<commit_before>### define
underscore : _
coffee-script : CoffeeScript
routes : Routes
libs/event_mixin : EventMixin
libs/key_value_store : KeyValueStore
./plugins : Plugins
./buffer_utils : BufferUtils
###

class PluginRenderer

  plugins : null


  constructor : (@dimensions, @slidesBeforeProblem, @slidesAfterProblem, @assetHandler, @dataHandler) ->

    [ @width, @height, @depth ] = dimensions

    @state = new KeyValueStore()

    @plugins = new Plugins(@assetHandler)
    @createSidebar()


  setCode : (code) ->

    @code = code


  testCompile : ->

    _.isFunction(@compile())


  compile : (code) ->

    functionBody = CoffeeScript.compile(@code, bare : true)
    func = new Function(
      "plugins"
      "with(plugins) { #{functionBody} }"
    )


  getRange : ->

    func = @compile()

    range = { start: Infinity, end: 0 }

    _plugins =

      time : (options) ->
        start = Math.min(options.start, range.start)
        end = start + Math.max(options.end, range.end)
        range = { start, end }

        (cb) -> cb()

      importSlides : ->

      unsafe : ->

      exit : ->
        _plugins.time = -> (->)
        range = { start: 0, end: 0 }
        return
<commit_msg>LEV-88 undefined missionData on start fixed<commit_after>### define
underscore : _
coffee-script : CoffeeScript
routes : Routes
libs/event_mixin : EventMixin
libs/key_value_store : KeyValueStore
./plugins : Plugins
./buffer_utils : BufferUtils
###

class PluginRenderer

  plugins : null


  constructor : (@dimensions, @slidesBeforeProblem, @slidesAfterProblem, @assetHandler, @dataHandler) ->

    [ @width, @height, @depth ] = dimensions

    @state = new KeyValueStore()

    @plugins = new Plugins(@assetHandler)
    @createSidebar()


  setCode : (code) ->

    @code = code


  testCompile : ->

    _.isFunction(@compile())


  compile : (code) ->

    functionBody = CoffeeScript.compile(@code, bare : true)
    func = new Function(
      "plugins"
      "with(plugins) { #{functionBody} }"
    )


  getRange : ->

    return { start: 0, end: 0 } unless @dataHandler.deferred("initialized").state() == "resolved"

    func = @compile()

    range = { start: Infinity, end: 0 }

    _plugins =

      time : (options) ->
        start = Math.min(options.start, range.start)
        end = start + Math.max(options.end, range.end)
        range = { start, end }

        (cb) -> cb()

      importSlides : ->

      unsafe : ->

      exit : ->
        _plugins.time = -> (->)
        range = { start: 0, end: 0 }
        return

{'fraction_non_alphanumeric': 0.13881242626818718, 'fraction_numerical': 0.003932363350373574, 'mean_word_length': 2.499312242090784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '379348', 'n_tokens_mistral': 848, 'n_tokens_neox': 773, 'n_words': 187}