quantum-component-library 1.4.45-qa.4 → 1.4.45-qa.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{babel-vendor-Brd7V25k.js → babel-vendor-BOM86iTb.js} +71 -76
  2. package/dist/babel-vendor-cKvSpnBp.cjs +3 -0
  3. package/dist/components.cjs +1 -1
  4. package/dist/components.js +49 -49
  5. package/dist/{dnd-core-vendor-GeFJIrqw.js → dnd-core-vendor-LFMXiCD5.js} +2 -2
  6. package/dist/{dnd-core-vendor-DFyhudg3.cjs → dnd-core-vendor-rqY4Q0Vq.cjs} +1 -1
  7. package/dist/{graphql-vendor-Bp1AYkpN.cjs → graphql-vendor-DRps04BT.cjs} +1 -1
  8. package/dist/{graphql-vendor-D5ETG7wB.js → graphql-vendor-DUv16c0G.js} +1 -1
  9. package/dist/hooks.cjs +1 -1
  10. package/dist/hooks.js +1 -1
  11. package/dist/lodash-vendor-D5A6v3mw.cjs +1 -0
  12. package/dist/lodash-vendor-Dz4vW7Gd.js +1120 -0
  13. package/dist/providers.cjs +1 -1
  14. package/dist/providers.js +6 -6
  15. package/dist/quantum-component-library.css +1 -1
  16. package/dist/{react-dnd-vendor-bl4guadi.js → react-dnd-vendor-Cuc51Scz.js} +24 -24
  17. package/dist/{react-dnd-vendor-CQ6n_Iry.cjs → react-dnd-vendor-FieaWO8Z.cjs} +1 -1
  18. package/dist/{react-select-vendor-CM41In8Q.js → react-select-vendor-BrXjJVof.js} +35 -35
  19. package/dist/{react-select-vendor-qYWfPIoq.cjs → react-select-vendor-CVxjkFXv.cjs} +1 -1
  20. package/dist/services.cjs +1 -1
  21. package/dist/services.js +1 -1
  22. package/dist/types.cjs +1 -1
  23. package/dist/types.js +1 -1
  24. package/dist/utils.cjs +1 -1
  25. package/dist/utils.js +11 -11
  26. package/dist/vendor-CPJGEWOn.cjs +45 -0
  27. package/dist/vendor-CoDHTSgb.js +7981 -0
  28. package/package.json +3 -3
  29. package/dist/babel-vendor-pl7onWh-.cjs +0 -3
  30. package/dist/framer-motion-vendor-BpR8WNZk.js +0 -2945
  31. package/dist/framer-motion-vendor-DmZv69_a.cjs +0 -9
  32. package/dist/lodash-vendor-Dkc3o8vE.cjs +0 -1
  33. package/dist/lodash-vendor-KQku4vKh.js +0 -1602
  34. package/dist/ui-vendor-CDpwLSe-.cjs +0 -294
  35. package/dist/ui-vendor-CTkR2JkD.js +0 -10756
  36. package/dist/vendor-D0fSwmdY.cjs +0 -90
  37. package/dist/vendor-DxZbxm3m.js +0 -13085
