163 lines
7.1 KiB
TypeScript
163 lines
7.1 KiB
TypeScript
/* Metro module 11035; source: modules/gif_picker/native/GIFPickerUtils.tsx; dependencies: [31, 661, 1471, 9598, 9813, 1244, 2] */
|
|
function _fun84487(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:6, offset: 0x01f4c728, size: 246 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const env0_4 = (require(661) /* metro dependency 661: Constants */).GIFPickerResultTypes;
|
|
const env0_5 = RegExp('(https?:\\/\\/)(?!media(?:\\d+)?\\.)(?:[^.]+\\.)*giphy\\.com', '');
|
|
const env0_6 = RegExp('(tenor\\.com)', '');
|
|
const env0_7 = RegExp('-(?:.(?!-))+$', '');
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/gif_picker/native/GIFPickerUtils.tsx');
|
|
exports.GIF_HEADER_HEIGHT = 56;
|
|
exports.useFavoriteGIFsMobile = useFavoriteGIFsMobile;
|
|
exports.GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180;
|
|
exports.GIF_PICKER_GUTTER_SPACING = 8;
|
|
exports.DEFAULT_CATEGORY_ROWS = 20;
|
|
}
|
|
|
|
function transformFavoriteGifUrl(a0, a1) { // fn#84488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:255, offset: 0x01f4c81e, size: 455 bytes, params: 3, frame: 20
|
|
var r3;
|
|
var pathname;
|
|
var value6;
|
|
var value8;
|
|
var value10;
|
|
var binding;
|
|
let value = a0;
|
|
const value3 = undefined;
|
|
const value4 = (importDefault(1471) /* metro dependency 1471: URLUtils */).toURLSafe(value);
|
|
if (value4 == null) {
|
|
binding = env0_5;
|
|
if (binding.test(a1)) {
|
|
value = env0_7.exec(a1);
|
|
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
|
|
r3 = value;
|
|
} else {
|
|
binding = env0_6;
|
|
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
|
|
}
|
|
} else {
|
|
var moduleValue = require(9598) /* metro dependency 9598: SignedAttachmentLinkUtils */;
|
|
if (moduleValue.isExternalProxiedAttachmentUrl(value4)) {
|
|
pathname = value4.pathname;
|
|
value6 = pathname.toLowerCase().endsWith('.webp');
|
|
pathname = value4.pathname;
|
|
value8 = pathname.toLowerCase().endsWith('.avif');
|
|
pathname = value4.pathname;
|
|
value10 = pathname.toLowerCase().endsWith('.gif');
|
|
if (value6) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
if (value8) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
if (value10) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
binding = env0_5;
|
|
if (binding.test(a1)) {
|
|
value = env0_7.exec(a1);
|
|
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
|
|
r3 = value;
|
|
} else {
|
|
binding = env0_6;
|
|
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
|
|
}
|
|
return r3;
|
|
}
|
|
var moduleValue2 = require(9598) /* metro dependency 9598: SignedAttachmentLinkUtils */;
|
|
if (moduleValue2.isAttachmentUrl(value4)) {
|
|
pathname = value4.pathname;
|
|
value6 = pathname.toLowerCase().endsWith('.webp');
|
|
pathname = value4.pathname;
|
|
value8 = pathname.toLowerCase().endsWith('.avif');
|
|
pathname = value4.pathname;
|
|
value10 = pathname.toLowerCase().endsWith('.gif');
|
|
if (value6) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
if (value8) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
if (value10) {
|
|
if (value8 || value10) {
|
|
value4.searchParams.set('format', 'webp');
|
|
}
|
|
value4.searchParams.set('animated', 'true');
|
|
return value4.toString();
|
|
}
|
|
binding = env0_5;
|
|
if (binding.test(a1)) {
|
|
value = env0_7.exec(a1);
|
|
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
|
|
r3 = value;
|
|
} else {
|
|
binding = env0_6;
|
|
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
|
|
}
|
|
return r3;
|
|
}
|
|
if (Reflect.apply(env0_5.test, binding, [a1])) {
|
|
value = env0_7.exec(a1);
|
|
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
|
|
r3 = value;
|
|
} else {
|
|
binding = env0_6;
|
|
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
|
|
}
|
|
}
|
|
return r3;
|
|
}
|
|
|
|
function useFavoriteGIFsMobile() { // fn#84489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:892, offset: 0x01f4c9e5, size: 90 bytes, params: 1, frame: 15
|
|
const value2 = (require(9813) /* metro dependency 9813: FavoriteGIFHooks */).useSortedFavoriteGIFs(transformFavoriteGifUrl);
|
|
const binding = env0_3;
|
|
const useMemo = binding.useMemo;
|
|
let object = [value2];
|
|
object = {favorites: value2, favoritesCategory: Reflect.apply(useMemo, binding, [_fun84490, object])};
|
|
return object;
|
|
}
|
|
|
|
function _fun84490() { // fn#84490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:999, offset: 0x01f4ca3f, size: 140 bytes, params: 1, frame: 18
|
|
var r0;
|
|
var object2;
|
|
var value3;
|
|
var intl;
|
|
var binding;
|
|
if (env0_0.length > 0) {
|
|
object2 = {};
|
|
value3 = environment.__proto__;
|
|
object2.type = GIFPickerResultTypes.FAVORITES;
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
object2.name = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.k8fFjp);
|
|
binding = env0_0;
|
|
object2.src = binding[0].src;
|
|
object2.format = binding[0].format;
|
|
r0 = object2;
|
|
} else {
|
|
r0 = undefined;
|
|
}
|
|
return r0;
|
|
}
|
|
|