@findnlink/neuro-ui
Version:
Findnlink design system
1,446 lines (1,444 loc) • 945 kB
JavaScript
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a2, b2) => {
for (var prop in b2 || (b2 = {}))
if (__hasOwnProp.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b2)) {
if (__propIsEnum.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
}
return a2;
};
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
import * as React$1 from "react";
import React__default, { createContext, useContext, useLayoutEffect, useEffect, useState, useRef, useCallback as useCallback$1, useMemo as useMemo$1, forwardRef, createElement, cloneElement, Children, isValidElement, useReducer, useDebugValue } from "react";
const fontS$p = "_fontS_2x9f7_1";
const fontM$p = "_fontM_2x9f7_6";
const fontL$p = "_fontL_2x9f7_11";
const fontXL$p = "_fontXL_2x9f7_16";
const weightLight$p = "_weightLight_2x9f7_21";
const weightNormal$p = "_weightNormal_2x9f7_26";
const weightBold$p = "_weightBold_2x9f7_31";
const disabled$p = "_disabled_2x9f7_36";
const error$p = "_error_2x9f7_45";
const errorMessage$p = "_errorMessage_2x9f7_49";
const pointer$p = "_pointer_2x9f7_54";
const loading$p = "_loading_2x9f7_58";
const loadingAnimationOpacity$p = "_loadingAnimationOpacity_2x9f7_1";
const loadingAnimation$p = "_loadingAnimation_2x9f7_1";
const margin0$p = "_margin0_2x9f7_94";
const marginS$p = "_marginS_2x9f7_98";
const marginM$p = "_marginM_2x9f7_102";
const marginL$p = "_marginL_2x9f7_106";
const marginXL$p = "_marginXL_2x9f7_110";
const marginTop0$p = "_marginTop0_2x9f7_114";
const marginTopS$p = "_marginTopS_2x9f7_118";
const marginTopM$p = "_marginTopM_2x9f7_122";
const marginTopL$p = "_marginTopL_2x9f7_126";
const marginTopXL$p = "_marginTopXL_2x9f7_130";
const marginRight0$p = "_marginRight0_2x9f7_134";
const marginRightS$p = "_marginRightS_2x9f7_138";
const marginRightM$p = "_marginRightM_2x9f7_142";
const marginRightL$p = "_marginRightL_2x9f7_146";
const marginRightXL$p = "_marginRightXL_2x9f7_150";
const marginBottom0$p = "_marginBottom0_2x9f7_154";
const marginBottomS$p = "_marginBottomS_2x9f7_158";
const marginBottomM$p = "_marginBottomM_2x9f7_162";
const marginBottomL$p = "_marginBottomL_2x9f7_166";
const marginBottomXL$p = "_marginBottomXL_2x9f7_170";
const marginLeft0$p = "_marginLeft0_2x9f7_174";
const marginLeftS$p = "_marginLeftS_2x9f7_178";
const marginLeftM$p = "_marginLeftM_2x9f7_182";
const marginLeftL$p = "_marginLeftL_2x9f7_186";
const marginLeftXL$p = "_marginLeftXL_2x9f7_190";
const padding0$p = "_padding0_2x9f7_194";
const paddingS$p = "_paddingS_2x9f7_198";
const paddingM$p = "_paddingM_2x9f7_202";
const paddingL$p = "_paddingL_2x9f7_206";
const paddingXL$p = "_paddingXL_2x9f7_210";
const paddingTop0$p = "_paddingTop0_2x9f7_214";
const paddingTopS$p = "_paddingTopS_2x9f7_218";
const paddingTopM$p = "_paddingTopM_2x9f7_222";
const paddingTopL$p = "_paddingTopL_2x9f7_226";
const paddingTopXL$p = "_paddingTopXL_2x9f7_230";
const paddingRight0$p = "_paddingRight0_2x9f7_234";
const paddingRightS$p = "_paddingRightS_2x9f7_238";
const paddingRightM$p = "_paddingRightM_2x9f7_242";
const paddingRightL$p = "_paddingRightL_2x9f7_246";
const paddingRightXL$p = "_paddingRightXL_2x9f7_250";
const paddingBottom0$p = "_paddingBottom0_2x9f7_254";
const paddingBottomS$p = "_paddingBottomS_2x9f7_258";
const paddingBottomM$p = "_paddingBottomM_2x9f7_262";
const paddingBottomL$p = "_paddingBottomL_2x9f7_266";
const paddingBottomXL$p = "_paddingBottomXL_2x9f7_270";
const paddingLeft0$p = "_paddingLeft0_2x9f7_274";
const paddingLeftS$p = "_paddingLeftS_2x9f7_278";
const paddingLeftM$p = "_paddingLeftM_2x9f7_282";
const paddingLeftL$p = "_paddingLeftL_2x9f7_286";
const paddingLeftXL$p = "_paddingLeftXL_2x9f7_290";
const button = "_button_2x9f7_310";
const primary = "_primary_2x9f7_332";
var scss$u = {
fontS: fontS$p,
fontM: fontM$p,
fontL: fontL$p,
fontXL: fontXL$p,
weightLight: weightLight$p,
weightNormal: weightNormal$p,
weightBold: weightBold$p,
disabled: disabled$p,
error: error$p,
errorMessage: errorMessage$p,
pointer: pointer$p,
loading: loading$p,
loadingAnimationOpacity: loadingAnimationOpacity$p,
loadingAnimation: loadingAnimation$p,
margin0: margin0$p,
marginS: marginS$p,
marginM: marginM$p,
marginL: marginL$p,
marginXL: marginXL$p,
marginTop0: marginTop0$p,
marginTopS: marginTopS$p,
marginTopM: marginTopM$p,
marginTopL: marginTopL$p,
marginTopXL: marginTopXL$p,
marginRight0: marginRight0$p,
marginRightS: marginRightS$p,
marginRightM: marginRightM$p,
marginRightL: marginRightL$p,
marginRightXL: marginRightXL$p,
marginBottom0: marginBottom0$p,
marginBottomS: marginBottomS$p,
marginBottomM: marginBottomM$p,
marginBottomL: marginBottomL$p,
marginBottomXL: marginBottomXL$p,
marginLeft0: marginLeft0$p,
marginLeftS: marginLeftS$p,
marginLeftM: marginLeftM$p,
marginLeftL: marginLeftL$p,
marginLeftXL: marginLeftXL$p,
padding0: padding0$p,
paddingS: paddingS$p,
paddingM: paddingM$p,
paddingL: paddingL$p,
paddingXL: paddingXL$p,
paddingTop0: paddingTop0$p,
paddingTopS: paddingTopS$p,
paddingTopM: paddingTopM$p,
paddingTopL: paddingTopL$p,
paddingTopXL: paddingTopXL$p,
paddingRight0: paddingRight0$p,
paddingRightS: paddingRightS$p,
paddingRightM: paddingRightM$p,
paddingRightL: paddingRightL$p,
paddingRightXL: paddingRightXL$p,
paddingBottom0: paddingBottom0$p,
paddingBottomS: paddingBottomS$p,
paddingBottomM: paddingBottomM$p,
paddingBottomL: paddingBottomL$p,
paddingBottomXL: paddingBottomXL$p,
paddingLeft0: paddingLeft0$p,
paddingLeftS: paddingLeftS$p,
paddingLeftM: paddingLeftM$p,
paddingLeftL: paddingLeftL$p,
paddingLeftXL: paddingLeftXL$p,
"backgroundColor--primary": "_backgroundColor--primary_2x9f7_294",
"backgroundColor--text100": "_backgroundColor--text100_2x9f7_298",
"color--primary": "_color--primary_2x9f7_302",
"color--text100": "_color--text100_2x9f7_306",
button,
primary
};
const _getClassNames = ({
parent,
scss: scss2,
_class,
primary: primary2,
disabled: disabled2,
loading: loading2,
error: error2,
pointer: pointer2,
scale: scale2,
weight,
margin,
padding,
color: color2,
backgroundColor
}) => {
let _className = [parent];
if (_class)
_className.push(_class);
if (primary2)
_className.push(scss2.primary);
if (disabled2)
_className.push(scss2.disabled);
if (loading2)
_className.push(scss2.loading);
if (error2)
_className.push(scss2.error);
if (pointer2)
_className.push(scss2.pointer);
if (color2)
_className.push(scss2["color" + color2]);
if (backgroundColor)
_className.push(scss2["backgroundColor" + backgroundColor]);
switch (scale2) {
case "s":
_className.push(scss2.fontS);
break;
case "m":
_className.push(scss2.fontM);
break;
case "l":
_className.push(scss2.fontL);
break;
case "xl":
_className.push(scss2.fontXL);
break;
}
switch (weight) {
case "light":
_className.push(scss2.weightLight);
break;
case "normal":
_className.push(scss2.weightNormal);
break;
case "bold":
_className.push(scss2.weightBold);
break;
}
if (margin) {
const marginArr = margin.split(" ");
if (marginArr.length === 1) {
switch (margin) {
case "0":
_className.push(scss2.margin0);
break;
case "s":
_className.push(scss2.marginS);
break;
case "m":
_className.push(scss2.marginM);
break;
case "l":
_className.push(scss2.marginL);
break;
case "xl":
_className.push(scss2.marginXL);
break;
}
} else if (marginArr.length === 2) {
switch (marginArr[0]) {
case "0":
_className.push(scss2.marginTop0);
_className.push(scss2.marginBottom0);
break;
case "s":
_className.push(scss2.marginTopS);
_className.push(scss2.marginBottomS);
break;
case "m":
_className.push(scss2.marginTopM);
_className.push(scss2.marginBottomM);
break;
case "l":
_className.push(scss2.marginTopL);
_className.push(scss2.marginBottomL);
break;
case "xl":
_className.push(scss2.marginTopXL);
_className.push(scss2.marginBottomXL);
break;
}
switch (marginArr[1]) {
case "0":
_className.push(scss2.marginLeft0);
_className.push(scss2.marginRight0);
break;
case "s":
_className.push(scss2.marginLeftS);
_className.push(scss2.marginRightS);
break;
case "m":
_className.push(scss2.marginLeftM);
_className.push(scss2.marginRightM);
break;
case "l":
_className.push(scss2.marginLeftL);
_className.push(scss2.marginRightL);
break;
case "xl":
_className.push(scss2.marginLeftXL);
_className.push(scss2.marginRightXL);
break;
}
} else if (marginArr.length === 4) {
switch (marginArr[0]) {
case "0":
_className.push(scss2.marginTop0);
break;
case "s":
_className.push(scss2.marginTopS);
break;
case "m":
_className.push(scss2.marginTopM);
break;
case "l":
_className.push(scss2.marginTopL);
break;
case "xl":
_className.push(scss2.marginTopXL);
break;
}
switch (marginArr[1]) {
case "0":
_className.push(scss2.marginRight0);
break;
case "s":
_className.push(scss2.marginRightS);
break;
case "m":
_className.push(scss2.marginRightM);
break;
case "l":
_className.push(scss2.marginRightL);
break;
case "xl":
_className.push(scss2.marginRightXL);
break;
}
switch (marginArr[2]) {
case "0":
_className.push(scss2.marginBottom0);
break;
case "s":
_className.push(scss2.marginBottomS);
break;
case "m":
_className.push(scss2.marginBottomM);
break;
case "l":
_className.push(scss2.marginBottomL);
break;
case "xl":
_className.push(scss2.marginBottomXL);
break;
}
switch (marginArr[3]) {
case "0":
_className.push(scss2.marginLeft0);
break;
case "s":
_className.push(scss2.marginLeftS);
break;
case "m":
_className.push(scss2.marginLeftM);
break;
case "l":
_className.push(scss2.marginLeftL);
break;
case "xl":
_className.push(scss2.marginLeftXL);
break;
}
}
}
if (padding) {
const paddingArr = padding.split(" ");
if (paddingArr.length === 1) {
switch (padding) {
case "0":
_className.push(scss2.padding0);
break;
case "s":
_className.push(scss2.paddingS);
break;
case "m":
_className.push(scss2.paddingM);
break;
case "l":
_className.push(scss2.paddingL);
break;
case "xl":
_className.push(scss2.paddingXL);
break;
}
} else if (paddingArr.length === 2) {
switch (paddingArr[0]) {
case "0":
_className.push(scss2.paddingTop0);
_className.push(scss2.paddingBottom0);
break;
case "s":
_className.push(scss2.paddingTopS);
_className.push(scss2.paddingBottomS);
break;
case "m":
_className.push(scss2.paddingTopM);
_className.push(scss2.paddingBottomM);
break;
case "l":
_className.push(scss2.paddingTopL);
_className.push(scss2.paddingBottomL);
break;
case "xl":
_className.push(scss2.paddingTopXL);
_className.push(scss2.paddingBottomXL);
break;
}
switch (paddingArr[1]) {
case "0":
_className.push(scss2.paddingLeft0);
_className.push(scss2.paddingRight0);
break;
case "s":
_className.push(scss2.paddingLeftS);
_className.push(scss2.paddingRightS);
break;
case "m":
_className.push(scss2.paddingLeftM);
_className.push(scss2.paddingRightM);
break;
case "l":
_className.push(scss2.paddingLeftL);
_className.push(scss2.paddingRightL);
break;
case "xl":
_className.push(scss2.paddingLeftXL);
_className.push(scss2.paddingRightXL);
break;
}
} else if (paddingArr.length === 4) {
switch (paddingArr[0]) {
case "0":
_className.push(scss2.paddingTop0);
break;
case "s":
_className.push(scss2.paddingTopS);
break;
case "m":
_className.push(scss2.paddingTopM);
break;
case "l":
_className.push(scss2.paddingTopL);
break;
case "xl":
_className.push(scss2.paddingTopXL);
break;
}
switch (paddingArr[1]) {
case "0":
_className.push(scss2.paddingRight0);
break;
case "s":
_className.push(scss2.paddingRightS);
break;
case "m":
_className.push(scss2.paddingRightM);
break;
case "l":
_className.push(scss2.paddingRightL);
break;
case "xl":
_className.push(scss2.paddingRightXL);
break;
}
switch (paddingArr[2]) {
case "0":
_className.push(scss2.paddingBottom0);
break;
case "s":
_className.push(scss2.paddingBottomS);
break;
case "m":
_className.push(scss2.paddingBottomM);
break;
case "l":
_className.push(scss2.paddingBottomL);
break;
case "xl":
_className.push(scss2.paddingBottomXL);
break;
}
switch (paddingArr[3]) {
case "0":
_className.push(scss2.paddingLeft0);
break;
case "s":
_className.push(scss2.paddingLeftS);
break;
case "m":
_className.push(scss2.paddingLeftM);
break;
case "l":
_className.push(scss2.paddingLeftL);
break;
case "xl":
_className.push(scss2.paddingLeftXL);
break;
}
}
}
return _className;
};
const Button = (_a) => {
var _b = _a, {
children,
href,
onClick,
disabled: disabled2,
loading: loading2,
htmlProps,
style: style2,
variables
} = _b, props2 = __objRest(_b, [
"children",
"href",
"onClick",
"disabled",
"loading",
"htmlProps",
"style",
"variables"
]);
const getClassNames = () => {
let className = _getClassNames(__spreadValues({
parent: scss$u.button,
scss: scss$u,
disabled: disabled2,
loading: loading2
}, props2));
return className.join(" ");
};
return /* @__PURE__ */ React__default.createElement("button", __spreadValues({
"data-testid": "button",
onClick: (e2) => {
if (disabled2 || loading2)
return;
if (onClick)
onClick(e2);
if (href)
window.open(href, "_blank");
},
className: getClassNames(),
style: style2
}, htmlProps), children);
};
const fontS$o = "_fontS_1itq9_1";
const fontM$o = "_fontM_1itq9_6";
const fontL$o = "_fontL_1itq9_11";
const fontXL$o = "_fontXL_1itq9_16";
const weightLight$o = "_weightLight_1itq9_21";
const weightNormal$o = "_weightNormal_1itq9_26";
const weightBold$o = "_weightBold_1itq9_31";
const disabled$o = "_disabled_1itq9_36";
const error$o = "_error_1itq9_45";
const errorMessage$o = "_errorMessage_1itq9_49";
const pointer$o = "_pointer_1itq9_54";
const loading$o = "_loading_1itq9_58";
const loadingAnimationOpacity$o = "_loadingAnimationOpacity_1itq9_1";
const loadingAnimation$o = "_loadingAnimation_1itq9_1";
const margin0$o = "_margin0_1itq9_94";
const marginS$o = "_marginS_1itq9_98";
const marginM$o = "_marginM_1itq9_102";
const marginL$o = "_marginL_1itq9_106";
const marginXL$o = "_marginXL_1itq9_110";
const marginTop0$o = "_marginTop0_1itq9_114";
const marginTopS$o = "_marginTopS_1itq9_118";
const marginTopM$o = "_marginTopM_1itq9_122";
const marginTopL$o = "_marginTopL_1itq9_126";
const marginTopXL$o = "_marginTopXL_1itq9_130";
const marginRight0$o = "_marginRight0_1itq9_134";
const marginRightS$o = "_marginRightS_1itq9_138";
const marginRightM$o = "_marginRightM_1itq9_142";
const marginRightL$o = "_marginRightL_1itq9_146";
const marginRightXL$o = "_marginRightXL_1itq9_150";
const marginBottom0$o = "_marginBottom0_1itq9_154";
const marginBottomS$o = "_marginBottomS_1itq9_158";
const marginBottomM$o = "_marginBottomM_1itq9_162";
const marginBottomL$o = "_marginBottomL_1itq9_166";
const marginBottomXL$o = "_marginBottomXL_1itq9_170";
const marginLeft0$o = "_marginLeft0_1itq9_174";
const marginLeftS$o = "_marginLeftS_1itq9_178";
const marginLeftM$o = "_marginLeftM_1itq9_182";
const marginLeftL$o = "_marginLeftL_1itq9_186";
const marginLeftXL$o = "_marginLeftXL_1itq9_190";
const padding0$o = "_padding0_1itq9_194";
const paddingS$o = "_paddingS_1itq9_198";
const paddingM$o = "_paddingM_1itq9_202";
const paddingL$o = "_paddingL_1itq9_206";
const paddingXL$o = "_paddingXL_1itq9_210";
const paddingTop0$o = "_paddingTop0_1itq9_214";
const paddingTopS$o = "_paddingTopS_1itq9_218";
const paddingTopM$o = "_paddingTopM_1itq9_222";
const paddingTopL$o = "_paddingTopL_1itq9_226";
const paddingTopXL$o = "_paddingTopXL_1itq9_230";
const paddingRight0$o = "_paddingRight0_1itq9_234";
const paddingRightS$o = "_paddingRightS_1itq9_238";
const paddingRightM$o = "_paddingRightM_1itq9_242";
const paddingRightL$o = "_paddingRightL_1itq9_246";
const paddingRightXL$o = "_paddingRightXL_1itq9_250";
const paddingBottom0$o = "_paddingBottom0_1itq9_254";
const paddingBottomS$o = "_paddingBottomS_1itq9_258";
const paddingBottomM$o = "_paddingBottomM_1itq9_262";
const paddingBottomL$o = "_paddingBottomL_1itq9_266";
const paddingBottomXL$o = "_paddingBottomXL_1itq9_270";
const paddingLeft0$o = "_paddingLeft0_1itq9_274";
const paddingLeftS$o = "_paddingLeftS_1itq9_278";
const paddingLeftM$o = "_paddingLeftM_1itq9_282";
const paddingLeftL$o = "_paddingLeftL_1itq9_286";
const paddingLeftXL$o = "_paddingLeftXL_1itq9_290";
const buttonGroup = "_buttonGroup_1itq9_310";
var scss$t = {
fontS: fontS$o,
fontM: fontM$o,
fontL: fontL$o,
fontXL: fontXL$o,
weightLight: weightLight$o,
weightNormal: weightNormal$o,
weightBold: weightBold$o,
disabled: disabled$o,
error: error$o,
errorMessage: errorMessage$o,
pointer: pointer$o,
loading: loading$o,
loadingAnimationOpacity: loadingAnimationOpacity$o,
loadingAnimation: loadingAnimation$o,
margin0: margin0$o,
marginS: marginS$o,
marginM: marginM$o,
marginL: marginL$o,
marginXL: marginXL$o,
marginTop0: marginTop0$o,
marginTopS: marginTopS$o,
marginTopM: marginTopM$o,
marginTopL: marginTopL$o,
marginTopXL: marginTopXL$o,
marginRight0: marginRight0$o,
marginRightS: marginRightS$o,
marginRightM: marginRightM$o,
marginRightL: marginRightL$o,
marginRightXL: marginRightXL$o,
marginBottom0: marginBottom0$o,
marginBottomS: marginBottomS$o,
marginBottomM: marginBottomM$o,
marginBottomL: marginBottomL$o,
marginBottomXL: marginBottomXL$o,
marginLeft0: marginLeft0$o,
marginLeftS: marginLeftS$o,
marginLeftM: marginLeftM$o,
marginLeftL: marginLeftL$o,
marginLeftXL: marginLeftXL$o,
padding0: padding0$o,
paddingS: paddingS$o,
paddingM: paddingM$o,
paddingL: paddingL$o,
paddingXL: paddingXL$o,
paddingTop0: paddingTop0$o,
paddingTopS: paddingTopS$o,
paddingTopM: paddingTopM$o,
paddingTopL: paddingTopL$o,
paddingTopXL: paddingTopXL$o,
paddingRight0: paddingRight0$o,
paddingRightS: paddingRightS$o,
paddingRightM: paddingRightM$o,
paddingRightL: paddingRightL$o,
paddingRightXL: paddingRightXL$o,
paddingBottom0: paddingBottom0$o,
paddingBottomS: paddingBottomS$o,
paddingBottomM: paddingBottomM$o,
paddingBottomL: paddingBottomL$o,
paddingBottomXL: paddingBottomXL$o,
paddingLeft0: paddingLeft0$o,
paddingLeftS: paddingLeftS$o,
paddingLeftM: paddingLeftM$o,
paddingLeftL: paddingLeftL$o,
paddingLeftXL: paddingLeftXL$o,
"backgroundColor--primary": "_backgroundColor--primary_1itq9_294",
"backgroundColor--text100": "_backgroundColor--text100_1itq9_298",
"color--primary": "_color--primary_1itq9_302",
"color--text100": "_color--text100_1itq9_306",
buttonGroup
};
const ButtonGroup = (_c) => {
var _d = _c, { selected: selected2, setSelected, buttons } = _d, props2 = __objRest(_d, ["selected", "setSelected", "buttons"]);
const getClassNames = () => {
let className = _getClassNames(__spreadValues({
parent: scss$t.buttonGroup,
scss: scss$t
}, props2));
return className.join(" ");
};
return /* @__PURE__ */ React__default.createElement("div", {
className: getClassNames()
}, buttons.map((button2, index) => typeof button2 === "string" ? /* @__PURE__ */ React__default.createElement(Button, {
margin: "s",
htmlProps: { key: index },
onClick: () => setSelected(button2),
primary: button2 === selected2,
disabled: props2.disabled,
key: index
}, button2) : /* @__PURE__ */ React__default.createElement(Button, __spreadValues({
margin: "s",
htmlProps: { key: index },
scale: props2.scale,
onClick: () => setSelected(button2.children),
primary: selected2 === button2.children,
key: index
}, button2), button2.children)));
};
const fontS$n = "_fontS_18wk5_1";
const fontM$n = "_fontM_18wk5_6";
const fontL$n = "_fontL_18wk5_11";
const fontXL$n = "_fontXL_18wk5_16";
const weightLight$n = "_weightLight_18wk5_21";
const weightNormal$n = "_weightNormal_18wk5_26";
const weightBold$n = "_weightBold_18wk5_31";
const disabled$n = "_disabled_18wk5_36";
const error$n = "_error_18wk5_45";
const errorMessage$n = "_errorMessage_18wk5_49";
const pointer$n = "_pointer_18wk5_54";
const loading$n = "_loading_18wk5_58";
const loadingAnimationOpacity$n = "_loadingAnimationOpacity_18wk5_1";
const loadingAnimation$n = "_loadingAnimation_18wk5_1";
const margin0$n = "_margin0_18wk5_94";
const marginS$n = "_marginS_18wk5_98";
const marginM$n = "_marginM_18wk5_102";
const marginL$n = "_marginL_18wk5_106";
const marginXL$n = "_marginXL_18wk5_110";
const marginTop0$n = "_marginTop0_18wk5_114";
const marginTopS$n = "_marginTopS_18wk5_118";
const marginTopM$n = "_marginTopM_18wk5_122";
const marginTopL$n = "_marginTopL_18wk5_126";
const marginTopXL$n = "_marginTopXL_18wk5_130";
const marginRight0$n = "_marginRight0_18wk5_134";
const marginRightS$n = "_marginRightS_18wk5_138";
const marginRightM$n = "_marginRightM_18wk5_142";
const marginRightL$n = "_marginRightL_18wk5_146";
const marginRightXL$n = "_marginRightXL_18wk5_150";
const marginBottom0$n = "_marginBottom0_18wk5_154";
const marginBottomS$n = "_marginBottomS_18wk5_158";
const marginBottomM$n = "_marginBottomM_18wk5_162";
const marginBottomL$n = "_marginBottomL_18wk5_166";
const marginBottomXL$n = "_marginBottomXL_18wk5_170";
const marginLeft0$n = "_marginLeft0_18wk5_174";
const marginLeftS$n = "_marginLeftS_18wk5_178";
const marginLeftM$n = "_marginLeftM_18wk5_182";
const marginLeftL$n = "_marginLeftL_18wk5_186";
const marginLeftXL$n = "_marginLeftXL_18wk5_190";
const padding0$n = "_padding0_18wk5_194";
const paddingS$n = "_paddingS_18wk5_198";
const paddingM$n = "_paddingM_18wk5_202";
const paddingL$n = "_paddingL_18wk5_206";
const paddingXL$n = "_paddingXL_18wk5_210";
const paddingTop0$n = "_paddingTop0_18wk5_214";
const paddingTopS$n = "_paddingTopS_18wk5_218";
const paddingTopM$n = "_paddingTopM_18wk5_222";
const paddingTopL$n = "_paddingTopL_18wk5_226";
const paddingTopXL$n = "_paddingTopXL_18wk5_230";
const paddingRight0$n = "_paddingRight0_18wk5_234";
const paddingRightS$n = "_paddingRightS_18wk5_238";
const paddingRightM$n = "_paddingRightM_18wk5_242";
const paddingRightL$n = "_paddingRightL_18wk5_246";
const paddingRightXL$n = "_paddingRightXL_18wk5_250";
const paddingBottom0$n = "_paddingBottom0_18wk5_254";
const paddingBottomS$n = "_paddingBottomS_18wk5_258";
const paddingBottomM$n = "_paddingBottomM_18wk5_262";
const paddingBottomL$n = "_paddingBottomL_18wk5_266";
const paddingBottomXL$n = "_paddingBottomXL_18wk5_270";
const paddingLeft0$n = "_paddingLeft0_18wk5_274";
const paddingLeftS$n = "_paddingLeftS_18wk5_278";
const paddingLeftM$n = "_paddingLeftM_18wk5_282";
const paddingLeftL$n = "_paddingLeftL_18wk5_286";
const paddingLeftXL$n = "_paddingLeftXL_18wk5_290";
const card = "_card_18wk5_310";
const header$2 = "_header_18wk5_321";
const content$1 = "_content_18wk5_325";
var scss$s = {
fontS: fontS$n,
fontM: fontM$n,
fontL: fontL$n,
fontXL: fontXL$n,
weightLight: weightLight$n,
weightNormal: weightNormal$n,
weightBold: weightBold$n,
disabled: disabled$n,
error: error$n,
errorMessage: errorMessage$n,
pointer: pointer$n,
loading: loading$n,
loadingAnimationOpacity: loadingAnimationOpacity$n,
loadingAnimation: loadingAnimation$n,
margin0: margin0$n,
marginS: marginS$n,
marginM: marginM$n,
marginL: marginL$n,
marginXL: marginXL$n,
marginTop0: marginTop0$n,
marginTopS: marginTopS$n,
marginTopM: marginTopM$n,
marginTopL: marginTopL$n,
marginTopXL: marginTopXL$n,
marginRight0: marginRight0$n,
marginRightS: marginRightS$n,
marginRightM: marginRightM$n,
marginRightL: marginRightL$n,
marginRightXL: marginRightXL$n,
marginBottom0: marginBottom0$n,
marginBottomS: marginBottomS$n,
marginBottomM: marginBottomM$n,
marginBottomL: marginBottomL$n,
marginBottomXL: marginBottomXL$n,
marginLeft0: marginLeft0$n,
marginLeftS: marginLeftS$n,
marginLeftM: marginLeftM$n,
marginLeftL: marginLeftL$n,
marginLeftXL: marginLeftXL$n,
padding0: padding0$n,
paddingS: paddingS$n,
paddingM: paddingM$n,
paddingL: paddingL$n,
paddingXL: paddingXL$n,
paddingTop0: paddingTop0$n,
paddingTopS: paddingTopS$n,
paddingTopM: paddingTopM$n,
paddingTopL: paddingTopL$n,
paddingTopXL: paddingTopXL$n,
paddingRight0: paddingRight0$n,
paddingRightS: paddingRightS$n,
paddingRightM: paddingRightM$n,
paddingRightL: paddingRightL$n,
paddingRightXL: paddingRightXL$n,
paddingBottom0: paddingBottom0$n,
paddingBottomS: paddingBottomS$n,
paddingBottomM: paddingBottomM$n,
paddingBottomL: paddingBottomL$n,
paddingBottomXL: paddingBottomXL$n,
paddingLeft0: paddingLeft0$n,
paddingLeftS: paddingLeftS$n,
paddingLeftM: paddingLeftM$n,
paddingLeftL: paddingLeftL$n,
paddingLeftXL: paddingLeftXL$n,
"backgroundColor--primary": "_backgroundColor--primary_18wk5_294",
"backgroundColor--text100": "_backgroundColor--text100_18wk5_298",
"color--primary": "_color--primary_18wk5_302",
"color--text100": "_color--text100_18wk5_306",
card,
header: header$2,
content: content$1
};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var extendStatics = function(d2, b2) {
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
d3.__proto__ = b3;
} || function(d3, b3) {
for (var p2 in b3)
if (Object.prototype.hasOwnProperty.call(b3, p2))
d3[p2] = b3[p2];
};
return extendStatics(d2, b2);
};
function __extends$1(d2, b2) {
if (typeof b2 !== "function" && b2 !== null)
throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
extendStatics(d2, b2);
function __() {
this.constructor = d2;
}
d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
}
var __assign$1 = function() {
__assign$1 = Object.assign || function __assign2(t2) {
for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
s = arguments[i];
for (var p2 in s)
if (Object.prototype.hasOwnProperty.call(s, p2))
t2[p2] = s[p2];
}
return t2;
};
return __assign$1.apply(this, arguments);
};
function __rest$1(s, e2) {
var t2 = {};
for (var p2 in s)
if (Object.prototype.hasOwnProperty.call(s, p2) && e2.indexOf(p2) < 0)
t2[p2] = s[p2];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) {
if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]))
t2[p2[i]] = s[p2[i]];
}
return t2;
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m2 = s && o[s], i = 0;
if (m2)
return m2.call(o);
if (o && typeof o.length === "number")
return {
next: function() {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n2) {
var m2 = typeof Symbol === "function" && o[Symbol.iterator];
if (!m2)
return o;
var i = m2.call(o), r2, ar = [], e2;
try {
while ((n2 === void 0 || n2-- > 0) && !(r2 = i.next()).done)
ar.push(r2.value);
} catch (error2) {
e2 = { error: error2 };
} finally {
try {
if (r2 && !r2.done && (m2 = i["return"]))
m2.call(i);
} finally {
if (e2)
throw e2.error;
}
}
return ar;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l2 = from.length, ar; i < l2; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
var createDefinition = function(propNames) {
return {
isEnabled: function(props2) {
return propNames.some(function(name) {
return !!props2[name];
});
}
};
};
var featureDefinitions = {
measureLayout: createDefinition(["layout", "layoutId", "drag"]),
animation: createDefinition([
"animate",
"exit",
"variants",
"whileHover",
"whileTap",
"whileFocus",
"whileDrag",
"whileInView"
]),
exit: createDefinition(["exit"]),
drag: createDefinition(["drag", "dragControls"]),
focus: createDefinition(["whileFocus"]),
hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
pan: createDefinition([
"onPan",
"onPanStart",
"onPanSessionStart",
"onPanEnd"
]),
inView: createDefinition([
"whileInView",
"onViewportEnter",
"onViewportLeave"
])
};
function loadFeatures(features) {
for (var key in features) {
if (features[key] === null)
continue;
if (key === "projectionNodeConstructor") {
featureDefinitions.projectionNodeConstructor = features[key];
} else {
featureDefinitions[key].Component = features[key];
}
}
}
var warning = function() {
};
var invariant$3 = function() {
};
var LazyContext = createContext({ strict: false });
var featureNames = Object.keys(featureDefinitions);
var numFeatures = featureNames.length;
function useFeatures(props2, visualElement2, preloadedFeatures) {
var features = [];
useContext(LazyContext);
if (!visualElement2)
return null;
for (var i = 0; i < numFeatures; i++) {
var name_1 = featureNames[i];
var _a = featureDefinitions[name_1], isEnabled = _a.isEnabled, Component = _a.Component;
if (isEnabled(props2) && Component) {
features.push(React$1.createElement(Component, __assign$1({ key: name_1 }, props2, { visualElement: visualElement2 })));
}
}
return features;
}
var MotionConfigContext = createContext({
transformPagePoint: function(p2) {
return p2;
},
isStatic: false,
reducedMotion: "never"
});
var MotionContext = createContext({});
function useVisualElementContext() {
return useContext(MotionContext).visualElement;
}
var PresenceContext = createContext(null);
var isBrowser = typeof window !== "undefined";
var useIsomorphicLayoutEffect$3 = isBrowser ? useLayoutEffect : useEffect;
var prefersReducedMotion = { current: null };
var hasDetected = false;
function initPrefersReducedMotion() {
hasDetected = true;
if (typeof window === "undefined")
return;
if (window.matchMedia) {
var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
var setReducedMotionPreferences = function() {
return prefersReducedMotion.current = motionMediaQuery_1.matches;
};
motionMediaQuery_1.addListener(setReducedMotionPreferences);
setReducedMotionPreferences();
} else {
prefersReducedMotion.current = false;
}
}
function useReducedMotion() {
!hasDetected && initPrefersReducedMotion();
var _a = __read(useState(prefersReducedMotion.current), 1), shouldReduceMotion = _a[0];
return shouldReduceMotion;
}
function useReducedMotionConfig() {
var reducedMotionPreference = useReducedMotion();
var reducedMotion = useContext(MotionConfigContext).reducedMotion;
if (reducedMotion === "never") {
return false;
} else if (reducedMotion === "always") {
return true;
} else {
return reducedMotionPreference;
}
}
function useVisualElement(Component, visualState, props2, createVisualElement) {
var lazyContext = useContext(LazyContext);
var parent = useVisualElementContext();
var presenceContext = useContext(PresenceContext);
var shouldReduceMotion = useReducedMotionConfig();
var visualElementRef = useRef(void 0);
if (!createVisualElement)
createVisualElement = lazyContext.renderer;
if (!visualElementRef.current && createVisualElement) {
visualElementRef.current = createVisualElement(Component, {
visualState,
parent,
props: props2,
presenceId: presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id,
blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
shouldReduceMotion
});
}
var visualElement2 = visualElementRef.current;
useIsomorphicLayoutEffect$3(function() {
visualElement2 === null || visualElement2 === void 0 ? void 0 : visualElement2.syncRender();
});
useEffect(function() {
var _a;
(_a = visualElement2 === null || visualElement2 === void 0 ? void 0 : visualElement2.animationState) === null || _a === void 0 ? void 0 : _a.animateChanges();
});
useIsomorphicLayoutEffect$3(function() {
return function() {
return visualElement2 === null || visualElement2 === void 0 ? void 0 : visualElement2.notifyUnmount();
};
}, []);
return visualElement2;
}
function isRefObject(ref) {
return typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current");
}
function useMotionRef(visualState, visualElement2, externalRef) {
return useCallback$1(function(instance) {
var _a;
instance && ((_a = visualState.mount) === null || _a === void 0 ? void 0 : _a.call(visualState, instance));
if (visualElement2) {
instance ? visualElement2.mount(instance) : visualElement2.unmount();
}
if (externalRef) {
if (typeof externalRef === "function") {
externalRef(instance);
} else if (isRefObject(externalRef)) {
externalRef.current = instance;
}
}
}, [visualElement2]);
}
function isVariantLabels(v2) {
return Array.isArray(v2);
}
function isVariantLabel(v2) {
return typeof v2 === "string" || isVariantLabels(v2);
}
function getCurrent(visualElement2) {
var current = {};
visualElement2.forEachValue(function(value, key) {
return current[key] = value.get();
});
return current;
}
function getVelocity$1(visualElement2) {
var velocity = {};
visualElement2.forEachValue(function(value, key) {
return velocity[key] = value.getVelocity();
});
return velocity;
}
function resolveVariantFromProps(props2, definition, custom, currentValues, currentVelocity) {
var _a;
if (currentValues === void 0) {
currentValues = {};
}
if (currentVelocity === void 0) {
currentVelocity = {};
}
if (typeof definition === "function") {
definition = definition(custom !== null && custom !== void 0 ? custom : props2.custom, currentValues, currentVelocity);
}
if (typeof definition === "string") {
definition = (_a = props2.variants) === null || _a === void 0 ? void 0 : _a[definition];
}
if (typeof definition === "function") {
definition = definition(custom !== null && custom !== void 0 ? custom : props2.custom, currentValues, currentVelocity);
}
return definition;
}
function resolveVariant(visualElement2, definition, custom) {
var props2 = visualElement2.getProps();
return resolveVariantFromProps(props2, definition, custom !== null && custom !== void 0 ? custom : props2.custom, getCurrent(visualElement2), getVelocity$1(visualElement2));
}
function checkIfControllingVariants(props2) {
var _a;
return typeof ((_a = props2.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" || isVariantLabel(props2.initial) || isVariantLabel(props2.animate) || isVariantLabel(props2.whileHover) || isVariantLabel(props2.whileDrag) || isVariantLabel(props2.whileTap) || isVariantLabel(props2.whileFocus) || isVariantLabel(props2.exit);
}
function checkIfVariantNode(props2) {
return Boolean(checkIfControllingVariants(props2) || props2.variants);
}
function getCurrentTreeVariants(props2, context) {
if (checkIfControllingVariants(props2)) {
var initial = props2.initial, animate2 = props2.animate;
return {
initial: initial === false || isVariantLabel(initial) ? initial : void 0,
animate: isVariantLabel(animate2) ? animate2 : void 0
};
}
return props2.inherit !== false ? context : {};
}
function useCreateMotionContext(props2) {
var _a = getCurrentTreeVariants(props2, useContext(MotionContext)), initial = _a.initial, animate2 = _a.animate;
return useMemo$1(function() {
return { initial, animate: animate2 };
}, [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate2)]);
}
function variantLabelsAsDependency(prop) {
return Array.isArray(prop) ? prop.join(" ") : prop;
}
function useConstant(init) {
var ref = useRef(null);
if (ref.current === null) {
ref.current = init();
}
return ref.current;
}
const defaultTimestep = 1 / 60 * 1e3;
const getCurrentTime = typeof performance !== "undefined" ? () => performance.now() : () => Date.now();
const onNextFrame = typeof window !== "undefined" ? (callback) => window.requestAnimationFrame(callback) : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);
function createRenderStep(runNextFrame2) {
let toRun = [];
let toRunNextFrame = [];
let numToRun = 0;
let isProcessing2 = false;
let flushNextFrame = false;
const toKeepAlive = /* @__PURE__ */ new WeakSet();
const step = {
schedule: (callback, keepAlive = false, immediate2 = false) => {
const addToCurrentFrame = immediate2 && isProcessing2;
const buffer = addToCurrentFrame ? toRun : toRunNextFrame;
if (keepAlive)
toKeepAlive.add(callback);
if (buffer.indexOf(callback) === -1) {
buffer.push(callback);
if (addToCurrentFrame && isProcessing2)
numToRun = toRun.length;
}
return callback;
},
cancel: (callback) => {
const index = toRunNextFrame.indexOf(callback);
if (index !== -1)
toRunNextFrame.splice(index, 1);
toKeepAlive.delete(callback);
},
process: (frameData) => {
if (isProcessing2) {
flushNextFrame = true;
return;
}
isProcessing2 = true;
[toRun, toRunNextFrame] = [toRunNextFrame, toRun];
toRunNextFrame.length = 0;
numToRun = toRun.length;
if (numToRun) {
for (let i = 0; i < numToRun; i++) {
const callback = toRun[i];
callback(frameData);
if (toKeepAlive.has(callback)) {
step.schedule(callback);
runNextFrame2();
}
}
}
isProcessing2 = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData);
}
}
};
return step;
}
const maxElapsed = 40;
let useDefaultElapsed = true;
let runNextFrame = false;
let isProcessing = false;
const frame = {
delta: 0,
timestamp: 0
};
const stepsOrder = [
"read",
"update",
"preRender",
"render",
"postRender"
];
const steps = stepsOrder.reduce((acc, key) => {
acc[key] = createRenderStep(() => runNextFrame = true);
return acc;
}, {});
const sync = stepsOrder.reduce((acc, key) => {
const step = steps[key];
acc[key] = (process, keepAlive = false, immediate2 = false) => {
if (!runNextFrame)
startLoop();
return step.schedule(process, keepAlive, immediate2);
};
return acc;
}, {});
const cancelSync = stepsOrder.reduce((acc, key) => {
acc[key] = steps[key].cancel;
return acc;
}, {});
const flushSync = stepsOrder.reduce((acc, key) => {
acc[key] = () => steps[key].process(frame);
return acc;
}, {});
const processStep = (stepId) => steps[stepId].process(frame);
const processFrame = (timestamp) => {
runNextFrame = false;
frame.delta = useDefaultElapsed ? defaultTimestep : Math.max(Math.min(timestamp - frame.timestamp, maxElapsed), 1);
frame.timestamp = timestamp;
isProcessing = true;
stepsOrder.forEach(processStep);
isProcessing = false;
if (runNextFrame) {
useDefaultElapsed = false;
onNextFrame(processFrame);
}
};
const startLoop = () => {
runNextFrame = true;
useDefaultElapsed = true;
if (!isProcessing)
onNextFrame(processFrame);
};
const getFrameData = () => frame;
const clamp$1 = (min, max, v2) => Math.min(Math.max(v2, min), max);
const safeMin = 1e-3;
const minDuration = 0.01;
const maxDuration = 10;
const minDamping = 0.05;
const maxDamping = 1;
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1 }) {
let envelope;
let derivative;
warning(duration <= maxDuration * 1e3);
let dampingRatio = 1 - bounce;
dampingRatio = clamp$1(minDamping, maxDamping, dampingRatio);
duration = clamp$1(minDuration, maxDuration, duration / 1e3);
if (dampingRatio < 1) {
envelope = (undampedFreq2) => {
const exponentialDecay = undampedFreq2 * dampingRatio;
const delta = exponentialDecay * duration;
const a2 = exponentialDecay - velocity;
const b2 = calcAngularFreq(undampedFreq2, dampingRatio);
const c2 = Math.exp(-delta);
return safeMin - a2 / b2 * c2;
};
derivative = (undampedFreq2) => {
const exponentialDecay = undampedFreq2 * dampingRatio;
const delta = exponentialDecay * duration;
const d2 = delta * velocity + velocity;
const e2 = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration;
const f2 = Math.exp(-delta);
const g2 = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
return factor * ((d2 - e2) * f2) / g2;
};
} else {
envelope = (undampedFreq2) => {
const a2 = Math.exp(-undampedFreq2 * duration);
const b2 = (undampedFreq2 - velocity) * duration + 1;
return -safeMin + a2 * b2;
};
derivative = (undampedFreq2) => {
const a2 = Math.exp(-undampedFreq2 * duration);
const b2 = (velocity - undampedFreq2) * (duration * duration);
return a2 * b2;
};
}
const initialGuess = 5 / duration;
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
duration = duration * 1e3;
if (isNaN(undampedFreq)) {
return {
stiffness: 100,
damping: 10,
duration
};
} else {
const stiffness = Math.pow(undampedFreq, 2) * mass;
return {
stiffness,
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
duration
};
}
}
const rootIterations = 12;
function approximateRoot(envelope, derivative, initialGuess) {
let result = initialGuess;
for (let i = 1; i < rootIterations; i++) {
result = result - envelope(result) / derivative(result);
}
return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}
const durationKeys = ["duration", "bounce"];
const physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys) {
return keys.some((key) => options[key] !== void 0);
}
function getSpringOptions(options) {
let springOptions = Object.assign({ velocity: 0, stiffness: 100, damping: 10, mass: 1, isResolvedFromDuration: false }, options);
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
const derived = findSpring(options);
springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), { velocity: 0, mass: 1 });
springOptions.isResolvedFromDuration = true;
}
return springOptions;
}
function spring$4(_a) {
var { from = 0, to = 1, restSpeed = 2, restDelta } = _a, options = __rest$1(_a, ["from", "to", "restSpeed", "restDelta"]);
const state = { done: false, value: from };
let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration } = getSpringOptions(options);
let resolveSpring = zero;
let resolveVelocity = zero;
function createSpring() {
const initialVelocity = velocity ? -(velocity / 1e3) : 0;
const initialDelta = to - from;
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1e3;
if (restDelta === void 0) {
restDelta = Math.min(Math.abs(to - from) / 100, 0.4);
}
if (dampingRatio < 1) {
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
resolveSpring = (t2) => {
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t2) + initialDelta * Math.cos(angularFreq * t2));
};
resolveVelocity = (t2) => {
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
return dampingRatio * undampedAngularFreq * envelope * (Math.sin(angularFreq * t2) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq + initialDelta * Math.cos(angularFreq * t2)) - envelope * (Math.cos(angularFreq * t2) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) - angularFreq * initialDelta * Math.sin(angularFreq * t2));
};
} else if (dampingRatio === 1) {
resolveSpring = (t2) => to - Math.exp(-undampedAngularFreq * t2) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t2);
} else {
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
resolveSpring = (t2) => {
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
const freqForT = Math.min(dampedAngularFreq * t2, 300);
return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
};
}
}
createSpring();
return {
next: (t2) => {
const current = resolveSpring(t2);
if (!isResolvedFromDuration) {
const currentVelocity = resolveVelocity(t2) * 1e3;
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
} else {
state.done = t2 >= duration;
}
state.value = state.done ? to : current;
return sta