<commit_before>_ = require 'underscore'
React = require 'react'
memoize = require 'memoizee'
parser = require './parser'
MarkatoApp = require './MarkatoApp'
MarkatoSplash = require './MarkatoSplash'
MarkatoNav = require './MarkatoNav'
MarkatoFooter = require './MarkatoFooter'
example = require './example'

parse = memoize parser.parseString, primitive: true

formatUserBucket = (userBucket) ->
  songs: userBucket.songs ? []
  currentSongIndex: userBucket.currentSongIndex

module.exports = React.createClass
  getInitialState: ->
    if @props.userBucket?
      formatUserBucket @props.userBucket
    else
      songs: [
        name: "I Wanna Hold Your Hand [Example]"
        content: example
      ]
      currentSongIndex: 0

  componentWillReceiveProps: (nextProps) -><commit_msg>Example now saves to account upon creation<commit_after>_ = require 'underscore'
React = require 'react'
memoize = require 'memoizee'
parser = require './parser'
MarkatoApp = require './MarkatoApp'
MarkatoSplash = require './MarkatoSplash'
MarkatoNav = require './MarkatoNav'
MarkatoFooter = require './MarkatoFooter'
example = require './example'

parse = memoize parser.parseString, primitive: true

formatUserBucket = (userBucket) ->
  songs: userBucket.songs ? []
  currentSongIndex: userBucket.currentSongIndex

module.exports = React.createClass
  getInitialState: ->
    if @props.userBucket?
      formatUserBucket @props.userBucket
    else
      songs: [
        name: "I Wanna Hold Your Hand"
        content: example
      ]
      currentSongIndex: 0

  componentDidMount: ->
    # If we have a new account, save the default song that gets loaded
    unless @props.userBucket?
      @saveCurrentSong()

  componentWillReceiveProps: (nextProps) ->
{'fraction_non_alphanumeric': 0.1013745704467354, 'fraction_numerical': 0.001145475372279496, 'mean_word_length': 3.7994505494505493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, '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': '7534492', 'n_tokens_mistral': 524, 'n_tokens_neox': 508, 'n_words': 144}