<commit_before>{$} = require 'atom'

class StatusBarView extends HTMLElement
  serialize: ->
    attached: @hasParent()

  initialize: (state) ->
    @classList.add('status-bar', 'tool-panel', 'panel-bottom')

    flexboxHackElement = document.createElement('div')
    flexboxHackElement.classList.add('flexbox-repaint-hack')
    @appendChild(flexboxHackElement)

    @rightPanel = document.createElement('div')
    @rightPanel.classList.add('status-bar-right', 'pull-right')
    flexboxHackElement.appendChild(@rightPanel)

    @leftPanel = document.createElement('div')
    @leftPanel.classList.add('status-bar-left')
    flexboxHackElement.appendChild(@leftPanel)

    @bufferSubscriptions = []

    @activeItemSubscription = atom.workspace.onDidChangeActivePaneItem =>
      @unsubscribeAllFromBuffer()
      @storeActiveBuffer()
      @subscribeAllToBuffer()

      @dispatchEvent(new CustomEvent('active-buffer-changed', bubbles: true))

    @storeActiveBuffer()

    @attach() if state.attached

  attach: ->
    atom.workspaceView.appendToBottom(this) unless @parentElement?

  destroy: ->
    @activeItemSubscription.dispose()
    @unsubscribeAllFromBuffer()
    @remove()

  toggle: ->
    if @parentElement
      @remove()
    else
      @attach()

  # Public: Append the view to the left side of the status bar.
  appendLeft: (view) ->
    $(@leftPanel).append(view)

  # Public: Prepend the view to the left side of the status bar.
  prependLeft: (view) ->
    $(@leftPanel).prepend(view)

  # Public: Append the view to the right side of the status bar.
  appendRight: (view) ->
    $(@rightPanel).append(view)

  # Public: Prepend the view to the right side of the status bar.
  prependRight: (view) ->
    $(@rightPanel).prepend(view)<commit_msg>:lipstick: Move serialize below initialize<commit_after>{$} = require 'atom'

class StatusBarView extends HTMLElement
  initialize: (state) ->
    @classList.add('status-bar', 'tool-panel', 'panel-bottom')

    flexboxHackElement = document.createElement('div')
    flexboxHackElement.classList.add('flexbox-repaint-hack')
    @appendChild(flexboxHackElement)

    @rightPanel = document.createElement('div')
    @rightPanel.classList.add('status-bar-right', 'pull-right')
    flexboxHackElement.appendChild(@rightPanel)

    @leftPanel = document.createElement('div')
    @leftPanel.classList.add('status-bar-left')
    flexboxHackElement.appendChild(@leftPanel)

    @bufferSubscriptions = []

    @activeItemSubscription = atom.workspace.onDidChangeActivePaneItem =>
      @unsubscribeAllFromBuffer()
      @storeActiveBuffer()
      @subscribeAllToBuffer()

      @dispatchEvent(new CustomEvent('active-buffer-changed', bubbles: true))

    @storeActiveBuffer()

    @attach() if state.attached

  serialize: ->
    attached: @hasParent()

  attach: ->
    atom.workspaceView.appendToBottom(this) unless @parentElement?

  destroy: ->
    @activeItemSubscription.dispose()
    @unsubscribeAllFromBuffer()
    @remove()

  toggle: ->
    if @parentElement
      @remove()
    else
      @attach()

  # Public: Append the view to the left side of the status bar.
  appendLeft: (view) ->
    $(@leftPanel).append(view)

  # Public: Prepend the view to the left side of the status bar.
  prependLeft: (view) ->
    $(@leftPanel).prepend(view)

  # Public: Append the view to the right side of the status bar.
  appendRight: (view) ->
    $(@rightPanel).append(view)

  # Public: Prepend the view to the right side of the status bar.
  prependRight: (view) ->
    $(@rightPanel).prepend(view)
{'fraction_non_alphanumeric': 0.1277793414016324, 'fraction_numerical': 0.0, 'mean_word_length': 3.8751714677640603, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6313711', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1064, 'n_words': 235}