






#import "PathSourceLoadViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+PrettyHex.h"
#import "NSString+AddDutchWho.h"

@interface PathSourceLoadViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *bannerListenerControl;
@property (nonatomic, strong) UIView * flushLanguagePrincipalChargingHome;
@property (nonatomic, strong) UIView * plugUpsideHasIssuerInvisible;

@property (nonatomic, strong) UIScrollView * alpineDailyView;

@end

@implementation PathSourceLoadViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.bagDesktopButton.hidden = YES;
    self.greatRainButton.hidden = YES;
    
    UISegmentedControl *tiedForView = [[UISegmentedControl alloc] initWithItems:@[PinMovement.otherPhasePlug.triangleEnergyDogOurMembersAlign,PinMovement.otherPhasePlug.waxPoliciesCompactEggDryChecked]];
    tiedForView.layer.masksToBounds = YES; 
    tiedForView.layer.cornerRadius = 2;    
    [tiedForView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PinMovement unorderedColor]} forState:UIControlStateSelected];
    [tiedForView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PinMovement unorderedColor]} forState:UIControlStateNormal];
    [self.view addSubview:tiedForView];
    [tiedForView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(PinMovement.cupFormatSun.walkWalkAre);
    }];
    [tiedForView addTarget:self action:@selector(curveBeginAnd:) forControlEvents:UIControlEventValueChanged];
    self.bannerListenerControl = tiedForView;
    
    _alpineDailyView = [[UIScrollView alloc]init];
    _alpineDailyView.pagingEnabled = YES;
    _alpineDailyView.delegate = self;
    [self.view addSubview:_alpineDailyView];
    [_alpineDailyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(PinMovement.cupFormatSun.seeFadePaper);
        make.right.equalTo(self.view).offset(-PinMovement.cupFormatSun.seeFadePaper);
        make.top.equalTo(self.view).offset(PinMovement.cupFormatSun.availLogoMin);
        make.bottom.equalTo(self.view).offset(-PinMovement.cupFormatSun.sawScanShare);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.alpineDailyView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.alpineDailyView);
        make.height.equalTo(_alpineDailyView);
    }];
    
    UIView * anotherBreak = [self failSlightView:[PinMovement sigmaVerboseFetchDragStable]];
    [containerView addSubview:anotherBreak];
    [anotherBreak mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.alpineDailyView);
    }];
    self.flushLanguagePrincipalChargingHome = anotherBreak;
    
    UIView * rationalFour = [self failSlightView:[PinMovement notifiesAwayImmutableIncorrectSegments]];
    [containerView addSubview:rationalFour];
    [rationalFour mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(anotherBreak.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.alpineDailyView);
    }];
    self.plugUpsideHasIssuerInvisible = rationalFour;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(rationalFour.mas_right);
    }];
    
    if (![self.modalKeyDid boolValue]) {
        UIButton *hellmanButton = [PinMovement narrativeForbidAlignedAcuteGrayColor:PinMovement.otherPhasePlug.busAlignBend];
        [hellmanButton setBackgroundImage:[UIImage exceededResultColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [hellmanButton addTarget:self action:@selector(negateCreamyCanPrepIntensityChina:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:hellmanButton];
        [hellmanButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-PinMovement.cupFormatSun.areFixElder);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(PinMovement.cupFormatSun.flipTrustDue);
        }];
    }
    
    UIButton *mostCupButton =  [PinMovement narrativeForbidAlignedAcuteGrayColor:PinMovement.otherPhasePlug.sawRoomRun];
    [mostCupButton addTarget:self action:@selector(wrongDeriveCoalesceLossPrimeSkipped:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:mostCupButton];
    [mostCupButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-PinMovement.cupFormatSun.areFixElder);
        make.centerX.equalTo(self.view).multipliedBy(![self.modalKeyDid boolValue]?1.35:1);
        make.height.mas_equalTo(PinMovement.cupFormatSun.flipTrustDue);
    }];
    
    tiedForView.selectedSegmentIndex = 0;
    [self curveBeginAnd:tiedForView];
}

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

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

- (void)ellipsisRecordingGainPolicyNiacinText:(NSInteger)type {
    NSString *barWatched = nil;
    UIView *contentView = nil;
    barWatched = type == 0 ? [PinMovement sigmaVerboseFetchDragStable]:[PinMovement notifiesAwayImmutableIncorrectSegments];
    contentView = type == 0 ? self.flushLanguagePrincipalChargingHome:self.plugUpsideHasIssuerInvisible;
    
    if (barWatched.typeUnderWax) {
        return;
    }
    
    if ([[barWatched pathExtension] containsString:PinMovement.cupFormatSun.reactorEnclosingWeightedFrameThe]) {
        UITextView *retView = (UITextView *)contentView;
        if (retView.text.length > 0) {
            return;
        }

        
        [ClickInnerView companyNormalView:contentView];

        
        NSURL *url = [NSURL URLWithString:barWatched];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [ClickInnerView axesSamplesLemmaPlaneCoverView:contentView];
                
                if (error || data.length == 0) {
                    
                    retView.text = PinMovement.otherPhasePlug.exponentLaterAppearSymbolsBackVision;
                    return;
                }
                
                
                NSString *peakRawPanMay = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                retView.text = peakRawPanMay ?: PinMovement.otherPhasePlug.ambiencePolishCollationValueSexOpaqueLoss;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *cupDry = (WKWebView *)contentView;
        if (!cupDry.isLoading && cupDry.estimatedProgress == 1) {
            [ClickInnerView axesSamplesLemmaPlaneCoverView:contentView];
            return;
        }
        [ClickInnerView companyNormalView:contentView];
        NSString *roundRead =  [barWatched.intentGoldenDeveloperSmallExtractMagnitude stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:roundRead];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [cupDry loadRequest:request];
    }
}

- (void)negateCreamyCanPrepIntensityChina:(id)sender {
    [self spaceBehaviorsBeforeScrollEnclosingAction:nil];
    if (self.tatarSmoothingTomorrowComparedListener) {
        self.tatarSmoothingTomorrowComparedListener(NO);
    }
}

- (void)wrongDeriveCoalesceLossPrimeSkipped:(id)sender {
    [self spaceBehaviorsBeforeScrollEnclosingAction:nil];
    if (self.tatarSmoothingTomorrowComparedListener) {
        self.tatarSmoothingTomorrowComparedListener(YES);
    }
}

- (UIView *)failSlightView:(NSString *)string {
    UIView *muteLoseDog = nil;
    if ([[string pathExtension] containsString:PinMovement.cupFormatSun.reactorEnclosingWeightedFrameThe]) {
        UITextView * panelKin = [UITextView new];
        panelKin.editable = NO;
        panelKin.backgroundColor = UIColor.whiteColor;
        panelKin.textColor = UIColor.grayColor;
        muteLoseDog = panelKin;
    }else {
        WKWebView *fivePubSize = [[WKWebView alloc] initWithFrame:CGRectZero];
        fivePubSize.backgroundColor = UIColor.clearColor;
        fivePubSize.scrollView.backgroundColor = UIColor.lightGrayColor;
        fivePubSize.opaque = YES;
        fivePubSize.scrollView.bounces =NO;
        fivePubSize.scrollView.showsVerticalScrollIndicator = NO;
        fivePubSize.scrollView.showsHorizontalScrollIndicator = NO;
        fivePubSize.navigationDelegate = self;
        muteLoseDog = fivePubSize;
    }
    return muteLoseDog;
}

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

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

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

@end
