

#import "BezelViewController.h"
#import "Model.h"
#import "PerformerModeChooseForkInsulinWin.h"
#import "WaistObjectRecentlyCloseBest.h"
#import "OurFastestConfig.h"

@interface BezelViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) PerformerModeChooseForkInsulinWin *pushSmoothTransformTouchSaturate;
@property (nonatomic, strong) WaistObjectRecentlyCloseBest *sensorAgeDeletingPerformsFilm;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static WaistObjectRecentlyCloseBest *notArabicSobRecordedBadgeFlight = nil;
static PerformerModeChooseForkInsulinWin *howProvidingLockingCompoundDescendedProject = nil;

@implementation BezelViewController

+ (void)burnDryCall {
    
    [Model introTapAccurateRespondDrawingPin];

    howProvidingLockingCompoundDescendedProject = [[PerformerModeChooseForkInsulinWin alloc] init];
    howProvidingLockingCompoundDescendedProject.searchLevel = AlignEditBuffersSodiumGlobally;

    [Model reportedSpouseCovariantDegreesPoint:howProvidingLockingCompoundDescendedProject];

    notArabicSobRecordedBadgeFlight = [[WaistObjectRecentlyCloseBest alloc] init];
    notArabicSobRecordedBadgeFlight.searchLevel = BevelSunReady;
    notArabicSobRecordedBadgeFlight.grouped = 7;
    notArabicSobRecordedBadgeFlight.icyEarMusicRoundIndirect = YES;
    [Model reportedSpouseCovariantDegreesPoint:notArabicSobRecordedBadgeFlight];

    [notArabicSobRecordedBadgeFlight indoorPrefixed];
}

+ (WaistObjectRecentlyCloseBest *)primaryTouchNumericBigSixFailing {
    return notArabicSobRecordedBadgeFlight;
}
+ (PerformerModeChooseForkInsulinWin *)maxTooFoundLoveWorkflowPlane {
    return howProvidingLockingCompoundDescendedProject;
}

- (PerformerModeChooseForkInsulinWin *)pushSmoothTransformTouchSaturate {
    return howProvidingLockingCompoundDescendedProject;
}

+ (void)showFromViewController:(UIViewController *)parentVC {
    BezelViewController *focal = [[BezelViewController alloc] init];
    UINavigationController *opt = [[UINavigationController alloc] initWithRootViewController:focal];
    opt.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:opt animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = whiteWayFit.nearDefinedDustTreeClangEntered;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(kannadaAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(placeAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(burnNowForAction)]
    ];
    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.sensorAgeDeletingPerformsFilm = [BezelViewController primaryTouchNumericBigSixFailing];

    [self microShe];
}

- (void)microShe {
    if (!self.sensorAgeDeletingPerformsFilm) {
        _textView.text = whiteWayFit.factoredUsabilityScalingSinMakerManager;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.sensorAgeDeletingPerformsFilm majorOddWayDate:self.selectedDate];
        } else {
            logs = [self.sensorAgeDeletingPerformsFilm selfSortWon];
        }

        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 = whiteWayFit.switchPositiveSampleStarDarkerSelecting;
            }

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

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

- (void)kannadaAction {
    [self microShe];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *entryFlag = [[NSDateFormatter alloc] init];
        entryFlag.dateFormat = whiteWayFit.goldenListenSugarSeparatorWalkTapCycle;
        NSString *sizeSobSun = [entryFlag stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = whiteWayFit.shotWeightedItalicGrandauntIgnoredAffine;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = whiteWayFit.adjustsChildFiltersPintBothHoverUnderline;
        } else {
            self.title = sizeSobSun;
        }
    } else {
        self.title = whiteWayFit.modelWhoTallOcclusionWayDelta;
    }
}

- (void)burnNowForAction {
    if (!self.sensorAgeDeletingPerformsFilm) {
        return;
    }

    NSArray<NSDate *> *rainBloodArray = [self.sensorAgeDeletingPerformsFilm snapTimeIts];
    if (rainBloodArray.count == 0) {
        UIAlertController *cross = [UIAlertController alertControllerWithTitle:whiteWayFit.eraPopIcyExistWeeklyBlur
                                                                       message:whiteWayFit.switchPositiveSampleStarDarkerSelecting
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [cross addAction:[UIAlertAction actionWithTitle:whiteWayFit.preferTallOperateAlongReleasedSpan style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:cross animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:whiteWayFit.offHalftonePenSoftballSkippedGetBlocker
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:whiteWayFit.modelWhoTallOcclusionWayDelta
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self microShe];
    }]];

    NSDateFormatter *entryFlag = [[NSDateFormatter alloc] init];
    entryFlag.dateFormat = whiteWayFit.goldenListenSugarSeparatorWalkTapCycle;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in rainBloodArray) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = whiteWayFit.shotWeightedItalicGrandauntIgnoredAffine;
        } else if ([calendar isDateInYesterday:date]) {
            title = whiteWayFit.adjustsChildFiltersPintBothHoverUnderline;
        } else {
            title = [entryFlag stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:whiteWayFit.syntaxParentalBurmeseFatEncodingsSubmit style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)placeAction {
    if (!self.sensorAgeDeletingPerformsFilm) {
        return;
    }

    NSArray *awayRank = [self.sensorAgeDeletingPerformsFilm kinClamping];
    if (awayRank.count == 0) {
        UIAlertController *cross = [UIAlertController alertControllerWithTitle:whiteWayFit.eraPopIcyExistWeeklyBlur
                                                                       message:whiteWayFit.longWinDecreaseMenuRotateHeart
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [cross addAction:[UIAlertAction actionWithTitle:whiteWayFit.preferTallOperateAlongReleasedSpan style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:cross animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:whiteWayFit.preventFarsiMaySlashWillSkippedHandles
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:whiteWayFit.ductilitySymbolicUnifiedInheritedExpandedNeedMax
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self behaveCorner];
    }]];

    for (NSURL *fileURL in awayRank) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:whiteWayFit.winLowBarNumericWeightedBusyFix, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self softPickFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:whiteWayFit.syntaxParentalBurmeseFatEncodingsSubmit style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)behaveCorner {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *yearBut = [self.sensorAgeDeletingPerformsFilm modelWristIdle];

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

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

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

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

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

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

@end
