








#import "ToneOxygenWarn.h"

#define AnyBedSignCat self.frame.size.width

@interface ToneOxygenWarn()



@property (nonatomic, strong) NSMutableArray                            *bendDryArray;



@property (nonatomic, strong) NSMutableArray <LightStripEditCell *>      *shotArray;



@property (strong, nonatomic) NSMutableArray <LightStripEditCell *>      *lawSpeedView;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) ComposedRearrangePinchTraverseStrength                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   editor;

@end

@implementation ToneOxygenWarn

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

- (void)stylusRetMix
{
    
    if (self.shotArray.firstObject) {
        
        
        LightStripEditCell *arbiterView = self.shotArray.firstObject;
        
        arbiterView.frame = CGRectMake(AnyBedSignCat, 0, arbiterView.pinSendSize.width, arbiterView.pinSendSize.height);
        
        self.editor = arbiterView.editor;
        
        self.channelCount = arbiterView.channelCount;
        
        
        NSInteger row = [self tornadoSmallestCounterResumedOpaqueEvictAlternate:arbiterView];
        
        
        if (row >= 0) {
            
            
            [self.shotArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:arbiterView]) {
                [self addSubview:arbiterView];
            }
            arbiterView.frame = CGRectMake(AnyBedSignCat,  row * (arbiterView.pinSendSize.height + _editor), arbiterView.pinSendSize.width, arbiterView.pinSendSize.height);
            
            
            [_bendDryArray setObject:arbiterView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(printDogWrapView:willDisplayCell:)]) {
                [self.delegate printDogWrapView:self willDisplayCell:arbiterView];
            }
            
            
            [self.lawSpeedView addObject:arbiterView];
            
            [arbiterView helloCaffeineControlsReceivingFeatured:^{
                
                
                [arbiterView setTransform:CGAffineTransformMakeTranslation(- arbiterView.frame.size.width-AnyBedSignCat, 0)];
                
            } completion:^(BOOL finished) {
                
                [arbiterView removeFromSuperview];
                
                
                [self.lawSpeedView removeObject:arbiterView];
                
                
                if ([self.delegate respondsToSelector:@selector(printDogWrapView:didEndDisplayingCell:)]) {
                    [self.delegate printDogWrapView:self didEndDisplayingCell:arbiterView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(sunAbortedShapeWrittenFoodThumbEyeOwn:)]) {
                        [self.delegate sunAbortedShapeWrittenFoodThumbEyeOwn:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)endDustSexForm:(NSArray <LightStripEditCell *> *)barrages
{
    self.count += barrages.count;
    [self.shotArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == DenyRecoveryBetweenSleepDetachingJoining) {
        return;
    }
    self.status = DenyRecoveryBetweenSleepDetachingJoining;
    
    if (self.lawSpeedView.count) {
        [self.lawSpeedView makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.shotArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.lawSpeedView  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.lawSpeedView  removeAllObjects];
    [self.shotArray     removeAllObjects];
    [self.bendDryArray  removeAllObjects];
    
    self.lawSpeedView       = nil;
    self.shotArray          = nil;
    self.bendDryArray       = nil;
}


- (NSInteger)tornadoSmallestCounterResumedOpaqueEvictAlternate:(LightStripEditCell *)newBarrage
{
    for (int row = 0; row<_bendDryArray.count; row++) {
        NSObject *object = _bendDryArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[LightStripEditCell class]]) { 
            
            LightStripEditCell *midDetects = (LightStripEditCell*)object;
            
            if ([self tornadoSmallestCounterResumedOpaqueEvictAlternate:midDetects youLooper:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)tornadoSmallestCounterResumedOpaqueEvictAlternate:(LightStripEditCell *)midDetects youLooper:(LightStripEditCell *)newBarrage
{
    
    if (midDetects.status == BelowCheckerBufferLocalesIodineFrame) {
        return NO;
    }
    
    
    CGRect rect = [midDetects.layer.presentationLayer frame];
    if (rect.origin.x>AnyBedSignCat - midDetects.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (midDetects.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = AnyBedSignCat/(AnyBedSignCat+newBarrage.frame.size.width)*newBarrage.shearRealBut;
        
        CGFloat echo = rect.origin.x - time/(midDetects.shearRealBut)*(AnyBedSignCat + midDetects.frame.size.width);
        if (echo < -midDetects.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *trait = [touches anyObject];
    CGPoint sonBestDog  = [trait locationInView:self];
    for (UIView *divider in [self subviews])
    {
        if (![divider isKindOfClass:[LightStripEditCell class]]) continue;
        LightStripEditCell *arbiterView = (LightStripEditCell *)divider;
        if ([arbiterView.layer.presentationLayer hitTest:sonBestDog])
        {
            
            if ([self.delegate respondsToSelector:@selector(printDogWrapView:scalingLineCell:)]) {
                [self.delegate printDogWrapView:self scalingLineCell:arbiterView];
            }
            break;
        }
    }
}




- (NSMutableArray<LightStripEditCell *> *)shotArray {
    if (!_shotArray) {
        _shotArray = [[NSMutableArray alloc] init];
    }
    return _shotArray;
}


- (NSMutableArray<LightStripEditCell *> *)lawSpeedView {
    if (!_lawSpeedView) {
        _lawSpeedView = [[NSMutableArray alloc] init];
    }
    return _lawSpeedView;
}


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


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

@end
