






#import "LowFirePanGaspViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+FindPrice.h"
#import "NSString+TildeWeekly.h"

@interface LowFirePanGaspViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *ownPastAreFairControl;
@property (nonatomic, strong) UIView * chromaCanSecurityOrnamentMind;
@property (nonatomic, strong) UIView * bestFinishGetSubConverter;

@property (nonatomic, strong) UIScrollView * updateInputView;

@end

@implementation LowFirePanGaspViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.funkSphereButton.hidden = YES;
    self.blurRangeButton.hidden = YES;
    
    UISegmentedControl *addPlugView = [[UISegmentedControl alloc] initWithItems:@[TextualTemp.mindSnowHeader.debuggerInverseAffectedMergeDigitizedDerived,TextualTemp.mindSnowHeader.bitsRadixGeneratesDoneFetchSob]];
    addPlugView.layer.masksToBounds = YES; 
    addPlugView.layer.cornerRadius = 2;    
    [addPlugView setTitleTextAttributes:@{NSForegroundColorAttributeName:[TextualTemp longBoostColor]} forState:UIControlStateSelected];
    [addPlugView setTitleTextAttributes:@{NSForegroundColorAttributeName:[TextualTemp longBoostColor]} forState:UIControlStateNormal];
    [self.view addSubview:addPlugView];
    [addPlugView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(TextualTemp.cancelsParse.wetLogoRole);
    }];
    [addPlugView addTarget:self action:@selector(digitNapLiter:) forControlEvents:UIControlEventValueChanged];
    self.ownPastAreFairControl = addPlugView;
    
    _updateInputView = [[UIScrollView alloc]init];
    _updateInputView.pagingEnabled = YES;
    _updateInputView.delegate = self;
    [self.view addSubview:_updateInputView];
    [_updateInputView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(TextualTemp.cancelsParse.leapDecayNet);
        make.right.equalTo(self.view).offset(-TextualTemp.cancelsParse.leapDecayNet);
        make.top.equalTo(self.view).offset(TextualTemp.cancelsParse.putIntroHigh);
        make.bottom.equalTo(self.view).offset(-TextualTemp.cancelsParse.pairPanTilde);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.updateInputView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.updateInputView);
        make.height.equalTo(_updateInputView);
    }];
    
    UIView * sharpnessMid = [self retOutGrayView:[TextualTemp predictedEnvelopeRespectsThiaminMaximum]];
    [containerView addSubview:sharpnessMid];
    [sharpnessMid mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.updateInputView);
    }];
    self.chromaCanSecurityOrnamentMind = sharpnessMid;
    
    UIView * downAlignWho = [self retOutGrayView:[TextualTemp genreTowerChainFormatSpacing]];
    [containerView addSubview:downAlignWho];
    [downAlignWho mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sharpnessMid.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.updateInputView);
    }];
    self.bestFinishGetSubConverter = downAlignWho;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(downAlignWho.mas_right);
    }];
    
    if (![self.cardTurnSum boolValue]) {
        UIButton *chamberButton = [TextualTemp preventLinkDeriveExponentRateColor:TextualTemp.mindSnowHeader.sobMinHockey];
        [chamberButton setBackgroundImage:[UIImage penVowelOwnTryColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [chamberButton addTarget:self action:@selector(returnsFinishLemmaPlanDidDropped:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:chamberButton];
        
        [chamberButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-TextualTemp.cancelsParse.cupLowTrack);
            make.left.equalTo(self.view).offset(TextualTemp.cancelsParse.leapDecayNet);
            make.right.equalTo(self.view.mas_centerX).offset(-TextualTemp.cancelsParse.rowsSeedUse);
            make.height.mas_equalTo(TextualTemp.cancelsParse.canonStalled);
        }];
    }

    UIButton *foodHowButton =  [TextualTemp preventLinkDeriveExponentRateColor:TextualTemp.mindSnowHeader.illDayTied];
    [foodHowButton addTarget:self action:@selector(bedEarlyExtentsIndexedCheckEngraved:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:foodHowButton];
    BOOL deltaButton = ![self.cardTurnSum boolValue];
    [foodHowButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-TextualTemp.cancelsParse.cupLowTrack);
        make.right.equalTo(self.view).offset(-TextualTemp.cancelsParse.leapDecayNet);
        
        if (deltaButton) {
            make.left.equalTo(self.view.mas_centerX).offset(TextualTemp.cancelsParse.rowsSeedUse);
        } else {
            make.left.equalTo(self.view).offset(TextualTemp.cancelsParse.leapDecayNet);
        }
        make.height.mas_equalTo(TextualTemp.cancelsParse.canonStalled);
    }];
    
    addPlugView.selectedSegmentIndex = 0;
    [self digitNapLiter:addPlugView];
}

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

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

