svg-scroll-draw 2.18.0 → 2.19.0
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.
- package/README.md +10 -10
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +3 -3
- package/dist/angular/index.d.ts +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.d.mts +6 -5
- package/dist/astro/index.d.ts +6 -5
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +133 -31
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/chunk-7SBTYJGH.mjs +1 -0
- package/dist/chunk-A4JCC3QQ.mjs +1 -0
- package/dist/chunk-BFX2CSQ3.mjs +1 -0
- package/dist/chunk-I45LCJUP.mjs +1 -0
- package/dist/{chunk-DIMNQPW5.mjs → chunk-JPK2NJWO.mjs} +1 -1
- package/dist/chunk-KHQ7OGQK.mjs +1 -0
- package/dist/chunk-MTEGM4RR.mjs +1 -0
- package/dist/chunk-PKHX3HSS.mjs +1 -0
- package/dist/chunk-WHFRS7IP.mjs +3 -0
- package/dist/{engine-6AXEX8CL.d.ts → engine-C9LKls__.d.ts} +1 -1
- package/dist/{engine-Ci08nM91.d.mts → engine-CvzRSkuk.d.mts} +1 -1
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.d.mts +3 -3
- package/dist/group/index.d.ts +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +10 -3
- package/dist/horizontal/index.d.ts +10 -3
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-BDGQEK6X.d.mts → index-BlIjovDN.d.mts} +1 -1
- package/dist/{index-DxjUOIbK.d.ts → index-DZjvLJcU.d.ts} +1 -1
- package/dist/{index-BVuNgQSd.d.ts → index-G3VfLIN8.d.ts} +2 -2
- package/dist/{index-CGR7pSOR.d.mts → index-Zxa5HIes.d.mts} +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +3 -3
- package/dist/nuxt/index.d.ts +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/pin/index.cjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +1 -1
- package/dist/progress/index.d.ts +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +16 -13
- package/dist/react/index.d.ts +16 -13
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +1 -1
- package/dist/reveal/index.d.ts +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-CNlq4Z_L.d.mts → scroll-draw-B4CadBz0.d.mts} +1 -1
- package/dist/{scroll-draw-BlJfbTDv.d.ts → scroll-draw-Cs6Z5ype.d.ts} +1 -1
- package/dist/snap/index.d.mts +1 -1
- package/dist/snap/index.d.ts +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.d.mts +3 -3
- package/dist/solid/index.d.ts +3 -3
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.d.mts +3 -3
- package/dist/svelte/index.d.ts +3 -3
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +11 -11
- package/dist/timeline/index.d.mts +1 -1
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.mjs +4 -4
- package/dist/{types-DHU1zNEw.d.mts → types-B0YM4nQP.d.mts} +6 -1
- package/dist/{types-DHU1zNEw.d.ts → types-B0YM4nQP.d.ts} +6 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +1 -1
- package/dist/video/index.d.ts +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +5 -83
- package/dist/vue/index.d.ts +5 -83
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-4MH5SQTH.mjs +0 -1
- package/dist/chunk-CTVQDBD3.mjs +0 -1
- package/dist/chunk-KBFWDHF4.mjs +0 -1
- package/dist/chunk-LINFV2GK.mjs +0 -3
- package/dist/chunk-PEFR3ZB7.mjs +0 -1
- package/dist/chunk-QJ4H2HW3.mjs +0 -1
- package/dist/chunk-SNCRC6BA.mjs +0 -1
- package/dist/chunk-TIRZOSQ4.mjs +0 -1
|
@@ -311,6 +311,59 @@ var SvgScrollDraw = (() => {
|
|
|
311
311
|
registry().delete(el);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
// src/core/layout-watch.ts
|
|
315
|
+
var observer;
|
|
316
|
+
var watchers = /* @__PURE__ */ new Set();
|
|
317
|
+
var boxes = /* @__PURE__ */ new WeakMap();
|
|
318
|
+
var uses = /* @__PURE__ */ new Map();
|
|
319
|
+
var boxOf = (t) => {
|
|
320
|
+
const r = t.getBoundingClientRect();
|
|
321
|
+
return r.width + " " + r.height;
|
|
322
|
+
};
|
|
323
|
+
function above(targets) {
|
|
324
|
+
const out = /* @__PURE__ */ new Set();
|
|
325
|
+
for (let n of targets) {
|
|
326
|
+
for (; n && n !== document.body; n = n.parentElement) {
|
|
327
|
+
for (let s = n; s; s = s.previousElementSibling) out.add(s);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return out;
|
|
331
|
+
}
|
|
332
|
+
function watchLayout(targets, onChange) {
|
|
333
|
+
if (typeof ResizeObserver === "undefined" || typeof document === "undefined") return () => {
|
|
334
|
+
};
|
|
335
|
+
const fire = () => onChange();
|
|
336
|
+
observer ?? (observer = new ResizeObserver((entries) => {
|
|
337
|
+
let moved = false;
|
|
338
|
+
for (const { target } of entries) {
|
|
339
|
+
if (boxes.get(target) !== boxOf(target)) moved = true;
|
|
340
|
+
boxes.set(target, "");
|
|
341
|
+
}
|
|
342
|
+
if (moved) watchers.forEach((w) => w());
|
|
343
|
+
}));
|
|
344
|
+
watchers.add(fire);
|
|
345
|
+
const all = above(targets);
|
|
346
|
+
[document.body, document.documentElement].forEach((t) => t && all.add(t));
|
|
347
|
+
all.forEach((t) => {
|
|
348
|
+
if (!boxes.has(t)) boxes.set(t, boxOf(t));
|
|
349
|
+
uses.set(t, (uses.get(t) ?? 0) + 1);
|
|
350
|
+
observer.observe(t);
|
|
351
|
+
});
|
|
352
|
+
return () => {
|
|
353
|
+
if (!watchers.delete(fire)) return;
|
|
354
|
+
all.forEach((t) => {
|
|
355
|
+
const n = (uses.get(t) ?? 1) - 1;
|
|
356
|
+
if (n) return void uses.set(t, n);
|
|
357
|
+
uses.delete(t);
|
|
358
|
+
observer?.unobserve(t);
|
|
359
|
+
});
|
|
360
|
+
if (!watchers.size) {
|
|
361
|
+
observer?.disconnect();
|
|
362
|
+
observer = void 0;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
314
367
|
// src/core/engine.ts
|
|
315
368
|
var nativeUid = 0;
|
|
316
369
|
function supportsNativeTimeline() {
|
|
@@ -839,7 +892,7 @@ var SvgScrollDraw = (() => {
|
|
|
839
892
|
resetPaths();
|
|
840
893
|
rafId = requestAnimationFrame(tick);
|
|
841
894
|
}
|
|
842
|
-
const
|
|
895
|
+
const observer3 = new IntersectionObserver(
|
|
843
896
|
(entries) => {
|
|
844
897
|
entries.forEach((e) => {
|
|
845
898
|
if (e.isIntersecting && !(once && completed)) {
|
|
@@ -865,13 +918,13 @@ var SvgScrollDraw = (() => {
|
|
|
865
918
|
}
|
|
866
919
|
window.addEventListener("resize", onResize2);
|
|
867
920
|
window.addEventListener("orientationchange", onResize2);
|
|
868
|
-
if (delay > 0) setTimeout(() =>
|
|
869
|
-
else
|
|
921
|
+
if (delay > 0) setTimeout(() => observer3.observe(container), delay);
|
|
922
|
+
else observer3.observe(container);
|
|
870
923
|
return {
|
|
871
924
|
destroy() {
|
|
872
925
|
cancelAnimationFrame(rafId);
|
|
873
926
|
clearTimeout(repeatTimer);
|
|
874
|
-
|
|
927
|
+
observer3.disconnect();
|
|
875
928
|
window.removeEventListener("resize", onResize2);
|
|
876
929
|
window.removeEventListener("orientationchange", onResize2);
|
|
877
930
|
clearTimeout(resizeTimer2);
|
|
@@ -988,7 +1041,6 @@ var SvgScrollDraw = (() => {
|
|
|
988
1041
|
if (once && !autoReverse) {
|
|
989
1042
|
alpha = frozenPath[i] = Math.max(frozenPath[i] ?? frozenAlpha, alpha);
|
|
990
1043
|
}
|
|
991
|
-
currentAlpha = alpha;
|
|
992
1044
|
el.style.strokeDashoffset = effectiveDir === "reverse" ? `${lengths[i] * alpha}` : `${lengths[i] * (1 - alpha)}`;
|
|
993
1045
|
if (fade) el.style.opacity = effectiveDir === "reverse" ? `${1 - alpha}` : `${alpha}`;
|
|
994
1046
|
if (colorFrom && colorTo) el.style.stroke = lerpColor(colorFrom, colorTo, alpha);
|
|
@@ -1004,6 +1056,7 @@ var SvgScrollDraw = (() => {
|
|
|
1004
1056
|
if (morphTo && el.tagName.toLowerCase() === "path" && originalDs[i])
|
|
1005
1057
|
el.setAttribute("d", morphPath(originalDs[i], morphTo, alpha));
|
|
1006
1058
|
if (i === 0) {
|
|
1059
|
+
currentAlpha = alpha;
|
|
1007
1060
|
onProgress?.(alpha);
|
|
1008
1061
|
container.style.setProperty("--scroll-draw-progress", String(alpha));
|
|
1009
1062
|
}
|
|
@@ -1056,7 +1109,7 @@ var SvgScrollDraw = (() => {
|
|
|
1056
1109
|
looping = false;
|
|
1057
1110
|
cancelAnimationFrame(rafId);
|
|
1058
1111
|
}
|
|
1059
|
-
const
|
|
1112
|
+
const observer2 = new IntersectionObserver(
|
|
1060
1113
|
(entries) => {
|
|
1061
1114
|
entries.forEach((e) => {
|
|
1062
1115
|
isVisible = e.isIntersecting;
|
|
@@ -1085,22 +1138,16 @@ var SvgScrollDraw = (() => {
|
|
|
1085
1138
|
}
|
|
1086
1139
|
window.addEventListener("resize", onResize);
|
|
1087
1140
|
window.addEventListener("orientationchange", onResize);
|
|
1088
|
-
|
|
1089
|
-
if (
|
|
1090
|
-
|
|
1091
|
-
layoutObserver.observe(document.body);
|
|
1092
|
-
layoutObserver.observe(document.documentElement);
|
|
1093
|
-
layoutObserver.observe(container);
|
|
1094
|
-
}
|
|
1095
|
-
if (delay > 0) setTimeout(() => observer.observe(container), delay);
|
|
1096
|
-
else observer.observe(container);
|
|
1141
|
+
const unwatch = watchLayout([container], onResize);
|
|
1142
|
+
if (delay > 0) setTimeout(() => observer2.observe(container), delay);
|
|
1143
|
+
else observer2.observe(container);
|
|
1097
1144
|
return tracked({
|
|
1098
1145
|
destroy() {
|
|
1099
1146
|
cancelAnimationFrame(rafId);
|
|
1100
1147
|
clearTimeout(repeatTimer);
|
|
1101
1148
|
stopLoop();
|
|
1102
|
-
|
|
1103
|
-
|
|
1149
|
+
observer2.disconnect();
|
|
1150
|
+
unwatch();
|
|
1104
1151
|
window.removeEventListener("resize", onResize);
|
|
1105
1152
|
window.removeEventListener("orientationchange", onResize);
|
|
1106
1153
|
clearTimeout(resizeTimer);
|
|
@@ -1361,6 +1408,9 @@ var SvgScrollDraw = (() => {
|
|
|
1361
1408
|
getTrigger: liveTriggers
|
|
1362
1409
|
});
|
|
1363
1410
|
const instance = {
|
|
1411
|
+
// The view() timeline measures the element every frame.
|
|
1412
|
+
refresh() {
|
|
1413
|
+
},
|
|
1364
1414
|
destroy() {
|
|
1365
1415
|
el.classList.remove(cls);
|
|
1366
1416
|
style.remove();
|
|
@@ -1413,9 +1463,23 @@ var SvgScrollDraw = (() => {
|
|
|
1413
1463
|
if (scrollEl) return axis === "x" ? scrollEl.clientWidth : scrollEl.clientHeight;
|
|
1414
1464
|
return axis === "x" ? window.innerWidth : window.innerHeight;
|
|
1415
1465
|
};
|
|
1466
|
+
const moving = triggerEl === el ? entries : [];
|
|
1467
|
+
let measured = false;
|
|
1416
1468
|
function cacheTriggers() {
|
|
1469
|
+
const style = el.style;
|
|
1470
|
+
const held = moving.map((e) => style.getPropertyValue(e.prop));
|
|
1471
|
+
const transition = style.transition;
|
|
1472
|
+
if (moving.length) style.transition = "none";
|
|
1473
|
+
moving.forEach((e) => style.setProperty(e.prop, savedInline.get(e.prop) ?? ""));
|
|
1417
1474
|
const frame = measureTriggerFrame(triggerEl, scrollEl, axis);
|
|
1475
|
+
moving.forEach((e, i) => style.setProperty(e.prop, held[i]));
|
|
1476
|
+
if (moving.length) {
|
|
1477
|
+
void el.offsetWidth;
|
|
1478
|
+
style.transition = transition;
|
|
1479
|
+
}
|
|
1418
1480
|
const result = computeTriggers(frame, frame.scroll, vpSize(), startConfig, endConfig);
|
|
1481
|
+
if (measured && Math.abs(result.tStart - tStart) < 1 && Math.abs(result.tEnd - tEnd) < 1) return;
|
|
1482
|
+
measured = true;
|
|
1419
1483
|
tStart = result.tStart;
|
|
1420
1484
|
tEnd = result.tEnd;
|
|
1421
1485
|
}
|
|
@@ -1480,7 +1544,7 @@ var SvgScrollDraw = (() => {
|
|
|
1480
1544
|
currentAlpha = initAlpha;
|
|
1481
1545
|
applyAlpha(initAlpha);
|
|
1482
1546
|
}
|
|
1483
|
-
const
|
|
1547
|
+
const observer2 = new IntersectionObserver(
|
|
1484
1548
|
(ioEntries) => {
|
|
1485
1549
|
ioEntries.forEach((e) => {
|
|
1486
1550
|
isVisible = e.isIntersecting;
|
|
@@ -1497,7 +1561,8 @@ var SvgScrollDraw = (() => {
|
|
|
1497
1561
|
}
|
|
1498
1562
|
window.addEventListener("resize", onResize);
|
|
1499
1563
|
window.addEventListener("orientationchange", onResize);
|
|
1500
|
-
|
|
1564
|
+
const unwatch = watchLayout([triggerEl], onResize);
|
|
1565
|
+
observer2.observe(el);
|
|
1501
1566
|
_register(el, {
|
|
1502
1567
|
type: "animate",
|
|
1503
1568
|
getProgress: () => currentAlpha,
|
|
@@ -1506,9 +1571,10 @@ var SvgScrollDraw = (() => {
|
|
|
1506
1571
|
return {
|
|
1507
1572
|
destroy() {
|
|
1508
1573
|
cancelAnimationFrame(rafId);
|
|
1509
|
-
|
|
1574
|
+
observer2.disconnect();
|
|
1510
1575
|
window.removeEventListener("resize", onResize);
|
|
1511
1576
|
window.removeEventListener("orientationchange", onResize);
|
|
1577
|
+
unwatch();
|
|
1512
1578
|
clearTimeout(resizeTimer);
|
|
1513
1579
|
restoreInline();
|
|
1514
1580
|
_unregister(el);
|
|
@@ -1539,6 +1605,9 @@ var SvgScrollDraw = (() => {
|
|
|
1539
1605
|
},
|
|
1540
1606
|
getProgress() {
|
|
1541
1607
|
return currentAlpha;
|
|
1608
|
+
},
|
|
1609
|
+
refresh() {
|
|
1610
|
+
cacheTriggers();
|
|
1542
1611
|
}
|
|
1543
1612
|
};
|
|
1544
1613
|
}
|
|
@@ -1574,16 +1643,23 @@ var SvgScrollDraw = (() => {
|
|
|
1574
1643
|
return NOOP;
|
|
1575
1644
|
}
|
|
1576
1645
|
const { speed = 0.3, axis = "y", easing = "linear", trigger, onProgress } = options;
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
|
|
1646
|
+
const travel = -speed * 100;
|
|
1647
|
+
const style = el.style;
|
|
1648
|
+
const svg = !!el.ownerSVGElement;
|
|
1649
|
+
const box = style.getPropertyValue("transform-box");
|
|
1650
|
+
if (svg) style.setProperty("transform-box", "fill-box");
|
|
1651
|
+
const inst = createAnimateEngine(el, {
|
|
1652
|
+
props: axis === "x" ? { transform: [`translateX(0%)`, `translateX(${travel}%)`] } : { transform: [`translateY(0%)`, `translateY(${travel}%)`] },
|
|
1582
1653
|
trigger: trigger ?? { start: "top bottom", end: "bottom top" },
|
|
1583
1654
|
easing,
|
|
1584
1655
|
native: false,
|
|
1585
1656
|
onProgress
|
|
1586
1657
|
});
|
|
1658
|
+
if (!svg) return inst;
|
|
1659
|
+
return { ...inst, destroy() {
|
|
1660
|
+
inst.destroy();
|
|
1661
|
+
style.setProperty("transform-box", box);
|
|
1662
|
+
} };
|
|
1587
1663
|
}
|
|
1588
1664
|
|
|
1589
1665
|
// src/counter/index.ts
|
|
@@ -1630,6 +1706,7 @@ var SvgScrollDraw = (() => {
|
|
|
1630
1706
|
}
|
|
1631
1707
|
let tStart = 0;
|
|
1632
1708
|
let tEnd = 0;
|
|
1709
|
+
let measured = false;
|
|
1633
1710
|
let rafId = 0;
|
|
1634
1711
|
let isVisible = false;
|
|
1635
1712
|
let paused = false;
|
|
@@ -1647,6 +1724,8 @@ var SvgScrollDraw = (() => {
|
|
|
1647
1724
|
startConfig,
|
|
1648
1725
|
endConfig
|
|
1649
1726
|
);
|
|
1727
|
+
if (measured && Math.abs(result.tStart - tStart) < 1 && Math.abs(result.tEnd - tEnd) < 1) return;
|
|
1728
|
+
measured = true;
|
|
1650
1729
|
tStart = result.tStart;
|
|
1651
1730
|
tEnd = result.tEnd;
|
|
1652
1731
|
}
|
|
@@ -1678,7 +1757,7 @@ var SvgScrollDraw = (() => {
|
|
|
1678
1757
|
currentAlpha = initAlpha;
|
|
1679
1758
|
applyAlpha(initAlpha);
|
|
1680
1759
|
}
|
|
1681
|
-
const
|
|
1760
|
+
const observer2 = new IntersectionObserver(
|
|
1682
1761
|
(entries) => {
|
|
1683
1762
|
entries.forEach((e) => {
|
|
1684
1763
|
isVisible = e.isIntersecting;
|
|
@@ -1694,7 +1773,8 @@ var SvgScrollDraw = (() => {
|
|
|
1694
1773
|
}
|
|
1695
1774
|
window.addEventListener("resize", onResize);
|
|
1696
1775
|
window.addEventListener("orientationchange", onResize);
|
|
1697
|
-
|
|
1776
|
+
const unwatch = watchLayout([el], onResize);
|
|
1777
|
+
observer2.observe(el);
|
|
1698
1778
|
_register(el, {
|
|
1699
1779
|
type: "counter",
|
|
1700
1780
|
getProgress: () => currentAlpha,
|
|
@@ -1703,9 +1783,10 @@ var SvgScrollDraw = (() => {
|
|
|
1703
1783
|
return {
|
|
1704
1784
|
destroy() {
|
|
1705
1785
|
cancelAnimationFrame(rafId);
|
|
1706
|
-
|
|
1786
|
+
observer2.disconnect();
|
|
1707
1787
|
window.removeEventListener("resize", onResize);
|
|
1708
1788
|
window.removeEventListener("orientationchange", onResize);
|
|
1789
|
+
unwatch();
|
|
1709
1790
|
clearTimeout(resizeTimer);
|
|
1710
1791
|
_unregister(el);
|
|
1711
1792
|
},
|
|
@@ -1867,7 +1948,7 @@ var SvgScrollDraw = (() => {
|
|
|
1867
1948
|
running = false;
|
|
1868
1949
|
cancelAnimationFrame(rafId);
|
|
1869
1950
|
};
|
|
1870
|
-
const
|
|
1951
|
+
const observer2 = new IntersectionObserver(
|
|
1871
1952
|
(entries) => {
|
|
1872
1953
|
for (const e of entries) {
|
|
1873
1954
|
visible = e.isIntersecting;
|
|
@@ -1877,7 +1958,7 @@ var SvgScrollDraw = (() => {
|
|
|
1877
1958
|
},
|
|
1878
1959
|
{ threshold: 0 }
|
|
1879
1960
|
);
|
|
1880
|
-
|
|
1961
|
+
observer2.observe(stage);
|
|
1881
1962
|
progress = computeProgress2();
|
|
1882
1963
|
apply(progress);
|
|
1883
1964
|
_register(mount, {
|
|
@@ -1891,7 +1972,7 @@ var SvgScrollDraw = (() => {
|
|
|
1891
1972
|
return {
|
|
1892
1973
|
destroy() {
|
|
1893
1974
|
stop();
|
|
1894
|
-
|
|
1975
|
+
observer2.disconnect();
|
|
1895
1976
|
_unregister(mount);
|
|
1896
1977
|
},
|
|
1897
1978
|
getProgress: () => progress
|
|
@@ -1901,12 +1982,32 @@ var SvgScrollDraw = (() => {
|
|
|
1901
1982
|
|
|
1902
1983
|
// src/web-component/index.ts
|
|
1903
1984
|
if (typeof HTMLElement !== "undefined" && typeof customElements !== "undefined" && !customElements.get("scroll-draw")) {
|
|
1985
|
+
const OPTIONS = ["speed", "easing", "stagger", "direction", "selector", "fade", "once"];
|
|
1904
1986
|
class ScrollDrawElement extends HTMLElement {
|
|
1905
1987
|
constructor() {
|
|
1906
1988
|
super(...arguments);
|
|
1907
1989
|
this.instance = null;
|
|
1990
|
+
/** The option attributes the running engine was built from. */
|
|
1991
|
+
this.key = "";
|
|
1908
1992
|
}
|
|
1909
1993
|
connectedCallback() {
|
|
1994
|
+
this.build();
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* An option changed after connect. The element read its attributes once, so
|
|
1998
|
+
* setting `speed` or `easing` later did nothing; the other wrappers rebuild on
|
|
1999
|
+
* a real change since 2.17.0. Called for every parsed attribute before connect
|
|
2000
|
+
* too — those are read in connectedCallback — and for an equal setAttribute,
|
|
2001
|
+
* which build() ignores.
|
|
2002
|
+
*/
|
|
2003
|
+
attributeChangedCallback() {
|
|
2004
|
+
if (this.instance) this.build();
|
|
2005
|
+
}
|
|
2006
|
+
build() {
|
|
2007
|
+
const key = JSON.stringify(OPTIONS.map((a) => this.getAttribute(a)));
|
|
2008
|
+
if (this.instance && key === this.key) return;
|
|
2009
|
+
this.instance?.destroy();
|
|
2010
|
+
this.key = key;
|
|
1910
2011
|
const opts = {};
|
|
1911
2012
|
const speed = this.getAttribute("speed");
|
|
1912
2013
|
const easing = this.getAttribute("easing");
|
|
@@ -1927,6 +2028,7 @@ var SvgScrollDraw = (() => {
|
|
|
1927
2028
|
this.instance = null;
|
|
1928
2029
|
}
|
|
1929
2030
|
}
|
|
2031
|
+
ScrollDrawElement.observedAttributes = OPTIONS;
|
|
1930
2032
|
customElements.define("scroll-draw", ScrollDrawElement);
|
|
1931
2033
|
}
|
|
1932
2034
|
return __toCommonJS(cdn_exports);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var SvgScrollDraw=(()=>{var
|
|
2
|
-
<div style="position:absolute;${c?`left:${
|
|
3
|
-
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",i,{passive:!0}),i(),{el:n,destroy(){window.removeEventListener("scroll",i),n.remove()}}}var Rt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ft=/[MmLlHhVvCcSsQqTtAaZz]/g;function cr(e,t,r){if(!!1)return;let n=(e.match(Ft)??[]).join("").toUpperCase(),i=(t.match(Ft)??[]).join("").toUpperCase(),a=(e.match(Rt)??[]).length,f=(t.match(Rt)??[]).length;if(n!==i){j(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}a!==f&&j(`morphTo: coordinate count differs (${a} \u2192 ${f}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function ft(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let f=parseFloat(a),m=n[i++]??f;return String(+(f+(m-f)*r).toFixed(4))})}function et(e,t={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...n}=t,i=r?{...Ke[r],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=!1,easing:p="linear",trigger:x={},stagger:I=0,direction:T="forward",once:J=!1,debug:Ee=!1,axis:S="y",scrollContainer:$,autoReverse:g=!1,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:G,velocityScale:ee=!1,threshold:de=0,rootMargin:Y="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ge,autoplay:Le=!1,duration:Ce=1e3,native:De=!0,onProgress:w,onStart:P,onComplete:ne,onEnter:ye,onLeave:He,onEnterBack:he,onLeaveBack:xe}=i,te=ge===!0?"left":typeof ge=="string"?ge:!1,ce=typeof p=="function"?p:K[p]??K.linear,be=$e(x.start??"top bottom"),_e=$e(x.end??"bottom top"),ae=typeof $=="string"?document.querySelector($):$??null,le=Array.isArray(b)?b[0]:null,U=Array.isArray(b)?b[1]:typeof b=="string"?b:null,X=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function we(o){let l=o*100;switch(te){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(f)),A=[],s=[],u=0,oe=0,k=!1,D=!1,O=0,fe=!1,ue=-1,B=[],Ie=-1,_=!1,ve=0,Ae=0,Oe,ot=null;function ht(){ot?.destroy(),ot=null}let Re=new Set,bt=NaN,Fe=!0,Ge=-1,wt=performance.now(),Ve=NaN;function st(){return ae?S==="x"?ae.scrollLeft:ae.scrollTop:S==="x"?window.scrollX:window.scrollY}function vt(){return ae?S==="x"?ae.clientWidth:ae.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function St(){let o=Ze(e,ae,S);return Ne(o,o.scroll,vt(),be,_e)}function Et(){({tStart:u,tEnd:oe}=St()),Ee&&!1&&(ht(),ot=lr(u,oe,S))}function it(o,l=St){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e)},o}function Gt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=l==="reverse"?1-o:o;e.style.clipPath=we(h);return}C.forEach((h,Q)=>{h.style.strokeDashoffset=l==="reverse"?`${A[Q]*o}`:`${A[Q]*(1-o)}`,c&&(h.style.opacity=l==="reverse"?`${1-o}`:`${o}`),le&&U?h.style.stroke=qe(le,U,o):U&&(h.style.stroke=U),X!==null&&H!==null?h.style.strokeWidth=`${X+(H-X)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[Q]&&h.setAttribute("d",ft(s[Q],N,o))})}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=we(0);return}C.forEach((o,l)=>{o.style.strokeDasharray=`${A[l]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${A[l]}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[l]&&o.setAttribute("d",s[l])})}if(C.forEach(o=>{ar(o);let l=ze(o);A.push(l);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?cr(s[s.length-1],N,o):j(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=T==="reverse"?`${l}`:"0",c&&(o.style.opacity="1"),U&&(o.style.stroke=U),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=T==="reverse"?"0":`${l}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`))}),te){if(a)return e.style.clipPath=we(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=we(0)}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let xt=typeof p=="string"?Je(p):null;function jt(){return!(De===!1||!ir()||!C.length||!xt||te||S!=="y"||ae||m!==1||I!==0||J||g||ee!==!1||N||G||q||E>0||w||P||ne||ye||He||he||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Yt(){let o=++sr,l=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Te=T==="reverse"?"0":"var(--ssd-len)",Se=T==="reverse"?"var(--ssd-len)":"0",pe=`stroke-dashoffset:${Te};`,v=`stroke-dashoffset:${Se};`;c&&(pe+=`opacity:${T==="reverse"?1:0};`,v+=`opacity:${T==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${l}{from{${pe}}to{${v}}}.${h}{view-timeline-name:${Q};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${xt};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Z(d,V){d.style.setProperty("--ssd-len",String(A[V])),d.style.strokeDasharray=`${A[V]}`,d.style.strokeDashoffset="",d.style.opacity="",d.style.animationPlayState="",d.classList.add(l)}C.forEach(Z);let y=!1,L=-1;function R(){if(L>=0)return L;let d=e.getBoundingClientRect(),{tStart:V,tEnd:me}=Ne({top:d.top,height:d.height},st(),vt(),be,_e);return ce(ie(st(),V,me,m))}return{destroy(){e.classList.remove(h),C.forEach(d=>{d.classList.remove(l),d.style.removeProperty("--ssd-len"),d.style.animationPlayState=""}),M.remove()},replay(){y=!1,L=-1,C.forEach(Z)},pause(){y=!0,C.forEach(d=>{d.style.animationPlayState="paused"})},resume(){y&&(y=!1,C.forEach(d=>{d.style.animationPlayState="running"}))},seek(d){let V=Math.min(1,Math.max(0,d));L=V,y=!0,C.forEach((me,se)=>{me.classList.remove(l),me.style.strokeDashoffset=T==="reverse"?`${A[se]*V}`:`${A[se]*(1-V)}`,c&&(me.style.opacity=T==="reverse"?`${1-V}`:`${V}`)})},getProgress(){return R()},refresh(){C.forEach((d,V)=>{A[V]=ze(d),d.style.setProperty("--ssd-len",String(A[V])),d.style.strokeDasharray=`${A[V]}`})}}}if(jt())return it(Yt());function Ut(){let o=Math.max(1,Ce),l=0,h=0,Q=!1;function Te(y){let L=!0;if(te){let R=Math.min(1,Math.max(0,y/o)),d=ce(R);ve=d,e.style.setProperty("--scroll-draw-progress",String(d)),e.style.clipPath=we(T==="reverse"?1-d:d),w?.(d),R<1&&(L=!1)}else C.forEach((R,d)=>{let V=d*I*o,me=Math.min(1,Math.max(0,(y-V)/o)),se=ce(me);R.style.strokeDashoffset=T==="reverse"?`${A[d]*se}`:`${A[d]*(1-se)}`,c&&(R.style.opacity=T==="reverse"?`${1-se}`:`${se}`),le&&U?R.style.stroke=qe(le,U,se):U&&(R.style.stroke=U),X!==null&&H!==null?R.style.strokeWidth=`${X+(H-X)*se}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*se}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[d]&&R.setAttribute("d",ft(s[d],N,se)),d===0&&(ve=se,w?.(se),e.style.setProperty("--scroll-draw-progress",String(se))),me<1&&(L=!1)});if(G){let R=Math.min(1,Math.max(0,y/o)),d=ce(R);for(let V in G){let me=parseFloat(V);d>=me&&!Re.has(me)&&(Re.add(me),G[V]?.())}}return L}function Se(y){if(_)return;let L=y-l;D||(D=!0,P?.());let R=Te(L);if(R&&!k){k=!0,Te(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Ae<(q==="infinite"?1/0:q??0)&&(Ae++,Oe=setTimeout(()=>{l=performance.now(),D=!1,k=!1,Re.clear(),je(),O=requestAnimationFrame(Se)},ke));return}R||(O=requestAnimationFrame(Se))}function pe(){cancelAnimationFrame(O),clearTimeout(Oe),l=performance.now(),h=0,_=!1,D=!1,k=!1,Ae=0,Q=!0,ve=0,Re.clear(),je(),O=requestAnimationFrame(Se)}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?pe():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Oe),Q=!1)})},{root:ae??null,threshold:de,rootMargin:Y}),M;function Z(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{A[L]=ze(y),y.style.strokeDasharray=`${A[L]}`})},150)}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Oe),v.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(M)},replay(){Ae=0,pe()},pause(){_||!Q||(_=!0,h=performance.now()-l,cancelAnimationFrame(O))},resume(){_&&(_=!1,Q=!0,l=performance.now()-h,O=requestAnimationFrame(Se))},seek(y){let L=Math.min(1,Math.max(0,y));ve=L,_=!0,h=L*o,l=performance.now()-h,cancelAnimationFrame(O),Te(h)},getProgress(){return ve},refresh(){clearTimeout(M),C.forEach((y,L)=>{A[L]=ze(y),y.style.strokeDasharray=`${A[L]}`})}}}if(Le)return it(Ut());Et();function Ye(){if(!fe||_)return;let o=performance.now(),l=st();if(!Fe&&ee===!1&&l===bt){O=requestAnimationFrame(Ye);return}Fe=!1,bt=l;let h=m;if(ee!==!1){let v=o-wt,M=v>0?Math.abs(l-(Ge<0?l:Ge))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04)}Ge=l,wt=o;let Q=g?Ie===-1||l>=Ie?"forward":"reverse":T;Ie=l;let Te=oe-u,Se=!0,pe=Te===0?0:(l-u)/Te;if(isNaN(Ve)||(Ve<=0&&pe>0?ye?.():Ve>0&&pe<=0&&xe?.(),Ve<1&&pe>=1?He?.():Ve>=1&&pe<1&&he?.()),Ve=pe,te){let v=ce(ie(l,u,oe,h));J&&!g&&(ue=Math.max(ue,v),v=ue),ve=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=Q==="reverse"?1-v:v;e.style.clipPath=we(M),w?.(v),!D&&ie(l,u,oe,h)>0&&(D=!0,P?.()),v>=1&&!k?(k=!0,ne?.(),Ae<(q==="infinite"?1/0:q??0)&&(Ae++,Oe=setTimeout(()=>{ue=-1,D=!1,k=!1,e.style.clipPath=we(0)},ke))):v<1&&!J&&(k=!1),O=requestAnimationFrame(Ye);return}if(C.forEach((v,M)=>{let Z=M*I*Te,y=ce(ie(l,u+Z,oe+Z,h));J&&!g&&(y=B[M]=Math.max(B[M]??ue,y)),ve=y,v.style.strokeDashoffset=Q==="reverse"?`${A[M]*y}`:`${A[M]*(1-y)}`,c&&(v.style.opacity=Q==="reverse"?`${1-y}`:`${y}`),le&&U?v.style.stroke=qe(le,U,y):U&&(v.style.stroke=U),X!==null&&H!==null?v.style.strokeWidth=`${X+(H-X)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",ft(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=!1)}),G){let v=ce(ie(l,u,oe,h));for(let M in G){let Z=parseFloat(M);v>=Z&&!Re.has(Z)&&(Re.add(Z),G[M]?.())}}!D&&ie(l,u,oe,h)>0&&(D=!0,P?.()),Se&&!k?(k=!0,ne?.(),Ae<(q==="infinite"?1/0:q??0)&&(Ae++,Oe=setTimeout(()=>{ue=-1,B=[],D=!1,k=!1,Re.clear(),je(),Fe=!0},ke))):!Se&&!J&&(k=!1),O=requestAnimationFrame(Ye)}let at=!1;function Ue(){at||(at=!0,O=requestAnimationFrame(function(){Ye()}))}function Xe(){at=!1,cancelAnimationFrame(O)}let lt=new IntersectionObserver(o=>{o.forEach(l=>{fe=l.isIntersecting,fe&&!_?(Fe=!0,Ue()):Xe()})},{root:ae??null,threshold:de,rootMargin:Y});function At(){C.forEach((o,l)=>{A[l]=ze(o),o.style.strokeDasharray=`${A[l]}`}),Et(),Fe=!0}let Qe;function We(){clearTimeout(Qe),Qe=setTimeout(At,150)}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),E>0?setTimeout(()=>lt.observe(e),E):lt.observe(e),it({destroy(){cancelAnimationFrame(O),clearTimeout(Oe),Xe(),lt.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Qe),ht()},replay(){ue=-1,B=[],Ie=-1,Ge=-1,D=!1,k=!1,Ae=0,_=!1,ve=0,Re.clear(),clearTimeout(Oe),je(),Fe=!0,fe&&Ue()},pause(){_=!0,Xe()},resume(){_&&(_=!1,Fe=!0,fe&&Ue())},seek(o){let l=Math.min(1,Math.max(0,o));ve=l,ue=l,B=[],_=!0,Xe(),Gt(l,T),Fe=!0},getProgress(){return ve},refresh(){clearTimeout(Qe),At(),fe&&!_&&Ue()}},()=>({tStart:u,tEnd:oe}))}function Nt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?et(n,t):(j("Container not found:",e),r)}function ur(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ht(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let i=[],a=[],f=n[2].trim();if(f)for(let m of f.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"")}t.push({fn:n[1],nums:i,units:a})}return t}function mr(e,t,r){let n=Ht(e),i=Ht(t);return n.length===0||n.length!==i.length?r<1?e:t:n.map((a,f)=>{let m=i[f];return a.fn!==m.fn||a.nums.length!==m.nums.length?r<1?`${a.fn}(${a.nums.map((c,p)=>`${c}${a.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,p)=>`${c}${m.units[p]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,p)=>`${c+(m.nums[p]-c)*r}${a.units[p]}`).join(", ")})`}).join(" ")}function _t(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),i=String(t);if(ur(n))return qe(n,i,r);if(n.includes("("))return mr(n,i,r);let a=n.match(/^([-+]?[\d.]+)(.*)$/),f=i.match(/^([-+]?[\d.]+)(.*)$/);if(a&&f){let m=parseFloat(a[1]),c=parseFloat(f[1]);return`${m+(c-m)*r}${a[2]||f[2]}`}return r<1?n:i}function fr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var pr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),dr=0,Vt="--scroll-draw-progress";function gr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function dt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:i={},easing:a="ease-out",speed:f=1,once:m=!1,axis:c="y",scrollContainer:p,native:x=!0,velocityScale:I=!1,respectReducedMotion:T=!0,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=t,z=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:K[a]??K["ease-out"],G=$e(i.start??"top bottom"),ee=$e(i.end??"bottom top"),de=J??e,Y=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([s,u])=>({prop:fr(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0")}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to))}let ge=new Map;for(let s of[...q.map(u=>u.prop),Vt])ge.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ge)u?e.style.setProperty(s,u):e.style.removeProperty(s)}if(z)return N(),S?.(),{...r,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Je(a):null;function De(){if(!x||!gr()||!Ce||c!=="y"||Y||de!==e||m||f!==1||Ee||S||$||g||E||b||I!==!1||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return!1;for(let s of q)if(!pr.has(s.prop))return!1;return!0}function w(){let s=`ssd-a-${++dr}`,u=q.map(B=>`${B.prop}:${B.from}`).join(";"),oe=q.map(B=>`${B.prop}:${B.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,fe=()=>{let B=e.getBoundingClientRect();return Ne({top:B.top,height:B.height},D(),O(),G,ee)};Me(e,{type:"animate",getProgress:()=>ue.getProgress(),getTrigger:fe});let ue={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e)},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(B){let Ie=Math.min(1,Math.max(0,B));e.classList.remove(s);for(let _ of q)e.style.setProperty(_.prop,_t(_.from,_.to,Ie))},getProgress(){let{tStart:B,tEnd:Ie}=fe();return F(ie(D(),B,Ie,f))}};return ue}if(De())return w();let P=0,ne=0,ye=0,He=!1,he=!1,xe=-1,te=0,ce=!1,be=NaN,_e=-1,ae=0,le=()=>Y?c==="x"?Y.scrollLeft:Y.scrollTop:c==="x"?window.scrollX:window.scrollY,U=()=>Y?c==="x"?Y.clientWidth:Y.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function X(){let s=Ze(de,Y,c),u=Ne(s,s.scroll,U(),G,ee);P=u.tStart,ne=u.tEnd}function H(s){e.style.setProperty(Vt,String(s));for(let u of q)e.style.setProperty(u.prop,_t(u.from,u.to,s));Ee?.(s)}function re(s){if(isNaN(be)){be=s;return}be<=0&&s>0?$?.():be>0&&s<=0&&b?.(),be<1&&s>=1?g?.():be>=1&&s<1&&E?.(),be=s}function W(){if(!He||he)return;let s=performance.now(),u=le(),oe=f;if(I!==!1){let O=s-ae,fe=O>0?Math.abs(u-(_e<0?u:_e))/O:0;oe=f*Math.max(.2,1+fe*(typeof I=="number"?I:1)*.04)}_e=u,ae=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(ie(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!ce?(ce=!0,S?.()):D<1&&!m&&(ce=!1),ye=requestAnimationFrame(W)}X(),ne===P&&j("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=F(ie(le(),P,ne,f));m&&s>0&&(xe=s),te=s,H(s)}let we=new IntersectionObserver(s=>{s.forEach(u=>{He=u.isIntersecting,He&&!he?ye=requestAnimationFrame(W):cancelAnimationFrame(ye)})},{root:Y??null}),C;function A(){clearTimeout(C),C=setTimeout(X,150)}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),we.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(ye),we.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(C),Le(),Pe(e)},replay(){xe=-1,ce=!1,te=0,he=!1,H(0)},pause(){he=!0,cancelAnimationFrame(ye)},resume(){he&&(he=!1,He&&(ye=requestAnimationFrame(W)))},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,he=!0,cancelAnimationFrame(ye),H(u)},getProgress(){return te}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,t){if(typeof window>"u")return tt;let r=typeof e=="string"?document.querySelector(e):e;return r?dt(r,t):(j("scrollAnimate: element not found:",e),tt)}function qt(e,t={}){if(typeof window>"u")return tt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return j("scrollParallax: element not found:",e),tt;let{speed:n=.3,axis:i="y",easing:a="linear",trigger:f,onProgress:m}=t,c=r.getBoundingClientRect(),p=i==="x"?c.width:c.height,x=n*p;return dt(r,{props:i==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:f??{start:"top bottom",end:"bottom top"},easing:a,native:!1,onProgress:m})}var gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Wt(e,t){if(typeof window>"u")return gt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return j("scrollCounter: element not found:",e),gt;let n=r,{from:i=0,to:a,format:f,easing:m="ease-out",trigger:c={},once:p=!0,decimals:x,onComplete:I}=t,T=x!==void 0?w=>w.toFixed(x):f??(w=>String(Math.round(w))),J=typeof m=="function"?m:K[m]??K["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=T(a),I?.(),gt;let g=0,E=0,b=0,z=!1,F=!1,G=-1,ee=0,de=!1,Y=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Ne({top:w.top,height:w.height},Y(),q(),Ee,S);g=P.tStart,E=P.tEnd}function N(w){n.textContent=T(i+(a-i)*w),n.style.setProperty("--scroll-draw-progress",String(w))}function ge(){if(!z||F)return;let w=J(ie(Y(),g,E,1));p&&(G=Math.max(G,w),w=G),ee=w,N(w),w>=1&&!de?(de=!0,I?.()):w<1&&!p&&(de=!1),b=requestAnimationFrame(ge)}ke();{let w=J(ie(Y(),g,E,1));p&&w>0&&(G=w),ee=w,N(w)}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ge):cancelAnimationFrame(b)})}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150)}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n)},replay(){G=-1,de=!1,ee=0,F=!1,N(0)},pause(){F=!0,cancelAnimationFrame(b)},resume(){F&&(F=!1,z&&(b=requestAnimationFrame(ge)))},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,G=P,F=!0,cancelAnimationFrame(b),N(P)},getProgress(){return ee}}}var Bt="http://www.w3.org/2000/svg",yr="cinematic-photo",yt=e=>e<0?0:e>1?1:e;function rt(e){let t=parseFloat(e);return Number.isFinite(t)?yt(t/100):0}function hr(e){return K[e]??K.linear}var br={destroy:()=>{},getProgress:()=>0},nt=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||j("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return br;r.style.position="relative",r.style.height=t.totalHeight,r.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",r.appendChild(n);let i=[];for(let S of t.scenes){if(S.background){let g=document.createElement("img");g.id=yr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g)}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Bt,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Bt,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),i.push({kind:"draw",el:b,start:rt(E.start),end:rt(E.end),ease:hr(E.easing),length:z})}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),i.push({kind:"fade",el:E,start:rt(g.start),end:rt(g.end),ease:K["ease-in-out"]??K.linear,from:g.from,to:g.to}))}}let a=0,f=()=>{let S=r.offsetHeight-window.innerHeight;return S<=0?r.getBoundingClientRect().top<=0?1:0:yt(-r.getBoundingClientRect().top/S)},m=S=>{for(let $ of i){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:yt((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,p=!1,x=!1,I=()=>{a=f(),m(a),p&&(c=requestAnimationFrame(I))},T=()=>{p||(p=!0,c=requestAnimationFrame(I))},J=()=>{p=!1,cancelAnimationFrame(c)},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?T():J()},{threshold:0});return Ee.observe(n),a=f(),m(a),Me(r,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=r.getBoundingClientRect().top+window.scrollY;return{tStart:S,tEnd:S+Math.max(0,r.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(r)},getProgress:()=>a}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null}connectedCallback(){let n={},i=this.getAttribute("speed"),a=this.getAttribute("easing"),f=this.getAttribute("stagger"),m=this.getAttribute("direction"),c=this.getAttribute("selector");i&&(n.speed=parseFloat(i)),a&&(n.easing=a),f&&(n.stagger=parseFloat(f)),m&&(n.direction=m),c&&(n.selector=c),this.hasAttribute("fade")&&(n.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(n.once=this.getAttribute("once")!=="false"),this.instance=et(this,n)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}customElements.define("scroll-draw",e)}return er(wr);})();
|
|
1
|
+
"use strict";var SvgScrollDraw=(()=>{var pt=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var rr=Object.getOwnPropertyNames;var nr=Object.prototype.hasOwnProperty;var or=(e,t)=>{for(var r in t)pt(e,r,{get:t[r],enumerable:!0})},sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of rr(t))!nr.call(e,s)&&s!==r&&pt(e,s,{get:()=>t[s],enumerable:!(n=tr(t,s))||n.enumerable});return e};var ir=e=>sr(pt({},"__esModule",{value:!0}),e);var Mr={};or(Mr,{Cinematic:()=>at,PRESETS:()=>et,createBounce:()=>dt,createElastic:()=>gt,createSpring:()=>kt,scrollAnimate:()=>jt,scrollCounter:()=>Ut,scrollDraw:()=>qt,scrollParallax:()=>Yt});function kt({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function dt({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(n),i=0,u=[];for(let p=0;p<r;p++){let v=Math.pow(s,p);u.push(v),i+=v}let f=[0],c=0;for(let p=0;p<r;p++)c+=u[p]/i,f.push(c);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let v=0;v<r;v++)if(p<=f[v+1]){let $=(p-f[v])/(f[v+1]-f[v]);if(v===0)return $*(2-$);let E=1-Math.pow(n,v);return E+(1-E)*(2*$-1)*(2*$-1)}return 1}}function gt({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),s=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var ne={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:dt(),elastic:gt()};function Lt(e,t,r){return Math.min(r,Math.max(t,e))}function ke(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return{element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return{element:r,viewport:n}}function Ct(e,t,r,n){switch(n){case"top":return e+r;case"center":return e+r+t/2;case"bottom":return e+r+t;default:return e+r}}function Dt(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case"top":return 0;case"center":return t/2;case"bottom":return t;default:return t}}function ce(e,t,r,n){return r===t?0:Lt((e-t)/(r-t)*n,0,1)}function Oe(e,t,r,n,s){let i=Ct(e.top,e.height,t,n.element)-Dt(n.viewport,r),u=Ct(e.top,e.height,t,s.element)-Dt(s.viewport,r);return{tStart:i,tEnd:u}}function Ke(e,t,r){let n=e.getBoundingClientRect(),s=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:s,scroll:0}:{top:r==="x"?n.left:n.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function ze(e){let t=e.tagName.toLowerCase();if(t==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(r+n)}if(t==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function It(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function qe(e,t,r){let n=It(e),s=It(t);return!n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*r)},${Math.round(n[1]+(s[1]-n[1])*r)},${Math.round(n[2]+(s[2]-n[2])*r)})`}var et={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function U(e,...t){}var ar="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ot=33;function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function ur(e){let t=[];for(let r=0;r<Ot;r++){let n=r/(Ot-1);t.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${t.join(",")})`}function tt(e){switch(e){case"linear":return"linear";case"ease-in":return ar;case"ease-out":return lr;case"ease-in-out":return cr()?ur(ne["ease-in-out"]):null;default:return null}}var Rt=Symbol.for("svg-scroll-draw.registry");function Ft(){let e=globalThis;return e[Rt]||(e[Rt]=new Map)}function Le(e,t){Ft().set(e,t)}function Ce(e){Ft().delete(e)}var Ge,rt=new Set,nt=new WeakMap,je=new Map,Nt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function mr(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function We(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let r=()=>t();Ge??(Ge=new ResizeObserver(s=>{let i=!1;for(let{target:u}of s)nt.get(u)!==Nt(u)&&(i=!0),nt.set(u,"");i&&rt.forEach(u=>u())})),rt.add(r);let n=mr(e);return[document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{nt.has(s)||nt.set(s,Nt(s)),je.set(s,(je.get(s)??0)+1),Ge.observe(s)}),()=>{rt.delete(r)&&(n.forEach(s=>{let i=(je.get(s)??1)-1;if(i)return void je.set(s,i);je.delete(s),Ge?.unobserve(s)}),rt.size||(Ge?.disconnect(),Ge=void 0))}}var fr=0;function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ht(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim()}catch{}return r||(e.getAttribute(t)??"").trim()}var _t=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function dr(e){if(!!1)return;let t=Ht(e,"stroke");if(!t||t==="none"){U("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!_t.has(r)&&!_t.has(Ht(e,"fill"))&&U("Element has a fill \u2014 it may obscure the stroke animation.",e)}function gr(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=r==="x"?window.scrollX:window.scrollY,u=e-i,f=t-i,c=r==="x";n.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${c?`left:${u}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${u}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function yr(e,t,r){if(!!1)return;let n=(e.match(zt)??[]).join("").toUpperCase(),s=(t.match(zt)??[]).join("").toUpperCase(),i=(e.match(Vt)??[]).length,u=(t.match(Vt)??[]).length;if(n!==s){U(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==u&&U(`morphTo: coordinate count differs (${i} \u2192 ${u}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function yt(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let u=parseFloat(i),f=n[s++]??u;return String(+(u+(f-u)*r).toFixed(4))})}function ot(e,t={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...n}=t,s=r?{...et[r],...n}:n,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:u="path, polyline, line, polygon, rect, circle",speed:f=1,fade:c=!1,easing:p="linear",trigger:v={},stagger:$=0,direction:E="forward",once:oe=!1,debug:Ae=!1,axis:S="y",scrollContainer:T,autoReverse:g=!1,delay:x=0,strokeColor:A,strokeWidth:I,fillOpacity:X,waypoints:q,velocityScale:se=!1,threshold:ae=0,rootMargin:W="0px",repeat:O=0,repeatDelay:Re=0,morphTo:B,clip:de,autoplay:Te=!1,duration:Fe=1e3,native:Ne=!0,onProgress:ue,onStart:Q,onComplete:d,onEnter:R,onLeave:He,onEnterBack:Ee,onLeaveBack:Me}=s,ie=de===!0?"left":typeof de=="string"?de:!1,ge=typeof p=="function"?p:ne[p]??ne.linear,Se=ke(v.start??"top bottom"),_e=ke(v.end??"bottom top"),me=typeof T=="string"?document.querySelector(T):T??null,fe=Array.isArray(A)?A[0]:null,Z=Array.isArray(A)?A[1]:typeof A=="string"?A:null,H=Array.isArray(I)?I[0]:null,G=Array.isArray(I)?I[1]:typeof I=="number"?I:null,j=Array.isArray(X)?X[0]:null,_=Array.isArray(X)?X[1]:typeof X=="number"?X:null;function Pe(o){let l=o*100;switch(ie){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let F=ie?[]:Array.from(e.querySelectorAll(u)),M=[],J=[],K=0,be=0,a=!1,m=!1,C=0,ee=!1,k=-1,Y=[],we=-1,V=!1,L=0,pe=0,ye,lt=null;function Et(){lt?.destroy(),lt=null}let De=new Set,St=NaN,Ie=!0,Ye=-1,xt=performance.now(),Ve=NaN;function ct(){return me?S==="x"?me.scrollLeft:me.scrollTop:S==="x"?window.scrollX:window.scrollY}function At(){return me?S==="x"?me.clientWidth:me.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function Tt(){let o=Ke(e,me,S);return Oe(o,o.scroll,At(),Se,_e)}function Mt(){({tStart:K,tEnd:be}=Tt()),Ae&&!1&&(Et(),lt=gr(K,be,S))}function ut(o,l=Tt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let b=o.destroy;return o.destroy=()=>{b.call(o),Ce(e)},o}function Qt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),ie){let b=l==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}F.forEach((b,te)=>{b.style.strokeDashoffset=l==="reverse"?`${M[te]*o}`:`${M[te]*(1-o)}`,c&&(b.style.opacity=l==="reverse"?`${1-o}`:`${o}`),fe&&Z?b.style.stroke=qe(fe,Z,o):Z&&(b.style.stroke=Z),H!==null&&G!==null?b.style.strokeWidth=`${H+(G-H)*o}`:G!==null&&(b.style.strokeWidth=`${G}`),j!==null&&_!==null?b.style.fillOpacity=`${j+(_-j)*o}`:_!==null&&(b.style.fillOpacity=`${_}`),B&&b.tagName.toLowerCase()==="path"&&J[te]&&b.setAttribute("d",yt(J[te],B,o))})}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),ie){e.style.clipPath=Pe(0);return}F.forEach((o,l)=>{o.style.strokeDasharray=`${M[l]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${M[l]}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",fe&&(o.style.stroke=fe),H!==null&&(o.style.strokeWidth=`${H}`),j!==null&&(o.style.fillOpacity=`${j}`),B&&o.tagName.toLowerCase()==="path"&&J[l]&&o.setAttribute("d",J[l])})}if(F.forEach(o=>{dr(o);let l=ze(o);M.push(l);let b=o.tagName.toLowerCase()==="path";b?J.push(o.getAttribute("d")??""):J.push(""),B&&(b?yr(J[J.length-1],B,o):U(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?`${l}`:"0",c&&(o.style.opacity="1"),Z&&(o.style.stroke=Z),G!==null&&(o.style.strokeWidth=`${G}`),_!==null&&(o.style.fillOpacity=`${_}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?"0":`${l}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",fe&&(o.style.stroke=fe),H!==null&&(o.style.strokeWidth=`${H}`),j!==null&&(o.style.fillOpacity=`${j}`))}),ie){if(i)return e.style.clipPath=Pe(1),d?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0)}else if(i)return d?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Pt=typeof p=="string"?tt(p):null;function Zt(){return!(Ne===!1||!pr()||!F.length||!Pt||ie||S!=="y"||me||f!==1||$!==0||oe||g||se!==!1||B||q||O||x>0||ue||Q||d||R||He||Ee||Me||A!=null||I!=null||X!=null||(v.start??"top bottom").trim()!=="top bottom"||(v.end??"bottom top").trim()!=="bottom top")}function Jt(){let o=++fr,l=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,te=`--svg-scroll-draw-${o}`,$e=E==="reverse"?"0":"var(--ssd-len)",xe=E==="reverse"?"var(--ssd-len)":"0",ve=`stroke-dashoffset:${$e};`,w=`stroke-dashoffset:${xe};`;c&&(ve+=`opacity:${E==="reverse"?1:0};`,w+=`opacity:${E==="reverse"?0:1};`);let P=document.createElement("style");P.setAttribute("data-svg-scroll-draw",""),P.textContent=`@keyframes ${l}{from{${ve}}to{${w}}}.${b}{view-timeline-name:${te};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Pt};animation-fill-mode:both;animation-timeline:${te};animation-range:cover 0% cover 100%;}`,document.head.appendChild(P),e.classList.add(b);function re(y,z){y.style.setProperty("--ssd-len",String(M[z])),y.style.strokeDasharray=`${M[z]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l)}F.forEach(re);let h=!1,D=-1;function N(){if(D>=0)return D;let y=e.getBoundingClientRect(),{tStart:z,tEnd:he}=Oe({top:y.top,height:y.height},ct(),At(),Se,_e);return ge(ce(ct(),z,he,f))}return{destroy(){e.classList.remove(b),F.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState=""}),P.remove()},replay(){h=!1,D=-1,F.forEach(re)},pause(){h=!0,F.forEach(y=>{y.style.animationPlayState="paused"})},resume(){h&&(h=!1,F.forEach(y=>{y.style.animationPlayState="running"}))},seek(y){let z=Math.min(1,Math.max(0,y));D=z,h=!0,F.forEach((he,le)=>{he.classList.remove(l),he.style.strokeDashoffset=E==="reverse"?`${M[le]*z}`:`${M[le]*(1-z)}`,c&&(he.style.opacity=E==="reverse"?`${1-z}`:`${z}`)})},getProgress(){return N()},refresh(){F.forEach((y,z)=>{M[z]=ze(y),y.style.setProperty("--ssd-len",String(M[z])),y.style.strokeDasharray=`${M[z]}`})}}}if(Zt())return ut(Jt());function Kt(){let o=Math.max(1,Fe),l=0,b=0,te=!1;function $e(h){let D=!0;if(ie){let N=Math.min(1,Math.max(0,h/o)),y=ge(N);L=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(E==="reverse"?1-y:y),ue?.(y),N<1&&(D=!1)}else F.forEach((N,y)=>{let z=y*$*o,he=Math.min(1,Math.max(0,(h-z)/o)),le=ge(he);N.style.strokeDashoffset=E==="reverse"?`${M[y]*le}`:`${M[y]*(1-le)}`,c&&(N.style.opacity=E==="reverse"?`${1-le}`:`${le}`),fe&&Z?N.style.stroke=qe(fe,Z,le):Z&&(N.style.stroke=Z),H!==null&&G!==null?N.style.strokeWidth=`${H+(G-H)*le}`:G!==null&&(N.style.strokeWidth=`${G}`),j!==null&&_!==null?N.style.fillOpacity=`${j+(_-j)*le}`:_!==null&&(N.style.fillOpacity=`${_}`),B&&N.tagName.toLowerCase()==="path"&&J[y]&&N.setAttribute("d",yt(J[y],B,le)),y===0&&(L=le,ue?.(le),e.style.setProperty("--scroll-draw-progress",String(le))),he<1&&(D=!1)});if(q){let N=Math.min(1,Math.max(0,h/o)),y=ge(N);for(let z in q){let he=parseFloat(z);y>=he&&!De.has(he)&&(De.add(he),q[z]?.())}}return D}function xe(h){if(V)return;let D=h-l;m||(m=!0,Q?.());let N=$e(D);if(N&&!a){a=!0,$e(o*(1+Math.max(0,F.length-1)*$)),d?.(),pe<(O==="infinite"?1/0:O??0)&&(pe++,ye=setTimeout(()=>{l=performance.now(),m=!1,a=!1,De.clear(),Ue(),C=requestAnimationFrame(xe)},Re));return}N||(C=requestAnimationFrame(xe))}function ve(){cancelAnimationFrame(C),clearTimeout(ye),l=performance.now(),b=0,V=!1,m=!1,a=!1,pe=0,te=!0,L=0,De.clear(),Ue(),C=requestAnimationFrame(xe)}let w=new IntersectionObserver(h=>{h.forEach(D=>{D.isIntersecting&&!(oe&&a)?ve():!D.isIntersecting&&!oe&&!a&&(cancelAnimationFrame(C),clearTimeout(ye),te=!1)})},{root:me??null,threshold:ae,rootMargin:W}),P;function re(){clearTimeout(P),P=setTimeout(()=>{F.forEach((h,D)=>{M[D]=ze(h),h.style.strokeDasharray=`${M[D]}`})},150)}return window.addEventListener("resize",re),window.addEventListener("orientationchange",re),x>0?setTimeout(()=>w.observe(e),x):w.observe(e),{destroy(){cancelAnimationFrame(C),clearTimeout(ye),w.disconnect(),window.removeEventListener("resize",re),window.removeEventListener("orientationchange",re),clearTimeout(P)},replay(){pe=0,ve()},pause(){V||!te||(V=!0,b=performance.now()-l,cancelAnimationFrame(C))},resume(){V&&(V=!1,te=!0,l=performance.now()-b,C=requestAnimationFrame(xe))},seek(h){let D=Math.min(1,Math.max(0,h));L=D,V=!0,b=D*o,l=performance.now()-b,cancelAnimationFrame(C),$e(b)},getProgress(){return L},refresh(){clearTimeout(P),F.forEach((h,D)=>{M[D]=ze(h),h.style.strokeDasharray=`${M[D]}`})}}}if(Te)return ut(Kt());Mt();function Xe(){if(!ee||V)return;let o=performance.now(),l=ct();if(!Ie&&se===!1&&l===St){C=requestAnimationFrame(Xe);return}Ie=!1,St=l;let b=f;if(se!==!1){let w=o-xt,P=w>0?Math.abs(l-(Ye<0?l:Ye))/w:0;b=f*Math.max(.2,1+P*(typeof se=="number"?se:1)*.04)}Ye=l,xt=o;let te=g?we===-1||l>=we?"forward":"reverse":E;we=l;let $e=be-K,xe=!0,ve=$e===0?0:(l-K)/$e;if(isNaN(Ve)||(Ve<=0&&ve>0?R?.():Ve>0&&ve<=0&&Me?.(),Ve<1&&ve>=1?He?.():Ve>=1&&ve<1&&Ee?.()),Ve=ve,ie){let w=ge(ce(l,K,be,b));oe&&!g&&(k=Math.max(k,w),w=k),L=w,e.style.setProperty("--scroll-draw-progress",String(w));let P=te==="reverse"?1-w:w;e.style.clipPath=Pe(P),ue?.(w),!m&&ce(l,K,be,b)>0&&(m=!0,Q?.()),w>=1&&!a?(a=!0,d?.(),pe<(O==="infinite"?1/0:O??0)&&(pe++,ye=setTimeout(()=>{k=-1,m=!1,a=!1,e.style.clipPath=Pe(0)},Re))):w<1&&!oe&&(a=!1),C=requestAnimationFrame(Xe);return}if(F.forEach((w,P)=>{let re=P*$*$e,h=ge(ce(l,K+re,be+re,b));oe&&!g&&(h=Y[P]=Math.max(Y[P]??k,h)),w.style.strokeDashoffset=te==="reverse"?`${M[P]*h}`:`${M[P]*(1-h)}`,c&&(w.style.opacity=te==="reverse"?`${1-h}`:`${h}`),fe&&Z?w.style.stroke=qe(fe,Z,h):Z&&(w.style.stroke=Z),H!==null&&G!==null?w.style.strokeWidth=`${H+(G-H)*h}`:G!==null&&(w.style.strokeWidth=`${G}`),j!==null&&_!==null?w.style.fillOpacity=`${j+(_-j)*h}`:_!==null&&(w.style.fillOpacity=`${_}`),B&&w.tagName.toLowerCase()==="path"&&J[P]&&w.setAttribute("d",yt(J[P],B,h)),P===0&&(L=h,ue?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(xe=!1)}),q){let w=ge(ce(l,K,be,b));for(let P in q){let re=parseFloat(P);w>=re&&!De.has(re)&&(De.add(re),q[P]?.())}}!m&&ce(l,K,be,b)>0&&(m=!0,Q?.()),xe&&!a?(a=!0,d?.(),pe<(O==="infinite"?1/0:O??0)&&(pe++,ye=setTimeout(()=>{k=-1,Y=[],m=!1,a=!1,De.clear(),Ue(),Ie=!0},Re))):!xe&&!oe&&(a=!1),C=requestAnimationFrame(Xe)}let mt=!1;function Qe(){mt||(mt=!0,C=requestAnimationFrame(function(){Xe()}))}function Ze(){mt=!1,cancelAnimationFrame(C)}let ft=new IntersectionObserver(o=>{o.forEach(l=>{ee=l.isIntersecting,ee&&!V?(Ie=!0,Qe()):Ze()})},{root:me??null,threshold:ae,rootMargin:W});function $t(){F.forEach((o,l)=>{M[l]=ze(o),o.style.strokeDasharray=`${M[l]}`}),Mt(),Ie=!0}let Je;function Be(){clearTimeout(Je),Je=setTimeout($t,150)}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let er=We([e],Be);return x>0?setTimeout(()=>ft.observe(e),x):ft.observe(e),ut({destroy(){cancelAnimationFrame(C),clearTimeout(ye),Ze(),ft.disconnect(),er(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Je),Et()},replay(){k=-1,Y=[],we=-1,Ye=-1,m=!1,a=!1,pe=0,V=!1,L=0,De.clear(),clearTimeout(ye),Ue(),Ie=!0,ee&&Qe()},pause(){V=!0,Ze()},resume(){V&&(V=!1,Ie=!0,ee&&Qe())},seek(o){let l=Math.min(1,Math.max(0,o));L=l,k=l,Y=[],V=!0,Ze(),Qt(l,E),Ie=!0},getProgress(){return L},refresh(){clearTimeout(Je),$t(),ee&&!V&&Qe()}},()=>({tStart:K,tEnd:be}))}function qt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?ot(n,t):(U("Container not found:",e),r)}function hr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Wt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],u=n[2].trim();if(u)for(let f of u.split(/[\s,]+/)){let c=f.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function br(e,t,r){let n=Wt(e),s=Wt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,u)=>{let f=s[u];return i.fn!==f.fn||i.nums.length!==f.nums.length?r<1?`${i.fn}(${i.nums.map((c,p)=>`${c}${i.units[p]}`).join(", ")})`:`${f.fn}(${f.nums.map((c,p)=>`${c}${f.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,p)=>`${c+(f.nums[p]-c)*r}${i.units[p]}`).join(", ")})`}).join(" ")}function Bt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(hr(n))return qe(n,s,r);if(n.includes("("))return br(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),u=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&u){let f=parseFloat(i[1]),c=parseFloat(u[1]);return`${f+(c-f)*r}${i[2]||u[2]}`}return r<1?n:s}function wr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var vr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Er=0,Gt="--scroll-draw-progress";function Sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function bt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:s={},easing:i="ease-out",speed:u=1,once:f=!1,axis:c="y",scrollContainer:p,native:v=!0,velocityScale:$=!1,respectReducedMotion:E=!0,triggerElement:oe,onProgress:Ae,onComplete:S,onEnter:T,onLeave:g,onEnterBack:x,onLeaveBack:A}=t,I=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,X=typeof i=="function"?i:ne[i]??ne["ease-out"],q=ke(s.start??"top bottom"),se=ke(s.end??"bottom top"),ae=oe??e,W=typeof p=="string"?document.querySelector(p):p??null,O=Object.entries(n).map(([a,m])=>({prop:wr(a),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function Re(){let a=window.getComputedStyle(e);for(let m of O)m.from===""&&(m.from=a.getPropertyValue(m.prop).trim()||"0")}function B(){for(let a of O)e.style.setProperty(a.prop,String(a.to))}let de=new Map;for(let a of[...O.map(m=>m.prop),Gt])de.set(a,e.style.getPropertyValue(a));function Te(){for(let[a,m]of de)m?e.style.setProperty(a,m):e.style.removeProperty(a)}if(I)return B(),S?.(),{...r,destroy:Te,getProgress:()=>1};Re();let Fe=typeof i=="string"?tt(i):null;function Ne(){if(!v||!Sr()||!Fe||c!=="y"||W||ae!==e||f||u!==1||Ae||S||T||g||x||A||$!==!1||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return!1;for(let a of O)if(!vr.has(a.prop))return!1;return!0}function ue(){let a=`ssd-a-${++Er}`,m=O.map(L=>`${L.prop}:${L.from}`).join(";"),C=O.map(L=>`${L.prop}:${L.to}`).join(";"),ee=document.createElement("style");ee.setAttribute("data-ssd-animate",""),ee.textContent=`@keyframes ${a}{from{${m}}to{${C}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ee),e.classList.add(a);let k=()=>c==="x"?window.scrollX:window.scrollY,Y=()=>c==="x"?window.innerWidth:window.innerHeight,we=()=>{let L=e.getBoundingClientRect();return Oe({top:L.top,height:L.height},k(),Y(),q,se)};Le(e,{type:"animate",getProgress:()=>V.getProgress(),getTrigger:we});let V={refresh(){},destroy(){e.classList.remove(a),ee.remove(),e.style.animationPlayState="",Te(),Ce(e)},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(L){let pe=Math.min(1,Math.max(0,L));e.classList.remove(a);for(let ye of O)e.style.setProperty(ye.prop,Bt(ye.from,ye.to,pe))},getProgress(){let{tStart:L,tEnd:pe}=we();return X(ce(k(),L,pe,u))}};return V}if(Ne())return ue();let Q=0,d=0,R=0,He=!1,Ee=!1,Me=-1,ie=0,ge=!1,Se=NaN,_e=-1,me=0,fe=()=>W?c==="x"?W.scrollLeft:W.scrollTop:c==="x"?window.scrollX:window.scrollY,Z=()=>W?c==="x"?W.clientWidth:W.clientHeight:c==="x"?window.innerWidth:window.innerHeight,H=ae===e?O:[],G=!1;function j(){let a=e.style,m=H.map(Y=>a.getPropertyValue(Y.prop)),C=a.transition;H.length&&(a.transition="none"),H.forEach(Y=>a.setProperty(Y.prop,de.get(Y.prop)??""));let ee=Ke(ae,W,c);H.forEach((Y,we)=>a.setProperty(Y.prop,m[we])),H.length&&(e.offsetWidth,a.transition=C);let k=Oe(ee,ee.scroll,Z(),q,se);G&&Math.abs(k.tStart-Q)<1&&Math.abs(k.tEnd-d)<1||(G=!0,Q=k.tStart,d=k.tEnd)}function _(a){e.style.setProperty(Gt,String(a));for(let m of O)e.style.setProperty(m.prop,Bt(m.from,m.to,a));Ae?.(a)}function Pe(a){if(isNaN(Se)){Se=a;return}Se<=0&&a>0?T?.():Se>0&&a<=0&&A?.(),Se<1&&a>=1?g?.():Se>=1&&a<1&&x?.(),Se=a}function F(){if(!He||Ee)return;let a=performance.now(),m=fe(),C=u;if($!==!1){let Y=a-me,we=Y>0?Math.abs(m-(_e<0?m:_e))/Y:0;C=u*Math.max(.2,1+we*(typeof $=="number"?$:1)*.04)}_e=m,me=a;let ee=d===Q?0:(m-Q)/(d-Q);Pe(ee);let k=X(ce(m,Q,d,C));f&&(Me=Math.max(Me,k),k=Me),ie=k,_(k),k>=1&&!ge?(ge=!0,S?.()):k<1&&!f&&(ge=!1),R=requestAnimationFrame(F)}j(),d===Q&&U("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=X(ce(fe(),Q,d,u));f&&a>0&&(Me=a),ie=a,_(a)}let M=new IntersectionObserver(a=>{a.forEach(m=>{He=m.isIntersecting,He&&!Ee?R=requestAnimationFrame(F):cancelAnimationFrame(R)})},{root:W??null}),J;function K(){clearTimeout(J),J=setTimeout(j,150)}window.addEventListener("resize",K),window.addEventListener("orientationchange",K);let be=We([ae],K);return M.observe(e),Le(e,{type:"animate",getProgress:()=>ie,getTrigger:()=>({tStart:Q,tEnd:d})}),{destroy(){cancelAnimationFrame(R),M.disconnect(),window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),be(),clearTimeout(J),Te(),Ce(e)},replay(){Me=-1,ge=!1,ie=0,Ee=!1,_(0)},pause(){Ee=!0,cancelAnimationFrame(R)},resume(){Ee&&(Ee=!1,He&&(R=requestAnimationFrame(F)))},seek(a){let m=Math.min(1,Math.max(0,a));ie=m,Me=m,Ee=!0,cancelAnimationFrame(R),_(m)},getProgress(){return ie},refresh(){j()}}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function jt(e,t){if(typeof window>"u")return st;let r=typeof e=="string"?document.querySelector(e):e;return r?bt(r,t):(U("scrollAnimate: element not found:",e),st)}function Yt(e,t={}){if(typeof window>"u")return st;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return U("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:u,onProgress:f}=t,c=-n*100,p=r.style,v=!!r.ownerSVGElement,$=p.getPropertyValue("transform-box");v&&p.setProperty("transform-box","fill-box");let E=bt(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${c}%)`]}:{transform:["translateY(0%)",`translateY(${c}%)`]},trigger:u??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:f});return v?{...E,destroy(){E.destroy(),p.setProperty("transform-box",$)}}:E}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ut(e,t){if(typeof window>"u")return wt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return U("scrollCounter: element not found:",e),wt;let n=r,{from:s=0,to:i,format:u,easing:f="ease-out",trigger:c={},once:p=!0,decimals:v,onComplete:$}=t,E=v!==void 0?d=>d.toFixed(v):u??(d=>String(Math.round(d))),oe=typeof f=="function"?f:ne[f]??ne["ease-out"],Ae=ke(c.start??"top 80%"),S=ke(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=E(i),$?.(),wt;let g=0,x=0,A=!1,I=0,X=!1,q=!1,se=-1,ae=0,W=!1,O=()=>window.scrollY,Re=()=>window.innerHeight;function B(){let d=n.getBoundingClientRect(),R=Oe({top:d.top,height:d.height},O(),Re(),Ae,S);A&&Math.abs(R.tStart-g)<1&&Math.abs(R.tEnd-x)<1||(A=!0,g=R.tStart,x=R.tEnd)}function de(d){n.textContent=E(s+(i-s)*d),n.style.setProperty("--scroll-draw-progress",String(d))}function Te(){if(!X||q)return;let d=oe(ce(O(),g,x,1));p&&(se=Math.max(se,d),d=se),ae=d,de(d),d>=1&&!W?(W=!0,$?.()):d<1&&!p&&(W=!1),I=requestAnimationFrame(Te)}B();{let d=oe(ce(O(),g,x,1));p&&d>0&&(se=d),ae=d,de(d)}let Fe=new IntersectionObserver(d=>{d.forEach(R=>{X=R.isIntersecting,X&&!q?I=requestAnimationFrame(Te):cancelAnimationFrame(I)})}),Ne;function ue(){clearTimeout(Ne),Ne=setTimeout(B,150)}window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue);let Q=We([n],ue);return Fe.observe(n),Le(n,{type:"counter",getProgress:()=>ae,getTrigger:()=>({tStart:g,tEnd:x})}),{destroy(){cancelAnimationFrame(I),Fe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),Q(),clearTimeout(Ne),Ce(n)},replay(){se=-1,W=!1,ae=0,q=!1,de(0)},pause(){q=!0,cancelAnimationFrame(I)},resume(){q&&(q=!1,X&&(I=requestAnimationFrame(Te)))},seek(d){let R=Math.min(1,Math.max(0,d));ae=R,se=R,q=!0,cancelAnimationFrame(I),de(R)},getProgress(){return ae}}}var Xt="http://www.w3.org/2000/svg",xr="cinematic-photo",vt=e=>e<0?0:e>1?1:e;function it(e){let t=parseFloat(e);return Number.isFinite(t)?vt(t/100):0}function Ar(e){return ne[e]??ne.linear}var Tr={destroy:()=>{},getProgress:()=>0},at=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||U("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return Tr;r.style.position="relative",r.style.height=t.totalHeight,r.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",r.appendChild(n);let s=[];for(let S of t.scenes){if(S.background){let g=document.createElement("img");g.id=xr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g)}let T=S.animations.filter(g=>g.type==="draw");if(T.length){let g=document.createElementNS(Xt,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let x of T){let A=document.createElementNS(Xt,"path");A.id=x.target.replace(/^#/,""),A.setAttribute("d",x.d),A.setAttribute("fill","none"),A.setAttribute("stroke",x.stroke),A.setAttribute("stroke-width",String(x.strokeWidth)),A.setAttribute("stroke-linecap","round"),A.setAttribute("stroke-linejoin","round");let I=x.length||A.getTotalLength?.()||0;A.style.strokeDasharray=String(I),A.style.strokeDashoffset=String(I),g.appendChild(A),s.push({kind:"draw",el:A,start:it(x.start),end:it(x.end),ease:Ar(x.easing),length:I})}}for(let g of S.animations){if(g.type!=="fade")continue;let x=n.querySelector(g.target)??document.querySelector(g.target);x&&(x.style.opacity=String(g.from),s.push({kind:"fade",el:x,start:it(g.start),end:it(g.end),ease:ne["ease-in-out"]??ne.linear,from:g.from,to:g.to}))}}let i=0,u=()=>{let S=r.offsetHeight-window.innerHeight;return S<=0?r.getBoundingClientRect().top<=0?1:0:vt(-r.getBoundingClientRect().top/S)},f=S=>{for(let T of s){let g=T.end-T.start,x=g<=0?S>=T.end?1:0:vt((S-T.start)/g),A=T.ease(x);T.kind==="draw"?T.el.style.strokeDashoffset=String(T.length*(1-A)):T.el.style.opacity=String(T.from+(T.to-T.from)*A)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let c=0,p=!1,v=!1,$=()=>{i=u(),f(i),p&&(c=requestAnimationFrame($))},E=()=>{p||(p=!0,c=requestAnimationFrame($))},oe=()=>{p=!1,cancelAnimationFrame(c)},Ae=new IntersectionObserver(S=>{for(let T of S)v=T.isIntersecting,v?E():oe()},{threshold:0});return Ae.observe(n),i=u(),f(i),Le(r,{type:"draw",getProgress:()=>i,getTrigger:()=>{let S=r.getBoundingClientRect().top+window.scrollY;return{tStart:S,tEnd:S+Math.max(0,r.offsetHeight-window.innerHeight)}}}),{destroy(){oe(),Ae.disconnect(),Ce(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map($=>this.getAttribute($)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},u=this.getAttribute("speed"),f=this.getAttribute("easing"),c=this.getAttribute("stagger"),p=this.getAttribute("direction"),v=this.getAttribute("selector");u&&(i.speed=parseFloat(u)),f&&(i.easing=f),c&&(i.stagger=parseFloat(c)),p&&(i.direction=p),v&&(i.selector=v),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=ot(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return ir(Mr);})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,d as d$1,c,b as b$2}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var G={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ne(m,h={}){if(typeof window>"u")return G;let E=typeof m=="string"?document.querySelector(m):m;if(!E||E.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",m),G;let t=E,{trigger:P={},easing:b$3="linear",once:z=false,axis:u="y",preload:W="auto",triggerElement:X,onReady:C,onComplete:Y,onProgress:j}=h,I=X??t,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=typeof b$3=="function"?b$3:d[b$3]??d.linear,K=a(P.start??"top top"),Q=a(P.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=W);let M=h.from??0,T=h.to,f=0,g=0,o=0,a$2=false,n=false,s=-1,l=0,p=false,i=false,R=()=>u==="x"?window.scrollX:window.scrollY,U=()=>u==="x"?window.innerWidth:window.innerHeight;function A(){let e=I.getBoundingClientRect(),r=u==="x"?e.left:e.top,d=u==="x"?e.width:e.height,O=c({top:r,height:d},R(),U(),K,Q);f=O.tStart,g=O.tEnd,i&&g===f&&b("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let w=NaN;function v(e){if(!i)return;let r=T??t.duration??0,d=M+(r-M)*e;d!==w&&(w=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),j?.(e);}function y(){if(!a$2||n||!i||V)return;let e=J(b$2(R(),f,g,1));z&&(s=Math.max(s,e),e=s),l=e,v(e),e>=1&&!p?(p=true,Y?.()):e<1&&!z&&(p=false),o=requestAnimationFrame(y);}function S(){if(i=true,T===void 0&&(T=t.duration),V){v(1),C?.();return}A(),C?.(),a$2&&!n&&(o=requestAnimationFrame(y));}t.readyState>=1?S():t.addEventListener("loadedmetadata",S,{once:true}),i||A();let q=new IntersectionObserver(e=>{e.forEach(r=>{a$2=r.isIntersecting,a$2&&!n&&i?o=requestAnimationFrame(y):cancelAnimationFrame(o);});}),x;function c$1(){clearTimeout(x),x=setTimeout(A,150);}window.addEventListener("resize",c$1),window.addEventListener("orientationchange",c$1);let Z=d$1([I],c$1);return q.observe(t),a$1(t,{type:"video",getProgress:()=>l,getTrigger:()=>({tStart:f,tEnd:g})}),{destroy(){cancelAnimationFrame(o),q.disconnect(),t.removeEventListener("loadedmetadata",S),window.removeEventListener("resize",c$1),window.removeEventListener("orientationchange",c$1),Z(),clearTimeout(x),b$1(t);},replay(){s=-1,p=false,l=0,n=false,w=NaN,v(0);},pause(){n=true,cancelAnimationFrame(o);},resume(){n&&(n=false,a$2&&i&&(o=requestAnimationFrame(y)));},seek(e){let r=Math.min(1,Math.max(0,e));l=r,s=r,n=true,cancelAnimationFrame(o),w=NaN,v(r);},getProgress(){return l}}}export{ne as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-4DOJSIEQ.mjs';function w(t="top bottom"){let e=t.trim();if(/^\d+(\.\d+)?%$/.test(e))return {element:"top",viewport:e};let[n="top",o="bottom"]=e.split(/\s+/).filter(Boolean);return {element:n,viewport:o}}function b(t,e,n,o){switch(o){case "top":return t+n;case "center":return t+n+e/2;case "bottom":return t+n+e;default:return t+n}}function l(t,e){if(/^\d+(\.\d+)?%$/.test(t))return e*(parseFloat(t)/100);switch(t){case "top":return 0;case "center":return e/2;case "bottom":return e;default:return e}}function v(t,e,n,o){return n===e?0:a$1((t-e)/(n-e)*o,0,1)}function E(t,e,n,o,r){let u=b(t.top,t.height,e,o.element)-l(o.viewport,n),i=b(t.top,t.height,e,r.element)-l(r.viewport,n);return {tStart:u,tEnd:i}}var s,c=new Set,d=new WeakMap,m=new Map,a=t=>{let e=t.getBoundingClientRect();return e.width+" "+e.height};function p(t){let e=new Set;for(let n of t)for(;n&&n!==document.body;n=n.parentElement)for(let o=n;o;o=o.previousElementSibling)e.add(o);return e}function x(t,e){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>e();s??(s=new ResizeObserver(r=>{let u=false;for(let{target:i}of r)d.get(i)!==a(i)&&(u=true),d.set(i,"");u&&c.forEach(i=>i());})),c.add(n);let o=p(t);return [document.body,document.documentElement].forEach(r=>r&&o.add(r)),o.forEach(r=>{d.has(r)||d.set(r,a(r)),m.set(r,(m.get(r)??0)+1),s.observe(r);}),()=>{c.delete(n)&&(o.forEach(r=>{let u=(m.get(r)??1)-1;if(u)return void m.set(r,u);m.delete(r),s?.unobserve(r);}),c.size||(s?.disconnect(),s=void 0));}}export{w as a,v as b,E as c,x as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b,a as a$3}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a,b as b$2,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$3}from'./chunk-BCV4RAIX.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';function Ae(t){return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")}function ge(t){let u=[],l=/([\w]+)\(([^)]*)\)/g,s;for(;(s=l.exec(t))!==null;){let a=[],o=[],m=s[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let r=i.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(r?parseFloat(r[1]):0),o.push(r?r[2]:"");}u.push({fn:s[1],nums:a,units:o});}return u}function He(t,u,l){let s=ge(t),a=ge(u);return s.length===0||s.length!==a.length?l<1?t:u:s.map((o,m)=>{let i=a[m];return o.fn!==i.fn||o.nums.length!==i.nums.length?l<1?`${o.fn}(${o.nums.map((r,g)=>`${r}${o.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((r,g)=>`${r}${i.units[g]}`).join(", ")})`:`${o.fn}(${o.nums.map((r,g)=>`${r+(i.nums[g]-r)*l}${o.units[g]}`).join(", ")})`}).join(" ")}function de(t,u,l){if(typeof t=="number"&&typeof u=="number")return String(t+(u-t)*l);let s=String(t),a=String(u);if(Ae(s))return a$3(s,a,l);if(s.includes("("))return He(s,a,l);let o=s.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(o&&m){let i=parseFloat(o[1]),r=parseFloat(m[1]);return `${i+(r-i)*l}${o[2]||m[2]}`}return l<1?s:a}function xe(t){return t.replace(/([A-Z])/g,u=>`-${u.toLowerCase()}`)}var Ce=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fe=0,ye="--scroll-draw-progress";function Ne(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function je(t,u){let l={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return l;let{props:s,trigger:a$3={},easing:o="ease-out",speed:m=1,once:i=false,axis:r="y",scrollContainer:g,native:he=true,velocityScale:H=false,respectReducedMotion:ve=true,triggerElement:Ee,onProgress:J,onComplete:R,onEnter:K,onLeave:Q,onEnterBack:ee,onLeaveBack:te}=u,be=ve&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,k=typeof o=="function"?o:d[o]??d["ease-out"],ne=a(a$3.start??"top bottom"),re=a(a$3.end??"bottom top"),x=Ee??t,d$2=typeof g=="string"?document.querySelector(g):g??null,y=Object.entries(s).map(([e,n])=>({prop:xe(e),from:Array.isArray(n)?n[0]:"",to:Array.isArray(n)?n[1]:n}));function we(){let e=window.getComputedStyle(t);for(let n of y)n.from===""&&(n.from=e.getPropertyValue(n.prop).trim()||"0");}function Se(){for(let e of y)t.style.setProperty(e.prop,String(e.to));}let V=new Map;for(let e of [...y.map(n=>n.prop),ye])V.set(e,t.style.getPropertyValue(e));function z(){for(let[e,n]of V)n?t.style.setProperty(e,n):t.style.removeProperty(e);}if(be)return Se(),R?.(),{...l,destroy:z,getProgress:()=>1};we();let oe=typeof o=="string"?b(o):null;function Te(){if(!he||!Ne()||!oe||r!=="y"||d$2||x!==t||i||m!==1||J||R||K||Q||ee||te||H!==false||(a$3.start??"top bottom").trim()!=="top bottom"||(a$3.end??"bottom top").trim()!=="bottom top")return false;for(let e of y)if(!Ce.has(e.prop))return false;return true}function Le(){let e=`ssd-a-${++Fe}`,n=y.map(f=>`${f.prop}:${f.from}`).join(";"),P=y.map(f=>`${f.prop}:${f.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${e}{from{${n}}to{${P}}}.${e}{animation-name:${e};animation-duration:auto;animation-timing-function:${oe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),t.classList.add(e);let c$1=()=>r==="x"?window.scrollX:window.scrollY,p=()=>r==="x"?window.innerWidth:window.innerHeight,M=()=>{let f=t.getBoundingClientRect();return c({top:f.top,height:f.height},c$1(),p(),ne,re)};a$1(t,{type:"animate",getProgress:()=>D.getProgress(),getTrigger:M});let D={refresh(){},destroy(){t.classList.remove(e),v.remove(),t.style.animationPlayState="",z(),b$3(t);},replay(){t.classList.remove(e),t.offsetWidth,t.classList.add(e);},pause(){t.style.animationPlayState="paused";},resume(){t.style.animationPlayState="";},seek(f){let _=Math.min(1,Math.max(0,f));t.classList.remove(e);for(let q of y)t.style.setProperty(q.prop,de(q.from,q.to,_));},getProgress(){let{tStart:f,tEnd:_}=M();return k(b$2(c$1(),f,_,m))}};return D}if(Te())return Le();let h=0,E=0,b$4=0,C=false,w=false,T=-1,L=0,F=false,S=NaN,O=-1,se=0,ie=()=>d$2?r==="x"?d$2.scrollLeft:d$2.scrollTop:r==="x"?window.scrollX:window.scrollY,Pe=()=>d$2?r==="x"?d$2.clientWidth:d$2.clientHeight:r==="x"?window.innerWidth:window.innerHeight,$=x===t?y:[],ae=false;function W(){let e=t.style,n=$.map(p=>e.getPropertyValue(p.prop)),P=e.transition;$.length&&(e.transition="none"),$.forEach(p=>e.setProperty(p.prop,V.get(p.prop)??""));let v=a$2(x,d$2,r);$.forEach((p,M)=>e.setProperty(p.prop,n[M])),$.length&&(t.offsetWidth,e.transition=P);let c$1=c(v,v.scroll,Pe(),ne,re);ae&&Math.abs(c$1.tStart-h)<1&&Math.abs(c$1.tEnd-E)<1||(ae=true,h=c$1.tStart,E=c$1.tEnd);}function N(e){t.style.setProperty(ye,String(e));for(let n of y)t.style.setProperty(n.prop,de(n.from,n.to,e));J?.(e);}function Me(e){if(isNaN(S)){S=e;return}S<=0&&e>0?K?.():S>0&&e<=0&&te?.(),S<1&&e>=1?Q?.():S>=1&&e<1&&ee?.(),S=e;}function B(){if(!C||w)return;let e=performance.now(),n=ie(),P=m;if(H!==false){let p=e-se,M=p>0?Math.abs(n-(O<0?n:O))/p:0;P=m*Math.max(.2,1+M*(typeof H=="number"?H:1)*.04);}O=n,se=e;let v=E===h?0:(n-h)/(E-h);Me(v);let c=k(b$2(n,h,E,P));i&&(T=Math.max(T,c),c=T),L=c,N(c),c>=1&&!F?(F=true,R?.()):c<1&&!i&&(F=false),b$4=requestAnimationFrame(B);}W(),E===h&&b$1("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",t);{let e=k(b$2(ie(),h,E,m));i&&e>0&&(T=e),L=e,N(e);}let le=new IntersectionObserver(e=>{e.forEach(n=>{C=n.isIntersecting,C&&!w?b$4=requestAnimationFrame(B):cancelAnimationFrame(b$4);});},{root:d$2??null}),j;function A(){clearTimeout(j),j=setTimeout(W,150);}window.addEventListener("resize",A),window.addEventListener("orientationchange",A);let $e=d$1([x],A);return le.observe(t),a$1(t,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(b$4),le.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),$e(),clearTimeout(j),z(),b$3(t);},replay(){T=-1,F=false,L=0,w=false,N(0);},pause(){w=true,cancelAnimationFrame(b$4);},resume(){w&&(w=false,C&&(b$4=requestAnimationFrame(B)));},seek(e){let n=Math.min(1,Math.max(0,e));L=n,T=n,w=true,cancelAnimationFrame(b$4),N(n);},getProgress(){return L},refresh(){W();}}}export{je as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,d as d$1,c,b as b$2}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';function B(n){let o=n.textContent??"";return n.textContent="",o.split(/(\s+)/).filter(Boolean).map(t=>{let e=document.createElement("span");return e.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(e.textContent=t,e.style.whiteSpace="pre"):(e.textContent=t,e.style.display="inline-block"),n.appendChild(e),/^\s+$/.test(t)?null:e}).filter(t=>t!==null)}function K(n){let o=n.textContent??"";return n.textContent="",o.split("").map(t=>{let e=document.createElement("span");return e.setAttribute("aria-hidden","true"),e.textContent=t,t===" "?e.style.whiteSpace="pre":e.style.display="inline-block",n.appendChild(e),t===" "?null:e}).filter(t=>t!==null)}function D(n){let o=B(n),t=new Map;for(let s of o){let i=s.offsetTop;t.has(i)||t.set(i,[]),t.get(i).push(s);}let e=[],c=Array.from(t.keys()).sort((s,i)=>s-i);for(let s of c){let i=t.get(s),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block",i.forEach((y,T)=>{let m=y.nextElementSibling;l.appendChild(y),T<i.length-1&&m&&m.style.whiteSpace==="pre"&&l.appendChild(m);}),e.push(l);}return n.textContent="",e.forEach((s,i)=>{n.appendChild(s),i<e.length-1&&n.appendChild(document.createTextNode(" "));}),e}function Q(n,o,t,e){if(t<=1||e===0)return n;let c=(t-1)*e,s=o*e,i=s+(1-c);return i<=s?n>=s?1:0:Math.min(1,Math.max(0,(n-s)/(i-s)))}function Z(n,o){let t=[];if(o?.y!==void 0&&t.push(`translateY(${o.y*(1-n)}px)`),o?.x!==void 0&&t.push(`translateX(${o.x*(1-n)}px)`),o?.rotate!==void 0&&t.push(`rotate(${o.rotate*(1-n)}deg)`),o?.scale!==void 0){let e=o.scale+(1-o.scale)*n;t.push(`scale(${e})`);}return t.join(" ")||""}var R={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ie(n,o={}){if(typeof window>"u")return R;let t=typeof n=="string"?document.querySelector(n):n;if(!t)return b("scrollText: element not found:",n),R;let e=t,{split:c$1="words",stagger:s=.04,easing:i="ease-out",from:l={opacity:0,y:24},trigger:y={},once:T=true,onComplete:m}=o,Y=window.matchMedia("(prefers-reduced-motion: reduce)").matches,_=typeof i=="function"?i:d[i]??d["ease-out"],j=a(y.start??"top 85%"),G=a(y.end??"top 40%"),S=e.innerHTML;e.setAttribute("aria-label",e.textContent??"");let d$2;c$1==="chars"?d$2=K(e):c$1==="lines"?d$2=D(e):d$2=B(e);let U=d$2.length;function V(r,a){l?.opacity!==void 0&&(r.style.opacity=String(l.opacity+(1-l.opacity)*a));let x=Z(a,l);x&&(r.style.transform=x);}function f(r){e.style.setProperty("--scroll-draw-progress",String(r)),d$2.forEach((a,x)=>{let J=_(Q(r,x,U,s));V(a,J);});}if(Y)return f(1),m?.(),{destroy(){e.innerHTML=S,e.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};f(0);let C=0,M=0,p=0,w=false,u=false,b$3=-1,g=0,E=false,I=()=>window.scrollY,W=()=>window.innerHeight;function F(){let r=e.getBoundingClientRect(),a=c({top:r.top,height:r.height},I(),W(),j,G);C=a.tStart,M=a.tEnd;}function L(){if(!w||u)return;let r=b$2(I(),C,M,1);T&&(b$3=Math.max(b$3,r),r=b$3),g=r,f(r),r>=1&&!E?(E=true,m?.()):r<1&&!T&&(E=false),p=requestAnimationFrame(L);}F();let P=new IntersectionObserver(r=>{r.forEach(a=>{w=a.isIntersecting,w&&!u?p=requestAnimationFrame(L):cancelAnimationFrame(p);});}),v;function h(){clearTimeout(v),v=setTimeout(()=>{if(c$1==="lines"){let r=g;e.innerHTML=S,e.setAttribute("aria-label",e.textContent??""),d$2=D(e),f(r);}F();},150);}window.addEventListener("resize",h),window.addEventListener("orientationchange",h);let X=d$1([e],h);return P.observe(e),a$1(e,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:C,tEnd:M})}),{destroy(){cancelAnimationFrame(p),P.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),X(),clearTimeout(v),e.innerHTML=S,e.removeAttribute("aria-label"),b$1(e);},replay(){b$3=-1,E=false,g=0,u=false,f(0);},pause(){u=true,cancelAnimationFrame(p);},resume(){u&&(u=false,w&&(p=requestAnimationFrame(L)));},seek(r){let a=Math.min(1,Math.max(0,r));g=a,b$3=a,u=true,cancelAnimationFrame(p),f(a);},getProgress(){return g}}}export{ie as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-WHFRS7IP.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';function l(r,s){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let o=typeof r=="string"?document.querySelector(r):r;return o?b(o,s):(b$1("Container not found:",r),n)}export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,b as b$1,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function X(m,H){if(typeof window>"u")return C;let E=typeof m=="string"?document.querySelector(m):m;if(!E)return b("scrollCounter: element not found:",m),C;let r=E,{from:T=0,to:A,format:_,easing:p="ease-out",trigger:F={},once:g=true,decimals:M,onComplete:x}=H,I=M!==void 0?e=>e.toFixed(M):_??(e=>String(Math.round(e))),P=typeof p=="function"?p:d[p]??d["ease-out"],B=a(F.start??"top 80%"),G=a(F.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r.textContent=I(A),x?.(),C;let a$2=0,c$1=0,z=false,n=0,u=false,o=false,i=-1,s=0,f=false,w=()=>window.scrollY,V=()=>window.innerHeight;function L(){let e=r.getBoundingClientRect(),t=c({top:e.top,height:e.height},w(),V(),B,G);z&&Math.abs(t.tStart-a$2)<1&&Math.abs(t.tEnd-c$1)<1||(z=true,a$2=t.tStart,c$1=t.tEnd);}function d$2(e){r.textContent=I(T+(A-T)*e),r.style.setProperty("--scroll-draw-progress",String(e));}function h(){if(!u||o)return;let e=P(b$1(w(),a$2,c$1,1));g&&(i=Math.max(i,e),e=i),s=e,d$2(e),e>=1&&!f?(f=true,x?.()):e<1&&!g&&(f=false),n=requestAnimationFrame(h);}L();{let e=P(b$1(w(),a$2,c$1,1));g&&e>0&&(i=e),s=e,d$2(e);}let O=new IntersectionObserver(e=>{e.forEach(t=>{u=t.isIntersecting,u&&!o?n=requestAnimationFrame(h):cancelAnimationFrame(n);});}),b$3;function l(){clearTimeout(b$3),b$3=setTimeout(L,150);}window.addEventListener("resize",l),window.addEventListener("orientationchange",l);let Y=d$1([r],l);return O.observe(r),a$1(r,{type:"counter",getProgress:()=>s,getTrigger:()=>({tStart:a$2,tEnd:c$1})}),{destroy(){cancelAnimationFrame(n),O.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),Y(),clearTimeout(b$3),b$2(r);},replay(){i=-1,f=false,s=0,o=false,d$2(0);},pause(){o=true,cancelAnimationFrame(n);},resume(){o&&(o=false,u&&(n=requestAnimationFrame(h)));},seek(e){let t=Math.min(1,Math.max(0,e));s=t,i=t,o=true,cancelAnimationFrame(n),d$2(t);},getProgress(){return s}}}export{X as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-BFX2CSQ3.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';var n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function b(e,o){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;return r?a(r,o):(b$1("scrollAnimate: element not found:",e),n)}function P(e,o={}){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return b$1("scrollParallax: element not found:",e),n;let{speed:c=.3,axis:p="y",easing:f="linear",trigger:u,onProgress:g}=o,i=-c*100,s=r.style,m=!!r.ownerSVGElement,y=s.getPropertyValue("transform-box");m&&s.setProperty("transform-box","fill-box");let l=a(r,{props:p==="x"?{transform:["translateX(0%)",`translateX(${i}%)`]}:{transform:["translateY(0%)",`translateY(${i}%)`]},trigger:u??{start:"top bottom",end:"bottom top"},easing:f,native:false,onProgress:g});return m?{...l,destroy(){l.destroy(),s.setProperty("transform-box",y);}}:l}export{b as a,P as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,b as b$1}from'./chunk-XSVTHCLO.mjs';import {a as a$3}from'./chunk-7SBTYJGH.mjs';import {a as a$4}from'./chunk-I45LCJUP.mjs';import {a as a$2}from'./chunk-KHQ7OGQK.mjs';import {a as a$1}from'./chunk-BFX2CSQ3.mjs';import {b as b$2}from'./chunk-WHFRS7IP.mjs';import {defineComponent,ref,h as h$1,onMounted,watch,onUnmounted,unref}from'vue';var u=e=>typeof e=="function"?e():unref(e);function r(e,t,o){let l=null,i=t(),s=()=>{l?.destroy(),l=e.value?o(e.value,b$1(i,()=>i)):null;};onMounted(s),watch(()=>a(i=t()),s),onUnmounted(()=>{l?.destroy(),l=null;});}function B(e={}){let t=ref(null);return r(t,()=>u(e),b$2),t}var g={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},b=[null,Boolean,[Boolean,String],[Boolean,Number]],T=e=>({type:e,default:void 0}),H=defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(g).map(([e,t])=>[e,t?T(b[t]):null])),setup(e,{slots:t}){let o=ref(null);return r(o,()=>{let l={};for(let i in g){let s=e[i];s!=null&&(l[i]=s);}return l},b$2),()=>h$1("div",{ref:o},t.default?.())}});function V(e){let t=ref(null);return r(t,()=>u(e),a$1),t}var j=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options,a$1),()=>h$1("div",{ref:o},t.default?.())}});function G(e){let t=ref(null);return r(t,()=>u(e),a$2),t}var h=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:T(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let t=ref(null);return r(t,()=>{let o={to:e.to};return e.from!=null&&(o.from=e.from),e.format!=null&&(o.format=e.format),e.easing!=null&&(o.easing=e.easing),e.trigger!=null&&(o.trigger=e.trigger),e.once!=null&&(o.once=e.once),e.decimals!=null&&(o.decimals=e.decimals),e.onComplete!=null&&(o.onComplete=e.onComplete),o},a$2),()=>h$1("span",{ref:t})}});function N(e={}){let t=ref(null);return r(t,()=>u(e),a$3),t}var F=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let t=ref(null);return r(t,()=>e.options??{},a$3),()=>h$1("video",{ref:t,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function q(e={}){let t=ref(null);return r(t,()=>u(e),a$4),t}var I=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options??{},a$4),()=>h$1(e.tag,{ref:o},t.default?.())}});export{B as a,H as b,V as c,j as d,G as e,h as f,N as g,F as h,q as i,I as j};
|