138 lines
3.5 KiB
TypeScript
138 lines
3.5 KiB
TypeScript
// Metro module 5987 (f5988).
|
|
import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties";
|
|
import { createWithEqualityFn } from "../../_bundle/identity_700";
|
|
import { persist, createJSONStorage } from "../../_bundle/createJSONStorage";
|
|
import { DEFAULT_VIDEO_VOLUME } from "../../_bundle/Module5988";
|
|
import { batchUpdates } from "../../_bundle/Module705";
|
|
import LocalStorageWrapper from "../zustand/LocalStorageWrapper";
|
|
let c3782_5;
|
|
const _toPropertyKey = function _toPropertyKey(a0) {
|
|
let r2 = a0;
|
|
if (typeof a0 === "object") {
|
|
r2 = a0;
|
|
if (a0) {
|
|
const r5 = a0[Symbol.toPrimitive];
|
|
if (r5 !== void 0) {
|
|
r2 = r5.call(a0, "string");
|
|
if (typeof r2 === "object") {
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
} else {
|
|
r2 = String(a0);
|
|
}
|
|
}
|
|
}
|
|
let r19 = r2;
|
|
if (typeof r19 !== "symbol") {
|
|
r19 = "" + r2;
|
|
}
|
|
return r19;
|
|
};
|
|
c3782_5 = {
|
|
UNKNOWN: "UNKNOWN",
|
|
NOT_STARTED: "NOT_STARTED",
|
|
IN_PROGRESS: "IN_PROGRESS",
|
|
COMPLETED: "COMPLETED"
|
|
};
|
|
const r24 = {
|
|
NONE: "NONE",
|
|
FETCHING: "FETCHING",
|
|
SUCCESS: "SUCCESS",
|
|
FAILURE: "FAILURE"
|
|
};
|
|
const r41 = createWithEqualityFn()(persist((c15347_0, c15347_1) => ({
|
|
volume: DEFAULT_VIDEO_VOLUME,
|
|
muted: false,
|
|
transcriptEnabled: false,
|
|
captionEnabled: false,
|
|
videoProgress: {},
|
|
transcript: null,
|
|
setVolume: (volume) => {
|
|
batchUpdates(() => c15347_0({
|
|
volume
|
|
}));
|
|
},
|
|
setMuted: (muted) => {
|
|
batchUpdates(() => c15347_0({
|
|
muted
|
|
}));
|
|
},
|
|
setVideoProgress: (a0, a1, duration) => {
|
|
const timestampSec = a1;
|
|
let r7 = c15347_1().videoProgress[a0]?.maxTimestampSec;
|
|
if (r7 == null) {
|
|
r7 = 0;
|
|
}
|
|
const maxTimestampSec = Math.max(r7, a1);
|
|
batchUpdates(() => {
|
|
const videoProgress = {
|
|
...c15347_1().videoProgress
|
|
};
|
|
videoProgress[a0] = {
|
|
timestampSec,
|
|
duration,
|
|
maxTimestampSec
|
|
};
|
|
return c15347_0({
|
|
videoProgress
|
|
});
|
|
});
|
|
},
|
|
setTranscriptEnabled: (transcriptEnabled) => {
|
|
batchUpdates(() => c15347_0({
|
|
transcriptEnabled
|
|
}));
|
|
},
|
|
setCaptionEnabled: (captionEnabled) => {
|
|
batchUpdates(() => c15347_0({
|
|
captionEnabled
|
|
}));
|
|
},
|
|
getVideoProgress: (a0) => c15347_1().videoProgress[a0],
|
|
getVideoProgressState: (a0) => {
|
|
const r7 = c15347_1().videoProgress[a0];
|
|
return r7 == null ? c3782_5.UNKNOWN : r7.timestampSec === 0 ? c3782_5.NOT_STARTED : r7.timestampSec >= r7.duration ? c3782_5.COMPLETED : c3782_5.IN_PROGRESS;
|
|
},
|
|
resetQuest: (c25671_0) => {
|
|
batchUpdates(() => {
|
|
const videoProgress = c15347_1().videoProgress;
|
|
videoProgress[c25671_0];
|
|
c15347_0({
|
|
videoProgress: _objectWithoutProperties(videoProgress, [c25671_0].map(_toPropertyKey))
|
|
});
|
|
});
|
|
},
|
|
clearState: () => {
|
|
batchUpdates(() => {
|
|
c15347_0({
|
|
videoProgress: {}
|
|
});
|
|
});
|
|
},
|
|
setTranscriptAsset: (transcript) => {
|
|
batchUpdates(() => {
|
|
c15347_0({
|
|
transcript
|
|
});
|
|
});
|
|
}
|
|
}), {
|
|
name: "videoQuestUIState",
|
|
storage: createJSONStorage(() => LocalStorageWrapper),
|
|
partialize: (a0) => ({
|
|
volume: a0.volume,
|
|
muted: a0.muted,
|
|
videoProgress: a0.videoProgress
|
|
}),
|
|
version: 0
|
|
}));
|
|
export default r41;
|
|
export const DEFAULT_VIDEO_PROGRESS = {
|
|
timestampSec: 0,
|
|
duration: 10,
|
|
maxTimestampSec: 0
|
|
};
|
|
export { c3782_5 as VideoProgressState };
|
|
export { r24 as FetchStatus };
|
|
export { r41 as useVideoQuestUIStore };
|