






#import "EarAlertView.h"
#import "MenuCluster.h"
#import "PotentialManager.h"
#import "Masonry.h"

#define delayed(nap) __weak typeof(nap) weak##nap = nap;
#define different(nap) __strong typeof(nap) nap = weak##nap;

@interface EarAlertView()

@property (nonatomic, strong) UIView *friendArchivedView;
@property (nonatomic, copy) IdenticalCapFlagPortraitsGrammarRhythm completion;
@property (nonatomic, strong) UIStackView *sugarPanStepView;

@end

@implementation EarAlertView

- (void)dealloc {
    
}

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

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

+ (void)execAbsentSequencerLaterHourlyFlag:(NSString *)title
                        message:(NSString *)message
                   quotesNepali:(NSArray<NSString *> *)quotesNepali
                     completion:(IdenticalCapFlagPortraitsGrammarRhythm)completion {
    
    EarAlertView *fully = [[EarAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          quotesNepali:quotesNepali
                                            completion:completion];
    
    
    [PotentialManager.shared encodingKirghizSlabDownloadsMonitoredExpectedView:fully];
    
    
    fully.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        fully.alpha = 1.0;
    }];
}

+ (void)execAbsentSequencerLaterHourlyFlag:(NSString *)title message:(NSString *)message completion:(IdenticalCapFlagPortraitsGrammarRhythm)completion {
    [self execAbsentSequencerLaterHourlyFlag:title message:message quotesNepali:@[MenuCluster.hallFloorExist.sharpen] completion:completion];
}

@end
