MailChimp for WordPress - Version 3.1.2

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 3.1.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.1.2

CHANGELOG.md CHANGED
@@ -1,6 +1,28 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 3.1.1 - February 1, 2016
5
 
6
  **Fixes**
1
  Changelog
2
  =========
3
 
4
+ #### 3.1.2 - February 15, 2016
5
+
6
+ **Fixes**
7
+
8
+ - Form JavaScript not working when another plugins loads Dojo framework.
9
+ - [ENTER] not submitting form settings or creating new-line.
10
+ - Internal fields marked as required not passing form validation.
11
+ - Deselecting all MailChimp lists wouldn't persist after saving form settings.
12
+ - No sign-up request firing for lists with only an `EMAIL` field.
13
+
14
+ **Improvements**
15
+
16
+ - Show accepted choice values for dropdown and radio fields in lists overview.
17
+ - Use all MailChimp lists for Lists Choice field, instead of just the selected ones.
18
+ - Failsafed JavaScript for when any other script loads RequireJS globally.
19
+
20
+ **Additions**
21
+
22
+ - Added support for [Shortcake](https://wordpress.org/plugins/shortcode-ui/) plugin.
23
+ - Error message for when no list is selected can now be customized from the form message settings.
24
+
25
+
26
  #### 3.1.1 - February 1, 2016
27
 
28
  **Fixes**
assets/js/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- (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})({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  // dependencies
@@ -2020,3 +2020,4 @@ else if (typeof define === "function" && define.amd) define(function() {return m
2020
  }.call(this));
2021
 
2022
  },{}]},{},[1]);
 
1
+ (function () { var require = undefined; var define = undefined; (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})({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  // dependencies
2020
  }.call(this));
2021
 
2022
  },{}]},{},[1]);
