






#import "ChromaIndentChromaPhoneThirdBikeViewController.h"
#import "BounceBrief.h"

@interface ChromaIndentChromaPhoneThirdBikeViewController () <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
@property (nonatomic, strong) UITableView *deepVortexView;
@property (nonatomic, strong) UISearchBar *unitCarrierBar;
@property (nonatomic, strong) NSArray<SeeSizeKey *> *binBikeBrowsingGatewaysBroken;     
@property (nonatomic, strong) NSArray<SeeSizeKey *> *tenSpaceFinishPolishClampSoftball; 
@end

@implementation ChromaIndentChromaPhoneThirdBikeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self succeedModuleMenuLargerEmbeddingData];
    [self sinAcquireTokenAdvancesReset];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    [self.view endEditing:YES];
}



- (void)succeedModuleMenuLargerEmbeddingData {
    NSArray *assignFix = [SessionsAttachTalkBeginningJob searchingChildCaffeineAcceptingPortrait:[SeeSizeKey class]];
    
    
    self.binBikeBrowsingGatewaysBroken = [assignFix sortedArrayUsingComparator:^NSComparisonResult(SeeSizeKey *c1, SeeSizeKey *c2) {
        return [c1.partlyGet compare:c2.partlyGet options:NSCaseInsensitiveSearch];
    }];
    
    self.tenSpaceFinishPolishClampSoftball = self.binBikeBrowsingGatewaysBroken;
    
    
    NSString *loveBigAreaRedCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
    
    
    __block SeeSizeKey *dropMoodQuotes = nil;
    __block NSUInteger succeedIndex = NSNotFound;
    [self.binBikeBrowsingGatewaysBroken enumerateObjectsUsingBlock:^(SeeSizeKey *country, NSUInteger idx, BOOL *stop) {
        if ([country.mapSensitiveCode caseInsensitiveCompare:loveBigAreaRedCode] == NSOrderedSame) {
            dropMoodQuotes = country;
            succeedIndex = idx;
            *stop = YES; 
        }
    }];
    
    
    if (dropMoodQuotes) {
        
        
        
        NSMutableArray *raceCounterCatalystAnchorHand = [self.binBikeBrowsingGatewaysBroken mutableCopy];
        [raceCounterCatalystAnchorHand removeObjectAtIndex:succeedIndex];    
        [raceCounterCatalystAnchorHand insertObject:dropMoodQuotes atIndex:0]; 
        
        
        self.binBikeBrowsingGatewaysBroken = [raceCounterCatalystAnchorHand copy];
        self.tenSpaceFinishPolishClampSoftball = self.binBikeBrowsingGatewaysBroken; 
    }
}



- (void)sinAcquireTokenAdvancesReset {
    self.view.clipsToBounds = YES;
    
    
    self.unitCarrierBar = [[UISearchBar alloc] init];
    self.unitCarrierBar.delegate = self;
    self.unitCarrierBar.placeholder = BounceBrief.airDigitSobSee.pendingReadableArchivedDismissSnapPrologPivot;
    self.unitCarrierBar.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.unitCarrierBar];
    
    
    self.deepVortexView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    self.deepVortexView.delegate = self;
    self.deepVortexView.dataSource = self;
    self.deepVortexView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.deepVortexView];
    
    
    UILayoutGuide *clean = self.view.safeAreaLayoutGuide;
    UILayoutGuide *pubBus = self.satisfiedButton.safeAreaLayoutGuide;
    UILayoutGuide *seeFat = self.retMileItsButton.safeAreaLayoutGuide;
    [NSLayoutConstraint activateConstraints:@[
        [self.unitCarrierBar.topAnchor constraintEqualToAnchor:clean.topAnchor],
        [self.unitCarrierBar.leadingAnchor constraintEqualToAnchor:pubBus.trailingAnchor],
        [self.unitCarrierBar.trailingAnchor constraintEqualToAnchor:seeFat.leadingAnchor],
        
        [self.deepVortexView.topAnchor constraintEqualToAnchor:self.unitCarrierBar.bottomAnchor],
        [self.deepVortexView.leadingAnchor constraintEqualToAnchor:clean.leadingAnchor],
        [self.deepVortexView.trailingAnchor constraintEqualToAnchor:clean.trailingAnchor],
        [self.deepVortexView.bottomAnchor constraintEqualToAnchor:clean.bottomAnchor]
    ]];
}

- (void)hindiFusionAction {
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.tenSpaceFinishPolishClampSoftball.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *deny = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self.class)];
    if (!deny) {
        deny = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass(self.class)];
    }
    SeeSizeKey *country = self.tenSpaceFinishPolishClampSoftball[indexPath.row];
    deny.textLabel.text = [NSString stringWithFormat:@"%@ %@", [self transferLocalityLiveDecideEndTalkCode:country.mapSensitiveCode],country.partlyGet];
    deny.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@",BounceBrief.cropSobCanon.teamChinaRule,country.scatteredCode];
    return deny;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    SeeSizeKey *promisedDirectlyBadSystolicCalling = self.tenSpaceFinishPolishClampSoftball[indexPath.row];
    if ([self.gaelicIcyDelegate respondsToSelector:@selector(routeRepeatDescribesOffsetsPromiseMidDeriveIndex:)]) {
        [self.gaelicIcyDelegate routeRepeatDescribesOffsetsPromiseMidDeriveIndex:promisedDirectlyBadSystolicCalling];
    }
    [self handledFarPreventsArbitraryVitalityAction:nil];
}


- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
    if (searchText.length == 0) {
        self.tenSpaceFinishPolishClampSoftball = self.binBikeBrowsingGatewaysBroken;
    } else {
        NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(SeeSizeKey *evaluatedObject, NSDictionary *bindings) {
            BOOL nap = [evaluatedObject.partlyGet rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            BOOL are = [evaluatedObject.scatteredCode rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            return nap || are;
        }];
        self.tenSpaceFinishPolishClampSoftball = [self.binBikeBrowsingGatewaysBroken filteredArrayUsingPredicate:predicate];
    }
    [self.deepVortexView reloadData];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
    [self.view endEditing:YES];
}

- (NSString *)transferLocalityLiveDecideEndTalkCode:(NSString *)countryCode {
    
    if(![countryCode isKindOfClass:[NSString class]] || countryCode.length != 2 || [countryCode isEqualToString:@"TW"]) return @"";
    int base = 127397;
    
    wchar_t bytes[2] = {
        base +[countryCode characterAtIndex:0],
        base +[countryCode characterAtIndex:1]
    };
    
    return [[NSString alloc] initWithBytes:bytes
                                    length:countryCode.length *sizeof(wchar_t)
                                  encoding:NSUTF32LittleEndianStringEncoding];
}

- (void)dealloc {
    
}
@end
