






#import "PrimeArtsManager.h"
#import "UnwrapRegistryViewController.h"
#import "DoneTryTenConfig.h"

@interface PrimeArtsManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *briefParseKind;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *subEchoShift;  
@end

@implementation PrimeArtsManager

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

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


- (UIWindow *)lookOutIllWindow {
    UIWindow *sigmaWindow = 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) {
                    sigmaWindow = windowScene.windows.firstObject;
                }
                break;
            }
        }
    } else {
        
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            sigmaWindow = windows.firstObject;
        }
    }
    
    
    if (!sigmaWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            sigmaWindow = windows.firstObject;
        }
    }
    
    return sigmaWindow;
}


- (UIWindow *)staleButLeftWindow {
    
    UIWindow *yetHostWindow = 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, *)) {
                    yetHostWindow = windowScene.keyWindow;
                }
                
                else {
                    for (UIWindow *window in windowScene.windows) {
                        if (window.isKeyWindow) {
                            yetHostWindow = window;
                            break;
                        }
                    }
                }
                break;
            }
        }
    } else {
        
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        yetHostWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!yetHostWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        for (UIWindow *window in windows) {
            if (window.isKeyWindow) {
                yetHostWindow = window;
                break;
            }
        }
    }
    
    return yetHostWindow;
}


- (void)schemeGatewaysBetweenNominalSpanBuilderProvidingViewController:(UIViewController *)seeEye{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *lowWindow = [self replyOrdinarySurrogateMarkupParticleTrait:seeEye];
            
            
            [self bothAdapterMaskEntityItemWhile:lowWindow];
            
            [self.briefParseKind addObject:lowWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id kit = nil;
            
            kit = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:kit];
                [weakSelf schemeGatewaysBetweenNominalSpanBuilderProvidingViewController:seeEye];
            }];
        }
    });
}

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

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

- (void)acceptedPerformedTrapOnlineObscuredMainSpecify:(id)object {
    UIViewController *seeEye = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        seeEye = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        seeEye = [UnwrapRegistryViewController new];
        seeEye.view = object;
    }
    
    
    UIWindow *lowWindow = [self replyOrdinarySurrogateMarkupParticleTrait:seeEye];
    
    
    [self bothAdapterMaskEntityItemWhile:lowWindow];
    
    
    [self.subEchoShift addObject:lowWindow];
}

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

- (void)helpItsModelWindow {
    [self advisoryShowingBirthdayWaterDownloadsWindow];
}

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

        
        UIWindow *hashWindow = [self.subEchoShift lastObject];
        [self.subEchoShift removeLastObject];

        
        if (hashWindow.isKeyWindow) {
            [self existSevenDenyWindow];
        }

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

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

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

- (void)logicalCursorsRemotelyExistStreamsSongPaper:(void(^)(void))completion {
    
    if (self.subEchoShift.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *frenchTertiaryUptimeMouseUnknown = [self.subEchoShift copy];
        for (UIWindow *window in frenchTertiaryUptimeMouseUnknown) {
            if (window.isKeyWindow) {
                [self existSevenDenyWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *butMill in [window.subviews copy]) {
                [butMill removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.subEchoShift 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 *)replyOrdinarySurrogateMarkupParticleTrait:(UIViewController *)seeEye {
    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 = seeEye;
    return window;
}

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

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


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

- (UIWindow *)manYouMovieWindow {
    __block UIWindow *artsWindow = nil;
    
    
    if (@available(iOS 13.0, *)) {
        NSArray<UIWindowScene *> *jobBadNumber = [self ringSyntaxEvaluatedProposedCarriage];
        [jobBadNumber 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 *> *)ringSyntaxEvaluatedProposedCarriage {
    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 *)putWindow {
    return [self.subEchoShift lastObject];
}

- (NSInteger)tooSheCount {
    return self.subEchoShift.count;
}


@end
