2026-09-28 16:18:32 +00:00
|
|
|
// Module ID: 11058
|
|
|
|
|
// Function ID: 11059
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: useGetOrFetchApplicationBatched
|
2026-09-28 16:18:32 +00:00
|
|
|
// Dependencies: [19, 5063, 2040, 12, 6584, 504, 2]
|
2026-09-26 17:57:22 +00:00
|
|
|
// Exports: useGetOrFetchApplicationBatched, useRequestApplication
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-09-28 16:18:32 +00:00
|
|
|
// Module 11058 (useGetOrFetchApplicationBatched)
|
|
|
|
|
import Timers from "Timers" /* 2040 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import react from "react" /* 19 */;
|
2026-09-28 16:18:32 +00:00
|
|
|
import ApplicationStore from "ApplicationStore" /* 5063 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
|
|
|
|
const require = globalThis.__r;
|
2026-10-01 14:13:23 +00:00
|
|
|
let _require;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
|
|
|
|
class ApplicationFetchManager {
|
|
|
|
|
constructor() {
|
|
|
|
|
obj = Object.create(new.target.prototype);
|
2026-10-01 14:13:23 +00:00
|
|
|
obj._lastFetchedAttempted = new Map();
|
|
|
|
|
new Map();
|
|
|
|
|
obj._pending = new Set();
|
|
|
|
|
new Set();
|
|
|
|
|
const delayedCall = new Timers.DelayedCall(32, () => obj._flush());
|
2026-09-18 19:45:33 +00:00
|
|
|
obj._flushHandler = delayedCall;
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
request(arg0) {
|
|
|
|
|
const self = this;
|
|
|
|
|
const _pending = this._pending;
|
|
|
|
|
if (!_pending.has(arg0)) {
|
|
|
|
|
const _lastFetchedAttempted = self._lastFetchedAttempted;
|
|
|
|
|
const value = _lastFetchedAttempted.get(arg0);
|
|
|
|
|
let tmp3 = null != value;
|
|
|
|
|
if (tmp3) {
|
|
|
|
|
const _Date = Date;
|
|
|
|
|
tmp3 = Date.now() - value < 60000;
|
|
|
|
|
}
|
|
|
|
|
if (!tmp3) {
|
|
|
|
|
const _pending2 = self._pending;
|
|
|
|
|
_pending2.add(arg0);
|
|
|
|
|
const _flushHandler = self._flushHandler;
|
|
|
|
|
_flushHandler.delay(false);
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
_flush() {
|
|
|
|
|
const self = this;
|
|
|
|
|
const items = [];
|
|
|
|
|
const _pending1 = this._pending;
|
|
|
|
|
const item = _pending1.forEach((item) => {
|
|
|
|
|
const _lastFetchedAttempted = self._lastFetchedAttempted;
|
|
|
|
|
const result = _lastFetchedAttempted.set(item, Date.now());
|
|
|
|
|
items.push(item);
|
2026-09-18 19:45:33 +00:00
|
|
|
});
|
2026-10-01 14:13:23 +00:00
|
|
|
const _pending = this._pending;
|
|
|
|
|
_pending.clear();
|
|
|
|
|
const items1 = [];
|
|
|
|
|
const items2 = [];
|
|
|
|
|
const item1 = items.forEach((item) => {
|
|
|
|
|
if (ApplicationStore.didFetchingApplicationFail(item)) {
|
|
|
|
|
items2.push(item);
|
|
|
|
|
} else {
|
|
|
|
|
items1.push(item);
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
});
|
2026-10-01 14:13:23 +00:00
|
|
|
if (items1.length > 0) {
|
|
|
|
|
obj = items(items1[3]);
|
|
|
|
|
const chunkResult = obj.chunk(items1, 20);
|
|
|
|
|
const item2 = chunkResult.forEach((item) => {
|
|
|
|
|
obj = items(items1[4]);
|
|
|
|
|
const applications = obj.fetchApplications(item, false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (items2.length > 0) {
|
|
|
|
|
const obj2 = items(items1[3]);
|
|
|
|
|
const chunkResult1 = obj2.chunk(items2, 20);
|
|
|
|
|
const item3 = chunkResult1.forEach((item) => {
|
|
|
|
|
obj = items(items1[4]);
|
|
|
|
|
const applications = obj.fetchApplications(item, true);
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
|
|
|
|
const prototype = ApplicationFetchManager.prototype;
|
|
|
|
|
let obj = Object.create(ApplicationFetchManager.prototype);
|
|
|
|
|
const map = new Map();
|
|
|
|
|
obj._lastFetchedAttempted = map;
|
|
|
|
|
const set = new Set();
|
|
|
|
|
obj._pending = set;
|
|
|
|
|
let delayedCall = new Timers.DelayedCall(32, () => obj._flush());
|
|
|
|
|
obj._flushHandler = delayedCall;
|
2026-09-26 17:57:22 +00:00
|
|
|
let result = size.fileFinishedImporting("modules/applications/useGetOrFetchApplicationBatched.tsx");
|
|
|
|
|
|
|
|
|
|
export const useRequestApplication = function useRequestApplication(arg0) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let closure_0 = arg0;
|
2026-09-18 19:45:33 +00:00
|
|
|
const items = [arg0];
|
2026-10-01 14:13:23 +00:00
|
|
|
const effect = react.useEffect(() => {
|
|
|
|
|
const tmp2 = null != closure_0 && "" !== tmp;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (tmp2) {
|
2026-10-01 14:13:23 +00:00
|
|
|
obj.request(closure_0);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}, items);
|
2026-09-26 17:57:22 +00:00
|
|
|
};
|
|
|
|
|
export const useGetOrFetchApplicationBatched = function useGetOrFetchApplicationBatched(applicationId) {
|
|
|
|
|
_require = applicationId;
|
|
|
|
|
const items = [applicationId];
|
2026-10-01 14:13:23 +00:00
|
|
|
const effect = react.useEffect(() => {
|
|
|
|
|
const tmp2 = null != closure_0 && "" !== tmp;
|
2026-09-26 17:57:22 +00:00
|
|
|
if (tmp2) {
|
2026-10-01 14:13:23 +00:00
|
|
|
obj.request(closure_0);
|
2026-09-26 17:57:22 +00:00
|
|
|
}
|
|
|
|
|
}, items);
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = require("get initialized");
|
2026-09-26 17:57:22 +00:00
|
|
|
const items1 = [ApplicationStore];
|
|
|
|
|
const items2 = [applicationId];
|
2026-10-01 14:13:23 +00:00
|
|
|
return obj.useStateFromStores(items1, () => {
|
2026-09-18 19:45:33 +00:00
|
|
|
let application = null;
|
2026-10-01 14:13:23 +00:00
|
|
|
if (null != applicationId) {
|
2026-09-18 19:45:33 +00:00
|
|
|
application = null;
|
2026-10-01 14:13:23 +00:00
|
|
|
if ("" !== applicationId) {
|
2026-09-18 19:45:33 +00:00
|
|
|
application = ApplicationStore.getApplication(tmp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return application;
|
2026-09-26 17:57:22 +00:00
|
|
|
}, items2);
|
|
|
|
|
};
|