






#import "InvertAnimatorViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+WorldHold.h"
#import "NSString+ZoomGeneric.h"

@interface InvertAnimatorViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *pathActiveMildControl;
@property (nonatomic, strong) UIView * disappearConflictsSindhiYahooStop;
@property (nonatomic, strong) UIView * kelvinRetrieveWinServicesWay;

@property (nonatomic, strong) UIScrollView * factCallTapView;

@end

@implementation InvertAnimatorViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.napEyeCityButton.hidden = YES;
    self.stayPaperButton.hidden = YES;
    
    UISegmentedControl *zipNameView = [[UISegmentedControl alloc] initWithItems:@[IndicesBest.linerSharpness.claimSuccessObserveInterruptMinSob,IndicesBest.linerSharpness.issuerSelectorPushWhoArteryPaste]];
    zipNameView.layer.masksToBounds = YES; 
    zipNameView.layer.cornerRadius = 2;    
    [zipNameView setTitleTextAttributes:@{NSForegroundColorAttributeName:[IndicesBest sexExtrasColor]} forState:UIControlStateSelected];
    [zipNameView setTitleTextAttributes:@{NSForegroundColorAttributeName:[IndicesBest sexExtrasColor]} forState:UIControlStateNormal];
    [self.view addSubview:zipNameView];
    [zipNameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(IndicesBest.trustMainArm.agentUseRun);
    }];
    [zipNameView addTarget:self action:@selector(nowHailFatHow:) forControlEvents:UIControlEventValueChanged];
    self.pathActiveMildControl = zipNameView;
    
    _factCallTapView = [[UIScrollView alloc]init];
    _factCallTapView.pagingEnabled = YES;
    _factCallTapView.delegate = self;
    [self.view addSubview:_factCallTapView];
    [_factCallTapView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(IndicesBest.trustMainArm.renameArmpit);
        make.right.equalTo(self.view).offset(-IndicesBest.trustMainArm.renameArmpit);
        make.top.equalTo(self.view).offset(IndicesBest.trustMainArm.unloadIcyHue);
        make.bottom.equalTo(self.view).offset(-IndicesBest.trustMainArm.wrestlingGet);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.factCallTapView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.factCallTapView);
        make.height.equalTo(_factCallTapView);
    }];
    
    UIView * chunkHeadset = [self postSubBinView:[IndicesBest coloredObstacleContainsEuropeanPlay]];
    [containerView addSubview:chunkHeadset];
    [chunkHeadset mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.factCallTapView);
    }];
    self.disappearConflictsSindhiYahooStop = chunkHeadset;
    
    UIView * greaterRound = [self postSubBinView:[IndicesBest acceptCursorStarEqualMile]];
    [containerView addSubview:greaterRound];
    [greaterRound mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(chunkHeadset.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.factCallTapView);
    }];
    self.kelvinRetrieveWinServicesWay = greaterRound;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(greaterRound.mas_right);
    }];
    
    if (![self.chunkySmall boolValue]) {
        UIButton *bankersButton = [IndicesBest faxDraftDialogEarCutterColor:IndicesBest.linerSharpness.selectIllPan];
        [bankersButton setBackgroundImage:[UIImage clipSigmaDolbyColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [bankersButton addTarget:self action:@selector(lappishSnapshotSensitiveDarkBundleSock:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:bankersButton];
        
        [bankersButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-IndicesBest.trustMainArm.rootLenient);
            make.left.equalTo(self.view).offset(IndicesBest.trustMainArm.renameArmpit);
            make.right.equalTo(self.view.mas_centerX).offset(-IndicesBest.trustMainArm.bodyThermal);
            make.height.mas_equalTo(IndicesBest.trustMainArm.modalHeapWon);
        }];
    }

    UIButton *stayNapButton =  [IndicesBest faxDraftDialogEarCutterColor:IndicesBest.linerSharpness.shelfOccur];
    [stayNapButton addTarget:self action:@selector(miterTurnEstonianWalkingFavoriteYahoo:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:stayNapButton];
    BOOL aboutButton = ![self.chunkySmall boolValue];
    [stayNapButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-IndicesBest.trustMainArm.rootLenient);
        make.right.equalTo(self.view).offset(-IndicesBest.trustMainArm.renameArmpit);
        
        if (aboutButton) {
            make.left.equalTo(self.view.mas_centerX).offset(IndicesBest.trustMainArm.bodyThermal);
        } else {
            make.left.equalTo(self.view).offset(IndicesBest.trustMainArm.renameArmpit);
        }
        make.height.mas_equalTo(IndicesBest.trustMainArm.modalHeapWon);
    }];
    
    zipNameView.selectedSegmentIndex = 0;
    [self nowHailFatHow:zipNameView];
}

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

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

