






#import "LostSexMainLabel.h"
#import "ForHueAfter.h"
#import "UIImage+GetImage.h"

@implementation LostSexMainLabel

+ (LostSexMainLabel *)comparedLimitLabel {
    return [self comparedLimitLabel:YES];
}

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

    NSAttributedString *bordersCleanupStreamGujaratiMid = nil;
    if (isCheckBox) {
        
        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
        UIImage *templateImage = [[UIImage thousandClipUnchangedPortionSelectedName:ForHueAfter.grayGradient.countryAdvertiseStylizeFrontFutureNearby] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        attachment.image = templateImage; 
        
        attachment.bounds = CGRectMake(0, -5, 20, 20);
        bordersCleanupStreamGujaratiMid = [NSAttributedString attributedStringWithAttachment:attachment];
    }

    
    NSString *text = ForHueAfter.stayFourthHint.fatMaxGallon;
    NSMutableAttributedString *rearExecLambda = [[NSMutableAttributedString alloc] initWithString:text];
    
    
    NSRange twentyKeyboard = [text rangeOfString:ForHueAfter.stayFourthHint.netNetValueHex];
    if (twentyKeyboard.location != NSNotFound) {
        [rearExecLambda addAttribute:NSForegroundColorAttributeName value:[ForHueAfter requiringColor] range:twentyKeyboard];
        [rearExecLambda addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:twentyKeyboard];
    }

    
    NSMutableAttributedString *thousandLiteralSinhaleseMaxHue = [[NSMutableAttributedString alloc] init];
    if (bordersCleanupStreamGujaratiMid) {
        [thousandLiteralSinhaleseMaxHue appendAttributedString:bordersCleanupStreamGujaratiMid];
    }
    [thousandLiteralSinhaleseMaxHue appendAttributedString:rearExecLambda];
    
    label.attributedText = thousandLiteralSinhaleseMaxHue;
    
    
    UITapGestureRecognizer *noneDidEra = [[UITapGestureRecognizer alloc] initWithTarget:label action:@selector(busyNeedIcyRequestHang:)];
    [label addGestureRecognizer:noneDidEra];
    
    return label;
}

- (void)setBadBarSlabSave:(BOOL)badBarSlabSave {
    _badBarSlabSave = !badBarSlabSave;
    [self fathomsRetAskSixOldCarLabel:self];
}

- (void)busyNeedIcyRequestHang:(UITapGestureRecognizer *)noneDidEra {
    LostSexMainLabel *label = (LostSexMainLabel *)noneDidEra.view;
    if (!label.attributedText) return;
    
    
    NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:label.attributedText];
    NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
    NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:label.bounds.size];
    
    textContainer.lineFragmentPadding = 0;
    textContainer.maximumNumberOfLines = label.numberOfLines;
    textContainer.lineBreakMode = label.lineBreakMode;
    
    [textStorage addLayoutManager:layoutManager];
    [layoutManager addTextContainer:textContainer];
    
    
    [layoutManager ensureLayoutForTextContainer:textContainer];
    
    
    CGPoint artHighPolo = [noneDidEra locationInView:label];
    CGRect usedRect = [layoutManager usedRectForTextContainer:textContainer];
    CGPoint manProvidedScatteredOutPort = CGPointMake(
        (label.bounds.size.width - usedRect.size.width) / 2,   
        (label.bounds.size.height - usedRect.size.height) / 2  
    );
    
    
    CGPoint structureHeapIodineRunRuleFeed = CGPointMake(
        artHighPolo.x - manProvidedScatteredOutPort.x,
        artHighPolo.y - manProvidedScatteredOutPort.y
    );
    
    
    __block BOOL fitMinimalOut = NO;
    [label.attributedText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.attributedText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *stop) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange oldWetLoad;
            [layoutManager glyphRangeForCharacterRange:range actualCharacterRange:&oldWetLoad];
            
            
            CGRect batchRect = [layoutManager boundingRectForGlyphRange:oldWetLoad
                                                      inTextContainer:textContainer];
            
            
            CGRect pinKeysAwayRect = CGRectOffset(batchRect, manProvidedScatteredOutPort.x, manProvidedScatteredOutPort.y);
            
            
            if (CGRectContainsPoint(pinKeysAwayRect, artHighPolo)) {
                fitMinimalOut = YES;
                *stop = YES;
            }
        }
    }];
    
    if (fitMinimalOut) {
        
        
        [self fathomsRetAskSixOldCarLabel:label];
        return;
    }
    
    
    NSUInteger characterIndex = [layoutManager characterIndexForPoint:structureHeapIodineRunRuleFeed
                                                    inTextContainer:textContainer
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *slabText = label.attributedText.string;
    NSRange twentyKeyboard = [slabText rangeOfString:ForHueAfter.stayFourthHint.netNetValueHex];
    
    if (characterIndex != NSNotFound && NSLocationInRange(characterIndex, twentyKeyboard)) {
        
        
        if (self.rotateVisitRespectsVisualDisablingWeight) {
            self.rotateVisitRespectsVisualDisablingWeight();
        }
    }
}


- (void)fathomsRetAskSixOldCarLabel:(LostSexMainLabel *)label {
    NSMutableAttributedString *attributedText = [label.attributedText mutableCopy];
    __block BOOL smileEvery = NO;
    
    [attributedText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, attributedText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *stop) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL dutchFire = !_badBarSlabSave;
        
        
        NSTextAttachment *dashInterlace = [[NSTextAttachment alloc] init];
        
        
        UIColor *midMinColor = dutchFire ? [ForHueAfter requiringColor]: UIColor.lightGrayColor;
        UIImage *footMileImage = [UIImage thousandClipUnchangedPortionSelectedName:dutchFire ? ForHueAfter.grayGradient.hexDeveloperBufferingOurJobLaw :ForHueAfter.grayGradient.countryAdvertiseStylizeFrontFutureNearby];
        
        
        dashInterlace.image = [[footMileImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:midMinColor];
        dashInterlace.bounds = oldAttachment.bounds;
        
        
        [attributedText removeAttribute:NSAttachmentAttributeName range:range];
        [attributedText addAttribute:NSAttachmentAttributeName value:dashInterlace range:range];
        
        _badBarSlabSave = dutchFire;
        smileEvery = YES;
        *stop = YES;
    }];
    
    if (smileEvery) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              duration:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.attributedText = attributedText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
