






#import "OptFriendFractionsDirectionPathViewController.h"
#import "SolutionsViewController.h"
#import "SphereDecrementSignalUtilitiesColoredCell.h"

@interface OptFriendFractionsDirectionPathViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *allocateAdvertiseIdenticalFreezingLocatorView;

@property (nonatomic, strong) UIView *clockwiseView;

@property (nonatomic, strong) UITableView *scanTwelveView;


@property (nonatomic, assign) BOOL backwardLowAwayCoercionCounter;

@property (nonatomic, weak) id pinPlateTabCut;

@property (nonatomic, strong) NSMutableArray *fillSuspendedArray;

@property (nonatomic, strong) NSMutableArray *unifyHitArray;

@property (nonatomic, strong) UIButton *shearWriteButton;
@property (nonatomic, strong) UIButton *detectsTalkButton;

@end

@implementation OptFriendFractionsDirectionPathViewController

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if (_unifyHitArray.count > 0 && self.backwardLowAwayCoercionCounter) {
        self.backwardLowAwayCoercionCounter = NO;
    }
}

- (void)viewWillAppear:(BOOL)animated {
    
    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        CGFloat bottom = CloudyPrice.resetEndsIts.tryCreateYou;
        make.centerX.equalTo(self.view.superview);
        make.centerY.equalTo(self.view.superview).offset(+bottom/2);
        make.height.mas_equalTo([CloudyPrice visitorResourceValidatesFlexibleNepaliInsertionSize].height+bottom);
        make.width.mas_equalTo([CloudyPrice visitorResourceValidatesFlexibleNepaliInsertionSize].width);
    }];
}

- (void)setBackwardLowAwayCoercionCounter:(BOOL)backwardLowAwayCoercionCounter {
    
    _backwardLowAwayCoercionCounter = backwardLowAwayCoercionCounter;
    
    _unifyHitArray = backwardLowAwayCoercionCounter ? _fillSuspendedArray : [NSMutableArray arrayWithObject:_pinPlateTabCut];
    
    [self.scanTwelveView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!backwardLowAwayCoercionCounter ? CloudyPrice.resetEndsIts.andRotateLog : self.unifyHitArray.count > 3 ? 3 * CloudyPrice.resetEndsIts.andRotateLog  : self.unifyHitArray.count * CloudyPrice.resetEndsIts.andRotateLog);
    }];
    
    self.scanTwelveView.scrollEnabled = backwardLowAwayCoercionCounter;
    
    [self.scanTwelveView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.scanTwelveView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _fillSuspendedArray = [[CloudyPrice planeRebusPoolWinZone] mutableCopy];
    
    _pinPlateTabCut = _fillSuspendedArray.firstObject;
    
    [self doubleKilowattSmallestProducingFun];
    
    self.backwardLowAwayCoercionCounter = NO;
}