- (void)magicParagraphNodeUbiquityBypassText:(NSInteger)type {
    NSString *boxBackSaw = nil;
    UIView *contentView = nil;
    boxBackSaw = type == 0 ? [IndicesBest coloredObstacleContainsEuropeanPlay]:[IndicesBest acceptCursorStarEqualMile];
    contentView = type == 0 ? self.disappearConflictsSindhiYahooStop:self.kelvinRetrieveWinServicesWay;
    
    if (boxBackSaw.receiveClang) {
        return;
    }
    
    if ([[boxBackSaw pathExtension] containsString:IndicesBest.trustMainArm.stoodRunIntegrateGrammarAny]) {
        UITextView *runView = (UITextView *)contentView;
        if (runView.text.length > 0) {
            return;
        }

        
        [AirCompactView secondsSubsetView:contentView];

        
        NSURL *url = [NSURL URLWithString:boxBackSaw];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [AirCompactView originFeedbackPanCatAdjustingView:contentView];
                
                if (error || data.length == 0) {
                    
                    runView.text = IndicesBest.linerSharpness.advancedExecuteNominallyBookJoinLoose;
                    return;
                }
                
                
                NSString *funBoxDecoder = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                runView.text = funBoxDecoder ?: IndicesBest.linerSharpness.allowableSlightPolishJustZoneVitalityFunction;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *mapBig = (WKWebView *)contentView;
        if (!mapBig.isLoading && mapBig.estimatedProgress == 1) {
            [AirCompactView originFeedbackPanCatAdjustingView:contentView];
            return;
        }
        [AirCompactView secondsSubsetView:contentView];
        NSString *authorLog =  [boxBackSaw.highOperatorGregorianResourcesFlushCap stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:authorLog];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [mapBig loadRequest:request];
    }
}

- (void)lappishSnapshotSensitiveDarkBundleSock:(id)sender {
    [self passiveCocoaSubRoleCurlAction:nil];
    if (self.recordPlugHerSeeSlovak) {
        self.recordPlugHerSeeSlovak(NO);
    }
}

- (void)miterTurnEstonianWalkingFavoriteYahoo:(id)sender {
    [self passiveCocoaSubRoleCurlAction:nil];
    if (self.recordPlugHerSeeSlovak) {
        self.recordPlugHerSeeSlovak(YES);
    }
}

- (UIView *)postSubBinView:(NSString *)string {
    UIView *pubBoldTint = nil;
    if ([[string pathExtension] containsString:IndicesBest.trustMainArm.stoodRunIntegrateGrammarAny]) {
        UITextView * bevelEar = [UITextView new];
        bevelEar.editable = NO;
        bevelEar.backgroundColor = UIColor.whiteColor;
        bevelEar.textColor = UIColor.grayColor;
        pubBoldTint = bevelEar;
    }else {
        WKWebView *lowerPutAdd = [[WKWebView alloc] initWithFrame:CGRectZero];
        lowerPutAdd.backgroundColor = UIColor.clearColor;
        lowerPutAdd.scrollView.backgroundColor = UIColor.lightGrayColor;
        lowerPutAdd.opaque = YES;
        lowerPutAdd.scrollView.bounces =NO;
        lowerPutAdd.scrollView.showsVerticalScrollIndicator = NO;
        lowerPutAdd.scrollView.showsHorizontalScrollIndicator = NO;
        lowerPutAdd.navigationDelegate = self;
        pubBoldTint = lowerPutAdd;
    }
    return pubBoldTint;
}

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

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

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

@end
