<commit_before>class PlaygroundTeamwork extends TeamworkWorkspace

  constructor: (options = {}, data) ->

    options.cssClass = KD.utils.curry "playground", options.cssClass

    super options, data

    @on "PanelCreated", =>
      @getActivePanel().header.unsetClass "teamwork"

    @on "ContentIsReady", =>
      return unless @amIHost()
      manifest = @getOptions().playgroundManifest
      {prerequisite, initialState} = manifest
      if prerequisite
        if prerequisite.type is "sh"
          if initialState
          then @doPrerequisite prerequisite.command, => @setUpInitialState initialState
          else @doPrerequisite prerequisite.command
        else
          warn "Unhandled prerequisite type."
      else if initialState
        @setUpInitialState initialState

  handleRun: (panel) ->
    options      = @getOptions()
    {playground} = options
    runConfig    = options.playgroundManifest.run

    return warn "Missing run config for #{playground}."  unless runConfig

    {handler, command} = runConfig
    {paneLauncher}     = panel

    if not handler or not command
      return warn "Missing parameter for #{playground} run config. You must pass a handler and a command"
<commit_msg>Teamwork: Header styling for teamwork header.<commit_after>class PlaygroundTeamwork extends TeamworkWorkspace

  constructor: (options = {}, data) ->

    options.cssClass = KD.utils.curry "playground", options.cssClass

    super options, data

    @on "PanelCreated", @bound "applyHeaderStyling"

    @on "ContentIsReady", =>
      return unless @amIHost()
      manifest = @getOptions().playgroundManifest
      {prerequisite, initialState} = manifest
      if prerequisite
        if prerequisite.type is "sh"
          if initialState
          then @doPrerequisite prerequisite.command, => @setUpInitialState initialState
          else @doPrerequisite prerequisite.command
        else
          warn "Unhandled prerequisite type."
      else if initialState
        @setUpInitialState initialState

  applyHeaderStyling: ->
    {header} = @getActivePanel().getPaneByName "finder"
    options = @getOptions().headerStyling
    return unless  options

    header.updatePartial "" # header.destroySubViews didn't work
    header.addSubView icon = new KDCustomHTMLView
      tagName  : "span"
      cssClass : "icon tw-ply-icon"

    header.addSubView title = new KDCustomHTMLView
      tagName  : "span"
      partial  : "#{@getOptions().playgroundManifest.name} Teamwork"

    {bgColor, bgImage, textColor} = options

    header.setCss "background"        , "#{bgColor}"       if bgColor
    header.setCss "color"             , textColor          if textColor
    icon.setCss   "backgroundImage"   , "url(#{bgImage})"  if bgImage

  handleRun: (panel) ->
    options      = @getOptions()
    {playground} = options
    runConfig    = options.playgroundManifest.run

    return warn "Missing run config for #{playground}."  unless runConfig

    {handler, command} = runConfig
    {paneLauncher}     = panel

    if not handler or not command
      return warn "Missing parameter for #{playground} run config. You must pass a handler and a command"

{'fraction_non_alphanumeric': 0.08695652173913043, 'fraction_numerical': 0.0, 'mean_word_length': 2.9539227895392277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1077364', 'n_tokens_mistral': 906, 'n_tokens_neox': 847, 'n_words': 251}