- (void)preventedSettingsOurPanHasText:(NSInteger)type {
    NSString *boxRenewed = nil;
    UIView *contentView = nil;
    boxRenewed = type == 0 ? [TextualTemp predictedEnvelopeRespectsThiaminMaximum]:[TextualTemp genreTowerChainFormatSpacing];
    contentView = type == 0 ? self.chromaCanSecurityOrnamentMind:self.bestFinishGetSubConverter;
    
    if (boxRenewed.birthdayPack) {
        return;
    }
    
    if ([[boxRenewed pathExtension] containsString:TextualTemp.cancelsParse.panMeterProcessorTalkSuccess]) {
        UITextView *lawView = (UITextView *)contentView;
        if (lawView.text.length > 0) {
            return;
        }

        
        [HourEndEraView offProjectSpaView:contentView];

        
        NSURL *url = [NSURL URLWithString:boxRenewed];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [HourEndEraView sobPenFirstUnfocusedAskView:contentView];
                
                if (error || data.length == 0) {
                    
                    lawView.text = TextualTemp.mindSnowHeader.setupYearsMomentJobConjugateLiner;
                    return;
                }
                
                
                NSString *formPoolAlive = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                lawView.text = formPoolAlive ?: TextualTemp.mindSnowHeader.smilePanExchangesPointDigestFragmentsPartially;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *icyOpt = (WKWebView *)contentView;
        if (!icyOpt.isLoading && icyOpt.estimatedProgress == 1) {
            [HourEndEraView sobPenFirstUnfocusedAskView:contentView];
            return;
        }
        [HourEndEraView offProjectSpaView:contentView];
        NSString *briefLove =  [boxRenewed.hexCenteringExpectingCapacityRaceInuit stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:briefLove];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [icyOpt loadRequest:request];
    }
}

- (void)returnsFinishLemmaPlanDidDropped:(id)sender {
    [self menOwnTopHeadsetWarnAction:nil];
    if (self.startingCancelledProxySpokenTool) {
        self.startingCancelledProxySpokenTool(NO);
    }
}

- (void)bedEarlyExtentsIndexedCheckEngraved:(id)sender {
    [self menOwnTopHeadsetWarnAction:nil];
    if (self.startingCancelledProxySpokenTool) {
        self.startingCancelledProxySpokenTool(YES);
    }
}

- (UIView *)retOutGrayView:(NSString *)string {
    UIView *switchTotal = nil;
    if ([[string pathExtension] containsString:TextualTemp.cancelsParse.panMeterProcessorTalkSuccess]) {
        UITextView * napHours = [UITextView new];
        napHours.editable = NO;
        napHours.backgroundColor = UIColor.whiteColor;
        napHours.textColor = UIColor.grayColor;
        switchTotal = napHours;
    }else {
        WKWebView *afterDefine = [[WKWebView alloc] initWithFrame:CGRectZero];
        afterDefine.backgroundColor = UIColor.clearColor;
        afterDefine.scrollView.backgroundColor = UIColor.lightGrayColor;
        afterDefine.opaque = YES;
        afterDefine.scrollView.bounces =NO;
        afterDefine.scrollView.showsVerticalScrollIndicator = NO;
        afterDefine.scrollView.showsHorizontalScrollIndicator = NO;
        afterDefine.navigationDelegate = self;
        switchTotal = afterDefine;
    }
    return switchTotal;
}

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

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

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

@end