@@ -1,2945 +0,0 @@
1
- import { j as k, i as pi, a as _t, t as et, b as Kt, g as fn, n as dn, d as D, p as ot, w as gi, e as mn, f as pn, m as S, h as Q, K as yi, k as Xt, l as T, o as H, q as vi, r as Pi, s as xi, v as kt, x as Ti, S as gn, y as Yt, D as Si, z as Vi, A as Ai, B as Ci, M as Pt, C as qt, E as gt, F as ge, J as wi, G as Di, H as Mi, I as yn, L, N as vn, O as Ri, P as Ot, Q as Pn, R as Li, T as xt, U as Z, V as xn, W as Tn, X as bi, Y as Ei, Z as Bi, _ as wt, $ as ji, a0 as Ii } from "./vendor-DxZbxm3m.js";
2
- import * as Zt from "react";
3
- import { createContext as nt, useRef as O, useLayoutEffect as ki, useEffect as Jt, useId as Qt, useContext as w, useInsertionEffect as Sn, useMemo as G, useCallback as Vn, Children as Oi, isValidElement as Fi, useState as ye, Fragment as An, createElement as Ui, forwardRef as Ni, Component as Wi } from "react";
4
- const te = nt({});
5
- function ee(t) {
6
- const e = O(null);
7
- return e.current === null && (e.current = t()), e.current;
8
- }
9
- const ne = typeof window < "u", Cn = ne ? ki : Jt, ft = /* @__PURE__ */ nt(null), ie = nt({
10
- transformPagePoint: (t) => t,
11
- isStatic: !1,
12
- reducedMotion: "never"
13
- });
14
- class $i extends Zt.Component {
15
- getSnapshotBeforeUpdate(e) {
16
- const n = this.props.childRef.current;
17
- if (n && e.isPresent && !this.props.isPresent) {
18
- const i = n.offsetParent, o = pi(i) && i.offsetWidth || 0, r = this.props.sizeRef.current;
19
- r.height = n.offsetHeight || 0, r.width = n.offsetWidth || 0, r.top = n.offsetTop, r.left = n.offsetLeft, r.right = o - r.width - r.left;
20
- }
21
- return null;
22
- }
23
- /**
24
- * Required with getSnapshotBeforeUpdate to stop React complaining.
25
- */
26
- componentDidUpdate() {
27
- }
28
- render() {
29
- return this.props.children;
30
- }
31
- }
32
- function Hi({ children: t, isPresent: e, anchorX: n, root: i }) {
33
- const o = Qt(), r = O(null), s = O({
34
- width: 0,
35
- height: 0,
36
- top: 0,
37
- left: 0,
38
- right: 0
39
- }), { nonce: a } = w(ie);
40
- return Sn(() => {
41
- const { width: l, height: c, top: u, left: h, right: f } = s.current;
42
- if (e || !r.current || !l || !c)
43
- return;
44
- const d = n === "left" ? `left: ${h}` : `right: ${f}`;
45
- r.current.dataset.motionPopId = o;
46
- const m = document.createElement("style");
47
- a && (m.nonce = a);
48
- const v = i ?? document.head;
49
- return v.appendChild(m), m.sheet && m.sheet.insertRule(`
50
- [data-motion-pop-id="${o}"] {
51
- position: absolute !important;
52
- width: ${l}px !important;
53
- height: ${c}px !important;
54
- ${d}px !important;
55
- top: ${u}px !important;
56
- }
57
- `), () => {
58
- v.contains(m) && v.removeChild(m);
59
- };
60
- }, [e]), k.jsx($i, { isPresent: e, childRef: r, sizeRef: s, children: Zt.cloneElement(t, { ref: r }) });
61
- }
62
- const Gi = ({ children: t, initial: e, isPresent: n, onExitComplete: i, custom: o, presenceAffectsLayout: r, mode: s, anchorX: a, root: l }) => {
63
- const c = ee(zi), u = Qt();
64
- let h = !0, f = G(() => (h = !1, {
65
- id: u,
66
- initial: e,
67
- isPresent: n,
68
- custom: o,
69
- onExitComplete: (d) => {
70
- c.set(d, !0);
71
- for (const m of c.values())
72
- if (!m)
73
- return;
74
- i && i();
75
- },
76
- register: (d) => (c.set(d, !1), () => c.delete(d))
77
- }), [n, c, i]);
78
- return r && h && (f = { ...f }), G(() => {
79
- c.forEach((d, m) => c.set(m, !1));
80
- }, [n]), Zt.useEffect(() => {
81
- !n && !c.size && i && i();
82
- }, [n]), s === "popLayout" && (t = k.jsx(Hi, { isPresent: n, anchorX: a, root: l, children: t })), k.jsx(ft.Provider, { value: f, children: t });
83
- };
84
- function zi() {
85
- return /* @__PURE__ */ new Map();
86
- }
87
- function wn(t = !0) {
88
- const e = w(ft);
89
- if (e === null)
90
- return [!0, null];
91
- const { isPresent: n, onExitComplete: i, register: o } = e, r = Qt();
92
- Jt(() => {
93
- if (t)
94
- return o(r);
95
- }, [t]);
96
- const s = Vn(() => t && i && i(r), [r, i, t]);
97
- return !n && i ? [!1, s] : [!0];
98
- }
99
- function Rr() {
100
- return _i(w(ft));
101
- }
102
- function _i(t) {
103
- return t === null ? !0 : t.isPresent;
104
- }
105
- const mt = (t) => t.key || "";
106
- function ve(t) {
107
- const e = [];
108
- return Oi.forEach(t, (n) => {
109
- Fi(n) && e.push(n);
110
- }), e;
111
- }
112
- const Lr = ({ children: t, custom: e, initial: n = !0, onExitComplete: i, presenceAffectsLayout: o = !0, mode: r = "sync", propagate: s = !1, anchorX: a = "left", root: l }) => {
113
- const [c, u] = wn(s), h = G(() => ve(t), [t]), f = s && !c ? [] : h.map(mt), d = O(!0), m = O(h), v = ee(() => /* @__PURE__ */ new Map()), [P, g] = ye(h), [p, y] = ye(h);
114
- Cn(() => {
115
- d.current = !1, m.current = h;
116
- for (let M = 0; M < p.length; M++) {
117
- const A = mt(p[M]);
118
- f.includes(A) ? v.delete(A) : v.get(A) !== !0 && v.set(A, !1);
119
- }
120
- }, [p, f.length, f.join("-")]);
121
- const V = [];
122
- if (h !== P) {
123
- let M = [...h];
124
- for (let A = 0; A < p.length; A++) {
125
- const I = p[A], z = mt(I);
126
- f.includes(z) || (M.splice(A, 0, I), V.push(I));
127
- }
128
- return r === "wait" && V.length && (M = V), y(ve(M)), g(h), null;
129
- }
130
- process.env.NODE_ENV !== "production" && r === "wait" && p.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
131
- const { forceRender: b } = w(te);
132
- return k.jsx(k.Fragment, { children: p.map((M) => {
133
- const A = mt(M), I = s && !c ? !1 : h === p || f.includes(A), z = () => {
134
- if (v.has(A))
135
- v.set(A, !0);
136
- else
137
- return;
138
- let it = !0;
139
- v.forEach((U) => {
140
- U || (it = !1);
141
- }), it && (b?.(), y(m.current), s && u?.(), i && i());
142
- };
143
- return k.jsx(Gi, { isPresent: I, initial: !d.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: o, mode: r, root: l, onExitComplete: I ? void 0 : z, anchorX: a, children: M }, A);
144
- }) });
145
- }, Dn = nt({ strict: !1 }), Pe = {
146
- animation: [
147
- "animate",
148
- "variants",
149
- "whileHover",
150
- "whileTap",
151
- "exit",
152
- "whileInView",
153
- "whileFocus",
154
- "whileDrag"
155
- ],
156
- exit: ["exit"],
157
- drag: ["drag", "dragControls"],
158
- focus: ["whileFocus"],
159
- hover: ["whileHover", "onHoverStart", "onHoverEnd"],
160
- tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
161
- pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
162
- inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
163
- layout: ["layout", "layoutId"]
164
- }, tt = {};
165
- for (const t in Pe)
166
- tt[t] = {
167
- isEnabled: (e) => Pe[t].some((n) => !!e[n])
168
- };
169
- function Ki(t) {
170
- for (const e in t)
171
- tt[e] = {
172
- ...tt[e],
173
- ...t[e]
174
- };
175
- }
176
- const Xi = /* @__PURE__ */ new Set([
177
- "animate",
178
- "exit",
179
- "variants",
180
- "initial",
181
- "style",
182
- "values",
183
- "variants",
184
- "transition",
185
- "transformTemplate",
186
- "custom",
187
- "inherit",
188
- "onBeforeLayoutMeasure",
189
- "onAnimationStart",
190
- "onAnimationComplete",
191
- "onUpdate",
192
- "onDragStart",
193
- "onDrag",
194
- "onDragEnd",
195
- "onMeasureDragConstraints",
196
- "onDirectionLock",
197
- "onDragTransitionEnd",
198
- "_dragX",
199
- "_dragY",
200
- "onHoverStart",
201
- "onHoverEnd",
202
- "onViewportEnter",
203
- "onViewportLeave",
204
- "globalTapTarget",
205
- "ignoreStrict",
206
- "viewport"
207
- ]);
208
- function Tt(t) {
209
- return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Xi.has(t);
210
- }
211
- let Mn = (t) => !Tt(t);
212
- function Yi(t) {
213
- typeof t == "function" && (Mn = (e) => e.startsWith("on") ? !Tt(e) : t(e));
214
- }
215
- try {
216
- Yi(require("@emotion/is-prop-valid").default);
217
- } catch {
218
- }
219
- function qi(t, e, n) {
220
- const i = {};
221
- for (const o in t)
222
- o === "values" && typeof t.values == "object" || (Mn(o) || n === !0 && Tt(o) || !e && !Tt(o) || // If trying to use native HTML drag events, forward drag listeners
223
- t.draggable && o.startsWith("onDrag")) && (i[o] = t[o]);
224
- return i;
225
- }
226
- const Vt = /* @__PURE__ */ nt({});
227
- function At(t) {
228
- return t !== null && typeof t == "object" && typeof t.start == "function";
229
- }
230
- function ut(t) {
231
- return typeof t == "string" || Array.isArray(t);
232
- }
233
- const se = [
234
- "animate",
235
- "whileInView",
236
- "whileFocus",
237
- "whileHover",
238
- "whileTap",
239
- "whileDrag",
240
- "exit"
241
- ], oe = ["initial", ...se];
242
- function Ct(t) {
243
- return At(t.animate) || oe.some((e) => ut(t[e]));
244
- }
245
- function Rn(t) {
246
- return !!(Ct(t) || t.variants);
247
- }
248
- function Zi(t, e) {
249
- if (Ct(t)) {
250
- const { initial: n, animate: i } = t;
251
- return {
252
- initial: n === !1 || ut(n) ? n : void 0,
253
- animate: ut(i) ? i : void 0
254
- };
255
- }
256
- return t.inherit !== !1 ? e : {};
257
- }
258
- function Ji(t) {
259
- const { initial: e, animate: n } = Zi(t, w(Vt));
260
- return G(() => ({ initial: e, animate: n }), [xe(e), xe(n)]);
261
- }
262
- function xe(t) {
263
- return Array.isArray(t) ? t.join(" ") : t;
264
- }
265
- const ct = {};
266
- function Qi(t) {
267
- for (const e in t)
268
- ct[e] = t[e], _t(e) && (ct[e].isCSSVariable = !0);
269
- }
270
- function Ln(t, { layout: e, layoutId: n }) {
271
- return et.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!ct[t] || t === "opacity");
272
- }
273
- const ts = {
274
- x: "translateX",
275
- y: "translateY",
276
- z: "translateZ",
277
- transformPerspective: "perspective"
278
- }, es = Kt.length;
279
- function ns(t, e, n) {
280
- let i = "", o = !0;
281
- for (let r = 0; r < es; r++) {
282
- const s = Kt[r], a = t[s];
283
- if (a === void 0)
284
- continue;
285
- let l = !0;
286
- if (typeof a == "number" ? l = a === (s.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
287
- const c = fn(a, dn[s]);
288
- if (!l) {
289
- o = !1;
290
- const u = ts[s] || s;
291
- i += `${u}(${c}) `;
292
- }
293
- n && (e[s] = c);
294
- }
295
- }
296
- return i = i.trim(), n ? i = n(e, o ? "" : i) : o && (i = "none"), i;
297
- }
298
- function re(t, e, n) {
299
- const { style: i, vars: o, transformOrigin: r } = t;
300
- let s = !1, a = !1;
301
- for (const l in e) {
302
- const c = e[l];
303
- if (et.has(l)) {
304
- s = !0;
305
- continue;
306
- } else if (_t(l)) {
307
- o[l] = c;
308
- continue;
309
- } else {
310
- const u = fn(c, dn[l]);
311
- l.startsWith("origin") ? (a = !0, r[l] = u) : i[l] = u;
312
- }
313
- }
314
- if (e.transform || (s || n ? i.transform = ns(e, t.transform, n) : i.transform && (i.transform = "none")), a) {
315
- const { originX: l = "50%", originY: c = "50%", originZ: u = 0 } = r;
316
- i.transformOrigin = `${l} ${c} ${u}`;
317
- }
318
- }
319
- const ae = () => ({
320
- style: {},
321
- transform: {},
322
- transformOrigin: {},
323
- vars: {}
324
- });
325
- function bn(t, e, n) {
326
- for (const i in e)
327
- !D(e[i]) && !Ln(i, n) && (t[i] = e[i]);
328
- }
329
- function is({ transformTemplate: t }, e) {
330
- return G(() => {
331
- const n = ae();
332
- return re(n, e, t), Object.assign({}, n.vars, n.style);
333
- }, [e]);
334
- }
335
- function ss(t, e) {
336
- const n = t.style || {}, i = {};
337
- return bn(i, n, t), Object.assign(i, is(t, e)), i;
338
- }
339
- function os(t, e) {
340
- const n = {}, i = ss(t, e);
341
- return t.drag && t.dragListener !== !1 && (n.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) && (n.tabIndex = 0), n.style = i, n;
342
- }
343
- const rs = {
344
- offset: "stroke-dashoffset",
345
- array: "stroke-dasharray"
346
- }, as = {
347
- offset: "strokeDashoffset",
348
- array: "strokeDasharray"
349
- };
350
- function ls(t, e, n = 1, i = 0, o = !0) {
351
- t.pathLength = 1;
352
- const r = o ? rs : as;
353
- t[r.offset] = ot.transform(-i);
354
- const s = ot.transform(e), a = ot.transform(n);
355
- t[r.array] = `${s} ${a}`;
356
- }
357
- function En(t, {
358
- attrX: e,
359
- attrY: n,
360
- attrScale: i,
361
- pathLength: o,
362
- pathSpacing: r = 1,
363
- pathOffset: s = 0,
364
- // This is object creation, which we try to avoid per-frame.
365
- ...a
366
- }, l, c, u) {
367
- if (re(t, a, c), l) {
368
- t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
369
- return;
370
- }
371
- t.attrs = t.style, t.style = {};
372
- const { attrs: h, style: f } = t;
373
- h.transform && (f.transform = h.transform, delete h.transform), (f.transform || h.transformOrigin) && (f.transformOrigin = h.transformOrigin ?? "50% 50%", delete h.transformOrigin), f.transform && (f.transformBox = u?.transformBox ?? "fill-box", delete h.transformBox), e !== void 0 && (h.x = e), n !== void 0 && (h.y = n), i !== void 0 && (h.scale = i), o !== void 0 && ls(h, o, r, s, !1);
374
- }
375
- const Bn = () => ({
376
- ...ae(),
377
- attrs: {}
378
- }), jn = (t) => typeof t == "string" && t.toLowerCase() === "svg";
379
- function us(t, e, n, i) {
380
- const o = G(() => {
381
- const r = Bn();
382
- return En(r, e, jn(i), t.transformTemplate, t.style), {
383
- ...r.attrs,
384
- style: { ...r.style }
385
- };
386
- }, [e]);
387
- if (t.style) {
388
- const r = {};
389
- bn(r, t.style, t), o.style = { ...r, ...o.style };
390
- }
391
- return o;
392
- }
393
- const cs = [
394
- "animate",
395
- "circle",
396
- "defs",
397
- "desc",
398
- "ellipse",
399
- "g",
400
- "image",
401
- "line",
402
- "filter",
403
- "marker",
404
- "mask",
405
- "metadata",
406
- "path",
407
- "pattern",
408
- "polygon",
409
- "polyline",
410
- "rect",
411
- "stop",
412
- "switch",
413
- "symbol",
414
- "svg",
415
- "text",
416
- "tspan",
417
- "use",
418
- "view"
419
- ];
420
- function le(t) {
421
- return (
422
- /**
423
- * If it's not a string, it's a custom React component. Currently we only support
424
- * HTML custom React components.
425
- */
426
- typeof t != "string" || /**
427
- * If it contains a dash, the element is a custom HTML webcomponent.
428
- */
429
- t.includes("-") ? !1 : (
430
- /**
431
- * If it's in our list of lowercase SVG tags, it's an SVG component
432
- */
433
- !!(cs.indexOf(t) > -1 || /**
434
- * If it contains a capital letter, it's an SVG component
435
- */
436
- /[A-Z]/u.test(t))
437
- )
438
- );
439
- }
440
- function hs(t, e, n, { latestValues: i }, o, r = !1) {
441
- const a = (le(t) ? us : os)(e, i, o, t), l = qi(e, typeof t == "string", r), c = t !== An ? { ...l, ...a, ref: n } : {}, { children: u } = e, h = G(() => D(u) ? u.get() : u, [u]);
442
- return Ui(t, {
443
- ...c,
444
- children: h
445
- });
446
- }
447
- function Te(t) {
448
- const e = [{}, {}];
449
- return t?.values.forEach((n, i) => {
450
- e[0][i] = n.get(), e[1][i] = n.getVelocity();
451
- }), e;
452
- }
453
- function ue(t, e, n, i) {
454
- if (typeof e == "function") {
455
- const [o, r] = Te(i);
456
- e = e(n !== void 0 ? n : t.custom, o, r);
457
- }
458
- if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
459
- const [o, r] = Te(i);
460
- e = e(n !== void 0 ? n : t.custom, o, r);
461
- }
462
- return e;
463
- }
464
- function yt(t) {
465
- return D(t) ? t.get() : t;
466
- }
467
- function fs({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, i, o) {
468
- return {
469
- latestValues: ds(n, i, o, t),
470
- renderState: e()
471
- };
472
- }
473
- function ds(t, e, n, i) {
474
- const o = {}, r = i(t, {});
475
- for (const f in r)
476
- o[f] = yt(r[f]);
477
- let { initial: s, animate: a } = t;
478
- const l = Ct(t), c = Rn(t);
479
- e && c && !l && t.inherit !== !1 && (s === void 0 && (s = e.initial), a === void 0 && (a = e.animate));
480
- let u = n ? n.initial === !1 : !1;
481
- u = u || s === !1;
482
- const h = u ? a : s;
483
- if (h && typeof h != "boolean" && !At(h)) {
484
- const f = Array.isArray(h) ? h : [h];
485
- for (let d = 0; d < f.length; d++) {
486
- const m = ue(t, f[d]);
487
- if (m) {
488
- const { transitionEnd: v, transition: P, ...g } = m;
489
- for (const p in g) {
490
- let y = g[p];
491
- if (Array.isArray(y)) {
492
- const V = u ? y.length - 1 : 0;
493
- y = y[V];
494
- }
495
- y !== null && (o[p] = y);
496
- }
497
- for (const p in v)
498
- o[p] = v[p];
499
- }
500
- }
501
- }
502
- return o;
503
- }
504
- const In = (t) => (e, n) => {
505
- const i = w(Vt), o = w(ft), r = () => fs(t, e, i, o);
506
- return n ? r() : ee(r);
507
- };
508
- function ce(t, e, n) {
509
- const { style: i } = t, o = {};
510
- for (const r in i)
511
- (D(i[r]) || e.style && D(e.style[r]) || Ln(r, t) || n?.getValue(r)?.liveStyle !== void 0) && (o[r] = i[r]);
512
- return o;
513
- }
514
- const ms = /* @__PURE__ */ In({
515
- scrapeMotionValuesFromProps: ce,
516
- createRenderState: ae
517
- });
518
- function kn(t, e, n) {
519
- const i = ce(t, e, n);
520
- for (const o in t)
521
- if (D(t[o]) || D(e[o])) {
522
- const r = Kt.indexOf(o) !== -1 ? "attr" + o.charAt(0).toUpperCase() + o.substring(1) : o;
523
- i[r] = t[o];
524
- }
525
- return i;
526
- }
527
- const ps = /* @__PURE__ */ In({
528
- scrapeMotionValuesFromProps: kn,
529
- createRenderState: Bn
530
- }), gs = Symbol.for("motionComponentSymbol");
531
- function K(t) {
532
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
533
- }
534
- function ys(t, e, n) {
535
- return Vn(
536
- (i) => {
537
- i && t.onMount && t.onMount(i), e && (i ? e.mount(i) : e.unmount()), n && (typeof n == "function" ? n(i) : K(n) && (n.current = i));
538
- },
539
- /**
540
- * Only pass a new ref callback to React if we've received a visual element
541
- * factory. Otherwise we'll be mounting/remounting every time externalRef
542
- * or other dependencies change.
543
- */
544
- [e]
545
- );
546
- }
547
- const he = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), vs = "framerAppearId", On = "data-" + he(vs), Fn = nt({});
548
- function Ps(t, e, n, i, o) {
549
- const { visualElement: r } = w(Vt), s = w(Dn), a = w(ft), l = w(ie).reducedMotion, c = O(null);
550
- i = i || s.renderer, !c.current && i && (c.current = i(t, {
551
- visualState: e,
552
- parent: r,
553
- props: n,
554
- presenceContext: a,
555
- blockInitialAnimation: a ? a.initial === !1 : !1,
556
- reducedMotionConfig: l
557
- }));
558
- const u = c.current, h = w(Fn);
559
- u && !u.projection && o && (u.type === "html" || u.type === "svg") && xs(c.current, n, o, h);
560
- const f = O(!1);
561
- Sn(() => {
562
- u && f.current && u.update(n, a);
563
- });
564
- const d = n[On], m = O(!!d && !window.MotionHandoffIsComplete?.(d) && window.MotionHasOptimisedAnimation?.(d));
565
- return Cn(() => {
566
- u && (f.current = !0, window.MotionIsMounted = !0, u.updateFeatures(), u.scheduleRenderMicrotask(), m.current && u.animationState && u.animationState.animateChanges());
567
- }), Jt(() => {
568
- u && (!m.current && u.animationState && u.animationState.animateChanges(), m.current && (queueMicrotask(() => {
569
- window.MotionHandoffMarkAsComplete?.(d);
570
- }), m.current = !1), u.enteringChildren = void 0);
571
- }), u;
572
- }
573
- function xs(t, e, n, i) {
574
- const { layoutId: o, layout: r, drag: s, dragConstraints: a, layoutScroll: l, layoutRoot: c, layoutCrossfade: u } = e;
575
- t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : Un(t.parent)), t.projection.setOptions({
576
- layoutId: o,
577
- layout: r,
578
- alwaysMeasureLayout: !!s || a && K(a),
579
- visualElement: t,
580
- /**
581
- * TODO: Update options in an effect. This could be tricky as it'll be too late
582
- * to update by the time layout animations run.
583
- * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
584
- * ensuring it gets called if there's no potential layout animations.
585
- *
586
- */
587
- animationType: typeof r == "string" ? r : "both",
588
- initialPromotionConfig: i,
589
- crossfade: u,
590
- layoutScroll: l,
591
- layoutRoot: c
592
- });
593
- }
594
- function Un(t) {
595
- if (t)
596
- return t.options.allowProjection !== !1 ? t.projection : Un(t.parent);
597
- }
598
- function Dt(t, { forwardMotionProps: e = !1 } = {}, n, i) {
599
- n && Ki(n);
600
- const o = le(t) ? ps : ms;
601
- function r(a, l) {
602
- let c;
603
- const u = {
604
- ...w(ie),
605
- ...a,
606
- layoutId: Ts(a)
607
- }, { isStatic: h } = u, f = Ji(a), d = o(a, h);
608
- if (!h && ne) {
609
- Ss(u, n);
610
- const m = Vs(u);
611
- c = m.MeasureLayout, f.visualElement = Ps(t, d, u, i, m.ProjectionNode);
612
- }
613
- return k.jsxs(Vt.Provider, { value: f, children: [c && f.visualElement ? k.jsx(c, { visualElement: f.visualElement, ...u }) : null, hs(t, a, ys(d, f.visualElement, l), d, h, e)] });
614
- }
615
- r.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
616
- const s = Ni(r);
617
- return s[gs] = t, s;
618
- }
619
- function Ts({ layoutId: t }) {
620
- const e = w(te).id;
621
- return e && t !== void 0 ? e + "-" + t : t;
622
- }
623
- function Ss(t, e) {
624
- const n = w(Dn).strict;
625
- if (process.env.NODE_ENV !== "production" && e && n) {
626
- const i = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
627
- t.ignoreStrict ? gi(!1, i, "lazy-strict-mode") : mn(!1, i, "lazy-strict-mode");
628
- }
629
- }
630
- function Vs(t) {
631
- const { drag: e, layout: n } = tt;
632
- if (!e && !n)
633
- return {};
634
- const i = { ...e, ...n };
635
- return {
636
- MeasureLayout: e?.isEnabled(t) || n?.isEnabled(t) ? i.MeasureLayout : void 0,
637
- ProjectionNode: i.ProjectionNode
638
- };
639
- }
640
- function As(t, e) {
641
- if (typeof Proxy > "u")
642
- return Dt;
643
- const n = /* @__PURE__ */ new Map(), i = (r, s) => Dt(r, s, t, e), o = (r, s) => (process.env.NODE_ENV !== "production" && pn(!1, "motion() is deprecated. Use motion.create() instead."), i(r, s));
644
- return new Proxy(o, {
645
- /**
646
- * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
647
- * The prop name is passed through as `key` and we can use that to generate a `motion`
648
- * DOM component with that name.
649
- */
650
- get: (r, s) => s === "create" ? i : (n.has(s) || n.set(s, Dt(s, void 0, t, e)), n.get(s))
651
- });
652
- }
653
- function Nn({ top: t, left: e, right: n, bottom: i }) {
654
- return {
655
- x: { min: e, max: n },
656
- y: { min: t, max: i }
657
- };
658
- }
659
- function Cs({ x: t, y: e }) {
660
- return { top: e.min, right: t.max, bottom: e.max, left: t.min };
661
- }
662
- function ws(t, e) {
663
- if (!e)
664
- return t;
665
- const n = e({ x: t.left, y: t.top }), i = e({ x: t.right, y: t.bottom });
666
- return {
667
- top: n.y,
668
- left: n.x,
669
- bottom: i.y,
670
- right: i.x
671
- };
672
- }
673
- function Mt(t) {
674
- return t === void 0 || t === 1;
675
- }
676
- function Ft({ scale: t, scaleX: e, scaleY: n }) {
677
- return !Mt(t) || !Mt(e) || !Mt(n);
678
- }
679
- function $(t) {
680
- return Ft(t) || Wn(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
681
- }
682
- function Wn(t) {
683
- return Se(t.x) || Se(t.y);
684
- }
685
- function Se(t) {
686
- return t && t !== "0%";
687
- }
688
- function St(t, e, n) {
689
- const i = t - n, o = e * i;
690
- return n + o;
691
- }
692
- function Ve(t, e, n, i, o) {
693
- return o !== void 0 && (t = St(t, o, i)), St(t, n, i) + e;
694
- }
695
- function Ut(t, e = 0, n = 1, i, o) {
696
- t.min = Ve(t.min, e, n, i, o), t.max = Ve(t.max, e, n, i, o);
697
- }
698
- function $n(t, { x: e, y: n }) {
699
- Ut(t.x, e.translate, e.scale, e.originPoint), Ut(t.y, n.translate, n.scale, n.originPoint);
700
- }
701
- const Ae = 0.999999999999, Ce = 1.0000000000001;
702
- function Ds(t, e, n, i = !1) {
703
- const o = n.length;
704
- if (!o)
705
- return;
706
- e.x = e.y = 1;
707
- let r, s;
708
- for (let a = 0; a < o; a++) {
709
- r = n[a], s = r.projectionDelta;
710
- const { visualElement: l } = r.options;
711
- l && l.props.style && l.props.style.display === "contents" || (i && r.options.layoutScroll && r.scroll && r !== r.root && Y(t, {
712
- x: -r.scroll.offset.x,
713
- y: -r.scroll.offset.y
714
- }), s && (e.x *= s.x.scale, e.y *= s.y.scale, $n(t, s)), i && $(r.latestValues) && Y(t, r.latestValues));
715
- }
716
- e.x < Ce && e.x > Ae && (e.x = 1), e.y < Ce && e.y > Ae && (e.y = 1);
717
- }
718
- function X(t, e) {
719
- t.min = t.min + e, t.max = t.max + e;
720
- }
721
- function we(t, e, n, i, o = 0.5) {
722
- const r = S(t.min, t.max, o);
723
- Ut(t, e, n, r, i);
724
- }
725
- function Y(t, e) {
726
- we(t.x, e.x, e.scaleX, e.scale, e.originX), we(t.y, e.y, e.scaleY, e.scale, e.originY);
727
- }
728
- function Hn(t, e) {
729
- return Nn(ws(t.getBoundingClientRect(), e));
730
- }
731
- function Ms(t, e, n) {
732
- const i = Hn(t, n), { scroll: o } = e;
733
- return o && (X(i.x, o.offset.x), X(i.y, o.offset.y)), i;
734
- }
735
- const De = () => ({
736
- translate: 0,
737
- scale: 1,
738
- origin: 0,
739
- originPoint: 0
740
- }), q = () => ({
741
- x: De(),
742
- y: De()
743
- }), Me = () => ({ min: 0, max: 0 }), x = () => ({
744
- x: Me(),
745
- y: Me()
746
- }), Nt = { current: null }, Gn = { current: !1 };
747
- function Rs() {
748
- if (Gn.current = !0, !!ne)
749
- if (window.matchMedia) {
750
- const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Nt.current = t.matches;
751
- t.addEventListener("change", e), e();
752
- } else
753
- Nt.current = !1;
754
- }
755
- const Ls = /* @__PURE__ */ new WeakMap();
756
- function bs(t, e, n) {
757
- for (const i in e) {
758
- const o = e[i], r = n[i];
759
- if (D(o))
760
- t.addValue(i, o);
761
- else if (D(r))
762
- t.addValue(i, Q(o, { owner: t }));
763
- else if (r !== o)
764
- if (t.hasValue(i)) {
765
- const s = t.getValue(i);
766
- s.liveStyle === !0 ? s.jump(o) : s.hasAnimated || s.set(o);
767
- } else {
768
- const s = t.getStaticValue(i);
769
- t.addValue(i, Q(s !== void 0 ? s : o, { owner: t }));
770
- }
771
- }
772
- for (const i in n)
773
- e[i] === void 0 && t.removeValue(i);
774
- return e;
775
- }
776
- const Re = [
777
- "AnimationStart",
778
- "AnimationComplete",
779
- "Update",
780
- "BeforeLayoutMeasure",
781
- "LayoutMeasure",
782
- "LayoutAnimationStart",
783
- "LayoutAnimationComplete"
784
- ];
785
- class Es {
786
- /**
787
- * This method takes React props and returns found MotionValues. For example, HTML
788
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
789
- *
790
- * This isn't an abstract method as it needs calling in the constructor, but it is
791
- * intended to be one.
792
- */
793
- scrapeMotionValuesFromProps(e, n, i) {
794
- return {};
795
- }
796
- constructor({ parent: e, props: n, presenceContext: i, reducedMotionConfig: o, blockInitialAnimation: r, visualState: s }, a = {}) {
797
- this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = yi, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
798
- this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
799
- }, this.renderScheduledAt = 0, this.scheduleRender = () => {
800
- const f = Xt.now();
801
- this.renderScheduledAt < f && (this.renderScheduledAt = f, T.render(this.render, !1, !0));
802
- };
803
- const { latestValues: l, renderState: c } = s;
804
- this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = e, this.props = n, this.presenceContext = i, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = o, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Ct(n), this.isVariantNode = Rn(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
805
- const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
806
- for (const f in h) {
807
- const d = h[f];
808
- l[f] !== void 0 && D(d) && d.set(l[f]);
809
- }
810
- }
811
- mount(e) {
812
- this.current = e, Ls.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, i) => this.bindToMotionValue(i, n)), Gn.current || Rs(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Nt.current, process.env.NODE_ENV !== "production" && pn(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.parent?.addChild(this), this.update(this.props, this.presenceContext);
813
- }
814
- unmount() {
815
- this.projection && this.projection.unmount(), H(this.notifyUpdate), H(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
816
- for (const e in this.events)
817
- this.events[e].clear();
818
- for (const e in this.features) {
819
- const n = this.features[e];
820
- n && (n.unmount(), n.isMounted = !1);
821
- }
822
- this.current = null;
823
- }
824
- addChild(e) {
825
- this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
826
- }
827
- removeChild(e) {
828
- this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
829
- }
830
- bindToMotionValue(e, n) {
831
- this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
832
- const i = et.has(e);
833
- i && this.onBindTransform && this.onBindTransform();
834
- const o = n.on("change", (s) => {
835
- this.latestValues[e] = s, this.props.onUpdate && T.preRender(this.notifyUpdate), i && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
836
- });
837
- let r;
838
- window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
839
- o(), r && r(), n.owner && n.stop();
840
- });
841
- }
842
- sortNodePosition(e) {
843
- return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
844
- }
845
- updateFeatures() {
846
- let e = "animation";
847
- for (e in tt) {
848
- const n = tt[e];
849
- if (!n)
850
- continue;
851
- const { isEnabled: i, Feature: o } = n;
852
- if (!this.features[e] && o && i(this.props) && (this.features[e] = new o(this)), this.features[e]) {
853
- const r = this.features[e];
854
- r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
855
- }
856
- }
857
- }
858
- triggerBuild() {
859
- this.build(this.renderState, this.latestValues, this.props);
860
- }
861
- /**
862
- * Measure the current viewport box with or without transforms.
863
- * Only measures axis-aligned boxes, rotate and skew must be manually
864
- * removed with a re-render to work.
865
- */
866
- measureViewportBox() {
867
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : x();
868
- }
869
- getStaticValue(e) {
870
- return this.latestValues[e];
871
- }
872
- setStaticValue(e, n) {
873
- this.latestValues[e] = n;
874
- }
875
- /**
876
- * Update the provided props. Ensure any newly-added motion values are
877
- * added to our map, old ones removed, and listeners updated.
878
- */
879
- update(e, n) {
880
- (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
881
- for (let i = 0; i < Re.length; i++) {
882
- const o = Re[i];
883
- this.propEventSubscriptions[o] && (this.propEventSubscriptions[o](), delete this.propEventSubscriptions[o]);
884
- const r = "on" + o, s = e[r];
885
- s && (this.propEventSubscriptions[o] = this.on(o, s));
886
- }
887
- this.prevMotionValues = bs(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
888
- }
889
- getProps() {
890
- return this.props;
891
- }
892
- /**
893
- * Returns the variant definition with a given name.
894
- */
895
- getVariant(e) {
896
- return this.props.variants ? this.props.variants[e] : void 0;
897
- }
898
- /**
899
- * Returns the defined default transition on this component.
900
- */
901
- getDefaultTransition() {
902
- return this.props.transition;
903
- }
904
- getTransformPagePoint() {
905
- return this.props.transformPagePoint;
906
- }
907
- getClosestVariantNode() {
908
- return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
909
- }
910
- /**
911
- * Add a child visual element to our set of children.
912
- */
913
- addVariantChild(e) {
914
- const n = this.getClosestVariantNode();
915
- if (n)
916
- return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
917
- }
918
- /**
919
- * Add a motion value and bind it to this visual element.
920
- */
921
- addValue(e, n) {
922
- const i = this.values.get(e);
923
- n !== i && (i && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
924
- }
925
- /**
926
- * Remove a motion value and unbind any active subscriptions.
927
- */
928
- removeValue(e) {
929
- this.values.delete(e);
930
- const n = this.valueSubscriptions.get(e);
931
- n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
932
- }
933
- /**
934
- * Check whether we have a motion value for this key
935
- */
936
- hasValue(e) {
937
- return this.values.has(e);
938
- }
939
- getValue(e, n) {
940
- if (this.props.values && this.props.values[e])
941
- return this.props.values[e];
942
- let i = this.values.get(e);
943
- return i === void 0 && n !== void 0 && (i = Q(n === null ? void 0 : n, { owner: this }), this.addValue(e, i)), i;
944
- }
945
- /**
946
- * If we're trying to animate to a previously unencountered value,
947
- * we need to check for it in our state and as a last resort read it
948
- * directly from the instance (which might have performance implications).
949
- */
950
- readValue(e, n) {
951
- let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
952
- return i != null && (typeof i == "string" && (vi(i) || Pi(i)) ? i = parseFloat(i) : !xi(i) && kt.test(n) && (i = Ti(e, n)), this.setBaseTarget(e, D(i) ? i.get() : i)), D(i) ? i.get() : i;
953
- }
954
- /**
955
- * Set the base target to later animate back to. This is currently
956
- * only hydrated on creation and when we first read a value.
957
- */
958
- setBaseTarget(e, n) {
959
- this.baseTarget[e] = n;
960
- }
961
- /**
962
- * Find the base target for a value thats been removed from all animation
963
- * props.
964
- */
965
- getBaseTarget(e) {
966
- const { initial: n } = this.props;
967
- let i;
968
- if (typeof n == "string" || typeof n == "object") {
969
- const r = ue(this.props, n, this.presenceContext?.custom);
970
- r && (i = r[e]);
971
- }
972
- if (n && i !== void 0)
973
- return i;
974
- const o = this.getBaseTargetFromProps(this.props, e);
975
- return o !== void 0 && !D(o) ? o : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
976
- }
977
- on(e, n) {
978
- return this.events[e] || (this.events[e] = new gn()), this.events[e].add(n);
979
- }
980
- notify(e, ...n) {
981
- this.events[e] && this.events[e].notify(...n);
982
- }
983
- scheduleRenderMicrotask() {
984
- Yt.render(this.render);
985
- }
986
- }
987
- class zn extends Es {
988
- constructor() {
989
- super(...arguments), this.KeyframeResolver = Si;
990
- }
991
- sortInstanceNodePosition(e, n) {
992
- return e.compareDocumentPosition(n) & 2 ? 1 : -1;
993
- }
994
- getBaseTargetFromProps(e, n) {
995
- return e.style ? e.style[n] : void 0;
996
- }
997
- removeValueFromRenderState(e, { vars: n, style: i }) {
998
- delete n[e], delete i[e];
999
- }
1000
- handleChildMotionValue() {
1001
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
1002
- const { children: e } = this.props;
1003
- D(e) && (this.childSubscription = e.on("change", (n) => {
1004
- this.current && (this.current.textContent = `${n}`);
1005
- }));
1006
- }
1007
- }
1008
- function _n(t, { style: e, vars: n }, i, o) {
1009
- const r = t.style;
1010
- let s;
1011
- for (s in e)
1012
- r[s] = e[s];
1013
- o?.applyProjectionStyles(r, i);
1014
- for (s in n)
1015
- r.setProperty(s, n[s]);
1016
- }
1017
- function Bs(t) {
1018
- return window.getComputedStyle(t);
1019
- }
1020
- class js extends zn {
1021
- constructor() {
1022
- super(...arguments), this.type = "html", this.renderInstance = _n;
1023
- }
1024
- readValueFromInstance(e, n) {
1025
- if (et.has(n))
1026
- return this.projection?.isProjecting ? Vi(n) : Ai(e, n);
1027
- {
1028
- const i = Bs(e), o = (_t(n) ? i.getPropertyValue(n) : i[n]) || 0;
1029
- return typeof o == "string" ? o.trim() : o;
1030
- }
1031
- }
1032
- measureInstanceViewportBox(e, { transformPagePoint: n }) {
1033
- return Hn(e, n);
1034
- }
1035
- build(e, n, i) {
1036
- re(e, n, i.transformTemplate);
1037
- }
1038
- scrapeMotionValuesFromProps(e, n, i) {
1039
- return ce(e, n, i);
1040
- }
1041
- }
1042
- const Kn = /* @__PURE__ */ new Set([
1043
- "baseFrequency",
1044
- "diffuseConstant",
1045
- "kernelMatrix",
1046
- "kernelUnitLength",
1047
- "keySplines",
1048
- "keyTimes",
1049
- "limitingConeAngle",
1050
- "markerHeight",
1051
- "markerWidth",
1052
- "numOctaves",
1053
- "targetX",
1054
- "targetY",
1055
- "surfaceScale",
1056
- "specularConstant",
1057
- "specularExponent",
1058
- "stdDeviation",
1059
- "tableValues",
1060
- "viewBox",
1061
- "gradientTransform",
1062
- "pathLength",
1063
- "startOffset",
1064
- "textLength",
1065
- "lengthAdjust"
1066
- ]);
1067
- function Is(t, e, n, i) {
1068
- _n(t, e, void 0, i);
1069
- for (const o in e.attrs)
1070
- t.setAttribute(Kn.has(o) ? o : he(o), e.attrs[o]);
1071
- }
1072
- class ks extends zn {
1073
- constructor() {
1074
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = x;
1075
- }
1076
- getBaseTargetFromProps(e, n) {
1077
- return e[n];
1078
- }
1079
- readValueFromInstance(e, n) {
1080
- if (et.has(n)) {
1081
- const i = Ci(n);
1082
- return i && i.default || 0;
1083
- }
1084
- return n = Kn.has(n) ? n : he(n), e.getAttribute(n);
1085
- }
1086
- scrapeMotionValuesFromProps(e, n, i) {
1087
- return kn(e, n, i);
1088
- }
1089
- build(e, n, i) {
1090
- En(e, n, this.isSVGTag, i.transformTemplate, i.style);
1091
- }
1092
- renderInstance(e, n, i, o) {
1093
- Is(e, n, i, o);
1094
- }
1095
- mount(e) {
1096
- this.isSVGTag = jn(e.tagName), super.mount(e);
1097
- }
1098
- }
1099
- const Os = (t, e) => le(t) ? new ks(e) : new js(e, {
1100
- allowProjection: t !== An
1101
- });
1102
- function J(t, e, n) {
1103
- const i = t.getProps();
1104
- return ue(i, e, n !== void 0 ? n : i.custom, t);
1105
- }
1106
- const Wt = (t) => Array.isArray(t);
1107
- function Fs(t, e, n) {
1108
- t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, Q(n));
1109
- }
1110
- function Us(t) {
1111
- return Wt(t) ? t[t.length - 1] || 0 : t;
1112
- }
1113
- function Ns(t, e) {
1114
- const n = J(t, e);
1115
- let { transitionEnd: i = {}, transition: o = {}, ...r } = n || {};
1116
- r = { ...r, ...i };
1117
- for (const s in r) {
1118
- const a = Us(r[s]);
1119
- Fs(t, s, a);
1120
- }
1121
- }
1122
- function Ws(t) {
1123
- return !!(D(t) && t.add);
1124
- }
1125
- function $t(t, e) {
1126
- const n = t.getValue("willChange");
1127
- if (Ws(n))
1128
- return n.add(e);
1129
- if (!n && Pt.WillChange) {
1130
- const i = new Pt.WillChange("auto");
1131
- t.addValue("willChange", i), i.add(e);
1132
- }
1133
- }
1134
- function Xn(t) {
1135
- return t.props[On];
1136
- }
1137
- const $s = (t) => t !== null;
1138
- function Hs(t, { repeat: e, repeatType: n = "loop" }, i) {
1139
- const o = t.filter($s), r = e && n !== "loop" && e % 2 === 1 ? 0 : o.length - 1;
1140
- return o[r];
1141
- }
1142
- const Gs = {
1143
- type: "spring",
1144
- stiffness: 500,
1145
- damping: 25,
1146
- restSpeed: 10
1147
- }, zs = (t) => ({
1148
- type: "spring",
1149
- stiffness: 550,
1150
- damping: t === 0 ? 2 * Math.sqrt(550) : 30,
1151
- restSpeed: 10
1152
- }), _s = {
1153
- type: "keyframes",
1154
- duration: 0.8
1155
- }, Ks = {
1156
- type: "keyframes",
1157
- ease: [0.25, 0.1, 0.35, 1],
1158
- duration: 0.3
1159
- }, Xs = (t, { keyframes: e }) => e.length > 2 ? _s : et.has(t) ? t.startsWith("scale") ? zs(e[1]) : Gs : Ks;
1160
- function Ys({ when: t, delay: e, delayChildren: n, staggerChildren: i, staggerDirection: o, repeat: r, repeatType: s, repeatDelay: a, from: l, elapsed: c, ...u }) {
1161
- return !!Object.keys(u).length;
1162
- }
1163
- const fe = (t, e, n, i = {}, o, r) => (s) => {
1164
- const a = qt(i, t) || {}, l = a.delay || i.delay || 0;
1165
- let { elapsed: c = 0 } = i;
1166
- c = c - gt(l);
1167
- const u = {
1168
- keyframes: Array.isArray(n) ? n : [null, n],
1169
- ease: "easeOut",
1170
- velocity: e.getVelocity(),
1171
- ...a,
1172
- delay: -c,
1173
- onUpdate: (f) => {
1174
- e.set(f), a.onUpdate && a.onUpdate(f);
1175
- },
1176
- onComplete: () => {
1177
- s(), a.onComplete && a.onComplete();
1178
- },
1179
- name: t,
1180
- motionValue: e,
1181
- element: r ? void 0 : o
1182
- };
1183
- Ys(a) || Object.assign(u, Xs(t, u)), u.duration && (u.duration = gt(u.duration)), u.repeatDelay && (u.repeatDelay = gt(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
1184
- let h = !1;
1185
- if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (ge(u), u.delay === 0 && (h = !0)), (Pt.instantAnimations || Pt.skipAnimations) && (h = !0, ge(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, h && !r && e.get() !== void 0) {
1186
- const f = Hs(u.keyframes, a);
1187
- if (f !== void 0) {
1188
- T.update(() => {
1189
- u.onUpdate(f), u.onComplete();
1190
- });
1191
- return;
1192
- }
1193
- }
1194
- return a.isSync ? new wi(u) : new Di(u);
1195
- };
1196
- function qs({ protectedKeys: t, needsAnimating: e }, n) {
1197
- const i = t.hasOwnProperty(n) && e[n] !== !0;
1198
- return e[n] = !1, i;
1199
- }
1200
- function Yn(t, e, { delay: n = 0, transitionOverride: i, type: o } = {}) {
1201
- let { transition: r = t.getDefaultTransition(), transitionEnd: s, ...a } = e;
1202
- i && (r = i);
1203
- const l = [], c = o && t.animationState && t.animationState.getState()[o];
1204
- for (const u in a) {
1205
- const h = t.getValue(u, t.latestValues[u] ?? null), f = a[u];
1206
- if (f === void 0 || c && qs(c, u))
1207
- continue;
1208
- const d = {
1209
- delay: n,
1210
- ...qt(r || {}, u)
1211
- }, m = h.get();
1212
- if (m !== void 0 && !h.isAnimating && !Array.isArray(f) && f === m && !d.velocity)
1213
- continue;
1214
- let v = !1;
1215
- if (window.MotionHandoffAnimation) {
1216
- const g = Xn(t);
1217
- if (g) {
1218
- const p = window.MotionHandoffAnimation(g, u, T);
1219
- p !== null && (d.startTime = p, v = !0);
1220
- }
1221
- }
1222
- $t(t, u), h.start(fe(u, h, f, t.shouldReduceMotion && Mi.has(u) ? { type: !1 } : d, t, v));
1223
- const P = h.animation;
1224
- P && l.push(P);
1225
- }
1226
- return s && Promise.all(l).then(() => {
1227
- T.update(() => {
1228
- s && Ns(t, s);
1229
- });
1230
- }), l;
1231
- }
1232
- function qn(t, e, n, i = 0, o = 1) {
1233
- const r = Array.from(t).sort((c, u) => c.sortNodePosition(u)).indexOf(e), s = t.size, a = (s - 1) * i;
1234
- return typeof n == "function" ? n(r, s) : o === 1 ? r * i : a - r * i;
1235
- }
1236
- function Ht(t, e, n = {}) {
1237
- const i = J(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
1238
- let { transition: o = t.getDefaultTransition() || {} } = i || {};
1239
- n.transitionOverride && (o = n.transitionOverride);
1240
- const r = i ? () => Promise.all(Yn(t, i, n)) : () => Promise.resolve(), s = t.variantChildren && t.variantChildren.size ? (l = 0) => {
1241
- const { delayChildren: c = 0, staggerChildren: u, staggerDirection: h } = o;
1242
- return Zs(t, e, l, c, u, h, n);
1243
- } : () => Promise.resolve(), { when: a } = o;
1244
- if (a) {
1245
- const [l, c] = a === "beforeChildren" ? [r, s] : [s, r];
1246
- return l().then(() => c());
1247
- } else
1248
- return Promise.all([r(), s(n.delay)]);
1249
- }
1250
- function Zs(t, e, n = 0, i = 0, o = 0, r = 1, s) {
1251
- const a = [];
1252
- for (const l of t.variantChildren)
1253
- l.notify("AnimationStart", e), a.push(Ht(l, e, {
1254
- ...s,
1255
- delay: n + (typeof i == "function" ? 0 : i) + qn(t.variantChildren, l, i, o, r)
1256
- }).then(() => l.notify("AnimationComplete", e)));
1257
- return Promise.all(a);
1258
- }
1259
- function Js(t, e, n = {}) {
1260
- t.notify("AnimationStart", e);
1261
- let i;
1262
- if (Array.isArray(e)) {
1263
- const o = e.map((r) => Ht(t, r, n));
1264
- i = Promise.all(o);
1265
- } else if (typeof e == "string")
1266
- i = Ht(t, e, n);
1267
- else {
1268
- const o = typeof e == "function" ? J(t, e, n.custom) : e;
1269
- i = Promise.all(Yn(t, o, n));
1270
- }
1271
- return i.then(() => {
1272
- t.notify("AnimationComplete", e);
1273
- });
1274
- }
1275
- function Zn(t, e) {
1276
- if (!Array.isArray(e))
1277
- return !1;
1278
- const n = e.length;
1279
- if (n !== t.length)
1280
- return !1;
1281
- for (let i = 0; i < n; i++)
1282
- if (e[i] !== t[i])
1283
- return !1;
1284
- return !0;
1285
- }
1286
- const Qs = oe.length;
1287
- function Jn(t) {
1288
- if (!t)
1289
- return;
1290
- if (!t.isControllingVariants) {
1291
- const n = t.parent ? Jn(t.parent) || {} : {};
1292
- return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1293
- }
1294
- const e = {};
1295
- for (let n = 0; n < Qs; n++) {
1296
- const i = oe[n], o = t.props[i];
1297
- (ut(o) || o === !1) && (e[i] = o);
1298
- }
1299
- return e;
1300
- }
1301
- const to = [...se].reverse(), eo = se.length;
1302
- function no(t) {
1303
- return (e) => Promise.all(e.map(({ animation: n, options: i }) => Js(t, n, i)));
1304
- }
1305
- function io(t) {
1306
- let e = no(t), n = Le(), i = !0;
1307
- const o = (l) => (c, u) => {
1308
- const h = J(t, u, l === "exit" ? t.presenceContext?.custom : void 0);
1309
- if (h) {
1310
- const { transition: f, transitionEnd: d, ...m } = h;
1311
- c = { ...c, ...m, ...d };
1312
- }
1313
- return c;
1314
- };
1315
- function r(l) {
1316
- e = l(t);
1317
- }
1318
- function s(l) {
1319
- const { props: c } = t, u = Jn(t.parent) || {}, h = [], f = /* @__PURE__ */ new Set();
1320
- let d = {}, m = 1 / 0;
1321
- for (let P = 0; P < eo; P++) {
1322
- const g = to[P], p = n[g], y = c[g] !== void 0 ? c[g] : u[g], V = ut(y), b = g === l ? p.isActive : null;
1323
- b === !1 && (m = P);
1324
- let M = y === u[g] && y !== c[g] && V;
1325
- if (M && i && t.manuallyAnimateOnMount && (M = !1), p.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
1326
- !p.isActive && b === null || // If we didn't and don't have any defined prop for this animation type
1327
- !y && !p.prevProp || // Or if the prop doesn't define an animation
1328
- At(y) || typeof y == "boolean")
1329
- continue;
1330
- const A = so(p.prevProp, y);
1331
- let I = A || // If we're making this variant active, we want to always make it active
1332
- g === l && p.isActive && !M && V || // If we removed a higher-priority variant (i is in reverse order)
1333
- P > m && V, z = !1;
1334
- const it = Array.isArray(y) ? y : [y];
1335
- let U = it.reduce(o(g), {});
1336
- b === !1 && (U = {});
1337
- const { prevResolvedValues: de = {} } = p, di = {
1338
- ...de,
1339
- ...U
1340
- }, me = (C) => {
1341
- I = !0, f.has(C) && (z = !0, f.delete(C)), p.needsAnimating[C] = !0;
1342
- const E = t.getValue(C);
1343
- E && (E.liveStyle = !1);
1344
- };
1345
- for (const C in di) {
1346
- const E = U[C], N = de[C];
1347
- if (d.hasOwnProperty(C))
1348
- continue;
1349
- let _ = !1;
1350
- Wt(E) && Wt(N) ? _ = !Zn(E, N) : _ = E !== N, _ ? E != null ? me(C) : f.add(C) : E !== void 0 && f.has(C) ? me(C) : p.protectedKeys[C] = !0;
1351
- }
1352
- p.prevProp = y, p.prevResolvedValues = U, p.isActive && (d = { ...d, ...U }), i && t.blockInitialAnimation && (I = !1);
1353
- const pe = M && A;
1354
- I && (!pe || z) && h.push(...it.map((C) => {
1355
- const E = { type: g };
1356
- if (typeof C == "string" && i && !pe && t.manuallyAnimateOnMount && t.parent) {
1357
- const { parent: N } = t, _ = J(N, C);
1358
- if (N.enteringChildren && _) {
1359
- const { delayChildren: mi } = _.transition || {};
1360
- E.delay = qn(N.enteringChildren, t, mi);
1361
- }
1362
- }
1363
- return {
1364
- animation: C,
1365
- options: E
1366
- };
1367
- }));
1368
- }
1369
- if (f.size) {
1370
- const P = {};
1371
- if (typeof c.initial != "boolean") {
1372
- const g = J(t, Array.isArray(c.initial) ? c.initial[0] : c.initial);
1373
- g && g.transition && (P.transition = g.transition);
1374
- }
1375
- f.forEach((g) => {
1376
- const p = t.getBaseTarget(g), y = t.getValue(g);
1377
- y && (y.liveStyle = !0), P[g] = p ?? null;
1378
- }), h.push({ animation: P });
1379
- }
1380
- let v = !!h.length;
1381
- return i && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (v = !1), i = !1, v ? e(h) : Promise.resolve();
1382
- }
1383
- function a(l, c) {
1384
- if (n[l].isActive === c)
1385
- return Promise.resolve();
1386
- t.variantChildren?.forEach((h) => h.animationState?.setActive(l, c)), n[l].isActive = c;
1387
- const u = s(l);
1388
- for (const h in n)
1389
- n[h].protectedKeys = {};
1390
- return u;
1391
- }
1392
- return {
1393
- animateChanges: s,
1394
- setActive: a,
1395
- setAnimateFunction: r,
1396
- getState: () => n,
1397
- reset: () => {
1398
- n = Le(), i = !0;
1399
- }
1400
- };
1401
- }
1402
- function so(t, e) {
1403
- return typeof e == "string" ? e !== t : Array.isArray(e) ? !Zn(e, t) : !1;
1404
- }
1405
- function W(t = !1) {
1406
- return {
1407
- isActive: t,
1408
- protectedKeys: {},
1409
- needsAnimating: {},
1410
- prevResolvedValues: {}
1411
- };
1412
- }
1413
- function Le() {
1414
- return {
1415
- animate: W(!0),
1416
- whileInView: W(),
1417
- whileHover: W(),
1418
- whileTap: W(),
1419
- whileDrag: W(),
1420
- whileFocus: W(),
1421
- exit: W()
1422
- };
1423
- }
1424
- class F {
1425
- constructor(e) {
1426
- this.isMounted = !1, this.node = e;
1427
- }
1428
- update() {
1429
- }
1430
- }
1431
- class oo extends F {
1432
- /**
1433
- * We dynamically generate the AnimationState manager as it contains a reference
1434
- * to the underlying animation library. We only want to load that if we load this,
1435
- * so people can optionally code split it out using the `m` component.
1436
- */
1437
- constructor(e) {
1438
- super(e), e.animationState || (e.animationState = io(e));
1439
- }
1440
- updateAnimationControlsSubscription() {
1441
- const { animate: e } = this.node.getProps();
1442
- At(e) && (this.unmountControls = e.subscribe(this.node));
1443
- }
1444
- /**
1445
- * Subscribe any provided AnimationControls to the component's VisualElement
1446
- */
1447
- mount() {
1448
- this.updateAnimationControlsSubscription();
1449
- }
1450
- update() {
1451
- const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1452
- e !== n && this.updateAnimationControlsSubscription();
1453
- }
1454
- unmount() {
1455
- this.node.animationState.reset(), this.unmountControls?.();
1456
- }
1457
- }
1458
- let ro = 0;
1459
- class ao extends F {
1460
- constructor() {
1461
- super(...arguments), this.id = ro++;
1462
- }
1463
- update() {
1464
- if (!this.node.presenceContext)
1465
- return;
1466
- const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
1467
- if (!this.node.animationState || e === i)
1468
- return;
1469
- const o = this.node.animationState.setActive("exit", !e);
1470
- n && !e && o.then(() => {
1471
- n(this.id);
1472
- });
1473
- }
1474
- mount() {
1475
- const { register: e, onExitComplete: n } = this.node.presenceContext || {};
1476
- n && n(this.id), e && (this.unmount = e(this.id));
1477
- }
1478
- unmount() {
1479
- }
1480
- }
1481
- const lo = {
1482
- animation: {
1483
- Feature: oo
1484
- },
1485
- exit: {
1486
- Feature: ao
1487
- }
1488
- };
1489
- function ht(t, e, n, i = { passive: !0 }) {
1490
- return t.addEventListener(e, n, i), () => t.removeEventListener(e, n);
1491
- }
1492
- function dt(t) {
1493
- return {
1494
- point: {
1495
- x: t.pageX,
1496
- y: t.pageY
1497
- }
1498
- };
1499
- }
1500
- const uo = (t) => (e) => yn(e) && t(e, dt(e));
1501
- function rt(t, e, n, i) {
1502
- return ht(t, e, uo(n), i);
1503
- }
1504
- const Qn = 1e-4, co = 1 - Qn, ho = 1 + Qn, ti = 0.01, fo = 0 - ti, mo = 0 + ti;
1505
- function R(t) {
1506
- return t.max - t.min;
1507
- }
1508
- function po(t, e, n) {
1509
- return Math.abs(t - e) <= n;
1510
- }
1511
- function be(t, e, n, i = 0.5) {
1512
- t.origin = i, t.originPoint = S(e.min, e.max, t.origin), t.scale = R(n) / R(e), t.translate = S(n.min, n.max, t.origin) - t.originPoint, (t.scale >= co && t.scale <= ho || isNaN(t.scale)) && (t.scale = 1), (t.translate >= fo && t.translate <= mo || isNaN(t.translate)) && (t.translate = 0);
1513
- }
1514
- function at(t, e, n, i) {
1515
- be(t.x, e.x, n.x, i ? i.originX : void 0), be(t.y, e.y, n.y, i ? i.originY : void 0);
1516
- }
1517
- function Ee(t, e, n) {
1518
- t.min = n.min + e.min, t.max = t.min + R(e);
1519
- }
1520
- function go(t, e, n) {
1521
- Ee(t.x, e.x, n.x), Ee(t.y, e.y, n.y);
1522
- }
1523
- function Be(t, e, n) {
1524
- t.min = e.min - n.min, t.max = t.min + R(e);
1525
- }
1526
- function lt(t, e, n) {
1527
- Be(t.x, e.x, n.x), Be(t.y, e.y, n.y);
1528
- }
1529
- function j(t) {
1530
- return [t("x"), t("y")];
1531
- }
1532
- const ei = ({ current: t }) => t ? t.ownerDocument.defaultView : null, je = (t, e) => Math.abs(t - e);
1533
- function yo(t, e) {
1534
- const n = je(t.x, e.x), i = je(t.y, e.y);
1535
- return Math.sqrt(n ** 2 + i ** 2);
1536
- }
1537
- class ni {
1538
- constructor(e, n, { transformPagePoint: i, contextWindow: o = window, dragSnapToOrigin: r = !1, distanceThreshold: s = 3 } = {}) {
1539
- if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
1540
- if (!(this.lastMoveEvent && this.lastMoveEventInfo))
1541
- return;
1542
- const f = Lt(this.lastMoveEventInfo, this.history), d = this.startEvent !== null, m = yo(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
1543
- if (!d && !m)
1544
- return;
1545
- const { point: v } = f, { timestamp: P } = L;
1546
- this.history.push({ ...v, timestamp: P });
1547
- const { onStart: g, onMove: p } = this.handlers;
1548
- d || (g && g(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), p && p(this.lastMoveEvent, f);
1549
- }, this.handlePointerMove = (f, d) => {
1550
- this.lastMoveEvent = f, this.lastMoveEventInfo = Rt(d, this.transformPagePoint), T.update(this.updatePoint, !0);
1551
- }, this.handlePointerUp = (f, d) => {
1552
- this.end();
1553
- const { onEnd: m, onSessionEnd: v, resumeAnimation: P } = this.handlers;
1554
- if (this.dragSnapToOrigin && P && P(), !(this.lastMoveEvent && this.lastMoveEventInfo))
1555
- return;
1556
- const g = Lt(f.type === "pointercancel" ? this.lastMoveEventInfo : Rt(d, this.transformPagePoint), this.history);
1557
- this.startEvent && m && m(f, g), v && v(f, g);
1558
- }, !yn(e))
1559
- return;
1560
- this.dragSnapToOrigin = r, this.handlers = n, this.transformPagePoint = i, this.distanceThreshold = s, this.contextWindow = o || window;
1561
- const a = dt(e), l = Rt(a, this.transformPagePoint), { point: c } = l, { timestamp: u } = L;
1562
- this.history = [{ ...c, timestamp: u }];
1563
- const { onSessionStart: h } = n;
1564
- h && h(e, Lt(l, this.history)), this.removeListeners = vn(rt(this.contextWindow, "pointermove", this.handlePointerMove), rt(this.contextWindow, "pointerup", this.handlePointerUp), rt(this.contextWindow, "pointercancel", this.handlePointerUp));
1565
- }
1566
- updateHandlers(e) {
1567
- this.handlers = e;
1568
- }
1569
- end() {
1570
- this.removeListeners && this.removeListeners(), H(this.updatePoint);
1571
- }
1572
- }
1573
- function Rt(t, e) {
1574
- return e ? { point: e(t.point) } : t;
1575
- }
1576
- function Ie(t, e) {
1577
- return { x: t.x - e.x, y: t.y - e.y };
1578
- }
1579
- function Lt({ point: t }, e) {
1580
- return {
1581
- point: t,
1582
- delta: Ie(t, ii(e)),
1583
- offset: Ie(t, vo(e)),
1584
- velocity: Po(e, 0.1)
1585
- };
1586
- }
1587
- function vo(t) {
1588
- return t[0];
1589
- }
1590
- function ii(t) {
1591
- return t[t.length - 1];
1592
- }
1593
- function Po(t, e) {
1594
- if (t.length < 2)
1595
- return { x: 0, y: 0 };
1596
- let n = t.length - 1, i = null;
1597
- const o = ii(t);
1598
- for (; n >= 0 && (i = t[n], !(o.timestamp - i.timestamp > gt(e))); )
1599
- n--;
1600
- if (!i)
1601
- return { x: 0, y: 0 };
1602
- const r = Ri(o.timestamp - i.timestamp);
1603
- if (r === 0)
1604
- return { x: 0, y: 0 };
1605
- const s = {
1606
- x: (o.x - i.x) / r,
1607
- y: (o.y - i.y) / r
1608
- };
1609
- return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
1610
- }
1611
- function xo(t, { min: e, max: n }, i) {
1612
- return e !== void 0 && t < e ? t = i ? S(e, t, i.min) : Math.max(t, e) : n !== void 0 && t > n && (t = i ? S(n, t, i.max) : Math.min(t, n)), t;
1613
- }
1614
- function ke(t, e, n) {
1615
- return {
1616
- min: e !== void 0 ? t.min + e : void 0,
1617
- max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
1618
- };
1619
- }
1620
- function To(t, { top: e, left: n, bottom: i, right: o }) {
1621
- return {
1622
- x: ke(t.x, n, o),
1623
- y: ke(t.y, e, i)
1624
- };
1625
- }
1626
- function Oe(t, e) {
1627
- let n = e.min - t.min, i = e.max - t.max;
1628
- return e.max - e.min < t.max - t.min && ([n, i] = [i, n]), { min: n, max: i };
1629
- }
1630
- function So(t, e) {
1631
- return {
1632
- x: Oe(t.x, e.x),
1633
- y: Oe(t.y, e.y)
1634
- };
1635
- }
1636
- function Vo(t, e) {
1637
- let n = 0.5;
1638
- const i = R(t), o = R(e);
1639
- return o > i ? n = Ot(e.min, e.max - i, t.min) : i > o && (n = Ot(t.min, t.max - o, e.min)), Pn(0, 1, n);
1640
- }
1641
- function Ao(t, e) {
1642
- const n = {};
1643
- return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
1644
- }
1645
- const Gt = 0.35;
1646
- function Co(t = Gt) {
1647
- return t === !1 ? t = 0 : t === !0 && (t = Gt), {
1648
- x: Fe(t, "left", "right"),
1649
- y: Fe(t, "top", "bottom")
1650
- };
1651
- }
1652
- function Fe(t, e, n) {
1653
- return {
1654
- min: Ue(t, e),
1655
- max: Ue(t, n)
1656
- };
1657
- }
1658
- function Ue(t, e) {
1659
- return typeof t == "number" ? t : t[e] || 0;
1660
- }
1661
- const wo = /* @__PURE__ */ new WeakMap();
1662
- class Do {
1663
- constructor(e) {
1664
- this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = x(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
1665
- }
1666
- start(e, { snapToCursor: n = !1, distanceThreshold: i } = {}) {
1667
- const { presenceContext: o } = this.visualElement;
1668
- if (o && o.isPresent === !1)
1669
- return;
1670
- const r = (h) => {
1671
- const { dragSnapToOrigin: f } = this.getProps();
1672
- f ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(dt(h).point);
1673
- }, s = (h, f) => {
1674
- const { drag: d, dragPropagation: m, onDragStart: v } = this.getProps();
1675
- if (d && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Li(d), !this.openDragLock))
1676
- return;
1677
- this.latestPointerEvent = h, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), j((g) => {
1678
- let p = this.getAxisMotionValue(g).get() || 0;
1679
- if (xt.test(p)) {
1680
- const { projection: y } = this.visualElement;
1681
- if (y && y.layout) {
1682
- const V = y.layout.layoutBox[g];
1683
- V && (p = R(V) * (parseFloat(p) / 100));
1684
- }
1685
- }
1686
- this.originPoint[g] = p;
1687
- }), v && T.postRender(() => v(h, f)), $t(this.visualElement, "transform");
1688
- const { animationState: P } = this.visualElement;
1689
- P && P.setActive("whileDrag", !0);
1690
- }, a = (h, f) => {
1691
- this.latestPointerEvent = h, this.latestPanInfo = f;
1692
- const { dragPropagation: d, dragDirectionLock: m, onDirectionLock: v, onDrag: P } = this.getProps();
1693
- if (!d && !this.openDragLock)
1694
- return;
1695
- const { offset: g } = f;
1696
- if (m && this.currentDirection === null) {
1697
- this.currentDirection = Mo(g), this.currentDirection !== null && v && v(this.currentDirection);
1698
- return;
1699
- }
1700
- this.updateAxis("x", f.point, g), this.updateAxis("y", f.point, g), this.visualElement.render(), P && P(h, f);
1701
- }, l = (h, f) => {
1702
- this.latestPointerEvent = h, this.latestPanInfo = f, this.stop(h, f), this.latestPointerEvent = null, this.latestPanInfo = null;
1703
- }, c = () => j((h) => this.getAnimationState(h) === "paused" && this.getAxisMotionValue(h).animation?.play()), { dragSnapToOrigin: u } = this.getProps();
1704
- this.panSession = new ni(e, {
1705
- onSessionStart: r,
1706
- onStart: s,
1707
- onMove: a,
1708
- onSessionEnd: l,
1709
- resumeAnimation: c
1710
- }, {
1711
- transformPagePoint: this.visualElement.getTransformPagePoint(),
1712
- dragSnapToOrigin: u,
1713
- distanceThreshold: i,
1714
- contextWindow: ei(this.visualElement)
1715
- });
1716
- }
1717
- /**
1718
- * @internal
1719
- */
1720
- stop(e, n) {
1721
- const i = e || this.latestPointerEvent, o = n || this.latestPanInfo, r = this.isDragging;
1722
- if (this.cancel(), !r || !o || !i)
1723
- return;
1724
- const { velocity: s } = o;
1725
- this.startAnimation(s);
1726
- const { onDragEnd: a } = this.getProps();
1727
- a && T.postRender(() => a(i, o));
1728
- }
1729
- /**
1730
- * @internal
1731
- */
1732
- cancel() {
1733
- this.isDragging = !1;
1734
- const { projection: e, animationState: n } = this.visualElement;
1735
- e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
1736
- const { dragPropagation: i } = this.getProps();
1737
- !i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
1738
- }
1739
- updateAxis(e, n, i) {
1740
- const { drag: o } = this.getProps();
1741
- if (!i || !pt(e, o, this.currentDirection))
1742
- return;
1743
- const r = this.getAxisMotionValue(e);
1744
- let s = this.originPoint[e] + i[e];
1745
- this.constraints && this.constraints[e] && (s = xo(s, this.constraints[e], this.elastic[e])), r.set(s);
1746
- }
1747
- resolveConstraints() {
1748
- const { dragConstraints: e, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, o = this.constraints;
1749
- e && K(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && i ? this.constraints = To(i.layoutBox, e) : this.constraints = !1, this.elastic = Co(n), o !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && j((r) => {
1750
- this.constraints !== !1 && this.getAxisMotionValue(r) && (this.constraints[r] = Ao(i.layoutBox[r], this.constraints[r]));
1751
- });
1752
- }
1753
- resolveRefConstraints() {
1754
- const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
1755
- if (!e || !K(e))
1756
- return !1;
1757
- const i = e.current;
1758
- mn(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
1759
- const { projection: o } = this.visualElement;
1760
- if (!o || !o.layout)
1761
- return !1;
1762
- const r = Ms(i, o.root, this.visualElement.getTransformPagePoint());
1763
- let s = So(o.layout.layoutBox, r);
1764
- if (n) {
1765
- const a = n(Cs(s));
1766
- this.hasMutatedConstraints = !!a, a && (s = Nn(a));
1767
- }
1768
- return s;
1769
- }
1770
- startAnimation(e) {
1771
- const { drag: n, dragMomentum: i, dragElastic: o, dragTransition: r, dragSnapToOrigin: s, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, c = j((u) => {
1772
- if (!pt(u, n, this.currentDirection))
1773
- return;
1774
- let h = l && l[u] || {};
1775
- s && (h = { min: 0, max: 0 });
1776
- const f = o ? 200 : 1e6, d = o ? 40 : 1e7, m = {
1777
- type: "inertia",
1778
- velocity: i ? e[u] : 0,
1779
- bounceStiffness: f,
1780
- bounceDamping: d,
1781
- timeConstant: 750,
1782
- restDelta: 1,
1783
- restSpeed: 10,
1784
- ...r,
1785
- ...h
1786
- };
1787
- return this.startAxisValueAnimation(u, m);
1788
- });
1789
- return Promise.all(c).then(a);
1790
- }
1791
- startAxisValueAnimation(e, n) {
1792
- const i = this.getAxisMotionValue(e);
1793
- return $t(this.visualElement, e), i.start(fe(e, i, 0, n, this.visualElement, !1));
1794
- }
1795
- stopAnimation() {
1796
- j((e) => this.getAxisMotionValue(e).stop());
1797
- }
1798
- pauseAnimation() {
1799
- j((e) => this.getAxisMotionValue(e).animation?.pause());
1800
- }
1801
- getAnimationState(e) {
1802
- return this.getAxisMotionValue(e).animation?.state;
1803
- }
1804
- /**
1805
- * Drag works differently depending on which props are provided.
1806
- *
1807
- * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
1808
- * - Otherwise, we apply the delta to the x/y motion values.
1809
- */
1810
- getAxisMotionValue(e) {
1811
- const n = `_drag${e.toUpperCase()}`, i = this.visualElement.getProps(), o = i[n];
1812
- return o || this.visualElement.getValue(e, (i.initial ? i.initial[e] : void 0) || 0);
1813
- }
1814
- snapToCursor(e) {
1815
- j((n) => {
1816
- const { drag: i } = this.getProps();
1817
- if (!pt(n, i, this.currentDirection))
1818
- return;
1819
- const { projection: o } = this.visualElement, r = this.getAxisMotionValue(n);
1820
- if (o && o.layout) {
1821
- const { min: s, max: a } = o.layout.layoutBox[n];
1822
- r.set(e[n] - S(s, a, 0.5));
1823
- }
1824
- });
1825
- }
1826
- /**
1827
- * When the viewport resizes we want to check if the measured constraints
1828
- * have changed and, if so, reposition the element within those new constraints
1829
- * relative to where it was before the resize.
1830
- */
1831
- scalePositionWithinConstraints() {
1832
- if (!this.visualElement.current)
1833
- return;
1834
- const { drag: e, dragConstraints: n } = this.getProps(), { projection: i } = this.visualElement;
1835
- if (!K(n) || !i || !this.constraints)
1836
- return;
1837
- this.stopAnimation();
1838
- const o = { x: 0, y: 0 };
1839
- j((s) => {
1840
- const a = this.getAxisMotionValue(s);
1841
- if (a && this.constraints !== !1) {
1842
- const l = a.get();
1843
- o[s] = Vo({ min: l, max: l }, this.constraints[s]);
1844
- }
1845
- });
1846
- const { transformTemplate: r } = this.visualElement.getProps();
1847
- this.visualElement.current.style.transform = r ? r({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.resolveConstraints(), j((s) => {
1848
- if (!pt(s, e, null))
1849
- return;
1850
- const a = this.getAxisMotionValue(s), { min: l, max: c } = this.constraints[s];
1851
- a.set(S(l, c, o[s]));
1852
- });
1853
- }
1854
- addListeners() {
1855
- if (!this.visualElement.current)
1856
- return;
1857
- wo.set(this.visualElement, this);
1858
- const e = this.visualElement.current, n = rt(e, "pointerdown", (l) => {
1859
- const { drag: c, dragListener: u = !0 } = this.getProps();
1860
- c && u && this.start(l);
1861
- }), i = () => {
1862
- const { dragConstraints: l } = this.getProps();
1863
- K(l) && l.current && (this.constraints = this.resolveRefConstraints());
1864
- }, { projection: o } = this.visualElement, r = o.addEventListener("measure", i);
1865
- o && !o.layout && (o.root && o.root.updateScroll(), o.updateLayout()), T.read(i);
1866
- const s = ht(window, "resize", () => this.scalePositionWithinConstraints()), a = o.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: c }) => {
1867
- this.isDragging && c && (j((u) => {
1868
- const h = this.getAxisMotionValue(u);
1869
- h && (this.originPoint[u] += l[u].translate, h.set(h.get() + l[u].translate));
1870
- }), this.visualElement.render());
1871
- }));
1872
- return () => {
1873
- s(), n(), r(), a && a();
1874
- };
1875
- }
1876
- getProps() {
1877
- const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: i = !1, dragPropagation: o = !1, dragConstraints: r = !1, dragElastic: s = Gt, dragMomentum: a = !0 } = e;
1878
- return {
1879
- ...e,
1880
- drag: n,
1881
- dragDirectionLock: i,
1882
- dragPropagation: o,
1883
- dragConstraints: r,
1884
- dragElastic: s,
1885
- dragMomentum: a
1886
- };
1887
- }
1888
- }
1889
- function pt(t, e, n) {
1890
- return (e === !0 || e === t) && (n === null || n === t);
1891
- }
1892
- function Mo(t, e = 10) {
1893
- let n = null;
1894
- return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
1895
- }
1896
- class Ro extends F {
1897
- constructor(e) {
1898
- super(e), this.removeGroupControls = Z, this.removeListeners = Z, this.controls = new Do(e);
1899
- }
1900
- mount() {
1901
- const { dragControls: e } = this.node.getProps();
1902
- e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || Z;
1903
- }
1904
- unmount() {
1905
- this.removeGroupControls(), this.removeListeners();
1906
- }
1907
- }
1908
- const Ne = (t) => (e, n) => {
1909
- t && T.postRender(() => t(e, n));
1910
- };
1911
- class Lo extends F {
1912
- constructor() {
1913
- super(...arguments), this.removePointerDownListener = Z;
1914
- }
1915
- onPointerDown(e) {
1916
- this.session = new ni(e, this.createPanHandlers(), {
1917
- transformPagePoint: this.node.getTransformPagePoint(),
1918
- contextWindow: ei(this.node)
1919
- });
1920
- }
1921
- createPanHandlers() {
1922
- const { onPanSessionStart: e, onPanStart: n, onPan: i, onPanEnd: o } = this.node.getProps();
1923
- return {
1924
- onSessionStart: Ne(e),
1925
- onStart: Ne(n),
1926
- onMove: i,
1927
- onEnd: (r, s) => {
1928
- delete this.session, o && T.postRender(() => o(r, s));
1929
- }
1930
- };
1931
- }
1932
- mount() {
1933
- this.removePointerDownListener = rt(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
1934
- }
1935
- update() {
1936
- this.session && this.session.updateHandlers(this.createPanHandlers());
1937
- }
1938
- unmount() {
1939
- this.removePointerDownListener(), this.session && this.session.end();
1940
- }
1941
- }
1942
- const vt = {
1943
- /**
1944
- * Global flag as to whether the tree has animated since the last time
1945
- * we resized the window
1946
- */
1947
- hasAnimatedSinceResize: !0,
1948
- /**
1949
- * We set this to true once, on the first update. Any nodes added to the tree beyond that
1950
- * update will be given a `data-projection-id` attribute.
1951
- */
1952
- hasEverUpdated: !1
1953
- };
1954
- function We(t, e) {
1955
- return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
1956
- }
1957
- const st = {
1958
- correct: (t, e) => {
1959
- if (!e.target)
1960
- return t;
1961
- if (typeof t == "string")
1962
- if (ot.test(t))
1963
- t = parseFloat(t);
1964
- else
1965
- return t;
1966
- const n = We(t, e.target.x), i = We(t, e.target.y);
1967
- return `${n}% ${i}%`;
1968
- }
1969
- }, bo = {
1970
- correct: (t, { treeScale: e, projectionDelta: n }) => {
1971
- const i = t, o = kt.parse(t);
1972
- if (o.length > 5)
1973
- return i;
1974
- const r = kt.createTransformer(t), s = typeof o[0] != "number" ? 1 : 0, a = n.x.scale * e.x, l = n.y.scale * e.y;
1975
- o[0 + s] /= a, o[1 + s] /= l;
1976
- const c = S(a, l, 0.5);
1977
- return typeof o[2 + s] == "number" && (o[2 + s] /= c), typeof o[3 + s] == "number" && (o[3 + s] /= c), r(o);
1978
- }
1979
- };
1980
- let bt = !1;
1981
- class Eo extends Wi {
1982
- /**
1983
- * This only mounts projection nodes for components that
1984
- * need measuring, we might want to do it for all components
1985
- * in order to incorporate transforms
1986
- */
1987
- componentDidMount() {
1988
- const { visualElement: e, layoutGroup: n, switchLayoutGroup: i, layoutId: o } = this.props, { projection: r } = e;
1989
- Qi(Bo), r && (n.group && n.group.add(r), i && i.register && o && i.register(r), bt && r.root.didUpdate(), r.addEventListener("animationComplete", () => {
1990
- this.safeToRemove();
1991
- }), r.setOptions({
1992
- ...r.options,
1993
- onExitComplete: () => this.safeToRemove()
1994
- })), vt.hasEverUpdated = !0;
1995
- }
1996
- getSnapshotBeforeUpdate(e) {
1997
- const { layoutDependency: n, visualElement: i, drag: o, isPresent: r } = this.props, { projection: s } = i;
1998
- return s && (s.isPresent = r, bt = !0, o || e.layoutDependency !== n || n === void 0 || e.isPresent !== r ? s.willUpdate() : this.safeToRemove(), e.isPresent !== r && (r ? s.promote() : s.relegate() || T.postRender(() => {
1999
- const a = s.getStack();
2000
- (!a || !a.members.length) && this.safeToRemove();
2001
- }))), null;
2002
- }
2003
- componentDidUpdate() {
2004
- const { projection: e } = this.props.visualElement;
2005
- e && (e.root.didUpdate(), Yt.postRender(() => {
2006
- !e.currentAnimation && e.isLead() && this.safeToRemove();
2007
- }));
2008
- }
2009
- componentWillUnmount() {
2010
- const { visualElement: e, layoutGroup: n, switchLayoutGroup: i } = this.props, { projection: o } = e;
2011
- bt = !0, o && (o.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(o), i && i.deregister && i.deregister(o));
2012
- }
2013
- safeToRemove() {
2014
- const { safeToRemove: e } = this.props;
2015
- e && e();
2016
- }
2017
- render() {
2018
- return null;
2019
- }
2020
- }
2021
- function si(t) {
2022
- const [e, n] = wn(), i = w(te);
2023
- return k.jsx(Eo, { ...t, layoutGroup: i, switchLayoutGroup: w(Fn), isPresent: e, safeToRemove: n });
2024
- }
2025
- const Bo = {
2026
- borderRadius: {
2027
- ...st,
2028
- applyTo: [
2029
- "borderTopLeftRadius",
2030
- "borderTopRightRadius",
2031
- "borderBottomLeftRadius",
2032
- "borderBottomRightRadius"
2033
- ]
2034
- },
2035
- borderTopLeftRadius: st,
2036
- borderTopRightRadius: st,
2037
- borderBottomLeftRadius: st,
2038
- borderBottomRightRadius: st,
2039
- boxShadow: bo
2040
- };
2041
- function jo(t, e, n) {
2042
- const i = D(t) ? t : Q(t);
2043
- return i.start(fe("", i, e, n)), i.animation;
2044
- }
2045
- const Io = (t, e) => t.depth - e.depth;
2046
- class ko {
2047
- constructor() {
2048
- this.children = [], this.isDirty = !1;
2049
- }
2050
- add(e) {
2051
- xn(this.children, e), this.isDirty = !0;
2052
- }
2053
- remove(e) {
2054
- Tn(this.children, e), this.isDirty = !0;
2055
- }
2056
- forEach(e) {
2057
- this.isDirty && this.children.sort(Io), this.isDirty = !1, this.children.forEach(e);
2058
- }
2059
- }
2060
- function Oo(t, e) {
2061
- const n = Xt.now(), i = ({ timestamp: o }) => {
2062
- const r = o - n;
2063
- r >= e && (H(i), t(r - e));
2064
- };
2065
- return T.setup(i, !0), () => H(i);
2066
- }
2067
- const oi = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Fo = oi.length, $e = (t) => typeof t == "string" ? parseFloat(t) : t, He = (t) => typeof t == "number" || ot.test(t);
2068
- function Uo(t, e, n, i, o, r) {
2069
- o ? (t.opacity = S(0, n.opacity ?? 1, No(i)), t.opacityExit = S(e.opacity ?? 1, 0, Wo(i))) : r && (t.opacity = S(e.opacity ?? 1, n.opacity ?? 1, i));
2070
- for (let s = 0; s < Fo; s++) {
2071
- const a = `border${oi[s]}Radius`;
2072
- let l = Ge(e, a), c = Ge(n, a);
2073
- if (l === void 0 && c === void 0)
2074
- continue;
2075
- l || (l = 0), c || (c = 0), l === 0 || c === 0 || He(l) === He(c) ? (t[a] = Math.max(S($e(l), $e(c), i), 0), (xt.test(c) || xt.test(l)) && (t[a] += "%")) : t[a] = c;
2076
- }
2077
- (e.rotate || n.rotate) && (t.rotate = S(e.rotate || 0, n.rotate || 0, i));
2078
- }
2079
- function Ge(t, e) {
2080
- return t[e] !== void 0 ? t[e] : t.borderRadius;
2081
- }
2082
- const No = /* @__PURE__ */ ri(0, 0.5, bi), Wo = /* @__PURE__ */ ri(0.5, 0.95, Z);
2083
- function ri(t, e, n) {
2084
- return (i) => i < t ? 0 : i > e ? 1 : n(Ot(t, e, i));
2085
- }
2086
- function ze(t, e) {
2087
- t.min = e.min, t.max = e.max;
2088
- }
2089
- function B(t, e) {
2090
- ze(t.x, e.x), ze(t.y, e.y);
2091
- }
2092
- function _e(t, e) {
2093
- t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
2094
- }
2095
- function Ke(t, e, n, i, o) {
2096
- return t -= e, t = St(t, 1 / n, i), o !== void 0 && (t = St(t, 1 / o, i)), t;
2097
- }
2098
- function $o(t, e = 0, n = 1, i = 0.5, o, r = t, s = t) {
2099
- if (xt.test(e) && (e = parseFloat(e), e = S(s.min, s.max, e / 100) - s.min), typeof e != "number")
2100
- return;
2101
- let a = S(r.min, r.max, i);
2102
- t === r && (a -= e), t.min = Ke(t.min, e, n, a, o), t.max = Ke(t.max, e, n, a, o);
2103
- }
2104
- function Xe(t, e, [n, i, o], r, s) {
2105
- $o(t, e[n], e[i], e[o], e.scale, r, s);
2106
- }
2107
- const Ho = ["x", "scaleX", "originX"], Go = ["y", "scaleY", "originY"];
2108
- function Ye(t, e, n, i) {
2109
- Xe(t.x, e, Ho, n ? n.x : void 0, i ? i.x : void 0), Xe(t.y, e, Go, n ? n.y : void 0, i ? i.y : void 0);
2110
- }
2111
- function qe(t) {
2112
- return t.translate === 0 && t.scale === 1;
2113
- }
2114
- function ai(t) {
2115
- return qe(t.x) && qe(t.y);
2116
- }
2117
- function Ze(t, e) {
2118
- return t.min === e.min && t.max === e.max;
2119
- }
2120
- function zo(t, e) {
2121
- return Ze(t.x, e.x) && Ze(t.y, e.y);
2122
- }
2123
- function Je(t, e) {
2124
- return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
2125
- }
2126
- function li(t, e) {
2127
- return Je(t.x, e.x) && Je(t.y, e.y);
2128
- }
2129
- function Qe(t) {
2130
- return R(t.x) / R(t.y);
2131
- }
2132
- function tn(t, e) {
2133
- return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
2134
- }
2135
- class _o {
2136
- constructor() {
2137
- this.members = [];
2138
- }
2139
- add(e) {
2140
- xn(this.members, e), e.scheduleRender();
2141
- }
2142
- remove(e) {
2143
- if (Tn(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
2144
- const n = this.members[this.members.length - 1];
2145
- n && this.promote(n);
2146
- }
2147
- }
2148
- relegate(e) {
2149
- const n = this.members.findIndex((o) => e === o);
2150
- if (n === 0)
2151
- return !1;
2152
- let i;
2153
- for (let o = n; o >= 0; o--) {
2154
- const r = this.members[o];
2155
- if (r.isPresent !== !1) {
2156
- i = r;
2157
- break;
2158
- }
2159
- }
2160
- return i ? (this.promote(i), !0) : !1;
2161
- }
2162
- promote(e, n) {
2163
- const i = this.lead;
2164
- if (e !== i && (this.prevLead = i, this.lead = e, e.show(), i)) {
2165
- i.instance && i.scheduleRender(), e.scheduleRender(), e.resumeFrom = i, n && (e.resumeFrom.preserveOpacity = !0), i.snapshot && (e.snapshot = i.snapshot, e.snapshot.latestValues = i.animationValues || i.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
2166
- const { crossfade: o } = e.options;
2167
- o === !1 && i.hide();
2168
- }
2169
- }
2170
- exitAnimationComplete() {
2171
- this.members.forEach((e) => {
2172
- const { options: n, resumingFrom: i } = e;
2173
- n.onExitComplete && n.onExitComplete(), i && i.options.onExitComplete && i.options.onExitComplete();
2174
- });
2175
- }
2176
- scheduleRender() {
2177
- this.members.forEach((e) => {
2178
- e.instance && e.scheduleRender(!1);
2179
- });
2180
- }
2181
- /**
2182
- * Clear any leads that have been removed this render to prevent them from being
2183
- * used in future animations and to prevent memory leaks
2184
- */
2185
- removeLeadSnapshot() {
2186
- this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
2187
- }
2188
- }
2189
- function Ko(t, e, n) {
2190
- let i = "";
2191
- const o = t.x.translate / e.x, r = t.y.translate / e.y, s = n?.z || 0;
2192
- if ((o || r || s) && (i = `translate3d(${o}px, ${r}px, ${s}px) `), (e.x !== 1 || e.y !== 1) && (i += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
2193
- const { transformPerspective: c, rotate: u, rotateX: h, rotateY: f, skewX: d, skewY: m } = n;
2194
- c && (i = `perspective(${c}px) ${i}`), u && (i += `rotate(${u}deg) `), h && (i += `rotateX(${h}deg) `), f && (i += `rotateY(${f}deg) `), d && (i += `skewX(${d}deg) `), m && (i += `skewY(${m}deg) `);
2195
- }
2196
- const a = t.x.scale * e.x, l = t.y.scale * e.y;
2197
- return (a !== 1 || l !== 1) && (i += `scale(${a}, ${l})`), i || "none";
2198
- }
2199
- const Et = ["", "X", "Y", "Z"], Xo = 1e3;
2200
- let Yo = 0;
2201
- function Bt(t, e, n, i) {
2202
- const { latestValues: o } = e;
2203
- o[t] && (n[t] = o[t], e.setStaticValue(t, 0), i && (i[t] = 0));
2204
- }
2205
- function ui(t) {
2206
- if (t.hasCheckedOptimisedAppear = !0, t.root === t)
2207
- return;
2208
- const { visualElement: e } = t.options;
2209
- if (!e)
2210
- return;
2211
- const n = Xn(e);
2212
- if (window.MotionHasOptimisedAnimation(n, "transform")) {
2213
- const { layout: o, layoutId: r } = t.options;
2214
- window.MotionCancelOptimisedAnimation(n, "transform", T, !(o || r));
2215
- }
2216
- const { parent: i } = t;
2217
- i && !i.hasCheckedOptimisedAppear && ui(i);
2218
- }
2219
- function ci({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: i, resetTransform: o }) {
2220
- return class {
2221
- constructor(s = {}, a = e?.()) {
2222
- this.id = Yo++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
2223
- this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
2224
- }, this.updateProjection = () => {
2225
- this.projectionUpdateScheduled = !1, this.nodes.forEach(Jo), this.nodes.forEach(nr), this.nodes.forEach(ir), this.nodes.forEach(Qo);
2226
- }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = s, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
2227
- for (let l = 0; l < this.path.length; l++)
2228
- this.path[l].shouldResetTransform = !0;
2229
- this.root === this && (this.nodes = new ko());
2230
- }
2231
- addEventListener(s, a) {
2232
- return this.eventHandlers.has(s) || this.eventHandlers.set(s, new gn()), this.eventHandlers.get(s).add(a);
2233
- }
2234
- notifyListeners(s, ...a) {
2235
- const l = this.eventHandlers.get(s);
2236
- l && l.notify(...a);
2237
- }
2238
- hasListeners(s) {
2239
- return this.eventHandlers.has(s);
2240
- }
2241
- /**
2242
- * Lifecycles
2243
- */
2244
- mount(s) {
2245
- if (this.instance)
2246
- return;
2247
- this.isSVG = Ei(s) && !Bi(s), this.instance = s;
2248
- const { layoutId: a, layout: l, visualElement: c } = this.options;
2249
- if (c && !c.current && c.mount(s), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (l || a) && (this.isLayoutDirty = !0), t) {
2250
- let u, h = 0;
2251
- const f = () => this.root.updateBlockedByResize = !1;
2252
- T.read(() => {
2253
- h = window.innerWidth;
2254
- }), t(s, () => {
2255
- const d = window.innerWidth;
2256
- d !== h && (h = d, this.root.updateBlockedByResize = !0, u && u(), u = Oo(f, 250), vt.hasAnimatedSinceResize && (vt.hasAnimatedSinceResize = !1, this.nodes.forEach(sn)));
2257
- });
2258
- }
2259
- a && this.root.registerSharedNode(a, this), this.options.animate !== !1 && c && (a || l) && this.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: h, hasRelativeLayoutChanged: f, layout: d }) => {
2260
- if (this.isTreeAnimationBlocked()) {
2261
- this.target = void 0, this.relativeTarget = void 0;
2262
- return;
2263
- }
2264
- const m = this.options.transition || c.getDefaultTransition() || lr, { onLayoutAnimationStart: v, onLayoutAnimationComplete: P } = c.getProps(), g = !this.targetLayout || !li(this.targetLayout, d), p = !h && f;
2265
- if (this.options.layoutRoot || this.resumeFrom || p || h && (g || !this.currentAnimation)) {
2266
- this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
2267
- const y = {
2268
- ...qt(m, "layout"),
2269
- onPlay: v,
2270
- onComplete: P
2271
- };
2272
- (c.shouldReduceMotion || this.options.layoutRoot) && (y.delay = 0, y.type = !1), this.startAnimation(y), this.setAnimationOrigin(u, p);
2273
- } else
2274
- h || sn(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
2275
- this.targetLayout = d;
2276
- });
2277
- }
2278
- unmount() {
2279
- this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
2280
- const s = this.getStack();
2281
- s && s.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), H(this.updateProjection);
2282
- }
2283
- // only on the root
2284
- blockUpdate() {
2285
- this.updateManuallyBlocked = !0;
2286
- }
2287
- unblockUpdate() {
2288
- this.updateManuallyBlocked = !1;
2289
- }
2290
- isUpdateBlocked() {
2291
- return this.updateManuallyBlocked || this.updateBlockedByResize;
2292
- }
2293
- isTreeAnimationBlocked() {
2294
- return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
2295
- }
2296
- // Note: currently only running on root node
2297
- startUpdate() {
2298
- this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(sr), this.animationId++);
2299
- }
2300
- getTransformTemplate() {
2301
- const { visualElement: s } = this.options;
2302
- return s && s.getProps().transformTemplate;
2303
- }
2304
- willUpdate(s = !0) {
2305
- if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
2306
- this.options.onExitComplete && this.options.onExitComplete();
2307
- return;
2308
- }
2309
- if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && ui(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
2310
- return;
2311
- this.isLayoutDirty = !0;
2312
- for (let u = 0; u < this.path.length; u++) {
2313
- const h = this.path[u];
2314
- h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
2315
- }
2316
- const { layoutId: a, layout: l } = this.options;
2317
- if (a === void 0 && !l)
2318
- return;
2319
- const c = this.getTransformTemplate();
2320
- this.prevTransformTemplateValue = c ? c(this.latestValues, "") : void 0, this.updateSnapshot(), s && this.notifyListeners("willUpdate");
2321
- }
2322
- update() {
2323
- if (this.updateScheduled = !1, this.isUpdateBlocked()) {
2324
- this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(en);
2325
- return;
2326
- }
2327
- if (this.animationId <= this.animationCommitId) {
2328
- this.nodes.forEach(nn);
2329
- return;
2330
- }
2331
- this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(er), this.nodes.forEach(qo), this.nodes.forEach(Zo)) : this.nodes.forEach(nn), this.clearAllSnapshots();
2332
- const a = Xt.now();
2333
- L.delta = Pn(0, 1e3 / 60, a - L.timestamp), L.timestamp = a, L.isProcessing = !0, wt.update.process(L), wt.preRender.process(L), wt.render.process(L), L.isProcessing = !1;
2334
- }
2335
- didUpdate() {
2336
- this.updateScheduled || (this.updateScheduled = !0, Yt.read(this.scheduleUpdate));
2337
- }
2338
- clearAllSnapshots() {
2339
- this.nodes.forEach(tr), this.sharedNodes.forEach(or);
2340
- }
2341
- scheduleUpdateProjection() {
2342
- this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, T.preRender(this.updateProjection, !1, !0));
2343
- }
2344
- scheduleCheckAfterUnmount() {
2345
- T.postRender(() => {
2346
- this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
2347
- });
2348
- }
2349
- /**
2350
- * Update measurements
2351
- */
2352
- updateSnapshot() {
2353
- this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !R(this.snapshot.measuredBox.x) && !R(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
2354
- }
2355
- updateLayout() {
2356
- if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
2357
- return;
2358
- if (this.resumeFrom && !this.resumeFrom.instance)
2359
- for (let l = 0; l < this.path.length; l++)
2360
- this.path[l].updateScroll();
2361
- const s = this.layout;
2362
- this.layout = this.measure(!1), this.layoutCorrected = x(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
2363
- const { visualElement: a } = this.options;
2364
- a && a.notify("LayoutMeasure", this.layout.layoutBox, s ? s.layoutBox : void 0);
2365
- }
2366
- updateScroll(s = "measure") {
2367
- let a = !!(this.options.layoutScroll && this.instance);
2368
- if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === s && (a = !1), a && this.instance) {
2369
- const l = i(this.instance);
2370
- this.scroll = {
2371
- animationId: this.root.animationId,
2372
- phase: s,
2373
- isRoot: l,
2374
- offset: n(this.instance),
2375
- wasRoot: this.scroll ? this.scroll.isRoot : l
2376
- };
2377
- }
2378
- }
2379
- resetTransform() {
2380
- if (!o)
2381
- return;
2382
- const s = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !ai(this.projectionDelta), l = this.getTransformTemplate(), c = l ? l(this.latestValues, "") : void 0, u = c !== this.prevTransformTemplateValue;
2383
- s && this.instance && (a || $(this.latestValues) || u) && (o(this.instance, c), this.shouldResetTransform = !1, this.scheduleRender());
2384
- }
2385
- measure(s = !0) {
2386
- const a = this.measurePageBox();
2387
- let l = this.removeElementScroll(a);
2388
- return s && (l = this.removeTransform(l)), ur(l), {
2389
- animationId: this.root.animationId,
2390
- measuredBox: a,
2391
- layoutBox: l,
2392
- latestValues: {},
2393
- source: this.id
2394
- };
2395
- }
2396
- measurePageBox() {
2397
- const { visualElement: s } = this.options;
2398
- if (!s)
2399
- return x();
2400
- const a = s.measureViewportBox();
2401
- if (!(this.scroll?.wasRoot || this.path.some(cr))) {
2402
- const { scroll: c } = this.root;
2403
- c && (X(a.x, c.offset.x), X(a.y, c.offset.y));
2404
- }
2405
- return a;
2406
- }
2407
- removeElementScroll(s) {
2408
- const a = x();
2409
- if (B(a, s), this.scroll?.wasRoot)
2410
- return a;
2411
- for (let l = 0; l < this.path.length; l++) {
2412
- const c = this.path[l], { scroll: u, options: h } = c;
2413
- c !== this.root && u && h.layoutScroll && (u.wasRoot && B(a, s), X(a.x, u.offset.x), X(a.y, u.offset.y));
2414
- }
2415
- return a;
2416
- }
2417
- applyTransform(s, a = !1) {
2418
- const l = x();
2419
- B(l, s);
2420
- for (let c = 0; c < this.path.length; c++) {
2421
- const u = this.path[c];
2422
- !a && u.options.layoutScroll && u.scroll && u !== u.root && Y(l, {
2423
- x: -u.scroll.offset.x,
2424
- y: -u.scroll.offset.y
2425
- }), $(u.latestValues) && Y(l, u.latestValues);
2426
- }
2427
- return $(this.latestValues) && Y(l, this.latestValues), l;
2428
- }
2429
- removeTransform(s) {
2430
- const a = x();
2431
- B(a, s);
2432
- for (let l = 0; l < this.path.length; l++) {
2433
- const c = this.path[l];
2434
- if (!c.instance || !$(c.latestValues))
2435
- continue;
2436
- Ft(c.latestValues) && c.updateSnapshot();
2437
- const u = x(), h = c.measurePageBox();
2438
- B(u, h), Ye(a, c.latestValues, c.snapshot ? c.snapshot.layoutBox : void 0, u);
2439
- }
2440
- return $(this.latestValues) && Ye(a, this.latestValues), a;
2441
- }
2442
- setTargetDelta(s) {
2443
- this.targetDelta = s, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
2444
- }
2445
- setOptions(s) {
2446
- this.options = {
2447
- ...this.options,
2448
- ...s,
2449
- crossfade: s.crossfade !== void 0 ? s.crossfade : !0
2450
- };
2451
- }
2452
- clearMeasurements() {
2453
- this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
2454
- }
2455
- forceRelativeParentToResolveTarget() {
2456
- this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== L.timestamp && this.relativeParent.resolveTargetDelta(!0);
2457
- }
2458
- resolveTargetDelta(s = !1) {
2459
- const a = this.getLead();
2460
- this.isProjectionDirty || (this.isProjectionDirty = a.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = a.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = a.isSharedProjectionDirty);
2461
- const l = !!this.resumingFrom || this !== a;
2462
- if (!(s || l && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
2463
- return;
2464
- const { layout: u, layoutId: h } = this.options;
2465
- if (!(!this.layout || !(u || h))) {
2466
- if (this.resolvedRelativeTargetAt = L.timestamp, !this.targetDelta && !this.relativeTarget) {
2467
- const f = this.getClosestProjectingParent();
2468
- f && f.layout && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = x(), this.relativeTargetOrigin = x(), lt(this.relativeTargetOrigin, this.layout.layoutBox, f.layout.layoutBox), B(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
2469
- }
2470
- if (!(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = x(), this.targetWithTransforms = x()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), go(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : B(this.target, this.layout.layoutBox), $n(this.target, this.targetDelta)) : B(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget)) {
2471
- this.attemptToResolveRelativeTarget = !1;
2472
- const f = this.getClosestProjectingParent();
2473
- f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = x(), this.relativeTargetOrigin = x(), lt(this.relativeTargetOrigin, this.target, f.target), B(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
2474
- }
2475
- }
2476
- }
2477
- getClosestProjectingParent() {
2478
- if (!(!this.parent || Ft(this.parent.latestValues) || Wn(this.parent.latestValues)))
2479
- return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
2480
- }
2481
- isProjecting() {
2482
- return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
2483
- }
2484
- calcProjection() {
2485
- const s = this.getLead(), a = !!this.resumingFrom || this !== s;
2486
- let l = !0;
2487
- if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (l = !1), a && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === L.timestamp && (l = !1), l)
2488
- return;
2489
- const { layout: c, layoutId: u } = this.options;
2490
- if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(c || u))
2491
- return;
2492
- B(this.layoutCorrected, this.layout.layoutBox);
2493
- const h = this.treeScale.x, f = this.treeScale.y;
2494
- Ds(this.layoutCorrected, this.treeScale, this.path, a), s.layout && !s.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (s.target = s.layout.layoutBox, s.targetWithTransforms = x());
2495
- const { target: d } = s;
2496
- if (!d) {
2497
- this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
2498
- return;
2499
- }
2500
- !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (_e(this.prevProjectionDelta.x, this.projectionDelta.x), _e(this.prevProjectionDelta.y, this.projectionDelta.y)), at(this.projectionDelta, this.layoutCorrected, d, this.latestValues), (this.treeScale.x !== h || this.treeScale.y !== f || !tn(this.projectionDelta.x, this.prevProjectionDelta.x) || !tn(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", d));
2501
- }
2502
- hide() {
2503
- this.isVisible = !1;
2504
- }
2505
- show() {
2506
- this.isVisible = !0;
2507
- }
2508
- scheduleRender(s = !0) {
2509
- if (this.options.visualElement?.scheduleRender(), s) {
2510
- const a = this.getStack();
2511
- a && a.scheduleRender();
2512
- }
2513
- this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
2514
- }
2515
- createProjectionDeltas() {
2516
- this.prevProjectionDelta = q(), this.projectionDelta = q(), this.projectionDeltaWithTransform = q();
2517
- }
2518
- setAnimationOrigin(s, a = !1) {
2519
- const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, h = q();
2520
- (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
2521
- const f = x(), d = l ? l.source : void 0, m = this.layout ? this.layout.source : void 0, v = d !== m, P = this.getStack(), g = !P || P.members.length <= 1, p = !!(v && !g && this.options.crossfade === !0 && !this.path.some(ar));
2522
- this.animationProgress = 0;
2523
- let y;
2524
- this.mixTargetDelta = (V) => {
2525
- const b = V / 1e3;
2526
- on(h.x, s.x, b), on(h.y, s.y, b), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (lt(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), rr(this.relativeTarget, this.relativeTargetOrigin, f, b), y && zo(this.relativeTarget, y) && (this.isProjectionDirty = !1), y || (y = x()), B(y, this.relativeTarget)), v && (this.animationValues = u, Uo(u, c, this.latestValues, b, p, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = b;
2527
- }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
2528
- }
2529
- startAnimation(s) {
2530
- this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (H(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = T.update(() => {
2531
- vt.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = Q(0)), this.currentAnimation = jo(this.motionValue, [0, 1e3], {
2532
- ...s,
2533
- velocity: 0,
2534
- isSync: !0,
2535
- onUpdate: (a) => {
2536
- this.mixTargetDelta(a), s.onUpdate && s.onUpdate(a);
2537
- },
2538
- onStop: () => {
2539
- },
2540
- onComplete: () => {
2541
- s.onComplete && s.onComplete(), this.completeAnimation();
2542
- }
2543
- }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
2544
- });
2545
- }
2546
- completeAnimation() {
2547
- this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
2548
- const s = this.getStack();
2549
- s && s.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
2550
- }
2551
- finishAnimation() {
2552
- this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Xo), this.currentAnimation.stop()), this.completeAnimation();
2553
- }
2554
- applyTransformsToTarget() {
2555
- const s = this.getLead();
2556
- let { targetWithTransforms: a, target: l, layout: c, latestValues: u } = s;
2557
- if (!(!a || !l || !c)) {
2558
- if (this !== s && this.layout && c && hi(this.options.animationType, this.layout.layoutBox, c.layoutBox)) {
2559
- l = this.target || x();
2560
- const h = R(this.layout.layoutBox.x);
2561
- l.x.min = s.target.x.min, l.x.max = l.x.min + h;
2562
- const f = R(this.layout.layoutBox.y);
2563
- l.y.min = s.target.y.min, l.y.max = l.y.min + f;
2564
- }
2565
- B(a, l), Y(a, u), at(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
2566
- }
2567
- }
2568
- registerSharedNode(s, a) {
2569
- this.sharedNodes.has(s) || this.sharedNodes.set(s, new _o()), this.sharedNodes.get(s).add(a);
2570
- const c = a.options.initialPromotionConfig;
2571
- a.promote({
2572
- transition: c ? c.transition : void 0,
2573
- preserveFollowOpacity: c && c.shouldPreserveFollowOpacity ? c.shouldPreserveFollowOpacity(a) : void 0
2574
- });
2575
- }
2576
- isLead() {
2577
- const s = this.getStack();
2578
- return s ? s.lead === this : !0;
2579
- }
2580
- getLead() {
2581
- const { layoutId: s } = this.options;
2582
- return s ? this.getStack()?.lead || this : this;
2583
- }
2584
- getPrevLead() {
2585
- const { layoutId: s } = this.options;
2586
- return s ? this.getStack()?.prevLead : void 0;
2587
- }
2588
- getStack() {
2589
- const { layoutId: s } = this.options;
2590
- if (s)
2591
- return this.root.sharedNodes.get(s);
2592
- }
2593
- promote({ needsReset: s, transition: a, preserveFollowOpacity: l } = {}) {
2594
- const c = this.getStack();
2595
- c && c.promote(this, l), s && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
2596
- }
2597
- relegate() {
2598
- const s = this.getStack();
2599
- return s ? s.relegate(this) : !1;
2600
- }
2601
- resetSkewAndRotation() {
2602
- const { visualElement: s } = this.options;
2603
- if (!s)
2604
- return;
2605
- let a = !1;
2606
- const { latestValues: l } = s;
2607
- if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
2608
- return;
2609
- const c = {};
2610
- l.z && Bt("z", s, c, this.animationValues);
2611
- for (let u = 0; u < Et.length; u++)
2612
- Bt(`rotate${Et[u]}`, s, c, this.animationValues), Bt(`skew${Et[u]}`, s, c, this.animationValues);
2613
- s.render();
2614
- for (const u in c)
2615
- s.setStaticValue(u, c[u]), this.animationValues && (this.animationValues[u] = c[u]);
2616
- s.scheduleRender();
2617
- }
2618
- applyProjectionStyles(s, a) {
2619
- if (!this.instance || this.isSVG)
2620
- return;
2621
- if (!this.isVisible) {
2622
- s.visibility = "hidden";
2623
- return;
2624
- }
2625
- const l = this.getTransformTemplate();
2626
- if (this.needsReset) {
2627
- this.needsReset = !1, s.visibility = "", s.opacity = "", s.pointerEvents = yt(a?.pointerEvents) || "", s.transform = l ? l(this.latestValues, "") : "none";
2628
- return;
2629
- }
2630
- const c = this.getLead();
2631
- if (!this.projectionDelta || !this.layout || !c.target) {
2632
- this.options.layoutId && (s.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, s.pointerEvents = yt(a?.pointerEvents) || ""), this.hasProjected && !$(this.latestValues) && (s.transform = l ? l({}, "") : "none", this.hasProjected = !1);
2633
- return;
2634
- }
2635
- s.visibility = "";
2636
- const u = c.animationValues || c.latestValues;
2637
- this.applyTransformsToTarget();
2638
- let h = Ko(this.projectionDeltaWithTransform, this.treeScale, u);
2639
- l && (h = l(u, h)), s.transform = h;
2640
- const { x: f, y: d } = this.projectionDelta;
2641
- s.transformOrigin = `${f.origin * 100}% ${d.origin * 100}% 0`, c.animationValues ? s.opacity = c === this ? u.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : u.opacityExit : s.opacity = c === this ? u.opacity !== void 0 ? u.opacity : "" : u.opacityExit !== void 0 ? u.opacityExit : 0;
2642
- for (const m in ct) {
2643
- if (u[m] === void 0)
2644
- continue;
2645
- const { correct: v, applyTo: P, isCSSVariable: g } = ct[m], p = h === "none" ? u[m] : v(u[m], c);
2646
- if (P) {
2647
- const y = P.length;
2648
- for (let V = 0; V < y; V++)
2649
- s[P[V]] = p;
2650
- } else
2651
- g ? this.options.visualElement.renderState.vars[m] = p : s[m] = p;
2652
- }
2653
- this.options.layoutId && (s.pointerEvents = c === this ? yt(a?.pointerEvents) || "" : "none");
2654
- }
2655
- clearSnapshot() {
2656
- this.resumeFrom = this.snapshot = void 0;
2657
- }
2658
- // Only run on root
2659
- resetTree() {
2660
- this.root.nodes.forEach((s) => s.currentAnimation?.stop()), this.root.nodes.forEach(en), this.root.sharedNodes.clear();
2661
- }
2662
- };
2663
- }
2664
- function qo(t) {
2665
- t.updateLayout();
2666
- }
2667
- function Zo(t) {
2668
- const e = t.resumeFrom?.snapshot || t.snapshot;
2669
- if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
2670
- const { layoutBox: n, measuredBox: i } = t.layout, { animationType: o } = t.options, r = e.source !== t.layout.source;
2671
- o === "size" ? j((u) => {
2672
- const h = r ? e.measuredBox[u] : e.layoutBox[u], f = R(h);
2673
- h.min = n[u].min, h.max = h.min + f;
2674
- }) : hi(o, e.layoutBox, n) && j((u) => {
2675
- const h = r ? e.measuredBox[u] : e.layoutBox[u], f = R(n[u]);
2676
- h.max = h.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[u].max = t.relativeTarget[u].min + f);
2677
- });
2678
- const s = q();
2679
- at(s, n, e.layoutBox);
2680
- const a = q();
2681
- r ? at(a, t.applyTransform(i, !0), e.measuredBox) : at(a, n, e.layoutBox);
2682
- const l = !ai(s);
2683
- let c = !1;
2684
- if (!t.resumeFrom) {
2685
- const u = t.getClosestProjectingParent();
2686
- if (u && !u.resumeFrom) {
2687
- const { snapshot: h, layout: f } = u;
2688
- if (h && f) {
2689
- const d = x();
2690
- lt(d, e.layoutBox, h.layoutBox);
2691
- const m = x();
2692
- lt(m, n, f.layoutBox), li(d, m) || (c = !0), u.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = d, t.relativeParent = u);
2693
- }
2694
- }
2695
- }
2696
- t.notifyListeners("didUpdate", {
2697
- layout: n,
2698
- snapshot: e,
2699
- delta: a,
2700
- layoutDelta: s,
2701
- hasLayoutChanged: l,
2702
- hasRelativeLayoutChanged: c
2703
- });
2704
- } else if (t.isLead()) {
2705
- const { onExitComplete: n } = t.options;
2706
- n && n();
2707
- }
2708
- t.options.transition = void 0;
2709
- }
2710
- function Jo(t) {
2711
- t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
2712
- }
2713
- function Qo(t) {
2714
- t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
2715
- }
2716
- function tr(t) {
2717
- t.clearSnapshot();
2718
- }
2719
- function en(t) {
2720
- t.clearMeasurements();
2721
- }
2722
- function nn(t) {
2723
- t.isLayoutDirty = !1;
2724
- }
2725
- function er(t) {
2726
- const { visualElement: e } = t.options;
2727
- e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
2728
- }
2729
- function sn(t) {
2730
- t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
2731
- }
2732
- function nr(t) {
2733
- t.resolveTargetDelta();
2734
- }
2735
- function ir(t) {
2736
- t.calcProjection();
2737
- }
2738
- function sr(t) {
2739
- t.resetSkewAndRotation();
2740
- }
2741
- function or(t) {
2742
- t.removeLeadSnapshot();
2743
- }
2744
- function on(t, e, n) {
2745
- t.translate = S(e.translate, 0, n), t.scale = S(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
2746
- }
2747
- function rn(t, e, n, i) {
2748
- t.min = S(e.min, n.min, i), t.max = S(e.max, n.max, i);
2749
- }
2750
- function rr(t, e, n, i) {
2751
- rn(t.x, e.x, n.x, i), rn(t.y, e.y, n.y, i);
2752
- }
2753
- function ar(t) {
2754
- return t.animationValues && t.animationValues.opacityExit !== void 0;
2755
- }
2756
- const lr = {
2757
- duration: 0.45,
2758
- ease: [0.4, 0, 0.1, 1]
2759
- }, an = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), ln = an("applewebkit/") && !an("chrome/") ? Math.round : Z;
2760
- function un(t) {
2761
- t.min = ln(t.min), t.max = ln(t.max);
2762
- }
2763
- function ur(t) {
2764
- un(t.x), un(t.y);
2765
- }
2766
- function hi(t, e, n) {
2767
- return t === "position" || t === "preserve-aspect" && !po(Qe(e), Qe(n), 0.2);
2768
- }
2769
- function cr(t) {
2770
- return t !== t.root && t.scroll?.wasRoot;
2771
- }
2772
- const hr = ci({
2773
- attachResizeListener: (t, e) => ht(t, "resize", e),
2774
- measureScroll: () => ({
2775
- x: document.documentElement.scrollLeft || document.body.scrollLeft,
2776
- y: document.documentElement.scrollTop || document.body.scrollTop
2777
- }),
2778
- checkIsScrollRoot: () => !0
2779
- }), jt = {
2780
- current: void 0
2781
- }, fi = ci({
2782
- measureScroll: (t) => ({
2783
- x: t.scrollLeft,
2784
- y: t.scrollTop
2785
- }),
2786
- defaultParent: () => {
2787
- if (!jt.current) {
2788
- const t = new hr({});
2789
- t.mount(window), t.setOptions({ layoutScroll: !0 }), jt.current = t;
2790
- }
2791
- return jt.current;
2792
- },
2793
- resetTransform: (t, e) => {
2794
- t.style.transform = e !== void 0 ? e : "none";
2795
- },
2796
- checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
2797
- }), fr = {
2798
- pan: {
2799
- Feature: Lo
2800
- },
2801
- drag: {
2802
- Feature: Ro,
2803
- ProjectionNode: fi,
2804
- MeasureLayout: si
2805
- }
2806
- };
2807
- function cn(t, e, n) {
2808
- const { props: i } = t;
2809
- t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
2810
- const o = "onHover" + n, r = i[o];
2811
- r && T.postRender(() => r(e, dt(e)));
2812
- }
2813
- class dr extends F {
2814
- mount() {
2815
- const { current: e } = this.node;
2816
- e && (this.unmount = ji(e, (n, i) => (cn(this.node, i, "Start"), (o) => cn(this.node, o, "End"))));
2817
- }
2818
- unmount() {
2819
- }
2820
- }
2821
- class mr extends F {
2822
- constructor() {
2823
- super(...arguments), this.isActive = !1;
2824
- }
2825
- onFocus() {
2826
- let e = !1;
2827
- try {
2828
- e = this.node.current.matches(":focus-visible");
2829
- } catch {
2830
- e = !0;
2831
- }
2832
- !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
2833
- }
2834
- onBlur() {
2835
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
2836
- }
2837
- mount() {
2838
- this.unmount = vn(ht(this.node.current, "focus", () => this.onFocus()), ht(this.node.current, "blur", () => this.onBlur()));
2839
- }
2840
- unmount() {
2841
- }
2842
- }
2843
- function hn(t, e, n) {
2844
- const { props: i } = t;
2845
- if (t.current instanceof HTMLButtonElement && t.current.disabled)
2846
- return;
2847
- t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
2848
- const o = "onTap" + (n === "End" ? "" : n), r = i[o];
2849
- r && T.postRender(() => r(e, dt(e)));
2850
- }
2851
- class pr extends F {
2852
- mount() {
2853
- const { current: e } = this.node;
2854
- e && (this.unmount = Ii(e, (n, i) => (hn(this.node, i, "Start"), (o, { success: r }) => hn(this.node, o, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
2855
- }
2856
- unmount() {
2857
- }
2858
- }
2859
- const zt = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakMap(), gr = (t) => {
2860
- const e = zt.get(t.target);
2861
- e && e(t);
2862
- }, yr = (t) => {
2863
- t.forEach(gr);
2864
- };
2865
- function vr({ root: t, ...e }) {
2866
- const n = t || document;
2867
- It.has(n) || It.set(n, {});
2868
- const i = It.get(n), o = JSON.stringify(e);
2869
- return i[o] || (i[o] = new IntersectionObserver(yr, { root: t, ...e })), i[o];
2870
- }
2871
- function Pr(t, e, n) {
2872
- const i = vr(e);
2873
- return zt.set(t, n), i.observe(t), () => {
2874
- zt.delete(t), i.unobserve(t);
2875
- };
2876
- }
2877
- const xr = {
2878
- some: 0,
2879
- all: 1
2880
- };
2881
- class Tr extends F {
2882
- constructor() {
2883
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2884
- }
2885
- startObserver() {
2886
- this.unmount();
2887
- const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: o = "some", once: r } = e, s = {
2888
- root: n ? n.current : void 0,
2889
- rootMargin: i,
2890
- threshold: typeof o == "number" ? o : xr[o]
2891
- }, a = (l) => {
2892
- const { isIntersecting: c } = l;
2893
- if (this.isInView === c || (this.isInView = c, r && !c && this.hasEnteredView))
2894
- return;
2895
- c && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", c);
2896
- const { onViewportEnter: u, onViewportLeave: h } = this.node.getProps(), f = c ? u : h;
2897
- f && f(l);
2898
- };
2899
- return Pr(this.node.current, s, a);
2900
- }
2901
- mount() {
2902
- this.startObserver();
2903
- }
2904
- update() {
2905
- if (typeof IntersectionObserver > "u")
2906
- return;
2907
- const { props: e, prevProps: n } = this.node;
2908
- ["amount", "margin", "root"].some(Sr(e, n)) && this.startObserver();
2909
- }
2910
- unmount() {
2911
- }
2912
- }
2913
- function Sr({ viewport: t = {} }, { viewport: e = {} } = {}) {
2914
- return (n) => t[n] !== e[n];
2915
- }
2916
- const Vr = {
2917
- inView: {
2918
- Feature: Tr
2919
- },
2920
- tap: {
2921
- Feature: pr
2922
- },
2923
- focus: {
2924
- Feature: mr
2925
- },
2926
- hover: {
2927
- Feature: dr
2928
- }
2929
- }, Ar = {
2930
- layout: {
2931
- ProjectionNode: fi,
2932
- MeasureLayout: si
2933
- }
2934
- }, Cr = {
2935
- ...lo,
2936
- ...Vr,
2937
- ...fr,
2938
- ...Ar
2939
- }, Er = /* @__PURE__ */ As(Cr, Os);
2940
- export {
2941
- Lr as A,
2942
- wn as a,
2943
- Er as m,
2944
- Rr as u
2945
- };