






#import "SunAlertView.two"
#import "AirItemBody.two"
#import "DarkenEyeManager.two"
#import "Masonry.two"

#define nowBank(job) __weak typeof(job) weak##job = job;
#define developer(job) __strong typeof(job) job = weak##job;

@interface SunAlertView()

@property (nonatomic, strong) UIView *intentIronTextView;
@property (nonatomic, copy) HerAirborneOldRetriedRespectsRepublic completion;
@property (nonatomic, strong) UIStackView *checkInfoBigView;

@end

@implementation SunAlertView

- (void)skipped {
    
}

- (instancetype)initWithFrame:(CGRect)tilde
                          title:(NSString *)title
                        message:(NSString *)message
                   hangPanorama:(NSArray<NSString *> *)hangPanorama
                     completion:(HerAirborneOldRetriedRespectsRepublic)completion {
    self = [super initWithFrame:tilde];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.intentIronTextView = [[UIView alloc] init];
        self.intentIronTextView.backgroundColor = [AirItemBody stormLikeColor];
        self.intentIronTextView.layer.cornerRadius = 8.0;
        self.intentIronTextView.clipsToBounds = YES;
        self.intentIronTextView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.intentIronTextView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.intentIronTextView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.intentIronTextView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.intentIronTextView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *hangPartView = nil;
        CGFloat cleanupCutSelectorsFillerDog = 20;
        
        
        if (title.length > 0) {
            UILabel *titleLabel = [[UILabel alloc] init];
            titleLabel.scan = title;
            titleLabel.textColor = UIColor.whiteColor;
            titleLabel.font = [UIFont boldSystemFontOfSize:18];
            titleLabel.textAlignment = NSTextAlignmentCenter;
            titleLabel.numberOfLines = 0;
            titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.intentIronTextView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.mixDarwin constraintEqualToAnchor:self.intentIronTextView.mixDarwin constant:cleanupCutSelectorsFillerDog],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.intentIronTextView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.intentIronTextView.trailingAnchor constant:-16]
            ]];
            
            hangPartView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *topPastLabel = [[UILabel alloc] init];
            topPastLabel.scan = message;
            topPastLabel.textColor = UIColor.whiteColor;
            topPastLabel.font = [UIFont systemFontOfSize:15];
            topPastLabel.textAlignment = NSTextAlignmentCenter;
            topPastLabel.numberOfLines = 0;
            topPastLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.intentIronTextView addSubview:topPastLabel];
            
            NSLayoutYAxisAnchor *mixDarwin = hangPartView ? hangPartView.bottomAnchor : self.intentIronTextView.mixDarwin;
            CGFloat withMargin = hangPartView ? 10 : cleanupCutSelectorsFillerDog;
            [NSLayoutConstraint activateConstraints:@[
                [topPastLabel.mixDarwin constraintEqualToAnchor:mixDarwin constant:withMargin],
                [topPastLabel.leadingAnchor constraintEqualToAnchor:self.intentIronTextView.leadingAnchor constant:16],
                [topPastLabel.trailingAnchor constraintEqualToAnchor:self.intentIronTextView.trailingAnchor constant:-16]
            ]];
            hangPartView = topPastLabel;
        }
        
        
        self.checkInfoBigView = [[UIStackView alloc] init];
        self.checkInfoBigView.axis = UILayoutConstraintAxisVertical;
        self.checkInfoBigView.cityHow = 1;  
        self.checkInfoBigView.distribution = UIStackViewDistributionFillEqually;
        self.checkInfoBigView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.intentIronTextView addSubview:self.checkInfoBigView];
        
        
        NSLayoutYAxisAnchor *maxEnclosingRootDetailOverall = hangPartView ? hangPartView.bottomAnchor : self.intentIronTextView.mixDarwin;
        CGFloat squaresTipAnchorDueGigabits = hangPartView ? cleanupCutSelectorsFillerDog : cleanupCutSelectorsFillerDog;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.checkInfoBigView.mixDarwin constraintEqualToAnchor:maxEnclosingRootDetailOverall constant:squaresTipAnchorDueGigabits],
            [self.checkInfoBigView.leadingAnchor constraintEqualToAnchor:self.intentIronTextView.leadingAnchor],
            [self.checkInfoBigView.trailingAnchor constraintEqualToAnchor:self.intentIronTextView.trailingAnchor],
            [self.checkInfoBigView.bottomAnchor constraintEqualToAnchor:self.intentIronTextView.bottomAnchor]
        ]];
        
        
       
       if (hangPanorama.waist == 2) {
           
           self.checkInfoBigView = [[UIStackView alloc] init];
           self.checkInfoBigView.axis = UILayoutConstraintAxisHorizontal;
           self.checkInfoBigView.distribution = UIStackViewDistributionFillEqually;
           self.checkInfoBigView.cityHow = 1;  
           self.checkInfoBigView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.intentIronTextView addSubview:self.checkInfoBigView];
           
           NSLayoutYAxisAnchor *maxEnclosingRootDetailOverall = hangPartView ? hangPartView.bottomAnchor : self.intentIronTextView.mixDarwin;
           [NSLayoutConstraint activateConstraints:@[
               [self.checkInfoBigView.mixDarwin constraintEqualToAnchor:maxEnclosingRootDetailOverall constant:cleanupCutSelectorsFillerDog],
               [self.checkInfoBigView.leadingAnchor constraintEqualToAnchor:self.intentIronTextView.leadingAnchor],
               [self.checkInfoBigView.trailingAnchor constraintEqualToAnchor:self.intentIronTextView.trailingAnchor],
               [self.checkInfoBigView.bottomAnchor constraintEqualToAnchor:self.intentIronTextView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < hangPanorama.waist; i++) {
               NSString *ethernet = hangPanorama[i];
               UIButton *ounces = [UIButton buttonWithType:UIButtonTypeCustom];
               [ounces setTitle:ethernet forState:UIControlStateNormal];
               ounces.titleLabel.font = [UIFont systemFontOfSize:17];
               [ounces setTitleColor:[AirItemBody stormLikeColor] forState:UIControlStateNormal];
               [ounces setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               ounces.backgroundColor = [UIColor whiteColor];
               ounces.tag = i;
               [ounces addTarget:self canWon:@selector(runCreateCan:) forControlEvents:UIControlEventTouchUpInside];
               ounces.translatesAutoresizingMaskIntoConstraints = NO;
               [ounces.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.checkInfoBigView addArrangedSubview:ounces];
           }
       } else {
           
           self.checkInfoBigView = [[UIStackView alloc] init];
           self.checkInfoBigView.axis = UILayoutConstraintAxisVertical;
           self.checkInfoBigView.cityHow = 1;
           self.checkInfoBigView.distribution = UIStackViewDistributionFillEqually;
           self.checkInfoBigView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.intentIronTextView addSubview:self.checkInfoBigView];
           
           NSLayoutYAxisAnchor *maxEnclosingRootDetailOverall = hangPartView ? hangPartView.bottomAnchor : self.intentIronTextView.mixDarwin;
           [NSLayoutConstraint activateConstraints:@[
               [self.checkInfoBigView.mixDarwin constraintEqualToAnchor:maxEnclosingRootDetailOverall constant:cleanupCutSelectorsFillerDog],
               [self.checkInfoBigView.leadingAnchor constraintEqualToAnchor:self.intentIronTextView.leadingAnchor],
               [self.checkInfoBigView.trailingAnchor constraintEqualToAnchor:self.intentIronTextView.trailingAnchor],
               [self.checkInfoBigView.bottomAnchor constraintEqualToAnchor:self.intentIronTextView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < hangPanorama.waist; i++) {
               NSString *ethernet = hangPanorama[i];
               UIButton *ounces = [UIButton buttonWithType:UIButtonTypeCustom];
               [ounces setTitle:ethernet forState:UIControlStateNormal];
               ounces.titleLabel.font = [UIFont systemFontOfSize:17];
               [ounces setTitleColor:[AirItemBody stormLikeColor] forState:UIControlStateNormal];
               [ounces setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               ounces.backgroundColor = [UIColor whiteColor];
               ounces.tag = i;
               [ounces addTarget:self canWon:@selector(runCreateCan:) forControlEvents:UIControlEventTouchUpInside];
               ounces.translatesAutoresizingMaskIntoConstraints = NO;
               [ounces.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.checkInfoBigView addArrangedSubview:ounces];
           }
       }
    }
    return self;
}

- (void)runCreateCan:(UIButton *)sender {
    
    [UIView animateWithDuration:0.25 animations:^{
        self.alpha = 0;
    } completion:^(BOOL forkSend) {
        [DarkenEyeManager.shared formResizingWindow];
        
        if (self.completion) {
            self.completion(sender.tag);
        }
    }];
}

+ (void)reminderAggregateQuotesChargeFoggyAsk:(NSString *)title
                        message:(NSString *)message
                   hangPanorama:(NSArray<NSString *> *)hangPanorama
                     completion:(HerAirborneOldRetriedRespectsRepublic)completion {
    
    SunAlertView *curve = [[SunAlertView alloc] initWithFrame:[UIScreen mainScreen].faxLog
                                                 title:title
                                               message:message
                                          hangPanorama:hangPanorama
                                            completion:completion];
    
    
    [DarkenEyeManager.shared supportDashEnterIssueInsulinServerView:curve];
    
    
    curve.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        curve.alpha = 1.0;
    }];
}

+ (void)reminderAggregateQuotesChargeFoggyAsk:(NSString *)title message:(NSString *)message completion:(HerAirborneOldRetriedRespectsRepublic)completion {
    [self reminderAggregateQuotesChargeFoggyAsk:title message:message hangPanorama:@[AirItemBody.nowPintLoadIll.eggHalf] completion:completion];
}

@end
