@onairos/react-native 3.7.2 โ†’ 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +116 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +109 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1 +1,1461 @@
1
- import{Platform}from'react-native';import{GoogleSignin,statusCodes}from'@react-native-google-signin/google-signin';function _0x5288(_0x26360a,_0x5288a5){_0x26360a=_0x26360a-0x0;const _0x4e4ea6=_0x2636();let _0x4a34dd=_0x4e4ea6[_0x26360a];return _0x4a34dd;}import AsyncStorage from'@react-native-async-storage/async-storage';function _0x2636(){const _0x1ffd95=['๐Ÿ”‘\x20Refresh\x20token\x20preview:','Nadcg','No\x20API\x20key\x20configured.\x20Please\x20initialize\x20the\x20SDK\x20with\x20a\x20valid\x20developer\x20API\x20key.','3.0.72','uYgYi','SDK\x20not\x20initialized.\x20Developers\x20must\x20call\x20initializeApiKey()\x20before\x20using\x20auth\x20features.','khcFI','apiKey','IVGPs','hBRyq','eRDvs','data','log','RlXrs','substring','...','GecYr','Bearer\x20','vPuDR','1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','https://api.instagram.com/oauth/authorize','demo_instagram_client_id','onairosevents://auth/callback','user_profile,user_media','/youtube/authorize','https://www.googleapis.com/auth/youtube.readonly','code','/reddit/authorize','demo_reddit_client_id','demo_pinterest_client_id','demo_facebook_client_id','public_profile,email','BASE_URL','/linkedin/authorize','openid\x20profile\x20email','/gmail/authorize','https://chat.openai.com','https://claude.ai/login','https://gemini.google.com','https://hinge.co','https://www.instagram.com','https://www.sephora.com','https://web.telegram.org/k/','iaeYq','hasNativeSDK','โœ…\x20Refresh\x20token\x20already\x20available','โŒ\x20YouTube\x20reconnection\x20error:','๐Ÿ”Œ\x20[CONNECTIVITY]\x20Running\x20comprehensive\x20network\x20diagnostics...','๐ŸŒ\x20[CONNECTIVITY]\x20Test\x201:\x20Checking\x20general\x20internet\x20(google.com)...','zxRVf','https://www.google.com','HEAD','no-cors','reachable','OVmUG','โŒ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20Google\x20-\x20internet\x20may\x20be\x20down:','๐ŸŒ\x20[CONNECTIVITY]\x20Test\x202:\x20Checking\x20API\x20server...','โœ…\x20[CONNECTIVITY]\x20API\x20server\x20is\x20reachable','โŒ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20API\x20server:','API\x20is\x20reachable','EBGyt','doczf','aFcNC','googleTest','kramo','yliiB','message','error','qEjQR','YTVls','rafoU','abort','fObuO','/health','CWBCM','text','Unable\x20to\x20read\x20response','api2Test','status','HkImf','BaXpG','โš ๏ธ\x20[CONNECTIVITY]\x20API\x20server\x20responded\x20with\x20status:\x20','dgTkx','Zacpj','mGVKX','success','Salvw','wnArV','woQqa','Yvnnz','nKRJZ','โŒ\x20[CONNECTIVITY]\x20Connectivity\x20test\x20failed:','Network\x20error:\x20','KKAdo','skPJL','๐Ÿ“ง\x20[OAUTH]\x20Email\x20platform\x20selected,\x20returning\x20mock\x20auth\x20URL','Ufmei','JtmAO','2|1|5|3|0|4','\x20\x20\x201.\x20No\x20internet\x20connection\x20on\x20device/simulator','\x20\x20\x203.\x20DNS\x20resolution\x20failed','\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','๐Ÿš€\x20[OAUTH]\x20Starting\x20OAuth\x20for\x20platform:\x20','๐Ÿ“ฑ\x20[OAUTH]\x20Platform:\x20',',\x20Version:\x20','Version','XEPRZ','email','MtuJu','FPDva','GwuRh','ndcdD','Vhjdn','/email/authorize?action=verify','NMYlh','๐Ÿ”‘\x20[OAUTH]\x20Using\x20User\x20JWT\x20for\x20authentication','โŒ\x20[OAUTH]\x20User\x20not\x20authenticated\x20-\x20cannot\x20initiate\x20','\x20OAuth','โŒ\x20[OAUTH]\x20Please\x20log\x20in\x20first\x20before\x20connecting\x20platforms','๐ŸŒ\x20[OAUTH]\x20Proxy\x20URL:\x20','๐Ÿ“ค\x20[OAUTH]\x20Request\x20body:','EkSMQ','โฐ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','\x20-\x20aborting','OuMtW','stringify','signal','blMPd','โŒ\x20[OAUTH]\x20Error\x20initiating\x20OAuth\x20for\x20','\x20-\x20','json','URL','url','๐Ÿ”—\x20[OAUTH]\x20Auth\x20URL\x20for\x20','\x20(key:\x20','FNYnu','name','AbortError','โŒ\x20Sign-in\x20already\x20in\x20progress','\x20-\x20the\x20server\x20took\x20too\x20long\x20to\x20respond','whLEN','includes','cGWBV','โŒ\x20[OAUTH]\x20Network\x20request\x20failed\x20for\x20','.\x20Possible\x20causes:','GTbwd','vMxDY','\x20\x20\x202.\x20API\x20server\x20(API\x20server)\x20is\x20unreachable','jIKOI','profile','YTwmK','โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20did\x20NOT\x20confirm\x20refresh\x20token\x20reception','โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Response\x20data:','Unknown\x20Channel','No\x20Channel','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20sent:','Yes','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes','๐ŸŽ‰\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Temporary\x20YouTube\x20connection\x20established!','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Connection\x20Details:','โœ…\x20Refresh\x20token\x20confirmed:','๐Ÿ”„\x20FORCING\x20fresh\x20YouTube\x20consent\x20for\x20refresh\x20token...','๐Ÿ‘ค\x20User:','โœ…\x20Signed\x20out\x20-\x20consent\x20cache\x20cleared','BeFzn','โœ…\x20Token\x20cache\x20cleared','gPVvc','โ„น๏ธ\x20No\x20token\x20cache\x20to\x20clear','openid','๐Ÿ”\x20Initiating\x20sign-in\x20-\x20consent\x20screen\x20should\x20appear...','๐Ÿ‘ค\x20User\x20email:','๐Ÿ“‹\x20FULL\x20userInfo\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','๐Ÿ“‹\x20FULL\x20tokens\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','-\x20Access\x20token:','Missing','-\x20ID\x20token:','-\x20ServerAuthCode\x20(userInfo):','-\x20ServerAuthCode\x20(currentUser):','UkBTJ','โœ…\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20consent!','serverAuthCode','FMEgb','๐Ÿ“บ\x20Fetching\x20YouTube\x20channel\x20information...','https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true','znbek','hHpIp','ID:','POgfM','โš ๏ธ\x20Error\x20fetching\x20YouTube\x20channel\x20info:','cjHAK','๐Ÿ”\x20Creating\x20authentication\x20token\x20for\x20YouTube\x20connection...','temp_token_for_youtube_connection','youtube','refreshToken','signOut_and_configure','๐Ÿ“ค\x20Sending\x20comprehensive\x20payload\x20with\x20REFRESH\x20TOKEN\x20to\x20backend:','๐Ÿš€\x20[YOUTUBE\x20REAUTH]\x20Endpoint:\x20https://API\x20server/youtube/native-auth','๐Ÿš€\x20[YOUTUBE\x20REAUTH]\x20Payload\x20Summary:','๐Ÿš€\x20[YOUTUBE\x20REAUTH]\x20FULL\x20PAYLOAD:','โœ…\x20[YOUTUBE\x20REAUTH]\x20Backend\x20CONFIRMED\x20refresh\x20token\x20received','๐ŸŽ‰\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Full\x20YouTube\x20connection\x20with\x20refresh\x20tokens!','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Full\x20refresh\x20token:','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20type:','โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Expected\x20hasRefreshToken\x20or\x20refreshTokenReceived\x20in\x20response','โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20failed:','โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20User\x20may\x20need\x20to\x20manually\x20restart\x20training','\x20\x20\x202.\x20Check\x20Google\x20Console\x20OAuth\x20configuration','โŒ\x20This\x20means\x20consent\x20screen\x20did\x20not\x20appear\x20or\x20user\x20denied\x20permissions','\x20\x20\x203.\x20Ensure\x20user\x20clicks\x20\x22Allow\x22\x20on\x20consent\x20screen','โŒ\x20Error\x20forcing\x20YouTube\x20consent:','xBwkC','MfZks','โŒ\x20User\x20cancelled\x20sign-in\x20-\x20no\x20refresh\x20token\x20obtained','๐Ÿ’ก\x20User\x20must\x20click\x20\x22Allow\x22\x20to\x20get\x20refresh\x20token','iGMXn','iJiEa','โ„น๏ธ\x20No\x20existing\x20permissions\x20to\x20revoke:','rwvMN','CBQZH','MiPws','vZZlW','warn','โ„น๏ธ\x20Sign\x20out\x20not\x20needed:','GoMBH','โš ๏ธ\x20Failed\x20to\x20fetch\x20YouTube\x20channel\x20info:','usyqK','hEhqj','kfvaN','user','PNhkJ','getTokens','accessToken','aBWVj','fpSKQ','efvYq','RHqum','โŒ\x20Error\x20with\x20revoke\x20method:','dBMxg','configure','puPuv','WAAcW','hasPlayServices','FXVJG','๐Ÿ“ฑ\x20User\x20should\x20see:\x20\x22Allow\x20[App]\x20to\x20access\x20your\x20YouTube\x20account\x20when\x20you\x27re\x20not\x20using\x20the\x20app?\x22','signIn','LsHlH','FRznB','HAmsK','getCurrentUser','orehO','UUnWw','qMMNO','hIVyD','RTuOv','UsdiE','ldWvi','clmUo','wubpQ','RlEiW','OmLdL','zzgDi','ZJeqQ','HhfFg','lQQSn','hvTBR','startsWith','vdyPu','xHBnN','vbLnQ','WsjYS','zzUFp','aXqow','qiJQY','items','length','FMWrO','fPMAg','snippet','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x201!','MIGwN','YaVmp','bRbav','acqmz','EYgJx','bzKEI','โš ๏ธ\x20No\x20YouTube\x20channel\x20found\x20for\x20user','yuxBM','iXLWy','zQhww','qtAGg','PuZyT','LcXGG','UwGza','bqPto','NJteQ','split','๐Ÿ”„\x20[YOUTUBE\x20REAUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Mode:\x20Temporary\x20(expires\x20~1\x20hour)','BLwNL','SvmRt','PmGQV','eCTfi','YREjf','NfafR','uRjcT','pJwCd','Vofkx','trim','AnYhO','zSroS','toISOString','ZLbzX','iXPfE','user-','youtube-','KNhcw','xZnqA','aOOkC','now','ETeYx','IjSVY','ZzAzP','debugInfo','refreshTokenType','aOKVT','cMXzy','pOyyZ','BuToR','khyXL','tgjlH','Ltdiu','๐Ÿ“ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Headers:','headers','โœ…\x20[YOUTUBE\x20REAUTH]\x20Backend\x20Response\x20SUCCESS:','xSUrV','validation','yarFZ','isTemporaryMode','temporaryMode','enabled','FbwTw','temporary\x20access\x20token\x20mode','VSiad','vdZCM','SZqBs','LqfKq','hasRefreshToken','KybJB','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20REFRESH\x20TOKEN\x20SENT\x20TO\x20BACKEND:','MNwME','JxqsT','๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20length:','KkbTz','tBrtw','DdFgx','kxRvK','โŒ\x20[YOUTUBE\x20REAUTH]\x20This\x20means\x20the\x20reauth\x20signal\x20was\x20not\x20processed','Error\x20exchanging\x20code\x20for\x20token:\x20','Token\x20exchange\x20failed\x20with\x20status\x20','1|2|5|6|0|4|3','GWmbx','dhlHd','rftix','QTfoZ','hiRSG','tZlcZ','SIGN_IN_CANCELLED','HcEFE','tCLaJ','wJflG','MfbZI','IN_PROGRESS','hxPnR','๐Ÿ”‘\x20Refresh\x20token\x20type:','MyMoX','RmfSU','โœ…\x20Revoked\x20existing\x20permissions\x20-\x20fresh\x20consent\x20REQUIRED','dikWY','โœ…\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20REVOKE\x20+\x20consent!','INHFJ','โŒ\x20Still\x20no\x20refresh\x20token\x20after\x20revoke\x20method','gyofr','ZgZcz','HVNNZ','โ„น๏ธ\x20No\x20valid\x20authentication\x20token\x20found\x20for\x20YouTube\x20connection','AtDIh','revokeAccess','hwXNe','FjaXi','signOut','โœ…\x20Signed\x20out\x20completely','๐Ÿ”\x20Signing\x20in\x20after\x20revoke\x20-\x20consent\x20screen\x20MUST\x20appear...','Kcwjo','KhlAu','SOtGd','XcSRI','mgIZw','KCkJj','cWfdg','swILa','โœ…\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection','lyueB','QIGGu','๐Ÿ”„\x20Method\x201:\x20Trying\x20forced\x20consent\x20via\x20configuration...','EXiJH','Napkr','๐Ÿ”„\x20Method\x202:\x20Trying\x20forced\x20consent\x20via\x20revoke...','๐Ÿ”ง\x20Fixing\x20YouTube\x20connection\x20for\x20user:\x20','KPtby','jsKXP','vIFhG','ieoyE','fdmVc','NFASq','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x202!','โŒ\x20Failed\x20to\x20fix\x20','\x20YouTube\x20connection\x20with\x20both\x20methods','๐Ÿ”„\x20Attempting\x20to\x20refresh\x20Google\x20tokens...','kVaGN','SCDxk','โœ…\x20Successfully\x20refreshed\x20Google\x20tokens','wPlIU','DycUd','โŒ\x20Failed\x20to\x20refresh\x20Google\x20tokens:','โŒ\x20Re-authentication\x20also\x20failed:','taBnP','MiTrc','bOirG','โŒ\x20User\x20not\x20signed\x20in\x20to\x20Google,\x20cannot\x20refresh\x20tokens','bIxHL','Ntzks','idToken','iqsoB','YhcQg','HZkFv','ZHLmB','๐Ÿ”„\x20Refresh\x20failed,\x20attempting\x20re-authentication...','WWZyh','Present','none','ELHZU','โŒ\x20Debug\x20tokens\x20failed:','๐Ÿ”\x20YouTube\x20Token\x20Debug:','NDeHY','DAMXN','HQyHZ','LhBcW','jAuCv','vGUHY','ujdwW','CFWCL','KacEz','No\x20internet\x20connectivity\x20detected.\x20Check\x20your\x20network\x20connection.','Kbmry','qDsLa','๐Ÿ”„\x20Forcing\x20fresh\x20YouTube\x20reconnection\x20for\x20refresh\x20token...','โœ…\x20Signed\x20out\x20from\x20Google','โ„น๏ธ\x20Token\x20clearing\x20failed\x20or\x20not\x20needed:','YxVck','fpSyP','โœ…\x20YouTube\x20reconnected\x20successfully\x20with\x20refresh\x20token','โš ๏ธ\x20Still\x20no\x20refresh\x20token\x20after\x20reconnection','Gmejt','bBGSj','RJSHt','xOaqm','jnPZu','TvCat','clearCachedAccessToken','โœ…\x20Cleared\x20cached\x20access\x20token','UDmGS','hOCMF','fQJuw','kzbEA','bIVrp','CFRhp','โŒ\x20YouTube\x20reconnection\x20failed','AaFrg','โ„น๏ธ\x20Already\x20signed\x20out\x20or\x20sign\x20out\x20failed:','โš ๏ธ\x20[YOUTUBE\x20AUTH]\x20Backend\x20did\x20not\x20confirm\x20refresh\x20token','๐Ÿ”\x20[YOUTUBE\x20AUTH]\x20Response\x20data\x20keys:','Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.','โŒ\x20Error\x20refreshing\x20YouTube\x20tokens:','โŒ\x20Failed\x20to\x20fix\x20YouTube\x20connection','OORvf','๐Ÿ”—\x20Initiating\x20native\x20Google\x20Sign-In\x20for\x20YouTube','โœ…\x20Google\x20Sign-In\x20successful:','๐Ÿ“‹\x20FULL\x20userInfo\x20object:','๐Ÿ”‘\x20Got\x20Google\x20tokens','๐Ÿ‘ค\x20Current\x20user\x20info:','-\x20userInfo.data?.serverAuthCode:','-\x20currentUser?.serverAuthCode:','-\x20tokens.accessToken:','โœ…\x20Got\x20serverAuthCode\x20(refresh\x20token\x20mechanism)','mVotu','๐Ÿ’ก\x20User\x20needs\x20to\x20reconnect\x20with\x20proper\x20consent\x20screen','๐Ÿ’ก\x20Check\x20Google\x20Sign-In\x20configuration:\x20offlineAccess,\x20forceCodeForRefreshToken','โš ๏ธ\x20Continuing\x20without\x20refresh\x20token\x20-\x20connection\x20may\x20fail\x20later','FIdod','mchGJ','TSjTQ','vPcFN','onairos_username','โ„น๏ธ\x20User\x20should\x20authenticate\x20first\x20via\x20Google/Apple/Email\x20before\x20connecting\x20YouTube','๐Ÿ”‘\x20Token\x20preview:','๐Ÿ”‘\x20Using\x20auth\x20token\x20for\x20linking:','apple','๐Ÿ“ค\x20BACKEND\x20PAYLOAD\x20SUMMARY:','-\x20hasServerAuthCode:','-\x20userEmail:','-\x20channelName:','๐Ÿ“‹\x20COMPLETE\x20BACKEND\x20PAYLOAD:','๐Ÿ“ค\x20Sending\x20YouTube\x20auth\x20to\x20backend\x20with\x20refresh\x20token:','wlFWP','๐Ÿ“‹\x20COMPLETE\x20BACKEND\x20RESPONSE:','uutdk','hSKVt','๐Ÿ”„\x20[YOUTUBE\x20AUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','โœ…\x20[YOUTUBE\x20AUTH]\x20Backend\x20confirmed\x20refresh\x20token\x20received','โœ…\x20[YOUTUBE\x20AUTH]\x20Full\x20YouTube\x20connection\x20with\x20persistent\x20access','โš ๏ธ\x20[YOUTUBE\x20AUTH]\x20Connection\x20may\x20fail\x20when\x20tokens\x20expire','BNfrW','๐Ÿ“‹\x20BACKEND\x20ERROR\x20RESPONSE:','โŒ\x20Google\x20Sign-In\x20error:','bKZIN','xArzp','Google\x20Sign-In\x20already\x20in\x20progress','NqUTF','GYeFw','yexBH','oMzdk','LWRlz','qNrkN','โ„น๏ธ\x20Sign\x20out\x20not\x20needed\x20or\x20failed:','otWYf','JOiNK','tLthy','uNeHC','chiiN','PoBig','cDWJd','๐Ÿ”\x20REFRESH\x20TOKEN\x20EXTRACTION:','VvjGH','acRxZ','XHnYy','sVMCf','FeBSf','Present:\x20','gDmMx','rPRtj','ODAay','jRLdF','qBoXt','CtUDl','vQbVr','aNYHL','ArHfW','โŒ\x20CRITICAL:\x20No\x20refresh\x20token\x20available\x20-\x20YouTube\x20connection\x20will\x20fail\x20when\x20token\x20expires','sgRbg','FpQuM','TmQLz','BCdDy','shxBT','WvhtW','mxvtH','USjxw','WczlQ','QVRnN','dXrts','BlYja','oFNbY','IUjLz','GJTYs','title','MKQYP','mSyRW','SiOAi','VqCmf','nzrIL','XoQDl','nDywS','wnDTT','ASWkl','oVOfa','cDSSX','DKpLd','keys','csOIU','ERvwZ','XZpjp','YgxlW','Cqkzx','gjNgB','frTyi','EgZxB','โœ…\x20Found\x20existing\x20authentication\x20token\x20for\x20YouTube\x20auth','๐Ÿ”—\x20Linking\x20YouTube\x20data\x20to\x20user:','No\x20token','KxFVo','SDZxK','pgYTS','mIswn','UIgoU','EjgID','uprLv','ZzZBB','ZtaxI','PCIAU','BSTba','jHOaG','MsbpS','GPyDd','TzJxV','ODvrQ','McnqV','OTKmI','Vzmhv','/youtube/native-auth','UVRcK','๐Ÿ“ก\x20Backend\x20response\x20status:','SPiKq','ZmwuH','fffjl','โœ…\x20YouTube\x20connection\x20successful','BNCUC','xvPnF','wIulv','ZewxB','dJxMg','โŒ\x20Error\x20verifying\x20email\x20code:','kFjVt','iNtyM','โœ…\x20[YOUTUBE\x20AUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','refreshTokenReceived','OvgQq','BTkko','LxTEG','โŒ\x20YouTube\x20auth\x20failed:','ZOUsc','FYdhp','SfNND','tLPtF','iOtNL','FrDwE','PLAY_SERVICES_NOT_AVAILABLE','AWtjS','Google\x20Play\x20Services\x20not\x20available','JGVIs','GffzC','SdSbh','YXQha','XwZXQ','Facebook\x20Login\x20completed\x20successfully','auth/callback','INohL','KJpHh','Exchanging\x20code\x20for\x20token\x20for\x20platform:\x20','/token','Token\x20exchange\x20successful\x20for\x20','YKCMR','ONrLQ','bZaVC','ICXWC','Falling\x20back\x20to\x20simulated\x20token\x20response','_access_token_','random','toString','โŒ\x20No\x20auth\x20token\x20found\x20for\x20YouTube\x20refresh','โŒ\x20Failed\x20to\x20get\x20fresh\x20tokens\x20from\x20Google\x20SDK','XlnlR','โœ…\x20YouTube\x20tokens\x20refreshed\x20successfully:','โŒ\x20YouTube\x20token\x20refresh\x20failed:','yLYGV','UNURs','xdcHo','VyNdf','sBdcL','tESMU','VZVjQ','FSbIW','mDGVC','/youtube/refresh-token','oIzRi','ikugs','vBSTm','UYsrF','KCmLr','ozoCl','Qizgz','5|3|1|0|2|4','\x20\x20\x204.\x20SSL/TLS\x20certificate\x20issue','youtube_reauth','uRIDi','srBUO','โŒ\x20[TRAINING\x20RESTART]\x20Error\x20triggering\x20training\x20restart:','rqAdT','QHHoQ','UXuiG','OFrKS','JmTSH','HfTWw','VHJGv','EaGxi','jkKGE','โŒ\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20failed:','Training\x20restart\x20failed:\x20','fChZz','NNIEy','wtcdl','FLycs','kDLGP','fnGMd','๐Ÿงช\x20Testing\x20YouTube\x20refresh\x20token\x20functionality...','๐Ÿ”\x20Current\x20token\x20status:','UHRaE','FJJJB','โš ๏ธ\x20No\x20refresh\x20token\x20found\x20-\x20attempting\x20to\x20fix...','๐Ÿ”\x20New\x20token\x20status:','WNnxg','eGFpm','LQqRv','VPUFo','PaHBr','uAIEJ','YawRA','FpxHA','โœ…\x20YouTube\x20connection\x20fixed!\x20Testing\x20again...','YyjOm','SEsOs','PGpEU','UkQkZ','uBQaf','GGdLk','โŒ\x20Error\x20testing\x20YouTube\x20refresh\x20token:','VzCFO','๐Ÿ“ง\x20Requesting\x20email\x20verification\x20for:','request','BOvue','zHzDz','Verification\x20code\x20sent\x20to\x20your\x20email','Failed\x20to\x20send\x20verification\x20code','nBXJs','โŒ\x20Error\x20requesting\x20email\x20verification:','jkZQi','VNHwj','NZnnS','/email/verification','LQUKt','kShXU','LpAfI','vZYux','ZUHNI','mdFSQ','kpHWG','NIFVz','YnuGp','KWbpD','SdMzp','nyegm','uRXAD','Email\x20verified\x20successfully','User\x20cancelled\x20Google\x20Sign-In','BNFgo','๐Ÿ”\x20Verifying\x20email\x20code\x20for:','TxqBz','SVVmg','Invalid\x20verification\x20code','BEnGg','MGCBR','YcueX','token','FszlQ','caZQg','verify','WpLwq','โŒ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','existingUser','jIkCa','EUrwH','TVBpM','hTyfp','bChor','nRwHe','ZAnLv','pQIzd','PtRaX','iNQlL','gGWwP','/email/verification/status','HsjtA','Network\x20error','ElbfW'];_0x2636=function(){return _0x1ffd95;};return _0x2636();}import{API_CONFIG,getApiHeaders,getUserAuthHeaders}from'../config/api';import{getApiConfig,isApiKeyInitialized}from'./apiKeyService';import{getJWT}from'./jwtStorageService';const getDeveloperAuthHeaders=()=>{const _0x3a80be={'RlXrs':_0x5288(0x0),'uYgYi':function(_0x48a187){return _0x48a187();},'khcFI':function(_0x4372ac,_0x5f4e09){return _0x4372ac!==_0x5f4e09;},'IVGPs':function(_0x394d6d,_0x33fbf1){return _0x394d6d===_0x33fbf1;},'hBRyq':'sIOZc','eRDvs':_0x5288(0x1),'GecYr':_0x5288(0x2),'YHLvI':function(_0x3b4c60){return _0x3b4c60();},'vPuDR':_0x5288(0x3)};if(!_0x3a80be[_0x5288(0x4)](isApiKeyInitialized))throw new Error(_0x5288(0x5));const _0x17bb02=_0x3a80be['uYgYi'](getApiConfig);if(!(_0x3a80be[_0x5288(0x6)](_0x17bb02,null)&&_0x3a80be['khcFI'](_0x17bb02,void 0x0)&&_0x17bb02[_0x5288(0x7)])){if(_0x3a80be[_0x5288(0x8)](_0x3a80be[_0x5288(0x9)],_0x3a80be[_0x5288(0xa)]))_0xb5c8b2=_0x3c6a3f[_0x5288(0xb)]['serverAuthCode'],_0x45a77f['log']('โœ…\x20Got\x20serverAuthCode\x20from\x20sign-in\x20response'),_0x2c3e5e[_0x5288(0xc)](_0x3a80be[_0x5288(0xd)],_0x19bdfb[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf));else throw new Error(_0x3a80be[_0x5288(0x10)]);}return{..._0x3a80be['YHLvI'](getApiHeaders),'Authorization':_0x5288(0x11)+_0x17bb02[_0x5288(0x7)],'X-SDK-Version':_0x3a80be[_0x5288(0x12)],'X-SDK-Platform':'react-native'};},WEB_CLIENT_ID=_0x5288(0x13),IOS_CLIENT_ID=_0x5288(0x13),OAUTH_CONFIG={'instagram':{'authUrl':_0x5288(0x14),'clientId':_0x5288(0x15),'redirectUri':_0x5288(0x16),'scope':_0x5288(0x17),'responseType':'code','hasNativeSDK':![]},'youtube':{'authUrl':API_CONFIG['BASE_URL']+_0x5288(0x18),'clientId':_0x5288(0x13),'redirectUri':'onairosevents://auth/callback','scope':_0x5288(0x19),'responseType':_0x5288(0x1a),'hasNativeSDK':!![]},'reddit':{'authUrl':API_CONFIG['BASE_URL']+_0x5288(0x1b),'clientId':_0x5288(0x1c),'redirectUri':'onairosevents://auth/callback','scope':'identity,read','responseType':_0x5288(0x1a),'hasNativeSDK':![]},'pinterest':{'authUrl':API_CONFIG['BASE_URL']+'/pinterest/authorize','clientId':_0x5288(0x1d),'redirectUri':_0x5288(0x16),'scope':'boards:read,pins:read','responseType':'code','hasNativeSDK':![]},'facebook':{'authUrl':'https://www.facebook.com/v12.0/dialog/oauth','clientId':_0x5288(0x1e),'redirectUri':'onairosevents://auth/callback','scope':_0x5288(0x1f),'responseType':_0x5288(0x1a),'hasNativeSDK':![]},'linkedin':{'authUrl':API_CONFIG[_0x5288(0x20)]+_0x5288(0x21),'clientId':'','redirectUri':_0x5288(0x16),'scope':_0x5288(0x22),'responseType':_0x5288(0x1a),'hasNativeSDK':![]},'gmail':{'authUrl':API_CONFIG['BASE_URL']+_0x5288(0x23),'clientId':'demo_gmail_client_id','redirectUri':'onairosevents://auth/callback','scope':'https://www.googleapis.com/auth/gmail.readonly','responseType':'code','hasNativeSDK':![]},'email':{'hasNativeSDK':![],'authUrl':API_CONFIG['BASE_URL']+'/email/authorize'},'chatgpt':{'authUrl':_0x5288(0x24),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'claude':{'authUrl':_0x5288(0x25),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'gemini':{'authUrl':_0x5288(0x26),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'grok':{'authUrl':'https://x.com/i/grok','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'hinge':{'authUrl':_0x5288(0x27),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'instagram_webview':{'authUrl':_0x5288(0x28),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'sephora':{'authUrl':_0x5288(0x29),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'telegram':{'authUrl':_0x5288(0x2a),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]}};export const hasNativeSDK=_0x135b13=>{const _0x5d2cc7={'iaeYq':function(_0x26ea3e,_0x4a9c79){return _0x26ea3e===_0x4a9c79;},'NwlcZ':function(_0x349ac9,_0x22ee9e){return _0x349ac9===_0x22ee9e;}};var _0x23074c;return(_0x5d2cc7[_0x5288(0x2b)](_0x23074c=OAUTH_CONFIG[_0x135b13],null)||_0x5d2cc7['NwlcZ'](_0x23074c,void 0x0)?void 0x0:_0x23074c[_0x5288(0x2c)])||![];};export const testApiConnectivity=async()=>{const _0x1d7b30={'rafoU':_0x5288(0x2d),'dgTkx':'โŒ\x20[YOUTUBE\x20AUTH]\x20Username\x20is\x20required\x20for\x20YouTube\x20authentication','nKRJZ':_0x5288(0x2e),'qMzEu':_0x5288(0x2f),'DChKP':_0x5288(0x30),'ppood':function(_0x1c41a9,_0x59fe44){return _0x1c41a9===_0x59fe44;},'TPuSk':_0x5288(0x31),'doczf':function(_0x4562fd,_0x760841,_0x721ac3){return _0x4562fd(_0x760841,_0x721ac3);},'EBhXV':_0x5288(0x32),'aFcNC':_0x5288(0x33),'DCdIL':_0x5288(0x34),'kramo':_0x5288(0x35),'yliiB':'โœ…\x20[CONNECTIVITY]\x20Google\x20is\x20reachable\x20-\x20internet\x20is\x20working','qEjQR':function(_0x2be46c,_0x11a08f){return _0x2be46c===_0x11a08f;},'YTVls':_0x5288(0x36),'uFJct':_0x5288(0x37),'pKgyT':_0x5288(0x38),'fObuO':function(_0x3ef757,_0x4faba9,_0x4297fa){return _0x3ef757(_0x4faba9,_0x4297fa);},'CWBCM':function(_0x45bd1f,_0x5e85cb){return _0x45bd1f(_0x5e85cb);},'HkImf':_0x5288(0x39),'mGVKX':function(_0x1050f0,_0x16a058){return _0x1050f0!==_0x16a058;},'Zacpj':_0x5288(0x3a),'Salvw':_0x5288(0x3b),'wnArV':'Internet\x20works\x20but\x20API\x20server\x20is\x20unreachable.\x20The\x20server\x20may\x20be\x20blocking\x20requests\x20from\x20this\x20device/simulator.','woQqa':'No\x20internet\x20connectivity\x20detected.\x20Check\x20your\x20network\x20connection.','Yvnnz':_0x5288(0x3c)},_0x592617={'googleTest':null,'api2Test':null};try{var _0x20bd9b,_0xcf4e5e;console['log'](_0x1d7b30['qMzEu']),console[_0x5288(0xc)](_0x1d7b30['DChKP']);try{if(_0x1d7b30['ppood'](_0x5288(0x31),_0x1d7b30['TPuSk'])){const _0x4a0596=await _0x1d7b30[_0x5288(0x3d)](fetch,_0x1d7b30['EBhXV'],{'method':_0x1d7b30[_0x5288(0x3e)],'mode':_0x1d7b30['DCdIL']});_0x592617[_0x5288(0x3f)]={'success':!![],'status':_0x1d7b30[_0x5288(0x40)]},console[_0x5288(0xc)](_0x1d7b30[_0x5288(0x41)]);}else _0x547673[_0x5288(0x3f)]={'success':![],'error':_0x4bb579[_0x5288(0x42)]},_0x23a4bb[_0x5288(0x43)](_0x5288(0x37),_0x57262a['message']);}catch(_0x5a5290){_0x1d7b30[_0x5288(0x44)](_0x1d7b30[_0x5288(0x45)],_0x5288(0x36))?(_0x592617['googleTest']={'success':![],'error':_0x5a5290[_0x5288(0x42)]},console[_0x5288(0x43)](_0x1d7b30['uFJct'],_0x5a5290[_0x5288(0x42)])):_0x1f9e9e[_0x5288(0xc)](_0x1d7b30[_0x5288(0x46)]);}console['log'](_0x1d7b30['pKgyT']);try{const _0x1fea2b=new AbortController(),_0x12ebbe=_0x1d7b30[_0x5288(0x3d)](setTimeout,()=>_0x1fea2b[_0x5288(0x47)](),0x7530),_0x35163f=await _0x1d7b30[_0x5288(0x48)](fetch,API_CONFIG[_0x5288(0x20)]+_0x5288(0x49),{'method':'GET','signal':_0x1fea2b['signal']});_0x1d7b30[_0x5288(0x4a)](clearTimeout,_0x12ebbe);const _0x197524=await _0x35163f[_0x5288(0x4b)]()['catch'](()=>_0x5288(0x4c));_0x592617[_0x5288(0x4d)]={'success':_0x35163f['ok'],'status':_0x35163f[_0x5288(0x4e)],'statusText':_0x35163f['statusText'],'response':_0x197524[_0x5288(0xe)](0x0,0xc8)};if(_0x35163f['ok'])console[_0x5288(0xc)](_0x1d7b30[_0x5288(0x4f)]);else{if(_0x1d7b30['mGVKX']('RegSO',_0x5288(0x50)))console[_0x5288(0xc)](_0x5288(0x51)+_0x35163f[_0x5288(0x4e)]);else return _0x49ec2c[_0x5288(0x43)](_0x1d7b30[_0x5288(0x52)]),![];}}catch(_0x5e33de){_0x592617[_0x5288(0x4d)]={'success':![],'error':_0x5e33de['message'],'name':_0x5e33de['name']},console[_0x5288(0x43)](_0x1d7b30[_0x5288(0x53)],_0x5e33de[_0x5288(0x42)]);}if(_0x1d7b30[_0x5288(0x54)](_0x20bd9b=_0x592617[_0x5288(0x4d)],null)&&_0x1d7b30[_0x5288(0x54)](_0x20bd9b,void 0x0)&&_0x20bd9b[_0x5288(0x55)])return{'success':!![],'message':_0x1d7b30[_0x5288(0x56)],'details':_0x592617};else return _0x1d7b30[_0x5288(0x54)](_0xcf4e5e=_0x592617[_0x5288(0x3f)],null)&&_0x1d7b30[_0x5288(0x54)](_0xcf4e5e,void 0x0)&&_0xcf4e5e[_0x5288(0x55)]?{'success':![],'message':_0x1d7b30[_0x5288(0x57)],'details':_0x592617}:{'success':![],'message':_0x1d7b30[_0x5288(0x58)],'details':_0x592617};}catch(_0x1c08b3){return _0x1d7b30[_0x5288(0x54)](_0x1d7b30[_0x5288(0x59)],_0x1d7b30['Yvnnz'])?(_0x4a4a4e[_0x5288(0x43)](_0x1d7b30[_0x5288(0x5a)],_0x10855c),![]):(console[_0x5288(0x43)](_0x5288(0x5b),_0x1c08b3[_0x5288(0x42)]),{'success':![],'message':_0x5288(0x5c)+_0x1c08b3[_0x5288(0x42)],'details':{'error':_0x1c08b3['message'],'results':_0x592617}});}};export const initiateOAuth=async(_0x4218cd,_0x3b5a7f)=>{const _0x4be64d={'ndcdD':'Google\x20Sign-In\x20already\x20in\x20progress','XEPRZ':function(_0x372f62,_0x18b41e){return _0x372f62===_0x18b41e;},'MtuJu':function(_0x304c24,_0x20a2bd){return _0x304c24===_0x20a2bd;},'FPDva':_0x5288(0x5d),'GwuRh':_0x5288(0x5e),'Vhjdn':_0x5288(0x5f),'NMYlh':function(_0x314584){return _0x314584();},'EkSMQ':function(_0x2dd65f,_0x257f39,_0x8f20af){return _0x2dd65f(_0x257f39,_0x8f20af);},'OuMtW':function(_0x146817,_0x1fc0fc,_0x40c3ce){return _0x146817(_0x1fc0fc,_0x40c3ce);},'blMPd':function(_0x5e2477,_0x11be66){return _0x5e2477(_0x11be66);},'FNYnu':'SJOmx','MZsEn':_0x5288(0x60),'LLrwW':_0x5288(0x61),'whLEN':function(_0x44223d,_0x4b33cf){return _0x44223d!==_0x4b33cf;},'Vgokn':_0x5288(0x62),'cGWBV':_0x5288(0x63),'GTbwd':_0x5288(0x64),'vMxDY':_0x5288(0x65)};try{console[_0x5288(0xc)](_0x5288(0x66)+_0x4218cd),console[_0x5288(0xc)](_0x5288(0x67)+Platform['OS']+_0x5288(0x68)+Platform[_0x5288(0x69)]);if(_0x4be64d[_0x5288(0x6a)](_0x4218cd,_0x5288(0x6b))){if(_0x4be64d[_0x5288(0x6c)](_0x4be64d[_0x5288(0x6d)],_0x4be64d[_0x5288(0x6e)]))_0x5df1bb[_0x5288(0xc)](_0x4be64d[_0x5288(0x6f)]);else return console['log'](_0x4be64d[_0x5288(0x70)]),API_CONFIG[_0x5288(0x20)]+_0x5288(0x71);}let _0x61b178;try{_0x61b178=await _0x4be64d[_0x5288(0x72)](getUserAuthHeaders),console[_0x5288(0xc)](_0x5288(0x73));}catch(_0x5a3b2d){return console[_0x5288(0x43)](_0x5288(0x74)+_0x4218cd+_0x5288(0x75)),console[_0x5288(0x43)](_0x5288(0x76)),null;}const _0x99472e=API_CONFIG[_0x5288(0x20)]+'/'+_0x4218cd+'/authorize';console[_0x5288(0xc)](_0x5288(0x77)+_0x99472e),console['log']('๐Ÿ”—\x20[OAUTH]\x20About\x20to\x20make\x20fetch\x20request...');const _0x22cbcb={'platform':_0x4218cd,'timestamp':new Date()['toISOString']()};console[_0x5288(0xc)](_0x5288(0x78),_0x22cbcb);const _0x2456e3=new AbortController(),_0x581264=_0x4be64d[_0x5288(0x79)](setTimeout,()=>{console[_0x5288(0xc)](_0x5288(0x7a)+_0x4218cd+_0x5288(0x7b)),_0x2456e3[_0x5288(0x47)]();},0x7530),_0x305e12=await _0x4be64d[_0x5288(0x7c)](fetch,_0x99472e,{'method':'POST','headers':_0x61b178,'body':JSON[_0x5288(0x7d)](_0x22cbcb),'signal':_0x2456e3[_0x5288(0x7e)]});_0x4be64d[_0x5288(0x7f)](clearTimeout,_0x581264),console[_0x5288(0xc)]('๐Ÿ“ก\x20[OAUTH]\x20Response\x20status:\x20'+_0x305e12[_0x5288(0x4e)]+'\x20'+_0x305e12['statusText']);if(!_0x305e12['ok']){const _0x594a86=await _0x305e12[_0x5288(0x4b)]();return console[_0x5288(0x43)](_0x5288(0x80)+_0x4218cd+':\x20'+_0x305e12[_0x5288(0x4e)]+_0x5288(0x81)+_0x594a86),null;}const _0x1181c2=await _0x305e12[_0x5288(0x82)]();console[_0x5288(0xc)]('๐Ÿ“‹\x20[OAUTH]\x20Response\x20data\x20for\x20'+_0x4218cd+':',_0x1181c2);const _0x29fafc=_0x4218cd+_0x5288(0x83),_0x5441c0=_0x1181c2[_0x29fafc]||_0x1181c2[_0x5288(0x84)]||null;return console[_0x5288(0xc)](_0x5288(0x85)+_0x4218cd+_0x5288(0x86)+_0x29fafc+'):',_0x5441c0),_0x5441c0;}catch(_0x52dfce){if(_0x4be64d[_0x5288(0x87)]===_0x4be64d[_0x5288(0x87)]){var _0x34a36d;if(_0x4be64d[_0x5288(0x6a)](_0x52dfce[_0x5288(0x88)],_0x5288(0x89)))_0x4be64d[_0x5288(0x6a)](_0x4be64d['MZsEn'],_0x4be64d['LLrwW'])?_0x5b11a8[_0x5288(0x43)](_0x5288(0x8a)):console['error']('โŒ\x20[OAUTH]\x20Request\x20timeout\x20for\x20'+_0x4218cd+_0x5288(0x8b));else{if(_0x4be64d['whLEN'](_0x34a36d=_0x52dfce[_0x5288(0x42)],null)&&_0x4be64d[_0x5288(0x8c)](_0x34a36d,void 0x0)&&_0x34a36d[_0x5288(0x8d)]('Network\x20request\x20failed')){const _0x24ed2c=_0x4be64d['Vgokn']['split']('|');let _0x67832f=0x0;while(!![]){switch(_0x24ed2c[_0x67832f++]){case'0':console[_0x5288(0x43)]('\x20\x20\x204.\x20SSL/TLS\x20certificate\x20issue');continue;case'1':console[_0x5288(0x43)](_0x4be64d[_0x5288(0x8e)]);continue;case'2':console['error'](_0x5288(0x8f)+_0x4218cd+_0x5288(0x90));continue;case'3':console['error'](_0x4be64d[_0x5288(0x91)]);continue;case'4':console[_0x5288(0x43)](_0x4be64d[_0x5288(0x92)]);continue;case'5':console[_0x5288(0x43)](_0x5288(0x93));continue;}break;}}else console['error'](_0x5288(0x80)+_0x4218cd+':',_0x52dfce);}return null;}else return _0x484ca9[_0x5288(0x43)]('โŒ\x20Still\x20no\x20refresh\x20token\x20after\x20revoke\x20method'),![];}};const initializeGoogleSignIn=()=>{const _0x5c0d3c={'dAvtC':_0x5288(0x19),'jIKOI':'openid','YTwmK':_0x5288(0x6b)};GoogleSignin['configure']({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x5c0d3c['dAvtC'],_0x5c0d3c[_0x5288(0x94)],_0x5288(0x95),_0x5c0d3c[_0x5288(0x96)]],'hostedDomain':'','accountName':''});};export const forceYouTubeReconnectionWithConsent=async _0x26d39a=>{const _0x49b0a5={'srmwB':_0x5288(0x97),'KkbTz':_0x5288(0x98),'usyqK':function(_0x53364c,_0x111f2b){return _0x53364c===_0x111f2b;},'hEhqj':function(_0x45037f,_0x2c028e){return _0x45037f===_0x2c028e;},'kfvaN':function(_0x1582c7,_0x364fe8){return _0x1582c7===_0x364fe8;},'PNhkJ':_0x5288(0x99),'yuxBM':function(_0x5538a4,_0x29f2a0){return _0x5538a4===_0x29f2a0;},'HAmsK':function(_0xc10839,_0x57b131){return _0xc10839===_0x57b131;},'ZJeqQ':function(_0x58037a,_0x189132){return _0x58037a===_0x189132;},'bzKEI':_0x5288(0x9a),'NJteQ':'1|4|5|6|2|3|0','vdZCM':_0x5288(0x9b),'aORVw':_0x5288(0x9c),'BLwNL':_0x5288(0x9d),'SvmRt':'โœ…\x20[YOUTUBE\x20REAUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','PmGQV':_0x5288(0x9e),'eCTfi':_0x5288(0x9f),'YREjf':'๐Ÿ”ง\x20Platform\x20auth\x20service\x20initialized','sBqqi':function(_0x652854){return _0x652854();},'zSroS':_0x5288(0x39),'HcEFE':_0x5288(0xa0),'iGMXn':function(_0x227f29,_0xb6f793){return _0x227f29!==_0xb6f793;},'rwvMN':_0x5288(0xa1),'CBQZH':_0x5288(0xa2),'MiPws':_0x5288(0xa3),'vZZlW':'TJqbt','GoMBH':function(_0x2f6494,_0xc8511a){return _0x2f6494!==_0xc8511a;},'peoiF':_0x5288(0xa4),'aBWVj':_0x5288(0xa5),'fpSKQ':'ewHEq','efvYq':_0x5288(0xa6),'RHqum':_0x5288(0xa7),'dBMxg':'๐Ÿ”ง\x20Configuring\x20Google\x20Sign-In\x20for\x20forced\x20consent...','puPuv':'https://www.googleapis.com/auth/youtube.readonly','Lryos':_0x5288(0xa8),'WAAcW':_0x5288(0x6b),'FXVJG':'โœ…\x20Play\x20Services\x20available','IDWMP':_0x5288(0xa9),'LsHlH':'โœ…\x20Sign-in\x20completed\x20-\x20checking\x20for\x20refresh\x20token...','FRznB':_0x5288(0xaa),'uRjcT':function(_0x52adc0,_0x175ac4){return _0x52adc0===_0x175ac4;},'orehO':_0x5288(0xab),'UUnWw':_0x5288(0xac),'qMMNO':'๐Ÿ”\x20Token\x20analysis:','hIVyD':_0x5288(0xad),'ldWvi':_0x5288(0xae),'RTuOv':_0x5288(0xaf),'UsdiE':'Present','clmUo':_0x5288(0xb0),'wubpQ':function(_0xd3c002,_0xfec3af){return _0xd3c002!==_0xfec3af;},'RlEiW':_0x5288(0xb1),'OmLdL':function(_0x13d9ef,_0x34dfde){return _0x13d9ef!==_0x34dfde;},'zzgDi':function(_0x44f518,_0x1f56ea){return _0x44f518!==_0x1f56ea;},'HhfFg':function(_0x3eeffe,_0x84d51){return _0x3eeffe===_0x84d51;},'ysNqF':_0x5288(0xb2),'lQQSn':_0x5288(0xb3),'hvTBR':'๐Ÿ”‘\x20Refresh\x20token\x20type:','vdyPu':_0x5288(0xb4),'xHBnN':_0x5288(0x0),'vbLnQ':_0x5288(0xb5),'ganzB':_0x5288(0xb6),'WsjYS':function(_0x367053,_0x19f3a0,_0x18b095){return _0x367053(_0x19f3a0,_0x18b095);},'zzUFp':_0x5288(0xb7),'aXqow':'RKuva','qiJQY':'kRjJT','VONau':function(_0x33dcea,_0x533198){return _0x33dcea!==_0x533198;},'FMWrO':_0x5288(0xb8),'fPMAg':_0x5288(0xb9),'vtRvy':_0x5288(0xba),'MIGwN':'โš ๏ธ\x20No\x20YouTube\x20channel\x20found\x20for\x20user','YaVmp':function(_0x28beab,_0x33fda4){return _0x28beab===_0x33fda4;},'qtAGg':function(_0xbf3c6c,_0x134aef){return _0xbf3c6c===_0x134aef;},'JtVBw':function(_0x1f5c18,_0x32d08e){return _0x1f5c18===_0x32d08e;},'bRbav':function(_0xb8058,_0x37c9e6){return _0xb8058===_0x37c9e6;},'acqmz':function(_0x273dfb,_0x2afaef){return _0x273dfb===_0x2afaef;},'EYgJx':function(_0x4c4ed3,_0x4da1f5){return _0x4c4ed3===_0x4da1f5;},'iXLWy':function(_0x2e867f,_0x363f12){return _0x2e867f===_0x363f12;},'zQhww':_0x5288(0xbb),'PuZyT':function(_0x5a0f48,_0xfef2aa){return _0x5a0f48===_0xfef2aa;},'LcXGG':function(_0x43e38c,_0x19821d){return _0x43e38c===_0x19821d;},'UwGza':function(_0x200074,_0x59f76a){return _0x200074===_0x59f76a;},'bqPto':function(_0x5707df,_0x463e0a){return _0x5707df===_0x463e0a;},'dIFym':function(_0x967938,_0x4d7027){return _0x967938===_0x4d7027;},'NfafR':_0x5288(0xbc),'pJwCd':function(_0xce2151,_0xf736e2){return _0xce2151===_0xf736e2;},'Vofkx':function(_0xecee74,_0x514c5b){return _0xecee74<_0x514c5b;},'AnYhO':function(_0x129aee,_0x13031e){return _0x129aee===_0x13031e;},'RVYzG':_0x5288(0xbd),'LQNMS':_0x5288(0xbe),'jzdeH':_0x5288(0xbf),'UYvsn':_0x5288(0xc0),'KNhcw':function(_0x2a2cab,_0x1fbd10){return _0x2a2cab===_0x1fbd10;},'ZLbzX':function(_0x814fab,_0x38a6b8){return _0x814fab===_0x38a6b8;},'iXPfE':function(_0x259020,_0x3011bc){return _0x259020===_0x3011bc;},'jlxgA':function(_0x51f980,_0x4b0623){return _0x51f980===_0x4b0623;},'xZnqA':function(_0x261bea,_0x1a1364){return _0x261bea===_0x1a1364;},'aOOkC':function(_0x2d34d1,_0x25097c){return _0x2d34d1===_0x25097c;},'MbEKd':function(_0x260db8,_0x4f6e35){return _0x260db8*_0x4f6e35;},'ETeYx':_0x5288(0xc1),'IjSVY':_0x5288(0xc2),'ZzAzP':_0x5288(0xc3),'aOKVT':function(_0x3c002c,_0x2248d9){return _0x3c002c===_0x2248d9;},'pYmdM':function(_0x38454c,_0x30a903){return _0x38454c===_0x30a903;},'cMXzy':'๐Ÿš€\x20[YOUTUBE\x20REAUTH]\x20=====\x20SENDING\x20REAUTH\x20SIGNAL\x20TO\x20BACKEND\x20=====','BohwY':_0x5288(0xc4),'pOyyZ':'๐Ÿš€\x20[YOUTUBE\x20REAUTH]\x20Headers:','CPQOV':'NO\x20AUTH\x20TOKEN','BuToR':_0x5288(0xc5),'khyXL':function(_0x30091a,_0x168419){return _0x30091a===_0x168419;},'tgjlH':_0x5288(0xc6),'MaJZu':function(_0x3fc797,_0x4f8ad0){return _0x3fc797&&_0x4f8ad0;},'Ltdiu':'๐Ÿ“ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status:','xSUrV':function(_0x5a6cef,_0x17bb75){return _0x5a6cef===_0x17bb75;},'yarFZ':function(_0xb0520c,_0x575160){return _0xb0520c===_0x575160;},'FbwTw':function(_0x11524e,_0x4b35ce){return _0x11524e===_0x4b35ce;},'VSiad':'2|5|0|4|1|3|6','SZqBs':_0x5288(0xc7),'LqfKq':'โœ…\x20[YOUTUBE\x20REAUTH]\x20Response\x20hasRefreshToken:','KybJB':_0x5288(0xc8),'MNwME':_0x5288(0xc9),'JxqsT':_0x5288(0xca),'kNkeR':_0x5288(0xcb),'tBrtw':'๐Ÿ”„\x20[YOUTUBE\x20REAUTH]\x20Signaling\x20training\x20system\x20to\x20restart...','IWoJp':_0x5288(0xcc),'DdFgx':_0x5288(0xcd),'kxRvK':'โŒ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20processing\x20FAILED:','vFEFU':_0x5288(0xce),'GWmbx':'โŒ\x20CRITICAL:\x20No\x20refresh\x20token\x20even\x20after\x20consent\x20screen','dhlHd':_0x5288(0xcf),'rftix':_0x5288(0xd0),'QTfoZ':'๐Ÿ’ก\x20Solutions:','hiRSG':_0x5288(0xd1),'tZlcZ':function(_0x2ecec5,_0x27b3c9){return _0x2ecec5===_0x27b3c9;},'pJEul':_0x5288(0xd2),'cxKiT':_0x5288(0xd3),'tCLaJ':_0x5288(0xd4),'wJflG':_0x5288(0xd5),'MfbZI':function(_0x42bc11,_0xe74414){return _0x42bc11===_0xe74414;},'hxPnR':_0x5288(0x8a),'IdMzY':function(_0x2facfd,_0x4e55c3){return _0x2facfd===_0x4e55c3;},'WDuhk':'โŒ\x20Google\x20Play\x20Services\x20not\x20available'};try{if(_0x49b0a5[_0x5288(0xd6)]('iJiEa',_0x5288(0xd7)))_0x5f0ce9['log'](_0x5288(0xd8),_0x3fc334);else{var _0x5dc33b,_0x14fa70,_0x420dea;console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xd9)]),console['log'](_0x49b0a5[_0x5288(0xda)],_0x26d39a);try{await GoogleSignin['signOut'](),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xdb)]);}catch(_0x1f0990){if(_0x49b0a5[_0x5288(0xdc)]!==_0x49b0a5[_0x5288(0xdc)])return _0x3bae85[_0x5288(0xdd)](_0x49b0a5['srmwB']),_0x2f376a[_0x5288(0xdd)](_0x49b0a5['KkbTz'],_0x2836ef),_0x4b58ee['warn']('โš ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Expected\x20hasRefreshToken\x20or\x20refreshTokenReceived\x20in\x20response'),![];else console[_0x5288(0xc)](_0x5288(0xde),_0x1f0990);}try{if(_0x49b0a5[_0x5288(0xdf)]('BeFzn',_0x49b0a5['peoiF'])){var _0x47895c,_0x25f19f;_0x43107b[_0x5288(0xc)](_0x5288(0xe0),_0x23fd4d[_0x5288(0x4e)]),_0x49ef88=((_0x47895c=_0x42a25d[_0x5288(0xb)])===null||_0x49b0a5[_0x5288(0xe1)](_0x47895c,void 0x0)||_0x49b0a5['hEhqj'](_0x47895c=_0x47895c['user'],null)||_0x49b0a5['hEhqj'](_0x47895c,void 0x0)?void 0x0:_0x47895c['name'])||(_0x49b0a5[_0x5288(0xe2)](_0x25f19f=_0x374664[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0xe2)](_0x25f19f,void 0x0)||_0x49b0a5[_0x5288(0xe3)](_0x25f19f=_0x25f19f[_0x5288(0xe4)],null)||_0x25f19f===void 0x0?void 0x0:_0x25f19f['email'])||_0x49b0a5[_0x5288(0xe5)];}else{const _0xfc74f6=await GoogleSignin[_0x5288(0xe6)]();_0xfc74f6[_0x5288(0xe7)]&&(await GoogleSignin['clearCachedAccessToken'](_0xfc74f6[_0x5288(0xe7)]),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xe8)]));}}catch(_0x10be0e){if(_0x49b0a5[_0x5288(0xdf)](_0x49b0a5[_0x5288(0xe9)],_0x49b0a5[_0x5288(0xea)]))console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xeb)]);else return _0xce50c4[_0x5288(0x43)](_0x5288(0xec),_0x2d9dc2),![];}console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xed)]),GoogleSignin[_0x5288(0xee)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x49b0a5[_0x5288(0xef)],_0x49b0a5['Lryos'],_0x5288(0x95),_0x49b0a5[_0x5288(0xf0)]],'hostedDomain':'','accountName':''}),await GoogleSignin[_0x5288(0xf1)](),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xf2)]),console[_0x5288(0xc)](_0x49b0a5['IDWMP']),console[_0x5288(0xc)](_0x5288(0xf3));const _0x2a0088=await GoogleSignin[_0x5288(0xf4)]();console['log'](_0x49b0a5[_0x5288(0xf5)]),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xf6)],(_0x5dc33b=_0x2a0088[_0x5288(0xb)])===null||_0x5dc33b===void 0x0||_0x49b0a5['uRjcT'](_0x5dc33b=_0x5dc33b[_0x5288(0xe4)],null)||_0x49b0a5[_0x5288(0xf7)](_0x5dc33b,void 0x0)?void 0x0:_0x5dc33b[_0x5288(0x6b)]);const _0x349793=await GoogleSignin[_0x5288(0xe6)](),_0x13a7bc=await GoogleSignin[_0x5288(0xf8)]();console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xf9)]),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x2a0088,null,0x2)),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xfa)]),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x349793,null,0x2)),console[_0x5288(0xc)]('๐Ÿ“‹\x20FULL\x20currentUser\x20object\x20from\x20forceYouTubeReconnectionWithConsent:'),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x13a7bc,null,0x2)),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xfb)]),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xfc)],_0x349793[_0x5288(0xe7)]?_0x349793[_0x5288(0xe7)][_0x5288(0xe)](0x0,0x14)+'...':_0x49b0a5['ldWvi']),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0xfd)],_0x349793['idToken']?_0x49b0a5[_0x5288(0xfe)]:_0x49b0a5[_0x5288(0xff)]),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x100)],_0x49b0a5['GoMBH'](_0x14fa70=_0x2a0088[_0x5288(0xb)],null)&&_0x49b0a5[_0x5288(0x101)](_0x14fa70,void 0x0)&&_0x14fa70[_0x5288(0xb4)]?_0x2a0088[_0x5288(0xb)][_0x5288(0xb4)][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x49b0a5['ldWvi']),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x102)],_0x49b0a5[_0x5288(0x103)](_0x13a7bc,null)&&_0x49b0a5[_0x5288(0x104)](_0x13a7bc,void 0x0)&&_0x13a7bc['serverAuthCode']?_0x13a7bc[_0x5288(0xb4)][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x49b0a5['ldWvi']);const _0x4ce931=(_0x49b0a5[_0x5288(0x105)](_0x420dea=_0x2a0088['data'],null)||_0x49b0a5[_0x5288(0xf7)](_0x420dea,void 0x0)?void 0x0:_0x420dea[_0x5288(0xb4)])||(_0x13a7bc===null||_0x13a7bc===void 0x0?void 0x0:_0x13a7bc[_0x5288(0xb4)]);if(_0x4ce931){if(_0x49b0a5[_0x5288(0x106)](_0x49b0a5['ysNqF'],_0x49b0a5['ysNqF'])){var _0x243847,_0x3482de,_0x41d159,_0x452175,_0x423584,_0x1985e1;console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x107)]),console['log'](_0x49b0a5[_0x5288(0x108)],_0x4ce931[_0x5288(0x109)]('4/')?_0x49b0a5[_0x5288(0x10a)]:_0x5288(0xc1)),console['log'](_0x49b0a5[_0x5288(0x10b)],_0x4ce931['substring'](0x0,0x14)+_0x5288(0xf));let _0x17e584=_0x49b0a5[_0x5288(0xe5)],_0x44f339=null;try{if(_0x49b0a5['hEhqj'](_0x49b0a5[_0x5288(0x10c)],_0x49b0a5[_0x5288(0x10c)])){console['log'](_0x49b0a5['ganzB']);const _0x150eb8=await _0x49b0a5[_0x5288(0x10d)](fetch,_0x49b0a5[_0x5288(0x10e)],{'headers':{'Authorization':'Bearer\x20'+_0x349793['accessToken'],'Accept':'application/json'}});if(_0x150eb8['ok']){if(_0x49b0a5[_0x5288(0x10f)]!==_0x49b0a5[_0x5288(0x110)]){const _0x186778=await _0x150eb8[_0x5288(0x82)]();if(_0x186778[_0x5288(0x111)]&&_0x186778[_0x5288(0x111)][_0x5288(0x112)]>0x0){if(_0x49b0a5['VONau'](_0x49b0a5[_0x5288(0x113)],_0x49b0a5[_0x5288(0x114)]))_0x17e584=_0x186778[_0x5288(0x111)][0x0][_0x5288(0x115)]['title'],_0x44f339=_0x186778['items'][0x0]['id'],console[_0x5288(0xc)]('โœ…\x20YouTube\x20channel\x20found:',_0x17e584,_0x49b0a5['vtRvy'],_0x44f339);else return _0x540bf1[_0x5288(0xc)]('โœ…\x20'+_0x3b95ce+_0x5288(0x116)),!![];}else{var _0x9e1090,_0x6cae20;console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x117)]),_0x17e584=((_0x9e1090=_0x2a0088['data'])===null||_0x49b0a5[_0x5288(0x118)](_0x9e1090,void 0x0)||_0x49b0a5['qtAGg'](_0x9e1090=_0x9e1090['user'],null)||_0x49b0a5['JtVBw'](_0x9e1090,void 0x0)?void 0x0:_0x9e1090['name'])||(_0x49b0a5[_0x5288(0xf7)](_0x6cae20=_0x2a0088[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0x119)](_0x6cae20,void 0x0)||_0x49b0a5[_0x5288(0x11a)](_0x6cae20=_0x6cae20[_0x5288(0xe4)],null)||_0x49b0a5[_0x5288(0x11b)](_0x6cae20,void 0x0)?void 0x0:_0x6cae20[_0x5288(0x6b)])||_0x49b0a5[_0x5288(0x11c)];}}else{var _0x5da545,_0xf67ff4;_0x3be937[_0x5288(0xc)](_0x5288(0x11d)),_0x31fb78=((_0x5da545=_0x538157[_0x5288(0xb)])===null||_0x49b0a5[_0x5288(0xe1)](_0x5da545,void 0x0)||(_0x5da545=_0x5da545[_0x5288(0xe4)])===null||_0x49b0a5[_0x5288(0x11e)](_0x5da545,void 0x0)?void 0x0:_0x5da545[_0x5288(0x88)])||(_0x49b0a5[_0x5288(0xf7)](_0xf67ff4=_0x26914c[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0x105)](_0xf67ff4,void 0x0)||_0x49b0a5[_0x5288(0xe2)](_0xf67ff4=_0xf67ff4[_0x5288(0xe4)],null)||_0xf67ff4===void 0x0?void 0x0:_0xf67ff4[_0x5288(0x6b)])||_0x49b0a5['bzKEI'];}}else{if(_0x49b0a5[_0x5288(0x11f)](_0x5288(0xbb),_0x49b0a5[_0x5288(0x120)])){var _0x4d647d,_0x193151;console[_0x5288(0xc)](_0x5288(0xe0),_0x150eb8[_0x5288(0x4e)]),_0x17e584=(_0x49b0a5[_0x5288(0xe1)](_0x4d647d=_0x2a0088[_0x5288(0xb)],null)||_0x4d647d===void 0x0||_0x49b0a5[_0x5288(0x121)](_0x4d647d=_0x4d647d[_0x5288(0xe4)],null)||_0x49b0a5[_0x5288(0x122)](_0x4d647d,void 0x0)?void 0x0:_0x4d647d['name'])||(_0x49b0a5[_0x5288(0x123)](_0x193151=_0x2a0088['data'],null)||_0x49b0a5[_0x5288(0x124)](_0x193151,void 0x0)||_0x49b0a5[_0x5288(0x125)](_0x193151=_0x193151['user'],null)||_0x49b0a5['dIFym'](_0x193151,void 0x0)?void 0x0:_0x193151[_0x5288(0x6b)])||_0x5288(0x99);}else{const _0x4c83f9=_0x49b0a5[_0x5288(0x126)][_0x5288(0x127)]('|');let _0xa6d6f2=0x0;while(!![]){switch(_0x4c83f9[_0xa6d6f2++]){case'0':_0x2c92aa[_0x5288(0xc)](_0x49b0a5['vdZCM'],_0x712972?_0x49b0a5['aORVw']:'No');continue;case'1':_0x1d5513[_0x5288(0xc)](_0x5288(0x128));continue;case'2':_0x1d758c[_0x5288(0xc)](_0x5288(0x129));continue;case'3':_0x5a73c7[_0x5288(0xc)](_0x49b0a5[_0x5288(0x12a)]);continue;case'4':_0x17a378[_0x5288(0xc)](_0x49b0a5[_0x5288(0x12b)]);continue;case'5':_0x59629b[_0x5288(0xc)](_0x49b0a5[_0x5288(0x12c)]);continue;case'6':_0xb38f5a['log'](_0x49b0a5[_0x5288(0x12d)]);continue;}break;}}}}else _0x5231e3['log'](_0x49b0a5[_0x5288(0x12e)]),_0x49b0a5['sBqqi'](_0x2db1af);}catch(_0x559cf7){var _0x1887f6,_0x7b7737;console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x12f)],_0x559cf7),_0x17e584=(_0x49b0a5[_0x5288(0x130)](_0x1887f6=_0x2a0088['data'],null)||_0x1887f6===void 0x0||(_0x1887f6=_0x1887f6[_0x5288(0xe4)])===null||_0x1887f6===void 0x0?void 0x0:_0x1887f6[_0x5288(0x88)])||(_0x49b0a5['bRbav'](_0x7b7737=_0x2a0088[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0x124)](_0x7b7737,void 0x0)||(_0x7b7737=_0x7b7737['user'])===null||_0x49b0a5[_0x5288(0x131)](_0x7b7737,void 0x0)?void 0x0:_0x7b7737[_0x5288(0x6b)])||_0x49b0a5['PNhkJ'];}let _0xeaac61=await _0x49b0a5['sBqqi'](getJWT);(!_0xeaac61||_0x49b0a5[_0x5288(0x132)](_0xeaac61[_0x5288(0x133)]()[_0x5288(0x112)],0x14))&&(_0x49b0a5[_0x5288(0x134)]('hGuDe',_0x49b0a5['RVYzG'])?_0x161003[_0x5288(0xc)](_0x49b0a5[_0x5288(0x135)]):(console[_0x5288(0xc)](_0x49b0a5['LQNMS']),_0xeaac61=_0x49b0a5['jzdeH']));const _0x465d74={'session':{'username':_0x26d39a,'platform':_0x49b0a5['UYvsn'],'timestamp':new Date()[_0x5288(0x136)](),'channelName':_0x17e584,'channelId':_0x44f339,'forceConsent':!![]},'googleUser':_0x49b0a5['KNhcw'](_0x243847=_0x2a0088[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0x137)](_0x243847,void 0x0)?void 0x0:_0x243847['user'],'accessToken':_0x349793['accessToken'],'idToken':_0x349793['idToken'],'refreshToken':_0x4ce931,'serverAuthCode':_0x4ce931,'refresh_token':_0x4ce931,'server_auth_code':_0x4ce931,'authCode':_0x4ce931,'userAccountInfo':{'username':_0x26d39a,'email':_0x49b0a5[_0x5288(0x11e)](_0x3482de=_0x2a0088[_0x5288(0xb)],null)||_0x3482de===void 0x0||_0x49b0a5[_0x5288(0x138)](_0x3482de=_0x3482de[_0x5288(0xe4)],null)||_0x49b0a5['jlxgA'](_0x3482de,void 0x0)?void 0x0:_0x3482de[_0x5288(0x6b)],'authToken':_0xeaac61,'channelName':_0x17e584,'channelId':_0x44f339,'userIdentifier':_0xeaac61?_0x5288(0x139)+_0xeaac61[_0x5288(0xe)](0x0,0xa):_0x5288(0x13a)+((_0x41d159=_0x2a0088[_0x5288(0xb)])===null||_0x49b0a5[_0x5288(0x11a)](_0x41d159,void 0x0)||(_0x41d159=_0x41d159[_0x5288(0xe4)])===null||_0x41d159===void 0x0?void 0x0:_0x41d159[_0x5288(0x6b)]),'googleId':_0x49b0a5[_0x5288(0x13b)](_0x452175=_0x2a0088[_0x5288(0xb)],null)||_0x49b0a5[_0x5288(0x13c)](_0x452175,void 0x0)||_0x49b0a5[_0x5288(0x13d)](_0x452175=_0x452175[_0x5288(0xe4)],null)||_0x452175===void 0x0?void 0x0:_0x452175['id'],'refreshToken':_0x4ce931,'serverAuthCode':_0x4ce931},'tokenExpiry':new Date(Date[_0x5288(0x13e)]()+_0x49b0a5['MbEKd'](0xe10,0x3e8))[_0x5288(0x136)](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!![],'refreshTokenType':_0x4ce931[_0x5288(0x109)]('4/')?_0x49b0a5[_0x5288(0x10a)]:_0x49b0a5[_0x5288(0x13f)],'configuredForRefresh':!![],'forcedConsent':!![],'consentMethod':_0x49b0a5[_0x5288(0x140)],'refreshTokenValue':_0x4ce931}};console['log'](_0x49b0a5[_0x5288(0x141)],{'hasAccessToken':!!_0x465d74['accessToken'],'hasRefreshToken':!!_0x465d74[_0x5288(0xc1)],'hasServerAuthCode':!!_0x465d74[_0x5288(0xb4)],'refreshTokenType':_0x465d74[_0x5288(0x142)][_0x5288(0x143)],'userEmail':_0x49b0a5[_0x5288(0x144)](_0x423584=_0x2a0088[_0x5288(0xb)],null)||_0x49b0a5['pYmdM'](_0x423584,void 0x0)||_0x49b0a5[_0x5288(0x11f)](_0x423584=_0x423584[_0x5288(0xe4)],null)||_0x49b0a5[_0x5288(0x13b)](_0x423584,void 0x0)?void 0x0:_0x423584[_0x5288(0x6b)],'forcedConsent':!![]}),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x145)]),console[_0x5288(0xc)](_0x49b0a5['BohwY']),console[_0x5288(0xc)]('\uD83D\uDE80 [YOUTUBE REAUTH] Method: POST'),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x146)],{'Content-Type':'application/json','Authorization':_0xeaac61?_0xeaac61[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x49b0a5['CPQOV']}),console['log'](_0x49b0a5[_0x5288(0x147)],{'hasAccessToken':!!_0x465d74['accessToken'],'hasRefreshToken':!!_0x465d74['refreshToken'],'hasServerAuthCode':!!_0x465d74['serverAuthCode'],'refreshTokenType':_0x465d74[_0x5288(0x142)]['refreshTokenType'],'userEmail':(_0x1985e1=_0x2a0088[_0x5288(0xb)])===null||_0x49b0a5[_0x5288(0x137)](_0x1985e1,void 0x0)||_0x49b0a5[_0x5288(0x148)](_0x1985e1=_0x1985e1[_0x5288(0xe4)],null)||_0x49b0a5[_0x5288(0x124)](_0x1985e1,void 0x0)?void 0x0:_0x1985e1[_0x5288(0x6b)],'channelName':_0x17e584,'forcedConsent':!![],'requestRefreshToken':!![]}),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x149)],JSON[_0x5288(0x7d)](_0x465d74,null,0x2));const _0x3f3b65=await _0x49b0a5[_0x5288(0x10d)](fetch,API_CONFIG[_0x5288(0x20)]+'/youtube/native-auth',{'method':'POST','headers':{'Content-Type':'application/json',..._0x49b0a5['MaJZu'](_0xeaac61,{'Authorization':_0xeaac61})},'body':JSON[_0x5288(0x7d)](_0x465d74)});console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x14a)],_0x3f3b65['status']),console[_0x5288(0xc)]('๐Ÿ“ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status\x20Text:',_0x3f3b65['statusText']),console[_0x5288(0xc)](_0x5288(0x14b),_0x3f3b65[_0x5288(0x14c)]);if(_0x3f3b65['ok']){var _0xefd1a9,_0x23c4ed;const _0x53aa8e=await _0x3f3b65['json']();console['log'](_0x5288(0x14d),JSON[_0x5288(0x7d)](_0x53aa8e,null,0x2));const _0x5633bb=_0x49b0a5['aOOkC'](_0x49b0a5[_0x5288(0x14e)](_0xefd1a9=_0x53aa8e[_0x5288(0x14f)],null)||_0x49b0a5[_0x5288(0x150)](_0xefd1a9,void 0x0)?void 0x0:_0xefd1a9[_0x5288(0x151)],!![])||(_0x49b0a5[_0x5288(0xe1)](_0x23c4ed=_0x53aa8e[_0x5288(0x152)],null)||_0x23c4ed===void 0x0?void 0x0:_0x23c4ed[_0x5288(0x153)])===!![]||_0x49b0a5[_0x5288(0x154)](_0x53aa8e[_0x5288(0x151)],!![])||_0x53aa8e[_0x5288(0x42)]&&_0x53aa8e['message'][_0x5288(0x8d)](_0x5288(0x155));if(_0x5633bb){const _0xb1e049=_0x49b0a5[_0x5288(0x156)][_0x5288(0x127)]('|');let _0x44d1ab=0x0;while(!![]){switch(_0xb1e049[_0x44d1ab++]){case'0':console[_0x5288(0xc)](_0x49b0a5['PmGQV']);continue;case'1':console['log']('๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Mode:\x20Temporary\x20(expires\x20~1\x20hour)');continue;case'2':console[_0x5288(0xc)](_0x5288(0x128));continue;case'3':console[_0x5288(0xc)]('๐Ÿ”‘\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes');continue;case'4':console[_0x5288(0xc)](_0x5288(0x9f));continue;case'5':console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x12b)]);continue;case'6':console['log'](_0x49b0a5[_0x5288(0x157)],_0x4ce931?'Yes':'No');continue;}break;}}else{if(_0x53aa8e['hasRefreshToken']||_0x53aa8e['refreshTokenReceived'])console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x158)]),console['log'](_0x49b0a5[_0x5288(0x159)],_0x53aa8e[_0x5288(0x15a)]),console['log'](_0x49b0a5[_0x5288(0x15b)]),console[_0x5288(0xc)](_0x5288(0x15c)),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x15d)],_0x4ce931),console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x15e)],_0x4ce931[_0x5288(0x109)]('4/')?_0x49b0a5['vdyPu']:_0x49b0a5[_0x5288(0x13f)]),console[_0x5288(0xc)](_0x5288(0x15f),_0x4ce931['length']);else return console[_0x5288(0xdd)](_0x49b0a5['srmwB']),console[_0x5288(0xdd)](_0x49b0a5[_0x5288(0x160)],_0x53aa8e),console[_0x5288(0xdd)](_0x49b0a5['kNkeR']),![];}console[_0x5288(0xc)](_0x49b0a5[_0x5288(0x161)]);try{await _0x49b0a5[_0x5288(0x10d)](triggerTrainingRestart,_0x26d39a,_0xeaac61),console[_0x5288(0xc)]('โœ…\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20sent\x20successfully');}catch(_0x28f7f0){console[_0x5288(0xdd)](_0x49b0a5['IWoJp'],_0x28f7f0),console[_0x5288(0xdd)](_0x49b0a5[_0x5288(0x162)]);}return!![];}else{const _0x1c3855=await _0x3f3b65[_0x5288(0x4b)]();return console[_0x5288(0x43)](_0x49b0a5[_0x5288(0x163)],_0x3f3b65[_0x5288(0x4e)],_0x1c3855),console[_0x5288(0x43)](_0x5288(0x164)),![];}}else{_0x244e66[_0x5288(0x43)](_0x5288(0x165)+_0xc2b72a[_0x5288(0x4e)]);throw new _0x534e2d(_0x5288(0x166)+_0x2f0908[_0x5288(0x4e)]);}}else{const _0x36a679=_0x5288(0x167)['split']('|');let _0x50a237=0x0;while(!![]){switch(_0x36a679[_0x50a237++]){case'0':console[_0x5288(0x43)](_0x49b0a5['vFEFU']);continue;case'1':console[_0x5288(0x43)](_0x49b0a5[_0x5288(0x168)]);continue;case'2':console['error'](_0x49b0a5[_0x5288(0x169)]);continue;case'3':return![];case'4':console['error'](_0x49b0a5[_0x5288(0x16a)]);continue;case'5':console[_0x5288(0x43)](_0x49b0a5[_0x5288(0x16b)]);continue;case'6':console[_0x5288(0x43)]('\x20\x20\x201.\x20Try\x20the\x20revoke\x20method:\x20forceYouTubeReconnectionWithRevoke()');continue;}break;}}}}catch(_0x4819b9){console['error'](_0x49b0a5[_0x5288(0x16c)],_0x4819b9);if(_0x49b0a5[_0x5288(0x16d)](_0x4819b9[_0x5288(0x1a)],statusCodes[_0x5288(0x16e)]))_0x49b0a5['PuZyT'](_0x49b0a5['pJEul'],_0x49b0a5['cxKiT'])?_0x15f1be[_0x5288(0xc)](_0x49b0a5[_0x5288(0x16f)],_0x3bafc[_0x5288(0x143)]):(console['error'](_0x49b0a5[_0x5288(0x170)]),console[_0x5288(0x43)](_0x49b0a5[_0x5288(0x171)]));else{if(_0x49b0a5[_0x5288(0x172)](_0x4819b9[_0x5288(0x1a)],statusCodes[_0x5288(0x173)]))console['error'](_0x49b0a5[_0x5288(0x174)]);else _0x49b0a5['IdMzY'](_0x4819b9[_0x5288(0x1a)],statusCodes['PLAY_SERVICES_NOT_AVAILABLE'])&&console[_0x5288(0x43)](_0x49b0a5['WDuhk']);}return![];}};export const forceYouTubeReconnectionWithRevoke=async _0x426f89=>{const _0xca71e0={'AtDIh':'โ„น๏ธ\x20NOTE:\x20SDK\x20does\x20not\x20create\x20users\x20during\x20YouTube\x20connection','mgIZw':'User\x20cancelled\x20Google\x20Sign-In','lyueB':_0x5288(0x175),'QIGGu':_0x5288(0xb4),'jioda':'๐Ÿ”„\x20FORCING\x20YouTube\x20consent\x20via\x20REVOKE\x20method...','ogfOb':_0x5288(0xa2),'gyofr':function(_0x4c4b87){return _0x4c4b87();},'Kcwjo':function(_0x24553f,_0x328e76){return _0x24553f===_0x328e76;},'ZgZcz':_0x5288(0x176),'HVNNZ':_0x5288(0x177),'hwXNe':_0x5288(0x178),'FjaXi':'โ„น๏ธ\x20No\x20existing\x20permissions\x20to\x20revoke:','KhlAu':_0x5288(0x179),'SOtGd':_0x5288(0x17a),'XcSRI':_0x5288(0x0),'KCkJj':function(_0x1f1201,_0x26fd6a){return _0x1f1201===_0x26fd6a;},'cWfdg':_0x5288(0x17b),'swILa':_0x5288(0x17c)};try{var _0x203f81;console[_0x5288(0xc)](_0xca71e0['jioda']),console[_0x5288(0xc)](_0xca71e0['ogfOb'],_0x426f89),_0xca71e0[_0x5288(0x17d)](initializeGoogleSignIn),await GoogleSignin[_0x5288(0xf1)]();try{_0xca71e0['Kcwjo'](_0xca71e0[_0x5288(0x17e)],_0xca71e0[_0x5288(0x17f)])?(_0xfb945f[_0x5288(0xc)](_0x5288(0x180)),_0x3c0c64['log'](_0xca71e0[_0x5288(0x181)]),_0x134dc9['log']('โ„น๏ธ\x20User\x20should\x20authenticate\x20first\x20via\x20Google/Apple/Email\x20before\x20connecting\x20YouTube')):(await GoogleSignin[_0x5288(0x182)](),console[_0x5288(0xc)](_0xca71e0[_0x5288(0x183)]));}catch(_0x23586a){console['log'](_0xca71e0[_0x5288(0x184)],_0x23586a);}await GoogleSignin[_0x5288(0x185)](),console[_0x5288(0xc)](_0x5288(0x186)),console[_0x5288(0xc)](_0x5288(0x187));const _0x3130a3=await GoogleSignin[_0x5288(0xf4)](),_0x571a90=await GoogleSignin[_0x5288(0xe6)](),_0x546f33=await GoogleSignin[_0x5288(0xf8)](),_0x5c358d=(_0xca71e0[_0x5288(0x188)](_0x203f81=_0x3130a3[_0x5288(0xb)],null)||_0x203f81===void 0x0?void 0x0:_0x203f81[_0x5288(0xb4)])||(_0x546f33===null||_0x546f33===void 0x0?void 0x0:_0x546f33['serverAuthCode']);if(_0x5c358d){if(_0xca71e0[_0x5288(0x188)](_0xca71e0['KhlAu'],_0xca71e0[_0x5288(0x189)]))return console[_0x5288(0xc)](_0xca71e0[_0x5288(0x18a)]),console[_0x5288(0xc)](_0xca71e0[_0x5288(0x18b)],_0x5c358d[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf)),!![];else _0x1ee707[_0x5288(0xc)](_0xca71e0[_0x5288(0x18c)]);}else{if(_0xca71e0[_0x5288(0x18d)](_0xca71e0['cWfdg'],_0xca71e0[_0x5288(0x18e)]))return console[_0x5288(0x43)](_0xca71e0[_0x5288(0x18f)]),![];else _0x1ad3b3[_0x5288(0xc)](_0x5288(0x190)),_0x5b5e4a['log'](_0xca71e0[_0x5288(0x191)],_0x1212e5[_0x5288(0x109)]('4/')?_0xca71e0[_0x5288(0x192)]:'refreshToken');}}catch(_0xaf6b63){return console[_0x5288(0x43)](_0x5288(0xec),_0xaf6b63),![];}};export const fixUserYouTubeConnection=async _0x4dea13=>{const _0x34e4da={'jsKXP':function(_0x42d5a0){return _0x42d5a0();},'vIFhG':_0x5288(0x5),'ieoyE':function(_0x2a9518,_0x5ff964){return _0x2a9518!==_0x5ff964;},'fdmVc':function(_0x192e48,_0x229ed7){return _0x192e48!==_0x229ed7;},'NFASq':_0x5288(0x3),'KPtby':_0x5288(0x193),'XjhAu':function(_0x239bdf,_0x3fea31){return _0x239bdf(_0x3fea31);},'yYSzG':_0x5288(0x194),'ZFNHU':_0x5288(0x195),'urdZQ':_0x5288(0x196)};console['log'](_0x5288(0x197)+_0x4dea13),console[_0x5288(0xc)](_0x34e4da[_0x5288(0x198)]);let _0x1554df=await _0x34e4da['XjhAu'](forceYouTubeReconnectionWithConsent,_0x4dea13);if(_0x1554df){if(_0x34e4da['yYSzG']===_0x34e4da['ZFNHU']){if(!_0x34e4da[_0x5288(0x199)](_0x3976e4))throw new _0x29a276(_0x34e4da[_0x5288(0x19a)]);const _0x333317=_0x34e4da[_0x5288(0x199)](_0x45e36b);if(!(_0x34e4da[_0x5288(0x19b)](_0x333317,null)&&_0x34e4da[_0x5288(0x19c)](_0x333317,void 0x0)&&_0x333317[_0x5288(0x7)]))throw new _0x55e5ba('No\x20API\x20key\x20configured.\x20Please\x20initialize\x20the\x20SDK\x20with\x20a\x20valid\x20developer\x20API\x20key.');return{..._0x1a68e6(),'Authorization':_0x5288(0x11)+_0x333317['apiKey'],'X-SDK-Version':_0x34e4da[_0x5288(0x19d)],'X-SDK-Platform':'react-native'};}else return console[_0x5288(0xc)]('โœ…\x20'+_0x4dea13+_0x5288(0x116)),!![];}console['log'](_0x34e4da['urdZQ']),_0x1554df=await forceYouTubeReconnectionWithRevoke(_0x4dea13);if(_0x1554df)return console[_0x5288(0xc)]('โœ…\x20'+_0x4dea13+_0x5288(0x19e)),!![];return console[_0x5288(0x43)](_0x5288(0x19f)+_0x4dea13+_0x5288(0x1a0)),![];};const refreshGoogleTokens=async()=>{const _0x430df2={'bIxHL':_0x5288(0x3a),'HZkFv':_0x5288(0xd4),'Ygdhr':_0x5288(0xd5),'taBnP':_0x5288(0x1a1),'Jroio':function(_0x5f01d3,_0x54ae0a){return _0x5f01d3!==_0x54ae0a;},'MiTrc':_0x5288(0x1a2),'bOirG':_0x5288(0x1a3),'Ntzks':_0x5288(0x1a4),'iqsoB':function(_0x4ee1f0,_0x261466){return _0x4ee1f0===_0x261466;},'GRADU':_0x5288(0x1a5),'YhcQg':_0x5288(0x1a6),'ZHLmB':_0x5288(0x1a7),'WWZyh':'โœ…\x20Re-authentication\x20successful','foVuP':_0x5288(0x1a8)};try{console['log'](_0x430df2[_0x5288(0x1a9)]);const _0x310bb1=await GoogleSignin[_0x5288(0xf8)]();if(!_0x310bb1){if(_0x430df2['Jroio'](_0x430df2[_0x5288(0x1aa)],_0x430df2[_0x5288(0x1ab)]))return console['log'](_0x5288(0x1ac)),null;else _0x4316b2['api2Test']={'success':![],'error':_0xd03545[_0x5288(0x42)],'name':_0x1c53bd[_0x5288(0x88)]},_0x32d43a[_0x5288(0x43)](_0x430df2[_0x5288(0x1ad)],_0x396156[_0x5288(0x42)]);}const _0x467ed6=await GoogleSignin[_0x5288(0xe6)]();return console[_0x5288(0xc)](_0x430df2[_0x5288(0x1ae)]),{'accessToken':_0x467ed6[_0x5288(0xe7)],'idToken':_0x467ed6[_0x5288(0x1af)]};}catch(_0x530821){if(_0x430df2[_0x5288(0x1b0)](_0x430df2['GRADU'],_0x430df2[_0x5288(0x1b1)]))_0x461f22[_0x5288(0x43)](_0x430df2[_0x5288(0x1b2)]),_0x31739b['error'](_0x430df2['Ygdhr']);else{console[_0x5288(0x43)](_0x430df2[_0x5288(0x1b3)],_0x530821);try{console[_0x5288(0xc)](_0x5288(0x1b4));const _0x1f3052=await GoogleSignin[_0x5288(0xf4)](),_0x5e9286=await GoogleSignin[_0x5288(0xe6)]();return console[_0x5288(0xc)](_0x430df2[_0x5288(0x1b5)]),{'accessToken':_0x5e9286['accessToken'],'idToken':_0x5e9286[_0x5288(0x1af)]};}catch(_0x4c541d){return console[_0x5288(0x43)](_0x430df2['foVuP'],_0x4c541d),null;}}}},debugYouTubeTokens=async()=>{const _0x5aefc1={'NDeHY':_0x5288(0xae),'DAMXN':_0x5288(0x1b6),'HQyHZ':function(_0x5edcf7,_0x4cb803){return _0x5edcf7!==_0x4cb803;},'LhBcW':function(_0x4dcaac,_0x4b70bf){return _0x4dcaac===_0x4b70bf;},'jAuCv':function(_0x2da83,_0x18e786){return _0x2da83===_0x18e786;},'vGUHY':function(_0x569741,_0x1fb8c3){return _0x569741!==_0x1fb8c3;},'FrzSJ':_0x5288(0xb4),'ujdwW':_0x5288(0x1b7),'KacEz':_0x5288(0x1b8),'xhoLz':_0x5288(0x1b9),'Kbmry':_0x5288(0x43)};try{var _0x2d1804;const _0x47612d=await GoogleSignin['getTokens'](),_0x5f3977=await GoogleSignin[_0x5288(0xf8)]();return console[_0x5288(0xc)](_0x5288(0x1ba),{'accessToken':_0x47612d[_0x5288(0xe7)]?_0x47612d[_0x5288(0xe7)]['substring'](0x0,0x14)+_0x5288(0xf):_0x5aefc1[_0x5288(0x1bb)],'idToken':_0x47612d[_0x5288(0x1af)]?_0x5aefc1[_0x5288(0x1bc)]:_0x5aefc1[_0x5288(0x1bb)],'serverAuthCode':_0x5aefc1[_0x5288(0x1bd)](_0x5f3977,null)&&_0x5f3977!==void 0x0&&_0x5f3977[_0x5288(0xb4)]?_0x5f3977[_0x5288(0xb4)][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x5aefc1['NDeHY'],'userEmail':(_0x5aefc1[_0x5288(0x1be)](_0x5f3977,null)||_0x5aefc1[_0x5288(0x1bf)](_0x5f3977,void 0x0)||(_0x2d1804=_0x5f3977[_0x5288(0xe4)])===null||_0x5aefc1[_0x5288(0x1bf)](_0x2d1804,void 0x0)?void 0x0:_0x2d1804[_0x5288(0x6b)])||_0x5aefc1[_0x5288(0x1bb)]}),{'hasRefreshToken':!!(_0x5aefc1['HQyHZ'](_0x5f3977,null)&&_0x5f3977!==void 0x0&&_0x5f3977[_0x5288(0xb4)]),'refreshTokenType':_0x5aefc1[_0x5288(0x1c0)](_0x5f3977,null)&&_0x5f3977!==void 0x0&&_0x5f3977[_0x5288(0xb4)]?_0x5aefc1['FrzSJ']:_0x5aefc1[_0x5288(0x1c1)]};}catch(_0x1a3939){return _0x5aefc1['jAuCv'](_0x5288(0x1c2),_0x5aefc1[_0x5288(0x1c3)])?{'success':![],'message':_0x5288(0x1c4),'details':_0x1310d4}:(console['error'](_0x5aefc1['xhoLz'],_0x1a3939),{'hasRefreshToken':![],'refreshTokenType':_0x5aefc1[_0x5288(0x1c5)]});}};export const reconnectYouTube=async _0x24c9a1=>{const _0x17bc4e={'jnPZu':_0x5288(0x1a8),'CFRhp':_0x5288(0x17a),'bBGSj':function(_0x2a29af,_0x5dd656){return _0x2a29af===_0x5dd656;},'RJSHt':_0x5288(0x1c6),'TvCat':_0x5288(0x1c7),'HuWiv':_0x5288(0x1c8),'kofku':'โ„น๏ธ\x20Already\x20signed\x20out\x20or\x20sign\x20out\x20failed:','UDmGS':_0x5288(0x1c9),'hOCMF':function(_0x23032b,_0x5aa322,_0x313fde){return _0x23032b(_0x5aa322,_0x313fde);},'fQJuw':_0x5288(0xc0),'JAyCo':_0x5288(0x1ca),'kzbEA':_0x5288(0x1cb),'aKDXT':_0x5288(0x1cc),'bIVrp':_0x5288(0xa0),'jgCWU':_0x5288(0x1cd),'sxDKh':_0x5288(0x1ce),'AaFrg':_0x5288(0x2e)};try{if(_0x17bc4e[_0x5288(0x1cf)](_0x17bc4e[_0x5288(0x1d0)],_0x5288(0x1d1)))return _0x12086f[_0x5288(0x43)](_0x17bc4e[_0x5288(0x1d2)],_0x2b15bd),null;else{console[_0x5288(0xc)](_0x17bc4e[_0x5288(0x1d3)]);try{await GoogleSignin[_0x5288(0x185)](),console[_0x5288(0xc)](_0x17bc4e['HuWiv']);}catch(_0x4e7e23){console[_0x5288(0xc)](_0x17bc4e['kofku'],_0x4e7e23);}try{const _0x583249=await GoogleSignin[_0x5288(0xe6)]();_0x583249[_0x5288(0xe7)]&&(await GoogleSignin[_0x5288(0x1d4)](_0x583249[_0x5288(0xe7)]),console[_0x5288(0xc)](_0x5288(0x1d5)));}catch(_0x3882fe){console[_0x5288(0xc)](_0x17bc4e[_0x5288(0x1d6)],_0x3882fe);}const _0x2c982c=await _0x17bc4e[_0x5288(0x1d7)](initiateNativeAuth,_0x17bc4e[_0x5288(0x1d8)],_0x24c9a1);if(_0x2c982c){if(_0x17bc4e['JAyCo']!==_0x17bc4e[_0x5288(0x1d9)]){console[_0x5288(0xc)](_0x17bc4e['aKDXT']);const _0x3baa0e=await debugYouTubeTokens();return _0x3baa0e['hasRefreshToken']?console[_0x5288(0xc)](_0x17bc4e[_0x5288(0x1da)],_0x3baa0e[_0x5288(0x143)]):console[_0x5288(0xdd)](_0x17bc4e['jgCWU']),!![];}else return _0x3ba71f['log']('โŒ\x20User\x20not\x20signed\x20in\x20to\x20Google,\x20cannot\x20refresh\x20tokens'),null;}else return _0x17bc4e['bBGSj'](_0x17bc4e['sxDKh'],'UQPFo')?(_0x5c0875[_0x5288(0xc)](_0x17bc4e[_0x5288(0x1db)]),_0x1c47ca[_0x5288(0xc)](_0x5288(0x0),_0x2d64c2[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf)),!![]):(console[_0x5288(0x43)](_0x5288(0x1dc)),![]);}}catch(_0x53f066){return console[_0x5288(0x43)](_0x17bc4e[_0x5288(0x1dd)],_0x53f066),![];}};export const initiateNativeAuth=async(_0x38575e,_0x1015a2)=>{const _0x177b47={'qBoXt':function(_0x40b35b,_0x19acf6){return _0x40b35b===_0x19acf6;},'CtUDl':function(_0x2bf8a0,_0x26f1ff){return _0x2bf8a0===_0x26f1ff;},'vQbVr':function(_0x4f910c,_0x1fab5b){return _0x4f910c===_0x1fab5b;},'tLthy':function(_0x38bc2e,_0x22ba46){return _0x38bc2e===_0x22ba46;},'aNYHL':function(_0x3c5aa2,_0x5f4785){return _0x3c5aa2===_0x5f4785;},'USjxw':_0x5288(0x2),'BlYja':_0x5288(0x1cd),'SiOAi':_0x5288(0x1de),'LpjAp':_0x5288(0xde),'cDSSX':_0x5288(0x1df),'DKpLd':_0x5288(0x1e0),'kFjVt':_0x5288(0x1e1),'FYdhp':_0x5288(0x1e2),'oBimy':_0x5288(0x1e3),'YXQha':'SdSbh','XwZXQ':function(_0x413a28,_0x1349ea,_0x559ec2){return _0x413a28(_0x1349ea,_0x559ec2);},'GYeFw':function(_0x1e9b66,_0x8222b7){return _0x1e9b66===_0x8222b7;},'yexBH':_0x5288(0x1e4),'oMzdk':_0x5288(0x1e5),'LWRlz':'โŒ\x20[YOUTUBE\x20AUTH]\x20Username\x20is\x20required\x20for\x20YouTube\x20authentication','qNrkN':'๐Ÿ”„\x20Signed\x20out\x20to\x20force\x20fresh\x20consent','otWYf':_0x5288(0x1e6),'JOiNK':function(_0x92ab61,_0x33e4d0){return _0x92ab61===_0x33e4d0;},'uNeHC':function(_0x4d0b50,_0x4c5b25){return _0x4d0b50===_0x4c5b25;},'chiiN':_0x5288(0x1e7),'PoBig':_0x5288(0x1e8),'cDWJd':_0x5288(0x1e9),'VvjGH':_0x5288(0x1ea),'acRxZ':function(_0x4f045d,_0xd1cce4){return _0x4f045d!==_0xd1cce4;},'XHnYy':_0x5288(0x1eb),'sVMCf':function(_0x3c04e7,_0x344a33){return _0x3c04e7!==_0x344a33;},'FeBSf':function(_0x3c9049,_0x6ff82d){return _0x3c9049!==_0x6ff82d;},'gDmMx':'-\x20tokens.idToken:','rPRtj':_0x5288(0x1ec),'lCGsc':function(_0x1c8c50,_0x27af19){return _0x1c8c50!==_0x27af19;},'gDeIn':_0x5288(0x1ed),'ODAay':_0x5288(0x0),'MKQYP':function(_0x185e36,_0x1cbd12){return _0x185e36!==_0x1cbd12;},'lNujU':function(_0x4d20c6,_0x246c3e){return _0x4d20c6!==_0x246c3e;},'jRLdF':_0x5288(0x1ee),'ArHfW':'โœ…\x20Got\x20serverAuthCode\x20from\x20sign-in\x20response','sgRbg':_0x5288(0x1ef),'FpQuM':_0x5288(0x1f0),'TmQLz':_0x5288(0x1f1),'BCdDy':'wijNO','shxBT':'eNReX','rVtBo':'โœ…\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection','WvhtW':_0x5288(0xb4),'mxvtH':_0x5288(0xc1),'WczlQ':_0x5288(0x99),'QVRnN':_0x5288(0x1f2),'oFNbY':_0x5288(0xb6),'IUjLz':function(_0x4871b5,_0x363c9b,_0x1ae881){return _0x4871b5(_0x363c9b,_0x1ae881);},'GJTYs':'https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true','JKWRu':'โœ…\x20YouTube\x20channel\x20found:','mSyRW':_0x5288(0x1f3),'YCOtM':_0x5288(0x11d),'VqCmf':function(_0x102476,_0x374c38){return _0x102476===_0x374c38;},'nzrIL':function(_0xbc058b,_0x4eee60){return _0xbc058b===_0x4eee60;},'XoQDl':'No\x20Channel','nDywS':_0x5288(0x1f4),'wnDTT':_0x5288(0xe0),'Cqkzx':function(_0x1c23b5,_0x3cb79e){return _0x1c23b5===_0x3cb79e;},'ASWkl':'PKvAv','oVOfa':_0x5288(0x1f5),'csOIU':function(_0x22066e,_0x5c2ad1){return _0x22066e===_0x5c2ad1;},'ERvwZ':function(_0x1ebc17,_0x3484fd){return _0x1ebc17===_0x3484fd;},'XZpjp':function(_0x5c1d92,_0x40cddb){return _0x5c1d92===_0x40cddb;},'YgxlW':function(_0x5ec2e8){return _0x5ec2e8();},'fhXlO':_0x5288(0x1f6),'QKPLm':'youtube_user','cpBtM':function(_0x2603a0,_0x2badc1){return _0x2603a0<_0x2badc1;},'gjNgB':_0x5288(0x180),'frTyi':'โ„น๏ธ\x20NOTE:\x20SDK\x20does\x20not\x20create\x20users\x20during\x20YouTube\x20connection','EgZxB':_0x5288(0x1f7),'hkxxY':_0x5288(0x1f8),'zYnQM':_0x5288(0x1f9),'KxFVo':'๐Ÿ“บ\x20YouTube\x20channel\x20name:','SDZxK':function(_0x3b98cc,_0x1b915){return _0x3b98cc===_0x1b915;},'YyNXu':function(_0x151845,_0x51a225){return _0x151845===_0x51a225;},'ImhlR':function(_0x132a6e,_0x4d9ef2){return _0x132a6e===_0x4d9ef2;},'pgYTS':function(_0x3ea505,_0x15120d){return _0x3ea505===_0x15120d;},'mIswn':function(_0x412fdf,_0x29dc52){return _0x412fdf===_0x29dc52;},'MZBjj':function(_0x1a8b95,_0x3e1c40){return _0x1a8b95===_0x3e1c40;},'xifNR':function(_0x4f52ed,_0x5312c3){return _0x4f52ed===_0x5312c3;},'UIgoU':function(_0x58a679,_0x5c1d0c){return _0x58a679===_0x5c1d0c;},'EjgID':function(_0x1c11fe,_0x31f960){return _0x1c11fe!==_0x31f960;},'uprLv':_0x5288(0x1fa),'ZzZBB':function(_0x5176da,_0x41a58b){return _0x5176da*_0x41a58b;},'ZtaxI':_0x5288(0x1b7),'PCIAU':_0x5288(0x1fb),'BSTba':'-\x20hasAccessToken:','jHOaG':'-\x20hasRefreshToken:','MsbpS':_0x5288(0x1fc),'GPyDd':_0x5288(0x1fd),'TzJxV':function(_0x3b343e,_0xca50f5){return _0x3b343e===_0xca50f5;},'ODvrQ':function(_0x51cf67,_0x16ffa2){return _0x51cf67===_0x16ffa2;},'XzjEA':function(_0x519daa,_0x2af45f){return _0x519daa===_0x2af45f;},'DaRmZ':function(_0x1ab562,_0x2114ac){return _0x1ab562===_0x2114ac;},'McnqV':_0x5288(0x1fe),'OTKmI':_0x5288(0x1ff),'Vzmhv':_0x5288(0x200),'UVRcK':function(_0xe260e9,_0x4ec6e3){return _0xe260e9&&_0x4ec6e3;},'SPiKq':'๐Ÿ“ก\x20Backend\x20response\x20headers:','ZmwuH':function(_0x55d68f,_0x251488){return _0x55d68f===_0x251488;},'RpmBr':_0x5288(0x201),'BNCUC':_0x5288(0x202),'xvPnF':function(_0x2b79f6,_0x6ac692){return _0x2b79f6===_0x6ac692;},'wIulv':function(_0xb9ada7,_0x848749){return _0xb9ada7===_0x848749;},'ZewxB':function(_0x26b45c,_0x5b04f0){return _0x26b45c===_0x5b04f0;},'gWHsm':_0x5288(0x155),'dJxMg':_0x5288(0x203),'AvNOn':_0x5288(0x204),'iNtyM':_0x5288(0x205),'OvgQq':_0x5288(0x206),'BTkko':_0x5288(0x207),'hZfwb':_0x5288(0x208),'LxTEG':_0x5288(0x209),'ZOUsc':_0x5288(0x20a),'SfNND':_0x5288(0x20b),'tLPtF':'User\x20cancelled\x20Google\x20Sign-In','iOtNL':_0x5288(0x20c),'JYftI':_0x5288(0x20d),'FrDwE':_0x5288(0x20e),'AWtjS':_0x5288(0x20f),'JGVIs':function(_0x1254a5,_0x1fefe2){return _0x1254a5===_0x1fefe2;},'GffzC':'instagram','QyJxu':'Initiating\x20Facebook\x20Login\x20for\x20Instagram'};if(_0x38575e==='youtube'){if(_0x177b47[_0x5288(0x210)](_0x5288(0x1e4),_0x177b47[_0x5288(0x211)])){console[_0x5288(0xc)](_0x177b47[_0x5288(0x212)]);if(!_0x1015a2||_0x177b47[_0x5288(0x210)](_0x1015a2[_0x5288(0x133)](),''))return console[_0x5288(0x43)](_0x177b47[_0x5288(0x213)]),![];try{var _0x3fa088,_0x3e00ac,_0x46f647,_0x3015bc,_0x2f3fa3,_0x479d3f,_0x2b093b,_0x224857,_0x1c9e10,_0x547ab4;initializeGoogleSignIn(),await GoogleSignin[_0x5288(0xf1)]();try{await GoogleSignin[_0x5288(0x185)](),console[_0x5288(0xc)](_0x177b47[_0x5288(0x214)]);}catch(_0x417f58){console[_0x5288(0xc)](_0x5288(0x215),_0x417f58);}const _0x56f0fe=await GoogleSignin[_0x5288(0xf4)]();console[_0x5288(0xc)](_0x177b47[_0x5288(0x216)],_0x177b47[_0x5288(0x217)](_0x3fa088=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x217)](_0x3fa088,void 0x0)||_0x177b47[_0x5288(0x218)](_0x3fa088=_0x3fa088['user'],null)||_0x177b47[_0x5288(0x219)](_0x3fa088,void 0x0)?void 0x0:_0x3fa088[_0x5288(0x6b)]),console['log'](_0x177b47[_0x5288(0x21a)]),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x56f0fe,null,0x2));const _0xcd7c2a=await GoogleSignin[_0x5288(0xe6)]();console[_0x5288(0xc)](_0x177b47[_0x5288(0x21b)]),console['log']('๐Ÿ“‹\x20FULL\x20tokens\x20object:'),console[_0x5288(0xc)](JSON['stringify'](_0xcd7c2a,null,0x2));const _0x58ebea=await GoogleSignin[_0x5288(0xf8)]();console[_0x5288(0xc)](_0x177b47[_0x5288(0x21c)],_0x177b47['uNeHC'](_0x58ebea,null)||_0x177b47[_0x5288(0x219)](_0x58ebea,void 0x0)||(_0x3e00ac=_0x58ebea['user'])===null||_0x3e00ac===void 0x0?void 0x0:_0x3e00ac[_0x5288(0x6b)]),console[_0x5288(0xc)]('๐Ÿ“‹\x20FULL\x20currentUser\x20object:'),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x58ebea,null,0x2));let _0xb773b5=null;console[_0x5288(0xc)](_0x5288(0x21d)),console[_0x5288(0xc)](_0x177b47[_0x5288(0x21e)],_0x177b47[_0x5288(0x21f)](_0x46f647=_0x56f0fe[_0x5288(0xb)],null)&&_0x177b47[_0x5288(0x21f)](_0x46f647,void 0x0)&&_0x46f647[_0x5288(0xb4)]?'Present:\x20'+_0x56f0fe[_0x5288(0xb)][_0x5288(0xb4)]['substring'](0x0,0x14)+_0x5288(0xf):_0x5288(0xae)),console[_0x5288(0xc)](_0x177b47[_0x5288(0x220)],_0x177b47[_0x5288(0x221)](_0x58ebea,null)&&_0x177b47[_0x5288(0x222)](_0x58ebea,void 0x0)&&_0x58ebea['serverAuthCode']?_0x5288(0x223)+_0x58ebea['serverAuthCode'][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x5288(0xae)),console['log'](_0x177b47[_0x5288(0x224)],_0xcd7c2a[_0x5288(0x1af)]?'Present:\x20'+_0xcd7c2a[_0x5288(0x1af)][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x5288(0xae)),console['log'](_0x177b47[_0x5288(0x225)],_0xcd7c2a[_0x5288(0xe7)]?_0x5288(0x223)+_0xcd7c2a['accessToken'][_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x5288(0xae));if(_0x177b47[_0x5288(0x222)](_0x58ebea,null)&&_0x177b47['lCGsc'](_0x58ebea,void 0x0)&&_0x58ebea[_0x5288(0xb4)])_0xb773b5=_0x58ebea[_0x5288(0xb4)],console[_0x5288(0xc)](_0x177b47['gDeIn']),console[_0x5288(0xc)](_0x177b47[_0x5288(0x226)],_0xb773b5[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf));else{if(_0x177b47['MKQYP'](_0x3015bc=_0x56f0fe['data'],null)&&_0x177b47['lNujU'](_0x3015bc,void 0x0)&&_0x3015bc['serverAuthCode']){if(_0x177b47['acRxZ'](_0x5288(0x1ee),_0x177b47[_0x5288(0x227)])){var _0x3f4fc8,_0x392fb5;_0x2caf8a['log'](_0x5288(0xbc),_0x1114ac),_0x2e592a=(_0x177b47[_0x5288(0x228)](_0x3f4fc8=_0x4ef3e4[_0x5288(0xb)],null)||_0x3f4fc8===void 0x0||(_0x3f4fc8=_0x3f4fc8[_0x5288(0xe4)])===null||_0x177b47[_0x5288(0x229)](_0x3f4fc8,void 0x0)?void 0x0:_0x3f4fc8['name'])||(_0x177b47[_0x5288(0x22a)](_0x392fb5=_0x10d47c[_0x5288(0xb)],null)||_0x177b47['tLthy'](_0x392fb5,void 0x0)||_0x177b47[_0x5288(0x22b)](_0x392fb5=_0x392fb5[_0x5288(0xe4)],null)||_0x177b47[_0x5288(0x228)](_0x392fb5,void 0x0)?void 0x0:_0x392fb5[_0x5288(0x6b)])||_0x5288(0x99);}else _0xb773b5=_0x56f0fe['data'][_0x5288(0xb4)],console['log'](_0x177b47[_0x5288(0x22c)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x226)],_0xb773b5[_0x5288(0xe)](0x0,0x14)+'...');}}if(!_0xb773b5)console[_0x5288(0x43)](_0x5288(0x22d)),console['error'](_0x177b47[_0x5288(0x22e)]),console[_0x5288(0x43)](_0x177b47[_0x5288(0x22f)]),console[_0x5288(0xdd)](_0x177b47[_0x5288(0x230)]);else{if(_0x177b47[_0x5288(0x231)]!==_0x177b47[_0x5288(0x232)])console['log'](_0x177b47['rVtBo']),console['log'](_0x5288(0x175),_0xb773b5[_0x5288(0x109)]('4/')?_0x177b47[_0x5288(0x233)]:_0x177b47[_0x5288(0x234)]);else throw new _0x1e498a(_0x177b47[_0x5288(0x235)]);}let _0x2790df=_0x177b47[_0x5288(0x236)],_0x289b38=null;try{if(_0x177b47['tLthy'](_0x177b47[_0x5288(0x237)],_0x5288(0x238)))_0x583ddb[_0x5288(0xdd)](_0x177b47[_0x5288(0x239)]);else{console['log'](_0x177b47[_0x5288(0x23a)]);const _0x4ad541=await _0x177b47[_0x5288(0x23b)](fetch,_0x177b47[_0x5288(0x23c)],{'headers':{'Authorization':_0x5288(0x11)+_0xcd7c2a[_0x5288(0xe7)],'Accept':'application/json'}});if(_0x4ad541['ok']){const _0x4a8a4d=await _0x4ad541[_0x5288(0x82)]();if(_0x4a8a4d[_0x5288(0x111)]&&_0x4a8a4d[_0x5288(0x111)][_0x5288(0x112)]>0x0)_0x2790df=_0x4a8a4d[_0x5288(0x111)][0x0][_0x5288(0x115)][_0x5288(0x23d)],_0x289b38=_0x4a8a4d[_0x5288(0x111)][0x0]['id'],console['log'](_0x177b47['JKWRu'],_0x2790df,_0x5288(0xba),_0x289b38);else{if(_0x177b47[_0x5288(0x23e)](_0x5288(0x1f3),_0x177b47[_0x5288(0x23f)]))_0x2ad61e[_0x5288(0xc)](_0x177b47[_0x5288(0x240)],_0x2a19fc);else{var _0x2581ad,_0x3fa688;console[_0x5288(0xc)](_0x177b47['YCOtM']),_0x2790df=(_0x177b47['qBoXt'](_0x2581ad=_0x56f0fe['data'],null)||_0x177b47[_0x5288(0x217)](_0x2581ad,void 0x0)||_0x177b47[_0x5288(0x219)](_0x2581ad=_0x2581ad[_0x5288(0xe4)],null)||_0x177b47[_0x5288(0x241)](_0x2581ad,void 0x0)?void 0x0:_0x2581ad[_0x5288(0x88)])||(_0x177b47[_0x5288(0x241)](_0x3fa688=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x219)](_0x3fa688,void 0x0)||(_0x3fa688=_0x3fa688[_0x5288(0xe4)])===null||_0x177b47[_0x5288(0x242)](_0x3fa688,void 0x0)?void 0x0:_0x3fa688['email'])||_0x177b47[_0x5288(0x243)];}}}else{if(_0x177b47['nDywS']!==_0x177b47[_0x5288(0x244)])_0x5a13d8[_0x5288(0xc)](_0x177b47['LpjAp'],_0x497eb8);else{var _0xf2e074,_0x4073e5;console['log'](_0x177b47[_0x5288(0x245)],_0x4ad541[_0x5288(0x4e)]),_0x2790df=(_0x177b47['GYeFw'](_0xf2e074=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x22b)](_0xf2e074,void 0x0)||_0x177b47[_0x5288(0x210)](_0xf2e074=_0xf2e074[_0x5288(0xe4)],null)||_0x177b47[_0x5288(0x228)](_0xf2e074,void 0x0)?void 0x0:_0xf2e074[_0x5288(0x88)])||(_0x177b47[_0x5288(0x219)](_0x4073e5=_0x56f0fe['data'],null)||_0x4073e5===void 0x0||_0x177b47[_0x5288(0x22b)](_0x4073e5=_0x4073e5[_0x5288(0xe4)],null)||_0x177b47['Cqkzx'](_0x4073e5,void 0x0)?void 0x0:_0x4073e5[_0x5288(0x6b)])||_0x177b47[_0x5288(0x236)];}}}}catch(_0xa0a6bd){if(_0x177b47[_0x5288(0x210)](_0x177b47[_0x5288(0x246)],_0x177b47[_0x5288(0x247)]))_0x99b19a[_0x5288(0xdd)](_0x177b47[_0x5288(0x248)]),_0x2e6627[_0x5288(0xdd)](_0x177b47[_0x5288(0x249)],_0x32ff7a[_0x5288(0x24a)](_0x5c8e2a)),_0x418507[_0x5288(0xdd)](_0x5288(0x208));else{var _0x224fa4,_0x59799f;console[_0x5288(0xc)](_0x5288(0xbc),_0xa0a6bd),_0x2790df=(_0x177b47['GYeFw'](_0x224fa4=_0x56f0fe[_0x5288(0xb)],null)||_0x224fa4===void 0x0||_0x177b47['uNeHC'](_0x224fa4=_0x224fa4[_0x5288(0xe4)],null)||_0x177b47[_0x5288(0x24b)](_0x224fa4,void 0x0)?void 0x0:_0x224fa4[_0x5288(0x88)])||(_0x177b47[_0x5288(0x24c)](_0x59799f=_0x56f0fe[_0x5288(0xb)],null)||_0x59799f===void 0x0||(_0x59799f=_0x59799f[_0x5288(0xe4)])===null||_0x177b47[_0x5288(0x24d)](_0x59799f,void 0x0)?void 0x0:_0x59799f[_0x5288(0x6b)])||_0x177b47[_0x5288(0x236)];}}let _0x31e20e=await _0x177b47[_0x5288(0x24e)](getJWT);const _0x180b87=await AsyncStorage['getItem'](_0x177b47['fhXlO']),_0x5b6adf=_0x180b87||_0x1015a2||(_0x177b47[_0x5288(0x24c)](_0x2f3fa3=_0x56f0fe['data'],null)||_0x177b47['qBoXt'](_0x2f3fa3,void 0x0)||_0x177b47[_0x5288(0x24f)](_0x2f3fa3=_0x2f3fa3[_0x5288(0xe4)],null)||_0x177b47[_0x5288(0x219)](_0x2f3fa3,void 0x0)?void 0x0:_0x2f3fa3['email'])||_0x177b47['QKPLm'];!_0x31e20e||_0x177b47['cpBtM'](_0x31e20e[_0x5288(0x133)]()[_0x5288(0x112)],0x14)?(console[_0x5288(0xc)](_0x177b47[_0x5288(0x250)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x251)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x252)])):(console[_0x5288(0xc)](_0x5288(0x253)),console[_0x5288(0xc)](_0x177b47['hkxxY'],_0x31e20e[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf)));console[_0x5288(0xc)](_0x5288(0x254),_0x5b6adf),console['log'](_0x177b47['zYnQM'],_0x31e20e?_0x31e20e[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf):_0x5288(0x255)),console[_0x5288(0xc)](_0x177b47[_0x5288(0x256)],_0x2790df);const _0xc1d21f={'session':{'username':_0x5b6adf,'platform':_0x5288(0xc0),'timestamp':new Date()[_0x5288(0x136)](),'channelName':_0x2790df,'channelId':_0x289b38},'googleUser':_0x177b47[_0x5288(0x241)](_0x479d3f=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x257)](_0x479d3f,void 0x0)?void 0x0:_0x479d3f[_0x5288(0xe4)],'accessToken':_0xcd7c2a['accessToken'],'idToken':_0xcd7c2a['idToken'],'refreshToken':_0xb773b5,'serverAuthCode':_0xb773b5,'refresh_token':_0xb773b5,'server_auth_code':_0xb773b5,'authCode':_0xb773b5,'userAccountInfo':{'username':_0x5b6adf,'email':_0x177b47['YyNXu'](_0x2b093b=_0x56f0fe['data'],null)||_0x177b47['ImhlR'](_0x2b093b,void 0x0)||_0x177b47['uNeHC'](_0x2b093b=_0x2b093b[_0x5288(0xe4)],null)||_0x2b093b===void 0x0?void 0x0:_0x2b093b['email'],'authToken':_0x31e20e,'channelName':_0x2790df,'channelId':_0x289b38,'userIdentifier':_0x31e20e?_0x5288(0x139)+_0x31e20e['substring'](0x0,0xa):'youtube-'+(_0x177b47[_0x5288(0x258)](_0x224857=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x259)](_0x224857,void 0x0)||_0x177b47[_0x5288(0x218)](_0x224857=_0x224857[_0x5288(0xe4)],null)||_0x224857===void 0x0?void 0x0:_0x224857['email']),'googleId':_0x177b47['MZBjj'](_0x1c9e10=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47['xifNR'](_0x1c9e10,void 0x0)||(_0x1c9e10=_0x1c9e10[_0x5288(0xe4)])===null||_0x177b47[_0x5288(0x25a)](_0x1c9e10,void 0x0)?void 0x0:_0x1c9e10['id'],'appleUserId':_0x31e20e!==null&&_0x177b47[_0x5288(0x25b)](_0x31e20e,void 0x0)&&_0x31e20e['includes'](_0x177b47[_0x5288(0x25c)])?_0x31e20e[_0x5288(0x127)]('.')[0x1]:null,'refreshToken':_0xb773b5,'serverAuthCode':_0xb773b5},'tokenExpiry':new Date(Date['now']()+_0x177b47[_0x5288(0x25d)](0xe10,0x3e8))[_0x5288(0x136)](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!!_0xb773b5,'refreshTokenType':_0xb773b5?_0xb773b5[_0x5288(0x109)]('4/')?_0x177b47[_0x5288(0x233)]:_0x5288(0xc1):_0x177b47[_0x5288(0x25e)],'configuredForRefresh':!![],'forcedConsent':!![],'refreshTokenValue':_0xb773b5}};console[_0x5288(0xc)](_0x177b47[_0x5288(0x25f)]),console['log'](_0x177b47[_0x5288(0x260)],!!_0xc1d21f[_0x5288(0xe7)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x261)],!!_0xc1d21f[_0x5288(0xc1)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x262)],!!_0xc1d21f['serverAuthCode']),console[_0x5288(0xc)]('-\x20refreshTokenType:',_0xc1d21f[_0x5288(0x142)]['refreshTokenType']),console['log'](_0x177b47[_0x5288(0x263)],_0x177b47[_0x5288(0x264)](_0x547ab4=_0x56f0fe[_0x5288(0xb)],null)||_0x177b47[_0x5288(0x265)](_0x547ab4,void 0x0)||_0x177b47['XzjEA'](_0x547ab4=_0x547ab4['user'],null)||_0x177b47['DaRmZ'](_0x547ab4,void 0x0)?void 0x0:_0x547ab4[_0x5288(0x6b)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x266)],_0x2790df),console[_0x5288(0xc)](_0x177b47[_0x5288(0x267)]),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0xc1d21f,null,0x2)),console[_0x5288(0xc)](_0x177b47[_0x5288(0x268)],!!_0xb773b5);const _0x2e4fa4=await fetch(API_CONFIG['BASE_URL']+_0x5288(0x269),{'method':'POST','headers':{'Content-Type':'application/json',..._0x177b47[_0x5288(0x26a)](_0x31e20e,{'Authorization':_0x31e20e})},'body':JSON[_0x5288(0x7d)](_0xc1d21f)});console[_0x5288(0xc)](_0x5288(0x26b),_0x2e4fa4[_0x5288(0x4e)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x26c)],_0x2e4fa4[_0x5288(0x14c)]);if(_0x2e4fa4['ok']){if(_0x177b47[_0x5288(0x26d)](_0x177b47['RpmBr'],_0x5288(0x26e)))return _0x592a90[_0x5288(0x43)](_0x5288(0x74)+_0x4e1d8f+_0x5288(0x75)),_0x3ed684[_0x5288(0x43)](_0x5288(0x76)),null;else{var _0x2fba6b,_0x567c29;const _0x4a90f3=await _0x2e4fa4[_0x5288(0x82)]();console[_0x5288(0xc)](_0x5288(0x26f)),console[_0x5288(0xc)](_0x177b47[_0x5288(0x270)]),console[_0x5288(0xc)](JSON[_0x5288(0x7d)](_0x4a90f3,null,0x2));const _0x475985=_0x177b47[_0x5288(0x264)]((_0x2fba6b=_0x4a90f3[_0x5288(0x14f)])===null||_0x177b47[_0x5288(0x271)](_0x2fba6b,void 0x0)?void 0x0:_0x2fba6b[_0x5288(0x151)],!![])||((_0x567c29=_0x4a90f3[_0x5288(0x152)])===null||_0x177b47[_0x5288(0x272)](_0x567c29,void 0x0)?void 0x0:_0x567c29[_0x5288(0x153)])===!![]||_0x177b47[_0x5288(0x273)](_0x4a90f3[_0x5288(0x151)],!![])||_0x4a90f3[_0x5288(0x42)]&&_0x4a90f3[_0x5288(0x42)][_0x5288(0x8d)](_0x177b47['gWHsm']);if(_0x475985){if(_0x177b47[_0x5288(0x265)](_0x177b47[_0x5288(0x274)],_0x177b47['AvNOn']))return _0x152d51[_0x5288(0x43)](_0x5288(0x275),_0x1101c9),{'success':![],'error':_0x177b47[_0x5288(0x276)]};else console[_0x5288(0xc)](_0x177b47[_0x5288(0x277)]),console[_0x5288(0xc)](_0x5288(0x278)),console['log']('โ„น๏ธ\x20[YOUTUBE\x20AUTH]\x20User\x20can\x20reconnect\x20later\x20for\x20refresh\x20tokens\x20if\x20needed');}else _0x4a90f3['hasRefreshToken']||_0x4a90f3[_0x5288(0x279)]?(console['log'](_0x177b47[_0x5288(0x27a)]),console[_0x5288(0xc)](_0x177b47[_0x5288(0x27b)])):(console[_0x5288(0xdd)](_0x5288(0x1df)),console['warn'](_0x177b47[_0x5288(0x249)],Object['keys'](_0x4a90f3)),console[_0x5288(0xdd)](_0x177b47['hZfwb']));return!![];}}else{if(_0x177b47['FeBSf'](_0x177b47[_0x5288(0x27c)],'ngnqY')){const _0x5716a2=await _0x2e4fa4[_0x5288(0x4b)]();return console[_0x5288(0x43)](_0x5288(0x27d),_0x2e4fa4[_0x5288(0x4e)]),console['error'](_0x177b47[_0x5288(0x27e)]),console['error'](_0x5716a2),![];}else return _0x25259e[_0x5288(0x43)](_0x177b47[_0x5288(0x27f)],_0x6c8335),![];}}catch(_0x72c78){console[_0x5288(0x43)](_0x177b47[_0x5288(0x280)],_0x72c78);if(_0x72c78['code']===statusCodes[_0x5288(0x16e)])console[_0x5288(0xc)](_0x177b47[_0x5288(0x281)]);else{if(_0x177b47[_0x5288(0x229)](_0x72c78[_0x5288(0x1a)],statusCodes[_0x5288(0x173)])){if(_0x177b47[_0x5288(0x282)]!==_0x177b47['JYftI'])console[_0x5288(0xc)](_0x177b47[_0x5288(0x283)]);else return _0x2cc1ac[_0x5288(0x43)]('โŒ\x20Error\x20requesting\x20email\x20verification:',_0x4b6d25),{'success':![],'error':_0x177b47['kFjVt']};}else _0x72c78[_0x5288(0x1a)]===statusCodes[_0x5288(0x284)]&&(_0x177b47['acRxZ'](_0x177b47[_0x5288(0x285)],_0x177b47[_0x5288(0x285)])?(_0x3f5084[_0x5288(0xc)](_0x5288(0x7a)+_0x28ef1e+_0x5288(0x7b)),_0x3663dc['abort']()):console[_0x5288(0xc)](_0x5288(0x286)));}return![];}}else _0x43a615[_0x5288(0x43)]('โŒ\x20[OAUTH]\x20Error\x20initiating\x20OAuth\x20for\x20'+_0x2cf106+':',_0x531736);}if(_0x177b47[_0x5288(0x287)](_0x38575e,_0x177b47[_0x5288(0x288)]))return console[_0x5288(0xc)](_0x177b47['QyJxu']),new Promise(_0x5854bc=>{_0x5288(0x289)===_0x177b47[_0x5288(0x28a)]?_0x177b47[_0x5288(0x28b)](setTimeout,()=>{console[_0x5288(0xc)](_0x5288(0x28c)),_0x5854bc(!![]);},0x3e8):_0x305e70[_0x5288(0x43)](_0x177b47['oBimy']);});return![];};export const isOAuthCallback=_0x27bdf1=>{const _0x528c90={'FTuEp':_0x5288(0x28d),'INohL':'code='};return _0x27bdf1['includes'](_0x528c90['FTuEp'])||_0x27bdf1[_0x5288(0x8d)](_0x528c90[_0x5288(0x28e)]);};export const exchangeCodeForToken=async(_0x3f0b85,_0x35691d)=>{const _0x38912b={'bZaVC':_0x5288(0x253),'ICXWC':_0x5288(0x1f8),'pbuKS':function(_0x29fc35,_0xe37ad9,_0x2d65bd){return _0x29fc35(_0xe37ad9,_0x2d65bd);},'YKCMR':function(_0x2a3758,_0x36e116){return _0x2a3758===_0x36e116;},'ONrLQ':_0x5288(0x28f)};console[_0x5288(0xc)](_0x5288(0x290)+_0x35691d);try{const _0x4225a2=API_CONFIG[_0x5288(0x20)]+'/'+_0x35691d+_0x5288(0x291),_0x4ce51b=await _0x38912b['pbuKS'](fetch,_0x4225a2,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x5288(0x7d)]({'code':_0x3f0b85,'platform':_0x35691d})});if(!_0x4ce51b['ok']){console[_0x5288(0x43)]('Error\x20exchanging\x20code\x20for\x20token:\x20'+_0x4ce51b[_0x5288(0x4e)]);throw new Error(_0x5288(0x166)+_0x4ce51b['status']);}const _0x4d9e27=await _0x4ce51b[_0x5288(0x82)]();return console[_0x5288(0xc)](_0x5288(0x292)+_0x35691d),_0x4d9e27;}catch(_0x2ffd09){if(_0x38912b[_0x5288(0x293)](_0x38912b[_0x5288(0x294)],'ijxUY'))_0xf71452['log'](_0x38912b[_0x5288(0x295)]),_0x57a792[_0x5288(0xc)](_0x38912b[_0x5288(0x296)],_0x173c0d['substring'](0x0,0x14)+_0x5288(0xf));else return console['error']('Error\x20exchanging\x20code\x20for\x20token:',_0x2ffd09),console['log'](_0x5288(0x297)),{'access_token':_0x35691d+_0x5288(0x298)+Math[_0x5288(0x299)]()[_0x5288(0x29a)](0x24)[_0x5288(0xe)](0x7),'refresh_token':_0x35691d+'_refresh_token_'+Math[_0x5288(0x299)]()[_0x5288(0x29a)](0x24)[_0x5288(0xe)](0x7),'expires_in':0xe10};}};export const refreshYouTubeTokens=async()=>{const _0x167df9={'VyNdf':function(_0x3bb1f7,_0x31368b){return _0x3bb1f7===_0x31368b;},'sBdcL':function(_0x234be9,_0x3bbe03){return _0x234be9===_0x3bbe03;},'tESMU':function(_0x40cff2,_0x526791){return _0x40cff2===_0x526791;},'VZVjQ':function(_0x45970c,_0x34ed49){return _0x45970c===_0x34ed49;},'FSbIW':function(_0x1a77c8,_0x239e75){return _0x1a77c8===_0x239e75;},'mDGVC':_0x5288(0x9a),'UYsrF':'๐Ÿ”‘\x20Refresh\x20token\x20preview:','xdcHo':_0x5288(0x29b),'yLYGV':'๐Ÿ”„\x20Refreshing\x20YouTube\x20tokens...','vXWSX':_0x5288(0x29c),'TfXdt':'โŒ\x20No\x20current\x20Google\x20user\x20found','UNURs':'bqusc','oIzRi':function(_0x1b3f74,_0x5a056c){return _0x1b3f74===_0x5a056c;},'ujmXb':function(_0x25654c,_0x1b0815){return _0x25654c===_0x1b0815;},'ikugs':_0x5288(0x29d),'vBSTm':_0x5288(0x29e),'gCYgM':_0x5288(0x29f),'KCmLr':function(_0x598583,_0x23d443){return _0x598583!==_0x23d443;},'ozoCl':'MWJad','Qizgz':'โŒ\x20Error\x20refreshing\x20YouTube\x20tokens:'};try{var _0x53b9ad;console['log'](_0x167df9[_0x5288(0x2a0)]);const _0xb483b=await GoogleSignin[_0x5288(0xe6)]();if(!_0xb483b)return console['error'](_0x167df9['vXWSX']),![];const _0xe29662=await GoogleSignin[_0x5288(0xf8)]();if(!_0xe29662)return console[_0x5288(0x43)](_0x167df9['TfXdt']),![];const _0x148ba0=await getJWT();if(!_0x148ba0){if(_0x167df9['sBdcL'](_0x167df9[_0x5288(0x2a1)],_0x167df9[_0x5288(0x2a1)]))return console['error'](_0x167df9[_0x5288(0x2a2)]),![];else{var _0xc49602,_0x393b4a;_0x3207cb['log'](_0x5288(0x11d)),_0x9b90dc=(_0x167df9[_0x5288(0x2a3)](_0xc49602=_0x48fe50[_0x5288(0xb)],null)||_0xc49602===void 0x0||_0x167df9['VyNdf'](_0xc49602=_0xc49602[_0x5288(0xe4)],null)||_0x167df9[_0x5288(0x2a4)](_0xc49602,void 0x0)?void 0x0:_0xc49602[_0x5288(0x88)])||(_0x167df9[_0x5288(0x2a5)](_0x393b4a=_0x10f85b[_0x5288(0xb)],null)||_0x167df9[_0x5288(0x2a4)](_0x393b4a,void 0x0)||_0x167df9[_0x5288(0x2a6)](_0x393b4a=_0x393b4a[_0x5288(0xe4)],null)||_0x167df9[_0x5288(0x2a7)](_0x393b4a,void 0x0)?void 0x0:_0x393b4a[_0x5288(0x6b)])||_0x167df9[_0x5288(0x2a8)];}}const _0x57bf5b=await fetch(API_CONFIG[_0x5288(0x20)]+_0x5288(0x2a9),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x148ba0},'body':JSON['stringify']({'accessToken':_0xb483b['accessToken'],'idToken':_0xb483b['idToken'],'refreshToken':_0xe29662[_0x5288(0xb4)],'userEmail':_0x167df9[_0x5288(0x2aa)](_0x53b9ad=_0xe29662[_0x5288(0xe4)],null)||_0x167df9['ujmXb'](_0x53b9ad,void 0x0)?void 0x0:_0x53b9ad[_0x5288(0x6b)],'tokenExpiry':new Date(Date[_0x5288(0x13e)]()+0xe10*0x3e8)[_0x5288(0x136)](),'timestamp':new Date()['toISOString']()})});if(_0x57bf5b['ok']){if(_0x167df9[_0x5288(0x2ab)]===_0x167df9[_0x5288(0x2ab)]){const _0x3e8f43=await _0x57bf5b[_0x5288(0x82)]();return console[_0x5288(0xc)](_0x167df9[_0x5288(0x2ac)],_0x3e8f43),!![];}else _0x27a82b=_0x2b600b['serverAuthCode'],_0x3716ac[_0x5288(0xc)](_0x5288(0x1ed)),_0x3310d0[_0x5288(0xc)](_0x167df9[_0x5288(0x2ad)],_0x84fd0e[_0x5288(0xe)](0x0,0x14)+_0x5288(0xf));}else{const _0x1a624a=await _0x57bf5b[_0x5288(0x4b)]();return console[_0x5288(0x43)](_0x167df9['gCYgM'],_0x57bf5b[_0x5288(0x4e)],_0x1a624a),![];}}catch(_0x644c20){return _0x167df9[_0x5288(0x2ae)](_0x167df9[_0x5288(0x2af)],_0x167df9[_0x5288(0x2af)])?(_0x397808[_0x5288(0x43)](_0x167df9[_0x5288(0x2a2)]),![]):(console['error'](_0x167df9[_0x5288(0x2b0)],_0x644c20),![]);}};const triggerTrainingRestart=async(_0x35303e,_0x402fcd)=>{const _0x362f43={'OFrKS':_0x5288(0xd1),'JmTSH':function(_0x5eda36,_0x52c3c4){return _0x5eda36===_0x52c3c4;},'amLZG':_0x5288(0xd4),'HfTWw':'โŒ\x20Google\x20Play\x20Services\x20not\x20available','iDiVv':_0x5288(0x2b1),'wtcdl':_0x5288(0x64),'FLycs':'\x20\x20\x202.\x20API\x20server\x20(API\x20server)\x20is\x20unreachable','xfOwl':_0x5288(0x2b2),'kDLGP':_0x5288(0x63),'fnGMd':_0x5288(0x65),'JpBnF':function(_0x27adc4,_0x5053f7,_0x269e82){return _0x27adc4(_0x5053f7,_0x269e82);},'rqAdT':_0x5288(0x2b3),'QHHoQ':function(_0x1085db,_0x53ac28){return _0x1085db!==_0x53ac28;},'UXuiG':_0x5288(0x2b4),'VHJGv':function(_0x43d910,_0x4291e0){return _0x43d910===_0x4291e0;},'jkKGE':'Txppb','aBEBj':function(_0x393451,_0x5f3d21){return _0x393451!==_0x5f3d21;},'tUyzR':_0x5288(0x2b5),'NNIEy':_0x5288(0x2b6)};try{console[_0x5288(0xc)]('๐Ÿ”„\x20[TRAINING\x20RESTART]\x20Triggering\x20training\x20restart\x20for\x20user:',_0x35303e);const _0x2abcea=await _0x362f43['JpBnF'](fetch,API_CONFIG['BASE_URL']+'/mobile-training/restart',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x402fcd},'body':JSON['stringify']({'username':_0x35303e,'reason':_0x362f43[_0x5288(0x2b7)],'platform':_0x5288(0xc0),'timestamp':new Date()['toISOString'](),'requestNewTraining':!![]})});if(_0x2abcea['ok']){if(_0x362f43[_0x5288(0x2b8)](_0x362f43[_0x5288(0x2b9)],_0x362f43[_0x5288(0x2b9)])){_0x1f65b4['error'](_0x362f43[_0x5288(0x2ba)],_0x5479f3);if(_0x362f43[_0x5288(0x2bb)](_0x293e90[_0x5288(0x1a)],_0x161814['SIGN_IN_CANCELLED']))_0x208fe6[_0x5288(0x43)](_0x362f43['amLZG']),_0x4cb873[_0x5288(0x43)](_0x5288(0xd5));else{if(_0x33535d[_0x5288(0x1a)]===_0x16d1eb['IN_PROGRESS'])_0x5df81a[_0x5288(0x43)](_0x5288(0x8a));else _0x2bf306[_0x5288(0x1a)]===_0x1dee03[_0x5288(0x284)]&&_0x49184a[_0x5288(0x43)](_0x362f43[_0x5288(0x2bc)]);}return![];}else{const _0x555746=await _0x2abcea[_0x5288(0x82)]();console['log']('โœ…\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20successful:',_0x555746);}}else{if(_0x362f43[_0x5288(0x2bd)](_0x5288(0x2be),_0x362f43[_0x5288(0x2bf)]))return{'success':![],'error':_0x1029c9[_0x5288(0x42)]||'Invalid\x20verification\x20code'};else{const _0x5de620=await _0x2abcea[_0x5288(0x4b)]();console[_0x5288(0x43)](_0x5288(0x2c0),_0x2abcea[_0x5288(0x4e)],_0x5de620);throw new Error(_0x5288(0x2c1)+_0x2abcea[_0x5288(0x4e)]);}}}catch(_0x28189b){if(_0x362f43['aBEBj'](_0x362f43['tUyzR'],_0x5288(0x2c2))){console[_0x5288(0x43)](_0x362f43[_0x5288(0x2c3)],_0x28189b);throw _0x28189b;}else{const _0x22a2f3=_0x362f43['iDiVv'][_0x5288(0x127)]('|');let _0x4c6d6b=0x0;while(!![]){switch(_0x22a2f3[_0x4c6d6b++]){case'0':_0x7c50db[_0x5288(0x43)](_0x362f43[_0x5288(0x2c4)]);continue;case'1':_0x464587['error'](_0x362f43[_0x5288(0x2c5)]);continue;case'2':_0x3646c4[_0x5288(0x43)](_0x362f43['xfOwl']);continue;case'3':_0x5f096e[_0x5288(0x43)](_0x362f43[_0x5288(0x2c6)]);continue;case'4':_0x51c713[_0x5288(0x43)](_0x362f43[_0x5288(0x2c7)]);continue;case'5':_0x3d4d99[_0x5288(0x43)](_0x5288(0x8f)+_0x31ebb4+'.\x20Possible\x20causes:');continue;}break;}}}};export const testYouTubeRefreshToken=async _0x3b817f=>{const _0x3b9504={'GGdLk':_0x5288(0x207),'eGFpm':_0x5288(0x2c8),'TDWbx':_0x5288(0xa2),'LQqRv':function(_0x150d02){return _0x150d02();},'VPUFo':_0x5288(0x2c9),'PaHBr':_0x5288(0x2ca),'uAIEJ':_0x5288(0x2cb),'YawRA':_0x5288(0x2cc),'FpxHA':function(_0x246f17,_0x563833){return _0x246f17(_0x563833);},'YyjOm':_0x5288(0x2cd),'SEsOs':_0x5288(0x1e3),'PGpEU':function(_0x2b81e1,_0x5333d3){return _0x2b81e1!==_0x5333d3;},'UkQkZ':'JzWBB','uBQaf':_0x5288(0x2ce),'niKzt':_0x5288(0x2d)};console[_0x5288(0xc)](_0x3b9504[_0x5288(0x2cf)]),console['log'](_0x3b9504['TDWbx'],_0x3b817f);try{const _0x1827c2=await _0x3b9504[_0x5288(0x2d0)](debugYouTubeTokens);console[_0x5288(0xc)](_0x3b9504[_0x5288(0x2d1)],_0x1827c2);if(!_0x1827c2[_0x5288(0x15a)]){if(_0x3b9504[_0x5288(0x2d2)]!==_0x3b9504[_0x5288(0x2d3)]){console[_0x5288(0xc)](_0x3b9504[_0x5288(0x2d4)]);const _0x58b631=await _0x3b9504[_0x5288(0x2d5)](fixUserYouTubeConnection,_0x3b817f);if(_0x58b631){console[_0x5288(0xc)](_0x5288(0x2d6));const _0x2aae64=await _0x3b9504[_0x5288(0x2d0)](debugYouTubeTokens);console[_0x5288(0xc)](_0x3b9504[_0x5288(0x2d7)],_0x2aae64);}else console[_0x5288(0x43)](_0x3b9504[_0x5288(0x2d8)]);}else return _0x119744[_0x5288(0x43)](_0x5288(0x1dc)),![];}else _0x3b9504[_0x5288(0x2d9)](_0x3b9504[_0x5288(0x2da)],_0x3b9504[_0x5288(0x2db)])?console[_0x5288(0xc)](_0x3b9504['niKzt']):(_0x2c9b0c[_0x5288(0xc)]('โœ…\x20[YOUTUBE\x20AUTH]\x20Backend\x20confirmed\x20refresh\x20token\x20received'),_0x3c2c06['log'](_0x3b9504[_0x5288(0x2dc)]));}catch(_0x2c8940){console[_0x5288(0x43)](_0x5288(0x2dd),_0x2c8940);}};export const requestEmailVerification=async(_0x5d0f5e,_0x20fe74=![])=>{const _0x537e49={'ZUHNI':function(_0x38273b,_0x303c99){return _0x38273b===_0x303c99;},'mdFSQ':function(_0x1a1cfd,_0x509507){return _0x1a1cfd===_0x509507;},'SdMzp':_0x5288(0x19),'nyegm':_0x5288(0x95),'uRXAD':_0x5288(0x6b),'jkZQi':_0x5288(0x2de),'VNHwj':_0x5288(0x2df),'NZnnS':function(_0x218f4a,_0x2f160d,_0x292d7e){return _0x218f4a(_0x2f160d,_0x292d7e);},'LQUKt':function(_0x484588){return _0x484588();},'kShXU':_0x5288(0x2e0),'LpAfI':_0x5288(0x2e1),'vZYux':_0x5288(0x2e2),'PNJXs':_0x5288(0x2e3),'kpHWG':_0x5288(0x2e4),'NIFVz':function(_0x4b5ee1,_0x4a4922){return _0x4b5ee1===_0x4a4922;},'YnuGp':_0x5288(0x2e5),'KWbpD':_0x5288(0x2e6)};try{if(_0x537e49[_0x5288(0x2e7)]===_0x537e49[_0x5288(0x2e7)]){console[_0x5288(0xc)](_0x537e49[_0x5288(0x2e8)],_0x5d0f5e);const _0x249824=await _0x537e49[_0x5288(0x2e9)](fetch,API_CONFIG[_0x5288(0x20)]+_0x5288(0x2ea),{'method':'POST','headers':_0x537e49[_0x5288(0x2eb)](getDeveloperAuthHeaders),'body':JSON['stringify']({'email':_0x5d0f5e,'action':_0x537e49[_0x5288(0x2ec)],'testMode':_0x20fe74})}),_0x44f275=await _0x249824['json']();if(_0x249824['ok']){if(_0x537e49[_0x5288(0x2ed)]===_0x537e49[_0x5288(0x2ee)]){var _0x7a42a;return(_0x537e49[_0x5288(0x2ef)](_0x7a42a=_0x581719[_0x116903],null)||_0x537e49[_0x5288(0x2f0)](_0x7a42a,void 0x0)?void 0x0:_0x7a42a['hasNativeSDK'])||![];}else return{'success':!![],'message':_0x44f275[_0x5288(0x42)]||_0x537e49['PNJXs']};}else return{'success':![],'error':_0x44f275[_0x5288(0x42)]||_0x537e49[_0x5288(0x2f1)]};}else _0x468bbf[_0x5288(0xc)](_0x5288(0x215),_0x52dd23);}catch(_0x4742a){if(_0x537e49[_0x5288(0x2f2)](_0x537e49[_0x5288(0x2f3)],_0x537e49['YnuGp']))return console[_0x5288(0x43)](_0x537e49[_0x5288(0x2f4)],_0x4742a),{'success':![],'error':'Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.'};else GoogleSignin[_0x5288(0xee)]({'webClientId':_0x19eb5a,'iosClientId':_0x418d31,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x537e49[_0x5288(0x2f5)],_0x5288(0xa8),_0x537e49[_0x5288(0x2f6)],_0x537e49[_0x5288(0x2f7)]],'hostedDomain':'','accountName':''});}};export const verifyEmailCode=async(_0x2d2b8b,_0x366e5a,_0x3eec30=![])=>{const _0x3fcee7={'YcueX':_0x5288(0x2f8),'hTyfp':_0x5288(0x20b),'jIkCa':function(_0x1e8b74,_0x5a9b24){return _0x1e8b74===_0x5a9b24;},'bChor':_0x5288(0x2f9),'nRwHe':_0x5288(0x20e),'ZAnLv':_0x5288(0x286),'PtRaX':_0x5288(0x28c),'iNQlL':function(_0x5cc23b,_0x37ea5d){return _0x5cc23b(_0x37ea5d);},'MGCBR':_0x5288(0x2fa),'FszlQ':_0x5288(0x2fb),'caZQg':function(_0x1bc6c6,_0x544cae,_0x1de71f){return _0x1bc6c6(_0x544cae,_0x1de71f);},'wXVHo':function(_0x247908,_0x16bfe5){return _0x247908===_0x16bfe5;},'IKYqX':_0x5288(0x2fc),'EUrwH':_0x5288(0x2fd),'TVBpM':_0x5288(0x2fe),'pQIzd':_0x5288(0x2ff),'jGVBI':_0x5288(0x275),'TSskm':'Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.'};try{if(_0x3fcee7[_0x5288(0x300)]!==_0x3fcee7[_0x5288(0x300)])return{'success':!![],'message':_0x158e3b['message']||_0x3fcee7[_0x5288(0x301)],'existingUser':_0xd7dc51['existingUser']||![],'token':_0x47d725[_0x5288(0x302)]};else{console[_0x5288(0xc)](_0x3fcee7[_0x5288(0x303)],_0x2d2b8b);const _0x39657b=await _0x3fcee7[_0x5288(0x304)](fetch,API_CONFIG[_0x5288(0x20)]+_0x5288(0x2ea),{'method':'POST','headers':getDeveloperAuthHeaders(),'body':JSON[_0x5288(0x7d)]({'email':_0x2d2b8b,'code':_0x366e5a,'action':_0x5288(0x305),'testMode':_0x3eec30})}),_0x38fbe3=await _0x39657b[_0x5288(0x82)]();if(_0x39657b['ok']){if(_0x3fcee7['wXVHo'](_0x3fcee7['IKYqX'],_0x5288(0x306)))_0x2120d3[_0x5288(0x43)](_0x5288(0x307)+_0x24ddc6+_0x5288(0x8b));else return{'success':!![],'message':_0x38fbe3[_0x5288(0x42)]||_0x5288(0x2f8),'existingUser':_0x38fbe3[_0x5288(0x308)]||![],'token':_0x38fbe3['token']};}else{if(_0x3fcee7[_0x5288(0x309)](_0x5288(0x2fd),_0x3fcee7[_0x5288(0x30a)]))return{'success':![],'error':_0x38fbe3[_0x5288(0x42)]||_0x3fcee7[_0x5288(0x30b)]};else{_0x4d519b[_0x5288(0x43)](_0x3fcee7[_0x5288(0x30c)],_0x47cd46);if(_0x3fcee7[_0x5288(0x309)](_0x3a5cf1['code'],_0x44f715[_0x5288(0x16e)]))_0x226a1a[_0x5288(0xc)](_0x3fcee7[_0x5288(0x30d)]);else{if(_0x3fcee7['jIkCa'](_0x4b37f4[_0x5288(0x1a)],_0x3ba1c5[_0x5288(0x173)]))_0xe19052[_0x5288(0xc)](_0x3fcee7[_0x5288(0x30e)]);else _0x59ecfe[_0x5288(0x1a)]===_0x4bc363[_0x5288(0x284)]&&_0x5b152e[_0x5288(0xc)](_0x3fcee7[_0x5288(0x30f)]);}return![];}}}}catch(_0x17ec3e){if(_0x3fcee7[_0x5288(0x310)]!==_0x3fcee7[_0x5288(0x310)])_0x524c55[_0x5288(0xc)](_0x3fcee7[_0x5288(0x311)]),_0x3fcee7[_0x5288(0x312)](_0x31f62e,!![]);else return console[_0x5288(0x43)](_0x3fcee7['jGVBI'],_0x17ec3e),{'success':![],'error':_0x3fcee7['TSskm']};}};export const checkEmailVerificationStatus=async(_0x469354,_0x177b6b=![])=>{const _0x318dd1={'gGWwP':function(_0x3cde0b,_0x2c1de3,_0x28f287){return _0x3cde0b(_0x2c1de3,_0x28f287);},'HsjtA':'โŒ\x20Error\x20checking\x20email\x20verification\x20status:'};try{const _0x2dd075=await _0x318dd1[_0x5288(0x313)](fetch,API_CONFIG['BASE_URL']+_0x5288(0x314),{'method':'POST','headers':getDeveloperAuthHeaders(),'body':JSON[_0x5288(0x7d)]({'email':_0x469354,'testMode':_0x177b6b})}),_0x5a234f=await _0x2dd075[_0x5288(0x82)]();return{'success':_0x2dd075['ok'],'isPending':_0x5a234f['isPending']||![],'message':_0x5a234f['message']};}catch(_0x10560a){return console[_0x5288(0x43)](_0x318dd1[_0x5288(0x315)],_0x10560a),{'success':![],'isPending':![],'error':_0x5288(0x316)};}};export const initializePlatformAuthService=()=>{const _0x45cb29={'ElbfW':'๐Ÿ”ง\x20Platform\x20auth\x20service\x20initialized','pDflv':function(_0x5a5022){return _0x5a5022();}};console[_0x5288(0xc)](_0x45cb29[_0x5288(0x317)]),_0x45cb29['pDflv'](initializeGoogleSignIn);};
1
+ /**
2
+ * Platform Authentication Service
3
+ * Handles OAuth flows for different platforms
4
+ */
5
+
6
+ import { Platform } from 'react-native';
7
+ import { GoogleSignin, statusCodes } from '@react-native-google-signin/google-signin';
8
+ import AsyncStorage from '@react-native-async-storage/async-storage';
9
+ import { API_CONFIG, getApiHeaders, getUserAuthHeaders } from '../config/api';
10
+ import { getApiConfig, isApiKeyInitialized } from './apiKeyService';
11
+ // CRITICAL FIX: Use static imports to avoid Hermes transpilation issues
12
+ import { getJWT } from './jwtStorageService';
13
+
14
+ /**
15
+ * Get developer API key authorization headers
16
+ * This ensures all auth requests include the developer's API key for backend validation
17
+ * @throws Error if SDK is not initialized with a valid API key
18
+ */
19
+ const getDeveloperAuthHeaders = () => {
20
+ if (!isApiKeyInitialized()) {
21
+ throw new Error('SDK not initialized. Developers must call initializeApiKey() before using auth features.');
22
+ }
23
+ const config = getApiConfig();
24
+ if (!(config !== null && config !== void 0 && config.apiKey)) {
25
+ throw new Error('No API key configured. Please initialize the SDK with a valid developer API key.');
26
+ }
27
+ return {
28
+ ...getApiHeaders(),
29
+ 'Authorization': `Bearer ${config.apiKey}`,
30
+ 'X-SDK-Version': '3.0.72',
31
+ 'X-SDK-Platform': 'react-native'
32
+ };
33
+ };
34
+
35
+ // ๐Ÿ”‘ CRITICAL: Using the same client ID for both web and iOS to avoid audience errors
36
+ const WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
37
+ const IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
38
+ // OAuth configuration for different platforms
39
+ const OAUTH_CONFIG = {
40
+ instagram: {
41
+ authUrl: 'https://api.instagram.com/oauth/authorize',
42
+ clientId: 'demo_instagram_client_id',
43
+ redirectUri: 'onairosevents://auth/callback',
44
+ scope: 'user_profile,user_media',
45
+ responseType: 'code',
46
+ hasNativeSDK: false
47
+ },
48
+ youtube: {
49
+ authUrl: `${API_CONFIG.BASE_URL}/youtube/authorize`,
50
+ clientId: '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com',
51
+ redirectUri: 'onairosevents://auth/callback',
52
+ scope: 'https://www.googleapis.com/auth/youtube.readonly',
53
+ responseType: 'code',
54
+ hasNativeSDK: true // Changed to true for native SDK
55
+ },
56
+ reddit: {
57
+ authUrl: `${API_CONFIG.BASE_URL}/reddit/authorize`,
58
+ clientId: 'demo_reddit_client_id',
59
+ redirectUri: 'onairosevents://auth/callback',
60
+ scope: 'identity,read',
61
+ responseType: 'code',
62
+ hasNativeSDK: false
63
+ },
64
+ pinterest: {
65
+ authUrl: `${API_CONFIG.BASE_URL}/pinterest/authorize`,
66
+ clientId: 'demo_pinterest_client_id',
67
+ redirectUri: 'onairosevents://auth/callback',
68
+ scope: 'boards:read,pins:read',
69
+ responseType: 'code',
70
+ hasNativeSDK: false
71
+ },
72
+ facebook: {
73
+ authUrl: 'https://www.facebook.com/v12.0/dialog/oauth',
74
+ clientId: 'demo_facebook_client_id',
75
+ redirectUri: 'onairosevents://auth/callback',
76
+ scope: 'public_profile,email',
77
+ responseType: 'code',
78
+ hasNativeSDK: false
79
+ },
80
+ // GitHub connector is temporarily commented out
81
+ // github: {
82
+ // authUrl: 'https://github.com/login/oauth/authorize',
83
+ // clientId: 'demo_github_client_id',
84
+ // redirectUri: 'onairosevents://auth/callback',
85
+ // scope: 'repo,user',
86
+ // responseType: 'code',
87
+ // hasNativeSDK: false
88
+ // },
89
+ linkedin: {
90
+ authUrl: `${API_CONFIG.BASE_URL}/linkedin/authorize`,
91
+ clientId: '',
92
+ // No client ID needed - backend handles OAuth
93
+ redirectUri: 'onairosevents://auth/callback',
94
+ scope: 'openid profile email',
95
+ // Updated to OpenID Connect scopes as per your backend
96
+ responseType: 'code',
97
+ hasNativeSDK: false // LinkedIn has no modern native SDK
98
+ },
99
+ gmail: {
100
+ authUrl: `${API_CONFIG.BASE_URL}/gmail/authorize`,
101
+ clientId: 'demo_gmail_client_id',
102
+ redirectUri: 'onairosevents://auth/callback',
103
+ scope: 'https://www.googleapis.com/auth/gmail.readonly',
104
+ responseType: 'code',
105
+ hasNativeSDK: false
106
+ },
107
+ email: {
108
+ // Email doesn't use OAuth but we still need to handle it in the flow
109
+ hasNativeSDK: false,
110
+ authUrl: `${API_CONFIG.BASE_URL}/email/authorize` // Proxy endpoint for email verification
111
+ },
112
+ // LLM Platforms - use direct login URLs (WebView handles extraction)
113
+ // These platforms use WebView-based login + JavaScript injection for data export
114
+ chatgpt: {
115
+ authUrl: 'https://chat.openai.com',
116
+ // Direct login URL - WebView injects export scripts
117
+ clientId: '',
118
+ redirectUri: '',
119
+ scope: '',
120
+ responseType: '',
121
+ hasNativeSDK: false
122
+ },
123
+ claude: {
124
+ authUrl: 'https://claude.ai/login',
125
+ // Direct login URL - WebView injects export scripts
126
+ clientId: '',
127
+ redirectUri: '',
128
+ scope: '',
129
+ responseType: '',
130
+ hasNativeSDK: false
131
+ },
132
+ gemini: {
133
+ authUrl: 'https://gemini.google.com',
134
+ // Direct login URL - WebView injects export scripts
135
+ clientId: '',
136
+ redirectUri: '',
137
+ scope: '',
138
+ responseType: '',
139
+ hasNativeSDK: false
140
+ },
141
+ grok: {
142
+ authUrl: 'https://x.com/i/grok',
143
+ // Direct login URL (via X) - WebView injects export scripts
144
+ clientId: '',
145
+ redirectUri: '',
146
+ scope: '',
147
+ responseType: '',
148
+ hasNativeSDK: false
149
+ },
150
+ // ============================================================
151
+ // NEW PLATFORMS - WebView-based extraction
152
+ // API endpoints are PLACEHOLDERS - fill in once known
153
+ // ============================================================
154
+ hinge: {
155
+ authUrl: 'https://hinge.co',
156
+ // PLACEHOLDER - may need mobile web URL
157
+ clientId: '',
158
+ redirectUri: '',
159
+ scope: '',
160
+ responseType: '',
161
+ hasNativeSDK: false
162
+ },
163
+ // Instagram WebView extraction (different from OAuth Instagram)
164
+ instagram_webview: {
165
+ authUrl: 'https://www.instagram.com',
166
+ // Direct login - WebView injects export scripts
167
+ clientId: '',
168
+ redirectUri: '',
169
+ scope: '',
170
+ responseType: '',
171
+ hasNativeSDK: false
172
+ },
173
+ sephora: {
174
+ authUrl: 'https://www.sephora.com',
175
+ // Direct login - WebView injects export scripts
176
+ clientId: '',
177
+ redirectUri: '',
178
+ scope: '',
179
+ responseType: '',
180
+ hasNativeSDK: false
181
+ },
182
+ // ============================================================
183
+ // TELEGRAM - MTProto API WebView-based extraction
184
+ // Uses web.telegram.org/k/ for login, extracts via IndexedDB
185
+ //
186
+ // MTProto API methods used:
187
+ // - messages.getDialogs: Get user's chat list
188
+ // - messages.getHistory: Get messages from a chat
189
+ //
190
+ // Backend should use Telethon/Pyrogram/TDLib for full API access
191
+ // @see https://core.telegram.org/api
192
+ // ============================================================
193
+ telegram: {
194
+ authUrl: 'https://web.telegram.org/k/',
195
+ // Telegram Web K - WebView injects export scripts
196
+ clientId: '',
197
+ // Not used - MTProto uses api_id/api_hash
198
+ redirectUri: '',
199
+ scope: '',
200
+ responseType: '',
201
+ hasNativeSDK: false
202
+ }
203
+ };
204
+
205
+ /**
206
+ * Check if the platform has a native SDK
207
+ */
208
+ export const hasNativeSDK = platform => {
209
+ var _OAUTH_CONFIG$platfor;
210
+ return ((_OAUTH_CONFIG$platfor = OAUTH_CONFIG[platform]) === null || _OAUTH_CONFIG$platfor === void 0 ? void 0 : _OAUTH_CONFIG$platfor.hasNativeSDK) || false;
211
+ };
212
+
213
+ /**
214
+ * Test API connectivity before making OAuth requests
215
+ */
216
+ export const testApiConnectivity = async () => {
217
+ const results = {
218
+ googleTest: null,
219
+ api2Test: null
220
+ };
221
+ try {
222
+ var _results$api2Test, _results$googleTest;
223
+ console.log('๐Ÿ”Œ [CONNECTIVITY] Running comprehensive network diagnostics...');
224
+
225
+ // Test 1: Can we reach Google? (known good endpoint)
226
+ console.log('๐ŸŒ [CONNECTIVITY] Test 1: Checking general internet (google.com)...');
227
+ try {
228
+ const googleResponse = await fetch('https://www.google.com', {
229
+ method: 'HEAD',
230
+ // @ts-ignore - mode not always available in React Native
231
+ mode: 'no-cors'
232
+ });
233
+ results.googleTest = {
234
+ success: true,
235
+ status: 'reachable'
236
+ };
237
+ console.log('โœ… [CONNECTIVITY] Google is reachable - internet is working');
238
+ } catch (googleError) {
239
+ results.googleTest = {
240
+ success: false,
241
+ error: googleError.message
242
+ };
243
+ console.error('โŒ [CONNECTIVITY] Cannot reach Google - internet may be down:', googleError.message);
244
+ }
245
+
246
+ // Test 2: Can we reach API server?
247
+ console.log('๐ŸŒ [CONNECTIVITY] Test 2: Checking API server...');
248
+ try {
249
+ const controller = new AbortController();
250
+ const timeoutId = setTimeout(() => controller.abort(), 30000); // Increased to 30s for simulator
251
+
252
+ const response = await fetch(`${API_CONFIG.BASE_URL}/health`, {
253
+ method: 'GET',
254
+ signal: controller.signal
255
+ });
256
+ clearTimeout(timeoutId);
257
+ const responseText = await response.text().catch(() => 'Unable to read response');
258
+ results.api2Test = {
259
+ success: response.ok,
260
+ status: response.status,
261
+ statusText: response.statusText,
262
+ response: responseText.substring(0, 200) // First 200 chars
263
+ };
264
+ if (response.ok) {
265
+ console.log('โœ… [CONNECTIVITY] API server is reachable');
266
+ } else {
267
+ console.log(`โš ๏ธ [CONNECTIVITY] API server responded with status: ${response.status}`);
268
+ }
269
+ } catch (apiError) {
270
+ results.api2Test = {
271
+ success: false,
272
+ error: apiError.message,
273
+ name: apiError.name
274
+ };
275
+ console.error('โŒ [CONNECTIVITY] Cannot reach API server:', apiError.message);
276
+ }
277
+
278
+ // Determine overall result
279
+ if ((_results$api2Test = results.api2Test) !== null && _results$api2Test !== void 0 && _results$api2Test.success) {
280
+ return {
281
+ success: true,
282
+ message: 'API is reachable',
283
+ details: results
284
+ };
285
+ } else if ((_results$googleTest = results.googleTest) !== null && _results$googleTest !== void 0 && _results$googleTest.success) {
286
+ return {
287
+ success: false,
288
+ message: 'Internet works but API server is unreachable. The server may be blocking requests from this device/simulator.',
289
+ details: results
290
+ };
291
+ } else {
292
+ return {
293
+ success: false,
294
+ message: 'No internet connectivity detected. Check your network connection.',
295
+ details: results
296
+ };
297
+ }
298
+ } catch (error) {
299
+ console.error('โŒ [CONNECTIVITY] Connectivity test failed:', error.message);
300
+ return {
301
+ success: false,
302
+ message: `Network error: ${error.message}`,
303
+ details: {
304
+ error: error.message,
305
+ results
306
+ }
307
+ };
308
+ }
309
+ };
310
+
311
+ /**
312
+ * Initiate OAuth flow for a platform
313
+ * Uses User JWT for authentication (TIER 2)
314
+ */
315
+ export const initiateOAuth = async (platform, _username) => {
316
+ try {
317
+ console.log(`๐Ÿš€ [OAUTH] Starting OAuth for platform: ${platform}`);
318
+ console.log(`๐Ÿ“ฑ [OAUTH] Platform: ${Platform.OS}, Version: ${Platform.Version}`);
319
+
320
+ // For platforms that don't need OAuth (like email), handle differently
321
+ if (platform === 'email') {
322
+ console.log('๐Ÿ“ง [OAUTH] Email platform selected, returning mock auth URL');
323
+ return `${API_CONFIG.BASE_URL}/email/authorize?action=verify`;
324
+ }
325
+
326
+ // Get user JWT headers - user must be authenticated
327
+ let authHeaders;
328
+ try {
329
+ authHeaders = await getUserAuthHeaders();
330
+ console.log(`๐Ÿ”‘ [OAUTH] Using User JWT for authentication`);
331
+ } catch (authError) {
332
+ console.error(`โŒ [OAUTH] User not authenticated - cannot initiate ${platform} OAuth`);
333
+ console.error(`โŒ [OAUTH] Please log in first before connecting platforms`);
334
+ return null;
335
+ }
336
+
337
+ // Construct the proxy URL
338
+ const proxyUrl = `${API_CONFIG.BASE_URL}/${platform}/authorize`;
339
+ console.log(`๐ŸŒ [OAUTH] Proxy URL: ${proxyUrl}`);
340
+ console.log(`๐Ÿ”— [OAUTH] About to make fetch request...`);
341
+
342
+ // Request body - no username needed, backend extracts from JWT
343
+ const requestBody = {
344
+ platform: platform,
345
+ timestamp: new Date().toISOString()
346
+ };
347
+ console.log(`๐Ÿ“ค [OAUTH] Request body:`, requestBody);
348
+
349
+ // Add timeout to prevent hanging requests
350
+ const controller = new AbortController();
351
+ const timeoutId = setTimeout(() => {
352
+ console.log(`โฐ [OAUTH] Request timeout for ${platform} - aborting`);
353
+ controller.abort();
354
+ }, 30000); // 30 second timeout for simulator compatibility
355
+
356
+ // Make a POST request to the proxy
357
+ // ๐Ÿ”’ SECURITY: Uses User JWT - backend extracts username from token
358
+ const response = await fetch(proxyUrl, {
359
+ method: 'POST',
360
+ headers: authHeaders,
361
+ body: JSON.stringify(requestBody),
362
+ signal: controller.signal
363
+ });
364
+ clearTimeout(timeoutId);
365
+ console.log(`๐Ÿ“ก [OAUTH] Response status: ${response.status} ${response.statusText}`);
366
+ if (!response.ok) {
367
+ const errorText = await response.text();
368
+ console.error(`โŒ [OAUTH] Error initiating OAuth for ${platform}: ${response.status} - ${errorText}`);
369
+ return null;
370
+ }
371
+ const data = await response.json();
372
+ console.log(`๐Ÿ“‹ [OAUTH] Response data for ${platform}:`, data);
373
+
374
+ // Get the authorization URL from the response
375
+ // Different platforms might use different keys (e.g., pinterestURL, youtubeURL)
376
+ const urlKey = `${platform}URL`;
377
+ const authUrl = data[urlKey] || data.url || null;
378
+ console.log(`๐Ÿ”— [OAUTH] Auth URL for ${platform} (key: ${urlKey}):`, authUrl);
379
+ return authUrl;
380
+ } catch (error) {
381
+ var _error$message;
382
+ // Enhanced error logging
383
+ if (error.name === 'AbortError') {
384
+ console.error(`โŒ [OAUTH] Request timeout for ${platform} - the server took too long to respond`);
385
+ } else if ((_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('Network request failed')) {
386
+ console.error(`โŒ [OAUTH] Network request failed for ${platform}. Possible causes:`);
387
+ console.error(' 1. No internet connection on device/simulator');
388
+ console.error(' 2. API server (API server) is unreachable');
389
+ console.error(' 3. DNS resolution failed');
390
+ console.error(' 4. SSL/TLS certificate issue');
391
+ console.error(' 5. iOS simulator network sandbox issue - try on physical device');
392
+ } else {
393
+ console.error(`โŒ [OAUTH] Error initiating OAuth for ${platform}:`, error);
394
+ }
395
+ return null;
396
+ }
397
+ };
398
+
399
+ /**
400
+ * Initialize Google Sign-In configuration with enhanced refresh token support
401
+ * Updated with CRITICAL parameters for refresh token generation
402
+ */
403
+ const initializeGoogleSignIn = () => {
404
+ GoogleSignin.configure({
405
+ webClientId: WEB_CLIENT_ID,
406
+ // โœ… CRITICAL: Web client ID for refresh tokens
407
+ iosClientId: IOS_CLIENT_ID,
408
+ // โœ… iOS client ID for native auth
409
+
410
+ // ๐Ÿ”‘ CRITICAL: These parameters are REQUIRED for refresh tokens
411
+ offlineAccess: true,
412
+ // โ† CRITICAL: Enables refresh tokens
413
+ forceCodeForRefreshToken: true,
414
+ // โ† CRITICAL: Forces refresh token generation
415
+
416
+ // โœ… Enhanced scopes for YouTube
417
+ scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
418
+ // โœ… Clear settings to avoid conflicts
419
+ hostedDomain: '',
420
+ accountName: ''
421
+ });
422
+ };
423
+
424
+ /**
425
+ * Force YouTube reconnection with consent screen to get refresh tokens
426
+ * This is the key function to fix YouTube token expiry issues
427
+ */
428
+ export const forceYouTubeReconnectionWithConsent = async username => {
429
+ try {
430
+ var _userInfo$data, _userInfo$data2, _userInfo$data3;
431
+ console.log('๐Ÿ”„ FORCING fresh YouTube consent for refresh token...');
432
+ console.log('๐Ÿ‘ค User:', username);
433
+
434
+ // Step 1: โœ… CRITICAL: Complete sign out (clears all cached consent)
435
+ try {
436
+ await GoogleSignin.signOut();
437
+ console.log('โœ… Signed out - consent cache cleared');
438
+ } catch (signOutError) {
439
+ console.log('โ„น๏ธ Sign out not needed:', signOutError);
440
+ }
441
+
442
+ // Step 2: โœ… CRITICAL: Clear cached tokens if available
443
+ try {
444
+ const existingTokens = await GoogleSignin.getTokens();
445
+ if (existingTokens.accessToken) {
446
+ await GoogleSignin.clearCachedAccessToken(existingTokens.accessToken);
447
+ console.log('โœ… Token cache cleared');
448
+ }
449
+ } catch (clearError) {
450
+ console.log('โ„น๏ธ No token cache to clear');
451
+ }
452
+
453
+ // Step 3: โœ… CRITICAL: Configure Google Sign-In for FORCED consent
454
+ console.log('๐Ÿ”ง Configuring Google Sign-In for forced consent...');
455
+ GoogleSignin.configure({
456
+ webClientId: WEB_CLIENT_ID,
457
+ // โœ… CRITICAL: Web client ID for refresh tokens
458
+ iosClientId: IOS_CLIENT_ID,
459
+ // โœ… iOS client ID for native auth
460
+
461
+ // ๐Ÿ”‘ FORCE REFRESH TOKEN SETTINGS:
462
+ offlineAccess: true,
463
+ // Request offline access
464
+ forceCodeForRefreshToken: true,
465
+ // Force refresh token generation
466
+
467
+ // ๐Ÿ”‘ FORCE CONSENT SCREEN:
468
+ scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
469
+ // โœ… CRITICAL: Clear settings to force fresh consent
470
+ hostedDomain: '',
471
+ accountName: ''
472
+ });
473
+
474
+ // Step 4: โœ… Check Play Services
475
+ await GoogleSignin.hasPlayServices();
476
+ console.log('โœ… Play Services available');
477
+
478
+ // Step 5: โœ… CRITICAL: Sign in (this SHOULD show consent screen)
479
+ console.log('๐Ÿ” Initiating sign-in - consent screen should appear...');
480
+ console.log('๐Ÿ“ฑ User should see: "Allow [App] to access your YouTube account when you\'re not using the app?"');
481
+ const userInfo = await GoogleSignin.signIn();
482
+ console.log('โœ… Sign-in completed - checking for refresh token...');
483
+ console.log('๐Ÿ‘ค User email:', (_userInfo$data = userInfo.data) === null || _userInfo$data === void 0 || (_userInfo$data = _userInfo$data.user) === null || _userInfo$data === void 0 ? void 0 : _userInfo$data.email);
484
+
485
+ // Step 6: โœ… Get tokens after consent
486
+ const tokens = await GoogleSignin.getTokens();
487
+ const currentUser = await GoogleSignin.getCurrentUser();
488
+ console.log('๐Ÿ“‹ FULL userInfo object from forceYouTubeReconnectionWithConsent:');
489
+ console.log(JSON.stringify(userInfo, null, 2));
490
+ console.log('๐Ÿ“‹ FULL tokens object from forceYouTubeReconnectionWithConsent:');
491
+ console.log(JSON.stringify(tokens, null, 2));
492
+ console.log('๐Ÿ“‹ FULL currentUser object from forceYouTubeReconnectionWithConsent:');
493
+ console.log(JSON.stringify(currentUser, null, 2));
494
+ console.log('๐Ÿ” Token analysis:');
495
+ console.log('- Access token:', tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing');
496
+ console.log('- ID token:', tokens.idToken ? 'Present' : 'Missing');
497
+ console.log('- ServerAuthCode (userInfo):', (_userInfo$data2 = userInfo.data) !== null && _userInfo$data2 !== void 0 && _userInfo$data2.serverAuthCode ? `${userInfo.data.serverAuthCode.substring(0, 20)}...` : 'Missing');
498
+ console.log('- ServerAuthCode (currentUser):', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
499
+
500
+ // Step 7: โœ… Extract refresh capability
501
+ const refreshToken = ((_userInfo$data3 = userInfo.data) === null || _userInfo$data3 === void 0 ? void 0 : _userInfo$data3.serverAuthCode) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serverAuthCode);
502
+ if (refreshToken) {
503
+ var _userInfo$data0, _userInfo$data1, _userInfo$data10, _userInfo$data11, _userInfo$data12, _userInfo$data13;
504
+ console.log('โœ… SUCCESS: Got refresh token after consent!');
505
+ console.log('๐Ÿ”‘ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
506
+ console.log('๐Ÿ”‘ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
507
+
508
+ // Step 8: โœ… Get YouTube channel info
509
+ let channelName = 'Unknown Channel';
510
+ let channelId = null;
511
+ try {
512
+ console.log('๐Ÿ“บ Fetching YouTube channel information...');
513
+ const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
514
+ headers: {
515
+ 'Authorization': `Bearer ${tokens.accessToken}`,
516
+ 'Accept': 'application/json'
517
+ }
518
+ });
519
+ if (channelResponse.ok) {
520
+ const channelData = await channelResponse.json();
521
+ if (channelData.items && channelData.items.length > 0) {
522
+ channelName = channelData.items[0].snippet.title;
523
+ channelId = channelData.items[0].id;
524
+ console.log('โœ… YouTube channel found:', channelName, 'ID:', channelId);
525
+ } else {
526
+ var _userInfo$data4, _userInfo$data5;
527
+ console.log('โš ๏ธ No YouTube channel found for user');
528
+ channelName = ((_userInfo$data4 = userInfo.data) === null || _userInfo$data4 === void 0 || (_userInfo$data4 = _userInfo$data4.user) === null || _userInfo$data4 === void 0 ? void 0 : _userInfo$data4.name) || ((_userInfo$data5 = userInfo.data) === null || _userInfo$data5 === void 0 || (_userInfo$data5 = _userInfo$data5.user) === null || _userInfo$data5 === void 0 ? void 0 : _userInfo$data5.email) || 'No Channel';
529
+ }
530
+ } else {
531
+ var _userInfo$data6, _userInfo$data7;
532
+ console.log('โš ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
533
+ channelName = ((_userInfo$data6 = userInfo.data) === null || _userInfo$data6 === void 0 || (_userInfo$data6 = _userInfo$data6.user) === null || _userInfo$data6 === void 0 ? void 0 : _userInfo$data6.name) || ((_userInfo$data7 = userInfo.data) === null || _userInfo$data7 === void 0 || (_userInfo$data7 = _userInfo$data7.user) === null || _userInfo$data7 === void 0 ? void 0 : _userInfo$data7.email) || 'Unknown Channel';
534
+ }
535
+ } catch (channelError) {
536
+ var _userInfo$data8, _userInfo$data9;
537
+ console.log('โš ๏ธ Error fetching YouTube channel info:', channelError);
538
+ channelName = ((_userInfo$data8 = userInfo.data) === null || _userInfo$data8 === void 0 || (_userInfo$data8 = _userInfo$data8.user) === null || _userInfo$data8 === void 0 ? void 0 : _userInfo$data8.name) || ((_userInfo$data9 = userInfo.data) === null || _userInfo$data9 === void 0 || (_userInfo$data9 = _userInfo$data9.user) === null || _userInfo$data9 === void 0 ? void 0 : _userInfo$data9.email) || 'Unknown Channel';
539
+ }
540
+
541
+ // Step 9: โœ… Get authentication token using simplified JWT storage
542
+ let authToken = await getJWT();
543
+ if (!authToken || authToken.trim().length < 20) {
544
+ console.log('๐Ÿ” Creating authentication token for YouTube connection...');
545
+ // Create token logic here if needed
546
+ authToken = 'temp_token_for_youtube_connection';
547
+ }
548
+
549
+ // Step 10: โœ… Send comprehensive data to backend
550
+ const backendPayload = {
551
+ session: {
552
+ username: username,
553
+ platform: 'youtube',
554
+ timestamp: new Date().toISOString(),
555
+ channelName: channelName,
556
+ channelId: channelId,
557
+ forceConsent: true // Flag to indicate this was forced consent
558
+ },
559
+ googleUser: (_userInfo$data0 = userInfo.data) === null || _userInfo$data0 === void 0 ? void 0 : _userInfo$data0.user,
560
+ accessToken: tokens.accessToken,
561
+ idToken: tokens.idToken,
562
+ refreshToken: refreshToken,
563
+ // โœ… CRITICAL: The refresh token!
564
+ serverAuthCode: refreshToken,
565
+ // โœ… Same as refresh token
566
+
567
+ // โœ… CRITICAL: Additional compatibility fields for backend
568
+ refresh_token: refreshToken,
569
+ // Snake case version
570
+ server_auth_code: refreshToken,
571
+ // Snake case version
572
+ authCode: refreshToken,
573
+ // Alternative naming
574
+
575
+ userAccountInfo: {
576
+ username: username,
577
+ email: (_userInfo$data1 = userInfo.data) === null || _userInfo$data1 === void 0 || (_userInfo$data1 = _userInfo$data1.user) === null || _userInfo$data1 === void 0 ? void 0 : _userInfo$data1.email,
578
+ authToken: authToken,
579
+ channelName: channelName,
580
+ channelId: channelId,
581
+ userIdentifier: authToken ? `user-${authToken.substring(0, 10)}` : `youtube-${(_userInfo$data10 = userInfo.data) === null || _userInfo$data10 === void 0 || (_userInfo$data10 = _userInfo$data10.user) === null || _userInfo$data10 === void 0 ? void 0 : _userInfo$data10.email}`,
582
+ googleId: (_userInfo$data11 = userInfo.data) === null || _userInfo$data11 === void 0 || (_userInfo$data11 = _userInfo$data11.user) === null || _userInfo$data11 === void 0 ? void 0 : _userInfo$data11.id,
583
+ // โœ… CRITICAL: Also include refresh token in userAccountInfo
584
+ refreshToken: refreshToken,
585
+ serverAuthCode: refreshToken
586
+ },
587
+ tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
588
+ // 1 hour from now
589
+ requestRefreshToken: true,
590
+ debugInfo: {
591
+ hasRefreshToken: true,
592
+ refreshTokenType: refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken',
593
+ configuredForRefresh: true,
594
+ forcedConsent: true,
595
+ consentMethod: 'signOut_and_configure',
596
+ refreshTokenValue: refreshToken // Include actual value for debugging
597
+ }
598
+ };
599
+ console.log('๐Ÿ“ค Sending comprehensive payload with REFRESH TOKEN to backend:', {
600
+ hasAccessToken: !!backendPayload.accessToken,
601
+ hasRefreshToken: !!backendPayload.refreshToken,
602
+ hasServerAuthCode: !!backendPayload.serverAuthCode,
603
+ refreshTokenType: backendPayload.debugInfo.refreshTokenType,
604
+ userEmail: (_userInfo$data12 = userInfo.data) === null || _userInfo$data12 === void 0 || (_userInfo$data12 = _userInfo$data12.user) === null || _userInfo$data12 === void 0 ? void 0 : _userInfo$data12.email,
605
+ forcedConsent: true
606
+ });
607
+
608
+ // Step 11: โœ… Send to backend with ENHANCED LOGGING
609
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] ===== SENDING REAUTH SIGNAL TO BACKEND =====');
610
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] Endpoint: https://API server/youtube/native-auth');
611
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] Method: POST');
612
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] Headers:', {
613
+ 'Content-Type': 'application/json',
614
+ 'Authorization': authToken ? `${authToken.substring(0, 20)}...` : 'NO AUTH TOKEN'
615
+ });
616
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] Payload Summary:', {
617
+ hasAccessToken: !!backendPayload.accessToken,
618
+ hasRefreshToken: !!backendPayload.refreshToken,
619
+ hasServerAuthCode: !!backendPayload.serverAuthCode,
620
+ refreshTokenType: backendPayload.debugInfo.refreshTokenType,
621
+ userEmail: (_userInfo$data13 = userInfo.data) === null || _userInfo$data13 === void 0 || (_userInfo$data13 = _userInfo$data13.user) === null || _userInfo$data13 === void 0 ? void 0 : _userInfo$data13.email,
622
+ channelName: channelName,
623
+ forcedConsent: true,
624
+ requestRefreshToken: true
625
+ });
626
+ console.log('๐Ÿš€ [YOUTUBE REAUTH] FULL PAYLOAD:', JSON.stringify(backendPayload, null, 2));
627
+ const backendResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/native-auth`, {
628
+ method: 'POST',
629
+ headers: {
630
+ 'Content-Type': 'application/json',
631
+ ...(authToken && {
632
+ 'Authorization': authToken
633
+ })
634
+ },
635
+ body: JSON.stringify(backendPayload)
636
+ });
637
+ console.log('๐Ÿ“ก [YOUTUBE REAUTH] Response Status:', backendResponse.status);
638
+ console.log('๐Ÿ“ก [YOUTUBE REAUTH] Response Status Text:', backendResponse.statusText);
639
+ console.log('๐Ÿ“ก [YOUTUBE REAUTH] Response Headers:', backendResponse.headers);
640
+ if (backendResponse.ok) {
641
+ var _responseData$validat, _responseData$tempora;
642
+ const responseData = await backendResponse.json();
643
+ console.log('โœ… [YOUTUBE REAUTH] Backend Response SUCCESS:', JSON.stringify(responseData, null, 2));
644
+
645
+ // Enhanced verification with detailed logging and temporary mode detection (exact backend fields)
646
+ const isTemporaryMode = ((_responseData$validat = responseData.validation) === null || _responseData$validat === void 0 ? void 0 : _responseData$validat.isTemporaryMode) === true || ((_responseData$tempora = responseData.temporaryMode) === null || _responseData$tempora === void 0 ? void 0 : _responseData$tempora.enabled) === true || responseData.isTemporaryMode === true || responseData.message && responseData.message.includes('temporary access token mode');
647
+ if (isTemporaryMode) {
648
+ console.log('๐Ÿ”„ [YOUTUBE REAUTH] YouTube connected in temporary mode');
649
+ console.log('โœ… [YOUTUBE REAUTH] Training will work, but connection expires in ~1 hour');
650
+ console.log('๐ŸŽ‰ [YOUTUBE REAUTH] SUCCESS: Temporary YouTube connection established!');
651
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Connection Details:');
652
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Mode: Temporary (expires ~1 hour)');
653
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Training Ready: Yes');
654
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Refresh token sent:', refreshToken ? 'Yes' : 'No');
655
+ } else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
656
+ console.log('โœ… [YOUTUBE REAUTH] Backend CONFIRMED refresh token received');
657
+ console.log('โœ… [YOUTUBE REAUTH] Response hasRefreshToken:', responseData.hasRefreshToken);
658
+ console.log('๐ŸŽ‰ [YOUTUBE REAUTH] SUCCESS: Full YouTube connection with refresh tokens!');
659
+
660
+ // CRITICAL: Print the refresh token that was sent for debugging
661
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] REFRESH TOKEN SENT TO BACKEND:');
662
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Full refresh token:', refreshToken);
663
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
664
+ console.log('๐Ÿ”‘ [YOUTUBE REAUTH] Refresh token length:', refreshToken.length);
665
+ } else {
666
+ console.warn('โš ๏ธ [YOUTUBE REAUTH] Backend did NOT confirm refresh token reception');
667
+ console.warn('โš ๏ธ [YOUTUBE REAUTH] Response data:', responseData);
668
+ console.warn('โš ๏ธ [YOUTUBE REAUTH] Expected hasRefreshToken or refreshTokenReceived in response');
669
+ return false;
670
+ }
671
+
672
+ // CRITICAL: Signal training system to restart with new connection
673
+ console.log('๐Ÿ”„ [YOUTUBE REAUTH] Signaling training system to restart...');
674
+ try {
675
+ await triggerTrainingRestart(username, authToken);
676
+ console.log('โœ… [YOUTUBE REAUTH] Training restart signal sent successfully');
677
+ } catch (restartError) {
678
+ console.warn('โš ๏ธ [YOUTUBE REAUTH] Training restart signal failed:', restartError);
679
+ console.warn('โš ๏ธ [YOUTUBE REAUTH] User may need to manually restart training');
680
+ }
681
+ return true;
682
+ } else {
683
+ const errorData = await backendResponse.text();
684
+ console.error('โŒ [YOUTUBE REAUTH] Backend processing FAILED:', backendResponse.status, errorData);
685
+ console.error('โŒ [YOUTUBE REAUTH] This means the reauth signal was not processed');
686
+ return false;
687
+ }
688
+ } else {
689
+ console.error('โŒ CRITICAL: No refresh token even after consent screen');
690
+ console.error('โŒ This means consent screen did not appear or user denied permissions');
691
+ console.error('๐Ÿ’ก Solutions:');
692
+ console.error(' 1. Try the revoke method: forceYouTubeReconnectionWithRevoke()');
693
+ console.error(' 2. Check Google Console OAuth configuration');
694
+ console.error(' 3. Ensure user clicks "Allow" on consent screen');
695
+ return false;
696
+ }
697
+ } catch (error) {
698
+ console.error('โŒ Error forcing YouTube consent:', error);
699
+ if (error.code === statusCodes.SIGN_IN_CANCELLED) {
700
+ console.error('โŒ User cancelled sign-in - no refresh token obtained');
701
+ console.error('๐Ÿ’ก User must click "Allow" to get refresh token');
702
+ } else if (error.code === statusCodes.IN_PROGRESS) {
703
+ console.error('โŒ Sign-in already in progress');
704
+ } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
705
+ console.error('โŒ Google Play Services not available');
706
+ }
707
+ return false;
708
+ }
709
+ };
710
+
711
+ /**
712
+ * Alternative method: Force consent by revoking existing permissions
713
+ */
714
+ export const forceYouTubeReconnectionWithRevoke = async username => {
715
+ try {
716
+ var _userInfo$data14;
717
+ console.log('๐Ÿ”„ FORCING YouTube consent via REVOKE method...');
718
+ console.log('๐Ÿ‘ค User:', username);
719
+
720
+ // Step 1: Initialize Google Sign-In
721
+ initializeGoogleSignIn();
722
+ await GoogleSignin.hasPlayServices();
723
+
724
+ // Step 2: โœ… CRITICAL: Revoke existing permissions (forces fresh consent)
725
+ try {
726
+ await GoogleSignin.revokeAccess();
727
+ console.log('โœ… Revoked existing permissions - fresh consent REQUIRED');
728
+ } catch (revokeError) {
729
+ console.log('โ„น๏ธ No existing permissions to revoke:', revokeError);
730
+ }
731
+
732
+ // Step 3: Sign out completely
733
+ await GoogleSignin.signOut();
734
+ console.log('โœ… Signed out completely');
735
+
736
+ // Step 4: โœ… Now sign in again (will DEFINITELY show consent screen)
737
+ console.log('๐Ÿ” Signing in after revoke - consent screen MUST appear...');
738
+ const userInfo = await GoogleSignin.signIn();
739
+
740
+ // Step 5: โœ… User will definitely see consent screen now
741
+ const tokens = await GoogleSignin.getTokens();
742
+ const currentUser = await GoogleSignin.getCurrentUser();
743
+ const refreshToken = ((_userInfo$data14 = userInfo.data) === null || _userInfo$data14 === void 0 ? void 0 : _userInfo$data14.serverAuthCode) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serverAuthCode);
744
+ if (refreshToken) {
745
+ console.log('โœ… SUCCESS: Got refresh token after REVOKE + consent!');
746
+ console.log('๐Ÿ”‘ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
747
+
748
+ // Continue with the same backend submission logic as above
749
+ // (Similar to forceYouTubeReconnectionWithConsent)
750
+
751
+ return true;
752
+ } else {
753
+ console.error('โŒ Still no refresh token after revoke method');
754
+ return false;
755
+ }
756
+ } catch (error) {
757
+ console.error('โŒ Error with revoke method:', error);
758
+ return false;
759
+ }
760
+ };
761
+
762
+ /**
763
+ * Fix YouTube connection for a specific user (like nicholase50)
764
+ */
765
+ export const fixUserYouTubeConnection = async username => {
766
+ console.log(`๐Ÿ”ง Fixing YouTube connection for user: ${username}`);
767
+
768
+ // Method 1: Try forced consent via configuration
769
+ console.log('๐Ÿ”„ Method 1: Trying forced consent via configuration...');
770
+ let success = await forceYouTubeReconnectionWithConsent(username);
771
+ if (success) {
772
+ console.log(`โœ… ${username} YouTube connection fixed via Method 1!`);
773
+ return true;
774
+ }
775
+
776
+ // Method 2: Try forced consent via revoke
777
+ console.log('๐Ÿ”„ Method 2: Trying forced consent via revoke...');
778
+ success = await forceYouTubeReconnectionWithRevoke(username);
779
+ if (success) {
780
+ console.log(`โœ… ${username} YouTube connection fixed via Method 2!`);
781
+ return true;
782
+ }
783
+ console.error(`โŒ Failed to fix ${username} YouTube connection with both methods`);
784
+ return false;
785
+ };
786
+
787
+ /**
788
+ * Get fresh tokens using refresh token
789
+ */
790
+ const refreshGoogleTokens = async () => {
791
+ try {
792
+ console.log('๐Ÿ”„ Attempting to refresh Google tokens...');
793
+
794
+ // Check if user is signed in
795
+ const currentUser = await GoogleSignin.getCurrentUser();
796
+ if (!currentUser) {
797
+ console.log('โŒ User not signed in to Google, cannot refresh tokens');
798
+ return null;
799
+ }
800
+
801
+ // Get fresh tokens
802
+ const tokens = await GoogleSignin.getTokens();
803
+ console.log('โœ… Successfully refreshed Google tokens');
804
+ return {
805
+ accessToken: tokens.accessToken,
806
+ idToken: tokens.idToken
807
+ };
808
+ } catch (error) {
809
+ console.error('โŒ Failed to refresh Google tokens:', error);
810
+
811
+ // If refresh fails, try to sign in again
812
+ try {
813
+ console.log('๐Ÿ”„ Refresh failed, attempting re-authentication...');
814
+ const userInfo = await GoogleSignin.signIn();
815
+ const tokens = await GoogleSignin.getTokens();
816
+ console.log('โœ… Re-authentication successful');
817
+ return {
818
+ accessToken: tokens.accessToken,
819
+ idToken: tokens.idToken
820
+ };
821
+ } catch (signInError) {
822
+ console.error('โŒ Re-authentication also failed:', signInError);
823
+ return null;
824
+ }
825
+ }
826
+ };
827
+
828
+ /**
829
+ * Debug YouTube tokens to verify refresh token availability
830
+ */
831
+ const debugYouTubeTokens = async () => {
832
+ try {
833
+ var _currentUser$user;
834
+ const tokens = await GoogleSignin.getTokens();
835
+ const currentUser = await GoogleSignin.getCurrentUser();
836
+ console.log('๐Ÿ” YouTube Token Debug:', {
837
+ accessToken: tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing',
838
+ idToken: tokens.idToken ? 'Present' : 'Missing',
839
+ serverAuthCode: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing',
840
+ userEmail: (currentUser === null || currentUser === void 0 || (_currentUser$user = currentUser.user) === null || _currentUser$user === void 0 ? void 0 : _currentUser$user.email) || 'Missing'
841
+ });
842
+ return {
843
+ hasRefreshToken: !!(currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode),
844
+ refreshTokenType: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? 'serverAuthCode' : 'none'
845
+ };
846
+ } catch (error) {
847
+ console.error('โŒ Debug tokens failed:', error);
848
+ return {
849
+ hasRefreshToken: false,
850
+ refreshTokenType: 'error'
851
+ };
852
+ }
853
+ };
854
+
855
+ /**
856
+ * Force fresh YouTube reconnection with proper refresh token
857
+ */
858
+ export const reconnectYouTube = async username => {
859
+ try {
860
+ console.log('๐Ÿ”„ Forcing fresh YouTube reconnection for refresh token...');
861
+
862
+ // 1. Sign out completely to force fresh consent
863
+ try {
864
+ await GoogleSignin.signOut();
865
+ console.log('โœ… Signed out from Google');
866
+ } catch (signOutError) {
867
+ console.log('โ„น๏ธ Already signed out or sign out failed:', signOutError);
868
+ }
869
+
870
+ // 2. Clear any cached tokens
871
+ try {
872
+ const currentTokens = await GoogleSignin.getTokens();
873
+ if (currentTokens.accessToken) {
874
+ await GoogleSignin.clearCachedAccessToken(currentTokens.accessToken);
875
+ console.log('โœ… Cleared cached access token');
876
+ }
877
+ } catch (clearError) {
878
+ console.log('โ„น๏ธ Token clearing failed or not needed:', clearError);
879
+ }
880
+
881
+ // 3. Re-authenticate with fresh consent
882
+ const result = await initiateNativeAuth('youtube', username);
883
+ if (result) {
884
+ console.log('โœ… YouTube reconnected successfully with refresh token');
885
+
886
+ // 4. Verify we now have a refresh token
887
+ const debugInfo = await debugYouTubeTokens();
888
+ if (debugInfo.hasRefreshToken) {
889
+ console.log('โœ… Refresh token confirmed:', debugInfo.refreshTokenType);
890
+ } else {
891
+ console.warn('โš ๏ธ Still no refresh token after reconnection');
892
+ }
893
+ return true;
894
+ } else {
895
+ console.error('โŒ YouTube reconnection failed');
896
+ return false;
897
+ }
898
+ } catch (error) {
899
+ console.error('โŒ YouTube reconnection error:', error);
900
+ return false;
901
+ }
902
+ };
903
+
904
+ /**
905
+ * Initiate native authentication for platforms with SDKs
906
+ */
907
+ export const initiateNativeAuth = async (platform, username) => {
908
+ if (platform === 'youtube') {
909
+ console.log('๐Ÿ”— Initiating native Google Sign-In for YouTube');
910
+
911
+ // Validate username for YouTube
912
+ if (!username || username.trim() === '') {
913
+ console.error('โŒ [YOUTUBE AUTH] Username is required for YouTube authentication');
914
+ return false;
915
+ }
916
+ try {
917
+ var _userInfo$data15, _currentUser$user2, _userInfo$data16, _userInfo$data17, _userInfo$data24, _userInfo$data25, _userInfo$data26, _userInfo$data27, _userInfo$data28, _userInfo$data29;
918
+ // Initialize Google Sign-In if not already done
919
+ // โœ… CRITICAL: Initialize with CORRECT iOS Client ID
920
+ initializeGoogleSignIn();
921
+
922
+ // Check if Google Play Services are available
923
+ await GoogleSignin.hasPlayServices();
924
+
925
+ // โœ… CRITICAL: Force sign out first to ensure fresh consent
926
+ try {
927
+ await GoogleSignin.signOut();
928
+ console.log('๐Ÿ”„ Signed out to force fresh consent');
929
+ } catch (signOutError) {
930
+ console.log('โ„น๏ธ Sign out not needed or failed:', signOutError);
931
+ }
932
+
933
+ // Sign in with Google (this will show consent screen due to our config)
934
+ const userInfo = await GoogleSignin.signIn();
935
+ console.log('โœ… Google Sign-In successful:', (_userInfo$data15 = userInfo.data) === null || _userInfo$data15 === void 0 || (_userInfo$data15 = _userInfo$data15.user) === null || _userInfo$data15 === void 0 ? void 0 : _userInfo$data15.email);
936
+ console.log('๐Ÿ“‹ FULL userInfo object:');
937
+ console.log(JSON.stringify(userInfo, null, 2));
938
+
939
+ // Get access token for API calls
940
+ const tokens = await GoogleSignin.getTokens();
941
+ console.log('๐Ÿ”‘ Got Google tokens');
942
+ console.log('๐Ÿ“‹ FULL tokens object:');
943
+ console.log(JSON.stringify(tokens, null, 2));
944
+
945
+ // CRITICAL: Get the current user info which contains the refresh token
946
+ const currentUser = await GoogleSignin.getCurrentUser();
947
+ console.log('๐Ÿ‘ค Current user info:', currentUser === null || currentUser === void 0 || (_currentUser$user2 = currentUser.user) === null || _currentUser$user2 === void 0 ? void 0 : _currentUser$user2.email);
948
+ console.log('๐Ÿ“‹ FULL currentUser object:');
949
+ console.log(JSON.stringify(currentUser, null, 2));
950
+
951
+ // โœ… CRITICAL: Extract refresh token properly using serverAuthCode
952
+ let refreshToken = null;
953
+ console.log('๐Ÿ” REFRESH TOKEN EXTRACTION:');
954
+ console.log('- userInfo.data?.serverAuthCode:', (_userInfo$data16 = userInfo.data) !== null && _userInfo$data16 !== void 0 && _userInfo$data16.serverAuthCode ? `Present: ${userInfo.data.serverAuthCode.substring(0, 20)}...` : 'Missing');
955
+ console.log('- currentUser?.serverAuthCode:', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `Present: ${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
956
+ console.log('- tokens.idToken:', tokens.idToken ? `Present: ${tokens.idToken.substring(0, 20)}...` : 'Missing');
957
+ console.log('- tokens.accessToken:', tokens.accessToken ? `Present: ${tokens.accessToken.substring(0, 20)}...` : 'Missing');
958
+
959
+ // The serverAuthCode is the refresh token mechanism for React Native Google Sign-In
960
+ if (currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode) {
961
+ refreshToken = currentUser.serverAuthCode;
962
+ console.log('โœ… Got serverAuthCode (refresh token mechanism)');
963
+ console.log('๐Ÿ”‘ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
964
+ } else if ((_userInfo$data17 = userInfo.data) !== null && _userInfo$data17 !== void 0 && _userInfo$data17.serverAuthCode) {
965
+ refreshToken = userInfo.data.serverAuthCode;
966
+ console.log('โœ… Got serverAuthCode from sign-in response');
967
+ console.log('๐Ÿ”‘ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
968
+ }
969
+
970
+ // โœ… CRITICAL: Verify refresh token availability
971
+ if (!refreshToken) {
972
+ console.error('โŒ CRITICAL: No refresh token available - YouTube connection will fail when token expires');
973
+ console.error('๐Ÿ’ก User needs to reconnect with proper consent screen');
974
+ console.error('๐Ÿ’ก Check Google Sign-In configuration: offlineAccess, forceCodeForRefreshToken');
975
+
976
+ // Still continue but warn about the issue
977
+ console.warn('โš ๏ธ Continuing without refresh token - connection may fail later');
978
+ } else {
979
+ console.log('โœ… Refresh token available for YouTube connection');
980
+ console.log('๐Ÿ”‘ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
981
+ }
982
+
983
+ // Fetch YouTube channel information using the access token
984
+ let channelName = 'Unknown Channel';
985
+ let channelId = null;
986
+ try {
987
+ console.log('๐Ÿ“บ Fetching YouTube channel information...');
988
+ const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
989
+ headers: {
990
+ 'Authorization': `Bearer ${tokens.accessToken}`,
991
+ 'Accept': 'application/json'
992
+ }
993
+ });
994
+ if (channelResponse.ok) {
995
+ const channelData = await channelResponse.json();
996
+ if (channelData.items && channelData.items.length > 0) {
997
+ channelName = channelData.items[0].snippet.title;
998
+ channelId = channelData.items[0].id;
999
+ console.log('โœ… YouTube channel found:', channelName, 'ID:', channelId);
1000
+ } else {
1001
+ var _userInfo$data18, _userInfo$data19;
1002
+ console.log('โš ๏ธ No YouTube channel found for user');
1003
+ channelName = ((_userInfo$data18 = userInfo.data) === null || _userInfo$data18 === void 0 || (_userInfo$data18 = _userInfo$data18.user) === null || _userInfo$data18 === void 0 ? void 0 : _userInfo$data18.name) || ((_userInfo$data19 = userInfo.data) === null || _userInfo$data19 === void 0 || (_userInfo$data19 = _userInfo$data19.user) === null || _userInfo$data19 === void 0 ? void 0 : _userInfo$data19.email) || 'No Channel';
1004
+ }
1005
+ } else {
1006
+ var _userInfo$data20, _userInfo$data21;
1007
+ console.log('โš ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
1008
+ channelName = ((_userInfo$data20 = userInfo.data) === null || _userInfo$data20 === void 0 || (_userInfo$data20 = _userInfo$data20.user) === null || _userInfo$data20 === void 0 ? void 0 : _userInfo$data20.name) || ((_userInfo$data21 = userInfo.data) === null || _userInfo$data21 === void 0 || (_userInfo$data21 = _userInfo$data21.user) === null || _userInfo$data21 === void 0 ? void 0 : _userInfo$data21.email) || 'Unknown Channel';
1009
+ }
1010
+ } catch (channelError) {
1011
+ var _userInfo$data22, _userInfo$data23;
1012
+ console.log('โš ๏ธ Error fetching YouTube channel info:', channelError);
1013
+ channelName = ((_userInfo$data22 = userInfo.data) === null || _userInfo$data22 === void 0 || (_userInfo$data22 = _userInfo$data22.user) === null || _userInfo$data22 === void 0 ? void 0 : _userInfo$data22.name) || ((_userInfo$data23 = userInfo.data) === null || _userInfo$data23 === void 0 || (_userInfo$data23 = _userInfo$data23.user) === null || _userInfo$data23 === void 0 ? void 0 : _userInfo$data23.email) || 'Unknown Channel';
1014
+ }
1015
+
1016
+ // Get stored authentication info to link YouTube data to user account
1017
+ // NOTE: SDK no longer creates EnochUser - consuming app should handle this
1018
+ let authToken = await getJWT();
1019
+ const storedUsername = await AsyncStorage.getItem('onairos_username');
1020
+ const finalUsername = storedUsername || username || ((_userInfo$data24 = userInfo.data) === null || _userInfo$data24 === void 0 || (_userInfo$data24 = _userInfo$data24.user) === null || _userInfo$data24 === void 0 ? void 0 : _userInfo$data24.email) || 'youtube_user';
1021
+
1022
+ // Log authentication status - SDK does NOT create users during YouTube connection
1023
+ if (!authToken || authToken.trim().length < 20) {
1024
+ console.log('โ„น๏ธ No valid authentication token found for YouTube connection');
1025
+ console.log('โ„น๏ธ NOTE: SDK does not create users during YouTube connection');
1026
+ console.log('โ„น๏ธ User should authenticate first via Google/Apple/Email before connecting YouTube');
1027
+ // Continue without token - YouTube connection will work but may not be linked to user
1028
+ } else {
1029
+ console.log('โœ… Found existing authentication token for YouTube auth');
1030
+ console.log('๐Ÿ”‘ Token preview:', `${authToken.substring(0, 20)}...`);
1031
+ }
1032
+ console.log('๐Ÿ”— Linking YouTube data to user:', finalUsername);
1033
+ console.log('๐Ÿ”‘ Using auth token for linking:', authToken ? `${authToken.substring(0, 20)}...` : 'No token');
1034
+ console.log('๐Ÿ“บ YouTube channel name:', channelName);
1035
+
1036
+ // โœ… CRITICAL: Enhanced payload with comprehensive refresh token data
1037
+ const backendPayload = {
1038
+ session: {
1039
+ username: finalUsername,
1040
+ platform: 'youtube',
1041
+ timestamp: new Date().toISOString(),
1042
+ channelName: channelName,
1043
+ channelId: channelId
1044
+ },
1045
+ googleUser: (_userInfo$data25 = userInfo.data) === null || _userInfo$data25 === void 0 ? void 0 : _userInfo$data25.user,
1046
+ accessToken: tokens.accessToken,
1047
+ idToken: tokens.idToken,
1048
+ refreshToken: refreshToken,
1049
+ // โœ… CRITICAL: Include refresh token
1050
+ serverAuthCode: refreshToken,
1051
+ // โœ… Alternative refresh mechanism (same as refreshToken)
1052
+
1053
+ // โœ… CRITICAL: Additional compatibility fields for backend
1054
+ refresh_token: refreshToken,
1055
+ // Snake case version
1056
+ server_auth_code: refreshToken,
1057
+ // Snake case version
1058
+ authCode: refreshToken,
1059
+ // Alternative naming
1060
+
1061
+ // Include user account linking information
1062
+ userAccountInfo: {
1063
+ username: finalUsername,
1064
+ email: (_userInfo$data26 = userInfo.data) === null || _userInfo$data26 === void 0 || (_userInfo$data26 = _userInfo$data26.user) === null || _userInfo$data26 === void 0 ? void 0 : _userInfo$data26.email,
1065
+ authToken: authToken,
1066
+ channelName: channelName,
1067
+ channelId: channelId,
1068
+ // CRITICAL: Include user identifier that matches your database
1069
+ userIdentifier: authToken ? `user-${authToken.substring(0, 10)}` : `youtube-${(_userInfo$data27 = userInfo.data) === null || _userInfo$data27 === void 0 || (_userInfo$data27 = _userInfo$data27.user) === null || _userInfo$data27 === void 0 ? void 0 : _userInfo$data27.email}`,
1070
+ googleId: (_userInfo$data28 = userInfo.data) === null || _userInfo$data28 === void 0 || (_userInfo$data28 = _userInfo$data28.user) === null || _userInfo$data28 === void 0 ? void 0 : _userInfo$data28.id,
1071
+ appleUserId: authToken !== null && authToken !== void 0 && authToken.includes('apple') ? authToken.split('.')[1] : null,
1072
+ // โœ… CRITICAL: Also include refresh token in userAccountInfo
1073
+ refreshToken: refreshToken,
1074
+ serverAuthCode: refreshToken
1075
+ },
1076
+ // Token expiry information
1077
+ tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
1078
+ // 1 hour from now
1079
+ // Force refresh token request
1080
+ requestRefreshToken: true,
1081
+ // โœ… CRITICAL: Debug information for backend
1082
+ debugInfo: {
1083
+ hasRefreshToken: !!refreshToken,
1084
+ refreshTokenType: refreshToken ? refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken' : 'none',
1085
+ configuredForRefresh: true,
1086
+ forcedConsent: true,
1087
+ refreshTokenValue: refreshToken // Include actual value for debugging
1088
+ }
1089
+ };
1090
+ console.log('๐Ÿ“ค BACKEND PAYLOAD SUMMARY:');
1091
+ console.log('- hasAccessToken:', !!backendPayload.accessToken);
1092
+ console.log('- hasRefreshToken:', !!backendPayload.refreshToken);
1093
+ console.log('- hasServerAuthCode:', !!backendPayload.serverAuthCode);
1094
+ console.log('- refreshTokenType:', backendPayload.debugInfo.refreshTokenType);
1095
+ console.log('- userEmail:', (_userInfo$data29 = userInfo.data) === null || _userInfo$data29 === void 0 || (_userInfo$data29 = _userInfo$data29.user) === null || _userInfo$data29 === void 0 ? void 0 : _userInfo$data29.email);
1096
+ console.log('- channelName:', channelName);
1097
+ console.log('๐Ÿ“‹ COMPLETE BACKEND PAYLOAD:');
1098
+ console.log(JSON.stringify(backendPayload, null, 2));
1099
+
1100
+ // Send the tokens to your backend for YouTube data processing with ENHANCED LOGGING
1101
+ console.log('๐Ÿ“ค Sending YouTube auth to backend with refresh token:', !!refreshToken);
1102
+ const backendResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/native-auth`, {
1103
+ method: 'POST',
1104
+ headers: {
1105
+ 'Content-Type': 'application/json',
1106
+ ...(authToken && {
1107
+ 'Authorization': authToken
1108
+ }) // Include auth token if available
1109
+ },
1110
+ body: JSON.stringify(backendPayload)
1111
+ });
1112
+ console.log('๐Ÿ“ก Backend response status:', backendResponse.status);
1113
+ console.log('๐Ÿ“ก Backend response headers:', backendResponse.headers);
1114
+ if (backendResponse.ok) {
1115
+ var _responseData$validat2, _responseData$tempora2;
1116
+ const responseData = await backendResponse.json();
1117
+ console.log('โœ… YouTube connection successful');
1118
+ console.log('๐Ÿ“‹ COMPLETE BACKEND RESPONSE:');
1119
+ console.log(JSON.stringify(responseData, null, 2));
1120
+
1121
+ // โœ… Enhanced verification with temporary mode detection (exact backend fields)
1122
+ const isTemporaryMode = ((_responseData$validat2 = responseData.validation) === null || _responseData$validat2 === void 0 ? void 0 : _responseData$validat2.isTemporaryMode) === true || ((_responseData$tempora2 = responseData.temporaryMode) === null || _responseData$tempora2 === void 0 ? void 0 : _responseData$tempora2.enabled) === true || responseData.isTemporaryMode === true || responseData.message && responseData.message.includes('temporary access token mode');
1123
+ if (isTemporaryMode) {
1124
+ console.log('๐Ÿ”„ [YOUTUBE AUTH] YouTube connected in temporary mode');
1125
+ console.log('โœ… [YOUTUBE AUTH] Training will work, but connection expires in ~1 hour');
1126
+ console.log('โ„น๏ธ [YOUTUBE AUTH] User can reconnect later for refresh tokens if needed');
1127
+ } else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
1128
+ console.log('โœ… [YOUTUBE AUTH] Backend confirmed refresh token received');
1129
+ console.log('โœ… [YOUTUBE AUTH] Full YouTube connection with persistent access');
1130
+ } else {
1131
+ console.warn('โš ๏ธ [YOUTUBE AUTH] Backend did not confirm refresh token');
1132
+ console.warn('๐Ÿ” [YOUTUBE AUTH] Response data keys:', Object.keys(responseData));
1133
+ console.warn('โš ๏ธ [YOUTUBE AUTH] Connection may fail when tokens expire');
1134
+ }
1135
+ return true;
1136
+ } else {
1137
+ const errorData = await backendResponse.text();
1138
+ console.error('โŒ YouTube auth failed:', backendResponse.status);
1139
+ console.error('๐Ÿ“‹ BACKEND ERROR RESPONSE:');
1140
+ console.error(errorData);
1141
+ return false;
1142
+ }
1143
+ } catch (error) {
1144
+ console.error('โŒ Google Sign-In error:', error);
1145
+ if (error.code === statusCodes.SIGN_IN_CANCELLED) {
1146
+ console.log('User cancelled Google Sign-In');
1147
+ } else if (error.code === statusCodes.IN_PROGRESS) {
1148
+ console.log('Google Sign-In already in progress');
1149
+ } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
1150
+ console.log('Google Play Services not available');
1151
+ }
1152
+ return false;
1153
+ }
1154
+ }
1155
+
1156
+ // Instagram is commented out in the UI, but keeping the code for future use
1157
+ if (platform === 'instagram') {
1158
+ // Simulate Facebook Login SDK for Instagram
1159
+ console.log('Initiating Facebook Login for Instagram');
1160
+ return new Promise(resolve => {
1161
+ setTimeout(() => {
1162
+ console.log('Facebook Login completed successfully');
1163
+ resolve(true);
1164
+ }, 1000);
1165
+ });
1166
+ }
1167
+ return false;
1168
+ };
1169
+
1170
+ /**
1171
+ * Check if a URL is an OAuth callback
1172
+ */
1173
+ export const isOAuthCallback = url => {
1174
+ return url.includes('auth/callback') || url.includes('code=');
1175
+ };
1176
+
1177
+ /**
1178
+ * Exchange authorization code for access token
1179
+ * This would typically be done on a server, but we're simulating it here
1180
+ */
1181
+ export const exchangeCodeForToken = async (code, platform) => {
1182
+ console.log(`Exchanging code for token for platform: ${platform}`);
1183
+ try {
1184
+ // Use the proxy server to exchange the code for a token
1185
+ const tokenUrl = `${API_CONFIG.BASE_URL}/${platform}/token`;
1186
+
1187
+ // Make a POST request to the proxy
1188
+ const response = await fetch(tokenUrl, {
1189
+ method: 'POST',
1190
+ headers: {
1191
+ 'Content-Type': 'application/json'
1192
+ },
1193
+ body: JSON.stringify({
1194
+ code: code,
1195
+ platform: platform
1196
+ })
1197
+ });
1198
+ if (!response.ok) {
1199
+ console.error(`Error exchanging code for token: ${response.status}`);
1200
+ throw new Error(`Token exchange failed with status ${response.status}`);
1201
+ }
1202
+ const data = await response.json();
1203
+ console.log(`Token exchange successful for ${platform}`);
1204
+ return data;
1205
+ } catch (error) {
1206
+ console.error(`Error exchanging code for token:`, error);
1207
+
1208
+ // Fallback to simulation if the API call fails
1209
+ console.log('Falling back to simulated token response');
1210
+ return {
1211
+ access_token: `${platform}_access_token_${Math.random().toString(36).substring(7)}`,
1212
+ refresh_token: `${platform}_refresh_token_${Math.random().toString(36).substring(7)}`,
1213
+ expires_in: 3600
1214
+ };
1215
+ }
1216
+ };
1217
+
1218
+ /**
1219
+ * Refresh YouTube tokens when they expire
1220
+ * This should be called when the backend reports token expiry
1221
+ */
1222
+ export const refreshYouTubeTokens = async () => {
1223
+ try {
1224
+ var _currentUser$user3;
1225
+ console.log('๐Ÿ”„ Refreshing YouTube tokens...');
1226
+
1227
+ // Get fresh tokens from Google SDK
1228
+ const freshTokens = await GoogleSignin.getTokens();
1229
+ if (!freshTokens) {
1230
+ console.error('โŒ Failed to get fresh tokens from Google SDK');
1231
+ return false;
1232
+ }
1233
+
1234
+ // Get current user info
1235
+ const currentUser = await GoogleSignin.getCurrentUser();
1236
+ if (!currentUser) {
1237
+ console.error('โŒ No current Google user found');
1238
+ return false;
1239
+ }
1240
+
1241
+ // Get stored auth token using simplified JWT storage
1242
+ const authToken = await getJWT();
1243
+ if (!authToken) {
1244
+ console.error('โŒ No auth token found for YouTube refresh');
1245
+ return false;
1246
+ }
1247
+
1248
+ // Send refreshed tokens to backend
1249
+ const refreshResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/refresh-token`, {
1250
+ method: 'POST',
1251
+ headers: {
1252
+ 'Content-Type': 'application/json',
1253
+ 'Authorization': authToken
1254
+ },
1255
+ body: JSON.stringify({
1256
+ accessToken: freshTokens.accessToken,
1257
+ idToken: freshTokens.idToken,
1258
+ refreshToken: currentUser.serverAuthCode,
1259
+ userEmail: (_currentUser$user3 = currentUser.user) === null || _currentUser$user3 === void 0 ? void 0 : _currentUser$user3.email,
1260
+ tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
1261
+ // 1 hour from now
1262
+ timestamp: new Date().toISOString()
1263
+ })
1264
+ });
1265
+ if (refreshResponse.ok) {
1266
+ const responseData = await refreshResponse.json();
1267
+ console.log('โœ… YouTube tokens refreshed successfully:', responseData);
1268
+ return true;
1269
+ } else {
1270
+ const errorData = await refreshResponse.text();
1271
+ console.error('โŒ YouTube token refresh failed:', refreshResponse.status, errorData);
1272
+ return false;
1273
+ }
1274
+ } catch (error) {
1275
+ console.error('โŒ Error refreshing YouTube tokens:', error);
1276
+ return false;
1277
+ }
1278
+ };
1279
+
1280
+ /**
1281
+ * Trigger training restart after YouTube re-authentication
1282
+ * This signals the backend to restart training with the new refresh token
1283
+ */
1284
+ const triggerTrainingRestart = async (username, authToken) => {
1285
+ try {
1286
+ console.log('๐Ÿ”„ [TRAINING RESTART] Triggering training restart for user:', username);
1287
+ const response = await fetch(`${API_CONFIG.BASE_URL}/mobile-training/restart`, {
1288
+ method: 'POST',
1289
+ headers: {
1290
+ 'Content-Type': 'application/json',
1291
+ 'Authorization': authToken
1292
+ },
1293
+ body: JSON.stringify({
1294
+ username: username,
1295
+ reason: 'youtube_reauth',
1296
+ platform: 'youtube',
1297
+ timestamp: new Date().toISOString(),
1298
+ requestNewTraining: true
1299
+ })
1300
+ });
1301
+ if (response.ok) {
1302
+ const responseData = await response.json();
1303
+ console.log('โœ… [TRAINING RESTART] Training restart successful:', responseData);
1304
+ } else {
1305
+ const errorData = await response.text();
1306
+ console.error('โŒ [TRAINING RESTART] Training restart failed:', response.status, errorData);
1307
+ throw new Error(`Training restart failed: ${response.status}`);
1308
+ }
1309
+ } catch (error) {
1310
+ console.error('โŒ [TRAINING RESTART] Error triggering training restart:', error);
1311
+ throw error;
1312
+ }
1313
+ };
1314
+
1315
+ /**
1316
+ * Test function to verify YouTube refresh token functionality
1317
+ * Call this in your app to test the YouTube connection
1318
+ */
1319
+ export const testYouTubeRefreshToken = async username => {
1320
+ console.log('๐Ÿงช Testing YouTube refresh token functionality...');
1321
+ console.log('๐Ÿ‘ค User:', username);
1322
+ try {
1323
+ // Test the debug function first
1324
+ const debugInfo = await debugYouTubeTokens();
1325
+ console.log('๐Ÿ” Current token status:', debugInfo);
1326
+ if (!debugInfo.hasRefreshToken) {
1327
+ console.log('โš ๏ธ No refresh token found - attempting to fix...');
1328
+ const success = await fixUserYouTubeConnection(username);
1329
+ if (success) {
1330
+ console.log('โœ… YouTube connection fixed! Testing again...');
1331
+ const newDebugInfo = await debugYouTubeTokens();
1332
+ console.log('๐Ÿ” New token status:', newDebugInfo);
1333
+ } else {
1334
+ console.error('โŒ Failed to fix YouTube connection');
1335
+ }
1336
+ } else {
1337
+ console.log('โœ… Refresh token already available');
1338
+ }
1339
+ } catch (error) {
1340
+ console.error('โŒ Error testing YouTube refresh token:', error);
1341
+ }
1342
+ };
1343
+
1344
+ /**
1345
+ * Request email verification code
1346
+ */
1347
+ export const requestEmailVerification = async (email, testMode = false) => {
1348
+ try {
1349
+ console.log('๐Ÿ“ง Requesting email verification for:', email);
1350
+
1351
+ // ๐Ÿ”’ SECURITY: Use developer API key - backend must validate
1352
+ const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
1353
+ method: 'POST',
1354
+ headers: getDeveloperAuthHeaders(),
1355
+ body: JSON.stringify({
1356
+ email,
1357
+ action: 'request',
1358
+ testMode
1359
+ })
1360
+ });
1361
+ const result = await response.json();
1362
+ if (response.ok) {
1363
+ return {
1364
+ success: true,
1365
+ message: result.message || 'Verification code sent to your email'
1366
+ };
1367
+ } else {
1368
+ return {
1369
+ success: false,
1370
+ error: result.message || 'Failed to send verification code'
1371
+ };
1372
+ }
1373
+ } catch (error) {
1374
+ console.error('โŒ Error requesting email verification:', error);
1375
+ return {
1376
+ success: false,
1377
+ error: 'Network error. Please check your connection and try again.'
1378
+ };
1379
+ }
1380
+ };
1381
+
1382
+ /**
1383
+ * Verify email code
1384
+ */
1385
+ export const verifyEmailCode = async (email, code, testMode = false) => {
1386
+ try {
1387
+ console.log('๐Ÿ” Verifying email code for:', email);
1388
+
1389
+ // ๐Ÿ”’ SECURITY: Use developer API key - backend must validate before issuing JWT
1390
+ const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
1391
+ method: 'POST',
1392
+ headers: getDeveloperAuthHeaders(),
1393
+ body: JSON.stringify({
1394
+ email,
1395
+ code,
1396
+ action: 'verify',
1397
+ testMode
1398
+ })
1399
+ });
1400
+ const result = await response.json();
1401
+ if (response.ok) {
1402
+ return {
1403
+ success: true,
1404
+ message: result.message || 'Email verified successfully',
1405
+ existingUser: result.existingUser || false,
1406
+ token: result.token
1407
+ };
1408
+ } else {
1409
+ return {
1410
+ success: false,
1411
+ error: result.message || 'Invalid verification code'
1412
+ };
1413
+ }
1414
+ } catch (error) {
1415
+ console.error('โŒ Error verifying email code:', error);
1416
+ return {
1417
+ success: false,
1418
+ error: 'Network error. Please check your connection and try again.'
1419
+ };
1420
+ }
1421
+ };
1422
+
1423
+ /**
1424
+ * Check email verification status
1425
+ */
1426
+ export const checkEmailVerificationStatus = async (email, testMode = false) => {
1427
+ try {
1428
+ // ๐Ÿ”’ SECURITY: Use developer API key - backend must validate
1429
+ const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification/status`, {
1430
+ method: 'POST',
1431
+ headers: getDeveloperAuthHeaders(),
1432
+ body: JSON.stringify({
1433
+ email,
1434
+ testMode
1435
+ })
1436
+ });
1437
+ const result = await response.json();
1438
+ return {
1439
+ success: response.ok,
1440
+ isPending: result.isPending || false,
1441
+ message: result.message
1442
+ };
1443
+ } catch (error) {
1444
+ console.error('โŒ Error checking email verification status:', error);
1445
+ return {
1446
+ success: false,
1447
+ isPending: false,
1448
+ error: 'Network error'
1449
+ };
1450
+ }
1451
+ };
1452
+
1453
+ /**
1454
+ * Initialize platform auth service
1455
+ */
1456
+ export const initializePlatformAuthService = () => {
1457
+ console.log('๐Ÿ”ง Platform auth service initialized');
1458
+ // Initialize Google Sign-In
1459
+ initializeGoogleSignIn();
1460
+ };
1461
+ //# sourceMappingURL=platformAuthService.js.map