decord/source/modules/gif_picker/native/GIFPickerUtils.tsx

84 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 9539
2026-07-27 11:26:19 +00:00
// Function ID: 74465
2026-07-20 16:05:17 +00:00
// Name: transformFavoriteGifUrl
2026-07-25 08:10:48 +00:00
// Dependencies: [31, 653, 1443, 9538, 9540, 1212, 2]
2026-07-20 16:05:17 +00:00
// Exports: useFavoriteGIFsMobile
2026-07-25 08:10:48 +00:00
// Module 9539 (transformFavoriteGifUrl)
2026-07-23 10:11:24 +00:00
import result from "result";
const require = arg1;
function transformFavoriteGifUrl(outer1_0) {
let combined = outer1_0;
const str = importDefault(1443).toURLSafe(outer1_0);
2026-07-20 16:05:17 +00:00
if (null != str) {
if (obj6.isExternalProxiedAttachmentUrl(str)) {
const formatted = str.pathname.toLowerCase();
const formatted1 = str.pathname.toLowerCase();
let endsWithResult1 = formatted1.endsWith(".avif");
const formatted2 = str.pathname.toLowerCase();
const endsWithResult2 = formatted2.endsWith(".gif");
if (!endsWithResult1) {
endsWithResult1 = endsWithResult2;
}
if (endsWithResult1) {
const searchParams = str.searchParams;
const result = searchParams.set("format", "webp");
}
const searchParams2 = str.searchParams;
const result1 = searchParams2.set("animated", "true");
return str.toString();
} else {
2026-07-25 08:10:48 +00:00
const obj2 = require(9538) /* isAttachmentUrl */;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
obj6 = require(9538) /* isAttachmentUrl */;
2026-07-20 16:05:17 +00:00
}
if (regex.test(arg1)) {
const match = regex3.exec(arg1);
let substr;
if (null != match) {
const first = match[0];
if (null != first) {
substr = first.slice(1);
}
}
const _HermesInternal2 = HermesInternal;
combined = "https://media.giphy.com/media/" + substr + "/giphy.gif";
} else if (regex2.test(arg1)) {
const _HermesInternal = HermesInternal;
combined = "" + arg1 + ".gif";
}
return combined;
}
2026-07-23 10:11:24 +00:00
require("ME").GIFPickerResultTypes;
const re5 = /(https?:\/\/)(?!media(?:\d+)?\.)(?:[^.]+\.)*giphy\.com/;
const re6 = /(tenor\.com)/;
const re7 = /-(?:.(?!-))+$/;
let result = require("isOriginalContentTypeDifferent").fileFinishedImporting("modules/gif_picker/native/GIFPickerUtils.tsx");
2026-07-20 16:05:17 +00:00
export const GIF_HEADER_HEIGHT = 56;
export const useFavoriteGIFsMobile = function useFavoriteGIFsMobile() {
2026-07-25 08:10:48 +00:00
let obj = sortedFavoriteGIFs(9540);
2026-07-23 10:11:24 +00:00
sortedFavoriteGIFs = obj.useSortedFavoriteGIFs(transformFavoriteGifUrl);
2026-07-20 16:05:17 +00:00
const items = [sortedFavoriteGIFs];
obj = {
favorites: sortedFavoriteGIFs,
favoritesCategory: React.useMemo(() => {
let tmp;
if (sortedFavoriteGIFs.length > 0) {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_4.FAVORITES };
const intl = sortedFavoriteGIFs(outer1_2[5]).intl;
obj.name = intl.string(sortedFavoriteGIFs(outer1_2[5]).t.k8fFjp);
2026-07-20 16:05:17 +00:00
obj.src = sortedFavoriteGIFs[0].src;
obj.format = sortedFavoriteGIFs[0].format;
tmp = obj;
}
return tmp;
}, items)
};
return obj;
};
export const GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180;
export const GIF_PICKER_GUTTER_SPACING = 8;
export const DEFAULT_CATEGORY_ROWS = 20;