decord/source/modules/clips/ClipsStore.tsx

920 lines
29 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 4357
// Function ID: 4358
2026-07-29 08:29:29 +00:00
// Name: _migrateDefaultStorage
2026-08-08 06:10:11 +00:00
// Dependencies: [5, 4323, 1218, 4358, 676, 4359, 3912, 4360, 38, 4361, 4367, 1384, 4370, 4371, 589, 4351, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-08 06:10:11 +00:00
// Module 4357 (_migrateDefaultStorage)
2026-07-29 08:29:29 +00:00
import closure_3 from "RESOLUTION_720";
import initialize from "initialize";
import fetchFingerprint from "fetchFingerprint";
2026-07-23 10:11:24 +00:00
import result from "result";
import { VoiceFlags } from "ME";
2026-07-29 08:29:29 +00:00
import RESOLUTION_720 from "RESOLUTION_720";
import { DeviceSettingsStore } from "initialize";
import set from "fetchFingerprint";
2026-07-20 16:05:17 +00:00
let ApplicationStreamFPS;
let ApplicationStreamResolutions;
let ClipsLengthSettings;
let ClipsViewerConnectivitySettings;
2026-07-22 07:54:56 +00:00
let DEFAULT_CLIPS_BITRATE_PERCENT;
2026-07-20 16:05:17 +00:00
let DEFAULT_MAX_AUTO_CLIPS;
2026-07-29 08:29:29 +00:00
let c10;
let c9;
2026-08-04 08:36:32 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let closure_6;
let error;
let metroImportAll;
2026-08-04 08:36:32 +00:00
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
function _migrateDefaultStorage() {
const self = this;
const tmp = callback(function*() {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-08 06:10:11 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let callback2 = tmp3;
let callback = tmp7;
callback = undefined;
callback2 = undefined;
2026-08-04 08:36:32 +00:00
if (outer1_31.clipsSettings.storageLocation === outer1_14) {
2026-07-29 08:29:29 +00:00
if (null != outer1_1(outer1_2[6])) {
if (null != outer1_1(outer1_2[6]).app) {
let c3 = 1;
const app2 = outer1_1(outer1_2[6]).app;
c4 = 3;
c5 = 1;
const obj1 = { value: null, done: false };
obj1[0] = app2.getPath("videos");
return obj1;
}
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
c5 = 3;
}
} else if (1 === tmp7) {
c3 = 0;
logger.error("Failed to resolve videos path for default storage migration", dependencyMap);
2026-08-07 06:50:47 +00:00
const app = callback2(3912).app;
2026-07-29 08:29:29 +00:00
c4 = 2;
c5 = 1;
const obj2 = { value: null, done: false };
obj2[0] = app.getPath("documents");
return obj2;
} else {
if (2 === tmp7) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
callback = arg1;
}
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
const obj3 = { value: null, done: true };
obj3[0] = arg1;
return obj3;
} else {
callback2 = arg1;
2026-08-08 06:10:11 +00:00
obj = callback(4360);
2026-08-04 08:36:32 +00:00
callback = obj.pathJoin(callback2, closure_15);
2026-07-29 08:29:29 +00:00
c3 = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
clipsSettings.clipsSettings.storageLocation = callback;
2026-08-04 08:36:32 +00:00
closure_34.emitChange();
2026-07-29 08:29:29 +00:00
}
c5 = 3;
const obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
} catch (tmp36) {
dependencyMap = tmp36;
if (tmp4 === c3) {
c5 = tmp2;
throw tmp36;
} else {
c4 = tmp;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
});
const _migrateDefaultStorage = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function trackSharedRemoteClipId(arg0, arg1, arg2) {
if (obj.getConfig({ location: "trackSharedRemoteClipId" }).enableDistributedClips) {
if (arg2 !== store.getId()) {
return false;
} else {
let flag2 = false;
2026-07-29 08:29:29 +00:00
const iter = arg1[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
if (null != nextResult.clip_remote_id) {
let obj2 = map;
let value = map.get(arg0);
let obj3 = value;
if (null == value) {
let _Set = Set;
let tmp8 = new.target;
let tmp9 = new.target;
let set = new Set();
let tmp11 = set;
obj3 = set;
let result = obj2.set(arg0, set);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp13 = obj3;
let tmp14 = nextResult;
let addResult = obj3.add(tmp6.clip_remote_id);
flag2 = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag2;
2026-07-20 16:05:17 +00:00
}
} else {
return false;
}
2026-08-08 06:10:11 +00:00
obj = importDefault(4370);
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
({ CLIPS_HARDWARE_CLASSIFICATION_VERSION: closure_6, ClipSaveTypes: error, ClipsUserEducationType: metroImportAll, ClipsLogger: c9, MAX_SIMULTANEOUS_SAVE_CLIP_OPERATIONS: c10, ClipsHardwareClassification: unpackModuleId, ClipsSaveNoOpReason: closure_12, ClipsLengthSettings, ClipsViewerConnectivitySettings, DEFAULT_MAX_AUTO_CLIPS, DEFAULT_CLIPS_BITRATE_PERCENT } = result);
let c14 = "default";
let c15 = "Discord Clips";
2026-07-29 08:29:29 +00:00
let closure_16 = {};
2026-08-04 08:36:32 +00:00
let closure_17 = {};
let closure_18 = {};
let closure_19 = [];
let c20 = 0;
2026-07-29 08:29:29 +00:00
let c21 = null;
2026-08-04 08:36:32 +00:00
let c22 = null;
let c23 = null;
let closure_24 = {};
let closure_25 = {};
let c26 = null;
2026-07-29 08:29:29 +00:00
({ ApplicationStreamFPS, ApplicationStreamResolutions } = RESOLUTION_720);
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-08-04 08:36:32 +00:00
let c28 = false;
2026-07-20 16:05:17 +00:00
const map = new Map();
2026-08-08 06:10:11 +00:00
obj = { clipsEnabled: false, storageLocation: "default", clipsQuality: obj, clipsLength: ClipsLengthSettings.SECONDS_30, remindersEnabled: true, decoupledClipsEnabled: false, viewerClipsEnabled: true, viewerConnectivity: ClipsViewerConnectivitySettings.ALL, maxAutoClips: DEFAULT_MAX_AUTO_CLIPS, clipSignals: { enableDistributedSignals: true, enableGameSignals: true }, debugTooltipsEnabled: false, enableAutoclipping: "ct", showPovClipsInGallery: "Array" };
2026-07-29 08:29:29 +00:00
obj = { resolution: ApplicationStreamResolutions.RESOLUTION_1080, frameRate: ApplicationStreamFPS.FPS_30, bitratePercent: DEFAULT_CLIPS_BITRATE_PERCENT };
2026-08-04 08:36:32 +00:00
let closure_31 = { clipsSettings: obj, hardwareClassification: null, hardwareClassificationForDecoupled: null, hardwareClassificationVersion: 0, newClipIds: [], hasClips: false, hasTakenDecoupledClip: false, clipsEducationState: { dismissedAt: null, numberOfGamesLaunchedSinceDismissal: 0, numberOfTimesDismissed: 0 } };
2026-07-29 08:29:29 +00:00
class ClipsStoreClass extends DeviceSettingsStore {
}
const prototype = ClipsStoreClass.prototype;
prototype["initialize"] = function initialize(arg0) {
if (null != arg0) {
2026-08-04 08:36:32 +00:00
let closure_31 = arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
(function migrateDefaultStorage() {
const self = this;
2026-08-04 08:36:32 +00:00
const apply = closure_32.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
})();
this.waitFor(initialize);
};
prototype["getClips"] = function getClips() {
2026-08-04 08:36:32 +00:00
return closure_16;
2026-07-29 08:29:29 +00:00
};
prototype["getClipById"] = function getClipById(arg0) {
return dependencyMap[arg0];
};
prototype["getClipByRemoteId"] = function getClipByRemoteId(arg0) {
if (null != table2[arg0]) {
return dependencyMap[tmp];
}
};
prototype["getClipCandidates"] = function getClipCandidates() {
2026-08-04 08:36:32 +00:00
return closure_19;
2026-07-29 08:29:29 +00:00
};
prototype["getClipCandidateById"] = function getClipCandidateById(arg0) {
return table[arg0];
};
prototype["getUserAgnosticState"] = function getUserAgnosticState() {
2026-08-04 08:36:32 +00:00
return closure_31;
2026-07-29 08:29:29 +00:00
};
prototype["getSettings"] = function getSettings() {
2026-08-04 08:36:32 +00:00
return closure_31.clipsSettings;
2026-07-29 08:29:29 +00:00
};
prototype["getEnableAutoclipping"] = function getEnableAutoclipping() {
2026-08-04 08:36:32 +00:00
let enabled = closure_31.clipsSettings.enableAutoclipping;
2026-07-29 08:29:29 +00:00
if (enabled == null) {
2026-08-08 06:10:11 +00:00
const AutoclippingDefaultOverrideExperiment = require(4371) /* apexExperiment */.AutoclippingDefaultOverrideExperiment;
2026-07-29 08:29:29 +00:00
enabled = AutoclippingDefaultOverrideExperiment.getConfig({ location: "getAutoclippingDefault" }).enabled;
}
return enabled;
};
prototype["hasUserSetAutoclippingSettings"] = function hasUserSetAutoclippingSettings() {
2026-08-04 08:36:32 +00:00
return null != closure_31.clipsSettings.enableAutoclipping;
2026-07-29 08:29:29 +00:00
};
prototype["getLastClipsSession"] = function getLastClipsSession() {
2026-08-04 08:36:32 +00:00
return c22;
2026-07-29 08:29:29 +00:00
};
prototype["getCurrentClipsSession"] = function getCurrentClipsSession() {
2026-08-04 08:36:32 +00:00
return c23;
2026-07-29 08:29:29 +00:00
};
prototype["getHistoricalClipsSessionById"] = function getHistoricalClipsSessionById(arg0) {
return table3[arg0];
};
prototype["devSetLastClipsSession"] = function devSetLastClipsSession(arg0) {
2026-08-04 08:36:32 +00:00
let closure_22 = arg0;
2026-07-29 08:29:29 +00:00
this.emitChange();
};
prototype["getClipsWarningShown"] = function getClipsWarningShown(channelId) {
2026-08-04 08:36:32 +00:00
return c21 === channelId;
2026-07-29 08:29:29 +00:00
};
prototype["getHardwareClassification"] = function getHardwareClassification() {
2026-08-04 08:36:32 +00:00
return closure_31.hardwareClassification;
2026-07-29 08:29:29 +00:00
};
prototype["getHardwareClassificationForDecoupled"] = function getHardwareClassificationForDecoupled() {
2026-08-04 08:36:32 +00:00
return closure_31.hardwareClassificationForDecoupled;
2026-07-29 08:29:29 +00:00
};
prototype["getHardwareClassificationVersion"] = function getHardwareClassificationVersion() {
2026-08-04 08:36:32 +00:00
return closure_31.hardwareClassificationVersion;
2026-07-29 08:29:29 +00:00
};
prototype["getIsAtMaxSaveClipOperations"] = function getIsAtMaxSaveClipOperations() {
2026-08-04 08:36:32 +00:00
return c20 >= closure_10;
2026-07-29 08:29:29 +00:00
};
prototype["getLastClipsError"] = function getLastClipsError() {
2026-08-04 08:36:32 +00:00
return c26;
2026-07-29 08:29:29 +00:00
};
prototype["isClipsEnabledForUser"] = function isClipsEnabledForUser(userId) {
let flag;
if (dependencyMap2[userId] != null) {
flag = tmp.clipsEnabled;
}
if (flag == null) {
flag = false;
}
return flag;
};
prototype["isVoiceRecordingAllowedForUser"] = function isVoiceRecordingAllowedForUser(id) {
let flag;
if (dependencyMap2[id] != null) {
flag = tmp.allowVoiceRecording;
}
if (flag == null) {
flag = false;
}
return flag;
};
prototype["isViewerClippingAllowedForUser"] = function isViewerClippingAllowedForUser(arg0) {
let flag;
if (dependencyMap2[arg0] != null) {
flag = tmp.allowAnyViewerClips;
}
if (flag == null) {
flag = false;
}
return flag;
};
prototype["hasClips"] = function hasClips() {
2026-08-04 08:36:32 +00:00
return closure_31.hasClips;
2026-07-29 08:29:29 +00:00
};
prototype["hasTakenDecoupledClip"] = function hasTakenDecoupledClip() {
2026-08-04 08:36:32 +00:00
return closure_31.hasTakenDecoupledClip;
2026-07-29 08:29:29 +00:00
};
prototype["canShowReminders"] = function canShowReminders() {
2026-08-04 08:36:32 +00:00
return closure_31.clipsSettings.remindersEnabled;
2026-07-29 08:29:29 +00:00
};
prototype["getNewClipIds"] = function getNewClipIds() {
2026-08-04 08:36:32 +00:00
return closure_31.newClipIds;
2026-07-29 08:29:29 +00:00
};
prototype["isClipExporting"] = function isClipExporting(arg0) {
return set.has(arg0);
};
prototype["getExportingClipIds"] = function getExportingClipIds() {
return set;
};
prototype["isAutoStashEnabled"] = function isAutoStashEnabled() {
2026-08-04 08:36:32 +00:00
return c28;
2026-07-29 08:29:29 +00:00
};
prototype["wasClipSharedInChannel"] = function wasClipSharedInChannel(arg0, arg1) {
const value = map.get(arg1);
let flag;
if (value != null) {
flag = value.has(arg0);
}
if (flag == null) {
flag = false;
}
return flag;
};
ClipsStoreClass.displayName = "ClipsStore";
ClipsStoreClass.persistKey = "ClipsStore";
2026-07-23 10:11:24 +00:00
let items = [
2026-07-20 16:05:17 +00:00
(arg0) => {
2026-07-29 08:29:29 +00:00
let clipsSettings = arg0;
2026-07-20 16:05:17 +00:00
if (null == arg0) {
2026-07-29 08:29:29 +00:00
clipsSettings = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return { clipsSettings, newClipsCount: 0 };
2026-07-20 16:05:17 +00:00
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(obj);
const merged1 = Object.assign(clipsSettings.clipsSettings);
obj = {};
const merged2 = Object.assign(clipsSettings);
2026-07-29 08:29:29 +00:00
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(newClipIds) => {
const obj = {};
const merged = Object.assign(newClipIds);
newClipIds = newClipIds.newClipIds;
2026-07-29 08:29:29 +00:00
if (newClipIds == null) {
2026-07-20 16:05:17 +00:00
newClipIds = [];
}
2026-07-29 08:29:29 +00:00
obj.newClipIds = newClipIds;
2026-07-20 16:05:17 +00:00
return obj;
},
(hardwareClassification) => {
const obj = {};
const merged = Object.assign(hardwareClassification);
2026-07-29 08:29:29 +00:00
let prop = hardwareClassification.hardwareClassification;
if (prop == null) {
prop = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.hardwareClassification = prop;
let num = hardwareClassification.hardwareClassificationVersion;
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.hardwareClassificationVersion = num;
2026-07-20 16:05:17 +00:00
return obj;
},
(hasClips) => {
const obj = {};
const merged = Object.assign(hasClips);
2026-07-29 08:29:29 +00:00
let flag = hasClips.hasClips;
if (flag == null) {
flag = false;
}
obj.hasClips = flag;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
2026-07-29 08:29:29 +00:00
obj.decoupledClipsEnabled = obj.decoupledClipsEnabled;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(hardwareClassificationForDecoupled) => {
const obj = {};
const merged = Object.assign(hardwareClassificationForDecoupled);
2026-07-29 08:29:29 +00:00
let prop = hardwareClassificationForDecoupled.hardwareClassificationForDecoupled;
if (prop == null) {
prop = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.hardwareClassificationForDecoupled = prop;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
2026-08-08 06:10:11 +00:00
const _default = require(4351) /* _detectH265HardwareDecode */.default;
2026-07-20 16:05:17 +00:00
let hardwareEncoding;
2026-07-29 08:29:29 +00:00
if (_default != null) {
2026-07-20 16:05:17 +00:00
hardwareEncoding = _default.getHardwareEncoding();
}
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
2026-07-29 08:29:29 +00:00
obj.clipsEnabled = hardwareEncoding && clipsSettings.clipsSettings.clipsEnabled;
obj.decoupledClipsEnabled = hardwareEncoding && clipsSettings.clipsSettings.decoupledClipsEnabled;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(newClipIds) => {
const obj = {};
const merged = Object.assign(newClipIds);
newClipIds = newClipIds.newClipIds;
2026-07-29 08:29:29 +00:00
if (newClipIds == null) {
2026-07-20 16:05:17 +00:00
newClipIds = [];
}
2026-07-29 08:29:29 +00:00
obj.newClipIds = newClipIds;
obj.newClipIDs = undefined;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
2026-08-04 21:03:28 +00:00
if (typeof clipsSettings.clipsSettings.clipsQuality !== "number") {
2026-07-20 16:05:17 +00:00
if (null != clipsSettings.clipsSettings.clipsQuality) {
let clipsQuality = clipsSettings.clipsSettings.clipsQuality;
}
2026-07-29 08:29:29 +00:00
obj.clipsQuality = clipsQuality;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
}
clipsQuality = obj.clipsQuality;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
let remindersEnabled = clipsSettings.clipsSettings.remindersEnabled;
2026-07-29 08:29:29 +00:00
if (remindersEnabled == null) {
2026-07-20 16:05:17 +00:00
remindersEnabled = obj.remindersEnabled;
}
2026-07-29 08:29:29 +00:00
obj.remindersEnabled = remindersEnabled;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(arg0) => {
const obj = {};
const merged = Object.assign(arg0);
2026-07-29 08:29:29 +00:00
obj.hasTakenDecoupledClip = false;
obj.clipsEducationState = { dismissedAt: null, numberOfGamesLaunchedSinceDismissal: 0, numberOfTimesDismissed: 0 };
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
let maxAutoClips = clipsSettings.clipsSettings.maxAutoClips;
2026-07-29 08:29:29 +00:00
if (maxAutoClips == null) {
2026-07-20 16:05:17 +00:00
maxAutoClips = obj.maxAutoClips;
}
2026-07-29 08:29:29 +00:00
obj.maxAutoClips = maxAutoClips;
2026-07-20 16:05:17 +00:00
let clipSignals = clipsSettings.clipsSettings.clipSignals;
2026-07-29 08:29:29 +00:00
if (clipSignals == null) {
2026-07-20 16:05:17 +00:00
clipSignals = obj.clipSignals;
}
2026-07-29 08:29:29 +00:00
obj.clipSignals = clipSignals;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
2026-07-29 08:29:29 +00:00
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
let enableAutoclipping = clipsSettings.clipsSettings.enableAutoclipping;
2026-07-29 08:29:29 +00:00
if (enableAutoclipping == null) {
2026-07-20 16:05:17 +00:00
enableAutoclipping = obj.enableAutoclipping;
}
2026-07-29 08:29:29 +00:00
obj.enableAutoclipping = enableAutoclipping;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
let showPovClipsInGallery = clipsSettings.clipsSettings.showPovClipsInGallery;
2026-07-29 08:29:29 +00:00
if (showPovClipsInGallery == null) {
2026-07-20 16:05:17 +00:00
showPovClipsInGallery = obj.showPovClipsInGallery;
}
2026-07-29 08:29:29 +00:00
obj.showPovClipsInGallery = showPovClipsInGallery;
obj.clipsSettings = obj;
2026-07-20 16:05:17 +00:00
return obj;
2026-07-22 07:54:56 +00:00
},
(clipsSettings) => {
let obj = {};
const merged = Object.assign(clipsSettings);
obj = {};
const merged1 = Object.assign(clipsSettings.clipsSettings);
obj = {};
const merged2 = Object.assign(clipsSettings.clipsSettings.clipsQuality);
let bitratePercent = clipsSettings.clipsSettings.clipsQuality.bitratePercent;
2026-07-29 08:29:29 +00:00
if (bitratePercent == null) {
2026-07-22 07:54:56 +00:00
bitratePercent = obj.clipsQuality.bitratePercent;
}
2026-07-29 08:29:29 +00:00
obj.bitratePercent = bitratePercent;
obj.clipsQuality = obj;
obj.clipsSettings = obj;
2026-07-22 07:54:56 +00:00
return obj;
2026-07-20 16:05:17 +00:00
}
];
2026-07-29 08:29:29 +00:00
ClipsStoreClass.migrations = items;
2026-07-23 10:11:24 +00:00
obj = {
2026-07-20 16:05:17 +00:00
CLIPS_SETTINGS_UPDATE: function handleSettingsUpdate(settings) {
let obj = {};
2026-07-22 07:54:56 +00:00
const merged = Object.assign(obj);
2026-07-21 06:55:02 +00:00
obj = {};
2026-07-22 07:54:56 +00:00
const merged1 = Object.assign(obj.clipsSettings);
2026-07-21 06:55:02 +00:00
const merged2 = Object.assign(settings.settings);
2026-07-29 08:29:29 +00:00
obj.clipsSettings = obj;
2026-07-21 06:55:02 +00:00
},
CLIPS_SAVE_CLIP: function handleSaveClip(clip) {
clip = clip.clip;
2026-08-04 08:36:32 +00:00
closure_20 = Math.max(closure_20 - 1, 0);
2026-07-21 06:55:02 +00:00
if (clip.isCandidate) {
const items = [clip];
2026-07-29 08:29:29 +00:00
HermesBuiltin.arraySpread(items, 1);
2026-08-04 08:36:32 +00:00
closure_17[clip.id] = clip;
2026-07-21 06:55:02 +00:00
}
2026-07-23 10:11:24 +00:00
if (null != obj) {
2026-07-21 06:55:02 +00:00
obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-22 07:54:56 +00:00
let num2 = 0;
if ("manual" === clip.clipMethod) {
num2 = 1;
}
2026-07-29 08:29:29 +00:00
obj.manualClipsSaved = obj.manualClipsSaved + num2;
2026-07-22 07:54:56 +00:00
let num3 = 0;
2026-07-29 08:29:29 +00:00
if (clip.isCandidate) {
num3 = 1;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
obj.candidateClipsSaved = obj.candidateClipsSaved + num3;
2026-07-22 07:54:56 +00:00
}
if (!clip.isCandidate) {
2026-07-29 08:29:29 +00:00
obj = { applicationName: null, ended: false };
obj[0] = clip.applicationName;
2026-07-23 10:11:24 +00:00
const merged1 = Object.assign(obj);
2026-07-22 07:54:56 +00:00
let newClipIds;
2026-07-29 08:29:29 +00:00
if (obj != null) {
2026-07-23 10:11:24 +00:00
newClipIds = obj.newClipIds;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
if (newClipIds == null) {
2026-07-22 07:54:56 +00:00
newClipIds = [];
}
const items1 = [];
2026-07-29 08:29:29 +00:00
items1[HermesBuiltin.arraySpread(newClipIds, 0)] = clip.id;
obj.newClipIds = items1;
2026-07-22 07:54:56 +00:00
obj = {};
const merged2 = Object.assign(obj);
let newClipIds1 = obj.newClipIds;
2026-07-29 08:29:29 +00:00
if (newClipIds1 == null) {
2026-07-22 07:54:56 +00:00
newClipIds1 = [];
}
const items2 = [];
2026-07-29 08:29:29 +00:00
items2[HermesBuiltin.arraySpread(newClipIds1, 0)] = clip.id;
obj.newClipIds = items2;
2026-08-04 08:36:32 +00:00
closure_16[clip.id] = clip;
2026-07-22 07:54:56 +00:00
if (null != clip.remoteClipId) {
2026-08-04 08:36:32 +00:00
closure_18[clip.remoteClipId] = clip.id;
2026-07-22 07:54:56 +00:00
}
obj.hasClips = true;
}
},
CLIPS_PROMOTE_CLIP_CANDIDATE: function handlePromoteClipCandidate(clip) {
clip = clip.clip;
let obj = { applicationName: clip.applicationName };
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj.ended = true;
2026-07-22 07:54:56 +00:00
let newClipIds;
2026-07-29 08:29:29 +00:00
if (obj != null) {
2026-07-23 10:11:24 +00:00
newClipIds = obj.newClipIds;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
if (newClipIds == null) {
2026-07-22 07:54:56 +00:00
newClipIds = [];
}
2026-07-29 08:29:29 +00:00
const items = [];
items[HermesBuiltin.arraySpread(newClipIds, 0)] = clip.id;
obj.newClipIds = items;
2026-07-23 10:11:24 +00:00
let tmp5 = null != obj;
if (tmp5) {
tmp5 = obj.id === clip.gameSessionId;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
importDefault(38)(tmp5, "Promoting clip candidates that do not match current autoclip session");
2026-07-22 07:54:56 +00:00
obj = {};
2026-07-23 10:11:24 +00:00
const merged1 = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj.candidateClipsPromoted = obj.candidateClipsPromoted + 1;
2026-07-22 07:54:56 +00:00
obj = {};
const merged2 = Object.assign(obj);
let newClipIds1 = obj.newClipIds;
2026-07-29 08:29:29 +00:00
if (newClipIds1 == null) {
2026-07-22 07:54:56 +00:00
newClipIds1 = [];
}
2026-07-29 08:29:29 +00:00
const items1 = [];
items1[HermesBuiltin.arraySpread(newClipIds1, 0)] = clip.id;
obj.newClipIds = items1;
const tmp4 = importDefault(38);
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-08-04 08:36:32 +00:00
closure_16[clip.id] = clip;
2026-07-22 07:54:56 +00:00
obj.hasClips = true;
},
CLIPS_SAVE_CLIP_START: function handleSaveClipStart(arg0) {
2026-08-04 08:36:32 +00:00
closure_20 = closure_20 + 1;
let hasTakenDecoupledClip = closure_31.hasTakenDecoupledClip;
2026-07-22 07:54:56 +00:00
if (!hasTakenDecoupledClip) {
hasTakenDecoupledClip = tmp === constants.DECOUPLED;
}
2026-08-04 08:36:32 +00:00
closure_31.hasTakenDecoupledClip = hasTakenDecoupledClip;
2026-07-22 07:54:56 +00:00
},
CLIPS_SAVE_CLIP_ERROR: function handleSaveClipError() {
2026-08-04 08:36:32 +00:00
closure_20 = Math.max(closure_20 - 1, 0);
2026-07-22 07:54:56 +00:00
},
CLIPS_SAVE_CLIP_NO_OP: function handleSaveClipNoOp(reason) {
reason = reason.reason;
2026-08-04 08:36:32 +00:00
if (!tmp) {
2026-07-22 07:54:56 +00:00
const _Math = Math;
2026-08-04 08:36:32 +00:00
closure_20 = Math.max(closure_20 - 1, 0);
2026-07-22 07:54:56 +00:00
}
},
STREAM_START: function handleStreamStart(arg0) {
let pid;
let sourceName;
({ sourceName, pid } = arg0);
2026-08-08 06:10:11 +00:00
let obj = require(4361) /* isClipsEnabled */;
2026-07-22 07:54:56 +00:00
if (obj.isClipsEnabled()) {
let tmp2 = sourceName;
if (null != pid) {
2026-07-23 10:11:24 +00:00
gameForPID = gameForPID.getGameForPID(pid);
2026-07-22 07:54:56 +00:00
let name;
2026-07-29 08:29:29 +00:00
if (gameForPID != null) {
2026-07-22 07:54:56 +00:00
name = gameForPID.name;
}
2026-07-29 08:29:29 +00:00
if (name == null) {
name = sourceName;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = name;
2026-07-22 07:54:56 +00:00
}
if (null != tmp2) {
if ("" !== tmp2) {
2026-07-29 08:29:29 +00:00
obj = { applicationName: null, newClipIds: null, ended: false };
obj[0] = tmp2;
obj[1] = [];
2026-07-22 07:54:56 +00:00
}
}
return false;
} else {
return false;
}
},
STREAM_STOP: function handleStreamStop(arg0) {
let tmp2 = null != _null;
if (tmp2) {
2026-08-08 06:10:11 +00:00
let obj = require(4367) /* isStreamKey */;
2026-07-22 07:54:56 +00:00
const tmp6 = obj.decodeStreamKey(tmp).ownerId === store.getId();
if (tmp6) {
let tmp8 = null;
if (0 !== _null.newClipIds.length) {
obj = {};
const merged = Object.assign(_null);
2026-07-29 08:29:29 +00:00
obj.ended = true;
2026-07-22 07:54:56 +00:00
tmp8 = obj;
}
2026-07-23 10:11:24 +00:00
_null = tmp8;
2026-07-22 07:54:56 +00:00
}
tmp2 = tmp6;
}
return tmp2;
},
CLIPS_CLEAR_LAST_CLIPS_SESSION: function handleClearLastClipsSession() {
2026-08-04 08:36:32 +00:00
if (null == c22) {
2026-07-22 07:54:56 +00:00
return false;
} else {
2026-08-04 08:36:32 +00:00
c22 = null;
2026-07-22 07:54:56 +00:00
}
},
CLIPS_SESSION_START: function handleClipsSessionStart(arg0) {
let gameId;
let sessionId;
({ sessionId, gameId } = arg0);
2026-07-29 08:29:29 +00:00
if (null != _null2) {
2026-08-04 08:36:32 +00:00
closure_24[_null2.id] = _null2;
2026-07-22 07:54:56 +00:00
}
2026-07-29 08:29:29 +00:00
_null2 = { id: sessionId, gameId, manualClipsSaved: 0, candidateClipsSaved: 0, candidateClipsPromoted: 0 };
2026-07-20 16:05:17 +00:00
},
CLIPS_SESSION_STOP: function handleClipsSessionStop() {
2026-07-23 10:11:24 +00:00
if (null == _null2) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-08-04 08:36:32 +00:00
closure_24[_null2.id] = _null2;
2026-07-23 10:11:24 +00:00
_null2 = null;
2026-07-20 16:05:17 +00:00
}
},
CLIPS_CLEAR_NEW_CLIP_IDS: function clearNewClipIds() {
2026-08-04 08:36:32 +00:00
closure_31.newClipIds = [];
2026-07-20 16:05:17 +00:00
},
CLIPS_REMOVE_SINGLE_NEW_CLIP_ID: function removeSingleNewClipId(clipId) {
2026-07-23 10:11:24 +00:00
clipId = clipId.clipId;
2026-08-04 08:36:32 +00:00
const newClipIds = closure_31.newClipIds;
closure_31.newClipIds = newClipIds.filter((arg0) => arg0 !== clipId);
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
CLIPS_LOAD_DIRECTORY_SUCCESS: function handleClipsDirectoryLoaded(arg0) {
2026-08-04 08:36:32 +00:00
let closure_16 = {};
2026-07-23 10:11:24 +00:00
let arr = [];
2026-07-29 08:29:29 +00:00
const iter = arg0.clips[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp2 = nextResult;
if (nextResult.isCandidate) {
2026-08-04 08:36:32 +00:00
let tmp7 = closure_17;
2026-07-29 08:29:29 +00:00
let tmp8 = nextResult;
2026-08-04 08:36:32 +00:00
closure_17[tmp2.id] = tmp2;
2026-07-29 08:29:29 +00:00
let tmp9 = arr;
arr = arr.push(tmp2);
} else {
2026-08-04 08:36:32 +00:00
let tmp3 = closure_16;
2026-07-29 08:29:29 +00:00
let tmp4 = nextResult;
2026-08-04 08:36:32 +00:00
closure_16[tmp2.id] = tmp2;
2026-07-29 08:29:29 +00:00
if (null != tmp2.remoteClipId) {
2026-08-04 08:36:32 +00:00
let tmp5 = closure_18;
2026-07-29 08:29:29 +00:00
let tmp6 = nextResult;
2026-08-04 08:36:32 +00:00
closure_18[tmp2.remoteClipId] = tmp2.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
closure_31.hasClips = Object.keys(closure_16).length > 0;
2026-07-20 16:05:17 +00:00
},
CLIPS_DELETE_CLIP: function handleClipsDelete(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
delete tmp4[tmp3];
2026-07-29 08:29:29 +00:00
delete tmp3[tmp2];
2026-07-20 16:05:17 +00:00
let remoteClipId;
2026-07-29 08:29:29 +00:00
if (dependencyMap[arg0.id] != null) {
2026-07-23 10:11:24 +00:00
remoteClipId = tmp5.remoteClipId;
2026-07-20 16:05:17 +00:00
}
if (null != remoteClipId) {
2026-07-23 10:11:24 +00:00
remoteClipId = tmp5.remoteClipId;
2026-07-29 08:29:29 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
closure_31.hasClips = Object.keys(dependencyMap).length > 0;
2026-07-20 16:05:17 +00:00
},
CLIPS_UPDATE_METADATA: function handleClipMetadataUpdate(clip) {
clip = clip.clip;
if (clip.isCandidate) {
2026-08-04 08:36:32 +00:00
closure_17[clip.id] = clip;
2026-07-20 16:05:17 +00:00
} else {
2026-08-04 08:36:32 +00:00
closure_16[clip.id] = clip;
2026-07-20 16:05:17 +00:00
if (null != clip.remoteClipId) {
2026-08-04 08:36:32 +00:00
closure_18[clip.remoteClipId] = clip.id;
2026-07-20 16:05:17 +00:00
}
}
},
RTC_CONNECTION_FLAGS: function handleRTCConnectionFlagsUpdate(flags) {
2026-07-29 08:29:29 +00:00
const obj = { clipsEnabled: null, allowVoiceRecording: null, allowAnyViewerClips: null };
obj[0] = require(1384) /* hasFlag */.hasFlag(flags.flags, VoiceFlags.CLIPS_ENABLED);
const obj2 = require(1384) /* hasFlag */;
obj[1] = require(1384) /* hasFlag */.hasFlag(flags.flags, VoiceFlags.ALLOW_VOICE_RECORDING);
const obj3 = require(1384) /* hasFlag */;
obj[2] = require(1384) /* hasFlag */.hasFlag(flags.flags, VoiceFlags.ALLOW_ANY_VIEWER_CLIPS);
2026-08-04 08:36:32 +00:00
closure_25[flags.userId] = obj;
2026-07-20 16:05:17 +00:00
},
CLIPS_SHOW_CALL_WARNING: function handleShowCallWarning(channelId) {
channelId = channelId.channelId;
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
2026-08-04 08:36:32 +00:00
if (channelId.channelId !== c21) {
c21 = null;
2026-07-20 16:05:17 +00:00
}
},
CLIPS_CLASSIFY_HARDWARE: function handleClassifyHardware(classification) {
classification = classification.classification;
2026-08-04 08:36:32 +00:00
closure_31.hardwareClassificationVersion = closure_6;
closure_31.hardwareClassification = classification;
2026-07-29 08:29:29 +00:00
if (tmp3) {
2026-08-04 08:36:32 +00:00
closure_31.clipsSettings.clipsEnabled = true;
2026-07-29 08:29:29 +00:00
}
2026-08-04 08:36:32 +00:00
closure_31.hardwareClassificationForDecoupled = classification;
let clipsEnabled = closure_31.hardwareClassificationForDecoupled === tmp2.MEETS_AUTO_ENABLE && tmp5 !== tmp2.MEETS_AUTO_ENABLE;
2026-07-20 16:05:17 +00:00
if (clipsEnabled) {
2026-08-04 08:36:32 +00:00
clipsEnabled = closure_31.clipsSettings.clipsEnabled;
2026-07-20 16:05:17 +00:00
}
if (clipsEnabled) {
2026-08-04 08:36:32 +00:00
closure_31.clipsSettings.decoupledClipsEnabled = true;
2026-07-20 16:05:17 +00:00
}
},
CLIPS_INIT: function handleClipsInit(applicationName) {
2026-08-04 08:36:32 +00:00
let c26 = null;
2026-08-08 06:10:11 +00:00
let obj = require(4361) /* isClipsEnabled */;
2026-07-20 16:05:17 +00:00
if (obj.isClipsEnabled()) {
2026-07-29 08:29:29 +00:00
obj = { applicationName: null, newClipIds: null, ended: false };
obj[0] = applicationName.applicationName;
obj[1] = [];
2026-07-20 16:05:17 +00:00
} else {
return false;
}
},
CLIPS_INIT_FAILURE: function handleClipsInitFailure(errMsg) {
errMsg = errMsg.errMsg;
},
CLIPS_DISMISS_EDUCATION: function handleDismissClipsEducation(educationType) {
educationType = educationType.educationType;
2026-07-29 08:29:29 +00:00
if (_Error.Error === educationType) {
2026-08-04 08:36:32 +00:00
let c26 = null;
2026-07-29 08:29:29 +00:00
} else if (tmp.Disabled === educationType) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-08-04 08:36:32 +00:00
closure_31.clipsEducationState.dismissedAt = Date.now();
closure_31.clipsEducationState.numberOfGamesLaunchedSinceDismissal = 0;
const clipsEducationState = closure_31.clipsEducationState;
2026-07-20 16:05:17 +00:00
clipsEducationState.numberOfTimesDismissed = clipsEducationState.numberOfTimesDismissed + 1;
}
},
RUNNING_GAMES_CHANGE: function handleRunningGamesChange(added) {
if (added.added.length > 0) {
2026-08-04 08:36:32 +00:00
const clipsEducationState = closure_31.clipsEducationState;
2026-07-20 16:05:17 +00:00
clipsEducationState.numberOfGamesLaunchedSinceDismissal = clipsEducationState.numberOfGamesLaunchedSinceDismissal + 1;
}
},
CLIPS_SET_EXPORTING: function handleSetExporting(clipIds) {
clipIds = clipIds.clipIds;
2026-07-29 08:29:29 +00:00
if (clipIds == null) {
2026-07-20 16:05:17 +00:00
clipIds = [];
}
const set = new Set(clipIds);
},
CLIPS_SET_AUTO_STASH_ENABLED: function handleSetAutoStashEnabled(enabled) {
enabled = enabled.enabled;
},
MESSAGE_CREATE: function handleMessageCreate(message) {
let attachments = message.message.attachments;
2026-07-29 08:29:29 +00:00
if (attachments == null) {
2026-07-20 16:05:17 +00:00
attachments = [];
}
const author = message.message.author;
let id;
2026-07-29 08:29:29 +00:00
if (author != null) {
2026-07-20 16:05:17 +00:00
id = author.id;
}
return trackSharedRemoteClipId(message.channelId, attachments, id);
},
2026-07-29 08:29:29 +00:00
LOAD_MESSAGES_SUCCESS: function handleLoadMessagesSuccess(channelId) {
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
const iter = channelId.messages[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp2 = nextResult;
let tmp4Result = flag;
if (!flag) {
let tmp5 = nextResult;
let attachments = tmp2.attachments;
let tmp4 = trackSharedRemoteClipId;
if (attachments == null) {
attachments = [];
}
let tmp6 = nextResult;
let author = tmp2.author;
let id;
if (author != null) {
id = author.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4Result = tmp4(channelId.channelId, attachments, id);
}
flag = tmp4Result;
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
LOGOUT: function reset() {
map.clear();
2026-08-04 08:36:32 +00:00
let c22 = null;
let c21 = null;
let closure_25 = {};
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
const clipsStoreClass = new ClipsStoreClass(require("dispatcher"), obj);
2026-07-23 10:11:24 +00:00
result = set.fileFinishedImporting("modules/clips/ClipsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default clipsStoreClass;
2026-07-20 16:05:17 +00:00
export const DEFAULT_STORAGE_SENTINEL = "default";
export const DEFAULT_STORAGE_DIRECTORY = "Discord Clips";