






#import "FormFrontExactAxesWayViewController.h"
#import "DecayHaveViewController.h"
#import "OfficialNearNicknameClickedGigahertzCell.h"

@interface FormFrontExactAxesWayViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *sentHandlerEndpointIslamicExactView;

@property (nonatomic, strong) UIView *arrowMainView;

@property (nonatomic, strong) UITableView *modalExistView;


@property (nonatomic, assign) BOOL nineteenAffectedReductionControlsStylus;

@property (nonatomic, weak) id keyOnceTheThin;

@property (nonatomic, strong) NSMutableArray *farHallOffEggArray;

@property (nonatomic, strong) NSMutableArray *barMetalArray;

@property (nonatomic, strong) UIButton *sunColumnsButton;
@property (nonatomic, strong) UIButton *outRotorPutButton;

@end

@implementation FormFrontExactAxesWayViewController

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

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

- (void)setNineteenAffectedReductionControlsStylus:(BOOL)nineteenAffectedReductionControlsStylus {
    
    _nineteenAffectedReductionControlsStylus = nineteenAffectedReductionControlsStylus;
    
    _barMetalArray = nineteenAffectedReductionControlsStylus ? _farHallOffEggArray : [NSMutableArray arrayWithObject:_keyOnceTheThin];
    
    [self.modalExistView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!nineteenAffectedReductionControlsStylus ? SumWorkTrad.fastAgeWidth.safeArtImage : self.barMetalArray.count > 3 ? 3 * SumWorkTrad.fastAgeWidth.safeArtImage  : self.barMetalArray.count * SumWorkTrad.fastAgeWidth.safeArtImage);
    }];
    
    self.modalExistView.scrollEnabled = nineteenAffectedReductionControlsStylus;
    
    [self.modalExistView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.modalExistView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _farHallOffEggArray = [[SumWorkTrad stoodPeakSerialDenyHeight] mutableCopy];
    
    _keyOnceTheThin = _farHallOffEggArray.firstObject;
    
    [self reachedObserveCheckLossChapter];
    
    self.nineteenAffectedReductionControlsStylus = NO;
}

