/**
* ˆÃ†Ž‘ŽYLPi/collabo/crypto/index.html)
*/
(function () {
"use strict";
function getSpeed(box) {
const s = parseFloat(box.getAttribute("speed"), 10);
return Number.isFinite(s) && s !== 0 ? Math.abs(s) : 60;
}
function isVertical(box) {
const fd = getComputedStyle(box).flexDirection;
return fd === "column" || fd === "column-reverse";
}
function isFlexReverse(box) {
const fd = getComputedStyle(box).flexDirection;
return fd === "row-reverse" || fd === "column-reverse";
}
function measurePeriod(box, track) {
if (!track) return 0;
const vertical = isVertical(track);
const boxStyle = getComputedStyle(box);
const trackStyle = getComputedStyle(track);
const d = vertical
? parseFloat(boxStyle.rowGap) ||
parseFloat(trackStyle.rowGap) ||
parseFloat(trackStyle.gap) ||
0
: parseFloat(boxStyle.columnGap) ||
parseFloat(trackStyle.columnGap) ||
parseFloat(trackStyle.gap) ||
0;
const children = Array.from(track.children).filter(function (el) {
return !el.classList || !el.classList.contains("loop-clone");
});
if (children.length === 0) return 0;
const ml = vertical ? "marginTop" : "marginLeft";
const mr = vertical ? "marginBottom" : "marginRight";
let v = 0;
children.forEach(function (child, P) {
const U = getComputedStyle(child);
const O = child.getBoundingClientRect();
const t1 = Math.ceil(vertical ? O.height : O.width);
const m1 = t1 + parseFloat(U[ml]) + parseFloat(U[mr]);
v += m1;
if (P < children.length - 1) v += d;
});
return v + d;
}
function getSecondKeyframeTransform(box, track, periodPx) {
const vertical = isVertical(track);
const B = isFlexReverse(box);
const T = box.hasAttribute("reverse");
const V = B !== T;
const n = vertical ? "translateY" : "translateX";
const S = V ? "" : "-";
return n + "(" + S + periodPx + "px)";
}
function placeLoopClone(box, track, periodPx) {
const clone = track.querySelector(".loop-clone");
if (!clone || !periodPx || periodPx < 1) return;
const vertical = isVertical(track);
const B = isFlexReverse(box);
const T = box.hasAttribute("reverse");
const V = B !== T;
const inset = V ? -periodPx : periodPx;
if (vertical) {
clone.style.left = "";
clone.style.top = inset + "px";
} else {
clone.style.left = inset + "px";
clone.style.top = "0px";
}
}
function initLoopBox(box) {
const track = box.querySelector(".loop-track");
if (!track || typeof track.animate !== "function") return;
const prev = box._loopBoxCancel;
if (typeof prev === "function") prev();
const period = measurePeriod(box, track);
if (!period || period < 1) {
var attempts = box._loopMeasureAttempts || 0;
if (attempts < 12) {
box._loopMeasureAttempts = attempts + 1;
window.setTimeout(function () {
initLoopBox(box);
}, attempts < 4 ? 50 : 120);
}
return;
}
box._loopMeasureAttempts = 0;
placeLoopClone(box, track, period);
const speed = getSpeed(box);
const reduce =
typeof window.matchMedia === "function" &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const endTransform = getSecondKeyframeTransform(box, track, period);
const anim = track.animate(
[
{ transform: isVertical(track) ? "translateY(0)" : "translateX(0)" },
{ transform: endTransform },
],
{
duration: period * 1000,
iterations: Infinity,
easing: "linear",
}
);
if (reduce) {
anim.pause();
anim.playbackRate = 0;
} else {
anim.playbackRate = speed;
anim.play();
}
function onReduce(e) {
if (e.matches) {
anim.pause();
anim.playbackRate = 0;
} else {
anim.playbackRate = speed;
anim.play();
}
}
let mql;
if (typeof window.matchMedia === "function") {
mql = window.matchMedia("(prefers-reduced-motion: reduce)");
if (mql.addEventListener) mql.addEventListener("change", onReduce);
else if (mql.addListener) mql.addListener(onReduce);
}
box._loopBoxCancel = function () {
anim.cancel();
if (mql) {
if (mql.removeEventListener) mql.removeEventListener("change", onReduce);
else if (mql.removeListener) mql.removeListener(onReduce);
}
var tr = box.querySelector(".loop-track");
var cl = tr && tr.querySelector(".loop-clone");
if (cl) {
cl.style.left = "";
cl.style.top = "";
}
delete box._loopBoxCancel;
};
}
function boot() {
var list = document.querySelectorAll("loop-box");
for (var i = 0; i < list.length; i++) {
var box = list[i];
if (box.parentElement && box.parentElement.closest("loop-box")) continue;
try {
initLoopBox(box);
} catch (e) {
if (typeof console !== "undefined" && console.warn) {
console.warn("[loop-box-static]", e);
}
}
}
}
function runBoot() {
requestAnimationFrame(function () {
requestAnimationFrame(boot);
});
}
var resizeTimer;
var lastLoopResizeInnerWidth = 0;
var RESIZE_WIDTH_EPS = 4;
function onWinResize() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
var w = window.innerWidth;
if (
lastLoopResizeInnerWidth > 0 &&
Math.abs(w - lastLoopResizeInnerWidth) < RESIZE_WIDTH_EPS
) {
return;
}
lastLoopResizeInnerWidth = w;
runBoot();
}, 450);
}
function onOrientationChange() {
lastLoopResizeInnerWidth = 0;
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
lastLoopResizeInnerWidth = window.innerWidth;
runBoot();
}, 400);
}
function schedule() {
function start() {
runBoot();
if (document.fonts && document.fonts.ready) {
document.fonts.ready.then(runBoot).catch(runBoot);
}
lastLoopResizeInnerWidth = window.innerWidth;
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", start);
} else {
start();
}
if (typeof window.addEventListener === "function") {
window.addEventListener("resize", onWinResize);
window.addEventListener("orientationchange", onOrientationChange);
}
}
schedule();
})();
(function () {
"use strict";
function prefersReducedMotion() {
return (
typeof window.matchMedia === "function" &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches
);
}
function reflow() {
void document.body.offsetHeight;
}
function animateTogglePanel(panel, isClose) {
const m = window.getComputedStyle(panel).height;
const addClose = function () {
panel.classList.add("_isClose");
};
const removeClose = function () {
panel.classList.remove("_isClose");
};
const y = isClose ? addClose : removeClose;
const z = isClose ? removeClose : addClose;
panel.style.transitionDuration = "0s";
y();
const L = window.getComputedStyle(panel).height;
z();
panel.style.height = m;
reflow();
panel.style.transitionDuration = "";
panel.style.height = L;
}
function afterTransition(panel, done) {
let finished = false;
function finish() {
if (finished) return;
finished = true;
clearTimeout(tm);
panel.removeEventListener("transitionend", onEnd);
done();
}
function onEnd(e) {
if (e.target === panel) finish();
}
const cs = window.getComputedStyle(panel);
const dur = (parseFloat(cs.transitionDuration) || 0) * 1000;
const delay = (parseFloat(cs.transitionDelay) || 0) * 1000;
const tm = setTimeout(finish, dur + delay + 1);
panel.addEventListener("transitionend", onEnd);
}
const buttons = document.querySelectorAll(
'button[aria-controls^="toggle-panel-"]'
);
for (let bi = 0; bi < buttons.length; bi++) {
const button = buttons[bi];
if (!button.getAttribute("type")) button.setAttribute("type", "button");
const contentId = button.getAttribute("aria-controls");
if (!contentId) continue;
const content = document.getElementById(contentId);
if (!content) continue;
const closeClassTargets = [
...button.querySelectorAll("._isClose"),
...content.querySelectorAll("._isClose"),
];
if (button.classList.contains("_isClose")) closeClassTargets.push(button);
if (content.classList.contains("_isClose")) closeClassTargets.push(content);
function setExpanded(expanded) {
button.setAttribute("aria-expanded", expanded ? "true" : "false");
content.setAttribute("aria-hidden", expanded ? "false" : "true");
if (expanded) content.removeAttribute("hidden");
else content.setAttribute("hidden", "");
for (const el of closeClassTargets) {
el.classList.toggle("_isClose", !expanded);
}
}
setExpanded(button.getAttribute("aria-expanded") === "true");
button.addEventListener("click", () => {
const willOpen = button.getAttribute("aria-expanded") !== "true";
if (prefersReducedMotion()) {
setExpanded(willOpen);
return;
}
if (willOpen) content.removeAttribute("hidden");
button.setAttribute("aria-expanded", willOpen ? "true" : "false");
content.setAttribute("aria-hidden", willOpen ? "false" : "true");
for (let i = 0; i < closeClassTargets.length; i++) {
const el = closeClassTargets[i];
if (el !== content) el.classList.toggle("_isClose", !willOpen);
}
function runMeasured() {
animateTogglePanel(content, !willOpen);
afterTransition(content, () => {
content.style.height = "";
content.style.transitionDuration = "";
content.classList.toggle("_isClose", !willOpen);
if (!willOpen) content.setAttribute("hidden", "");
else content.removeAttribute("hidden");
});
}
if (willOpen) {
requestAnimationFrame(function () {
requestAnimationFrame(runMeasured);
});
} else {
runMeasured();
}
});
}
})();