/* Metro module 6730; source: lib/spellcheck/LanguageDetector.tsx; dependencies: [6, 7, 6731, 2] */ function _fun52864(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:6, offset: 0x01338c37, size: 132 bytes, params: 8, frame: 18 const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(6) /* metro dependency 6 */; const env0_3 = importDefault(7) /* metro dependency 7 */; const value = _fun52865(); (require(2) /* metro dependency 2 */).fileFinishedImporting('lib/spellcheck/LanguageDetector.tsx'); exports.default = value; } function _fun52865() { // fn#52865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:122, offset: 0x01338cbb, size: 135 bytes, params: 1, frame: 15 return env0_3(LanguageDetector, [{key: 'language', get: function() { return this._language; }, set: function(a0) { if (this._language !== a0) { this._language = a0; this._onChange(a0); } }}, {key: 'languageHint', set: function(a0) { this._languageHint = a0; }}, {key: 'process', value: function(a0) { var env0_0 = this; var env0_1 = a0; if (!this._processing) { this._processing = true; global.requestIdleCallback(_fun52871); } }}, {key: '_processEnd', value: function() { var r1; var _minimumTimeRemaining; var value = a0; r1 = value !== undefined ? value : false; this._processing = false; if (r1) { _minimumTimeRemaining = this._minimumTimeRemaining; this._minimumTimeRemaining = typeof _minimumTimeRemaining === 'bigint' ? _minimumTimeRemaining + 1n : +_minimumTimeRemaining + 1; } }}]); } function LanguageDetector(a0, a1) { // fn#52866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:143, offset: 0x01338d42, size: 81 bytes, params: 3, frame: 15 env1_2(this, LanguageDetector); this._shouldProcess = false; this._processing = false; this._minimumTimeRemaining = 5; this._language = a0; this._languageHint = a0; this._onChange = a1; a1(a0); } function value_52870(a0) { // fn#52870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:543, offset: 0x01338dd3, size: 57 bytes, params: 2, frame: 11 const env0_1 = a0; if (!this._processing) { this._processing = true; global.requestIdleCallback(_fun52871); } } function _fun52871(a0) { // fn#52871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:615, offset: 0x01338e0c, size: 144 bytes, params: 2, frame: 15 const env0_0 = a0; if (a0.timeRemaining() <= env0_0._minimumTimeRemaining) { env0_0._processEnd(); } else { env0_1 = env0_1.length > 256 ? env0_1.slice(0, 256) : env0_1; detectLanguage(env0_1, env0_0._languageHint).then(_fun52876, _fun52877); } } function detectLanguage(a0, a1) { // fn#52872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:718, offset: 0x01338e9c, size: 75 bytes, params: 3, frame: 12 var environment; const env0_0 = a0; const env0_1 = a1; let value = environment.__proto__.__proto__.__proto__; value = importDefault(6731) /* metro dependency 6731: DesktopNativeUtils */; value = value.ensureModule('discord_spellcheck'); return value.then(_fun52873); } function _fun52876(a0) { // fn#52876, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:1143, offset: 0x01339063, size: 44 bytes, params: 2, frame: 11 const binding = env1_0; binding.language = a0; binding._processEnd(env0_0.didTimeout); } function _fun52877() { // fn#52877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:1197, offset: 0x0133908f, size: 35 bytes, params: 1, frame: 11 const binding = env1_0; binding._processEnd(env0_0.didTimeout); } function _fun52873() { // fn#52873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:803, offset: 0x01338ee7, size: 91 bytes, params: 1, frame: 12 var environment; let value = environment.__proto__.__proto__.__proto__.__proto__; value = importDefault(6731) /* metro dependency 6731: DesktopNativeUtils */; const env0_0 = value.requireModule('discord_spellcheck').cld; const Promise = global.Promise; value = Object.create(Promise.prototype, {constructor: {value: Promise}}); const promise = new Promise(_fun52874); return promise instanceof Object ? promise : value; } function _fun52874(a0, a1) { // fn#52874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:882, offset: 0x01338f42, size: 80 bytes, params: 3, frame: 16 const env0_0 = a0; const env0_1 = a1; const cldBinding = cld; cldBinding.detect(env1_0, {httpHint: require, encodingHint: 'UTF8'}, _fun52875); } function _fun52875(a0, a1) { // fn#52875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6908:935, offset: 0x01338f92, size: 209 bytes, params: 3, frame: 13 var Error; var message; if (a0 != null) { Error = global.Error; message = a0.message; require(new Error()); } else if (a1.reliable) { if (a1.languages[0].percent < 90) { require(new global.Error('Not enough reliable text.')); } else if (a1.languages[0].score < 500) { require(new global.Error('Not enough reliable text.')); } else { env0_0(a1.languages[0].code); } } else { require(new global.Error('Not enough reliable text.')); } }