








#import "BackupComposer.h"

#define PeakRedoLeaky self.frame.size.width

@interface BackupComposer()



@property (nonatomic, strong) NSMutableArray                            *sameFitArray;



@property (nonatomic, strong) NSMutableArray <RecentlyOnlineCell *>      *moodArray;



@property (strong, nonatomic) NSMutableArray <RecentlyOnlineCell *>      *weightsScene;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) AuditMinderReuseAnswerWrite                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   optAll;

@end

@implementation BackupComposer

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.status = UnfocusedTimeBoldChromiumDarkerFinish;
    }
    return self;
}

- (void)firstHusband
{
    
    if (self.moodArray.firstObject) {
        
        
        RecentlyOnlineCell *pendingView = self.moodArray.firstObject;
        
        pendingView.frame = CGRectMake(PeakRedoLeaky, 0, pendingView.hostingSize.width, pendingView.hostingSize.height);
        
        self.optAll = pendingView.optAll;
        
        self.channelCount = pendingView.channelCount;
        
        
        NSInteger row = [self pongTwoFloatingChangeBrandHeadAscending:pendingView];
        
        
        if (row >= 0) {
            
            
            [self.moodArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:pendingView]) {
                [self addSubview:pendingView];
            }
            pendingView.frame = CGRectMake(PeakRedoLeaky,  row * (pendingView.hostingSize.height + _optAll), pendingView.hostingSize.width, pendingView.hostingSize.height);
            
            
            [_sameFitArray setObject:pendingView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(icyUnlockKeyView:willDisplayCell:)]) {
                [self.delegate icyUnlockKeyView:self willDisplayCell:pendingView];
            }
            
            
            [self.weightsScene addObject:pendingView];
            
            [pendingView illIntrinsicScalingMagnesiumBody:^{
                
                
                [pendingView setTransform:CGAffineTransformMakeTranslation(- pendingView.frame.size.width-PeakRedoLeaky, 0)];
                
            } completion:^(BOOL finished) {
                
                [pendingView removeFromSuperview];
                
                
                [self.weightsScene removeObject:pendingView];
                
                
                if ([self.delegate respondsToSelector:@selector(icyUnlockKeyView:didEndDisplayingCell:)]) {
                    [self.delegate icyUnlockKeyView:self didEndDisplayingCell:pendingView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(partlyYoungestAddressLayeringStrictFlowManagerCancels:)]) {
                        [self.delegate partlyYoungestAddressLayeringStrictFlowManagerCancels:self];
                    }
                    self.count = 0;
                }
                
                

            }];
        }
    }
    
    [self performSelector:@selector(firstHusband) withObject:nil afterDelay:0.45f];
}


- (void)tagalogMeasure:(NSArray <RecentlyOnlineCell *> *)barrages
{
    self.count += barrages.count;
    [self.moodArray addObjectsFromArray:barrages];
}

- (void)start
{
    if (self.status == BestSuccessGopherDroppedSummaryReliable) {
        return;
    }
    self.status = BestSuccessGopherDroppedSummaryReliable;
    
    [self firstHusband];
}

- (void)stop
{
    if (self.status == UnfocusedTimeBoldChromiumDarkerFinish) {
        return;
    }
    self.status = UnfocusedTimeBoldChromiumDarkerFinish;
    
    if (self.weightsScene.count) {
        [self.weightsScene makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.moodArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.weightsScene  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.weightsScene  removeAllObjects];
    [self.moodArray     removeAllObjects];
    [self.sameFitArray  removeAllObjects];
    
    self.weightsScene       = nil;
    self.moodArray          = nil;
    self.sameFitArray       = nil;
}


- (NSInteger)pongTwoFloatingChangeBrandHeadAscending:(RecentlyOnlineCell *)newBarrage
{
    for (int row = 0; row<_sameFitArray.count; row++) {
        NSObject *object = _sameFitArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[RecentlyOnlineCell class]]) { 
            
            RecentlyOnlineCell *radioOuter = (RecentlyOnlineCell*)object;
            
            if ([self pongTwoFloatingChangeBrandHeadAscending:radioOuter universal:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)pongTwoFloatingChangeBrandHeadAscending:(RecentlyOnlineCell *)radioOuter universal:(RecentlyOnlineCell *)newBarrage
{
    
    if (radioOuter.status == EitherBasalEmbeddedTouchesPaddleBig) {
        return NO;
    }
    
    
    CGRect rect = [radioOuter.layer.presentationLayer frame];
    if (rect.origin.x>PeakRedoLeaky - radioOuter.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (radioOuter.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = PeakRedoLeaky/(PeakRedoLeaky+newBarrage.frame.size.width)*newBarrage.bigLeastRing;
        
        CGFloat fork = rect.origin.x - time/(radioOuter.bigLeastRing)*(PeakRedoLeaky + radioOuter.frame.size.width);
        if (fork < -radioOuter.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *trial = [touches anyObject];
    CGPoint artEraKnow  = [trial locationInView:self];
    for (RecentlyOnlineCell *pendingView in [self subviews])
    {
        if ([pendingView.layer.presentationLayer hitTest:artEraKnow])
        {
            
            if ([self.delegate respondsToSelector:@selector(icyUnlockKeyView:fixWinCleanCell:)]) {
                [self.delegate icyUnlockKeyView:self fixWinCleanCell:pendingView];
            }
            break;
        }
    }
}




- (NSMutableArray<RecentlyOnlineCell *> *)moodArray {
    if (!_moodArray) {
        _moodArray = [[NSMutableArray alloc] init];
    }
    return _moodArray;
}


- (NSMutableArray<RecentlyOnlineCell *> *)weightsScene {
    if (!_weightsScene) {
        _weightsScene = [[NSMutableArray alloc] init];
    }
    return _weightsScene;
}


- (void)setChannelCount:(NSInteger)channelCount
{
    
    if (self.sameFitArray.count < channelCount) { 
        
        for (NSInteger row = self.sameFitArray.count; row < channelCount; row++) {
            NSNumber *number = [NSNumber numberWithBool:YES];
            [self.sameFitArray setObject:number atIndexedSubscript:row];
        }
        
    }else {
        
        for (NSInteger row = channelCount; row < self.sameFitArray.count; row++) {
            [self.sameFitArray removeObjectAtIndex:row];
        }
    }
    
    _channelCount = channelCount;
    
}


- (NSMutableArray *)sameFitArray {
    if (!_sameFitArray) {
        _sameFitArray = [[NSMutableArray alloc] init];
    }
    return _sameFitArray;
}

@end
