// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles

(function(modules, cache, entry, mainEntry, parcelRequireName, globalName) {
  /* eslint-disable no-undef */
  var globalObject =
    typeof globalThis !== 'undefined'
      ? globalThis
      : typeof self !== 'undefined'
      ? self
      : typeof window !== 'undefined'
      ? window
      : typeof global !== 'undefined'
      ? global
      : {};
  /* eslint-enable no-undef */

  // Save the require from previous bundle to this closure if any
  var previousRequire =
    typeof globalObject[parcelRequireName] === 'function' &&
    globalObject[parcelRequireName];
  // Do not use `require` to prevent Webpack from trying to bundle this call
  var nodeRequire =
    typeof module !== 'undefined' &&
    typeof module.require === 'function' &&
    module.require.bind(module);

  function newRequire(name, jumped) {
    if (!cache[name]) {
      if (!modules[name]) {
        // if we cannot find the module within our internal map or
        // cache jump to the current global require ie. the last bundle
        // that was added to the page.
        var currentRequire =
          typeof globalObject[parcelRequireName] === 'function' &&
          globalObject[parcelRequireName];
        if (!jumped && currentRequire) {
          return currentRequire(name, true);
        }

        // If there are other bundles on this page the require from the
        // previous one is saved to 'previousRequire'. Repeat this as
        // many times as there are bundles until the module is found or
        // we exhaust the require chain.
        if (previousRequire) {
          return previousRequire(name, true);
        }

        // Try the node require function if it exists.
        if (nodeRequire && typeof name === 'string') {
          return nodeRequire(name);
        }

        var err = new Error("Cannot find module '" + name + "'");
        err.code = 'MODULE_NOT_FOUND';
        throw err;
      }

      localRequire.resolve = resolve;
      localRequire.cache = {};

      var module = (cache[name] = new newRequire.Module(name));

      modules[name][0].call(
        module.exports,
        localRequire,
        module,
        module.exports,
        this
      );
    }

    return cache[name].exports;

    function localRequire(x) {
      return newRequire(localRequire.resolve(x));
    }

    function resolve(x) {
      return modules[name][1][x] || x;
    }
  }

  function Module(moduleName) {
    this.id = moduleName;
    this.bundle = newRequire;
    this.exports = {};
  }

  newRequire.isParcelRequire = true;
  newRequire.Module = Module;
  newRequire.modules = modules;
  newRequire.cache = cache;
  newRequire.parent = previousRequire;
  newRequire.register = function(id, exports) {
    modules[id] = [
      function(require, module) {
        module.exports = exports;
      },
      {},
    ];
  };

  Object.defineProperty(newRequire, 'root', {
    get: function() {
      return globalObject[parcelRequireName];
    },
  });

  globalObject[parcelRequireName] = newRequire;

  for (var i = 0; i < entry.length; i++) {
    newRequire(entry[i]);
  }

  if (mainEntry) {
    // Expose entry point to Node, AMD or browser globals
    // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
    var mainExports = newRequire(mainEntry);

    // CommonJS
    if (typeof exports === 'object' && typeof module !== 'undefined') {
      module.exports = mainExports;

      // RequireJS
    } else if (typeof define === 'function' && define.amd) {
      define(function() {
        return mainExports;
      });

      // <script>
    } else if (globalName) {
      this[globalName] = mainExports;
    }
  }
})({"4cdO8":[function(require,module,exports) {
var HMR_HOST = null;
var HMR_PORT = 1234;
var HMR_ENV_HASH = "d751713988987e9331980363e24189ce";
module.bundle.HMR_BUNDLE_ID = "f7668890c4b97863d05a108ad80e1bfc";
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH */

var OVERLAY_ID = '__parcel__error__overlay__';
var OldModule = module.bundle.Module;

function Module(moduleName) {
  OldModule.call(this, moduleName);
  this.hot = {
    data: module.bundle.hotData,
    _acceptCallbacks: [],
    _disposeCallbacks: [],
    accept: function (fn) {
      this._acceptCallbacks.push(fn || function () {});
    },
    dispose: function (fn) {
      this._disposeCallbacks.push(fn);
    }
  };
  module.bundle.hotData = null;
}

module.bundle.Module = Module;
var checkedAssets, assetsToAccept, acceptedAssets;

function getHostname() {
  return HMR_HOST || (location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost');
}

function getPort() {
  return HMR_PORT || location.port;
} // eslint-disable-next-line no-redeclare


var parent = module.bundle.parent;

if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
  var hostname = getHostname();
  var port = getPort();
  var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
  var ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/');

  ws.onmessage = function (event) {
    checkedAssets = {};
    assetsToAccept = [];
    acceptedAssets = {};
    var data = JSON.parse(event.data);

    if (data.type === 'update') {
      // Remove error overlay if there is one
      removeErrorOverlay();
      let assets = data.assets.filter(asset => asset.envHash === HMR_ENV_HASH); // Handle HMR Update

      var handled = false;
      assets.forEach(asset => {
        var didAccept = asset.type === 'css' || hmrAcceptCheck(module.bundle.root, asset.id);

        if (didAccept) {
          handled = true;
        }
      });

      if (handled) {
        console.clear();
        assets.forEach(function (asset) {
          hmrApply(module.bundle.root, asset);
        });

        for (var i = 0; i < assetsToAccept.length; i++) {
          var id = assetsToAccept[i][1];

          if (!acceptedAssets[id]) {
            hmrAcceptRun(assetsToAccept[i][0], id);
          }
        }
      } else {
        window.location.reload();
      }
    }

    if (data.type === 'error') {
      // Log parcel errors to console
      for (let ansiDiagnostic of data.diagnostics.ansi) {
        let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
        console.error('🚨 [parcel]: ' + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n'));
      } // Render the fancy html overlay


      removeErrorOverlay();
      var overlay = createErrorOverlay(data.diagnostics.html);
      document.body.appendChild(overlay);
    }
  };

  ws.onerror = function (e) {
    console.error(e.message);
  };

  ws.onclose = function (e) {
    console.warn('[parcel] 🚨 Connection to the HMR server was lost');
  };
}

function removeErrorOverlay() {
  var overlay = document.getElementById(OVERLAY_ID);

  if (overlay) {
    overlay.remove();
    console.log('[parcel] ✨ Error resolved');
  }
}

function createErrorOverlay(diagnostics) {
  var overlay = document.createElement('div');
  overlay.id = OVERLAY_ID;
  let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';

  for (let diagnostic of diagnostics) {
    let stack = diagnostic.codeframe ? diagnostic.codeframe : diagnostic.stack;
    errorHTML += "\n      <div>\n        <div style=\"font-size: 18px; font-weight: bold; margin-top: 20px;\">\n          \uD83D\uDEA8 ".concat(diagnostic.message, "\n        </div>\n        <pre>\n          ").concat(stack, "\n        </pre>\n        <div>\n          ").concat(diagnostic.hints.map(hint => '<div>' + hint + '</div>').join(''), "\n        </div>\n      </div>\n    ");
  }

  errorHTML += '</div>';
  overlay.innerHTML = errorHTML;
  return overlay;
}

function getParents(bundle, id) {
  var modules = bundle.modules;

  if (!modules) {
    return [];
  }

  var parents = [];
  var k, d, dep;

  for (k in modules) {
    for (d in modules[k][1]) {
      dep = modules[k][1][d];

      if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
        parents.push([bundle, k]);
      }
    }
  }

  if (bundle.parent) {
    parents = parents.concat(getParents(bundle.parent, id));
  }

  return parents;
}

function updateLink(link) {
  var newLink = link.cloneNode();

  newLink.onload = function () {
    if (link.parentNode !== null) {
      link.parentNode.removeChild(link);
    }
  };

  newLink.setAttribute('href', link.getAttribute('href').split('?')[0] + '?' + Date.now());
  link.parentNode.insertBefore(newLink, link.nextSibling);
}

var cssTimeout = null;

function reloadCSS() {
  if (cssTimeout) {
    return;
  }

  cssTimeout = setTimeout(function () {
    var links = document.querySelectorAll('link[rel="stylesheet"]');

    for (var i = 0; i < links.length; i++) {
      var href = links[i].getAttribute('href');
      var hostname = getHostname();
      var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort());
      var absolute = /^https?:\/\//i.test(href) && href.indexOf(window.location.origin) !== 0 && !servedFromHMRServer;

      if (!absolute) {
        updateLink(links[i]);
      }
    }

    cssTimeout = null;
  }, 50);
}

function hmrApply(bundle, asset) {
  var modules = bundle.modules;

  if (!modules) {
    return;
  }

  if (modules[asset.id] || !bundle.parent) {
    if (asset.type === 'css') {
      reloadCSS();
    } else {
      var fn = new Function('require', 'module', 'exports', asset.output);
      modules[asset.id] = [fn, asset.depsByBundle[bundle.HMR_BUNDLE_ID]];
    }
  } else if (bundle.parent) {
    hmrApply(bundle.parent, asset);
  }
}

function hmrAcceptCheck(bundle, id) {
  var modules = bundle.modules;

  if (!modules) {
    return;
  }

  if (!modules[id] && bundle.parent) {
    return hmrAcceptCheck(bundle.parent, id);
  }

  if (checkedAssets[id]) {
    return;
  }

  checkedAssets[id] = true;
  var cached = bundle.cache[id];
  assetsToAccept.push([bundle, id]);

  if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
    return true;
  }

  return getParents(module.bundle.root, id).some(function (v) {
    return hmrAcceptCheck(v[0], v[1]);
  });
}

function hmrAcceptRun(bundle, id) {
  var cached = bundle.cache[id];
  bundle.hotData = {};

  if (cached && cached.hot) {
    cached.hot.data = bundle.hotData;
  }

  if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
    cached.hot._disposeCallbacks.forEach(function (cb) {
      cb(bundle.hotData);
    });
  }

  delete bundle.cache[id];
  bundle(id);
  cached = bundle.cache[id];

  if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
    cached.hot._acceptCallbacks.forEach(function (cb) {
      var assetsToAlsoAccept = cb(function () {
        return getParents(module.bundle.root, id);
      });

      if (assetsToAlsoAccept && assetsToAccept.length) {
        assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
      }
    });
  }

  acceptedAssets[id] = true;
}
},{}],"Ahtjw":[function(require,module,exports) {
"use strict";

var _mount = _interopRequireDefault(require("../../vm/mount"));

var _App = _interopRequireDefault(require("./App"));

var _core = require("../../core");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _core.showTrace)();
window.addEventListener('load', function () {
  // console.log(App)
  (0, _mount.default)(_App.default, document.getElementById('root'));
});
},{"../../vm/mount":"NxZhw","./App":"5Hexf","../../core":"2YQJM"}],"NxZhw":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = mount;

var _render = require("./render");

function mount(template, element) {
  if (!element) throw Error('mount: target element is undefined');
  (0, _render.renderDom)(template, element, true); // console.log(element)
}
},{"./render":"5dh0s"}],"5dh0s":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.renderDomChildren = renderDomChildren;
exports.renderDomView = renderDomView;
exports.renderDomText = renderDomText;
exports.renderDom = renderDom;
exports.default = void 0;

var _types = require("../core/types");

var _logging = require("../core/logging");

var _collections = require("../core/collections");

var _event = require("../dom/event");

