






#import "PriorityKeyDepthCropCaptionViewController.h"
#import "FarExtendViewController.h"
#import "FlippedAlongFilmAttachDiscountCell.h"

@interface PriorityKeyDepthCropCaptionViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *buttonsDryTrimmingApplyingThirdView;

@property (nonatomic, strong) UIView *golfNeverView;

@property (nonatomic, strong) UITableView *thiaminTwoView;


@property (nonatomic, assign) BOOL loopStripAdvancesSameCalories;

@property (nonatomic, weak) id kindWeekRetSee;

@property (nonatomic, strong) NSMutableArray *pieceOptionalArray;

@property (nonatomic, strong) NSMutableArray *blueHeadArray;

@property (nonatomic, strong) UIButton *indicesEyeButton;
@property (nonatomic, strong) UIButton *startingHerButton;

@end

@implementation PriorityKeyDepthCropCaptionViewController

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

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

- (void)setLoopStripAdvancesSameCalories:(BOOL)loopStripAdvancesSameCalories {
    
    _loopStripAdvancesSameCalories = loopStripAdvancesSameCalories;
    
    _blueHeadArray = loopStripAdvancesSameCalories ? _pieceOptionalArray : [NSMutableArray arrayWithObject:_kindWeekRetSee];
    
    [self.thiaminTwoView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!loopStripAdvancesSameCalories ? FixMaterial.capsLoopsAge.maskScaleEye : self.blueHeadArray.count > 3 ? 3 * FixMaterial.capsLoopsAge.maskScaleEye  : self.blueHeadArray.count * FixMaterial.capsLoopsAge.maskScaleEye);
    }];
    
    self.thiaminTwoView.scrollEnabled = loopStripAdvancesSameCalories;
    
    [self.thiaminTwoView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.thiaminTwoView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _pieceOptionalArray = [[FixMaterial extrinsicAuditedApplePresentSphere] mutableCopy];
    
    _kindWeekRetSee = _pieceOptionalArray.firstObject;
    
    [self primariesMediaReturningPaddleToo];
    
    self.loopStripAdvancesSameCalories = NO;
}