- (void)reachedObserveCheckLossChapter {
    
    _sentHandlerEndpointIslamicExactView = [[UIView alloc] init];
    _sentHandlerEndpointIslamicExactView.backgroundColor = UIColor.whiteColor;
    _sentHandlerEndpointIslamicExactView.layer.cornerRadius = 2;
    [self.view addSubview:_sentHandlerEndpointIslamicExactView];
    [self.view sendSubviewToBack:_sentHandlerEndpointIslamicExactView];
    [_sentHandlerEndpointIslamicExactView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([SumWorkTrad readableAttachModelTrapIterationSoloSize]);
    }];
    
    
    UIView *arrowMainView = [SumWorkTrad arrowMainView];
    [self.view addSubview:arrowMainView];
    self.arrowMainView = arrowMainView;
    [arrowMainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(SumWorkTrad.fastAgeWidth.databasesBus);
        make.height.mas_equalTo(SumWorkTrad.fastAgeWidth.fingerSindhi);
        make.left.equalTo(self.exclusiveButton.mas_right);
        make.right.equalTo(self.loudLegacyButton.mas_left);
    }];
    
    
    _modalExistView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _modalExistView.backgroundColor = [UIColor whiteColor];
    _modalExistView.layer.masksToBounds = YES;
    _modalExistView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _modalExistView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _modalExistView.layer.borderColor = [SumWorkTrad alphaPingColor].CGColor;
    _modalExistView.layer.borderWidth = 0.6;
    _modalExistView.layer.cornerRadius = 2;
    _modalExistView.rowHeight = SumWorkTrad.fastAgeWidth.safeArtImage;
    _modalExistView.delegate = self;
    _modalExistView.dataSource = self;
    [_modalExistView registerClass:[OfficialNearNicknameClickedGigahertzCell class] forCellReuseIdentifier:NSStringFromClass(OfficialNearNicknameClickedGigahertzCell.class)];
    [self.view addSubview:_modalExistView];
    [self.modalExistView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.arrowMainView.mas_bottom).offset(SumWorkTrad.fastAgeWidth.databasesBus);
        make.left.equalTo(self.sentHandlerEndpointIslamicExactView).offset(SumWorkTrad.fastAgeWidth.mixSwipeArea);
        make.right.equalTo(self.sentHandlerEndpointIslamicExactView).offset(-SumWorkTrad.fastAgeWidth.mixSwipeArea);
        make.height.mas_equalTo(SumWorkTrad.fastAgeWidth.safeArtImage);
    }];
    
    
    self.sunColumnsButton = [SumWorkTrad tallStampPeerPinkBuilder:SumWorkTrad.arrayLawAllTop.oddShowFrontFactMicro];
    [self.sunColumnsButton addTarget:self action:@selector(ciphersActualArbitraryOptionFilterAffineAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.sentHandlerEndpointIslamicExactView addSubview:self.sunColumnsButton];
    [self.sunColumnsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.sentHandlerEndpointIslamicExactView).offset(-SumWorkTrad.fastAgeWidth.databasesBus);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.outRotorPutButton = [SumWorkTrad mandatoryTakeNonceSearchUniqueColor:SumWorkTrad.arrayLawAllTop.fileBarsRet];
    [self.outRotorPutButton addTarget:self action:@selector(cornersDarkBlueRedoneDogExposure:) forControlEvents:UIControlEventTouchUpInside];
    [self.sentHandlerEndpointIslamicExactView addSubview:self.outRotorPutButton];
    [self.outRotorPutButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.sunColumnsButton.mas_top).offset(-SumWorkTrad.fastAgeWidth.quantityLeft);
        make.left.right.equalTo(self.modalExistView);
        make.height.mas_equalTo(SumWorkTrad.fastAgeWidth.clientBitHit);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    OfficialNearNicknameClickedGigahertzCell *many = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(OfficialNearNicknameClickedGigahertzCell.class) forIndexPath:indexPath];
    NSArray *oldClear = _barMetalArray[indexPath.row];
    
    many.runAcuteName.text = oldClear[0];
    
    many.sobKeepRunView.image = [[UIImage preciseProvidingLexicalAddressHandlesName:oldClear[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    many.andFitRightTime.text = [NSString stringWithFormat:@"%@ %@",SumWorkTrad.arrayLawAllTop.redoneSexAudioDestroyMobileTime,[self cubicDetailedHitChatterForRelevanceTime:[oldClear[2] doubleValue]]];
    
    many.accessoryType = self.nineteenAffectedReductionControlsStylus ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return many;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id oldClear = _barMetalArray[indexPath.row];
        
        [_barMetalArray removeObject:oldClear];
        
        [_farHallOffEggArray removeObject:oldClear];
        
        if ([self.molarEvictMap respondsToSelector:@selector(waistStringStalledAxialObserveCombiningName:completion:)]) {
            [self.molarEvictMap waistStringStalledAxialObserveCombiningName:oldClear[0] completion:^(id object) {
                
            }];
        }
        
        if(_farHallOffEggArray.count > 0){
            
            _barMetalArray = _farHallOffEggArray;
            _keyOnceTheThin = _barMetalArray.firstObject;
            self.nineteenAffectedReductionControlsStylus = YES;
            
        }
    }
}


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

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

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


- (void)ciphersActualArbitraryOptionFilterAffineAction:(UIButton *)sender {
    DecayHaveViewController *allTooService = [DecayHaveViewController new];
    allTooService.molarEvictMap = self.molarEvictMap;
    [self.navigationController pushViewController:allTooService animated:NO];
}

- (void)cornersDarkBlueRedoneDogExposure:(UIButton *)sender {
    if ([self.molarEvictMap respondsToSelector:@selector(customEchoMetabolicPhoneKilogramEndsFinalName:completion:)]) {
        [TurkmenOddView carUnifiedFaxWindow];
        [self.molarEvictMap customEchoMetabolicPhoneKilogramEndsFinalName:self.keyOnceTheThin[0] completion:^(id object) {
            [TurkmenOddView zipTagsChamberDateDetailWindow];
        }];
    }
}


- (NSString *)cubicDetailedHitChatterForRelevanceTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double compoundTime = now - beTime;
    NSString * pasteHowArt;
    
    NSDate * sayDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * two = [[NSDateFormatter alloc] init];
    [two setDateFormat:@"HH:mm"];
    NSString * getStay = [two stringFromDate:sayDate];
    
    [two setDateFormat:@"dd"];
    NSString * hybrid = [two stringFromDate:[NSDate date]];
    NSString * suchOpt = [two stringFromDate:sayDate];
    
    if (compoundTime < 60) {
        pasteHowArt = SumWorkTrad.arrayLawAllTop.herNineBound;
    }else if (compoundTime < 60 * 60) {
        pasteHowArt = [NSString stringWithFormat:@"%ld%@",(long)compoundTime / 60, SumWorkTrad.arrayLawAllTop.areSoloCalculateWakeOutside];
    }else if(compoundTime < 24 * 60 * 60 && [hybrid integerValue] == [suchOpt integerValue]){
        pasteHowArt = [NSString stringWithFormat:@"%@ %@",SumWorkTrad.arrayLawAllTop.illForLink,getStay];
    }else if(compoundTime < 24 * 60 * 60 * 2 && [hybrid integerValue] != [suchOpt integerValue]){
        if ([hybrid integerValue] - [suchOpt integerValue] == 1 || ([suchOpt integerValue] - [hybrid integerValue] > 10 && [hybrid integerValue] == 1)) {
            pasteHowArt = [NSString stringWithFormat:@"%@ %@",SumWorkTrad.arrayLawAllTop.kinKinUsedTrad,getStay];
        }else{
            [two setDateFormat:@"MM-dd HH:mm"];
            pasteHowArt = [two stringFromDate:sayDate];
        }
    }else if(compoundTime < 24 * 60 * 60 * 365){
        [two setDateFormat:@"MM-dd HH:mm"];
        pasteHowArt = [two stringFromDate:sayDate];
    }else{
        [two setDateFormat:@"yyyy-MM-dd HH:mm"];
        pasteHowArt = [two stringFromDate:sayDate];
    }
    return pasteHowArt;
}

@end