var _jss = _interopRequireDefault(require("./jss"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// import {compileStyles} from "./vm_deprecated/util";
// import View from "./view";
function compileStyles(styles, joinWith) {
  if (!(0, _types.isVal)(styles)) return '';else if ((0, _types.isStr)(styles)) return styles;else if ((0, _types.isArr)(styles)) return styles.join(joinWith);
  return _jss.default.generateCss(styles, joinWith);
}

function setElementProps(element, node, view) {
  if (node.attrs) {
    (0, _collections.forEach)(node.attrs, (val, key) => {
      if (key === 'style') {
        val = compileStyles(val, ' ');
      } else if (key === 'className') {
        key = 'class';
      }

      element.setAttribute(key, val);
    });
  }

  if (node.events) {
    (0, _collections.forEach)(node.events, (v, k) => {
      if (view) v = v.bind(view);
      (0, _event.setEvent)(element, k, v);
    });
  }
}

function renderDomChildren(node, parentElement) {
  let nodes = [];

  for (let i = 0; i < node.$count; i++) {
    const curNode = node.$nodes[i];

    if (curNode.$isText) {
      nodes.push(renderDomText(curNode));
    } else {
      let childDom = undefined;
      if (curNode.$raw) curNode.$render(curNode, curNode.$view);

      if (curNode.$isView) {
        childDom = renderDomView(curNode, node.$element || parentElement);
      } else if (curNode.$isNode) {
        childDom = renderDom(curNode);
      } else {
        (0, _logging.error)('Illegal node', curNode);
        throw Error(`Illegal child node`);
      }

      if (childDom instanceof Array) {
        childDom.forEach(c => nodes.push(c));
      } else {
        nodes.push(childDom);
      }
    }
  }

  return nodes;
}

function renderDomView(node, parentElement, isRoot = false) {
  if (node.$raw) {
    node.$render(node.$parent, node.$view);
  } // if (node.$empty) {
  //     View.$setNodes(node, [VNode.create('slot')], false)
  //     node.$element = renderDom(node.$first)
  //     node.$element.__view__ = node
  //     node.$element.__node__ = node.$first
  //     return [node.$element]
  // }


  let children = renderDomChildren(node, parentElement);
  let currentElement = !node.$parent ? parentElement : undefined;

  if (node.$single) {
    currentElement = children[0];
  }

  if (currentElement && !node.$single) {
    // console.log('not single', children)
    children.forEach(c => currentElement.append(c));
    children = [currentElement];
    currentElement.__view__ = node;
  } // warn(node, currentElement,node.$parent&& node.$parent.$rootElement)


  node.$element = currentElement;
  node.$rootElement = node.$rootElement || parentElement || node.$parent && node.$parent.$rootElement || node.$parent && node.$parent.$element;

  if (!node.$rootElement) {
    (0, _logging.info)('no root', node);
  } else {
    if (node.$element === parentElement) {
      (0, _logging.info)('Parent is the same element');
    } else {
      children.forEach(c => parentElement.append(c));
    } // if (children.length!==1)
    //     children.forEach((c)=>parentElement.append(c))
    // else {
    //     if (node.$element === parentElement) {
    //         console.error('same')
    //     } else {
    //         children.forEach((c)=>parentElement.append(c))
    //     }
    // }
    // children = [node.$rootElement]


    node.$rootElement.__view__ = node;
  }

  return children;
}

function renderDomText(node) {
  let textNode = document.createTextNode(node.$text);
  node.$element = textNode;
  textNode.__node__ = node;
  return textNode;
}

function renderDom(node, parentElement, replaceParent) {
  if (!node) console.trace(node);
  let currentElement = undefined;
  if (node.$isText) return renderDomText(node);

  if (node.$isNode || node.$frag && parentElement) {
    //#region Done
    let id = undefined; // if (!node.$parent) {

    if (replaceParent) {
      id = parentElement.id;
      currentElement = parentElement;
    } else {
      currentElement = document.createElement(node.$tag);
    }

    setElementProps(currentElement, node, node.$view);
    if (id) currentElement.id = id;
    currentElement.__node__ = node;
    node.$element = currentElement; //#endregion A

    let children = renderDomChildren(node, currentElement);

    try {
      children.forEach(c => {
        try {
          currentElement.append(c);
        } catch (ee) {
          console.error(c, ee);
        }
      });
    } catch (e) {
      console.error(node, e);
    }

    return currentElement;
  }

  if (node instanceof Array) {
    node = VNode.create(null, undefined, node);
    node.$render();
  }

  if (node.$frag) {
    if (!parentElement) {
      (0, _logging.warn)('Rendering fragment without rootElement', node);
      return renderDomChildren(node);
    } else {
      let children = renderDomChildren(node, parentElement);
      children.forEach(ch => {
        parentElement.append(ch);
      });
      return parentElement;
    }
  }

  return renderDomView(node, parentElement);
}

var _default = renderDom;
exports.default = _default;
},{"../core/types":"5jEMv","../core/logging":"2ERs7","../core/collections":"5lqP4","../dom/event":"6wQPW","./jss":"1Xb8X"}],"5jEMv":[function(require,module,exports) {
/**
 * @module core/types
 * @memberOf core
 */

/**
 * If is class or function return class/function name else returns typeof
 * @param x
 * @return {"undefined"|"object"|"boolean"|"number"|"string"|"function"|"symbol"|"bigint"|*}
 */
function typeName(x) {
  if (x.hasOwnProperty('constructor')) {
    return x.constructor.name;
  }

  return typeof x;
}
/** Is undefined
 * @param x
 * @returns {boolean}
 */


function isUnd(x) {
  return x !== null && x === undefined;
}
/** Is null
 * @param x
 * @return {boolean}
 */


function isNull(x) {
  return x === null;
}
/** Is value !null && !undefined
 * @param x
 * @return {boolean|boolean}
 */


function isVal(x) {
  return !isUnd(x) && !isNull(x);
}
/** Is number
 * @param x
 * @return {boolean}
 */


function isNum(x) {
  return typeof x === "number";
}
/** Is string|String
 * @param x
 * @return {boolean}
 */


function isStr(x) {
  return typeof x === "string" || x instanceof String;
}
/** Is function
 * @param x
 * @return {boolean}
 */


function isFun(x) {
  return typeof x === "function";
}
/** Is object
 * @param x
 * @return {boolean|boolean}
 */


function isObj(x) {
  return x !== null && typeof x === "object";
}
/** Is Array
 * @param x
 * @return {boolean}
 */


function isArr(x) {
  return x instanceof Array;
}
/** Is primitive isVal && !isObj && !isFun
 * @param x
 * @return {boolean}
 */


function isPrim(x) {
  return isVal(x) && !isObj(x) && !isFun(x);
}
/** Is List (has length property and item() function)
 * @param x
 * @return {boolean|boolean}
 */


function isList(x) {
  return isVal(x.length) && isFun(x.item);
}
/** Is MutableList (has length property, item() and add() functions)
 * @param x
 * @return {boolean}
 */


function isMutableList(x) {
  return isVal(x.length) && isFun(x.item) && isFun(x.add);
}
/** Is Set type
 * @param x
 * @return {boolean}
 */


function isSet(x) {
  return x instanceof Set;
}
/** Is Map type
 * @param x
 * @return {boolean}
 */


function isMap(x) {
  return x instanceof Map;
}
/** Is Error type
 * @param x
 * @return {boolean}
 */


function isError(x) {
  return x instanceof Error;
}
/** Is Element/Node
 * @param x
 * @return {boolean}
 */


function isEl(x) {
  return x instanceof Element || x instanceof HTMLElement || x instanceof Node;
}
/** Is NodeList || HTMLCollection
 * @param x
 * @return {boolean}
 */


function isEls(x) {
  return x instanceof HTMLCollection || x instanceof NodeList;
}
/**
 * Object has field
 * @param {Object} obj - source object
 * @param {String} field - field/property name
 * @param {Function} [pred] - optional predicate function to check field
 * @return {boolean}
 */


function hasField(obj, field, pred) {
  if (!isVal(obj)) return false;

  if (isFun(pred)) {
    return pred(obj[field]);
  }

  return obj.hasOwnProperty(field);
}
/** Is Empty Array/List/Object/String
 * @param x
 * @return {boolean}
 */


function isEmpty(x) {
  if (hasField(x, 'length')) return x.length <= 0;
  if (isFun(x)) return false;
  if (isObj(x)) return Object.keys(x).length <= 0;
  return true;
}
/**
 * Custom Enum implementation
 *
 * @param src {Object | String[]}
 * @return {Object}
 * @constructor
 */


function Enum(src) {
  let c = 0;
  let MAP = {};

  for (let i of Object.keys(src)) {
    MAP[MAP[c] = i] = c++;
  }

  return MAP;
}
/**
 * Deserialize sequence of key values (key, value, ...) into an object
 *
 * @param {any} args - key{String}, value{*} sequence
 * @return {Object}
 */


function dict(...args) {
  let o = {};

  for (let i = 0; i < args.length; i++) {
    if (i % 2 !== 0) continue;
    o[args[i]] = args[i + 1];
  }

  return o;
}

module.exports = {
  typeName,
  isUnd,
  isNull,
  isVal,
  isNum,
  isStr,
  isFun,
  isObj,
  isArr,
  isPrim,
  isList,
  isMutableList,
  isSet,
  isMap,
  isError,
  isEl,
  isEls,
  hasField,
  isEmpty,
  Enum,
  dict
};
},{}],"2ERs7":[function(require,module,exports) {
// const {Enum} = require("./types");

/**
 * @module core/logging
 * @memberOf core
 */

/** @private */
function _logTime() {
  let t = new Date();
  return `${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}:${t.getMilliseconds()}`;
}
/** @private */


function _logTitle(flag) {
  return `[${flag}] [${_logTime()}]`;
}
/** @private */


function _prepareLog(args, lt) {
  args.reverse();
  args.push("display: inline-block; font-weight: bold; color: black", "%c" + lt);
  args.reverse();
}
/**
 * @type {Object}
 */


const LogLevels = {
  TRACE: 0,
  INFO: 1,
  WARN: 2,
  ERROR: 3,
  SILENT: -1
};
/**
 * Log config
 * @type {{LogLevel: *}}
 */

const Config = {
  LogLevel: LogLevels.TRACE
};
/** Set `Config.LogLevel` to TRACE */

function showTrace() {
  Config.LogLevel = LogLevels.TRACE;
}
/** Set `Config.LogLevel` to INFO */


function showInfo() {
  Config.LogLevel = LogLevels.INFO;
}
/** Set `Config.LogLevel` to WARN */


function showWarn() {
  Config.LogLevel = LogLevels.WARN;
}
/** Set `Config.LogLevel` to ERROR */


function showError() {
  Config.LogLevel = LogLevels.ERROR;
}
/** Set `Config.LogLevel` to SILENT */


function silent() {
  Config.LogLevel = LogLevels.SILENT;
}
/** Set Config.LogLevel
 * @param l - LogLevel */


function lvl(l) {
  return Config.LogLevel !== LogLevels.SILENT && Config.LogLevel <= l;
}
/**
 * Log Trace
 * @param {any} args
 */


function trace(...args) {
  if (!lvl(LogLevels.TRACE)) return;
  args.reverse();
  args.push(_logTitle("🔍 TRACE"));
  args.reverse(); // args.push("\n");

  console.trace.apply(this, args);
}
/**
 * Log Info
 * @param {any} args
 */


function info(...args) {
  if (!lvl(LogLevels.INFO)) return;

  _prepareLog(args, _logTitle("🔵 INFO"));

  console.log.apply(this, args);
}
/**
 * Log Warning
 * @param {any} args
 */


function warn(...args) {
  if (!lvl(LogLevels.WARN)) return;

  _prepareLog(args, _logTitle("🚨 WARN"));

  console.warn.apply(this, args);
}
/**
 * Log Error
 * @param {any} args
 */


function error(...args) {
  if (!lvl(LogLevels.ERROR)) return;

  _prepareLog(args, _logTitle("💥 ERROR"));

  console.error.apply(this, args);
}

module.exports = {
  Config,
  LogLevels,
  showTrace,
  showInfo,
  showWarn,
  showError,
  silent,
  trace,
  info,
  warn,
  error
};
},{}],"5lqP4":[function(require,module,exports) {
var global = arguments[3];

/**
 * @module core/collections
 * @memberOf core
 */
const T = require("./types");

if (!global._X_LOOP_BREAK_) {
  global._X_LOOP_BREAK_ = Symbol("BREAK_LOOP");
  global._X_ANY_ = Symbol("ANY");
  global._X_ALL_ = Symbol("ALL");
}
/**
 * Break from functional loops: forEach, filter, ...
 * @type {symbol}
 */


const BREAK = global._X_LOOP_BREAK_;
/**
 * Match Any: Used as value in predicate object
 * @type {symbol}
 */

const ANY = global._X_ANY_;
const ALL = global._X_ALL_;
const UNSAFE_PROPS = ['__proto__', 'constructor', '__defineGetter__', '__defineSetter__', 'prototype'];
/**
 * Get item by index from multiple source types
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} s - source
 * @param {Number|String} i - item index
 * @returns {any|null|undefined}
 */

function item(s, i) {
  if (!T.isVal(s)) return undefined;
  if (T.isObj(s)) return s[i];
  if (T.isStr(s)) return s[i];
  if (T.isArr(s)) return s[i];else return s.item(i);
}
/**
 * Source contains value or key:value
 *
 * @param {Array|Object|String} src
 * @param {any} value
 * @param {String|undefined} [key]
 * @returns {boolean}
 */


function contains(src, value, key) {
  if (!T.isVal(src)) return false;
  if (!T.isArr(src) && T.isObj(src)) return src[key] === value;
  return src.indexOf(value) >= 0;
}
/**
 * Add item(s) to source
 *
 * @param {Array|{add:Function}} src - source
 * @param {any} v - values
 */


function add(src, ...v) {
  if (T.isArr(src)) {
    forEach(v, vi => src.push(vi));
  } else if (T.isMutableList(src)) {
    src.add(v);
  }
}
/**
 * Remove item(s) from source
 *
 * @param {Array|String} src
 * @param {...any} it
 * @returns {boolean}
 */


function remove(src, ...it) {
  it = flatMap(it);
  let any = false;
  forEach(it, item => {
    let idx = src.indexOf(item);

    if (idx >= 0) {
      any = true;
      src.splice(idx, 1);
    }
  });
  return any;
}
/**
 * Toggles items in source
 *
 * @param {Array} src
 * @param {...any} c
 */


function toggle(src, ...c) {
  if (c.length === 0) return;
  c = flatMap(c);
  let idx = undefined;

  if (c.length === 1) {
    if (!remove(src, c)) {
      add(src, c[0]);
    }
  } else {
    c.push(c[0]);
    let any = false;
    forEach(src, (cl, i) => {
      idx = c.indexOf(cl);

      if (idx >= 0 && c.length > idx + 1) {
        any = true;
        src[i] = c[idx + 1];
      }
    });

    if (!any) {
      src.push(c[0]);
    }
  }
}

function objMatchOne(o, match) {
  let m = Object.keys(match);

  for (let k of m) {
    // if (!T.isObj(o[k])) continue;
    if (match[k] === ANY && o.hasOwnProperty(k)) return true;
    if (match[k] === o[k]) return true;
  }

  return false;
}

function objMatchAll(o, match) {
  let m = Object.keys(match);

  for (let k of m) {
    // if (!T.isObj(o[k])) return false;
    if (match[k] === ANY) continue;
    if (match[k] !== o[k]) return false;
  }

  return true;
}

function predicate(f, def = () => true, inc = true) {
  if (T.isUnd(f)) return def;
  if (T.isFun(f)) return f;else if (f instanceof RegExp) return (v, k, i, s) => !T.isObj(v) ? f.test(v.toString()) : false;else if (T.isObj(f)) {
    if (Object.keys(f).length === 0) return def;
    return inc ? (v, k, i, s) => objMatchOne(v, f) : (v, k, i, s) => objMatchAll(v, f);
  } else return (v, k, i, s) => v === f;
}

function funOrKey(f) {
  if (T.isUnd(f)) return v => v;
  if (T.isFun(f)) return f;

  if (T.isStr(f)) {
    const key = f;

    f = v => v[key];
  }

  throw Error(`Predicate ${f} cannot be of type ${typeof f}`);
}
/**
 * Create empty instance of given source
 *
 * @param {any} src - source object
 * @param {any} def - default value for primitives
 * @returns {any} empty instance of src
 */


function emptyOf(src, def = {}) {
  if (T.isStr(src)) return "";
  if (T.isList(src)) return [];

  if (T.isObj(src)) {
    if (T.isEl(src)) {
      if (src.nodeType === 3 || src.nodeType === 8) {
        return document.createTextNode(src.textContent);
      } else {
        return document.createElement(src.tagName);
      }
    }

    if (src.__proto__) return Object.create(src.__proto__);
    return {};
  }

  return def;
}
/**
 * Type-agnostic concat. !!Mutates target!!
 *
 * @param {Array|String|Object} target
 * @param {Array|String|Object} source
 * @returns {Array|String|Object}
 */


function concat(target, source, override = false) {
  if (T.isStr(target)) {
    return target.concat(source);
  }

  if (T.isArr(target)) {
    return target.concat(source);
  }

  for (let k of Object.keys(source)) {
    if (!target[k] || override) target[k] = source[k];
  }

  return target;
}
/**
 * Polyfill-like for Object.values (uses native method if available)
 *
 * @param {Object} obj
 * @returns {Array|undefined} - array of values
 */


function objectValues(obj) {
  if (Object.values) {
    return Object.values(obj);
  } else {
    return map(obj, v => v);
  }
}
/**
 * Index for loop from "init" to "finish"(included) by "step"
 *
 * @param {Function} func
 * @param {Number} init
 * @param {Number} finish
 * @param {Number} [step]
 */


function forN(func, init = 0, finish = 0, step = init < finish ? 1 : -1) {
  if (step > 0) {
    for (; init <= finish; init += step) {
      func(init);
    }
  }

  for (; init >= finish; init += step) {
    func(init);
  }
}
/**
 * forEach(left) with limited range
 *
 * @param {Array|Object|NodeList|HTMLCollection} src
 * @param {Function} func
 * @param {Number} [start]
 * @param {Number?} [end]
 * @returns {*|number}
 */


function forEachRange(src, func, start = 0, end) {
  if (!T.isArr(src) || !T.isStr(src)) {
    let keys = Object.keys(src);
    end = end || keys.length - 1;

    for (let i = start; i <= end; i++) {
      let r = func(src[keys[i]], keys[i], i, src);
      if (r === BREAK) return i;
    }

    return end;
  }

  end = end || src.length;

  for (let i = start; i < end; i++) {
    let r = func(item(src, i), i, i, src);
    if (r === BREAK) return i;
  }

  return end;
}
/**
 * Type-agnostic forEach loop
 *
 * @param src
 * @param func
 * @returns {number|*}
 */


function forEach(src, func) {
  if (!T.isVal(src)) return -1;

  if (!T.isArr(src) || !T.isStr(src) || !T.isList(src)) {
    let i = 0;
    let keys = Object.keys(src);
    const len = keys.length;

    for (; i < len; i++) {
      // let r = ;
      const k = keys[i],
            v = src[k];
      if (func(v, k, i, src) === BREAK) return i;
    }

    return i;
  }

  const len = src.length;

  if (!T.isArr(src)) {
    for (let i = 0; i < len; i++) {
      const v = src[i];
      let r = func(v, i, i, src);
      if (r === BREAK) return i;
    }
  } else {
    for (let i = 0; i < len; i++) {
      const v = item(src, i);
      let r = func(v, i, i, src);
      if (r === BREAK) return i;
    }
  }

  return src.length;
}
/**
 * Type-agnostic forEachRight loop
 *
 * @param src
 * @param func
 * @param range
 * @returns {number|*}
 */


function forEachRight(src, func, range = []) {
  if (!T.isArr(src) || !T.isStr(src)) {
    let i = 0;
    let keys = Object.keys(src);

    for (let i = keys.length - 1; i >= 0; i--) {
      if (i < range[1]) continue;
      if (i >= range[0]) return i;
      let r = func(src[keys[i]], keys[i], i, src);
      if (r === BREAK) return i;
    }

    return i;
  }

  for (let i = src.length - 1; i >= 0; i--) {
    let r = func(item(src, i), i, i, src);
    if (r === BREAK) return i;
  }

  return src.length;
}
/**
 * Extended version of native indexOf method, using {@link forEach}
 * @see forEach
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Object|Array} pred - predicate function/{key:value}/[keys]
 * @returns {number}
 */


function firstIndex(src, pred) {
  pred = predicate(pred, () => true);
  let r = -1;
  forEach(src, function (v, k, i) {
    r = pred(v, k, i, src);

    if (r === true) {
      r = i;
      return BREAK;
    }
  });
  return r;
}
/**
 * Extended version of native first method, using {@link firstIndex}
 * @see firstIndex
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Object|Array} [pred] - predicate function/{key:value}/[keys]
 * @returns {*}
 */


function first(src, pred) {
  return item(src, firstIndex(src, pred));
}
/**
 * Returns true if first item matches predicate
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Object|Array} [pred] - predicate function/{key:value}/[keys] pred
 * @returns {boolean|*}
 */


function startsWith(src, pred) {
  if (T.isStr(src) && T.isStr(pred)) {
    return src.indexOf(pred) === 0;
  }

  pred = predicate(pred, () => true);
  return pred(first(src));
}
/**
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Array|Object} pred
 * @returns {number}
 */


function lastIndex(src, pred) {
  pred = predicate(pred, () => true);
  let r = -1;
  forEachRight(src, function (v, k, i) {
    r = pred(v, k, i);

    if (r === true) {
      r = i;
      return BREAK;
    }
  });
  return r;
}
/**
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Array|Object} [pred]
 * @returns {*}
 */


function last(src, pred) {
  return src[lastIndex(src, pred)];
}
/**
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Array|Object} pred
 * @returns {boolean|*}
 */


function endsWith(src, pred) {
  if (T.isStr(src) && T.isStr(pred)) {
    return src.indexOf(pred) === src.length - pred.length;
  }

  pred = predicate(pred, () => true);
  return pred(last(src));
}
/**
 * Reverse array-like src
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @returns {Array|Object|String|NodeList|HTMLCollection} - reversed src
 */


function reverse(src) {
  if (T.isArr(src)) return src.reverse();
  let rev = "";
  forEachRight(src, function (it) {
    rev += it;
  });
  return rev;
}
/**
 * A more versatile alternative to native "some" method
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Array|Object} pred
 * @returns {boolean}
 */


function any(src, pred) {
  // if (!func){
  //     if (T.isArr(src) || T.isStr(src)) return src.length>0;
  //     return Object.keys(src).length>0;
  // }
  let fn = predicate(pred);
  let r = false;
  forEach(src, function (v, k, i, src) {
    r = fn(v, k, i, src);
    if (r === true) return BREAK;
  });
  return r;
}
/**
 * A more versatile alternative to native "every" method
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src
 * @param {Function|Array|Object} pred
 * @returns {boolean}
 */


function all(src, pred) {
  pred = predicate(pred, () => true);
  let r = true;
  forEach(src, function (v, k, i, src) {
    r = pred(v, k, i, src);
    if (r === false) return BREAK;
  });
  return r;
}

function filterStr(src, pred, right = false, omit = false) {
  pred = predicate(pred, () => true);
  let res = "";
  let loop = right ? forEachRight : forEach;
  loop(src, function (v, k, i) {
    if (!pred || pred(v, k, i, src) === omit) res += v;
  });
  return res;
}

function filterObj(src, pred, right = false, omit = false) {
  if (T.isArr(pred)) {
    let a = Object.assign({}, pred);
    if (omit) pred = (v, k) => !any(a, k);else pred = (v, k) => any(a, k);
  } else pred = predicate(pred, () => true);

  let res = {}; // let loop = right ? ForEachRight : ForEach;

  const keys = Object.keys(src);
  const len = keys.length;

  if (!right) {
    for (let i = 0; i < len; i++) {
      const k = keys[i];
      const v = src[k];
      if (pred(v, k, i, src) !== omit) res[k] = v;
    }
  } else {
    for (let i = len - 1; i >= 0; i--) {
      const k = keys[i];
      const v = src[k];
      if (pred(v, k, i, src) !== omit) res[k] = v;
    }
  } // loop(src, function (v, k, i) {
  //     if (pred(v, k, i, src) !== omit) res[k] = v;
  // });


  return res;
}

function filterArr(src, pred, right = false, omit = false) {
  if (T.isArr(pred)) {
    let a = Object.assign([], pred);
    if (omit) pred = (v, k, i) => !any(a, i);else pred = (v, k, i) => any(a, i);
  } else pred = predicate(pred, () => true);

  let res = [];
  const len = src.length;

  if (!right) {
    for (let i = 0; i < len; i++) {
      const v = src[i];

      if (pred(v, i, i, src) !== omit) {
        res.push(v);
      }
    }
  } else {
    for (let i = len - 1; i >= 0; i--) {
      const v = src[i];

      if (!pred(v, i, i, src) !== omit) {
        res.push(v);
      }
    }
  }

  return res;
}
/**
 * A more versatile alternative to native "filter" method
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src - source
 * @param {Function|Array|Object} pred - predicate function/{key:value}/[keys]
 * @param {boolean} [right] - reverse loop
 * @returns {Array|Object|String}
 */


function filter(src, pred, right = false) {
  if (T.isStr(src)) return filterStr(src, pred, right);
  if (T.isArr(src) || T.isList(src)) return filterArr(src, pred, right);
  return filterObj(src, pred, right);
}
/**
 * Opposite of filter, returns items not matching predicate
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src - source
 * @param {Function|Array|Object} pred - predicate function/{key:value}/[keys]
 * @param {boolean} [right] - reverse loop
 * @returns {Array|Object|String}
 */


function omit(src, pred, right = false) {
  if (T.isStr(src)) return filterStr(src, pred, right, true);
  if (T.isArr(src) || T.isList(src)) return filterArr(src, pred, right, true);
  return filterObj(src, pred, right, true);
}
/**
 * {@link filter} in reverse order (right)
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src - source
 * @param {Function|Array|Object} pred - predicate function/{key:value}/[keys]
 * @returns {Array|Object|String}
 */


function filterRight(src, pred) {
  return filter(src, pred, true);
}
/**
 * Find max index
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} list
 * @param {Function|String} pred - predicate function/key
 * @return {number}
 */


function maxIndex(list, pred) {
  pred = funOrKey(pred);
  let mx;
  let index = -1;
  forEach(list, function (i, ix) {
    let x = pred(i, ix);

    if (!mx) {
      mx = x;
      index = ix;
    } else if (x >= mx) {
      mx = x;
      index = ix;
    }
  });
  return index;
}
/**
 * Find max
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} list
 * @param {Function|String} pred - predicate function/key
 * @return {number}
 */


function max(list, pred) {
  return list[maxIndex(list, pred)];
}
/**
 * Find min index
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} list
 * @param {Function|String} pred - predicate function/key
 * @return {number}
 */


function minIndex(list, pred) {
  pred = funOrKey(pred);
  let mn;
  let index = -1;
  forEach(list, function (i, ix) {
    let x = pred(i, ix);

    if (!mn) {
      mn = x;
      index = ix;
    } else if (x <= mn) {
      mn = x;
      index = ix;
    }
  });
  return index;
}
/**
 * Find min
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} list
 * @param {Function|String} pred - predicate function/key
 * @return {number}
 */


function min(list, pred) {
  return list[minIndex(list, pred)];
}

function mapArr(src, func, right = false) {
  let res = []; // let loop = right ? ForEachRight : ForEach;

  const len = src.length;

  if (!right) {
    for (let i = 0; i < len; i++) {
      let r = func(src[i], i, src);
      if (r === BREAK) break;
      if (!T.isUnd(r)) res.push(r);
    }
  } else {
    for (let i = len; i >= 0; i--) {
      let r = func(src[i], i, src);
      if (r === BREAK) break;
      if (!T.isUnd(r)) res.push(r);
    }
  } // loop(src, function (a, i) {
  //     let r = func(a, i, src);
  //     if (!T.isUnd(r))
  //         res.push(r);
  // });


  return res;
}

function mapObj(src, func, right = false) {
  let res = {}; // let loop = right ? ForEachRight : ForEach;

  const keys = Object.keys(src);
  const len = src.length;

  if (!right) {
    for (let i = 0; i < len; i++) {
      const k = keys[i];
      const v = src[k];
      let r = func(v, k, i, src);
      if (r === BREAK) break;
      if (!T.isUnd(r)) res[k] = r;
    }
  } else {
    for (let i = len; i >= 0; i--) {
      const k = keys[i];
      const v = src[k];
      let r = func(v, k, i, src);
      if (r === BREAK) break;
      if (!T.isUnd(r)) res[k] = r;
    }
  } // loop(src, function (v, k, i) {
  //     let r = func(v, k, i, src);
  //     if (!T.isUnd(r))
  //         res[k] = r
  // });


  return res;
}
/**
 * A more versatile alternative to native "map" method
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src - source
 * @param {Function|Array|Object} transform - transformer function
 * @param {boolean} [right] - reverse loop
 * @returns {Array|Object|String}
 */


function map(src, transform, right = false) {
  transform = predicate(transform, v => v);
  if (T.isArr(src)) return mapArr(src, transform, right);else if (T.isObj(src)) return mapObj(src, transform, right);
}
/**
 * A more versatile alternative to native "flatMap" method, flattens first level items
 *
 * @param {Array|Object|String|NodeList|HTMLCollection} src - source
 * @param {Function|Array|Object} [transform] - transformer function
 * @returns {Array|Object|String}
 */


function flatMap(src, transform) {
  let res;
  if (T.isStr(src)) res = "";else if (T.isArr(src)) res = [];else res = {};
  forEach(src, function (a, i) {
    let f;

    if (!!transform) {
      f = transform(a, i, src);
    } else {
      if (!T.isArr(res) && T.isObj(res)) {
        f = {};
        f[i] = a;
      } else {
        f = a;
      }
    }

    res = concat(res, f);
  });
  return res;
}
/**
 * A more versatile alternative to native "reduce" method
 *
 * @param {any} src - source
 * @param {Function|Array|Object} func - reducer function
 * @param {any} [acc] - accumulator
 * @returns {any}
 */


function reduce(src, func, acc = src) {
  if (T.isUnd(func)) {
    func = (rs, v) => rs + v;
  }

  forEach(src, (v, k, src) => {
    acc = func(acc, v, k, src);
  });
  return acc;
}
/**
 * {@link reduce} in reverse
 * @see reduce
 * @param {any} src - source
 * @param {Function|Array|Object} func - reducer function
 * @param {any} [acc] - accumulator
 * @returns {any}
 */


function reduceRight(src, func, acc = src) {
  forEachRight(src, (v, k, src) => {
    acc = func(acc, v, k, src);
  });
}
/**
 * Randomly shuffle array's items
 * @param {ArrayLike} arrayLike
 */


function shuffle(arrayLike) {
  return Array.prototype.sort.call(arrayLike, () => Math.random() - 0.5);
}
/**
 * Sort array ascending with optional field parameter
 * @param {ArrayLike} arrayLike
 * @param {Function} [fieldFn]
 * @param {String} [locale]
 */


function sortAsc(arrayLike, fieldFn, locale = 'en') {
  let compare = fieldFn ? function (a, b) {
    return ('' + fieldFn(a)).localeCompare('' + fieldFn(b), locale);
  } : undefined;
  return Array.prototype.sort.call(arrayLike, compare);
}
/**
 * Sort array descending with optional field parameter
 * @param {ArrayLike} arrayLike
 * @param {Function} [fieldFn]
 * @param {String} [locale]
 */


function sortDesc(arrayLike, fieldFn, locale = 'en') {
  let compare = fieldFn ? function (a, b) {
    return ('' + fieldFn(b)).localeCompare('' + fieldFn(a), locale);
  } : undefined;
  return Array.prototype.sort.call(arrayLike, compare);
}
/**
 * Extract single key-value pairs from object
 *
 * @param object
 * @return {Object[]}
 */


function keyValuePairs(object) {
  let entries = [];
  forEach(object, (v, k) => {
    entries.push(T.dict(k, v));
  });
  return entries;
}
/**
 * Like Object.entries extracts key-value pairs as [[key1,value1],[key2,value2],...]
 *
 * @param {Object} object
 * @return {Array[]}
 */


function entries(object) {
  let entries = [];
  forEach(object, (v, k) => {
    entries.push([k, v]);
  });
  return entries;
}
/**
 * Translate(rename) object fields using dict parameter, omitting undefined keys
 * @param {Object} source
 * @param {Object|Array} dict
 * @return {Array|Object|String}
 */


function translateObject(source, dict) {
  if (T.isArr(dict)) {
    filter(source, dict);
  }

  const keys = Object.keys(dict);
  let res = filter(source, keys);

  for (let key of keys) {
    res[dict[key]] = res[key];
    delete res[key];
  }

  return res;
}
/**
 * Recursive deep merge {@param target} with {@param source}
 *
 * @param {Object|Array} target
 * @param {Object|Array} source
 * @param {Array} excludeKeys - keys to be skipped while merging
 * @param maxDepth - maximum recursive depth
 * @param allowUnsafeProps - allow unsafe properties like __proto__
 * @return {Object|Array}
 */


function deepMerge(target, source, {
  excludeKeys = [],
  maxDepth = 999,
  allowUnsafeProps = false
} = {
  excludeKeys: [],
  maxDepth: 999,
  allowUnsafeProps: false
}, depth = 0) {
  if (depth >= maxDepth) return target;
  forEach(source, (v, k) => {
    if (excludeKeys && contains(excludeKeys, k)) return;
    if (allowUnsafeProps && contains(UNSAFE_PROPS, k)) return;

    if (T.isObj(source[k])) {
      target[k] = deepMerge(emptyOf(source[k]), source[k], {
        excludeKeys,
        maxDepth,
        depth: depth + 1
      });
    } else target[k] = v;
  });
  return target;
}
/**
 * Recursive deep clone {@param source}
 * @see deepMerge
 *
 * @param {Object|Array} source
 * @param {Array} excludeKeys - keys to be skipped while merging
 * @param {Number} [maxDepth] - maximum recursive depth
 * @param {boolean} [allowUnsafeProps] - allow unsafe properties like __proto__
 * @return {Object|Array}
 */


function deepClone(source, {
  excludeKeys = [],
  maxDepth = 999,
  allowUnsafeProps = false
} = {
  excludeKeys: [],
  maxDepth: 999,
  allowUnsafeProps: false
}) {
  return deepMerge(emptyOf(source), source, {
    excludeKeys,
    maxDepth,
    allowUnsafeProps
  });
}

function _keyGen(key, fnName) {
  let keyGen = key;

  if (T.isStr(key)) {
    keyGen = item => item[key];
  } else if (T.isArr(key)) {
    keyGen = item => reduce(item, (res, v, k) => {
      if (contains(key, k)) {
        return res + v;
      }
    }, "");
  } else if (!T.isFun(key)) {
    throw Error(`${fnName} key only accepts: String, [String,...], Function`);
  }

  return keyGen;
}
/**
 * Join arrays of objects based on a generated or static key
 *
 * @param {Function|String} key
 * @param {Object[]} lists
 * @return {Object}
 */


function join(key, ...lists) {
  if (lists.length === 0) return [];
  if (!all(lists, T.isArr)) throw Error("Join only accepts arrays of data!");

  let keyGen = _keyGen(key, "Join");

  const joined = {};
  forEach(lists, list => {
    forEach(list, item => {
      const joinKey = keyGen(item);
      const presentValue = joined[joinKey];

      if (!presentValue) {
        joined[joinKey] = item;
      } else {
        joined[joinKey] = concat(presentValue, item);
      }
    });
  });
  return joined;
}
/**
 * Group arrays based on generated or static key(s)
 *
 * @param {Function|String} key
 * @param {Object[]} lists
 * @return {Object}
 */


function groupBy(key, ...lists) {
  if (lists.length === 0) return {};
  if (!all(lists, T.isArr)) throw Error("GroupBy only accepts arrays of data!");

  let keyGen = _keyGen(key, "GroupBy");

  const group = {};
  forEach(lists, list => {
    forEach(list, item => {
      const joinKey = keyGen(item);
      const presentValue = group[joinKey];

      if (!presentValue) {
        group[joinKey] = [item];
      } else {
        group[joinKey] = concat(presentValue, item);
      }
    });
  });
  return group;
} // noinspection JSUnusedGlobalSymbols


module.exports = {
  ANY,
  ALL,
  BREAK,
  item,
  contains,
  add,
  remove,
  toggle,
  concat,
  emptyOf,
  objMatchOne,
  objMatchAll,
  deepMerge,
  deepClone,
  forN,
  forEachRange,
  forEach,
  forEachRight,
  firstIndex,
  first,
  startsWith,
  lastIndex,
  last,
  endsWith,
  reverse,
  any,
  all,
  filter,
  filterRight,
  reduce,
  reduceRight,
  map,
  flatMap,
  keyValuePairs,
  entries,
  maxIndex,
  max,
  minIndex,
  min,
  shuffle,
  sortAsc,
  sortDesc,
  translateObject,
  omit,
  join,
  groupBy,
  objectValues
};
},{"./types":"5jEMv"}],"6wQPW":[function(require,module,exports) {
/**
 * @module DOM
 * @memberOf dom
 */
const scope = require("../core/scope");

const {
  isArr,
  hasField,
  isEmpty
} = require("../core/types");

const {
  contains,
  forEach,
  filter
} = require("../core/collections");

const {
  error
} = require("../core/logging");

const {
  funcBodyEquals
} = require("../core/functions");
/**
 * Set listener for event type(s) on element, removes identical event listeners to avoid duplication
 *
 * @param {HTMLElement|Element|Node} target - target element
 * @param {String|Array} event - event type(s)
 * @param {Function} listener
 * @param {AddEventListenerOptions?} [options]
 */


function setEvent(target, event, listener, options) {
  if (!scope.isBrowser()) {
    error("Events are browser only!");
    return;
  }

  if (!isArr(event)) {
    if (contains(event, ' ')) {
      event = event.split(' ').Map(it => it.trim());
    } else event = [event];
  }

  target.__EVENTS__ = target.__EVENTS__ || {};
  forEach(event, ev => {
    target.__EVENTS__[ev] = target.__EVENTS__[ev] || [];

    let f = function (e) {
      listener(e, target);
    };

    if (!hasField(options, 'duplicates', a => a)) {
      target.__EVENTS__[ev] = filter(target.__EVENTS__[ev], fl => {
        if (funcBodyEquals(fl.l, listener)) {
          target.removeEventListener(ev, fl.f, fl.o);
          return false;
        } else {
          console.log('notEqual', fl.l.toString(), listener.toString());
        }
      });
    }

    target.__EVENTS__[ev].push({
      f: f,
      l: listener,
      o: options
    });

    target.addEventListener(ev, f, options);
  });
}
/**
 * Clear all event listeners of type from element
 *
 * @param {HTMLElement|Element|Node} target - target element
 * @param {String|Array} event - event type(s)
 */


function clearEvent(target, event) {
  if (!scope.isBrowser()) {
    error("Events are browser only!");
    return;
  }

  if (!isArr(event)) {
    if (contains(event, ' ')) {
      event = event.split(' ').Map(it => it.trim());
    } else event = [event];
  }

  target.__EVENTS__ = target.__EVENTS__ || {};
  if (isEmpty(target.__EVENTS__)) return;
  forEach(event, function (ev) {
    target.__EVENTS__[ev] = target.__EVENTS__[ev] || [];
    if (isEmpty(target.__EVENTS__[ev])) return;
    forEach(target.__EVENTS__[ev], fl => {
      target.removeEventListener(ev, fl.f, fl.o);
      return false;
    });
    target.__EVENTS__[ev] = [];
  });
}
/**
 * Target has event listener for event type
 *
 * @param {HTMLElement|Element|Node} target - target element
 * @param {String} type - event type
 * @return {boolean}
 */


function hasEvent(target, type) {
  return target.__EVENTS__ && target.__EVENTS__[type] && !isEmpty(target.__EVENTS__[type]);
}

module.exports = {
  setEvent,
  clearEvent,
  hasEvent
};
},{"../core/scope":"7A8qL","../core/types":"5jEMv","../core/collections":"5lqP4","../core/logging":"2ERs7","../core/functions":"45TqM"}],"7A8qL":[function(require,module,exports) {
var global = arguments[3];

/**
 * Merges an object with global namespace
 * @private
 * @param {Object} obj
 */
function setGlobal(obj) {
  for (let key of Object.keys(obj)) {
    global[key] = obj[key];
  }
}
/**
 * Code generator for prototype modification, used in polyfills
 */


class Extension {
  /**
   * @constructor
   * @param {any[]} types - Array of prototypes
   */
  constructor(types) {
    this.types = types;
    this.types = [];
    /** Generated code */

    this.pcode = "\n";
  }
  /**
   * Defines a new function for given prototypes
   *
   * @param {Function} namedFunc A named function
   * @return {string}
   */


  define(namedFunc) {
    if (!namedFunc.name) {
      let err = `Function must have a name [Extension.define(f)]\n<<${namedFunc}>>`;
      console.error(err);
      return `\n/**\n *${err}\n */`;
    }

    let code = "\n";

    for (let p of this.types) {
      if (p !== undefined) code += `${p.name || p}.prototype.${namedFunc.name} = `;
    }

    code += namedFunc.toString() + ";\n";
    this.pcode += code;
    return code;
  }

  polyfill(namedFunc) {
    if (!namedFunc.name) {
      let err = `Extension function must have a name:\n<<${namedFunc}>>`;
      console.error(err);
      return `\n/**\n *${err}\n */`;
    }

    let code = "\n";

    for (let p of this.types) {
      code += `if (${p.name || p}.prototype.${namedFunc.name} === undefined) ${p.name || p}.prototype.${namedFunc.name} = ${namedFunc.toString()};\n`;
    }

    this.pcode += code;
  }

}

function isBrowser() {
  return global.window !== undefined && global.document !== undefined && global.navigator !== undefined;
}

if (!isBrowser()) {
  // -------------
  global.HTMLElement = !global.HTMLElement ? function HTMLElement() {} : global.HTMLElement;
  global.Element = !global.Element ? function Element() {} : global.Element;
  global.Node = !global.Node ? function Node() {} : global.Node;
  global.HTMLCollection = !global.HTMLCollection ? function HTMLCollection() {} : global.HTMLCollection;
  global.NodeList = !global.NodeList ? function NodeList() {} : global.NodeList; // -------------
}

module.exports = {
  setGlobal,
  Extension,
  isBrowser
};
},{}],"45TqM":[function(require,module,exports) {
/**
 * @module
 * @memberOf core
 */
function bodyOf(func) {
  return func.toString().match(/{[\w\W]*}/)[0];
}
/**
 * Check if function bodies are equal
 * @param {Function} f1
 * @param {Function} f2
 * @return {boolean}
 */


function funcBodyEquals(f1, f2) {
  return bodyOf(f1) === bodyOf(f2);
}
/**
 * Throttle function execution.
 * {@link https://css-tricks.com/debouncing-throttling-explained-examples/}
 *
 * @param {Function} func - function
 * @param {Number} intervalMs
 * @return {Function} - throttled function
 */


function throttle(func, intervalMs) {
  var ___last___ = new Date().getTime();

  function throttled(args) {
    if (new Date().getTime() - ___last___ >= intervalMs) {
      ___last___ = new Date().getTime();
      func.call(this, args);
    }
  }

  return throttled;
}
/**
 * Debounce function execution.
 * {@link https://css-tricks.com/debouncing-throttling-explained-examples/}
 *
 * @param {Function} func - function
 * @param {Number} afterMs - milliseconds after last call
 * @return {Function} - debounced function
 */


function debounce(func, afterMs) {
  var ___timeout___ = null;

  function debounced(...args) {
    clearTimeout(___timeout___);
    ___timeout___ = setTimeout(function (_this) {
      return func.apply(_this, args);
    }, afterMs, this);
  }

  debounced.flush = function (...args) {
    clearTimeout(___timeout___);
    return func.apply(this, args);
  };

  return debounced;
}
/**
 * Bind args to function and return a no-arg function
 * @param {Function} func - source function
 * @param {any[]} args - array of arguments to bind
 * @return {Function}
 */


function bindArgs(func, args) {
  return function () {
    return func.apply(this, args);
  };
}

function once(func) {
  var called = false;
  return function () {
    if (!called) {
      called = true;
      return func.apply(this, arguments);
    }
  };
}

module.exports = {
  funcBodyEquals,
  throttle,
  debounce,
  bindArgs,
  once
};
},{}],"1Xb8X":[function(require,module,exports) {
const {
  kebab
} = require("../core/cases");

const {
  forEach
} = require("../core/collections");

function generateStyles(jss) {
  let styles = [];
  forEach(jss, (val, prop) => {
    styles.push(`${kebab(prop)}: ${val};`);
  });
  return styles;
}

function generateCss(jss, joinWith = '\n') {
  return generateStyles(jss).sort((a, b) => a[0].localeCompare(b[0])).join(joinWith);
}

module.exports = {
  generateStyles,
  generateCss
};
},{"../core/cases":"3AZSM","../core/collections":"5lqP4"}],"3AZSM":[function(require,module,exports) {
/**
 * @module
 * @memberOf core
 */

/**
 * @static
 * @param name
 * @returns {string}
 */
function kebab(name) {
  let kb = "";
  let pres = false;

  for (let i = 0; i < name.length; i++) {
    let c = name.charAt(i);

    if (c === '_') {
      kb += '-';
      pres = true;
      continue;
    }

    if (c >= 'A' && c <= 'Z') {
      if (i > 0 && !pres) {
        kb += '-';
      }
    }

    kb += c.toLowerCase();
    pres = false;
  }

  return kb;
}
/**
 * @static
 * @param name
 * @returns {string}
 */


function snake(name) {
  let snk = "";
  let pres = false;

  for (let i = 0; i < name.length; i++) {
    let c = name.charAt(i);

    if (c === '-') {
      snk += '_';
      pres = true;
      continue;
    }

    if (c >= 'A' && c <= 'Z') {
      if (i > 0 && !pres) {
        snk += '_';
      }
    }

    snk += c.toLowerCase();
    pres = false;
  }

  return snk;
}
/**
 * @static
 * @param name
 * @returns {string}
 */


function camel(name) {
  let cml = "";
  let pres = false;

  for (let i = 0; i < name.length; i++) {
    let c = name.charAt(i);

    if (c === '-' || c === '_') {
      pres = true;
    } else if (pres === true) {
      cml += c.toUpperCase();
      pres = false;
    } else {
      if (i === 0) {
        cml += c.toLowerCase();
      } else {
        cml += c;
      }
    }
  }

  return cml;
}
/**
 * @static
 * @param name
 * @returns {string}
 */


function pascal(name) {
  let psc = "";
  let pres = false;

  for (let i = 0; i < name.length; i++) {
    let c = name.charAt(i);

    if (c === '-' || c === '_') {
      pres = true;
    } else if (pres === true) {
      psc += c.toUpperCase();
      pres = false;
    } else {
      if (i === 0) {
        psc += c.toUpperCase();
      } else {
        psc += c;
      }
    }
  }

  return psc;
}

module.exports = {
  kebab,
  camel,
  pascal,
  snake
};
},{}],"5Hexf":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vm = _interopRequireDefault(require("../../vm"));

