








#import "EarArmSmileAll.h"

#define ClampedExtend self.frame.size.width

@interface EarArmSmileAll()



@property (nonatomic, strong) NSMutableArray                            *kinFullArray;



@property (nonatomic, strong) NSMutableArray <MaxLineOneWrapCell *>      *zoneArray;



@property (strong, nonatomic) NSMutableArray <MaxLineOneWrapCell *>      *sixRollAlien;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) ConfigureLossRelayDesiredWarning                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   lambda;

@end

@implementation EarArmSmileAll

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

- (void)endsLowDelta
{
    
    if (self.zoneArray.firstObject) {
        
        
        MaxLineOneWrapCell *tipFlatView = self.zoneArray.firstObject;
        
        tipFlatView.frame = CGRectMake(ClampedExtend, 0, tipFlatView.manSnowSize.width, tipFlatView.manSnowSize.height);
        
        self.lambda = tipFlatView.lambda;
        
        self.channelCount = tipFlatView.channelCount;
        
        
        NSInteger row = [self yetBestDownloadsStylusPageOutlineAudited:tipFlatView];
        
        
        if (row >= 0) {
            
            
            [self.zoneArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:tipFlatView]) {
                [self addSubview:tipFlatView];
            }
            tipFlatView.frame = CGRectMake(ClampedExtend,  row * (tipFlatView.manSnowSize.height + _lambda), tipFlatView.manSnowSize.width, tipFlatView.manSnowSize.height);
            
            
            [_kinFullArray setObject:tipFlatView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(algorithmSeeView:willDisplayCell:)]) {
                [self.delegate algorithmSeeView:self willDisplayCell:tipFlatView];
            }
            
            
            [self.sixRollAlien addObject:tipFlatView];
            
            [tipFlatView existingCadencePressedCyrillicProfiles:^{
                
                
                [tipFlatView setTransform:CGAffineTransformMakeTranslation(- tipFlatView.frame.size.width-ClampedExtend, 0)];
                
            } completion:^(BOOL finished) {
                
                [tipFlatView removeFromSuperview];
                
                
                [self.sixRollAlien removeObject:tipFlatView];
                
                
                if ([self.delegate respondsToSelector:@selector(algorithmSeeView:didEndDisplayingCell:)]) {
                    [self.delegate algorithmSeeView:self didEndDisplayingCell:tipFlatView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(renderRoundExtractFullRemoveAlignmentParserSex:)]) {
                        [self.delegate renderRoundExtractFullRemoveAlignmentParserSex:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)familyBreaking:(NSArray <MaxLineOneWrapCell *> *)barrages
{
    self.count += barrages.count;
    [self.zoneArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == BriefExceptionShortcutEmailZeroLappish) {
        return;
    }
    self.status = BriefExceptionShortcutEmailZeroLappish;
    
    if (self.sixRollAlien.count) {
        [self.sixRollAlien makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.zoneArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.sixRollAlien  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.sixRollAlien  removeAllObjects];
    [self.zoneArray     removeAllObjects];
    [self.kinFullArray  removeAllObjects];
    
    self.sixRollAlien       = nil;
    self.zoneArray          = nil;
    self.kinFullArray       = nil;
}


- (NSInteger)yetBestDownloadsStylusPageOutlineAudited:(MaxLineOneWrapCell *)newBarrage
{
    for (int row = 0; row<_kinFullArray.count; row++) {
        NSObject *object = _kinFullArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[MaxLineOneWrapCell class]]) { 
            
            MaxLineOneWrapCell *hueBusPush = (MaxLineOneWrapCell*)object;
            
            if ([self yetBestDownloadsStylusPageOutlineAudited:hueBusPush airExpect:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)yetBestDownloadsStylusPageOutlineAudited:(MaxLineOneWrapCell *)hueBusPush airExpect:(MaxLineOneWrapCell *)newBarrage
{
    
    if (hueBusPush.status == ImproperUniformResponderCellFollowCarrier) {
        return NO;
    }
    
    
    CGRect rect = [hueBusPush.layer.presentationLayer frame];
    if (rect.origin.x>ClampedExtend - hueBusPush.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (hueBusPush.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = ClampedExtend/(ClampedExtend+newBarrage.frame.size.width)*newBarrage.addressesFar;
        
        CGFloat soft = rect.origin.x - time/(hueBusPush.addressesFar)*(ClampedExtend + hueBusPush.frame.size.width);
        if (soft < -hueBusPush.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *mouse = [touches anyObject];
    CGPoint morePrefix  = [mouse locationInView:self];
    for (UIView *tapSend in [self subviews])
    {
        if (![tapSend isKindOfClass:[MaxLineOneWrapCell class]]) continue;
        MaxLineOneWrapCell *tipFlatView = (MaxLineOneWrapCell *)tapSend;
        if ([tipFlatView.layer.presentationLayer hitTest:morePrefix])
        {
            
            if ([self.delegate respondsToSelector:@selector(algorithmSeeView:routerCurveCell:)]) {
                [self.delegate algorithmSeeView:self routerCurveCell:tipFlatView];
            }
            break;
        }
    }
}




- (NSMutableArray<MaxLineOneWrapCell *> *)zoneArray {
    if (!_zoneArray) {
        _zoneArray = [[NSMutableArray alloc] init];
    }
    return _zoneArray;
}


- (NSMutableArray<MaxLineOneWrapCell *> *)sixRollAlien {
    if (!_sixRollAlien) {
        _sixRollAlien = [[NSMutableArray alloc] init];
    }
    return _sixRollAlien;
}


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


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

@end
