<commit_before># Normalize requestAnimationFrame
if window.requestAnimationFrame == undefined
  window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame

# Normalize cancelAnimationFrame
if window.cancelAnimationFrame == undefined
  window.cancelAnimationFrame = window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame

# Normalize window.performance
if window.performance == undefined
  nowOffset = Date.now();
  window.performance =
    now: ->
      Date.now() - nowOffset;

Function::property = (prop, desc) ->
  Object.defineProperty @prototype, prop, desc

Arcadia =
  Game: require('./game.coffee')
  Button: require('./button.coffee')
  Emitter: require('./emitter.coffee')
  GameObject: require('./gameobject.coffee')
  Label: require('./label.coffee')
  Pool: require('./pool.coffee')
  Scene: require('./scene.coffee')
  Shape: require('./shape.coffee')
  Sprite: require('./sprite.coffee')

module.exports = Arcadia

# Static variables tracking performance
Arcadia.fps = 0
Arcadia.garbageCollected = false
Arcadia.lastUsedHeap = 0

###
@description Get information about the current environment
###
Arcadia.env = do ->
  agent = navigator.userAgent.toLowerCase()

  android = (agent.match(/android/i) && agent.match(/android/i).length > 0) || false
  ios = (agent.match(/ip(hone|od|ad)/i) && agent.match(/ip(hone|od|ad)/i).length) > 0 || false
  firefox = (agent.match(/firefox/i) && agent.match(/firefox/i).length > 0) || false

  # "mobile" here refers to a touchscreen - this is pretty janky
  mobile = ((agent.match(/mobile/i) && agent.match(/mobile/i).length > 0) || false) || android

  return {
    android: android
    ios: ios
    firefox: firefox
    mobile: mobile
    desktop: !mobile
    cordova: window.cordova != undefined
  }

###
@description Change the active scene being displayed
###
Arcadia.changeScene = (SceneClass) ->
  throw "Invalid scene!" if typeof SceneClass != "function"

  # Clean up previous scene
  Arcadia.instance.active.destroy()
  Arcadia.instance.active = new SceneClass()
  Arcadia.instance.active.transition()

###
@description Static method to translate mouse/touch input to coordinates the game will understand
             Takes the <canvas> offset and scale into account
###
Arcadia.getPoints = (event) ->
  if event.type.indexOf('mouse') != -1<commit_msg>Freeze Arcadeia.ENV<commit_after># Normalize requestAnimationFrame
if window.requestAnimationFrame == undefined
  window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame

# Normalize cancelAnimationFrame
if window.cancelAnimationFrame == undefined
  window.cancelAnimationFrame = window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame

# Normalize window.performance
if window.performance == undefined
  nowOffset = Date.now();
  window.performance =
    now: ->
      Date.now() - nowOffset;

Function::property = (prop, desc) ->
  Object.defineProperty @prototype, prop, desc

Arcadia =
  Game: require('./game.coffee')
  Button: require('./button.coffee')
  Emitter: require('./emitter.coffee')
  GameObject: require('./gameobject.coffee')
  Label: require('./label.coffee')
  Pool: require('./pool.coffee')
  Scene: require('./scene.coffee')
  Shape: require('./shape.coffee')
  Sprite: require('./sprite.coffee')

module.exports = Arcadia

# Static variables tracking performance
Arcadia.fps = 0
Arcadia.garbageCollected = false
Arcadia.lastUsedHeap = 0

###
@description Get information about the current environment
###
Arcadia.ENV = do ->
  agent = navigator.userAgent.toLowerCase()

  android = !!(agent.match(/android/i) && agent.match(/android/i).length > 0)
  ios = !!(agent.match(/ip(hone|od|ad)/i) && agent.match(/ip(hone|od|ad)/i).length > 0)
  firefox = !!(agent.match(/firefox/i) && agent.match(/firefox/i).length > 0)

  # "mobile" here refers to a touchscreen - this is pretty janky
  mobile = !!(agent.match(/mobile/i) && agent.match(/mobile/i).length > 0) || android

  return Object.freeze
    android: android
    ios: ios
    firefox: firefox
    mobile: mobile
    desktop: !mobile
    cordova: window.cordova != undefined

###
@description Change the active scene being displayed
###
Arcadia.changeScene = (SceneClass) ->
  throw "Invalid scene!" if typeof SceneClass != "function"

  # Clean up previous scene
  Arcadia.instance.active.destroy()
  Arcadia.instance.active = new SceneClass()
  Arcadia.instance.active.transition()

###
@description Static method to translate mouse/touch input to coordinates the game will understand
             Takes the <canvas> offset and scale into account
###
Arcadia.getPoints = (event) ->
  if event.type.indexOf('mouse') != -1
{'fraction_non_alphanumeric': 0.1330313014827018, 'fraction_numerical': 0.002883031301482702, 'mean_word_length': 4.414715719063545, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3348928', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1409, 'n_words': 347}