








#import "BoxFadeLogoTwo.h"

#define NetSurfaceCar self.frame.size.width

@interface BoxFadeLogoTwo()



@property (nonatomic, strong) NSMutableArray                            *binSentArray;



@property (nonatomic, strong) NSMutableArray <TelephoneStateCell *>      *linkArray;



@property (strong, nonatomic) NSMutableArray <TelephoneStateCell *>      *breakingType;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) CutterLineLegalUnifyEvery                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   dueBox;

@end

@implementation BoxFadeLogoTwo

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

- (void)alongWasFoot
{
    
    if (self.linkArray.firstObject) {
        
        
        TelephoneStateCell *oldSlabView = self.linkArray.firstObject;
        
        oldSlabView.frame = CGRectMake(NetSurfaceCar, 0, oldSlabView.lostItsSize.width, oldSlabView.lostItsSize.height);
        
        self.dueBox = oldSlabView.dueBox;
        
        self.channelCount = oldSlabView.channelCount;
        
        
        NSInteger row = [self enumerateFavoritesQueueEscapingAutoDeclineDegraded:oldSlabView];
        
        
        if (row >= 0) {
            
            
            [self.linkArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:oldSlabView]) {
                [self addSubview:oldSlabView];
            }
            oldSlabView.frame = CGRectMake(NetSurfaceCar,  row * (oldSlabView.lostItsSize.height + _dueBox), oldSlabView.lostItsSize.width, oldSlabView.lostItsSize.height);
            
            
            [_binSentArray setObject:oldSlabView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(finnishDatumView:willDisplayCell:)]) {
                [self.delegate finnishDatumView:self willDisplayCell:oldSlabView];
            }
            
            
            [self.breakingType addObject:oldSlabView];
            
            [oldSlabView cloudyEventualEnablingSlovenianLexicon:^{
                
                
                [oldSlabView setTransform:CGAffineTransformMakeTranslation(- oldSlabView.frame.size.width-NetSurfaceCar, 0)];
                
            } completion:^(BOOL finished) {
                
                [oldSlabView removeFromSuperview];
                
                
                [self.breakingType removeObject:oldSlabView];
                
                
                if ([self.delegate respondsToSelector:@selector(finnishDatumView:didEndDisplayingCell:)]) {
                    [self.delegate finnishDatumView:self didEndDisplayingCell:oldSlabView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(physicalRecipientIndexArabicAutomaticSecurityMethodDuplex:)]) {
                        [self.delegate physicalRecipientIndexArabicAutomaticSecurityMethodDuplex:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)panRowRuleFair:(NSArray <TelephoneStateCell *> *)barrages
{
    self.count += barrages.count;
    [self.linkArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == PhraseTabSquashPlainFloaterHuman) {
        return;
    }
    self.status = PhraseTabSquashPlainFloaterHuman;
    
    if (self.breakingType.count) {
        [self.breakingType makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.linkArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.breakingType  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.breakingType  removeAllObjects];
    [self.linkArray     removeAllObjects];
    [self.binSentArray  removeAllObjects];
    
    self.breakingType       = nil;
    self.linkArray          = nil;
    self.binSentArray       = nil;
}


- (NSInteger)enumerateFavoritesQueueEscapingAutoDeclineDegraded:(TelephoneStateCell *)newBarrage
{
    for (int row = 0; row<_binSentArray.count; row++) {
        NSObject *object = _binSentArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[TelephoneStateCell class]]) { 
            
            TelephoneStateCell *hundredTop = (TelephoneStateCell*)object;
            
            if ([self enumerateFavoritesQueueEscapingAutoDeclineDegraded:hundredTop execution:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)enumerateFavoritesQueueEscapingAutoDeclineDegraded:(TelephoneStateCell *)hundredTop execution:(TelephoneStateCell *)newBarrage
{
    
    if (hundredTop.status == KilohertzRelativeCrossGatewaysTimeTickets) {
        return NO;
    }
    
    
    CGRect rect = [hundredTop.layer.presentationLayer frame];
    if (rect.origin.x>NetSurfaceCar - hundredTop.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (hundredTop.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = NetSurfaceCar/(NetSurfaceCar+newBarrage.frame.size.width)*newBarrage.semicolonAsk;
        
        CGFloat slow = rect.origin.x - time/(hundredTop.semicolonAsk)*(NetSurfaceCar + hundredTop.frame.size.width);
        if (slow < -hundredTop.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *segue = [touches anyObject];
    CGPoint fixMoveMan  = [segue locationInView:self];
    for (UIView *atomWax in [self subviews])
    {
        if (![atomWax isKindOfClass:[TelephoneStateCell class]]) continue;
        TelephoneStateCell *oldSlabView = (TelephoneStateCell *)atomWax;
        if ([oldSlabView.layer.presentationLayer hitTest:fixMoveMan])
        {
            
            if ([self.delegate respondsToSelector:@selector(finnishDatumView:malayBottomCell:)]) {
                [self.delegate finnishDatumView:self malayBottomCell:oldSlabView];
            }
            break;
        }
    }
}




- (NSMutableArray<TelephoneStateCell *> *)linkArray {
    if (!_linkArray) {
        _linkArray = [[NSMutableArray alloc] init];
    }
    return _linkArray;
}


- (NSMutableArray<TelephoneStateCell *> *)breakingType {
    if (!_breakingType) {
        _breakingType = [[NSMutableArray alloc] init];
    }
    return _breakingType;
}


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


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

@end
