






#import "ViewPlayWayLabel.two"
#import "AirItemBody.two"
#import "UIImage+RawImage.two"

@implementation ViewPlayWayLabel

+ (ViewPlayWayLabel *)interactSurgeLabel {
    return [self interactSurgeLabel:YES];
}

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

    NSAttributedString *urgencyMultiplyWayLowTelephoto = nil;
    if (isCheckBox) {
        
        NSTextAttachment *retryFloor = [[NSTextAttachment alloc] init];
        UIImage *packBlurImage = [[UIImage staticAddressesSpokenLongitudeKernelsName:AirItemBody.mouseMeasure.theSeleniumAutomaticStatePortraitPut] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        retryFloor.image = packBlurImage; 
        
        retryFloor.faxLog = CGRectMake(0, -5, 20, 20);
        urgencyMultiplyWayLowTelephoto = [NSAttributedString attributedStringWithAttachment:retryFloor];
    }

    
    NSString *scan = AirItemBody.nowPintLoadIll.openConclude;
    NSMutableAttributedString *multipleDarken = [[NSMutableAttributedString alloc] initWithString:scan];
    
    
    NSRange smoothHardPush = [scan rangeOfString:AirItemBody.nowPintLoadIll.sobSameSixTrad];
    if (smoothHardPush.location != NSNotFound) {
        [multipleDarken addAttribute:NSForegroundColorAttributeName value:[AirItemBody stormLikeColor] range:smoothHardPush];
        [multipleDarken addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:smoothHardPush];
    }

    
    NSMutableAttributedString *fourthSpaSaltBloodAscent = [[NSMutableAttributedString alloc] init];
    if (urgencyMultiplyWayLowTelephoto) {
        [fourthSpaSaltBloodAscent appendAttributedString:urgencyMultiplyWayLowTelephoto];
    }
    [fourthSpaSaltBloodAscent appendAttributedString:multipleDarken];
    
    label.axesIndigoText = fourthSpaSaltBloodAscent;
    
    
    UITapGestureRecognizer *badBedClip = [[UITapGestureRecognizer alloc] initWithTarget:label canWon:@selector(eastBelowAliveWeekOur:)];
    [label addGestureRecognizer:badBedClip];
    
    return label;
}

- (void)setQuietMayBadUse:(BOOL)quietMayBadUse {
    _quietMayBadUse = !quietMayBadUse;
    [self genderBurnContextDividerHandoffVisibleLabel:self];
}

- (void)eastBelowAliveWeekOur:(UITapGestureRecognizer *)badBedClip {
    ViewPlayWayLabel *label = (ViewPlayWayLabel *)badBedClip.view;
    if (!label.axesIndigoText) return;
    
    
    NSTextStorage *pinkStorage = [[NSTextStorage alloc] initWithAttributedString:label.axesIndigoText];
    NSLayoutManager *serialManager = [[NSLayoutManager alloc] init];
    NSTextContainer *proxiesFrench = [[NSTextContainer alloc] initWithSize:label.faxLog.size];
    
    proxiesFrench.lineFragmentPadding = 0;
    proxiesFrench.maximumNumberOfLines = label.numberOfLines;
    proxiesFrench.lineBreakMode = label.lineBreakMode;
    
    [pinkStorage addLayoutManager:serialManager];
    [serialManager addTextContainer:proxiesFrench];
    
    
    [serialManager ensureLayoutForTextContainer:proxiesFrench];
    
    
    CGPoint barProvides = [badBedClip locationInView:label];
    CGRect loudRect = [serialManager usedRectForTextContainer:proxiesFrench];
    CGPoint autoMarkupInterruptGatheringExclusive = CGPointMake(
        (label.faxLog.size.width - loudRect.size.width) / 2,   
        (label.faxLog.size.height - loudRect.size.height) / 2  
    );
    
    
    CGPoint packageMaxMilesStylisticFeedExpect = CGPointMake(
        barProvides.x - autoMarkupInterruptGatheringExclusive.x,
        barProvides.y - autoMarkupInterruptGatheringExclusive.y
    );
    
    
    __block BOOL priorFlushEar = NO;
    [label.axesIndigoText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.axesIndigoText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *blob) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange hueVolumes;
            [serialManager glyphRangeForCharacterRange:range actualCharacterRange:&hueVolumes];
            
            
            CGRect yahooRect = [serialManager boundingRectForGlyphRange:hueVolumes
                                                      inTextContainer:proxiesFrench];
            
            
            CGRect subFlipNeedRect = CGRectOffset(yahooRect, autoMarkupInterruptGatheringExclusive.x, autoMarkupInterruptGatheringExclusive.y);
            
            
            if (CGRectContainsPoint(subFlipNeedRect, barProvides)) {
                priorFlushEar = YES;
                *blob = YES;
            }
        }
    }];
    
    if (priorFlushEar) {
        
        
        [self genderBurnContextDividerHandoffVisibleLabel:label];
        return;
    }
    
    
    NSUInteger extendingIndex = [serialManager characterIndexForPoint:packageMaxMilesStylisticFeedExpect
                                                    inTextContainer:proxiesFrench
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *plugText = label.axesIndigoText.string;
    NSRange smoothHardPush = [plugText rangeOfString:AirItemBody.nowPintLoadIll.sobSameSixTrad];
    
    if (extendingIndex != NSNotFound && NSLocationInRange(extendingIndex, smoothHardPush)) {
        
        
        if (self.crossAlwaysOrdinaryEllipseNotifyRing) {
            self.crossAlwaysOrdinaryEllipseNotifyRing();
        }
    }
}


- (void)genderBurnContextDividerHandoffVisibleLabel:(ViewPlayWayLabel *)label {
    NSMutableAttributedString *axesIndigoText = [label.axesIndigoText mutableCopy];
    __block BOOL mayFlemish = NO;
    
    [axesIndigoText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, axesIndigoText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *blob) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL pubOnline = !_quietMayBadUse;
        
        
        NSTextAttachment *mapTapRunFunk = [[NSTextAttachment alloc] init];
        
        
        UIColor *adverbColor = pubOnline ? [AirItemBody stormLikeColor]: UIColor.lightGrayColor;
        UIImage *faeroeseImage = [UIImage staticAddressesSpokenLongitudeKernelsName:pubOnline ? AirItemBody.mouseMeasure.degreeSpaUseStackedUpscaleDelta :AirItemBody.mouseMeasure.theSeleniumAutomaticStatePortraitPut];
        
        
        mapTapRunFunk.image = [[faeroeseImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:adverbColor];
        mapTapRunFunk.faxLog = oldAttachment.faxLog;
        
        
        [axesIndigoText removeAttribute:NSAttachmentAttributeName range:range];
        [axesIndigoText addAttribute:NSAttachmentAttributeName value:mapTapRunFunk range:range];
        
        _quietMayBadUse = pubOnline;
        mayFlemish = YES;
        *blob = YES;
    }];
    
    if (mayFlemish) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              tabPrint:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.axesIndigoText = axesIndigoText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
