390 lines
12 KiB
JavaScript
390 lines
12 KiB
JavaScript
// Metro module 363 (f364).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _get from "./_get";
|
|
import _inherits from "./_inherits";
|
|
import Module364 from "./Module364";
|
|
import Module38 from "./Module38";
|
|
import normalizeColor from "./normalizeColor";
|
|
import processColor from "./processColor";
|
|
import Module357 from "./Module357";
|
|
import AnimatedWithChildren from "./AnimatedWithChildren";
|
|
function $mk66251($env) {
|
|
return function(a0) {
|
|
const r0 = $env;
|
|
return r0[1].apply(r0[0], a0);
|
|
};
|
|
}
|
|
function $mk66252($env) {
|
|
return (a0) => {
|
|
let r29, r35;
|
|
const r7 = $env;
|
|
const r8 = $env.$parent;
|
|
(0, r8[0])(r8[1][7])(typeof a0 === "number", "Cannot interpolate an input which is not a number");
|
|
const r23 = r7[1];
|
|
const r0 = r23.length - 1;
|
|
let r2 = 1;
|
|
if (1 < r0) {
|
|
const r26 = r23[1] >= a0;
|
|
let r27 = 1;
|
|
r2 = 1;
|
|
if (!r26) {
|
|
do {
|
|
const r1 = r27 + 1;
|
|
const r4 = r23.length - 1;
|
|
r2 = r1;
|
|
if (!(r1 < r4)) {
|
|
break;
|
|
}
|
|
r29 = r23[r1];
|
|
r27 = r1;
|
|
r2 = r27;
|
|
} while (!(r29 >= a0));
|
|
}
|
|
}
|
|
L28: {
|
|
const r30 = r2 - 1;
|
|
const r10 = r23[r30];
|
|
const r31 = r30 + 1;
|
|
const r12 = r23[r31];
|
|
const r32 = r7[0];
|
|
const r33 = r32[r30];
|
|
let r34 = r32[r31];
|
|
const r13 = r7[2];
|
|
const r15 = r7[3];
|
|
const r16 = r7[4];
|
|
let r17 = a0;
|
|
if (a0 < r10) {
|
|
r35 = a0;
|
|
if (r15 === "identity") {
|
|
break L28;
|
|
}
|
|
r17 = r15 === "clamp" ? r10 : a0;
|
|
}
|
|
let r37 = r17;
|
|
if (r17 > r12) {
|
|
r35 = r17;
|
|
if (r16 === "identity") {
|
|
break L28;
|
|
}
|
|
r37 = r16 === "clamp" ? r12 : r17;
|
|
}
|
|
r35 = r33;
|
|
if (r35 !== r34) {
|
|
if (r10 === r12) {
|
|
if (a0 <= r10) {
|
|
r34 = r33;
|
|
}
|
|
r35 = r34;
|
|
} else {
|
|
const r45 = r13(r10 === -Infinity ? -r37 : r12 === Infinity ? r37 - r10 : (r37 - r10) / (r12 - r10));
|
|
r35 = r33 === -Infinity ? -r45 : r34 === Infinity ? r45 + r33 : r45 * (r34 - r33) + r33;
|
|
}
|
|
}
|
|
}
|
|
return r35;
|
|
};
|
|
}
|
|
let mapStringToNumericComponents, c376_7;
|
|
let AnimatedInterpolation;
|
|
let env376 = {};
|
|
env376[6] = function _isNativeReflectConstruct() {
|
|
let c12274_0;
|
|
try {
|
|
c12274_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c12274_0;
|
|
};
|
|
env376[6] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
mapStringToNumericComponents = function mapStringToNumericComponents(a0) {
|
|
const r20 = normalizeColor(a0);
|
|
Module38(r20 == null || typeof r20 !== "object", "PlatformColors are not supported");
|
|
if (typeof r20 === "number") {
|
|
const r58 = r20 || 0;
|
|
return {
|
|
isColor: true,
|
|
components: [(4278190080 & r58) >>> 24, (16711680 & r58) >>> 16, (65280 & r58) >>> 8, (255 & r58) / 255]
|
|
};
|
|
}
|
|
const components = [];
|
|
let r27 = c376_7.exec(a0);
|
|
const r28 = r27 != null;
|
|
let r29 = 0;
|
|
let r11 = 0;
|
|
if (r28) {
|
|
do {
|
|
const index = r27.index;
|
|
const r18 = r29;
|
|
const r14 = r27;
|
|
if (index > r18) {
|
|
components.push(a0.substring(r18, r14.index));
|
|
}
|
|
components.push(parseFloat(r14[0]));
|
|
r29 = r14.index + r14[0].length;
|
|
r27 = c376_7.exec(a0);
|
|
r11 = r29;
|
|
} while (r27 != null);
|
|
}
|
|
Module38(components.length > 0, "outputRange must contain color or value with numeric component");
|
|
if (r11 < a0.length) {
|
|
components.push(a0.substring(r11, a0.length));
|
|
}
|
|
return {
|
|
isColor: false,
|
|
components
|
|
};
|
|
};
|
|
c376_7 = /[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;
|
|
AnimatedInterpolation = function AnimatedInterpolation(a0, a1) {
|
|
_classCallCheck(this, AnimatedInterpolation);
|
|
const r9 = [a1];
|
|
const r8 = _getPrototypeOf(AnimatedInterpolation);
|
|
const r22 = _possibleConstructorReturn(this, (0, env376[6])() ? Reflect.construct(r8, r9, _getPrototypeOf(this).constructor) : r8.apply(this, r9));
|
|
r22._parent = a0;
|
|
r22._config = a1;
|
|
return r22;
|
|
};
|
|
_inherits(AnimatedInterpolation, AnimatedWithChildren);
|
|
export default _createClass(AnimatedInterpolation, [{
|
|
key: "_getInterpolation",
|
|
value: function _getInterpolation() {
|
|
L30: {
|
|
if (!this._interpolation) {
|
|
const _config2 = this._config;
|
|
if (_config2.outputRange && typeof _config2.outputRange[0] === "string") {
|
|
let c23701_3, c23701_4;
|
|
const _config = _config2;
|
|
Module38(_config.outputRange.length >= 2, "Bad output range");
|
|
const r80 = _config.outputRange.map(mapStringToNumericComponents);
|
|
let c23701_1 = r80;
|
|
const isColor = r80[0].isColor;
|
|
const r85 = r80.map(({ components }) => isColor ? components : components.filter((component) => typeof component === "number"));
|
|
c23701_3 = r85;
|
|
c23701_4 = r85[0].map((a0, c31149_0) => {
|
|
let env31150;
|
|
const r4 = env376;
|
|
const r8 = {
|
|
..._config,
|
|
outputRange: c23701_3.map((item) => item[c31149_0])
|
|
};
|
|
const r13 = env31150 = {
|
|
$parent: r4
|
|
};
|
|
env31150[0] = void 0;
|
|
env31150[1] = void 0;
|
|
env31150[2] = void 0;
|
|
env31150[3] = void 0;
|
|
env31150[4] = void 0;
|
|
env31150[0] = r8.outputRange;
|
|
env31150[1] = r8.inputRange;
|
|
env31150[2] = r8.easing || Module364.linear;
|
|
env31150[3] = "extend";
|
|
if (r8.extrapolateLeft !== void 0) {
|
|
env31150[3] = r8.extrapolateLeft;
|
|
} else if (r8.extrapolate !== void 0) {
|
|
env31150[3] = r8.extrapolate;
|
|
}
|
|
env31150[4] = "extend";
|
|
if (r8.extrapolateRight !== void 0) {
|
|
env31150[4] = r8.extrapolateRight;
|
|
} else if (r8.extrapolate !== void 0) {
|
|
env31150[4] = r8.extrapolate;
|
|
}
|
|
return $mk66252(r13);
|
|
});
|
|
this._interpolation = isColor ? (c31151_0) => {
|
|
const r20 = c23701_4.map((item, index) => {
|
|
const r6 = item(c31151_0);
|
|
return index < 3 ? Math.round(r6) : Math.round(1000 * r6) / 1000;
|
|
});
|
|
return `rgba(${r20[0]}, ${r20[1]}, ${r20[2]}, ${r20[3]})`;
|
|
} : (c31152_0) => {
|
|
let c31152_2;
|
|
let c31152_1 = c23701_4.map((item) => item(c31152_0));
|
|
c31152_2 = 0;
|
|
return c23701_1[0].components.map((component) => {
|
|
let r0 = component;
|
|
if (typeof component === "number") {
|
|
const r5 = +c31152_2;
|
|
c31152_2 = r5 + 1;
|
|
r0 = c31152_1[r5];
|
|
}
|
|
return r0;
|
|
}).join("");
|
|
};
|
|
break L30;
|
|
}
|
|
if (typeof _config2.outputRange[0] === "object") {
|
|
let env23700;
|
|
const outputRange = _config2.outputRange;
|
|
const r46 = {
|
|
..._config2,
|
|
inputRange: _config2.inputRange,
|
|
outputRange: Array.from(Array(outputRange.length).keys())
|
|
};
|
|
const r49 = env23700 = {
|
|
$parent: env376
|
|
};
|
|
env23700[0] = void 0;
|
|
env23700[1] = void 0;
|
|
env23700[2] = void 0;
|
|
env23700[3] = void 0;
|
|
env23700[4] = void 0;
|
|
env23700[0] = r46.outputRange;
|
|
env23700[1] = r46.inputRange;
|
|
env23700[2] = r46.easing || Module364.linear;
|
|
env23700[3] = "extend";
|
|
if (r46.extrapolateLeft !== void 0) {
|
|
env23700[3] = r46.extrapolateLeft;
|
|
} else if (r46.extrapolate !== void 0) {
|
|
env23700[3] = r46.extrapolate;
|
|
}
|
|
env23700[4] = "extend";
|
|
if (r46.extrapolateRight !== void 0) {
|
|
env23700[4] = r46.extrapolateRight;
|
|
} else if (r46.extrapolate !== void 0) {
|
|
env23700[4] = r46.extrapolate;
|
|
}
|
|
let c23699_1 = $mk66252(r49);
|
|
this._interpolation = (a0) => {
|
|
const r4 = c23699_1(a0);
|
|
if (!Number.isInteger(r4)) {
|
|
console.warn("PlatformColor interpolation should happen natively, here we fallback to the closest color");
|
|
}
|
|
return outputRange[Math.floor(r4)];
|
|
};
|
|
} else {
|
|
let env23698;
|
|
const r19 = env23698 = {
|
|
$parent: env376
|
|
};
|
|
env23698[0] = _config2.outputRange;
|
|
env23698[1] = _config2.inputRange;
|
|
env23698[2] = _config2.easing || Module364.linear;
|
|
env23698[3] = "extend";
|
|
if (_config2.extrapolateLeft !== void 0) {
|
|
env23698[3] = _config2.extrapolateLeft;
|
|
} else if (_config2.extrapolate !== void 0) {
|
|
env23698[3] = _config2.extrapolate;
|
|
}
|
|
env23698[4] = "extend";
|
|
if (_config2.extrapolateRight !== void 0) {
|
|
env23698[4] = _config2.extrapolateRight;
|
|
} else if (_config2.extrapolate !== void 0) {
|
|
env23698[4] = _config2.extrapolate;
|
|
}
|
|
this._interpolation = $mk66252(r19);
|
|
}
|
|
}
|
|
}
|
|
return this._interpolation;
|
|
}
|
|
}, {
|
|
key: "__makeNative",
|
|
value: function __makeNative(a0) {
|
|
let env23702;
|
|
this._parent.__makeNative(a0);
|
|
const r10 = env23702 = {};
|
|
env23702[0] = this;
|
|
env23702[1] = void 0;
|
|
let r15 = _get(_getPrototypeOf(AnimatedInterpolation.prototype), "__makeNative", this);
|
|
env23702[1] = r15;
|
|
if (typeof r15 === "function") {
|
|
r15 = $mk66251(r10);
|
|
}
|
|
r15([a0]);
|
|
}
|
|
}, {
|
|
key: "__getValue",
|
|
value: function __getValue() {
|
|
const r6 = this._parent.__getValue();
|
|
Module38(typeof r6 === "number", "Cannot interpolate an input which is not a number.");
|
|
return this._getInterpolation()(r6);
|
|
}
|
|
}, {
|
|
key: "interpolate",
|
|
value: function interpolate(a0) {
|
|
const r2 = {
|
|
__proto__: AnimatedInterpolation.prototype
|
|
};
|
|
_classCallCheck(r2, AnimatedInterpolation);
|
|
const r9 = [a0];
|
|
const r8 = _getPrototypeOf(AnimatedInterpolation);
|
|
const r23 = _possibleConstructorReturn(r2, (0, env376[6])() ? Reflect.construct(r8, r9, _getPrototypeOf(r2).constructor) : r8.apply(r2, r9));
|
|
r23._parent = this;
|
|
r23._config = a0;
|
|
return r23 instanceof Object ? r23 : r2;
|
|
}
|
|
}, {
|
|
key: "__attach",
|
|
value: function __attach() {
|
|
let env23703;
|
|
this._parent.__addChild(this);
|
|
const r9 = env23703 = {};
|
|
env23703[0] = this;
|
|
env23703[1] = void 0;
|
|
let r14 = _get(_getPrototypeOf(AnimatedInterpolation.prototype), "__attach", this);
|
|
env23703[1] = r14;
|
|
if (typeof r14 === "function") {
|
|
r14 = $mk66251(r9);
|
|
}
|
|
r14([]);
|
|
}
|
|
}, {
|
|
key: "__detach",
|
|
value: function __detach() {
|
|
let env23704;
|
|
this._parent.__removeChild(this);
|
|
const r9 = env23704 = {};
|
|
env23704[0] = this;
|
|
env23704[1] = void 0;
|
|
let r14 = _get(_getPrototypeOf(AnimatedInterpolation.prototype), "__detach", this);
|
|
env23704[1] = r14;
|
|
if (typeof r14 === "function") {
|
|
r14 = $mk66251(r9);
|
|
}
|
|
r14([]);
|
|
}
|
|
}, {
|
|
key: "__getNativeConfig",
|
|
value: function __getNativeConfig() {
|
|
let outputRange3;
|
|
const outputRange2 = this._config.outputRange;
|
|
let outputType = null;
|
|
if (typeof outputRange2[0] === "string") {
|
|
outputRange3 = outputRange2.map((item) => {
|
|
let r11;
|
|
const r7 = processColor(item);
|
|
if (typeof r7 === "number") {
|
|
outputType = "color";
|
|
r11 = r7;
|
|
} else {
|
|
r11 = Module357.transformDataType(item);
|
|
}
|
|
return r11;
|
|
});
|
|
} else {
|
|
const r8 = outputRange2[0];
|
|
outputRange3 = outputRange2;
|
|
if (typeof r8 === "object") {
|
|
outputType = "platform_color";
|
|
outputRange3 = outputRange2;
|
|
}
|
|
}
|
|
return {
|
|
inputRange: this._config.inputRange,
|
|
outputRange: outputRange3,
|
|
outputType,
|
|
extrapolateLeft: this._config.extrapolateLeft || this._config.extrapolate || "extend",
|
|
extrapolateRight: this._config.extrapolateRight || this._config.extrapolate || "extend",
|
|
type: "interpolation",
|
|
debugID: this.__getDebugID()
|
|
};
|
|
}
|
|
}]);
|