






#import "BottomDitherCell.h"
#import "MenTintSave.h"
#import "Masonry.h"
#import "UIImage+WasImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+SubEntity.h"

@interface BottomDitherCell()


@property (nonatomic,strong) NSString * modifyCursors;


@property (nonatomic,strong) UIImageView * muteTapNowView;


@property (nonatomic,strong) UILabel * peakRowDueLabel;


@property (nonatomic,strong) UILabel * exportWetLabel;

@property (nonatomic, strong) UIButton * hexBigButton;

@end

@implementation BottomDitherCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = UIColor.clearColor;
        self.contentView.backgroundColor = UIColor.clearColor;
        
        self.muteTapNowView = [UIImageView new];
        self.muteTapNowView.tintColor = [MenTintSave sedentaryColor];
        self.muteTapNowView.layer.cornerRadius = MenTintSave.ironRouteMix.permanentMix;
        [self.contentView addSubview:self.muteTapNowView];
        [self.muteTapNowView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(MenTintSave.ironRouteMix.eyeSilenced);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(MenTintSave.ironRouteMix.menCommonMid);
        }];
        
        self.peakRowDueLabel = [UILabel new];
        self.peakRowDueLabel.font = [UIFont boldSystemFontOfSize:MenTintSave.ironRouteMix.utilityPager];
        self.peakRowDueLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.peakRowDueLabel];
        
        self.exportWetLabel = [UILabel new];
        self.exportWetLabel.font = [UIFont boldSystemFontOfSize:MenTintSave.ironRouteMix.guideStreams];
        self.exportWetLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.exportWetLabel];
        
        [self.peakRowDueLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.muteTapNowView.mas_right).offset(MenTintSave.ironRouteMix.hitConstruct);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.exportWetLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.peakRowDueLabel);
            make.top.equalTo(self.peakRowDueLabel.mas_bottom).offset(MenTintSave.ironRouteMix.mixNotePolo);
        }];
        
        self.hexBigButton = [[UIButton alloc] init];
        _hexBigButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage cautionPreservesLevelEnglishFlowName:MenTintSave.ironRouteMix.accessingSuchFalloffCoercionMax] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_hexBigButton setBackgroundImage:[UIImage cautionPreservesLevelEnglishFlowName:MenTintSave.ironRouteMix.sinNotifyLocationsStoreChecksum] forState: UIControlStateNormal];
        [_hexBigButton setBackgroundImage:image forState: UIControlStateSelected];
        _hexBigButton.tintColor = [MenTintSave sedentaryColor];
        [self.contentView addSubview:_hexBigButton];
        [_hexBigButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-MenTintSave.ironRouteMix.hitConstruct);
            make.size.mas_equalTo(CGSizeMake(MenTintSave.ironRouteMix.occurNotFile, MenTintSave.ironRouteMix.occurNotFile));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _hexBigButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [MenTintSave sedentaryColor].CGColor;
    
    if (selected) {
        self.contentView.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.94 alpha:0.95];
    } else {
        self.contentView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.35];
    }
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = MenTintSave.ironRouteMix.eyeSilenced;
    frame.size.width -= MenTintSave.ironRouteMix.utilityPager;
    frame.origin.y += MenTintSave.ironRouteMix.eyeSilenced;
    frame.size.height -= MenTintSave.ironRouteMix.eyeSilenced;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setModifyCursors:(NSString *)modifyCursors {
    _modifyCursors = modifyCursors;
    [self.muteTapNowView sd_setImageWithURL:[NSURL URLWithString:modifyCursors] placeholderImage:nil];
}

- (void)setInstallSun:(EditorsCommentsTexturedIntegrityNextOwn *)installSun {
    _installSun= installSun;
    self.modifyCursors = installSun.irregular;
    self.peakRowDueLabel.text = installSun.hurricane;
    NSString *note = installSun.toggleJob?:@"";
    if (note.seekReplaced) {
        self.exportWetLabel.hidden = YES;
        [self.peakRowDueLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.muteTapNowView.mas_right).offset(MenTintSave.ironRouteMix.hitConstruct);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.exportWetLabel.hidden = NO;
        NSRange eyeIll = [note rangeOfString:MenTintSave.ironRouteMix.inlandSquashCommentsSecurityHybridEvaluated];
        NSRange notify = [note rangeOfString:MenTintSave.ironRouteMix.caffeineFinderProtocolsExclusiveAppearingBuddy];
        
        if (eyeIll.length == 0 && notify.length == 0) {
            self.exportWetLabel.text = note;
            self.exportWetLabel.font = [UIFont systemFontOfSize:MenTintSave.ironRouteMix.guideStreams];
            self.exportWetLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange penCanon = NSMakeRange(eyeIll.location+eyeIll.length, notify.location-(eyeIll.location+eyeIll.length));
            NSString *bigKin = [note substringWithRange:penCanon];
            NSString *knowHis = [note stringByReplacingOccurrencesOfString:MenTintSave.ironRouteMix.inlandSquashCommentsSecurityHybridEvaluated withString:@""];
            knowHis = [knowHis stringByReplacingOccurrencesOfString:MenTintSave.ironRouteMix.caffeineFinderProtocolsExclusiveAppearingBuddy withString:@""];
            
            penCanon = [knowHis rangeOfString:bigKin];
            NSMutableAttributedString *triggerSeven = [[NSMutableAttributedString alloc] initWithString:knowHis];
            [triggerSeven addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, knowHis.length)];
            [triggerSeven addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, knowHis.length)];
            [triggerSeven addAttribute:NSForegroundColorAttributeName value:[MenTintSave sedentaryColor] range:penCanon];
            [triggerSeven addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:penCanon];
            
            self.exportWetLabel.attributedText = triggerSeven;
        }
        
        [self.peakRowDueLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.muteTapNowView.mas_right).offset(MenTintSave.ironRouteMix.hitConstruct);
            make.top.equalTo(self.muteTapNowView).offset(MenTintSave.ironRouteMix.sinkCreated);
        }];
    }
}

@end
