<commit_before>import React, {Component, PropTypes} from 'react';
import _ from 'underscore';
import {exec} from 'child_process';

// This is a stripped down version of
// https://github.com/michaelvillar/dynamics.js/blob/master/src/dynamics.coffee#L1179,
//
const SpringBounceFactory = (options)=> {
  const frequency = Math.max(1, options.frequency / 20);
  const friction = Math.pow(20, options.friction / 100);
  return (t)=> {
    return 1 - (Math.pow(friction / 10, -t) * (1 - t) * Math.cos(frequency * t));
  };
};
const SpringBounceFunction = SpringBounceFactory({
  frequency: 360,
  friction: 440,
})

const Phase = {
  // No wheel events received yet, container is inactive.
  None: 'none',

  // Wheel events received
  GestureStarting: 'gesture-starting',

  // Wheel events received and we are stopping event propagation.
  GestureConfirmed: 'gesture-confirmed',

  // Fingers lifted, we are animating to a final state.
  Settling: 'settling',
}

let SwipeInverted = false;

if (process.platform === 'darwin') {
  exec("defaults read -g com.apple.swipescrolldirection", (err, stdout)=> {
    if (err !== null) {
      return;
    }
    if (stdout.toString().trim() === '1') {
      SwipeInverted = true;
    }
  });
} else if (process.platform === 'win32') {
  // Currently does not matter because we don't support trackpad gestures on Win.
  // It appears there's a config key called FlipFlopWheel which we might have to
  // check, but it also looks like disabling natural scroll on Win32 only changes
  // vertical, not horizontal, behavior.
}


export default class SwipeContainer extends Component {
  static displayName = 'SwipeContainer';

  static propTypes = {
    children: PropTypes.object.isRequired,
    onSwipeLeft: React.PropTypes.func,
    onSwipeLeftClass: React.PropTypes.string,
    onSwipeRight: React.PropTypes.func,
    onSwipeRightClass: React.PropTypes.string,<commit_msg>fix(swipe): Count '' as "natural scrolling enabled" on Mac OS X<commit_after>import React, {Component, PropTypes} from 'react';
import _ from 'underscore';
import {exec} from 'child_process';

// This is a stripped down version of
// https://github.com/michaelvillar/dynamics.js/blob/master/src/dynamics.coffee#L1179,
//
const SpringBounceFactory = (options)=> {
  const frequency = Math.max(1, options.frequency / 20);
  const friction = Math.pow(20, options.friction / 100);
  return (t)=> {
    return 1 - (Math.pow(friction / 10, -t) * (1 - t) * Math.cos(frequency * t));
  };
};
const SpringBounceFunction = SpringBounceFactory({
  frequency: 360,
  friction: 440,
})

const Phase = {
  // No wheel events received yet, container is inactive.
  None: 'none',

  // Wheel events received
  GestureStarting: 'gesture-starting',

  // Wheel events received and we are stopping event propagation.
  GestureConfirmed: 'gesture-confirmed',

  // Fingers lifted, we are animating to a final state.
  Settling: 'settling',
}

let SwipeInverted = false;

if (process.platform === 'darwin') {
  exec("defaults read -g com.apple.swipescrolldirection", (err, stdout)=> {
    if (err !== null) {
      return;
    }
    SwipeInverted = (stdout.toString().trim() !== '0');
  });
} else if (process.platform === 'win32') {
  // Currently does not matter because we don't support trackpad gestures on Win.
  // It appears there's a config key called FlipFlopWheel which we might have to
  // check, but it also looks like disabling natural scroll on Win32 only changes
  // vertical, not horizontal, behavior.
}


export default class SwipeContainer extends Component {
  static displayName = 'SwipeContainer';

  static propTypes = {
    children: PropTypes.object.isRequired,
    onSwipeLeft: React.PropTypes.func,
    onSwipeLeftClass: React.PropTypes.string,
    onSwipeRight: React.PropTypes.func,
    onSwipeRightClass: React.PropTypes.string,
{'fraction_non_alphanumeric': 0.12396049896049896, 'fraction_numerical': 0.014033264033264034, 'mean_word_length': 3.7695167286245352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1061520', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1171, 'n_words': 364}