






#import "PetiteLossUsedViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+MathIntro.h"
#import "NSString+ResizeDelta.h"

@interface PetiteLossUsedViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *saturatedCrossControl;
@property (nonatomic, strong) UIView * tensionMostDogFaeroeseOptimized;
@property (nonatomic, strong) UIView * decryptPinStalledFaxDiscovery;

@property (nonatomic, strong) UIScrollView * expandSevenView;

@end

@implementation PetiteLossUsedViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.logAddTintButton.hidden = YES;
    self.truncatesButton.hidden = YES;
    
    UISegmentedControl *elapsedView = [[UISegmentedControl alloc] initWithItems:@[PriorEarSee.drawCreditLeft.separatorPeriodicComposeStylusPinchAir,PriorEarSee.drawCreditLeft.springCardTwentyFarsiPostcardList]];
    elapsedView.layer.masksToBounds = YES; 
    elapsedView.layer.cornerRadius = 2;    
    [elapsedView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PriorEarSee seeKazakhColor]} forState:UIControlStateSelected];
    [elapsedView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PriorEarSee seeKazakhColor]} forState:UIControlStateNormal];
    [self.view addSubview:elapsedView];
    [elapsedView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(PriorEarSee.netListPhoto.escapeMoire);
    }];
    [elapsedView addTarget:self action:@selector(translateSlab:) forControlEvents:UIControlEventValueChanged];
    self.saturatedCrossControl = elapsedView;
    
    _expandSevenView = [[UIScrollView alloc]init];
    _expandSevenView.pagingEnabled = YES;
    _expandSevenView.delegate = self;
    [self.view addSubview:_expandSevenView];
    [_expandSevenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(PriorEarSee.netListPhoto.uighurDerive);
        make.right.equalTo(self.view).offset(-PriorEarSee.netListPhoto.uighurDerive);
        make.top.equalTo(self.view).offset(PriorEarSee.netListPhoto.wetDrumTight);
        make.bottom.equalTo(self.view).offset(-PriorEarSee.netListPhoto.rootAskScene);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.expandSevenView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.expandSevenView);
        make.height.equalTo(_expandSevenView);
    }];
    
    UIView * axesProduced = [self oceanScaleView:[PriorEarSee loadUnboundInvitedAlcoholAll]];
    [containerView addSubview:axesProduced];
    [axesProduced mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.expandSevenView);
    }];
    self.tensionMostDogFaeroeseOptimized = axesProduced;
    
    UIView * bayerListEgg = [self oceanScaleView:[PriorEarSee depthSwitchSinPersonPending]];
    [containerView addSubview:bayerListEgg];
    [bayerListEgg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(axesProduced.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.expandSevenView);
    }];
    self.decryptPinStalledFaxDiscovery = bayerListEgg;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bayerListEgg.mas_right);
    }];
    
    if (![self.theBuddyAge boolValue]) {
        UIButton *auditedButton = [PriorEarSee alignmentBlindingScrollInstancesBuildColor:PriorEarSee.drawCreditLeft.predicateYet];
        [auditedButton setBackgroundImage:[UIImage skinAnyClipMapColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [auditedButton addTarget:self action:@selector(buttonPaperLogoFatTextualAbove:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:auditedButton];
        
        [auditedButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-PriorEarSee.netListPhoto.allConstant);
            make.left.equalTo(self.view).offset(PriorEarSee.netListPhoto.uighurDerive);
            make.right.equalTo(self.view.mas_centerX).offset(-PriorEarSee.netListPhoto.verticalHer);
            make.height.mas_equalTo(PriorEarSee.netListPhoto.didCardFarsi);
        }];
    }

    UIButton *hueTallButton =  [PriorEarSee alignmentBlindingScrollInstancesBuildColor:PriorEarSee.drawCreditLeft.bounceRole];
    [hueTallButton addTarget:self action:@selector(peerFavoriteFragmentsCanonicalShadowSnow:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:hueTallButton];
    BOOL slopeButton = ![self.theBuddyAge boolValue];
    [hueTallButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-PriorEarSee.netListPhoto.allConstant);
        make.right.equalTo(self.view).offset(-PriorEarSee.netListPhoto.uighurDerive);
        
        if (slopeButton) {
            make.left.equalTo(self.view.mas_centerX).offset(PriorEarSee.netListPhoto.verticalHer);
        } else {
            make.left.equalTo(self.view).offset(PriorEarSee.netListPhoto.uighurDerive);
        }
        make.height.mas_equalTo(PriorEarSee.netListPhoto.didCardFarsi);
    }];
    
    elapsedView.selectedSegmentIndex = 0;
    [self translateSlab:elapsedView];
}

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

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

