wawa-vfx
Version:
A simple and easy-to-use library for creating visual effects in React Three Fiber.
1,387 lines • 312 kB
JavaScript
import { jsx as Fe, jsxs as Oa, Fragment as Ca } from "react/jsx-runtime";
import { useFrame as Pa, extend as vc } from "@react-three/fiber";
import * as _e from "react";
import g, { useCallback as B, forwardRef as ve, Children as _t, isValidElement as bn, createElement as ee, cloneElement as to, Fragment as Ta, useEffect as W, createContext as ht, useMemo as he, useContext as mt, useRef as C, useState as re, useLayoutEffect as Je, useReducer as no, useImperativeHandle as Mn, useDebugValue as bc } from "react";
import * as an from "three";
import { Vector3 as jn, Quaternion as Ra, Euler as ro, Matrix4 as yc, Color as wc, PlaneGeometry as $c, AdditiveBlending as Ec, DynamicDrawUsage as wt } from "three";
import * as xc from "react-dom";
import Sc, { flushSync as Aa } from "react-dom";
import { createRoot as _c } from "react-dom/client";
function Po(e, t) {
return e + Math.floor(Math.random() * (t - e + 1));
}
function xe(e, t) {
return e + Math.random() * (t - e);
}
function ye() {
return ye = Object.assign ? Object.assign.bind() : function(e) {
for (var t = 1; t < arguments.length; t++) {
var n = arguments[t];
for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
}
return e;
}, ye.apply(null, arguments);
}
function Oc(e, t) {
typeof e == "function" ? e(t) : e != null && (e.current = t);
}
function ka(...e) {
return (t) => e.forEach(
(n) => Oc(n, t)
);
}
function Pt(...e) {
return B(ka(...e), e);
}
const Da = /* @__PURE__ */ ve((e, t) => {
const { children: n, ...r } = e, o = _t.toArray(n), i = o.find(Cc);
if (i) {
const a = i.props.children, s = o.map((c) => c === i ? _t.count(a) > 1 ? _t.only(null) : /* @__PURE__ */ bn(a) ? a.props.children : null : c);
return /* @__PURE__ */ ee(Rr, ye({}, r, {
ref: t
}), /* @__PURE__ */ bn(a) ? /* @__PURE__ */ to(a, void 0, s) : null);
}
return /* @__PURE__ */ ee(Rr, ye({}, r, {
ref: t
}), n);
});
Da.displayName = "Slot";
const Rr = /* @__PURE__ */ ve((e, t) => {
const { children: n, ...r } = e;
return /* @__PURE__ */ bn(n) ? /* @__PURE__ */ to(n, {
...Pc(r, n.props),
ref: ka(t, n.ref)
}) : _t.count(n) > 1 ? _t.only(null) : null;
});
Rr.displayName = "SlotClone";
const Ia = ({ children: e }) => /* @__PURE__ */ ee(Ta, null, e);
function Cc(e) {
return /* @__PURE__ */ bn(e) && e.type === Ia;
}
function Pc(e, t) {
const n = {
...t
};
for (const r in t) {
const o = e[r], i = t[r];
/^on[A-Z]/.test(r) ? o && i ? n[r] = (...s) => {
i(...s), o(...s);
} : o && (n[r] = o) : r === "style" ? n[r] = {
...o,
...i
} : r === "className" && (n[r] = [
o,
i
].filter(Boolean).join(" "));
}
return {
...e,
...n
};
}
const Tc = [
"a",
"button",
"div",
"form",
"h2",
"h3",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"span",
"svg",
"ul"
], st = Tc.reduce((e, t) => {
const n = /* @__PURE__ */ ve((r, o) => {
const { asChild: i, ...a } = r, s = i ? Da : t;
return W(() => {
window[Symbol.for("radix-ui")] = !0;
}, []), /* @__PURE__ */ ee(s, ye({}, a, {
ref: o
}));
});
return n.displayName = `Primitive.${t}`, {
...e,
[t]: n
};
}, {});
function Rc(e, t) {
e && Aa(
() => e.dispatchEvent(t)
);
}
const Ac = /* @__PURE__ */ ve((e, t) => {
var n;
const { container: r = globalThis == null || (n = globalThis.document) === null || n === void 0 ? void 0 : n.body, ...o } = e;
return r ? /* @__PURE__ */ Sc.createPortal(/* @__PURE__ */ ee(st.div, ye({}, o, {
ref: t
})), r) : null;
}), kc = Ac;
var To = Object.prototype.hasOwnProperty;
function Yt(e, t) {
var n, r;
if (e === t) return !0;
if (e && t && (n = e.constructor) === t.constructor) {
if (n === Date) return e.getTime() === t.getTime();
if (n === RegExp) return e.toString() === t.toString();
if (n === Array) {
if ((r = e.length) === t.length)
for (; r-- && Yt(e[r], t[r]); ) ;
return r === -1;
}
if (!n || typeof e == "object") {
r = 0;
for (n in e)
if (To.call(e, n) && ++r && !To.call(t, n) || !(n in t) || !Yt(e[n], t[n])) return !1;
return Object.keys(t).length === r;
}
}
return e !== e && t !== t;
}
function Nn(e, t) {
if (Object.is(e, t))
return !0;
if (typeof e != "object" || e === null || typeof t != "object" || t === null)
return !1;
const n = Object.keys(e);
if (n.length !== Object.keys(t).length)
return !1;
for (let r = 0; r < n.length; r++)
if (!Object.prototype.hasOwnProperty.call(t, n[r]) || !Object.is(e[n[r]], t[n[r]]))
return !1;
return !0;
}
var Ln = function(t, n, r, o) {
this.name = t, this.fn = n, this.args = r, this.modifiers = o;
};
Ln.prototype._test = function(t) {
var n = this.fn;
try {
Ot(this.modifiers.slice(), n, this)(t);
} catch {
n = function() {
return !1;
};
}
try {
return Ot(this.modifiers.slice(), n, this)(t);
} catch {
return !1;
}
};
Ln.prototype._check = function(t) {
try {
Ot(this.modifiers.slice(), this.fn, this)(t);
} catch {
if (Ot(this.modifiers.slice(), function(r) {
return r;
}, this)(!1))
return;
}
if (!Ot(this.modifiers.slice(), this.fn, this)(t))
throw null;
};
Ln.prototype._testAsync = function(t) {
var n = this;
return new Promise(function(r, o) {
ja(
n.modifiers.slice(),
n.fn,
n
)(t).then(function(i) {
i ? r(t) : o(null);
}).catch(function(i) {
return o(i);
});
});
};
function Ma(e, t) {
return t === void 0 && (t = "simple"), typeof e == "object" ? e[t] : e;
}
function Ot(e, t, n) {
if (e.length) {
var r = e.shift(), o = Ot(e, t, n);
return r.perform(o, n);
} else
return Ma(t);
}
function ja(e, t, n) {
if (e.length) {
var r = e.shift(), o = ja(e, t, n);
return r.performAsync(o, n);
} else
return function(i) {
return Promise.resolve(Ma(t, "async")(i));
};
}
var Dc = function(t, n, r) {
this.name = t, this.perform = n, this.performAsync = r;
}, oo = /* @__PURE__ */ function(e) {
function t(n, r, o, i) {
for (var a = [], s = arguments.length - 4; s-- > 0; ) a[s] = arguments[s + 4];
e.call(this, a), e.captureStackTrace && e.captureStackTrace(this, t), this.rule = n, this.value = r, this.cause = o, this.target = i;
}
return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t;
}(Error), Be = function(t, n) {
t === void 0 && (t = []), n === void 0 && (n = []), this.chain = t, this.nextRuleModifiers = n;
};
Be.prototype._applyRule = function(t, n) {
var r = this;
return function() {
for (var o = [], i = arguments.length; i--; ) o[i] = arguments[i];
return r.chain.push(
new Ln(n, t.apply(r, o), o, r.nextRuleModifiers)
), r.nextRuleModifiers = [], r;
};
};
Be.prototype._applyModifier = function(t, n) {
return this.nextRuleModifiers.push(
new Dc(n, t.simple, t.async)
), this;
};
Be.prototype._clone = function() {
return new Be(this.chain.slice(), this.nextRuleModifiers.slice());
};
Be.prototype.test = function(t) {
return this.chain.every(function(n) {
return n._test(t);
});
};
Be.prototype.testAll = function(t) {
var n = [];
return this.chain.forEach(function(r) {
try {
r._check(t);
} catch (o) {
n.push(new oo(r, t, o));
}
}), n;
};
Be.prototype.check = function(t) {
this.chain.forEach(function(n) {
try {
n._check(t);
} catch (r) {
throw new oo(n, t, r);
}
});
};
Be.prototype.testAsync = function(t) {
var n = this;
return new Promise(function(r, o) {
Na(t, n.chain.slice(), r, o);
});
};
function Na(e, t, n, r) {
if (t.length) {
var o = t.shift();
o._testAsync(e).then(
function() {
Na(e, t, n, r);
},
function(i) {
r(new oo(o, e, i));
}
);
} else
n(e);
}
var Ro = function(e, t) {
return t && typeof e == "string" && e.trim().length === 0 ? !0 : e == null;
};
function Ic(e, t) {
return t === void 0 && (t = !1), {
simple: function(n) {
return Ro(n, t) || e.check(n) === void 0;
},
async: function(n) {
return Ro(n, t) || e.testAsync(n);
}
};
}
function Re() {
return typeof Proxy < "u" ? La(new Be()) : Ar(new Be());
}
var Kt = {};
Re.extend = function(e) {
Object.assign(Kt, e);
};
Re.clearCustomRules = function() {
Kt = {};
};
function La(e) {
return new Proxy(e, {
get: function(n, r) {
if (r in n)
return n[r];
var o = La(e._clone());
if (r in yn)
return o._applyModifier(yn[r], r);
if (r in Kt)
return o._applyRule(Kt[r], r);
if (r in kr)
return o._applyRule(kr[r], r);
}
});
}
function Ar(e) {
var t = function(o, i) {
return Object.keys(o).forEach(function(a) {
i[a] = function() {
for (var s = [], c = arguments.length; c--; ) s[c] = arguments[c];
var l = Ar(i._clone()), u = l._applyRule(
o[a],
a
).apply(void 0, s);
return u;
};
}), i;
}, n = t(kr, e), r = t(
Kt,
n
);
return Object.keys(yn).forEach(function(o) {
Object.defineProperty(r, o, {
get: function() {
var i = Ar(r._clone());
return i._applyModifier(yn[o], o);
}
});
}), r;
}
var yn = {
not: {
simple: function(e) {
return function(t) {
return !e(t);
};
},
async: function(e) {
return function(t) {
return Promise.resolve(e(t)).then(function(n) {
return !n;
}).catch(function() {
return !0;
});
};
}
},
some: {
simple: function(e) {
return function(t) {
return sn(t).some(function(n) {
try {
return e(n);
} catch {
return !1;
}
});
};
},
async: function(e) {
return function(t) {
return Promise.all(
sn(t).map(function(n) {
try {
return e(n).catch(function() {
return !1;
});
} catch {
return !1;
}
})
).then(function(n) {
return n.some(Boolean);
});
};
}
},
every: {
simple: function(e) {
return function(t) {
return t !== !1 && sn(t).every(e);
};
},
async: function(e) {
return function(t) {
return Promise.all(sn(t).map(e)).then(function(n) {
return n.every(Boolean);
});
};
}
},
strict: {
simple: function(e, t) {
return function(n) {
return Ao(t) && n && typeof n == "object" ? Object.keys(t.args[0]).length === Object.keys(n).length && e(n) : e(n);
};
},
async: function(e, t) {
return function(n) {
return Promise.resolve(e(n)).then(function(r) {
return Ao(t) && n && typeof n == "object" ? Object.keys(t.args[0]).length === Object.keys(n).length && r : r;
}).catch(function() {
return !1;
});
};
}
}
};
function Ao(e) {
return e && e.name === "schema" && e.args.length > 0 && typeof e.args[0] == "object";
}
function sn(e) {
return typeof e == "string" ? e.split("") : e;
}
var kr = {
// Value
equal: function(e) {
return function(t) {
return t == e;
};
},
exact: function(e) {
return function(t) {
return t === e;
};
},
// Types
number: function(e) {
return e === void 0 && (e = !0), function(t) {
return typeof t == "number" && (e || isFinite(t));
};
},
integer: function() {
return function(e) {
var t = Number.isInteger || Mc;
return t(e);
};
},
numeric: function() {
return function(e) {
return !isNaN(parseFloat(e)) && isFinite(e);
};
},
string: function() {
return $t("string");
},
boolean: function() {
return $t("boolean");
},
undefined: function() {
return $t("undefined");
},
null: function() {
return $t("null");
},
array: function() {
return $t("array");
},
object: function() {
return $t("object");
},
instanceOf: function(e) {
return function(t) {
return t instanceof e;
};
},
// Pattern
pattern: function(e) {
return function(t) {
return e.test(t);
};
},
lowercase: function() {
return function(e) {
return typeof e == "boolean" || e === e.toLowerCase() && e.trim() !== "";
};
},
uppercase: function() {
return function(e) {
return e === e.toUpperCase() && e.trim() !== "";
};
},
vowel: function() {
return function(e) {
return /^[aeiou]+$/i.test(e);
};
},
consonant: function() {
return function(e) {
return /^(?=[^aeiou])([a-z]+)$/i.test(e);
};
},
// Value at
first: function(e) {
return function(t) {
return t[0] == e;
};
},
last: function(e) {
return function(t) {
return t[t.length - 1] == e;
};
},
// Length
empty: function() {
return function(e) {
return e.length === 0;
};
},
length: function(e, t) {
return function(n) {
return n.length >= e && n.length <= (t || e);
};
},
minLength: function(e) {
return function(t) {
return t.length >= e;
};
},
maxLength: function(e) {
return function(t) {
return t.length <= e;
};
},
// Range
negative: function() {
return function(e) {
return e < 0;
};
},
positive: function() {
return function(e) {
return e >= 0;
};
},
between: function(e, t) {
return function(n) {
return n >= e && n <= t;
};
},
range: function(e, t) {
return function(n) {
return n >= e && n <= t;
};
},
lessThan: function(e) {
return function(t) {
return t < e;
};
},
lessThanOrEqual: function(e) {
return function(t) {
return t <= e;
};
},
greaterThan: function(e) {
return function(t) {
return t > e;
};
},
greaterThanOrEqual: function(e) {
return function(t) {
return t >= e;
};
},
// Divisible
even: function() {
return function(e) {
return e % 2 === 0;
};
},
odd: function() {
return function(e) {
return e % 2 !== 0;
};
},
includes: function(e) {
return function(t) {
return ~t.indexOf(e);
};
},
schema: function(e) {
return jc(e);
},
// branching
passesAnyOf: function() {
for (var e = [], t = arguments.length; t--; ) e[t] = arguments[t];
return function(n) {
return e.some(function(r) {
return r.test(n);
});
};
},
optional: Ic
};
function $t(e) {
return function(t) {
return Array.isArray(t) && e === "array" || t === null && e === "null" || typeof t === e;
};
}
function Mc(e) {
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
}
function jc(e) {
return {
simple: function(t) {
var n = [];
if (Object.keys(e).forEach(function(r) {
var o = e[r];
try {
o.check((t || {})[r]);
} catch (i) {
i.target = r, n.push(i);
}
}), n.length > 0)
throw n;
return !0;
},
async: function(t) {
var n = [], r = Object.keys(e).map(function(o) {
var i = e[o];
return i.testAsync((t || {})[o]).catch(function(a) {
a.target = o, n.push(a);
});
});
return Promise.all(r).then(function() {
if (n.length > 0)
throw n;
return !0;
});
}
};
}
var oe = "colors", Se = "sizes", D = "space", Nc = { gap: D, gridGap: D, columnGap: D, gridColumnGap: D, rowGap: D, gridRowGap: D, inset: D, insetBlock: D, insetBlockEnd: D, insetBlockStart: D, insetInline: D, insetInlineEnd: D, insetInlineStart: D, margin: D, marginTop: D, marginRight: D, marginBottom: D, marginLeft: D, marginBlock: D, marginBlockEnd: D, marginBlockStart: D, marginInline: D, marginInlineEnd: D, marginInlineStart: D, padding: D, paddingTop: D, paddingRight: D, paddingBottom: D, paddingLeft: D, paddingBlock: D, paddingBlockEnd: D, paddingBlockStart: D, paddingInline: D, paddingInlineEnd: D, paddingInlineStart: D, top: D, right: D, bottom: D, left: D, scrollMargin: D, scrollMarginTop: D, scrollMarginRight: D, scrollMarginBottom: D, scrollMarginLeft: D, scrollMarginX: D, scrollMarginY: D, scrollMarginBlock: D, scrollMarginBlockEnd: D, scrollMarginBlockStart: D, scrollMarginInline: D, scrollMarginInlineEnd: D, scrollMarginInlineStart: D, scrollPadding: D, scrollPaddingTop: D, scrollPaddingRight: D, scrollPaddingBottom: D, scrollPaddingLeft: D, scrollPaddingX: D, scrollPaddingY: D, scrollPaddingBlock: D, scrollPaddingBlockEnd: D, scrollPaddingBlockStart: D, scrollPaddingInline: D, scrollPaddingInlineEnd: D, scrollPaddingInlineStart: D, fontSize: "fontSizes", background: oe, backgroundColor: oe, backgroundImage: oe, borderImage: oe, border: oe, borderBlock: oe, borderBlockEnd: oe, borderBlockStart: oe, borderBottom: oe, borderBottomColor: oe, borderColor: oe, borderInline: oe, borderInlineEnd: oe, borderInlineStart: oe, borderLeft: oe, borderLeftColor: oe, borderRight: oe, borderRightColor: oe, borderTop: oe, borderTopColor: oe, caretColor: oe, color: oe, columnRuleColor: oe, fill: oe, outline: oe, outlineColor: oe, stroke: oe, textDecorationColor: oe, fontFamily: "fonts", fontWeight: "fontWeights", lineHeight: "lineHeights", letterSpacing: "letterSpacings", blockSize: Se, minBlockSize: Se, maxBlockSize: Se, inlineSize: Se, minInlineSize: Se, maxInlineSize: Se, width: Se, minWidth: Se, maxWidth: Se, height: Se, minHeight: Se, maxHeight: Se, flexBasis: Se, gridTemplateColumns: Se, gridTemplateRows: Se, borderWidth: "borderWidths", borderTopWidth: "borderWidths", borderRightWidth: "borderWidths", borderBottomWidth: "borderWidths", borderLeftWidth: "borderWidths", borderStyle: "borderStyles", borderTopStyle: "borderStyles", borderRightStyle: "borderStyles", borderBottomStyle: "borderStyles", borderLeftStyle: "borderStyles", borderRadius: "radii", borderTopLeftRadius: "radii", borderTopRightRadius: "radii", borderBottomRightRadius: "radii", borderBottomLeftRadius: "radii", boxShadow: "shadows", textShadow: "shadows", transition: "transitions", zIndex: "zIndices" }, Lc = (e, t) => typeof t == "function" ? { "()": Function.prototype.toString.call(t) } : t, Tt = () => {
const e = /* @__PURE__ */ Object.create(null);
return (t, n, ...r) => {
const o = ((i) => JSON.stringify(i, Lc))(t);
return o in e ? e[o] : e[o] = n(t, ...r);
};
}, dt = Symbol.for("sxs.internal"), io = (e, t) => Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)), ko = (e) => {
for (const t in e) return !0;
return !1;
}, { hasOwnProperty: zc } = Object.prototype, Dr = (e) => e.includes("-") ? e : e.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase()), Fc = /\s+(?![^()]*\))/, Et = (e) => (t) => e(...typeof t == "string" ? String(t).split(Fc) : [t]), Do = { appearance: (e) => ({ WebkitAppearance: e, appearance: e }), backfaceVisibility: (e) => ({ WebkitBackfaceVisibility: e, backfaceVisibility: e }), backdropFilter: (e) => ({ WebkitBackdropFilter: e, backdropFilter: e }), backgroundClip: (e) => ({ WebkitBackgroundClip: e, backgroundClip: e }), boxDecorationBreak: (e) => ({ WebkitBoxDecorationBreak: e, boxDecorationBreak: e }), clipPath: (e) => ({ WebkitClipPath: e, clipPath: e }), content: (e) => ({ content: e.includes('"') || e.includes("'") || /^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e) ? e : `"${e}"` }), hyphens: (e) => ({ WebkitHyphens: e, hyphens: e }), maskImage: (e) => ({ WebkitMaskImage: e, maskImage: e }), maskSize: (e) => ({ WebkitMaskSize: e, maskSize: e }), tabSize: (e) => ({ MozTabSize: e, tabSize: e }), textSizeAdjust: (e) => ({ WebkitTextSizeAdjust: e, textSizeAdjust: e }), userSelect: (e) => ({ WebkitUserSelect: e, userSelect: e }), marginBlock: Et((e, t) => ({ marginBlockStart: e, marginBlockEnd: t || e })), marginInline: Et((e, t) => ({ marginInlineStart: e, marginInlineEnd: t || e })), maxSize: Et((e, t) => ({ maxBlockSize: e, maxInlineSize: t || e })), minSize: Et((e, t) => ({ minBlockSize: e, minInlineSize: t || e })), paddingBlock: Et((e, t) => ({ paddingBlockStart: e, paddingBlockEnd: t || e })), paddingInline: Et((e, t) => ({ paddingInlineStart: e, paddingInlineEnd: t || e })) }, er = /([\d.]+)([^]*)/, Bc = (e, t) => e.length ? e.reduce((n, r) => (n.push(...t.map((o) => o.includes("&") ? o.replace(/&/g, /[ +>|~]/.test(r) && /&.*&/.test(o) ? `:is(${r})` : r) : r + " " + o)), n), []) : t, Wc = (e, t) => e in Uc && typeof t == "string" ? t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (n, r, o, i) => r + (o === "stretch" ? `-moz-available${i};${Dr(e)}:${r}-webkit-fill-available` : `-moz-fit-content${i};${Dr(e)}:${r}fit-content`) + i) : String(t), Uc = { blockSize: 1, height: 1, inlineSize: 1, maxBlockSize: 1, maxHeight: 1, maxInlineSize: 1, maxWidth: 1, minBlockSize: 1, minHeight: 1, minInlineSize: 1, minWidth: 1, width: 1 }, Xe = (e) => e ? e + "-" : "", za = (e, t, n) => e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, (r, o, i, a, s) => a == "$" == !!i ? r : (o || a == "--" ? "calc(" : "") + "var(--" + (a === "$" ? Xe(t) + (s.includes("$") ? "" : Xe(n)) + s.replace(/\$/g, "-") : s) + ")" + (o || a == "--" ? "*" + (o || "") + (i || "1") + ")" : "")), Hc = /\s*,\s*(?![^()]*\))/, Vc = Object.prototype.toString, St = (e, t, n, r, o) => {
let i, a, s;
const c = (l, u, f) => {
let d, p;
const m = (h) => {
for (d in h) {
const y = d.charCodeAt(0) === 64, E = y && Array.isArray(h[d]) ? h[d] : [h[d]];
for (p of E) {
const $ = /[A-Z]/.test(b = d) ? b : b.replace(/-[^]/g, (x) => x[1].toUpperCase()), w = typeof p == "object" && p && p.toString === Vc && (!r.utils[$] || !u.length);
if ($ in r.utils && !w) {
const x = r.utils[$];
if (x !== a) {
a = x, m(x(p)), a = null;
continue;
}
} else if ($ in Do) {
const x = Do[$];
if (x !== s) {
s = x, m(x(p)), s = null;
continue;
}
}
if (y && (v = d.slice(1) in r.media ? "@media " + r.media[d.slice(1)] : d, d = v.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g, (x, _, O, M, k, R) => {
const I = er.test(_), L = 0.0625 * (I ? -1 : 1), [K, q] = I ? [M, _] : [_, M];
return "(" + (O[0] === "=" ? "" : O[0] === ">" === I ? "max-" : "min-") + K + ":" + (O[0] !== "=" && O.length === 1 ? q.replace(er, (Q, ae, se) => Number(ae) + L * (O === ">" ? 1 : -1) + se) : q) + (k ? ") and (" + (k[0] === ">" ? "min-" : "max-") + K + ":" + (k.length === 1 ? R.replace(er, (Q, ae, se) => Number(ae) + L * (k === ">" ? -1 : 1) + se) : R) : "") + ")";
})), w) {
const x = y ? f.concat(d) : [...f], _ = y ? [...u] : Bc(u, d.split(Hc));
i !== void 0 && o(Io(...i)), i = void 0, c(p, _, x);
} else i === void 0 && (i = [[], u, f]), d = y || d.charCodeAt(0) !== 36 ? d : `--${Xe(r.prefix)}${d.slice(1).replace(/\$/g, "-")}`, p = w ? p : typeof p == "number" ? p && $ in Yc ? String(p) + "px" : String(p) : za(Wc($, p ?? ""), r.prefix, r.themeMap[$]), i[0].push(`${y ? `${d} ` : `${Dr(d)}:`}${p}`);
}
}
var v, b;
};
m(l), i !== void 0 && o(Io(...i)), i = void 0;
};
c(e, t, n);
}, Io = (e, t, n) => `${n.map((r) => `${r}{`).join("")}${t.length ? `${t.join(",")}{` : ""}${e.join(";")}${t.length ? "}" : ""}${Array(n.length ? n.length + 1 : 0).join("}")}`, Yc = { animationDelay: 1, animationDuration: 1, backgroundSize: 1, blockSize: 1, border: 1, borderBlock: 1, borderBlockEnd: 1, borderBlockEndWidth: 1, borderBlockStart: 1, borderBlockStartWidth: 1, borderBlockWidth: 1, borderBottom: 1, borderBottomLeftRadius: 1, borderBottomRightRadius: 1, borderBottomWidth: 1, borderEndEndRadius: 1, borderEndStartRadius: 1, borderInlineEnd: 1, borderInlineEndWidth: 1, borderInlineStart: 1, borderInlineStartWidth: 1, borderInlineWidth: 1, borderLeft: 1, borderLeftWidth: 1, borderRadius: 1, borderRight: 1, borderRightWidth: 1, borderSpacing: 1, borderStartEndRadius: 1, borderStartStartRadius: 1, borderTop: 1, borderTopLeftRadius: 1, borderTopRightRadius: 1, borderTopWidth: 1, borderWidth: 1, bottom: 1, columnGap: 1, columnRule: 1, columnRuleWidth: 1, columnWidth: 1, containIntrinsicSize: 1, flexBasis: 1, fontSize: 1, gap: 1, gridAutoColumns: 1, gridAutoRows: 1, gridTemplateColumns: 1, gridTemplateRows: 1, height: 1, inlineSize: 1, inset: 1, insetBlock: 1, insetBlockEnd: 1, insetBlockStart: 1, insetInline: 1, insetInlineEnd: 1, insetInlineStart: 1, left: 1, letterSpacing: 1, margin: 1, marginBlock: 1, marginBlockEnd: 1, marginBlockStart: 1, marginBottom: 1, marginInline: 1, marginInlineEnd: 1, marginInlineStart: 1, marginLeft: 1, marginRight: 1, marginTop: 1, maxBlockSize: 1, maxHeight: 1, maxInlineSize: 1, maxWidth: 1, minBlockSize: 1, minHeight: 1, minInlineSize: 1, minWidth: 1, offsetDistance: 1, offsetRotate: 1, outline: 1, outlineOffset: 1, outlineWidth: 1, overflowClipMargin: 1, padding: 1, paddingBlock: 1, paddingBlockEnd: 1, paddingBlockStart: 1, paddingBottom: 1, paddingInline: 1, paddingInlineEnd: 1, paddingInlineStart: 1, paddingLeft: 1, paddingRight: 1, paddingTop: 1, perspective: 1, right: 1, rowGap: 1, scrollMargin: 1, scrollMarginBlock: 1, scrollMarginBlockEnd: 1, scrollMarginBlockStart: 1, scrollMarginBottom: 1, scrollMarginInline: 1, scrollMarginInlineEnd: 1, scrollMarginInlineStart: 1, scrollMarginLeft: 1, scrollMarginRight: 1, scrollMarginTop: 1, scrollPadding: 1, scrollPaddingBlock: 1, scrollPaddingBlockEnd: 1, scrollPaddingBlockStart: 1, scrollPaddingBottom: 1, scrollPaddingInline: 1, scrollPaddingInlineEnd: 1, scrollPaddingInlineStart: 1, scrollPaddingLeft: 1, scrollPaddingRight: 1, scrollPaddingTop: 1, shapeMargin: 1, textDecoration: 1, textDecorationThickness: 1, textIndent: 1, textUnderlineOffset: 1, top: 1, transitionDelay: 1, transitionDuration: 1, verticalAlign: 1, width: 1, wordSpacing: 1 }, Mo = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), pt = (e) => ((t) => {
let n, r = "";
for (n = Math.abs(t); n > 52; n = n / 52 | 0) r = Mo(n % 52) + r;
return Mo(n % 52) + r;
})(((t, n) => {
let r = n.length;
for (; r; ) t = 33 * t ^ n.charCodeAt(--r);
return t;
})(5381, JSON.stringify(e)) >>> 0), Ft = ["themed", "global", "styled", "onevar", "resonevar", "allvar", "inline"], Kc = (e) => {
if (e.href && !e.href.startsWith(location.origin)) return !1;
try {
return !!e.cssRules;
} catch {
return !1;
}
}, qc = (e) => {
let t;
const n = () => {
const { cssRules: o } = t.sheet;
return [].map.call(o, (i, a) => {
const { cssText: s } = i;
let c = "";
if (s.startsWith("--sxs")) return "";
if (o[a - 1] && (c = o[a - 1].cssText).startsWith("--sxs")) {
if (!i.cssRules.length) return "";
for (const l in t.rules) if (t.rules[l].group === i) return `--sxs{--sxs:${[...t.rules[l].cache].join(" ")}}${s}`;
return i.cssRules.length ? `${c}${s}` : "";
}
return s;
}).join("");
}, r = () => {
if (t) {
const { rules: s, sheet: c } = t;
if (!c.deleteRule) {
for (; Object(Object(c.cssRules)[0]).type === 3; ) c.cssRules.splice(0, 1);
c.cssRules = [];
}
for (const l in s) delete s[l];
}
const o = Object(e).styleSheets || [];
for (const s of o) if (Kc(s)) {
for (let c = 0, l = s.cssRules; l[c]; ++c) {
const u = Object(l[c]);
if (u.type !== 1) continue;
const f = Object(l[c + 1]);
if (f.type !== 4) continue;
++c;
const { cssText: d } = u;
if (!d.startsWith("--sxs")) continue;
const p = d.slice(14, -3).trim().split(/\s+/), m = Ft[p[0]];
m && (t || (t = { sheet: s, reset: r, rules: {}, toString: n }), t.rules[m] = { group: f, index: c, cache: new Set(p) });
}
if (t) break;
}
if (!t) {
const s = (c, l) => ({ type: l, cssRules: [], insertRule(u, f) {
this.cssRules.splice(f, 0, s(u, { import: 3, undefined: 1 }[(u.toLowerCase().match(/^@([a-z]+)/) || [])[1]] || 4));
}, get cssText() {
return c === "@media{}" ? `@media{${[].map.call(this.cssRules, (u) => u.cssText).join("")}}` : c;
} });
t = { sheet: e ? (e.head || e).appendChild(document.createElement("style")).sheet : s("", "text/css"), rules: {}, reset: r, toString: n };
}
const { sheet: i, rules: a } = t;
for (let s = Ft.length - 1; s >= 0; --s) {
const c = Ft[s];
if (!a[c]) {
const l = Ft[s + 1], u = a[l] ? a[l].index : i.cssRules.length;
i.insertRule("@media{}", u), i.insertRule(`--sxs{--sxs:${s}}`, u), a[c] = { group: i.cssRules[u + 1], index: u, cache: /* @__PURE__ */ new Set([s]) };
}
Gc(a[c]);
}
};
return r(), t;
}, Gc = (e) => {
const t = e.group;
let n = t.cssRules.length;
e.apply = (r) => {
try {
t.insertRule(r, n), ++n;
} catch {
}
};
}, Nt = Symbol(), Xc = Tt(), jo = (e, t) => Xc(e, () => (...n) => {
let r = { type: null, composers: /* @__PURE__ */ new Set() };
for (const o of n) if (o != null) if (o[dt]) {
r.type == null && (r.type = o[dt].type);
for (const i of o[dt].composers) r.composers.add(i);
} else o.constructor !== Object || o.$$typeof ? r.type == null && (r.type = o) : r.composers.add(Jc(o, e));
return r.type == null && (r.type = "span"), r.composers.size || r.composers.add(["PJLV", {}, [], [], {}, []]), Zc(e, r, t);
}), Jc = ({ variants: e, compoundVariants: t, defaultVariants: n, ...r }, o) => {
const i = `${Xe(o.prefix)}c-${pt(r)}`, a = [], s = [], c = /* @__PURE__ */ Object.create(null), l = [];
for (const d in n) c[d] = String(n[d]);
if (typeof e == "object" && e) for (const d in e) {
u = c, f = d, zc.call(u, f) || (c[d] = "undefined");
const p = e[d];
for (const m in p) {
const h = { [d]: String(m) };
String(m) === "undefined" && l.push(d);
const v = p[m], b = [h, v, !ko(v)];
a.push(b);
}
}
var u, f;
if (typeof t == "object" && t) for (const d of t) {
let { css: p, ...m } = d;
p = typeof p == "object" && p || {};
for (const v in m) m[v] = String(m[v]);
const h = [m, p, !ko(p)];
s.push(h);
}
return [i, r, a, s, c, l];
}, Zc = (e, t, n) => {
const [r, o, i, a] = Qc(t.composers), s = typeof t.type == "function" || t.type.$$typeof ? ((f) => {
function d() {
for (let p = 0; p < d[Nt].length; p++) {
const [m, h] = d[Nt][p];
f.rules[m].apply(h);
}
return d[Nt] = [], null;
}
return d[Nt] = [], d.rules = {}, Ft.forEach((p) => d.rules[p] = { apply: (m) => d[Nt].push([p, m]) }), d;
})(n) : null, c = (s || n).rules, l = `.${r}${o.length > 1 ? `:where(.${o.slice(1).join(".")})` : ""}`, u = (f) => {
f = typeof f == "object" && f || el;
const { css: d, ...p } = f, m = {};
for (const b in i) if (delete p[b], b in f) {
let y = f[b];
typeof y == "object" && y ? m[b] = { "@initial": i[b], ...y } : (y = String(y), m[b] = y !== "undefined" || a.has(b) ? y : i[b]);
} else m[b] = i[b];
const h = /* @__PURE__ */ new Set([...o]);
for (const [b, y, E, $] of t.composers) {
n.rules.styled.cache.has(b) || (n.rules.styled.cache.add(b), St(y, [`.${b}`], [], e, (_) => {
c.styled.apply(_);
}));
const w = No(E, m, e.media), x = No($, m, e.media, !0);
for (const _ of w) if (_ !== void 0) for (const [O, M, k] of _) {
const R = `${b}-${pt(M)}-${O}`;
h.add(R);
const I = (k ? n.rules.resonevar : n.rules.onevar).cache, L = k ? c.resonevar : c.onevar;
I.has(R) || (I.add(R), St(M, [`.${R}`], [], e, (K) => {
L.apply(K);
}));
}
for (const _ of x) if (_ !== void 0) for (const [O, M] of _) {
const k = `${b}-${pt(M)}-${O}`;
h.add(k), n.rules.allvar.cache.has(k) || (n.rules.allvar.cache.add(k), St(M, [`.${k}`], [], e, (R) => {
c.allvar.apply(R);
}));
}
}
if (typeof d == "object" && d) {
const b = `${r}-i${pt(d)}-css`;
h.add(b), n.rules.inline.cache.has(b) || (n.rules.inline.cache.add(b), St(d, [`.${b}`], [], e, (y) => {
c.inline.apply(y);
}));
}
for (const b of String(f.className || "").trim().split(/\s+/)) b && h.add(b);
const v = p.className = [...h].join(" ");
return { type: t.type, className: v, selector: l, props: p, toString: () => v, deferredInjector: s };
};
return io(u, { className: r, selector: l, [dt]: t, toString: () => (n.rules.styled.cache.has(r) || u(), r) });
}, Qc = (e) => {
let t = "";
const n = [], r = {}, o = [];
for (const [i, , , , a, s] of e) {
t === "" && (t = i), n.push(i), o.push(...s);
for (const c in a) {
const l = a[c];
(r[c] === void 0 || l !== "undefined" || s.includes(l)) && (r[c] = l);
}
}
return [t, n, r, new Set(o)];
}, No = (e, t, n, r) => {
const o = [];
e: for (let [i, a, s] of e) {
if (s) continue;
let c, l = 0, u = !1;
for (c in i) {
const f = i[c];
let d = t[c];
if (d !== f) {
if (typeof d != "object" || !d) continue e;
{
let p, m, h = 0;
for (const v in d) {
if (f === String(d[v])) {
if (v !== "@initial") {
const b = v.slice(1);
(m = m || []).push(b in n ? n[b] : v.replace(/^@media ?/, "")), u = !0;
}
l += h, p = !0;
}
++h;
}
if (m && m.length && (a = { ["@media " + m.join(", ")]: a }), !p) continue e;
}
}
}
(o[l] = o[l] || []).push([r ? "cv" : `${c}-${i[c]}`, a, u]);
}
return o;
}, el = {}, tl = Tt(), nl = (e, t) => tl(e, () => (...n) => {
const r = () => {
for (let o of n) {
o = typeof o == "object" && o || {};
let i = pt(o);
if (!t.rules.global.cache.has(i)) {
if (t.rules.global.cache.add(i), "@import" in o) {
let a = [].indexOf.call(t.sheet.cssRules, t.rules.themed.group) - 1;
for (let s of [].concat(o["@import"])) s = s.includes('"') || s.includes("'") ? s : `"${s}"`, t.sheet.insertRule(`@import ${s};`, a++);
delete o["@import"];
}
St(o, [], [], e, (a) => {
t.rules.global.apply(a);
});
}
}
return "";
};
return io(r, { toString: r });
}), rl = Tt(), ol = (e, t) => rl(e, () => (n) => {
const r = `${Xe(e.prefix)}k-${pt(n)}`, o = () => {
if (!t.rules.global.cache.has(r)) {
t.rules.global.cache.add(r);
const i = [];
St(n, [], [], e, (s) => i.push(s));
const a = `@keyframes ${r}{${i.join("")}}`;
t.rules.global.apply(a);
}
return r;
};
return io(o, { get name() {
return o();
}, toString: o });
}), il = class {
constructor(e, t, n, r) {
this.token = e == null ? "" : String(e), this.value = t == null ? "" : String(t), this.scale = n == null ? "" : String(n), this.prefix = r == null ? "" : String(r);
}
get computedValue() {
return "var(" + this.variable + ")";
}
get variable() {
return "--" + Xe(this.prefix) + Xe(this.scale) + this.token;
}
toString() {
return this.computedValue;
}
}, al = Tt(), sl = (e, t) => al(e, () => (n, r) => {
r = typeof n == "object" && n || Object(r);
const o = `.${n = (n = typeof n == "string" ? n : "") || `${Xe(e.prefix)}t-${pt(r)}`}`, i = {}, a = [];
for (const c in r) {
i[c] = {};
for (const l in r[c]) {
const u = `--${Xe(e.prefix)}${c}-${l}`, f = za(String(r[c][l]), e.prefix, c);
i[c][l] = new il(l, f, c, e.prefix), a.push(`${u}:${f}`);
}
}
const s = () => {
if (a.length && !t.rules.themed.cache.has(n)) {
t.rules.themed.cache.add(n);
const c = `${r === e.theme ? ":root," : ""}.${n}{${a.join(";")}}`;
t.rules.themed.apply(c);
}
return n;
};
return { ...i, get className() {
return s();
}, selector: o, toString: s };
}), cl = Tt(), ll = Tt(), ul = (e) => {
const t = ((n) => {
let r = !1;
const o = cl(n, (i) => {
r = !0;
const a = "prefix" in (i = typeof i == "object" && i || {}) ? String(i.prefix) : "", s = typeof i.media == "object" && i.media || {}, c = typeof i.root == "object" ? i.root || null : globalThis.document || null, l = typeof i.theme == "object" && i.theme || {}, u = { prefix: a, media: s, theme: l, themeMap: typeof i.themeMap == "object" && i.themeMap || { ...Nc }, utils: typeof i.utils == "object" && i.utils || {} }, f = qc(c), d = { css: jo(u, f), globalCss: nl(u, f), keyframes: ol(u, f), createTheme: sl(u, f), reset() {
f.reset(), d.theme.toString();
}, theme: {}, sheet: f, config: u, prefix: a, getCssText: f.toString, toString: f.toString };
return String(d.theme = d.createTheme(l)), d;
});
return r || o.reset(), o;
})(e);
return t.styled = (({ config: n, sheet: r }) => ll(n, () => {
const o = jo(n, r);
return (...i) => {
const a = o(...i), s = a[dt].type, c = g.forwardRef((l, u) => {
const f = l && l.as || s, { props: d, deferredInjector: p } = a(l);
return delete d.as, d.ref = u, p ? g.createElement(g.Fragment, null, g.createElement(f, d), g.createElement(p, null)) : g.createElement(f, d);
});
return c.className = a.className, c.displayName = `Styled.${s.displayName || s.name || s}`, c.selector = a.selector, c.toString = () => a.selector, c[dt] = a[dt], c;
};
}))(t), t;
};
function fl(e, t, n) {
return Math.max(t, Math.min(e, n));
}
const $e = {
toVector(e, t) {
return e === void 0 && (e = t), Array.isArray(e) ? e : [e, e];
},
add(e, t) {
return [e[0] + t[0], e[1] + t[1]];
},
sub(e, t) {
return [e[0] - t[0], e[1] - t[1]];
},
addTo(e, t) {
e[0] += t[0], e[1] += t[1];
},
subTo(e, t) {
e[0] -= t[0], e[1] -= t[1];
}
};
function Lo(e, t, n) {
return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(e, n * 5) : e * t * n / (t + n * e);
}
function zo(e, t, n, r = 0.15) {
return r === 0 ? fl(e, t, n) : e < t ? -Lo(t - e, n - t, r) + t : e > n ? +Lo(e - n, n - t, r) + n : e;
}
function dl(e, [t, n], [r, o]) {
const [[i, a], [s, c]] = e;
return [zo(t, i, a, r), zo(n, s, c, o)];
}
function pl(e, t) {
if (typeof e != "object" || e === null) return e;
var n = e[Symbol.toPrimitive];
if (n !== void 0) {
var r = n.call(e, t);
if (typeof r != "object") return r;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
function hl(e) {
var t = pl(e, "string");
return typeof t == "symbol" ? t : String(t);
}
function Te(e, t, n) {
return t = hl(t), t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e;
}
function Fo(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t && (r = r.filter(function(o) {
return Object.getOwnPropertyDescriptor(e, o).enumerable;
})), n.push.apply(n, r);
}
return n;
}
function fe(e) {
for (var t = 1; t < arguments.length; t++) {
var n = arguments[t] != null ? arguments[t] : {};
t % 2 ? Fo(Object(n), !0).forEach(function(r) {
Te(e, r, n[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Fo(Object(n)).forEach(function(r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
});
}
return e;
}
const Fa = {
pointer: {
start: "down",
change: "move",
end: "up"
},
mouse: {
start: "down",
change: "move",
end: "up"
},
touch: {
start: "start",
change: "move",
end: "end"
},
gesture: {
start: "start",
change: "change",
end: "end"
}
};
function Bo(e) {
return e ? e[0].toUpperCase() + e.slice(1) : "";
}
const gl = ["enter", "leave"];
function ml(e = !1, t) {
return e && !gl.includes(t);
}
function vl(e, t = "", n = !1) {
const r = Fa[e], o = r && r[t] || t;
return "on" + Bo(e) + Bo(o) + (ml(n, o) ? "Capture" : "");
}
const bl = ["gotpointercapture", "lostpointercapture"];
function yl(e) {
let t = e.substring(2).toLowerCase();
const n = !!~t.indexOf("passive");
n && (t = t.replace("passive", ""));
const r = bl.includes(t) ? "capturecapture" : "capture", o = !!~t.indexOf(r);
return o && (t = t.replace("capture", "")), {
device: t,
capture: o,
passive: n
};
}
function wl(e, t = "") {
const n = Fa[e], r = n && n[t] || t;
return e + r;
}
function zn(e) {
return "touches" in e;
}
function Ba(e) {
return zn(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
}
function $l(e) {
return Array.from(e.touches).filter((t) => {
var n, r;
return t.target === e.currentTarget || ((n = e.currentTarget) === null || n === void 0 || (r = n.contains) === null || r === void 0 ? void 0 : r.call(n, t.target));
});
}
function El(e) {
return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
}
function Wa(e) {
return zn(e) ? El(e)[0] : e;
}
function xl(e) {
return $l(e).map((t) => t.identifier);
}
function tr(e) {
const t = Wa(e);
return zn(e) ? t.identifier : t.pointerId;
}
function Wo(e) {
const t = Wa(e);
return [t.clientX, t.clientY];
}
function Sl(e) {
const t = {};
if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
const {
shiftKey: n,
altKey: r,
metaKey: o,
ctrlKey: i
} = e;
Object.assign(t, {
shiftKey: n,
altKey: r,
metaKey: o,
ctrlKey: i
});
}
return t;
}
function wn(e, ...t) {
return typeof e == "function" ? e(...t) : e;
}
function _l() {
}
function Ol(...e) {
return e.length === 0 ? _l : e.length === 1 ? e[0] : function() {
let t;
for (const n of e)
t = n.apply(this, arguments) || t;
return t;
};
}
function Uo(e, t) {
return Object.assign({}, t, e || {});
}
const Cl = 32;
class Pl {
constructor(t, n, r) {
this.ctrl = t, this.args = n, this.key = r, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
}
get state() {
return this.ctrl.state[this.key];
}
set state(t) {
this.ctrl.state[this.key] = t;
}
get shared() {
return this.ctrl.state.shared;
}
get eventStore() {
return this.ctrl.gestureEventStores[this.key];
}
get timeoutStore() {
return this.ctrl.gestureTimeoutStores[this.key];
}
get config() {
return this.ctrl.config[this.key];
}
get sharedConfig() {
return this.ctrl.config.shared;
}
get handler() {
return this.ctrl.handlers[this.key];
}
reset() {
const {
state: t,
shared: n,
ingKey: r,
args: o
} = this;
n[r] = t._active = t.active = t._blocked = t._force = !1, t._step = [!1, !1], t.intentional = !1, t._movement = [0, 0], t._distance = [0, 0], t._direction = [0, 0], t._delta = [0, 0], t._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], t.args = o, t.axis = void 0, t.memo = void 0, t.elapsedTime = t.timeDelta = 0, t.direction = [0, 0], t.distance = [0, 0], t.overflow = [0, 0], t._movementBound = [!1, !1], t.velocity = [0, 0], t.movement = [0, 0], t.delta = [0, 0], t.timeStamp = 0;
}
start(t) {
const n = this.state, r = this.config;
n._active || (this.reset(), this.computeInitial(), n._active = !0, n.target = t.target, n.currentTarget = t.currentTarget, n.lastOffset = r.from ? wn(r.from, n) : n.offset, n.offset = n.lastOffset, n.startTime = n.timeStamp = t.timeStamp);
}
computeValues(t) {
const n = this.state;
n._values = t, n.values = this.config.transform(t);
}
computeInitial() {
const t = this.state;
t._initial = t._values, t.initial = t.values;
}
compute(t) {
const {
state: n,
config: r,
shared: o
} = this;
n.args = this.args;
let i = 0;
if (t && (n.event = t, r.preventDefault && t.cancelable && n.event.preventDefault(), n.type = t.type, o.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, o.locked = !!document.pointerLockElement, Object.assign(o, Sl(t)), o.down = o.pressed = o.buttons % 2 === 1 || o.touches > 0, i = t.timeStamp - n.timeStamp, n.timeStamp = t.timeStamp, n.elapsedTime = n.timeStamp - n.startTime), n._active) {
const x = n._delta.map(Math.abs);
$e.addTo(n._distance, x);
}
this.axisIntent && this.axisIntent(t);
const [a, s] = n._movement, [c, l] = r.threshold, {
_step: u,
values: f
} = n;
if (r.hasCustomTransform ? (u[0] === !1 && (u[0] = Math.abs(a) >= c && f[0]), u[1] === !1 && (u[1] = Math.abs(s) >= l && f[1])) : (u[0] === !1 && (u[0] = Math.abs(a) >= c && Math.sign(a) * c), u[1] === !1 && (u[1] = Math.abs(s) >= l && Math.sign(s) * l)), n.intentional = u[0] !== !1 || u[1] !== !1, !n.intentional) return;
const d = [0, 0];
if (r.hasCustomTransform) {
const [x, _] = f;
d[0] = u[0] !== !1 ? x - u[0] : 0, d[1] = u[1] !== !1 ? _ - u[1] : 0;
} else
d[0] = u[0] !== !1 ? a - u[0] : 0, d[1] = u[1] !== !1 ? s - u[1] : 0;
this.restrictToAxis && !n._blocked && this.restrictToAxis(d);
const p = n.offset, m = n._active && !n._blocked || n.active;
m && (n.first = n._active && !n.active, n.last = !n._active && n.active, n.active = o[this.ingKey] = n._active, t && (n.first && ("bounds" in r && (n._bounds = wn(r.bounds, n)), this.setup && this.setup()), n.movement = d, this.computeOffset()));
const [h, v] = n.offset, [[b, y], [E, $]] = n._bounds;
n.overflow = [h < b ? -1 : h > y ? 1 : 0, v < E ? -1 : v > $ ? 1 : 0], n._movementBound[0] = n.overflow[0] ? n._movementBound[0] === !1 ? n._movement[0] : n._movementBound[0] : !1, n._movementBound[1] = n.overflow[1] ? n._movementBound[1] === !1 ? n._movement[1] : n._movementBound[1] : !1;
const w = n._active ? r.rubberband || [0, 0] : [0, 0];
if (n.offset = dl(n._bounds, n.offset, w), n.delta = $e.sub(n.offset, p), this.computeMovement(), m && (!n.last || i > Cl)) {
n.delta = $e.sub(n.offset, p);
const x = n.delta.map(Math.abs);
$e.addTo(n.distance, x), n.direction = n.delta.map(Math.sign), n._direction = n._delta.map(Math.sign), !n.first && i > 0 && (n.velocity = [x[0] / i, x[1] / i], n.timeDelta = i);
}
}
emit() {
const t = this.state, n = this.shared, r = this.config;
if (t._active || this.clean(), (t._blocked || !t.intentional) && !t._force && !r.triggerAllEvents) return;
const o = this.handler(fe(fe(fe({}, n), t), {}, {
[this.aliasKey]: t.values
}));
o !== void 0 && (t.memo = o);
}
clean() {
this.eventStore.clean(), this.timeoutStore.clean();
}
}
function Tl([e, t], n) {
const r = Math.abs(e), o = Math.abs(t);
if (r > o && r > n)
return "x";
if (o > r && o > n)
return "y";
}
class Rl extends Pl {
constructor(...t) {
super(...t), Te(this, "aliasKey", "xy");
}
reset() {
super.reset(), this.state.axis = void 0;
}
init() {
this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
}
computeOffset() {
this.state.offset = $e.add(this.state.lastOffset, this.state.movement);
}
computeMovement() {
this.state.movement = $e.sub(this.state.offset, this.state.lastOffset);
}
axisIntent(t) {
const n = this.state, r = this.config;
if (!n.axis && t) {
const o = typeof r.axisThreshold == "object" ? r.axisThreshold[Ba(t)] : r.axisThreshold;
n.axis = Tl(n._movement, o);
}
n._blocked = (r.lockDirection || !!r.axis) && !n.axis || !!r.axis && r.axis !== n.axis;
}
restrictToAxis(t) {
if (this.config.axis || this.config.lockDirection)
switch (this.state.axis) {
case "x":
t[1] = 0;
break;
case "y":
t[0] = 0;
break;
}
}
}
const Ho = (e) => e, Vo = 0.15, ao = {
enabled(e = !0) {
return e;
},
eventOptions(e, t, n) {
return fe(fe({}, n.shared.eventOptions), e);
},
preventDefault(e = !1) {
return e;
},
triggerAllEvents(e = !1) {
return e;
},
rubberband(e = 0) {
switch (e) {
case !0:
return [Vo, Vo];
case !1:
return [0, 0];
default:
return $e.toVector(e);
}
},
from(e) {
if (typeof e == "function") return e;
if (e != null) return $e.toVector(e);
},
transform(e, t, n) {
const r = e || n.shared.transform;
if (this.hasCustomTransform = !!r, process.env.NODE_ENV === "development") {
const o = r || Ho;
return (i) => {
const a = o(i);
return (!isFinite(a[0]) || !isFinite(a[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${a[0]},${[1]}]`), a;
};
}
return r || Ho;
},
threshold(e) {
return $e.toVector(e, 0);
}
};
process.env.NODE_ENV === "development" && Object.assign(ao, {
domTarget(e) {
if (e !== void 0)
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
return NaN;
},
lockDirection(e) {
if (e !== void 0)
throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
return NaN;
},
initial(e) {
if (e !== void 0)
throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
return NaN;
}
});
const Al = 0, Xt = fe(fe({}, ao), {}, {
axis(e, t, {
axis: n
}) {
if (this.lockDirection = n === "lock", !this.lockDirection) return n;
},
axisThreshold(e = Al) {
r