-
Notifications
You must be signed in to change notification settings - Fork 4
/
map.json
1 lines (1 loc) · 86 KB
/
map.json
1
{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","js/src/app.js","js/src/index.js","node_modules/mithril/mithril.js"],"names":["require","window","init","win","appUrls","c","document","getElementById","list","controller","localStorage","getItem","u","clear","setTimeout","m","route","this","i","length","push","navigate","el","url","getAttribute","view","ctrl","map","post","baseUrl","onclick","date","title","year","param","month","day","file","text","request","method","deserialize","v","then","data","dsq","createElement","type","async","src","disqus_shortname","getElementsByTagName","appendChild","trust","mode","routeConf","body","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","onScrollFunction","scroll","scrollY","header","getElementsByClassName","totalScroll","innerHeight","style","opacity","setAttribute","onscroll","module","exports","app","undefined","initialize","$document","$location","location","$cancelAnimationFrame","cancelAnimationFrame","clearTimeout","$requestAnimationFrame","requestAnimationFrame","match","args","slice","call","arguments","hasAttrs","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","Error","parser","exec","id","pair","attrParser","children","ARRAY","attrName","hasOwnProperty","join","build","parentElement","parentTag","parentCache","parentIndex","cached","shouldReattach","index","editable","namespace","configs","toString","e","subtree","cachedType","dataType","nodes","offset","end","constructor","len","concat","apply","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","shouldMaintainIdentities","key","action","guid","j","keysDiffer","cachedCell","dataCell","from","element","actions","prop","changes","sort","sortChanges","newCached","Array","change","splice","dummy","insertBefore","childNodes","cacheCount","item","$trusted","node","parentNode","indexOf","views","controllers","$original","controllerIndex","redraw","strategy","noop","pendingRequests","onunload","unloaders","handler","dataAttrKeys","Object","keys","hasKeys","configContext","retain","FUNCTION","preventDefault","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","$old","value","context","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","a","b","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","setAttributeNS","message","removeChild","unload","child","nextSibling","isElement","placeholder","insertAdjacentHTML","object","event","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","parameterize","component","output","computePreRedrawHook","root","roots","components","$$args","render","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","modes","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","mount","matcher","RegExp","replace","test","values","decodeURIComponent","routeUnobtrusive","ctrlKey","metaKey","which","returnValue","currentTarget","srcElement","search","toUpperCase","setScroll","hash","scrollTo","buildQueryString","prefix","duplicates","str","valueType","encodeURIComponent","reduce","memo","charAt","substring","pairs","split","params","reset","cacheKey","cellCache","propify","promise","initialValue","resolve","reject","Deferred","successCallback","failureCallback","finish","state","REJECTED","next","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","open","user","password","onreadystatechange","readyState","status","onload","target","serialize","JSON","stringify","setRequestHeader","parse","config","maybeXhr","FormData","send","callbackKey","getTime","round","random","script","resp","responseText","error","bindData","xhrOptions","querystring","parameterizeUrl","tokens","documentNode","replaceChild","forceRecreation","isDocumentRoot","String","topComponent","FRAME_BUDGET","unloader","isPrevented","subcomponent","currentComponent","redrawing","force","endComputation","withAttr","withAttrCallback","currentRoute","pathname","redirect","isDefaultRoute","defaultRoute","source","listener","addEventListener","attachEvent","vdom","href","removeEventListener","detachEvent","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","history","pushState","sync","synchronizer","pos","resolved","results","outstanding","background","isJSONP","extract","jsonp","unwrap","unwrapSuccess","unwrapError","response","deps","mock","factory","define","amd"],"mappings":"AAAA;ACAAA,QAAQ,WAAWC;;ACCnB,QAASC,MAAKC,GACZ,YACA,IAAIC,GAAUD,EAAIC,OAClBD,GAAIE,EAAIC,SAASC,eAAe,UAChC,IAAIC,IACFC,WAAY,WACV,GAAIN,GAAOA,EAAIO,cAAgBP,EAAIO,aAAaC,QAAQ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K,GAAI7B,GAAI,EAAGA,EAAI6X,EAAS5X,OAAQD,IAAK6X,EAAS7X,GAAK,GAAIyU,GAAW5S,KAAKgW,EAAS7X,QAE7EyU,GAAW5S,OAAMgW,EAAW,GAAIpD,GAAW5S,KAAKgW,GAE1DhG,GAAoB,SAAXlL,EAAE9E,KAAkB,UAAY,UAAUgW,GAEpD,MAAOlR,GACN9G,EAAEgS,SAASM,QAAQxL,GACnBkL,EAASR,OAAO1K,GAEb8N,EAAW6C,cAAe,GAAMzX,EAAE6V,kBAEvChD,EAAK+B,GACL5C,EAASX,QAAUD,EAAQY,EAASX,QAASuD,EAAWtD,cACjDU,EAASX,SAIjBrR,EAAEiY,KAAO,SAASC,GAEjB,MADAjU,GAAW/E,EAASgZ,GAAQhZ,GACrBA,GAGRc,EAAEiY,KAAKE,QAAUpU,EAEV/D,GACY,mBAAVd,QAAwBA,UAEb,oBAAV2E,SAAoC,OAAXA,QAAmBA,OAAOC,QAASD,OAAOC,QAAU9D,EAC7D,kBAAXoY,SAAyBA,OAAOC,KAAKD,OAAO,WAAY,MAAOpY","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","require('./index')(window);\n","var m = require('mithril');\nfunction init(win) {\n 'use strict';\n var appUrls = win.appUrls;\n win.c = document.getElementById('content');\n var list = {\n controller: function() {\n if (win && win.localStorage && win.localStorage.getItem('redirect')) {\n var u = win.localStorage.getItem('redirect');\n win.localStorage.clear('redirect');\n setTimeout(function() {\n m.route(u);\n }, 10);\n }\n this.list = [];\n for (var i = 0; i < appUrls.length; i++) {\n this.list.push(appUrls[i]);\n }\n this.navigate = function(el) {\n var url = el.getAttribute('href');\n m.route(url, {}, true);\n };\n },\n view: function(ctrl) {\n return m('div.content', [\n ctrl.list.map(function(post) {\n return m('div.post', [\n m('a[href=\"' + win.baseUrl + post.url + '\"].postlink', { onclick: (function(){ctrl.navigate(this);return false;})}, [\n m('span.date', post.date + ':'),\n m('h2', [\n m('span.title', post.title)\n ])\n ])\n ]);\n })\n ]);\n }\n };\n var post = {\n controller: function() {\n this.year = m.route.param('year');\n this.month = m.route.param('month');\n this.day = m.route.param('day');\n this.file = m.route.param('file');\n this.text = '';\n var ctrl = this;\n m.request({\n method: 'GET',\n url: win.baseUrl + '/blog/' + this.year + '/' + this.month + '/' + this.day + '/' + this.file + '/index.html',\n deserialize: function(v) {\n return v;\n }\n })\n .then(function(data) {\n ctrl.text = data;\n });\n },\n view: function(ctrl) {\n if (typeof(win.disqus_shortname) != 'undefined') {\n var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n dsq.src = '//' + win.disqus_shortname + '.disqus.com/embed.js';\n document.getElementsByTagName('head')[0].appendChild(dsq);\n }\n return m('div.content', [\n m('div.post-full', m.trust(ctrl.text))\n ]);\n }\n };\n m.route.mode = 'pathname';\n var routeConf = {};\n routeConf['/'] = list;\n routeConf[win.baseUrl + '/'] = list;\n routeConf['/blog/:year/:month/:day/:file'] = post;\n routeConf['/blog/:year/:month/:day/:file/'] = post;\n routeConf[win.baseUrl + '/blog/:year/:month/:day/:file'] = post;\n routeConf[win.baseUrl + '/blog/:year/:month/:day/:file/'] = post;\n m.route(win.c, win.baseUrl + '/', routeConf);\n\n // Do some parallax stuff.\n var body = document.body;\n var html = document.documentElement;\n var height = Math.max(body.scrollHeight, body.offsetHeight,\n html.clientHeight, html.scrollHeight, html.offsetHeight);\n var onScrollFunction = function() {\n height = Math.max(body.scrollHeight, body.offsetHeight,\n html.clientHeight, html.scrollHeight, html.offsetHeight);\n var scroll = win.scrollY;\n var header = document.getElementsByClassName('site-title')[0];\n var totalScroll = win.innerHeight / 6;\n header.style.opacity = 1 - (scroll / totalScroll);\n /* istanbul ignore next */\n if (scroll >= (height - win.innerHeight - 100)) {\n document.getElementsByTagName('footer')[0].setAttribute('style',\n 'opacity: ' + (1 + ((scroll - (height - win.innerHeight)) / 100))\n );\n }\n };\n win.onscroll = onScrollFunction;\n win.m = m;\n}\nmodule.exports = init;\n","var m = (function app(window, undefined) {\r\n\tvar OBJECT = \"[object Object]\", ARRAY = \"[object Array]\", STRING = \"[object String]\", FUNCTION = \"function\";\r\n\tvar type = {}.toString;\r\n\tvar parser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[.+?\\])/g, attrParser = /\\[(.+?)(?:=(\"|'|)(.*?)\\2)?\\]/;\r\n\tvar voidElements = /^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;\r\n\tvar noop = function() {}\r\n\r\n\t// caching commonly used variables\r\n\tvar $document, $location, $requestAnimationFrame, $cancelAnimationFrame;\r\n\r\n\t// self invoking function needed because of the way mocks work\r\n\tfunction initialize(window){\r\n\t\t$document = window.document;\r\n\t\t$location = window.location;\r\n\t\t$cancelAnimationFrame = window.cancelAnimationFrame || window.clearTimeout;\r\n\t\t$requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;\r\n\t}\r\n\r\n\tinitialize(window);\r\n\r\n\r\n\t/**\r\n\t * @typedef {String} Tag\r\n\t * A string that looks like -> div.classname#id[param=one][param2=two]\r\n\t * Which describes a DOM node\r\n\t */\r\n\r\n\t/**\r\n\t *\r\n\t * @param {Tag} The DOM node tag\r\n\t * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs\r\n\t * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array, or splat (optional)\r\n\t *\r\n\t */\r\n\tfunction m() {\r\n\t\tvar args = [].slice.call(arguments);\r\n\t\tvar hasAttrs = args[1] != null && type.call(args[1]) === OBJECT && !(\"tag\" in args[1] || \"view\" in args[1]) && !(\"subtree\" in args[1]);\r\n\t\tvar attrs = hasAttrs ? args[1] : {};\r\n\t\tvar classAttrName = \"class\" in attrs ? \"class\" : \"className\";\r\n\t\tvar cell = {tag: \"div\", attrs: {}};\r\n\t\tvar match, classes = [];\r\n\t\tif (type.call(args[0]) != STRING) throw new Error(\"selector in m(selector, attrs, children) should be a string\")\r\n\t\twhile (match = parser.exec(args[0])) {\r\n\t\t\tif (match[1] === \"\" && match[2]) cell.tag = match[2];\r\n\t\t\telse if (match[1] === \"#\") cell.attrs.id = match[2];\r\n\t\t\telse if (match[1] === \".\") classes.push(match[2]);\r\n\t\t\telse if (match[3][0] === \"[\") {\r\n\t\t\t\tvar pair = attrParser.exec(match[3]);\r\n\t\t\t\tcell.attrs[pair[1]] = pair[3] || (pair[2] ? \"\" :true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar children = hasAttrs ? args.slice(2) : args.slice(1);\r\n\t\tif (children.length === 1 && type.call(children[0]) === ARRAY) {\r\n\t\t\tcell.children = children[0]\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcell.children = children\r\n\t\t}\r\n\t\t\r\n\t\tfor (var attrName in attrs) {\r\n\t\t\tif (attrs.hasOwnProperty(attrName)) {\r\n\t\t\t\tif (attrName === classAttrName && attrs[attrName] != null && attrs[attrName] !== \"\") {\r\n\t\t\t\t\tclasses.push(attrs[attrName])\r\n\t\t\t\t\tcell.attrs[attrName] = \"\" //create key in correct iteration order\r\n\t\t\t\t}\r\n\t\t\t\telse cell.attrs[attrName] = attrs[attrName]\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (classes.length > 0) cell.attrs[classAttrName] = classes.join(\" \");\r\n\t\t\r\n\t\treturn cell\r\n\t}\r\n\tfunction build(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) {\r\n\t\t//`build` is a recursive function that manages creation/diffing/removal of DOM elements based on comparison between `data` and `cached`\r\n\t\t//the diff algorithm can be summarized as this:\r\n\t\t//1 - compare `data` and `cached`\r\n\t\t//2 - if they are different, copy `data` to `cached` and update the DOM based on what the difference is\r\n\t\t//3 - recursively apply this algorithm for every array and for the children of every virtual element\r\n\r\n\t\t//the `cached` data structure is essentially the same as the previous redraw's `data` data structure, with a few additions:\r\n\t\t//- `cached` always has a property called `nodes`, which is a list of DOM elements that correspond to the data represented by the respective virtual element\r\n\t\t//- in order to support attaching `nodes` as a property of `cached`, `cached` is *always* a non-primitive object, i.e. if the data was a string, then cached is a String instance. If data was `null` or `undefined`, cached is `new String(\"\")`\r\n\t\t//- `cached also has a `configContext` property, which is the state storage object exposed by config(element, isInitialized, context)\r\n\t\t//- when `cached` is an Object, it represents a virtual element; when it's an Array, it represents a list of elements; when it's a String, Number or Boolean, it represents a text node\r\n\r\n\t\t//`parentElement` is a DOM element used for W3C DOM API calls\r\n\t\t//`parentTag` is only used for handling a corner case for textarea values\r\n\t\t//`parentCache` is used to remove nodes in some multi-node cases\r\n\t\t//`parentIndex` and `index` are used to figure out the offset of nodes. They're artifacts from before arrays started being flattened and are likely refactorable\r\n\t\t//`data` and `cached` are, respectively, the new and old nodes being diffed\r\n\t\t//`shouldReattach` is a flag indicating whether a parent node was recreated (if so, and if this node is reused, then this node must reattach itself to the new parent)\r\n\t\t//`editable` is a flag that indicates whether an ancestor is contenteditable\r\n\t\t//`namespace` indicates the closest HTML namespace as it cascades down from an ancestor\r\n\t\t//`configs` is a list of config functions to run after the topmost `build` call finishes running\r\n\r\n\t\t//there's logic that relies on the assumption that null and undefined data are equivalent to empty strings\r\n\t\t//- this prevents lifecycle surprises from procedural helpers that mix implicit and explicit return statements (e.g. function foo() {if (cond) return m(\"div\")}\r\n\t\t//- it simplifies diffing code\r\n\t\t//data.toString() might throw or return null if data is the return value of Console.log in Firefox (behavior depends on version)\r\n\t\ttry {if (data == null || data.toString() == null) data = \"\";} catch (e) {data = \"\"}\r\n\t\tif (data.subtree === \"retain\") return cached;\r\n\t\tvar cachedType = type.call(cached), dataType = type.call(data);\r\n\t\tif (cached == null || cachedType !== dataType) {\r\n\t\t\tif (cached != null) {\r\n\t\t\t\tif (parentCache && parentCache.nodes) {\r\n\t\t\t\t\tvar offset = index - parentIndex;\r\n\t\t\t\t\tvar end = offset + (dataType === ARRAY ? data : cached.nodes).length;\r\n\t\t\t\t\tclear(parentCache.nodes.slice(offset, end), parentCache.slice(offset, end))\r\n\t\t\t\t}\r\n\t\t\t\telse if (cached.nodes) clear(cached.nodes, cached)\r\n\t\t\t}\r\n\t\t\tcached = new data.constructor;\r\n\t\t\tif (cached.tag) cached = {}; //if constructor creates a virtual dom element, use a blank object as the base cached node instead of copying the virtual el (#277)\r\n\t\t\tcached.nodes = []\r\n\t\t}\r\n\r\n\t\tif (dataType === ARRAY) {\r\n\t\t\t//recursively flatten array\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\tif (type.call(data[i]) === ARRAY) {\r\n\t\t\t\t\tdata = data.concat.apply([], data);\r\n\t\t\t\t\ti-- //check current index again and flatten until there are no more nested arrays at that index\r\n\t\t\t\t\tlen = data.length\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar nodes = [], intact = cached.length === data.length, subArrayCount = 0;\r\n\r\n\t\t\t//keys algorithm: sort elements without recreating them if keys are present\r\n\t\t\t//1) create a map of all existing keys, and mark all for deletion\r\n\t\t\t//2) add new keys to map and mark them for addition\r\n\t\t\t//3) if key exists in new list, change action from deletion to a move\r\n\t\t\t//4) for each key, handle its corresponding action as marked in previous steps\r\n\t\t\tvar DELETION = 1, INSERTION = 2 , MOVE = 3;\r\n\t\t\tvar existing = {}, shouldMaintainIdentities = false;\r\n\t\t\tfor (var i = 0; i < cached.length; i++) {\r\n\t\t\t\tif (cached[i] && cached[i].attrs && cached[i].attrs.key != null) {\r\n\t\t\t\t\tshouldMaintainIdentities = true;\r\n\t\t\t\t\texisting[cached[i].attrs.key] = {action: DELETION, index: i}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar guid = 0\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\tif (data[i] && data[i].attrs && data[i].attrs.key != null) {\r\n\t\t\t\t\tfor (var j = 0, len = data.length; j < len; j++) {\r\n\t\t\t\t\t\tif (data[j] && data[j].attrs && data[j].attrs.key == null) data[j].attrs.key = \"__mithril__\" + guid++\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (shouldMaintainIdentities) {\r\n\t\t\t\tvar keysDiffer = false\r\n\t\t\t\tif (data.length != cached.length) keysDiffer = true\r\n\t\t\t\telse for (var i = 0, cachedCell, dataCell; cachedCell = cached[i], dataCell = data[i]; i++) {\r\n\t\t\t\t\tif (cachedCell.attrs && dataCell.attrs && cachedCell.attrs.key != dataCell.attrs.key) {\r\n\t\t\t\t\t\tkeysDiffer = true\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (keysDiffer) {\r\n\t\t\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t\t\tif (data[i] && data[i].attrs) {\r\n\t\t\t\t\t\t\tif (data[i].attrs.key != null) {\r\n\t\t\t\t\t\t\t\tvar key = data[i].attrs.key;\r\n\t\t\t\t\t\t\t\tif (!existing[key]) existing[key] = {action: INSERTION, index: i};\r\n\t\t\t\t\t\t\t\telse existing[key] = {\r\n\t\t\t\t\t\t\t\t\taction: MOVE,\r\n\t\t\t\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\t\t\t\tfrom: existing[key].index,\r\n\t\t\t\t\t\t\t\t\telement: cached.nodes[existing[key].index] || $document.createElement(\"div\")\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar actions = []\r\n\t\t\t\t\tfor (var prop in existing) actions.push(existing[prop])\r\n\t\t\t\t\tvar changes = actions.sort(sortChanges);\r\n\t\t\t\t\tvar newCached = new Array(cached.length)\r\n\t\t\t\t\tnewCached.nodes = cached.nodes.slice()\r\n\r\n\t\t\t\t\tfor (var i = 0, change; change = changes[i]; i++) {\r\n\t\t\t\t\t\tif (change.action === DELETION) {\r\n\t\t\t\t\t\t\tclear(cached[change.index].nodes, cached[change.index]);\r\n\t\t\t\t\t\t\tnewCached.splice(change.index, 1)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (change.action === INSERTION) {\r\n\t\t\t\t\t\t\tvar dummy = $document.createElement(\"div\");\r\n\t\t\t\t\t\t\tdummy.key = data[change.index].attrs.key;\r\n\t\t\t\t\t\t\tparentElement.insertBefore(dummy, parentElement.childNodes[change.index] || null);\r\n\t\t\t\t\t\t\tnewCached.splice(change.index, 0, {attrs: {key: data[change.index].attrs.key}, nodes: [dummy]})\r\n\t\t\t\t\t\t\tnewCached.nodes[change.index] = dummy\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (change.action === MOVE) {\r\n\t\t\t\t\t\t\tif (parentElement.childNodes[change.index] !== change.element && change.element !== null) {\r\n\t\t\t\t\t\t\t\tparentElement.insertBefore(change.element, parentElement.childNodes[change.index] || null)\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnewCached[change.index] = cached[change.from]\r\n\t\t\t\t\t\t\tnewCached.nodes[change.index] = change.element\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcached = newCached;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//end key algorithm\r\n\r\n\t\t\tfor (var i = 0, cacheCount = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t//diff each item in the array\r\n\t\t\t\tvar item = build(parentElement, parentTag, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs);\r\n\t\t\t\tif (item === undefined) continue;\r\n\t\t\t\tif (!item.nodes.intact) intact = false;\r\n\t\t\t\tif (item.$trusted) {\r\n\t\t\t\t\t//fix offset of next element if item was a trusted string w/ more than one html element\r\n\t\t\t\t\t//the first clause in the regexp matches elements\r\n\t\t\t\t\t//the second clause (after the pipe) matches text nodes\r\n\t\t\t\t\tsubArrayCount += (item.match(/<[^\\/]|\\>\\s*[^<]/g) || [0]).length\r\n\t\t\t\t}\r\n\t\t\t\telse subArrayCount += type.call(item) === ARRAY ? item.length : 1;\r\n\t\t\t\tcached[cacheCount++] = item\r\n\t\t\t}\r\n\t\t\tif (!intact) {\r\n\t\t\t\t//diff the array itself\r\n\t\t\t\t\r\n\t\t\t\t//update the list of DOM nodes by collecting the nodes from each item\r\n\t\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t\tif (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)\r\n\t\t\t\t}\r\n\t\t\t\t//remove items from the end of the array if the new array is shorter than the old one\r\n\t\t\t\t//if errors ever happen here, the issue is most likely a bug in the construction of the `cached` data structure somewhere earlier in the program\r\n\t\t\t\tfor (var i = 0, node; node = cached.nodes[i]; i++) {\r\n\t\t\t\t\tif (node.parentNode != null && nodes.indexOf(node) < 0) clear([node], [cached[i]])\r\n\t\t\t\t}\r\n\t\t\t\tif (data.length < cached.length) cached.length = data.length;\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (data != null && dataType === OBJECT) {\r\n\t\t\tvar views = [], controllers = []\r\n\t\t\twhile (data.view) {\r\n\t\t\t\tvar view = data.view.$original || data.view\r\n\t\t\t\tvar controllerIndex = m.redraw.strategy() == \"diff\" && cached.views ? cached.views.indexOf(view) : -1\r\n\t\t\t\tvar controller = controllerIndex > -1 ? cached.controllers[controllerIndex] : new (data.controller || noop)\r\n\t\t\t\tvar key = data && data.attrs && data.attrs.key\r\n\t\t\t\tdata = pendingRequests == 0 || (cached && cached.controllers && cached.controllers.indexOf(controller) > -1) ? data.view(controller) : {tag: \"placeholder\"}\r\n\t\t\t\tif (data.subtree === \"retain\") return cached;\r\n\t\t\t\tif (key) {\r\n\t\t\t\t\tif (!data.attrs) data.attrs = {}\r\n\t\t\t\t\tdata.attrs.key = key\r\n\t\t\t\t}\r\n\t\t\t\tif (controller.onunload) unloaders.push({controller: controller, handler: controller.onunload})\r\n\t\t\t\tviews.push(view)\r\n\t\t\t\tcontrollers.push(controller)\r\n\t\t\t}\r\n\t\t\tif (!data.tag && controllers.length) throw new Error(\"Component template must return a virtual element, not an array, string, etc.\")\r\n\t\t\tif (!data.attrs) data.attrs = {};\r\n\t\t\tif (!cached.attrs) cached.attrs = {};\r\n\r\n\t\t\tvar dataAttrKeys = Object.keys(data.attrs)\r\n\t\t\tvar hasKeys = dataAttrKeys.length > (\"key\" in data.attrs ? 1 : 0)\r\n\t\t\t//if an element is different enough from the one in cache, recreate it\r\n\t\t\tif (data.tag != cached.tag || dataAttrKeys.sort().join() != Object.keys(cached.attrs).sort().join() || data.attrs.id != cached.attrs.id || data.attrs.key != cached.attrs.key || (m.redraw.strategy() == \"all\" && (!cached.configContext || cached.configContext.retain !== true)) || (m.redraw.strategy() == \"diff\" && cached.configContext && cached.configContext.retain === false)) {\r\n\t\t\t\tif (cached.nodes.length) clear(cached.nodes);\r\n\t\t\t\tif (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload()\r\n\t\t\t\tif (cached.controllers) {\r\n\t\t\t\t\tfor (var i = 0, controller; controller = cached.controllers[i]; i++) {\r\n\t\t\t\t\t\tif (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop})\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (type.call(data.tag) != STRING) return;\r\n\r\n\t\t\tvar node, isNew = cached.nodes.length === 0;\r\n\t\t\tif (data.attrs.xmlns) namespace = data.attrs.xmlns;\r\n\t\t\telse if (data.tag === \"svg\") namespace = \"http://www.w3.org/2000/svg\";\r\n\t\t\telse if (data.tag === \"math\") namespace = \"http://www.w3.org/1998/Math/MathML\";\r\n\t\t\t\r\n\t\t\tif (isNew) {\r\n\t\t\t\tif (data.attrs.is) node = namespace === undefined ? $document.createElement(data.tag, data.attrs.is) : $document.createElementNS(namespace, data.tag, data.attrs.is);\r\n\t\t\t\telse node = namespace === undefined ? $document.createElement(data.tag) : $document.createElementNS(namespace, data.tag);\r\n\t\t\t\tcached = {\r\n\t\t\t\t\ttag: data.tag,\r\n\t\t\t\t\t//set attributes first, then create children\r\n\t\t\t\t\tattrs: hasKeys ? setAttributes(node, data.tag, data.attrs, {}, namespace) : data.attrs,\r\n\t\t\t\t\tchildren: data.children != null && data.children.length > 0 ?\r\n\t\t\t\t\t\tbuild(node, data.tag, undefined, undefined, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace, configs) :\r\n\t\t\t\t\t\tdata.children,\r\n\t\t\t\t\tnodes: [node]\r\n\t\t\t\t};\r\n\t\t\t\tif (controllers.length) {\r\n\t\t\t\t\tcached.views = views\r\n\t\t\t\t\tcached.controllers = controllers\r\n\t\t\t\t\tfor (var i = 0, controller; controller = controllers[i]; i++) {\r\n\t\t\t\t\t\tif (controller.onunload && controller.onunload.$old) controller.onunload = controller.onunload.$old\r\n\t\t\t\t\t\tif (pendingRequests && controller.onunload) {\r\n\t\t\t\t\t\t\tvar onunload = controller.onunload\r\n\t\t\t\t\t\t\tcontroller.onunload = noop\r\n\t\t\t\t\t\t\tcontroller.onunload.$old = onunload\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (cached.children && !cached.children.nodes) cached.children.nodes = [];\r\n\t\t\t\t//edge case: setting value on <select> doesn't work before children exist, so set it again after children have been created\r\n\t\t\t\tif (data.tag === \"select\" && \"value\" in data.attrs) setAttributes(node, data.tag, {value: data.attrs.value}, {}, namespace);\r\n\t\t\t\tparentElement.insertBefore(node, parentElement.childNodes[index] || null)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnode = cached.nodes[0];\r\n\t\t\t\tif (hasKeys) setAttributes(node, data.tag, data.attrs, cached.attrs, namespace);\r\n\t\t\t\tcached.children = build(node, data.tag, undefined, undefined, data.children, cached.children, false, 0, data.attrs.contenteditable ? node : editable, namespace, configs);\r\n\t\t\t\tcached.nodes.intact = true;\r\n\t\t\t\tif (controllers.length) {\r\n\t\t\t\t\tcached.views = views\r\n\t\t\t\t\tcached.controllers = controllers\r\n\t\t\t\t}\r\n\t\t\t\tif (shouldReattach === true && node != null) parentElement.insertBefore(node, parentElement.childNodes[index] || null)\r\n\t\t\t}\r\n\t\t\t//schedule configs to be called. They are called after `build` finishes running\r\n\t\t\tif (typeof data.attrs[\"config\"] === FUNCTION) {\r\n\t\t\t\tvar context = cached.configContext = cached.configContext || {};\r\n\r\n\t\t\t\t// bind\r\n\t\t\t\tvar callback = function(data, args) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\treturn data.attrs[\"config\"].apply(data, args)\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tconfigs.push(callback(data, [node, !isNew, context, cached]))\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (typeof data != FUNCTION) {\r\n\t\t\t//handle text nodes\r\n\t\t\tvar nodes;\r\n\t\t\tif (cached.nodes.length === 0) {\r\n\t\t\t\tif (data.$trusted) {\r\n\t\t\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tnodes = [$document.createTextNode(data)];\r\n\t\t\t\t\tif (!parentElement.nodeName.match(voidElements)) parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null)\r\n\t\t\t\t}\r\n\t\t\t\tcached = \"string number boolean\".indexOf(typeof data) > -1 ? new data.constructor(data) : data;\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t\telse if (cached.valueOf() !== data.valueOf() || shouldReattach === true) {\r\n\t\t\t\tnodes = cached.nodes;\r\n\t\t\t\tif (!editable || editable !== $document.activeElement) {\r\n\t\t\t\t\tif (data.$trusted) {\r\n\t\t\t\t\t\tclear(nodes, cached);\r\n\t\t\t\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t//corner case: replacing the nodeValue of a text node that is a child of a textarea/contenteditable doesn't work\r\n\t\t\t\t\t\t//we need to update the value property of the parent textarea or the innerHTML of the contenteditable element instead\r\n\t\t\t\t\t\tif (parentTag === \"textarea\") parentElement.value = data;\r\n\t\t\t\t\t\telse if (editable) editable.innerHTML = data;\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif (nodes[0].nodeType === 1 || nodes.length > 1) { //was a trusted string\r\n\t\t\t\t\t\t\t\tclear(cached.nodes, cached);\r\n\t\t\t\t\t\t\t\tnodes = [$document.createTextNode(data)]\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tparentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null);\r\n\t\t\t\t\t\t\tnodes[0].nodeValue = data\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcached = new data.constructor(data);\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t\telse cached.nodes.intact = true\r\n\t\t}\r\n\r\n\t\treturn cached\r\n\t}\r\n\tfunction sortChanges(a, b) {return a.action - b.action || a.index - b.index}\r\n\tfunction setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {\r\n\t\tfor (var attrName in dataAttrs) {\r\n\t\t\tvar dataAttr = dataAttrs[attrName];\r\n\t\t\tvar cachedAttr = cachedAttrs[attrName];\r\n\t\t\tif (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {\r\n\t\t\t\tcachedAttrs[attrName] = dataAttr;\r\n\t\t\t\ttry {\r\n\t\t\t\t\t//`config` isn't a real attributes, so ignore it\r\n\t\t\t\t\tif (attrName === \"config\" || attrName == \"key\") continue;\r\n\t\t\t\t\t//hook event handlers to the auto-redrawing system\r\n\t\t\t\t\telse if (typeof dataAttr === FUNCTION && attrName.indexOf(\"on\") === 0) {\r\n\t\t\t\t\t\tnode[attrName] = autoredraw(dataAttr, node)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle `style: {...}`\r\n\t\t\t\t\telse if (attrName === \"style\" && dataAttr != null && type.call(dataAttr) === OBJECT) {\r\n\t\t\t\t\t\tfor (var rule in dataAttr) {\r\n\t\t\t\t\t\t\tif (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) node.style[rule] = dataAttr[rule]\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfor (var rule in cachedAttr) {\r\n\t\t\t\t\t\t\tif (!(rule in dataAttr)) node.style[rule] = \"\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle SVG\r\n\t\t\t\t\telse if (namespace != null) {\r\n\t\t\t\t\t\tif (attrName === \"href\") node.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"href\", dataAttr);\r\n\t\t\t\t\t\telse if (attrName === \"className\") node.setAttribute(\"class\", dataAttr);\r\n\t\t\t\t\t\telse node.setAttribute(attrName, dataAttr)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle cases that are properties (but ignore cases where we should use setAttribute instead)\r\n\t\t\t\t\t//- list and form are typically used as strings, but are DOM element references in js\r\n\t\t\t\t\t//- when using CSS selectors (e.g. `m(\"[style='']\")`), style is used as a string, but it's an object in js\r\n\t\t\t\t\telse if (attrName in node && !(attrName === \"list\" || attrName === \"style\" || attrName === \"form\" || attrName === \"type\" || attrName === \"width\" || attrName === \"height\")) {\r\n\t\t\t\t\t\t//#348 don't set the value if not needed otherwise cursor placement breaks in Chrome\r\n\t\t\t\t\t\tif (tag !== \"input\" || node[attrName] !== dataAttr) node[attrName] = dataAttr\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse node.setAttribute(attrName, dataAttr)\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\t//swallow IE's invalid argument errors to mimic HTML's fallback-to-doing-nothing-on-invalid-attributes behavior\r\n\t\t\t\t\tif (e.message.indexOf(\"Invalid argument\") < 0) throw e\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//#348 dataAttr may not be a string, so use loose comparison (double equal) instead of strict (triple equal)\r\n\t\t\telse if (attrName === \"value\" && tag === \"input\" && node.value != dataAttr) {\r\n\t\t\t\tnode.value = dataAttr\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cachedAttrs\r\n\t}\r\n\tfunction clear(nodes, cached) {\r\n\t\tfor (var i = nodes.length - 1; i > -1; i--) {\r\n\t\t\tif (nodes[i] && nodes[i].parentNode) {\r\n\t\t\t\ttry {nodes[i].parentNode.removeChild(nodes[i])}\r\n\t\t\t\tcatch (e) {} //ignore if this fails due to order of events (see http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)\r\n\t\t\t\tcached = [].concat(cached);\r\n\t\t\t\tif (cached[i]) unload(cached[i])\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (nodes.length != 0) nodes.length = 0\r\n\t}\r\n\tfunction unload(cached) {\r\n\t\tif (cached.configContext && typeof cached.configContext.onunload === FUNCTION) {\r\n\t\t\tcached.configContext.onunload();\r\n\t\t\tcached.configContext.onunload = null\r\n\t\t}\r\n\t\tif (cached.controllers) {\r\n\t\t\tfor (var i = 0, controller; controller = cached.controllers[i]; i++) {\r\n\t\t\t\tif (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop});\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (cached.children) {\r\n\t\t\tif (type.call(cached.children) === ARRAY) {\r\n\t\t\t\tfor (var i = 0, child; child = cached.children[i]; i++) unload(child)\r\n\t\t\t}\r\n\t\t\telse if (cached.children.tag) unload(cached.children)\r\n\t\t}\r\n\t}\r\n\tfunction injectHTML(parentElement, index, data) {\r\n\t\tvar nextSibling = parentElement.childNodes[index];\r\n\t\tif (nextSibling) {\r\n\t\t\tvar isElement = nextSibling.nodeType != 1;\r\n\t\t\tvar placeholder = $document.createElement(\"span\");\r\n\t\t\tif (isElement) {\r\n\t\t\t\tparentElement.insertBefore(placeholder, nextSibling || null);\r\n\t\t\t\tplaceholder.insertAdjacentHTML(\"beforebegin\", data);\r\n\t\t\t\tparentElement.removeChild(placeholder)\r\n\t\t\t}\r\n\t\t\telse nextSibling.insertAdjacentHTML(\"beforebegin\", data)\r\n\t\t}\r\n\t\telse parentElement.insertAdjacentHTML(\"beforeend\", data);\r\n\t\tvar nodes = [];\r\n\t\twhile (parentElement.childNodes[index] !== nextSibling) {\r\n\t\t\tnodes.push(parentElement.childNodes[index]);\r\n\t\t\tindex++\r\n\t\t}\r\n\t\treturn nodes\r\n\t}\r\n\tfunction autoredraw(callback, object) {\r\n\t\treturn function(e) {\r\n\t\t\te = e || event;\r\n\t\t\tm.redraw.strategy(\"diff\");\r\n\t\t\tm.startComputation();\r\n\t\t\ttry {return callback.call(object, e)}\r\n\t\t\tfinally {\r\n\t\t\t\tendFirstComputation()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvar html;\r\n\tvar documentNode = {\r\n\t\tappendChild: function(node) {\r\n\t\t\tif (html === undefined) html = $document.createElement(\"html\");\r\n\t\t\tif ($document.documentElement && $document.documentElement !== node) {\r\n\t\t\t\t$document.replaceChild(node, $document.documentElement)\r\n\t\t\t}\r\n\t\t\telse $document.appendChild(node);\r\n\t\t\tthis.childNodes = $document.childNodes\r\n\t\t},\r\n\t\tinsertBefore: function(node) {\r\n\t\t\tthis.appendChild(node)\r\n\t\t},\r\n\t\tchildNodes: []\r\n\t};\r\n\tvar nodeCache = [], cellCache = {};\r\n\tm.render = function(root, cell, forceRecreation) {\r\n\t\tvar configs = [];\r\n\t\tif (!root) throw new Error(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\");\r\n\t\tvar id = getCellCacheKey(root);\r\n\t\tvar isDocumentRoot = root === $document;\r\n\t\tvar node = isDocumentRoot || root === $document.documentElement ? documentNode : root;\r\n\t\tif (isDocumentRoot && cell.tag != \"html\") cell = {tag: \"html\", attrs: {}, children: cell};\r\n\t\tif (cellCache[id] === undefined) clear(node.childNodes);\r\n\t\tif (forceRecreation === true) reset(root);\r\n\t\tcellCache[id] = build(node, null, undefined, undefined, cell, cellCache[id], false, 0, null, undefined, configs);\r\n\t\tfor (var i = 0, len = configs.length; i < len; i++) configs[i]()\r\n\t};\r\n\tfunction getCellCacheKey(element) {\r\n\t\tvar index = nodeCache.indexOf(element);\r\n\t\treturn index < 0 ? nodeCache.push(element) - 1 : index\r\n\t}\r\n\r\n\tm.trust = function(value) {\r\n\t\tvalue = new String(value);\r\n\t\tvalue.$trusted = true;\r\n\t\treturn value\r\n\t};\r\n\r\n\tfunction gettersetter(store) {\r\n\t\tvar prop = function() {\r\n\t\t\tif (arguments.length) store = arguments[0];\r\n\t\t\treturn store\r\n\t\t};\r\n\r\n\t\tprop.toJSON = function() {\r\n\t\t\treturn store\r\n\t\t};\r\n\r\n\t\treturn prop\r\n\t}\r\n\r\n\tm.prop = function (store) {\r\n\t\t//note: using non-strict equality check here because we're checking if store is null OR undefined\r\n\t\tif (((store != null && type.call(store) === OBJECT) || typeof store === FUNCTION) && typeof store.then === FUNCTION) {\r\n\t\t\treturn propify(store)\r\n\t\t}\r\n\r\n\t\treturn gettersetter(store)\r\n\t};\r\n\r\n\tvar roots = [], components = [], controllers = [], lastRedrawId = null, lastRedrawCallTime = 0, computePreRedrawHook = null, computePostRedrawHook = null, prevented = false, topComponent, unloaders = [];\r\n\tvar FRAME_BUDGET = 16; //60 frames per second = 1 call per 16 ms\r\n\tfunction parameterize(component, args) {\r\n\t\tvar controller = function() {\r\n\t\t\treturn (component.controller || noop).apply(this, args) || this\r\n\t\t}\r\n\t\tvar view = function(ctrl) {\r\n\t\t\tif (arguments.length > 1) args = args.concat([].slice.call(arguments, 1))\r\n\t\t\treturn component.view.apply(component, args ? [ctrl].concat(args) : [ctrl])\r\n\t\t}\r\n\t\tview.$original = component.view\r\n\t\tvar output = {controller: controller, view: view}\r\n\t\tif (args[0] && args[0].key != null) output.attrs = {key: args[0].key}\r\n\t\treturn output\r\n\t}\r\n\tm.component = function(component) {\r\n\t\treturn parameterize(component, [].slice.call(arguments, 1))\r\n\t}\r\n\tm.mount = m.module = function(root, component) {\r\n\t\tif (!root) throw new Error(\"Please ensure the DOM element exists before rendering a template into it.\");\r\n\t\tvar index = roots.indexOf(root);\r\n\t\tif (index < 0) index = roots.length;\r\n\t\t\r\n\t\tvar isPrevented = false;\r\n\t\tvar event = {preventDefault: function() {\r\n\t\t\tisPrevented = true;\r\n\t\t\tcomputePreRedrawHook = computePostRedrawHook = null;\r\n\t\t}};\r\n\t\tfor (var i = 0, unloader; unloader = unloaders[i]; i++) {\r\n\t\t\tunloader.handler.call(unloader.controller, event)\r\n\t\t\tunloader.controller.onunload = null\r\n\t\t}\r\n\t\tif (isPrevented) {\r\n\t\t\tfor (var i = 0, unloader; unloader = unloaders[i]; i++) unloader.controller.onunload = unloader.handler\r\n\t\t}\r\n\t\telse unloaders = []\r\n\t\t\r\n\t\tif (controllers[index] && typeof controllers[index].onunload === FUNCTION) {\r\n\t\t\tcontrollers[index].onunload(event)\r\n\t\t}\r\n\t\t\r\n\t\tif (!isPrevented) {\r\n\t\t\tm.redraw.strategy(\"all\");\r\n\t\t\tm.startComputation();\r\n\t\t\troots[index] = root;\r\n\t\t\tif (arguments.length > 2) component = subcomponent(component, [].slice.call(arguments, 2))\r\n\t\t\tvar currentComponent = topComponent = component = component || {controller: function() {}};\r\n\t\t\tvar constructor = component.controller || noop\r\n\t\t\tvar controller = new constructor;\r\n\t\t\t//controllers may call m.mount recursively (via m.route redirects, for example)\r\n\t\t\t//this conditional ensures only the last recursive m.mount call is applied\r\n\t\t\tif (currentComponent === topComponent) {\r\n\t\t\t\tcontrollers[index] = controller;\r\n\t\t\t\tcomponents[index] = component\r\n\t\t\t}\r\n\t\t\tendFirstComputation();\r\n\t\t\treturn controllers[index]\r\n\t\t}\r\n\t};\r\n\tvar redrawing = false\r\n\tm.redraw = function(force) {\r\n\t\tif (redrawing) return\r\n\t\tredrawing = true\r\n\t\t//lastRedrawId is a positive number if a second redraw is requested before the next animation frame\r\n\t\t//lastRedrawID is null if it's the first redraw and not an event handler\r\n\t\tif (lastRedrawId && force !== true) {\r\n\t\t\t//when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout\r\n\t\t\t//when rAF: always reschedule redraw\r\n\t\t\tif ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {\r\n\t\t\t\tif (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);\r\n\t\t\t\tlastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tredraw();\r\n\t\t\tlastRedrawId = $requestAnimationFrame(function() {lastRedrawId = null}, FRAME_BUDGET)\r\n\t\t}\r\n\t\tredrawing = false\r\n\t};\r\n\tm.redraw.strategy = m.prop();\r\n\tfunction redraw() {\r\n\t\tif (computePreRedrawHook) {\r\n\t\t\tcomputePreRedrawHook()\r\n\t\t\tcomputePreRedrawHook = null\r\n\t\t}\r\n\t\tfor (var i = 0, root; root = roots[i]; i++) {\r\n\t\t\tif (controllers[i]) {\r\n\t\t\t\tvar args = components[i].controller && components[i].controller.$$args ? [controllers[i]].concat(components[i].controller.$$args) : [controllers[i]]\r\n\t\t\t\tm.render(root, components[i].view ? components[i].view(controllers[i], args) : \"\")\r\n\t\t\t}\r\n\t\t}\r\n\t\t//after rendering within a routed context, we need to scroll back to the top, and fetch the document title for history.pushState\r\n\t\tif (computePostRedrawHook) {\r\n\t\t\tcomputePostRedrawHook();\r\n\t\t\tcomputePostRedrawHook = null\r\n\t\t}\r\n\t\tlastRedrawId = null;\r\n\t\tlastRedrawCallTime = new Date;\r\n\t\tm.redraw.strategy(\"diff\")\r\n\t}\r\n\r\n\tvar pendingRequests = 0;\r\n\tm.startComputation = function() {pendingRequests++};\r\n\tm.endComputation = function() {\r\n\t\tpendingRequests = Math.max(pendingRequests - 1, 0);\r\n\t\tif (pendingRequests === 0) m.redraw()\r\n\t};\r\n\tvar endFirstComputation = function() {\r\n\t\tif (m.redraw.strategy() == \"none\") {\r\n\t\t\tpendingRequests--\r\n\t\t\tm.redraw.strategy(\"diff\")\r\n\t\t}\r\n\t\telse m.endComputation();\r\n\t}\r\n\r\n\tm.withAttr = function(prop, withAttrCallback) {\r\n\t\treturn function(e) {\r\n\t\t\te = e || event;\r\n\t\t\tvar currentTarget = e.currentTarget || this;\r\n\t\t\twithAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop))\r\n\t\t}\r\n\t};\r\n\r\n\t//routing\r\n\tvar modes = {pathname: \"\", hash: \"#\", search: \"?\"};\r\n\tvar redirect = noop, routeParams, currentRoute, isDefaultRoute = false;\r\n\tm.route = function() {\r\n\t\t//m.route()\r\n\t\tif (arguments.length === 0) return currentRoute;\r\n\t\t//m.route(el, defaultRoute, routes)\r\n\t\telse if (arguments.length === 3 && type.call(arguments[1]) === STRING) {\r\n\t\t\tvar root = arguments[0], defaultRoute = arguments[1], router = arguments[2];\r\n\t\t\tredirect = function(source) {\r\n\t\t\t\tvar path = currentRoute = normalizeRoute(source);\r\n\t\t\t\tif (!routeByValue(root, router, path)) {\r\n\t\t\t\t\tif (isDefaultRoute) throw new Error(\"Ensure the default route matches one of the routes defined in m.route\")\r\n\t\t\t\t\tisDefaultRoute = true\r\n\t\t\t\t\tm.route(defaultRoute, true)\r\n\t\t\t\t\tisDefaultRoute = false\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar listener = m.route.mode === \"hash\" ? \"onhashchange\" : \"onpopstate\";\r\n\t\t\twindow[listener] = function() {\r\n\t\t\t\tvar path = $location[m.route.mode]\r\n\t\t\t\tif (m.route.mode === \"pathname\") path += $location.search\r\n\t\t\t\tif (currentRoute != normalizeRoute(path)) {\r\n\t\t\t\t\tredirect(path)\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tcomputePreRedrawHook = setScroll;\r\n\t\t\twindow[listener]()\r\n\t\t}\r\n\t\t//config: m.route\r\n\t\telse if (arguments[0].addEventListener || arguments[0].attachEvent) {\r\n\t\t\tvar element = arguments[0];\r\n\t\t\tvar isInitialized = arguments[1];\r\n\t\t\tvar context = arguments[2];\r\n\t\t\tvar vdom = arguments[3];\r\n\t\t\telement.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + vdom.attrs.href;\r\n\t\t\tif (element.addEventListener) {\r\n\t\t\t\telement.removeEventListener(\"click\", routeUnobtrusive);\r\n\t\t\t\telement.addEventListener(\"click\", routeUnobtrusive)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\telement.detachEvent(\"onclick\", routeUnobtrusive);\r\n\t\t\t\telement.attachEvent(\"onclick\", routeUnobtrusive)\r\n\t\t\t}\r\n\t\t}\r\n\t\t//m.route(route, params, shouldReplaceHistoryEntry)\r\n\t\telse if (type.call(arguments[0]) === STRING) {\r\n\t\t\tvar oldRoute = currentRoute;\r\n\t\t\tcurrentRoute = arguments[0];\r\n\t\t\tvar args = arguments[1] || {}\r\n\t\t\tvar queryIndex = currentRoute.indexOf(\"?\")\r\n\t\t\tvar params = queryIndex > -1 ? parseQueryString(currentRoute.slice(queryIndex + 1)) : {}\r\n\t\t\tfor (var i in args) params[i] = args[i]\r\n\t\t\tvar querystring = buildQueryString(params)\r\n\t\t\tvar currentPath = queryIndex > -1 ? currentRoute.slice(0, queryIndex) : currentRoute\r\n\t\t\tif (querystring) currentRoute = currentPath + (currentPath.indexOf(\"?\") === -1 ? \"?\" : \"&\") + querystring;\r\n\r\n\t\t\tvar shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || oldRoute === arguments[0];\r\n\r\n\t\t\tif (window.history.pushState) {\r\n\t\t\t\tcomputePreRedrawHook = setScroll\r\n\t\t\t\tcomputePostRedrawHook = function() {\r\n\t\t\t\t\twindow.history[shouldReplaceHistoryEntry ? \"replaceState\" : \"pushState\"](null, $document.title, modes[m.route.mode] + currentRoute);\r\n\t\t\t\t};\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$location[m.route.mode] = currentRoute\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tm.route.param = function(key) {\r\n\t\tif (!routeParams) throw new Error(\"You must call m.route(element, defaultRoute, routes) before calling m.route.param()\")\r\n\t\treturn routeParams[key]\r\n\t};\r\n\tm.route.mode = \"search\";\r\n\tfunction normalizeRoute(route) {\r\n\t\treturn route.slice(modes[m.route.mode].length)\r\n\t}\r\n\tfunction routeByValue(root, router, path) {\r\n\t\trouteParams = {};\r\n\r\n\t\tvar queryStart = path.indexOf(\"?\");\r\n\t\tif (queryStart !== -1) {\r\n\t\t\trouteParams = parseQueryString(path.substr(queryStart + 1, path.length));\r\n\t\t\tpath = path.substr(0, queryStart)\r\n\t\t}\r\n\r\n\t\t// Get all routes and check if there's\r\n\t\t// an exact match for the current path\r\n\t\tvar keys = Object.keys(router);\r\n\t\tvar index = keys.indexOf(path);\r\n\t\tif(index !== -1){\r\n\t\t\tm.mount(root, router[keys [index]]);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tfor (var route in router) {\r\n\t\t\tif (route === path) {\r\n\t\t\t\tm.mount(root, router[route]);\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\r\n\t\t\tvar matcher = new RegExp(\"^\" + route.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\").replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\");\r\n\r\n\t\t\tif (matcher.test(path)) {\r\n\t\t\t\tpath.replace(matcher, function() {\r\n\t\t\t\t\tvar keys = route.match(/:[^\\/]+/g) || [];\r\n\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2);\r\n\t\t\t\t\tfor (var i = 0, len = keys.length; i < len; i++) routeParams[keys[i].replace(/:|\\./g, \"\")] = decodeURIComponent(values[i])\r\n\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t});\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfunction routeUnobtrusive(e) {\r\n\t\te = e || event;\r\n\t\tif (e.ctrlKey || e.metaKey || e.which === 2) return;\r\n\t\tif (e.preventDefault) e.preventDefault();\r\n\t\telse e.returnValue = false;\r\n\t\tvar currentTarget = e.currentTarget || e.srcElement;\r\n\t\tvar args = m.route.mode === \"pathname\" && currentTarget.search ? parseQueryString(currentTarget.search.slice(1)) : {};\r\n\t\twhile (currentTarget && currentTarget.nodeName.toUpperCase() != \"A\") currentTarget = currentTarget.parentNode\r\n\t\tm.route(currentTarget[m.route.mode].slice(modes[m.route.mode].length), args)\r\n\t}\r\n\tfunction setScroll() {\r\n\t\tif (m.route.mode != \"hash\" && $location.hash) $location.hash = $location.hash;\r\n\t\telse window.scrollTo(0, 0)\r\n\t}\r\n\tfunction buildQueryString(object, prefix) {\r\n\t\tvar duplicates = {}\r\n\t\tvar str = []\r\n\t\tfor (var prop in object) {\r\n\t\t\tvar key = prefix ? prefix + \"[\" + prop + \"]\" : prop\r\n\t\t\tvar value = object[prop]\r\n\t\t\tvar valueType = type.call(value)\r\n\t\t\tvar pair = (value === null) ? encodeURIComponent(key) :\r\n\t\t\t\tvalueType === OBJECT ? buildQueryString(value, key) :\r\n\t\t\t\tvalueType === ARRAY ? value.reduce(function(memo, item) {\r\n\t\t\t\t\tif (!duplicates[key]) duplicates[key] = {}\r\n\t\t\t\t\tif (!duplicates[key][item]) {\r\n\t\t\t\t\t\tduplicates[key][item] = true\r\n\t\t\t\t\t\treturn memo.concat(encodeURIComponent(key) + \"=\" + encodeURIComponent(item))\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn memo\r\n\t\t\t\t}, []).join(\"&\") :\r\n\t\t\t\tencodeURIComponent(key) + \"=\" + encodeURIComponent(value)\r\n\t\t\tif (value !== undefined) str.push(pair)\r\n\t\t}\r\n\t\treturn str.join(\"&\")\r\n\t}\r\n\tfunction parseQueryString(str) {\r\n\t\tif (str.charAt(0) === \"?\") str = str.substring(1);\r\n\t\t\r\n\t\tvar pairs = str.split(\"&\"), params = {};\r\n\t\tfor (var i = 0, len = pairs.length; i < len; i++) {\r\n\t\t\tvar pair = pairs[i].split(\"=\");\r\n\t\t\tvar key = decodeURIComponent(pair[0])\r\n\t\t\tvar value = pair.length == 2 ? decodeURIComponent(pair[1]) : null\r\n\t\t\tif (params[key] != null) {\r\n\t\t\t\tif (type.call(params[key]) !== ARRAY) params[key] = [params[key]]\r\n\t\t\t\tparams[key].push(value)\r\n\t\t\t}\r\n\t\t\telse params[key] = value\r\n\t\t}\r\n\t\treturn params\r\n\t}\r\n\tm.route.buildQueryString = buildQueryString\r\n\tm.route.parseQueryString = parseQueryString\r\n\t\r\n\tfunction reset(root) {\r\n\t\tvar cacheKey = getCellCacheKey(root);\r\n\t\tclear(root.childNodes, cellCache[cacheKey]);\r\n\t\tcellCache[cacheKey] = undefined\r\n\t}\r\n\r\n\tm.deferred = function () {\r\n\t\tvar deferred = new Deferred();\r\n\t\tdeferred.promise = propify(deferred.promise);\r\n\t\treturn deferred\r\n\t};\r\n\tfunction propify(promise, initialValue) {\r\n\t\tvar prop = m.prop(initialValue);\r\n\t\tpromise.then(prop);\r\n\t\tprop.then = function(resolve, reject) {\r\n\t\t\treturn propify(promise.then(resolve, reject), initialValue)\r\n\t\t};\r\n\t\treturn prop\r\n\t}\r\n\t//Promiz.mithril.js | Zolmeister | MIT\r\n\t//a modified version of Promiz.js, which does not conform to Promises/A+ for two reasons:\r\n\t//1) `then` callbacks are called synchronously (because setTimeout is too slow, and the setImmediate polyfill is too big\r\n\t//2) throwing subclasses of Error cause the error to be bubbled up instead of triggering rejection (because the spec does not account for the important use case of default browser error handling, i.e. message w/ line number)\r\n\tfunction Deferred(successCallback, failureCallback) {\r\n\t\tvar RESOLVING = 1, REJECTING = 2, RESOLVED = 3, REJECTED = 4;\r\n\t\tvar self = this, state = 0, promiseValue = 0, next = [];\r\n\r\n\t\tself[\"promise\"] = {};\r\n\r\n\t\tself[\"resolve\"] = function(value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value;\r\n\t\t\t\tstate = RESOLVING;\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\t\t\treturn this\r\n\t\t};\r\n\r\n\t\tself[\"reject\"] = function(value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value;\r\n\t\t\t\tstate = REJECTING;\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\t\t\treturn this\r\n\t\t};\r\n\r\n\t\tself.promise[\"then\"] = function(successCallback, failureCallback) {\r\n\t\t\tvar deferred = new Deferred(successCallback, failureCallback);\r\n\t\t\tif (state === RESOLVED) {\r\n\t\t\t\tdeferred.resolve(promiseValue)\r\n\t\t\t}\r\n\t\t\telse if (state === REJECTED) {\r\n\t\t\t\tdeferred.reject(promiseValue)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnext.push(deferred)\r\n\t\t\t}\r\n\t\t\treturn deferred.promise\r\n\t\t};\r\n\r\n\t\tfunction finish(type) {\r\n\t\t\tstate = type || REJECTED;\r\n\t\t\tnext.map(function(deferred) {\r\n\t\t\t\tstate === RESOLVED && deferred.resolve(promiseValue) || deferred.reject(promiseValue)\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tfunction thennable(then, successCallback, failureCallback, notThennableCallback) {\r\n\t\t\tif (((promiseValue != null && type.call(promiseValue) === OBJECT) || typeof promiseValue === FUNCTION) && typeof then === FUNCTION) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t// count protects against abuse calls from spec checker\r\n\t\t\t\t\tvar count = 0;\r\n\t\t\t\t\tthen.call(promiseValue, function(value) {\r\n\t\t\t\t\t\tif (count++) return;\r\n\t\t\t\t\t\tpromiseValue = value;\r\n\t\t\t\t\t\tsuccessCallback()\r\n\t\t\t\t\t}, function (value) {\r\n\t\t\t\t\t\tif (count++) return;\r\n\t\t\t\t\t\tpromiseValue = value;\r\n\t\t\t\t\t\tfailureCallback()\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\t\tpromiseValue = e;\r\n\t\t\t\t\tfailureCallback()\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tnotThennableCallback()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction fire() {\r\n\t\t\t// check if it's a thenable\r\n\t\t\tvar then;\r\n\t\t\ttry {\r\n\t\t\t\tthen = promiseValue && promiseValue.then\r\n\t\t\t}\r\n\t\t\tcatch (e) {\r\n\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\tpromiseValue = e;\r\n\t\t\t\tstate = REJECTING;\r\n\t\t\t\treturn fire()\r\n\t\t\t}\r\n\t\t\tthennable(then, function() {\r\n\t\t\t\tstate = RESOLVING;\r\n\t\t\t\tfire()\r\n\t\t\t}, function() {\r\n\t\t\t\tstate = REJECTING;\r\n\t\t\t\tfire()\r\n\t\t\t}, function() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (state === RESOLVING && typeof successCallback === FUNCTION) {\r\n\t\t\t\t\t\tpromiseValue = successCallback(promiseValue)\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (state === REJECTING && typeof failureCallback === \"function\") {\r\n\t\t\t\t\t\tpromiseValue = failureCallback(promiseValue);\r\n\t\t\t\t\t\tstate = RESOLVING\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\t\tpromiseValue = e;\r\n\t\t\t\t\treturn finish()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (promiseValue === self) {\r\n\t\t\t\t\tpromiseValue = TypeError();\r\n\t\t\t\t\tfinish()\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthennable(then, function () {\r\n\t\t\t\t\t\tfinish(RESOLVED)\r\n\t\t\t\t\t}, finish, function () {\r\n\t\t\t\t\t\tfinish(state === RESOLVING && RESOLVED)\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\tm.deferred.onerror = function(e) {\r\n\t\tif (type.call(e) === \"[object Error]\" && !e.constructor.toString().match(/ Error/)) throw e\r\n\t};\r\n\r\n\tm.sync = function(args) {\r\n\t\tvar method = \"resolve\";\r\n\t\tfunction synchronizer(pos, resolved) {\r\n\t\t\treturn function(value) {\r\n\t\t\t\tresults[pos] = value;\r\n\t\t\t\tif (!resolved) method = \"reject\";\r\n\t\t\t\tif (--outstanding === 0) {\r\n\t\t\t\t\tdeferred.promise(results);\r\n\t\t\t\t\tdeferred[method](results)\r\n\t\t\t\t}\r\n\t\t\t\treturn value\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar deferred = m.deferred();\r\n\t\tvar outstanding = args.length;\r\n\t\tvar results = new Array(outstanding);\r\n\t\tif (args.length > 0) {\r\n\t\t\tfor (var i = 0; i < args.length; i++) {\r\n\t\t\t\targs[i].then(synchronizer(i, true), synchronizer(i, false))\r\n\t\t\t}\r\n\t\t}\r\n\t\telse deferred.resolve([]);\r\n\r\n\t\treturn deferred.promise\r\n\t};\r\n\tfunction identity(value) {return value}\r\n\r\n\tfunction ajax(options) {\r\n\t\tif (options.dataType && options.dataType.toLowerCase() === \"jsonp\") {\r\n\t\t\tvar callbackKey = \"mithril_callback_\" + new Date().getTime() + \"_\" + (Math.round(Math.random() * 1e16)).toString(36);\r\n\t\t\tvar script = $document.createElement(\"script\");\r\n\r\n\t\t\twindow[callbackKey] = function(resp) {\r\n\t\t\t\tscript.parentNode.removeChild(script);\r\n\t\t\t\toptions.onload({\r\n\t\t\t\t\ttype: \"load\",\r\n\t\t\t\t\ttarget: {\r\n\t\t\t\t\t\tresponseText: resp\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\twindow[callbackKey] = undefined\r\n\t\t\t};\r\n\r\n\t\t\tscript.onerror = function(e) {\r\n\t\t\t\tscript.parentNode.removeChild(script);\r\n\r\n\t\t\t\toptions.onerror({\r\n\t\t\t\t\ttype: \"error\",\r\n\t\t\t\t\ttarget: {\r\n\t\t\t\t\t\tstatus: 500,\r\n\t\t\t\t\t\tresponseText: JSON.stringify({error: \"Error making jsonp request\"})\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\twindow[callbackKey] = undefined;\r\n\r\n\t\t\t\treturn false\r\n\t\t\t};\r\n\r\n\t\t\tscript.onload = function(e) {\r\n\t\t\t\treturn false\r\n\t\t\t};\r\n\r\n\t\t\tscript.src = options.url\r\n\t\t\t\t+ (options.url.indexOf(\"?\") > 0 ? \"&\" : \"?\")\r\n\t\t\t\t+ (options.callbackKey ? options.callbackKey : \"callback\")\r\n\t\t\t\t+ \"=\" + callbackKey\r\n\t\t\t\t+ \"&\" + buildQueryString(options.data || {});\r\n\t\t\t$document.body.appendChild(script)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar xhr = new window.XMLHttpRequest;\r\n\t\t\txhr.open(options.method, options.url, true, options.user, options.password);\r\n\t\t\txhr.onreadystatechange = function() {\r\n\t\t\t\tif (xhr.readyState === 4) {\r\n\t\t\t\t\tif (xhr.status >= 200 && xhr.status < 300) options.onload({type: \"load\", target: xhr});\r\n\t\t\t\t\telse options.onerror({type: \"error\", target: xhr})\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tif (options.serialize === JSON.stringify && options.data && options.method !== \"GET\") {\r\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\r\n\t\t\t}\r\n\t\t\tif (options.deserialize === JSON.parse) {\r\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\");\r\n\t\t\t}\r\n\t\t\tif (typeof options.config === FUNCTION) {\r\n\t\t\t\tvar maybeXhr = options.config(xhr, options);\r\n\t\t\t\tif (maybeXhr != null) xhr = maybeXhr\r\n\t\t\t}\r\n\r\n\t\t\tvar data = options.method === \"GET\" || !options.data ? \"\" : options.data\r\n\t\t\tif (data && (type.call(data) != STRING && data.constructor != window.FormData)) {\r\n\t\t\t\tthrow \"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`\";\r\n\t\t\t}\r\n\t\t\txhr.send(data);\r\n\t\t\treturn xhr\r\n\t\t}\r\n\t}\r\n\tfunction bindData(xhrOptions, data, serialize) {\r\n\t\tif (xhrOptions.method === \"GET\" && xhrOptions.dataType != \"jsonp\") {\r\n\t\t\tvar prefix = xhrOptions.url.indexOf(\"?\") < 0 ? \"?\" : \"&\";\r\n\t\t\tvar querystring = buildQueryString(data);\r\n\t\t\txhrOptions.url = xhrOptions.url + (querystring ? prefix + querystring : \"\")\r\n\t\t}\r\n\t\telse xhrOptions.data = serialize(data);\r\n\t\treturn xhrOptions\r\n\t}\r\n\tfunction parameterizeUrl(url, data) {\r\n\t\tvar tokens = url.match(/:[a-z]\\w+/gi);\r\n\t\tif (tokens && data) {\r\n\t\t\tfor (var i = 0; i < tokens.length; i++) {\r\n\t\t\t\tvar key = tokens[i].slice(1);\r\n\t\t\t\turl = url.replace(tokens[i], data[key]);\r\n\t\t\t\tdelete data[key]\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn url\r\n\t}\r\n\r\n\tm.request = function(xhrOptions) {\r\n\t\tif (xhrOptions.background !== true) m.startComputation();\r\n\t\tvar deferred = new Deferred();\r\n\t\tvar isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === \"jsonp\";\r\n\t\tvar serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify;\r\n\t\tvar deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse;\r\n\t\tvar extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) {\r\n\t\t\treturn xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText\r\n\t\t};\r\n\t\txhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();\r\n\t\txhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data);\r\n\t\txhrOptions = bindData(xhrOptions, xhrOptions.data, serialize);\r\n\t\txhrOptions.onload = xhrOptions.onerror = function(e) {\r\n\t\t\ttry {\r\n\t\t\t\te = e || event;\r\n\t\t\t\tvar unwrap = (e.type === \"load\" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity;\r\n\t\t\t\tvar response = unwrap(deserialize(extract(e.target, xhrOptions)), e.target);\r\n\t\t\t\tif (e.type === \"load\") {\r\n\t\t\t\t\tif (type.call(response) === ARRAY && xhrOptions.type) {\r\n\t\t\t\t\t\tfor (var i = 0; i < response.length; i++) response[i] = new xhrOptions.type(response[i])\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (xhrOptions.type) response = new xhrOptions.type(response)\r\n\t\t\t\t}\r\n\t\t\t\tdeferred[e.type === \"load\" ? \"resolve\" : \"reject\"](response)\r\n\t\t\t}\r\n\t\t\tcatch (e) {\r\n\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\tdeferred.reject(e)\r\n\t\t\t}\r\n\t\t\tif (xhrOptions.background !== true) m.endComputation()\r\n\t\t};\r\n\t\tajax(xhrOptions);\r\n\t\tdeferred.promise = propify(deferred.promise, xhrOptions.initialValue);\r\n\t\treturn deferred.promise\r\n\t};\r\n\r\n\t//testing API\r\n\tm.deps = function(mock) {\r\n\t\tinitialize(window = mock || window);\r\n\t\treturn window;\r\n\t};\r\n\t//for internal testing only, do not use `m.deps.factory`\r\n\tm.deps.factory = app;\r\n\r\n\treturn m\r\n})(typeof window != \"undefined\" ? window : {});\r\n\r\nif (typeof module != \"undefined\" && module !== null && module.exports) module.exports = m;\r\nelse if (typeof define === \"function\" && define.amd) define(function() {return m});\r\n"]}