var _List = _interopRequireDefault(require("./List"));

var _mystore = require("./mystore");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = _vm.default.createComponent('App', {
  click() {
    _mystore.store.dispatch({
      type: 'inc'
    }); // this.state.x++


    this.$isDirty = true;
    this.$update();
  },

  render() {
    return _vm.default.jsx("div", null, _vm.default.jsx("h1", {
      onClick: this.click
    }, "Header"), JSON.stringify(_mystore.store.getState()), _vm.default.jsx("div", {
      id: 'container'
    }, _vm.default.jsx("div", null, "Items Header")), _vm.default.jsx(_List.default, {
      step: 1500
    }));
  }

});

exports.default = _default;
},{"../../vm":"4U4fI","./List":"6J0mp","./mystore":"6evsB"}],"4U4fI":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.jsx = exports.createComponent = void 0;

var _view = _interopRequireDefault(require("./view"));

var _vnode = _interopRequireDefault(require("./vnode"));

var _mount = _interopRequireDefault(require("./mount"));

var _hscriptMinimal = _interopRequireDefault(require("./hscript-minimal"));

var _render = require("./render");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var global = arguments[3];

/**
 * @type {function(*, *=): View}
 */
const createComponent = _view.default.create;
/**
 * @type {function(*, *=): [VNode]}
 */

