hunk.code_window: #import "ABI15_0_0EXUnversioned.h"
   @interface ABI15_0_0EXWebBrowser () <SFSafariViewControllerDelegate>
   @end
   NSString *ABI15_0_0EXWebBrowserErrorCode = @"ABI15_0_0EXWebBrowser";
  
hunk.labels: keep keep keep add keep keep keep keep
hunk.after_edit: @property (nonatomic, copy) ABI15_0_0RCTPromiseResolveBlock redirectResolve;
   @property (nonatomic, copy) ABI15_0_0RCTPromiseRejectBlock redirectReject;
  
hunk.file_path: ios/versioned-react-native/ABI15_0_0/Exponent/Modules/Api/ABI15_0_0EXWebBrowser.m
hunk.type: add
file: /**
   * Copyright (c) 2015-present, Horcrux.
   * All rights reserved.
   *
   * This source code is licensed under the MIT-style license found in the
   * LICENSE file in the root directory of this source tree.
   */
  
  #import "ABI12_0_0RNSVGPercentageConverter.h"
  
  @implementation ABI12_0_0RNSVGPercentageConverter
  {
      CGFloat _relative;
      CGFloat _offset;
      NSRegularExpression *percentageRegularExpression;
  }
  
  - (instancetype) initWithRelativeAndOffset:(CGFloat)relative offset:(CGFloat)offset
  {
      if (self = [super init]) {
          _relative = relative;
          _offset = offset;
          percentageRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"^(\\-?\\d+(?:\\.\\d+)?)%$" options:0 error:nil];
      }
      return self;
  }
  
  - (id)init
  {
      if (self = [super init]) {
          percentageRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"^(\\-?\\d+(?:\\.\\d+)?)%$" options:0 error:nil];
      }
      return self;
  }
  
  - (NSRegularExpression *) getPercentageRegularExpression
  {
      return percentageRegularExpression;
  }
  
  - (CGFloat) stringToFloat:(NSString *)string
  {
      return [self stringToFloat:string relative:_relative offset:_offset];
  }
  
  - (CGFloat) stringToFloat:(NSString *)string relative:(CGFloat)relative offset:(CGFloat)offset
  {
      if ([self isPercentage:string] == NO) {
          return [string floatValue];
      } else {
          return [self percentageToFloat:string relative:relative offset:offset];
      }
  }
  
  - (CGFloat) percentageToFloat:(NSString *)percentage
  {
      return [self percentageToFloat:percentage relative:_relative offset:_offset];
  }
  
  - (CGFloat) percentageToFloat:(NSString *)percentage relative:(CGFloat)relative offset:(CGFloat)offset
  {
      __block CGFloat matched;
      
      [percentageRegularExpression enumerateMatchesInString:percentage
                                                    options:0
                                                      range:NSMakeRange(0, percentage.length)
                                                 usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop)
       {
           
           matched = [[percentage substringWithRange:NSMakeRange(result.range.location, result.range.length)] floatValue];
           matched = matched / 100 * relative + offset;
       }];
      
      return matched;
  }
  
  - (BOOL) isPercentage:(NSString *) string
  {
      return [percentageRegularExpression firstMatchInString:string options:0 range:NSMakeRange(0, [string length])] != nil;
  }
  
  @end
  