








#import "PopMapSixImage.h"

#define EarDrumBinRun self.frame.size.width

@interface PopMapSixImage()



@property (nonatomic, strong) NSMutableArray                            *outlineArray;



@property (nonatomic, strong) NSMutableArray <SerifMaskHindiCell *>      *endsArray;



@property (strong, nonatomic) NSMutableArray <SerifMaskHindiCell *>      *tatarCupLogo;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) MakeClangBrushGenerateGlobal                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   runAnd;

@end

@implementation PopMapSixImage

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

- (void)accordingCap
{
    
    if (self.endsArray.firstObject) {
        
        
        SerifMaskHindiCell *homeAddView = self.endsArray.firstObject;
        
        homeAddView.frame = CGRectMake(EarDrumBinRun, 0, homeAddView.tibetanSize.width, homeAddView.tibetanSize.height);
        
        self.runAnd = homeAddView.runAnd;
        
        self.channelCount = homeAddView.channelCount;
        
        
        NSInteger row = [self wonEntrySecurelyInvitedComposerTreeOther:homeAddView];
        
        
        if (row >= 0) {
            
            
            [self.endsArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:homeAddView]) {
                [self addSubview:homeAddView];
            }
            homeAddView.frame = CGRectMake(EarDrumBinRun,  row * (homeAddView.tibetanSize.height + _runAnd), homeAddView.tibetanSize.width, homeAddView.tibetanSize.height);
            
            
            [_outlineArray setObject:homeAddView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(parsecsEjectView:willDisplayCell:)]) {
                [self.delegate parsecsEjectView:self willDisplayCell:homeAddView];
            }
            
            
            [self.tatarCupLogo addObject:homeAddView];
            
            [homeAddView movieForkSecureCheckerSpecified:^{
                
                
                [homeAddView setTransform:CGAffineTransformMakeTranslation(- homeAddView.frame.size.width-EarDrumBinRun, 0)];
                
            } completion:^(BOOL finished) {
                
                [homeAddView removeFromSuperview];
                
                
                [self.tatarCupLogo removeObject:homeAddView];
                
                
                if ([self.delegate respondsToSelector:@selector(parsecsEjectView:didEndDisplayingCell:)]) {
                    [self.delegate parsecsEjectView:self didEndDisplayingCell:homeAddView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(ropeSunRotatePushOutletComponentOriginalBracketed:)]) {
                        [self.delegate ropeSunRotatePushOutletComponentOriginalBracketed:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)secureProducts:(NSArray <SerifMaskHindiCell *> *)barrages
{
    self.count += barrages.count;
    [self.endsArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == OwnPaperFaxMinimumMagnesiumRunning) {
        return;
    }
    self.status = OwnPaperFaxMinimumMagnesiumRunning;
    
    if (self.tatarCupLogo.count) {
        [self.tatarCupLogo makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.endsArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.tatarCupLogo  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.tatarCupLogo  removeAllObjects];
    [self.endsArray     removeAllObjects];
    [self.outlineArray  removeAllObjects];
    
    self.tatarCupLogo       = nil;
    self.endsArray          = nil;
    self.outlineArray       = nil;
}


- (NSInteger)wonEntrySecurelyInvitedComposerTreeOther:(SerifMaskHindiCell *)newBarrage
{
    for (int row = 0; row<_outlineArray.count; row++) {
        NSObject *object = _outlineArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[SerifMaskHindiCell class]]) { 
            
            SerifMaskHindiCell *nodeLaunch = (SerifMaskHindiCell*)object;
            
            if ([self wonEntrySecurelyInvitedComposerTreeOther:nodeLaunch serifDash:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)wonEntrySecurelyInvitedComposerTreeOther:(SerifMaskHindiCell *)nodeLaunch serifDash:(SerifMaskHindiCell *)newBarrage
{
    
    if (nodeLaunch.status == BusyTightFormCopperMastersPrecision) {
        return NO;
    }
    
    
    CGRect rect = [nodeLaunch.layer.presentationLayer frame];
    if (rect.origin.x>EarDrumBinRun - nodeLaunch.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (nodeLaunch.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = EarDrumBinRun/(EarDrumBinRun+newBarrage.frame.size.width)*newBarrage.remotelyPull;
        
        CGFloat snap = rect.origin.x - time/(nodeLaunch.remotelyPull)*(EarDrumBinRun + nodeLaunch.frame.size.width);
        if (snap < -nodeLaunch.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *radix = [touches anyObject];
    CGPoint wetTagTurn  = [radix locationInView:self];
    for (UIView *optUndo in [self subviews])
    {
        if (![optUndo isKindOfClass:[SerifMaskHindiCell class]]) continue;
        SerifMaskHindiCell *homeAddView = (SerifMaskHindiCell *)optUndo;
        if ([homeAddView.layer.presentationLayer hitTest:wetTagTurn])
        {
            
            if ([self.delegate respondsToSelector:@selector(parsecsEjectView:handVisitorCell:)]) {
                [self.delegate parsecsEjectView:self handVisitorCell:homeAddView];
            }
            break;
        }
    }
}




- (NSMutableArray<SerifMaskHindiCell *> *)endsArray {
    if (!_endsArray) {
        _endsArray = [[NSMutableArray alloc] init];
    }
    return _endsArray;
}


- (NSMutableArray<SerifMaskHindiCell *> *)tatarCupLogo {
    if (!_tatarCupLogo) {
        _tatarCupLogo = [[NSMutableArray alloc] init];
    }
    return _tatarCupLogo;
}


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


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

@end
