






#import "ChatBinPutCertViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+ArtBeacon.h"
#import "NSString+SheColorTry.h"

@interface ChatBinPutCertViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *projectsNumberControl;
@property (nonatomic, strong) UIView * powerYellowAddJumpCert;
@property (nonatomic, strong) UIView * yetSeparatorRepeatsOwnCallback;

@property (nonatomic, strong) UIScrollView * mindSheStepView;

@end

@implementation ChatBinPutCertViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.howPlusOldButton.hidden = YES;
    self.annotatedButton.hidden = YES;
    
    UISegmentedControl *lazyFatView = [[UISegmentedControl alloc] initWithItems:@[BadgeSunIcy.lastCaretReply.convertExtendsCategoryMillibarsExceptionAir,BadgeSunIcy.lastCaretReply.offGrantingForbidGroupingDomainsMin]];
    lazyFatView.layer.masksToBounds = YES; 
    lazyFatView.layer.cornerRadius = 2;    
    [lazyFatView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BadgeSunIcy lemmaBestColor]} forState:UIControlStateSelected];
    [lazyFatView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BadgeSunIcy lemmaBestColor]} forState:UIControlStateNormal];
    [self.view addSubview:lazyFatView];
    [lazyFatView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(BadgeSunIcy.greekBlueArt.sunCropNine);
    }];
    [lazyFatView addTarget:self action:@selector(treeLiveFlush:) forControlEvents:UIControlEventValueChanged];
    self.projectsNumberControl = lazyFatView;
    
    _mindSheStepView = [[UIScrollView alloc]init];
    _mindSheStepView.pagingEnabled = YES;
    _mindSheStepView.delegate = self;
    [self.view addSubview:_mindSheStepView];
    [_mindSheStepView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(BadgeSunIcy.greekBlueArt.mayWaistHand);
        make.right.equalTo(self.view).offset(-BadgeSunIcy.greekBlueArt.mayWaistHand);
        make.top.equalTo(self.view).offset(BadgeSunIcy.greekBlueArt.effortHexTap);
        make.bottom.equalTo(self.view).offset(-BadgeSunIcy.greekBlueArt.paceWorldOdd);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.mindSheStepView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.mindSheStepView);
        make.height.equalTo(_mindSheStepView);
    }];
    
    UIView * executingSum = [self locallyOutView:[BadgeSunIcy drivenSemanticBeaconMandarinPlain]];
    [containerView addSubview:executingSum];
    [executingSum mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.mindSheStepView);
    }];
    self.powerYellowAddJumpCert = executingSum;
    
    UIView * animatorCase = [self locallyOutView:[BadgeSunIcy exerciseCardTerminalQuoteApple]];
    [containerView addSubview:animatorCase];
    [animatorCase mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(executingSum.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.mindSheStepView);
    }];
    self.yetSeparatorRepeatsOwnCallback = animatorCase;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(animatorCase.mas_right);
    }];
    
    if (![self.barsPubLink boolValue]) {
        UIButton *binFillButton = [BadgeSunIcy birthConductorWeekendDirectoryExtensionColor:BadgeSunIcy.lastCaretReply.endSleepSent];
        [binFillButton setBackgroundImage:[UIImage assemblyInviteColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [binFillButton addTarget:self action:@selector(automaticBoxLaterPenDirectorPacket:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:binFillButton];
        
        [binFillButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-BadgeSunIcy.greekBlueArt.homepageSum);
            make.left.equalTo(self.view).offset(BadgeSunIcy.greekBlueArt.mayWaistHand);
            make.right.equalTo(self.view.mas_centerX).offset(-BadgeSunIcy.greekBlueArt.introAnyOut);
            make.height.mas_equalTo(BadgeSunIcy.greekBlueArt.genderTabSpa);
        }];
    }

    UIButton *proxiesButton =  [BadgeSunIcy birthConductorWeekendDirectoryExtensionColor:BadgeSunIcy.lastCaretReply.modeIntent];
    [proxiesButton addTarget:self action:@selector(sendExecutorAuthoritySeeArmenianSampler:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:proxiesButton];
    BOOL civilButton = ![self.barsPubLink boolValue];
    [proxiesButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-BadgeSunIcy.greekBlueArt.homepageSum);
        make.right.equalTo(self.view).offset(-BadgeSunIcy.greekBlueArt.mayWaistHand);
        
        if (civilButton) {
            make.left.equalTo(self.view.mas_centerX).offset(BadgeSunIcy.greekBlueArt.introAnyOut);
        } else {
            make.left.equalTo(self.view).offset(BadgeSunIcy.greekBlueArt.mayWaistHand);
        }
        make.height.mas_equalTo(BadgeSunIcy.greekBlueArt.genderTabSpa);
    }];
    
    lazyFatView.selectedSegmentIndex = 0;
    [self treeLiveFlush:lazyFatView];
}

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

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

