Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: components.js
[19000] Fix | Delete
[19001] Fix | Delete
class DOMKeyframesResolver extends KeyframeResolver {
[19002] Fix | Delete
constructor(unresolvedKeyframes, onComplete, name, motionValue) {
[19003] Fix | Delete
super(unresolvedKeyframes, onComplete, name, motionValue, motionValue === null || motionValue === void 0 ? void 0 : motionValue.owner, true);
[19004] Fix | Delete
}
[19005] Fix | Delete
readKeyframes() {
[19006] Fix | Delete
const { unresolvedKeyframes, element, name } = this;
[19007] Fix | Delete
if (!element.current)
[19008] Fix | Delete
return;
[19009] Fix | Delete
super.readKeyframes();
[19010] Fix | Delete
/**
[19011] Fix | Delete
* If any keyframe is a CSS variable, we need to find its value by sampling the element
[19012] Fix | Delete
*/
[19013] Fix | Delete
for (let i = 0; i < unresolvedKeyframes.length; i++) {
[19014] Fix | Delete
const keyframe = unresolvedKeyframes[i];
[19015] Fix | Delete
if (typeof keyframe === "string" && isCSSVariableToken(keyframe)) {
[19016] Fix | Delete
const resolved = getVariableValue(keyframe, element.current);
[19017] Fix | Delete
if (resolved !== undefined) {
[19018] Fix | Delete
unresolvedKeyframes[i] = resolved;
[19019] Fix | Delete
}
[19020] Fix | Delete
if (i === unresolvedKeyframes.length - 1) {
[19021] Fix | Delete
this.finalKeyframe = keyframe;
[19022] Fix | Delete
}
[19023] Fix | Delete
}
[19024] Fix | Delete
}
[19025] Fix | Delete
/**
[19026] Fix | Delete
* Resolve "none" values. We do this potentially twice - once before and once after measuring keyframes.
[19027] Fix | Delete
* This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which
[19028] Fix | Delete
* have a far bigger performance impact.
[19029] Fix | Delete
*/
[19030] Fix | Delete
this.resolveNoneKeyframes();
[19031] Fix | Delete
/**
[19032] Fix | Delete
* Check to see if unit type has changed. If so schedule jobs that will
[19033] Fix | Delete
* temporarily set styles to the destination keyframes.
[19034] Fix | Delete
* Skip if we have more than two keyframes or this isn't a positional value.
[19035] Fix | Delete
* TODO: We can throw if there are multiple keyframes and the value type changes.
[19036] Fix | Delete
*/
[19037] Fix | Delete
if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {
[19038] Fix | Delete
return;
[19039] Fix | Delete
}
[19040] Fix | Delete
const [origin, target] = unresolvedKeyframes;
[19041] Fix | Delete
const originType = findDimensionValueType(origin);
[19042] Fix | Delete
const targetType = findDimensionValueType(target);
[19043] Fix | Delete
/**
[19044] Fix | Delete
* Either we don't recognise these value types or we can animate between them.
[19045] Fix | Delete
*/
[19046] Fix | Delete
if (originType === targetType)
[19047] Fix | Delete
return;
[19048] Fix | Delete
/**
[19049] Fix | Delete
* If both values are numbers or pixels, we can animate between them by
[19050] Fix | Delete
* converting them to numbers.
[19051] Fix | Delete
*/
[19052] Fix | Delete
if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
[19053] Fix | Delete
for (let i = 0; i < unresolvedKeyframes.length; i++) {
[19054] Fix | Delete
const value = unresolvedKeyframes[i];
[19055] Fix | Delete
if (typeof value === "string") {
[19056] Fix | Delete
unresolvedKeyframes[i] = parseFloat(value);
[19057] Fix | Delete
}
[19058] Fix | Delete
}
[19059] Fix | Delete
}
[19060] Fix | Delete
else {
[19061] Fix | Delete
/**
[19062] Fix | Delete
* Else, the only way to resolve this is by measuring the element.
[19063] Fix | Delete
*/
[19064] Fix | Delete
this.needsMeasurement = true;
[19065] Fix | Delete
}
[19066] Fix | Delete
}
[19067] Fix | Delete
resolveNoneKeyframes() {
[19068] Fix | Delete
const { unresolvedKeyframes, name } = this;
[19069] Fix | Delete
const noneKeyframeIndexes = [];
[19070] Fix | Delete
for (let i = 0; i < unresolvedKeyframes.length; i++) {
[19071] Fix | Delete
if (isNone(unresolvedKeyframes[i])) {
[19072] Fix | Delete
noneKeyframeIndexes.push(i);
[19073] Fix | Delete
}
[19074] Fix | Delete
}
[19075] Fix | Delete
if (noneKeyframeIndexes.length) {
[19076] Fix | Delete
makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);
[19077] Fix | Delete
}
[19078] Fix | Delete
}
[19079] Fix | Delete
measureInitialState() {
[19080] Fix | Delete
const { element, unresolvedKeyframes, name } = this;
[19081] Fix | Delete
if (!element.current)
[19082] Fix | Delete
return;
[19083] Fix | Delete
if (name === "height") {
[19084] Fix | Delete
this.suspendedScrollY = window.pageYOffset;
[19085] Fix | Delete
}
[19086] Fix | Delete
this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
[19087] Fix | Delete
unresolvedKeyframes[0] = this.measuredOrigin;
[19088] Fix | Delete
// Set final key frame to measure after next render
[19089] Fix | Delete
const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
[19090] Fix | Delete
if (measureKeyframe !== undefined) {
[19091] Fix | Delete
element.getValue(name, measureKeyframe).jump(measureKeyframe, false);
[19092] Fix | Delete
}
[19093] Fix | Delete
}
[19094] Fix | Delete
measureEndState() {
[19095] Fix | Delete
var _a;
[19096] Fix | Delete
const { element, name, unresolvedKeyframes } = this;
[19097] Fix | Delete
if (!element.current)
[19098] Fix | Delete
return;
[19099] Fix | Delete
const value = element.getValue(name);
[19100] Fix | Delete
value && value.jump(this.measuredOrigin, false);
[19101] Fix | Delete
const finalKeyframeIndex = unresolvedKeyframes.length - 1;
[19102] Fix | Delete
const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
[19103] Fix | Delete
unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
[19104] Fix | Delete
if (finalKeyframe !== null && this.finalKeyframe === undefined) {
[19105] Fix | Delete
this.finalKeyframe = finalKeyframe;
[19106] Fix | Delete
}
[19107] Fix | Delete
// If we removed transform values, reapply them before the next render
[19108] Fix | Delete
if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
[19109] Fix | Delete
this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
[19110] Fix | Delete
element
[19111] Fix | Delete
.getValue(unsetTransformName)
[19112] Fix | Delete
.set(unsetTransformValue);
[19113] Fix | Delete
});
[19114] Fix | Delete
}
[19115] Fix | Delete
this.resolveNoneKeyframes();
[19116] Fix | Delete
}
[19117] Fix | Delete
}
[19118] Fix | Delete
[19119] Fix | Delete
[19120] Fix | Delete
[19121] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/memo.mjs
[19122] Fix | Delete
function memo(callback) {
[19123] Fix | Delete
let result;
[19124] Fix | Delete
return () => {
[19125] Fix | Delete
if (result === undefined)
[19126] Fix | Delete
result = callback();
[19127] Fix | Delete
return result;
[19128] Fix | Delete
};
[19129] Fix | Delete
}
[19130] Fix | Delete
[19131] Fix | Delete
[19132] Fix | Delete
[19133] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs
[19134] Fix | Delete
[19135] Fix | Delete
[19136] Fix | Delete
/**
[19137] Fix | Delete
* Check if a value is animatable. Examples:
[19138] Fix | Delete
*
[19139] Fix | Delete
* ✅: 100, "100px", "#fff"
[19140] Fix | Delete
* ❌: "block", "url(2.jpg)"
[19141] Fix | Delete
* @param value
[19142] Fix | Delete
*
[19143] Fix | Delete
* @internal
[19144] Fix | Delete
*/
[19145] Fix | Delete
const isAnimatable = (value, name) => {
[19146] Fix | Delete
// If the list of keys tat might be non-animatable grows, replace with Set
[19147] Fix | Delete
if (name === "zIndex")
[19148] Fix | Delete
return false;
[19149] Fix | Delete
// If it's a number or a keyframes array, we can animate it. We might at some point
[19150] Fix | Delete
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
[19151] Fix | Delete
// but for now lets leave it like this for performance reasons
[19152] Fix | Delete
if (typeof value === "number" || Array.isArray(value))
[19153] Fix | Delete
return true;
[19154] Fix | Delete
if (typeof value === "string" && // It's animatable if we have a string
[19155] Fix | Delete
(complex.test(value) || value === "0") && // And it contains numbers and/or colors
[19156] Fix | Delete
!value.startsWith("url(") // Unless it starts with "url("
[19157] Fix | Delete
) {
[19158] Fix | Delete
return true;
[19159] Fix | Delete
}
[19160] Fix | Delete
return false;
[19161] Fix | Delete
};
[19162] Fix | Delete
[19163] Fix | Delete
[19164] Fix | Delete
[19165] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/utils/can-animate.mjs
[19166] Fix | Delete
[19167] Fix | Delete
[19168] Fix | Delete
[19169] Fix | Delete
function hasKeyframesChanged(keyframes) {
[19170] Fix | Delete
const current = keyframes[0];
[19171] Fix | Delete
if (keyframes.length === 1)
[19172] Fix | Delete
return true;
[19173] Fix | Delete
for (let i = 0; i < keyframes.length; i++) {
[19174] Fix | Delete
if (keyframes[i] !== current)
[19175] Fix | Delete
return true;
[19176] Fix | Delete
}
[19177] Fix | Delete
}
[19178] Fix | Delete
function canAnimate(keyframes, name, type, velocity) {
[19179] Fix | Delete
/**
[19180] Fix | Delete
* Check if we're able to animate between the start and end keyframes,
[19181] Fix | Delete
* and throw a warning if we're attempting to animate between one that's
[19182] Fix | Delete
* animatable and another that isn't.
[19183] Fix | Delete
*/
[19184] Fix | Delete
const originKeyframe = keyframes[0];
[19185] Fix | Delete
if (originKeyframe === null)
[19186] Fix | Delete
return false;
[19187] Fix | Delete
/**
[19188] Fix | Delete
* These aren't traditionally animatable but we do support them.
[19189] Fix | Delete
* In future we could look into making this more generic or replacing
[19190] Fix | Delete
* this function with mix() === mixImmediate
[19191] Fix | Delete
*/
[19192] Fix | Delete
if (name === "display" || name === "visibility")
[19193] Fix | Delete
return true;
[19194] Fix | Delete
const targetKeyframe = keyframes[keyframes.length - 1];
[19195] Fix | Delete
const isOriginAnimatable = isAnimatable(originKeyframe, name);
[19196] Fix | Delete
const isTargetAnimatable = isAnimatable(targetKeyframe, name);
[19197] Fix | Delete
warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
[19198] Fix | Delete
// Always skip if any of these are true
[19199] Fix | Delete
if (!isOriginAnimatable || !isTargetAnimatable) {
[19200] Fix | Delete
return false;
[19201] Fix | Delete
}
[19202] Fix | Delete
return hasKeyframesChanged(keyframes) || (type === "spring" && velocity);
[19203] Fix | Delete
}
[19204] Fix | Delete
[19205] Fix | Delete
[19206] Fix | Delete
[19207] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/BaseAnimation.mjs
[19208] Fix | Delete
[19209] Fix | Delete
[19210] Fix | Delete
[19211] Fix | Delete
[19212] Fix | Delete
[19213] Fix | Delete
class BaseAnimation {
[19214] Fix | Delete
constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
[19215] Fix | Delete
// Track whether the animation has been stopped. Stopped animations won't restart.
[19216] Fix | Delete
this.isStopped = false;
[19217] Fix | Delete
this.hasAttemptedResolve = false;
[19218] Fix | Delete
this.options = {
[19219] Fix | Delete
autoplay,
[19220] Fix | Delete
delay,
[19221] Fix | Delete
type,
[19222] Fix | Delete
repeat,
[19223] Fix | Delete
repeatDelay,
[19224] Fix | Delete
repeatType,
[19225] Fix | Delete
...options,
[19226] Fix | Delete
};
[19227] Fix | Delete
this.updateFinishedPromise();
[19228] Fix | Delete
}
[19229] Fix | Delete
/**
[19230] Fix | Delete
* A getter for resolved data. If keyframes are not yet resolved, accessing
[19231] Fix | Delete
* this.resolved will synchronously flush all pending keyframe resolvers.
[19232] Fix | Delete
* This is a deoptimisation, but at its worst still batches read/writes.
[19233] Fix | Delete
*/
[19234] Fix | Delete
get resolved() {
[19235] Fix | Delete
if (!this._resolved && !this.hasAttemptedResolve) {
[19236] Fix | Delete
flushKeyframeResolvers();
[19237] Fix | Delete
}
[19238] Fix | Delete
return this._resolved;
[19239] Fix | Delete
}
[19240] Fix | Delete
/**
[19241] Fix | Delete
* A method to be called when the keyframes resolver completes. This method
[19242] Fix | Delete
* will check if its possible to run the animation and, if not, skip it.
[19243] Fix | Delete
* Otherwise, it will call initPlayback on the implementing class.
[19244] Fix | Delete
*/
[19245] Fix | Delete
onKeyframesResolved(keyframes, finalKeyframe) {
[19246] Fix | Delete
this.hasAttemptedResolve = true;
[19247] Fix | Delete
const { name, type, velocity, delay, onComplete, onUpdate, isGenerator, } = this.options;
[19248] Fix | Delete
/**
[19249] Fix | Delete
* If we can't animate this value with the resolved keyframes
[19250] Fix | Delete
* then we should complete it immediately.
[19251] Fix | Delete
*/
[19252] Fix | Delete
if (!isGenerator && !canAnimate(keyframes, name, type, velocity)) {
[19253] Fix | Delete
// Finish immediately
[19254] Fix | Delete
if (instantAnimationState.current || !delay) {
[19255] Fix | Delete
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes, this.options, finalKeyframe));
[19256] Fix | Delete
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
[19257] Fix | Delete
this.resolveFinishedPromise();
[19258] Fix | Delete
return;
[19259] Fix | Delete
}
[19260] Fix | Delete
// Finish after a delay
[19261] Fix | Delete
else {
[19262] Fix | Delete
this.options.duration = 0;
[19263] Fix | Delete
}
[19264] Fix | Delete
}
[19265] Fix | Delete
const resolvedAnimation = this.initPlayback(keyframes, finalKeyframe);
[19266] Fix | Delete
if (resolvedAnimation === false)
[19267] Fix | Delete
return;
[19268] Fix | Delete
this._resolved = {
[19269] Fix | Delete
keyframes,
[19270] Fix | Delete
finalKeyframe,
[19271] Fix | Delete
...resolvedAnimation,
[19272] Fix | Delete
};
[19273] Fix | Delete
this.onPostResolved();
[19274] Fix | Delete
}
[19275] Fix | Delete
onPostResolved() { }
[19276] Fix | Delete
/**
[19277] Fix | Delete
* Allows the returned animation to be awaited or promise-chained. Currently
[19278] Fix | Delete
* resolves when the animation finishes at all but in a future update could/should
[19279] Fix | Delete
* reject if its cancels.
[19280] Fix | Delete
*/
[19281] Fix | Delete
then(resolve, reject) {
[19282] Fix | Delete
return this.currentFinishedPromise.then(resolve, reject);
[19283] Fix | Delete
}
[19284] Fix | Delete
updateFinishedPromise() {
[19285] Fix | Delete
this.currentFinishedPromise = new Promise((resolve) => {
[19286] Fix | Delete
this.resolveFinishedPromise = resolve;
[19287] Fix | Delete
});
[19288] Fix | Delete
}
[19289] Fix | Delete
}
[19290] Fix | Delete
[19291] Fix | Delete
[19292] Fix | Delete
[19293] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/velocity-per-second.mjs
[19294] Fix | Delete
/*
[19295] Fix | Delete
Convert velocity into velocity per second
[19296] Fix | Delete
[19297] Fix | Delete
@param [number]: Unit per frame
[19298] Fix | Delete
@param [number]: Frame duration in ms
[19299] Fix | Delete
*/
[19300] Fix | Delete
function velocityPerSecond(velocity, frameDuration) {
[19301] Fix | Delete
return frameDuration ? velocity * (1000 / frameDuration) : 0;
[19302] Fix | Delete
}
[19303] Fix | Delete
[19304] Fix | Delete
[19305] Fix | Delete
[19306] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/utils/velocity.mjs
[19307] Fix | Delete
[19308] Fix | Delete
[19309] Fix | Delete
const velocitySampleDuration = 5; // ms
[19310] Fix | Delete
function calcGeneratorVelocity(resolveValue, t, current) {
[19311] Fix | Delete
const prevT = Math.max(t - velocitySampleDuration, 0);
[19312] Fix | Delete
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
[19313] Fix | Delete
}
[19314] Fix | Delete
[19315] Fix | Delete
[19316] Fix | Delete
[19317] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/spring/find.mjs
[19318] Fix | Delete
[19319] Fix | Delete
[19320] Fix | Delete
[19321] Fix | Delete
[19322] Fix | Delete
const safeMin = 0.001;
[19323] Fix | Delete
const minDuration = 0.01;
[19324] Fix | Delete
const maxDuration = 10.0;
[19325] Fix | Delete
const minDamping = 0.05;
[19326] Fix | Delete
const maxDamping = 1;
[19327] Fix | Delete
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
[19328] Fix | Delete
let envelope;
[19329] Fix | Delete
let derivative;
[19330] Fix | Delete
warning(duration <= secondsToMilliseconds(maxDuration), "Spring duration must be 10 seconds or less");
[19331] Fix | Delete
let dampingRatio = 1 - bounce;
[19332] Fix | Delete
/**
[19333] Fix | Delete
* Restrict dampingRatio and duration to within acceptable ranges.
[19334] Fix | Delete
*/
[19335] Fix | Delete
dampingRatio = clamp_clamp(minDamping, maxDamping, dampingRatio);
[19336] Fix | Delete
duration = clamp_clamp(minDuration, maxDuration, millisecondsToSeconds(duration));
[19337] Fix | Delete
if (dampingRatio < 1) {
[19338] Fix | Delete
/**
[19339] Fix | Delete
* Underdamped spring
[19340] Fix | Delete
*/
[19341] Fix | Delete
envelope = (undampedFreq) => {
[19342] Fix | Delete
const exponentialDecay = undampedFreq * dampingRatio;
[19343] Fix | Delete
const delta = exponentialDecay * duration;
[19344] Fix | Delete
const a = exponentialDecay - velocity;
[19345] Fix | Delete
const b = calcAngularFreq(undampedFreq, dampingRatio);
[19346] Fix | Delete
const c = Math.exp(-delta);
[19347] Fix | Delete
return safeMin - (a / b) * c;
[19348] Fix | Delete
};
[19349] Fix | Delete
derivative = (undampedFreq) => {
[19350] Fix | Delete
const exponentialDecay = undampedFreq * dampingRatio;
[19351] Fix | Delete
const delta = exponentialDecay * duration;
[19352] Fix | Delete
const d = delta * velocity + velocity;
[19353] Fix | Delete
const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
[19354] Fix | Delete
const f = Math.exp(-delta);
[19355] Fix | Delete
const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
[19356] Fix | Delete
const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
[19357] Fix | Delete
return (factor * ((d - e) * f)) / g;
[19358] Fix | Delete
};
[19359] Fix | Delete
}
[19360] Fix | Delete
else {
[19361] Fix | Delete
/**
[19362] Fix | Delete
* Critically-damped spring
[19363] Fix | Delete
*/
[19364] Fix | Delete
envelope = (undampedFreq) => {
[19365] Fix | Delete
const a = Math.exp(-undampedFreq * duration);
[19366] Fix | Delete
const b = (undampedFreq - velocity) * duration + 1;
[19367] Fix | Delete
return -safeMin + a * b;
[19368] Fix | Delete
};
[19369] Fix | Delete
derivative = (undampedFreq) => {
[19370] Fix | Delete
const a = Math.exp(-undampedFreq * duration);
[19371] Fix | Delete
const b = (velocity - undampedFreq) * (duration * duration);
[19372] Fix | Delete
return a * b;
[19373] Fix | Delete
};
[19374] Fix | Delete
}
[19375] Fix | Delete
const initialGuess = 5 / duration;
[19376] Fix | Delete
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
[19377] Fix | Delete
duration = secondsToMilliseconds(duration);
[19378] Fix | Delete
if (isNaN(undampedFreq)) {
[19379] Fix | Delete
return {
[19380] Fix | Delete
stiffness: 100,
[19381] Fix | Delete
damping: 10,
[19382] Fix | Delete
duration,
[19383] Fix | Delete
};
[19384] Fix | Delete
}
[19385] Fix | Delete
else {
[19386] Fix | Delete
const stiffness = Math.pow(undampedFreq, 2) * mass;
[19387] Fix | Delete
return {
[19388] Fix | Delete
stiffness,
[19389] Fix | Delete
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
[19390] Fix | Delete
duration,
[19391] Fix | Delete
};
[19392] Fix | Delete
}
[19393] Fix | Delete
}
[19394] Fix | Delete
const rootIterations = 12;
[19395] Fix | Delete
function approximateRoot(envelope, derivative, initialGuess) {
[19396] Fix | Delete
let result = initialGuess;
[19397] Fix | Delete
for (let i = 1; i < rootIterations; i++) {
[19398] Fix | Delete
result = result - envelope(result) / derivative(result);
[19399] Fix | Delete
}
[19400] Fix | Delete
return result;
[19401] Fix | Delete
}
[19402] Fix | Delete
function calcAngularFreq(undampedFreq, dampingRatio) {
[19403] Fix | Delete
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
[19404] Fix | Delete
}
[19405] Fix | Delete
[19406] Fix | Delete
[19407] Fix | Delete
[19408] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/spring/index.mjs
[19409] Fix | Delete
[19410] Fix | Delete
[19411] Fix | Delete
[19412] Fix | Delete
[19413] Fix | Delete
const durationKeys = ["duration", "bounce"];
[19414] Fix | Delete
const physicsKeys = ["stiffness", "damping", "mass"];
[19415] Fix | Delete
function isSpringType(options, keys) {
[19416] Fix | Delete
return keys.some((key) => options[key] !== undefined);
[19417] Fix | Delete
}
[19418] Fix | Delete
function getSpringOptions(options) {
[19419] Fix | Delete
let springOptions = {
[19420] Fix | Delete
velocity: 0.0,
[19421] Fix | Delete
stiffness: 100,
[19422] Fix | Delete
damping: 10,
[19423] Fix | Delete
mass: 1.0,
[19424] Fix | Delete
isResolvedFromDuration: false,
[19425] Fix | Delete
...options,
[19426] Fix | Delete
};
[19427] Fix | Delete
// stiffness/damping/mass overrides duration/bounce
[19428] Fix | Delete
if (!isSpringType(options, physicsKeys) &&
[19429] Fix | Delete
isSpringType(options, durationKeys)) {
[19430] Fix | Delete
const derived = findSpring(options);
[19431] Fix | Delete
springOptions = {
[19432] Fix | Delete
...springOptions,
[19433] Fix | Delete
...derived,
[19434] Fix | Delete
mass: 1.0,
[19435] Fix | Delete
};
[19436] Fix | Delete
springOptions.isResolvedFromDuration = true;
[19437] Fix | Delete
}
[19438] Fix | Delete
return springOptions;
[19439] Fix | Delete
}
[19440] Fix | Delete
function spring({ keyframes, restDelta, restSpeed, ...options }) {
[19441] Fix | Delete
const origin = keyframes[0];
[19442] Fix | Delete
const target = keyframes[keyframes.length - 1];
[19443] Fix | Delete
/**
[19444] Fix | Delete
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
[19445] Fix | Delete
* to reduce GC during animation.
[19446] Fix | Delete
*/
[19447] Fix | Delete
const state = { done: false, value: origin };
[19448] Fix | Delete
const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({
[19449] Fix | Delete
...options,
[19450] Fix | Delete
velocity: -millisecondsToSeconds(options.velocity || 0),
[19451] Fix | Delete
});
[19452] Fix | Delete
const initialVelocity = velocity || 0.0;
[19453] Fix | Delete
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
[19454] Fix | Delete
const initialDelta = target - origin;
[19455] Fix | Delete
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
[19456] Fix | Delete
/**
[19457] Fix | Delete
* If we're working on a granular scale, use smaller defaults for determining
[19458] Fix | Delete
* when the spring is finished.
[19459] Fix | Delete
*
[19460] Fix | Delete
* These defaults have been selected emprically based on what strikes a good
[19461] Fix | Delete
* ratio between feeling good and finishing as soon as changes are imperceptible.
[19462] Fix | Delete
*/
[19463] Fix | Delete
const isGranularScale = Math.abs(initialDelta) < 5;
[19464] Fix | Delete
restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
[19465] Fix | Delete
restDelta || (restDelta = isGranularScale ? 0.005 : 0.5);
[19466] Fix | Delete
let resolveSpring;
[19467] Fix | Delete
if (dampingRatio < 1) {
[19468] Fix | Delete
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
[19469] Fix | Delete
// Underdamped spring
[19470] Fix | Delete
resolveSpring = (t) => {
[19471] Fix | Delete
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
[19472] Fix | Delete
return (target -
[19473] Fix | Delete
envelope *
[19474] Fix | Delete
(((initialVelocity +
[19475] Fix | Delete
dampingRatio * undampedAngularFreq * initialDelta) /
[19476] Fix | Delete
angularFreq) *
[19477] Fix | Delete
Math.sin(angularFreq * t) +
[19478] Fix | Delete
initialDelta * Math.cos(angularFreq * t)));
[19479] Fix | Delete
};
[19480] Fix | Delete
}
[19481] Fix | Delete
else if (dampingRatio === 1) {
[19482] Fix | Delete
// Critically damped spring
[19483] Fix | Delete
resolveSpring = (t) => target -
[19484] Fix | Delete
Math.exp(-undampedAngularFreq * t) *
[19485] Fix | Delete
(initialDelta +
[19486] Fix | Delete
(initialVelocity + undampedAngularFreq * initialDelta) * t);
[19487] Fix | Delete
}
[19488] Fix | Delete
else {
[19489] Fix | Delete
// Overdamped spring
[19490] Fix | Delete
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
[19491] Fix | Delete
resolveSpring = (t) => {
[19492] Fix | Delete
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
[19493] Fix | Delete
// When performing sinh or cosh values can hit Infinity so we cap them here
[19494] Fix | Delete
const freqForT = Math.min(dampedAngularFreq * t, 300);
[19495] Fix | Delete
return (target -
[19496] Fix | Delete
(envelope *
[19497] Fix | Delete
((initialVelocity +
[19498] Fix | Delete
dampingRatio * undampedAngularFreq * initialDelta) *
[19499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function