+window.wavesurfer = Object.create(WaveSurfer)
+
 randomColor = (alpha) ->
   'rgba(' + [
     ~ ~(Math.random() * 255)

    form.reset()
  return

setMarker = ->
  time = wavesurfer.getCurrentTime()
  wavesurfer.addRegion(start: round100(time), drag: true, resize: false, data: { type: 'segment_item' }, color: 'rgba(0,0,0,0.5)')
  saveRegions()

window.regionsArray = ->
  mapped = Object.keys(wavesurfer.regions.list).map((id) ->
    region = wavesurfer.regions.list[id]
    {

  deleteRegion()

window.GLOBAL_ACTIONS['split-region'] = ->
  wavesurfer.splitRegion()
  saveRegions()

window.GLOBAL_ACTIONS['mark-word'] = ->
  wavesurfer.setMarker()
  saveRegions()

window.GLOBAL_ACTIONS['export'] = ->
  window.open 'data:application/json;charset=utf-8,' + encodeURIComponent(localStorage.regions)
