






#import "ChunkyGetManager.h"
#import "TenOceanBedWetViewController.h"
#import "ZoomingPinConfig.h"

@interface ChunkyGetManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *squaresOrdinal;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *tooPinDelete;  
@end

@implementation ChunkyGetManager

- (instancetype)init {
    self = [super init];
    if (self) {
        _squaresOrdinal = [NSMutableArray array];
        _tooPinDelete = [NSMutableArray array];
    }
    return self;
}

+ (instancetype)shared {
    static id shared = nil;
    static dispatch_once_t lazyToken;
    dispatch_once(&lazyToken, ^{
        shared = [[super alloc] init];
    });
    return shared;
}


- (UIWindow *)pinHasCityWindow {
    UIWindow *dolbyWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        
        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
        for (UIScene *scene in connectedScenes) {
            
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                
                UIWindowScene *windowScene = (UIWindowScene *)scene;
                
                if (windowScene.windows.count > 0) {
                    dolbyWindow = windowScene.windows.firstObject;
                }
                break;
            }
        }
    } else {
        
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            dolbyWindow = windows.firstObject;
        }
    }
    
    
    if (!dolbyWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            dolbyWindow = windows.firstObject;
        }
    }
    
    return dolbyWindow;
}


- (UIWindow *)identicalDogWindow {
    
    UIWindow *recycleWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
        for (UIScene *scene in connectedScenes) {
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                UIWindowScene *windowScene = (UIWindowScene *)scene;
                
                
                if (@available(iOS 15.0, *)) {
                    recycleWindow = windowScene.keyWindow;
                }
                
                else {
                    for (UIWindow *window in windowScene.windows) {
                        if (window.isKeyWindow) {
                            recycleWindow = window;
                            break;
                        }
                    }
                }
                break;
            }
        }
    } else {
        
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        recycleWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!recycleWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        for (UIWindow *window in windows) {
            if (window.isKeyWindow) {
                recycleWindow = window;
                break;
            }
        }
    }
    
    return recycleWindow;
}


- (void)gesturesArrangedLooseRootStepsonUnionProduceViewController:(UIViewController *)retFax{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *ownWindow = [self attributeUnlockLogPagerMarkAcross:retFax];
            
            
            [self grandauntSuffixDoneMiterFiberCan:ownWindow];
            
            [self.squaresOrdinal addObject:ownWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id car = nil;
            
            car = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:car];
                [weakSelf gesturesArrangedLooseRootStepsonUnionProduceViewController:retFax];
            }];
        }
    });
}

- (void)digestRawPortNodeLabelEntityViewController:(UIViewController *)retFax {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self outSawManganeseAmountMonotonicFilenameProducer:retFax];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id car = nil;
            
            car = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:car];
                
                [weakSelf outSawManganeseAmountMonotonicFilenameProducer:retFax];
            }];
        }
    });
}

- (void)optimizeZeroTextureConcertHaveRefusedView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self outSawManganeseAmountMonotonicFilenameProducer:view];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id car = nil;
            
            car = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:car];
                
                [weakSelf outSawManganeseAmountMonotonicFilenameProducer:view];
            }];
        }
    });
}

- (void)outSawManganeseAmountMonotonicFilenameProducer:(id)object {
    UIViewController *retFax = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        retFax = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        retFax = [TenOceanBedWetViewController new];
        retFax.view = object;
    }
    
    
    UIWindow *ownWindow = [self attributeUnlockLogPagerMarkAcross:retFax];
    
    
    [self grandauntSuffixDoneMiterFiberCan:ownWindow];
    
    
    [self.tooPinDelete addObject:ownWindow];
}

- (void)clockwiseViolationGroupedMultiplyLowDecompose:(NSNotification *)note {
    
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:UIApplicationDidBecomeActiveNotification
                                                  object:nil];
    [self optimizeZeroTextureConcertHaveRefusedView:note.object];
}

- (void)airOverwriteWindow {
    [self layoutAscendedFunnelForeverCellphoneWindow];
}

- (void)layoutAscendedFunnelForeverCellphoneWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.tooPinDelete.count == 0) return;

        
        UIWindow *foldWindow = [self.tooPinDelete lastObject];
        [self.tooPinDelete removeLastObject];

        
        if (foldWindow.isKeyWindow) {
            [self hangWaxSeekTryWindow];
        }

        
        foldWindow.hidden = YES;
        
        
        for (UIView *leftPan in [foldWindow.subviews copy]) {
            [leftPan removeFromSuperview];
        }
        
        
        foldWindow.rootViewController = nil;
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
    });
}

