/* Metro module 5106; source: modules/guild_onboarding/GuildOnboardingPromptsConstants.tsx; dependencies: [57, 29, 661, 644, 1244, 1861, 2] */ function _fun44608(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#44608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:6, offset: 0x01174d00, size: 776 bytes, params: 8, frame: 29 var object5; const env0_0 = require; const _arrayLikeToArray_44611 = 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 closure = getDefaultPrompt; const closure2 = function(a0) { var object = {id: a0.id}; object.options = a0.options.map(_fun44614); object.title = a0.title; object.singleSelect = a0.single_select; object.disabled = a0.disabled; object.required = a0.required; object.inOnboarding = a0.in_onboarding; object.type = a0.type; return object; }; const closure3 = getConnectionIdentifier; const closure4 = validateOnboardingConnection; const env0_3 = ['id']; const env0_4 = ['id']; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_5 = importDefault(57) /* metro dependency 57 */; const env0_6 = importDefault(29) /* metro dependency 29 */; const PlatformTypes = (require(661) /* metro dependency 661: Constants */).PlatformTypes; object5 = {CUSTOMIZE: 0}; object5[0] = 'CUSTOMIZE'; object5.BROWSE = 1; object5[1] = 'BROWSE'; const object6 = {MULTIPLE_CHOICE: 0}; object6[0] = 'MULTIPLE_CHOICE'; object6.DROPDOWN = 1; object6[1] = 'DROPDOWN'; const object7 = {ONBOARDING_DEFAULT: 0}; object7[0] = 'ONBOARDING_DEFAULT'; object7.ONBOARDING_ADVANCED = 1; object7[1] = 'ONBOARDING_ADVANCED'; const object8 = {APPLICATION: 0}; object8[0] = 'APPLICATION'; object8.PROVIDER_CONNECTED_ACCOUNT = 1; object8[1] = 'PROVIDER_CONNECTED_ACCOUNT'; const Set = global.Set; const PLAYSTATION_STAGING = PlatformTypes.PLAYSTATION_STAGING; const CONTACTS = PlatformTypes.CONTACTS; const DOMAIN = PlatformTypes.DOMAIN; const TWITTER_LEGACY = PlatformTypes.TWITTER_LEGACY; const MASTODON = PlatformTypes.MASTODON; const INSTAGRAM = PlatformTypes.INSTAGRAM; const LEAGUE_OF_LEGENDS = PlatformTypes.LEAGUE_OF_LEGENDS; const SKYPE = PlatformTypes.SKYPE; const set = new Set([PLAYSTATION_STAGING, CONTACTS, DOMAIN, TWITTER_LEGACY, MASTODON, INSTAGRAM, LEAGUE_OF_LEGENDS, SKYPE]); Object = global.Object; const env0_10 = Object.values(PlatformTypes).filter(_fun44617); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_onboarding/GuildOnboardingPromptsConstants.tsx'); exports.MAX_PROMPT_TITLE_LENGTH = 100; exports.MAX_PROMPT_OPTION_TITLE_LENGTH = 50; exports.MAX_PROMPT_OPTION_DESCRIPTION_LENGTH = 100; exports.MAX_NUM_PROMPTS = 15; exports.MULTIPLE_CHOICE_MAX_NUM_OPTIONS = 12; exports.DROPDOWN_MAX_NUM_OPTIONS = 50; exports.MAX_DEFAULT_CHANNEL_IDS = 25; exports.MAX_NUMBER_OF_ONBOARDING_CONNECTIONS = 10; exports.MAX_CONNECTION_DESCRIPTION_LENGTH = 100; exports.MAX_NUMBER_OF_ONBOARDING_PROMPTS_IN_ONBOARDING = 4; exports.NUM_DEFAULT_CHATTABLE_CHANNELS_MIN = 1; exports.ONBOARDING_PROMPT_TYPE_SWITCH_THRESHOLD = 13; exports.GuildOnboardingTab = object5; exports.OnboardingPromptType = object6; exports.GuildOnboardingMode = object7; exports.OnboardingConnectionType = object8; exports.isDefaultPrompt = isDefaultPrompt; exports.getDefaultPrompt = closure; exports.getEmptyPrompt = getEmptyPrompt; exports.clientPromptToServerPrompt = function(a0) { var object = {id: a0.id}; object.options = a0.options.map(_fun44621); object.title = a0.title; object.single_select = a0.singleSelect; object.disabled = a0.disabled; object.required = a0.required; object.in_onboarding = a0.inOnboarding; object.type = a0.type; return object; }; exports.serverPromptToClientPrompt = closure2; exports.serverApiResponseToClientState = serverApiResponseToClientState; exports.isEmojiEmpty = function(a0) { return a0 == null || a0.id == null && a0.name == null; }; exports.EXCLUDED_ONBOARDING_PLATFORM_TYPES = set; exports.getConnectionIdentifier = closure3; exports.parseConnectionIdentifier = parseConnectionIdentifier; exports.validateOnboardingConnection = closure4; exports.validateOnboardingConnections = validateOnboardingConnections; } function _createForOfIteratorHelperLoose_44609(a0, a1) { // fn#44609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:167, offset: 0x01175008, 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 _fun44610; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_44611(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_44611(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_44611(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun44610; } 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 getDefaultPrompt() { // fn#44612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:1505, offset: 0x0117517a, size: 142 bytes, params: 1, frame: 16 const object2 = {'id': null, 'title': null, 'options': null, 'singleSelect': false, 'required': false, 'inOnboarding': true}; const String = global.String; const Date = global.Date; object2.id = String(Date.now()); const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; object2.title = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.vY91C9); object2.options = []; const MULTIPLE_CHOICE = env0_7.MULTIPLE_CHOICE; object2.type = MULTIPLE_CHOICE; return object2; } function serverPromptToClientPrompt({id, options, title, single_select, disabled, required, in_onboarding, type}) { // fn#44613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:1687, offset: 0x01175208, size: 102 bytes, params: 2, frame: 13 const object2 = {}; object2.id = id; object2.options = options.map(function(a0) { return {id: a0.id, channelIds: a0.channel_ids, roleIds: a0.role_ids, emoji: a0.emoji, title: a0.title, description: a0.description ?? ''}; }); object2.title = title; object2.singleSelect = single_select; object2.disabled = disabled; object2.required = required; object2.inOnboarding = in_onboarding; object2.type = type; return object2; } function getConnectionIdentifier(a0) { // fn#44615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:2200, offset: 0x011752c1, size: 90 bytes, params: 2, frame: 12 const connection_type = a0.connection_type; const APPLICATION = env0_8.APPLICATION; return connection_type === APPLICATION ? 'app:' + a0.application_id : 'provider:' + a0.provider_id; } function validateOnboardingConnection(a0) { // fn#44616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:2331, offset: 0x0117531b, size: 439 bytes, params: 2, frame: 16 var moduleValue; var isNullOrEmpty; var binding; var moduleValue2; const items2 = []; let connection_type = a0.connection_type; var value; const APPLICATION = env0_8.APPLICATION; if (connection_type === APPLICATION) { connection_type = a0.connection_type; if (env0_8.APPLICATION === connection_type) { moduleValue2 = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = moduleValue2.isNullOrEmpty; if (Reflect.apply(isNullOrEmpty, moduleValue2, [a0.application_id])) { items2.push('Application ID is required for application connections'); } value = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = value.isNullOrEmpty; if (!Reflect.apply(isNullOrEmpty, value, [a0.provider_id])) { items2.push('Platform ID not allowed for application connections'); } } else if (env0_8.PROVIDER_CONNECTED_ACCOUNT === connection_type) { moduleValue = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = moduleValue.isNullOrEmpty; if (Reflect.apply(isNullOrEmpty, moduleValue, [a0.provider_id])) { items2.push('Platform ID is required for platform connections'); } else { binding = env0_10; if (!binding.includes(a0.provider_id)) { items2.push('Invalid platform ID'); } } value = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = value.isNullOrEmpty; if (!Reflect.apply(isNullOrEmpty, value, [a0.application_id])) { items2.push('Application ID not allowed for platform connections'); } } else { a0.connection_type; } } else { connection_type = a0.connection_type; if (connection_type !== env0_8.PROVIDER_CONNECTED_ACCOUNT) { items2.push('Invalid connection type'); return items2; } connection_type = a0.connection_type; if (env0_8.APPLICATION === connection_type) { moduleValue2 = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = moduleValue2.isNullOrEmpty; if (Reflect.apply(isNullOrEmpty, moduleValue2, [a0.application_id])) { items2.push('Application ID is required for application connections'); } value = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = value.isNullOrEmpty; if (!Reflect.apply(isNullOrEmpty, value, [a0.provider_id])) { items2.push('Platform ID not allowed for application connections'); } } else if (env0_8.PROVIDER_CONNECTED_ACCOUNT === connection_type) { moduleValue = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = moduleValue.isNullOrEmpty; if (Reflect.apply(isNullOrEmpty, moduleValue, [a0.provider_id])) { items2.push('Platform ID is required for platform connections'); } else { binding = env0_10; if (!binding.includes(a0.provider_id)) { items2.push('Invalid platform ID'); } } value = require(1861) /* metro dependency 1861: StringUtils */; isNullOrEmpty = value.isNullOrEmpty; if (!Reflect.apply(isNullOrEmpty, value, [a0.application_id])) { items2.push('Application ID not allowed for platform connections'); } } else { a0.connection_type; } } if (a0.description != null && a0.description.length > 100) { items2.push('Description must be 100 characters or less'); } return items2; } function _fun44617(a0) { // fn#44617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:2185, offset: 0x011754d2, size: 25 bytes, params: 2, frame: 11 const binding = env0_9; return !binding.has(a0); } function isDefaultPrompt(a0) { // fn#44618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:3877, offset: 0x011754eb, size: 98 bytes, params: 2, frame: 15 if (a0.options.length > 0) { return false; } const defaultPrompt = getDefaultPrompt(); defaultPrompt.id; const binding = env0_6; const value3 = binding(defaultPrompt, env0_3); a0.id; return (importDefault(644) /* metro dependency 644 */)(value3, binding(a0, env0_4)); } function getEmptyPrompt(a0) { // fn#44619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:4069, offset: 0x0117554d, size: 87 bytes, params: 2, frame: 12 const object2 = {'id': null, 'title': '', 'options': null, 'singleSelect': false, 'required': false}; const String = global.String; const Date = global.Date; object2.id = String(Date.now()); object2.options = []; object2.inOnboarding = a0; const MULTIPLE_CHOICE = env0_7.MULTIPLE_CHOICE; object2.type = MULTIPLE_CHOICE; return object2; } function clientPromptToServerPrompt({id, options, title, singleSelect, disabled, required, inOnboarding, type}) { // fn#44620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:4243, offset: 0x011755a4, size: 102 bytes, params: 2, frame: 13 const object2 = {}; object2.id = id; object2.options = options.map(_fun44621); object2.title = title; object2.single_select = singleSelect; object2.disabled = disabled; object2.required = required; object2.in_onboarding = inOnboarding; object2.type = type; return object2; } function serverApiResponseToClientState({prompts, default_channel_ids, responses, mode, enabled, onboarding_prompts_seen, onboarding_responses_seen, below_requirements, connections}) { // fn#44622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:4801, offset: 0x0117569b, size: 151 bytes, params: 2, frame: 13 return {prompts: prompts.map(serverPromptToClientPrompt), defaultChannelIds: default_channel_ids, responses: responses ?? [], mode: mode, enabled: enabled, onboardingPromptsSeen: onboarding_prompts_seen ?? ({}), onboardingResponsesSeen: onboarding_responses_seen ?? ({}), belowRequirements: below_requirements, connections: connections ?? []}; } function parseConnectionIdentifier(a0) { // fn#44624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:5435, offset: 0x01175758, size: 147 bytes, params: 2, frame: 16 let value = a0.split(':'); value = env0_5(value, 2); const property = value[0]; const property2 = value[1]; return property !== 'app' || property2 === undefined ? property !== 'provider' || property2 === undefined || property2 === '' ? null : {type: env0_8.PROVIDER_CONNECTED_ACCOUNT, providerId: property2} : property2 !== '' ? {type: env0_8.APPLICATION, applicationId: property2} : property !== 'provider' || property2 === undefined || property2 === '' ? null : {type: env0_8.PROVIDER_CONNECTED_ACCOUNT, providerId: property2}; } function validateOnboardingConnections(a0) { // fn#44625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:5772, offset: 0x011757eb, size: 143 bytes, params: 2, frame: 21 var r2; var value5; var value6; var property; var value7; const Set = global.Set; const set = new Set(); const closure = validateOnboardingConnections_loop; const value3 = _createForOfIteratorHelperLoose_44609(a0.entries()); const value4 = value3(); let done = value4.done; if (!done) { for (r2 = value4; true; r2 = value7) { value5 = r2.value; value6 = env0_5(value5, 2); property = value6[0]; var env0_2 = value6[1]; closure(property); value7 = value3(); done = value7.done; if (done) { break; } } } return []; } function _fun44621(a0) { // fn#44621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:4320, offset: 0x0117560a, size: 145 bytes, params: 2, frame: 7 const object2 = {}; object2.id = a0.id; object2.channel_ids = a0.channelIds; object2.role_ids = a0.roleIds; let emoji = a0.emoji; object2.emoji = emoji; emoji = a0.emoji; const value = undefined; object2.emoji_id = emoji == null ? value : emoji.id; emoji = a0.emoji; object2.emoji_name = emoji == null ? value : emoji.name; emoji = a0.emoji; object2.emoji_animated = emoji == null ? value : emoji.animated; object2.title = a0.title; object2.description = a0.description; return object2; } function validateOnboardingConnections_loop(a0) { // fn#44626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:5845, owner: validateOnboardingConnections._loop, offset: 0x0117587a, size: 146 bytes, params: 2, frame: 18 var environment; const env0_0 = a0; let value = environment.__proto__; const value3 = validateOnboardingConnection(env0_2); let binding = env0_0; const push = binding.push; const value4 = value3.map(_fun44627); const items2 = []; arraySpread(items2, value4, 0, value3); apply(push, items2, binding, value3); value = getConnectionIdentifier(env0_2); binding = env0_1; if (binding.has(value)) { env0_0.push('Duplicate connection configuration'); } env0_1.add(value); } function _fun44627(a0) { // fn#44627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5284:5912, offset: 0x0117590c, size: 51 bytes, params: 2, frame: 15 return 'Connection ' + (env0_0 + 1) + ': ' + a0; }