/* Metro module 11891; source: modules/channel/hooks/useRequiredLinkedLobbyApplicationAuthorization.tsx; dependencies: [31, 4234, 5109, 566, 6779, 6772, 2] */ import ApplicationStore from '../../applications/ApplicationStore.tsx'; /* Metro dependency 4234 */ import AuthorizedAppsStore from '../../../stores/AuthorizedAppsStore.tsx'; /* Metro dependency 5109 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as AuthorizedAppsStoreModule from '../../../stores/AuthorizedAppsStore.tsx'; /* Metro dependency 5109 */ function _fun91275(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12077:6, offset: 0x02059d63, size: 174 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/channel/hooks/useRequiredLinkedLobbyApplicationAuthorization.tsx'); exports.default = useRequiredLinkedLobbyApplicationAuthorization; function useRequiredLinkedLobbyApplicationAuthorization(a0) { // fn#91276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12077:273, offset: 0x02059e11, size: 395 bytes, params: 2, frame: 24 var r7; var r6; const value = null; const application_id = value != a0 && a0.require_application_authorization ? a0.application_id : value; const {authorizationsFetchState, applicationOAuth2Token} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([AuthorizedAppsStore], function() { var object = {}; var authorizedAppsStoreBinding = AuthorizedAppsStore; object.authorizationsFetchState = authorizedAppsStoreBinding.getFetchState(); object.applicationOAuth2Token = authorizedAppsStoreBinding.getNewestTokenForApplication(application_id); return object; }); const fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStores = fluxModule.useStateFromStores; const applicationStoreBinding = ApplicationStore; const application = Reflect.apply(useStateFromStores, fluxModule, [[applicationStoreBinding], function() { return ApplicationStore.getApplication(application_id); }]); const application2 = fluxModule.useStateFromStores([applicationStoreBinding], function() { return ApplicationStore.getApplication(application?.parentId); }); useEffect(_fun91280, [authorizationsFetchState, application_id]); useEffect(_fun91281, [application_id, applicationOAuth2Token, authorizationsFetchState, application]); useEffect(_fun91282, [application, authorizationsFetchState, application2]); const r5 = value != application && (value == application.parentId || value != application2); const value7 = value != application_id; if (value7) { r7 = authorizationsFetchState !== FetchState.FETCHED || value == application; r7 = !r7 ? !r5 : r7; r6 = r7; } else { r6 = value7; } return {showLinkedLobbyApplicationLoadingIndicator: r6, requiredLinkedLobbyApplication: value == applicationOAuth2Token && value != application && r5 ? value == application2 ? application : application2 : value}; function _fun91280() { // fn#91280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12077:758, offset: 0x02059ffd, size: 79 bytes, params: 1, frame: 11 var r0; var authorizationsFetchStateBinding; var value; const value2 = application_id != null; if (value2) { authorizationsFetchStateBinding = authorizationsFetchState; value = environment.__proto__; value = authorizationsFetchStateBinding === FetchState.NOT_FETCHED; r0 = value; } else { r0 = value2; } if (r0) { value = environment.__proto__; value = importDefault(6779) /* metro dependency 6779: AuthorizedAppsActionCreators */; value.fetch(); } } function _fun91281() { // fn#91281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12077:819, offset: 0x0205a04c, size: 106 bytes, params: 1, frame: 13 var value6; var defaultImport; if (application_id != null && application == null && authorizationsFetchState === FetchState.FETCHED) { value6 = environment.__proto__; defaultImport = importDefault(6772) /* metro dependency 6772: ApplicationActionCreators */; defaultImport.fetchApplications([application_id], false); } } function _fun91282() { // fn#91282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12077:907, offset: 0x0205a0b6, size: 129 bytes, params: 1, frame: 13 var value7; var defaultImport; if (application != null && application.parentId != null && application == null && authorizationsFetchState === FetchState.FETCHED) { value7 = environment.__proto__; defaultImport = importDefault(6772) /* metro dependency 6772: ApplicationActionCreators */; defaultImport.fetchApplications([application.parentId], false); } } } } global.__d(_fun91275, 11891, [31, 4234, 5109, 566, 6779, 6772, 2]) /* metro module 11891, dependencies: [31, 4234, 5109, 566, 6779, 6772, 2] */;