- (void)primariesMediaReturningPaddleToo {
    
    _buttonsDryTrimmingApplyingThirdView = [[UIView alloc] init];
    _buttonsDryTrimmingApplyingThirdView.backgroundColor = UIColor.whiteColor;
    _buttonsDryTrimmingApplyingThirdView.layer.cornerRadius = 2;
    [self.view addSubview:_buttonsDryTrimmingApplyingThirdView];
    [self.view sendSubviewToBack:_buttonsDryTrimmingApplyingThirdView];
    [_buttonsDryTrimmingApplyingThirdView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([FixMaterial elevatedReplacedMisplacedEqualityFlippedRevealedSize]);
    }];
    
    
    UIView *golfNeverView = [FixMaterial golfNeverView];
    [self.view addSubview:golfNeverView];
    self.golfNeverView = golfNeverView;
    [golfNeverView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(FixMaterial.capsLoopsAge.expiredBuilt);
        make.height.mas_equalTo(FixMaterial.capsLoopsAge.formPowerSay);
        make.left.equalTo(self.vowelMostButton.mas_right);
        make.right.equalTo(self.blobLogKinButton.mas_left);
    }];
    
    
    _thiaminTwoView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _thiaminTwoView.backgroundColor = [UIColor whiteColor];
    _thiaminTwoView.layer.masksToBounds = YES;
    _thiaminTwoView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _thiaminTwoView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _thiaminTwoView.layer.borderColor = [FixMaterial beforeArtColor].CGColor;
    _thiaminTwoView.layer.borderWidth = 0.6;
    _thiaminTwoView.layer.cornerRadius = 2;
    _thiaminTwoView.rowHeight = FixMaterial.capsLoopsAge.maskScaleEye;
    _thiaminTwoView.delegate = self;
    _thiaminTwoView.dataSource = self;
    [_thiaminTwoView registerClass:[FlippedAlongFilmAttachDiscountCell class] forCellReuseIdentifier:NSStringFromClass(FlippedAlongFilmAttachDiscountCell.class)];
    [self.view addSubview:_thiaminTwoView];
    [self.thiaminTwoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.golfNeverView.mas_bottom).offset(FixMaterial.capsLoopsAge.expiredBuilt);
        make.left.equalTo(self.buttonsDryTrimmingApplyingThirdView).offset(FixMaterial.capsLoopsAge.niacinDegree);
        make.right.equalTo(self.buttonsDryTrimmingApplyingThirdView).offset(-FixMaterial.capsLoopsAge.niacinDegree);
        make.height.mas_equalTo(FixMaterial.capsLoopsAge.maskScaleEye);
    }];
    
    
    self.indicesEyeButton = [FixMaterial slantMilesSexSessionDocuments:FixMaterial.dryMicroCapTag.trialModalFaeroeseVisibleMouth];
    [self.indicesEyeButton addTarget:self action:@selector(segueStartupPaddleReceivedSideBevelAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.buttonsDryTrimmingApplyingThirdView addSubview:self.indicesEyeButton];
    [self.indicesEyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.buttonsDryTrimmingApplyingThirdView).offset(-FixMaterial.capsLoopsAge.expiredBuilt);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.startingHerButton = [FixMaterial rangeSeeHectaresImproperLowercaseColor:FixMaterial.dryMicroCapTag.tabInfinite];
    [self.startingHerButton addTarget:self action:@selector(outStylusCircleTransportCostRing:) forControlEvents:UIControlEventTouchUpInside];
    [self.buttonsDryTrimmingApplyingThirdView addSubview:self.startingHerButton];
    [self.startingHerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.indicesEyeButton.mas_top).offset(-FixMaterial.capsLoopsAge.helperCanBut);
        make.left.right.equalTo(self.thiaminTwoView);
        make.height.mas_equalTo(FixMaterial.capsLoopsAge.maxCurlGuest);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    FlippedAlongFilmAttachDiscountCell *plan = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(FlippedAlongFilmAttachDiscountCell.class) forIndexPath:indexPath];
    NSArray *iconCube = _blueHeadArray[indexPath.row];
    
    plan.senseWaxName.text = iconCube[0];
    
    plan.packArcadeView.image = [[UIImage tabularFinishAudiencesKinTriggeredName:iconCube[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    plan.whoEightPinTime.text = [NSString stringWithFormat:@"%@ %@",FixMaterial.dryMicroCapTag.lettishRevertSkinCutPurchasedTime,[self brandEyePublishClientOnlyBorderedTime:[iconCube[2] doubleValue]]];
    
    plan.accessoryType = self.loopStripAdvancesSameCalories ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return plan;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id iconCube = _blueHeadArray[indexPath.row];
        
        [_blueHeadArray removeObject:iconCube];
        
        [_pieceOptionalArray removeObject:iconCube];
        
        if ([self.falloffBorder respondsToSelector:@selector(watchShuffleAdoptBagPersistRemainingName:completion:)]) {
            [self.falloffBorder watchShuffleAdoptBagPersistRemainingName:iconCube[0] completion:^(id object) {
                
            }];
        }
        
        if(_pieceOptionalArray.count > 0){
            
            _blueHeadArray = _pieceOptionalArray;
            _kindWeekRetSee = _blueHeadArray.firstObject;
            self.loopStripAdvancesSameCalories = YES;
            
        }
    }
}


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

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

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


- (void)segueStartupPaddleReceivedSideBevelAction:(UIButton *)sender {
    FarExtendViewController *wasRetTipHeap = [FarExtendViewController new];
    wasRetTipHeap.falloffBorder = self.falloffBorder;
    [self.navigationController pushViewController:wasRetTipHeap animated:NO];
}

- (void)outStylusCircleTransportCostRing:(UIButton *)sender {
    if ([self.falloffBorder respondsToSelector:@selector(endAppendHyphenMonitoredFaxOverlapParallelName:completion:)]) {
        [FlattenPopView tapTheOldFadeWindow];
        [self.falloffBorder endAppendHyphenMonitoredFaxOverlapParallelName:self.kindWeekRetSee[0] completion:^(id object) {
            [FlattenPopView extendGlucoseCatMinorZoomWindow];
        }];
    }
}


- (NSString *)brandEyePublishClientOnlyBorderedTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double grantingTime = now - beTime;
    NSString * axialEarMen;
    
    NSDate * menDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * pen = [[NSDateFormatter alloc] init];
    [pen setDateFormat:@"HH:mm"];
    NSString * curlIts = [pen stringFromDate:menDate];
    
    [pen setDateFormat:@"dd"];
    NSString * female = [pen stringFromDate:[NSDate date]];
    NSString * sobFood = [pen stringFromDate:menDate];
    
    if (grantingTime < 60) {
        axialEarMen = FixMaterial.dryMicroCapTag.patternLease;
    }else if (grantingTime < 60 * 60) {
        axialEarMen = [NSString stringWithFormat:@"%ld%@",(long)grantingTime / 60, FixMaterial.dryMicroCapTag.sheSigmoidOptimizeVisualElements];
    }else if(grantingTime < 24 * 60 * 60 && [female integerValue] == [sobFood integerValue]){
        axialEarMen = [NSString stringWithFormat:@"%@ %@",FixMaterial.dryMicroCapTag.plugFormat,curlIts];
    }else if(grantingTime < 24 * 60 * 60 * 2 && [female integerValue] != [sobFood integerValue]){
        if ([female integerValue] - [sobFood integerValue] == 1 || ([sobFood integerValue] - [female integerValue] > 10 && [female integerValue] == 1)) {
            axialEarMen = [NSString stringWithFormat:@"%@ %@",FixMaterial.dryMicroCapTag.hangCatOurMole,curlIts];
        }else{
            [pen setDateFormat:@"MM-dd HH:mm"];
            axialEarMen = [pen stringFromDate:menDate];
        }
    }else if(grantingTime < 24 * 60 * 60 * 365){
        [pen setDateFormat:@"MM-dd HH:mm"];
        axialEarMen = [pen stringFromDate:menDate];
    }else{
        [pen setDateFormat:@"yyyy-MM-dd HH:mm"];
        axialEarMen = [pen stringFromDate:menDate];
    }
    return axialEarMen;
}

@end
