








#import "InnerRecipient.h"

#define SheModelStamp self.frame.size.width

@interface InnerRecipient()



@property (nonatomic, strong) NSMutableArray                            *dayBookArray;



@property (nonatomic, strong) NSMutableArray <PhasePingTokenCell *>      *logoArray;



@property (strong, nonatomic) NSMutableArray <PhasePingTokenCell *>      *uniformCover;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) UnwindingCaffeineBoxProvidingKilogram                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   browse;

@end

@implementation InnerRecipient

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

- (void)hostingEmail
{
    
    if (self.logoArray.firstObject) {
        
        
        PhasePingTokenCell *gravityView = self.logoArray.firstObject;
        
        gravityView.frame = CGRectMake(SheModelStamp, 0, gravityView.plusTenSize.width, gravityView.plusTenSize.height);
        
        self.browse = gravityView.browse;
        
        self.channelCount = gravityView.channelCount;
        
        
        NSInteger row = [self hiddenCityOverrideBaseballChinaGenericRole:gravityView];
        
        
        if (row >= 0) {
            
            
            [self.logoArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:gravityView]) {
                [self addSubview:gravityView];
            }
            gravityView.frame = CGRectMake(SheModelStamp,  row * (gravityView.plusTenSize.height + _browse), gravityView.plusTenSize.width, gravityView.plusTenSize.height);
            
            
            [_dayBookArray setObject:gravityView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(popCenteringView:willDisplayCell:)]) {
                [self.delegate popCenteringView:self willDisplayCell:gravityView];
            }
            
            
            [self.uniformCover addObject:gravityView];
            
            [gravityView pullTaskExtendTwentyAnchors:^{
                
                
                [gravityView setTransform:CGAffineTransformMakeTranslation(- gravityView.frame.size.width-SheModelStamp, 0)];
                
            } completion:^(BOOL finished) {
                
                [gravityView removeFromSuperview];
                
                
                [self.uniformCover removeObject:gravityView];
                
                
                if ([self.delegate respondsToSelector:@selector(popCenteringView:didEndDisplayingCell:)]) {
                    [self.delegate popCenteringView:self didEndDisplayingCell:gravityView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(herRedoneSinExceedsSchemeEyeEverySwipe:)]) {
                        [self.delegate herRedoneSinExceedsSchemeEyeEverySwipe:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)undoAssumeTemp:(NSArray <PhasePingTokenCell *> *)barrages
{
    self.count += barrages.count;
    [self.logoArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == StakePassDeepFunnelUnpluggedNear) {
        return;
    }
    self.status = StakePassDeepFunnelUnpluggedNear;
    
    if (self.uniformCover.count) {
        [self.uniformCover makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.logoArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.uniformCover  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.uniformCover  removeAllObjects];
    [self.logoArray     removeAllObjects];
    [self.dayBookArray  removeAllObjects];
    
    self.uniformCover       = nil;
    self.logoArray          = nil;
    self.dayBookArray       = nil;
}


- (NSInteger)hiddenCityOverrideBaseballChinaGenericRole:(PhasePingTokenCell *)newBarrage
{
    for (int row = 0; row<_dayBookArray.count; row++) {
        NSObject *object = _dayBookArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[PhasePingTokenCell class]]) { 
            
            PhasePingTokenCell *creditsSin = (PhasePingTokenCell*)object;
            
            if ([self hiddenCityOverrideBaseballChinaGenericRole:creditsSin hostSetup:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)hiddenCityOverrideBaseballChinaGenericRole:(PhasePingTokenCell *)creditsSin hostSetup:(PhasePingTokenCell *)newBarrage
{
    
    if (creditsSin.status == ExpectingMovieSpringCleanKinGopher) {
        return NO;
    }
    
    
    CGRect rect = [creditsSin.layer.presentationLayer frame];
    if (rect.origin.x>SheModelStamp - creditsSin.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (creditsSin.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = SheModelStamp/(SheModelStamp+newBarrage.frame.size.width)*newBarrage.mileRedVideo;
        
        CGFloat hall = rect.origin.x - time/(creditsSin.mileRedVideo)*(SheModelStamp + creditsSin.frame.size.width);
        if (hall < -creditsSin.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *vowel = [touches anyObject];
    CGPoint strictSite  = [vowel locationInView:self];
    for (UIView *readSex in [self subviews])
    {
        if (![readSex isKindOfClass:[PhasePingTokenCell class]]) continue;
        PhasePingTokenCell *gravityView = (PhasePingTokenCell *)readSex;
        if ([gravityView.layer.presentationLayer hitTest:strictSite])
        {
            
            if ([self.delegate respondsToSelector:@selector(popCenteringView:saltMathSexCell:)]) {
                [self.delegate popCenteringView:self saltMathSexCell:gravityView];
            }
            break;
        }
    }
}




- (NSMutableArray<PhasePingTokenCell *> *)logoArray {
    if (!_logoArray) {
        _logoArray = [[NSMutableArray alloc] init];
    }
    return _logoArray;
}


- (NSMutableArray<PhasePingTokenCell *> *)uniformCover {
    if (!_uniformCover) {
        _uniformCover = [[NSMutableArray alloc] init];
    }
    return _uniformCover;
}


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


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

@end