exports.createComponent = createComponent;
const jsx = _vnode.default.create;
/**
 * @type {function(*, *=)}
 */

exports.jsx = jsx;
global.Exir = {
  View: _view.default,
  VNode: _vnode.default,
  jsx,
  mount: _mount.default,
  createComponent,
  render: _render.renderDom
};
global.v = { ..._hscriptMinimal.default,
  jsx,
  h: jsx
};
var _default = {
  createComponent,
  jsx,
  mount: _mount.default
};
exports.default = _default;
},{"./view":"6X1e2","./vnode":"2IfjJ","./mount":"NxZhw","./hscript-minimal":"13si2","./render":"5dh0s"}],"6X1e2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vnode = _interopRequireWildcard(require("./vnode"));

var _collections = require("../core/collections");

var _functions = require("../core/functions");

var _util = require("./util");

var _patch = require("./patch");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// import { error, info, showError, showInfo} from "../core/logging";
function View(opt = {}, construct = opt) {
  this.$type = _vnode.NodeType.VIEW; // derived class

  this.$name = this.constructor.name;
  this.$isView = true;
  this.$nodes = undefined;
  this.$isDirty = true;
  this.$raw = true;
  this.$constructor = construct;
  let cons = Object.getOwnPropertyNames(this.$constructor);

  for (let i = 0; i < cons.length; i++) {
    const prop = cons[i];

    if (this.$constructor[prop] instanceof Function) {
      this[prop] = this.$constructor[prop];
    } else {
      this[prop] = (0, _collections.deepClone)(this.$constructor[prop]);
    }
  }

  Object.defineProperty(this, '$update', {
    value: (0, _functions.debounce)(() => {
      this.$isDirty = true;

      if (window.requestAnimationFrame) {
        requestAnimationFrame(() => {
          if (!this.$isDirty) return;
          (0, _patch.updateViewRoot)(this);
        });
      } else {
        (0, _patch.updateViewRoot)(this);
      } // console.log('done')

    }, 20),
    enumerable: false,
    configurable: false,
    writable: false
  });
}

