text: (function () {
  'use strict';
  
  function __$styleInject(css, returnValue) {
    if (typeof document === 'undefined') {
      return returnValue;
    }
    css = css || '';
    var head = document.head || document.getElementsByTagName('head')[0];
    var style = document.createElement('style');
    style.type = 'text/css';
    if (style.styleSheet){
      style.styleSheet.cssText = css;
    } else {
      style.appendChild(document.createTextNode(css));
    }
    head.appendChild(style);
    return returnValue;
  }
  var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  
  
  
  function unwrapExports (x) {
  	return x && x.__esModule ? x['default'] : x;
  }
  
  function createCommonjsModule(fn, module) {
  	return module = { exports: {} }, fn(module, module.exports), module.exports;
  }
  
  // 7.1.4 ToInteger
  var ceil  = Math.ceil;
  var floor = Math.floor;
  var _toInteger = function(it){
    return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  };
  
  // 7.2.1 RequireObjectCoercible(argument)
  var _defined = function(it){
    if(it == undefined)throw TypeError("Can't call method on  " + it);
    return it;
  };
  
  var toInteger = _toInteger;
  var defined   = _defined;
  // true  -> String#at
  // false -> String#codePointAt
  var _stringAt = function(TO_STRING){
    return function(that, pos){
      var s = String(defined(that))
        , i = toInteger(pos)
        , l = s.length
        , a, b;
      if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
      a = s.charCodeAt(i);
      return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
        ? TO_STRING ? s.charAt(i) : a
        : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
    };
  };
  
  var _library = true;
  
  var _global = createCommonjsModule(function (module) {
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  var global = module.exports = typeof window != 'undefined' && window.Math == Math
    ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  });
  
  var _core = createCommonjsModule(function (module) {
  var core = module.exports = {version: '2.4.0'};
  if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  });
  
  var _aFunction = function(it){
    if(typeof it != 'function')throw TypeError(it + ' is not a function!');
    return it;
  };
  
  // optional / simple context binding
  var aFunction = _aFunction;
  var _ctx$1 = function(fn, that, length){
    aFunction(fn);
    if(that === undefined)return fn;
    switch(length){
      case 1: return function(a){
        return fn.call(that, a);
      };
      case 2: return function(a, b){
        return fn.call(that, a, b);
      };
      case 3: return function(a, b, c){
        return fn.call(that, a, b, c);
      };
    }
    return function(/* ...args */){
      return fn.apply(that, arguments);
    };
  };
  
  var _isObject = function(it){
    return typeof it === 'object' ? it !== null : typeof it === 'function';
  };
  
  var isObject = _isObject;
  var _anObject = function(it){
    if(!isObject(it))throw TypeError(it + ' is not an object!');
    return it;
  };
  
  var _fails = function(exec){
    try {
      return !!exec();
    } catch(e){
      return true;
    }
  };
  
  // Thank's IE8 for his funny defineProperty
  var _descriptors = !_fails(function(){
    return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  });
  
  var isObject$1 = _isObject;
  var document$1 = _global.document;
  var is = isObject$1(document$1) && isObject$1(document$1.createElement);
  var _domCreate = function(it){
    return is ? document$1.createElement(it) : {};
  };
  
  var _ie8DomDefine = !_descriptors && !_fails(function(){
    return Object.defineProperty(_domCreate('div'), 'a', {get: function(){ return 7; }}).a != 7;
  });
  
  // 7.1.1 ToPrimitive(input [, PreferredType])
  var isObject$2 = _isObject;
  // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  // and the second argument - flag - preferred type is a string
  var _toPrimitive = function(it, S){
    if(!isObject$2(it))return it;
    var fn, val;
    if(S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it)))return val;
    if(typeof (fn = it.valueOf) == 'function' && !isObject$2(val = fn.call(it)))return val;
    if(!S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it)))return val;
    throw TypeError("Can't convert object to primitive value");
  };
  
  var anObject       = _anObject;
  var IE8_DOM_DEFINE = _ie8DomDefine;
  var toPrimitive    = _toPrimitive;
  var dP$1             = Object.defineProperty;
  
  var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes){
    anObject(O);
    P = toPrimitive(P, true);
    anObject(Attributes);
    if(IE8_DOM_DEFINE)try {
      return dP$1(O, P, Attributes);
    } catch(e){ /* empty */ }
    if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
    if('value' in Attributes)O[P] = Attributes.value;
    return O;
  };
  
  var _objectDp = {
  	f: f
  };
  
  var _propertyDesc = function(bitmap, value){
    return {
      enumerable  : !(bitmap & 1),
      configurable: !(bitmap & 2),
      writable    : !(bitmap & 4),
      value       : value
    };
  };
  
  var dP         = _objectDp;
  var createDesc = _propertyDesc;
  var _hide = _descriptors ? function(object, key, value){
    return dP.f(object, key, createDesc(1, value));
  } : function(object, key, value){
    object[key] = value;
    return object;
  };
  
  var global$1    = _global;
  var core      = _core;
  var ctx$1       = _ctx$1;
  var hide$1      = _hide;
  var PROTOTYPE = 'prototype';
  
  var $export$1 = function(type, name, source){
    var IS_FORCED = type & $export$1.F
      , IS_GLOBAL = type & $export$1.G
      , IS_STATIC = type & $export$1.S
      , IS_PROTO  = type & $export$1.P
      , IS_BIND   = type & $export$1.B
      , IS_WRAP   = type & $export$1.W
      , exports   = IS_GLOBAL ? core : core[name] || (core[name] = {})
      , expProto  = exports[PROTOTYPE]
      , target    = IS_GLOBAL ? global$1 : IS_STATIC ? global$1[name] : (global$1[name] || {})[PROTOTYPE]
      , key, own, out;
    if(IS_GLOBAL)source = name;
    for(key in source){
      // contains in native
      own = !IS_FORCED && target && target[key] !== undefined;
      if(own && key in exports)continue;
      // export native or passed
      out = own ? target[key] : source[key];
      // prevent global pollution for namespaces
      exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
      // bind timers to global for call from export context
      : IS_BIND && own ? ctx$1(out, global$1)
      // wrap global constructors for prevent change them in library
      : IS_WRAP && target[key] == out ? (function(C){
        var F = function(a, b, c){
          if(this instanceof C){
            switch(arguments.length){
              case 0: return new C;
              case 1: return new C(a);
              case 2: return new C(a, b);
            } return new C(a, b, c);
          } return C.apply(this, arguments);
        };
        F[PROTOTYPE] = C[PROTOTYPE];
        return F;
      // make static versions for prototype methods
      })(out) : IS_PROTO && typeof out == 'function' ? ctx$1(Function.call, out) : out;
      // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
      if(IS_PROTO){
        (exports.virtual || (exports.virtual = {}))[key] = out;
        // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
        if(type & $export$1.R && expProto && !expProto[key])hide$1(expProto, key, out);
      }
    }
  };
  // type bitmap
  $export$1.F = 1;   // forced
  $export$1.G = 2;   // global
  $export$1.S = 4;   // static
  $export$1.P = 8;   // proto
  $export$1.B = 16;  // bind
  $export$1.W = 32;  // wrap
  $export$1.U = 64;  // safe
  $export$1.R = 128; // real proto method for `library` 
  var _export = $export$1;
  
  var _redefine = _hide;
  
  var hasOwnProperty = {}.hasOwnProperty;
  var _has = function(it, key){
    return hasOwnProperty.call(it, key);
  };
  
  var _iterators = {};
  
  var toString = {}.toString;
  
  var _cof = function(it){
    return toString.call(it).slice(8, -1);
  };
  
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
  var cof = _cof;
  var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function(it){
    return cof(it) == 'String' ? it.split('') : Object(it);
  };
  
  // to indexed object, toObject with fallback for non-array-like ES3 strings
  var IObject = _iobject;
  var defined$1 = _defined;
  var _toIobject = function(it){
    return IObject(defined$1(it));
  };
  
  // 7.1.15 ToLength
  var toInteger$1 = _toInteger;
  var min       = Math.min;
  var _toLength = function(it){
    return it > 0 ? min(toInteger$1(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  };
  
  var toInteger$2 = _toInteger;
  var max       = Math.max;
  var min$1       = Math.min;
  var _toIndex = function(index, length){
    index = toInteger$2(index);
    return index < 0 ? max(index + length, 0) : min$1(index, length);
  };
  
  // false -> Array#indexOf
  // true  -> Array#includes
  var toIObject$1 = _toIobject;
  var toLength  = _toLength;
  var toIndex   = _toIndex;
  var _arrayIncludes = function(IS_INCLUDES){
    return function($this, el, fromIndex){
      var O      = toIObject$1($this)
        , length = toLength(O.length)
        , index  = toIndex(fromIndex, length)
        , value;
      // Array#includes uses SameValueZero equality algorithm
      if(IS_INCLUDES && el != el)while(length > index){
        value = O[index++];
        if(value != value)return true;
      // Array#toIndex ignores holes, Array#includes - not
      } else for(;length > index; index++)if(IS_INCLUDES || index in O){
        if(O[index] === el)return IS_INCLUDES || index || 0;
      } return !IS_INCLUDES && -1;
    };
  };
  
  var global$2 = _global;
  var SHARED = '__core-js_shared__';
  var store  = global$2[SHARED] || (global$2[SHARED] = {});
  var _shared = function(key){
    return store[key] || (store[key] = {});
  };
  
  var id = 0;
  var px = Math.random();
  var _uid = function(key){
    return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  };
  
  var shared = _shared('keys');
  var uid    = _uid;
  var _sharedKey = function(key){
    return shared[key] || (shared[key] = uid(key));
  };
  
  var has$1          = _has;
  var toIObject    = _toIobject;
  var arrayIndexOf = _arrayIncludes(false);
  var IE_PROTO$1     = _sharedKey('IE_PROTO');
  
  var _objectKeysInternal = function(object, names){
    var O      = toIObject(object)
      , i      = 0
      , result = []
      , key;
    for(key in O)if(key != IE_PROTO$1)has$1(O, key) && result.push(key);
    // Don't enum bug & hidden keys
    while(names.length > i)if(has$1(O, key = names[i++])){
      ~arrayIndexOf(result, key) || result.push(key);
    }
    return result;
  };
  
  // IE 8- don't enum bug keys
  var _enumBugKeys = (
    'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  ).split(',');
  
  // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  var $keys       = _objectKeysInternal;
  var enumBugKeys$1 = _enumBugKeys;
  
  var _objectKeys = Object.keys || function keys(O){
    return $keys(O, enumBugKeys$1);
  };
  
  var dP$2       = _objectDp;
  var anObject$2 = _anObject;
  var getKeys  = _objectKeys;
  
  var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties){
    anObject$2(O);
    var keys   = getKeys(Properties)
      , length = keys.length
      , i = 0
      , P;
    while(length > i)dP$2.f(O, P = keys[i++], Properties[P]);
    return O;
  };
  
  var _html = _global.document && document.documentElement;
  
  // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  var anObject$1    = _anObject;
  var dPs         = _objectDps;
  var enumBugKeys = _enumBugKeys;
  var IE_PROTO    = _sharedKey('IE_PROTO');
  var Empty       = function(){ /* empty */ };
  var PROTOTYPE$1   = 'prototype';
  
  // Create object with fake `null` prototype: use iframe Object with cleared prototype
  var createDict = function(){
    // Thrash, waste and sodomy: IE GC bug
    var iframe = _domCreate('iframe')
      , i      = enumBugKeys.length
      , lt     = '<'
      , gt     = '>'
      , iframeDocument;
    iframe.style.display = 'none';
    _html.appendChild(iframe);
    iframe.src = 'javascript:'; // eslint-disable-line no-script-url
    // createDict = iframe.contentWindow.Object;
    // html.removeChild(iframe);
    iframeDocument = iframe.contentWindow.document;
    iframeDocument.open();
    iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
    iframeDocument.close();
    createDict = iframeDocument.F;
    while(i--)delete createDict[PROTOTYPE$1][enumBugKeys[i]];
    return createDict();
  };
  
  var _objectCreate = Object.create || function create(O, Properties){
    var result;
    if(O !== null){
      Empty[PROTOTYPE$1] = anObject$1(O);
      result = new Empty;
      Empty[PROTOTYPE$1] = null;
      // add "__proto__" for Object.getPrototypeOf polyfill
      result[IE_PROTO] = O;
    } else result = createDict();
    return Properties === undefined ? result : dPs(result, Properties);
  };
  
  var _wks = createCommonjsModule(function (module) {
  var store      = _shared('wks')
    , uid        = _uid
    , Symbol     = _global.Symbol
    , USE_SYMBOL = typeof Symbol == 'function';
  
  var $exports = module.exports = function(name){
    return store[name] || (store[name] =
      USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  };
  
  $exports.store = store;
  });
  
  var def = _objectDp.f;
  var has$2 = _has;
  var TAG = _wks('toStringTag');
  
  var _setToStringTag = function(it, tag, stat){
    if(it && !has$2(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
  };
  
  var create$1         = _objectCreate;
  var descriptor     = _propertyDesc;
  var setToStringTag$1 = _setToStringTag;
  var IteratorPrototype = {};
  
  // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  _hide(IteratorPrototype, _wks('iterator'), function(){ return this; });
  
  var _iterCreate = function(Constructor, NAME, next){
    Constructor.prototype = create$1(IteratorPrototype, {next: descriptor(1, next)});
    setToStringTag$1(Constructor, NAME + ' Iterator');
  };
  
  // 7.1.13 ToObject(argument)
  var defined$2 = _defined;
  var _toObject = function(it){
    return Object(defined$2(it));
  };
  
  // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  var has$3         = _has;
  var toObject    = _toObject;
  var IE_PROTO$2    = _sharedKey('IE_PROTO');
  var ObjectProto = Object.prototype;
  
  var _objectGpo = Object.getPrototypeOf || function(O){
    O = toObject(O);
    if(has$3(O, IE_PROTO$2))return O[IE_PROTO$2];
    if(typeof O.constructor == 'function' && O instanceof O.constructor){
      return O.constructor.prototype;
    } return O instanceof Object ? ObjectProto : null;
  };
  
  var LIBRARY        = _library;
  var $export        = _export;
  var redefine       = _redefine;
  var hide           = _hide;
  var has            = _has;
  var Iterators      = _iterators;
  var $iterCreate    = _iterCreate;
  var setToStringTag = _setToStringTag;
  var getPrototypeOf = _objectGpo;
  var ITERATOR       = _wks('iterator');
  var BUGGY          = !([].keys && 'next' in [].keys());
  var FF_ITERATOR    = '@@iterator';
  var KEYS           = 'keys';
  var VALUES         = 'values';
  
  var returnThis = function(){ return this; };
  
  var _iterDefine = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
    $iterCreate(Constructor, NAME, next);
    var getMethod = function(kind){
      if(!BUGGY && kind in proto)return proto[kind];
      switch(kind){
        case KEYS: return function keys(){ return new Constructor(this, kind); };
        case VALUES: return function values(){ return new Constructor(this, kind); };
      } return function entries(){ return new Constructor(this, kind); };
    };
    var TAG        = NAME + ' Iterator'
      , DEF_VALUES = DEFAULT == VALUES
      , VALUES_BUG = false
      , proto      = Base.prototype
      , $native    = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
      , $default   = $native || getMethod(DEFAULT)
      , $entries   = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
      , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
      , methods, key, IteratorPrototype;
    // Fix native
    if($anyNative){
      IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
      if(IteratorPrototype !== Object.prototype){
        // Set @@toStringTag to native iterators
        setToStringTag(IteratorPrototype, TAG, true);
        // fix for some old engines
        if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
      }
    }
    // fix Array#{values, @@iterator}.name in V8 / FF
    if(DEF_VALUES && $native && $native.name !== VALUES){
      VALUES_BUG = true;
      $default = function values(){ return $native.call(this); };
    }
    // Define iterator
    if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
      hide(proto, ITERATOR, $default);
    }
    // Plug for library
    Iterators[NAME] = $default;
    Iterators[TAG]  = returnThis;
    if(DEFAULT){
      methods = {
        values:  DEF_VALUES ? $default : getMethod(VALUES),
        keys:    IS_SET     ? $default : getMethod(KEYS),
        entries: $entries
      };
      if(FORCED)for(key in methods){
        if(!(key in proto))redefine(proto, key, methods[key]);
      } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
    }
    return methods;
  };
  
  var $at  = _stringAt(true);
  
  // 21.1.3.27 String.prototype[@@iterator]()
  _iterDefine(String, 'String', function(iterated){
    this._t = String(iterated); // target
    this._i = 0;                // next index
  // 21.1.5.2.1 %StringIteratorPrototype%.next()
  }, function(){
    var O     = this._t
      , index = this._i
      , point;
    if(index >= O.length)return {value: undefined, done: true};
    point = $at(O, index);
    this._i += point.length;
    return {value: point, done: false};
  });
  
  // call something on iterator step with safe closing on error
  var anObject$3 = _anObject;
  var _iterCall = function(iterator, fn, value, entries){
    try {
      return entries ? fn(anObject$3(value)[0], value[1]) : fn(value);
    // 7.4.6 IteratorClose(iterator, completion)
    } catch(e){
      var ret = iterator['return'];
      if(ret !== undefined)anObject$3(ret.call(iterator));
      throw e;
    }
  };
  
  // check on default Array iterator
  var Iterators$1  = _iterators;
  var ITERATOR$1   = _wks('iterator');
  var ArrayProto = Array.prototype;
  
  var _isArrayIter = function(it){
    return it !== undefined && (Iterators$1.Array === it || ArrayProto[ITERATOR$1] === it);
  };
  
  var $defineProperty = _objectDp;
  var createDesc$1      = _propertyDesc;
  
  var _createProperty = function(object, index, value){
    if(index in object)$defineProperty.f(object, index, createDesc$1(0, value));
    else object[index] = value;
  };
  
  // getting tag from 19.1.3.6 Object.prototype.toString()
  var cof$1 = _cof;
  var TAG$1 = _wks('toStringTag');
  var ARG = cof$1(function(){ return arguments; }()) == 'Arguments';
  
  // fallback for IE11 Script Access Denied error
  var tryGet = function(it, key){
    try {
      return it[key];
    } catch(e){ /* empty */ }
  };
  
  var _classof = function(it){
    var O, T, B;
    return it === undefined ? 'Undefined' : it === null ? 'Null'
      // @@toStringTag case
      : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
      // builtinTag case
      : ARG ? cof$1(O)
      // ES3 arguments fallback
      : (B = cof$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  };
  
  var classof   = _classof;
  var ITERATOR$2  = _wks('iterator');
  var Iterators$2 = _iterators;
  var core_getIteratorMethod = _core.getIteratorMethod = function(it){
    if(it != undefined)return it[ITERATOR$2]
      || it['@@iterator']
      || Iterators$2[classof(it)];
  };
  
  var ITERATOR$3     = _wks('iterator');
  var SAFE_CLOSING = false;
  
  try {
    var riter = [7][ITERATOR$3]();
    riter['return'] = function(){ SAFE_CLOSING = true; };
    Array.from(riter, function(){ throw 2; });
  } catch(e){ /* empty */ }
  
  var _iterDetect = function(exec, skipClosing){
    if(!skipClosing && !SAFE_CLOSING)return false;
    var safe = false;
    try {
      var arr  = [7]
        , iter = arr[ITERATOR$3]();
      iter.next = function(){ return {done: safe = true}; };
      arr[ITERATOR$3] = function(){ return iter; };
      exec(arr);
    } catch(e){ /* empty */ }
    return safe;
  };
  
  var ctx$2            = _ctx$1;
  var $export$2        = _export;
  var toObject$1       = _toObject;
  var call           = _iterCall;
  var isArrayIter    = _isArrayIter;
  var toLength$1       = _toLength;
  var createProperty = _createProperty;
  var getIterFn      = core_getIteratorMethod;
  
  $export$2($export$2.S + $export$2.F * !_iterDetect(function(iter){ Array.from(iter); }), 'Array', {
    // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
    from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
      var O       = toObject$1(arrayLike)
        , C       = typeof this == 'function' ? this : Array
        , aLen    = arguments.length
        , mapfn   = aLen > 1 ? arguments[1] : undefined
        , mapping = mapfn !== undefined
        , index   = 0
        , iterFn  = getIterFn(O)
        , length, result, step, iterator;
      if(mapping)mapfn = ctx$2(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
      // if object isn't iterable or it's array with default iterator - use simple case
      if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
        for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
          createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
        }
      } else {
        length = toLength$1(O.length);
        for(result = new C(length); length > index; index++){
          createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
        }
      }
      result.length = index;
      return result;
    }
  });
  
  var from$2 = _core.Array.from;
  
  var from$1 = createCommonjsModule(function (module) {
  module.exports = { "default": from$2, __esModule: true };
  });
  
  var _Array$from = unwrapExports(from$1);
  
  var loglevel = createCommonjsModule(function (module) {
  /*
  * loglevel - https://github.com/pimterry/loglevel
  *
  * Copyright (c) 2013 Tim Perry
  * Licensed under the MIT license.
  */
  (function (root, definition) {
      "use strict";
      if (typeof define === 'function' && define.amd) {
          define(definition);
      } else if (typeof module === 'object' && module.exports) {
          module.exports = definition();
      } else {
          root.log = definition();
      }
  }(commonjsGlobal, function () {
      "use strict";
      var noop = function() {};
      var undefinedType = "undefined";
  
      function realMethod(methodName) {
          if (typeof console === undefinedType) {
              return false; // We can't build a real method without a console to log to
          } else if (console[methodName] !== undefined) {
              return bindMethod(console, methodName);
          } else if (console.log !== undefined) {
              return bindMethod(console, 'log');
          } else {
              return noop;
          }
      }
  
      function bindMethod(obj, methodName) {
          var method = obj[methodName];
          if (typeof method.bind === 'function') {
              return method.bind(obj);
          } else {
              try {
                  return Function.prototype.bind.call(method, obj);
              } catch (e) {
                  // Missing bind shim or IE8 + Modernizr, fallback to wrapping
                  return function() {
                      return Function.prototype.apply.apply(method, [obj, arguments]);
                  };
              }
          }
      }
  
      // these private functions always need `this` to be set properly
  
      function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
          return function () {
              if (typeof console !== undefinedType) {
                  replaceLoggingMethods.call(this, level, loggerName);
                  this[methodName].apply(this, arguments);
              }
          };
      }
  
      function replaceLoggingMethods(level, loggerName) {
          /*jshint validthis:true */
          for (var i = 0; i < logMethods.length; i++) {
              var methodName = logMethods[i];
              this[methodName] = (i < level) ?
                  noop :
                  this.methodFactory(methodName, level, loggerName);
          }
      }
  
      function defaultMethodFactory(methodName, level, loggerName) {
          /*jshint validthis:true */
          return realMethod(methodName) ||
                 enableLoggingWhenConsoleArrives.apply(this, arguments);
      }
  
      var logMethods = [
          "trace",
          "debug",
          "info",
          "warn",
          "error"
      ];
  
      function Logger(name, defaultLevel, factory) {
        var self = this;
        var currentLevel;
        var storageKey = "loglevel";
        if (name) {
          storageKey += ":" + name;
        }
  
        function persistLevelIfPossible(levelNum) {
            var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
  
            // Use localStorage if available
            try {
                window.localStorage[storageKey] = levelName;
                return;
            } catch (ignore) {}
  
            // Use session cookie as fallback
            try {
                window.document.cookie =
                  encodeURIComponent(storageKey) + "=" + levelName + ";";
            } catch (ignore) {}
        }
  
        function getPersistedLevel() {
            var storedLevel;
  
            try {
                storedLevel = window.localStorage[storageKey];
            } catch (ignore) {}
  
            if (typeof storedLevel === undefinedType) {
                try {
                    var cookie = window.document.cookie;
                    var location = cookie.indexOf(
                        encodeURIComponent(storageKey) + "=");
                    if (location) {
                        storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
                    }
                } catch (ignore) {}
            }
  
            // If the stored level is not valid, treat it as if nothing was stored.
            if (self.levels[storedLevel] === undefined) {
                storedLevel = undefined;
            }
  
            return storedLevel;
        }
  
        /*
         *
         * Public API
         *
         */
  
        self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
            "ERROR": 4, "SILENT": 5};
  
        self.methodFactory = factory || defaultMethodFactory;
  
        self.getLevel = function () {
            return currentLevel;
        };
  
        self.setLevel = function (level, persist) {
            if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
                level = self.levels[level.toUpperCase()];
            }
            if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
                currentLevel = level;
                if (persist !== false) {  // defaults to true
                    persistLevelIfPossible(level);
                }
                replaceLoggingMethods.call(self, level, name);
                if (typeof console === undefinedType && level < self.levels.SILENT) {
                    return "No console available for logging";
                }
            } else {
                throw "log.setLevel() called with invalid level: " + level;
            }
        };
  
        self.setDefaultLevel = function (level) {
            if (!getPersistedLevel()) {
                self.setLevel(level, false);
            }
        };
  
        self.enableAll = function(persist) {
            self.setLevel(self.levels.TRACE, persist);
        };
  
        self.disableAll = function(persist) {
            self.setLevel(self.levels.SILENT, persist);
        };
  
        // Initialize with the right level
        var initialLevel = getPersistedLevel();
        if (initialLevel == null) {
            initialLevel = defaultLevel == null ? "WARN" : defaultLevel;
        }
        self.setLevel(initialLevel, false);
      }
  
      /*
       *
       * Package-level API
       *
       */
  
      var defaultLogger = new Logger();
  
      var _loggersByName = {};
      defaultLogger.getLogger = function getLogger(name) {
          if (typeof name !== "string" || name === "") {
            throw new TypeError("You must supply a name when creating a logger.");
          }
  
          var logger = _loggersByName[name];
          if (!logger) {
            logger = _loggersByName[name] = new Logger(
              name, defaultLogger.getLevel(), defaultLogger.methodFactory);
          }
          return logger;
      };
  
      // Grab the current global log variable in case of overwrite
      var _log = (typeof window !== undefinedType) ? window.log : undefined;
      defaultLogger.noConflict = function() {
          if (typeof window !== undefinedType &&
                 window.log === defaultLogger) {
              window.log = _log;
          }
  
          return defaultLogger;
      };
  
      return defaultLogger;
  }));
  });
  
  var appName = '[WPESMU]';
  var log = console.log.bind(null, appName);
  var trace = loglevel.trace.bind(null, appName);
  var debug = loglevel.debug.bind(null, appName);
  var info = loglevel.info.bind(null, appName);
  var warn = loglevel.warn.bind(null, appName);
  var error = loglevel.error.bind(null, appName);
  
  loglevel.setLevel('trace');
  
  info('Debug logging enabled!');
  
  var content = "<div class=\"wsmu box left top\">\n\t<input class=\"wsmu input\" type=\"file\" accept=\"audio/*\">\n\t<button class=\"wsmu btn play\">Play</button>\n\t<button class=\"wsmu btn pause\">Pause</button>\n\t<button class=\"wsmu btn stop\">Stop</button>\n\t<canvas class=\"wsmu canvas\" height=\"1024\" width=\"1024\"></canvas>\n</div>\n";
  
  __$styleInject(".wsmu.box {\n\tposition: fixed;\n\tpadding: 5px;\n\toverflow: hidden;\n\tbackground-color: rgba(0, 0, 0, 0.6);\n\tz-index: 999999;\n\twidth: 420px;\n}\n.wsmu.top {\n\ttop: 0;\n}\n.wsmu.left {\n\tleft: 0;\n}\n.wsmu.bottom {\n\tbottom: 0;\n}\n.wsmu.right {\n\tright: 0;\n}\n.wsmu.canvas {\n\twidth: 100%;\n\theight: 200px;\n}\n", undefined);
  
  var $ = function $(selector) {
  	return document.querySelector(selector);
  };
  var canvas = null;
  var _ctx = null;
  var audioListener = function audioListener(arr) {
  	return log('Data received!', arr);
  };
  
  var registerAudioListener = function registerAudioListener(listener) {
  	audioListener = listener;
  };
  window.wallpaperRegisterAudioListener = registerAudioListener;
  
  var audio = new Audio();
  var ctx = new (window.AudioContext || window.webkitAudioContext)();
  var source = ctx.createMediaElementSource(audio);
  var splitter = ctx.createChannelSplitter();
  var analyserL = ctx.createAnalyser();
  var analyserR = ctx.createAnalyser();
  var TDBL = analyserL.maxDecibels - analyserL.minDecibels;
  var TDBR = analyserR.maxDecibels - analyserR.minDecibels;
  var fps = 30;
  var tg = 1000 / fps;
  
  var raito = 0.6;
  var AFID = 0;
  var last = 0;
  var threshold = 0;
  var useMicrophone = false;
  
  analyserL.smoothingTimeConstant = 0;
  analyserR.smoothingTimeConstant = 0;
  analyserL.fftSize = 2048;
  analyserR.fftSize = 2048;
  
  var shiftCanvas = function shiftCanvas() {
  	var imageData = _ctx.getImageData(0, 0, canvas.width, canvas.height);
  	canvas.width = canvas.width;
  	_ctx.putImageData(imageData, -1, 0);
  };
  
  var getRawL = function getRawL(i) {
  	return (i + TDBL) / TDBL;
  };
  var getRawR = function getRawR(i) {
  	return (i + TDBR) / TDBR;
  };
  var sum = function sum(l, r) {
  	return l + r;
  };
  
  function _ref(item) {
  	if (item < 0 || item === Infinity) return 0;
  	return item;
  }
  
  var update = function update() {
  	AFID = window.requestAnimationFrame(update);
  
  	var now = performance.now();
  	var dt = now - last;
  	last = now;
  
  	threshold += dt;
  	if (threshold <= tg) return;
  	threshold = 0;
  
  	var f32arrL = new Float32Array(analyserL.frequencyBinCount);
  	var f32arrR = new Float32Array(analyserR.frequencyBinCount);
  	analyserL.getFloatFrequencyData(f32arrL);
  	analyserR.getFloatFrequencyData(f32arrR);
  	var tarrL = _Array$from(f32arrL).slice(0, 512).map(getRawL);
  	var tarrR = _Array$from(f32arrR).slice(0, 512).map(getRawR);
  	var arrL = [];
  	var arrR = [];
  	for (var i = 0; i < 256; i += 4) {
  		arrL.push(tarrL.slice(i, i + 4).reduce(sum) / 4 * Math.pow(0.9 + 4 * i / f32arrL.length, 2) * raito);
  		arrR.push(tarrR.slice(i, i + 8).reduce(sum) / 4 * Math.pow(0.9 + 4 * i / f32arrR.length, 2) * raito);
  	}
  
  	var scopeData = tarrR.concat(tarrL).reverse();
  
  	shiftCanvas();
  	for (var _i in scopeData) {
  		var opacity = scopeData[_i];
  		if (opacity < 0) opacity = 0;
  		if (opacity < 0) log('<0');
  		_ctx.fillStyle = 'rgba(255, 255, 255, ' + opacity + ')';
  		_ctx.fillRect(1023, _i, 1, 1);
  	}
  
  	var outputData = arrL.concat(arrR).map(_ref);
  	audioListener(outputData);
  };
  
  function _ref2(evt) {
  	var url = URL.createObjectURL(evt.target.files[0]);
  	if (audio.src) URL.revokeObjectURL(audio.src);
  	audio.src = url;
  }
  
  function _ref3() {
  	if (!AFID) update();
  	audio.play();
  }
  
  function _ref4() {
  	audio.pause();
  }
  
  function _ref5() {
  	audio.pause();
  	audio.currentTime = 0;
  	window.cancelAnimationFrame(AFID);
  	AFID = 0;
  }
  
  var init = function init() {
  	document.removeEventListener('DOMContentLoaded', init, false);
  
  	$('body').insertAdjacentHTML('afterbegin', content);
  
  	var input = $('.wsmu.input');
  	var playBtn = $('.wsmu.btn.play');
  	var pauseBtn = $('.wsmu.btn.pause');
  	var stopBtn = $('.wsmu.btn.stop');
  	canvas = $('.wsmu.canvas');
  	_ctx = canvas.getContext('2d');
  
  	if (useMicrophone) update();
  	input.addEventListener('change', _ref2);
  
  	playBtn.addEventListener('click', _ref3);
  	pauseBtn.addEventListener('click', _ref4);
  	stopBtn.addEventListener('click', _ref5);
  
  	info('v' + "0.3.3.master.4605c59" + ' Initialized!');
  };
  
  var connectAll = function connectAll() {
  	source.connect(splitter);
  	splitter.connect(analyserL, 0, 0);
  	splitter.connect(analyserR, 1, 0);
  	source.connect(ctx.destination);
  	init();
  	update();
  };
  
  var streamMic = function streamMic(stream) {
  	var userSource = ctx.createMediaStreamSource(stream);
  
  	userSource.connect(splitter);
  	useMicrophone = true;
  };
  
  var logReject = function logReject(e) {
  	return log('Rejected!', e);
  };
  
  var _init = function _init() {
  	connectAll();
  	if (navigator.mediaDevices) navigator.mediaDevices.getUserMedia({ audio: true }).then(streamMic).catch(logReject);else try {
  		navigator.getUserMedia({ audio: true }, streamMic, logReject);
  	} catch (err) {
  		log('Your browser doesn\'t support audio recording!', err);
  	}
  };
  
  document.addEventListener('DOMContentLoaded', _init, false);
  
  }());
  //# sourceMappingURL=wpesmu.dev.js.map
  