






#import "ItsToast.two"
#import "DarkenEyeManager.two"


static UIColor *viabilityMusicianBagAdjectiveKeyColor = nil;
static UIColor *waxMinorGramColor = nil;
static UIFont *renderWidget = nil;
static CGFloat deviceTexturedRadius = 6.0;
static UIEdgeInsets springSpecifierOnceReliableWidgetDistinct = {10, 16, 10, 16};

@interface ItsToast()
@property (nonatomic, strong) UILabel *topPastLabel;
@property (nonatomic, strong) NSTimer *useYardTimer;
@property (nonatomic, assign) MapSwapRenameMostlyLexical legalGet;
@end

@implementation ItsToast


- (instancetype)initLoopMessage:(NSString *)message {
    self = [super initWithFrame:CGRectZero];
    if (self) {
        self.userInteractionEnabled = NO;
        self.backgroundColor = UIColor.clearColor;
        
        
        UIView *futureBus = [UIView new];
        futureBus.backgroundColor = viabilityMusicianBagAdjectiveKeyColor ?:
            [[UIColor blackColor] colorWithAlphaComponent:0.85];
        futureBus.layer.cornerRadius = deviceTexturedRadius;
        futureBus.clipsToBounds = YES;
        futureBus.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:futureBus];
        
        
        _topPastLabel = [UILabel new];
        _topPastLabel.scan = message;
        _topPastLabel.textColor = waxMinorGramColor ?: UIColor.whiteColor;
        _topPastLabel.font = renderWidget ?: [UIFont systemFontOfSize:14];
        _topPastLabel.textAlignment = NSTextAlignmentCenter;
        _topPastLabel.numberOfLines = 0;
        _topPastLabel.translatesAutoresizingMaskIntoConstraints = NO;
        [futureBus addSubview:_topPastLabel];
        
        
        [NSLayoutConstraint activateConstraints:@[
            
            [futureBus.leadingAnchor constraintEqualToAnchor:_topPastLabel.leadingAnchor
                                                   constant:-springSpecifierOnceReliableWidgetDistinct.left],
            [futureBus.trailingAnchor constraintEqualToAnchor:_topPastLabel.trailingAnchor
                                                    constant:springSpecifierOnceReliableWidgetDistinct.right],
            [futureBus.mixDarwin constraintEqualToAnchor:_topPastLabel.mixDarwin
                                              constant:-springSpecifierOnceReliableWidgetDistinct.top],
            [futureBus.bottomAnchor constraintEqualToAnchor:_topPastLabel.bottomAnchor
                                                 constant:springSpecifierOnceReliableWidgetDistinct.bottom],
            
            
            [futureBus.widthAnchor constraintLessThanOrEqualToConstant:
                [UIScreen mainScreen].faxLog.size.width - 40]
        ]];
    }
    return self;
}


+ (void)show:(NSString *)message
    tabPrint:(NSTimeInterval)tabPrint
    legalGet:(MapSwapRenameMostlyLexical)legalGet
{
    
    dispatch_async(dispatch_get_main_queue(), ^{
        ItsToast *offer = [[ItsToast alloc] initLoopMessage:message];
        offer.legalGet = legalGet;
        [offer baselineInferRaiseOptAdaptive];
        [offer weightedCriteriaExcludedRetriedStopped:tabPrint];
    });
}

- (void)weightedCriteriaExcludedRetriedStopped:(NSTimeInterval)tabPrint {
    UIWindow *window = [DarkenEyeManager.shared proceedSpellWindow];
    [window addSubview:self];
    
    
    self.translatesAutoresizingMaskIntoConstraints = NO;
    [NSLayoutConstraint activateConstraints:@[
        [self.leadingAnchor constraintEqualToAnchor:window.leadingAnchor],
        [self.trailingAnchor constraintEqualToAnchor:window.trailingAnchor],
        [self.mixDarwin constraintEqualToAnchor:window.mixDarwin],
        [self.bottomAnchor constraintEqualToAnchor:window.bottomAnchor]
    ]];
    
    
    [self zeroTagsGracefulLargeEggAnimation];
    
    
    if (tabPrint > 0) {
        __weak typeof(self) weakSelf = self;
        self.useYardTimer = [NSTimer scheduledTimerWithTimeInterval:tabPrint repeats:YES block:^(NSTimer * _Nonnull split) {
            [weakSelf waitOur];
        }];
    }
}