- (void)tabProposalErrorLimitSurgeText:(NSInteger)type {
    NSString *lettersIcy = nil;
    UIView *contentView = nil;
    lettersIcy = type == 0 ? [PriorEarSee loadUnboundInvitedAlcoholAll]:[PriorEarSee depthSwitchSinPersonPending];
    contentView = type == 0 ? self.tensionMostDogFaeroeseOptimized:self.decryptPinStalledFaxDiscovery;
    
    if (lettersIcy.lawDiskPause) {
        return;
    }
    
    if ([[lettersIcy pathExtension] containsString:PriorEarSee.netListPhoto.pongSonHomeCanadianRun]) {
        UITextView *theView = (UITextView *)contentView;
        if (theView.text.length > 0) {
            return;
        }

        
        [ManPenNearView paletteMarginView:contentView];

        
        NSURL *url = [NSURL URLWithString:lettersIcy];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [ManPenNearView portChatterSubsetKitActionView:contentView];
                
                if (error || data.length == 0) {
                    
                    theView.text = PriorEarSee.drawCreditLeft.preferredPromptSplitExportingEyePint;
                    return;
                }
                
                
                NSString *logZipBarHeap = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                theView.text = logZipBarHeap ?: PriorEarSee.drawCreditLeft.sheGroupedLooperGrayClampOneMantissa;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *eraser = (WKWebView *)contentView;
        if (!eraser.isLoading && eraser.estimatedProgress == 1) {
            [ManPenNearView portChatterSubsetKitActionView:contentView];
            return;
        }
        [ManPenNearView paletteMarginView:contentView];
        NSString *wayRename =  [lettersIcy.cardGaspBlueRopeProfilesLegal stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:wayRename];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [eraser loadRequest:request];
    }
}

- (void)buttonPaperLogoFatTextualAbove:(id)sender {
    [self universalArmSpecifiedSlopeFitAction:nil];
    if (self.operandInviteProvidersBoyfriendCount) {
        self.operandInviteProvidersBoyfriendCount(NO);
    }
}

- (void)peerFavoriteFragmentsCanonicalShadowSnow:(id)sender {
    [self universalArmSpecifiedSlopeFitAction:nil];
    if (self.operandInviteProvidersBoyfriendCount) {
        self.operandInviteProvidersBoyfriendCount(YES);
    }
}

- (UIView *)oceanScaleView:(NSString *)string {
    UIView *bedBypassed = nil;
    if ([[string pathExtension] containsString:PriorEarSee.netListPhoto.pongSonHomeCanadianRun]) {
        UITextView * ownStamp = [UITextView new];
        ownStamp.editable = NO;
        ownStamp.backgroundColor = UIColor.whiteColor;
        ownStamp.textColor = UIColor.grayColor;
        bedBypassed = ownStamp;
    }else {
        WKWebView *bigSpineBus = [[WKWebView alloc] initWithFrame:CGRectZero];
        bigSpineBus.backgroundColor = UIColor.clearColor;
        bigSpineBus.scrollView.backgroundColor = UIColor.lightGrayColor;
        bigSpineBus.opaque = YES;
        bigSpineBus.scrollView.bounces =NO;
        bigSpineBus.scrollView.showsVerticalScrollIndicator = NO;
        bigSpineBus.scrollView.showsHorizontalScrollIndicator = NO;
        bigSpineBus.navigationDelegate = self;
        bedBypassed = bigSpineBus;
    }
    return bedBypassed;
}

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

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

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

@end
