






#import "NowAlertView.h"
#import "MapSheFocus.h"
#import "FormThirdManager.h"
#import "Masonry.h"

#define allFeat(arm) __weak typeof(arm) weak##arm = arm;
#define expandAir(arm) __strong typeof(arm) arm = weak##arm;

@interface NowAlertView()

@property (nonatomic, strong) UIView *cupMapFaxTotalView;
@property (nonatomic, copy) PrototypeStateExpectsUseAskSoftness completion;
@property (nonatomic, strong) UIStackView *canonMillSobView;

@end

@implementation NowAlertView

- (void)dealloc {
    
}

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

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

+ (void)spousesPackRuleCountryImmutableSubtitles:(NSString *)title
                        message:(NSString *)message
                   allocatorYet:(NSArray<NSString *> *)allocatorYet
                     completion:(PrototypeStateExpectsUseAskSoftness)completion {
    
    NowAlertView *adopt = [[NowAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          allocatorYet:allocatorYet
                                            completion:completion];
    
    
    [FormThirdManager.shared germanArtLogAndAdaptiveSunView:adopt];
    
    
    adopt.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        adopt.alpha = 1.0;
    }];
}

+ (void)spousesPackRuleCountryImmutableSubtitles:(NSString *)title message:(NSString *)message completion:(PrototypeStateExpectsUseAskSoftness)completion {
    [self spousesPackRuleCountryImmutableSubtitles:title message:message allocatorYet:@[MapSheFocus.catBlackPopMay.darkFun] completion:completion];
}

@end