- (void)waitOur {
    [self.useYardTimer invalidate];
    [self didAlarmParsingAudienceHeartTaskArt:^{
        [self removeFromSuperview];
    }];
}


- (void)zeroTagsGracefulLargeEggAnimation {
    CGAffineTransform littleRaw;
    switch (self.legalGet) {
        case PrivilegePopAudioIndexesSize:
            littleRaw = CGAffineTransformMakeTranslation(0, -100);
            break;
        case HallVisitProcessorGolfMatrixHandshake:
            littleRaw = CGAffineTransformMakeTranslation(0, 100);
            break;
        default:
            littleRaw = CGAffineTransformMakeScale(0.8, 0.8);
            break;
    }
    
    self.alpha = 0;
    self.topPastLabel.superview.littleRaw = littleRaw;
    
    [UIView animateWithDuration:0.3
                          delay:0
         usingSpringWithDamping:0.7
          initialSpringVelocity:0.1
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
        self.alpha = 1;
        self.topPastLabel.superview.littleRaw = CGAffineTransformIdentity;
    } completion:nil];
}

- (void)didAlarmParsingAudienceHeartTaskArt:(void(^)(void))completion {
    CGAffineTransform littleRaw;
    switch (self.legalGet) {
        case PrivilegePopAudioIndexesSize:
            littleRaw = CGAffineTransformMakeTranslation(0, -self.topPastLabel.superview.tilde.size.height - 50);
            break;
        case HallVisitProcessorGolfMatrixHandshake:
            littleRaw = CGAffineTransformMakeTranslation(0, self.topPastLabel.superview.tilde.size.height + 50);
            break;
        default:
            littleRaw = CGAffineTransformMakeScale(0.8, 0.8);
            break;
    }
    
    [UIView animateWithDuration:0.25
                     animations:^{
        self.alpha = 0;
        self.topPastLabel.superview.littleRaw = littleRaw;
    } completion:^(BOOL forkSend) {
        if (completion) completion();
    }];
}


- (void)baselineInferRaiseOptAdaptive {
    UIView *futureBus = self.topPastLabel.superview;
    
    
    switch (self.legalGet) {
        case PrivilegePopAudioIndexesSize: {
            [futureBus.mixDarwin constraintEqualToAnchor:self.safeAreaLayoutGuide.mixDarwin
                                               constant:30].active = YES;
            break;
        }
        case SupportsSamplingProfilesPencilAreCenter: {
            [futureBus.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;
            break;
        }
        case HallVisitProcessorGolfMatrixHandshake: {
            [futureBus.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor
                                                  constant:-30].active = YES;
            break;
        }
    }
    
    
    [futureBus.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES;
}


+ (void)foreverAcquireStepperStandExponentExpiresColor:(UIColor *)color {
    viabilityMusicianBagAdjectiveKeyColor = color;
}

+ (void)clipEastFatRunColor:(UIColor *)color {
    waxMinorGramColor = color;
}

+ (void)mergeSunWhoHer:(UIFont *)font {
    renderWidget = font;
}

+ (void)meterMotionDemandLyricistDogRadius:(CGFloat)radius {
    deviceTexturedRadius = radius;
}


+ (void)bracket:(NSString *)message {
    [self show:message tabPrint:2.0 legalGet:PrivilegePopAudioIndexesSize];
}

+ (void)raceCenter:(NSString *)message {
    [self show:message tabPrint:2.0 legalGet:SupportsSamplingProfilesPencilAreCenter];
}

+ (void)spaPrinter:(NSString *)message {
    [self show:message tabPrint:2.0 legalGet:HallVisitProcessorGolfMatrixHandshake];
}

- (void)skipped {
    
}

@end
