This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,18 @@
// Metro module 8083 (f8084).
import { useMemo } from "react";
import ProfileFrameRecord from "../../records/ProfileFrameRecord";
import { useFramePreviewOverrideStore } from "../native/tooling/FramePreviewOverrideStore";
import { CollectiblesItemType } from "../../../../_bundle/Module1901";
export default function useFramePreviewOverrideFrame() {
const framePreviewOverrideStore = useFramePreviewOverrideStore((a0) => a0.override);
return useMemo(() => framePreviewOverrideStore != null ? new ProfileFrameRecord({
type: CollectiblesItemType.PROFILE_FRAME,
skuId: "frame-preview-override",
label: framePreviewOverrideStore.frameKey,
layers: framePreviewOverrideStore.layers,
innerWidth: framePreviewOverrideStore.innerWidth,
overflowTop: framePreviewOverrideStore.overflowTop,
overflowBottom: framePreviewOverrideStore.overflowBottom,
overflowHorizontal: framePreviewOverrideStore.overflowHorizontal
}) : null, [framePreviewOverrideStore]);
};
@@ -0,0 +1,22 @@
// Metro module 8082 (f8083).
import { useEffect } from "react";
import useFramePreviewOverrideFrame_native from "./useFramePreviewOverrideFrame.native";
import { useIsProfileFramesEnabled } from "../../experiments/CollectiblesProfileFramesExperiment";
import useProfileFrame from "./useProfileFrame";
import { maybeFetchCollectiblesProduct } from "../../CollectiblesActionCreators";
export default function useMaybeFetchProfileFrame(a0, a1) {
let r13 = useFramePreviewOverrideFrame_native();
const isProfileFramesEnabled = useIsProfileFramesEnabled(a1);
const profileFrame = useProfileFrame(a0);
const r20 = r13 == null && isProfileFramesEnabled && a0 != null && profileFrame == null;
let c16239_1 = r20;
useEffect(() => {
if (c16239_1) {
maybeFetchCollectiblesProduct(a0);
}
}, [r20, a0]);
if (r13 == null) {
r13 = isProfileFramesEnabled ? profileFrame : void 0;
}
return r13;
};
@@ -0,0 +1,44 @@
// Metro module 8366 (f8367).
import { useEffect, useRef } from "react";
import CollectiblesCategoryStore from "../../CollectiblesCategoryStore";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import { maybeTrackUserProfileUiViewed } from "../../../user_profile/UserProfileAnalyticsUtils";
export default function useMaybeTrackProfileFrameViewed({ skuId, openedAt, context, analyticsLocations }) {
let ref, ref2, ref3, ref4;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
ref4 = void 0;
const stateFromStores = useStateFromStores([CollectiblesCategoryStore], () => CollectiblesCategoryStore.getProductFetch(skuId));
ref = useRef(void 0);
ref2 = useRef(void 0);
ref3 = useRef(void 0);
ref4 = useRef(false);
useEffect(() => {
if (skuId != null && openedAt != null) {
if (!(ref2.current === skuId && ref3.current === openedAt)) {
ref2.current = skuId;
ref3.current = openedAt;
ref4.current = false;
ref.current = void 0;
}
const r9 = Date.now();
if (ref.current == null) {
ref.current = r9 - openedAt;
}
if (!(stateFromStores?.state !== "success" || ref4.current)) {
ref4.current = true;
maybeTrackUserProfileUiViewed({
profileUi: "PROFILE_FRAME",
timeToInteractiveMs: ref.current,
timeToLoadMs: r9 - openedAt,
timeToFetchMs: stateFromStores.startedAt != null ? stateFromStores.endedAt != null ? stateFromStores.endedAt - stateFromStores.startedAt : void 0 : void 0,
viewStartedAt: openedAt,
fetchStartedAt: stateFromStores.startedAt,
analyticsLocations,
...context
});
}
}
}, [skuId, openedAt, stateFromStores]);
};
@@ -0,0 +1,17 @@
// Metro module 8094 (f8095).
import CollectiblesCategoryStore from "../../CollectiblesCategoryStore";
import CollectiblesPurchaseStore from "../../CollectiblesPurchaseStore";
import { isProfileFrameRecord } from "../../records/ProfileFrameRecord";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useProfileFrame(c16244_0) {
return useStateFromStores([CollectiblesCategoryStore, CollectiblesPurchaseStore], () => {
if (c16244_0 != null) {
const product = CollectiblesCategoryStore.getProduct(c16244_0);
if (isProfileFrameRecord(product == null ? void 0 : product.items[0])) {
return product.items[0];
}
const purchase = CollectiblesPurchaseStore.getPurchase(c16244_0);
return isProfileFrameRecord(purchase == null ? void 0 : purchase.items[0]) ? purchase.items[0] : void 0;
}
});
};
@@ -0,0 +1,69 @@
// Metro module 13727 (f13728).
import { useMemo } from "react";
import CollectiblesCategoryStore from "../../CollectiblesCategoryStore";
import CollectiblesPurchaseStore from "../../CollectiblesPurchaseStore";
import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/defaultAreStatesEqual";
import { useIsProfileFramesEarlyAccessPhase } from "../../hooks/useCanPurchaseFrames";
import { getProfileFrames, isPremiumCollectiblesPurchase, isPremiumCollectiblesProduct } from "../../CollectiblesUtils";
import { intl, t } from "../../../../intl/index.native";
let c9542_6 = {
PURCHASE: "purchase",
PREMIUM_PURCHASE: "premium_purchase",
PREVIEW: "preview"
};
let c9542_7 = {
skuId: "None"
};
let c9542_8 = {
skuId: "Shop"
};
export default function useProfileFrameSections() {
let c20676_1, c20676_2, isProfileFramesEarlyAccessPhase;
const stateFromStores = useStateFromStores([CollectiblesPurchaseStore], () => CollectiblesPurchaseStore.purchases);
const [r22, r23] = useStateFromStoresArray([CollectiblesCategoryStore], () => [CollectiblesCategoryStore.categories, CollectiblesCategoryStore.products]);
c20676_1 = r22;
c20676_2 = r23;
isProfileFramesEarlyAccessPhase = useIsProfileFramesEarlyAccessPhase("useProfileFrameSections");
return useMemo(() => {
const r23 = getProfileFrames(stateFromStores, c20676_1).reduce((acc, item) => {
const r9 = stateFromStores.get(item.skuId);
if (r9 != null ? isPremiumCollectiblesPurchase(r9) : isPremiumCollectiblesProduct(c20676_2.get(item.skuId))) {
acc.premium_purchase.push(item);
} else if (r9 != null) {
acc.purchase.push(item);
} else {
acc.preview.push(item);
}
return acc;
}, {
purchase: [],
premium_purchase: [],
preview: []
});
let header = intl.string(t.TiLCgw);
const r46 = [{
section: c9542_6.PURCHASE,
items: [c9542_7, c9542_8, ...r23.purchase],
height: 12,
header: intl.string(t["9eZ4aO"])
}, {
section: c9542_6.PREMIUM_PURCHASE,
items: r23.premium_purchase,
height: 12,
header
}, ,];
if (!isProfileFramesEarlyAccessPhase) {
header = intl.string(t["1vbbee"]);
}
r46[2] = {
section: c9542_6.PREVIEW,
items: r23.preview,
height: 12,
header
};
return r46.filter((item) => item.items.length > 0);
}, [r22, r23, stateFromStores, isProfileFramesEarlyAccessPhase]);
};
export { c9542_6 as Section };
export { c9542_7 as NONE_ITEM };
export { c9542_8 as SHOP_ITEM };
@@ -0,0 +1,75 @@
// Metro module 13728 (f13729).
import { memo, useCallback } from "react";
import { View } from "react-native";
import { isProfileFrameRecord } from "../../records/ProfileFrameRecord";
import { PROFILE_FRAME_ASPECT_RATIO } from "./ProfileFrameConstants";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { GUTTER_SIZE, ROW_SIZE } from "../../native/useCollectibleListLayout";
import { NONE_ITEM, SHOP_ITEM } from "../hooks/useProfileFrameSections";
import { EditCollectiblesListItemNone, EditCollectiblesListItemShop, EditCollectiblesListItemProduct } from "../../native/CollectiblesEditUserProfileListItems";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import ProfileFrameSamplePreview from "./previews/ProfileFrameSamplePreview";
let Component;
const PX_8 = Module712.space.PX_8;
const useStyles = createStyles({
row: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: GUTTER_SIZE
},
rowSpacer: {
height: GUTTER_SIZE
},
previewContainer: {
width: "100%",
height: "100%",
paddingVertical: PX_8,
overflow: "hidden",
alignItems: "center",
justifyContent: "center"
}
});
const r49 = memo(({ items, selectedSkuId, setSelectedProfileFrame, guildId, size }) => {
const styles = useStyles();
const callback = useCallback(() => {
setSelectedProfileFrame(null);
}, [setSelectedProfileFrame]);
return <>
<View style={styles.row}>
{[...items, null, null].slice(0, ROW_SIZE).map((item, index) => {
if (item === NONE_ITEM) {
return <EditCollectiblesListItemNone key="none" size={size} onPress={callback} isSelected={selectedSkuId == null} asDefault={guildId != null} />;
}
if (item === SHOP_ITEM) {
return <EditCollectiblesListItemShop key="shop" size={size} analyticsSource={AnalyticsLocation.EDIT_PROFILE_FRAME_SHEET} />;
}
if (isProfileFrameRecord(item)) {
return <Component key={item.skuId} profileFrame={item} isSelected={selectedSkuId === item.skuId} setSelectedProfileFrame={setSelectedProfileFrame} size={size} />;
}
return <View key={index} style={{
height: size,
width: size
}} />;
})}
</View>
<View style={styles.rowSpacer} />
</>;
});
r49.displayName = "EditProfileFrameRow";
Component = memo(({ profileFrame, isSelected, setSelectedProfileFrame: setSelectedProfileFrame2, size: size2 }) => {
const styles = useStyles();
return <EditCollectiblesListItemProduct skuId={profileFrame.skuId} isSelected={isSelected} onPress={useCallback(() => {
setSelectedProfileFrame2({
skuId: profileFrame.skuId,
type: profileFrame.type
});
}, [setSelectedProfileFrame2, profileFrame])} size={size2} accessibilityLabel={profileFrame.label}>
<View style={styles.previewContainer}>
<ProfileFrameSamplePreview profileFrame={profileFrame} previewWidth={size2 * PROFILE_FRAME_ASPECT_RATIO} previewHeight={size2 - 2 * PX_8} profileBackgroundColor={Module712.colors.BACKGROUND_BASE_LOW} />
</View>
</EditCollectiblesListItemProduct>;
});
Component.displayName = "EditProfileFrameItem";
export { r49 as EditProfileFrameRow };
@@ -0,0 +1,110 @@
// Metro module 8097 (f8098).
import { useMemo } from "react";
import { View, StyleSheet } from "react-native";
import { useFramePreviewOverrideStore } from "./tooling/FramePreviewOverrideStore";
import { PROFILE_FRAME_RESPONSIVE_RAIL_MIN_ASPECT_RATIO, PROFILE_FRAME_Z_INDEX } from "./ProfileFrameConstants";
import { UserProfileThemeTypes } from "../../../user_profile/native/Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useProfileFrameLayerAsset from "./useProfileFrameLayerAsset";
import FastImage from "../../../../components_native/common/FastImage";
import scaleProfileFrame from "../scaleProfileFrame";
import FramePreviewOverrideFrame from "./tooling/FramePreviewOverrideFrame";
let useStyles, LiveProfileFrame;
const ProfileFrameLayer = function ProfileFrameLayer(props) {
const { skuId, layer, overflowTop, overflowBottom, overflowHorizontal, containerWidth: containerWidth2, containerHeight: containerHeight2 } = props;
const styles = useStyles();
const width = containerWidth2 + 2 * overflowHorizontal;
const profileFrameLayerAsset = useProfileFrameLayerAsset({
skuId,
layer,
width
});
const { assetUrl, imageHeight } = profileFrameLayerAsset;
const memo = useMemo(() => {
const r1 = {
left: -overflowHorizontal,
right: -overflowHorizontal,
zIndex: PROFILE_FRAME_Z_INDEX[layer.order]
};
const type = layer.type;
if (type === "staple") {
return {
...r1,
top: layer.anchor === "top" ? -overflowTop : void 0,
bottom: layer.anchor === "bottom" ? -overflowBottom : void 0
};
}
if (type === "rail") {
return {
...r1,
justifyContent: layer.anchor !== "center" ? layer.anchor === "top" ? "flex-start" : "flex-end" : "center"
};
}
return {
...r1,
left: -overflowHorizontal
};
}, [layer.anchor, layer.type, layer.order, overflowTop, overflowBottom, overflowHorizontal]);
const r1 = layer.responsive === true && layer.type === "rail" && containerHeight2 != null && containerWidth2 / containerHeight2 >= PROFILE_FRAME_RESPONSIVE_RAIL_MIN_ASPECT_RATIO;
if (imageHeight !== 0 && assetUrl != null && !r1) {
if (layer.type === "border") {
if (containerHeight2 != null && containerHeight2 !== 0) {
return <View style={[styles.layer, memo]}>
{Array.from({
length: Math.ceil(containerHeight2 / imageHeight)
}, (a0, a1) => <FastImage key={a1} source={{
uri: assetUrl
}} resizeMode="cover" width={width} height={imageHeight} />)}
</View>;
}
return null;
}
return <View style={[styles.layer, memo]}>
<FastImage source={{
uri: assetUrl
}} resizeMode="cover" width={width} height={imageHeight} />
</View>;
}
return null;
};
LiveProfileFrame = function LiveProfileFrame(props) {
let overflowTop2, overflowBottom2, overflowHorizontal2;
const { frame, containerWidth, containerHeight, profileThemeType, frameOrder, filterLayer } = props;
overflowTop2 = void 0;
overflowBottom2 = void 0;
overflowHorizontal2 = void 0;
const styles = useStyles();
const memo = useMemo(() => frame.layers.filter((layer) => {
let r1 = frameOrder == null || frameOrder === layer.order;
if (r1) {
const r0 = filterLayer != null && !filterLayer(layer);
r1 = r0 ? !r0 : profileThemeType === UserProfileThemeTypes.PREVIEW || layer.anchor === "top" && layer.type === "staple";
}
return r1;
}), [frame.layers, frameOrder, profileThemeType, filterLayer]);
if (memo.length !== 0 && containerWidth !== 0) {
const r24 = scaleProfileFrame(frame, containerWidth);
overflowTop2 = r24.overflowTop;
overflowBottom2 = r24.overflowBottom;
overflowHorizontal2 = r24.overflowHorizontal;
return <View style={styles.container}>
{memo.map((item) => <ProfileFrameLayer key={item.id} skuId={frame.skuId} layer={item} overflowTop={overflowTop2} overflowBottom={overflowBottom2} overflowHorizontal={overflowHorizontal2} containerWidth={containerWidth} containerHeight={containerHeight} />)}
</View>;
}
return null;
};
useStyles = createStyles({
container: {
...StyleSheet.absoluteFillObject,
pointerEvents: "none"
},
layer: {
...StyleSheet.absoluteFillObject,
alignItems: "center",
overflow: "hidden"
}
});
export default function ProfileFrame(props) {
const framePreviewOverrideStore = useFramePreviewOverrideStore((a0) => a0.override);
return framePreviewOverrideStore != null ? <FramePreviewOverrideFrame override={framePreviewOverrideStore} {...props} /> : <LiveProfileFrame {...props} />;
};
@@ -0,0 +1,8 @@
// Metro module 8098 (f8099).
import { ProfileFrameLayerOrder } from "../../../../_bundle/Module8088";
const r11 = {};
r11[ProfileFrameLayerOrder.FRONT] = 3;
r11[ProfileFrameLayerOrder.BACK] = 2;
export const PROFILE_FRAME_RESPONSIVE_RAIL_MIN_ASPECT_RATIO = 0.625;
export const PROFILE_FRAME_ASPECT_RATIO = 0.66;
export { r11 as PROFILE_FRAME_Z_INDEX };
@@ -0,0 +1,146 @@
// Metro module 8694 (f8695).
import { StyleSheet, View } from "react-native";
import { SAMPLE_PROFILE_ASPECT_RATIO } from "../../../native/CollectiblesPreviewConstants";
import { UserProfileThemeTypes } from "../../../../user_profile/native/Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import scaleProfileFrame from "../../scaleProfileFrame";
import { useToken } from "../../../../../design/tokens/native/useToken";
import ProfileFrame from "../ProfileFrame";
import { ProfileFrameLayerOrder } from "../../../../../_bundle/Module8088";
import Module5165 from "../../../../../_bundle/Module5165";
import FastImage from "../../../../../components_native/common/FastImage";
import Module8695 from "../../../../../_bundle/Module8695";
let useStyles;
const filterLayer = function filterLayer(a0) {
return a0.responsive !== true;
};
useStyles = createStyles({
profileFrameContainer: {
flex: 1
},
profileContainer: {
flex: 1,
overflow: "hidden",
borderWidth: 1,
borderColor: Module712.colors.BORDER_NORMAL,
borderRadius: Module712.radii.xs
},
sampleProfile: {
width: "100%",
aspectRatio: SAMPLE_PROFILE_ASPECT_RATIO
}
});
export default function ProfileFrameSamplePreview(props) {
const { profileFrame, previewWidth, previewHeight, profileBackgroundColor } = props;
const styles = useStyles();
const innerWidth = profileFrame.innerWidth;
const containerWidth = previewWidth * innerWidth / (innerWidth + 2 * profileFrame.overflowHorizontal);
const r37 = scaleProfileFrame(profileFrame, containerWidth);
const { overflowTop, overflowBottom, overflowHorizontal } = r37;
const token = useToken(profileBackgroundColor);
let r9 = <ProfileFrame frame={profileFrame} filterLayer={filterLayer} profileThemeType={UserProfileThemeTypes.PREVIEW} frameOrder={ProfileFrameLayerOrder.BACK} containerWidth={containerWidth} containerHeight={previewHeight} />;
const xs = Module712.radii.xs;
const r104 = <Module5165 style={{
position: "absolute",
top: -overflowTop,
bottom: -overflowBottom,
left: -overflowHorizontal,
right: -overflowHorizontal
}} maskElement={<View style={StyleSheet.absoluteFill}>
<View style={{
position: "absolute",
top: 0,
left: 0,
right: 0,
height: overflowTop,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
bottom: 0,
left: 0,
right: 0,
height: overflowBottom,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
top: overflowTop,
bottom: overflowBottom,
left: 0,
width: overflowHorizontal,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
top: overflowTop,
bottom: overflowBottom,
right: 0,
width: overflowHorizontal,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
top: overflowTop - xs,
left: overflowHorizontal - xs,
width: 2 * xs,
height: 2 * xs,
borderRadius: xs,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
top: overflowTop - xs,
right: overflowHorizontal - xs,
width: 2 * xs,
height: 2 * xs,
borderRadius: xs,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
bottom: overflowBottom - xs,
left: overflowHorizontal - xs,
width: 2 * xs,
height: 2 * xs,
borderRadius: xs,
backgroundColor: "black"
}} />
<View style={{
position: "absolute",
bottom: overflowBottom - xs,
right: overflowHorizontal - xs,
width: 2 * xs,
height: 2 * xs,
borderRadius: xs,
backgroundColor: "black"
}} />
</View>}>
<View style={{
marginTop: overflowTop,
marginBottom: overflowBottom,
marginHorizontal: overflowHorizontal,
flex: 1
}}>{r9}</View>
</Module5165>;
if (profileBackgroundColor == null) {
r9 = r104;
}
return <View style={[styles.profileFrameContainer, {
width: containerWidth,
marginTop: overflowTop,
marginBottom: overflowBottom,
marginHorizontal: overflowHorizontal
}]}>
{r9}
<View style={[styles.profileContainer, token != null && {
backgroundColor: token
}]}>
<FastImage source={{
uri: Module8695
}} style={styles.sampleProfile} resizeMode="cover" />
</View>
<ProfileFrame frame={profileFrame} filterLayer={filterLayer} profileThemeType={UserProfileThemeTypes.PREVIEW} frameOrder={ProfileFrameLayerOrder.FRONT} containerWidth={containerWidth} containerHeight={previewHeight - overflowTop - overflowBottom} />
</View>;
};
@@ -0,0 +1,9 @@
// Metro module 8745 (f8746).
import UserProfilePreview from "../../../../user_profile/native/UserProfilePreview";
import { intl, t } from "../../../../../intl/index.native";
export default function ProfileFrameUserPreview(props) {
const { profileFrame, ...props2 } = props;
return <UserProfilePreview profileFrameOverride={profileFrame} accessibilityLabel={profileFrame != null ? intl.formatToPlainString(t["DT/PwH"], {
a11y_text: profileFrame.label
}) : intl.string(t.vQx51z)} {...props2} />;
};
@@ -0,0 +1,3 @@
// Metro module 8085 (f8086).
export const OVERRIDE_DIR = "frame_override";
export const MANIFEST_NAME = "manifest.json";
@@ -0,0 +1,108 @@
// Metro module 8100 (f8101).
import { useMemo } from "react";
import { View, StyleSheet } from "react-native";
import { PROFILE_FRAME_RESPONSIVE_RAIL_MIN_ASPECT_RATIO, PROFILE_FRAME_Z_INDEX } from "../ProfileFrameConstants";
import { UserProfileThemeTypes } from "../../../../user_profile/native/Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import FastImage from "../../../../../components_native/common/FastImage";
let useStyles;
const OverrideProfileFrameLayer = function OverrideProfileFrameLayer(props) {
const { layer, uri, ratio, overflowTop, overflowBottom, overflowHorizontal, containerWidth: containerWidth2, containerHeight: containerHeight2 } = props;
const styles = useStyles();
const width = containerWidth2 + 2 * overflowHorizontal;
const height = ratio * width;
const memo = useMemo(() => {
const r1 = {
left: -overflowHorizontal,
right: -overflowHorizontal,
zIndex: PROFILE_FRAME_Z_INDEX[layer.order]
};
const type = layer.type;
if (type === "staple") {
return {
...r1,
top: layer.anchor === "top" ? -overflowTop : void 0,
bottom: layer.anchor === "bottom" ? -overflowBottom : void 0
};
}
if (type === "rail") {
return {
...r1,
justifyContent: layer.anchor !== "center" ? layer.anchor === "top" ? "flex-start" : "flex-end" : "center"
};
}
return {
...r1,
left: -overflowHorizontal
};
}, [layer.anchor, layer.type, layer.order, overflowTop, overflowBottom, overflowHorizontal]);
const r2 = layer.responsive === true && layer.type === "rail" && containerHeight2 != null && containerWidth2 / containerHeight2 >= PROFILE_FRAME_RESPONSIVE_RAIL_MIN_ASPECT_RATIO;
if (height !== 0 && uri != null && !r2) {
if (layer.type === "border") {
if (containerHeight2 != null && containerHeight2 !== 0) {
return <View style={[styles.layer, memo]}>
{Array.from({
length: Math.ceil(containerHeight2 / height)
}, (a0, a1) => <FastImage key={a1} source={{
uri
}} resizeMode="cover" width={width} height={height} />)}
</View>;
}
return null;
}
return <View style={[styles.layer, memo]}>
<FastImage source={{
uri
}} resizeMode="cover" width={width} height={height} />
</View>;
}
return null;
};
useStyles = createStyles({
container: {
...StyleSheet.absoluteFillObject,
pointerEvents: "none"
},
layer: {
...StyleSheet.absoluteFillObject,
alignItems: "center",
overflow: "hidden"
}
});
export default function FramePreviewOverrideFrame(props) {
let overflowTop2, overflowBottom2, overflowHorizontal2;
const { override, containerWidth, containerHeight, profileThemeType, frameOrder, filterLayer } = props;
overflowTop2 = void 0;
overflowBottom2 = void 0;
overflowHorizontal2 = void 0;
const styles = useStyles();
const memo = useMemo(() => override.layers.filter((layer) => {
let r1 = frameOrder == null || frameOrder === layer.order;
if (r1) {
const r0 = filterLayer != null && !filterLayer(layer);
r1 = r0 ? !r0 : profileThemeType === UserProfileThemeTypes.PREVIEW || layer.anchor === "top" && layer.type === "staple";
}
return r1;
}), [override.layers, frameOrder, profileThemeType, filterLayer]);
if (memo.length !== 0 && containerWidth !== 0) {
const r21 = containerWidth / override.innerWidth;
overflowTop2 = override.overflowTop * r21;
overflowBottom2 = override.overflowBottom * r21;
overflowHorizontal2 = override.overflowHorizontal * r21;
return <View style={styles.container}>
{memo.map((item) => {
const r10 = override.layerAssetById[item.id];
let uri2 = r10?.uri;
if (uri2 == null) {
uri2 = null;
}
let ratio = r10?.ratio;
if (ratio == null) {
ratio = 0;
}
return <OverrideProfileFrameLayer key={item.id} layer={item} uri={uri2} ratio={ratio} overflowTop={overflowTop2} overflowBottom={overflowBottom2} overflowHorizontal={overflowHorizontal2} containerWidth={containerWidth} containerHeight={containerHeight} />;
})}
</View>;
}
return null;
};
@@ -0,0 +1,321 @@
// Metro module 8084 (f8085).
import { Image } from "react-native";
import { OVERRIDE_DIR, MANIFEST_NAME } from "./FrameOverrideConstants";
import Logger from "../../../../debug/Logger";
import { readFile } from "../../../../../utils/FileManagerUtils.android";
import Module1271 from "../../../../../_bundle/Module1271";
import { compareLayerFiles, parseLayerFilename, PARSE_ERROR_LABELS, FOLDER_ORDER_MAP } from "../../tooling/ProfileFrameLayerParser";
import { computeProfileFrameDimensions } from "../../tooling/computeProfileFrameDimensions";
import { create } from "../../../../../_bundle/Module644";
function $mk115102($env) {
return function buildOverride() {
return $env[11].apply(this, arguments);
};
}
let c5129_7;
let env5129 = {};
const measure = function measure(c16241_0) {
return new Promise((c26101_0, c26101_1) => {
Image.getSize(c16241_0, (a0, a1) => c26101_0({
width: a0,
height: a1
}), (a0) => c26101_1(a0 instanceof Error ? a0 : new Error(String(a0))));
});
};
env5129[10] = function _readManifest() {
const r8 = async () => {
let c29886_0 = await readFile("documents", `${OVERRIDE_DIR}/${MANIFEST_NAME}`, "utf8");
return c29886_0 != null ? JSON.parse(c29886_0) : null;
};
env5129[10] = r8;
return r8.apply(this, arguments);
};
env5129[11] = function _buildOverride() {
const r8 = async (c26103_0) => {
let r44, r331, r400;
let c26103_1, layers, c26103_3, c26103_4, c26103_5;
let c26103_6 = 0;
const r10 = "Malformed manifest (no layers). Re-push the frame.";
const r9 = env5129;
L37: {
try {
let env29887;
c26103_4 = r9;
const r26 = env29887 = {};
c26103_3 = r26;
env29887[0] = c26103_0;
env29887[1] = void 0;
env29887[2] = void 0;
env29887[3] = void 0;
env29887[4] = void 0;
env29887[5] = void 0;
env29887[6] = void 0;
env29887[7] = void 0;
env29887[8] = void 0;
env29887[9] = void 0;
env29887[10] = void 0;
env29887[11] = void 0;
env29887[12] = void 0;
env29887[13] = void 0;
env29887[14] = void 0;
env29887[15] = void 0;
env29887[16] = void 0;
env29887[17] = void 0;
if (!Array.isArray(c26103_0.layers)) {
throw new Error(r10);
}
env29887[1] = `file://${Module1271.getConstants().DocumentsDirPath}/${OVERRIDE_DIR}`;
env29887[2] = [];
env29887[3] = {};
env29887[4] = [];
layers = c26103_0.layers;
const r72 = layers[Symbol.iterator]();
layers = r72.next;
c26103_1 = r72;
let r79 = c26103_1;
const r80 = r79 === void 0 ? void 0 : (r44 = layers.call(r79)).done ? r79 = void 0 : r44.value;
c26103_1 = r79;
if (r79 === void 0) {
if (env29887[2].length === 0) {
throw new Error("Frame has no valid layers.");
}
env29887[2].sort(compareLayerFiles);
env29887[17] = computeProfileFrameDimensions(env29887[4]);
r400 = {
frameKey: env29887[0].frameKey,
previewUri: env29887[0].preview != null ? `${env29887[1]}/${env29887[0].preview}` : null,
layers: env29887[2].map((item) => item.layer),
layerAssetById: env29887[3],
...env29887[17]
};
break L37;
}
c26103_6 = 1;
env29887[5] = r80;
env29887[6] = env29887[5].folder;
env29887[7] = env29887[5].filename;
env29887[8] = parseLayerFilename(env29887[7]);
env29887[9] = env29887[8].parsed;
env29887[10] = env29887[8].errorType;
if (env29887[9] == null) {
env29887[11] = env29887[10] != null ? PARSE_ERROR_LABELS[env29887[10]] : "invalid";
throw new Error(`Bad layer file "${env29887[6]}/${env29887[7]}": ${env29887[11]}`);
}
env29887[12] = FOLDER_ORDER_MAP[env29887[6]];
env29887[13] = `override-${env29887[12]}-${env29887[9].index}`;
env29887[14] = `${env29887[1]}/${env29887[6]}/${env29887[7]}`;
env29887[15] = {
id: env29887[13],
type: env29887[9].type,
order: env29887[12],
anchor: env29887[9].anchor,
responsive: env29887[9].responsive
};
let r143 = await (0, measure)(env29887[14]);
while (true) {
env29887[16] = r143;
env29887[2].push({
layer: env29887[15],
order: env29887[12],
index: env29887[9].index
});
env29887[3][env29887[13]] = {
uri: env29887[14],
ratio: env29887[16].width > 0 ? env29887[16].height / env29887[16].width : 0
};
env29887[4].push({
layer: env29887[15],
dims: env29887[16]
});
c26103_6 = 0;
let r194 = c26103_1;
const r195 = r194 === void 0 ? void 0 : (r44 = layers.call(r194)).done ? r194 = void 0 : r44.value;
c26103_1 = r194;
if (r194 === void 0) {
if (env29887[2].length === 0) {
throw new Error("Frame has no valid layers.");
}
env29887[2].sort(compareLayerFiles);
env29887[17] = computeProfileFrameDimensions(env29887[4]);
r331 = {
frameKey: env29887[0].frameKey,
previewUri: env29887[0].preview != null ? `${env29887[1]}/${env29887[0].preview}` : null,
layers: env29887[2].map((item) => item.layer),
layerAssetById: env29887[3],
...env29887[17]
};
break;
}
c26103_6 = 1;
env29887[5] = r195;
env29887[6] = env29887[5].folder;
env29887[7] = env29887[5].filename;
env29887[8] = parseLayerFilename(env29887[7]);
env29887[9] = env29887[8].parsed;
env29887[10] = env29887[8].errorType;
if (env29887[9] == null) {
env29887[11] = env29887[10] != null ? PARSE_ERROR_LABELS[env29887[10]] : "invalid";
throw new Error(`Bad layer file "${env29887[6]}/${env29887[7]}": ${env29887[11]}`);
}
env29887[12] = FOLDER_ORDER_MAP[env29887[6]];
env29887[13] = `override-${env29887[12]}-${env29887[9].index}`;
env29887[14] = `${env29887[1]}/${env29887[6]}/${env29887[7]}`;
env29887[15] = {
id: env29887[13],
type: env29887[9].type,
order: env29887[12],
anchor: env29887[9].anchor,
responsive: env29887[9].responsive
};
r143 = await (0, measure)(env29887[14]);
}
} catch ($e) {
const r52 = $e;
let r7 = r52;
c26103_5 = r52;
if (c26103_6 !== 0) {
while (true) {
try {
const r426 = c26103_5;
c26103_6 = 0;
const r428 = c26103_1;
if (r428 !== void 0 && typeof r428.return === "function") {
try {
r428.return();
} catch {}
}
throw r426;
} catch (r424) {
r7 = r424;
c26103_5 = r424;
if (c26103_6 === 0) {
break;
}
}
}
}
throw r7;
}
return r331;
}
return r400;
};
env5129[11] = r8;
return r8.apply(this, arguments);
};
c5129_7 = new Logger("FramePreviewOverrideStore");
env5129[8] = 0;
const r38 = create((c16242_0) => {
let c16242_1 = async () => {
let c26104_0, c26104_1, c26104_2;
let c26104_3 = 0;
const r14 = void 0;
const r13 = env5129;
L21: {
L18: {
L20: {
try {
let env29888;
c26104_1 = r14;
const r17 = env29888 = {
$parent: r13
};
c26104_0 = r17;
env29888[2] = void 0;
env29888[3] = void 0;
env29888[4] = void 0;
env29888[1] = function isStale() {
return env29888[0] !== env5129[8];
};
const r34 = env5129[8] + 1;
env5129[8] = r34;
env29888[0] = r34;
c16242_0({
status: "loading",
error: null
});
c26104_3 = 1;
env29888[2] = await (function readManifest() {
return env5129[10].apply(this, arguments);
})();
if ((0, env29888[1])()) {
c26104_3 = 0;
break L21;
}
if (env29888[2] == null) {
(0, c16242_0)({
status: "error",
error: "No frame on device. Ask Cap to push one (or run pushFrameOverride.mjs)."
});
c26104_3 = 0;
break L20;
}
const r71 = env29888[2];
env29888[3] = await $mk115102(env5129)(r71);
if (!(0, env29888[1])()) {
(0, c16242_0)({
override: env29888[3],
status: "idle",
error: null
});
c26104_3 = 0;
break L18;
}
c26104_3 = 0;
} catch ($e) {
const r30 = $e;
let r7 = r30;
c26104_2 = r30;
if (c26104_3 !== 0) {
while (true) {
try {
const r111 = c26104_2;
c26104_3 = 0;
env29888[5] = r111;
if (!(0, env29888[1])()) {
env29888[4] = env29888[5] instanceof Error ? env29888[5].message : String(env29888[5]);
c5129_7.error("Failed to load frame override", env29888[5]);
(0, c16242_0)({
status: "error",
error: env29888[4]
});
break L18;
}
} catch (r108) {
r7 = r108;
c26104_2 = r108;
if (c26104_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r7;
}
return void 0;
}
return void 0;
}
return void 0;
}
};
return {
override: null,
status: "idle",
error: null,
loadFromDevice: function() {
return c16242_1.apply(this, arguments);
},
clear: () => {
env5129[8] = env5129[8] + 1;
c16242_0({
override: null,
status: "idle",
error: null
});
}
};
});
export { r38 as useFramePreviewOverrideStore };
@@ -0,0 +1,39 @@
// Metro module 8099 (f8100).
import { useReducer, useEffect } from "react";
import { Image as Image2, PixelRatio } from "react-native";
import { getCollectiblesItemAssetUrl, CollectiblesItemAssetFormat } from "../../utils/CollectiblesAssetUtils";
let c5137_6 = new Map();
export default function useProfileFrameLayerAsset({ skuId, layer, width }) {
const collectiblesItemAssetUrl = getCollectiblesItemAssetUrl({
skuId,
assetFormat: CollectiblesItemAssetFormat.STATIC,
assetId: layer.id
});
const [, dispatch] = useReducer((a0) => a0 + 1, 0);
useEffect(() => {
if (!(collectiblesItemAssetUrl == null || collectiblesItemAssetUrl === "" || c5137_6.has(collectiblesItemAssetUrl))) {
Image2.getSize(collectiblesItemAssetUrl, (a0, a1) => {
if (a0 > 0) {
c5137_6.set(collectiblesItemAssetUrl, a1 / a0);
dispatch();
}
}, () => {});
}
}, [collectiblesItemAssetUrl]);
const r40 = collectiblesItemAssetUrl != null ? c5137_6.get(collectiblesItemAssetUrl) : void 0;
const imageHeight = r40 != null ? r40 * width : 0;
const r45 = collectiblesItemAssetUrl != null;
let assetUrl = null;
if (r45) {
const r47 = r40 != null;
assetUrl = null;
if (r47) {
const r55 = Math.round(width * PixelRatio.get());
assetUrl = `${collectiblesItemAssetUrl}?width=${r55}&height=${Math.round(r55 * r40)}`;
}
}
return {
assetUrl,
imageHeight
};
};
@@ -0,0 +1,9 @@
// Metro module 8096 (f8097).
export default function scaleProfileFrame(a0, a1) {
const r4 = a1 / a0.innerWidth;
return {
overflowTop: a0.overflowTop * r4,
overflowBottom: a0.overflowBottom * r4,
overflowHorizontal: a0.overflowHorizontal * r4
};
};
@@ -0,0 +1,131 @@
// Metro module 8087 (f8088).
import _toArray from "../../../../_bundle/_toArray";
import { ProfileFrameLayerOrder } from "../../../../_bundle/Module8088";
import { ProfileFrameLayerType } from "../../../../_bundle/Module8089";
import { ProfileFrameLayerAnchor } from "../../../../_bundle/Module8090";
let c5131_3 = "preview";
let c5131_4 = "responsive";
const r33 = {
foreground: ProfileFrameLayerOrder.FRONT,
background: ProfileFrameLayerOrder.BACK
};
let c5131_5 = new Set([ProfileFrameLayerType.STAPLE, ProfileFrameLayerType.RAIL, ProfileFrameLayerType.BORDER]);
let c5131_6 = new Set([ProfileFrameLayerAnchor.TOP, ProfileFrameLayerAnchor.BOTTOM, ProfileFrameLayerAnchor.CENTER]);
let c5131_7 = {
WRONG_PART_COUNT: "wrong_part_count",
INVALID_INDEX: "invalid_index",
INVALID_TYPE: "invalid_type",
INVALID_ANCHOR: "invalid_anchor",
INVALID_RESPONSIVE: "invalid_responsive",
BORDER_HAS_ANCHOR: "border_has_anchor"
};
const r79 = {};
r79[c5131_7.WRONG_PART_COUNT] = "wrong filename format";
r79[c5131_7.INVALID_INDEX] = "invalid index";
r79[c5131_7.INVALID_TYPE] = `invalid type (expected: ${[...c5131_5].join(", ")})`;
r79[c5131_7.INVALID_ANCHOR] = `invalid anchor (expected: ${[...c5131_6].join(", ")})`;
r79[c5131_7.INVALID_RESPONSIVE] = `invalid suffix (expected 'responsive')`;
r79[c5131_7.BORDER_HAS_ANCHOR] = "border layers must omit the anchor";
const r109 = {};
r109[ProfileFrameLayerOrder.FRONT] = 0;
r109[ProfileFrameLayerOrder.BACK] = 1;
let c5131_8 = r109;
export const PREVIEW_FILENAME = "preview";
export const RESPONSIVE_KEYWORD = "responsive";
export { r33 as FOLDER_ORDER_MAP };
export { c5131_7 as ParseErrorKind };
export { r79 as PARSE_ERROR_LABELS };
export function parseLayerFilename(a0) {
const r18 = a0.replace(/\.\w+$/, "").split("_");
if (!(r18.length < 2) && !(r18.length > 4)) {
const r22 = _toArray(r18);
const r13 = r22[0];
const type = r22[1];
const r24 = r22.slice(2);
if (/^\d+$/.test(r13)) {
if (c5131_5.has(type)) {
if (type === ProfileFrameLayerType.BORDER) {
if (r24.length > 0 && c5131_6.has(r24[0])) {
return {
parsed: null,
errorType: c5131_7.BORDER_HAS_ANCHOR
};
}
if (r24.length > 1) {
return {
parsed: null,
errorType: c5131_7.WRONG_PART_COUNT
};
}
if (r24.length === 1 && r24[0] !== c5131_4) {
return {
parsed: null,
errorType: c5131_7.INVALID_RESPONSIVE
};
}
const length = r24.length;
return {
parsed: {
index: Number(r13),
type,
anchor: ProfileFrameLayerAnchor.CENTER,
responsive: length === 1
},
errorType: null
};
}
const anchor = r24[0];
if (anchor != null && c5131_6.has(anchor)) {
if (r24.length > 2) {
return {
parsed: null,
errorType: c5131_7.WRONG_PART_COUNT
};
}
if (r24.length === 2 && r24[1] !== c5131_4) {
return {
parsed: null,
errorType: c5131_7.INVALID_RESPONSIVE
};
}
const responsive = r24.length === 2 || type === ProfileFrameLayerType.RAIL;
return {
parsed: {
index: Number(r13),
type,
anchor,
responsive
},
errorType: null
};
}
return {
parsed: null,
errorType: c5131_7.INVALID_ANCHOR
};
}
return {
parsed: null,
errorType: c5131_7.INVALID_TYPE
};
}
return {
parsed: null,
errorType: c5131_7.INVALID_INDEX
};
}
return {
parsed: null,
errorType: c5131_7.WRONG_PART_COUNT
};
}
export function compareLayerFiles(a0, a1) {
let r9 = c5131_8[a0.order] - c5131_8[a1.order];
if (r9 === 0) {
r9 = a0.index - a1.index;
}
return r9;
}
export function isPreviewFilename(a0) {
return a0.replace(/\.\w+$/, "") === c5131_3;
}
@@ -0,0 +1,34 @@
// Metro module 8091 (f8092).
import { DefaultProfileFrameDimensions } from "../../../../_bundle/Module8092";
import { ProfileFrameLayerType } from "../../../../_bundle/Module8089";
import { ProfileFrameLayerAnchor } from "../../../../_bundle/Module8090";
export function computeProfileFrameDimensions(a0) {
const INNER_WIDTH = DefaultProfileFrameDimensions.INNER_WIDTH;
const r10 = a0.map((item) => Math.round(Math.max(0, (item.dims.width - INNER_WIDTH) / 2)));
const r21 = r10.length > 0;
let overflowHorizontal = 0;
if (r21) {
const r8 = Math;
overflowHorizontal = r8.max.apply(r8, [...r10]);
}
const r11 = a0.filter(({ layer }) => layer.type === ProfileFrameLayerType.STAPLE && layer.anchor === ProfileFrameLayerAnchor.TOP).map((item) => Math.max(0, item.dims.height - (716 - DefaultProfileFrameDimensions.OVERFLOW_TOP)));
const r35 = r11.length > 0;
let overflowTop = 0;
if (r35) {
const r38 = Math;
overflowTop = r38.max.apply(r38, [...r11]);
}
const r53 = a0.filter(({ layer }) => layer.type === ProfileFrameLayerType.STAPLE && layer.anchor === ProfileFrameLayerAnchor.BOTTOM).map((item) => Math.max(0, item.dims.height - (424 - DefaultProfileFrameDimensions.OVERFLOW_BOTTOM)));
const r55 = r53.length > 0;
let overflowBottom = 0;
if (r55) {
const r58 = Math;
overflowBottom = r58.max.apply(r58, [...r53]);
}
return {
innerWidth: INNER_WIDTH,
overflowTop,
overflowBottom,
overflowHorizontal
};
}