






#import "AskAlertView.h"
#import "PaceDownHue.h"
#import "AboutLikeManager.h"
#import "Masonry.h"

#define spanish(sub) __weak typeof(sub) weak##sub = sub;
#define initially(sub) __strong typeof(sub) sub = weak##sub;

@interface AskAlertView()

@property (nonatomic, strong) UIView *pipeOffSunLeftView;
@property (nonatomic, copy) ElapsedNotPinRepairSwitchTap completion;
@property (nonatomic, strong) UIStackView *initialMovieView;

@end

@implementation AskAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   bypassMenHow:(NSArray<NSString *> *)bypassMenHow
                     completion:(ElapsedNotPinRepairSwitchTap)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.pipeOffSunLeftView = [[UIView alloc] init];
        self.pipeOffSunLeftView.backgroundColor = [PaceDownHue frequencyColor];
        self.pipeOffSunLeftView.layer.cornerRadius = 8.0;
        self.pipeOffSunLeftView.clipsToBounds = YES;
        self.pipeOffSunLeftView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.pipeOffSunLeftView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.pipeOffSunLeftView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.pipeOffSunLeftView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.pipeOffSunLeftView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *waxBoundView = nil;
        CGFloat spaHandoffSensorHandlesHue = 20;
        
        
        if (title.length > 0) {
            UILabel *titleLabel = [[UILabel alloc] init];
            titleLabel.text = title;
            titleLabel.textColor = UIColor.whiteColor;
            titleLabel.font = [UIFont boldSystemFontOfSize:18];
            titleLabel.textAlignment = NSTextAlignmentCenter;
            titleLabel.numberOfLines = 0;
            titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.pipeOffSunLeftView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.topAnchor constant:spaHandoffSensorHandlesHue],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.trailingAnchor constant:-16]
            ]];
            
            waxBoundView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *corruptLabel = [[UILabel alloc] init];
            corruptLabel.text = message;
            corruptLabel.textColor = UIColor.whiteColor;
            corruptLabel.font = [UIFont systemFontOfSize:15];
            corruptLabel.textAlignment = NSTextAlignmentCenter;
            corruptLabel.numberOfLines = 0;
            corruptLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.pipeOffSunLeftView addSubview:corruptLabel];
            
            NSLayoutYAxisAnchor *topAnchor = waxBoundView ? waxBoundView.bottomAnchor : self.pipeOffSunLeftView.topAnchor;
            CGFloat mayNatural = waxBoundView ? 10 : spaHandoffSensorHandlesHue;
            [NSLayoutConstraint activateConstraints:@[
                [corruptLabel.topAnchor constraintEqualToAnchor:topAnchor constant:mayNatural],
                [corruptLabel.leadingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.leadingAnchor constant:16],
                [corruptLabel.trailingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.trailingAnchor constant:-16]
            ]];
            waxBoundView = corruptLabel;
        }
        
        
        self.initialMovieView = [[UIStackView alloc] init];
        self.initialMovieView.axis = UILayoutConstraintAxisVertical;
        self.initialMovieView.spacing = 1;  
        self.initialMovieView.distribution = UIStackViewDistributionFillEqually;
        self.initialMovieView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.pipeOffSunLeftView addSubview:self.initialMovieView];
        
        
        NSLayoutYAxisAnchor *bridgeFetchRankTatarFitness = waxBoundView ? waxBoundView.bottomAnchor : self.pipeOffSunLeftView.topAnchor;
        CGFloat logDictationRefreshRawEditor = waxBoundView ? spaHandoffSensorHandlesHue : spaHandoffSensorHandlesHue;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.initialMovieView.topAnchor constraintEqualToAnchor:bridgeFetchRankTatarFitness constant:logDictationRefreshRawEditor],
            [self.initialMovieView.leadingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.leadingAnchor],
            [self.initialMovieView.trailingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.trailingAnchor],
            [self.initialMovieView.bottomAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.bottomAnchor]
        ]];
        
        
       
       if (bypassMenHow.count == 2) {
           
           self.initialMovieView = [[UIStackView alloc] init];
           self.initialMovieView.axis = UILayoutConstraintAxisHorizontal;
           self.initialMovieView.distribution = UIStackViewDistributionFillEqually;
           self.initialMovieView.spacing = 1;  
           self.initialMovieView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.pipeOffSunLeftView addSubview:self.initialMovieView];
           
           NSLayoutYAxisAnchor *bridgeFetchRankTatarFitness = waxBoundView ? waxBoundView.bottomAnchor : self.pipeOffSunLeftView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.initialMovieView.topAnchor constraintEqualToAnchor:bridgeFetchRankTatarFitness constant:spaHandoffSensorHandlesHue],
               [self.initialMovieView.leadingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.leadingAnchor],
               [self.initialMovieView.trailingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.trailingAnchor],
               [self.initialMovieView.bottomAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < bypassMenHow.count; i++) {
               NSString *rawRenew = bypassMenHow[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:rawRenew forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PaceDownHue frequencyColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(seasonArtist:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.initialMovieView addArrangedSubview:button];
           }
       } else {
           
           self.initialMovieView = [[UIStackView alloc] init];
           self.initialMovieView.axis = UILayoutConstraintAxisVertical;
           self.initialMovieView.spacing = 1;
           self.initialMovieView.distribution = UIStackViewDistributionFillEqually;
           self.initialMovieView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.pipeOffSunLeftView addSubview:self.initialMovieView];
           
           NSLayoutYAxisAnchor *bridgeFetchRankTatarFitness = waxBoundView ? waxBoundView.bottomAnchor : self.pipeOffSunLeftView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.initialMovieView.topAnchor constraintEqualToAnchor:bridgeFetchRankTatarFitness constant:spaHandoffSensorHandlesHue],
               [self.initialMovieView.leadingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.leadingAnchor],
               [self.initialMovieView.trailingAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.trailingAnchor],
               [self.initialMovieView.bottomAnchor constraintEqualToAnchor:self.pipeOffSunLeftView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < bypassMenHow.count; i++) {
               NSString *rawRenew = bypassMenHow[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:rawRenew forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PaceDownHue frequencyColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(seasonArtist:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.initialMovieView addArrangedSubview:button];
           }
       }
    }
    return self;
}

- (void)seasonArtist:(UIButton *)sender {
    
    [UIView animateWithDuration:0.25 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [AboutLikeManager.shared rawAnchorCarWindow];
        
        if (self.completion) {
            self.completion(sender.tag);
        }
    }];
}

+ (void)notationWasTokenTriggerYouBars:(NSString *)title
                        message:(NSString *)message
                   bypassMenHow:(NSArray<NSString *> *)bypassMenHow
                     completion:(ElapsedNotPinRepairSwitchTap)completion {
    
    AskAlertView *china = [[AskAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          bypassMenHow:bypassMenHow
                                            completion:completion];
    
    
    [AboutLikeManager.shared bufferingIntensityChromeStripBatchDryView:china];
    
    
    china.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        china.alpha = 1.0;
    }];
}

+ (void)notationWasTokenTriggerYouBars:(NSString *)title message:(NSString *)message completion:(ElapsedNotPinRepairSwitchTap)completion {
    [self notationWasTokenTriggerYouBars:title message:message bypassMenHow:@[PaceDownHue.touchBusyMalay.twitter] completion:completion];
}

@end
