






#import "CapsYouLowHaveViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+EvictFile.h"
#import "NSString+DueKitLossy.h"

@interface CapsYouLowHaveViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *stayLastSexualControl;
@property (nonatomic, strong) UIView * reportingRearrangeModifiersFurlongsDisables;
@property (nonatomic, strong) UIView * keyboardThatRestoreProducingFlatness;

@property (nonatomic, strong) UIScrollView * binLessFindView;

@end

@implementation CapsYouLowHaveViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.acrossStopButton.hidden = YES;
    self.earStrideButton.hidden = YES;
    
    UISegmentedControl *siteBagView = [[UISegmentedControl alloc] initWithItems:@[OutTapPlain.loudMeterMount.extentNotJoinHighestBypassBounce,OutTapPlain.loudMeterMount.fiveAbsoluteEyeEditorHeadphoneSound]];
    siteBagView.layer.masksToBounds = YES; 
    siteBagView.layer.cornerRadius = 2;    
    [siteBagView setTitleTextAttributes:@{NSForegroundColorAttributeName:[OutTapPlain bagOuncesColor]} forState:UIControlStateSelected];
    [siteBagView setTitleTextAttributes:@{NSForegroundColorAttributeName:[OutTapPlain bagOuncesColor]} forState:UIControlStateNormal];
    [self.view addSubview:siteBagView];
    [siteBagView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(OutTapPlain.parentMixMay.butDogOther);
    }];
    [siteBagView addTarget:self action:@selector(nowLoopCupSee:) forControlEvents:UIControlEventValueChanged];
    self.stayLastSexualControl = siteBagView;
    
    _binLessFindView = [[UIScrollView alloc]init];
    _binLessFindView.pagingEnabled = YES;
    _binLessFindView.delegate = self;
    [self.view addSubview:_binLessFindView];
    [_binLessFindView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(OutTapPlain.parentMixMay.pashtoMenAge);
        make.right.equalTo(self.view).offset(-OutTapPlain.parentMixMay.pashtoMenAge);
        make.top.equalTo(self.view).offset(OutTapPlain.parentMixMay.markReleased);
        make.bottom.equalTo(self.view).offset(-OutTapPlain.parentMixMay.strictButTry);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.binLessFindView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.binLessFindView);
        make.height.equalTo(_binLessFindView);
    }];
    
    UIView * labelWetWork = [self tabDefinedView:[OutTapPlain moleShoulderTakeWorkspaceLabeled]];
    [containerView addSubview:labelWetWork];
    [labelWetWork mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.binLessFindView);
    }];
    self.reportingRearrangeModifiersFurlongsDisables = labelWetWork;
    
    UIView * lessTagUsage = [self tabDefinedView:[OutTapPlain ornamentsVelocityDesignCutoffHighest]];
    [containerView addSubview:lessTagUsage];
    [lessTagUsage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(labelWetWork.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.binLessFindView);
    }];
    self.keyboardThatRestoreProducingFlatness = lessTagUsage;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(lessTagUsage.mas_right);
    }];
    
    if (![self.runServices boolValue]) {
        UIButton *corruptButton = [OutTapPlain busIndoorTableDrizzleAwayColor:OutTapPlain.loudMeterMount.hostRedQuick];
        [corruptButton setBackgroundImage:[UIImage decimalAdvanceColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [corruptButton addTarget:self action:@selector(readyPeopleVolumeValidityMidRectum:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:corruptButton];
        
        [corruptButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-OutTapPlain.parentMixMay.bevelSodium);
            make.left.equalTo(self.view).offset(OutTapPlain.parentMixMay.pashtoMenAge);
            make.right.equalTo(self.view.mas_centerX).offset(-OutTapPlain.parentMixMay.boundIndian);
            make.height.mas_equalTo(OutTapPlain.parentMixMay.tipOptAscent);
        }];
    }

    UIButton *tempSumButton =  [OutTapPlain busIndoorTableDrizzleAwayColor:OutTapPlain.loudMeterMount.koreanEach];
    [tempSumButton addTarget:self action:@selector(fitPrincipalMiddleBlobWaterSize:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:tempSumButton];
    BOOL acuteButton = ![self.runServices boolValue];
    [tempSumButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-OutTapPlain.parentMixMay.bevelSodium);
        make.right.equalTo(self.view).offset(-OutTapPlain.parentMixMay.pashtoMenAge);
        
        if (acuteButton) {
            make.left.equalTo(self.view.mas_centerX).offset(OutTapPlain.parentMixMay.boundIndian);
        } else {
            make.left.equalTo(self.view).offset(OutTapPlain.parentMixMay.pashtoMenAge);
        }
        make.height.mas_equalTo(OutTapPlain.parentMixMay.tipOptAscent);
    }];
    
    siteBagView.selectedSegmentIndex = 0;
    [self nowLoopCupSee:siteBagView];
}

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    [self.stayLastSexualControl setSelectedSegmentIndex:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
    [self heightHeadsetSumTagSmileText:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
}

- (void)nowLoopCupSee:(UISegmentedControl *)sender {
    [self heightHeadsetSumTagSmileText:sender.selectedSegmentIndex == 0?0:1];
    [self.binLessFindView setContentOffset:CGPointMake(sender.selectedSegmentIndex == 0?0:self.binLessFindView.frame.size.width, 0) animated:YES];
}

- (void)heightHeadsetSumTagSmileText:(NSInteger)type {
    NSString *pairHyphen = nil;
    UIView *contentView = nil;
    pairHyphen = type == 0 ? [OutTapPlain moleShoulderTakeWorkspaceLabeled]:[OutTapPlain ornamentsVelocityDesignCutoffHighest];
    contentView = type == 0 ? self.reportingRearrangeModifiersFurlongsDisables:self.keyboardThatRestoreProducingFlatness;
    
    if (pairHyphen.twoWonBypass) {
        return;
    }
    
    if ([[pairHyphen pathExtension] containsString:OutTapPlain.parentMixMay.kitMayLambdaPerformsBundle]) {
        UITextView *logView = (UITextView *)contentView;
        if (logView.text.length > 0) {
            return;
        }

        
        [ManButThinView cutBothCarOwnView:contentView];

        
        NSURL *url = [NSURL URLWithString:pairHyphen];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [ManButThinView unlockInfoBufferVectorBigView:contentView];
                
                if (error || data.length == 0) {
                    
                    logView.text = OutTapPlain.loudMeterMount.burstCenteringBarExcludeHectaresDisabled;
                    return;
                }
                
                
                NSString *featGenreWill = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                logView.text = featGenreWill ?: OutTapPlain.loudMeterMount.changeZipBodyOptimizedThiaminHisHumidity;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *tenWay = (WKWebView *)contentView;
        if (!tenWay.isLoading && tenWay.estimatedProgress == 1) {
            [ManButThinView unlockInfoBufferVectorBigView:contentView];
            return;
        }
        [ManButThinView cutBothCarOwnView:contentView];
        NSString *penMiddle =  [pairHyphen.commonCameraElevationAgeWideOrange stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:penMiddle];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [tenWay loadRequest:request];
    }
}

- (void)readyPeopleVolumeValidityMidRectum:(id)sender {
    [self groupKitFisheyeBordersIdentityAction:nil];
    if (self.echoPrefixedKitInitialPencil) {
        self.echoPrefixedKitInitialPencil(NO);
    }
}

- (void)fitPrincipalMiddleBlobWaterSize:(id)sender {
    [self groupKitFisheyeBordersIdentityAction:nil];
    if (self.echoPrefixedKitInitialPencil) {
        self.echoPrefixedKitInitialPencil(YES);
    }
}

- (UIView *)tabDefinedView:(NSString *)string {
    UIView *teamSexType = nil;
    if ([[string pathExtension] containsString:OutTapPlain.parentMixMay.kitMayLambdaPerformsBundle]) {
        UITextView * tapExact = [UITextView new];
        tapExact.editable = NO;
        tapExact.backgroundColor = UIColor.whiteColor;
        tapExact.textColor = UIColor.grayColor;
        teamSexType = tapExact;
    }else {
        WKWebView *renameReset = [[WKWebView alloc] initWithFrame:CGRectZero];
        renameReset.backgroundColor = UIColor.clearColor;
        renameReset.scrollView.backgroundColor = UIColor.lightGrayColor;
        renameReset.opaque = YES;
        renameReset.scrollView.bounces =NO;
        renameReset.scrollView.showsVerticalScrollIndicator = NO;
        renameReset.scrollView.showsHorizontalScrollIndicator = NO;
        renameReset.navigationDelegate = self;
        teamSexType = renameReset;
    }
    return teamSexType;
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
    [ManButThinView unlockInfoBufferVectorBigView:webView];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    UIEdgeInsets sentProlog = [[AwayGlyphManager shared] tagKeysSwipeWindow].safeAreaInsets;
    sentProlog.top    += 10;
    sentProlog.left   += 10;
    sentProlog.bottom += 10;
    sentProlog.right  += 10;

    [self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(sentProlog);
    }];
}

@end