- (void)doubleKilowattSmallestProducingFun {
    
    _allocateAdvertiseIdenticalFreezingLocatorView = [[UIView alloc] init];
    _allocateAdvertiseIdenticalFreezingLocatorView.backgroundColor = UIColor.whiteColor;
    _allocateAdvertiseIdenticalFreezingLocatorView.layer.cornerRadius = 2;
    [self.view addSubview:_allocateAdvertiseIdenticalFreezingLocatorView];
    [self.view sendSubviewToBack:_allocateAdvertiseIdenticalFreezingLocatorView];
    [_allocateAdvertiseIdenticalFreezingLocatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([CloudyPrice visitorResourceValidatesFlexibleNepaliInsertionSize]);
    }];
    
    
    UIView *clockwiseView = [CloudyPrice clockwiseView];
    [self.view addSubview:clockwiseView];
    self.clockwiseView = clockwiseView;
    [clockwiseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(CloudyPrice.resetEndsIts.mailCatValue);
        make.height.mas_equalTo(CloudyPrice.resetEndsIts.frenchSumBin);
        make.left.equalTo(self.cinematicButton.mas_right);
        make.right.equalTo(self.sonLockingButton.mas_left);
    }];
    
    
    _scanTwelveView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _scanTwelveView.backgroundColor = [UIColor whiteColor];
    _scanTwelveView.layer.masksToBounds = YES;
    _scanTwelveView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _scanTwelveView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _scanTwelveView.layer.borderColor = [CloudyPrice oneCreditColor].CGColor;
    _scanTwelveView.layer.borderWidth = 0.6;
    _scanTwelveView.layer.cornerRadius = 2;
    _scanTwelveView.rowHeight = CloudyPrice.resetEndsIts.andRotateLog;
    _scanTwelveView.delegate = self;
    _scanTwelveView.dataSource = self;
    [_scanTwelveView registerClass:[SphereDecrementSignalUtilitiesColoredCell class] forCellReuseIdentifier:NSStringFromClass(SphereDecrementSignalUtilitiesColoredCell.class)];
    [self.view addSubview:_scanTwelveView];
    [self.scanTwelveView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.clockwiseView.mas_bottom).offset(CloudyPrice.resetEndsIts.mailCatValue);
        make.left.equalTo(self.allocateAdvertiseIdenticalFreezingLocatorView).offset(CloudyPrice.resetEndsIts.timeLevelWon);
        make.right.equalTo(self.allocateAdvertiseIdenticalFreezingLocatorView).offset(-CloudyPrice.resetEndsIts.timeLevelWon);
        make.height.mas_equalTo(CloudyPrice.resetEndsIts.andRotateLog);
    }];
    
    
    self.shearWriteButton = [CloudyPrice legalCosmicVitalEntryTower:CloudyPrice.presentedIrish.barsPullLinerSwedishChina];
    [self.shearWriteButton addTarget:self action:@selector(layerStoneCharWarnConsumedSigmaAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.allocateAdvertiseIdenticalFreezingLocatorView addSubview:self.shearWriteButton];
    [self.shearWriteButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.allocateAdvertiseIdenticalFreezingLocatorView).offset(-CloudyPrice.resetEndsIts.mailCatValue);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.detectsTalkButton = [CloudyPrice bridgedEpsilonReferenceLooseStrideColor:CloudyPrice.presentedIrish.useThreaded];
    [self.detectsTalkButton addTarget:self action:@selector(closeHighestHandledInfoModeCeltic:) forControlEvents:UIControlEventTouchUpInside];
    [self.allocateAdvertiseIdenticalFreezingLocatorView addSubview:self.detectsTalkButton];
    [self.detectsTalkButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.shearWriteButton.mas_top).offset(-CloudyPrice.resetEndsIts.nowOwnerLong);
        make.left.right.equalTo(self.scanTwelveView);
        make.height.mas_equalTo(CloudyPrice.resetEndsIts.noteTemplate);
    }];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _unifyHitArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SphereDecrementSignalUtilitiesColoredCell *gasp = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(SphereDecrementSignalUtilitiesColoredCell.class) forIndexPath:indexPath];
    NSArray *provides = _unifyHitArray[indexPath.row];
    
    gasp.dailyHisName.text = provides[0];
    
    gasp.sonNearestView.image = [[UIImage pressEncryptSemicolonEmptySixName:provides[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    gasp.personalEarTime.text = [NSString stringWithFormat:@"%@ %@",CloudyPrice.presentedIrish.manualPairMostTagSubtitlesTime,[self logGaussianRectumYouAvailableSymbolicTime:[provides[2] doubleValue]]];
    
    gasp.accessoryType = self.backwardLowAwayCoercionCounter ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return gasp;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    _pinPlateTabCut = _unifyHitArray[indexPath.row];
    self.backwardLowAwayCoercionCounter = !self.backwardLowAwayCoercionCounter;
}


- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return self.backwardLowAwayCoercionCounter;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id provides = _unifyHitArray[indexPath.row];
        
        [_unifyHitArray removeObject:provides];
        
        [_fillSuspendedArray removeObject:provides];
        
        if ([self.tapOurOptEast respondsToSelector:@selector(softVeryExecSensitivePressureDidName:completion:)]) {
            [self.tapOurOptEast softVeryExecSensitivePressureDidName:provides[0] completion:^(id object) {
                
            }];
        }
        
        if(_fillSuspendedArray.count > 0){
            
            _unifyHitArray = _fillSuspendedArray;
            _pinPlateTabCut = _unifyHitArray.firstObject;
            self.backwardLowAwayCoercionCounter = YES;
            
        }
    }
}


- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
    return @"Delete";
}

- (void)observersPrintableSlabPassBed:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super observersPrintableSlabPassBed:touches withEvent:event];
    self.backwardLowAwayCoercionCounter = NO;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    self.backwardLowAwayCoercionCounter = NO;
}


- (void)layerStoneCharWarnConsumedSigmaAction:(UIButton *)sender {
    SolutionsViewController *replyFarsiRet = [SolutionsViewController new];
    replyFarsiRet.tapOurOptEast = self.tapOurOptEast;
    [self.navigationController pushViewController:replyFarsiRet animated:NO];
}

- (void)closeHighestHandledInfoModeCeltic:(UIButton *)sender {
    if ([self.tapOurOptEast respondsToSelector:@selector(arrayReusableUsageWarpStepIntegerKeyName:completion:)]) {
        [JobRankSawView typePasteWordWindow];
        [self.tapOurOptEast arrayReusableUsageWarpStepIntegerKeyName:self.pinPlateTabCut[0] completion:^(id object) {
            [JobRankSawView carCameraKilogramBoxScoreWindow];
        }];
    }
}


- (NSString *)logGaussianRectumYouAvailableSymbolicTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double spellSpaTime = now - beTime;
    NSString * softPeerFat;
    
    NSDate * zipDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * say = [[NSDateFormatter alloc] init];
    [say setDateFormat:@"HH:mm"];
    NSString * treeSix = [say stringFromDate:zipDate];
    
    [say setDateFormat:@"dd"];
    NSString * hourly = [say stringFromDate:[NSDate date]];
    NSString * gainPin = [say stringFromDate:zipDate];
    
    if (spellSpaTime < 60) {
        softPeerFat = CloudyPrice.presentedIrish.beganAgeChar;
    }else if (spellSpaTime < 60 * 60) {
        softPeerFat = [NSString stringWithFormat:@"%ld%@",(long)spellSpaTime / 60, CloudyPrice.presentedIrish.deliveredCloudMenuKeepTone];
    }else if(spellSpaTime < 24 * 60 * 60 && [hourly integerValue] == [gainPin integerValue]){
        softPeerFat = [NSString stringWithFormat:@"%@ %@",CloudyPrice.presentedIrish.lateOldSob,treeSix];
    }else if(spellSpaTime < 24 * 60 * 60 * 2 && [hourly integerValue] != [gainPin integerValue]){
        if ([hourly integerValue] - [gainPin integerValue] == 1 || ([gainPin integerValue] - [hourly integerValue] > 10 && [hourly integerValue] == 1)) {
            softPeerFat = [NSString stringWithFormat:@"%@ %@",CloudyPrice.presentedIrish.realQuitHyphen,treeSix];
        }else{
            [say setDateFormat:@"MM-dd HH:mm"];
            softPeerFat = [say stringFromDate:zipDate];
        }
    }else if(spellSpaTime < 24 * 60 * 60 * 365){
        [say setDateFormat:@"MM-dd HH:mm"];
        softPeerFat = [say stringFromDate:zipDate];
    }else{
        [say setDateFormat:@"yyyy-MM-dd HH:mm"];
        softPeerFat = [say stringFromDate:zipDate];
    }
    return softPeerFat;
}

@end
