2026-07-24 07:16:23 +00:00
// Module ID: 7083
// Function ID: 56721
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-23 10:11:24 +00:00
// Dependencies: [5, 6, 7, 15, 17, 18, 653, 4123, 3, 4672, 22, 4706, 4711, 4673, 631, 2]
2026-07-20 16:05:17 +00:00
2026-07-24 07:16:23 +00:00
// Module 7083 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import _inherits from "_inherits" ;
import ME from "ME" ;
import MESSAGE_GROUP_SPACING from "MESSAGE_GROUP_SPACING" ;
import set from "set" ;
import _getPrototypeOf from "_getPrototypeOf" ;
import closure_8 from "_inherits" ;
import { AbortCodes } from "ME" ;
import { FileUploadErrorTypes } from "MESSAGE_GROUP_SPACING" ;
import importDefaultResult from "_possibleConstructorReturn" ;
const require = arg1 ;
function _createForOfIteratorHelperLoose ( iterable ) {
let closure_0 = iterable ;
iterable = "undefined" !== typeof Symbol ;
if ( iterable ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( iterable ) {
const iter = iterable . call ( iterable ) ;
2026-07-20 16:05:17 +00:00
const next = iter . next ;
return next . bind ( iter ) ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
let tmp = iterable ;
if ( ! Array . isArray ( iterable ) ) {
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
if ( iterable ) {
if ( "string" === typeof iterable ) {
tmp2 = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
const toString = { } . toString ;
2026-07-23 10:11:24 +00:00
const substr = toString . call ( iterable ) . slice ( 8 , - 1 ) ;
2026-07-20 16:05:17 +00:00
let name = substr ;
if ( tmp3 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr ;
}
const _Array2 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
const callResult = toString . call ( iterable ) ;
tmp3 = "Object" === substr && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2 ;
if ( ! tmp2 ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
throw typeError ;
}
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0 ;
2026-07-20 16:05:17 +00:00
return ( ) = > {
2026-07-23 10:11:24 +00:00
if ( closure_1 >= length . length ) {
2026-07-20 16:05:17 +00:00
let obj = { done : true } ;
} else {
obj = { done : false } ;
closure_1 = tmp3 + 1 ;
2026-07-23 10:11:24 +00:00
obj . value = length [ + closure_1 ] ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
}
}
function _arrayLikeToArray ( arg0 , arg1 ) {
let length ;
if ( tmp ) {
length = arg0 . length ;
}
const ArrayResult = Array ( length ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
ArrayResult [ num ] = arg0 [ num ] ;
}
return ArrayResult ;
}
function _isNativeReflectConstruct() {
let closure_0 = ! valueOf . call ( Reflect . construct ( Boolean , [ ] , ( ) = > {
} ) ) ;
function _isNativeReflectConstruct() {
return closure_0 ;
}
const result = _isNativeReflectConstruct ( ) ;
}
importDefaultResult = new importDefaultResult ( "UploaderBase.tsx" ) ;
2026-07-23 10:11:24 +00:00
const tmp4 = ( ( EventEmitter ) = > {
2026-07-20 16:05:17 +00:00
class UploaderBase {
constructor ( ) {
self = this ;
2026-07-23 10:11:24 +00:00
tmp = outer1_4 ( this , UploaderBase ) ;
obj = outer1_7 ( UploaderBase ) ;
tmp2 = outer1_6 ;
if ( outer1_14 ( ) ) {
2026-07-20 16:05:17 +00:00
tmp4 = globalThis ;
_Reflect = Reflect ;
2026-07-23 10:11:24 +00:00
tmp5 = outer1_7 ;
constructResult = Reflect . construct ( obj , [ ] , outer1_7 ( self ) . constructor ) ;
2026-07-20 16:05:17 +00:00
} else {
constructResult = obj . apply ( self , undefined ) ;
}
tmp2Result = tmp2 ( self , constructResult ) ;
2026-07-23 10:11:24 +00:00
apply = tmp2Result ;
2026-07-20 16:05:17 +00:00
tmp2Result . _aborted = false ;
tmp2Result . _errored = false ;
tmp2Result . files = [ ] ;
tmp2Result . _lastUpdate = 0 ;
tmp2Result . _loaded = 0 ;
tmp2Result . alreadyStarted = false ;
tmp2Result . _handleStart = ( _cancel ) = > {
tmp2Result . _cancel = _cancel ;
if ( ! tmp2Result . alreadyStarted ) {
tmp2Result . emit ( "start" , tmp2Result . _file ) ;
}
tmp2Result . alreadyStarted = true ;
} ;
tmp2Result . _handleProgress = ( _loaded , currentSize ) = > {
const timestamp = Date . now ( ) ;
2026-07-23 10:11:24 +00:00
let obj = tmp2Result ( UploaderBase [ 9 ] ) ;
2026-07-20 16:05:17 +00:00
const rounded = Math . floor ( ( _loaded - tmp2Result . _loaded ) / ( ( timestamp - tmp2Result . _lastUpdate ) / 1000 ) ) ;
if ( null != arg2 ) {
const items = tmp2Result . _file . items ;
if ( null != items ) {
const item = items . forEach ( ( item ) = > {
2026-07-23 10:11:24 +00:00
item . item . progress = table [ item . id ] ;
2026-07-20 16:05:17 +00:00
} ) ;
}
}
arg2 . _lastUpdate = timestamp ;
arg2 . _loaded = _loaded ;
obj = { } ;
const merged = Object . assign ( tmp2Result . _file ) ;
obj [ "currentSize" ] = currentSize ;
obj [ "progress" ] = obj . calculateProgress ( _loaded , currentSize ) ;
obj [ "rate" ] = rounded ;
arg2 . _file = obj ;
arg2 . emit ( "progress" , arg2 . _file ) ;
} ;
tmp2Result . _handleException = ( arg0 ) = > {
let obj = { } ;
2026-07-23 10:11:24 +00:00
obj = { type : outer2_10 . ERROR_SOURCE_UNKNOWN , msg : arg0.toString ( ) } ;
2026-07-20 16:05:17 +00:00
obj . reason = obj ;
tmp2Result . _handleError ( obj ) ;
} ;
tmp2Result . _handleAborted = ( ) = > {
const result = tmp2Result . clearProcessingMessageInterval ( ) ;
} ;
tmp2Result . _handleError = ( arg0 ) = > {
let body ;
let code ;
let reason ;
( { code , reason , body } = arg0 ) ;
const result = tmp2Result . clearProcessingMessageInterval ( ) ;
if ( ! tmp2Result . _aborted ) {
tmp2Result . _errored = true ;
const _JSON = JSON ;
const _HermesInternal = HermesInternal ;
2026-07-23 10:11:24 +00:00
outer2_11 . log ( "_handleError: " + code + " (" + JSON . stringify ( reason ) + ") for " + tmp2Result . id ) ;
2026-07-20 16:05:17 +00:00
tmp2Result . emit ( "error" , tmp2Result . _file , code , body , reason ) ;
tmp2Result . removeAllListeners ( ) ;
}
} ;
tmp2Result . _handleComplete = ( arg0 ) = > {
const result = tmp2Result . clearProcessingMessageInterval ( ) ;
2026-07-23 10:11:24 +00:00
outer2_11 . log ( "_handleComplete for " + tmp2Result . id ) ;
2026-07-20 16:05:17 +00:00
tmp2Result . emit ( "complete" , tmp2Result . _file , arg0 ) ;
tmp2Result . removeAllListeners ( ) ;
} ;
2026-07-24 07:16:23 +00:00
obj2 = f56739 ( UploaderBase [ 10 ] ) ;
2026-07-20 16:05:17 +00:00
tmp2Result . id = obj2 . uniqueId ( "Uploader" ) ;
2026-07-23 10:11:24 +00:00
obj = { id : null , currentSize : 0 , totalPreCompressionSize : 0 , compressionProgress : 0 , progress : 0 , rate : 0 , hasImage : false , hasVideo : false , attachmentsCount : 0 } ;
2026-07-20 16:05:17 +00:00
obj . id = tmp2Result . id ;
obj . items = undefined ;
tmp2Result . _file = obj ;
return tmp2Result ;
}
}
callback3 ( UploaderBase , EventEmitter ) ;
let obj = {
key : "_fileSize" ,
value() {
const files = this . files ;
return files . reduce ( ( arg0 , currentSize ) = > {
currentSize = currentSize . currentSize ;
let num = 0 ;
if ( null != currentSize ) {
num = currentSize ;
}
return arg0 + num ;
} , 0 ) ;
}
} ;
2026-07-23 10:11:24 +00:00
let items = [ obj , , , , , , , , , , ] ;
2026-07-20 16:05:17 +00:00
obj = { key : "compressAndCheckFileSize" } ;
let closure_1 = callback ( async function ( ) {
const self = this ;
2026-07-23 10:11:24 +00:00
let obj = callback ( UploaderBase [ 11 ] ) ;
2026-07-20 16:05:17 +00:00
const first = self . files [ 0 ] ;
let target ;
if ( null != first ) {
const item = first . item ;
if ( null != item ) {
target = item . target ;
}
}
const uploadTarget = obj . getUploadTarget ( target ) ;
let obj2 = uploadTarget ;
if ( self . files . length > uploadTarget . getMaxAttachmentsCount ( ) ) {
const _HermesInternal2 = HermesInternal ;
2026-07-23 10:11:24 +00:00
outer2_11 . log ( "Too many attachments for " + self . id ) ;
obj = { code : outer2_9.TOO_MANY_ATTACHMENTS } ;
2026-07-20 16:05:17 +00:00
self . _handleError ( obj ) ;
return false ;
} else {
obj = { location : "UploaderBase.compressAndCheckFileSize" } ;
2026-07-23 10:11:24 +00:00
const kestrelConfig = callback ( UploaderBase [ 12 ] ) . getKestrelConfig ( obj ) ;
2026-07-20 16:05:17 +00:00
const _HermesInternal3 = HermesInternal ;
2026-07-23 10:11:24 +00:00
outer2_11 . log ( "compressing files for " + self . id ) ;
const tmp34 = outer2_12 ( self . files ) ;
2026-07-20 16:05:17 +00:00
const iter3 = tmp34 ( ) ;
let iter2 = iter3 ;
if ( ! iter3 . done ) {
const value = iter2 . value ;
yield value . reactNativeCompressAndExtractData ( ) ;
while ( true ) {
let tmp6 = value ;
if ( value . isCancelled ( ) ) {
2026-07-23 10:11:24 +00:00
let tmp13 = outer2_11 ;
2026-07-20 16:05:17 +00:00
let tmp14 = value ;
let _HermesInternal = HermesInternal ;
2026-07-23 10:11:24 +00:00
let logResult2 = outer2_11 . log ( "compressAndCheckFileSize() file has been cancelled for compression - " + value . id ) ;
2026-07-20 16:05:17 +00:00
} else {
let tmp7 = value ;
let currentSize = value . currentSize ;
let tmp8 = currentSize ;
let num = 0 ;
if ( null != currentSize ) {
num = currentSize ;
}
if ( 0 === num ) {
break ;
} else {
let tmp36 = callback ;
2026-07-23 10:11:24 +00:00
let tmp37 = UploaderBase ;
let obj11 = callback ( UploaderBase [ 12 ] ) ;
2026-07-20 16:05:17 +00:00
let tmp38 = kestrelConfig ;
let tmp39 = uploadTarget ;
let tmp40 = value ;
let effectiveKestrelLimit = obj11 . getEffectiveKestrelLimit ( kestrelConfig , obj2 . getMaxFileSize ( value . channelId ) ) ;
let currentSize2 = value . currentSize ;
let tmp42 = currentSize2 ;
let num2 = 0 ;
if ( null != currentSize2 ) {
num2 = currentSize2 ;
}
let tmp9 = effectiveKestrelLimit ;
if ( num2 > effectiveKestrelLimit ) {
let obj1 = { } ;
2026-07-23 10:11:24 +00:00
let tmp10 = outer2_9 ;
obj1 . code = outer2_9 . ENTITY_TOO_LARGE ;
2026-07-20 16:05:17 +00:00
obj2 = { } ;
2026-07-23 10:11:24 +00:00
let tmp11 = outer2_10 ;
obj2 . type = outer2_10 . POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE ;
2026-07-20 16:05:17 +00:00
obj1 . reason = obj2 ;
let _handleErrorResult1 = self . _handleError ( obj1 ) ;
let flag = false ;
return false ;
}
}
}
let tmp16 = tmp34 ;
let iter = tmp35 ( ) ;
iter2 = iter ;
}
}
2026-07-23 10:11:24 +00:00
const obj9 = callback ( UploaderBase [ 12 ] ) ;
tmp35 = tmp34 ;
2026-07-20 16:05:17 +00:00
let num3 = self . _fileSize ( ) > obj2 . getMaxTotalAttachmentSize ( ) ;
if ( num3 ) {
2026-07-23 10:11:24 +00:00
const obj3 = { code : outer2_9.ENTITY_TOO_LARGE } ;
const obj4 = { type : outer2_10 . POSTCOMPRESSION_SUM_TOO_LARGE } ;
2026-07-20 16:05:17 +00:00
obj3 . reason = obj4 ;
self . _handleError ( obj3 ) ;
num3 = 1 ;
}
return ! num3 ;
}
} ) ;
obj . value = function compressAndCheckFileSize() {
return callback2 ( . . . arguments ) ;
} ;
items [ 1 ] = obj ;
obj = {
key : "setUploadingTextForUI" ,
value() {
let files ;
let files2 ;
( { files , files : files2 } = this ) ;
const someResult = files . some ( ( isImage ) = > isImage . isImage ) ;
const _fileSizeResult = this . _fileSize ( ) ;
2026-07-23 10:11:24 +00:00
outer1_11 . log ( "setUploadingTextForUI - total content: " + _fileSizeResult + " bytes and " + this . files . length + " attachments for " + this . id ) ;
2026-07-20 16:05:17 +00:00
const obj = { } ;
const merged = Object . assign ( this . _file ) ;
obj [ "totalPostCompressionSize" ] = _fileSizeResult ;
obj [ "currentSize" ] = _fileSizeResult ;
obj [ "hasVideo" ] = files2 . some ( ( isVideo ) = > isVideo . isVideo ) ;
obj [ "hasImage" ] = someResult ;
obj [ "attachmentsCount" ] = this . files . length ;
obj [ "items" ] = this . files ;
this . _file = obj ;
}
} ;
items [ 2 ] = obj ;
items [ 3 ] = {
key : "_recomputeProgress" ,
value() {
let loaded ;
let total ;
const result = this . _recomputeProgressTotal ( ) ;
( { loaded , total } = result ) ;
this . _handleProgress ( loaded , total , this . _recomputeProgressByFile ( ) ) ;
}
} ;
items [ 4 ] = {
key : "_recomputeProgressTotal" ,
value() {
const obj = { } ;
const files = this . files ;
obj . loaded = files . reduce ( ( arg0 , loaded ) = > {
loaded = loaded . loaded ;
let num = 0 ;
if ( null != loaded ) {
num = loaded ;
}
return arg0 + num ;
} , 0 ) ;
obj . total = this . _fileSize ( ) ;
return obj ;
}
} ;
items [ 5 ] = {
key : "_recomputeProgressByFile" ,
value() {
2026-07-23 10:11:24 +00:00
let obj = { } ;
2026-07-20 16:05:17 +00:00
const files = this . files ;
const item = files . forEach ( ( id ) = > {
2026-07-23 10:11:24 +00:00
obj = obj ( UploaderBase [ 9 ] ) ;
2026-07-20 16:05:17 +00:00
obj [ id . id ] = obj . calculateProgress ( id . loaded , id . currentSize ) ;
} ) ;
return obj ;
}
} ;
items [ 6 ] = {
key : "_addAttachmentsToPayload" ,
value ( arg0 , arg1 , arg2 ) {
const merged = Object . assign ( arg0 ) ;
callback2 ( UploaderBase [ 10 ] ) ;
const items = [ . . . arg2 ] ;
return callback2 ( UploaderBase [ 10 ] ) . set ( { } , arg1 , items ) ;
}
} ;
items [ 7 ] = {
key : "clearProcessingMessageInterval" ,
value() {
const self = this ;
if ( null != this . processingMessageChangeInterval ) {
const _clearInterval = clearInterval ;
clearInterval ( self . processingMessageChangeInterval ) ;
self . processingMessageChangeInterval = undefined ;
}
}
} ;
items [ 8 ] = {
key : "cancel" ,
value() {
const self = this ;
2026-07-23 10:11:24 +00:00
outer1_11 . log ( "cancel() for " + this . id ) ;
2026-07-20 16:05:17 +00:00
if ( ! this . _aborted ) {
self . _aborted = true ;
const _cancel = self . _cancel ;
if ( null != _cancel ) {
_cancel . call ( self ) ;
}
const files = self . files ;
const item = files . forEach ( ( cancel ) = > cancel . cancel ( ) ) ;
self . _handleComplete ( ) ;
}
}
} ;
const obj7 = { key : "cancelItem" } ;
let closure_0 = callback ( async function ( arg0 ) {
const self = this ;
2026-07-23 10:11:24 +00:00
const callback = arg0 ;
outer2_11 . log ( "Cancel called for " + self . id + " for item " + arg0 ) ;
2026-07-20 16:05:17 +00:00
const files = self . files ;
2026-07-23 10:11:24 +00:00
const found = files . find ( ( id ) = > id . id === closure_0 ) ;
2026-07-20 16:05:17 +00:00
if ( null != found ) {
if ( ! found . isCancelled ( ) ) {
const files1 = self . files ;
const index = files1 . indexOf ( found ) ;
const files2 = self . files ;
const items = [ ] ;
const files3 = self . files ;
let arraySpreadResult = HermesBuiltin . arraySpread ( files2 . slice ( 0 , index ) , 0 ) ;
arraySpreadResult = HermesBuiltin . arraySpread ( files3 . slice ( index + 1 ) , arraySpreadResult ) ;
self . files = items ;
const obj = { } ;
const merged = Object . assign ( self . _file ) ;
obj [ "items" ] = self . files ;
self . _file = obj ;
2026-07-23 10:11:24 +00:00
yield callback ( UploaderBase [ 13 ] ) . cancelGetAttachmentFile ( found ) ;
2026-07-20 16:05:17 +00:00
found . cancel ( ) ;
self . emit ( "cancel-upload-item" , self . _file ) ;
if ( 0 === self . files . length ) {
self . cancel ( ) ;
}
2026-07-23 10:11:24 +00:00
const obj3 = callback ( UploaderBase [ 13 ] ) ;
2026-07-20 16:05:17 +00:00
}
}
} ) ;
obj7 . value = function cancelItem ( itemId ) {
return callback ( . . . arguments ) ;
} ;
items [ 9 ] = obj7 ;
items [ 10 ] = {
key : "upload" ,
value ( items ) {
const self = this ;
if ( null != this . _cancel ) {
const _Error = Error ;
const error = new Error ( "Uploader.upload(...): An upload is already in progress." ) ;
throw error ;
} else {
const _Date = Date ;
self . _lastUpdate = Date . now ( ) ;
self . _loaded = 0 ;
2026-07-23 10:11:24 +00:00
const obj = { id : self.id , currentSize : 0 , totalPreCompressionSize : 0 , compressionProgress : 0 , progress : 0 , rate : 0 , hasImage : false , hasVideo : false , attachmentsCount : 0 , items } ;
2026-07-20 16:05:17 +00:00
self . _file = obj ;
}
}
} ;
return callback2 ( UploaderBase , items ) ;
2026-07-23 10:11:24 +00:00
} ) ( require ( "EventEmitter" ) . EventEmitter ) ;
let result = require ( "_defineProperties" ) . fileFinishedImporting ( "lib/uploader/UploaderBase.tsx" ) ;
2026-07-20 16:05:17 +00:00
export default tmp4 ;