Files
discord-decomp/_bundle/Module1659.js
T
2026-11-01 12:12:55 +02:00

253 lines
9.7 KiB
JavaScript

// Metro module 1659 (f1660).
import * as _Module1617 from "./Module1617";
let A, B, C, calcBezier, getSlope, binarySubdivide, newtonRaphsonIterate, __initData, __initData2, __initData3;
const NEWTON_MIN_SLOPE = 0.001;
const kSampleStepSize = 0.1;
const r11 = function A(a0, a1) {
return 1 - 3 * a1 + 3 * a0;
};
r11.__closure = {};
r11.__workletHash = 6646411187233;
r11.__initData = {
code: "function A_Pnpm_BezierTs1(aA1,aA2){return 1.0-3.0*aA2+3.0*aA1;}"
};
A = r11;
const r18 = function B(a0, a1) {
return 3 * a1 - 6 * a0;
};
r18.__closure = {};
r18.__workletHash = 4657056619296;
r18.__initData = {
code: "function B_Pnpm_BezierTs2(aA1,aA2){return 3.0*aA2-6.0*aA1;}"
};
B = r18;
const r22 = function C(a0) {
return 3 * a0;
};
r22.__closure = {};
r22.__workletHash = 10558087844899;
r22.__initData = {
code: "function C_Pnpm_BezierTs3(aA1){return 3.0*aA1;}"
};
C = r22;
const calcBezier2 = function calcBezier(a0, a1, a2) {
return (((1 - 3 * a2 + 3 * a1) * a0 + (3 * a2 - 6 * a1)) * a0 + 3 * a1) * a0;
};
calcBezier2.__closure = {
A,
B,
C
};
calcBezier2.__workletHash = 6436686649451;
calcBezier2.__initData = {
code: "function calcBezier_Pnpm_BezierTs4(aT,aA1,aA2){const{A,B,C}=this.__closure;return((A(aA1,aA2)*aT+B(aA1,aA2))*aT+C(aA1))*aT;}"
};
calcBezier = calcBezier2;
const getSlope2 = function getSlope(a0, a1, a2) {
return 3 * (1 - 3 * a2 + 3 * a1) * a0 * a0 + 2 * (3 * a2 - 6 * a1) * a0 + 3 * a1;
};
getSlope2.__closure = {
A,
B,
C
};
getSlope2.__workletHash = 7144143660854;
getSlope2.__initData = {
code: "function getSlope_Pnpm_BezierTs5(aT,aA1,aA2){const{A,B,C}=this.__closure;return 3.0*A(aA1,aA2)*aT*aT+2.0*B(aA1,aA2)*aT+C(aA1);}"
};
getSlope = getSlope2;
const binarySubdivide2 = function binarySubdivide(a0, r18, r17, a3, a4) {
let r2 = 0;
while (true) {
const r26 = r18 + (r17 - r18) / 2;
const r27 = r2;
let r22 = r17;
const r23 = r18;
const r47 = (((1 - 3 * a4 + 3 * a3) * r26 + (3 * a4 - 6 * a3)) * r26 + 3 * a3) * r26 - a0;
let r48 = r26;
if (0 < r47) {
r22 = r26;
r48 = r23;
}
if (Math.abs(r47) > 1e-7) {
r2 = r27 + 1;
r17 = r22;
r18 = r48;
if (r2 < 10) {
continue;
}
}
return r26;
}
};
binarySubdivide2.__closure = {
calcBezier,
SUBDIVISION_PRECISION: 1e-7,
SUBDIVISION_MAX_ITERATIONS: 10
};
binarySubdivide2.__workletHash = 16502327865282;
binarySubdivide2.__initData = {
code: "function binarySubdivide_Pnpm_BezierTs6(aX,aA,aB,mX1,mX2){const{calcBezier,SUBDIVISION_PRECISION,SUBDIVISION_MAX_ITERATIONS}=this.__closure;let currentX;let currentT;let i=0;do{currentT=aA+(aB-aA)/2.0;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0.0){aB=currentT;}else{aA=currentT;}}while(Math.abs(currentX)>SUBDIVISION_PRECISION&&++i<SUBDIVISION_MAX_ITERATIONS);return currentT;}"
};
binarySubdivide = binarySubdivide2;
const newtonRaphsonIterate2 = function newtonRaphsonIterate(a0, r15, a2, a3) {
let r4 = 0;
while (true) {
const r8 = r4;
const r12 = r15;
const r41 = 3 * (1 - 3 * a3 + 3 * a2) * r12 * r12 + 2 * (3 * a3 - 6 * a2) * r12 + 3 * a2;
if (r41 === 0) {
return r12;
}
const r65 = r12 - ((((1 - 3 * a3 + 3 * a2) * r12 + (3 * a3 - 6 * a2)) * r12 + 3 * a2) * r12 - a0) / r41;
r4 = r8 + 1;
r15 = r65;
if (!(r4 < 4)) {
return r65;
}
}
};
newtonRaphsonIterate2.__closure = {
NEWTON_ITERATIONS: 4,
getSlope,
calcBezier
};
newtonRaphsonIterate2.__workletHash = 13998382484908;
newtonRaphsonIterate2.__initData = {
code: "function newtonRaphsonIterate_Pnpm_BezierTs7(aX,aGuessT,mX1,mX2){const{NEWTON_ITERATIONS,getSlope,calcBezier}=this.__closure;for(let i=0;i<NEWTON_ITERATIONS;++i){const currentSlope=getSlope(aGuessT,mX1,mX2);if(currentSlope===0.0){return aGuessT;}const currentX=calcBezier(aGuessT,mX1,mX2)-aX;aGuessT-=currentX/currentSlope;}return aGuessT;}"
};
newtonRaphsonIterate = newtonRaphsonIterate2;
__initData = {
code: "function LinearEasing_Pnpm_BezierTs9(x){return x;}"
};
__initData2 = {
code: "function getTForX_Pnpm_BezierTs10(aX){const{kSplineTableSize,sampleValues,kSampleStepSize,getSlope,mX1,mX2,NEWTON_MIN_SLOPE,newtonRaphsonIterate,binarySubdivide}=this.__closure;let intervalStart=0.0;let currentSample=1;const lastSample=kSplineTableSize-1;for(;currentSample!==lastSample&&sampleValues[currentSample]<=aX;++currentSample){intervalStart+=kSampleStepSize;}--currentSample;const dist=(aX-sampleValues[currentSample])/(sampleValues[currentSample+1]-sampleValues[currentSample]);const guessForT=intervalStart+dist*kSampleStepSize;const initialSlope=getSlope(guessForT,mX1,mX2);if(initialSlope>=NEWTON_MIN_SLOPE){return newtonRaphsonIterate(aX,guessForT,mX1,mX2);}else if(initialSlope===0.0){return guessForT;}else{return binarySubdivide(aX,intervalStart,intervalStart+kSampleStepSize,mX1,mX2);}}"
};
__initData3 = {
code: "function BezierEasing_Pnpm_BezierTs11(x){const{mX1,mY1,mX2,mY2,calcBezier,getTForX}=this.__closure;if(mX1===mY1&&mX2===mY2){return x;}if(x===0){return 0;}if(x===1){return 1;}return calcBezier(getTForX(x),mY1,mY2);}"
};
export function Bezier(a0, a1, a2, a3) {
let c24537_4, getTForX2;
let c24537_0 = a0;
const LinearEasing = function LinearEasing(a0) {
return a0;
};
LinearEasing.__closure = {};
LinearEasing.__workletHash = 17109055856391;
LinearEasing.__initData = __initData;
if (a0 >= 0 && a0 <= 1 && a2 >= 0 && a2 <= 1) {
if (a0 === a1 && a2 === a3) {
return LinearEasing;
}
const array = new Array(11);
c24537_4 = array;
let r39 = 0;
while (true) {
const r5 = r39;
const r1 = 3 * a2;
const r7 = 3 * a0;
const r8 = 3 * a2;
const r0 = 6 * a0;
const r4 = r5 * kSampleStepSize;
array[r5] = (((1 - r1 + r7) * r4 + (r8 - r0)) * r4 + 3 * a0) * r4;
r39 = r5 + 1;
if (!(r39 < 11)) {
const getTForX = function getTForX(a0) {
let r26;
const r9 = c24537_4[1] <= a0;
let r1 = 1;
let r0 = 0;
let r3 = 1;
let r5 = 0;
if (r9) {
do {
const r4 = r0 + kSampleStepSize;
const r2 = r1 + 1;
r3 = r2;
r5 = r4;
if (r2 === 10) {
break;
}
r26 = c24537_4[r2];
r1 = r2;
r0 = r4;
r3 = r1;
r5 = r0;
} while (r26 <= a0);
}
const r27 = r3 - 1;
const r35 = (a0 - c24537_4[r27]) / (c24537_4[r27 + 1] - c24537_4[r27]) * kSampleStepSize;
const r44 = 3 * a2;
const r45 = 3 * c24537_0;
const r49 = 3 * a2;
const r51 = 6 * c24537_0;
const r55 = r5 + r35;
const r67 = 3 * (1 - r44 + r45) * r55 * r55 + 2 * (r49 - r51) * r55 + 3 * c24537_0;
return r67 >= NEWTON_MIN_SLOPE ? newtonRaphsonIterate(a0, r55, c24537_0, a2) : r67 !== 0 ? binarySubdivide(a0, r5, r5 + kSampleStepSize, c24537_0, a2) : r55;
};
getTForX.__closure = {
kSplineTableSize: 11,
sampleValues: array,
kSampleStepSize,
getSlope,
mX1: a0,
mX2: a2,
NEWTON_MIN_SLOPE,
newtonRaphsonIterate,
binarySubdivide
};
getTForX.__workletHash = 8576728300710;
getTForX.__initData = __initData2;
getTForX2 = getTForX;
const r70 = function(a0) {
let r15;
L15: {
if (c24537_0 === a1) {
r15 = a0;
if (a2 === a3) {
break L15;
}
}
let r2 = 0;
if (a0 !== 0) {
let r3 = 1;
if (a0 !== 1) {
const tForX2 = getTForX2(a0);
r3 = (((1 - 3 * a3 + 3 * a1) * tForX2 + (3 * a3 - 6 * a1)) * tForX2 + 3 * a1) * tForX2;
}
r2 = r3;
}
r15 = r2;
}
return r15;
};
r70.__closure = {
mX1: a0,
mY1: a1,
mX2: a2,
mY2: a3,
calcBezier,
getTForX: getTForX2
};
r70.__workletHash = 4633198201234;
r70.__initData = __initData3;
return r70;
}
}
}
throw new _Module1617.ReanimatedError("Bezier x values must be in [0, 1] range.");
}
Bezier.__closure = {
kSplineTableSize: 11,
calcBezier,
kSampleStepSize: 0.1,
getSlope,
NEWTON_MIN_SLOPE: 0.001,
newtonRaphsonIterate,
binarySubdivide
};
Bezier.__workletHash = 1707642440340;
Bezier.__initData = {
code: "function Bezier_Pnpm_BezierTs8(mX1,mY1,mX2,mY2){const{kSplineTableSize,calcBezier,kSampleStepSize,getSlope,NEWTON_MIN_SLOPE,newtonRaphsonIterate,binarySubdivide}=this.__closure;function LinearEasing(x){'worklet';return x;}if(!(mX1>=0&&mX1<=1&&mX2>=0&&mX2<=1)){throw new ReanimatedError('Bezier x values must be in [0, 1] range.');}if(mX1===mY1&&mX2===mY2){return LinearEasing;}const sampleValues=new Array(kSplineTableSize);for(let i=0;i<kSplineTableSize;++i){sampleValues[i]=calcBezier(i*kSampleStepSize,mX1,mX2);}function getTForX(aX){'worklet';let intervalStart=0.0;let currentSample=1;const lastSample=kSplineTableSize-1;for(;currentSample!==lastSample&&sampleValues[currentSample]<=aX;++currentSample){intervalStart+=kSampleStepSize;}--currentSample;const dist=(aX-sampleValues[currentSample])/(sampleValues[currentSample+1]-sampleValues[currentSample]);const guessForT=intervalStart+dist*kSampleStepSize;const initialSlope=getSlope(guessForT,mX1,mX2);if(initialSlope>=NEWTON_MIN_SLOPE){return newtonRaphsonIterate(aX,guessForT,mX1,mX2);}else if(initialSlope===0.0){return guessForT;}else{return binarySubdivide(aX,intervalStart,intervalStart+kSampleStepSize,mX1,mX2);}}return function Bezier_Pnpm_BezierTs8(x){'worklet';if(mX1===mY1&&mX2===mY2){return x;}if(x===0){return 0;}if(x===1){return 1;}return calcBezier(getTForX(x),mY1,mY2);};}"
};