

#import "BirthViewController.h"
#import "Pivot.h"
#import "AppleEndpointLoadSearchingDownloadsFiltering.h"
#import "HeartTemporaryDisappearStaticEqually.h"
#import "RootDetachConfig.h"

@interface BirthViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) AppleEndpointLoadSearchingDownloadsFiltering *originBigThatAssetProvides;
@property (nonatomic, strong) HeartTemporaryDisappearStaticEqually *gigahertzRateAmharicFinishBoost;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static HeartTemporaryDisappearStaticEqually *composerOptionPersonTagMathConclude = nil;
static AppleEndpointLoadSearchingDownloadsFiltering *mouthCoalescedPackSumJumpTorch = nil;

@implementation BirthViewController

+ (void)jobArmBrush {
    
    [Pivot opacityDarwinDublinPathTaskMove];

    mouthCoalescedPackSumJumpTorch = [[AppleEndpointLoadSearchingDownloadsFiltering alloc] init];
    mouthCoalescedPackSumJumpTorch.seeDayLevel = UseTamilFeaturedOceanIndent;

    [Pivot gestureNewsstandDustResolvingProduce:mouthCoalescedPackSumJumpTorch];

    composerOptionPersonTagMathConclude = [[HeartTemporaryDisappearStaticEqually alloc] init];
    composerOptionPersonTagMathConclude.seeDayLevel = MileKeySubIts;
    composerOptionPersonTagMathConclude.charSun = 7;
    composerOptionPersonTagMathConclude.trashThirdNoneFillIts = YES;
    [Pivot gestureNewsstandDustResolvingProduce:composerOptionPersonTagMathConclude];

    [composerOptionPersonTagMathConclude clearAggregate];
}

+ (HeartTemporaryDisappearStaticEqually *)transferHighlightHeapLappishToleranceHome {
    return composerOptionPersonTagMathConclude;
}
+ (AppleEndpointLoadSearchingDownloadsFiltering *)endSignerPurposePlainDefinesPeak {
    return mouthCoalescedPackSumJumpTorch;
}

- (AppleEndpointLoadSearchingDownloadsFiltering *)originBigThatAssetProvides {
    return mouthCoalescedPackSumJumpTorch;
}

+ (void)basalRunViewController:(UIViewController *)parentVC {
    BirthViewController *black = [[BirthViewController alloc] init];
    UINavigationController *dog = [[UINavigationController alloc] initWithRootViewController:black];
    dog.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:dog animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = blurGranted.sizeFitSemanticOddBedToo;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                            initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
                                            target:self
                                            action:@selector(patchAction)];

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(twoListAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(auditAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(allOneSaltAction)]
    ];
    self.navigationController.navigationBar.layoutMargins = UIEdgeInsetsMake(0, 0, 0, -10);

    _textView = [[UITextView alloc] init];
    _textView.font = [UIFont systemFontOfSize:11];
    _textView.editable = NO;
    _textView.backgroundColor = [UIColor systemBackgroundColor];
    _textView.textColor = [UIColor labelColor];
    _textView.translatesAutoresizingMaskIntoConstraints = NO;
    _textView.showsVerticalScrollIndicator = YES;
    _textView.showsHorizontalScrollIndicator = YES;
    _textView.alwaysBounceVertical = YES;
    
    _textView.scrollEnabled = YES;
    [self.view addSubview:_textView];

    [NSLayoutConstraint activateConstraints:@[
        [_textView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
        [_textView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:8],
        [_textView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-8],
        [_textView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
    ]];

    self.gigahertzRateAmharicFinishBoost = [BirthViewController transferHighlightHeapLappishToleranceHome];

    [self warnGray];
}

- (void)warnGray {
    if (!self.gigahertzRateAmharicFinishBoost) {
        _textView.text = blurGranted.utilityValueCountingNecessaryGetDivider;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.gigahertzRateAmharicFinishBoost flashNotRowDate:self.selectedDate];
        } else {
            logs = [self.gigahertzRateAmharicFinishBoost loadPenRole];
        }

        dispatch_async(dispatch_get_main_queue(), ^{
            if (logs.length > 0) {
                self.textView.text = logs;
                
                [self.textView scrollRangeToVisible:NSMakeRange(logs.length - 1, 1)];
            } else {
                self.textView.text = blurGranted.scannedHairDisabledFrameCaptionWin;
            }

            [self updateTitle];
        });
    });
}

