






#import "ConsumerBehaveAccessedTreeExponentsViewController.h"
#import "RainSugarViewController.h"
#import "BecomeBusWidgetCollapseAbortCell.h"

@interface ConsumerBehaveAccessedTreeExponentsViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *distantProtocolsSeeElderAudioView;

@property (nonatomic, strong) UIView *relayArtsView;

@property (nonatomic, strong) UITableView *wayRunFunkView;


@property (nonatomic, assign) BOOL passiveDriveOrdinalDragPlace;

@property (nonatomic, weak) id prefixNodeShow;

@property (nonatomic, strong) NSMutableArray *binTenRankNowArray;

@property (nonatomic, strong) NSMutableArray *entryBigArray;

@property (nonatomic, strong) UIButton *bikeLaunchButton;
@property (nonatomic, strong) UIButton *lookupEvictButton;

@end

@implementation ConsumerBehaveAccessedTreeExponentsViewController

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

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

- (void)setPassiveDriveOrdinalDragPlace:(BOOL)passiveDriveOrdinalDragPlace {
    
    _passiveDriveOrdinalDragPlace = passiveDriveOrdinalDragPlace;
    
    _entryBigArray = passiveDriveOrdinalDragPlace ? _binTenRankNowArray : [NSMutableArray arrayWithObject:_prefixNodeShow];
    
    [self.wayRunFunkView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!passiveDriveOrdinalDragPlace ? SobIllWelsh.followBigKit.golfEggAlpha : self.entryBigArray.count > 3 ? 3 * SobIllWelsh.followBigKit.golfEggAlpha  : self.entryBigArray.count * SobIllWelsh.followBigKit.golfEggAlpha);
    }];
    
    self.wayRunFunkView.scrollEnabled = passiveDriveOrdinalDragPlace;
    
    [self.wayRunFunkView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.wayRunFunkView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _binTenRankNowArray = [[SobIllWelsh raiseIdentityExternalDeviationRecorded] mutableCopy];
    
    _prefixNodeShow = _binTenRankNowArray.firstObject;
    
    [self wetFlemishPanelExpandingSafari];
    
    self.passiveDriveOrdinalDragPlace = NO;
}

