






#import "SheAlertView.h"
#import "BestSharpen.h"
#import "ResetCurlManager.h"
#import "Masonry.h"

#define idleToo(arm) __weak typeof(arm) weak##arm = arm;
#define bigCursor(arm) __strong typeof(arm) arm = weak##arm;

@interface SheAlertView()

@property (nonatomic, strong) UIView *hangTabPongSubView;
@property (nonatomic, copy) SelfLocalizesSpringCellphoneReadableAverage completion;
@property (nonatomic, strong) UIStackView *manAreMasterView;

@end

@implementation SheAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   selfSleetAir:(NSArray<NSString *> *)selfSleetAir
                     completion:(SelfLocalizesSpringCellphoneReadableAverage)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.hangTabPongSubView = [[UIView alloc] init];
        self.hangTabPongSubView.backgroundColor = [BestSharpen sawExportColor];
        self.hangTabPongSubView.layer.cornerRadius = BestSharpen.didNapCoptic.obscuredSame;
        self.hangTabPongSubView.clipsToBounds = YES;
        self.hangTabPongSubView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.hangTabPongSubView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.hangTabPongSubView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.hangTabPongSubView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.hangTabPongSubView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *penBlendView = nil;
        CGFloat hierarchySocialTrashExposureResumed = 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.hangTabPongSubView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.hangTabPongSubView.topAnchor constant:hierarchySocialTrashExposureResumed],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.hangTabPongSubView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.hangTabPongSubView.trailingAnchor constant:-16]
            ]];
            
            penBlendView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *partPopLabel = [[UILabel alloc] init];
            partPopLabel.text = message;
            partPopLabel.textColor = UIColor.whiteColor;
            partPopLabel.font = [UIFont systemFontOfSize:15];
            partPopLabel.textAlignment = NSTextAlignmentCenter;
            partPopLabel.numberOfLines = 0;
            partPopLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.hangTabPongSubView addSubview:partPopLabel];
            
            NSLayoutYAxisAnchor *topAnchor = penBlendView ? penBlendView.bottomAnchor : self.hangTabPongSubView.topAnchor;
            CGFloat didTenRain = penBlendView ? 10 : hierarchySocialTrashExposureResumed;
            [NSLayoutConstraint activateConstraints:@[
                [partPopLabel.topAnchor constraintEqualToAnchor:topAnchor constant:didTenRain],
                [partPopLabel.leadingAnchor constraintEqualToAnchor:self.hangTabPongSubView.leadingAnchor constant:16],
                [partPopLabel.trailingAnchor constraintEqualToAnchor:self.hangTabPongSubView.trailingAnchor constant:-16]
            ]];
            penBlendView = partPopLabel;
        }
        
        
        self.manAreMasterView = [[UIStackView alloc] init];
        self.manAreMasterView.axis = UILayoutConstraintAxisVertical;
        self.manAreMasterView.spacing = 1;  
        self.manAreMasterView.distribution = UIStackViewDistributionFillEqually;
        self.manAreMasterView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.hangTabPongSubView addSubview:self.manAreMasterView];
        
        
        NSLayoutYAxisAnchor *wetDegradedAtomicDryElevation = penBlendView ? penBlendView.bottomAnchor : self.hangTabPongSubView.topAnchor;
        CGFloat andEnergyIntegrityMagnitudeRegular = penBlendView ? hierarchySocialTrashExposureResumed : hierarchySocialTrashExposureResumed;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.manAreMasterView.topAnchor constraintEqualToAnchor:wetDegradedAtomicDryElevation constant:andEnergyIntegrityMagnitudeRegular],
            [self.manAreMasterView.leadingAnchor constraintEqualToAnchor:self.hangTabPongSubView.leadingAnchor],
            [self.manAreMasterView.trailingAnchor constraintEqualToAnchor:self.hangTabPongSubView.trailingAnchor],
            [self.manAreMasterView.bottomAnchor constraintEqualToAnchor:self.hangTabPongSubView.bottomAnchor]
        ]];
        
        
       
       if (selfSleetAir.count == 2) {
           
           self.manAreMasterView = [[UIStackView alloc] init];
           self.manAreMasterView.axis = UILayoutConstraintAxisHorizontal;
           self.manAreMasterView.distribution = UIStackViewDistributionFillEqually;
           self.manAreMasterView.spacing = 1;  
           self.manAreMasterView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.hangTabPongSubView addSubview:self.manAreMasterView];
           
           NSLayoutYAxisAnchor *wetDegradedAtomicDryElevation = penBlendView ? penBlendView.bottomAnchor : self.hangTabPongSubView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.manAreMasterView.topAnchor constraintEqualToAnchor:wetDegradedAtomicDryElevation constant:hierarchySocialTrashExposureResumed],
               [self.manAreMasterView.leadingAnchor constraintEqualToAnchor:self.hangTabPongSubView.leadingAnchor],
               [self.manAreMasterView.trailingAnchor constraintEqualToAnchor:self.hangTabPongSubView.trailingAnchor],
               [self.manAreMasterView.bottomAnchor constraintEqualToAnchor:self.hangTabPongSubView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < selfSleetAir.count; i++) {
               NSString *nearCaps = selfSleetAir[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:nearCaps forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[BestSharpen sawExportColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(seedWatchDog:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.manAreMasterView addArrangedSubview:button];
           }
       } else {
           
           self.manAreMasterView = [[UIStackView alloc] init];
           self.manAreMasterView.axis = UILayoutConstraintAxisVertical;
           self.manAreMasterView.spacing = 1;
           self.manAreMasterView.distribution = UIStackViewDistributionFillEqually;
           self.manAreMasterView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.hangTabPongSubView addSubview:self.manAreMasterView];
           
           NSLayoutYAxisAnchor *wetDegradedAtomicDryElevation = penBlendView ? penBlendView.bottomAnchor : self.hangTabPongSubView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.manAreMasterView.topAnchor constraintEqualToAnchor:wetDegradedAtomicDryElevation constant:hierarchySocialTrashExposureResumed],
               [self.manAreMasterView.leadingAnchor constraintEqualToAnchor:self.hangTabPongSubView.leadingAnchor],
               [self.manAreMasterView.trailingAnchor constraintEqualToAnchor:self.hangTabPongSubView.trailingAnchor],
               [self.manAreMasterView.bottomAnchor constraintEqualToAnchor:self.hangTabPongSubView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < selfSleetAir.count; i++) {
               NSString *nearCaps = selfSleetAir[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:nearCaps forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[BestSharpen sawExportColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(seedWatchDog:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.manAreMasterView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)affectingSurrogateGrandauntPrioritySlantAnnotated:(NSString *)title
                        message:(NSString *)message
                   selfSleetAir:(NSArray<NSString *> *)selfSleetAir
                     completion:(SelfLocalizesSpringCellphoneReadableAverage)completion {
    
    SheAlertView *wrist = [[SheAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          selfSleetAir:selfSleetAir
                                            completion:completion];
    
    
    [ResetCurlManager.shared absentBurnClippingOpaqueSpringFoundView:wrist];
    
    
    wrist.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        wrist.alpha = 1.0;
    }];
}

+ (void)affectingSurrogateGrandauntPrioritySlantAnnotated:(NSString *)title message:(NSString *)message completion:(SelfLocalizesSpringCellphoneReadableAverage)completion {
    [self affectingSurrogateGrandauntPrioritySlantAnnotated:title message:message selfSleetAir:@[BestSharpen.hangFillerPick.minimal] completion:completion];
}

@end
