








#import "RollbackGender.h"

#define SeeBigIndexed self.frame.size.width

@interface RollbackGender()



@property (nonatomic, strong) NSMutableArray                            *falloffArray;



@property (nonatomic, strong) NSMutableArray <StopLostSliderCell *>      *saveArray;



@property (strong, nonatomic) NSMutableArray <StopLostSliderCell *>      *leadRecorded;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) SequenceBeatFunKilobitsSubtract                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   soccer;

@end

@implementation RollbackGender

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

- (void)twoStiffness
{
    
    if (self.saveArray.firstObject) {
        
        
        StopLostSliderCell *highestView = self.saveArray.firstObject;
        
        highestView.frame = CGRectMake(SeeBigIndexed, 0, highestView.repeatsSize.width, highestView.repeatsSize.height);
        
        self.soccer = highestView.soccer;
        
        self.channelCount = highestView.channelCount;
        
        
        NSInteger row = [self preservedPrimeTwoOwnerDetailSayPin:highestView];
        
        
        if (row >= 0) {
            
            
            [self.saveArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:highestView]) {
                [self addSubview:highestView];
            }
            highestView.frame = CGRectMake(SeeBigIndexed,  row * (highestView.repeatsSize.height + _soccer), highestView.repeatsSize.width, highestView.repeatsSize.height);
            
            
            [_falloffArray setObject:highestView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(capLessClickView:willDisplayCell:)]) {
                [self.delegate capLessClickView:self willDisplayCell:highestView];
            }
            
            
            [self.leadRecorded addObject:highestView];
            
            [highestView shiftCloudCropMarkupQuantity:^{
                
                
                [highestView setTransform:CGAffineTransformMakeTranslation(- highestView.frame.size.width-SeeBigIndexed, 0)];
                
            } completion:^(BOOL finished) {
                
                [highestView removeFromSuperview];
                
                
                [self.leadRecorded removeObject:highestView];
                
                
                if ([self.delegate respondsToSelector:@selector(capLessClickView:didEndDisplayingCell:)]) {
                    [self.delegate capLessClickView:self didEndDisplayingCell:highestView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(kirghizThresholdTraitMethodCanIntentCubicPin:)]) {
                        [self.delegate kirghizThresholdTraitMethodCanIntentCubicPin:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)themeBitBitAsk:(NSArray <StopLostSliderCell *> *)barrages
{
    self.count += barrages.count;
    [self.saveArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == MalformedEsperantoObservingChinaValuePencil) {
        return;
    }
    self.status = MalformedEsperantoObservingChinaValuePencil;
    
    if (self.leadRecorded.count) {
        [self.leadRecorded makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.saveArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.leadRecorded  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.leadRecorded  removeAllObjects];
    [self.saveArray     removeAllObjects];
    [self.falloffArray  removeAllObjects];
    
    self.leadRecorded       = nil;
    self.saveArray          = nil;
    self.falloffArray       = nil;
}


- (NSInteger)preservedPrimeTwoOwnerDetailSayPin:(StopLostSliderCell *)newBarrage
{
    for (int row = 0; row<_falloffArray.count; row++) {
        NSObject *object = _falloffArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[StopLostSliderCell class]]) { 
            
            StopLostSliderCell *sphereNeed = (StopLostSliderCell*)object;
            
            if ([self preservedPrimeTwoOwnerDetailSayPin:sphereNeed paceThird:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)preservedPrimeTwoOwnerDetailSayPin:(StopLostSliderCell *)sphereNeed paceThird:(StopLostSliderCell *)newBarrage
{
    
    if (sphereNeed.status == AreaFactorySceneChromiumHindiMismatch) {
        return NO;
    }
    
    
    CGRect rect = [sphereNeed.layer.presentationLayer frame];
    if (rect.origin.x>SeeBigIndexed - sphereNeed.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (sphereNeed.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = SeeBigIndexed/(SeeBigIndexed+newBarrage.frame.size.width)*newBarrage.shadowChroma;
        
        CGFloat chat = rect.origin.x - time/(sphereNeed.shadowChroma)*(SeeBigIndexed + sphereNeed.frame.size.width);
        if (chat < -sphereNeed.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *outer = [touches anyObject];
    CGPoint openWeekly  = [outer locationInView:self];
    for (UIView *logDrum in [self subviews])
    {
        if (![logDrum isKindOfClass:[StopLostSliderCell class]]) continue;
        StopLostSliderCell *highestView = (StopLostSliderCell *)logDrum;
        if ([highestView.layer.presentationLayer hitTest:openWeekly])
        {
            
            if ([self.delegate respondsToSelector:@selector(capLessClickView:exceedsFoldCell:)]) {
                [self.delegate capLessClickView:self exceedsFoldCell:highestView];
            }
            break;
        }
    }
}




- (NSMutableArray<StopLostSliderCell *> *)saveArray {
    if (!_saveArray) {
        _saveArray = [[NSMutableArray alloc] init];
    }
    return _saveArray;
}


- (NSMutableArray<StopLostSliderCell *> *)leadRecorded {
    if (!_leadRecorded) {
        _leadRecorded = [[NSMutableArray alloc] init];
    }
    return _leadRecorded;
}


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


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

@end