View.create = function (name, opt) {
  let c = new View(opt);
  if (!opt.render) console.warn("render method is not defined");
  c.$name = name;
  return c;
};

View.prototype.$createInstance = function (props, children) {
  const construct = this.$constructor;
  const name = this.$name;
  let inst = new View(construct, construct);
  inst.$name = name;
  inst.$instanceId = (0, _util.randomId)();
  inst.$isDirty = true;
  return inst.$updateInstance(props, children);
};

View.prototype.$updateInstance = function (props, children, parent) {
  if (!this.props) this.props = {};

  if (props) {
    (0, _collections.concat)(this.props, props, true);
  }

  if (children) children = _vnode.default.normalizeNodes(children, undefined, this, true);
  this.$children = children;
  this.$instanceId = (0, _util.randomId)();
  this.$isDirty = true;
  return this;
};

View.prototype.$render = function (parent, view, initial = true) {
  if (initial && !this.$raw) return this;
  let rendered = this.render();

  if (rendered.length === 0) {
    rendered = [_vnode.default.create('slot', {})];
  }

  View.$setNodes(this, rendered, true); // if (this.$empty) {
  //     View.$setNodes(this, [VNode.create('slot')], false)
  // }

  this.$parent = parent;
  this.$view = view;
  this.$raw = false;
  return this;
};

