decord/source/5656__isNativeReflectConstruct.js

384 lines
11 KiB
JavaScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 5656
// Function ID: 5657
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-08-08 06:10:11 +00:00
// Dependencies: [5638, 5639, 5657, 5659, 5660, 5662, 5664]
2026-07-23 10:11:24 +00:00
2026-08-08 06:10:11 +00:00
// Module 5656 (_isNativeReflectConstruct)
2026-07-29 08:29:29 +00:00
import RVMasonryLayoutManagerImpl from "_classCallCheck";
2026-07-23 10:11:24 +00:00
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _get from "_get";
2026-07-29 08:29:29 +00:00
import importDefaultResult from "_createClass";
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
let closure_0 = !callResult;
function _isNativeReflectConstruct() {
return closure_0;
}
return _isNativeReflectConstruct();
} catch (err) {
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
class RVMasonryLayoutManagerImpl {
constructor(arg0, arg1) {
self = this;
tmp = RVMasonryLayoutManagerImpl(this, RVMasonryLayoutManagerImpl);
items = [, ];
items[0] = global;
items[1] = arg1;
tmp2 = __esModule;
obj = __esModule(RVMasonryLayoutManagerImpl);
tmp3 = __esModule;
if (_isNativeReflectConstruct()) {
tmp5 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj, items, tmp2(self).constructor);
} else {
constructResult = obj.apply(self, items);
}
tmp3Result = tmp3(self, constructResult);
tmp3Result.currentColumn = 0;
tmp3Result.fullRelayoutRequired = false;
tmp3Result.boundedSize = global.windowSize.width;
tmp3Result.optimizeItemArrangement = global.optimizeItemArrangement;
columnHeights = tmp3Result.columnHeights;
if (columnHeights == null) {
tmp7 = globalThis;
_Array = Array;
ArrayResult = Array(tmp3Result.maxColumns);
columnHeights = require("_classCallCheck");
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3Result.columnHeights = columnHeights;
return tmp3Result;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
require("_inherits")(RVMasonryLayoutManagerImpl, require("RVLayoutManager").RVLayoutManager);
let items = [
{
2026-07-20 16:05:17 +00:00
key: "updateLayoutParams",
value: function updateLayoutParams(windowSize) {
let maxColumns;
let optimizeItemArrangement;
2026-07-29 08:29:29 +00:00
let self = this;
self = this;
let c1;
2026-07-20 16:05:17 +00:00
({ maxColumns, optimizeItemArrangement } = this);
2026-07-29 08:29:29 +00:00
const tmp = callback2(callback(self.prototype), "updateLayoutParams", this);
c1 = tmp;
let fn = tmp;
2026-08-04 21:03:28 +00:00
if (typeof tmp === "function") {
2026-07-29 08:29:29 +00:00
fn = (items) => _undefined.apply(self, items);
}
2026-07-20 16:05:17 +00:00
const items = [windowSize];
2026-07-29 08:29:29 +00:00
!fn(items);
if (!tmp3) {
2026-07-20 16:05:17 +00:00
self.boundedSize = windowSize.windowSize.width;
if (self.layouts.length > 0) {
self.updateAllWidths();
self.recomputeLayouts(0, self.layouts.length - 1);
self.requiresRepaint = true;
}
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "processLayoutInfo",
value: function processLayoutInfo(arg0, arg1) {
const self = this;
const iter = arg0[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let index = nextResult.index;
let tmp2 = self.layouts[index];
tmp2.height = nextResult.dimensions.height;
tmp2.isHeightMeasured = true;
tmp2.isWidthMeasured = true;
self.layouts[index] = tmp2;
2026-07-23 10:11:24 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
if (self.fullRelayoutRequired) {
self.updateAllWidths();
self.fullRelayoutRequired = false;
return 0;
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "estimateLayout",
value: function estimateLayout(arg0) {
2026-07-23 10:11:24 +00:00
this.layouts[arg0].width = this.getWidth(arg0);
this.layouts[arg0].height = this.getEstimatedHeight(arg0);
this.layouts[arg0].isWidthMeasured = true;
this.layouts[arg0].enforcedWidth = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "handleSpanChange",
value: function handleSpanChange(arg0) {
this.fullRelayoutRequired = true;
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "getLayoutSize",
value: function getLayoutSize() {
const self = this;
if (0 === this.layouts.length) {
2026-07-23 10:11:24 +00:00
return { width: 0, height: 0 };
2026-07-20 16:05:17 +00:00
} else {
const _Math = Math;
2026-07-29 08:29:29 +00:00
const items = [];
HermesBuiltin.arraySpread(self.columnHeights, 0);
2026-07-20 16:05:17 +00:00
const _Math2 = Math;
2026-07-29 08:29:29 +00:00
const obj = { width: null, height: null };
obj[0] = self.boundedSize;
obj[1] = HermesBuiltin.apply(items, Math);
2026-07-20 16:05:17 +00:00
return obj;
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "recomputeLayouts",
value: function recomputeLayouts(sum) {
const self = this;
if (0 === sum) {
const _Array = Array;
self.columnHeights = Array(self.maxColumns).fill(0);
self.currentColumn = 0;
const ArrayResult = Array(self.maxColumns);
} else {
const result = self.updateColumnHeightsToIndex(sum);
}
if (sum < self.layouts.length) {
do {
let layout = self.getLayout(sum);
let span = self.getSpan(sum, true);
let tmp6 = sum;
if (self.optimizeItemArrangement) {
if (1 === span) {
let result1 = self.placeSingleColumnItem(layout);
} else {
let result2 = self.placeOptimizedMultiColumnItem(layout, span);
}
} else {
let result3 = self.placeItemSequentially(layout, span);
}
sum = sum + 1;
} while (sum < length);
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "getWidth",
value: function getWidth(sum) {
const result = this.boundedSize / this.maxColumns;
return result * this.getSpan(sum);
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "updateAllWidths",
value: function updateAllWidths() {
let length;
const self = this;
let num = 0;
if (0 < this.layouts.length) {
do {
self.layouts[num].width = self.getWidth(num);
self.layouts[num].minHeight = undefined;
num = num + 1;
length = self.layouts.length;
} while (num < length);
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "placeItemSequentially",
value: function placeItemSequentially(layout, span) {
const self = this;
if (this.currentColumn + span > this.maxColumns) {
self.currentColumn = 0;
}
2026-07-29 08:29:29 +00:00
let tmp = self.columnHeights[self.currentColumn];
2026-07-20 16:05:17 +00:00
let sum = self.currentColumn + 1;
let tmp3 = tmp;
if (sum < self.currentColumn + span) {
do {
2026-07-29 08:29:29 +00:00
let tmp4 = sum;
let tmp5 = tmp;
let bound = tmp;
2026-07-20 16:05:17 +00:00
if (sum < self.maxColumns) {
let _Math = Math;
2026-07-29 08:29:29 +00:00
bound = Math.max(tmp, self.columnHeights[sum]);
2026-07-20 16:05:17 +00:00
}
sum = sum + 1;
2026-07-29 08:29:29 +00:00
tmp = bound;
2026-07-20 16:05:17 +00:00
tmp3 = bound;
} while (sum < self.currentColumn + span);
}
layout.x = self.boundedSize / self.maxColumns * self.currentColumn;
2026-07-29 08:29:29 +00:00
layout.y = tmp3;
2026-07-20 16:05:17 +00:00
let currentColumn = self.currentColumn;
if (currentColumn < self.currentColumn + span) {
do {
2026-07-29 08:29:29 +00:00
let tmp7 = currentColumn;
2026-07-20 16:05:17 +00:00
if (currentColumn < self.maxColumns) {
2026-07-29 08:29:29 +00:00
self.columnHeights[currentColumn] = tmp3 + layout.height;
2026-07-20 16:05:17 +00:00
}
currentColumn = currentColumn + 1;
} while (currentColumn < self.currentColumn + span);
}
self.currentColumn = self.currentColumn + span;
if (self.currentColumn >= self.maxColumns) {
self.currentColumn = 0;
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "placeSingleColumnItem",
value: function placeSingleColumnItem(layout) {
const self = this;
let first = this.columnHeights[0];
2026-07-29 08:29:29 +00:00
let num = 0;
2026-07-20 16:05:17 +00:00
let num2 = 1;
let num3 = 0;
if (1 < this.maxColumns) {
do {
2026-07-29 08:29:29 +00:00
let tmp2 = num2;
let tmp3 = first;
let tmp4 = num;
2026-07-20 16:05:17 +00:00
if (self.columnHeights[num2] < first) {
2026-07-29 08:29:29 +00:00
tmp3 = self.columnHeights[num2];
tmp4 = num2;
2026-07-20 16:05:17 +00:00
}
num2 = num2 + 1;
2026-07-29 08:29:29 +00:00
first = tmp3;
num = tmp4;
num3 = tmp4;
2026-07-20 16:05:17 +00:00
} while (num2 < self.maxColumns);
}
2026-07-29 08:29:29 +00:00
layout.x = self.boundedSize / self.maxColumns * num3;
layout.y = self.columnHeights[num3];
2026-07-20 16:05:17 +00:00
const columnHeights = self.columnHeights;
2026-07-29 08:29:29 +00:00
columnHeights[num3] = columnHeights[num3] + layout.height;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "placeOptimizedMultiColumnItem",
value: function placeOptimizedMultiColumnItem(layout, span) {
2026-07-29 08:29:29 +00:00
let sum;
let sum5;
2026-07-20 16:05:17 +00:00
const self = this;
let num = 0;
let num2 = 0;
let num3 = 0;
if (0 <= this.maxColumns - span) {
do {
2026-07-29 08:29:29 +00:00
let bound = self.columnHeights[num];
sum = num + 1;
let tmp3 = num;
let tmp4 = MAX_VALUE;
let tmp5 = num2;
let tmp6 = bound;
let sum1 = sum;
if (sum < num + span) {
2026-07-20 16:05:17 +00:00
do {
let _Math = Math;
2026-07-29 08:29:29 +00:00
bound = Math.max(bound, self.columnHeights[sum1]);
sum1 = sum1 + 1;
tmp6 = bound;
sum2 = num + span;
} while (sum1 < sum2);
2026-07-20 16:05:17 +00:00
}
let num4 = 0;
let num5 = 0;
let num6 = 0;
if (0 < self.maxColumns) {
while (true) {
2026-07-29 08:29:29 +00:00
let tmp9 = num4;
let tmp10 = num5;
if (num <= num4) {
if (num4 < num + span) {
let sum3 = tmp6 + layout.height;
num5 = num5 + sum3;
num4 = num4 + 1;
num6 = num5;
if (num4 >= self.maxColumns) {
2026-07-20 16:05:17 +00:00
break;
}
}
}
2026-07-29 08:29:29 +00:00
sum3 = self.columnHeights[num4];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (num6 < tmp4) {
tmp4 = num6;
tmp5 = num;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
MAX_VALUE = tmp4;
num2 = tmp5;
num = sum;
num3 = tmp5;
} while (sum <= self.maxColumns - span);
2026-07-20 16:05:17 +00:00
}
const columnHeights = self.columnHeights;
2026-07-29 08:29:29 +00:00
const items = [...columnHeights.slice(num3, num3 + span)];
const applyResult = Math.max.apply(items);
2026-07-20 16:05:17 +00:00
layout.x = self.boundedSize / self.maxColumns * num3;
layout.y = applyResult;
2026-07-29 08:29:29 +00:00
let sum4 = num3;
2026-07-20 16:05:17 +00:00
if (num3 < num3 + span) {
do {
2026-07-29 08:29:29 +00:00
self.columnHeights[sum4] = applyResult + layout.height;
sum4 = sum4 + 1;
sum5 = num3 + span;
} while (sum4 < sum5);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "updateColumnHeightsToIndex",
value: function updateColumnHeightsToIndex(sum) {
const self = this;
let num = 0;
this.columnHeights = Array(this.maxColumns).fill(0);
this.currentColumn = 0;
if (0 < sum) {
do {
let size = self.layouts[num];
let result = self.boundedSize / self.maxColumns;
let _Math = Math;
let rounded = Math.round(size.width / result);
let _Math2 = Math;
let rounded1 = Math.round(size.x / result);
let _Math3 = Math;
let bound = Math.min(rounded1 + rounded, self.maxColumns);
2026-07-29 08:29:29 +00:00
let tmp5 = num;
2026-07-20 16:05:17 +00:00
sum = rounded1;
if (rounded1 < bound) {
do {
let _Math4 = Math;
self.columnHeights[sum] = Math.max(self.columnHeights[sum], size.y + size.height);
sum = sum + 1;
} while (sum < bound);
}
if (!self.optimizeItemArrangement) {
self.currentColumn = (rounded1 + rounded) % self.maxColumns;
}
num = num + 1;
} while (num < sum);
}
}
2026-07-29 08:29:29 +00:00
}
];
export const RVMasonryLayoutManagerImpl = importDefaultResult(RVMasonryLayoutManagerImpl, items);