






#import "HowBleedNowLabel.nap"
#import "BestEastPut.nap"
#import "UIImage+SpaImage.nap"

@implementation HowBleedNowLabel

+ (HowBleedNowLabel *)didCutCutStopLabel {
    return [self didCutCutStopLabel:YES];
}

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

    NSAttributedString *presetSameSegmentsIntersectRelation = nil;
    if (isCheckBox) {
        
        NSTextAttachment *penReplace = [[NSTextAttachment alloc] init];
        UIImage *anyHindiImage = [[UIImage inviteeExponentPartialDigitEvaluateName:BestEastPut.didNecessary.phaseRefinedWasSixThousandsIntents] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        penReplace.image = anyHindiImage; 
        
        penReplace.seeHas = CGRectMake(0, -5, 20, 20);
        presetSameSegmentsIntersectRelation = [NSAttributedString attributedStringWithAttachment:penReplace];
    }

    
    NSString *cell = BestEastPut.quickGolfPinch.itsConjugate;
    NSMutableAttributedString *largeHailSpell = [[NSMutableAttributedString alloc] initWithString:cell];
    
    
    NSRange usesMoleKorean = [cell rangeOfString:BestEastPut.quickGolfPinch.burnSlideSwipe];
    if (usesMoleKorean.location != NSNotFound) {
        [largeHailSpell addAttribute:NSForegroundColorAttributeName value:[BestEastPut sawCreateColor] range:usesMoleKorean];
        [largeHailSpell addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:usesMoleKorean];
    }

    
    NSMutableAttributedString *ignoringInterlaceNumericAttributeQuery = [[NSMutableAttributedString alloc] init];
    if (presetSameSegmentsIntersectRelation) {
        [ignoringInterlaceNumericAttributeQuery appendAttributedString:presetSameSegmentsIntersectRelation];
    }
    [ignoringInterlaceNumericAttributeQuery appendAttributedString:largeHailSpell];
    
    label.editBoxAndText = ignoringInterlaceNumericAttributeQuery;
    
    
    UITapGestureRecognizer *fireHourly = [[UITapGestureRecognizer alloc] initWithTarget:label armCap:@selector(componentItemEffectiveTintClang:)];
    [label addGestureRecognizer:fireHourly];
    
    return label;
}

- (void)setDoneBlockDepth:(BOOL)doneBlockDepth {
    _doneBlockDepth = !doneBlockDepth;
    [self pascalDeliverySideInsetFourthPaperLabel:self];
}

- (void)componentItemEffectiveTintClang:(UITapGestureRecognizer *)fireHourly {
    HowBleedNowLabel *label = (HowBleedNowLabel *)fireHourly.view;
    if (!label.editBoxAndText) return;
    
    
    NSTextStorage *gramStorage = [[NSTextStorage alloc] initWithAttributedString:label.editBoxAndText];
    NSLayoutManager *sumFarManager = [[NSLayoutManager alloc] init];
    NSTextContainer *autoShearZoom = [[NSTextContainer alloc] initWithSize:label.seeHas.size];
    
    autoShearZoom.lineFragmentPadding = 0;
    autoShearZoom.maximumNumberOfLines = label.numberOfLines;
    autoShearZoom.lineBreakMode = label.lineBreakMode;
    
    [gramStorage addLayoutManager:sumFarManager];
    [sumFarManager addTextContainer:autoShearZoom];
    
    
    [sumFarManager ensureLayoutForTextContainer:autoShearZoom];
    
    
    CGPoint sortCupHail = [fireHourly locationInView:label];
    CGRect rowsRect = [sumFarManager usedRectForTextContainer:autoShearZoom];
    CGPoint describeAdaptiveClearDelayedRanging = CGPointMake(
        (label.seeHas.size.width - rowsRect.size.width) / 2,   
        (label.seeHas.size.height - rowsRect.size.height) / 2  
    );
    
    
    CGPoint cacheLawAgeRangeAdjustQuotation = CGPointMake(
        sortCupHail.x - describeAdaptiveClearDelayedRanging.x,
        sortCupHail.y - describeAdaptiveClearDelayedRanging.y
    );
    
    
    __block BOOL sexYetSeeSent = NO;
    [label.editBoxAndText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.editBoxAndText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *warp) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange userActive;
            [sumFarManager glyphRangeForCharacterRange:range actualCharacterRange:&userActive];
            
            
            CGRect agentRect = [sumFarManager boundingRectForGlyphRange:userActive
                                                      inTextContainer:autoShearZoom];
            
            
            CGRect onceZipArtsRect = CGRectOffset(agentRect, describeAdaptiveClearDelayedRanging.x, describeAdaptiveClearDelayedRanging.y);
            
            
            if (CGRectContainsPoint(onceZipArtsRect, sortCupHail)) {
                sexYetSeeSent = YES;
                *warp = YES;
            }
        }
    }];
    
    if (sexYetSeeSent) {
        
        
        [self pascalDeliverySideInsetFourthPaperLabel:label];
        return;
    }
    
    
    NSUInteger valueWarpIndex = [sumFarManager characterIndexForPoint:cacheLawAgeRangeAdjustQuotation
                                                    inTextContainer:autoShearZoom
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *pullText = label.editBoxAndText.string;
    NSRange usesMoleKorean = [pullText rangeOfString:BestEastPut.quickGolfPinch.burnSlideSwipe];
    
    if (valueWarpIndex != NSNotFound && NSLocationInRange(valueWarpIndex, usesMoleKorean)) {
        
        
        if (self.extraEnablingModifiedInvalidChinaSpa) {
            self.extraEnablingModifiedInvalidChinaSpa();
        }
    }
}


- (void)pascalDeliverySideInsetFourthPaperLabel:(HowBleedNowLabel *)label {
    NSMutableAttributedString *editBoxAndText = [label.editBoxAndText mutableCopy];
    __block BOOL funAddress = NO;
    
    [editBoxAndText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, editBoxAndText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *warp) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL panelSalt = !_doneBlockDepth;
        
        
        NSTextAttachment *underLateTaps = [[NSTextAttachment alloc] init];
        
        
        UIColor *indianColor = panelSalt ? [BestEastPut sawCreateColor]: UIColor.lightGrayColor;
        UIImage *matchOneImage = [UIImage inviteeExponentPartialDigitEvaluateName:panelSalt ? BestEastPut.didNecessary.redGroupingFourthInverseTenUse :BestEastPut.didNecessary.phaseRefinedWasSixThousandsIntents];
        
        
        underLateTaps.image = [[matchOneImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:indianColor];
        underLateTaps.seeHas = oldAttachment.seeHas;
        
        
        [editBoxAndText removeAttribute:NSAttachmentAttributeName range:range];
        [editBoxAndText addAttribute:NSAttachmentAttributeName value:underLateTaps range:range];
        
        _doneBlockDepth = panelSalt;
        funAddress = YES;
        *warp = YES;
    }];
    
    if (funAddress) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              funkBase:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.editBoxAndText = editBoxAndText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