View.$setNodes = function (view, nodes, normalize) {
  if (nodes.length === 0) nodes = [_vnode.default.createTag('slot')];
  if (normalize) view.$nodes = _vnode.default.normalizeNodes(nodes, view, view, true);else view.$nodes = nodes;
  view.$count = view.$nodes.length;

  if (!(view.$empty = view.$count === 0)) {
    view.$first = view.$nodes[0];
  }

  if (view.$count === 1) {
    view.$single = true;
  }
}; //
// View.$resetNodes = function (view, nodes) {
//     view.$nodes = VNode.normalizeNodes(nodes, view, view,true)
//     view.$count = view.$nodes.length
//     if ((view.$empty = view.$count) !== 0) {
//         view.$first = view.$nodes[0]
//     }
//     if (view.$count === 1) {
//         view.$single = true
//     }
//     return nodes
// }


View.prototype.shouldUpdate = function (newProps) {
  return this.$isDirty || !(0, _util.sameProps)(this.props, newProps);
};

View.prototype.$removeDom = function () {
  if (this.$single) return this.$element.remove();
  this.$nodes.forEach(n => n.$removeDom());
};

View.prototype.$update = (0, _functions.debounce)(function () {
  this.$isDirty = true;
  console.log('UPDATING', this);
}, 20);

View.prototype.$renderDom = function (targetElement) {
  for (let i = 0; i < this.$count; i++) {
    targetElement.append(this.$nodes[i].$renderDom());
  }
};

View.prototype.$clone = function (parent, view) {
  let cl = this.$createInstance((0, _collections.deepClone)(this.props), this.$children.map(ch => ch.$clone()));
  return cl.$render(parent, view || cl);
};

View.prototype.$serialize = function () {
  return (0, _collections.deepClone)(this, {
    excludeKeys: ['$parent', '$first', '$view', '$element', '$rootElement']
  });
};

var _default = View;
exports.default = _default;
},{"./vnode":"2IfjJ","../core/collections":"5lqP4","../core/functions":"45TqM","./util":"1LTPD","./patch":"OwvVt"}],"2IfjJ":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.NodeType = void 0;

var _types = require("../core/types");

var _collections = require("../core/collections");

var _util = require("./util");

var _view = _interopRequireDefault(require("./view"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var global = arguments[3];
// import View from "./view";
const NodeType = {
  VNODE: 0,
  VIEW: 1,
  TEXT: 2
};
exports.NodeType = NodeType;

function VNode(tag, props = {}, nodes) {
  this.$type = NodeType.VNODE;
  this.$tag = tag;

  if (tag === null) {
    this.$frag = true;
  } else {
    if (tag === '#text') {
      this.$isText = true;
      this.$text = props;
      return;
    }

    this.$isNode = true;
    let compiled = VNode.compileProps(props);
    this.events = compiled.events;
    this.attrs = compiled.attrs;
    this.$element = undefined;
  }

  this.$raw = true; // this.$nodes = nodes

  this.$resetNodes(nodes);
}

VNode.create = function (type, props = {}, ...nodes) {
  if (props === null) props = {};
  if (type === null) return new VNode(type, props, nodes); // View class instance

  if (type.$isView) {
    // error(,nodes)
    return type.$createInstance(props, nodes);
  } // View class


  if (type.$type === NodeType.VIEW) {
    // error('update')
    return new type().$updateInstance(props, nodes);
  }

  if (!type.$type && type instanceof Function) {
    console.log('func', type);
    return _view.default.create(type.name, {
      render: type
    }).$createInstance(props, nodes);
  } // create VNode instance


  return VNode.createTag(type, props, nodes);
};

VNode.compileProps = function (props) {
  const cats = {
    events: {},
    attrs: {}
  };
  (0, _collections.forEach)(props, (v, k) => {
    if ((0, _util.isEventPropKey)(k)) cats.events[(0, _util.normalizeEventName)(k)] = v;else cats.attrs[k] = v;
  });
  return cats;
};

VNode.createText = function (text) {
  return new VNode('#text', text);
};

VNode.createTag = function (tag, props, nodes) {
  return new VNode(tag, props, nodes);
};

VNode.prototype.$render = function (parent, view) {
  this.$parent = parent;
  this.$view = view;

  for (let i = 0; i < this.$count; i++) {
    let curNode = this.$nodes[i];

    if (curNode.$isText) {
      curNode.$parent = this;
    } else {
      try {
        curNode = curNode.$render(this, view);
      } catch (e) {
        console.log(e, curNode);
      }
    }
  }

  this.$raw = false;
  return this;
};

VNode.prototype.$resetNodes = function (nodes) {
  try {
    this.$nodes = VNode.normalizeNodes(nodes);
  } catch (e) {
    console.log(e, this.$nodes);
  }

  this.$count = this.$nodes.length;

  if (!(this.$empty = this.$count === 0)) {
    this.$first = this.$nodes[0];
  } else if (this.$count === 1) {
    this.$single = true;
  }
};

VNode.prototype.$removeDom = function () {
  try {
    this.$element.remove();
  } catch (e) {}
};

VNode.normalizeNodes = function (nodes = [], parent, view, render = false) {
  let normalizedNodes = []; // console.error(parent, nodes)

  if (!(nodes instanceof Array)) nodes = [nodes];

  for (let i = 0; i < nodes.length; i++) {
    let node = nodes[i]; // replace text

    if ((0, _types.isStr)(node) || (0, _types.isNum)(node)) {
      let n = VNode.createText("" + node);
      n.$parent = parent;
      normalizedNodes.push(n); // pass View

      continue;
    }

    if (node.$isView) {
      normalizedNodes.push(render ? node.$render(parent, node) : node);
      continue;
    }

    if (node.$frag) node = node.$nodes; // flatten array or non-view fragment

    if (node instanceof Array) {
      for (let j = 0; j < node.length; j++) {
        let nj = node[j];

        if (!nj.$isView && nj instanceof Function) {
          nj = _view.default.create(nj.name, {
            render: nj
          });
        }

        normalizedNodes.push(render ? nj.$render(parent, view) : nj);
      }
    } else {
      if (!node.$isView && node instanceof Function) {
        node = _view.default.create(node.name, {
          render: node
        });
      }

      normalizedNodes.push(render ? node.$render(parent, view) : node);
    }
  }

  return normalizedNodes;
};

VNode.prototype.$clone = function (parent, view) {
  let cl = VNode.createTag(this.$tag, {
    attrs: (0, _collections.deepClone)(this.attrs),
    events: this.events
  }, this.$nodes.map(n => n.$clone()));
  return cl.$render(parent, view);
};

global.VNode = VNode;
var _default = VNode;
exports.default = _default;
},{"../core/types":"5jEMv","../core/collections":"5lqP4","./util":"1LTPD","./view":"6X1e2"}],"1LTPD":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isEventPropKey = isEventPropKey;
exports.normalizeEventName = normalizeEventName;
exports.randomId = randomId;
exports.compileProps = compileProps;
exports.compileStyles = compileStyles;
exports.sameProps = sameProps;

var _core = require("../core");