2023
+ })();
assets/js/admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function e(t,n,r){function o(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){"use strict";var r=e("mithril"),o=e("wolfy87-eventemitter"),i=document.getElementById("mc4wp-admin"),a=new o,l=e("./admin/tabs.js")(i),s=e("./admin/helpers.js"),u=e("./admin/settings.js")(i,s,a);window.mc4wp=window.mc4wp||{},window.mc4wp.deps=window.mc4wp.deps||{},window.mc4wp.deps.mithril=r,window.mc4wp.helpers=s,window.mc4wp.events=a,window.mc4wp.settings=u,window.mc4wp.tabs=l},{"./admin/helpers.js":2,"./admin/settings.js":3,"./admin/tabs.js":4,mithril:6,"wolfy87-eventemitter":7}],2:[function(e,t,n){"use strict";var r={};r.toggleElement=function(e){for(var t=document.querySelectorAll(e),n=0;n<t.length;n++){var r=t[n].clientHeight<=0;t[n].style.display=r?"":"none"}},r.bindEventToElement=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on"+t,n)},r.bindEventToElements=function(e,t,n){Array.prototype.forEach.call(e,function(e){r.bindEventToElement(e,t,n)})},r.debounce=function(e,t,n){var r;return function(){var o=this,i=arguments,a=function(){r=null,n||e.apply(o,i)},l=n&&!r;clearTimeout(r),r=setTimeout(a,t),l&&e.apply(o,i)}},function(){var e=document.querySelectorAll("[data-showif]");Array.prototype.forEach.call(e,function(e){function t(){if("boolean"!=typeof this.checked||this.checked){var t=this.value==n.value;a?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",Array.prototype.forEach.call(i,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}var n=JSON.parse(e.getAttribute("data-showif")),o=document.querySelectorAll('[name="'+n.element+'"]'),i=e.querySelectorAll("input,select,textarea:not([readonly])"),a=void 0===n.hide||n.hide;Array.prototype.forEach.call(o,function(e){t.call(e)}),r.bindEventToElements(o,"change",t)})}(),t.exports=r},{}],3:[function(e,t,n){var r=function(e,t,n){"use strict";function r(e,t){return u.filter(function(n){return n[e]===t})}function o(){return u}function i(){return u=[],Array.prototype.forEach.call(l,function(e){("boolean"!=typeof e.checked||e.checked)&&"object"==typeof s[e.value]&&u.push(s[e.value])}),n.trigger("selectedLists.change",[u]),u}function a(){var e=document.querySelectorAll(".lists--only-selected > *");Array.prototype.forEach.call(e,function(e){var t=e.getAttribute("data-list-id"),n=r("id",t).length>0;n?e.setAttribute("class",e.getAttribute("class").replace("hidden","")):e.setAttribute("class",e.getAttribute("class")+" hidden")})}var l=(e.querySelector("form"),e.querySelectorAll(".mc4wp-list-input")),s=mc4wp_vars.mailchimp.lists,u=[];return n.on("selectedLists.change",a),t.bindEventToElements(l,"change",i),i(),{getSelectedLists:o}};t.exports=r},{}],4:[function(e,t,n){var r=function(t){"use strict";function n(e){for(var t=0;t<h.length;t++)if(h[t].id===e)return h[t]}function r(e,t){if("string"==typeof e&&(e=n(e)),!e)return!1;void 0==t&&(t=!0),c.removeClass("tab-active").css("display","none"),d.removeClass("nav-tab-active"),Array.prototype.forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var r=s.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",r),o(e),f.value=r,"function"==typeof tb_remove&&tb_remove(),"fields"===e.id&&window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&mc4wp.forms.editor.refresh(),!0}function o(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function i(e){e=e||window.event;var t=this.getAttribute("data-tab");if(!t){var n=this.className.match(/nav-tab-(\w+)?/);n&&(t=n[1])}if(!t){var o=s.parse(this.href);if(!o.tab)return;t=o.tab}var i=r(t);return i?(e.preventDefault(),e.returnValue=!1,!1):!0}function a(){if(history.pushState){var e=c.filter(":visible").get(0);if(e){var t=n(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),o(t))}}}var l=window.jQuery,s=e("./url.js"),u=l(t),c=u.find(".tab"),d=u.find(".nav-tab"),f=t.querySelector('input[name="_wp_http_referer"]'),h=[];return l.each(c,function(e,n){var o=n.id.substring(4),i=l(n).find("h2").first().text();h.push({id:o,title:i,element:n,nav:t.querySelectorAll(".nav-tab-"+o),open:function(){return r(o)}})}),d.click(i),l(document.body).on("click",".tab-link",i),a(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){if(!e.state)return!0;var t=e.state;return r(t,!1)}),{open:r,get:n}};t.exports=r},{"./url.js":5}],5:[function(e,t,n){"use strict";var r={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var o=r.parse(e);return o[t]=n,r.build(o)}};t.exports=r},{}],6:[function(e,t,n){var r=function o(e,t){function n(e){j=e.document,S=e.location,R=e.cancelAnimationFrame||e.clearTimeout,T=e.requestAnimationFrame||e.setTimeout}function r(){var e,t=[].slice.call(arguments),n=!(null==t[1]||U.call(t[1])!==_||"tag"in t[1]||"view"in t[1]||"subtree"in t[1]),r=n?t[1]:{},o="class"in r?"class":"className",i={tag:"div",attrs:{}},a=[];if(U.call(t[0])!=M)throw new Error("selector in m(selector, attrs, children) should be a string");for(;e=I.exec(t[0]);)if(""===e[1]&&e[2])i.tag=e[2];else if("#"===e[1])i.attrs.id=e[2];else if("."===e[1])a.push(e[2]);else if("["===e[3][0]){var l=$.exec(e[3]);i.attrs[l[1]]=l[3]||(l[2]?"":!0)}var s=n?t.slice(2):t.slice(1);1===s.length&&U.call(s[0])===q?i.children=s[0]:i.children=s;for(var u in r)r.hasOwnProperty(u)&&(u===o&&null!=r[u]&&""!==r[u]?(a.push(r[u]),i.attrs[u]=""):i.attrs[u]=r[u]);return a.length>0&&(i.attrs[o]=a.join(" ")),i}function i(e,n,o,u,d,f,h,p,v,m,g){try{(null==d||null==d.toString())&&(d="")}catch(y){d=""}if("retain"===d.subtree)return f;var w=U.call(f),b=U.call(d);if(null==f||w!==b){if(null!=f)if(o&&o.nodes){var E=p-u,x=E+(b===q?d:f.nodes).length;s(o.nodes.slice(E,x),o.slice(E,x))}else f.nodes&&s(f.nodes,f);f=new d.constructor,f.tag&&(f={}),f.nodes=[]}if(b===q){for(var A=0,C=d.length;C>A;A++)U.call(d[A])===q&&(d=d.concat.apply([],d),A--,C=d.length);for(var O=[],L=f.length===d.length,k=0,N=1,S=2,T=3,R={},I=!1,A=0;A<f.length;A++)f[A]&&f[A].attrs&&null!=f[A].attrs.key&&(I=!0,R[f[A].attrs.key]={action:N,index:A});for(var $=0,A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){for(var V=0,C=d.length;C>V;V++)d[V]&&d[V].attrs&&null==d[V].attrs.key&&(d[V].attrs.key="__mithril__"+$++);break}if(I){var H=!1;if(d.length!=f.length)H=!0;else for(var z,J,A=0;z=f[A],J=d[A];A++)if(z.attrs&&J.attrs&&z.attrs.key!=J.attrs.key){H=!0;break}if(H){for(var A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){var K=d[A].attrs.key;R[K]?R[K]={action:T,index:A,from:R[K].index,element:f.nodes[R[K].index]||j.createElement("div")}:R[K]={action:S,index:A}}var F=[];for(var G in R)F.push(R[G]);var Q=F.sort(a),Y=new Array(f.length);Y.nodes=f.nodes.slice();for(var W,A=0;W=Q[A];A++){if(W.action===N&&(s(f[W.index].nodes,f[W.index]),Y.splice(W.index,1)),W.action===S){var X=j.createElement("div");X.key=d[W.index].attrs.key,e.insertBefore(X,e.childNodes[W.index]||null),Y.splice(W.index,0,{attrs:{key:d[W.index].attrs.key},nodes:[X]}),Y.nodes[W.index]=X}W.action===T&&(e.childNodes[W.index]!==W.element&&null!==W.element&&e.insertBefore(W.element,e.childNodes[W.index]||null),Y[W.index]=f[W.from],Y.nodes[W.index]=W.element)}f=Y}}for(var A=0,Z=0,C=d.length;C>A;A++){var te=i(e,n,f,p,d[A],f[Z],h,p+k||k,v,m,g);te!==t&&(te.nodes.intact||(L=!1),k+=te.$trusted?(te.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:U.call(te)===q?te.length:1,f[Z++]=te)}if(!L){for(var A=0,C=d.length;C>A;A++)null!=f[A]&&O.push.apply(O,f[A].nodes);for(var ne,A=0;ne=f.nodes[A];A++)null!=ne.parentNode&&O.indexOf(ne)<0&&s([ne],[f[A]]);d.length<f.length&&(f.length=d.length),f.nodes=O}}else if(null!=d&&b===_){for(var oe=[],ie=[];d.view;){var ae=d.view.$original||d.view,le="diff"==r.redraw.strategy()&&f.views?f.views.indexOf(ae):-1,se=le>-1?f.controllers[le]:new(d.controller||B),K=d&&d.attrs&&d.attrs.key;if(d=0==re||f&&f.controllers&&f.controllers.indexOf(se)>-1?d.view(se):{tag:"placeholder"},"retain"===d.subtree)return f;K&&(d.attrs||(d.attrs={}),d.attrs.key=K),se.onunload&&ee.push({controller:se,handler:se.onunload}),oe.push(ae),ie.push(se)}if(!d.tag&&ie.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");d.attrs||(d.attrs={}),f.attrs||(f.attrs={});var ue=Object.keys(d.attrs),ce=ue.length>("key"in d.attrs?1:0);if((d.tag!=f.tag||ue.sort().join()!=Object.keys(f.attrs).sort().join()||d.attrs.id!=f.attrs.id||d.attrs.key!=f.attrs.key||"all"==r.redraw.strategy()&&(!f.configContext||f.configContext.retain!==!0)||"diff"==r.redraw.strategy()&&f.configContext&&f.configContext.retain===!1)&&(f.nodes.length&&s(f.nodes),f.configContext&&typeof f.configContext.onunload===D&&f.configContext.onunload(),f.controllers))for(var se,A=0;se=f.controllers[A];A++)typeof se.onunload===D&&se.onunload({preventDefault:B});if(U.call(d.tag)!=M)return;var ne,de=0===f.nodes.length;if(d.attrs.xmlns?m=d.attrs.xmlns:"svg"===d.tag?m="http://www.w3.org/2000/svg":"math"===d.tag&&(m="http://www.w3.org/1998/Math/MathML"),de){if(ne=d.attrs.is?m===t?j.createElement(d.tag,d.attrs.is):j.createElementNS(m,d.tag,d.attrs.is):m===t?j.createElement(d.tag):j.createElementNS(m,d.tag),f={tag:d.tag,attrs:ce?l(ne,d.tag,d.attrs,{},m):d.attrs,children:null!=d.children&&d.children.length>0?i(ne,d.tag,t,t,d.children,f.children,!0,0,d.attrs.contenteditable?ne:v,m,g):d.children,nodes:[ne]},ie.length){f.views=oe,f.controllers=ie;for(var se,A=0;se=ie[A];A++)if(se.onunload&&se.onunload.$old&&(se.onunload=se.onunload.$old),re&&se.onunload){var fe=se.onunload;se.onunload=B,se.onunload.$old=fe}}f.children&&!f.children.nodes&&(f.children.nodes=[]),"select"===d.tag&&"value"in d.attrs&&l(ne,d.tag,{value:d.attrs.value},{},m),e.insertBefore(ne,e.childNodes[p]||null)}else ne=f.nodes[0],ce&&l(ne,d.tag,d.attrs,f.attrs,m),f.children=i(ne,d.tag,t,t,d.children,f.children,!1,0,d.attrs.contenteditable?ne:v,m,g),f.nodes.intact=!0,ie.length&&(f.views=oe,f.controllers=ie),h===!0&&null!=ne&&e.insertBefore(ne,e.childNodes[p]||null);if(typeof d.attrs.config===D){var he=f.configContext=f.configContext||{},pe=function(e,t){return function(){return e.attrs.config.apply(e,t)}};g.push(pe(d,[ne,!de,he,f]))}}else if(typeof d!=D){var O;0===f.nodes.length?(d.$trusted?O=c(e,p,d):(O=[j.createTextNode(d)],e.nodeName.match(P)||e.insertBefore(O[0],e.childNodes[p]||null)),f="string number boolean".indexOf(typeof d)>-1?new d.constructor(d):d,f.nodes=O):f.valueOf()!==d.valueOf()||h===!0?(O=f.nodes,v&&v===j.activeElement||(d.$trusted?(s(O,f),O=c(e,p,d)):"textarea"===n?e.value=d:v?v.innerHTML=d:((1===O[0].nodeType||O.length>1)&&(s(f.nodes,f),O=[j.createTextNode(d)]),e.insertBefore(O[0],e.childNodes[p]||null),O[0].nodeValue=d)),f=new d.constructor(d),f.nodes=O):f.nodes.intact=!0}return f}function a(e,t){return e.action-t.action||e.index-t.index}function l(e,t,n,r,o){for(var i in n){var a=n[i],l=r[i];if(i in r&&l===a)"value"===i&&"input"===t&&e.value!=a&&(e.value=a);else{r[i]=a;try{if("config"===i||"key"==i)continue;if(typeof a===D&&0===i.indexOf("on"))e[i]=d(a,e);else if("style"===i&&null!=a&&U.call(a)===_){for(var s in a)(null==l||l[s]!==a[s])&&(e.style[s]=a[s]);for(var s in l)s in a||(e.style[s]="")}else null!=o?"href"===i?e.setAttributeNS("http://www.w3.org/1999/xlink","href",a):"className"===i?e.setAttribute("class",a):e.setAttribute(i,a):i in e&&"list"!==i&&"style"!==i&&"form"!==i&&"type"!==i&&"width"!==i&&"height"!==i?("input"!==t||e[i]!==a)&&(e[i]=a):e.setAttribute(i,a)}catch(u){if(u.message.indexOf("Invalid argument")<0)throw u}}}return r}function s(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&u(t[n])}0!=e.length&&(e.length=0)}function u(e){if(e.configContext&&typeof e.configContext.onunload===D&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers)for(var t,n=0;t=e.controllers[n];n++)typeof t.onunload===D&&t.onunload({preventDefault:B});if(e.children)if(U.call(e.children)===q)for(var r,n=0;r=e.children[n];n++)u(r);else e.children.tag&&u(e.children)}function c(e,t,n){var r=e.childNodes[t];if(r){var o=1!=r.nodeType,i=j.createElement("span");o?(e.insertBefore(i,r||null),i.insertAdjacentHTML("beforebegin",n),e.removeChild(i)):r.insertAdjacentHTML("beforebegin",n)}else e.insertAdjacentHTML("beforeend",n);for(var a=[];e.childNodes[t]!==r;)a.push(e.childNodes[t]),t++;return a}function d(e,t){return function(n){n=n||event,r.redraw.strategy("diff"),r.startComputation();try{return e.call(t,n)}finally{oe()}}}function f(e){var t=z.indexOf(e);return 0>t?z.push(e)-1:t}function h(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t}function p(e,t){var n=function(){return(e.controller||B).apply(this,t)||this},r=function(n){return arguments.length>1&&(t=t.concat([].slice.call(arguments,1))),e.view.apply(e,t?[n].concat(t):[n])};r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function v(){X&&(X(),X=null);for(var e,t=0;e=F[t];t++)if(Q[t]){var n=G[t].controller&&G[t].controller.$$args?[Q[t]].concat(G[t].controller.$$args):[Q[t]];r.render(e,G[t].view?G[t].view(Q[t],n):"")}Z&&(Z(),Z=null),Y=null,W=new Date,r.redraw.strategy("diff")}function m(e){return e.slice(le[r.route.mode].length)}function g(e,t,n){ie={};var o=n.indexOf("?");-1!==o&&(ie=E(n.substr(o+1,n.length)),n=n.substr(0,o));var i=Object.keys(t),a=i.indexOf(n);if(-1!==a)return r.mount(e,t[i[a]]),!0;for(var l in t){if(l===n)return r.mount(e,t[l]),!0;var s=new RegExp("^"+l.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(s.test(n))return n.replace(s,function(){for(var n=l.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),i=0,a=n.length;a>i;i++)ie[n[i].replace(/:|\./g,"")]=decodeURIComponent(o[i]);r.mount(e,t[l])}),!0}}function y(e){if(e=e||event,!e.ctrlKey&&!e.metaKey&&2!==e.which){e.preventDefault?e.preventDefault():e.returnValue=!1;for(var t=e.currentTarget||e.srcElement,n="pathname"===r.route.mode&&t.search?E(t.search.slice(1)):{};t&&"A"!=t.nodeName.toUpperCase();)t=t.parentNode;r.route(t[r.route.mode].slice(le[r.route.mode].length),n)}}function w(){"hash"!=r.route.mode&&S.hash?S.hash=S.hash:e.scrollTo(0,0)}function b(e,n){var r={},o=[];for(var i in e){var a=n?n+"["+i+"]":i,l=e[i],s=U.call(l),u=null===l?encodeURIComponent(a):s===_?b(l,a):s===q?l.reduce(function(e,t){return r[a]||(r[a]={}),r[a][t]?e:(r[a][t]=!0,e.concat(encodeURIComponent(a)+"="+encodeURIComponent(t)))},[]).join("&"):encodeURIComponent(a)+"="+encodeURIComponent(l);l!==t&&o.push(u)}return o.join("&")}function E(e){"?"===e.charAt(0)&&(e=e.substring(1));for(var t=e.split("&"),n={},r=0,o=t.length;o>r;r++){var i=t[r].split("="),a=decodeURIComponent(i[0]),l=2==i.length?decodeURIComponent(i[1]):null;null!=n[a]?(U.call(n[a])!==q&&(n[a]=[n[a]]),n[a].push(l)):n[a]=l}return n}function x(e){var n=f(e);s(e.childNodes,J[n]),J[n]=t}function A(e,t){var n=r.prop(t);return e.then(n),n.then=function(n,r){return A(e.then(n,r),t)},n}function C(e,t){function n(e){d=e||u,h.map(function(e){d===s&&e.resolve(f)||e.reject(f)})}function o(e,t,n,o){if((null!=f&&U.call(f)===_||typeof f===D)&&typeof e===D)try{var i=0;e.call(f,function(e){i++||(f=e,t())},function(e){i++||(f=e,n())})}catch(a){r.deferred.onerror(a),f=a,n()}else o()}function i(){var u;try{u=f&&f.then}catch(h){return r.deferred.onerror(h),f=h,d=l,i()}o(u,function(){d=a,i()},function(){d=l,i()},function(){try{d===a&&typeof e===D?f=e(f):d===l&&"function"==typeof t&&(f=t(f),d=a)}catch(i){return r.deferred.onerror(i),f=i,n()}f===c?(f=TypeError(),n()):o(u,function(){n(s)},n,function(){n(d===a&&s)})})}var a=1,l=2,s=3,u=4,c=this,d=0,f=0,h=[];c.promise={},c.resolve=function(e){return d||(f=e,d=a,i()),this},c.reject=function(e){return d||(f=e,d=l,i()),this},c.promise.then=function(e,t){var n=new C(e,t);return d===s?n.resolve(f):d===u?n.reject(f):h.push(n),n.promise}}function O(e){return e}function L(n){if(!n.dataType||"jsonp"!==n.dataType.toLowerCase()){var r=new e.XMLHttpRequest;if(r.open(n.method,n.url,!0,n.user,n.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?n.onload({type:"load",target:r}):n.onerror({type:"error",target:r}))},n.serialize===JSON.stringify&&n.data&&"GET"!==n.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),typeof n.config===D){var o=n.config(r,n);null!=o&&(r=o)}var i="GET"!==n.method&&n.data?n.data:"";if(i&&U.call(i)!=M&&i.constructor!=e.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return r.send(i),r}var a="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),l=j.createElement("script");e[a]=function(r){l.parentNode.removeChild(l),n.onload({type:"load",target:{responseText:r}}),e[a]=t},l.onerror=function(r){return l.parentNode.removeChild(l),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[a]=t,!1},l.onload=function(e){return!1},l.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+a+"&"+b(n.data||{}),j.body.appendChild(l)}function k(e,t,n){if("GET"===e.method&&"jsonp"!=e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=b(t);e.url=e.url+(o?r+o:"")}else e.data=n(t);return e}function N(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;r<n.length;r++){var o=n[r].slice(1);e=e.replace(n[r],t[o]),delete t[o]}return e}var j,S,T,R,_="[object Object]",q="[object Array]",M="[object String]",D="function",U={}.toString,I=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,$=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,P=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/,B=function(){};n(e);var V,H={appendChild:function(e){V===t&&(V=j.createElement("html")),j.documentElement&&j.documentElement!==e?j.replaceChild(e,j.documentElement):j.appendChild(e),this.childNodes=j.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},z=[],J={};r.render=function(e,n,r){var o=[];if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var a=f(e),l=e===j,u=l||e===j.documentElement?H:e;l&&"html"!=n.tag&&(n={tag:"html",attrs:{},children:n}),J[a]===t&&s(u.childNodes),r===!0&&x(e),J[a]=i(u,null,t,t,n,J[a],!1,0,null,t,o);for(var c=0,d=o.length;d>c;c++)o[c]()},r.trust=function(e){return e=new String(e),e.$trusted=!0,e},r.prop=function(e){return(null!=e&&U.call(e)===_||typeof e===D)&&typeof e.then===D?A(e):h(e)};var K,F=[],G=[],Q=[],Y=null,W=0,X=null,Z=null,ee=[],te=16;r.component=function(e){return p(e,[].slice.call(arguments,1))},r.mount=r.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var n=F.indexOf(e);0>n&&(n=F.length);for(var o,i=!1,a={preventDefault:function(){i=!0,X=Z=null}},l=0;o=ee[l];l++)o.handler.call(o.controller,a),o.controller.onunload=null;if(i)for(var o,l=0;o=ee[l];l++)o.controller.onunload=o.handler;else ee=[];if(Q[n]&&typeof Q[n].onunload===D&&Q[n].onunload(a),!i){r.redraw.strategy("all"),r.startComputation(),F[n]=e,arguments.length>2&&(t=subcomponent(t,[].slice.call(arguments,2)));var s=K=t=t||{controller:function(){}},u=t.controller||B,c=new u;return s===K&&(Q[n]=c,G[n]=t),oe(),Q[n]}};var ne=!1;r.redraw=function(t){ne||(ne=!0,Y&&t!==!0?(T===e.requestAnimationFrame||new Date-W>te)&&(Y>0&&R(Y),Y=T(v,te)):(v(),Y=T(function(){Y=null},te)),ne=!1)},r.redraw.strategy=r.prop();var re=0;r.startComputation=function(){re++},r.endComputation=function(){re=Math.max(re-1,0),0===re&&r.redraw()};var oe=function(){"none"==r.redraw.strategy()?(re--,r.redraw.strategy("diff")):r.endComputation()};r.withAttr=function(e,t){return function(n){n=n||event;var r=n.currentTarget||this;t(e in r?r[e]:r.getAttribute(e))}};var ie,ae,le={pathname:"",hash:"#",search:"?"},se=B,ue=!1;return r.route=function(){if(0===arguments.length)return ae;if(3===arguments.length&&U.call(arguments[1])===M){var t=arguments[0],n=arguments[1],o=arguments[2];se=function(e){var i=ae=m(e);if(!g(t,o,i)){if(ue)throw new Error("Ensure the default route matches one of the routes defined in m.route");ue=!0,r.route(n,!0),ue=!1}};var i="hash"===r.route.mode?"onhashchange":"onpopstate";e[i]=function(){var e=S[r.route.mode];"pathname"===r.route.mode&&(e+=S.search),ae!=m(e)&&se(e)},X=w,e[i]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){var a=arguments[0],l=(arguments[1],arguments[2],arguments[3]);a.href=("pathname"!==r.route.mode?S.pathname:"")+le[r.route.mode]+l.attrs.href,a.addEventListener?(a.removeEventListener("click",y),a.addEventListener("click",y)):(a.detachEvent("onclick",y),a.attachEvent("onclick",y))}else if(U.call(arguments[0])===M){var s=ae;ae=arguments[0];var u=arguments[1]||{},c=ae.indexOf("?"),d=c>-1?E(ae.slice(c+1)):{};for(var f in u)d[f]=u[f];var h=b(d),p=c>-1?ae.slice(0,c):ae;h&&(ae=p+(-1===p.indexOf("?")?"?":"&")+h);var v=(3===arguments.length?arguments[2]:arguments[1])===!0||s===arguments[0];e.history.pushState?(X=w,Z=function(){e.history[v?"replaceState":"pushState"](null,j.title,le[r.route.mode]+ae)},se(le[r.route.mode]+ae)):(S[r.route.mode]=ae,se(le[r.route.mode]+ae))}},r.route.param=function(e){if(!ie)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return ie[e]},r.route.mode="search",r.route.buildQueryString=b,r.route.parseQueryString=E,r.deferred=function(){var e=new C;return e.promise=A(e.promise),e},r.deferred.onerror=function(e){if("[object Error]"===U.call(e)&&!e.constructor.toString().match(/ Error/))throw e},r.sync=function(e){function t(e,t){return function(r){return a[e]=r,t||(n="reject"),0===--i&&(o.promise(a),o[n](a)),r}}var n="resolve",o=r.deferred(),i=e.length,a=new Array(i);if(e.length>0)for(var l=0;l<e.length;l++)e[l].then(t(l,!0),t(l,!1));else o.resolve([]);return o.promise},r.request=function(e){e.background!==!0&&r.startComputation();var t=new C,n=e.dataType&&"jsonp"===e.dataType.toLowerCase(),o=e.serialize=n?O:e.serialize||JSON.stringify,i=e.deserialize=n?O:e.deserialize||JSON.parse,a=n?function(e){return e.responseText}:e.extract||function(e){return 0===e.responseText.length&&i===JSON.parse?null:e.responseText};return e.method=(e.method||"GET").toUpperCase(),e.url=N(e.url,e.data),e=k(e,e.data,o),e.onload=e.onerror=function(n){try{n=n||event;var o=("load"===n.type?e.unwrapSuccess:e.unwrapError)||O,l=o(i(a(n.target,e)),n.target);if("load"===n.type)if(U.call(l)===q&&e.type)for(var s=0;s<l.length;s++)l[s]=new e.type(l[s]);else e.type&&(l=new e.type(l));t["load"===n.type?"resolve":"reject"](l)}catch(n){r.deferred.onerror(n),t.reject(n)}e.background!==!0&&r.endComputation()},L(e),t.promise=A(t.promise,e.initialValue),t.promise},r.deps=function(t){return n(e=t||e),e},r.deps.factory=o,r}("undefined"!=typeof window?window:{});"undefined"!=typeof t&&null!==t&&t.exports?t.exports=r:"function"==typeof define&&define.amd&&define(function(){return r})},{}],7:[function(e,t,n){(function(){"use strict";function e(){}function n(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function r(e){return function(){return this[e].apply(this,arguments)}}var o=e.prototype,i=this,a=i.EventEmitter;o.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},o.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},o.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},o.addListener=function(e,t){var r,o=this.getListenersAsObject(e),i="object"==typeof t;for(r in o)o.hasOwnProperty(r)&&-1===n(o[r],t)&&o[r].push(i?t:{listener:t,once:!1});return this},o.on=r("addListener"),o.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},o.once=r("addOnceListener"),o.defineEvent=function(e){return this.getListeners(e),this},o.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},o.removeListener=function(e,t){var r,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(r=n(i[o],t),-1!==r&&i[o].splice(r,1));return this},o.off=r("removeListener"),o.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},o.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},o.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):a.call(this,r,o));return this},o.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},o.removeAllListeners=r("removeEvent"),o.emitEvent=function(e,t){var n,r,o,i,a,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),a=r.listener.apply(this,t||[]),a===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},o.trigger=r("emitEvent"),o.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},o.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},o._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return i.EventEmitter=a,e},"function"==typeof define&&define.amd?define(function(){return e}):"object"==typeof t&&t.exports?t.exports=e:i.EventEmitter=e}).call(this)},{}]},{},[1]);
2
  //# sourceMappingURL=admin.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(l,s){if(!r[l]){if(!t[l]){var u="function"==typeof e&&e;if(!s&&u)return u(l,!0);if(a)return a(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var d=r[l]={exports:{}};t[l][0].call(d.exports,function(e){var n=t[l][1][e];return i(n?n:e)},d,d.exports,n,t,r,o)}return r[l].exports}for(var a="function"==typeof e&&e,l=0;l<o.length;l++)i(o[l]);return i}({1:[function(e,t,n){"use strict";var r=e("mithril"),o=e("wolfy87-eventemitter"),i=document.getElementById("mc4wp-admin"),a=new o,l=e("./admin/tabs.js")(i),s=e("./admin/helpers.js"),u=e("./admin/settings.js")(i,s,a);window.mc4wp=window.mc4wp||{},window.mc4wp.deps=window.mc4wp.deps||{},window.mc4wp.deps.mithril=r,window.mc4wp.helpers=s,window.mc4wp.events=a,window.mc4wp.settings=u,window.mc4wp.tabs=l},{"./admin/helpers.js":2,"./admin/settings.js":3,"./admin/tabs.js":4,mithril:6,"wolfy87-eventemitter":7}],2:[function(e,t,n){"use strict";var r={};r.toggleElement=function(e){for(var t=document.querySelectorAll(e),n=0;n<t.length;n++){var r=t[n].clientHeight<=0;t[n].style.display=r?"":"none"}},r.bindEventToElement=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on"+t,n)},r.bindEventToElements=function(e,t,n){Array.prototype.forEach.call(e,function(e){r.bindEventToElement(e,t,n)})},r.debounce=function(e,t,n){var r;return function(){var o=this,i=arguments,a=function(){r=null,n||e.apply(o,i)},l=n&&!r;clearTimeout(r),r=setTimeout(a,t),l&&e.apply(o,i)}},function(){var e=document.querySelectorAll("[data-showif]");Array.prototype.forEach.call(e,function(e){function t(){if("boolean"!=typeof this.checked||this.checked){var t=this.value==n.value;a?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",Array.prototype.forEach.call(i,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}var n=JSON.parse(e.getAttribute("data-showif")),o=document.querySelectorAll('[name="'+n.element+'"]'),i=e.querySelectorAll("input,select,textarea:not([readonly])"),a=void 0===n.hide||n.hide;Array.prototype.forEach.call(o,function(e){t.call(e)}),r.bindEventToElements(o,"change",t)})}(),t.exports=r},{}],3:[function(e,t,n){var r=function(e,t,n){"use strict";function r(e,t){return u.filter(function(n){return n[e]===t})}function o(){return u}function i(){return u=[],Array.prototype.forEach.call(l,function(e){("boolean"!=typeof e.checked||e.checked)&&"object"==typeof s[e.value]&&u.push(s[e.value])}),n.trigger("selectedLists.change",[u]),u}function a(){var e=document.querySelectorAll(".lists--only-selected > *");Array.prototype.forEach.call(e,function(e){var t=e.getAttribute("data-list-id"),n=r("id",t).length>0;n?e.setAttribute("class",e.getAttribute("class").replace("hidden","")):e.setAttribute("class",e.getAttribute("class")+" hidden")})}var l=(e.querySelector("form"),e.querySelectorAll(".mc4wp-list-input")),s=mc4wp_vars.mailchimp.lists,u=[];return n.on("selectedLists.change",a),t.bindEventToElements(l,"change",i),i(),{getSelectedLists:o}};t.exports=r},{}],4:[function(e,t,n){var r=function(t){"use strict";function n(e){for(var t=0;t<h.length;t++)if(h[t].id===e)return h[t]}function r(e,t){if("string"==typeof e&&(e=n(e)),!e)return!1;void 0==t&&(t=!0),c.removeClass("tab-active").css("display","none"),d.removeClass("nav-tab-active"),Array.prototype.forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var r=s.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",r),o(e),f.value=r,"function"==typeof tb_remove&&tb_remove(),"fields"===e.id&&window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&mc4wp.forms.editor.refresh(),!0}function o(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function i(e){e=e||window.event;var t=this.getAttribute("data-tab");if(!t){var n=this.className.match(/nav-tab-(\w+)?/);n&&(t=n[1])}if(!t){var o=s.parse(this.href);if(!o.tab)return;t=o.tab}var i=r(t);return i?(e.preventDefault(),e.returnValue=!1,!1):!0}function a(){if(history.pushState){var e=c.filter(":visible").get(0);if(e){var t=n(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),o(t))}}}var l=window.jQuery,s=e("./url.js"),u=l(t),c=u.find(".tab"),d=u.find(".nav-tab"),f=t.querySelector('input[name="_wp_http_referer"]'),h=[];return l.each(c,function(e,n){var o=n.id.substring(4),i=l(n).find("h2").first().text();h.push({id:o,title:i,element:n,nav:t.querySelectorAll(".nav-tab-"+o),open:function(){return r(o)}})}),d.click(i),l(document.body).on("click",".tab-link",i),a(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){if(!e.state)return!0;var t=e.state;return r(t,!1)}),{open:r,get:n}};t.exports=r},{"./url.js":5}],5:[function(e,t,n){"use strict";var r={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var o=r.parse(e);return o[t]=n,r.build(o)}};t.exports=r},{}],6:[function(e,n,r){var o=function i(e,t){function n(e){j=e.document,S=e.location,R=e.cancelAnimationFrame||e.clearTimeout,T=e.requestAnimationFrame||e.setTimeout}function r(){var e,t=[].slice.call(arguments),n=!(null==t[1]||U.call(t[1])!==_||"tag"in t[1]||"view"in t[1]||"subtree"in t[1]),r=n?t[1]:{},o="class"in r?"class":"className",i={tag:"div",attrs:{}},a=[];if(U.call(t[0])!=q)throw new Error("selector in m(selector, attrs, children) should be a string");for(;e=I.exec(t[0]);)if(""===e[1]&&e[2])i.tag=e[2];else if("#"===e[1])i.attrs.id=e[2];else if("."===e[1])a.push(e[2]);else if("["===e[3][0]){var l=$.exec(e[3]);i.attrs[l[1]]=l[3]||(l[2]?"":!0)}var s=n?t.slice(2):t.slice(1);1===s.length&&U.call(s[0])===M?i.children=s[0]:i.children=s;for(var u in r)r.hasOwnProperty(u)&&(u===o&&null!=r[u]&&""!==r[u]?(a.push(r[u]),i.attrs[u]=""):i.attrs[u]=r[u]);return a.length>0&&(i.attrs[o]=a.join(" ")),i}function o(e,n,i,u,d,f,h,p,v,m,g){try{(null==d||null==d.toString())&&(d="")}catch(y){d=""}if("retain"===d.subtree)return f;var w=U.call(f),b=U.call(d);if(null==f||w!==b){if(null!=f)if(i&&i.nodes){var E=p-u,x=E+(b===M?d:f.nodes).length;s(i.nodes.slice(E,x),i.slice(E,x))}else f.nodes&&s(f.nodes,f);f=new d.constructor,f.tag&&(f={}),f.nodes=[]}if(b===M){for(var A=0,C=d.length;C>A;A++)U.call(d[A])===M&&(d=d.concat.apply([],d),A--,C=d.length);for(var O=[],L=f.length===d.length,k=0,N=1,S=2,T=3,R={},I=!1,A=0;A<f.length;A++)f[A]&&f[A].attrs&&null!=f[A].attrs.key&&(I=!0,R[f[A].attrs.key]={action:N,index:A});for(var $=0,A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){for(var V=0,C=d.length;C>V;V++)d[V]&&d[V].attrs&&null==d[V].attrs.key&&(d[V].attrs.key="__mithril__"+$++);break}if(I){var H=!1;if(d.length!=f.length)H=!0;else for(var z,J,A=0;z=f[A],J=d[A];A++)if(z.attrs&&J.attrs&&z.attrs.key!=J.attrs.key){H=!0;break}if(H){for(var A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){var K=d[A].attrs.key;R[K]?R[K]={action:T,index:A,from:R[K].index,element:f.nodes[R[K].index]||j.createElement("div")}:R[K]={action:S,index:A}}var F=[];for(var G in R)F.push(R[G]);var Q=F.sort(a),Y=new Array(f.length);Y.nodes=f.nodes.slice();for(var W,A=0;W=Q[A];A++){if(W.action===N&&(s(f[W.index].nodes,f[W.index]),Y.splice(W.index,1)),W.action===S){var X=j.createElement("div");X.key=d[W.index].attrs.key,e.insertBefore(X,e.childNodes[W.index]||null),Y.splice(W.index,0,{attrs:{key:d[W.index].attrs.key},nodes:[X]}),Y.nodes[W.index]=X}W.action===T&&(e.childNodes[W.index]!==W.element&&null!==W.element&&e.insertBefore(W.element,e.childNodes[W.index]||null),Y[W.index]=f[W.from],Y.nodes[W.index]=W.element)}f=Y}}for(var A=0,Z=0,C=d.length;C>A;A++){var te=o(e,n,f,p,d[A],f[Z],h,p+k||k,v,m,g);te!==t&&(te.nodes.intact||(L=!1),k+=te.$trusted?(te.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:U.call(te)===M?te.length:1,f[Z++]=te)}if(!L){for(var A=0,C=d.length;C>A;A++)null!=f[A]&&O.push.apply(O,f[A].nodes);for(var ne,A=0;ne=f.nodes[A];A++)null!=ne.parentNode&&O.indexOf(ne)<0&&s([ne],[f[A]]);d.length<f.length&&(f.length=d.length),f.nodes=O}}else if(null!=d&&b===_){for(var oe=[],ie=[];d.view;){var ae=d.view.$original||d.view,le="diff"==r.redraw.strategy()&&f.views?f.views.indexOf(ae):-1,se=le>-1?f.controllers[le]:new(d.controller||B),K=d&&d.attrs&&d.attrs.key;if(d=0==re||f&&f.controllers&&f.controllers.indexOf(se)>-1?d.view(se):{tag:"placeholder"},"retain"===d.subtree)return f;K&&(d.attrs||(d.attrs={}),d.attrs.key=K),se.onunload&&ee.push({controller:se,handler:se.onunload}),oe.push(ae),ie.push(se)}if(!d.tag&&ie.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");d.attrs||(d.attrs={}),f.attrs||(f.attrs={});var ue=Object.keys(d.attrs),ce=ue.length>("key"in d.attrs?1:0);if((d.tag!=f.tag||ue.sort().join()!=Object.keys(f.attrs).sort().join()||d.attrs.id!=f.attrs.id||d.attrs.key!=f.attrs.key||"all"==r.redraw.strategy()&&(!f.configContext||f.configContext.retain!==!0)||"diff"==r.redraw.strategy()&&f.configContext&&f.configContext.retain===!1)&&(f.nodes.length&&s(f.nodes),f.configContext&&typeof f.configContext.onunload===D&&f.configContext.onunload(),f.controllers))for(var se,A=0;se=f.controllers[A];A++)typeof se.onunload===D&&se.onunload({preventDefault:B});if(U.call(d.tag)!=q)return;var ne,de=0===f.nodes.length;if(d.attrs.xmlns?m=d.attrs.xmlns:"svg"===d.tag?m="http://www.w3.org/2000/svg":"math"===d.tag&&(m="http://www.w3.org/1998/Math/MathML"),de){if(ne=d.attrs.is?m===t?j.createElement(d.tag,d.attrs.is):j.createElementNS(m,d.tag,d.attrs.is):m===t?j.createElement(d.tag):j.createElementNS(m,d.tag),f={tag:d.tag,attrs:ce?l(ne,d.tag,d.attrs,{},m):d.attrs,children:null!=d.children&&d.children.length>0?o(ne,d.tag,t,t,d.children,f.children,!0,0,d.attrs.contenteditable?ne:v,m,g):d.children,nodes:[ne]},ie.length){f.views=oe,f.controllers=ie;for(var se,A=0;se=ie[A];A++)if(se.onunload&&se.onunload.$old&&(se.onunload=se.onunload.$old),re&&se.onunload){var fe=se.onunload;se.onunload=B,se.onunload.$old=fe}}f.children&&!f.children.nodes&&(f.children.nodes=[]),"select"===d.tag&&"value"in d.attrs&&l(ne,d.tag,{value:d.attrs.value},{},m),e.insertBefore(ne,e.childNodes[p]||null)}else ne=f.nodes[0],ce&&l(ne,d.tag,d.attrs,f.attrs,m),f.children=o(ne,d.tag,t,t,d.children,f.children,!1,0,d.attrs.contenteditable?ne:v,m,g),f.nodes.intact=!0,ie.length&&(f.views=oe,f.controllers=ie),h===!0&&null!=ne&&e.insertBefore(ne,e.childNodes[p]||null);if(typeof d.attrs.config===D){var he=f.configContext=f.configContext||{},pe=function(e,t){return function(){return e.attrs.config.apply(e,t)}};g.push(pe(d,[ne,!de,he,f]))}}else if(typeof d!=D){var O;0===f.nodes.length?(d.$trusted?O=c(e,p,d):(O=[j.createTextNode(d)],e.nodeName.match(P)||e.insertBefore(O[0],e.childNodes[p]||null)),f="string number boolean".indexOf(typeof d)>-1?new d.constructor(d):d,f.nodes=O):f.valueOf()!==d.valueOf()||h===!0?(O=f.nodes,v&&v===j.activeElement||(d.$trusted?(s(O,f),O=c(e,p,d)):"textarea"===n?e.value=d:v?v.innerHTML=d:((1===O[0].nodeType||O.length>1)&&(s(f.nodes,f),O=[j.createTextNode(d)]),e.insertBefore(O[0],e.childNodes[p]||null),O[0].nodeValue=d)),f=new d.constructor(d),f.nodes=O):f.nodes.intact=!0}return f}function a(e,t){return e.action-t.action||e.index-t.index}function l(e,t,n,r,o){for(var i in n){var a=n[i],l=r[i];if(i in r&&l===a)"value"===i&&"input"===t&&e.value!=a&&(e.value=a);else{r[i]=a;try{if("config"===i||"key"==i)continue;if(typeof a===D&&0===i.indexOf("on"))e[i]=d(a,e);else if("style"===i&&null!=a&&U.call(a)===_){for(var s in a)(null==l||l[s]!==a[s])&&(e.style[s]=a[s]);for(var s in l)s in a||(e.style[s]="")}else null!=o?"href"===i?e.setAttributeNS("http://www.w3.org/1999/xlink","href",a):"className"===i?e.setAttribute("class",a):e.setAttribute(i,a):i in e&&"list"!==i&&"style"!==i&&"form"!==i&&"type"!==i&&"width"!==i&&"height"!==i?("input"!==t||e[i]!==a)&&(e[i]=a):e.setAttribute(i,a)}catch(u){if(u.message.indexOf("Invalid argument")<0)throw u}}}return r}function s(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&u(t[n])}0!=e.length&&(e.length=0)}function u(e){if(e.configContext&&typeof e.configContext.onunload===D&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers)for(var t,n=0;t=e.controllers[n];n++)typeof t.onunload===D&&t.onunload({preventDefault:B});if(e.children)if(U.call(e.children)===M)for(var r,n=0;r=e.children[n];n++)u(r);else e.children.tag&&u(e.children)}function c(e,t,n){var r=e.childNodes[t];if(r){var o=1!=r.nodeType,i=j.createElement("span");o?(e.insertBefore(i,r||null),i.insertAdjacentHTML("beforebegin",n),e.removeChild(i)):r.insertAdjacentHTML("beforebegin",n)}else e.insertAdjacentHTML("beforeend",n);for(var a=[];e.childNodes[t]!==r;)a.push(e.childNodes[t]),t++;return a}function d(e,t){return function(n){n=n||event,r.redraw.strategy("diff"),r.startComputation();try{return e.call(t,n)}finally{oe()}}}function f(e){var t=z.indexOf(e);return 0>t?z.push(e)-1:t}function h(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t}function p(e,t){var n=function(){return(e.controller||B).apply(this,t)||this},r=function(n){return arguments.length>1&&(t=t.concat([].slice.call(arguments,1))),e.view.apply(e,t?[n].concat(t):[n])};r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function v(){X&&(X(),X=null);for(var e,t=0;e=F[t];t++)if(Q[t]){var n=G[t].controller&&G[t].controller.$$args?[Q[t]].concat(G[t].controller.$$args):[Q[t]];r.render(e,G[t].view?G[t].view(Q[t],n):"")}Z&&(Z(),Z=null),Y=null,W=new Date,r.redraw.strategy("diff")}function m(e){return e.slice(le[r.route.mode].length)}function g(e,t,n){ie={};var o=n.indexOf("?");-1!==o&&(ie=E(n.substr(o+1,n.length)),n=n.substr(0,o));var i=Object.keys(t),a=i.indexOf(n);if(-1!==a)return r.mount(e,t[i[a]]),!0;for(var l in t){if(l===n)return r.mount(e,t[l]),!0;var s=new RegExp("^"+l.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(s.test(n))return n.replace(s,function(){for(var n=l.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),i=0,a=n.length;a>i;i++)ie[n[i].replace(/:|\./g,"")]=decodeURIComponent(o[i]);r.mount(e,t[l])}),!0}}function y(e){if(e=e||event,!e.ctrlKey&&!e.metaKey&&2!==e.which){e.preventDefault?e.preventDefault():e.returnValue=!1;for(var t=e.currentTarget||e.srcElement,n="pathname"===r.route.mode&&t.search?E(t.search.slice(1)):{};t&&"A"!=t.nodeName.toUpperCase();)t=t.parentNode;r.route(t[r.route.mode].slice(le[r.route.mode].length),n)}}function w(){"hash"!=r.route.mode&&S.hash?S.hash=S.hash:e.scrollTo(0,0)}function b(e,n){var r={},o=[];for(var i in e){var a=n?n+"["+i+"]":i,l=e[i],s=U.call(l),u=null===l?encodeURIComponent(a):s===_?b(l,a):s===M?l.reduce(function(e,t){return r[a]||(r[a]={}),r[a][t]?e:(r[a][t]=!0,e.concat(encodeURIComponent(a)+"="+encodeURIComponent(t)))},[]).join("&"):encodeURIComponent(a)+"="+encodeURIComponent(l);l!==t&&o.push(u)}return o.join("&")}function E(e){"?"===e.charAt(0)&&(e=e.substring(1));for(var t=e.split("&"),n={},r=0,o=t.length;o>r;r++){var i=t[r].split("="),a=decodeURIComponent(i[0]),l=2==i.length?decodeURIComponent(i[1]):null;null!=n[a]?(U.call(n[a])!==M&&(n[a]=[n[a]]),n[a].push(l)):n[a]=l}return n}function x(e){var n=f(e);s(e.childNodes,J[n]),J[n]=t}function A(e,t){var n=r.prop(t);return e.then(n),n.then=function(n,r){return A(e.then(n,r),t)},n}function C(e,t){function n(e){d=e||u,h.map(function(e){d===s&&e.resolve(f)||e.reject(f)})}function o(e,t,n,o){if((null!=f&&U.call(f)===_||typeof f===D)&&typeof e===D)try{var i=0;e.call(f,function(e){i++||(f=e,t())},function(e){i++||(f=e,n())})}catch(a){r.deferred.onerror(a),f=a,n()}else o()}function i(){var u;try{u=f&&f.then}catch(h){return r.deferred.onerror(h),f=h,d=l,i()}o(u,function(){d=a,i()},function(){d=l,i()},function(){try{d===a&&typeof e===D?f=e(f):d===l&&"function"==typeof t&&(f=t(f),d=a)}catch(i){return r.deferred.onerror(i),f=i,n()}f===c?(f=TypeError(),n()):o(u,function(){n(s)},n,function(){n(d===a&&s)})})}var a=1,l=2,s=3,u=4,c=this,d=0,f=0,h=[];c.promise={},c.resolve=function(e){return d||(f=e,d=a,i()),this},c.reject=function(e){return d||(f=e,d=l,i()),this},c.promise.then=function(e,t){var n=new C(e,t);return d===s?n.resolve(f):d===u?n.reject(f):h.push(n),n.promise}}function O(e){return e}function L(n){if(!n.dataType||"jsonp"!==n.dataType.toLowerCase()){var r=new e.XMLHttpRequest;if(r.open(n.method,n.url,!0,n.user,n.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?n.onload({type:"load",target:r}):n.onerror({type:"error",target:r}))},n.serialize===JSON.stringify&&n.data&&"GET"!==n.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),typeof n.config===D){var o=n.config(r,n);null!=o&&(r=o)}var i="GET"!==n.method&&n.data?n.data:"";if(i&&U.call(i)!=q&&i.constructor!=e.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return r.send(i),r}var a="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),l=j.createElement("script");e[a]=function(r){l.parentNode.removeChild(l),n.onload({type:"load",target:{responseText:r}}),e[a]=t},l.onerror=function(r){return l.parentNode.removeChild(l),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[a]=t,!1},l.onload=function(e){return!1},l.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+a+"&"+b(n.data||{}),j.body.appendChild(l)}function k(e,t,n){if("GET"===e.method&&"jsonp"!=e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=b(t);e.url=e.url+(o?r+o:"")}else e.data=n(t);return e}function N(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;r<n.length;r++){var o=n[r].slice(1);e=e.replace(n[r],t[o]),delete t[o]}return e}var j,S,T,R,_="[object Object]",M="[object Array]",q="[object String]",D="function",U={}.toString,I=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,$=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,P=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/,B=function(){};n(e);var V,H={appendChild:function(e){V===t&&(V=j.createElement("html")),j.documentElement&&j.documentElement!==e?j.replaceChild(e,j.documentElement):j.appendChild(e),this.childNodes=j.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},z=[],J={};r.render=function(e,n,r){var i=[];if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var a=f(e),l=e===j,u=l||e===j.documentElement?H:e;l&&"html"!=n.tag&&(n={tag:"html",attrs:{},children:n}),J[a]===t&&s(u.childNodes),r===!0&&x(e),J[a]=o(u,null,t,t,n,J[a],!1,0,null,t,i);for(var c=0,d=i.length;d>c;c++)i[c]()},r.trust=function(e){return e=new String(e),e.$trusted=!0,e},r.prop=function(e){return(null!=e&&U.call(e)===_||typeof e===D)&&typeof e.then===D?A(e):h(e)};var K,F=[],G=[],Q=[],Y=null,W=0,X=null,Z=null,ee=[],te=16;r.component=function(e){return p(e,[].slice.call(arguments,1))},r.mount=r.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var n=F.indexOf(e);0>n&&(n=F.length);for(var o,i=!1,a={preventDefault:function(){i=!0,X=Z=null}},l=0;o=ee[l];l++)o.handler.call(o.controller,a),o.controller.onunload=null;if(i)for(var o,l=0;o=ee[l];l++)o.controller.onunload=o.handler;else ee=[];if(Q[n]&&typeof Q[n].onunload===D&&Q[n].onunload(a),!i){r.redraw.strategy("all"),r.startComputation(),F[n]=e,arguments.length>2&&(t=subcomponent(t,[].slice.call(arguments,2)));var s=K=t=t||{controller:function(){}},u=t.controller||B,c=new u;return s===K&&(Q[n]=c,G[n]=t),oe(),Q[n]}};var ne=!1;r.redraw=function(t){ne||(ne=!0,Y&&t!==!0?(T===e.requestAnimationFrame||new Date-W>te)&&(Y>0&&R(Y),Y=T(v,te)):(v(),Y=T(function(){Y=null},te)),ne=!1)},r.redraw.strategy=r.prop();var re=0;r.startComputation=function(){re++},r.endComputation=function(){re=Math.max(re-1,0),0===re&&r.redraw()};var oe=function(){"none"==r.redraw.strategy()?(re--,r.redraw.strategy("diff")):r.endComputation()};r.withAttr=function(e,t){return function(n){n=n||event;var r=n.currentTarget||this;t(e in r?r[e]:r.getAttribute(e))}};var ie,ae,le={pathname:"",hash:"#",search:"?"},se=B,ue=!1;return r.route=function(){if(0===arguments.length)return ae;if(3===arguments.length&&U.call(arguments[1])===q){var t=arguments[0],n=arguments[1],o=arguments[2];se=function(e){var i=ae=m(e);if(!g(t,o,i)){if(ue)throw new Error("Ensure the default route matches one of the routes defined in m.route");ue=!0,r.route(n,!0),ue=!1}};var i="hash"===r.route.mode?"onhashchange":"onpopstate";e[i]=function(){var e=S[r.route.mode];"pathname"===r.route.mode&&(e+=S.search),ae!=m(e)&&se(e)},X=w,e[i]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){var a=arguments[0],l=(arguments[1],arguments[2],arguments[3]);a.href=("pathname"!==r.route.mode?S.pathname:"")+le[r.route.mode]+l.attrs.href,a.addEventListener?(a.removeEventListener("click",y),a.addEventListener("click",y)):(a.detachEvent("onclick",y),a.attachEvent("onclick",y))}else if(U.call(arguments[0])===q){var s=ae;ae=arguments[0];var u=arguments[1]||{},c=ae.indexOf("?"),d=c>-1?E(ae.slice(c+1)):{};for(var f in u)d[f]=u[f];var h=b(d),p=c>-1?ae.slice(0,c):ae;h&&(ae=p+(-1===p.indexOf("?")?"?":"&")+h);var v=(3===arguments.length?arguments[2]:arguments[1])===!0||s===arguments[0];e.history.pushState?(X=w,Z=function(){e.history[v?"replaceState":"pushState"](null,j.title,le[r.route.mode]+ae)},se(le[r.route.mode]+ae)):(S[r.route.mode]=ae,se(le[r.route.mode]+ae))}},r.route.param=function(e){if(!ie)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return ie[e]},r.route.mode="search",r.route.buildQueryString=b,r.route.parseQueryString=E,r.deferred=function(){var e=new C;return e.promise=A(e.promise),e},r.deferred.onerror=function(e){if("[object Error]"===U.call(e)&&!e.constructor.toString().match(/ Error/))throw e},r.sync=function(e){function t(e,t){return function(r){return a[e]=r,t||(n="reject"),0===--i&&(o.promise(a),o[n](a)),r}}var n="resolve",o=r.deferred(),i=e.length,a=new Array(i);if(e.length>0)for(var l=0;l<e.length;l++)e[l].then(t(l,!0),t(l,!1));else o.resolve([]);return o.promise},r.request=function(e){e.background!==!0&&r.startComputation();var t=new C,n=e.dataType&&"jsonp"===e.dataType.toLowerCase(),o=e.serialize=n?O:e.serialize||JSON.stringify,i=e.deserialize=n?O:e.deserialize||JSON.parse,a=n?function(e){return e.responseText}:e.extract||function(e){return 0===e.responseText.length&&i===JSON.parse?null:e.responseText};return e.method=(e.method||"GET").toUpperCase(),e.url=N(e.url,e.data),e=k(e,e.data,o),e.onload=e.onerror=function(n){try{n=n||event;var o=("load"===n.type?e.unwrapSuccess:e.unwrapError)||O,l=o(i(a(n.target,e)),n.target);if("load"===n.type)if(U.call(l)===M&&e.type)for(var s=0;s<l.length;s++)l[s]=new e.type(l[s]);else e.type&&(l=new e.type(l));t["load"===n.type?"resolve":"reject"](l)}catch(n){r.deferred.onerror(n),t.reject(n)}e.background!==!0&&r.endComputation()},L(e),t.promise=A(t.promise,e.initialValue),t.promise},r.deps=function(t){return n(e=t||e),e},r.deps.factory=i,r}("undefined"!=typeof window?window:{});"undefined"!=typeof n&&null!==n&&n.exports?n.exports=o:"function"==typeof t&&t.amd&&t(function(){return o})},{}],7:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,a=this,l=a.EventEmitter;i.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===r(o[n],t)&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),-1!==n&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):a.call(this,r,o));return this},i.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,a,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),a=r.listener.apply(this,t||[]),a===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return a.EventEmitter=l,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:a.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin.min.js.map
assets/js/admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","m","EventEmitter","context","document","getElementById","events","tabs","helpers","settings","window","mc4wp","deps","mithril","./admin/helpers.js","./admin/settings.js","./admin/tabs.js","wolfy87-eventemitter",2,"toggleElement","selector","elements","querySelectorAll","show","clientHeight","style","display","bindEventToElement","element","event","handler","addEventListener","attachEvent","bindEventToElements","Array","prototype","forEach","debounce","func","wait","immediate","timeout","this","args","arguments","later","apply","callNow","clearTimeout","setTimeout","showIfElements","checked","conditionMet","value","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","getAttribute","parentElements","undefined","parentElement",3,"Settings","getSelectedListsWhere","searchKey","searchValue","selectedLists","filter","el","getSelectedLists","updateSelectedLists","listInputs","input","lists","push","trigger","toggleVisibleLists","rows","listId","isSelected","replace","querySelector","mc4wp_vars","mailchimp","on",4,"Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","className","blur","url","URL","setParameter","location","href","history","pushState","title","refererField","tb_remove","forms","editor","refresh","split","switchTab","tabId","match","urlParams","opened","preventDefault","returnValue","init","activeTab","substring","replaceState","state","$","jQuery","$context","find","each","first","text","click","body","./url.js",5,"query","hasOwnProperty","b","decodeURIComponent","build","data","ret","d","encodeURIComponent","join","key",6,"app","initialize","$document","$location","$cancelAnimationFrame","cancelAnimationFrame","$requestAnimationFrame","requestAnimationFrame","slice","hasAttrs","type","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","parser","exec","pair","attrParser","children","ARRAY","attrName","parentTag","parentCache","parentIndex","cached","shouldReattach","index","editable","namespace","configs","toString","subtree","cachedType","dataType","nodes","offset","end","clear","constructor","len","concat","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","shouldMaintainIdentities","action","guid","j","keysDiffer","cachedCell","dataCell","from","createElement","actions","prop","changes","sort","sortChanges","newCached","change","splice","dummy","insertBefore","childNodes","cacheCount","item","$trusted","node","parentNode","indexOf","views","controllers","view","$original","controllerIndex","redraw","strategy","controller","noop","pendingRequests","onunload","unloaders","dataAttrKeys","Object","keys","hasKeys","configContext","retain","FUNCTION","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","$old","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","setAttributeNS","message","removeChild","unload","child","nextSibling","isElement","placeholder","insertAdjacentHTML","object","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","parameterize","component","ctrl","output","computePreRedrawHook","root","roots","components","$$args","render","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","mount","matcher","RegExp","test","values","routeUnobtrusive","ctrlKey","metaKey","which","currentTarget","srcElement","search","toUpperCase","setScroll","hash","scrollTo","buildQueryString","prefix","duplicates","str","valueType","reduce","memo","charAt","pairs","params","reset","cacheKey","cellCache","propify","promise","initialValue","then","resolve","reject","Deferred","successCallback","failureCallback","finish","REJECTED","next","map","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","method","user","password","onreadystatechange","readyState","status","onload","target","serialize","stringify","setRequestHeader","deserialize","maybeXhr","FormData","send","callbackKey","getTime","Math","round","random","script","resp","responseText","error","src","appendChild","bindData","xhrOptions","querystring","parameterizeUrl","tokens","html","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","topComponent","FRAME_BUDGET","unloader","isPrevented","subcomponent","currentComponent","redrawing","force","endComputation","max","withAttr","withAttrCallback","currentRoute","pathname","redirect","isDefaultRoute","defaultRoute","source","listener","vdom","removeEventListener","detachEvent","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","param","sync","synchronizer","pos","resolved","results","outstanding","request","background","isJSONP","extract","jsonp","unwrap","unwrapSuccess","unwrapError","response","mock","factory","define","amd",7,"indexOfListener","listeners","alias","name","proto","originalGlobalValue","getListeners","evt","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceRetur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ErC6Z,IAAa9Z,KAAKoc,uBAClBpc,KAAKub,eAAeZ,EAAKpC,EAASA,SAMlD,OAAOvY,OAMXwa,EAAMhY,QAAU8X,EAAM,aAUtBE,EAAM6B,KAAO,SAAc1B,GACvB,GAAI1a,GAAOT,MAAMC,UAAUgI,MAAMtK,KAAK+C,UAAW,EACjD,OAAOF,MAAKkc,UAAUvB,EAAK1a,IAW/Bua,EAAM8B,mBAAqB,SAA4B3b,GAEnD,MADAX,MAAKuc,iBAAmB5b,EACjBX,MAWXwa,EAAM4B,oBAAsB,WACxB,MAAIpc,MAAKsG,eAAe,oBACbtG,KAAKuc,kBAGL,GAUf/B,EAAMI,WAAa,WACf,MAAO5a,MAAKgc,UAAYhc,KAAKgc,aAQjCxe,EAAagf,WAAa,WAEtB,MADAtf,GAAQM,aAAeid,EAChBjd,GAIW,kBAAXyc,SAAyBA,OAAOC,IACvCD,OAAO,WACH,MAAOzc,KAGY,gBAAXF,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUM,EAGjBN,EAAQM,aAAeA,IAE7BL,KAAK6C,gBAEI","file":"admin.min.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})({1:[function(require,module,exports){\n'use strict';\n\n// dependencies\nvar m = require('mithril');\nvar EventEmitter = require('wolfy87-eventemitter');\n\n// vars\nvar context = document.getElementById('mc4wp-admin');\nvar events = new EventEmitter();\nvar tabs = require ('./admin/tabs.js')(context);\nvar helpers = require('./admin/helpers.js');\nvar settings = require('./admin/settings.js')(context, helpers, events);\n\n// expose some things\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.deps = window.mc4wp.deps || {};\nwindow.mc4wp.deps.mithril = m;\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.events = events;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n},{\"./admin/helpers.js\":2,\"./admin/settings.js\":3,\"./admin/tabs.js\":4,\"mithril\":6,\"wolfy87-eventemitter\":7}],2:[function(require,module,exports){\n'use strict';\n\nvar helpers = {};\n\nhelpers.toggleElement = function(selector) {\n\tvar elements = document.querySelectorAll(selector);\n\tfor( var i=0; i<elements.length;i++){\n\t\tvar show = elements[i].clientHeight <= 0;\n\t\telements[i].style.display = show ? '' : 'none';\n\t}\n};\n\nhelpers.bindEventToElement = function(element,event,handler) {\n\tif ( element.addEventListener) {\n\t\telement.addEventListener(event, handler);\n\t} else if (element.attachEvent) {\n\t\telement.attachEvent('on' + event, handler);\n\t}\n};\n\nhelpers.bindEventToElements = function( elements, event, handler ) {\n\tArray.prototype.forEach.call( elements, function(element) {\n\t\thelpers.bindEventToElement(element,event,handler);\n\t});\n};\n\n\n// polling\nhelpers.debounce = function(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n};\n\n/**\n * Showif.js\n */\n(function() {\n\tvar showIfElements = document.querySelectorAll('[data-showif]');\n\n\t// dependent elements\n\tArray.prototype.forEach.call( showIfElements, function(element) {\n\t\tvar config = JSON.parse( element.getAttribute('data-showif') );\n\t\tvar parentElements = document.querySelectorAll('[name=\"'+ config.element +'\"]');\n\n\t\tvar inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n\t\tvar hide = config.hide === undefined || config.hide;\n\n\t\tfunction toggleElement() {\n\n\t\t\t// do nothing with unchecked elements\n\t\t\tif( typeof( this.checked ) === \"boolean\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check if element value matches expected value\n\t\t\tvar conditionMet = ( this.value == config.value );\n\n\t\t\tif( hide ) {\n\t\t\t\telement.style.display = conditionMet ? '' : 'none';\n\t\t\t\telement.style.visibility = conditionMet ? '' : 'hidden';\n\t\t\t} else {\n\t\t\t\telement.style.opacity = conditionMet ? '' : '0.4';\n\t\t\t}\n\n\t\t\t// disable input fields to stop sending their values to server\n\t\t\tArray.prototype.forEach.call( inputs, function(inputElement) {\n\t\t\t\tconditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly','readonly');\n\t\t\t});\n\t\t}\n\n\t\t// find checked element and call toggleElement function\n\t\tArray.prototype.forEach.call( parentElements, function( parentElement ) {\n\t\t\ttoggleElement.call(parentElement);\n\t\t});\n\n\t\t// bind on all changes\n\t\thelpers.bindEventToElements(parentElements, 'change', toggleElement);\n\t});\n})();\n\nmodule.exports = helpers;\n},{}],3:[function(require,module,exports){\nvar Settings = function(context, helpers, events ) {\n\t'use strict';\n\n\t// vars\n\tvar form = context.querySelector('form');\n\tvar listInputs = context.querySelectorAll('.mc4wp-list-input');\n\tvar lists = mc4wp_vars.mailchimp.lists;\n\tvar selectedLists = [];\n\n\t// functions\n\tfunction getSelectedListsWhere(searchKey,searchValue) {\n\t\treturn selectedLists.filter(function(el) {\n\t\t\treturn el[searchKey] === searchValue;\n\t\t});\n\t}\n\n\tfunction getSelectedLists() {\n\t\treturn selectedLists;\n\t}\n\n\tfunction updateSelectedLists() {\n\t\tselectedLists = [];\n\n\t\tArray.prototype.forEach.call(listInputs, function(input) {\n\t\t\t// skip unchecked checkboxes\n\t\t\tif( typeof( input.checked ) === \"boolean\" && ! input.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif( typeof( lists[ input.value ] ) === \"object\" ){\n\t\t\t\tselectedLists.push( lists[ input.value ] );\n\t\t\t}\n\t\t});\n\n\t\tevents.trigger('selectedLists.change', [ selectedLists ]);\n\t\treturn selectedLists;\n\t}\n\n\tfunction toggleVisibleLists() {\n\t\tvar rows = document.querySelectorAll('.lists--only-selected > *');\n\t\tArray.prototype.forEach.call(rows, function(el) {\n\n\t\t\tvar listId = el.getAttribute('data-list-id');\n\t\t\tvar isSelected = getSelectedListsWhere('id', listId).length > 0;\n\n\t\t\tif( isSelected ) {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class').replace('hidden',''));\n\t\t\t} else {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class') + \" hidden\" );\n\t\t\t}\n\t\t});\n\t}\n\n\tevents.on('selectedLists.change', toggleVisibleLists);\n\thelpers.bindEventToElements(listInputs,'change',updateSelectedLists);\n\n\tupdateSelectedLists();\n\n\treturn {\n\t\tgetSelectedLists: getSelectedLists\n\t}\n\n};\n\nmodule.exports = Settings;\n},{}],4:[function(require,module,exports){\n// Tabs\nvar Tabs = function(context) {\n\t'use strict';\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\n\tvar URL = require('./url.js');\n\tvar $context = $(context);\n\tvar $tabs = $context.find('.tab');\n\tvar $tabNavs = $context.find('.nav-tab');\n\tvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\n\tvar tabs = [];\n\n\t$.each($tabs, function(i,t) {\n\t\tvar id = t.id.substring(4);\n\t\tvar title = $(t).find('h2').first().text();\n\n\t\ttabs.push({\n\t\t\tid: id,\n\t\t\ttitle: title,\n\t\t\telement: t,\n\t\t\tnav: context.querySelectorAll('.nav-tab-' + id),\n\t\t\topen: function() { return open(id); }\n\t\t});\n\t});\n\n\tfunction get(id) {\n\n\t\tfor( var i=0; i<tabs.length; i++){\n\t\t\tif(tabs[i].id === id ) {\n\t\t\t\treturn tabs[i];\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfunction open( tab, updateState ) {\n\n\t\t// make sure we have a tab object\n\t\tif(typeof(tab) === \"string\"){\n\t\t\ttab = get(tab);\n\t\t}\n\n\t\tif(!tab) { return false; }\n\n\t\t// should we update state?\n\t\tif( updateState == undefined ) {\n\t\t\tupdateState = true;\n\t\t}\n\n\t\t// hide all tabs & remove active class\n\t\t$tabs.removeClass('tab-active').css('display', 'none');\n\t\t$tabNavs.removeClass('nav-tab-active');\n\n\t\t// add `nav-tab-active` to this tab\n\t\tArray.prototype.forEach.call(tab.nav, function(nav) {\n\t\t\tnav.className += \" nav-tab-active\";\n\t\t\tnav.blur();\n\t\t});\n\n\t\t// show target tab\n\t\ttab.element.style.display = 'block';\n\t\ttab.element.className += \" tab-active\";\n\n\t\t// create new URL\n\t\tvar url = URL.setParameter(window.location.href, \"tab\", tab.id );\n\n\t\t// update hash\n\t\tif( history.pushState && updateState ) {\n\t\t\thistory.pushState( tab.id, '', url );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\n\t\t// update referer field\n\t\trefererField.value = url;\n\n\t\t// if thickbox is open, close it.\n\t\tif( typeof(tb_remove) === \"function\" ) {\n\t\t\ttb_remove();\n\t\t}\n\n\t\t// refresh editor after switching tabs\n\t\t// TODO: decouple decouple decouple\n\t\tif( tab.id === 'fields' && window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor ) {\n\t\t\tmc4wp.forms.editor.refresh();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction title(tab) {\n\t\tvar title = document.title.split('-');\n\t\tdocument.title = document.title.replace(title[0], tab.title + \" \");\n\t}\n\n\tfunction switchTab(e) {\n\t\te = e || window.event;\n\n\t\t// get from data attribute\n\t\tvar tabId = this.getAttribute('data-tab');\n\n\t\t// get from classname\n\t\tif( ! tabId ) {\n\t\t\tvar match = this.className.match(/nav-tab-(\\w+)?/);\n\t\t\tif( match ) {\n\t\t\t\ttabId = match[1];\n\t\t\t}\n\t\t}\n\n\t\t// get from href\n\t\tif( ! tabId ) {\n\t\t\tvar urlParams = URL.parse( this.href );\n\t\t\tif( ! urlParams.tab ) { return; }\n\t\t\ttabId = urlParams.tab;\n\t\t}\n\n\t\tvar opened = open( tabId );\n\n\t\tif( opened ) {\n\t\t\te.preventDefault();\n\t\t\te.returnValue = false;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction init() {\n\n\t\t// check for current tab\n\t\tif(! history.pushState) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar activeTab = $tabs.filter(':visible').get(0);\n\t\tif( ! activeTab ) { return; }\n\t\tvar tab = get(activeTab.id.substring(4));\n\t\tif(!tab) return;\n\n\t\t// check if tab is in html5 history\n\t\tif( history.replaceState && history.state === null) {\n\t\t\thistory.replaceState( tab.id, '' );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\t}\n\n\t$tabNavs.click(switchTab);\n\t$(document.body).on('click', '.tab-link', switchTab);\n\tinit();\n\n\tif(window.addEventListener && history.pushState ) {\n\t\twindow.addEventListener('popstate', function(e) {\n\t\t\tif(!e.state) return true;\n\t\t\tvar tabId = e.state;\n\t\t\treturn open(tabId,false);\n\t\t});\n\t}\n\n\treturn {\n\t\topen: open,\n\t\tget: get\n\t}\n\n};\n\nmodule.exports = Tabs;\n},{\"./url.js\":5}],5:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n\tparse: function(url) {\n\t\tvar query = {};\n\t\tvar a = url.split('&');\n\t\tfor (var i in a) {\n\t\t\tif(!a.hasOwnProperty(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar b = a[i].split('=');\n\t\t\tquery[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n\t\t}\n\n\t\treturn query;\n\t},\n\tbuild: function(data) {\n\t\tvar ret = [];\n\t\tfor (var d in data)\n\t\t\tret.push(d + \"=\" + encodeURIComponent(data[d]));\n\t\treturn ret.join(\"&\");\n\t},\n\tsetParameter: function( url, key, value ) {\n\t\tvar data = URL.parse( url );\n\t\tdata[ key ] = value;\n\t\treturn URL.build( data );\n\t}\n};\n\nmodule.exports = URL;\n},{}],6:[function(require,module,exports){\nvar 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\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n"],"sourceRoot":"/source/"}
1
+ {"version":3,"sources":["admin.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","m","EventEmitter","context","document","getElementById","events","tabs","helpers","settings","window","mc4wp","deps","mithril","./admin/helpers.js","./admin/settings.js","./admin/tabs.js","wolfy87-eventemitter",2,"toggleElement","selector","elements","querySelectorAll","show","clientHeight","style","display","bindEventToElement","element","event","handler","addEventListener","attachEvent","bindEventToElements","Array","prototype","forEach","debounce","func","wait","immediate","timeout","this","args","arguments","later","apply","callNow","clearTimeout","setTimeout","showIfElements","checked","conditionMet","value","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","getAttribute","parentElements","parentElement",3,"Settings","getSelectedListsWhere","searchKey","searchValue","selectedLists","filter","el","getSelectedLists","updateSelectedLists","listInputs","input","lists","push","trigger","toggleVisibleLists","rows","listId","isSelected","replace","querySelector","mc4wp_vars","mailchimp","on",4,"Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","className","blur","url","URL","setParameter","location","href","history","pushState","title","refererField","tb_remove","forms","editor","refresh","split","switchTab","tabId","match","urlParams","opened","preventDefault","returnValue","init","activeTab","substring","replaceState","state","$","jQuery","$context","find","each","first","text","click","body","./url.js",5,"query","hasOwnProperty","b","decodeURIComponent","build","data","ret","d","encodeURIComponent","join","key",6,"app","initialize","$document","$location","$cancelAnimationFrame","cancelAnimationFrame","$requestAnimationFrame","requestAnimationFrame","slice","hasAttrs","type","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","parser","exec","pair","attrParser","children","ARRAY","attrName","parentTag","parentCache","parentIndex","cached","shouldReattach","index","editable","namespace","configs","toString","subtree","cachedType","dataType","nodes","offset","end","clear","constructor","len","concat","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","shouldMaintainIdentities","action","guid","j","keysDiffer","cachedCell","dataCell","from","createElement","actions","prop","changes","sort","sortChanges","newCached","change","splice","dummy","insertBefore","childNodes","cacheCount","item","$trusted","node","parentNode","indexOf","views","controllers","view","$original","controllerIndex","redraw","strategy","controller","noop","pendingRequests","onunload","unloaders","dataAttrKeys","Object","keys","hasKeys","configContext","retain","FUNCTION","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","$old","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","setAttributeNS","message","removeChild","unload","child","nextSibling","isElement","placeholder","insertAdjacentHTML","object","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","parameterize","component","ctrl","output","computePreRedrawHook","root","roots","components","$$args","render","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","mount","matcher","RegExp","test","values","routeUnobtrusive","ctrlKey","metaKey","which","currentTarget","srcElement","search","toUpperCase","setScroll","hash","scrollTo","buildQueryString","prefix","duplicates","str","valueType","reduce","memo","charAt","pairs","params","reset","cacheKey","cellCache","propify","promise","initialValue","then","resolve","reject","Deferred","successCallback","failureCallback","finish","REJECTED","next","map","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","method","user","password","onreadystatechange","readyState","status","onload","target","serialize","stringify","setRequestHeader","deserialize","maybeXhr","FormData","send","callbackKey","getTime","Math","round","random","script","resp","responseText","error","src","appendChild","bindData","xhrOptions","querystring","parameterizeUrl","tokens","html","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","topComponent","FRAME_BUDGET","unloader","isPrevented","subcomponent","currentComponent","redrawing","force","endComputation","max","withAttr","withAttrCallback","currentRoute","pathname","redirect","isDefaultRoute","defaultRoute","source","listener","vdom","removeEventListener","detachEvent","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","param","sync","synchronizer","pos","resolved","results","outstanding","request","background","isJSONP","extract","jsonp","unwrap","unwrapSuccess","unwrapError","response","mock","factory","amd",7,"indexOfListener","listeners","alias","name","proto","originalGlobalValue","getListeners","evt","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,YAGA,IAAIK,GAAIrB,EAAQ,WACZsB,EAAetB,EAAQ,wBAGvBuB,EAAUC,SAASC,eAAe,eAClCC,EAAS,GAAIJ,GACbK,EAAO3B,EAAS,mBAAmBuB,GACnCK,EAAU5B,EAAQ,sBAClB6B,EAAW7B,EAAQ,uBAAuBuB,EAASK,EAASF,EAGhEI,QAAOC,MAAQD,OAAOC,UACtBD,OAAOC,MAAMC,KAAOF,OAAOC,MAAMC,SACjCF,OAAOC,MAAMC,KAAKC,QAAUZ,EAC5B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AAM,GACpC3K,EAAIsd,EAAU/c,OAEPP,KAGHyb,EAAW6B,EAAUtd,GAEjByb,EAAS0C,QAAS,GAClBhb,KAAKqb,eAAeZ,EAAKnC,EAASA,UAGtCuB,EAAWvB,EAASA,SAASlY,MAAMJ,KAAMC,OAErC4Z,IAAa7Z,KAAKkc,uBAClBlc,KAAKqb,eAAeZ,EAAKnC,EAASA,SAMlD,OAAOtY,OAMXsa,EAAM/X,QAAU6X,EAAM,aAUtBE,EAAM6B,KAAO,SAAc1B,GACvB,GAAIxa,GAAOT,MAAMC,UAAU+H,MAAMrK,KAAK+C,UAAW,EACjD,OAAOF,MAAKgc,UAAUvB,EAAKxa,IAW/Bqa,EAAM8B,mBAAqB,SAA4Bzb,GAEnD,MADAX,MAAKqc,iBAAmB1b,EACjBX,MAWXsa,EAAM4B,oBAAsB,WACxB,MAAIlc,MAAKqG,eAAe,oBACbrG,KAAKqc,kBAGL,GAUf/B,EAAMI,WAAa,WACf,MAAO1a,MAAK8b,UAAY9b,KAAK8b,aAQjCte,EAAa8e,WAAa,WAEtB,MADApf,GAAQM,aAAe+c,EAChB/c,GAIW,kBAAXpB,IAAyBA,EAAO4d,IACvC5d,EAAO,WACH,MAAOoB,KAGY,gBAAXF,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUM,EAGjBN,EAAQM,aAAeA,IAE7BL,KAAK6C,gBAEI","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (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})({1:[function(require,module,exports){\n'use strict';\n\n// dependencies\nvar m = require('mithril');\nvar EventEmitter = require('wolfy87-eventemitter');\n\n// vars\nvar context = document.getElementById('mc4wp-admin');\nvar events = new EventEmitter();\nvar tabs = require ('./admin/tabs.js')(context);\nvar helpers = require('./admin/helpers.js');\nvar settings = require('./admin/settings.js')(context, helpers, events);\n\n// expose some things\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.deps = window.mc4wp.deps || {};\nwindow.mc4wp.deps.mithril = m;\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.events = events;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n},{\"./admin/helpers.js\":2,\"./admin/settings.js\":3,\"./admin/tabs.js\":4,\"mithril\":6,\"wolfy87-eventemitter\":7}],2:[function(require,module,exports){\n'use strict';\n\nvar helpers = {};\n\nhelpers.toggleElement = function(selector) {\n\tvar elements = document.querySelectorAll(selector);\n\tfor( var i=0; i<elements.length;i++){\n\t\tvar show = elements[i].clientHeight <= 0;\n\t\telements[i].style.display = show ? '' : 'none';\n\t}\n};\n\nhelpers.bindEventToElement = function(element,event,handler) {\n\tif ( element.addEventListener) {\n\t\telement.addEventListener(event, handler);\n\t} else if (element.attachEvent) {\n\t\telement.attachEvent('on' + event, handler);\n\t}\n};\n\nhelpers.bindEventToElements = function( elements, event, handler ) {\n\tArray.prototype.forEach.call( elements, function(element) {\n\t\thelpers.bindEventToElement(element,event,handler);\n\t});\n};\n\n\n// polling\nhelpers.debounce = function(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n};\n\n/**\n * Showif.js\n */\n(function() {\n\tvar showIfElements = document.querySelectorAll('[data-showif]');\n\n\t// dependent elements\n\tArray.prototype.forEach.call( showIfElements, function(element) {\n\t\tvar config = JSON.parse( element.getAttribute('data-showif') );\n\t\tvar parentElements = document.querySelectorAll('[name=\"'+ config.element +'\"]');\n\n\t\tvar inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n\t\tvar hide = config.hide === undefined || config.hide;\n\n\t\tfunction toggleElement() {\n\n\t\t\t// do nothing with unchecked elements\n\t\t\tif( typeof( this.checked ) === \"boolean\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check if element value matches expected value\n\t\t\tvar conditionMet = ( this.value == config.value );\n\n\t\t\tif( hide ) {\n\t\t\t\telement.style.display = conditionMet ? '' : 'none';\n\t\t\t\telement.style.visibility = conditionMet ? '' : 'hidden';\n\t\t\t} else {\n\t\t\t\telement.style.opacity = conditionMet ? '' : '0.4';\n\t\t\t}\n\n\t\t\t// disable input fields to stop sending their values to server\n\t\t\tArray.prototype.forEach.call( inputs, function(inputElement) {\n\t\t\t\tconditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly','readonly');\n\t\t\t});\n\t\t}\n\n\t\t// find checked element and call toggleElement function\n\t\tArray.prototype.forEach.call( parentElements, function( parentElement ) {\n\t\t\ttoggleElement.call(parentElement);\n\t\t});\n\n\t\t// bind on all changes\n\t\thelpers.bindEventToElements(parentElements, 'change', toggleElement);\n\t});\n})();\n\nmodule.exports = helpers;\n},{}],3:[function(require,module,exports){\nvar Settings = function(context, helpers, events ) {\n\t'use strict';\n\n\t// vars\n\tvar form = context.querySelector('form');\n\tvar listInputs = context.querySelectorAll('.mc4wp-list-input');\n\tvar lists = mc4wp_vars.mailchimp.lists;\n\tvar selectedLists = [];\n\n\t// functions\n\tfunction getSelectedListsWhere(searchKey,searchValue) {\n\t\treturn selectedLists.filter(function(el) {\n\t\t\treturn el[searchKey] === searchValue;\n\t\t});\n\t}\n\n\tfunction getSelectedLists() {\n\t\treturn selectedLists;\n\t}\n\n\tfunction updateSelectedLists() {\n\t\tselectedLists = [];\n\n\t\tArray.prototype.forEach.call(listInputs, function(input) {\n\t\t\t// skip unchecked checkboxes\n\t\t\tif( typeof( input.checked ) === \"boolean\" && ! input.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif( typeof( lists[ input.value ] ) === \"object\" ){\n\t\t\t\tselectedLists.push( lists[ input.value ] );\n\t\t\t}\n\t\t});\n\n\t\tevents.trigger('selectedLists.change', [ selectedLists ]);\n\t\treturn selectedLists;\n\t}\n\n\tfunction toggleVisibleLists() {\n\t\tvar rows = document.querySelectorAll('.lists--only-selected > *');\n\t\tArray.prototype.forEach.call(rows, function(el) {\n\n\t\t\tvar listId = el.getAttribute('data-list-id');\n\t\t\tvar isSelected = getSelectedListsWhere('id', listId).length > 0;\n\n\t\t\tif( isSelected ) {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class').replace('hidden',''));\n\t\t\t} else {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class') + \" hidden\" );\n\t\t\t}\n\t\t});\n\t}\n\n\tevents.on('selectedLists.change', toggleVisibleLists);\n\thelpers.bindEventToElements(listInputs,'change',updateSelectedLists);\n\n\tupdateSelectedLists();\n\n\treturn {\n\t\tgetSelectedLists: getSelectedLists\n\t}\n\n};\n\nmodule.exports = Settings;\n},{}],4:[function(require,module,exports){\n// Tabs\nvar Tabs = function(context) {\n\t'use strict';\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\n\tvar URL = require('./url.js');\n\tvar $context = $(context);\n\tvar $tabs = $context.find('.tab');\n\tvar $tabNavs = $context.find('.nav-tab');\n\tvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\n\tvar tabs = [];\n\n\t$.each($tabs, function(i,t) {\n\t\tvar id = t.id.substring(4);\n\t\tvar title = $(t).find('h2').first().text();\n\n\t\ttabs.push({\n\t\t\tid: id,\n\t\t\ttitle: title,\n\t\t\telement: t,\n\t\t\tnav: context.querySelectorAll('.nav-tab-' + id),\n\t\t\topen: function() { return open(id); }\n\t\t});\n\t});\n\n\tfunction get(id) {\n\n\t\tfor( var i=0; i<tabs.length; i++){\n\t\t\tif(tabs[i].id === id ) {\n\t\t\t\treturn tabs[i];\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfunction open( tab, updateState ) {\n\n\t\t// make sure we have a tab object\n\t\tif(typeof(tab) === \"string\"){\n\t\t\ttab = get(tab);\n\t\t}\n\n\t\tif(!tab) { return false; }\n\n\t\t// should we update state?\n\t\tif( updateState == undefined ) {\n\t\t\tupdateState = true;\n\t\t}\n\n\t\t// hide all tabs & remove active class\n\t\t$tabs.removeClass('tab-active').css('display', 'none');\n\t\t$tabNavs.removeClass('nav-tab-active');\n\n\t\t// add `nav-tab-active` to this tab\n\t\tArray.prototype.forEach.call(tab.nav, function(nav) {\n\t\t\tnav.className += \" nav-tab-active\";\n\t\t\tnav.blur();\n\t\t});\n\n\t\t// show target tab\n\t\ttab.element.style.display = 'block';\n\t\ttab.element.className += \" tab-active\";\n\n\t\t// create new URL\n\t\tvar url = URL.setParameter(window.location.href, \"tab\", tab.id );\n\n\t\t// update hash\n\t\tif( history.pushState && updateState ) {\n\t\t\thistory.pushState( tab.id, '', url );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\n\t\t// update referer field\n\t\trefererField.value = url;\n\n\t\t// if thickbox is open, close it.\n\t\tif( typeof(tb_remove) === \"function\" ) {\n\t\t\ttb_remove();\n\t\t}\n\n\t\t// refresh editor after switching tabs\n\t\t// TODO: decouple decouple decouple\n\t\tif( tab.id === 'fields' && window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor ) {\n\t\t\tmc4wp.forms.editor.refresh();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction title(tab) {\n\t\tvar title = document.title.split('-');\n\t\tdocument.title = document.title.replace(title[0], tab.title + \" \");\n\t}\n\n\tfunction switchTab(e) {\n\t\te = e || window.event;\n\n\t\t// get from data attribute\n\t\tvar tabId = this.getAttribute('data-tab');\n\n\t\t// get from classname\n\t\tif( ! tabId ) {\n\t\t\tvar match = this.className.match(/nav-tab-(\\w+)?/);\n\t\t\tif( match ) {\n\t\t\t\ttabId = match[1];\n\t\t\t}\n\t\t}\n\n\t\t// get from href\n\t\tif( ! tabId ) {\n\t\t\tvar urlParams = URL.parse( this.href );\n\t\t\tif( ! urlParams.tab ) { return; }\n\t\t\ttabId = urlParams.tab;\n\t\t}\n\n\t\tvar opened = open( tabId );\n\n\t\tif( opened ) {\n\t\t\te.preventDefault();\n\t\t\te.returnValue = false;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction init() {\n\n\t\t// check for current tab\n\t\tif(! history.pushState) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar activeTab = $tabs.filter(':visible').get(0);\n\t\tif( ! activeTab ) { return; }\n\t\tvar tab = get(activeTab.id.substring(4));\n\t\tif(!tab) return;\n\n\t\t// check if tab is in html5 history\n\t\tif( history.replaceState && history.state === null) {\n\t\t\thistory.replaceState( tab.id, '' );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\t}\n\n\t$tabNavs.click(switchTab);\n\t$(document.body).on('click', '.tab-link', switchTab);\n\tinit();\n\n\tif(window.addEventListener && history.pushState ) {\n\t\twindow.addEventListener('popstate', function(e) {\n\t\t\tif(!e.state) return true;\n\t\t\tvar tabId = e.state;\n\t\t\treturn open(tabId,false);\n\t\t});\n\t}\n\n\treturn {\n\t\topen: open,\n\t\tget: get\n\t}\n\n};\n\nmodule.exports = Tabs;\n},{\"./url.js\":5}],5:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n\tparse: function(url) {\n\t\tvar query = {};\n\t\tvar a = url.split('&');\n\t\tfor (var i in a) {\n\t\t\tif(!a.hasOwnProperty(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar b = a[i].split('=');\n\t\t\tquery[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n\t\t}\n\n\t\treturn query;\n\t},\n\tbuild: function(data) {\n\t\tvar ret = [];\n\t\tfor (var d in data)\n\t\t\tret.push(d + \"=\" + encodeURIComponent(data[d]));\n\t\treturn ret.join(\"&\");\n\t},\n\tsetParameter: function( url, key, value ) {\n\t\tvar data = URL.parse( url );\n\t\tdata[ key ] = value;\n\t\treturn URL.build( data );\n\t}\n};\n\nmodule.exports = URL;\n},{}],6:[function(require,module,exports){\nvar 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\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
assets/js/forms-admin.js CHANGED
@@ -1,4 +1,4 @@
1
- (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})({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  var rows = function(m, i18n) {
@@ -291,6 +291,7 @@ var g = function(m) {
291
  value : choice.value(),
292
  checked : choice.selected()
293
  }),
 
294
  m('span', choice.label())
295
  ]
296
  )
@@ -533,9 +534,11 @@ var FieldFactory = function(settings, fields, i18n) {
533
  *
534
  * @param data
535
  */
536
- function register(data) {
537
  var field = fields.register(data);
538
- registeredFields.push(field);
 
 
539
  }
540
 
541
  /**
@@ -623,6 +626,16 @@ var FieldFactory = function(settings, fields, i18n) {
623
  list.groupings.forEach(registerGrouping);
624
  }
625
 
 
 
 
 
 
 
 
 
 
 
626
  function registerCustomFields(lists) {
627
 
628
  var choices;
@@ -633,20 +646,21 @@ var FieldFactory = function(settings, fields, i18n) {
633
  value: i18n.subscribe,
634
  type: "submit",
635
  title: i18n.submitButton
636
- });
637
 
638
  // register lists choice field
639
  choices = {};
640
- lists.forEach(function(list) {
641
- choices[list.id] = list.name;
642
- });
 
643
  register({
644
  name: '_mc4wp_lists',
645
  type: 'checkbox',
646
  title: i18n.listChoice,
647
  choices: choices,
648
  help: i18n.listChoiceDescription
649
- });
650
 
651
  choices = {
652
  'subscribe': "Subscribe",
@@ -659,31 +673,16 @@ var FieldFactory = function(settings, fields, i18n) {
659
  choices: choices,
660
  value: 'subscribe',
661
  help: i18n.formActionDescription
662
- });
663
- }
664
-
665
- /**
666
- * Update list fields
667
- *
668
- * @param lists
669
- */
670
- function work(lists) {
671
-
672
- // clear our fields
673
- reset();
674
-
675
- // register list specific fields
676
- lists.forEach(registerListFields);
677
-
678
- // register global fields like "submit" & "list choice"
679
- registerCustomFields(lists);
680
  }
681
 
682
  /**
683
  * Expose some methods
684
  */
685
  return {
686
- 'work': work
 
 
687
  }
688
 
689
  };
@@ -821,7 +820,9 @@ module.exports = function(m, events) {
821
 
822
  // create Field object
823
  field = new Field(data);
824
- fields.push(field);
 
 
825
 
826
  // redraw view
827
  m.redraw();
@@ -1022,6 +1023,11 @@ var FormWatcher = function(m, editor, settings, fields, events, helpers) {
1022
  Array.prototype.forEach.call(requiredFieldElements, function(el) {
1023
  var name = el.name.toUpperCase();
1024
 
 
 
 
 
 
1025
  // only add field if it's not already in it
1026
  if( requiredFields.indexOf(name) === -1 ) {
1027
  requiredFields.push(name);
@@ -1046,15 +1052,21 @@ var overlay = function(m, i18n) {
1046
  var _element,
1047
  _onCloseCallback;
1048
 
 
 
 
 
 
 
1049
  function onKeyDown(e) {
1050
  e = e || window.event;
1051
 
1052
  // close overlay when pressing ESC
1053
- if (e.keyCode == 27 && _onCloseCallback ) {
1054
- _onCloseCallback();
1055
  }
1056
 
1057
- // prevent ENTER when overlay is open & inside <form>
1058
  if(e.keyCode == 13 ) {
1059
  e.preventDefault();
1060
  }
@@ -1074,18 +1086,12 @@ var overlay = function(m, i18n) {
1074
  _element.style.top = ( marginTop > 0 ? marginTop : 0 ) + "px";
1075
  }
1076
 
1077
- // bind events (IE8 compatible)
1078
- if (document.addEventListener) {
1079
- document.addEventListener('keydown', onKeyDown);
1080
- window.addEventListener('resize', position);
1081
- } else if(document.attachEvent) {
1082
- document.attachEvent('onkeydown', onKeyDown);
1083
- window.attachEvent('onresize', position);
1084
- }
1085
-
1086
  return function (content, onCloseCallback) {
1087
  _onCloseCallback = onCloseCallback;
1088
 
 
 
 
1089
  return [
1090
  m('div.overlay-wrap',
1091
  m("div.overlay", {
@@ -1099,7 +1105,7 @@ var overlay = function(m, i18n) {
1099
  m('span', {
1100
  "class": 'close dashicons dashicons-no',
1101
  title : i18n.close,
1102
- onclick: onCloseCallback
1103
  }),
1104
 
1105
  content
@@ -1108,7 +1114,7 @@ var overlay = function(m, i18n) {
1108
  ,
1109
  m('div.overlay-background', {
1110
  title: i18n.close,
1111
- onclick: onCloseCallback
1112
  })
1113
  ];
1114
  };
@@ -1143,9 +1149,10 @@ m.mount( document.getElementById( 'mc4wp-field-wizard'), fieldHelper );
1143
 
1144
  // register fields and redraw screen in 2 seconds (fixes IE8 bug)
1145
  var fieldsFactory = new FieldsFactory(settings, fields, i18n);
1146
- events.on('selectedLists.change', fieldsFactory.work);
1147
- fieldsFactory.work(settings.getSelectedLists());
1148
- window.setTimeout( function() {m.redraw();}, 2000 );
 
1149
 
1150
  // expose some methods
1151
  window.mc4wp = window.mc4wp || {};
@@ -2525,7 +2532,7 @@ module.exports = render;
2525
  else if (typeof define == "function" && define.amd) // AMD
2526
  return define([], mod);
2527
  else // Plain browser env
2528
- this.CodeMirror = mod();
2529
  })(function() {
2530
  "use strict";
2531
 
@@ -2922,7 +2929,7 @@ module.exports = render;
2922
  if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
2923
  });
2924
 
2925
- this.checkedOverlay = false;
2926
  // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
2927
  if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
2928
  }
@@ -2957,29 +2964,43 @@ module.exports = render;
2957
  this.horiz.firstChild.style.width = "0";
2958
  }
2959
 
2960
- if (!this.checkedOverlay && measure.clientHeight > 0) {
2961
- if (sWidth == 0) this.overlayHack();
2962
- this.checkedOverlay = true;
2963
  }
2964
 
2965
  return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
2966
  },
2967
  setScrollLeft: function(pos) {
2968
  if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
 
2969
  },
2970
  setScrollTop: function(pos) {
2971
  if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
 
2972
  },
2973
- overlayHack: function() {
2974
  var w = mac && !mac_geMountainLion ? "12px" : "18px";
2975
- this.horiz.style.minHeight = this.vert.style.minWidth = w;
2976
- var self = this;
2977
- var barMouseDown = function(e) {
2978
- if (e_target(e) != self.vert && e_target(e) != self.horiz)
2979
- operation(self.cm, onMouseDown)(e);
2980
- };
2981
- on(this.vert, "mousedown", barMouseDown);
2982
- on(this.horiz, "mousedown", barMouseDown);
 
 
 
 
 
 
 
 
 
 
 
 
2983
  },
2984
  clear: function() {
2985
  var parent = this.horiz.parentNode;
@@ -3321,7 +3342,7 @@ module.exports = render;
3321
  // given line.
3322
  function updateWidgetHeight(line) {
3323
  if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
3324
- line.widgets[i].height = line.widgets[i].node.offsetHeight;
3325
  }
3326
 
3327
  // Do a bulk-read of the DOM positions and sizes needed to draw the
@@ -3592,10 +3613,6 @@ module.exports = render;
3592
  if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
3593
  }
3594
 
3595
- function isReadOnly(cm) {
3596
- return cm.options.readOnly || cm.doc.cantEdit;
3597
- }
3598
-
3599
  // This will be set to an array of strings when copying, so that,
3600
  // when pasting, we know what kind of selections the copied text
3601
  // was made out of.
@@ -3650,7 +3667,7 @@ module.exports = render;
3650
  var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
3651
  if (pasted) {
3652
  e.preventDefault();
3653
- if (!isReadOnly(cm) && !cm.options.disableInput)
3654
  runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
3655
  return true;
3656
  }
@@ -3753,13 +3770,14 @@ module.exports = render;
3753
  });
3754
 
3755
  on(te, "paste", function(e) {
3756
- if (handlePaste(e, cm)) return true;
3757
 
3758
  cm.state.pasteIncoming = true;
3759
  input.fastPoll();
3760
  });
3761
 
3762
  function prepareCopyCut(e) {
 
3763
  if (cm.somethingSelected()) {
3764
  lastCopied = cm.getSelections();
3765
  if (input.inaccurateSelection) {
@@ -3787,7 +3805,7 @@ module.exports = render;
3787
  on(te, "copy", prepareCopyCut);
3788
 
3789
  on(display.scroller, "paste", function(e) {
3790
- if (eventInWidget(display, e)) return;
3791
  cm.state.pasteIncoming = true;
3792
  input.focus();
3793
  });
@@ -3921,7 +3939,7 @@ module.exports = render;
3921
  // in which case reading its value would be expensive.
3922
  if (this.contextMenuPending || !cm.state.focused ||
3923
  (hasSelection(input) && !prevInput && !this.composing) ||
3924
- isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
3925
  return false;
3926
 
3927
  var text = input.value;
@@ -4072,7 +4090,9 @@ module.exports = render;
4072
  var div = input.div = display.lineDiv;
4073
  disableBrowserMagic(div);
4074
 
4075
- on(div, "paste", function(e) { handlePaste(e, cm); })
 
 
4076
 
4077
  on(div, "compositionstart", function(e) {
4078
  var data = e.data;
@@ -4110,11 +4130,12 @@ module.exports = render;
4110
 
4111
  on(div, "input", function() {
4112
  if (input.composing) return;
4113
- if (isReadOnly(cm) || !input.pollContent())
4114
  runInOp(input.cm, function() {regChange(cm);});
4115
  });
4116
 
4117
  function onCopyCut(e) {
 
4118
  if (cm.somethingSelected()) {
4119
  lastCopied = cm.getSelections();
4120
  if (e.type == "cut") cm.replaceSelection("", null, "cut");
@@ -4190,8 +4211,13 @@ module.exports = render;
4190
  try { var rng = range(start.node, start.offset, end.offset, end.node); }
4191
  catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
4192
  if (rng) {
4193
- sel.removeAllRanges();
4194
- sel.addRange(rng);
 
 
 
 
 
4195
  if (old && sel.anchorNode == null) sel.addRange(old);
4196
  else if (gecko) this.startGracePeriod();
4197
  }
@@ -4335,7 +4361,7 @@ module.exports = render;
4335
  this.div.focus();
4336
  },
4337
  applyComposition: function(composing) {
4338
- if (isReadOnly(this.cm))
4339
  operation(this.cm, regChange)(this.cm)
4340
  else if (composing.data && composing.data != composing.startData)
4341
  operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
@@ -4347,7 +4373,7 @@ module.exports = render;
4347
 
4348
  onKeyPress: function(e) {
4349
  e.preventDefault();
4350
- if (!isReadOnly(this.cm))
4351
  operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
4352
  },
4353
 
@@ -4652,7 +4678,7 @@ module.exports = render;
4652
 
4653
  // Give beforeSelectionChange handlers a change to influence a
4654
  // selection update.
4655
- function filterSelectionChange(doc, sel) {
4656
  var obj = {
4657
  ranges: sel.ranges,
4658
  update: function(ranges) {
@@ -4660,7 +4686,8 @@ module.exports = render;
4660
  for (var i = 0; i < ranges.length; i++)
4661
  this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
4662
  clipPos(doc, ranges[i].head));
4663
- }
 
4664
  };
4665
  signal(doc, "beforeSelectionChange", doc, obj);
4666
  if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
@@ -4686,7 +4713,7 @@ module.exports = render;
4686
 
4687
  function setSelectionNoUndo(doc, sel, options) {
4688
  if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
4689
- sel = filterSelectionChange(doc, sel);
4690
 
4691
  var bias = options && options.bias ||
4692
  (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
@@ -4720,8 +4747,9 @@ module.exports = render;
4720
  var out;
4721
  for (var i = 0; i < sel.ranges.length; i++) {
4722
  var range = sel.ranges[i];
4723
- var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);
4724
- var newHead = skipAtomic(doc, range.head, bias, mayClear);
 
4725
  if (out || newAnchor != range.anchor || newHead != range.head) {
4726
  if (!out) out = sel.ranges.slice(0, i);
4727
  out[i] = new Range(newAnchor, newHead);
@@ -4730,54 +4758,59 @@ module.exports = render;
4730
  return out ? normalizeSelection(out, sel.primIndex) : sel;
4731
  }
4732
 
4733
- // Ensure a given position is not inside an atomic range.
4734
- function skipAtomic(doc, pos, bias, mayClear) {
4735
- var flipped = false, curPos = pos;
4736
- var dir = bias || 1;
4737
- doc.cantEdit = false;
4738
- search: for (;;) {
4739
- var line = getLine(doc, curPos.line);
4740
- if (line.markedSpans) {
4741
- for (var i = 0; i < line.markedSpans.length; ++i) {
4742
- var sp = line.markedSpans[i], m = sp.marker;
4743
- if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
4744
- (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
4745
- if (mayClear) {
4746
- signal(m, "beforeCursorEnter");
4747
- if (m.explicitlyCleared) {
4748
- if (!line.markedSpans) break;
4749
- else {--i; continue;}
4750
- }
4751
- }
4752
- if (!m.atomic) continue;
4753
- var newPos = m.find(dir < 0 ? -1 : 1);
4754
- if (cmp(newPos, curPos) == 0) {
4755
- newPos.ch += dir;
4756
- if (newPos.ch < 0) {
4757
- if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
4758
- else newPos = null;
4759
- } else if (newPos.ch > line.text.length) {
4760
- if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
4761
- else newPos = null;
4762
- }
4763
- if (!newPos) {
4764
- if (flipped) {
4765
- // Driven in a corner -- no valid cursor position found at all
4766
- // -- try again *with* clearing, if we didn't already
4767
- if (!mayClear) return skipAtomic(doc, pos, bias, true);
4768
- // Otherwise, turn off editing until further notice, and return the start of the doc
4769
- doc.cantEdit = true;
4770
- return Pos(doc.first, 0);
4771
- }
4772
- flipped = true; newPos = pos; dir = -dir;
4773
- }
4774
- }
4775
- curPos = newPos;
4776
- continue search;
4777
  }
4778
  }
 
 
 
 
 
 
 
 
 
 
 
 
4779
  }
4780
- return curPos;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4781
  }
4782
  }
4783
 
@@ -5605,7 +5638,8 @@ module.exports = render;
5605
 
5606
  if (cm.state.focused && op.updateInput)
5607
  cm.display.input.reset(op.typing);
5608
- if (op.focus && op.focus == activeElt()) ensureFocus(op.cm);
 
5609
  }
5610
 
5611
  function endOperation_finish(op) {
@@ -5920,7 +5954,7 @@ module.exports = render;
5920
  return dx * dx + dy * dy > 20 * 20;
5921
  }
5922
  on(d.scroller, "touchstart", function(e) {
5923
- if (!isMouseLikeTouchEvent(e)) {
5924
  clearTimeout(touchFinished);
5925
  var now = +new Date;
5926
  d.activeTouch = {start: now, moved: false,
@@ -6049,7 +6083,7 @@ module.exports = render;
6049
  // not interfere with, such as a scrollbar or widget.
6050
  function onMouseDown(e) {
6051
  var cm = this, display = cm.display;
6052
- if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;
6053
  display.shift = e.shiftKey;
6054
 
6055
  if (eventInWidget(display, e)) {
@@ -6105,7 +6139,7 @@ module.exports = render;
6105
  }
6106
 
6107
  var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
6108
- if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
6109
  type == "single" && (contained = sel.contains(start)) > -1 &&
6110
  (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
6111
  (cmp(contained.to(), start) > 0 || start.xRel < 0))
@@ -6290,7 +6324,7 @@ module.exports = render;
6290
 
6291
  // Determines whether an event happened in the gutter, and fires the
6292
  // handlers for the corresponding event.
6293
- function gutterEvent(cm, e, type, prevent, signalfn) {
6294
  try { var mX = e.clientX, mY = e.clientY; }
6295
  catch(e) { return false; }
6296
  if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
@@ -6307,14 +6341,14 @@ module.exports = render;
6307
  if (g && g.getBoundingClientRect().right >= mX) {
6308
  var line = lineAtHeight(cm.doc, mY);
6309
  var gutter = cm.options.gutters[i];
6310
- signalfn(cm, type, cm, line, gutter, e);
6311
  return e_defaultPrevented(e);
6312
  }
6313
  }
6314
  }
6315
 
6316
  function clickInGutter(cm, e) {
6317
- return gutterEvent(cm, e, "gutterClick", true, signalLater);
6318
  }
6319
 
6320
  // Kludge to work around strange IE behavior where it'll sometimes
@@ -6329,7 +6363,7 @@ module.exports = render;
6329
  e_preventDefault(e);
6330
  if (ie) lastDrop = +new Date;
6331
  var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
6332
- if (!pos || isReadOnly(cm)) return;
6333
  // Might be a file drop, in which case we simply extract the text
6334
  // and insert it.
6335
  if (files && files.length && window.FileReader && window.File) {
@@ -6568,7 +6602,7 @@ module.exports = render;
6568
  cm.display.input.ensurePolled();
6569
  var prevShift = cm.display.shift, done = false;
6570
  try {
6571
- if (isReadOnly(cm)) cm.state.suppressEdits = true;
6572
  if (dropShift) cm.display.shift = false;
6573
  done = bound(cm) != Pass;
6574
  } finally {
@@ -6753,7 +6787,7 @@ module.exports = render;
6753
 
6754
  function contextMenuInGutter(cm, e) {
6755
  if (!hasHandler(cm, "gutterContextMenu")) return false;
6756
- return gutterEvent(cm, e, "gutterContextMenu", false, signal);
6757
  }
6758
 
6759
  // UPDATING
@@ -7301,10 +7335,9 @@ module.exports = render;
7301
  function findPosH(doc, pos, dir, unit, visually) {
7302
  var line = pos.line, ch = pos.ch, origDir = dir;
7303
  var lineObj = getLine(doc, line);
7304
- var possible = true;
7305
  function findNextLine() {
7306
  var l = line + dir;
7307
- if (l < doc.first || l >= doc.first + doc.size) return (possible = false);
7308
  line = l;
7309
  return lineObj = getLine(doc, l);
7310
  }
@@ -7314,14 +7347,16 @@ module.exports = render;
7314
  if (!boundToLine && findNextLine()) {
7315
  if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
7316
  else ch = dir < 0 ? lineObj.text.length : 0;
7317
- } else return (possible = false);
7318
  } else ch = next;
7319
  return true;
7320
  }
7321
 
7322
- if (unit == "char") moveOnce();
7323
- else if (unit == "column") moveOnce(true);
7324
- else if (unit == "word" || unit == "group") {
 
 
7325
  var sawType = null, group = unit == "group";
7326
  var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
7327
  for (var first = true;; first = false) {
@@ -7341,8 +7376,8 @@ module.exports = render;
7341
  if (dir > 0 && !moveOnce(!first)) break;
7342
  }
7343
  }
7344
- var result = skipAtomic(doc, Pos(line, ch), origDir, true);
7345
- if (!possible) result.hitSide = true;
7346
  return result;
7347
  }
7348
 
@@ -7729,6 +7764,7 @@ module.exports = render;
7729
  signal(this, "overwriteToggle", this, this.state.overwrite);
7730
  },
7731
  hasFocus: function() { return this.display.input.getField() == activeElt(); },
 
7732
 
7733
  scrollTo: methodOp(function(x, y) {
7734
  if (x != null || y != null) resolveScrollToPos(this);
@@ -9165,7 +9201,7 @@ module.exports = render;
9165
  parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;";
9166
  removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
9167
  }
9168
- return widget.height = widget.node.offsetHeight;
9169
  }
9170
 
9171
  function addLineWidget(doc, handle, node, options) {
@@ -9575,7 +9611,7 @@ module.exports = render;
9575
  if (nextChange == pos) { // Update current marker set
9576
  spanStyle = spanEndStyle = spanStartStyle = title = css = "";
9577
  collapsed = null; nextChange = Infinity;
9578
- var foundBookmarks = [];
9579
  for (var j = 0; j < spans.length; ++j) {
9580
  var sp = spans[j], m = sp.marker;
9581
  if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
@@ -9586,9 +9622,9 @@ module.exports = render;
9586
  spanEndStyle = "";
9587
  }
9588
  if (m.className) spanStyle += " " + m.className;
9589
- if (m.css) css = m.css;
9590
  if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
9591
- if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
9592
  if (m.title && !title) title = m.title;
9593
  if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
9594
  collapsed = sp;
@@ -9596,14 +9632,17 @@ module.exports = render;
9596
  nextChange = sp.from;
9597
  }
9598
  }
 
 
 
 
 
9599
  if (collapsed && (collapsed.from || 0) == pos) {
9600
  buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
9601
  collapsed.marker, collapsed.from == null);
9602
  if (collapsed.to == null) return;
9603
  if (collapsed.to == pos) collapsed = false;
9604
  }
9605
- if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)
9606
- buildCollapsedSpan(builder, 0, foundBookmarks[j]);
9607
  }
9608
  if (pos >= len) break;
9609
 
@@ -9855,6 +9894,7 @@ module.exports = render;
9855
  this.id = ++nextDocId;
9856
  this.modeOption = mode;
9857
  this.lineSep = lineSep;
 
9858
 
9859
  if (typeof text == "string") text = this.splitLines(text);
9860
  updateDoc(this, {from: start, to: start, text: text});
@@ -9942,10 +9982,11 @@ module.exports = render;
9942
  extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
9943
  }),
9944
  extendSelections: docMethodOp(function(heads, options) {
9945
- extendSelections(this, clipPosArray(this, heads, options));
9946
  }),
9947
  extendSelectionsBy: docMethodOp(function(f, options) {
9948
- extendSelections(this, map(this.sel.ranges, f), options);
 
9949
  }),
9950
  setSelections: docMethodOp(function(ranges, primary, options) {
9951
  if (!ranges.length) return;
@@ -11362,7 +11403,7 @@ module.exports = render;
11362
 
11363
  // THE END
11364
 
11365
- CodeMirror.version = "5.8.0";
11366
 
11367
  return CodeMirror;
11368
  });
@@ -11382,9 +11423,8 @@ module.exports = render;
11382
  "use strict";
11383
 
11384
  CodeMirror.defineMode("css", function(config, parserConfig) {
11385
- var provided = parserConfig;
11386
  if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
11387
- parserConfig.inline = provided.inline;
11388
 
11389
  var indentUnit = config.indentUnit,
11390
  tokenHooks = parserConfig.tokenHooks,
@@ -11598,7 +11638,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
11598
  if (type == "}" || type == "{") return popAndPass(type, stream, state);
11599
  if (type == "(") return pushContext(state, stream, "parens");
11600
 
11601
- if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
11602
  override += " error";
11603
  } else if (type == "word") {
11604
  wordAsValue(stream);
@@ -11738,9 +11778,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
11738
  return {
11739
  startState: function(base) {
11740
  return {tokenize: null,
11741
- state: parserConfig.inline ? "block" : "top",
11742
  stateArg: null,
11743
- context: new Context(parserConfig.inline ? "block" : "top", base || 0, null)};
11744
  },
11745
 
11746
  token: function(stream, state) {
@@ -11823,8 +11863,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
11823
  "animation-direction", "animation-duration", "animation-fill-mode",
11824
  "animation-iteration-count", "animation-name", "animation-play-state",
11825
  "animation-timing-function", "appearance", "azimuth", "backface-visibility",
11826
- "background", "background-attachment", "background-clip", "background-color",
11827
- "background-image", "background-origin", "background-position",
11828
  "background-repeat", "background-size", "baseline-shift", "binding",
11829
  "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
11830
  "bookmark-target", "border", "border-bottom", "border-bottom-color",
@@ -11968,11 +12008,12 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
11968
  "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
11969
  "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
11970
  "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
11971
- "col-resize", "collapse", "column", "column-reverse", "compact", "condensed", "contain", "content",
 
11972
  "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
11973
- "cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
11974
  "decimal-leading-zero", "default", "default-button", "destination-atop",
11975
- "destination-in", "destination-out", "destination-over", "devanagari",
11976
  "disc", "discard", "disclosure-closed", "disclosure-open", "document",
11977
  "dot-dash", "dot-dot-dash",
11978
  "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
@@ -11983,23 +12024,23 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
11983
  "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
11984
  "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
11985
  "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
11986
- "ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
11987
  "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
11988
  "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
11989
- "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
11990
  "help", "hidden", "hide", "higher", "highlight", "highlighttext",
11991
- "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
11992
  "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
11993
  "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
11994
  "inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
11995
  "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
11996
  "katakana", "katakana-iroha", "keep-all", "khmer",
11997
  "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
11998
- "landscape", "lao", "large", "larger", "left", "level", "lighter",
11999
  "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
12000
  "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
12001
  "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
12002
- "lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
12003
  "media-controls-background", "media-current-time-display",
12004
  "media-fullscreen-button", "media-mute-button", "media-play-button",
12005
  "media-return-to-realtime-button", "media-rewind-button",
@@ -12008,7 +12049,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12008
  "media-volume-slider-container", "media-volume-sliderthumb", "medium",
12009
  "menu", "menulist", "menulist-button", "menulist-text",
12010
  "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
12011
- "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
12012
  "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
12013
  "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
12014
  "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
@@ -12022,7 +12063,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12022
  "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
12023
  "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
12024
  "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
12025
- "s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
12026
  "scroll", "scrollbar", "se-resize", "searchfield",
12027
  "searchfield-cancel-button", "searchfield-decoration",
12028
  "searchfield-results-button", "searchfield-results-decoration",
@@ -12030,7 +12071,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12030
  "simp-chinese-formal", "simp-chinese-informal", "single",
12031
  "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
12032
  "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
12033
- "small", "small-caps", "small-caption", "smaller", "solid", "somali",
12034
  "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
12035
  "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
12036
  "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
@@ -12362,6 +12403,11 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12362
  })(function(CodeMirror) {
12363
  "use strict";
12364
 
 
 
 
 
 
12365
  CodeMirror.defineMode("javascript", function(config, parserConfig) {
12366
  var indentUnit = config.indentUnit;
12367
  var statementIndent = parserConfig.statementIndent;
@@ -12381,12 +12427,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12381
  "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
12382
  "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
12383
  "var": kw("var"), "const": kw("var"), "let": kw("var"),
12384
- "async": kw("async"), "function": kw("function"), "catch": kw("catch"),
12385
  "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
12386
  "in": operator, "typeof": operator, "instanceof": operator,
12387
  "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
12388
  "this": kw("this"), "class": kw("class"), "super": kw("atom"),
12389
- "await": C, "yield": C, "export": kw("export"), "import": kw("import"), "extends": C
12390
  };
12391
 
12392
  // Extend the 'normal' keywords with the TypeScript language extensions
@@ -12394,15 +12440,20 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12394
  var type = {type: "variable", style: "variable-3"};
12395
  var tsKeywords = {
12396
  // object-like things
12397
- "interface": kw("interface"),
12398
- "extends": kw("extends"),
12399
- "constructor": kw("constructor"),
 
 
12400
 
12401
  // scope modifiers
12402
- "public": kw("public"),
12403
- "private": kw("private"),
12404
- "protected": kw("protected"),
12405
- "static": kw("static"),
 
 
 
12406
 
12407
  // types
12408
  "string": type, "number": type, "boolean": type, "any": type
@@ -12470,8 +12521,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12470
  } else if (stream.eat("/")) {
12471
  stream.skipToEnd();
12472
  return ret("comment", "comment");
12473
- } else if (state.lastType == "operator" || state.lastType == "keyword c" ||
12474
- state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
12475
  readRegexp(stream);
12476
  stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
12477
  return ret("regexp", "string-2");
@@ -12705,6 +12755,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12705
  if (type == "class") return cont(pushlex("form"), className, poplex);
12706
  if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
12707
  if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
 
12708
  return pass(pushlex("stat"), expression, expect(";"), poplex);
12709
  }
12710
  function expression(type) {
@@ -12722,7 +12773,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12722
 
12723
  var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
12724
  if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
12725
- if (type == "async") return cont(expression);
12726
  if (type == "function") return cont(functiondef, maybeop);
12727
  if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
12728
  if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
@@ -12801,9 +12851,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12801
  if (type == "variable") {cx.marked = "property"; return cont();}
12802
  }
12803
  function objprop(type, value) {
12804
- if (type == "async") {
12805
- return cont(objprop);
12806
- } else if (type == "variable" || cx.style == "keyword") {
12807
  cx.marked = "property";
12808
  if (value == "get" || value == "set") return cont(getterSetter);
12809
  return cont(afterprop);
@@ -12812,8 +12860,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12812
  return cont(afterprop);
12813
  } else if (type == "jsonld-keyword") {
12814
  return cont(afterprop);
 
 
12815
  } else if (type == "[") {
12816
  return cont(expression, expect("]"), afterprop);
 
 
12817
  }
12818
  }
12819
  function getterSetter(type) {
@@ -12862,6 +12914,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12862
  return pass(pattern, maybetype, maybeAssign, vardefCont);
12863
  }
12864
  function pattern(type, value) {
 
12865
  if (type == "variable") { register(value); return cont(); }
12866
  if (type == "spread") return cont(pattern);
12867
  if (type == "[") return contCommasep(pattern, "]");
@@ -12874,6 +12927,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12874
  }
12875
  if (type == "variable") cx.marked = "property";
12876
  if (type == "spread") return cont(pattern);
 
12877
  return cont(expect(":"), pattern, maybeAssign);
12878
  }
12879
  function maybeAssign(_type, value) {
@@ -12996,7 +13050,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12996
  lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
12997
  localVars: parserConfig.localVars,
12998
  context: parserConfig.localVars && {vars: parserConfig.localVars},
12999
- indented: 0
13000
  };
13001
  if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
13002
  state.globalVars = parserConfig.globalVars;
@@ -13052,7 +13106,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13052
 
13053
  helperType: jsonMode ? "json" : "javascript",
13054
  jsonldMode: jsonldMode,
13055
- jsonMode: jsonMode
 
 
 
 
 
 
13056
  };
13057
  });
13058
 
@@ -13085,54 +13145,56 @@ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript
13085
  })(function(CodeMirror) {
13086
  "use strict";
13087
 
13088
- CodeMirror.defineMode("xml", function(config, parserConfig) {
13089
- var indentUnit = config.indentUnit;
13090
- var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
13091
- var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag;
13092
- if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true;
13093
-
13094
- var Kludges = parserConfig.htmlMode ? {
13095
- autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
13096
- 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
13097
- 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
13098
- 'track': true, 'wbr': true, 'menuitem': true},
13099
- implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
13100
- 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
13101
- 'th': true, 'tr': true},
13102
- contextGrabbers: {
13103
- 'dd': {'dd': true, 'dt': true},
13104
- 'dt': {'dd': true, 'dt': true},
13105
- 'li': {'li': true},
13106
- 'option': {'option': true, 'optgroup': true},
13107
- 'optgroup': {'optgroup': true},
13108
- 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
13109
- 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
13110
- 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
13111
- 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
13112
- 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
13113
- 'rp': {'rp': true, 'rt': true},
13114
- 'rt': {'rp': true, 'rt': true},
13115
- 'tbody': {'tbody': true, 'tfoot': true},
13116
- 'td': {'td': true, 'th': true},
13117
- 'tfoot': {'tbody': true},
13118
- 'th': {'td': true, 'th': true},
13119
- 'thead': {'tbody': true, 'tfoot': true},
13120
- 'tr': {'tr': true}
13121
- },
13122
- doNotIndent: {"pre": true},
13123
- allowUnquoted: true,
13124
- allowMissing: true,
13125
- caseFold: true
13126
- } : {
13127
- autoSelfClosers: {},
13128
- implicitlyClosed: {},
13129
- contextGrabbers: {},
13130
- doNotIndent: {},
13131
- allowUnquoted: false,
13132
- allowMissing: false,
13133
- caseFold: false
13134
- };
13135
- var alignCDATA = parserConfig.alignCDATA;
 
 
13136
 
13137
  // Return variables for tokenizers
13138
  var type, setStyle;
@@ -13262,7 +13324,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13262
  this.tagName = tagName;
13263
  this.indent = state.indented;
13264
  this.startOfLine = startOfLine;
13265
- if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
13266
  this.noIndent = true;
13267
  }
13268
  function popContext(state) {
@@ -13275,8 +13337,8 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13275
  return;
13276
  }
13277
  parentTagName = state.context.tagName;
13278
- if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
13279
- !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
13280
  return;
13281
  }
13282
  popContext(state);
@@ -13307,7 +13369,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13307
  if (type == "word") {
13308
  var tagName = stream.current();
13309
  if (state.context && state.context.tagName != tagName &&
13310
- Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))
13311
  popContext(state);
13312
  if (state.context && state.context.tagName == tagName) {
13313
  setStyle = "tag";
@@ -13343,7 +13405,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13343
  var tagName = state.tagName, tagStart = state.tagStart;
13344
  state.tagName = state.tagStart = null;
13345
  if (type == "selfcloseTag" ||
13346
- Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
13347
  maybePopContext(state, tagName);
13348
  } else {
13349
  maybePopContext(state, tagName);
@@ -13356,12 +13418,12 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13356
  }
13357
  function attrEqState(type, stream, state) {
13358
  if (type == "equals") return attrValueState;
13359
- if (!Kludges.allowMissing) setStyle = "error";
13360
  return attrState(type, stream, state);
13361
  }
13362
  function attrValueState(type, stream, state) {
13363
  if (type == "string") return attrContinuedState;
13364
- if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}
13365
  setStyle = "error";
13366
  return attrState(type, stream, state);
13367
  }
@@ -13371,12 +13433,14 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13371
  }
13372
 
13373
  return {
13374
- startState: function() {
13375
- return {tokenize: inText,
13376
- state: baseState,
13377
- indented: 0,
13378
- tagName: null, tagStart: null,
13379
- context: null};
 
 
13380
  },
13381
 
13382
  token: function(stream, state) {
@@ -13409,19 +13473,19 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13409
  return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
13410
  // Indent the starts of attribute names.
13411
  if (state.tagName) {
13412
- if (multilineTagIndentPastTag)
13413
  return state.tagStart + state.tagName.length + 2;
13414
  else
13415
- return state.tagStart + indentUnit * multilineTagIndentFactor;
13416
  }
13417
- if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
13418
  var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
13419
  if (tagAfter && tagAfter[1]) { // Closing tag spotted
13420
  while (context) {
13421
  if (context.tagName == tagAfter[2]) {
13422
  context = context.prev;
13423
  break;
13424
- } else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {
13425
  context = context.prev;
13426
  } else {
13427
  break;
@@ -13429,25 +13493,30 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
13429
  }
13430
  } else if (tagAfter) { // Opening tag spotted
13431
  while (context) {
13432
- var grabbers = Kludges.contextGrabbers[context.tagName];
13433
  if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
13434
  context = context.prev;
13435
  else
13436
  break;
13437
  }
13438
  }
13439
- while (context && !context.startOfLine)
13440
  context = context.prev;
13441
  if (context) return context.indent + indentUnit;
13442
- else return 0;
13443
  },
13444
 
13445
  electricInput: /<\/[\s\w:]+>$/,
13446
  blockCommentStart: "<!--",
13447
  blockCommentEnd: "-->",
13448
 
13449
- configuration: parserConfig.htmlMode ? "html" : "xml",
13450
- helperType: parserConfig.htmlMode ? "html" : "xml"
 
 
 
 
 
13451
  };
13452
  });
13453
 
@@ -13459,3 +13528,4 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
13459
  });
13460
 
13461
  },{"../../lib/codemirror":16}]},{},[10]);
 
1
+ (function () { var require = undefined; var define = undefined; (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})({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  var rows = function(m, i18n) {
291
  value : choice.value(),
292
  checked : choice.selected()
293
  }),
294
+ ' ',
295
  m('span', choice.label())
296
  ]
297
  )
534
  *
535
  * @param data
536
  */
537
+ function register(data, sticky) {
538
  var field = fields.register(data);
539
+ if( ! sticky ) {
540
+ registeredFields.push(field);
541
+ }
542
  }
543
 
544
  /**
626
  list.groupings.forEach(registerGrouping);
627
  }
628
 
629
+ /**
630
+ * Register all lists fields
631
+ *
632
+ * @param lists
633
+ */
634
+ function registerListsFields(lists) {
635
+ reset();
636
+ lists.forEach(registerListFields);
637
+ }
638
+
639
  function registerCustomFields(lists) {
640
 
641
  var choices;
646
  value: i18n.subscribe,
647
  type: "submit",
648
  title: i18n.submitButton
649
+ }, true);
650
 
651
  // register lists choice field
652
  choices = {};
653
+ for(var key in lists) {
654
+ choices[lists[key].id] = lists[key].name;
655
+ }
656
+
657
  register({
658
  name: '_mc4wp_lists',
659
  type: 'checkbox',
660
  title: i18n.listChoice,
661
  choices: choices,
662
  help: i18n.listChoiceDescription
663
+ }, true);
664
 
665
  choices = {
666
  'subscribe': "Subscribe",
673
  choices: choices,
674
  value: 'subscribe',
675
  help: i18n.formActionDescription
676
+ }, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  }
678
 
679
  /**
680
  * Expose some methods
681
  */
682
  return {
683
+ 'registerCustomFields': registerCustomFields,
684
+ 'registerListFields': registerListFields,
685
+ 'registerListsFields': registerListsFields
686
  }
687
 
688
  };
820
 
821
  // create Field object
822
  field = new Field(data);
823
+
824
+ // add to start of array
825
+ fields.unshift(field);
826
 
827
  // redraw view
828
  m.redraw();
1023
  Array.prototype.forEach.call(requiredFieldElements, function(el) {
1024
  var name = el.name.toUpperCase();
1025
 
1026
+ // bail if name attr starts with underscore
1027
+ if( name[0] === '_' ) {
1028
+ return;
1029
+ }
1030
+
1031
  // only add field if it's not already in it
1032
  if( requiredFields.indexOf(name) === -1 ) {
1033
  requiredFields.push(name);
1052
  var _element,
1053
  _onCloseCallback;
1054
 
1055
+ function close() {
1056
+ document.removeEventListener('keydown', onKeyDown);
1057
+ window.removeEventListener('resize', position);
1058
+ _onCloseCallback();
1059
+ }
1060
+
1061
  function onKeyDown(e) {
1062
  e = e || window.event;
1063
 
1064
  // close overlay when pressing ESC
1065
+ if(e.keyCode == 27) {
1066
+ close();
1067
  }
1068
 
1069
+ // prevent ENTER
1070
  if(e.keyCode == 13 ) {
1071
  e.preventDefault();
1072
  }
1086
  _element.style.top = ( marginTop > 0 ? marginTop : 0 ) + "px";
1087
  }
1088
 
 
 
 
 
 
 
 
 
 
1089
  return function (content, onCloseCallback) {
1090
  _onCloseCallback = onCloseCallback;
1091
 
1092
+ document.addEventListener('keydown', onKeyDown);
1093
+ window.addEventListener('resize', position);
1094
+
1095
  return [
1096
  m('div.overlay-wrap',
1097
  m("div.overlay", {
1105
  m('span', {
1106
  "class": 'close dashicons dashicons-no',
1107
  title : i18n.close,
1108
+ onclick: close
1109
  }),
1110
 
1111
  content
1114
  ,
1115
  m('div.overlay-background', {
1116
  title: i18n.close,
1117
+ onclick: close
1118
  })
1119
  ];
1120
  };
1149
 
1150
  // register fields and redraw screen in 2 seconds (fixes IE8 bug)
1151
  var fieldsFactory = new FieldsFactory(settings, fields, i18n);
1152
+ fieldsFactory.registerCustomFields(mc4wp_vars.mailchimp.lists);
1153
+ events.on('selectedLists.change', fieldsFactory.registerListsFields);
1154
+ fieldsFactory.registerListsFields(settings.getSelectedLists());
1155
+ window.setTimeout( function() { m.redraw();}, 2000 );
1156
 
1157
  // expose some methods
1158
  window.mc4wp = window.mc4wp || {};
2532
  else if (typeof define == "function" && define.amd) // AMD
2533
  return define([], mod);
2534
  else // Plain browser env
2535
+ (this || window).CodeMirror = mod();
2536
  })(function() {
2537
  "use strict";
2538
 
2929
  if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
2930
  });
2931
 
2932
+ this.checkedZeroWidth = false;
2933
  // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
2934
  if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
2935
  }
2964
  this.horiz.firstChild.style.width = "0";
2965
  }
2966
 
2967
+ if (!this.checkedZeroWidth && measure.clientHeight > 0) {
2968
+ if (sWidth == 0) this.zeroWidthHack();
2969
+ this.checkedZeroWidth = true;
2970
  }
2971
 
2972
  return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
2973
  },
2974
  setScrollLeft: function(pos) {
2975
  if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
2976
+ if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);
2977
  },
2978
  setScrollTop: function(pos) {
2979
  if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
2980
+ if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);
2981
  },
2982
+ zeroWidthHack: function() {
2983
  var w = mac && !mac_geMountainLion ? "12px" : "18px";
2984
+ this.horiz.style.height = this.vert.style.width = w;
2985
+ this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
2986
+ this.disableHoriz = new Delayed;
2987
+ this.disableVert = new Delayed;
2988
+ },
2989
+ enableZeroWidthBar: function(bar, delay) {
2990
+ bar.style.pointerEvents = "auto";
2991
+ function maybeDisable() {
2992
+ // To find out whether the scrollbar is still visible, we
2993
+ // check whether the element under the pixel in the bottom
2994
+ // left corner of the scrollbar box is the scrollbar box
2995
+ // itself (when the bar is still visible) or its filler child
2996
+ // (when the bar is hidden). If it is still visible, we keep
2997
+ // it enabled, if it's hidden, we disable pointer events.
2998
+ var box = bar.getBoundingClientRect();
2999
+ var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);
3000
+ if (elt != bar) bar.style.pointerEvents = "none";
3001
+ else delay.set(1000, maybeDisable);
3002
+ }
3003
+ delay.set(1000, maybeDisable);
3004
  },
3005
  clear: function() {
3006
  var parent = this.horiz.parentNode;
3342
  // given line.
3343
  function updateWidgetHeight(line) {
3344
  if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
3345
+ line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;
3346
  }
3347
 
3348
  // Do a bulk-read of the DOM positions and sizes needed to draw the
3613
  if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
3614
  }
3615
 
 
 
 
 
3616
  // This will be set to an array of strings when copying, so that,
3617
  // when pasting, we know what kind of selections the copied text
3618
  // was made out of.
3667
  var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
3668
  if (pasted) {
3669
  e.preventDefault();
3670
+ if (!cm.isReadOnly() && !cm.options.disableInput)
3671
  runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
3672
  return true;
3673
  }
3770
  });
3771
 
3772
  on(te, "paste", function(e) {
3773
+ if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
3774
 
3775
  cm.state.pasteIncoming = true;
3776
  input.fastPoll();
3777
  });
3778
 
3779
  function prepareCopyCut(e) {
3780
+ if (signalDOMEvent(cm, e)) return
3781
  if (cm.somethingSelected()) {
3782
  lastCopied = cm.getSelections();
3783
  if (input.inaccurateSelection) {
3805
  on(te, "copy", prepareCopyCut);
3806
 
3807
  on(display.scroller, "paste", function(e) {
3808
+ if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;
3809
  cm.state.pasteIncoming = true;
3810
  input.focus();
3811
  });
3939
  // in which case reading its value would be expensive.
3940
  if (this.contextMenuPending || !cm.state.focused ||
3941
  (hasSelection(input) && !prevInput && !this.composing) ||
3942
+ cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
3943
  return false;
3944
 
3945
  var text = input.value;
4090
  var div = input.div = display.lineDiv;
4091
  disableBrowserMagic(div);
4092
 
4093
+ on(div, "paste", function(e) {
4094
+ if (!signalDOMEvent(cm, e)) handlePaste(e, cm);
4095
+ })
4096
 
4097
  on(div, "compositionstart", function(e) {
4098
  var data = e.data;
4130
 
4131
  on(div, "input", function() {
4132
  if (input.composing) return;
4133
+ if (cm.isReadOnly() || !input.pollContent())
4134
  runInOp(input.cm, function() {regChange(cm);});
4135
  });
4136
 
4137
  function onCopyCut(e) {
4138
+ if (signalDOMEvent(cm, e)) return
4139
  if (cm.somethingSelected()) {
4140
  lastCopied = cm.getSelections();
4141
  if (e.type == "cut") cm.replaceSelection("", null, "cut");
4211
  try { var rng = range(start.node, start.offset, end.offset, end.node); }
4212
  catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
4213
  if (rng) {
4214
+ if (!gecko && this.cm.state.focused) {
4215
+ sel.collapse(start.node, start.offset);
4216
+ if (!rng.collapsed) sel.addRange(rng);
4217
+ } else {
4218
+ sel.removeAllRanges();
4219
+ sel.addRange(rng);
4220
+ }
4221
  if (old && sel.anchorNode == null) sel.addRange(old);
4222
  else if (gecko) this.startGracePeriod();
4223
  }
4361
  this.div.focus();
4362
  },
4363
  applyComposition: function(composing) {
4364
+ if (this.cm.isReadOnly())
4365
  operation(this.cm, regChange)(this.cm)
4366
  else if (composing.data && composing.data != composing.startData)
4367
  operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
4373
 
4374
  onKeyPress: function(e) {
4375
  e.preventDefault();
4376
+ if (!this.cm.isReadOnly())
4377
  operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
4378
  },
4379
 
4678
 
4679
  // Give beforeSelectionChange handlers a change to influence a
4680
  // selection update.
4681
+ function filterSelectionChange(doc, sel, options) {
4682
  var obj = {
4683
  ranges: sel.ranges,
4684
  update: function(ranges) {
4686
  for (var i = 0; i < ranges.length; i++)
4687
  this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
4688
  clipPos(doc, ranges[i].head));
4689
+ },
4690
+ origin: options && options.origin
4691
  };
4692
  signal(doc, "beforeSelectionChange", doc, obj);
4693
  if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
4713
 
4714
  function setSelectionNoUndo(doc, sel, options) {
4715
  if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
4716
+ sel = filterSelectionChange(doc, sel, options);
4717
 
4718
  var bias = options && options.bias ||
4719
  (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
4747
  var out;
4748
  for (var i = 0; i < sel.ranges.length; i++) {
4749
  var range = sel.ranges[i];
4750
+ var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
4751
+ var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
4752
+ var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
4753
  if (out || newAnchor != range.anchor || newHead != range.head) {
4754
  if (!out) out = sel.ranges.slice(0, i);
4755
  out[i] = new Range(newAnchor, newHead);
4758
  return out ? normalizeSelection(out, sel.primIndex) : sel;
4759
  }
4760
 
4761
+ function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
4762
+ var line = getLine(doc, pos.line);
4763
+ if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
4764
+ var sp = line.markedSpans[i], m = sp.marker;
4765
+ if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
4766
+ (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
4767
+ if (mayClear) {
4768
+ signal(m, "beforeCursorEnter");
4769
+ if (m.explicitlyCleared) {
4770
+ if (!line.markedSpans) break;
4771
+ else {--i; continue;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4772
  }
4773
  }
4774
+ if (!m.atomic) continue;
4775
+
4776
+ if (oldPos) {
4777
+ var near = m.find(dir < 0 ? 1 : -1), diff;
4778
+ if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) near = movePos(doc, near, -dir, line);
4779
+ if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
4780
+ return skipAtomicInner(doc, near, pos, dir, mayClear);
4781
+ }
4782
+
4783
+ var far = m.find(dir < 0 ? -1 : 1);
4784
+ if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) far = movePos(doc, far, dir, line);
4785
+ return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;
4786
  }
4787
+ }
4788
+ return pos;
4789
+ }
4790
+
4791
+ // Ensure a given position is not inside an atomic range.
4792
+ function skipAtomic(doc, pos, oldPos, bias, mayClear) {
4793
+ var dir = bias || 1;
4794
+ var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
4795
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
4796
+ skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
4797
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
4798
+ if (!found) {
4799
+ doc.cantEdit = true;
4800
+ return Pos(doc.first, 0);
4801
+ }
4802
+ return found;
4803
+ }
4804
+
4805
+ function movePos(doc, pos, dir, line) {
4806
+ if (dir < 0 && pos.ch == 0) {
4807
+ if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));
4808
+ else return null;
4809
+ } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
4810
+ if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);
4811
+ else return null;
4812
+ } else {
4813
+ return new Pos(pos.line, pos.ch + dir);
4814
  }
4815
  }
4816
 
5638
 
5639
  if (cm.state.focused && op.updateInput)
5640
  cm.display.input.reset(op.typing);
5641
+ if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))
5642
+ ensureFocus(op.cm);
5643
  }
5644
 
5645
  function endOperation_finish(op) {
5954
  return dx * dx + dy * dy > 20 * 20;
5955
  }
5956
  on(d.scroller, "touchstart", function(e) {
5957
+ if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
5958
  clearTimeout(touchFinished);
5959
  var now = +new Date;
5960
  d.activeTouch = {start: now, moved: false,
6083
  // not interfere with, such as a scrollbar or widget.
6084
  function onMouseDown(e) {
6085
  var cm = this, display = cm.display;
6086
+ if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;
6087
  display.shift = e.shiftKey;
6088
 
6089
  if (eventInWidget(display, e)) {
6139
  }
6140
 
6141
  var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
6142
+ if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
6143
  type == "single" && (contained = sel.contains(start)) > -1 &&
6144
  (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
6145
  (cmp(contained.to(), start) > 0 || start.xRel < 0))
6324
 
6325
  // Determines whether an event happened in the gutter, and fires the
6326
  // handlers for the corresponding event.
6327
+ function gutterEvent(cm, e, type, prevent) {
6328
  try { var mX = e.clientX, mY = e.clientY; }
6329
  catch(e) { return false; }
6330
  if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
6341
  if (g && g.getBoundingClientRect().right >= mX) {
6342
  var line = lineAtHeight(cm.doc, mY);
6343
  var gutter = cm.options.gutters[i];
6344
+ signal(cm, type, cm, line, gutter, e);
6345
  return e_defaultPrevented(e);
6346
  }
6347
  }
6348
  }
6349
 
6350
  function clickInGutter(cm, e) {
6351
+ return gutterEvent(cm, e, "gutterClick", true);
6352
  }
6353
 
6354
  // Kludge to work around strange IE behavior where it'll sometimes
6363
  e_preventDefault(e);
6364
  if (ie) lastDrop = +new Date;
6365
  var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
6366
+ if (!pos || cm.isReadOnly()) return;
6367
  // Might be a file drop, in which case we simply extract the text
6368
  // and insert it.
6369
  if (files && files.length && window.FileReader && window.File) {
6602
  cm.display.input.ensurePolled();
6603
  var prevShift = cm.display.shift, done = false;
6604
  try {
6605
+ if (cm.isReadOnly()) cm.state.suppressEdits = true;
6606
  if (dropShift) cm.display.shift = false;
6607
  done = bound(cm) != Pass;
6608
  } finally {
6787
 
6788
  function contextMenuInGutter(cm, e) {
6789
  if (!hasHandler(cm, "gutterContextMenu")) return false;
6790
+ return gutterEvent(cm, e, "gutterContextMenu", false);
6791
  }
6792
 
6793
  // UPDATING
7335
  function findPosH(doc, pos, dir, unit, visually) {
7336
  var line = pos.line, ch = pos.ch, origDir = dir;
7337
  var lineObj = getLine(doc, line);
 
7338
  function findNextLine() {
7339
  var l = line + dir;
7340
+ if (l < doc.first || l >= doc.first + doc.size) return false
7341
  line = l;
7342
  return lineObj = getLine(doc, l);
7343
  }
7347
  if (!boundToLine && findNextLine()) {
7348
  if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
7349
  else ch = dir < 0 ? lineObj.text.length : 0;
7350
+ } else return false
7351
  } else ch = next;
7352
  return true;
7353
  }
7354
 
7355
+ if (unit == "char") {
7356
+ moveOnce()
7357
+ } else if (unit == "column") {
7358
+ moveOnce(true)
7359
+ } else if (unit == "word" || unit == "group") {
7360
  var sawType = null, group = unit == "group";
7361
  var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
7362
  for (var first = true;; first = false) {
7376
  if (dir > 0 && !moveOnce(!first)) break;
7377
  }
7378
  }
7379
+ var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);
7380
+ if (!cmp(pos, result)) result.hitSide = true;
7381
  return result;
7382
  }
7383
 
7764
  signal(this, "overwriteToggle", this, this.state.overwrite);
7765
  },
7766
  hasFocus: function() { return this.display.input.getField() == activeElt(); },
7767
+ isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); },
7768
 
7769
  scrollTo: methodOp(function(x, y) {
7770
  if (x != null || y != null) resolveScrollToPos(this);
9201
  parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;";
9202
  removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
9203
  }
9204
+ return widget.height = widget.node.parentNode.offsetHeight;
9205
  }
9206
 
9207
  function addLineWidget(doc, handle, node, options) {
9611
  if (nextChange == pos) { // Update current marker set
9612
  spanStyle = spanEndStyle = spanStartStyle = title = css = "";
9613
  collapsed = null; nextChange = Infinity;
9614
+ var foundBookmarks = [], endStyles
9615
  for (var j = 0; j < spans.length; ++j) {
9616
  var sp = spans[j], m = sp.marker;
9617
  if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
9622
  spanEndStyle = "";
9623
  }
9624
  if (m.className) spanStyle += " " + m.className;
9625
+ if (m.css) css = (css ? css + ";" : "") + m.css;
9626
  if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
9627
+ if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)
9628
  if (m.title && !title) title = m.title;
9629
  if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
9630
  collapsed = sp;
9632
  nextChange = sp.from;
9633
  }
9634
  }
9635
+ if (endStyles) for (var j = 0; j < endStyles.length; j += 2)
9636
+ if (endStyles[j + 1] == nextChange) spanEndStyle += " " + endStyles[j]
9637
+
9638
+ if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)
9639
+ buildCollapsedSpan(builder, 0, foundBookmarks[j]);
9640
  if (collapsed && (collapsed.from || 0) == pos) {
9641
  buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
9642
  collapsed.marker, collapsed.from == null);
9643
  if (collapsed.to == null) return;
9644
  if (collapsed.to == pos) collapsed = false;
9645
  }
 
 
