decord/alpha/source/modules/quests/VideoQuestUIStore.tsx

166 lines
5.1 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7393
// Function ID: 7394
// Name: VideoQuestUIStore
2026-10-12 06:59:38 +00:00
// Dependencies: [109, 1267, 4990, 7394, 1272, 7395, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7393 (VideoQuestUIStore)
2026-10-09 10:00:15 +00:00
import react_native from "react-native" /* 1272 */;
import _objectWithoutProperties from "_objectWithoutProperties" /* 109 */;
2026-10-09 10:00:15 +00:00
import module_1267_mod from "module_1267" /* 1267 */;
2026-10-10 08:08:14 +00:00
import combine_mod from "combine" /* 4990 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let _require, closure_0;
2026-07-23 10:11:24 +00:00
2026-08-04 21:03:28 +00:00
function _toPropertyKey(obj) {
let StringResult = obj;
if (typeof obj === "object") {
StringResult = obj;
2026-10-03 08:58:59 +00:00
if (StringResult) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol;
2026-08-04 21:03:28 +00:00
if (undefined !== obj[Symbol.toPrimitive]) {
2026-10-03 08:58:59 +00:00
const callResult = obj[Symbol.toPrimitive].call(obj, "string");
2026-07-20 16:05:17 +00:00
StringResult = callResult;
2026-08-04 21:03:28 +00:00
if (typeof callResult === "object") {
2026-07-20 16:05:17 +00:00
const _TypeError = TypeError;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-20 16:05:17 +00:00
const typeError = new TypeError("@@toPrimitive must return a primitive value.");
throw typeError;
}
} else {
const _String = String;
2026-08-04 21:03:28 +00:00
StringResult = String(obj);
2026-07-20 16:05:17 +00:00
}
}
}
let text = StringResult;
2026-08-04 21:03:28 +00:00
if (typeof StringResult !== "symbol") {
2026-07-20 16:05:17 +00:00
text = `${tmp}`;
}
return text;
}
const VideoProgressState = { UNKNOWN: "UNKNOWN", NOT_STARTED: "NOT_STARTED", IN_PROGRESS: "IN_PROGRESS", COMPLETED: "COMPLETED" };
2026-10-09 10:00:15 +00:00
let module_1267 = module_1267_mod;
module_1267 = module_1267.createWithEqualityFn();
2026-10-03 08:58:59 +00:00
let combine = combine_mod;
let obj2 = {
name: "videoQuestUIState",
storage: combine.createJSONStorage(() => require("LocalStorageWrapper")),
partialize(volume) {
return { volume: volume.volume, muted: volume.muted, videoProgress: volume.videoProgress };
},
version: 0
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
const persist = combine.persist;
combine = combine_mod;
2026-10-09 10:00:15 +00:00
const withEqualityFnResult = module_1267(persist((arg0, arg1) => {
_require = arg0;
2026-10-03 08:58:59 +00:00
let closure_1 = arg1;
let obj = {
volume: require("DiscordVideoPlayerTypes").DEFAULT_VIDEO_VOLUME,
2026-07-23 10:11:24 +00:00
muted: false,
transcriptEnabled: false,
captionEnabled: false,
2026-07-20 16:05:17 +00:00
videoProgress: {},
2026-07-23 10:11:24 +00:00
transcript: null,
setVolume(volume) {
2026-10-03 08:58:59 +00:00
let obj = volume(dependencyMap[4]);
obj.batchUpdates(() => {
const obj = { volume };
return volume(obj);
});
2026-07-20 16:05:17 +00:00
},
setMuted(muted) {
2026-10-03 08:58:59 +00:00
let obj = muted(dependencyMap[4]);
obj.batchUpdates(() => {
const obj = { muted };
return muted(obj);
});
2026-07-20 16:05:17 +00:00
},
setVideoProgress(arg0, timestampSec, duration) {
closure_0 = arg0;
const tmp = timestampSec().videoProgress[arg0];
2026-07-29 08:29:29 +00:00
let num;
if (tmp != null) {
num = tmp.maxTimestampSec;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const maxTimestampSec = Math.max(num, timestampSec);
2026-10-03 08:58:59 +00:00
let obj = closure_0(dependencyMap[4]);
obj.batchUpdates(() => {
let obj2;
const obj = { videoProgress: obj2 };
obj2 = {};
const merged = Object.assign(timestampSec().videoProgress);
2026-10-03 08:58:59 +00:00
const obj3 = { timestampSec, duration, maxTimestampSec };
obj2[closure_0] = obj3;
return closure_0(obj);
2026-07-20 16:05:17 +00:00
});
},
setTranscriptEnabled(transcriptEnabled) {
2026-10-03 08:58:59 +00:00
let obj = transcriptEnabled(dependencyMap[4]);
obj.batchUpdates(() => {
const obj = { transcriptEnabled };
return transcriptEnabled(obj);
});
2026-07-20 16:05:17 +00:00
},
setCaptionEnabled(captionEnabled) {
2026-10-03 08:58:59 +00:00
let obj = captionEnabled(dependencyMap[4]);
obj.batchUpdates(() => {
const obj = { captionEnabled };
return captionEnabled(obj);
});
2026-07-20 16:05:17 +00:00
},
getVideoProgress(questId) {
return closure_1().videoProgress[questId];
2026-07-20 16:05:17 +00:00
},
getVideoProgressState(arg0) {
2026-10-03 08:58:59 +00:00
let IN_PROGRESS;
const tmp = closure_1().videoProgress[arg0];
2026-07-20 16:05:17 +00:00
if (null == tmp) {
2026-10-03 08:58:59 +00:00
IN_PROGRESS = obj.UNKNOWN;
2026-07-20 16:05:17 +00:00
} else if (0 === tmp.timestampSec) {
IN_PROGRESS = obj.NOT_STARTED;
2026-07-20 16:05:17 +00:00
} else if (tmp.timestampSec >= tmp.duration) {
IN_PROGRESS = obj.COMPLETED;
2026-07-20 16:05:17 +00:00
} else {
IN_PROGRESS = obj.IN_PROGRESS;
2026-07-20 16:05:17 +00:00
}
return IN_PROGRESS;
},
resetQuest(questId) {
2026-10-03 08:58:59 +00:00
let obj = questId(dependencyMap[4]);
obj.batchUpdates(() => {
2026-07-23 10:11:24 +00:00
const items = [questId];
2026-10-03 08:58:59 +00:00
const obj = { videoProgress: _objectWithoutProperties(closure_1().videoProgress, items.map(_toPropertyKey)) };
questId(obj);
2026-07-20 16:05:17 +00:00
});
},
clearState() {
2026-10-03 08:58:59 +00:00
const obj = react_native;
obj.batchUpdates(() => {
closure_1_0({ videoProgress: {} });
2026-07-20 16:05:17 +00:00
});
},
setTranscriptAsset(transcript) {
2026-10-03 08:58:59 +00:00
let obj = transcript(dependencyMap[4]);
obj.batchUpdates(() => {
const obj = { transcript };
transcript(obj);
2026-07-20 16:05:17 +00:00
});
}
};
2026-10-03 08:58:59 +00:00
return obj;
}, obj2));
const result = size.fileFinishedImporting("modules/quests/VideoQuestUIStore.tsx");
2026-07-20 16:05:17 +00:00
export default withEqualityFnResult;
2026-07-23 10:11:24 +00:00
export const DEFAULT_VIDEO_PROGRESS = { timestampSec: 0, duration: 10, maxTimestampSec: 0 };
export { VideoProgressState };
2026-07-20 16:05:17 +00:00
export const FetchStatus = { NONE: "NONE", FETCHING: "FETCHING", SUCCESS: "SUCCESS", FAILURE: "FAILURE" };
export const useVideoQuestUIStore = withEqualityFnResult;