decord/source/components_native/common/IconUploader.tsx

183 lines
5.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 9831
// Function ID: 9832
2026-07-20 16:05:17 +00:00
// Name: IconUploader
2026-08-25 06:04:03 +00:00
// Dependencies: [5, 19, 17, 676, 21, 4380, 4963, 5885, 1435, 9832, 4949, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 9831 (IconUploader)
2026-08-24 06:08:38 +00:00
import getSystemLocale from "getSystemLocale" /* 1236 */;
import getAvatarURL from "getAvatarURL" /* 1435 */;
2026-08-25 06:04:03 +00:00
import PressableBase from "PressableBase" /* 4949 */;
import GuildIconSizes from "GuildIconSizes" /* 5885 */;
import GuildIconSizesDefault from "GuildIconSizes" /* 5885 */;
import registerAssetDefault from "registerAsset" /* 9832 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import { UPLOAD_MEDIUM_SIZE } from "ME" /* 676 */;
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
({ View: c5, Image: closure_6 } = get_ActivityIndicator);
2026-08-24 06:08:38 +00:00
({ jsx: closure_8, Fragment: c9, jsxs: c10 } = jsxProd);
2026-07-29 08:29:29 +00:00
let closure_11 = createCacheKey.createStyles({ uploadIcon: { position: "absolute", right: -7, top: -7 }, avatar: { height: 64, width: 64, borderRadius: 32 } });
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("components_native/common/IconUploader.tsx");
2026-07-20 16:05:17 +00:00
export default function IconUploader(disabled) {
let flag = disabled.disabled;
if (flag === undefined) {
flag = false;
}
let fn = disabled.makeURL;
if (fn === undefined) {
fn = function u(icon) {
};
}
let str = disabled.type;
if (str === undefined) {
str = "avatar";
}
2026-07-23 10:11:24 +00:00
({ name, icon, onUpload: require, iconStyle, onChangeIconPress: importDefault } = disabled);
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-20 16:05:17 +00:00
function _handleChangeIcon(arg0) {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = _handleChangeIcon(function*() {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === ref) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
2026-07-29 08:29:29 +00:00
let base64 = tmp2;
base64 = undefined;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
closure_1_1();
2026-07-29 08:29:29 +00:00
}
if (ref.current) {
c3 = 3;
} else {
ref.current = true;
2026-08-24 06:08:38 +00:00
obj1 = closure_1_1(ref[6]);
2026-07-29 08:29:29 +00:00
obj1 = { size: null };
2026-08-24 06:08:38 +00:00
obj1[0] = closure_1_7;
2026-07-29 08:29:29 +00:00
c3 = 1;
const obj2 = { value: null, done: false };
obj2[0] = obj1.openImagePicker(obj1);
return obj2;
}
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 !== 2) {
base64 = arg1.base64;
if (null != base64) {
if (base64 != null) {
tmp10(base64);
}
}
ref.current = false;
}
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp22) {
c3 = tmp;
throw tmp22;
}
}
});
2026-08-24 06:08:38 +00:00
closure_3 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp = callback2();
2026-07-23 10:11:24 +00:00
dependencyMap = React.useRef(false);
2026-07-20 16:05:17 +00:00
if (null == icon) {
let fnResult = fn(icon);
} else {
let obj = /^data:/;
fnResult = icon;
}
if ("guild" === str) {
if (!tmp8) {
2026-07-29 08:29:29 +00:00
obj = { style: null, icon: null, value: null, size: null, animate: true };
obj[0] = iconStyle;
obj[1] = fnResult;
obj[2] = name;
2026-08-24 06:08:38 +00:00
obj[3] = GuildIconSizes.GuildIconSizes.XLARGE;
let tmp7 = callback(GuildIconSizesDefault, obj);
const tmp12 = GuildIconSizesDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
tmp8 = null == icon && null == name;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
obj1 = getAvatarURL;
2026-07-29 08:29:29 +00:00
obj = { style: null, source: null };
2026-07-20 16:05:17 +00:00
const items = [tmp.avatar, iconStyle];
2026-07-29 08:29:29 +00:00
obj[0] = items;
obj[1] = obj1.makeSource(fnResult);
2026-07-20 16:05:17 +00:00
tmp7 = callback(closure_6, obj);
}
const items1 = [tmp7, ];
let tmp16 = null;
if (!flag) {
2026-07-29 08:29:29 +00:00
obj1 = { style: null, source: null };
obj1[0] = tmp.uploadIcon;
2026-08-24 06:08:38 +00:00
obj1[1] = registerAssetDefault;
2026-07-29 08:29:29 +00:00
tmp16 = callback(closure_6, obj1);
2026-07-20 16:05:17 +00:00
}
items1[1] = tmp16;
2026-07-29 08:29:29 +00:00
const tmp14Result = closure_10(closure_9, { children: items1 });
2026-07-20 16:05:17 +00:00
let tmp22 = tmp14Result;
if (!flag) {
2026-07-29 08:29:29 +00:00
let obj2 = { style: null, children: null };
obj2[0] = disabled.style;
const obj3 = { accessibilityRole: "button", accessibilityLabel: null, onPress: null, children: null };
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
obj3[1] = intl.string(getSystemLocale.t["MsUY/S"]);
2026-07-29 08:29:29 +00:00
obj3[2] = function handleChangeIcon() {
const self = this;
const apply = _handleChangeIcon.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj3[3] = tmp14Result;
2026-08-24 06:08:38 +00:00
obj2[1] = callback(PressableBase.PressableOpacity, obj3);
2026-07-29 08:29:29 +00:00
tmp22 = callback(closure_5, obj2);
2026-07-20 16:05:17 +00:00
}
return tmp22;
};