








#import "LoveSuddenCurl.h"

#define ArmForLateNot self.frame.size.width

@interface LoveSuddenCurl()



@property (nonatomic, strong) NSMutableArray                            *cupLoopArray;



@property (nonatomic, strong) NSMutableArray <BinNearCaseOptCell *>      *planArray;



@property (strong, nonatomic) NSMutableArray <BinNearCaseOptCell *>      *eggSingleAge;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) WeightAirlinePingPointFriends                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   somali;

@end

@implementation LoveSuddenCurl

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

- (void)turkmenThick
{
    
    if (self.planArray.firstObject) {
        
        
        BinNearCaseOptCell *productView = self.planArray.firstObject;
        
        productView.frame = CGRectMake(ArmForLateNot, 0, productView.outBestSize.width, productView.outBestSize.height);
        
        self.somali = productView.somali;
        
        self.channelCount = productView.channelCount;
        
        
        NSInteger row = [self tabIndicatorValueReusablePrefixesTallWrap:productView];
        
        
        if (row >= 0) {
            
            
            [self.planArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:productView]) {
                [self addSubview:productView];
            }
            productView.frame = CGRectMake(ArmForLateNot,  row * (productView.outBestSize.height + _somali), productView.outBestSize.width, productView.outBestSize.height);
            
            
            [_cupLoopArray setObject:productView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(regionsLimitView:willDisplayCell:)]) {
                [self.delegate regionsLimitView:self willDisplayCell:productView];
            }
            
            
            [self.eggSingleAge addObject:productView];
            
            [productView tapEraSheSixExact:^{
                
                
                [productView setTransform:CGAffineTransformMakeTranslation(- productView.frame.size.width-ArmForLateNot, 0)];
                
            } completion:^(BOOL finished) {
                
                [productView removeFromSuperview];
                
                
                [self.eggSingleAge removeObject:productView];
                
                
                if ([self.delegate respondsToSelector:@selector(regionsLimitView:didEndDisplayingCell:)]) {
                    [self.delegate regionsLimitView:self didEndDisplayingCell:productView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(limitedCounterDiscoverBodyProvidedDropCalculateAmpere:)]) {
                        [self.delegate limitedCounterDiscoverBodyProvidedDropCalculateAmpere:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)nothingRemoval:(NSArray <BinNearCaseOptCell *> *)barrages
{
    self.count += barrages.count;
    [self.planArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == OptionHourlyMouthBoundaryNegotiateLowercase) {
        return;
    }
    self.status = OptionHourlyMouthBoundaryNegotiateLowercase;
    
    if (self.eggSingleAge.count) {
        [self.eggSingleAge makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.planArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.eggSingleAge  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.eggSingleAge  removeAllObjects];
    [self.planArray     removeAllObjects];
    [self.cupLoopArray  removeAllObjects];
    
    self.eggSingleAge       = nil;
    self.planArray          = nil;
    self.cupLoopArray       = nil;
}


- (NSInteger)tabIndicatorValueReusablePrefixesTallWrap:(BinNearCaseOptCell *)newBarrage
{
    for (int row = 0; row<_cupLoopArray.count; row++) {
        NSObject *object = _cupLoopArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[BinNearCaseOptCell class]]) { 
            
            BinNearCaseOptCell *sentString = (BinNearCaseOptCell*)object;
            
            if ([self tabIndicatorValueReusablePrefixesTallWrap:sentString zipUplink:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)tabIndicatorValueReusablePrefixesTallWrap:(BinNearCaseOptCell *)sentString zipUplink:(BinNearCaseOptCell *)newBarrage
{
    
    if (sentString.status == FactoriesAnchorLaunchingBezelAmharicSound) {
        return NO;
    }
    
    
    CGRect rect = [sentString.layer.presentationLayer frame];
    if (rect.origin.x>ArmForLateNot - sentString.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (sentString.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = ArmForLateNot/(ArmForLateNot+newBarrage.frame.size.width)*newBarrage.funWhiteSlow;
        
        CGFloat take = rect.origin.x - time/(sentString.funWhiteSlow)*(ArmForLateNot + sentString.frame.size.width);
        if (take < -sentString.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *spell = [touches anyObject];
    CGPoint armpitBlur  = [spell locationInView:self];
    for (UIView *volumes in [self subviews])
    {
        if (![volumes isKindOfClass:[BinNearCaseOptCell class]]) continue;
        BinNearCaseOptCell *productView = (BinNearCaseOptCell *)volumes;
        if ([productView.layer.presentationLayer hitTest:armpitBlur])
        {
            
            if ([self.delegate respondsToSelector:@selector(regionsLimitView:fiveIdleManCell:)]) {
                [self.delegate regionsLimitView:self fiveIdleManCell:productView];
            }
            break;
        }
    }
}




- (NSMutableArray<BinNearCaseOptCell *> *)planArray {
    if (!_planArray) {
        _planArray = [[NSMutableArray alloc] init];
    }
    return _planArray;
}


- (NSMutableArray<BinNearCaseOptCell *> *)eggSingleAge {
    if (!_eggSingleAge) {
        _eggSingleAge = [[NSMutableArray alloc] init];
    }
    return _eggSingleAge;
}


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


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

@end