var _jss = _interopRequireDefault(require("./jss"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isEventPropKey(key) {
  return /on[A-Z]+/.test(key);
}

function normalizeEventName(eventName) {
  return eventName.slice(2).toLowerCase();
}

function randomId() {
  return Date.now().toString(24).slice(2) + Math.random().toString(24).slice(6);
}

function compileProps(props) {
  const cats = {
    events: {},
    attrs: {}
  };
  (0, _core.forEach)(props, (v, k) => {
    if (isEventPropKey(k)) cats.events[normalizeEventName(k)] = v;else cats.attrs[k] = v;
  });
  return cats;
}

function compileStyles(styles, joinWith) {
  if (!(0, _core.isVal)(styles)) return '';else if ((0, _core.isStr)(styles)) return styles;else if ((0, _core.isArr)(styles)) return styles.join(joinWith);
  return _jss.default.generateCss(styles, joinWith);
}

function sameProps(currentProps = {}, newProps = {}) {
  const curKeys = Object.keys(currentProps);
  const newKeys = Object.keys(newProps);
  if (curKeys.length !== newKeys.length) return false;

  for (let curKey of curKeys) {
    if (newProps[curKey] !== currentProps[curKey]) return false;
  }

  return true;
}
},{"../core":"2YQJM","./jss":"1Xb8X"}],"2YQJM":[function(require,module,exports) {
let collections = require('./collections');

let logging = require('./logging');

let types = require('./types');

let cases = require('./cases');

let strings = require('./strings');

let queryable = require('./queryable');

let functions = require('./functions');

module.exports = { ...collections,
  ...logging,
  ...types,
  ...cases,
  ...strings,
  ...queryable,
  ...functions
};
/**
 * @namespace core
 */
},{"./collections":"5lqP4","./logging":"2ERs7","./types":"5jEMv","./cases":"3AZSM","./strings":"5SvYH","./queryable":"6Froq","./functions":"45TqM"}],"5SvYH":[function(require,module,exports) {
const decimalRegex = /^[-+]?\d*(\.\d+|\d*)(e[-+]?\d+)?$/;
const hexRegex = /^[-+]?[a-f0-9]+$/;
const octRegex = /^[-+]?[0][0-7]+$/;
const binRegex = /^[-+]?[01]+$/;
const emailRegex = /^[a-z0-9]([a-z0-9._%-+][a-z0-9]|[a-z0-9])*@[a-z0-9]([a-z0-9.-][a-z0-9]|[a-z0-9])*\.[a-z]{2,6}$/i;
/**
 * @module core/strings
 * @memberOf core
 */

/**
 * String is decimal number
 * @param {String} str
 * @return {boolean}
 */

function isDecimal(str) {
  return decimalRegex.test(str);
}
/**
 * String is binary number
 * @param {String} str
 * @return {boolean}
 */


function isBinary(str) {
  return binRegex.test(str);
}
/**
 * String is octal number
 * @param {String} str
 * @return {boolean}
 */


function isOctal(str) {
  return octRegex.test(str);
}
/**
 * String is hexadecimal number
 * @param {String} str
 * @return {boolean}
 */


function isHex(str) {
  return hexRegex.test(str);
}
/**
 * String is valid email address
 * @param {String} str
 * @return {boolean}
 */


function isEmail(str) {
  return emailRegex.test(str);
}
/**
 * String starts with sequence polyfill
 * @param {String} str
 * @param {String} seq
 * @return {boolean}
 */


function startsWith(str, seq) {
  return str.indexOf(seq) === 0;
}
/**
 * String ends with sequence polyfill
 * @param {String} str
 * @param {String} seq
 * @return {boolean}
 */


function endsWith(str, seq) {
  return str.indexOf(seq) === seq.length - 1;
}
/**
 * String contains sequence
 * @param {String} str
 * @param {String} seq
 * @return {boolean}
 */


function contains(str, seq) {
  return str.indexOf(seq) >= 0;
}

module.exports = {
  isDecimal,
  isHex,
  isOctal,
  isBinary,
  isEmail,
  startsWith,
  endsWith,
  contains
};
},{}],"6Froq":[function(require,module,exports) {
const T = require("./types");

class Queryable {
  constructor() {
    this.__src__ = undefined;
    this.keys = undefined;
  }

  get count() {
    return this.keys.length;
  }

  static of(s) {
    let c = new Queryable();
    c.__src__ = s;
    c.keys = Object.keys(s);
    c.len = c.keys.length;
    return c;
  }

  slice(start = 0, end = this.count - 1) {
    this.keys = this.keys.slice(start, end);
  }

  key(i = 0) {
    return this.keys[i];
  }

  value(i = 0) {
    return this.__src__[this.key(i)];
  }

  loop(f, reverse = false) {
    if (reverse) {
      for (let i = this.count - 1; i >= 0; i--) {
        if (f(this.value(i), this.key(i), i) === null) break;
      }
    } else {
      for (let i = 0; i < this.count; i++) {
        if (f(this.value(i), this.key(i), i) === null) break;
      }
    }

    return this;
  }

  values(reverse = false) {
    let vs = [];
    this.loop(function (v, k, i) {
      vs.push(v);
    }, reverse);
    return vs;
  }

  item(i) {
    if (i === undefined) return undefined;
    if (T.isArr(this.__src__)) return this.value(i);
    let o = {};
    o[this.key(i)] = this.value(i);
    return o;
  }

  asObject() {
    // if (T.isArr(this.__src__)) return this.values();
    let o = {};
    this.loop(function (v, k, i) {
      o[k] = v;
    });
    return o;
  }

  asArray(reverse = false) {
    return this.values(reverse);
  }

  filter(f, reverse = false) {
    let nk = [];
    this.loop(function (v, k, i) {
      let r = f(v, k, i);

      if (r === true) {
        nk.push(k);
      } else if (r === null) return null;
    }, reverse);
    this.keys = nk;
    return this;
  }

  map(f, reverse = false) {
    let arr = [];
    this.loop(function (v, k, i) {
      arr.push(f(v, k, i));
    }, reverse);
    return arr;
  }

  any(f) {
    let r = false;
    this.loop(function (v, k, i) {
      r = f(v, k, i);

      if (r === true) {
        return null;
      }
    });
    return r;
  }

  all(f) {
    let r = true;
    this.loop(function (v, k, i) {
      r = f(v, k, i);

      if (r === false) {
        return null;
      }
    });
    return r;
  }

  first(f) {
    if (!f) {
      return this.item(0);
    }

    let it;
    this.loop(function (v, k, i) {
      if (f(v, k, i) === true) {
        it = i;
        return null;
      }
    });
    return this.item(it);
  }

  last(f) {
    if (!f) {
      return this.item(this.count - 1);
    }

    let it;
    this.loop(function (v, k, i) {
      if (f(v, k, i) === true) {
        it = i;
        return null;
      }
    }, true);
    return this.item(it);
  }

}

module.exports = {
  Queryable
};
},{"./types":"5jEMv"}],"OwvVt":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.updateViewRoot = updateViewRoot;
exports.isViewDirty = isViewDirty;
exports.patchNodes = patchNodes;

var _updateAttrs = require("./update-attrs");

var _render = _interopRequireWildcard(require("./render"));

var _view = _interopRequireDefault(require("./view"));

var _logging = require("../core/logging");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// import {sameProps} from "./util";
function updateViewRoot(view) {
  let newNodes = VNode.normalizeNodes(view.render.call(view), view, view, true); // console.log(newNodes)
  // console.log(newNodes, view.$nodes)
  // return

  patchNodes(view, newNodes, view.$rootElement);

  _view.default.$setNodes(view, newNodes, false);

  view.$isDirty = false;
}

function isViewDirty(view, props) {
  // return true
  if (view.$isView) {
    return view.shouldUpdate && view.shouldUpdate(props);
  } else return true;
}

function digElement(currentNode) {
  let element = undefined;

  if (currentNode.$element) {
    // info('Dug ', currentNode.$element, currentNode)
    return currentNode.$element;
  } else {
    let nodes = currentNode.$nodes;

    for (let i = 0; i < nodes.length; i++) {
      if (element) {
        nodes[i].$removeDom();
      } else {
        element = digElement(nodes[i]);
        if (element) nodes[i].$element = undefined;
      }
    }
  } // console.log('Digged ', element, currentNode)


  return element;
}

function patchNodes(current, newNodes, rootElement) {
  // info('PATCH NODES OF', current)
  // info('ROOT ELEMENT IS ', rootElement)
  let parentElement = current.$isNode ? current.$element : rootElement; // info('PARENT ELEMENT IS ', rootElement)

  let currentNodes = current.$nodes;
  let newLen = newNodes.length; // if (!parent.$nodes) console.trace(parent)

  let curLen = current.$nodes.length;
  let added = newLen >= curLen;
  let len = added ? curLen : newLen;
  let lastElement;
  let index = 0;

  for (; index < len; index++) {
    let curNode = currentNodes[index];
    let newNode = newNodes[index];

    if (newNode.$isText) {
      if (curNode.$isText && !newNode.$element) {
        // Text - Text
        // info('Text - Text', curNode.$text, newNode.$text)
        if (curNode.$text !== newNode.$text) {
          curNode.$element.textContent = newNode.$text;
        }

        newNode.$element = curNode.$element;
      } else {
        //info('Text - Not Text')
        // Text - VNode/View
        newNode.$element = document.createTextNode(newNode.$text);
        let curElement = digElement(curNode);
        parentElement.insertBefore(newNode.$element, curElement); // curElement.insertAdjacentElement('beforeBegin', newNode.$element)

        curElement.remove();
      }

      continue;
    }

    if (newNode.$isNode) {
      if (curNode.$isNode && curNode.$tag === newNode.$tag && !newNode.$element) {
        // VNode - VNode
        // info("VNode - VNode / tags equal", curNode.$element, newNode)
        (0, _updateAttrs.updateAttributes)(newNode.attrs, curNode.attrs, curNode.$element);
        newNode.$element = curNode.$element;
        newNode.$element.__node__ = newNode.$element;
        lastElement = newNode.$element;

        if (!newNode.$element) {
          (0, _logging.trace)('Regression: current node has no $element', curNode, newNode);
        } // VNode children


        patchNodes(curNode, newNode.$nodes, curNode.$element);
      } else {
        // VNode - Different
        // info("VNode - VNode - different Tags", curNode.$tag, newNode.$tag)
        let curElement = lastElement || digElement(curNode);
        if (!newNode.$element) newNode.$element = (0, _render.default)(newNode, curElement);else {
          (0, _logging.error)('NEW NODE HAS ELEMENT', newNode.$element);
        }

        if (!curElement) {
          // warn('NO CURRENT ELEMENT', newNode)
          rootElement.append(newNode.$element);
        } else {
          // info('insert ',newNode.$element.tagName, ' before ', curElement.tagName, ' parent ', rootElement)
          // parentElement.insertBefore(newNode.$element, curElement)
          // curElement.insertAdjacentElement('afterEnd', newNode.$element)
          parentElement.replaceChild(newNode.$element, curElement); // curElement.remove()
        }
      }

      lastElement = newNode.$element;
      continue;
    }

    if (newNode.$isView) {
      if (curNode.$isView && curNode.$name === newNode.$name) {
        // View - View
        // error('View - View')
        newNodes[index] = curNode;
        curNode.$parent = current;

        if (isViewDirty(curNode, newNode.props)) {
          // View is dirty -> update instance & patch nodes
          // apply new props & children
          curNode.$updateInstance(newNode.props, newNode.$children);
          updateViewRoot(curNode);
        }
      } else {
        // error('View - NOT View')
        // requestAnimationFrame(()=>{
        newNode.$nodes = (0, _render.renderDomView)(newNode, rootElement);
        let curElement = digElement(curNode); // info(curElement, newNode.$element)

        curElement.replaceWith(newNode.$element); // })
      }
    } else {
      (0, _logging.trace)('WTH is this?', newNode);
      throw Error('Illegal node');
    }
  }

  if (added) {
    // console.log('ADDING', curLen, newLen)
    if (newLen - index > 50) {
      // requestAnimationFrame(()=>{
      let ch = [];

      for (let i = index; i < newLen; i++) {
        let render = (0, _render.default)(newNodes[i], current.$rootElement);
        ch.push(render);
      }

      let temp = document.createElement('slot');
      temp.style.display = 'none'; // console.log(par)

      parentElement.append(temp);
      temp.replaceWith.apply(temp, ch); // })
    } else {
      for (let i = index; i < newLen; i++) {
        let render = (0, _render.default)(newNodes[i], current.$rootElement);
        parentElement.append(render);
      }
    }
  }

  if (curLen > newLen) {
    let nodes = current.$nodes; // info('REMOVING', curLen-newLen-1)

    for (let i = index; i < curLen; i++) {
      // info('REMOVE', nodes[i])
      nodes[i].$removeDom();
    }
  } // info('PARENT DONE', rootElement)

}
},{"./update-attrs":"5iBye","./render":"5dh0s","./view":"6X1e2","../core/logging":"2ERs7"}],"5iBye":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.compileStyles = compileStyles;
exports.updateAttributes = updateAttributes;

