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

325 lines
13 KiB
JavaScript

// Metro module 1774 (f1775).
import * as _getVal from "./getVal";
import * as _hue2rgb from "./hue2rgb";
import Module1776 from "./Module1776";
import * as _Module1617 from "./Module1617";
import { useSharedValue } from "./Module1758";
import { makeMutable } from "./Module1650";
function $mk70187($env) {
return (a0) => Math.pow(a0 / 255, $env[0]);
}
function $mk70188() {
return (a0) => ({
ch1: a0.r,
ch2: a0.g,
ch3: a0.b
});
}
let o2, t, _r, _a, n, l, _c, p2, i, c1500_12, $mk70189 = function() {
return (a0) => {
const r11 = _hue2rgb.RGBtoHSV(a0.r, a0.g, a0.b);
return {
ch1: r11.h,
ch2: r11.s,
ch3: r11.v
};
};
}, $mk70190 = function() {
return (a0) => {
const r10 = Module1776.oklab.convert.fromRgb(a0);
return {
ch1: r10.l,
ch2: r10.a,
ch3: r10.b
};
};
};
const r13 = function(a0, a1, a2, { useCorrectedHSVInterpolation }) {
let r14;
if (useCorrectedHSVInterpolation !== void 0 && !useCorrectedHSVInterpolation) {
r14 = _getVal.interpolate(a0, a1, a2.h, _getVal.Extrapolation.CLAMP);
} else {
const r21 = [a1[0]];
const r33 = a2.h;
const r20 = [r33[0]];
const r8 = 1 < r33.length;
let r1 = 1;
if (r8) {
do {
const r36 = r33[r1];
const r2 = r1 - 1;
const r38 = r36 - r33[r2];
const r17 = r33[r1];
const r39 = r33[r2];
const r0 = r1;
if (r17 > r39 && r38 > 0.5) {
r21.push(a1[r0]);
r21.push(a1[r0] + 0.00001);
r20.push(r33[r0] - 1);
r20.push(r33[r0]);
} else if (r33[r0] < r33[r2] && r38 < -0.5) {
r21.push(a1[r0]);
r21.push(a1[r0] + 0.00001);
r20.push(r33[r0] + 1);
r20.push(r33[r0]);
} else {
r21.push(a1[r0]);
r20.push(r33[r0]);
}
r1 = r0 + 1;
} while (r1 < r33.length);
}
r14 = (_getVal.interpolate(a0, r21, r20, _getVal.Extrapolation.CLAMP) + 1) % 1;
}
return _hue2rgb.hsvToColor(r14, _getVal.interpolate(a0, a1, a2.s, _getVal.Extrapolation.CLAMP), _getVal.interpolate(a0, a1, a2.v, _getVal.Extrapolation.CLAMP), _getVal.interpolate(a0, a1, a2.a, _getVal.Extrapolation.CLAMP));
};
r13.__closure = {
interpolate: _getVal.interpolate,
Extrapolation: _getVal.Extrapolation,
hsvToColor: _hue2rgb.hsvToColor
};
r13.__workletHash = 1574790978150;
r13.__initData = {
code: "function pnpm_interpolateColorTs1(value,inputRange,colors,options){const{interpolate,Extrapolation,hsvToColor}=this.__closure;let h=0;const{useCorrectedHSVInterpolation=true}=options;if(useCorrectedHSVInterpolation){const correctedInputRange=[inputRange[0]];const originalH=colors.h;const correctedH=[originalH[0]];for(let i=1;i<originalH.length;++i){const d=originalH[i]-originalH[i-1];if(originalH[i]>originalH[i-1]&&d>0.5){correctedInputRange.push(inputRange[i]);correctedInputRange.push(inputRange[i]+0.00001);correctedH.push(originalH[i]-1);correctedH.push(originalH[i]);}else if(originalH[i]<originalH[i-1]&&d<-0.5){correctedInputRange.push(inputRange[i]);correctedInputRange.push(inputRange[i]+0.00001);correctedH.push(originalH[i]+1);correctedH.push(originalH[i]);}else{correctedInputRange.push(inputRange[i]);correctedH.push(originalH[i]);}}h=(interpolate(value,correctedInputRange,correctedH,Extrapolation.CLAMP)+1)%1;}else{h=interpolate(value,inputRange,colors.h,Extrapolation.CLAMP);}const s=interpolate(value,inputRange,colors.s,Extrapolation.CLAMP);const v=interpolate(value,inputRange,colors.v,Extrapolation.CLAMP);const a=interpolate(value,inputRange,colors.a,Extrapolation.CLAMP);return hsvToColor(h,s,v,a);}"
};
o2 = r13;
const r28 = function t(a0, a1) {
let env13220;
const r0 = env13220 = {};
env13220[0] = a1;
return a0.map($mk70187(r0));
};
r28.__closure = {};
r28.__workletHash = 16826369876333;
r28.__initData = {
code: "function pnpm_interpolateColorTs2(x,gamma){return x.map(function(v){return Math.pow(v/255,gamma);});}"
};
t = r28;
const r = function r(a0, a1) {
return Math.round(255 * Math.pow(a0, 1 / a1));
};
r.__closure = {};
r.__workletHash = 5856560656141;
r.__initData = {
code: "function pnpm_interpolateColorTs3(x,gamma){return Math.round(Math.pow(x,1/gamma)*255);}"
};
_r = r;
const a = function a(a0, a1, a2, { gamma }) {
const r18 = gamma !== void 0 ? gamma : 2.2;
const { r: r9, g: r14, b: r10 } = a2;
let r13 = r10;
let r12 = r14;
let r11 = r9;
if (r18 !== 1) {
let env13221;
const r27 = env13221 = {};
env13221[0] = r18;
const r29 = r9.map($mk70187(r27));
let env13222;
const r32 = env13222 = {};
env13222[0] = r18;
const r35 = r14.map($mk70187(r32));
let env13223;
const r38 = env13223 = {};
env13223[0] = r18;
r13 = r10.map($mk70187(r38));
r12 = r35;
r11 = r29;
}
const r51 = _getVal.interpolate(a0, a1, r11, _getVal.Extrapolation.CLAMP);
const r63 = _getVal.interpolate(a0, a1, r12, _getVal.Extrapolation.CLAMP);
const r75 = _getVal.interpolate(a0, a1, r13, _getVal.Extrapolation.CLAMP);
const r87 = _getVal.interpolate(a0, a1, a2.a, _getVal.Extrapolation.CLAMP);
return r18 === 1 ? _hue2rgb.rgbaColor(r51, r63, r75, r87) : _hue2rgb.rgbaColor(Math.round(255 * Math.pow(r51, 1 / r18)), Math.round(255 * Math.pow(r63, 1 / r18)), Math.round(255 * Math.pow(r75, 1 / r18)), r87);
};
a.__closure = {
toLinearSpace: t,
interpolate: _getVal.interpolate,
Extrapolation: _getVal.Extrapolation,
rgbaColor: _hue2rgb.rgbaColor,
toGammaSpace: _r
};
a.__workletHash = 13883480600753;
a.__initData = {
code: "function pnpm_interpolateColorTs4(value,inputRange,colors,options){const{toLinearSpace,interpolate,Extrapolation,rgbaColor,toGammaSpace}=this.__closure;const{gamma=2.2}=options;let{r:outputR,g:outputG,b:outputB}=colors;if(gamma!==1){outputR=toLinearSpace(outputR,gamma);outputG=toLinearSpace(outputG,gamma);outputB=toLinearSpace(outputB,gamma);}const r=interpolate(value,inputRange,outputR,Extrapolation.CLAMP);const g=interpolate(value,inputRange,outputG,Extrapolation.CLAMP);const b=interpolate(value,inputRange,outputB,Extrapolation.CLAMP);const a=interpolate(value,inputRange,colors.a,Extrapolation.CLAMP);if(gamma===1){return rgbaColor(r,g,b,a);}return rgbaColor(toGammaSpace(r,gamma),toGammaSpace(g,gamma),toGammaSpace(b,gamma),a);}"
};
_a = a;
const r48 = function n(a0, a1, a2, a3) {
const r62 = Module1776.oklab.convert.toRgb({
l: _getVal.interpolate(a0, a1, a2.l, _getVal.Extrapolation.CLAMP),
a: _getVal.interpolate(a0, a1, a2.a, _getVal.Extrapolation.CLAMP),
b: _getVal.interpolate(a0, a1, a2.b, _getVal.Extrapolation.CLAMP),
alpha: _getVal.interpolate(a0, a1, a2.alpha, _getVal.Extrapolation.CLAMP)
});
return _hue2rgb.rgbaColor(r62.r, r62.g, r62.b, r62.alpha);
};
r48.__closure = {
interpolate: _getVal.interpolate,
Extrapolation: _getVal.Extrapolation,
culori: Module1776,
rgbaColor: _hue2rgb.rgbaColor
};
r48.__workletHash = 7788654685113;
r48.__initData = {
code: "function pnpm_interpolateColorTs5(value,inputRange,colors,_options){const{interpolate,Extrapolation,culori,rgbaColor}=this.__closure;const l=interpolate(value,inputRange,colors.l,Extrapolation.CLAMP);const a=interpolate(value,inputRange,colors.a,Extrapolation.CLAMP);const b=interpolate(value,inputRange,colors.b,Extrapolation.CLAMP);const alpha=interpolate(value,inputRange,colors.alpha,Extrapolation.CLAMP);const{r:_r,g:_g,b:_b,alpha:_alpha}=culori.oklab.convert.toRgb({l:l,a:a,b:b,alpha:alpha});return rgbaColor(_r,_g,_b,_alpha);}"
};
n = r48;
const r63 = function l(a0, a1) {
const ch1 = [];
const ch2 = [];
const ch3 = [];
const alpha = [];
const length = a0.length;
let r0 = 0;
if (0 < length) {
do {
const r20 = _hue2rgb.processColor(a0[r0]);
const r1 = r0;
if (typeof r20 === "number") {
const r33 = a1({
r: _hue2rgb.red(r20),
g: _hue2rgb.green(r20),
b: _hue2rgb.blue(r20)
});
ch1.push(r33.ch1);
ch2.push(r33.ch2);
ch3.push(r33.ch3);
alpha.push(_hue2rgb.opacity(r20));
}
r0 = r1 + 1;
} while (r0 < a0.length);
}
return {
ch1,
ch2,
ch3,
alpha
};
};
r63.__closure = {
processColor: _hue2rgb.processColor,
red: _hue2rgb.red,
green: _hue2rgb.green,
blue: _hue2rgb.blue,
opacity: _hue2rgb.opacity
};
r63.__workletHash = 8764168362190;
r63.__initData = {
code: "function pnpm_interpolateColorTs6(colors,convFromRgb){const{processColor,red,green,blue,opacity}=this.__closure;const ch1=[];const ch2=[];const ch3=[];const alpha=[];for(let i=0;i<colors.length;i++){const color=colors[i];const processedColor=processColor(color);if(typeof processedColor==='number'){const convertedColor=convFromRgb({r:red(processedColor),g:green(processedColor),b:blue(processedColor)});ch1.push(convertedColor.ch1);ch2.push(convertedColor.ch2);ch3.push(convertedColor.ch3);alpha.push(opacity(processedColor));}}return{ch1:ch1,ch2:ch2,ch3:ch3,alpha:alpha};}"
};
l = r63;
const c = function c(a0) {
const r5 = l(a0, $mk70188());
return {
r: r5.ch1,
g: r5.ch2,
b: r5.ch3,
a: r5.alpha
};
};
c.__closure = {
_splitColorsIntoChannels: l
};
c.__workletHash = 937749076324;
c.__initData = {
code: "function pnpm_interpolateColorTs7(colors){const{_splitColorsIntoChannels}=this.__closure;const{ch1:ch1,ch2:ch2,ch3:ch3,alpha:alpha}=_splitColorsIntoChannels(colors,function(color){return{ch1:color.r,ch2:color.g,ch3:color.b};});return{r:ch1,g:ch2,b:ch3,a:alpha};}"
};
_c = c;
const r12 = function(a0) {
const r5 = l(a0, $mk70189());
return {
h: r5.ch1,
s: r5.ch2,
v: r5.ch3,
a: r5.alpha
};
};
r12.__closure = {
_splitColorsIntoChannels: l,
RGBtoHSV: _hue2rgb.RGBtoHSV
};
r12.__workletHash = 11798906675452;
r12.__initData = {
code: "function pnpm_interpolateColorTs8(colors){const{_splitColorsIntoChannels,RGBtoHSV}=this.__closure;const{ch1:ch1,ch2:ch2,ch3:ch3,alpha:alpha}=_splitColorsIntoChannels(colors,function(color){const hsvColor=RGBtoHSV(color.r,color.g,color.b);return{ch1:hsvColor.h,ch2:hsvColor.s,ch3:hsvColor.v};});return{h:ch1,s:ch2,v:ch3,a:alpha};}"
};
p2 = r12;
const r91 = function i(a0) {
const r5 = l(a0, $mk70190());
return {
l: r5.ch1,
a: r5.ch2,
b: r5.ch3,
alpha: r5.alpha
};
};
r91.__closure = {
_splitColorsIntoChannels: l,
culori: Module1776
};
r91.__workletHash = 11214827752418;
r91.__initData = {
code: "function pnpm_interpolateColorTs9(colors){const{_splitColorsIntoChannels,culori}=this.__closure;const{ch1:ch1,ch2:ch2,ch3:ch3,alpha:alpha}=_splitColorsIntoChannels(colors,function(color){const labColor=culori.oklab.convert.fromRgb(color);return{ch1:labColor.l,ch2:labColor.a,ch3:labColor.b};});return{l:ch1,a:ch2,b:ch3,alpha:alpha};}"
};
i = r91;
export function interpolateColor(a0, a1, a2, r10 = "RGB", r5 = {}) {
if (r10 === "HSV") {
const r67 = l(a2, $mk70189());
return o2(a0, a1, {
h: r67.ch1,
s: r67.ch2,
v: r67.ch3,
a: r67.alpha
}, r5);
}
if (r10 === "RGB") {
const r49 = l(a2, $mk70188());
return _a(a0, a1, {
r: r49.ch1,
g: r49.ch2,
b: r49.ch3,
a: r49.alpha
}, r5);
}
if (r10 === "LAB") {
const r34 = l(a2, $mk70190());
return n(a0, a1, {
l: r34.ch1,
a: r34.ch2,
b: r34.ch3,
alpha: r34.alpha
}, r5);
}
throw new _Module1617.ReanimatedError(`Invalid color space provided: ${r10}. Supported values are: ['RGB', 'HSV', 'LAB'].`);
}
interpolateColor.__closure = {
interpolateColorsHSV: o2,
getInterpolateHSV: p2,
interpolateColorsRGB: _a,
getInterpolateRGB: _c,
interpolateColorsLAB: n,
getInterpolateLAB: i
};
interpolateColor.__workletHash = 10004340589678;
interpolateColor.__initData = {
code: "function interpolateColor_Pnpm_interpolateColorTs10(value,inputRange,outputRange,colorSpace='RGB',options={}){const{interpolateColorsHSV,getInterpolateHSV,interpolateColorsRGB,getInterpolateRGB,interpolateColorsLAB,getInterpolateLAB}=this.__closure;if(colorSpace==='HSV'){return interpolateColorsHSV(value,inputRange,getInterpolateHSV(outputRange),options);}else if(colorSpace==='RGB'){return interpolateColorsRGB(value,inputRange,getInterpolateRGB(outputRange),options);}else if(colorSpace==='LAB'){return interpolateColorsLAB(value,inputRange,getInterpolateLAB(outputRange),options);}throw new ReanimatedError(\"Invalid color space provided: \"+colorSpace+\". Supported values are: ['RGB', 'HSV', 'LAB'].\");}"
};
c1500_12 = {
RGB: 0,
0: "RGB",
HSV: 1,
1: "HSV",
LAB: 2,
2: "LAB"
};
export const Extrapolate = _getVal.Extrapolation;
export { c1500_12 as ColorSpace };
export function useInterpolateConfig(a0, a1, colorSpace = c1500_12.RGB, options = {}) {
return useSharedValue({
inputRange: a0,
outputRange: a1,
colorSpace,
cache: makeMutable(null),
options
});
}