9646
  }
9647
  if (pos >= len) break;
9648
 
9894
  this.id = ++nextDocId;
9895
  this.modeOption = mode;
9896
  this.lineSep = lineSep;
9897
+ this.extend = false;
9898
 
9899
  if (typeof text == "string") text = this.splitLines(text);
9900
  updateDoc(this, {from: start, to: start, text: text});
9982
  extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
9983
  }),
9984
  extendSelections: docMethodOp(function(heads, options) {
9985
+ extendSelections(this, clipPosArray(this, heads), options);
9986
  }),
9987
  extendSelectionsBy: docMethodOp(function(f, options) {
9988
+ var heads = map(this.sel.ranges, f);
9989
+ extendSelections(this, clipPosArray(this, heads), options);
9990
  }),
9991
  setSelections: docMethodOp(function(ranges, primary, options) {
9992
  if (!ranges.length) return;
11403
 
11404
  // THE END
11405
 
11406
+ CodeMirror.version = "5.11.0";
11407
 
11408
  return CodeMirror;
11409
  });
11423
  "use strict";
11424
 
11425
  CodeMirror.defineMode("css", function(config, parserConfig) {
11426
+ var inline = parserConfig.inline
11427
  if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
 
11428
 
11429
  var indentUnit = config.indentUnit,
11430
  tokenHooks = parserConfig.tokenHooks,
11638
  if (type == "}" || type == "{") return popAndPass(type, stream, state);
11639
  if (type == "(") return pushContext(state, stream, "parens");
11640
 
11641
+ if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
11642
  override += " error";
11643
  } else if (type == "word") {
11644
  wordAsValue(stream);
11778
  return {
11779
  startState: function(base) {
11780
  return {tokenize: null,
11781
+ state: inline ? "block" : "top",
11782
  stateArg: null,
11783
+ context: new Context(inline ? "block" : "top", base || 0, null)};
11784
  },
11785
 
11786
  token: function(stream, state) {
11863
  "animation-direction", "animation-duration", "animation-fill-mode",
11864
  "animation-iteration-count", "animation-name", "animation-play-state",
11865
  "animation-timing-function", "appearance", "azimuth", "backface-visibility",
11866
+ "background", "background-attachment", "background-blend-mode", "background-clip",
11867
+ "background-color", "background-image", "background-origin", "background-position",
11868
  "background-repeat", "background-size", "baseline-shift", "binding",
11869
  "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
11870
  "bookmark-target", "border", "border-bottom", "border-bottom-color",
12008
  "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
12009
  "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
12010
  "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
12011
+ "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
12012
+ "compact", "condensed", "contain", "content",
12013
  "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
12014
+ "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
12015
  "decimal-leading-zero", "default", "default-button", "destination-atop",
12016
+ "destination-in", "destination-out", "destination-over", "devanagari", "difference",
12017
  "disc", "discard", "disclosure-closed", "disclosure-open", "document",
12018
  "dot-dash", "dot-dot-dash",
12019
  "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
12024
  "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
12025
  "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
12026
  "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
12027
+ "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
12028
  "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
12029
  "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
12030
+ "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
12031
  "help", "hidden", "hide", "higher", "highlight", "highlighttext",
12032
+ "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
12033
  "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
12034
  "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
12035
  "inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
12036
  "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
12037
  "katakana", "katakana-iroha", "keep-all", "khmer",
12038
  "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
12039
+ "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
12040
  "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
12041
  "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
12042
  "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
12043
+ "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
12044
  "media-controls-background", "media-current-time-display",
12045
  "media-fullscreen-button", "media-mute-button", "media-play-button",
12046
  "media-return-to-realtime-button", "media-rewind-button",
12049
  "media-volume-slider-container", "media-volume-sliderthumb", "medium",
12050
  "menu", "menulist", "menulist-button", "menulist-text",
12051
  "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
12052
+ "mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
12053
  "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
12054
  "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
12055
  "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
12063
  "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
12064
  "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
12065
  "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
12066
+ "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
12067
  "scroll", "scrollbar", "se-resize", "searchfield",
12068
  "searchfield-cancel-button", "searchfield-decoration",
12069
  "searchfield-results-button", "searchfield-results-decoration",
12071
  "simp-chinese-formal", "simp-chinese-informal", "single",
12072
  "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
12073
  "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
12074
+ "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
12075
  "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
12076
  "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
12077
  "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
12403
  })(function(CodeMirror) {
12404
  "use strict";
12405
 
12406
+ function expressionAllowed(stream, state, backUp) {
12407
+ return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
12408
+ (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
12409
+ }
12410
+
12411
  CodeMirror.defineMode("javascript", function(config, parserConfig) {
12412
  var indentUnit = config.indentUnit;
12413
  var statementIndent = parserConfig.statementIndent;
12427
  "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
12428
  "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
12429
  "var": kw("var"), "const": kw("var"), "let": kw("var"),
12430
+ "function": kw("function"), "catch": kw("catch"),
12431
  "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
12432
  "in": operator, "typeof": operator, "instanceof": operator,
12433
  "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
12434
  "this": kw("this"), "class": kw("class"), "super": kw("atom"),
12435
+ "yield": C, "export": kw("export"), "import": kw("import"), "extends": C
12436
  };
12437
 
12438
  // Extend the 'normal' keywords with the TypeScript language extensions
12440
  var type = {type: "variable", style: "variable-3"};
12441
  var tsKeywords = {
12442
  // object-like things
12443
+ "interface": kw("class"),
12444
+ "implements": C,
12445
+ "namespace": C,
12446
+ "module": kw("module"),
12447
+ "enum": kw("module"),
12448
 
12449
  // scope modifiers
12450
+ "public": kw("modifier"),
12451
+ "private": kw("modifier"),
12452
+ "protected": kw("modifier"),
12453
+ "abstract": kw("modifier"),
12454
+
12455
+ // operators
12456
+ "as": operator,
12457
 
12458
  // types
12459
  "string": type, "number": type, "boolean": type, "any": type
12521
  } else if (stream.eat("/")) {
12522
  stream.skipToEnd();
12523
  return ret("comment", "comment");
12524
+ } else if (expressionAllowed(stream, state, 1)) {
 
12525
  readRegexp(stream);
12526
  stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
12527
  return ret("regexp", "string-2");
12755
  if (type == "class") return cont(pushlex("form"), className, poplex);
12756
  if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
12757
  if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
12758
+ if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
12759
  return pass(pushlex("stat"), expression, expect(";"), poplex);
12760
  }
12761
  function expression(type) {
12773
 
12774
  var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
12775
  if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
 
12776
  if (type == "function") return cont(functiondef, maybeop);
12777
  if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
12778
  if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
12851
  if (type == "variable") {cx.marked = "property"; return cont();}
12852
  }
12853
  function objprop(type, value) {
12854
+ if (type == "variable" || cx.style == "keyword") {
 
 
12855
  cx.marked = "property";
12856
  if (value == "get" || value == "set") return cont(getterSetter);
12857
  return cont(afterprop);
12860
  return cont(afterprop);
12861
  } else if (type == "jsonld-keyword") {
12862
  return cont(afterprop);
12863
+ } else if (type == "modifier") {
12864
+