422 lines
19 KiB
TypeScript
422 lines
19 KiB
TypeScript
/* Metro module 6585; source: modules/stickers/StickersPackStore.tsx; dependencies: [57, 6, 7, 15, 17, 18, 1420, 1868, 672, 4785, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PlainRecordModule from '../../external/discord_common/js/packages/libdiscore/js_shim/js/PlainRecord.tsx'; /* Metro dependency 1420 */
|
|
import * as LibdiscoreStoreModule from '../libdiscore/stores/LibdiscoreStore.tsx'; /* Metro dependency 1868 */
|
|
import * as StickersTypesModule from './StickersTypes.tsx'; /* Metro dependency 4785 */
|
|
|
|
function _fun51800(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51800, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:6, offset: 0x012e4f84, size: 426 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_51806 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const parseServerPackSticker = function(a0) {
|
|
return {id: a0.id, tags: a0.tags, type: a0.type, name: a0.name, description: a0.description,
|
|
format_type: a0.format_type, pack_id: a0.pack_id, [TypeTag]: 'PackSticker'};
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const LibdiscoreStore = (LibdiscoreStoreModule).LibdiscoreStore;
|
|
const Millis = (Durations).Millis;
|
|
const env0_11 = Millis.HOUR;
|
|
let value = _fun51810(LibdiscoreStore);
|
|
value.displayName = 'StickersPackStore';
|
|
value = new value({LOGOUT: function(a0, a1) {
|
|
(0, a1.clearAllDBs)();
|
|
}, STICKER_PACK_FETCH_SUCCESS: function({pack}, {packStickersDatabase, packsDatabase, premiumPacksDatabase}) {
|
|
ingestStickerPack(pack, packStickersDatabase, packsDatabase, premiumPacksDatabase, false);
|
|
}, STICKER_PACKS_FETCH_START: function(a0, {markDirty}) {
|
|
env0_9 = true;
|
|
markDirty();
|
|
}, STICKER_PACKS_FETCH_SUCCESS: STICKER_PACKS_FETCH_SUCCESS, PACK_STICKER_FETCH_SUCCESS: function({sticker},
|
|
{packStickersDatabase}) {
|
|
packStickersDatabase.setRecord(sticker.pack_id, sticker.id, parseServerPackSticker(sticker));
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/stickers/StickersPackStore.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_51801() { // fn#51801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:206, offset: 0x012e512e, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_51801_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_51804(a0, a1) { // fn#51804, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:399, offset: 0x012e518c, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun51805;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_51806(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_51806(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_51806(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun51805;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun51805() { // fn#51805, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:970, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function deriveStickerMetadata_51808({name}, a1) { // fn#51808, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:1522, offset: 0x012e535c, size: 154 bytes, params: 3, frame: 16
|
|
const items2 = [];
|
|
const object = {};
|
|
const StickerMetadataTypes = (StickersTypesModule).StickerMetadataTypes;
|
|
const STICKER_NAME = StickerMetadataTypes.STICKER_NAME;
|
|
object.type = STICKER_NAME;
|
|
object.value = name.trim().toLocaleLowerCase();
|
|
items2.push(object);
|
|
if (a1 != null) {
|
|
items2.push({type: StickerMetadataTypes.PACK_NAME, value: a1.name});
|
|
}
|
|
return items2;
|
|
}
|
|
|
|
function ingestStickerPack(a0, a1, a2, a3, a4) { // fn#51809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:3393, offset: 0x012e53f6, size: 141 bytes, params: 6, frame: 20
|
|
var r6;
|
|
var value4;
|
|
var id2;
|
|
var value5;
|
|
let set = a2.set;
|
|
let id = a0.id;
|
|
Reflect.apply(set, a2, [id, a0]);
|
|
reducibleJoin2: while (true) {
|
|
if (a4) {
|
|
set = a3.set;
|
|
id = a0.id;
|
|
Reflect.apply(set, a3, [id, a0]);
|
|
break reducibleJoin2;
|
|
}
|
|
break reducibleJoin2;
|
|
}
|
|
const setPartition = a1.setPartition;
|
|
id = a0.id;
|
|
const stickers = a0.stickers;
|
|
const object = {};
|
|
const value2 = _createForOfIteratorHelperLoose_51804(stickers);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r6 = value3;
|
|
reducibleLoop3: while (true) {
|
|
value4 = r6.value;
|
|
id2 = value4.id;
|
|
object[id2] = parseServerPackSticker(value4);
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break reducibleLoop3;
|
|
}
|
|
r6 = value5;
|
|
continue reducibleLoop3;
|
|
}
|
|
}
|
|
Reflect.apply(setPartition, a1, [id, object]);
|
|
}
|
|
|
|
function _fun51810(a0) { // fn#51810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:1761, offset: 0x012e5483, size: 185 bytes, params: 2, frame: 16
|
|
const StickersPackStore2 = StickersPackStore;
|
|
Inherits(StickersPackStore2, a0);
|
|
return CreateClass(StickersPackStore2, [{key: 'stateWrapper', value: function() {
|
|
var env0_0 = this;
|
|
return {packsDatabase: this.packsDatabase, packStickersDatabase: this.packStickersDatabase,
|
|
premiumPacksDatabase: this.premiumPacksDatabase, markDirty: _fun51816, clearAllDBs: _fun51817};
|
|
}}, {key: 'isFetchingStickerPacks', get: get_51818}, {key: 'hasLoadedStickerPacks', get: get_51819},
|
|
{key: 'getStickerById', value: function(a0) {
|
|
return this.packStickerByIdIndex.get(a0);
|
|
}}, {key: 'isPremiumPack', value: function(a0) {
|
|
return this.premiumPacksDatabase.get(a0) != null;
|
|
}}, {key: 'getStickerPack', value: function(a0) {
|
|
return this.packsDatabase.get(a0);
|
|
}}]);
|
|
function StickersPackStore(a0) { // fn#51811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:1773, offset: 0x012e553c, size: 312 bytes, params: 2, frame: 20
|
|
var environment;
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let value2 = environment.__proto__;
|
|
let binding = env1_3;
|
|
binding(this, StickersPackStore);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(StickersPackStore);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_51801()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.packsDatabase = value.addKVDatabase('stickerPacks');
|
|
value.packStickersDatabase = value.addKKVDatabase('packStickers');
|
|
value.packStickerByIdIndex = value.packStickersDatabase.addSecondaryKVIndex('id');
|
|
value.premiumPacksDatabase = value.addKVDatabase('premiumPacks');
|
|
value.getAllPackStickers = value.packStickersDatabase.memoized(function(a0) {
|
|
var propertyName;
|
|
var property = global.Map;
|
|
var value2 = new property();
|
|
for (propertyName in a0) {
|
|
property = global.Object;
|
|
value2.set(propertyName, property.values(a0[propertyName].root));
|
|
}
|
|
return value2;
|
|
});
|
|
value.getStickerMetadataMap = value.packStickersDatabase.memoized(_fun51813);
|
|
value.getPremiumPacks = value.premiumPacksDatabase.memoized(function(a0) {
|
|
var Object = global.Object;
|
|
return Object.values(a0);
|
|
});
|
|
return value;
|
|
function _fun51813(a0) { // fn#51813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:2431, offset: 0x012e5674, size: 199 bytes, params: 2, frame: 31
|
|
var r13;
|
|
var r2;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var Object;
|
|
var entries;
|
|
var root;
|
|
var value5;
|
|
var length;
|
|
var property;
|
|
var value6;
|
|
var property2;
|
|
var packsDatabase;
|
|
var get;
|
|
var value7;
|
|
var set;
|
|
var value8;
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
const value2 = 0;
|
|
const properties = Object.keys(a0);
|
|
const properties2 = 0;
|
|
const properties3 = properties.length;
|
|
if (properties !== undefined) {
|
|
r13 = properties2;
|
|
reducibleLoop1: while (true) {
|
|
propertyName = properties[r13];
|
|
propertyName2 = r13 + 1;
|
|
if (propertyName === undefined) {
|
|
break reducibleLoop1;
|
|
}
|
|
Object = global.Object;
|
|
entries = Object.entries;
|
|
root = a0[propertyName].root;
|
|
value5 = Reflect.apply(entries, Object, [root]);
|
|
length = value5.length;
|
|
if (!(value2 < length)) {
|
|
r13 = propertyName2;
|
|
continue reducibleLoop1;
|
|
}
|
|
r2 = value2;
|
|
reducibleLoop3: while (true) {
|
|
property = value5[r2];
|
|
value6 = env2_2(property, 2);
|
|
property = value6[value2];
|
|
property2 = value6[1];
|
|
packsDatabase = env0_0.packsDatabase;
|
|
get = packsDatabase.get;
|
|
value7 = Reflect.apply(get, packsDatabase, [propertyName]);
|
|
set = map.set;
|
|
Reflect.apply(set, map, [property, deriveStickerMetadata_51808(property2, value7)]);
|
|
value8 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = value5.length;
|
|
if (value8 < length) {
|
|
r2 = value8;
|
|
continue reducibleLoop3;
|
|
}
|
|
r13 = propertyName2;
|
|
continue reducibleLoop1;
|
|
}
|
|
continue reducibleLoop1;
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
}
|
|
|
|
function value_51815() { // fn#51815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:2783, offset: 0x012e573b, size: 66 bytes, params: 1, frame: 4
|
|
return {packsDatabase: this.packsDatabase, packStickersDatabase: this.packStickersDatabase,
|
|
premiumPacksDatabase: this.premiumPacksDatabase, markDirty: markDirty, clearAllDBs: clearAllDBs};
|
|
function markDirty() { // fn#51816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:2938, owner: value_51815.markDirty, offset: 0x012e577d, size: 19 bytes, params: 1, frame: 9
|
|
return env0_0.markDirty();
|
|
}
|
|
|
|
function clearAllDBs() { // fn#51817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:2971, owner: value_51815.clearAllDBs, offset: 0x012e5790, size: 21 bytes, params: 1, frame: 9
|
|
return env0_0.clearAllDatabases();
|
|
}
|
|
|
|
}
|
|
|
|
function get_51818() { // fn#51818, offset: 0x00e07a77, size: 9 bytes, params: 1, frame: 1
|
|
return env1_9;
|
|
}
|
|
|
|
function get_51819() { // fn#51819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:3092, offset: 0x012e57a5, size: 51 bytes, params: 1, frame: 11
|
|
var r0;
|
|
var performance;
|
|
let value = environment.__proto__;
|
|
const value2 = env1_10 != null;
|
|
if (value2) {
|
|
value = env1_10 + HOUR;
|
|
performance = global.performance;
|
|
value = value > performance.now();
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function STICKER_PACKS_FETCH_SUCCESS({packs}, {packStickersDatabase, packsDatabase, premiumPacksDatabase, markDirty}) { // fn#51826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6763:3951, offset: 0x012e5882, size: 136 bytes, params: 3, frame: 22
|
|
var r2;
|
|
var ingestStickerPackBinding;
|
|
var value4;
|
|
var value5;
|
|
markDirty();
|
|
env0_10 = global.performance.now();
|
|
const value2 = _createForOfIteratorHelperLoose_51804(packs);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
for (r2 = value3; true; r2 = value5) {
|
|
ingestStickerPackBinding = ingestStickerPack;
|
|
value4 = r2.value;
|
|
ingestStickerPackBinding(value4, packStickersDatabase, packsDatabase, premiumPacksDatabase, true);
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun51800, 6585, [57, 6, 7, 15, 17, 18, 1420, 1868, 672, 4785,
|
|
2]) /* metro module 6585, dependencies: [57, 6, 7, 15, 17, 18, 1420, 1868, 672, 4785, 2] */;
|