ESP8266 part of the f105-motor-demo project (see f105-motor-demo_stm32)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2 lines
48 KiB

function bool(t){return 1===t||"1"===t||t===!0||"true"===t}function e(t){return String(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)}function isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function regexEscape(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function rssiPerc(t){var e=parseInt(t);return e>-50?100:-100>e?0:Math.round(2*(e+100))}!function(){"use strict";function t(){var t;for(f=!0,t=0;t<d.length;t+=1)d[t]();d=[]}function e(){var e;for(m=!0,f||t(),e=0;e<p.length;e+=1)p[e]();p=[]}function n(t,e){var n;for(n=e.length-1;n>=0;n-=1)t(e[n])}function i(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function s(t,e){return t.currentStyle?t.currentStyle[i(e)]:x.getComputedStyle?x.getComputedStyle(t,null).getPropertyValue(e):null}function r(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function a(t,e,n){try{t.style[i(e)]=n}catch(s){}}function o(t){t.style.display="","none"===s(t,"display")&&(t.style.display="block")}function c(t){var e,i,s,a="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(i=0;i<t[e].length;i+=1)a+="&"+r(e,t[e][i]);else a+="&"+r(e,t[e])}else n(function(t){if("FORM"===t.nodeName)for(i=0;i<t.elements.length;i+=1)if(e=t.elements[i],!e.disabled)switch(e.type){case"button":case"image":case"file":case"submit":case"reset":break;case"select-one":e.length>0&&(a+="&"+r(e.name,e.value));break;case"select-multiple":for(s=0;s<e.length;s+=1)e[s].selected&&(a+="&"+r(e.name,e[s].value));break;case"checkbox":case"radio":e.checked&&(a+="&"+r(e.name,e.value));break;default:a+="&"+r(e.name,e.value)}},t);return a.length>0?a.substring(1):""}function u(t,e,i){var s,r,a,o=!1;return t&&(s=t.split(/\s+/),n(function(t){for(a=0;a<s.length;a+=1)if(r=new RegExp("\\b"+s[a]+"\\b","g"),"remove"===e)t.className=t.className.replace(r,"");else if("toggle"===e)t.className=t.className.match(r)?t.className.replace(r,""):t.className+" "+s[a];else if("has"===e&&t.className.match(r)){o=!0;break}},i)),o}function l(t,e,i){var s,r;t&&n(function(n){for(s=v.createElement("div"),s.innerHTML=t;null!==(r=s.lastChild);)try{"before"===e?n.parentNode.insertBefore(r,n):"after"===e?n.parentNode.insertBefore(r,n.nextSibling):"append"===e?n.appendChild(r):"prepend"===e&&n.insertBefore(r,n.firstChild)}catch(i){break}},i)}function h(t){var e,r,y,w=[],b=!1;if(t)if(t.nodeType&&1===t.nodeType)w=[t];else if("object"==typeof t)b="number"!=typeof t.length,w=t;else if("string"==typeof t)for(v.querySelectorAll||(v.querySelectorAll=function(t){var e,n,i,r=v.getElementsByTagName("head")[0],a=[];if(e=v.createElement("STYLE"),e.type="text/css",e.styleSheet){for(e.styleSheet.cssText=t+" {a:b}",r.appendChild(e),n=v.getElementsByTagName("*"),i=0;i<n.length;i+=1)"b"===s(n[i],"a")&&a.push(n[i]);r.removeChild(e)}return a}),r=v.querySelectorAll(t),y=0;y<r.length;y+=1)w[y]=r[y];return e=b?{}:w,e.ready=function(t){if(t){if(f)return t(),e;d.push(t)}},e.loaded=function(t){if(t){if(m)return t(),e;p.push(t)}},e.each=function(t){return"function"==typeof t&&n(function(e){return t.apply(e,arguments)},w),e},e.first=function(){return h(w.shift())},e.last=function(){return h(w.pop())},e.odd=function(){var t,e=[];for(t=0;t<w.length;t+=2)e.push(w[t]);return h(e)},e.even=function(){var t,e=[];for(t=1;t<w.length;t+=2)e.push(w[t]);return h(e)},e.hide=function(){return n(function(t){t.style.display="none"},w),e},e.show=function(){return n(function(t){o(t)},w),e},e.toggle=function(t){return"undefined"!=typeof t?t?e.show():e.hide():n(function(t){"none"===s(t,"display")?o(t):t.style.display="none"},w),e},e.remove=function(){return n(function(t){try{t.parentNode.removeChild(t)}catch(e){}},w),h()},e.css=function(t,r){if(t){if(r||""===r)return n(function(e){a(e,t,r)},w),e;if(w[0]){if(w[0].style[i(t)])return w[0].style[i(t)];if(s(w[0],t))return s(w[0],t)}}},e.getClass=function(){return w[0]&&w[0].className.length>0?w[0].className.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"").replace(/\s+/," "):void 0},e.setClass=function(t){return(t||""===t)&&n(function(e){e.className=t},w),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},w),e},e.removeClass=function(t){return u(t,"remove",w),e},e.toggleClass=function(t){return u(t,"toggle",w),e},e.hasClass=function(t){return u(t,"has",w)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},w),e):w[0]?w[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",w),e},e.htmlAfter=function(t){return l(t,"after",w),e},e.htmlAppend=function(t){return l(t,"append",w),e},e.htmlPrepend=function(t){return l(t,"prepend",w),e},e.attr=function(t,i){if(t){if(t=t.toLowerCase(),"undefined"!=typeof i)return n(function(e){"style"===t?e.style.cssText=i:"class"===t?e.className=i:e.setAttribute(t,i)},w),e;if(w[0])if("style"===t){if(w[0].style.cssText)return w[0].style.cssText}else if("class"===t){if(w[0].className)return w[0].className}else if(w[0].getAttribute(t))return w[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var i,s,r;if(t||""===t)return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),s=0;s<e.length;s+=1)for(r=0;r<t.length;r+=1)if(e[s].selected="",e[s].value===t[r]){e[s].selected="selected";break}break;case"INPUT":case"TEXTAREA":case"BUTTON":e.value=t}},w),e;if(w[0])switch(w[0].nodeName){case"SELECT":for(i=[],s=0;s<w[0].length;s+=1)w[0][s].selected&&i.push(w[0][s].value);return i.length>1?i:i[0];case"INPUT":case"TEXTAREA":case"BUTTON":return w[0].value}},e.checked=function(t){return"boolean"==typeof t?(n(function(e){"INPUT"!==e.nodeName||"checkbox"!==e.type&&"radio"!==e.type||(e.checked=t)},w),e):!w[0]||"INPUT"!==w[0].nodeName||"checkbox"!==w[0].type&&"radio"!==w[0].type?void 0:!!w[0].checked},e.on=function(i,s){return t!==x&&t!==v||(w=[t]),n(function(t){v.addEventListener?t.addEventListener(i,s,!1):v.attachEvent&&(t[i+s]=function(){return s.apply(t,arguments)},t.attachEvent("on"+i,t[i+s]))},w),e},e.off=function(i,s){return t!==x&&t!==v||(w=[t]),n(function(t){v.addEventListener?t.removeEventListener(i,s,!1):v.attachEvent&&(t.detachEvent("on"+i,t[i+s]),t[i+s]=null)},w),e},e.ajax=function(t,n,i,s,r){var a,o,u=c(w),l=n?n.toUpperCase():"GET",h=new RegExp("http[s]?://(.*?)/","gi"),d=h.exec(t),p="_ts="+ +new Date,f=v.getElementsByTagName("head")[0],m="chibi"+ +new Date+(g+=1);return!u||"GET"!==l&&"DELETE"!==l||(t+=-1===t.indexOf("?")?"?"+u:"&"+u,u=null),"GET"===l&&!r&&d&&x.location.host!==d[1]?(s&&(t+=-1===t.indexOf("?")?"?"+p:"&"+p),t=t.replace("=%3F","=?"),i&&-1!==t.indexOf("=?")&&(t=t.replace("=?","="+m),x[m]=function(t){try{i(t,200)}catch(e){}x[m]=void 0}),o=document.createElement("script"),o.async=!0,o.src=t,o.onload=function(){f.removeChild(o)},f.appendChild(o)):(x.XMLHttpRequest?a=new XMLHttpRequest:x.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP")),a&&(s&&(t+=-1===t.indexOf("?")?"?"+p:"&"+p),a.open(l,t,!0),a.onreadystatechange=function(){4===a.readyState&&i&&i(a.responseText,a.status)},a.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"!==l&&"PUT"!==l||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(u))),e},e.get=function(t,n,i,s){return e.ajax(t,"get",n,i,s)},e.post=function(t,n,i){return e.ajax(t,"post",n,i)},e}var d=[],p=[],f=!1,m=!1,g=0,v=document,x=window;v.addEventListener?(v.addEventListener("DOMContentLoaded",t,!1),x.addEventListener("load",e,!1)):v.attachEvent?(v.attachEvent("onreadystatechange",t),x.attachEvent("onload",e)):x.onload=e,x.$=h}(),function(t,e){t.Chartist=e()}(this,function(){var t={version:"0.9.7"};return function(t,e,n){"use strict";n.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},n.noop=function(t){return t},n.alphaNumerate=function(t){return String.fromCharCode(97+t%26)},n.extend=function(t){t=t||{};var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(e){for(var i in e)"object"!=typeof e[i]||null===e[i]||e[i]instanceof Array?t[i]=e[i]:t[i]=n.extend({},t[i],e[i])}),t},n.replaceAll=function(t,e,n){return t.replace(new RegExp(e,"g"),n)},n.ensureUnit=function(t,e){return"number"==typeof t&&(t+=e),t},n.quantity=function(t){if("string"==typeof t){var e=/^(\d+)\s*(.*)$/g.exec(t);return{value:+e[1],unit:e[2]||void 0}}return{value:t}},n.querySelector=function(t){return t instanceof Node?t:e.querySelector(t)},n.times=function(t){return Array.apply(null,new Array(t))},n.sum=function(t,e){return t+(e?e:0)},n.mapMultiply=function(t){return function(e){return e*t}},n.mapAdd=function(t){return function(e){return e+t}},n.serialMap=function(t,e){var i=[],s=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(s).forEach(function(n,s){var r=t.map(function(t){return t[s]});i[s]=e.apply(null,r)}),i},n.roundWithPrecision=function(t,e){var i=Math.pow(10,e||n.precision);return Math.round(t*i)/i},n.precision=8,n.escapingMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"},n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),Object.keys(n.escapingMap).reduce(function(t,e){return n.replaceAll(t,e,n.escapingMap[e])},t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=Object.keys(n.escapingMap).reduce(function(t,e){return n.replaceAll(t,n.escapingMap[e],e)},t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,i,s){var r;return e=e||"100%",i=i||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),r=new n.Svg("svg").attr({width:e,height:i}).addClass(s).attr({style:"width: "+e+"; height: "+i+";"}),t.appendChild(r._node),r},n.normalizeData=function(t){if(t=t||{series:[],labels:[]},t.series=t.series||[],t.labels=t.labels||[],t.series.length>0&&0===t.labels.length){var e,i=n.getDataArray(t);e=i.every(function(t){return t instanceof Array})?Math.max.apply(null,i.map(function(t){return t.length})):i.length,t.labels=n.times(e).map(function(){return""})}return t},n.reverseData=function(t){t.labels.reverse(),t.series.reverse();for(var e=0;e<t.series.length;e++)"object"==typeof t.series[e]&&void 0!==t.series[e].data?t.series[e].data.reverse():t.series[e]instanceof Array&&t.series[e].reverse()},n.getDataArray=function(t,e,i){function s(t){if(!n.isFalseyButZero(t)){if((t.data||t)instanceof Array)return(t.data||t).map(s);if(t.hasOwnProperty("value"))return s(t.value);if(i){var e={};return"string"==typeof i?e[i]=n.getNumberOrUndefined(t):e.y=n.getNumberOrUndefined(t),e.x=t.hasOwnProperty("x")?n.getNumberOrUndefined(t.x):e.x,e.y=t.hasOwnProperty("y")?n.getNumberOrUndefined(t.y):e.y,e}return n.getNumberOrUndefined(t)}}return(e&&!t.reversed||!e&&t.reversed)&&(n.reverseData(t),t.reversed=!t.reversed),t.series.map(s)},n.normalizePadding=function(t,e){return e=e||0,"number"==typeof t?{top:t,right:t,bottom:t,left:t}:{top:"number"==typeof t.top?t.top:e,right:"number"==typeof t.right?t.right:e,bottom:"number"==typeof t.bottom?t.bottom:e,left:"number"==typeof t.left?t.left:e}},n.getMetaData=function(t,e){var i=t.data?t.data[e]:t[e];return i?n.serialize(i.meta):void 0},n.orderOfMagnitude=function(t){return Math.floor(Math.log(Math.abs(t))/Math.LN10)},n.projectLength=function(t,e,n){return e/n.range*t},n.getAvailableHeight=function(t,e){return Math.max((n.quantity(e.height).value||t.height())-(e.chartPadding.top+e.chartPadding.bottom)-e.axisX.offset,0)},n.getHighLow=function(t,e,i){function s(t){if(void 0!==t)if(t instanceof Array)for(var e=0;e<t.length;e++)s(t[e]);else{var n=i?+t[i]:+t;a&&n>r.high&&(r.high=n),o&&n<r.low&&(r.low=n)}}e=n.extend({},e,i?e["axis"+i.toUpperCase()]:{});var r={high:void 0===e.high?-Number.MAX_VALUE:+e.high,low:void 0===e.low?Number.MAX_VALUE:+e.low},a=void 0===e.high,o=void 0===e.low;return(a||o)&&s(t),(e.referenceValue||0===e.referenceValue)&&(r.high=Math.max(e.referenceValue,r.high),r.low=Math.min(e.referenceValue,r.low)),r.high<=r.low&&(0===r.low?r.high=1:r.low<0?r.high=0:r.high>0?r.low=0:(r.high=1,r.low=0)),r},n.isNum=function(t){return!isNaN(t)&&isFinite(t)},n.isFalseyButZero=function(t){return!t&&0!==t},n.getNumberOrUndefined=function(t){return isNaN(+t)?void 0:+t},n.getMultiValue=function(t,e){return n.isNum(t)?+t:t?t[e||"y"]||0:0},n.rho=function(t){function e(t,n){return t%n===0?n:e(n,t%n)}function n(t){return t*t+1}if(1===t)return t;var i,s=2,r=2;if(t%2===0)return 2;do s=n(s)%t,r=n(n(r))%t,i=e(Math.abs(s-r),t);while(1===i);return i},n.getBounds=function(t,e,i,s){var r,a,o,c=0,u={high:e.high,low:e.low};u.valueRange=u.high-u.low,u.oom=n.orderOfMagnitude(u.valueRange),u.step=Math.pow(10,u.oom),u.min=Math.floor(u.low/u.step)*u.step,u.max=Math.ceil(u.high/u.step)*u.step,u.range=u.max-u.min,u.numberOfSteps=Math.round(u.range/u.step);var l=n.projectLength(t,u.step,u),h=i>l,d=s?n.rho(u.range):0;if(s&&n.projectLength(t,1,u)>=i)u.step=1;else if(s&&d<u.step&&n.projectLength(t,d,u)>=i)u.step=d;else for(;;){if(h&&n.projectLength(t,u.step,u)<=i)u.step*=2;else{if(h||!(n.projectLength(t,u.step/2,u)>=i))break;if(u.step/=2,s&&u.step%1!==0){u.step*=2;break}}if(c++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(a=u.min,o=u.max;a+u.step<=u.low;)a+=u.step;for(;o-u.step>=u.high;)o-=u.step;for(u.min=a,u.max=o,u.range=u.max-u.min,u.values=[],r=u.min;r<=u.max;r+=u.step)u.values.push(n.roundWithPrecision(r));return u},n.polarToCartesian=function(t,e,n,i){var s=(i-90)*Math.PI/180;return{x:t+n*Math.cos(s),y:e+n*Math.sin(s)}},n.createChartRect=function(t,e,i){var s=!(!e.axisX&&!e.axisY),r=s?e.axisY.offset:0,a=s?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,c=t.height()||n.quantity(e.height).value||0,u=n.normalizePadding(e.chartPadding,i);o=Math.max(o,r+u.left+u.right),c=Math.max(c,a+u.top+u.bottom);var l={padding:u,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return s?("start"===e.axisX.position?(l.y2=u.top+a,l.y1=Math.max(c-u.bottom,l.y2+1)):(l.y2=u.top,l.y1=Math.max(c-u.bottom-a,l.y2+1)),"start"===e.axisY.position?(l.x1=u.left+r,l.x2=Math.max(o-u.right,l.x1+1)):(l.x1=u.left,l.x2=Math.max(o-u.right-r,l.x1+1))):(l.x1=u.left,l.x2=Math.max(o-u.right,l.x1+1),l.y2=u.top,l.y1=Math.max(c-u.bottom,l.y2+1)),l},n.createGrid=function(t,e,i,s,r,a,o,c){var u={};u[i.units.pos+"1"]=Math.round(t)+.5,u[i.units.pos+"2"]=Math.round(t)+.5,u[i.counterUnits.pos+"1"]=s,u[i.counterUnits.pos+"2"]=s+r;var l=a.elem("line",u,o.join(" "));c.emit("draw",n.extend({type:"grid",axis:i,index:e,group:a,element:l},u))},n.createLabel=function(t,e,i,s,r,a,o,c,u,l,h){var d,p={};p[r.units.pos]=t+o[r.units.pos],p[r.counterUnits.pos]=o[r.counterUnits.pos],p[r.units.len]=e,p[r.counterUnits.len]=a-10;var f=s[i];if(f=Math.round(100*+f)/100,l){var m='<span class="'+u.join(" ")+'" style="'+r.units.len+": "+Math.round(p[r.units.len])+"px; "+r.counterUnits.len+": "+Math.round(p[r.counterUnits.len])+'px">'+f+"</span>";d=c.foreignObject(m,n.extend({style:"overflow: visible;"},p))}else d=c.elem("text",p,u.join(" ")).text(f);h.emit("draw",n.extend({type:"label",axis:r,index:i,group:c,element:d,text:f},p))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var i=e.series[t.name];return i.hasOwnProperty(n)?i[n]:e[n]}return e[n]},n.optionsProvider=function(e,i,s){function r(e){var r=o;if(o=n.extend({},u),i)for(c=0;c<i.length;c++){var a=t.matchMedia(i[c][0]);a.matches&&(o=n.extend(o,i[c][1]))}s&&!e&&s.emit("optionsChanged",{previousOptions:r,currentOptions:o})}function a(){l.forEach(function(t){t.removeListener(r)})}var o,c,u=n.extend({},e),l=[];if(!t.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(i)for(c=0;c<i.length;c++){var h=t.matchMedia(i[c][0]);h.addListener(r),l.push(h)}return r(!0),{removeMediaQueryListeners:a,getCurrentOptions:function(){return n.extend({},o)}}}}(window,document,t),function(t,e,n){"use strict";n.Interpolation={},n.Interpolation.none=function(t){var e={fillHoles:!1};return t=n.extend({},e,t),function(e,i){for(var s=new n.Svg.Path,r=!0,a=0;a<e.length;a+=2){var o=e[a],c=e[a+1],u=i[a/2];void 0!==u.value?(r?s.move(o,c,!1,u):s.line(o,c,!1,u),r=!1):t.fillHoles||(r=!0)}return s}},n.Interpolation.simple=function(t){var e={divisor:2,fillHoles:!1};t=n.extend({},e,t);var i=1/Math.max(1,t.divisor);return function(e,s){for(var r,a,o,c=new n.Svg.Path,u=0;u<e.length;u+=2){var l=e[u],h=e[u+1],d=(l-r)*i,p=s[u/2];void 0!==p.value?(void 0===o?c.move(l,h,!1,p):c.curve(r+d,a,l-d,h,l,h,!1,p),r=l,a=h,o=p):t.fillHoles||(r=l=o=void 0)}return c}},n.Interpolation.cardinal=function(t){function e(e,n){for(var i=[],s=!0,r=0;r<e.length;r+=2)void 0===n[r/2].value?t.fillHoles||(s=!0):(s&&(i.push({pathCoordinates:[],valueData:[]}),s=!1),i[i.length-1].pathCoordinates.push(e[r],e[r+1]),i[i.length-1].valueData.push(n[r/2]));return i}var i={tension:1,fillHoles:!1};t=n.extend({},i,t);var s=Math.min(1,Math.max(0,t.tension)),r=1-s;return function a(t,i){var o=e(t,i);if(o.length){if(o.length>1){var c=[];return o.forEach(function(t){c.push(a(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(c)}if(t=o[0].pathCoordinates,i=o[0].valueData,t.length<=4)return n.Interpolation.none()(t,i);for(var u,l=(new n.Svg.Path).move(t[0],t[1],!1,i[0]),h=0,d=t.length;d-2*!u>h;h+=2){var p=[{x:+t[h-2],y:+t[h-1]},{x:+t[h],y:+t[h+1]},{x:+t[h+2],y:+t[h+3]},{x:+t[h+4],y:+t[h+5]}];u?h?d-4===h?p[3]={x:+t[0],y:+t[1]}:d-2===h&&(p[2]={x:+t[0],y:+t[1]},p[3]={x:+t[2],y:+t[3]}):p[0]={x:+t[d-2],y:+t[d-1]}:d-4===h?p[3]=p[2]:h||(p[0]={x:+t[h],y:+t[h+1]}),l.curve(s*(-p[0].x+6*p[1].x+p[2].x)/6+r*p[2].x,s*(-p[0].y+6*p[1].y+p[2].y)/6+r*p[2].y,s*(p[1].x+6*p[2].x-p[3].x)/6+r*p[2].x,s*(p[1].y+6*p[2].y-p[3].y)/6+r*p[2].y,p[2].x,p[2].y,!1,i[(h+2)/2])}return l}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,i){for(var s,r,a,o=new n.Svg.Path,c=0;c<e.length;c+=2){var u=e[c],l=e[c+1],h=i[c/2];void 0!==h.value?(void 0===a?o.move(u,l,!1,h):(t.postpone?o.line(u,r,!1,a):o.line(s,l,!1,h),o.line(u,l,!1,h)),s=u,r=l,a=h):t.fillHoles||(s=r=a=void 0)}return o}}}(window,document,t),function(t,e,n){"use strict";n.EventEmitter=function(){function t(t,e){i[t]=i[t]||[],i[t].push(e)}function e(t,e){i[t]&&(e?(i[t].splice(i[t].indexOf(e),1),0===i[t].length&&delete i[t]):delete i[t])}function n(t,e){i[t]&&i[t].forEach(function(t){t(e)}),i["*"]&&i["*"].forEach(function(n){n(t,e)})}var i=[];return{addEventHandler:t,removeEventHandler:e,emit:n}}}(window,document,t),function(t,e,n){"use strict";function i(t){var e=[];if(t.length)for(var n=0;n<t.length;n++)e.push(t[n]);return e}function s(t,e){var i=e||this.prototype||n.Class,s=Object.create(i);n.Class.cloneDefinitions(s,t);var r=function(){var t,e=s.constructor||function(){};return t=this===n?Object.create(s):this,e.apply(t,Array.prototype.slice.call(arguments,0)),t};return r.prototype=s,r["super"]=i,r.extend=this.extend,r}function r(){var t=i(arguments),e=t[0];return t.splice(1,t.length-1).forEach(function(t){Object.getOwnPropertyNames(t).forEach(function(n){delete e[n],Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}),e}n.Class={extend:s,cloneDefinitions:r}}(window,document,t),function(t,e,n){"use strict";function i(t,e,i){return t&&(this.data=t,this.eventEmitter.emit("data",{type:"update",data:this.data})),e&&(this.options=n.extend({},i?this.options:this.defaultOptions,e),this.initializeTimeoutId||(this.optionsProvider.removeMediaQueryListeners(),this.optionsProvider=n.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter))),this.initializeTimeoutId||this.createChart(this.optionsProvider.getCurrentOptions()),this}function s(){return this.initializeTimeoutId?t.clearTimeout(this.initializeTimeoutId):(t.removeEventListener("resize",this.resizeListener),this.optionsProvider.removeMediaQueryListeners()),this}function r(t,e){return this.eventEmitter.addEventHandler(t,e),this}function a(t,e){return this.eventEmitter.removeEventHandler(t,e),this}function o(){t.addEventListener("resize",this.resizeListener),this.optionsProvider=n.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.addEventHandler("optionsChanged",function(){this.update()}.bind(this)),this.options.plugins&&this.options.plugins.forEach(function(t){t instanceof Array?t[0](this,t[1]):t(this)}.bind(this)),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=void 0}function c(t,e,i,s,r){this.container=n.querySelector(t),this.data=e,this.defaultOptions=i,this.options=s,this.responsiveOptions=r,this.eventEmitter=n.EventEmitter(),this.supportsForeignObject=n.Svg.isSupported("Extensibility"),this.supportsAnimations=n.Svg.isSupported("AnimationEventsAttribute"),this.resizeListener=function(){this.update()}.bind(this),this.container&&(this.container.__chartist__&&this.container.__chartist__.detach(),this.container.__chartist__=this),this.initializeTimeoutId=setTimeout(o.bind(this),0)}n.Base=n.Class.extend({constructor:c,optionsProvider:void 0,container:void 0,svg:void 0,eventEmitter:void 0,createChart:function(){throw new Error("Base chart type can't be instantiated!")},update:i,detach:s,on:r,off:a,version:n.version,supportsForeignObject:!1})}(window,document,t),function(t,e,n){"use strict";function i(t,i,s,r,a){t instanceof Element?this._node=t:(this._node=e.createElementNS(n.namespaces.svg,t),"svg"===t&&this.attr({"xmlns:ct":n.namespaces.ct})),i&&this.attr(i),s&&this.addClass(s),r&&(a&&r._node.firstChild?r._node.insertBefore(this._node,r._node.firstChild):r._node.appendChild(this._node))}function s(t,e){return"string"==typeof t?e?this._node.getAttributeNS(e,t):this._node.getAttribute(t):(Object.keys(t).forEach(function(e){if(void 0!==t[e])if(-1!==e.indexOf(":")){var i=e.split(":");this._node.setAttributeNS(n.namespaces[i[0]],e,t[e])}else this._node.setAttribute(e,t[e])}.bind(this)),this)}function r(t,e,i,s){return new n.Svg(t,e,i,this,s)}function a(){return this._node.parentNode instanceof SVGElement?new n.Svg(this._node.parentNode):null}function o(){for(var t=this._node;"svg"!==t.nodeName;)t=t.parentNode;return new n.Svg(t)}function c(t){var e=this._node.querySelector(t);return e?new n.Svg(e):null}function u(t){var e=this._node.querySelectorAll(t);return e.length?new n.Svg.List(e):null}function l(t,i,s,r){if("string"==typeof t){var a=e.createElement("div");a.innerHTML=t,t=a.firstChild}t.setAttribute("xmlns",n.namespaces.xmlns);var o=this.elem("foreignObject",i,s,r);return o._node.appendChild(t),o}function h(t){return this._node.appendChild(e.createTextNode(t)),this}function d(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}function p(){return this._node.parentNode.removeChild(this._node),this.parent()}function f(t){return this._node.parentNode.replaceChild(t._node,this._node),t}function m(t,e){return e&&this._node.firstChild?this._node.insertBefore(t._node,this._node.firstChild):this._node.appendChild(t._node),this}function g(){return this._node.getAttribute("class")?this._node.getAttribute("class").trim().split(/\s+/):[]}function v(t){return this._node.setAttribute("class",this.classes(this._node).concat(t.trim().split(/\s+/)).filter(function(t,e,n){return n.indexOf(t)===e}).join(" ")),this}function x(t){var e=t.trim().split(/\s+/);return this._node.setAttribute("class",this.classes(this._node).filter(function(t){return-1===e.indexOf(t)}).join(" ")),this}function y(){return this._node.setAttribute("class",""),this}function w(){return this._node.getBoundingClientRect().height}function b(){return this._node.getBoundingClientRect().width}function E(t,e,i){return void 0===e&&(e=!0),Object.keys(t).forEach(function(s){function r(t,e){var r,a,o,c={};t.easing&&(o=t.easing instanceof Array?t.easing:n.Svg.Easing[t.easing],delete t.easing),t.begin=n.ensureUnit(t.begin,"ms"),t.dur=n.ensureUnit(t.dur,"ms"),o&&(t.calcMode="spline",t.keySplines=o.join(" "),t.keyTimes="0;1"),e&&(t.fill="freeze",c[s]=t.from,this.attr(c),a=n.quantity(t.begin||0).value,t.begin="indefinite"),r=this.elem("animate",n.extend({attributeName:s},t)),e&&setTimeout(function(){try{r._node.beginElement()}catch(e){c[s]=t.to,this.attr(c),r.remove()}}.bind(this),a),i&&r._node.addEventListener("beginEvent",function(){i.emit("animationBegin",{element:this,animate:r._node,params:t})}.bind(this)),r._node.addEventListener("endEvent",function(){i&&i.emit("animationEnd",{element:this,animate:r._node,params:t}),e&&(c[s]=t.to,this.attr(c),r.remove())}.bind(this))}t[s]instanceof Array?t[s].forEach(function(t){r.bind(this)(t,!1)}.bind(this)):r.bind(this)(t[s],e)}.bind(this)),this}function A(t){var e=this;this.svgElements=[];for(var i=0;i<t.length;i++)this.svgElements.push(new n.Svg(t[i]));Object.keys(n.Svg.prototype).filter(function(t){return-1===["constructor","parent","querySelector","querySelectorAll","replace","append","classes","height","width"].indexOf(t)}).forEach(function(t){e[t]=function(){var i=Array.prototype.slice.call(arguments,0);return e.svgElements.forEach(function(e){n.Svg.prototype[t].apply(e,i)}),e}})}n.Svg=n.Class.extend({constructor:i,attr:s,elem:r,parent:a,root:o,querySelector:c,querySelectorAll:u,foreignObject:l,text:h,empty:d,remove:p,replace:f,append:m,classes:g,addClass:v,removeClass:x,removeAllClasses:y,height:w,width:b,animate:E}),n.Svg.isSupported=function(t){return e.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+t,"1.1")};var S={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]};n.Svg.Easing=S,n.Svg.List=n.Class.extend({constructor:A})}(window,document,t),function(t,e,n){"use strict";function i(t,e,i,s,r,a){var o=n.extend({command:r?t.toLowerCase():t.toUpperCase()},e,a?{data:a}:{});i.splice(s,0,o)}function s(t,e){t.forEach(function(n,i){w[n.command.toLowerCase()].forEach(function(s,r){e(n,s,i,r,t)})})}function r(t,e){this.pathElements=[],this.pos=0,this.close=t,this.options=n.extend({},b,e)}function a(t){return void 0!==t?(this.pos=Math.max(0,Math.min(this.pathElements.length,t)),this):this.pos}function o(t){return this.pathElements.splice(this.pos,t),this}function c(t,e,n,s){return i("M",{x:+t,y:+e},this.pathElements,this.pos++,n,s),this}function u(t,e,n,s){return i("L",{x:+t,y:+e},this.pathElements,this.pos++,n,s),this}function l(t,e,n,s,r,a,o,c){return i("C",{x1:+t,y1:+e,x2:+n,y2:+s,x:+r,y:+a},this.pathElements,this.pos++,o,c),this}function h(t,e,n,s,r,a,o,c,u){return i("A",{rx:+t,ry:+e,xAr:+n,lAf:+s,sf:+r,x:+a,y:+o},this.pathElements,this.pos++,c,u),this}function d(t){var e=t.replace(/([A-Za-z])([0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(function(t,e){return e.match(/[A-Za-z]/)&&t.push([]),t[t.length-1].push(e),t},[]);"Z"===e[e.length-1][0].toUpperCase()&&e.pop();var i=e.map(function(t){var e=t.shift(),i=w[e.toLowerCase()];return n.extend({command:e},i.reduce(function(e,n,i){return e[n]=+t[i],e},{}))}),s=[this.pos,0];return Array.prototype.push.apply(s,i),Array.prototype.splice.apply(this.pathElements,s),this.pos+=i.length,this}function p(){var t=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(e,n){var i=w[n.command.toLowerCase()].map(function(e){return this.options.accuracy?Math.round(n[e]*t)/t:n[e]}.bind(this));return e+n.command+i.join(",")}.bind(this),"")+(this.close?"Z":"")}function f(t,e){return s(this.pathElements,function(n,i){n[i]*="x"===i[0]?t:e}),this}function m(t,e){return s(this.pathElements,function(n,i){n[i]+="x"===i[0]?t:e}),this}function g(t){return s(this.pathElements,function(e,n,i,s,r){var a=t(e,n,i,s,r);(a||0===a)&&(e[n]=a)}),this}function v(t){var e=new n.Svg.Path(t||this.close);return e.pos=this.pos,e.pathElements=this.pathElements.slice().map(function(t){return n.extend({},t)}),e.options=n.extend({},this.options),e}function x(t){var e=[new n.Svg.Path];return this.pathElements.forEach(function(i){i.command===t.toUpperCase()&&0!==e[e.length-1].pathElements.length&&e.push(new n.Svg.Path),e[e.length-1].pathElements.push(i)}),e}function y(t,e,i){for(var s=new n.Svg.Path(e,i),r=0;r<t.length;r++)for(var a=t[r],o=0;o<a.pathElements.length;o++)s.pathElements.push(a.pathElements[o]);return s}var w={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},b={accuracy:3};n.Svg.Path=n.Class.extend({constructor:r,position:a,remove:o,move:c,line:u,curve:l,arc:h,scale:f,translate:m,transform:g,parse:d,stringify:p,clone:v,splitByCommand:x}),n.Svg.Path.elementDescriptions=w,n.Svg.Path.join=y}(window,document,t),function(t,e,n){"use strict";function i(t,e,n,i){this.units=t,this.counterUnits=t===r.x?r.y:r.x,this.chartRect=e,this.axisLength=e[t.rectEnd]-e[t.rectStart],this.gridOffset=e[t.rectOffset],this.ticks=n,this.options=i}function s(t,e,i,s,r){var a=s["axis"+this.units.pos.toUpperCase()],o=this.ticks.map(this.projectValue.bind(this)),c=this.ticks.map(a.labelInterpolationFnc);o.forEach(function(o,u){var l={x:0,y:0},h=0;n.isFalseyButZero(c[u])&&""!==c[u]||("x"===this.units.pos?(o=this.chartRect.x1+o,l.x=s.axisX.labelOffset.x,"start"===s.axisX.position?l.y=this.chartRect.padding.top+s.axisX.labelOffset.y+(i?5:20):l.y=this.chartRect.y1+s.axisX.labelOffset.y+(i?5:20)):(o=this.chartRect.y1-o,l.y=s.axisY.labelOffset.y-(i?h:0),"start"===s.axisY.position?l.x=i?this.chartRect.padding.left+s.axisY.labelOffset.x:this.chartRect.x1-10:l.x=this.chartRect.x2+s.axisY.labelOffset.x+10),a.showGrid&&n.createGrid(o,u,this,this.gridOffset,this.chartRect[this.counterUnits.len](),t,[s.classNames.grid,s.classNames[this.units.dir]],r),a.showLabel&&n.createLabel(o,h,u,c,this,a.offset,l,e,[s.classNames.label,s.classNames[this.units.dir],s.classNames[a.position]],i,r))}.bind(this))}var r={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}};n.Axis=n.Class.extend({constructor:i,createGridAndLabels:s,projectValue:function(t,e,n){throw new Error("Base axis can't be instantiated!")}}),n.Axis.units=r}(window,document,t),function(t,e,n){"use strict";function i(t,e,i,s){var r=s.highLow||n.getHighLow(e.normalized,s,t.pos);this.bounds=n.getBounds(i[t.rectEnd]-i[t.rectStart],r,s.scaleMinSpace||20,s.onlyInteger),this.range={min:this.bounds.min,max:this.bounds.max},n.AutoScaleAxis["super"].constructor.call(this,t,i,this.bounds.values,s)}function s(t){return this.axisLength*(+n.getMultiValue(t,this.units.pos)-this.bounds.min)/this.bounds.range}n.AutoScaleAxis=n.Axis.extend({constructor:i,projectValue:s})}(window,document,t),function(t,e,n){"use strict";function i(t,e,i,s){var r=s.highLow||n.getHighLow(e.normalized,s,t.pos);this.divisor=s.divisor||1,this.ticks=s.ticks||n.times(this.divisor).map(function(t,e){return r.low+(r.high-r.low)/this.divisor*e}.bind(this)),this.ticks.sort(function(t,e){return t-e}),this.range={min:r.low,max:r.high},n.FixedScaleAxis["super"].constructor.call(this,t,i,this.ticks,s),
this.stepLength=this.axisLength/this.divisor}function s(t){return this.axisLength*(+n.getMultiValue(t,this.units.pos)-this.range.min)/(this.range.max-this.range.min)}n.FixedScaleAxis=n.Axis.extend({constructor:i,projectValue:s})}(window,document,t),function(t,e,n){"use strict";function i(t,e,i,s){n.StepAxis["super"].constructor.call(this,t,i,s.ticks,s),this.stepLength=this.axisLength/(s.ticks.length-(s.stretch?1:0))}function s(t,e){return this.stepLength*e}n.StepAxis=n.Axis.extend({constructor:i,projectValue:s})}(window,document,t),function(t,e,n){"use strict";function i(t){this.data=n.normalizeData(this.data);var e={raw:this.data,normalized:n.getDataArray(this.data,t.reverseData,!0)};this.svg=n.createSvg(this.container,t.width,t.height,t.classNames.chart);var i,s,a=this.svg.elem("g").addClass(t.classNames.gridGroup),o=this.svg.elem("g"),c=this.svg.elem("g").addClass(t.classNames.labelGroup),u=n.createChartRect(this.svg,t,r.padding);i=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,e,u,n.extend({},t.axisX,{ticks:e.raw.labels,stretch:t.fullWidth})):t.axisX.type.call(n,n.Axis.units.x,e,u,t.axisX),s=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,e,u,n.extend({},t.axisY,{high:n.isNum(t.high)?t.high:t.axisY.high,low:n.isNum(t.low)?t.low:t.axisY.low})):t.axisY.type.call(n,n.Axis.units.y,e,u,t.axisY),i.createGridAndLabels(a,c,this.supportsForeignObject,t,this.eventEmitter),s.createGridAndLabels(a,c,this.supportsForeignObject,t,this.eventEmitter),e.raw.series.forEach(function(r,a){var c=o.elem("g");c.attr({"ct:series-name":r.name,"ct:meta":n.serialize(r.meta)}),c.addClass([t.classNames.series,r.className||t.classNames.series+"-"+n.alphaNumerate(a)].join(" "));var l=[],h=[];e.normalized[a].forEach(function(t,o){var c={x:u.x1+i.projectValue(t,o,e.normalized[a]),y:u.y1-s.projectValue(t,o,e.normalized[a])};l.push(c.x,c.y),h.push({value:t,valueIndex:o,meta:n.getMetaData(r,o)})}.bind(this));var d={lineSmooth:n.getSeriesOption(r,t,"lineSmooth"),showPoint:n.getSeriesOption(r,t,"showPoint"),showLine:n.getSeriesOption(r,t,"showLine"),showArea:n.getSeriesOption(r,t,"showArea"),areaBase:n.getSeriesOption(r,t,"areaBase")},p="function"==typeof d.lineSmooth?d.lineSmooth:d.lineSmooth?n.Interpolation.cardinal():n.Interpolation.none(),f=p(l,h);if(d.showPoint&&f.pathElements.forEach(function(e){var o=c.elem("line",{x1:e.x,y1:e.y,x2:e.x+.01,y2:e.y},t.classNames.point).attr({"ct:value":[e.data.value.x,e.data.value.y].filter(n.isNum).join(","),"ct:meta":e.data.meta});this.eventEmitter.emit("draw",{type:"point",value:e.data.value,index:e.data.valueIndex,meta:e.data.meta,series:r,seriesIndex:a,axisX:i,axisY:s,group:c,element:o,x:e.x,y:e.y})}.bind(this)),d.showLine){var m=c.elem("path",{d:f.stringify()},t.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:e.normalized[a],path:f.clone(),chartRect:u,index:a,series:r,seriesIndex:a,axisX:i,axisY:s,group:c,element:m})}if(d.showArea&&s.range){var g=Math.max(Math.min(d.areaBase,s.range.max),s.range.min),v=u.y1-s.projectValue(g);f.splitByCommand("M").filter(function(t){return t.pathElements.length>1}).map(function(t){var e=t.pathElements[0],n=t.pathElements[t.pathElements.length-1];return t.clone(!0).position(0).remove(1).move(e.x,v).line(e.x,e.y).position(t.pathElements.length+1).line(n.x,v)}).forEach(function(n){var o=c.elem("path",{d:n.stringify()},t.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:e.normalized[a],path:n.clone(),series:r,seriesIndex:a,axisX:i,axisY:s,chartRect:u,index:a,group:c,element:o})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:s.bounds,chartRect:u,axisX:i,axisY:s,svg:this.svg,options:t})}function s(t,e,i,s){n.Line["super"].constructor.call(this,t,e,r,n.extend({},r,i),s)}var r={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};n.Line=n.Base.extend({constructor:s,createChart:i})}(window,document,t),function(t,e,n){"use strict";function i(t){this.data=n.normalizeData(this.data);var e,i={raw:this.data,normalized:t.distributeSeries?n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y").map(function(t){return[t]}):n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y")};this.svg=n.createSvg(this.container,t.width,t.height,t.classNames.chart+(t.horizontalBars?" "+t.classNames.horizontalBars:""));var s=this.svg.elem("g").addClass(t.classNames.gridGroup),a=this.svg.elem("g"),o=this.svg.elem("g").addClass(t.classNames.labelGroup);if(t.stackBars&&0!==i.normalized.length){var c=n.serialMap(i.normalized,function(){return Array.prototype.slice.call(arguments).map(function(t){return t}).reduce(function(t,e){return{x:t.x+(e&&e.x)||0,y:t.y+(e&&e.y)||0}},{x:0,y:0})});e=n.getHighLow([c],n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y")}else e=n.getHighLow(i.normalized,n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y");e.high=+t.high||(0===t.high?0:e.high),e.low=+t.low||(0===t.low?0:e.low);var u,l,h,d,p,f=n.createChartRect(this.svg,t,r.padding);l=t.distributeSeries&&t.stackBars?i.raw.labels.slice(0,1):i.raw.labels,t.horizontalBars?(u=d=void 0===t.axisX.type?new n.AutoScaleAxis(n.Axis.units.x,i,f,n.extend({},t.axisX,{highLow:e,referenceValue:0})):t.axisX.type.call(n,n.Axis.units.x,i,f,n.extend({},t.axisX,{highLow:e,referenceValue:0})),h=p=void 0===t.axisY.type?new n.StepAxis(n.Axis.units.y,i,f,{ticks:l}):t.axisY.type.call(n,n.Axis.units.y,i,f,t.axisY)):(h=d=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,i,f,{ticks:l}):t.axisX.type.call(n,n.Axis.units.x,i,f,t.axisX),u=p=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,i,f,n.extend({},t.axisY,{highLow:e,referenceValue:0})):t.axisY.type.call(n,n.Axis.units.y,i,f,n.extend({},t.axisY,{highLow:e,referenceValue:0})));var m=t.horizontalBars?f.x1+u.projectValue(0):f.y1-u.projectValue(0),g=[];h.createGridAndLabels(s,o,this.supportsForeignObject,t,this.eventEmitter),u.createGridAndLabels(s,o,this.supportsForeignObject,t,this.eventEmitter),i.raw.series.forEach(function(e,s){var r,o,c=s-(i.raw.series.length-1)/2;r=t.distributeSeries&&!t.stackBars?h.axisLength/i.normalized.length/2:t.distributeSeries&&t.stackBars?h.axisLength/2:h.axisLength/i.normalized[s].length/2,o=a.elem("g"),o.attr({"ct:series-name":e.name,"ct:meta":n.serialize(e.meta)}),o.addClass([t.classNames.series,e.className||t.classNames.series+"-"+n.alphaNumerate(s)].join(" ")),i.normalized[s].forEach(function(a,l){var v,x,y,w;if(w=t.distributeSeries&&!t.stackBars?s:t.distributeSeries&&t.stackBars?0:l,v=t.horizontalBars?{x:f.x1+u.projectValue(a&&a.x?a.x:0,l,i.normalized[s]),y:f.y1-h.projectValue(a&&a.y?a.y:0,w,i.normalized[s])}:{x:f.x1+h.projectValue(a&&a.x?a.x:0,w,i.normalized[s]),y:f.y1-u.projectValue(a&&a.y?a.y:0,l,i.normalized[s])},h instanceof n.StepAxis&&(h.options.stretch||(v[h.units.pos]+=r*(t.horizontalBars?-1:1)),v[h.units.pos]+=t.stackBars||t.distributeSeries?0:c*t.seriesBarDistance*(t.horizontalBars?-1:1)),y=g[l]||m,g[l]=y-(m-v[h.counterUnits.pos]),void 0!==a){var b={};b[h.units.pos+"1"]=v[h.units.pos],b[h.units.pos+"2"]=v[h.units.pos],!t.stackBars||"accumulate"!==t.stackMode&&t.stackMode?(b[h.counterUnits.pos+"1"]=m,b[h.counterUnits.pos+"2"]=v[h.counterUnits.pos]):(b[h.counterUnits.pos+"1"]=y,b[h.counterUnits.pos+"2"]=g[l]),b.x1=Math.min(Math.max(b.x1,f.x1),f.x2),b.x2=Math.min(Math.max(b.x2,f.x1),f.x2),b.y1=Math.min(Math.max(b.y1,f.y2),f.y1),b.y2=Math.min(Math.max(b.y2,f.y2),f.y1),x=o.elem("line",b,t.classNames.bar).attr({"ct:value":[a.x,a.y].filter(n.isNum).join(","),"ct:meta":n.getMetaData(e,l)}),this.eventEmitter.emit("draw",n.extend({type:"bar",value:a,index:l,meta:n.getMetaData(e,l),series:e,seriesIndex:s,axisX:d,axisY:p,chartRect:f,group:o,element:x},b))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:u.bounds,chartRect:f,axisX:d,axisY:p,svg:this.svg,options:t})}function s(t,e,i,s){n.Bar["super"].constructor.call(this,t,e,r,n.extend({},r,i),s)}var r={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};n.Bar=n.Base.extend({constructor:s,createChart:i})}(window,document,t),t}),function(t,e){t["Chartist.plugins.ctAxisTitle"]=e()}(this,function(){return function(t,e,n){"use strict";var i={axisTitle:"",axisClass:"ct-axis-title",offset:{x:0,y:0},textAnchor:"middle",flipText:!1},s={axisX:i,axisY:i};n.plugins=n.plugins||{},n.plugins.ctAxisTitle=function(t){return t=n.extend({},s,t),console.log(t),function(e){e.on("created",function(e){var i,s,r;if(t.axisX.axisTitle&&e.axisX&&(i=e.axisX.axisLength/2+e.options.axisY.offset+e.options.chartPadding.left,s=e.options.chartPadding.top,"end"===e.options.axisY.position&&(i-=e.options.axisY.offset),"end"===e.options.axisX.position&&(s+=e.axisY.axisLength),r=new n.Svg("text"),r.addClass(t.axisX.axisClass),r.text(t.axisX.axisTitle),r.attr({x:i+t.axisX.offset.x,y:s+t.axisX.offset.y,"text-anchor":t.axisX.textAnchor}),e.svg.append(r,!0)),t.axisY.axisTitle&&e.axisY){i=0,s=e.axisY.axisLength/2+e.options.chartPadding.top,"start"===e.options.axisX.position&&(s+=e.options.axisX.offset),"end"===e.options.axisY.position&&(i=e.axisX.axisLength);var a="rotate("+(t.axisY.flipText?-90:90)+", "+i+", "+s+")";r=new n.Svg("text"),r.addClass(t.axisY.axisClass),r.text(t.axisY.axisTitle),r.attr({x:i+t.axisY.offset.x,y:s+t.axisY.offset.y,transform:a,"text-anchor":t.axisY.textAnchor}),e.svg.append(r,!0)}})}}}(window,document,Chartist),Chartist.plugins.ctAxisTitle}),function(t,e){t["Chartist.plugins.zoom"]=e()}(this,function(){return function(t,e,n){"use strict";function i(t){t.attr({style:"display:none"})}function s(t){t.attr({style:"display:block"})}function r(t,e){var n=t.x,i=t.y,s=e.x-n,r=e.y-i;return 0>s&&(s=-s,n=e.x),0>r&&(r=-r,i=e.y),{x:n,y:i,width:s,height:r}}function a(t,e){return o(t.clientX,t.clientY,e)}function o(t,e,n){var i="svg"===n.tagName?n:n.ownerSVGElement,s=i.getScreenCTM(),r=i.createSVGPoint();return r.x=t,r.y=e,r=r.matrixTransform(s.inverse()),r||{x:0,y:0}}function c(t,e){var n=e.bounds.max,i=e.bounds.min;if(e.scale&&"log"===e.scale.type){var s=e.scale.base;return Math.pow(s,t*u(n/i,s)/e.axisLength)*i}return t*e.bounds.range/e.axisLength+i}function u(t,e){return Math.log(t)/Math.log(e)}var l={};n.plugins=n.plugins||{},n.plugins.zoom=function(t){return t=n.extend({},l,t),function(e){function o(t){var e=a(t,w);return e.id=t.identifier,e}function u(t){for(var e=0;e<O.length;e++){var n=O[e].id;if(n===t)return e}return-1}function l(t){for(var e=t.changedTouches,n=0;n<e.length;n++)O.push(o(e[n]));O.length>1&&(y.attr(r(O[0],O[1])),s(y))}function h(t){for(var e=t.changedTouches,n=0;n<e.length;n++){var i=u(e[n].identifier);O.splice(i,1,o(e[n]))}O.length>1&&(y.attr(r(O[0],O[1])),s(y),t.preventDefault())}function d(t){p(t.changedTouches)}function p(t){for(var e=0;e<t.length;e++){var n=u(t[e].identifier);n>=0&&O.splice(n,1)}}function f(t){O.length>1&&v(r(O[0],O[1])),p(t.changedTouches),i(y)}function m(t){0===t.button&&(S=a(t,w),y.attr(r(S,S)),s(y),t.preventDefault())}function g(e){if(0===e.button){var n=r(S,a(e,w));v(n),S=null,i(y),e.preventDefault()}else t.resetOnRightMouseBtn&&2===e.button&&(M(),e.preventDefault())}function v(t){if(t.width>5&&t.height>5){var n=t.x-A.x1,i=n+t.width,s=A.y1-t.y,r=s-t.height;e.options.axisX.highLow={low:c(n,b),high:c(i,b)},e.options.axisY.highLow={low:c(r,E),high:c(s,E)},e.update(e.data,e.options),C&&C(e,M)}}function x(t){if(S){var e=a(t,w);y.attr(r(S,e)),t.preventDefault()}}if(e instanceof n.Line){var y,w,b,E,A,S,C=t.onZoom,O=[];e.on("draw",function(t){var e=t.type;"line"!==e&&"bar"!==e&&"area"!==e&&"point"!==e||t.element.attr({"clip-path":"url(#zoom-mask)"})}),e.on("created",function(t){b=t.axisX,E=t.axisY,A=t.chartRect,w=t.svg._node,y=t.svg.elem("rect",{x:10,y:10,width:100,height:100},"ct-zoom-rect"),i(y);var e=t.svg.querySelector("defs")||t.svg.elem("defs"),n=A.width(),s=A.height();e.elem("clipPath",{id:"zoom-mask"}).elem("rect",{x:A.x1,y:A.y2,width:n,height:s,fill:"white"}),w.addEventListener("mousedown",m),w.addEventListener("mouseup",g),w.addEventListener("mousemove",x),w.addEventListener("touchstart",l),w.addEventListener("touchmove",h),w.addEventListener("touchend",f),w.addEventListener("touchcancel",d)});var M=function(){e.options.axisX.highLow=null,e.options.axisY.highLow=null,e.update(e.data,e.options)}}}}}(window,document,Chartist),Chartist.plugins.zoom}),String.prototype.format=function(){var t=this,e=arguments;1==arguments.length&&(isArray(arguments[0])||isObject(arguments[0]))&&(e=arguments[0]);for(var n in e)if(e.hasOwnProperty(n)){var i=n;n.match(/^\{.*\}$/)||(n="{"+n+"}");var s=new RegExp(regexEscape(n),"g");t=t.replace(s,e[i])}return t};var modal=function(){var t={};return t.show=function(t){var e=$(t);e.removeClass("hidden visible"),setTimeout(function(){e.addClass("visible")},1)},t.hide=function(t){var e=$(t);e.removeClass("visible"),setTimeout(function(){e.addClass("hidden")},500)},t.init=function(){$(".Modal").on("click",function(){t.hide(this)}),$(".Dialog").on("click",function(t){t.stopImmediatePropagation()}),$(window).on("keydown",function(e){27==e.which&&t.hide(".Modal")})},t}();$().ready(function(){setInterval(function(){$(".anim-dots").each(function(t){var e=$(t),n=e.html()+".";5==n.length&&(n="."),e.html(n)})},1e3),modal.init()});var page_wifi=function(){function t(t,n){if(200!=n)return void i(5e3);t=JSON.parse(t);var a=!bool(t.result.inProgress)&&t.result.APs.length>0;if(i(a?15e3:1e3),a){var o=$("#ap-list");$(".AP").remove(),o.toggle(a),$("#ap-loader").toggle(!a),t.result.APs.sort(function(t,e){return e.rssi-t.rssi}).forEach(function(t){if(t.enc=parseInt(t.enc),!(t.enc>4)){var n=document.createElement("div"),i=$(n).data("ssid",t.essid).data("pwd",0!=t.enc).addClass("AP");t.essid==s.current&&i.addClass("selected");var a=document.createElement("div");$(a).addClass("inner").htmlAppend('<div class="rssi">{0}</div>'.format(rssiPerc(t.rssi))).htmlAppend('<div class="essid" title="{0}">{0}</div>'.format(e(t.essid))).htmlAppend('<div class="auth">{0}</div>'.format(r[t.enc]));i.on("click",function(){var t=$(this);$("#conn-essid").val(t.data("ssid")),$("#conn-passwd").val(""),t.data("pwd")?modal.show("#psk-modal"):$("#conn-form").submit()}),n.appendChild(a),o[0].appendChild(n)}})}}function n(){$().get("/wifi/scan.cgi",t,!0,!0)}function i(t){setTimeout(n,t)}var s={},r=["Open","WEP","WPA","WPA2","WPA/WPA2"];return s.init=function(){n()},s}(),page_waveform=function(){function t(t,e,n){var i=[];t.forEach(function(t,e){i.push({x:e,y:t})});var s=[],r=window.matchMedia("screen and (min-width: 544px)"),a=!r.matches;a||s.push(Chartist.plugins.ctAxisTitle({axisX:{axisTitle:e,offset:{x:0,y:55}},axisY:{axisTitle:n,flipText:!0,offset:{x:0,y:15}}})),new Chartist.Line("#chart",{series:[{name:"a",data:i}]},{showPoint:!1,fullWidth:!0,chartPadding:a?{right:20,bottom:5,left:0}:{right:25,bottom:30,left:25},series:{a:{lineSmooth:Chartist.Interpolation.none()}},axisX:{type:Chartist.AutoScaleAxis,onlyInteger:!0},axisY:{type:Chartist.AutoScaleAxis},plugins:s})}function e(e,n){if(200!=n)return void alert("Request failed.");var i=JSON.parse(e);return i.success?void t(i.samples,"Sample Nr.","ADC value"):void alert("Sampling failed.")}var n={};return n.init=function(){function t(){var t=$("#count").val();$().get("/api/raw.json?n="+t,e,!0,!0)}$("#load").on("click",t),$("#count").on("keyup",function(e){13==e.which&&t()})},n}(),page_status=function(){function t(t,n){if(200!=n)console.error("Update failed.");else try{var i=JSON.parse(t);$(".sta-only").toggle(i.sta),$(".ap-only").toggle(i.ap),$("#uptime").html(i.uptime),$("#heap").html(i.heap+" bytes"),$("#wmode").html(i.wifiMode),i.sta&&($("#staSSID").html(i.sta.SSID),$("#staRSSIperc").html(i.sta.RSSIperc),$("#staRSSI").html(i.sta.RSSI),$("#staMAC").html(i.sta.MAC)),i.ap&&($("#apSSID").html(i.ap.SSID),$("#apHidden").html(i.ap.hidden?"Yes":"No"),$("#apAuth").html(i.ap.auth),$(".ap-auth-only").toggle("Open"!=i.ap.auth),$("#apPwd").html(i.ap.pwd),$("#apChan").html(i.ap.chan),$("#apMAC").html(i.ap.MAC))}catch(s){console.error(s)}setTimeout(e,1e4)}function e(){$().get("/api/status.json",t,!0,!0)}var n={};return n.init=function(){e(),setTimeout(e,1e4)},n}();