var _core = require("../core");

var _jss = _interopRequireDefault(require("./jss"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// import {compileStyles} from "../vm/util";
function compileStyles(styles, joinWith) {
  if (!(0, _core.isVal)(styles)) return '';else if ((0, _core.isStr)(styles)) return styles;else if ((0, _core.isArr)(styles)) return styles.join(joinWith);
  return _jss.default.generateCss(styles, joinWith);
}

function updateAttributes(newAttrs, currentAttrs, element) {
  const newKeys = Object.keys(newAttrs);
  const currentKeys = Object.keys(currentAttrs);
  const keys = Object.keys(newAttrs); // const len = keys.length
  // console.log(newAttrs, currentAttrs)

  for (let key of keys) {
    const newVal = newAttrs[key]; // if (currentKeys.indexOf(key) < 0) {
    //     element.setAttribute(key, newVal)
    // } else {

    const curVal = currentAttrs[key];

    if (key === 'style') {
      const newStyle = compileStyles(newVal, ' ');
      const currentStyle = compileStyles(curVal, ' ');

      if (newStyle !== currentStyle) {
        //     console.log()
        element.setAttribute('style', newStyle);
      }
    } else if (key === 'className') {
      element.setAttribute('class', newVal);
    } else {
      element.setAttribute(key, newVal);
    } // }

  }

  for (let key of currentKeys) {
    if (newKeys.indexOf(key) < 0) {
      element.removeAttribute(key);
    }
  }
}
},{"../core":"2YQJM","./jss":"1Xb8X"}],"13si2":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.a = a;
exports.abbr = abbr;
exports.address = address;
exports.aside = aside;
exports.b = b;
exports.bdi = bdi;
exports.bdo = bdo;
exports.blockquote = blockquote;
exports.br = br;
exports.button = button;
exports.caption = caption;
exports.code = code;
exports.col = col;
exports.colgroup = colgroup;
exports.div = div;
exports.em = em;
exports.embed = embed;
exports.fieldset = fieldset;
exports.footer = footer;
exports.form = form;
exports.h1 = h1;
exports.h2 = h2;
exports.h3 = h3;
exports.h4 = h4;
exports.h5 = h5;
exports.h6 = h6;
exports.header = header;
exports.hgroup = hgroup;
exports.hr = hr;
exports.i = i;
exports.img = img;
exports.input = input;
exports.label = label;
exports.li = li;
exports.mark = mark;
exports.nav = nav;
exports.ol = ol;
exports.optgroup = optgroup;
exports.option = option;
exports.p = p;
exports.pre = pre;
exports.progress = progress;
exports.q = q;
exports.s = s;
exports.section = section;
exports.select = select;
exports.small = small;
exports.span = span;
exports.strong = strong;
exports.sub = sub;
exports.sup = sup;
exports.table = table;
exports.tbody = tbody;
exports.td = td;
exports.textarea = textarea;
exports.tfoot = tfoot;
exports.th = th;
exports.thead = thead;
exports.tr = tr;
exports.u = u;
exports.ul = ul;
exports.default = void 0;

var _vnode = _interopRequireDefault(require("../vm/vnode"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const e = _vnode.default.create;

function a(args, ...children) {
  return e('a', args, ...children);
}

function abbr(args, ...children) {
  return e('abbr', args, ...children);
}

function address(args, ...children) {
  return e('address', args, ...children);
}

function aside(args, ...children) {
  return e('aside', args, ...children);
}

function b(args, ...children) {
  return e('b', args, ...children);
}

function bdi(args, ...children) {
  return e('bdi', args, ...children);
}

function bdo(args, ...children) {
  return e('bdo', args, ...children);
}

function blockquote(args, ...children) {
  return e('blockquote', args, ...children);
}

function br(args, ...children) {
  return e('br', args, ...children);
}

function button(args, ...children) {
  return e('button', args, ...children);
}

function caption(args, ...children) {
  return e('caption', args, ...children);
}

function code(args, ...children) {
  return e('code', args, ...children);
}

function col(args, ...children) {
  return e('col', args, ...children);
}

function colgroup(args, ...children) {
  return e('colgroup', args, ...children);
}

function div(args, ...children) {
  return e('div', args, ...children);
}

function em(args, ...children) {
  return e('em', args, ...children);
}

function embed(args, ...children) {
  return e('embed', args, ...children);
}

function fieldset(args, ...children) {
  return e('fieldset', args, ...children);
}

function footer(args, ...children) {
  return e('footer', args, ...children);
}

function form(args, ...children) {
  return e('form', args, ...children);
}

function h1(args, ...children) {
  return e('h1', args, ...children);
}

function h2(args, ...children) {
  return e('h2', args, ...children);
}

function h3(args, ...children) {
  return e('h3', args, ...children);
}

function h4(args, ...children) {
  return e('h4', args, ...children);
}

function h5(args, ...children) {
  return e('h5', args, ...children);
}

function h6(args, ...children) {
  return e('h6', args, ...children);
}

function header(args, ...children) {
  return e('header', args, ...children);
}

function hgroup(args, ...children) {
  return e('hgroup', args, ...children);
}

function hr(args, ...children) {
  return e('hr', args, ...children);
}

function i(args, ...children) {
  return e('i', args, ...children);
}

function img(args, ...children) {
  return e('img', args, ...children);
}

function input(args, ...children) {
  return e('input', args, ...children);
}

function label(args, ...children) {
  return e('label', args, ...children);
}

function li(args, ...children) {
  return e('li', args, ...children);
}

function mark(args, ...children) {
  return e('mark', args, ...children);
}

function nav(args, ...children) {
  return e('nav', args, ...children);
}

function ol(args, ...children) {
  return e('ol', args, ...children);
}

function optgroup(args, ...children) {
  return e('optgroup', args, ...children);
}

function option(args, ...children) {
  return e('option', args, ...children);
}

function p(args, ...children) {
  return e('p', args, ...children);
}

function pre(args, ...children) {
  return e('pre', args, ...children);
}

function progress(args, ...children) {
  return e('progress', args, ...children);
}

function q(args, ...children) {
  return e('q', args, ...children);
}

function s(args, ...children) {
  return e('s', args, ...children);
}

function section(args, ...children) {
  return e('section', args, ...children);
}

function select(args, ...children) {
  return e('select', args, ...children);
}

function small(args, ...children) {
  return e('small', args, ...children);
}

function span(args, ...children) {
  return e('span', args, ...children);
}

function strong(args, ...children) {
  return e('strong', args, ...children);
}

function sub(args, ...children) {
  return e('sub', args, ...children);
}

function sup(args, ...children) {
  return e('sup', args, ...children);
}

function table(args, ...children) {
  return e('table', args, ...children);
}

function tbody(args, ...children) {
  return e('tbody', args, ...children);
}

function td(args, ...children) {
  return e('td', args, ...children);
}

function textarea(args, ...children) {
  return e('textarea', args, ...children);
}

function tfoot(args, ...children) {
  return e('tfoot', args, ...children);
}

function th(args, ...children) {
  return e('th', args, ...children);
}

function thead(args, ...children) {
  return e('thead', args, ...children);
}

function tr(args, ...children) {
  return e('tr', args, ...children);
}

function u(args, ...children) {
  return e('u', args, ...children);
}

function ul(args, ...children) {
  return e('ul', args, ...children);
}

var _default = {
  a,
  abbr,
  address,
  aside,
  b,
  bdi,
  bdo,
  blockquote,
  br,
  button,
  caption,
  code,
  col,
  colgroup,
  div,
  em,
  embed,
  fieldset,
  footer,
  form,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  header,
  hgroup,
  hr,
  i,
  img,
  input,
  label,
  li,
  mark,
  nav,
  ol,
  optgroup,
  option,
  p,
  pre,
  progress,
  q,
  s,
  section,
  select,
  small,
  span,
  strong,
  sub,
  sup,
  table,
  tbody,
  td,
  textarea,
  tfoot,
  th,
  thead,
  tr,
  u,
  ul,
  e
};
exports.default = _default;
},{"../vm/vnode":"2IfjJ"}],"6J0mp":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vm = _interopRequireDefault(require("../../vm"));

var _util = require("../../vm/util");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = _vm.default.createComponent('List', {
  props: {
    step: 100
  },
  state: {
    a: 0,
    items: [],
    children: []
  },

  render() {
    return _vm.default.jsx("div", {
      id: 'ListParent' + this.state.a
    }, _vm.default.jsx("button", {
      onClick: this.add
    }, "Add ", this.props.step), _vm.default.jsx("button", {
      onClick: this.remove
    }, "Remove ", this.props.step), _vm.default.jsx("h3", null, this.state.items.length, ", ", this.state.items.length % 2 === 0 ? _vm.default.jsx("b", null, "Even") : _vm.default.jsx("s", null, "Odd")), "state.a: ", this.state.a, _vm.default.jsx(null, null, this.$children.map(child => child.$clone())), _vm.default.jsx("div", null, this.state.items.map(idx => _vm.default.jsx("div", {
      id: '' + this.state.a + idx
    }, "Link ", idx))));
  },

  add() {
    // console.log('items', this.state.items.length)
    for (let i = 0; i < this.props.step; i++) {
      this.state.items.push((0, _util.randomId)());
    }

    this.state.a += this.props.step; // this.$isDirty = true

    this.$update();
  },

  remove() {
    // for (let i = 0; i < this.state.a; i++) {
    for (let i = 0; i < this.props.step; i++) {
      this.state.items.pop();
    } // console.log(this.state)


    this.state.a -= this.props.step;
    this.$update(); // }
  }

});

exports.default = _default;
},{"../../vm":"4U4fI","../../vm/util":"1LTPD"}],"6evsB":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.store = void 0;

var _Store = require("./Store");

const store = new _Store.Store(function (state = {
  x: 0
}, action) {
  switch (action.type) {
    case 'inc':
      return { ...state,
        x: state.x + 1
      };

    case 'dec':
      return { ...state,
        x: state.x - 1
      };

    default:
      return state;
  }
});
exports.store = store;
},{"./Store":"2DFov"}],"2DFov":[function(require,module,exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Store = Store;

var _types = require("../../core/types");

function Store(reducer) {
  this.state = reducer(undefined, {});
  if (!(0, _types.isVal)(this.state)) throw TypeError('Store: Initial state is null or undefined,' + ' reducer does not return properly on random/empty state');
  Object.defineProperty(this, 'listeners', {
    value: [],
    writable: false,
    configurable: false
  });
  Object.defineProperty(this, 'reducer', {
    value: reducer,
    writable: false,
    configurable: false
  });

  this.subscribe = function (callback) {
    this.listeners.push(callback);
  };

  this.unsubscribe = function (callback) {
    this.listeners.splice(this.listeners.indexOf(callback), 1);
  };

  this.getState = function () {
    return this.state;
  };

  this.dispatch = function (action) {
    this.state = this.reducer(this.getState(), action);
    this.listeners.forEach(callback => {
      setTimeout(callback, 1);
    });
  };
}
},{"../../core/types":"5jEMv"}]},{},["4cdO8","Ahtjw"], "Ahtjw", "parcelRequire430d")

//# sourceMappingURL=index.d80e1bfc.js.map
