decord/alpha/source/modules/applications/useGetOrFetchApplications.tsx
2026-10-12 06:59:38 +00:00

185 lines
5.3 KiB
TypeScript

// Module ID: 6858
// Function ID: 6859
// Name: useGetOrFetchApplications
// Dependencies: [19, 5440, 558, 576, 568, 6853, 12, 1388, 504, 2]
// Module 6858 (useGetOrFetchApplications)
import _modDef12 from "module_12" /* 12 */;
import shallowEqual from "shallowEqual" /* 568 */;
import react2 from "react" /* 576 */;
import GlobalUtils from "GlobalUtils" /* 1388 */;
import ApplicationActionCreatorsDefault from "ApplicationActionCreators" /* 6853 */;
import react from "react" /* 19 */;
import ApplicationStore from "ApplicationStore" /* 5440 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let _require, application, dependencyMap;
let ReactCompilerGating = ReactCompilerGating_mod;
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useGetOrFetchApplications(current, arg1) {
let first;
let ref;
_require = current;
let tmp = _require;
let obj = require("react");
const cResult = obj.c(8);
let closure_1 = tmp4;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
dependencyMap = react.useRef(first);
const obj2 = react;
if (cResult[1] === current) {
let tmp6;
let tmp7;
let tmp9;
let tmp11;
if (cResult[2] === (undefined === arg1 || arg1)) {
tmp6 = cResult[3];
tmp7 = cResult[4];
}
const effect = obj2.useEffect(tmp6, tmp7);
const _Symbol = Symbol;
if (cResult[5] === Symbol.for("react.memo_cache_sentinel")) {
const items1 = [ApplicationStore];
cResult[5] = items1;
tmp9 = items1;
} else {
tmp9 = cResult[5];
}
if (cResult[6] !== current) {
class A {
constructor() {
return closure_0.map((item) => {
application = undefined;
if (null != item) {
application = application.getApplication(item);
}
return application;
});
}
}
cResult[6] = current;
cResult[7] = A;
tmp11 = A;
} else {
class A {
constructor() {
return closure_0.map((item) => {
application = undefined;
if (null != item) {
application = application.getApplication(item);
}
return application;
});
}
}
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStoresArray(tmp9, tmp11);
}
const fn = function p() {
let tmp = closure_1;
if (tmp) {
const obj = shallowEqual;
tmp = !obj.areArraysShallowEqual(current, ref.current);
}
if (tmp) {
const fetchApplications = ApplicationActionCreatorsDefault.fetchApplications;
ApplicationActionCreatorsDefault;
const arr = _modDef12(current);
const found = arr.filter(GlobalUtils.isNotNullish);
const iter = found.uniq();
const applications = fetchApplications(iter.value(), false);
ref.current = current;
}
};
const items2 = [current, tmp4];
cResult[1] = current;
cResult[2] = undefined === arg1 || arg1;
cResult[3] = fn;
cResult[4] = items2;
tmp7 = items2;
tmp6 = fn;
}) : (function useGetOrFetchApplications(current) {
let ref;
_require = current;
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
dependencyMap = react.useRef([]);
const items = [current, flag];
const effect = react.useEffect(() => {
let tmp = flag;
if (tmp) {
const obj = shallowEqual;
tmp = !obj.areArraysShallowEqual(current, ref.current);
}
if (tmp) {
const fetchApplications = ApplicationActionCreatorsDefault.fetchApplications;
ApplicationActionCreatorsDefault;
const arr = _modDef12(current);
const found = arr.filter(GlobalUtils.isNotNullish);
const iter = found.uniq();
const applications = fetchApplications(iter.value(), false);
ref.current = current;
}
}, items);
let obj = require("get initialized");
const items1 = [ApplicationStore];
return obj.useStateFromStoresArray(items1, () => current.map((item) => {
application = undefined;
if (null != item) {
application = application.getApplication(item);
}
return application;
}));
});
let closure_5 = tmp2;
ReactCompilerGating = ReactCompilerGating_mod;
let tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useGetOrFetchApplication(arg0, arg1) {
let tmp3;
const obj = react2;
const cResult = obj.c(2);
const tmp2 = undefined === arg1 || arg1;
if (cResult[0] !== arg0) {
let items1;
if (null != arg0) {
const items = [arg0];
items1 = items;
} else {
items1 = [];
}
cResult[0] = arg0;
cResult[1] = items1;
tmp3 = items1;
} else {
tmp3 = cResult[1];
}
return closure_5(tmp3, tmp2)[0];
}) : (function useGetOrFetchApplication(arg0) {
let items1;
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
const tmp = closure_5;
if (null != arg0) {
const items = [arg0];
items1 = items;
} else {
items1 = [];
}
return tmp(items1, flag)[0];
});
const result = size.fileFinishedImporting("modules/applications/useGetOrFetchApplications.tsx");
export default tmp2;
export const useGetOrFetchApplication = tmp3;