- (void)sumCursorLargestBezelDisorderText:(NSInteger)type {
    NSString *auditedSob = nil;
    UIView *contentView = nil;
    auditedSob = type == 0 ? [BadgeSunIcy drivenSemanticBeaconMandarinPlain]:[BadgeSunIcy exerciseCardTerminalQuoteApple];
    contentView = type == 0 ? self.powerYellowAddJumpCert:self.yetSeparatorRepeatsOwnCallback;
    
    if (auditedSob.chainPoolTop) {
        return;
    }
    
    if ([[auditedSob pathExtension] containsString:BadgeSunIcy.greekBlueArt.clearSourcesClickFeatActual]) {
        UITextView *nowView = (UITextView *)contentView;
        if (nowView.text.length > 0) {
            return;
        }

        
        [DarwinThatView burnPlainPeerView:contentView];

        
        NSURL *url = [NSURL URLWithString:auditedSob];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [DarwinThatView pasteWorldDimensionWrongAddView:contentView];
                
                if (error || data.length == 0) {
                    
                    nowView.text = BadgeSunIcy.lastCaretReply.maxPreservedTimeRemotelyAmbienceMisplaced;
                    return;
                }
                
                
                NSString *paperCatTitle = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                nowView.text = paperCatTitle ?: BadgeSunIcy.lastCaretReply.visionBaselinesSunRunInviteeBundleHeadset;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *expand = (WKWebView *)contentView;
        if (!expand.isLoading && expand.estimatedProgress == 1) {
            [DarwinThatView pasteWorldDimensionWrongAddView:contentView];
            return;
        }
        [DarwinThatView burnPlainPeerView:contentView];
        NSString *logBehave =  [auditedSob.clockClickPerfusionNineteenScopeFair stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:logBehave];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [expand loadRequest:request];
    }
}

- (void)automaticBoxLaterPenDirectorPacket:(id)sender {
    [self earQueryKilogramsNormalVolumeAction:nil];
    if (self.rawSubmitFinalizeNativeSafety) {
        self.rawSubmitFinalizeNativeSafety(NO);
    }
}

- (void)sendExecutorAuthoritySeeArmenianSampler:(id)sender {
    [self earQueryKilogramsNormalVolumeAction:nil];
    if (self.rawSubmitFinalizeNativeSafety) {
        self.rawSubmitFinalizeNativeSafety(YES);
    }
}

- (UIView *)locallyOutView:(NSString *)string {
    UIView *yetSawValue = nil;
    if ([[string pathExtension] containsString:BadgeSunIcy.greekBlueArt.clearSourcesClickFeatActual]) {
        UITextView * fixAwake = [UITextView new];
        fixAwake.editable = NO;
        fixAwake.backgroundColor = UIColor.whiteColor;
        fixAwake.textColor = UIColor.grayColor;
        yetSawValue = fixAwake;
    }else {
        WKWebView *manBlinkDog = [[WKWebView alloc] initWithFrame:CGRectZero];
        manBlinkDog.backgroundColor = UIColor.clearColor;
        manBlinkDog.scrollView.backgroundColor = UIColor.lightGrayColor;
        manBlinkDog.opaque = YES;
        manBlinkDog.scrollView.bounces =NO;
        manBlinkDog.scrollView.showsVerticalScrollIndicator = NO;
        manBlinkDog.scrollView.showsHorizontalScrollIndicator = NO;
        manBlinkDog.navigationDelegate = self;
        yetSawValue = manBlinkDog;
    }
    return yetSawValue;
}

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

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

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

@end
