{"version":3,"sources":["dist/hyperapp.js"],"names":["hyperapp","exports","EMPTY_OBJ","EMPTY_ARR","map","isArray","Array","defer","requestAnimationFrame","setTimeout","createClass","obj","out","length","tmp","k","merge","a","b","batch","list","reduce","item","concat","isSameAction","shouldRestart","patchProperty","node","key","oldValue","newValue","listener","isSvg","setProperty","actions","slice","toLowerCase","addEventListener","removeEventListener","removeAttribute","setAttribute","createNode","vdom","props","type","document","createTextNode","name","createElementNS","is","createElement","i","len","children","appendChild","getVNode","getKey","patch","parent","oldVNode","newVNode","nodeValue","insertBefore","removeChild","tmpVKid","oldVKid","oldKey","newKey","oldVProps","newVProps","oldVKids","newVKids","oldHead","newHead","oldTail","newTail","keyed","newKeyed","getTextVNode","createTextVNode","lazy","propsChanged","view","createVNode","value","undefined","recycleNode","nodeType","nodeName","call","childNodes","Lazy","app","state","lock","subscriptions","subs","event","dispatch","this","setState","newState","oldSubs","newSubs","oldSub","newSub","push","patchSubs","render","middleware","action","fx","parentNode","init","h","rest","arguments","pop"],"mappings":"AAAA,IAAIA,SAAY,SAAUC,GACxB,aAEA,IAGIC,EAAY,GACZC,EAAY,GACZC,EAAMD,EAAUC,IAChBC,EAAUC,MAAMD,QAChBE,EAC+B,oBAA1BC,sBACHA,sBACAC,WAEFC,EAAc,SAASC,GACzB,IAAIC,EAAM,GAEV,GAAmB,iBAARD,EAAkB,OAAOA,EAEpC,GAAIN,EAAQM,IAAQA,EAAIE,OAAS,EAC/B,IAAK,IAAWC,EAAPC,EAAI,EAAQA,EAAIJ,EAAIE,OAAQE,IACC,MAA/BD,EAAMJ,EAAYC,EAAII,OACzBH,IAAQA,GAAO,KAAOE,QAI1B,IAAK,IAAIC,KAAKJ,EACRA,EAAII,KACNH,IAAQA,GAAO,KAAOG,GAK5B,OAAOH,GAGLI,EAAQ,SAASC,EAAGC,GACtB,IAAIN,EAAM,GAEV,IAAK,IAAIG,KAAKE,EAAGL,EAAIG,GAAKE,EAAEF,GAC5B,IAAK,IAAIA,KAAKG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AMqG,EAASd,GAAO,IAEpCD,GAGLK,GAAYvD,EAAMkE,YACpB,SAASlG,GACP,OAAOA,KACN,SAASmG,EAAQnE,GACpB,MAAyB,mBAAXmE,EACVZ,EAASY,EAAOjB,EAAOlD,IACvBtC,EAAQyG,GACa,mBAAdA,EAAO,IAAqBzG,EAAQyG,EAAO,IAChDZ,EACEY,EAAO,GACc,mBAAdA,EAAO,GAAoBA,EAAO,GAAGnE,GAASmE,EAAO,KAE7D3F,EAAM2F,EAAO3E,MAAM,IAAI/B,KAAI,SAAS2G,GACnCA,GAAMA,EAAG,GAAGb,EAAUa,EAAG,MACxBX,EAASU,EAAO,KACnBjB,GACFO,EAASU,MAGXF,EAAS,WACXd,GAAO,EACPnE,EAAO8B,EACL9B,EAAKqF,WACLrF,EACAe,EACCA,EAAOoC,EAAaI,EAAKW,IAC1B9D,IAIJmE,EAASvD,EAAMsE,OAKjBhH,EAAQiH,EAjFA,SAASnE,EAAMJ,GACrB,IAAK,IAAID,EAAMyE,EAAO,GAAI9D,EAAW,GAAIF,EAAIiE,UAAUvG,OAAQsC,KAAM,GACnEgE,EAAKT,KAAKU,UAAUjE,IAGtB,KAAOgE,EAAKtG,OAAS,GACnB,GAAIR,EAASqC,EAAOyE,EAAKE,OACvB,IAASlE,EAAIT,EAAK7B,OAAQsC,KAAM,GAC9BgE,EAAKT,KAAKhE,EAAKS,SAEC,IAATT,IAA2B,IAATA,GAAyB,MAARA,GAC5CW,EAASqD,KAAK5B,EAAapC,IAM/B,OAFAC,EAAQA,GAASzC,EAEM,mBAAT6C,EACVA,EAAKJ,EAAOU,GACZ8B,EAAYpC,EAAMJ,EAAOU,OAAUgC,EAAW1C,EAAMf,MAgEnD3B,EA3eM,CA6eb","sourcesContent":["var hyperapp = (function (exports) {\n 'use strict';\n\n var RECYCLED_NODE = 1;\n var LAZY_NODE = 2;\n var TEXT_NODE = 3;\n var EMPTY_OBJ = {};\n var EMPTY_ARR = [];\n var map = EMPTY_ARR.map;\n var isArray = Array.isArray;\n var defer =\n typeof requestAnimationFrame !== \"undefined\"\n ? requestAnimationFrame\n : setTimeout;\n\n var createClass = function(obj) {\n var out = \"\";\n\n if (typeof obj === \"string\") return obj\n\n if (isArray(obj) && obj.length > 0) {\n for (var k = 0, tmp; k < obj.length; k++) {\n if ((tmp = createClass(obj[k])) !== \"\") {\n out += (out && \" \") + tmp;\n }\n }\n } else {\n for (var k in obj) {\n if (obj[k]) {\n out += (out && \" \") + k;\n }\n }\n }\n\n return out\n };\n\n var merge = function(a, b) {\n var out = {};\n\n for (var k in a) out[k] = a[k];\n for (var k in b) out[k] = b[k];\n\n return out\n };\n\n var batch = function(list) {\n return list.reduce(function(out, item) {\n return out.concat(\n !item || item === true\n ? 0\n : typeof item[0] === \"function\"\n ? [item]\n : batch(item)\n )\n }, EMPTY_ARR)\n };\n\n var isSameAction = function(a, b) {\n return isArray(a) && isArray(b) && a[0] === b[0] && typeof a[0] === \"function\"\n };\n\n var shouldRestart = function(a, b) {\n if (a !== b) {\n for (var k in merge(a, b)) {\n if (a[k] !== b[k] && !isSameAction(a[k], b[k])) return true\n b[k] = a[k];\n }\n }\n };\n\n var patchSubs = function(oldSubs, newSubs, dispatch) {\n for (\n var i = 0, oldSub, newSub, subs = [];\n i < oldSubs.length || i < newSubs.length;\n i++\n ) {\n oldSub = oldSubs[i];\n newSub = newSubs[i];\n subs.push(\n newSub\n ? !oldSub ||\n newSub[0] !== oldSub[0] ||\n shouldRestart(newSub[1], oldSub[1])\n ? [\n newSub[0],\n newSub[1],\n newSub[0](dispatch, newSub[1]),\n oldSub && oldSub[2]()\n ]\n : oldSub\n : oldSub && oldSub[2]()\n );\n }\n return subs\n };\n\n var patchProperty = function(node, key, oldValue, newValue, listener, isSvg) {\n if (key === \"key\") ; else if (key === \"style\") {\n for (var k in merge(oldValue, newValue)) {\n oldValue = newValue == null || newValue[k] == null ? \"\" : newValue[k];\n if (k[0] === \"-\") {\n node[key].setProperty(k, oldValue);\n } else {\n node[key][k] = oldValue;\n }\n }\n } else if (key[0] === \"o\" && key[1] === \"n\") {\n if (\n !((node.actions || (node.actions = {}))[\n (key = key.slice(2).toLowerCase())\n ] = newValue)\n ) {\n node.removeEventListener(key, listener);\n } else if (!oldValue) {\n node.addEventListener(key, listener);\n }\n } else if (!isSvg && key !== \"list\" && key in node) {\n node[key] = newValue == null ? \"\" : newValue;\n } else if (\n newValue == null ||\n newValue === false ||\n (key === \"class\" && !(newValue = createClass(newValue)))\n ) {\n node.removeAttribute(key);\n } else {\n node.setAttribute(key, newValue);\n }\n };\n\n var createNode = function(vdom, listener, isSvg) {\n var ns = \"http://www.w3.org/2000/svg\";\n var props = vdom.props;\n var node =\n vdom.type === TEXT_NODE\n ? document.createTextNode(vdom.name)\n : (isSvg = isSvg || vdom.name === \"svg\")\n ? document.createElementNS(ns, vdom.name, { is: props.is })\n : document.createElement(vdom.name, { is: props.is });\n\n for (var k in props) {\n patchProperty(node, k, null, props[k], listener, isSvg);\n }\n\n for (var i = 0, len = vdom.children.length; i < len; i++) {\n node.appendChild(\n createNode(\n (vdom.children[i] = getVNode(vdom.children[i])),\n listener,\n isSvg\n )\n );\n }\n\n return (vdom.node = node)\n };\n\n var getKey = function(vdom) {\n return vdom == null ? null : vdom.key\n };\n\n var patch = function(parent, node, oldVNode, newVNode, listener, isSvg) {\n if (oldVNode === newVNode) ; else if (\n oldVNode != null &&\n oldVNode.type === TEXT_NODE &&\n newVNode.type === TEXT_NODE\n ) {\n if (oldVNode.name !== newVNode.name) node.nodeValue = newVNode.name;\n } else if (oldVNode == null || oldVNode.name !== newVNode.name) {\n node = parent.insertBefore(\n createNode((newVNode = getVNode(newVNode)), listener, isSvg),\n node\n );\n if (oldVNode != null) {\n parent.removeChild(oldVNode.node);\n }\n } else {\n var tmpVKid;\n var oldVKid;\n\n var oldKey;\n var newKey;\n\n var oldVProps = oldVNode.props;\n var newVProps = newVNode.props;\n\n var oldVKids = oldVNode.children;\n var newVKids = newVNode.children;\n\n var oldHead = 0;\n var newHead = 0;\n var oldTail = oldVKids.length - 1;\n var newTail = newVKids.length - 1;\n\n isSvg = isSvg || newVNode.name === \"svg\";\n\n for (var i in merge(oldVProps, newVProps)) {\n if (\n (i === \"value\" || i === \"selected\" || i === \"checked\"\n ? node[i]\n : oldVProps[i]) !== newVProps[i]\n ) {\n patchProperty(node, i, oldVProps[i], newVProps[i], listener, isSvg);\n }\n }\n\n while (newHead <= newTail && oldHead <= oldTail) {\n if (\n (oldKey = getKey(oldVKids[oldHead])) == null ||\n oldKey !== getKey(newVKids[newHead])\n ) {\n break\n }\n\n patch(\n node,\n oldVKids[oldHead].node,\n oldVKids[oldHead],\n (newVKids[newHead] = getVNode(\n newVKids[newHead++],\n oldVKids[oldHead++]\n )),\n listener,\n isSvg\n );\n }\n\n while (newHead <= newTail && oldHead <= oldTail) {\n if (\n (oldKey = getKey(oldVKids[oldTail])) == null ||\n oldKey !== getKey(newVKids[newTail])\n ) {\n break\n }\n\n patch(\n node,\n oldVKids[oldTail].node,\n oldVKids[oldTail],\n (newVKids[newTail] = getVNode(\n newVKids[newTail--],\n oldVKids[oldTail--]\n )),\n listener,\n isSvg\n );\n }\n\n if (oldHead > oldTail) {\n while (newHead <= newTail) {\n node.insertBefore(\n createNode(\n (newVKids[newHead] = getVNode(newVKids[newHead++])),\n listener,\n isSvg\n ),\n (oldVKid = oldVKids[oldHead]) && oldVKid.node\n );\n }\n } else if (newHead > newTail) {\n while (oldHead <= oldTail) {\n node.removeChild(oldVKids[oldHead++].node);\n }\n } else {\n for (var i = oldHead, keyed = {}, newKeyed = {}; i <= oldTail; i++) {\n if ((oldKey = oldVKids[i].key) != null) {\n keyed[oldKey] = oldVKids[i];\n }\n }\n\n while (newHead <= newTail) {\n oldKey = getKey((oldVKid = oldVKids[oldHead]));\n newKey = getKey(\n (newVKids[newHead] = getVNode(newVKids[newHead], oldVKid))\n );\n\n if (\n newKeyed[oldKey] ||\n (newKey != null && newKey === getKey(oldVKids[oldHead + 1]))\n ) {\n if (oldKey == null) {\n node.removeChild(oldVKid.node);\n }\n oldHead++;\n continue\n }\n\n if (newKey == null || oldVNode.type === RECYCLED_NODE) {\n if (oldKey == null) {\n patch(\n node,\n oldVKid && oldVKid.node,\n oldVKid,\n newVKids[newHead],\n listener,\n isSvg\n );\n newHead++;\n }\n oldHead++;\n } else {\n if (oldKey === newKey) {\n patch(\n node,\n oldVKid.node,\n oldVKid,\n newVKids[newHead],\n listener,\n isSvg\n );\n newKeyed[newKey] = true;\n oldHead++;\n } else {\n if ((tmpVKid = keyed[newKey]) != null) {\n patch(\n node,\n node.insertBefore(tmpVKid.node, oldVKid && oldVKid.node),\n tmpVKid,\n newVKids[newHead],\n listener,\n isSvg\n );\n newKeyed[newKey] = true;\n } else {\n patch(\n node,\n oldVKid && oldVKid.node,\n null,\n newVKids[newHead],\n listener,\n isSvg\n );\n }\n }\n newHead++;\n }\n }\n\n while (oldHead <= oldTail) {\n if (getKey((oldVKid = oldVKids[oldHead++])) == null) {\n node.removeChild(oldVKid.node);\n }\n }\n\n for (var i in keyed) {\n if (newKeyed[i] == null) {\n node.removeChild(keyed[i].node);\n }\n }\n }\n }\n\n return (newVNode.node = node)\n };\n\n var propsChanged = function(a, b) {\n for (var k in a) if (a[k] !== b[k]) return true\n for (var k in b) if (a[k] !== b[k]) return true\n };\n\n var getTextVNode = function(node) {\n return typeof node === \"object\" ? node : createTextVNode(node)\n };\n\n var getVNode = function(newVNode, oldVNode) {\n return newVNode.type === LAZY_NODE\n ? ((!oldVNode || !oldVNode.lazy || propsChanged(oldVNode.lazy, newVNode.lazy))\n && ((oldVNode = getTextVNode(newVNode.lazy.view(newVNode.lazy))).lazy =\n newVNode.lazy),\n oldVNode)\n : newVNode\n };\n\n var createVNode = function(name, props, children, node, key, type) {\n return {\n name: name,\n props: props,\n children: children,\n node: node,\n type: type,\n key: key\n }\n };\n\n var createTextVNode = function(value, node) {\n return createVNode(value, EMPTY_OBJ, EMPTY_ARR, node, undefined, TEXT_NODE)\n };\n\n var recycleNode = function(node) {\n return node.nodeType === TEXT_NODE\n ? createTextVNode(node.nodeValue, node)\n : createVNode(\n node.nodeName.toLowerCase(),\n EMPTY_OBJ,\n map.call(node.childNodes, recycleNode),\n node,\n undefined,\n RECYCLED_NODE\n )\n };\n\n var Lazy = function(props) {\n return {\n lazy: props,\n type: LAZY_NODE\n }\n };\n\n var h = function(name, props) {\n for (var vdom, rest = [], children = [], i = arguments.length; i-- > 2; ) {\n rest.push(arguments[i]);\n }\n\n while (rest.length > 0) {\n if (isArray((vdom = rest.pop()))) {\n for (var i = vdom.length; i-- > 0; ) {\n rest.push(vdom[i]);\n }\n } else if (vdom === false || vdom === true || vdom == null) ; else {\n children.push(getTextVNode(vdom));\n }\n }\n\n props = props || EMPTY_OBJ;\n\n return typeof name === \"function\"\n ? name(props, children)\n : createVNode(name, props, children, undefined, props.key)\n };\n\n var app = function(props) {\n var state = {};\n var lock = false;\n var view = props.view;\n var node = props.node;\n var vdom = node && recycleNode(node);\n var subscriptions = props.subscriptions;\n var subs = [];\n\n var listener = function(event) {\n dispatch(this.actions[event.type], event);\n };\n\n var setState = function(newState) {\n if (state !== newState) {\n state = newState;\n if (subscriptions) {\n subs = patchSubs(subs, batch([subscriptions(state)]), dispatch);\n }\n if (view && !lock) defer(render, (lock = true));\n }\n return state\n };\n\n var dispatch = (props.middleware ||\n function(obj) {\n return obj\n })(function(action, props) {\n return typeof action === \"function\"\n ? dispatch(action(state, props))\n : isArray(action)\n ? typeof action[0] === \"function\" || isArray(action[0])\n ? dispatch(\n action[0],\n typeof action[1] === \"function\" ? action[1](props) : action[1]\n )\n : (batch(action.slice(1)).map(function(fx) {\n fx && fx[0](dispatch, fx[1]);\n }, setState(action[0])),\n state)\n : setState(action)\n });\n\n var render = function() {\n lock = false;\n node = patch(\n node.parentNode,\n node,\n vdom,\n (vdom = getTextVNode(view(state))),\n listener\n );\n };\n\n dispatch(props.init);\n };\n\n exports.Lazy = Lazy;\n exports.app = app;\n exports.h = h;\n\n return exports;\n\n}({}));\n//# sourceMappingURL=hyperapp.js.map\n"]}