Files
discord-decomp/sources/modules/devtools/native/components/DevWidget.tsx
T
2026-07-27 16:20:00 +03:00

193 lines
12 KiB
TypeScript

/* Metro module 14282; source: modules/devtools/native/components/DevWidget.tsx; dependencies: [31, 7111, 695, 33, 4501, 697, 4017, 11281, 14283, 5321, 4577, 4581, 5278, 13121, 13969, 14284, 13126, 2] */
function _fun108017(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108017, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:6, offset: 0x02311eb6, size: 462 bytes, params: 8, frame: 24
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = importAll(31) /* metro dependency 31 */;
const devToolsSettingsStore = importDefault(7111) /* metro dependency 7111: DevToolsSettingsStore */;
const DEV_WIDGET_SIZE = (require(695) /* metro dependency 695: Constants */).DEV_WIDGET_SIZE;
const value2 = require(33) /* metro dependency 33 */;
const env0_6 = value2.jsx;
const env0_7 = value2.Fragment;
const env0_8 = value2.jsxs;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
const object2 = {'backgroundColor': null, 'justifyContent': 'center', 'alignItems': 'center'};
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object2.backgroundColor = BACKGROUND_BRAND;
object2.height = DEV_WIDGET_SIZE;
object2.width = DEV_WIDGET_SIZE;
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xl;
const SHADOW_MOBILE_NAVIGATOR_X = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_MOBILE_NAVIGATOR_X;
copyDataProperties(object2, SHADOW_MOBILE_NAVIGATOR_X, undefined);
const env0_9 = Reflect.apply(createStyles, createStylesModule, [{widgetContainer: {position: 'absolute'},
widget: object2}]);
object = {code: 'function DevWidgetTsx1(x,y){const{windowDimensionsSharedValue,insetsSharedValue,clamp,dragBoundsPadding,contentWidth,contentHeight}=this.__closure;const{width:windowWidth,height:windowHeight}=windowDimensionsSharedValue.get();const insets=insetsSharedValue.get();return{x:clamp(x,insets.left+dragBoundsPadding,windowWidth-insets.right-contentWidth-dragBoundsPadding),y:clamp(y,insets.top+dragBoundsPadding,windowHeight-insets.bottom-contentHeight-dragBoundsPadding)};}'};
object = {code: 'function DevWidgetTsx2(){const{runOnJS,onChangePosition,x,y}=this.__closure;runOnJS(onChangePosition)({x:x.get(),y:y.get()});}'};
object = {code: 'function DevWidgetTsx3(event){const{getClampedPosition,originalX,originalY,x,y}=this.__closure;const{x:xClamped,y:yClamped}=getClampedPosition(originalX.get()+event.translationX,originalY.get()+event.translationY);x.set(xClamped);y.set(yClamped);}'};
object = {code: 'function DevWidgetTsx4(){const{originalX,x,originalY,y}=this.__closure;originalX.set(x.get());originalY.set(y.get());}'};
object = {code: 'function DevWidgetTsx5(){const{getClampedPosition,x,y,withSpring,springUnclamped}=this.__closure;const{x:translateX,y:translateY}=getClampedPosition(x.get(),y.get());return{transform:[{translateX:withSpring(translateX,springUnclamped)},{translateY:withSpring(translateY,springUnclamped)}]};}'};
const env0_16 = value.memo(_fun108024);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/devtools/native/components/DevWidget.tsx');
exports.default = DevWidget;
}
function DraggableContainer({x, y, contentWidth, contentHeight, dragBoundsPadding, onChangePosition, children}) { // fn#108018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:1768, offset: 0x02312084, size: 817 bytes, params: 2, frame: 33
const env0_3 = contentHeight;
dragBoundsPadding = dragBoundsPadding === undefined ? 0 : dragBoundsPadding;
const styles = useStyles();
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
let useSharedValue = reanimatedRexportModule.useSharedValue;
let get = x.get;
const value2 = Reflect.apply(useSharedValue, reanimatedRexportModule, [Reflect.apply(get, x, [])]);
const moduleValue2 = reanimatedRexportModule;
useSharedValue = moduleValue2.useSharedValue;
get = y.get;
const value3 = Reflect.apply(useSharedValue, moduleValue2, [Reflect.apply(get, y, [])]);
const value4 = (importDefault(11281) /* metro dependency 11281: useSafeAreaInsetsSharedValueNative */)();
const value5 = (importDefault(14283) /* metro dependency 14283: useWindowDimensionsSharedValueNative */)();
const binding = env0_3;
const useCallback = binding.useCallback;
let closure = DraggableContainerP;
let object2 = {windowDimensionsSharedValue: value5, insetsSharedValue: value4};
object2.clamp = reanimatedRexportModule.clamp;
object2.dragBoundsPadding = dragBoundsPadding;
object2.contentWidth = contentWidth;
object2.contentHeight = contentHeight;
closure.__closure = object2;
closure.__workletHash = 729779775192;
closure.__initData = undefined;
const value6 = Reflect.apply(useCallback, binding, [closure, [contentHeight, contentWidth, dragBoundsPadding,
value4, value5]]);
const Gesture = (require(5321) /* metro dependency 5321 */).Gesture;
const value7 = Gesture.Pan();
const onStart = value7.onStart;
closure = DraggableContainerC;
closure.__closure = {originalX: value2, x: x, originalY: value3, y: y};
closure.__workletHash = 7165614533762;
closure.__initData = env0_13;
const value8 = Reflect.apply(onStart, value7, [closure]);
const onUpdate = value8.onUpdate;
closure = DraggableContainerD;
closure.__closure = {getClampedPosition: value6, originalX: value2, originalY: value3, x: x, y: y};
closure.__workletHash = 10056531764801;
closure.__initData = env0_12;
const value9 = Reflect.apply(onUpdate, value8, [closure]);
const onEnd = value9.onEnd;
closure = DraggableContainerF;
closure.__closure = {runOnJS: reanimatedRexportModule.runOnJS, onChangePosition: onChangePosition, x: x, y: y};
closure.__workletHash = 12890758993684;
closure.__initData = env0_11;
const value10 = Reflect.apply(onEnd, value9, [closure]);
const moduleValue3 = reanimatedRexportModule;
const useAnimatedStyle = moduleValue3.useAnimatedStyle;
closure = DraggableContainerW;
object2 = {getClampedPosition: value6, x: x, y: y};
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.springUnclamped = (require(4581) /* metro dependency 4581: springPresets */).springUnclamped;
closure.__closure = object2;
closure.__workletHash = 6251354551691;
closure.__initData = env0_14;
const value11 = Reflect.apply(useAnimatedStyle, moduleValue3, [closure]);
const GestureDetector = (require(5321) /* metro dependency 5321 */).GestureDetector;
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
return (
<GestureDetector gesture={value10}>
<View style={[styles.widgetContainer, value11]}>
{children}
</View>
</GestureDetector>
);
}
function _fun108024() { // fn#108024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:3426, offset: 0x02312610, size: 141 bytes, params: 1, frame: 16
const styles = useStyles();
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
const pressableOpacityProps = {style: styles.widget, accessibilityRole: 'button', onPress: onPress_108025,
activeOpacity: 0.5};
const StaffBadgeIcon = (require(13969) /* metro dependency 13969: StaffBadgeIcon */).StaffBadgeIcon;
return (
<PressableOpacity {...pressableOpacityProps}>
<StaffBadgeIcon size="md" color="white" />
</PressableOpacity>
);
}
function DevWidget() { // fn#108026, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:3744, offset: 0x023126c2, size: 244 bytes, params: 1, frame: 22
const value2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(DevToolsSettingsStore.devWidgetPosition.x);
const value3 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(DevToolsSettingsStore.devWidgetPosition.y);
const jsxRuntimeEnv0_7Binding = jsxRuntimeEnv0_7;
const value4 = ((Component) => <Component x={value2} y={value3} />)(importDefault(14284) /* metro dependency 14284: VEVOO */);
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
return (
<>
{value4}
<DraggableContainer
x={value2}
y={value3}
contentWidth={DEV_WIDGET_SIZE}
contentHeight={DEV_WIDGET_SIZE}
dragBoundsPadding={PX_4}
onChangePosition={onChangePosition}
>
{((Component) => <Component />)(env0_16)}
</DraggableContainer>
</>
);
}
function DraggableContainerP(a0, a1) { // fn#108019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:1996, owner: DraggableContainer.P, offset: 0x023123b5, size: 181 bytes, params: 3, frame: 24
const {width, height} = env0_9.get();
const value3 = env0_8.get();
const object2 = {};
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const clamp = reanimatedRexportModule.clamp;
const left = value3.left;
const dragBoundsPaddingBinding = dragBoundsPadding;
object2.x = Reflect.apply(clamp, reanimatedRexportModule, [a0, left + dragBoundsPaddingBinding,
width - value3.right - contentWidth - dragBoundsPaddingBinding]);
const moduleValue2 = reanimatedRexportModule;
object2.y = moduleValue2.clamp(a1, value3.top + dragBoundsPaddingBinding,
height - value3.bottom - contentHeight - dragBoundsPaddingBinding);
return object2;
}
function DraggableContainerF() { // fn#108022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:2751, owner: DraggableContainer.f, offset: 0x0231250f, size: 85 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = Reflect.apply((require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS, value,
[onChangePosition]);
const object2 = {};
object2.x = x.get();
object2.y = y.get();
value(object2);
}
function DraggableContainerW() { // fn#108023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:2949, owner: DraggableContainer.W, offset: 0x02312564, size: 172 bytes, params: 1, frame: 21
const binding = env0_10;
const value2 = x.get();
let value = y.get();
value = binding(value2, value);
const x2 = value.x;
const y2 = value.y;
value = environment.__proto__;
value = require(4577) /* metro dependency 4577: spring */;
const withSpring = value.withSpring;
const springUnclamped = (require(4581) /* metro dependency 4581: springPresets */).springUnclamped;
const items2 = [{translateX: Reflect.apply(withSpring, value, [x2, springUnclamped])}];
const object = {};
object.translateY = (require(4577) /* metro dependency 4577: spring */).withSpring(y2, springUnclamped);
items2[1] = object;
return {transform: items2};
}
function onPress_108025() { // fn#108025, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:3533, offset: 0x0231269d, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__;
return (require(13121) /* metro dependency 13121: DevToolsNavigator */).navigateToDevTools();
}
function onChangePosition(a0) { // fn#108027, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14479:4024, owner: DevWidget.onChangePosition, offset: 0x023127b6, size: 48 bytes, params: 2, frame: 12
const value = environment.__proto__;
return (require(13126) /* metro dependency 13126: DevToolsActionCreators */).updateDevToolsSettings({devWidgetPosition: a0});
}