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

160 lines
3.7 KiB
JavaScript

// Metro module 8546 (f8547).
import { idPattern } from "./Module8547";
import extractResponder from "./extractResponder";
import extractFill from "./extractFill";
import extractStroke from "./extractStroke";
import extractTransform from "./extractTransform";
import extractOpacity from "./extractOpacity";
let c5477_3;
const extractProps = function extractProps(a0, a1) {
const { id, opacity, onLayout, clipPath, clipRule, display, mask, filter, marker, markerStart = marker, markerMid = marker, markerEnd = marker, testID, accessibilityLabel, accessible } = a0;
const r26 = {};
const propList = [];
extractResponder(r26, a0, a1);
extractFill(r26, a0, propList);
extractStroke(r26, a0, propList);
if (a0.color) {
r26.color = a0.color;
}
if (propList.length) {
r26.propList = propList;
}
const matrix = extractTransform(a0);
if (matrix !== null) {
r26.matrix = matrix;
}
if (opacity != null) {
r26.opacity = extractOpacity(opacity);
}
if (display != null) {
r26.display = display === "none" ? "none" : void 0;
}
if (onLayout) {
r26.onSvgLayout = onLayout;
}
if (markerStart) {
let markerStart2 = void 0;
if (markerStart) {
const r52 = markerStart.match(idPattern);
markerStart2 = r52 ? r52[1] : void 0;
}
r26.markerStart = markerStart2;
}
if (markerMid) {
let markerMid2 = void 0;
if (markerMid) {
const r60 = markerMid.match(idPattern);
markerMid2 = r60 ? r60[1] : void 0;
}
r26.markerMid = markerMid2;
}
if (markerEnd) {
let markerEnd2 = void 0;
if (markerEnd) {
const r68 = markerEnd.match(idPattern);
markerEnd2 = r68 ? r68[1] : void 0;
}
r26.markerEnd = markerEnd2;
}
if (id) {
r26.name = String(id);
}
if (testID) {
r26.testID = testID;
}
if (accessibilityLabel) {
r26.accessibilityLabel = accessibilityLabel;
}
if (accessible) {
r26.accessible = accessible;
}
if (clipRule) {
r26.clipRule = c5477_3[clipRule] === 0 ? 0 : 1;
}
if (clipPath) {
const r80 = clipPath.match(idPattern);
if (r80) {
r26.clipPath = r80[1];
} else {
console.warn("Invalid `clipPath` prop, expected a clipPath like \"#id\", but got: \"" + clipPath + "\"");
}
}
if (mask) {
const r95 = mask.match(idPattern);
if (r95) {
r26.mask = r95[1];
} else {
console.warn("Invalid `mask` prop, expected a mask like \"#id\", but got: \"" + mask + "\"");
}
}
if (filter) {
const r110 = filter.match(idPattern);
if (r110) {
r26.filter = r110[1];
} else {
console.warn("Invalid `filter` prop, expected a filter like \"#id\", but got: \"" + filter + "\"");
}
}
return r26;
};
c5477_3 = {
evenodd: 0,
nonzero: 1
};
export default extractProps;
export function propsAndStyles(a0) {
const style = a0.style;
let r1 = a0;
if (style) {
const isArray = Array.isArray(style);
let r13 = style;
if (isArray) {
const r6 = Object;
r13 = r6.assign.apply(r6, [{}, ...style]);
}
r1 = {
...r13,
...a0
};
}
return r1;
}
export function extract(a0, a1) {
const style = a1.style;
let r3 = a1;
if (style) {
const isArray = Array.isArray(style);
let r16 = style;
if (isArray) {
const r8 = Object;
r16 = r8.assign.apply(r8, [{}, ...style]);
}
r3 = {
...r16,
...a1
};
}
return extractProps(r3, a0);
}
export function withoutXY(a0, a1) {
const style = a1.style;
let r5 = a1;
if (style) {
const isArray = Array.isArray(style);
let r16 = style;
if (isArray) {
const r8 = Object;
r16 = r8.assign.apply(r8, [{}, ...style]);
}
r5 = {
...r16,
...a1
};
}
return extractProps({
...r5,
x: null,
y: null
}, a0);
}