decord/source/319_prefetch.js

318 lines
9.6 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 319
// Function ID: 4864
// Name: prefetch
2026-07-23 10:11:24 +00:00
// Dependencies: [29, 5, 31, 33, 320, 322, 90, 147, 323, 324, 327, 328, 253]
2026-07-20 16:05:17 +00:00
// Module 319 (prefetch)
2026-07-23 10:11:24 +00:00
import _objectWithoutProperties from "_objectWithoutProperties";
import getImageSourcesFromImageProps from "getImageSourcesFromImageProps";
import "result";
import { jsx } from "jsxProd";
import set from "set";
const require = arg1;
2026-07-20 16:05:17 +00:00
function prefetch(arg0, arg1) {
let closure_7 = tmp + 1;
if (arg1) {
arg1(tmp);
}
2026-07-23 10:11:24 +00:00
return importDefault(320).prefetchImage(arg0, +closure_7);
2026-07-20 16:05:17 +00:00
}
async function _queryCache(arg0, arg1) {
if (obj) {
return obj.resume();
} else {
2026-07-23 10:11:24 +00:00
return outer2_1(outer2_2[4]).queryCache(arg0);
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let closure_3 = ["ref"];
let c7 = 1;
2026-07-20 16:05:17 +00:00
class BaseImage {
constructor(arg0) {
2026-07-23 10:11:24 +00:00
size = _objectWithoutProperties(global, _queryCache);
obj = require("getImageSourcesFromImageProps");
2026-07-20 16:05:17 +00:00
size2 = obj.getImageSourcesFromImageProps(size);
if (!size2) {
obj = {};
obj.uri = undefined;
obj.width = undefined;
obj.height = undefined;
size2 = obj;
}
2026-07-23 10:11:24 +00:00
tmp = require("getSourceCodeScriptURL")(size.defaultSource);
tmp2 = require("getSourceCodeScriptURL")(size.loadingIndicatorSource);
2026-07-20 16:05:17 +00:00
if (null != size.children) {
tmp32 = globalThis;
_Error2 = Error;
prototype2 = Error.prototype;
tmp33 = new.target;
str5 = "The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.";
tmp34 = new.target;
error = new Error("The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.");
tmp36 = error;
throw error;
} else {
if (null != size.defaultSource) {
if (null != size.loadingIndicatorSource) {
tmp27 = globalThis;
_Error = Error;
prototype = Error.prototype;
tmp28 = new.target;
str4 = "The <Image> component cannot have defaultSource and loadingIndicatorSource at the same time. Please use either defaultSource or loadingIndicatorSource.";
tmp29 = new.target;
error1 = new Error("The <Image> component cannot have defaultSource and loadingIndicatorSource at the same time. Please use either defaultSource or loadingIndicatorSource.");
tmp31 = error1;
throw error1;
}
}
tmp3 = globalThis;
_Array = Array;
if (Array.isArray(size2)) {
2026-07-23 10:11:24 +00:00
tmp6 = c8;
2026-07-20 16:05:17 +00:00
items = [, ];
2026-07-23 10:11:24 +00:00
items[0] = c8.base;
2026-07-20 16:05:17 +00:00
items[1] = size.style;
items1 = items;
items2 = size2;
} else {
str = "";
if ("" === size2.uri) {
_console = console;
str2 = "source.uri should not be an empty string";
warnResult = console.warn("source.uri should not be an empty string");
}
obj1 = {};
width = size2.width;
if (null == width) {
width = size.width;
}
obj1.width = width;
height = size2.height;
if (null == height) {
height = size.height;
}
obj1.height = height;
items1 = [, , ];
items1[0] = obj1;
2026-07-23 10:11:24 +00:00
tmp5 = c8;
items1[1] = c8.base;
2026-07-20 16:05:17 +00:00
items1[2] = size.style;
items2 = [];
items2[0] = size2;
}
onLoad = size.onLoadStart;
obj2 = {};
obj2.style = items1;
({ onLoadEnd, onError } = size);
if (!onLoad) {
onLoad = size.onLoad;
}
if (!onLoad) {
onLoad = onLoadEnd;
}
if (!onLoad) {
onLoad = onError;
}
obj2.shouldNotifyLoadEvents = onLoad;
obj2.src = items2;
obj2.source = items2;
headers = undefined;
if (null != size2) {
num = 0;
first = size2[0];
if (null != first) {
headers = first.headers;
}
}
if (!headers) {
headers1 = undefined;
if (null != size2) {
headers1 = size2.headers;
}
headers = headers1;
}
obj2.headers = headers;
if (!tmp) {
tmp = null;
}
obj2.defaultSource = tmp;
if (!tmp2) {
tmp2 = null;
}
obj2.loadingIndicatorSrc = tmp2;
2026-07-23 10:11:24 +00:00
alt = size["aria-label"];
2026-07-20 16:05:17 +00:00
if (null == alt) {
alt = size.accessibilityLabel;
}
if (null == alt) {
alt = size.alt;
}
obj2.accessibilityLabel = alt;
prop = undefined;
if (null != size) {
2026-07-23 10:11:24 +00:00
prop = size["aria-labelledby"];
2026-07-20 16:05:17 +00:00
}
if (null == prop) {
prop1 = undefined;
if (null != size) {
prop1 = size.accessibilityLabelledBy;
}
prop = prop1;
}
obj2.accessibilityLabelledBy = prop;
obj2.accessible = undefined !== size.alt || size.accessible;
obj3 = {};
2026-07-23 10:11:24 +00:00
aria_busy = size["aria-busy"];
2026-07-20 16:05:17 +00:00
if (null == aria_busy) {
accessibilityState = size.accessibilityState;
busy = undefined;
if (null != accessibilityState) {
busy = accessibilityState.busy;
}
2026-07-23 10:11:24 +00:00
aria_busy = busy;
2026-07-20 16:05:17 +00:00
}
obj3.busy = aria_busy;
2026-07-23 10:11:24 +00:00
aria_checked = size["aria-checked"];
2026-07-20 16:05:17 +00:00
if (null == aria_checked) {
accessibilityState2 = size.accessibilityState;
checked = undefined;
if (null != accessibilityState2) {
checked = accessibilityState2.checked;
}
2026-07-23 10:11:24 +00:00
aria_checked = checked;
2026-07-20 16:05:17 +00:00
}
obj3.checked = aria_checked;
2026-07-23 10:11:24 +00:00
aria_disabled = size["aria-disabled"];
2026-07-20 16:05:17 +00:00
if (null == aria_disabled) {
accessibilityState3 = size.accessibilityState;
disabled = undefined;
if (null != accessibilityState3) {
disabled = accessibilityState3.disabled;
}
2026-07-23 10:11:24 +00:00
aria_disabled = disabled;
2026-07-20 16:05:17 +00:00
}
obj3.disabled = aria_disabled;
2026-07-23 10:11:24 +00:00
aria_expanded = size["aria-expanded"];
2026-07-20 16:05:17 +00:00
if (null == aria_expanded) {
accessibilityState4 = size.accessibilityState;
expanded = undefined;
if (null != accessibilityState4) {
expanded = accessibilityState4.expanded;
}
2026-07-23 10:11:24 +00:00
aria_expanded = expanded;
2026-07-20 16:05:17 +00:00
}
obj3.expanded = aria_expanded;
2026-07-23 10:11:24 +00:00
aria_selected = size["aria-selected"];
2026-07-20 16:05:17 +00:00
if (null == aria_selected) {
accessibilityState5 = size.accessibilityState;
selected = undefined;
if (null != accessibilityState5) {
selected = accessibilityState5.selected;
}
2026-07-23 10:11:24 +00:00
aria_selected = selected;
2026-07-20 16:05:17 +00:00
}
obj3.selected = aria_selected;
obj2.accessibilityState = obj3;
2026-07-23 10:11:24 +00:00
accessible = Object.assign({}, size, obj2);
tmp17 = cover;
tmp18 = c2;
2026-07-20 16:05:17 +00:00
num2 = 7;
2026-07-23 10:11:24 +00:00
tmp19 = require("flattenStyle")(items1);
tmp20 = accessible;
2026-07-20 16:05:17 +00:00
num3 = 8;
2026-07-23 10:11:24 +00:00
obj6 = require("convertObjectFitToResizeMode");
2026-07-20 16:05:17 +00:00
objectFit = undefined;
if (null != tmp19) {
objectFit = tmp19.objectFit;
}
str3 = obj6.convertObjectFitToResizeMode(objectFit) || size.resizeMode;
if (!str3) {
resizeMode = undefined;
if (null != tmp19) {
resizeMode = tmp19.resizeMode;
}
str3 = resizeMode;
}
if (!str3) {
str3 = "cover";
}
2026-07-23 10:11:24 +00:00
cover = str3;
tmp23 = accessible;
tmp24 = c2;
2026-07-20 16:05:17 +00:00
num4 = 9;
2026-07-23 10:11:24 +00:00
obj7 = require("set");
c2 = obj7.useWrapRefWithImageAttachedCallbacks(global.ref);
2026-07-20 16:05:17 +00:00
tmp25 = jsx;
2026-07-23 10:11:24 +00:00
tmp26 = cover;
2026-07-20 16:05:17 +00:00
num5 = 10;
obj4 = {};
obj4.children = function children(internal_analyticTag) {
if (null !== internal_analyticTag) {
const _Object = Object;
let obj = { internal_analyticTag };
let merged = Object.assign({}, closure_0, obj);
} else {
merged = closure_0;
}
2026-07-23 10:11:24 +00:00
obj = { resizeMode: str3, ref: table };
return outer1_6(str3(table[11]), Object.assign({}, merged, obj));
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
return jsx(require("result").Consumer, obj4);
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-23 10:11:24 +00:00
set = set.unstable_getImageComponentDecorator();
2026-07-20 16:05:17 +00:00
let resultResult = BaseImage;
2026-07-23 10:11:24 +00:00
if (null != set) {
resultResult = set(BaseImage);
2026-07-20 16:05:17 +00:00
}
resultResult.displayName = "Image";
resultResult.getSize = function getSize(arg0, arg1, arg2) {
let fn = arg2;
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const importDefault = arg1;
2026-07-23 10:11:24 +00:00
const size = importDefault(320).getSize(arg0);
2026-07-20 16:05:17 +00:00
if ("function" !== typeof arg1) {
return size;
} else {
if (!fn) {
fn = () => {
console.warn(`Failed to get size for image: ${closure_0}`);
};
}
2026-07-23 10:11:24 +00:00
size.then((width) => callback(width.width, width.height)).catch(fn);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj = importDefault(320);
2026-07-20 16:05:17 +00:00
};
resultResult.getSizeWithHeaders = function getSizeWithHeaders(arg0, arg1) {
let fn = arg3;
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const importDefault = arg2;
2026-07-23 10:11:24 +00:00
const sizeWithHeaders = importDefault(320).getSizeWithHeaders(arg0, arg1);
2026-07-20 16:05:17 +00:00
if ("function" !== typeof arg2) {
return sizeWithHeaders;
} else {
if (!fn) {
fn = () => {
console.warn(`Failed to get size for image: ${closure_0}`);
};
}
2026-07-23 10:11:24 +00:00
sizeWithHeaders.then((width) => callback(width.width, width.height)).catch(fn);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj = importDefault(320);
2026-07-20 16:05:17 +00:00
};
resultResult.prefetch = prefetch;
resultResult.prefetchWithMetadata = function prefetchWithMetadata(arg0, arg1, arg2, arg3) {
return prefetch(arg0, arg3);
};
resultResult.abortPrefetch = function abortPrefetch(_requestId) {
2026-07-23 10:11:24 +00:00
importDefault(320).abortRequest(_requestId);
2026-07-20 16:05:17 +00:00
};
resultResult.queryCache = function queryCache(arg0) {
return _queryCache(...arguments);
};
2026-07-23 10:11:24 +00:00
resultResult.resolveAssetSource = require("getSourceCodeScriptURL");
let closure_8 = require("setStyleAttributePreprocessor").create({ base: { overflow: "hidden" } });
2026-07-20 16:05:17 +00:00
export default resultResult;