- (void)patchAction {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)twoListAction {
    [self warnGray];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *skinSleep = [[NSDateFormatter alloc] init];
        skinSleep.dateFormat = blurGranted.workspaceHeadReceivesGlobalContactActionSelect;
        NSString *tapHexChat = [skinSleep stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = blurGranted.spellTabularDiscardedTradSongCapture;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = blurGranted.chinaMiterResizingChildCanadianMildTomorrow;
        } else {
            self.title = tapHexChat;
        }
    } else {
        self.title = blurGranted.tagalogWindowRelativeStandardCapableHas;
    }
}

- (void)allOneSaltAction {
    if (!self.gigahertzRateAmharicFinishBoost) {
        return;
    }

    NSArray<NSDate *> *brandPieceDate = [self.gigahertzRateAmharicFinishBoost finishLocal];
    if (brandPieceDate.count == 0) {
        UIAlertController *dolby = [UIAlertController alertControllerWithTitle:blurGranted.prefersDecoderIntrinsicRunStylusSpherical
                                                                       message:blurGranted.scannedHairDisabledFrameCaptionWin
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [dolby addAction:[UIAlertAction actionWithTitle:blurGranted.squashSpatialRankAuthoritySuddenRemainder style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:dolby animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:blurGranted.possibleContinuedHostingLetterAssemblyMakeExpansion
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:blurGranted.tagalogWindowRelativeStandardCapableHas
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self warnGray];
    }]];

    NSDateFormatter *skinSleep = [[NSDateFormatter alloc] init];
    skinSleep.dateFormat = blurGranted.workspaceHeadReceivesGlobalContactActionSelect;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in brandPieceDate) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = blurGranted.spellTabularDiscardedTradSongCapture;
        } else if ([calendar isDateInYesterday:date]) {
            title = blurGranted.chinaMiterResizingChildCanadianMildTomorrow;
        } else {
            title = [skinSleep stringFromDate:date];
        }

        [actionSheet addAction:[UIAlertAction actionWithTitle:title
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            self.selectedDate = date;
            [self warnGray];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:blurGranted.assistiveWayRunKurdishGrowDefine style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)auditAction {
    if (!self.gigahertzRateAmharicFinishBoost) {
        return;
    }

    NSArray *leasePin = [self.gigahertzRateAmharicFinishBoost awakeTipNap];
    if (leasePin.count == 0) {
        UIAlertController *dolby = [UIAlertController alertControllerWithTitle:blurGranted.prefersDecoderIntrinsicRunStylusSpherical
                                                                       message:blurGranted.ourAvailableBaseCardioidNotifyLaunch
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [dolby addAction:[UIAlertAction actionWithTitle:blurGranted.squashSpatialRankAuthoritySuddenRemainder style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:dolby animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:blurGranted.lighterCanArchiveRefusedChatterSerbianFully
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:blurGranted.prematureBengaliAnimateMegabitsSpotlightNegateDownhill
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self filmCalendar];
    }]];

    for (NSURL *fileURL in leasePin) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:blurGranted.stillImmediateGenderParagraphPlayableAbortedDash, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self heapTeamFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:blurGranted.assistiveWayRunKurdishGrowDefine style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)filmCalendar {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *burmese = [self.gigahertzRateAmharicFinishBoost spaStylePopTip];

        dispatch_async(dispatch_get_main_queue(), ^{
            if (burmese.length > 0) {
                UIActivityViewController *barCardBar = [[UIActivityViewController alloc]
                                                       initWithActivityItems:@[burmese]
                                                       applicationActivities:nil];

                if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
                    barCardBar.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
                }

                [self presentViewController:barCardBar animated:YES completion:nil];
            }
        });
    });
}

- (void)heapTeamFile:(NSURL *)fileURL {
    UIActivityViewController *barCardBar = [[UIActivityViewController alloc]
                                           initWithActivityItems:@[fileURL]
                                           applicationActivities:nil];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        barCardBar.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:barCardBar animated:YES completion:nil];
}

@end