- (void)wetFlemishPanelExpandingSafari {
    
    _distantProtocolsSeeElderAudioView = [[UIView alloc] init];
    _distantProtocolsSeeElderAudioView.backgroundColor = UIColor.whiteColor;
    _distantProtocolsSeeElderAudioView.layer.cornerRadius = 2;
    [self.view addSubview:_distantProtocolsSeeElderAudioView];
    [self.view sendSubviewToBack:_distantProtocolsSeeElderAudioView];
    [_distantProtocolsSeeElderAudioView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([SobIllWelsh daysLeakyMainUrgencyBoostArraySize]);
    }];
    
    
    UIView *relayArtsView = [SobIllWelsh relayArtsView];
    [self.view addSubview:relayArtsView];
    self.relayArtsView = relayArtsView;
    [relayArtsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(SobIllWelsh.followBigKit.herPreserved);
        make.height.mas_equalTo(SobIllWelsh.followBigKit.keepEscaping);
        make.left.equalTo(self.diskGenreButton.mas_right);
        make.right.equalTo(self.warpFitWonButton.mas_left);
    }];
    
    
    _wayRunFunkView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _wayRunFunkView.backgroundColor = [UIColor whiteColor];
    _wayRunFunkView.layer.masksToBounds = YES;
    _wayRunFunkView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _wayRunFunkView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _wayRunFunkView.layer.borderColor = [SobIllWelsh itemQuickColor].CGColor;
    _wayRunFunkView.layer.borderWidth = 0.6;
    _wayRunFunkView.layer.cornerRadius = 2;
    _wayRunFunkView.rowHeight = SobIllWelsh.followBigKit.golfEggAlpha;
    _wayRunFunkView.delegate = self;
    _wayRunFunkView.dataSource = self;
    [_wayRunFunkView registerClass:[BecomeBusWidgetCollapseAbortCell class] forCellReuseIdentifier:NSStringFromClass(BecomeBusWidgetCollapseAbortCell.class)];
    [self.view addSubview:_wayRunFunkView];
    [self.wayRunFunkView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.relayArtsView.mas_bottom).offset(SobIllWelsh.followBigKit.herPreserved);
        make.left.equalTo(self.distantProtocolsSeeElderAudioView).offset(SobIllWelsh.followBigKit.busStepAsset);
        make.right.equalTo(self.distantProtocolsSeeElderAudioView).offset(-SobIllWelsh.followBigKit.busStepAsset);
        make.height.mas_equalTo(SobIllWelsh.followBigKit.golfEggAlpha);
    }];
    
    
    self.bikeLaunchButton = [SobIllWelsh fullyPushCaptionMastersCascade:SobIllWelsh.notHeapPeerRed.russianPhaseButterflyDiscountsGreat];
    [self.bikeLaunchButton addTarget:self action:@selector(tryCupProvidedRhythmAliveBottomAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.distantProtocolsSeeElderAudioView addSubview:self.bikeLaunchButton];
    [self.bikeLaunchButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.distantProtocolsSeeElderAudioView).offset(-SobIllWelsh.followBigKit.herPreserved);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.lookupEvictButton = [SobIllWelsh allExistExecutionCreditsJumpColor:SobIllWelsh.notHeapPeerRed.forkOutdoor];
    [self.lookupEvictButton addTarget:self action:@selector(ordinalIconDetermineDogMindAir:) forControlEvents:UIControlEventTouchUpInside];
    [self.distantProtocolsSeeElderAudioView addSubview:self.lookupEvictButton];
    [self.lookupEvictButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.bikeLaunchButton.mas_top).offset(-SobIllWelsh.followBigKit.topFirstShot);
        make.left.right.equalTo(self.wayRunFunkView);
        make.height.mas_equalTo(SobIllWelsh.followBigKit.floatWaxPlus);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BecomeBusWidgetCollapseAbortCell *more = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(BecomeBusWidgetCollapseAbortCell.class) forIndexPath:indexPath];
    NSArray *inputMap = _entryBigArray[indexPath.row];
    
    more.usesPlusName.text = inputMap[0];
    
    more.eachForBitView.image = [[UIImage loveObserveBestAxesFitName:inputMap[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    more.clangVisualTime.text = [NSString stringWithFormat:@"%@ %@",SobIllWelsh.notHeapPeerRed.bitsMeteringStepperPhoneFlatTime,[self decodingGetEstimatedAcrossDetectsElapsedTime:[inputMap[2] doubleValue]]];
    
    more.accessoryType = self.passiveDriveOrdinalDragPlace ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return more;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id inputMap = _entryBigArray[indexPath.row];
        
        [_entryBigArray removeObject:inputMap];
        
        [_binTenRankNowArray removeObject:inputMap];
        
        if ([self.alienHoldEdit respondsToSelector:@selector(romanFarBeaconCustodianInsertingSyntaxName:completion:)]) {
            [self.alienHoldEdit romanFarBeaconCustodianInsertingSyntaxName:inputMap[0] completion:^(id object) {
                
            }];
        }
        
        if(_binTenRankNowArray.count > 0){
            
            _entryBigArray = _binTenRankNowArray;
            _prefixNodeShow = _entryBigArray.firstObject;
            self.passiveDriveOrdinalDragPlace = YES;
            
        }
    }
}


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

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

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


- (void)tryCupProvidedRhythmAliveBottomAction:(UIButton *)sender {
    RainSugarViewController *drainPlanCube = [RainSugarViewController new];
    drainPlanCube.alienHoldEdit = self.alienHoldEdit;
    [self.navigationController pushViewController:drainPlanCube animated:NO];
}

- (void)ordinalIconDetermineDogMindAir:(UIButton *)sender {
    if ([self.alienHoldEdit respondsToSelector:@selector(promisedWetExemplarOxygenSkinMajorRollName:completion:)]) {
        [AskWillCatView ratioLawWorldWindow];
        [self.alienHoldEdit promisedWetExemplarOxygenSkinMajorRollName:self.prefixNodeShow[0] completion:^(id object) {
            [AskWillCatView strongestSeparatorAddPasswordsSpouseWindow];
        }];
    }
}


- (NSString *)decodingGetEstimatedAcrossDetectsElapsedTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double popBlockTime = now - beTime;
    NSString * poloLeadIts;
    
    NSDate * eyeDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * yet = [[NSDateFormatter alloc] init];
    [yet setDateFormat:@"HH:mm"];
    NSString * adjusts = [yet stringFromDate:eyeDate];
    
    [yet setDateFormat:@"dd"];
    NSString * bitTap = [yet stringFromDate:[NSDate date]];
    NSString * whoRare = [yet stringFromDate:eyeDate];
    
    if (popBlockTime < 60) {
        poloLeadIts = SobIllWelsh.notHeapPeerRed.requestedWas;
    }else if (popBlockTime < 60 * 60) {
        poloLeadIts = [NSString stringWithFormat:@"%ld%@",(long)popBlockTime / 60, SobIllWelsh.notHeapPeerRed.makeAggregateMetadataSubmitInstances];
    }else if(popBlockTime < 24 * 60 * 60 && [bitTap integerValue] == [whoRare integerValue]){
        poloLeadIts = [NSString stringWithFormat:@"%@ %@",SobIllWelsh.notHeapPeerRed.cellHowPut,adjusts];
    }else if(popBlockTime < 24 * 60 * 60 * 2 && [bitTap integerValue] != [whoRare integerValue]){
        if ([bitTap integerValue] - [whoRare integerValue] == 1 || ([whoRare integerValue] - [bitTap integerValue] > 10 && [bitTap integerValue] == 1)) {
            poloLeadIts = [NSString stringWithFormat:@"%@ %@",SobIllWelsh.notHeapPeerRed.reclaimPartial,adjusts];
        }else{
            [yet setDateFormat:@"MM-dd HH:mm"];
            poloLeadIts = [yet stringFromDate:eyeDate];
        }
    }else if(popBlockTime < 24 * 60 * 60 * 365){
        [yet setDateFormat:@"MM-dd HH:mm"];
        poloLeadIts = [yet stringFromDate:eyeDate];
    }else{
        [yet setDateFormat:@"yyyy-MM-dd HH:mm"];
        poloLeadIts = [yet stringFromDate:eyeDate];
    }
    return poloLeadIts;
}

@end
