






#import "TooAddCountLabel.cap"
#import "SuchOptSnap.cap"
#import "UIImage+OneImage.cap"

@implementation TooAddCountLabel

+ (TooAddCountLabel *)tonePreventedLabel {
    return [self tonePreventedLabel:YES];
}

+ (TooAddCountLabel *)tonePreventedLabel:(BOOL)isCheckBox {
    
    TooAddCountLabel *label = [[TooAddCountLabel alloc] init];
    label.numberOfLines = 0;
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor lightGrayColor];
    label.font = [UIFont systemFontOfSize:12];
    label.userInteractionEnabled = YES; 

    NSAttributedString *underlineMasteringStormDeepSelected = nil;
    if (isCheckBox) {
        
        NSTextAttachment *decideFeed = [[NSTextAttachment alloc] init];
        UIImage *winSugarImage = [[UIImage datumBloodRecordDecibelDescendName:SuchOptSnap.visionOneBus.afterInuitHisSigmoidPenCreate] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        decideFeed.image = winSugarImage; 
        
        decideFeed.cupTen = CGRectMake(0, -5, 20, 20);
        underlineMasteringStormDeepSelected = [NSAttributedString attributedStringWithAttachment:decideFeed];
    }

    
    NSString *skin = SuchOptSnap.eyeAndFlatThin.sayNotifying;
    NSMutableAttributedString *whoTempWhoMove = [[NSMutableAttributedString alloc] initWithString:skin];
    
    
    NSRange trackArtsMagic = [skin rangeOfString:SuchOptSnap.eyeAndFlatThin.redoneMeasured];
    if (trackArtsMagic.location != NSNotFound) {
        [whoTempWhoMove addAttribute:NSForegroundColorAttributeName value:[SuchOptSnap exposuresColor] range:trackArtsMagic];
        [whoTempWhoMove addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:trackArtsMagic];
    }

    
    NSMutableAttributedString *warnGenerateTitleCroppingKorean = [[NSMutableAttributedString alloc] init];
    if (underlineMasteringStormDeepSelected) {
        [warnGenerateTitleCroppingKorean appendAttributedString:underlineMasteringStormDeepSelected];
    }
    [warnGenerateTitleCroppingKorean appendAttributedString:whoTempWhoMove];
    
    label.kitRegularText = warnGenerateTitleCroppingKorean;
    
    
    UITapGestureRecognizer *mustTagRaw = [[UITapGestureRecognizer alloc] initWithTarget:label dogWay:@selector(balticCollationRedoTagRecorder:)];
    [label addGestureRecognizer:mustTagRaw];
    
    return label;
}

- (void)setBedGetRunSolve:(BOOL)bedGetRunSolve {
    _bedGetRunSolve = !bedGetRunSolve;
    [self argumentsFunctionsEnterSharingWakeTintLabel:self];
}

- (void)balticCollationRedoTagRecorder:(UITapGestureRecognizer *)mustTagRaw {
    TooAddCountLabel *label = (TooAddCountLabel *)mustTagRaw.view;
    if (!label.kitRegularText) return;
    
    
    NSTextStorage *snapStorage = [[NSTextStorage alloc] initWithAttributedString:label.kitRegularText];
    NSLayoutManager *assumeManager = [[NSLayoutManager alloc] init];
    NSTextContainer *graphicsNonce = [[NSTextContainer alloc] initWithSize:label.cupTen.size];
    
    graphicsNonce.lineFragmentPadding = 0;
    graphicsNonce.maximumNumberOfLines = label.numberOfLines;
    graphicsNonce.lineBreakMode = label.lineBreakMode;
    
    [snapStorage addLayoutManager:assumeManager];
    [assumeManager addTextContainer:graphicsNonce];
    
    
    [assumeManager ensureLayoutForTextContainer:graphicsNonce];
    
    
    CGPoint opacityEach = [mustTagRaw locationInView:label];
    CGRect maskRect = [assumeManager usedRectForTextContainer:graphicsNonce];
    CGPoint exceededTelephonePlaneRedoPolicy = CGPointMake(
        (label.cupTen.size.width - maskRect.size.width) / 2,   
        (label.cupTen.size.height - maskRect.size.height) / 2  
    );
    
    
    CGPoint unlockMoireReadoutArteryPredictedFarsi = CGPointMake(
        opacityEach.x - exceededTelephonePlaneRedoPolicy.x,
        opacityEach.y - exceededTelephonePlaneRedoPolicy.y
    );
    
    
    __block BOOL violationWarn = NO;
    [label.kitRegularText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.kitRegularText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *burn) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange membersMix;
            [assumeManager glyphRangeForCharacterRange:range actualCharacterRange:&membersMix];
            
            
            CGRect burstRect = [assumeManager boundingRectForGlyphRange:membersMix
                                                      inTextContainer:graphicsNonce];
            
            
            CGRect wrapperCharRect = CGRectOffset(burstRect, exceededTelephonePlaneRedoPolicy.x, exceededTelephonePlaneRedoPolicy.y);
            
            
            if (CGRectContainsPoint(wrapperCharRect, opacityEach)) {
                violationWarn = YES;
                *burn = YES;
            }
        }
    }];
    
    if (violationWarn) {
        
        
        [self argumentsFunctionsEnterSharingWakeTintLabel:label];
        return;
    }
    
    
    NSUInteger logDetailIndex = [assumeManager characterIndexForPoint:unlockMoireReadoutArteryPredictedFarsi
                                                    inTextContainer:graphicsNonce
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *loveText = label.kitRegularText.string;
    NSRange trackArtsMagic = [loveText rangeOfString:SuchOptSnap.eyeAndFlatThin.redoneMeasured];
    
    if (logDetailIndex != NSNotFound && NSLocationInRange(logDetailIndex, trackArtsMagic)) {
        
        
        if (self.stationPronounBedCutOrderingAutomatic) {
            self.stationPronounBedCutOrderingAutomatic();
        }
    }
}


- (void)argumentsFunctionsEnterSharingWakeTintLabel:(TooAddCountLabel *)label {
    NSMutableAttributedString *kitRegularText = [label.kitRegularText mutableCopy];
    __block BOOL formSpoken = NO;
    
    [kitRegularText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, kitRegularText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *burn) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL tooRevert = !_bedGetRunSolve;
        
        
        NSTextAttachment *askHisMustHit = [[NSTextAttachment alloc] init];
        
        
        UIColor *farHerColor = tooRevert ? [SuchOptSnap exposuresColor]: UIColor.lightGrayColor;
        UIImage *daySlopeImage = [UIImage datumBloodRecordDecibelDescendName:tooRevert ? SuchOptSnap.visionOneBus.convergedWaitAreRareRoundDeleting :SuchOptSnap.visionOneBus.afterInuitHisSigmoidPenCreate];
        
        
        askHisMustHit.image = [[daySlopeImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:farHerColor];
        askHisMustHit.cupTen = oldAttachment.cupTen;
        
        
        [kitRegularText removeAttribute:NSAttachmentAttributeName range:range];
        [kitRegularText addAttribute:NSAttachmentAttributeName value:askHisMustHit range:range];
        
        _bedGetRunSolve = tooRevert;
        formSpoken = YES;
        *burn = YES;
    }];
    
    if (formSpoken) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              napWrite:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.kitRegularText = kitRegularText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
