1216 lines
45 KiB
TypeScript
1216 lines
45 KiB
TypeScript
// Module ID: 8895
|
|
// Function ID: 8896
|
|
// Name: isValidImageAttachment
|
|
// Dependencies: [19, 17, 676, 4532, 1403, 5950, 5955, 1492, 8367, 8248, 4677, 8100, 4566, 1954, 8261, 8277, 1370, 8781, 691, 4061, 8896, 4684, 1236, 8897, 2]
|
|
// Exports: downloadMediaAsset, downloadMediaAssetWithContentType, extractMediaFromMessageComponents, extractMediaSourcesFromComponent, extractMediaSourcesFromEmbed, extractMediaSourcesFromMessage, flattenSource, getAttachmentUrl, getEmbedMedia, getEmbedUrl, getSelectedMediaSource, getVideoSourceType, getYoutubeClipVideoIdFromURI, getYoutubeVideoIdFromURI, isAnimatedAvifSource, isAnimatedImageSource, isAnimatedWebpSource, isGIFSource, isThumbnailAttachment, isValidImageEmbed, isValidVideoAttachment, isValidVideoEmbed, setMediaSourcePortal, supportOverlayVideoControls, useSelectedMediaSource
|
|
|
|
// Module 8895 (isValidImageAttachment)
|
|
import presentAddedFriendToast from "presentAddedFriendToast";
|
|
import { NativeModules } from "map";
|
|
import ME from "ME";
|
|
|
|
let c5;
|
|
let closure_6;
|
|
const require = arg1;
|
|
function isValidImageAttachment(filename) {
|
|
let height;
|
|
let width;
|
|
if (null == filename) {
|
|
return false;
|
|
} else {
|
|
({ height, width } = filename);
|
|
let tmp = require(4532) /* urlMatchesFileExtension */.isImageFile(filename.filename) && null != height;
|
|
if (tmp) {
|
|
tmp = height > 0;
|
|
}
|
|
if (tmp) {
|
|
tmp = null != width;
|
|
}
|
|
if (tmp) {
|
|
tmp = width > 0;
|
|
}
|
|
if (tmp) {
|
|
let tmp2 = null != filename;
|
|
if (tmp2) {
|
|
let hasFlagResult = null != filename.flags;
|
|
if (hasFlagResult) {
|
|
hasFlagResult = require(1403) /* hasFlag */.hasFlag(filename.flags, constants.IS_THUMBNAIL);
|
|
const tmp5Result = require(1403) /* hasFlag */;
|
|
}
|
|
tmp2 = hasFlagResult;
|
|
}
|
|
tmp = !tmp2;
|
|
}
|
|
return tmp;
|
|
}
|
|
}
|
|
function extractMediaFromAttachment(width, closure_0, index, closure_02, arg4) {
|
|
let height;
|
|
if (null != width.width) {
|
|
if (width.width > 0) {
|
|
if (null != width.height) {
|
|
if (width.height > 0) {
|
|
const enabledHarmTypesForMessage = require(5950) /* getEligibleHarmTypesConfigsForContext */.getEnabledHarmTypesForMessage(closure_0);
|
|
const obj12 = require(5950) /* getEligibleHarmTypesConfigsForContext */;
|
|
let obj = { type: null, media: null };
|
|
obj[0] = require(5955) /* ContentHarmTypeChannel */.ObscuredMediaTypes.Attachment;
|
|
obj[1] = width;
|
|
const result = require(5950) /* getEligibleHarmTypesConfigsForContext */.isMediaObscuredForHarmTypes(obj, enabledHarmTypesForMessage);
|
|
const obj13 = require(5950) /* getEligibleHarmTypesConfigsForContext */;
|
|
const isVideoFileResult = require(4532) /* urlMatchesFileExtension */.isVideoFile(width.filename);
|
|
if (null != width.proxy_url) {
|
|
if ("" !== width.proxy_url) {
|
|
let url = width.proxy_url;
|
|
}
|
|
obj = importDefault(1492);
|
|
({ width, height } = width);
|
|
let str2;
|
|
if (isVideoFileResult) {
|
|
str2 = "png";
|
|
}
|
|
const mobileOptimizedSrc = obj.getMobileOptimizedSrc(url, width, height, str2);
|
|
if (isVideoFileResult) {
|
|
obj = { uri: null, messageId: null, guildId: null, channelId: null, videoURI: null, filename: null, mediaIndex: null, width: null, height: null, sourceURI: null, contentType: null, description: null, accessoryType: "attachment", spoiler: null, flags: null, obscure: null, placeholder: null, contentScanVersion: null, mediaViewIndex: null, attachmentId: null, shareURI: null };
|
|
obj[0] = mobileOptimizedSrc;
|
|
obj[1] = closure_0.id;
|
|
obj[2] = closure_02;
|
|
obj[3] = closure_0.channel_id;
|
|
obj[4] = url;
|
|
obj[5] = tmp(8367)(width);
|
|
obj[6] = index;
|
|
({ width: obj10[7], height: obj10[8] } = width);
|
|
obj[9] = url;
|
|
({ content_type: obj10[10], description: obj10[11] } = width);
|
|
let tmp39Result = tmp39(1403);
|
|
let num3 = width.flags;
|
|
if (num3 == null) {
|
|
num3 = 0;
|
|
}
|
|
obj[13] = tmp39Result.hasFlag(num3, constants.IS_SPOILER);
|
|
obj[14] = width.flags;
|
|
obj[15] = result;
|
|
({ placeholder: obj10[16], content_scan_version: obj10[17] } = width);
|
|
obj[18] = arg4;
|
|
obj[19] = width.id;
|
|
obj[20] = url;
|
|
return obj;
|
|
} else {
|
|
const obj1 = { uri: null, messageId: null, guildId: null, channelId: null, filename: null, mediaIndex: null, width: null, height: null, sourceURI: null, contentType: null, description: null, accessoryType: "attachment", spoiler: null, flags: null, obscure: null, placeholder: null, contentScanVersion: null, mediaViewIndex: null, attachmentId: null, shareURI: null };
|
|
obj1[0] = mobileOptimizedSrc;
|
|
obj1[1] = closure_0.id;
|
|
obj1[2] = closure_02;
|
|
obj1[3] = closure_0.channel_id;
|
|
obj1[4] = tmp(8367)(width);
|
|
obj1[5] = index;
|
|
({ width: obj2[6], height: obj2[7], url: obj2[8], content_type: obj2[9], description: obj2[10] } = width);
|
|
tmp39Result = tmp39(1403);
|
|
let num = width.flags;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
obj1[12] = tmp39Result.hasFlag(num, constants.IS_SPOILER);
|
|
obj1[13] = width.flags;
|
|
obj1[14] = result;
|
|
({ placeholder: obj2[15], content_scan_version: obj2[16] } = width);
|
|
obj1[17] = arg4;
|
|
({ id: obj2[18], url: obj2[19] } = width);
|
|
const obj2 = {};
|
|
const merged = Object.assign(obj1);
|
|
obj2.uri = url;
|
|
const formatted = tmp(8367)(width).toLowerCase();
|
|
const str3 = tmp(8367)(width);
|
|
const tmp11 = constants;
|
|
const endsWithResult = formatted.endsWith(".webp");
|
|
const formatted1 = tmp(8367)(width).toLowerCase();
|
|
const endsWithResult1 = formatted1.endsWith(".avif");
|
|
const str5 = tmp(8367)(width);
|
|
let num2 = width.flags;
|
|
if (num2 == null) {
|
|
num2 = 0;
|
|
}
|
|
if (tmp39Result1.hasFlag(num2, tmp11.IS_ANIMATED)) {
|
|
const _URL2 = URL;
|
|
const str10 = new URL(url);
|
|
const searchParams2 = str10.searchParams;
|
|
searchParams2.append("animated", "true");
|
|
if (endsWithResult1) {
|
|
const searchParams3 = str10.searchParams;
|
|
searchParams3.append("format", "webp");
|
|
}
|
|
const items = [obj1, ];
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(obj2);
|
|
obj3.uri = str10.toString();
|
|
items[1] = obj3;
|
|
return items;
|
|
}
|
|
if (endsWithResult1) {
|
|
const _URL = URL;
|
|
const str7 = new URL(url);
|
|
const searchParams = str7.searchParams;
|
|
searchParams.append("format", "webp");
|
|
const items1 = [obj1, ];
|
|
const obj4 = {};
|
|
const merged2 = Object.assign(obj2);
|
|
obj4.uri = str7.toString();
|
|
items1[1] = obj4;
|
|
return items1;
|
|
} else {
|
|
let tmp17 = obj2;
|
|
if (url !== mobileOptimizedSrc) {
|
|
const items2 = [obj1, obj2];
|
|
tmp17 = items2;
|
|
}
|
|
return tmp17;
|
|
}
|
|
tmp39Result1 = tmp39(1403);
|
|
}
|
|
}
|
|
url = width.url;
|
|
const obj15 = require(4532) /* urlMatchesFileExtension */;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function extractMediaFromEmbed(image, closure_0, contentMessage, arg3, closure_02) {
|
|
let proxyURL;
|
|
let proxyURL2;
|
|
let proxyURL3;
|
|
let proxyURL4;
|
|
let url;
|
|
let url2;
|
|
let url4;
|
|
let url5;
|
|
let thumbnail = image.image;
|
|
if (thumbnail == null) {
|
|
thumbnail = image.video;
|
|
}
|
|
if (thumbnail == null) {
|
|
thumbnail = image.thumbnail;
|
|
}
|
|
if (null != thumbnail) {
|
|
if (null == image.video) {
|
|
({ proxyURL: proxyURL2, url: url2 } = thumbnail);
|
|
let str = url2;
|
|
if (null != proxyURL2) {
|
|
str = url2;
|
|
if ("" !== proxyURL2) {
|
|
const _URL2 = URL;
|
|
const str44 = new URL(proxyURL2);
|
|
const formatted = str44.pathname.toLowerCase();
|
|
const endsWithResult = formatted.endsWith(".avif");
|
|
const formatted1 = str44.pathname.toLowerCase();
|
|
if (tmp6) {
|
|
if (formatted1.endsWith(".webp")) {
|
|
const searchParams5 = str44.searchParams;
|
|
searchParams5.append("animated", "true");
|
|
if (endsWithResult) {
|
|
const searchParams6 = str44.searchParams;
|
|
searchParams6.append("format", "webp");
|
|
}
|
|
str = str44.toString();
|
|
} else {
|
|
str = proxyURL2;
|
|
}
|
|
} else {
|
|
str = proxyURL2;
|
|
if (endsWithResult) {
|
|
const searchParams4 = str44.searchParams;
|
|
searchParams4.append("format", "webp");
|
|
str = str44.toString();
|
|
}
|
|
}
|
|
const str45 = str44.pathname;
|
|
const str47 = str44.pathname;
|
|
}
|
|
}
|
|
if (null != image.contentScanVersion) {
|
|
let content_scan_version = image.contentScanVersion;
|
|
} else if (null != image.content_scan_version) {
|
|
content_scan_version = image.content_scan_version;
|
|
}
|
|
let obj = importDefault(1492);
|
|
const mobileOptimizedSrc = obj.getMobileOptimizedSrc(str, thumbnail.width, thumbnail.height);
|
|
obj = { contentMessage: null };
|
|
obj[0] = contentMessage;
|
|
const hasSpoilerEmbeds = importDefault(8248)(closure_0, obj).hasSpoilerEmbeds;
|
|
let obj2 = require(5950) /* getEligibleHarmTypesConfigsForContext */;
|
|
const enabledHarmTypesForMessage = obj2.getEnabledHarmTypesForMessage(closure_0);
|
|
let obj3 = require(5950) /* getEligibleHarmTypesConfigsForContext */;
|
|
obj = { type: null, media: null };
|
|
obj[0] = require(5955) /* ContentHarmTypeChannel */.ObscuredMediaTypes.Embed;
|
|
obj[1] = image;
|
|
const result = obj3.isMediaObscuredForHarmTypes(obj, enabledHarmTypesForMessage);
|
|
if ("title" in image) {
|
|
let rawTitle = image.title;
|
|
} else if ("rawTitle" in image) {
|
|
rawTitle = image.rawTitle;
|
|
}
|
|
let tmp16Result = tmp16(4677);
|
|
const obj1 = {};
|
|
const merged = Object.assign(image);
|
|
obj1.rawTitle = rawTitle;
|
|
const isEmbedInlineResult = tmp16Result.isEmbedInline(obj1);
|
|
tmp16Result = tmp16(4677);
|
|
const provider = image.provider;
|
|
let name;
|
|
if (provider != null) {
|
|
name = provider.name;
|
|
}
|
|
const video = image.video;
|
|
url = undefined;
|
|
if (video != null) {
|
|
url = video.url;
|
|
}
|
|
let url3 = tmp16Result.getEffectiveVideoProvider(name, url);
|
|
const result1 = require(8100) /* frozen */.shouldPlayVideoInline(url3);
|
|
let tmp26 = result1;
|
|
if (result1) {
|
|
tmp26 = null != image.video;
|
|
}
|
|
if (null != undefined) {
|
|
if (!result1) {
|
|
obj2 = { uri: null, messageId: null, guildId: null, channelId: null, mediaIndex: null, videoURI: null, embedURI: null, width: null, height: null, isGIFV: null, sourceURI: null, embedProviderName: null, accessoryType: "embed", noCarousel: null, spoiler: null, flags: null, contentScanVersion: null, contentType: null, obscure: null, thumbnail: null, shareURI: null };
|
|
obj2[0] = mobileOptimizedSrc;
|
|
obj2[1] = closure_0.id;
|
|
obj2[2] = closure_02;
|
|
obj2[3] = closure_0.channel_id;
|
|
obj2[4] = arg3;
|
|
obj2[5] = undefined;
|
|
obj2[6] = image.url;
|
|
({ width: obj10[7], height: obj10[8] } = thumbnail);
|
|
obj2[9] = "gifv" === image.type;
|
|
obj2[10] = thumbnail.url;
|
|
const provider2 = image.provider;
|
|
let name1;
|
|
if (provider2 != null) {
|
|
name1 = provider2.name;
|
|
}
|
|
obj2[11] = name1;
|
|
obj2[13] = !isEmbedInlineResult;
|
|
obj2[14] = hasSpoilerEmbeds;
|
|
obj2[15] = image.flags;
|
|
obj2[16] = content_scan_version;
|
|
if ("contentType" in thumbnail) {
|
|
let contentType = thumbnail.contentType;
|
|
} else if ("content_type" in thumbnail) {
|
|
const content_type = thumbnail.content_type;
|
|
contentType = content_type;
|
|
}
|
|
obj2[17] = contentType;
|
|
obj2[18] = result;
|
|
let tmp30;
|
|
if (null != image.thumbnail) {
|
|
obj3 = { width: null, height: null, uri: null };
|
|
obj3[0] = image.thumbnail.width;
|
|
obj3[1] = image.thumbnail.height;
|
|
obj3[2] = image.thumbnail.url;
|
|
tmp30 = obj3;
|
|
}
|
|
obj2[19] = tmp30;
|
|
obj2[20] = image.url;
|
|
return obj2;
|
|
}
|
|
}
|
|
if ("video" !== image.type) {
|
|
const obj4 = { uri: null, messageId: null, guildId: null, channelId: null, mediaIndex: null, width: null, height: null, sourceURI: null, accessoryType: "embed", noCarousel: null, spoiler: null, flags: null, obscure: null, contentScanVersion: null, contentType: null, shareURI: null };
|
|
obj4[0] = mobileOptimizedSrc;
|
|
obj4[1] = closure_0.id;
|
|
obj4[2] = closure_02;
|
|
obj4[3] = closure_0.channel_id;
|
|
obj4[4] = arg3;
|
|
({ width: obj15[5], height: obj15[6], url: obj15[7] } = thumbnail);
|
|
obj4[9] = !isEmbedInlineResult;
|
|
obj4[10] = hasSpoilerEmbeds;
|
|
obj4[11] = image.flags;
|
|
obj4[12] = result;
|
|
obj4[13] = content_scan_version;
|
|
if ("contentType" in thumbnail) {
|
|
let contentType4 = thumbnail.contentType;
|
|
} else if ("content_type" in thumbnail) {
|
|
const content_type4 = thumbnail.content_type;
|
|
contentType4 = content_type4;
|
|
}
|
|
obj4[14] = contentType4;
|
|
obj4[15] = thumbnail.url;
|
|
const obj5 = {};
|
|
const merged1 = Object.assign(obj4);
|
|
obj5.uri = str;
|
|
let tmp43 = obj5;
|
|
if (str !== mobileOptimizedSrc) {
|
|
const items = [obj4, obj5];
|
|
tmp43 = items;
|
|
}
|
|
return tmp43;
|
|
}
|
|
const items1 = [];
|
|
if (null == image.thumbnail) {
|
|
if (tmp26) {
|
|
tmp26 = null != image.video;
|
|
}
|
|
if (!tmp26) {
|
|
if (0 !== items1.length) {
|
|
if (1 === items1.length) {
|
|
let first = items1[0];
|
|
} else if (2 === items1.length) {
|
|
const items2 = [, ];
|
|
[arr2[0], arr2[1]] = items1;
|
|
first = items2;
|
|
}
|
|
return first;
|
|
}
|
|
} else {
|
|
let obj6 = { uri: null, guildId: null, spoiler: null, flags: null, obscure: null, contentScanVersion: null, contentType: null, sourceURI: null, messageId: null, noCarousel: null, mediaIndex: null, accessoryType: "embed", width: null, height: null, channelId: null, embedURI: null, embedProviderName: null, disableDownload: true, shareURI: null };
|
|
obj6[0] = mobileOptimizedSrc;
|
|
obj6[1] = closure_02;
|
|
obj6[2] = hasSpoilerEmbeds;
|
|
obj6[3] = image.flags;
|
|
obj6[4] = result;
|
|
obj6[5] = content_scan_version;
|
|
let str29 = image.video;
|
|
if ("contentType" in str29) {
|
|
let contentType3 = str29.contentType;
|
|
} else if ("content_type" in str29) {
|
|
const content_type3 = str29.content_type;
|
|
contentType3 = content_type3;
|
|
}
|
|
obj6[6] = contentType3;
|
|
obj6[7] = image.url;
|
|
obj6[8] = closure_0.id;
|
|
obj6[9] = !isEmbedInlineResult;
|
|
obj6[10] = arg3;
|
|
obj6[12] = image.video.width;
|
|
obj6[13] = image.video.height;
|
|
obj6[14] = closure_0.channel_id;
|
|
({ proxyURL: proxyURL3, url: url4 } = image.video);
|
|
let str1 = url4;
|
|
if (null != proxyURL3) {
|
|
str29 = "";
|
|
str1 = url4;
|
|
if ("" !== proxyURL3) {
|
|
const _URL4 = URL;
|
|
const uRL = new URL(proxyURL3);
|
|
url4 = uRL;
|
|
const formatted2 = uRL.pathname.toLowerCase();
|
|
str29 = formatted2.endsWith(".avif");
|
|
const formatted3 = uRL.pathname.toLowerCase();
|
|
let str34 = formatted3.endsWith(".webp");
|
|
if (!tmp35) {
|
|
str1 = proxyURL3;
|
|
if (str29) {
|
|
const searchParams10 = url4.searchParams;
|
|
searchParams10.append("format", "webp");
|
|
str1 = url4.toString();
|
|
}
|
|
}
|
|
const str55 = uRL.pathname;
|
|
const str57 = uRL.pathname;
|
|
}
|
|
if (str34) {
|
|
const searchParams11 = url4.searchParams;
|
|
str34 = "true";
|
|
proxyURL3 = searchParams11.append("animated", "true");
|
|
if (str29) {
|
|
const searchParams12 = url4.searchParams;
|
|
proxyURL3 = "webp";
|
|
searchParams12.append("format", "webp");
|
|
}
|
|
str29 = url4.toString;
|
|
str1 = str29();
|
|
} else {
|
|
str1 = proxyURL3;
|
|
}
|
|
}
|
|
obj6[15] = str1;
|
|
obj6[16] = url3;
|
|
url3 = image.url;
|
|
obj6[18] = url3;
|
|
obj6 = items1.push(obj6);
|
|
}
|
|
} else {
|
|
({ proxyURL: proxyURL4, url: url5 } = image.thumbnail);
|
|
let str2 = url5;
|
|
if (null != proxyURL4) {
|
|
str2 = url5;
|
|
if ("" !== proxyURL4) {
|
|
const _URL3 = URL;
|
|
const str50 = new URL(proxyURL4);
|
|
const formatted4 = str50.pathname.toLowerCase();
|
|
const endsWithResult1 = formatted4.endsWith(".avif");
|
|
const formatted5 = str50.pathname.toLowerCase();
|
|
if (tmp55) {
|
|
if (formatted5.endsWith(".webp")) {
|
|
const searchParams8 = str50.searchParams;
|
|
searchParams8.append("animated", "true");
|
|
if (endsWithResult1) {
|
|
const searchParams9 = str50.searchParams;
|
|
searchParams9.append("format", "webp");
|
|
}
|
|
str2 = str50.toString();
|
|
} else {
|
|
str2 = proxyURL4;
|
|
}
|
|
} else {
|
|
str2 = proxyURL4;
|
|
if (endsWithResult1) {
|
|
const searchParams7 = str50.searchParams;
|
|
searchParams7.append("format", "webp");
|
|
str2 = str50.toString();
|
|
}
|
|
}
|
|
const str51 = str50.pathname;
|
|
const str53 = str50.pathname;
|
|
}
|
|
}
|
|
let obj7 = { uri: null, guildId: null, spoiler: null, flags: null, obscure: null, contentScanVersion: null, contentType: null, messageId: null, noCarousel: null, mediaIndex: null, accessoryType: "embed", channelId: null, sourceURI: null, width: null, height: null, shareURI: null };
|
|
obj7[0] = tmp13(1492).getMobileOptimizedSrc(str2, image.thumbnail.width, image.thumbnail.height);
|
|
obj7[1] = closure_02;
|
|
obj7[2] = hasSpoilerEmbeds;
|
|
obj7[3] = image.flags;
|
|
obj7[4] = result;
|
|
obj7[5] = content_scan_version;
|
|
const thumbnail2 = image.thumbnail;
|
|
if ("contentType" in thumbnail2) {
|
|
let contentType2 = thumbnail2.contentType;
|
|
} else if ("content_type" in thumbnail2) {
|
|
const content_type2 = thumbnail2.content_type;
|
|
contentType2 = content_type2;
|
|
}
|
|
obj7[6] = contentType2;
|
|
obj7[7] = closure_0.id;
|
|
obj7[8] = !isEmbedInlineResult;
|
|
obj7[9] = arg3;
|
|
obj7[11] = closure_0.channel_id;
|
|
obj7[12] = image.thumbnail.url;
|
|
obj7[13] = image.thumbnail.width;
|
|
obj7[14] = image.thumbnail.height;
|
|
obj7[15] = image.thumbnail.url;
|
|
obj7 = items1.push(obj7);
|
|
const tmp13Result = tmp13(1492);
|
|
}
|
|
tmp13 = importDefault;
|
|
const tmp16Result1 = require(8100) /* frozen */;
|
|
} else {
|
|
({ proxyURL, url } = image.video);
|
|
let str3 = url;
|
|
if (null != proxyURL) {
|
|
let str6 = "";
|
|
str3 = url;
|
|
if ("" !== proxyURL) {
|
|
const _URL = URL;
|
|
const uRL1 = new URL(proxyURL);
|
|
url = uRL1;
|
|
const formatted6 = uRL1.pathname.toLowerCase();
|
|
str6 = formatted6.endsWith(".avif");
|
|
const formatted7 = uRL1.pathname.toLowerCase();
|
|
str3 = formatted7.endsWith(".webp");
|
|
if (!tmp) {
|
|
str3 = proxyURL;
|
|
if (str6) {
|
|
const searchParams = url.searchParams;
|
|
str = "webp";
|
|
str2 = "format";
|
|
searchParams.append("format", "webp");
|
|
str3 = url.toString();
|
|
}
|
|
}
|
|
const str39 = uRL1.pathname;
|
|
const str41 = uRL1.pathname;
|
|
}
|
|
if (str3) {
|
|
const searchParams2 = url.searchParams;
|
|
str3 = "true";
|
|
proxyURL = searchParams2.append("animated", "true");
|
|
if (str6) {
|
|
const searchParams3 = url.searchParams;
|
|
proxyURL = "webp";
|
|
searchParams3.append("format", "webp");
|
|
}
|
|
str6 = url.toString;
|
|
str3 = str6();
|
|
} else {
|
|
str3 = proxyURL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function toMediaSourceFromUnfurledMedia(id, guild_id, media, description, spoiler) {
|
|
let proxyUrl2;
|
|
let width;
|
|
let width2;
|
|
let obj = require(8261) /* transformToRowGeneratedComponent */;
|
|
const unfurledMediaItemType = obj.getUnfurledMediaItemType(media);
|
|
if (unfurledMediaItemType === require(8277) /* MediaGalleryItemType */.MediaGalleryItemType.VISUAL_PLACEHOLDER) {
|
|
return null;
|
|
} else {
|
|
const obj8 = importDefault(1492);
|
|
({ proxyUrl: proxyUrl2, width } = media);
|
|
if (width == null) {
|
|
width = 0;
|
|
}
|
|
let num = media.height;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
const tmp4 = unfurledMediaItemType === tmp(8277).MediaGalleryItemType.VIDEO;
|
|
let str;
|
|
if (tmp4) {
|
|
str = "png";
|
|
}
|
|
const mobileOptimizedSrc = obj8.getMobileOptimizedSrc(proxyUrl2, width, num, str);
|
|
const contentScanMetadata = media.contentScanMetadata;
|
|
let version;
|
|
if (contentScanMetadata != null) {
|
|
version = contentScanMetadata.version;
|
|
}
|
|
let tmpResult = tmp(5950);
|
|
const enabledHarmTypesForMessage = tmpResult.getEnabledHarmTypesForMessage(id);
|
|
tmpResult = tmp(5950);
|
|
obj = { type: null, media: null };
|
|
obj[0] = tmp(5955).ObscuredMediaTypes.GenericMedia;
|
|
obj[1] = media;
|
|
obj = { messageId: null, guildId: null, channelId: null, uri: null, sourceURI: null, width: null, height: null, contentType: null, description: null, spoiler: null, obscure: null, contentScanVersion: null, accessoryType: "component", mediaIndex: 0, shareURI: null };
|
|
obj[0] = id.id;
|
|
obj[1] = guild_id;
|
|
obj[2] = id.channel_id;
|
|
obj[3] = mobileOptimizedSrc;
|
|
({ url: obj5[4], width: width2 } = media);
|
|
const result = tmpResult.isMediaObscuredForHarmTypes(obj, enabledHarmTypesForMessage);
|
|
if (width2 == null) {
|
|
width2 = 0;
|
|
}
|
|
obj[5] = width2;
|
|
let num2 = media.height;
|
|
if (num2 == null) {
|
|
num2 = 0;
|
|
}
|
|
obj[6] = num2;
|
|
obj[7] = media.contentType;
|
|
obj[8] = description;
|
|
obj[9] = spoiler;
|
|
obj[10] = result;
|
|
obj[11] = version;
|
|
obj[14] = media.url;
|
|
const obj1 = {};
|
|
const merged = Object.assign(obj);
|
|
const proxyUrl = media.proxyUrl;
|
|
if (tmp4) {
|
|
obj1.videoURI = proxyUrl;
|
|
return obj1;
|
|
} else {
|
|
obj1.uri = proxyUrl;
|
|
let tmp21 = obj1;
|
|
if (media.proxyUrl !== mobileOptimizedSrc) {
|
|
const obj2 = {};
|
|
const merged1 = Object.assign(obj);
|
|
const items = [obj2, obj1];
|
|
tmp21 = items;
|
|
}
|
|
return tmp21;
|
|
}
|
|
}
|
|
}
|
|
function handleDownloadError() {
|
|
let obj = importDefault(4684);
|
|
obj = { title: null, body: null, isDismissable: true };
|
|
const intl = require(1236) /* getSystemLocale */.intl;
|
|
obj[0] = intl.string(require(1236) /* getSystemLocale */.t.cV3alD);
|
|
const intl2 = require(1236) /* getSystemLocale */.intl;
|
|
obj[1] = intl2.string(require(1236) /* getSystemLocale */.t.r4Zjzv);
|
|
obj.show(obj);
|
|
}
|
|
({ MessageAttachmentFlags: c5, WEBP_RE_IOS: closure_6 } = ME);
|
|
const re7 = /\.avif$/i;
|
|
let obj = { PORTAL: 0, [0]: "PORTAL", TIKTOK_IFRAME: 1, [1]: "TIKTOK_IFRAME", WEB_FILE_IFRAME: 2, [2]: "WEB_FILE_IFRAME", DEFAULT: 3, [3]: "DEFAULT" };
|
|
let result = require("ME").fileFinishedImporting("modules/media_viewer/native/MediaSourceUtil.tsx");
|
|
|
|
export const flattenSource = function flattenSource(closure_1, arg1) {
|
|
if (!Array.isArray(closure_1)) {
|
|
return closure_1;
|
|
} else if (arg1) {
|
|
let first = closure_1[closure_1.length - 1];
|
|
} else {
|
|
first = closure_1[0];
|
|
}
|
|
};
|
|
export { isValidImageAttachment };
|
|
export const isValidVideoAttachment = function isValidVideoAttachment(filename) {
|
|
let tmp = null != filename;
|
|
if (tmp) {
|
|
let isVideoFileResult = null != filename;
|
|
if (isVideoFileResult) {
|
|
isVideoFileResult = require(4532) /* urlMatchesFileExtension */.isVideoFile(filename.filename);
|
|
const obj = require(4532) /* urlMatchesFileExtension */;
|
|
}
|
|
if (isVideoFileResult) {
|
|
isVideoFileResult = null != filename.proxy_url;
|
|
}
|
|
tmp = isVideoFileResult;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const isValidImageEmbed = function isValidImageEmbed(image) {
|
|
return null != image.image || null != image.thumbnail;
|
|
};
|
|
export const isValidVideoEmbed = function isValidVideoEmbed(video) {
|
|
return null != video.video;
|
|
};
|
|
export const isThumbnailAttachment = function isThumbnailAttachment(flags) {
|
|
let tmp = null != flags;
|
|
if (tmp) {
|
|
let hasFlagResult = null != flags.flags;
|
|
if (hasFlagResult) {
|
|
hasFlagResult = require(1403) /* hasFlag */.hasFlag(flags.flags, constants.IS_THUMBNAIL);
|
|
const obj = require(1403) /* hasFlag */;
|
|
}
|
|
tmp = hasFlagResult;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const getAttachmentUrl = function getAttachmentUrl(attachment) {
|
|
if (null != attachment.proxy_url) {
|
|
if ("" !== attachment.proxy_url) {
|
|
let url = attachment.proxy_url;
|
|
}
|
|
return url;
|
|
}
|
|
url = attachment.url;
|
|
};
|
|
export { extractMediaFromAttachment };
|
|
export const getEmbedUrl = function getEmbedUrl(size) {
|
|
const proxyURL = size.proxyURL;
|
|
if (null != proxyURL) {
|
|
if ("" !== proxyURL) {
|
|
const _URL = URL;
|
|
const str2 = new URL(proxyURL);
|
|
const formatted = str2.pathname.toLowerCase();
|
|
const endsWithResult = formatted.endsWith(".avif");
|
|
const formatted1 = str2.pathname.toLowerCase();
|
|
if (tmp) {
|
|
const searchParams2 = str2.searchParams;
|
|
searchParams2.append("animated", "true");
|
|
if (endsWithResult) {
|
|
const searchParams3 = str2.searchParams;
|
|
searchParams3.append("format", "webp");
|
|
}
|
|
return str2.toString();
|
|
} else if (endsWithResult) {
|
|
const searchParams = str2.searchParams;
|
|
searchParams.append("format", "webp");
|
|
return str2.toString();
|
|
}
|
|
return proxyURL;
|
|
}
|
|
}
|
|
return size.url;
|
|
};
|
|
export const getEmbedMedia = function getEmbedMedia(embed) {
|
|
let thumbnail = embed.image;
|
|
if (thumbnail == null) {
|
|
thumbnail = embed.video;
|
|
}
|
|
if (thumbnail == null) {
|
|
thumbnail = embed.thumbnail;
|
|
}
|
|
return thumbnail;
|
|
};
|
|
export { extractMediaFromEmbed };
|
|
export const extractMediaFromMessageComponents = function extractMediaFromMessageComponents(getContentMessage, contentMessage, closure_0) {
|
|
if (0 === contentMessage.components.length) {
|
|
return [];
|
|
} else {
|
|
let items = [];
|
|
const obj2 = require(4566) /* flattenComponents */;
|
|
const items1 = [];
|
|
HermesBuiltin.arraySpread(require(4566) /* flattenComponents */.flattenComponents(contentMessage.components).values(), 0);
|
|
const iter = items1[Symbol.iterator]();
|
|
const nextResult = iter.next();
|
|
while (iter !== undefined) {
|
|
let tmp4 = nextResult;
|
|
let type = nextResult.type;
|
|
let tmp5 = require;
|
|
let tmp6 = require;
|
|
let tmp7 = dependencyMap;
|
|
let tmp8 = dependencyMap;
|
|
if (require(1954) /* PermissionOverwriteType */.ComponentType.MEDIA_GALLERY === type) {
|
|
let tmp9 = nextResult;
|
|
items = tmp4.items;
|
|
let tmp10 = items;
|
|
let tmp11 = items;
|
|
for (const item10029 of items) {
|
|
let tmp13 = toMediaSourceFromUnfurledMedia;
|
|
let num = 0;
|
|
let tmp14 = arg0;
|
|
let tmp15 = arg2;
|
|
let tmp12 = item10029;
|
|
let tmp16 = toMediaSourceFromUnfurledMedia(arg0, arg2, item10029.media, item10029.description, item10029.spoiler);
|
|
if (null != tmp16) {
|
|
let obj = { sources: null, unfurledMediaItem: null };
|
|
let tmp18 = tmp16;
|
|
obj[0] = tmp17;
|
|
let tmp19 = item10029;
|
|
obj[1] = tmp12.media;
|
|
let arr = items.push(obj);
|
|
}
|
|
continue;
|
|
}
|
|
} else {
|
|
let tmp29 = tmp5;
|
|
let tmp30 = tmp7;
|
|
if (tmp6(1954).ComponentType.THUMBNAIL === type) {
|
|
let tmp31 = toMediaSourceFromUnfurledMedia;
|
|
let tmp32 = nextResult;
|
|
let num3 = 0;
|
|
let tmp33 = getContentMessage;
|
|
let tmp34 = closure_0;
|
|
let tmp35 = toMediaSourceFromUnfurledMedia(getContentMessage, closure_0, tmp4.media, tmp4.description, tmp4.spoiler);
|
|
if (null != tmp35) {
|
|
obj = { sources: null, unfurledMediaItem: null };
|
|
let tmp37 = tmp35;
|
|
obj[0] = tmp36;
|
|
let tmp38 = nextResult;
|
|
obj[1] = tmp4.media;
|
|
arr = items.push(obj);
|
|
}
|
|
}
|
|
}
|
|
continue;
|
|
}
|
|
return items;
|
|
}
|
|
};
|
|
export const extractMediaSourcesFromEmbed = function extractMediaSourcesFromEmbed(arg0, contentMessage, images, index, guild_id) {
|
|
let closure_0 = arg0;
|
|
const importDefault = images;
|
|
const dependencyMap = index;
|
|
let presentAddedFriendToast = guild_id;
|
|
const hasSpoilerEmbeds = importDefault(8248)(arg0, { contentMessage }).hasSpoilerEmbeds;
|
|
images = images.images;
|
|
if (images == null) {
|
|
let items = [images.image];
|
|
images = items;
|
|
}
|
|
return images.map((width) => {
|
|
let proxyURL;
|
|
let url;
|
|
({ proxyURL, url } = width);
|
|
let str = url;
|
|
if (null != proxyURL) {
|
|
str = url;
|
|
if ("" !== proxyURL) {
|
|
const _URL = URL;
|
|
const str8 = new URL(proxyURL);
|
|
const formatted = str8.pathname.toLowerCase();
|
|
const endsWithResult = formatted.endsWith(".avif");
|
|
const formatted1 = str8.pathname.toLowerCase();
|
|
if (tmp) {
|
|
if (formatted1.endsWith(".webp")) {
|
|
const searchParams2 = str8.searchParams;
|
|
searchParams2.append("animated", "true");
|
|
if (endsWithResult) {
|
|
const searchParams3 = str8.searchParams;
|
|
searchParams3.append("format", "webp");
|
|
}
|
|
str = str8.toString();
|
|
} else {
|
|
str = proxyURL;
|
|
}
|
|
} else {
|
|
str = proxyURL;
|
|
if (endsWithResult) {
|
|
const searchParams = str8.searchParams;
|
|
str = "webp";
|
|
searchParams.append("format", "webp");
|
|
str = str8.toString();
|
|
}
|
|
}
|
|
const str11 = str8.pathname;
|
|
const str9 = str8.pathname;
|
|
}
|
|
}
|
|
let obj = images(index[7]);
|
|
const mobileOptimizedSrc = obj.getMobileOptimizedSrc(str, width.width, width.height);
|
|
if (null != images.contentScanVersion) {
|
|
let content_scan_version = tmp8.contentScanVersion;
|
|
} else if (null != tmp8.content_scan_version) {
|
|
content_scan_version = tmp8.content_scan_version;
|
|
}
|
|
const enabledHarmTypesForMessage = lib(index[5]).getEnabledHarmTypesForMessage(lib);
|
|
const obj2 = lib(index[5]);
|
|
obj = { type: lib(tmp6[6]).ObscuredMediaTypes.Embed, media: tmp8 };
|
|
const tmp10 = lib(index[5]).getMediaObscuredReasonFromBitmask(obj, enabledHarmTypesForMessage).length > 0;
|
|
obj = { uri: mobileOptimizedSrc, messageId: lib.id, guildId: presentAddedFriendToast, channelId: lib.channel_id, mediaIndex: index, width: width.width, height: width.height, sourceURI: width.url, accessoryType: "embed", noCarousel: false, spoiler: hasSpoilerEmbeds, flags: tmp8.flags, obscure: tmp10, contentScanVersion: content_scan_version, contentType: width.contentType, shareURI: width.url };
|
|
const items = [obj, { uri: str, messageId: lib.id, guildId: presentAddedFriendToast, channelId: lib.channel_id, mediaIndex: index, width: width.width, height: width.height, sourceURI: width.url, accessoryType: "embed", noCarousel: false, spoiler: hasSpoilerEmbeds, contentType: width.contentType, flags: images.flags, obscure: tmp10, contentScanVersion: content_scan_version, shareURI: width.url }];
|
|
return items;
|
|
});
|
|
};
|
|
export const extractMediaSourcesFromComponent = function extractMediaSourcesFromComponent(id, components, guild_id, tmp10Result3, componentMediaIndex) {
|
|
const _require = id;
|
|
let closure_1 = guild_id;
|
|
let obj = _require(4566);
|
|
const value = obj.flattenComponents(components).get(tmp10Result3);
|
|
if (null == value) {
|
|
return null;
|
|
} else {
|
|
const type = value.type;
|
|
if (tmp(1954).ComponentType.MEDIA_GALLERY === type) {
|
|
let num2 = 0;
|
|
if (null != componentMediaIndex) {
|
|
num2 = 0;
|
|
if (componentMediaIndex <= value.items.length) {
|
|
num2 = componentMediaIndex;
|
|
}
|
|
}
|
|
const items = value.items;
|
|
const mapped = items.map((media) => {
|
|
let tmp = outer1_11(closure_0, closure_1, media.media, media.description, media.spoiler);
|
|
if (null == tmp) {
|
|
tmp = null;
|
|
if (arg1 < closure_2) {
|
|
closure_2 = closure_2 - 1;
|
|
tmp = null;
|
|
}
|
|
}
|
|
return tmp;
|
|
});
|
|
obj = { initialIndex: null, sources: null };
|
|
obj[0] = num2;
|
|
obj[1] = mapped.filter(tmp(1370).isNotNullish);
|
|
return obj;
|
|
} else if (tmp(1954).ComponentType.THUMBNAIL === type) {
|
|
const tmp7 = toMediaSourceFromUnfurledMedia(id, guild_id, value.media, value.description, value.spoiler);
|
|
let tmp8 = null;
|
|
if (null != tmp7) {
|
|
obj = { initialIndex: 0, sources: null };
|
|
const items1 = [tmp7];
|
|
obj[1] = items1;
|
|
tmp8 = obj;
|
|
}
|
|
return tmp8;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
const flattenComponentsResult = obj.flattenComponents(components);
|
|
};
|
|
export const extractMediaSourcesFromMessage = function extractMediaSourcesFromMessage(message, message2, guild_id, GRAVITY_VALID_EMBED_TYPES) {
|
|
const items = [];
|
|
let num = 0;
|
|
let num2 = 0;
|
|
if (0 < message2.attachments.length) {
|
|
do {
|
|
let tmp = message2.attachments[num];
|
|
let tmp2 = isValidImageAttachment;
|
|
if (isValidImageAttachment(tmp)) {
|
|
let tmp9 = extractMediaFromAttachment;
|
|
let tmp10 = tmp;
|
|
let tmp11 = message;
|
|
let tmp12 = num;
|
|
let tmp13 = guild_id;
|
|
let tmp14 = num2;
|
|
let tmp15 = extractMediaFromAttachment(tmp, message, tmp3, guild_id, tmp4);
|
|
if (null != tmp15) {
|
|
let arr = items.push(tmp15);
|
|
}
|
|
} else {
|
|
let tmp5 = null != tmp;
|
|
if (tmp5) {
|
|
let isVideoFileResult = null != tmp;
|
|
if (isVideoFileResult) {
|
|
let tmp7 = require;
|
|
let tmp8 = dependencyMap;
|
|
let obj = require(4532) /* urlMatchesFileExtension */;
|
|
isVideoFileResult = obj.isVideoFile(tmp.filename);
|
|
}
|
|
if (isVideoFileResult) {
|
|
isVideoFileResult = null != tmp.proxy_url;
|
|
}
|
|
tmp5 = isVideoFileResult;
|
|
}
|
|
}
|
|
let tmp17 = null != tmp;
|
|
if (tmp17) {
|
|
let hasFlagResult = null != tmp.flags;
|
|
if (hasFlagResult) {
|
|
let tmp19 = require;
|
|
let tmp20 = dependencyMap;
|
|
let obj2 = require(1403) /* hasFlag */;
|
|
let tmp21 = constants;
|
|
hasFlagResult = obj2.hasFlag(tmp.flags, constants.IS_THUMBNAIL);
|
|
}
|
|
tmp17 = hasFlagResult;
|
|
}
|
|
let sum = num2;
|
|
if (!tmp17) {
|
|
sum = num2 + 1;
|
|
}
|
|
num = num + 1;
|
|
num2 = sum;
|
|
} while (num < message2.attachments.length);
|
|
}
|
|
for (let num3 = 0; num3 < message2.embeds.length; num3 = num3 + 1) {
|
|
let tmp23 = message2.embeds[num3];
|
|
if (null == GRAVITY_VALID_EMBED_TYPES) {
|
|
let tmp25 = null != tmp23.image || null != tmp23.thumbnail;
|
|
if (tmp25) {
|
|
let tmp26 = extractMediaFromEmbed;
|
|
let tmp27 = tmp23;
|
|
let tmp28 = message;
|
|
let tmp29 = message2;
|
|
let tmp30 = num3;
|
|
let tmp31 = guild_id;
|
|
let tmp32 = extractMediaFromEmbed(tmp23, message, message2, tmp24, guild_id);
|
|
if (null != tmp32) {
|
|
arr = items.push(tmp32);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return items;
|
|
};
|
|
export const setMediaSourcePortal = function setMediaSourcePortal(arg0, portal) {
|
|
let first = arg0;
|
|
if (Array.isArray(arg0)) {
|
|
first = arg0[0];
|
|
}
|
|
if (!tmp2) {
|
|
const _Array = Array;
|
|
if (Array.isArray(arg0)) {
|
|
arg0[0].portal = portal;
|
|
} else {
|
|
arg0.portal = portal;
|
|
}
|
|
}
|
|
};
|
|
export const getSelectedMediaSource = function getSelectedMediaSource(mediaViewerSyncer) {
|
|
const index = mediaViewerSyncer.index;
|
|
const value = index.get();
|
|
if (value >= 0) {
|
|
if (value < mediaViewerSyncer.sources.length) {
|
|
let tmp2 = null;
|
|
if (null != mediaViewerSyncer.sources[value]) {
|
|
const _Array = Array;
|
|
let tmp4 = arr;
|
|
if (Array.isArray(arr)) {
|
|
tmp4 = arr[arr.length - 1];
|
|
}
|
|
tmp2 = tmp4;
|
|
}
|
|
return tmp2;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
export const useSelectedMediaSource = function useSelectedMediaSource(syncer) {
|
|
let closure_0 = syncer;
|
|
const tmp = importDefault(8781)(syncer.index);
|
|
importDefault = tmp;
|
|
const items = [syncer.sources, tmp];
|
|
const items1 = [
|
|
tmp,
|
|
React.useMemo(() => {
|
|
if (closure_1 >= 0) {
|
|
if (tmp < syncer.sources.length) {
|
|
let tmp2 = null;
|
|
if (null != syncer.sources[tmp]) {
|
|
const _Array = Array;
|
|
let tmp4 = arr;
|
|
if (Array.isArray(arr)) {
|
|
tmp4 = arr[arr.length - 1];
|
|
}
|
|
tmp2 = tmp4;
|
|
}
|
|
return tmp2;
|
|
}
|
|
}
|
|
return null;
|
|
}, items)
|
|
];
|
|
return items1;
|
|
};
|
|
export const downloadMediaAsset = function downloadMediaAsset(mediaUrl, VIDEO) {
|
|
let closure_0 = VIDEO;
|
|
const MediaManager = NativeModules.MediaManager;
|
|
return MediaManager.downloadMediaAsset(mediaUrl, VIDEO).then(() => {
|
|
if (VIDEO(outer1_2[18]).MediaType.IMAGE === VIDEO) {
|
|
let tmp2Result = tmp2(tmp3[19]);
|
|
tmp2Result.presentImageSaved();
|
|
} else if (tmp2(tmp3[18]).MediaType.GIF === tmp) {
|
|
tmp2Result = tmp2(tmp3[19]);
|
|
tmp2Result.presentGifSaved();
|
|
} else if (tmp2(tmp3[18]).MediaType.VIDEO === tmp) {
|
|
tmp2(tmp3[19]).presentVideoSaved();
|
|
const tmp2Result1 = tmp2(tmp3[19]);
|
|
}
|
|
const MediaViewerAnalytics = tmp2(tmp3[20]).MediaViewerAnalytics;
|
|
const result = MediaViewerAnalytics.trackMediaViewerDownloadButtonTapped();
|
|
}, handleDownloadError);
|
|
};
|
|
export const downloadMediaAssetWithContentType = function downloadMediaAssetWithContentType(mediaUrl, VIDEO, contentType) {
|
|
let closure_0 = VIDEO;
|
|
if (null != contentType) {
|
|
const MediaManager2 = NativeModules.MediaManager;
|
|
let result = MediaManager2.downloadMediaAssetWithContentType(mediaUrl, VIDEO, contentType);
|
|
} else {
|
|
const MediaManager = NativeModules.MediaManager;
|
|
result = MediaManager.downloadMediaAsset(mediaUrl, VIDEO);
|
|
}
|
|
return result.then(() => {
|
|
if (VIDEO(outer1_2[18]).MediaType.IMAGE === VIDEO) {
|
|
let tmp2Result = tmp2(tmp3[19]);
|
|
tmp2Result.presentImageSaved();
|
|
} else if (tmp2(tmp3[18]).MediaType.GIF === tmp) {
|
|
tmp2Result = tmp2(tmp3[19]);
|
|
tmp2Result.presentGifSaved();
|
|
} else if (tmp2(tmp3[18]).MediaType.VIDEO === tmp) {
|
|
tmp2(tmp3[19]).presentVideoSaved();
|
|
const tmp2Result1 = tmp2(tmp3[19]);
|
|
}
|
|
const MediaViewerAnalytics = tmp2(tmp3[20]).MediaViewerAnalytics;
|
|
const result = MediaViewerAnalytics.trackMediaViewerDownloadButtonTapped();
|
|
}, handleDownloadError);
|
|
};
|
|
export const getYoutubeClipVideoIdFromURI = function getYoutubeClipVideoIdFromURI(uri) {
|
|
const match = uri.match(/^https:\/\/www\.youtube\.com\/embed\/([A-Za-z0-9_-]*)(\?clip=([A-Za-z0-9_-]+)(&clipt=([A-Za-z0-9_-]+)))?$/);
|
|
if (null != match) {
|
|
if (6 === match.length) {
|
|
let tmp4 = null;
|
|
if (null != match[1]) {
|
|
tmp4 = null;
|
|
if (null != tmp2) {
|
|
tmp4 = null;
|
|
if (null != tmp3) {
|
|
const obj = { videoId: null, clip: null, clipt: null };
|
|
obj[0] = tmp;
|
|
obj[1] = tmp2;
|
|
obj[2] = tmp3;
|
|
tmp4 = obj;
|
|
}
|
|
}
|
|
}
|
|
return tmp4;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
export const getYoutubeVideoIdFromURI = function getYoutubeVideoIdFromURI(uri) {
|
|
let match = uri.match(/^https:\/\/www\.youtube\.com\/embed\/([A-Za-z0-9_-]*)(\?start=([0-9]+))?$/);
|
|
let tmp = null;
|
|
if (null != match) {
|
|
tmp = null;
|
|
if (null != match[1]) {
|
|
tmp = null;
|
|
if (11 === match[1].length) {
|
|
if (4 !== match.length) {
|
|
let obj = { videoId: null };
|
|
obj[0] = match[1];
|
|
}
|
|
obj = { videoId: null, start: null };
|
|
obj[0] = match[1];
|
|
const _Number = Number;
|
|
match = Number(match[3]);
|
|
obj[1] = match;
|
|
}
|
|
}
|
|
}
|
|
return tmp;
|
|
};
|
|
export const VideoSourceType = obj;
|
|
export const getVideoSourceType = function getVideoSourceType(source) {
|
|
if (null != source.videoURI) {
|
|
const obj = require(4532) /* urlMatchesFileExtension */;
|
|
if (obj.isWebPlayerVideoUrl(source.videoURI)) {
|
|
let PORTAL = obj.WEB_FILE_IFRAME;
|
|
}
|
|
return PORTAL;
|
|
}
|
|
if (null != source.portal) {
|
|
if (!obj2.isPortalExpired(source.portal)) {
|
|
PORTAL = obj.PORTAL;
|
|
}
|
|
obj2 = require(8897) /* MediaPlayerManager */;
|
|
}
|
|
if (null == source.embedURI) {
|
|
const DEFAULT = obj.DEFAULT;
|
|
}
|
|
const TIKTOK_IFRAME = obj.TIKTOK_IFRAME;
|
|
};
|
|
export const supportOverlayVideoControls = function supportOverlayVideoControls(videoURI) {
|
|
let tmp = null != videoURI.videoURI;
|
|
if (tmp) {
|
|
tmp = true !== videoURI.isGIFV;
|
|
}
|
|
if (!tmp) {
|
|
let tmp2 = null != videoURI.embedURI;
|
|
if (tmp2) {
|
|
tmp2 = "TikTok" === videoURI.embedProviderName;
|
|
}
|
|
tmp = tmp2;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const isAnimatedWebpSource = function isAnimatedWebpSource(sourceURI) {
|
|
let result = null != sourceURI.sourceURI && null != sourceURI.uri;
|
|
if (result) {
|
|
result = require(4532) /* urlMatchesFileExtension */.urlMatchesFileExtension(sourceURI.sourceURI, closure_6);
|
|
const obj = require(4532) /* urlMatchesFileExtension */;
|
|
}
|
|
if (result) {
|
|
const _URL = URL;
|
|
const uRL = new URL(sourceURI.uri);
|
|
const searchParams = uRL.searchParams;
|
|
result = "true" === searchParams.get("animated");
|
|
}
|
|
return result;
|
|
};
|
|
export const isAnimatedAvifSource = function isAnimatedAvifSource(sourceURI) {
|
|
let result = null != sourceURI.sourceURI && null != sourceURI.uri;
|
|
if (result) {
|
|
result = require(4532) /* urlMatchesFileExtension */.urlMatchesFileExtension(sourceURI.sourceURI, closure_7);
|
|
const obj = require(4532) /* urlMatchesFileExtension */;
|
|
}
|
|
if (result) {
|
|
const _URL = URL;
|
|
const uRL = new URL(sourceURI.uri);
|
|
const searchParams = uRL.searchParams;
|
|
result = "true" === searchParams.get("animated");
|
|
}
|
|
return result;
|
|
};
|
|
export const isGIFSource = function isGIFSource(sourceURI) {
|
|
return require(4532) /* urlMatchesFileExtension */.urlMatchesFileExtension(sourceURI.sourceURI, require(691) /* keys */.GIF_RE_IOS);
|
|
};
|
|
export const isAnimatedImageSource = function isAnimatedImageSource(source) {
|
|
let result = require(4532) /* urlMatchesFileExtension */.urlMatchesFileExtension(source.sourceURI, require(691) /* keys */.GIF_RE_IOS);
|
|
if (!result) {
|
|
let result1 = null != source.sourceURI && null != source.uri;
|
|
if (result1) {
|
|
let tmpResult = tmp(4532);
|
|
result1 = tmpResult.urlMatchesFileExtension(source.sourceURI, closure_6);
|
|
}
|
|
if (result1) {
|
|
const _URL = URL;
|
|
const uRL = new URL(source.uri);
|
|
const searchParams = uRL.searchParams;
|
|
result1 = "true" === searchParams.get("animated");
|
|
}
|
|
result = result1;
|
|
}
|
|
if (!result) {
|
|
let result2 = null != source.sourceURI && null != source.uri;
|
|
if (result2) {
|
|
tmpResult = tmp(4532);
|
|
result2 = tmpResult.urlMatchesFileExtension(source.sourceURI, closure_7);
|
|
}
|
|
if (result2) {
|
|
const _URL2 = URL;
|
|
const uRL1 = new URL(source.uri);
|
|
const searchParams2 = uRL1.searchParams;
|
|
result2 = "true" === searchParams2.get("animated");
|
|
}
|
|
result = result2;
|
|
}
|
|
return result;
|
|
};
|