






#import "HexAlertView.h"
#import "PlayDragTap.h"
#import "TagsFoggyManager.h"
#import "Masonry.h"

#define maxMill(way) __weak typeof(way) weak##way = way;
#define tokenFail(way) __strong typeof(way) way = weak##way;

@interface HexAlertView()

@property (nonatomic, strong) UIView *ownershipWidthView;
@property (nonatomic, copy) DublinFigureDayServiceBehaviorBlack completion;
@property (nonatomic, strong) UIStackView *markAboveEyeView;

@end

@implementation HexAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   showingRound:(NSArray<NSString *> *)showingRound
                     completion:(DublinFigureDayServiceBehaviorBlack)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.ownershipWidthView = [[UIView alloc] init];
        self.ownershipWidthView.backgroundColor = [PlayDragTap realUpperColor];
        self.ownershipWidthView.layer.cornerRadius = 8.0;
        self.ownershipWidthView.clipsToBounds = YES;
        self.ownershipWidthView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.ownershipWidthView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.ownershipWidthView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.ownershipWidthView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.ownershipWidthView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *moireHasView = nil;
        CGFloat wakeExtrinsicEyeBayerRadio = 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.ownershipWidthView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.ownershipWidthView.topAnchor constant:wakeExtrinsicEyeBayerRadio],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.ownershipWidthView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.ownershipWidthView.trailingAnchor constant:-16]
            ]];
            
            moireHasView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *kinSockLabel = [[UILabel alloc] init];
            kinSockLabel.text = message;
            kinSockLabel.textColor = UIColor.whiteColor;
            kinSockLabel.font = [UIFont systemFontOfSize:15];
            kinSockLabel.textAlignment = NSTextAlignmentCenter;
            kinSockLabel.numberOfLines = 0;
            kinSockLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.ownershipWidthView addSubview:kinSockLabel];
            
            NSLayoutYAxisAnchor *topAnchor = moireHasView ? moireHasView.bottomAnchor : self.ownershipWidthView.topAnchor;
            CGFloat warnOneBig = moireHasView ? 10 : wakeExtrinsicEyeBayerRadio;
            [NSLayoutConstraint activateConstraints:@[
                [kinSockLabel.topAnchor constraintEqualToAnchor:topAnchor constant:warnOneBig],
                [kinSockLabel.leadingAnchor constraintEqualToAnchor:self.ownershipWidthView.leadingAnchor constant:16],
                [kinSockLabel.trailingAnchor constraintEqualToAnchor:self.ownershipWidthView.trailingAnchor constant:-16]
            ]];
            moireHasView = kinSockLabel;
        }
        
        
        self.markAboveEyeView = [[UIStackView alloc] init];
        self.markAboveEyeView.axis = UILayoutConstraintAxisVertical;
        self.markAboveEyeView.spacing = 1;  
        self.markAboveEyeView.distribution = UIStackViewDistributionFillEqually;
        self.markAboveEyeView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.ownershipWidthView addSubview:self.markAboveEyeView];
        
        
        NSLayoutYAxisAnchor *garbageWrittenRankedParentalMonth = moireHasView ? moireHasView.bottomAnchor : self.ownershipWidthView.topAnchor;
        CGFloat scrollingRelatedPenHowSigmoid = moireHasView ? wakeExtrinsicEyeBayerRadio : wakeExtrinsicEyeBayerRadio;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.markAboveEyeView.topAnchor constraintEqualToAnchor:garbageWrittenRankedParentalMonth constant:scrollingRelatedPenHowSigmoid],
            [self.markAboveEyeView.leadingAnchor constraintEqualToAnchor:self.ownershipWidthView.leadingAnchor],
            [self.markAboveEyeView.trailingAnchor constraintEqualToAnchor:self.ownershipWidthView.trailingAnchor],
            [self.markAboveEyeView.bottomAnchor constraintEqualToAnchor:self.ownershipWidthView.bottomAnchor]
        ]];
        
        
       
       if (showingRound.count == 2) {
           
           self.markAboveEyeView = [[UIStackView alloc] init];
           self.markAboveEyeView.axis = UILayoutConstraintAxisHorizontal;
           self.markAboveEyeView.distribution = UIStackViewDistributionFillEqually;
           self.markAboveEyeView.spacing = 1;  
           self.markAboveEyeView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.ownershipWidthView addSubview:self.markAboveEyeView];
           
           NSLayoutYAxisAnchor *garbageWrittenRankedParentalMonth = moireHasView ? moireHasView.bottomAnchor : self.ownershipWidthView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.markAboveEyeView.topAnchor constraintEqualToAnchor:garbageWrittenRankedParentalMonth constant:wakeExtrinsicEyeBayerRadio],
               [self.markAboveEyeView.leadingAnchor constraintEqualToAnchor:self.ownershipWidthView.leadingAnchor],
               [self.markAboveEyeView.trailingAnchor constraintEqualToAnchor:self.ownershipWidthView.trailingAnchor],
               [self.markAboveEyeView.bottomAnchor constraintEqualToAnchor:self.ownershipWidthView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < showingRound.count; i++) {
               NSString *zipMusic = showingRound[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:zipMusic forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PlayDragTap realUpperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(nepaliFatIll:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.markAboveEyeView addArrangedSubview:button];
           }
       } else {
           
           self.markAboveEyeView = [[UIStackView alloc] init];
           self.markAboveEyeView.axis = UILayoutConstraintAxisVertical;
           self.markAboveEyeView.spacing = 1;
           self.markAboveEyeView.distribution = UIStackViewDistributionFillEqually;
           self.markAboveEyeView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.ownershipWidthView addSubview:self.markAboveEyeView];
           
           NSLayoutYAxisAnchor *garbageWrittenRankedParentalMonth = moireHasView ? moireHasView.bottomAnchor : self.ownershipWidthView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.markAboveEyeView.topAnchor constraintEqualToAnchor:garbageWrittenRankedParentalMonth constant:wakeExtrinsicEyeBayerRadio],
               [self.markAboveEyeView.leadingAnchor constraintEqualToAnchor:self.ownershipWidthView.leadingAnchor],
               [self.markAboveEyeView.trailingAnchor constraintEqualToAnchor:self.ownershipWidthView.trailingAnchor],
               [self.markAboveEyeView.bottomAnchor constraintEqualToAnchor:self.ownershipWidthView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < showingRound.count; i++) {
               NSString *zipMusic = showingRound[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:zipMusic forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PlayDragTap realUpperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(nepaliFatIll:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.markAboveEyeView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)affinityFeedSentencesPeopleSelectingLocality:(NSString *)title
                        message:(NSString *)message
                   showingRound:(NSArray<NSString *> *)showingRound
                     completion:(DublinFigureDayServiceBehaviorBlack)completion {
    
    HexAlertView *miter = [[HexAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          showingRound:showingRound
                                            completion:completion];
    
    
    [TagsFoggyManager.shared upscaleBorderFirmwareThousandsModelSchoolView:miter];
    
    
    miter.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        miter.alpha = 1.0;
    }];
}

+ (void)affinityFeedSentencesPeopleSelectingLocality:(NSString *)title message:(NSString *)message completion:(DublinFigureDayServiceBehaviorBlack)completion {
    [self affinityFeedSentencesPeopleSelectingLocality:title message:message showingRound:@[PlayDragTap.andSugarSawBar.boxBlob] completion:completion];
}

@end