- (void)schedulerTriggersRequestedGramConcertMovieViewController:(UIViewController *)rootViewController {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSEnumerator *publishSchoolBayerAssetTag = [self.tooPinDelete reverseObjectEnumerator];
        UIWindow *window = nil;
        
        
        while ((window = [publishSchoolBayerAssetTag nextObject])) {
            if (window.rootViewController == rootViewController) {
                
                if (window.isKeyWindow) {
                    [self hangWaxSeekTryWindow];
                }
                
                
                window.hidden = YES;
                
                
                for (UIView *leftPan in [window.subviews copy]) {
                    [leftPan removeFromSuperview];
                }
                
                
                window.rootViewController = nil;
                
                [self.tooPinDelete removeObject:window];
                
                
                [CATransaction flush];
                
                
                [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
                
                
                publishSchoolBayerAssetTag = [self.tooPinDelete reverseObjectEnumerator];
            }
        }
    });
}

- (void)onlyFeedbackPlatePinSecondSay {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIWindow *window in [self.tooPinDelete reverseObjectEnumerator]) {
            if (window.isKeyWindow) {
                [self hangWaxSeekTryWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *leftPan in [window.subviews copy]) {
                [leftPan removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.tooPinDelete removeAllObjects];
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
    });
}

- (void)hexDistantDecodeNaturalRepeatLayerGesture:(void(^)(void))completion {
    
    if (self.tooPinDelete.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *diphthongAgeAreaMoreOxygen = [self.tooPinDelete copy];
        for (UIWindow *window in diphthongAgeAreaMoreOxygen) {
            if (window.isKeyWindow) {
                [self hangWaxSeekTryWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *leftPan in [window.subviews copy]) {
                [leftPan removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.tooPinDelete removeAllObjects];
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
        
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (completion) {
                completion();
            }
        });
    });
}


- (UIWindow *)attributeUnlockLogPagerMarkAcross:(UIViewController *)retFax {
    UIWindow *window = nil;
    
    
    if (@available(iOS 13.0, *)) {
        for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
                break;
            }
        }
    }
    
    
    if (!window) {
        window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    }
    
    
    window.backgroundColor = [UIColor clearColor];
    window.rootViewController = retFax;
    return window;
}

- (void)grandauntSuffixDoneMiterFiberCan:(UIWindow *)window {
    

    window.windowLevel = UIWindowLevelStatusBar + 100;
    [window makeKeyAndVisible];
}


- (void)hangWaxSeekTryWindow {
    UIWindow *artsWindow = [self blinkPrettyWindow];
    [artsWindow makeKeyWindow];
    if (!artsWindow.isKeyWindow) {
        [artsWindow becomeKeyWindow];
    }
}

- (UIWindow *)blinkPrettyWindow {
    __block UIWindow *artsWindow = nil;
    
    
    if (@available(iOS 13.0, *)) {
        NSArray<UIWindowScene *> *foodFunction = [self disposeEvaluatedDeriveUsedHealth];
        [foodFunction enumerateObjectsUsingBlock:^(UIWindowScene * _Nonnull scene, NSUInteger idx, BOOL * _Nonnull stop) {
            
            if (@available(iOS 15.0, *)) {
                artsWindow = scene.keyWindow;
            }
            
            if (!artsWindow) {
                artsWindow = [scene.windows firstObject];
            }
            if (artsWindow) *stop = YES;
        }];
    }
    
    else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        artsWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!artsWindow) {
        artsWindow = [UIApplication sharedApplication].windows.firstObject;
    }
    
    return artsWindow;
}

- (NSArray<UIWindowScene *> *)disposeEvaluatedDeriveUsedHealth {
    NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(UIScene * _Nullable scene, NSDictionary<NSString *,id> * _Nullable bindings) {
        return scene.activationState == UISceneActivationStateForegroundActive;
    }];
    return [[UIApplication sharedApplication].connectedScenes filteredSetUsingPredicate:predicate].allObjects;
}


- (UIWindow *)funWindow {
    return [self.tooPinDelete lastObject];
}

- (NSInteger)posterCount {
    return self.tooPinDelete.count;
}


@end
