From d62390721511009d0bb609dd49ec3ad81b6a70b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 2 Apr 2016 03:09:56 +0200 Subject: [PATCH] compiled web & added missing routes --- _web-build_do.sh | 1 + html/js/all.js | 2 +- html/pages/sgm.html | 73 ++++++++++++++++++++++++++++++++++++ html_src/js-src/lib/chibi.js | 2 +- html_src/js/all.js | 2 +- user/routes.c | 1 + 6 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 html/pages/sgm.html diff --git a/_web-build_do.sh b/_web-build_do.sh index 2f2eabe..ee2bb5d 100755 --- a/_web-build_do.sh +++ b/_web-build_do.sh @@ -28,3 +28,4 @@ php "$SRCDIR/page_about.php" > "$BLDDIR/pages/about.tpl" php "$SRCDIR/page_wifi.php" > "$BLDDIR/pages/wifi.tpl" php "$SRCDIR/page_waveform.php" > "$BLDDIR/pages/wfm.html" # no substitutions, .html allows to gzip it. php "$SRCDIR/page_fft.php" > "$BLDDIR/pages/fft.html" # same +php "$SRCDIR/page_spectrogram.php" > "$BLDDIR/pages/sgm.html" # same \ No newline at end of file diff --git a/html/js/all.js b/html/js/all.js index b957a88..9d0c0f7 100644 --- a/html/js/all.js +++ b/html/js/all.js @@ -1,3 +1,3 @@ -function bool(t){return 1===t||"1"===t||t===!0||"true"===t}function numfmt(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}function estimateLoadTime(t,e){return 1e3/t*e+1500}function msNow(){return+new Date}function msElapsed(t){return msNow()-t}function errorMsg(t,e){notify.show(t,e||3e3)}!function(){"use strict";function t(){var t;for(p=!0,t=0;t=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return t.currentStyle?t.currentStyle[r(e)]:v.getComputedStyle?v.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function s(t,e,n){try{t.style[r(e)]=n}catch(i){}}function o(t){t.style.display="","none"===i(t,"display")&&(t.style.display="block")}function u(t){var e,r,i,s="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r0&&(s+="&"+a(e.name,e.value));break;case"select-multiple":for(i=0;i0?s.substring(1):""}function c(t,e,r){var i,a,s,o=!1;return t&&(i=t.split(/\s+/),n(function(t){for(s=0;s0?y[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},y),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},y),e},e.removeClass=function(t){return c(t,"remove",y),e},e.toggleClass=function(t){return c(t,"toggle",y),e},e.hasClass=function(t){return c(t,"has",y)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},y),e):y[0]?y[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",y),e},e.htmlAfter=function(t){return l(t,"after",y),e},e.htmlAppend=function(t){return l(t,"append",y),e},e.htmlPrepend=function(t){return l(t,"prepend",y),e},e.attr=function(t,r){if(t){if(t=t.toLowerCase(),"undefined"!=typeof r)return n(function(e){"style"===t?e.style.cssText=r:"class"===t?e.className=r:e.setAttribute(t,r)},y),e;if(y[0])if("style"===t){if(y[0].style.cssText)return y[0].style.cssText}else if("class"===t){if(y[0].className)return y[0].className}else if(y[0].getAttribute(t))return y[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var r,i,a;if(!_.isUndefined(t))return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),i=0;i1?r:r[0];case"INPUT":case"TEXTAREA":case"BUTTON":return y[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)},y),e):!y[0]||"INPUT"!==y[0].nodeName||"checkbox"!==y[0].type&&"radio"!==y[0].type?void 0:!!y[0].checked},e.on=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.addEventListener(r,i,!1):g.attachEvent&&(t[r+i]=function(){return i.apply(t,arguments)},t.attachEvent("on"+r,t[r+i]))},y),e},e.off=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.removeEventListener(r,i,!1):g.attachEvent&&(t.detachEvent("on"+r,t[r+i]),t[r+i]=null)},y),e},e.ajax=function(t,e,n,r){var i,a,s=u(y),o=e?e.toUpperCase():"GET";_.isNumber(r)&&(r={timeout:r});var c=Chartist.extend({},{nocache:!0,timeout:5e3,loader:!0},r);if(s&&"GET"===o&&(t+=-1===t.indexOf("?")?"?"+s:"&"+s,s=null),i=new XMLHttpRequest){if(c.nocache){var l=(+ +new Date).toString(36);t+=(-1===t.indexOf("?")?"?":"&")+"_="+l}c.loader&&$("#loader").addClass("show"),i.open(o,t,!0),i.timeout=c.timeout,a=setTimeout(function(){errorMsg("XHR timed out."),i.abort(),c.loader&&$("#loader").removeClass("show")},c.timeout+10),i.onreadystatechange=function(){4===i.readyState&&(c.loader&&$("#loader").removeClass("show"),n&&0!=i.status&&n(i.responseText,i.status),clearTimeout(a))},i.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===o&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(s)}return i},e.get=function(t,n,r){return e.ajax(t,"get",n,r)},e.post=function(t,n,r){return e.ajax(t,"post",n,r)},e}var f=[],d=[],p=!1,m=!1,g=document,v=window;g.addEventListener?(g.addEventListener("DOMContentLoaded",t,!1),v.addEventListener("load",e,!1)):g.attachEvent?(g.attachEvent("onreadystatechange",t),v.attachEvent("onload",e)):v.onload=e,v.$=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 r in e)"object"!=typeof e[r]||null===e[r]||e[r]instanceof Array?t[r]=e[r]:t[r]=n.extend({},t[r],e[r])}),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 r=[],i=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(i).forEach(function(n,i){var a=t.map(function(t){return t[i]});r[i]=e.apply(null,a)}),r},n.roundWithPrecision=function(t,e){var r=Math.pow(10,e||n.precision);return Math.round(t*r)/r},n.precision=8,n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),_.escape(t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=_.unescape(t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,r,i){var a;return e=e||"100%",r=r||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),a=new n.Svg("svg").attr({width:e,height:r}).addClass(i).attr({style:"width: "+e+"; height: "+r+";"}),t.appendChild(a._node),a},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,r=n.getDataArray(t);e=r.every(function(t){return t instanceof Array})?Math.max.apply(null,r.map(function(t){return t.length})):r.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;ea.high&&(a.high=n),o&&n0?a.low=0:(a.high=1,a.low=0)),a},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 r,i=2,a=2;if(t%2===0)return 2;do i=n(i)%t,a=n(n(a))%t,r=e(Math.abs(i-a),t);while(1===r);return r},n.getBounds=function(t,e,r,i){var a,s,o,u=0,c={high:e.high,low:e.low};c.valueRange=c.high-c.low,c.oom=n.orderOfMagnitude(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);var l=n.projectLength(t,c.step,c),h=r>l,f=i?n.rho(c.range):0;if(i&&n.projectLength(t,1,c)>=r)c.step=1;else if(i&&f=r)c.step=f;else for(;;){if(h&&n.projectLength(t,c.step,c)<=r)c.step*=2;else{if(h||!(n.projectLength(t,c.step/2,c)>=r))break;if(c.step/=2,i&&c.step%1!==0){c.step*=2;break}}if(u++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(s=c.min,o=c.max;s+c.step<=c.low;)s+=c.step;for(;o-c.step>=c.high;)o-=c.step;for(c.min=s,c.max=o,c.range=c.max-c.min,c.values=[],a=c.min;a<=c.max;a+=c.step)c.values.push(n.roundWithPrecision(a));return c},n.createChartRect=function(t,e,r){var i=!(!e.axisX&&!e.axisY),a=i?e.axisY.offset:0,s=i?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,u=t.height()||n.quantity(e.height).value||0,c=n.normalizePadding(e.chartPadding,r);o=Math.max(o,a+c.left+c.right),u=Math.max(u,s+c.top+c.bottom);var l={padding:c,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===e.axisX.position?(l.y2=c.top+s,l.y1=Math.max(u-c.bottom,l.y2+1)):(l.y2=c.top,l.y1=Math.max(u-c.bottom-s,l.y2+1)),"start"===e.axisY.position?(l.x1=c.left+a,l.x2=Math.max(o-c.right,l.x1+1)):(l.x1=c.left,l.x2=Math.max(o-c.right-a,l.x1+1))):(l.x1=c.left,l.x2=Math.max(o-c.right,l.x1+1),l.y2=c.top,l.y1=Math.max(u-c.bottom,l.y2+1)),l},n.createGrid=function(t,e,r,i,a,s,o,u){var c={};c[r.units.pos+"1"]=Math.round(t)+.5,c[r.units.pos+"2"]=Math.round(t)+.5,c[r.counterUnits.pos+"1"]=i,c[r.counterUnits.pos+"2"]=i+a;var l=s.elem("line",c,o.join(" "));u.emit("draw",n.extend({type:"grid",axis:r,index:e,group:s,element:l},c))},n.createLabel=function(t,e,r,i,a,s,o,u,c,l,h){var f,d={};d[a.units.pos]=t+o[a.units.pos],d[a.counterUnits.pos]=o[a.counterUnits.pos],d[a.units.len]=e,d[a.counterUnits.len]=s-10;var p=i[r];if(_.isNumber(p)&&(p=n.roundWithPrecision(p,2)),l){var m=''+p+"";f=u.foreignObject(m,n.extend({style:"overflow: visible;"},d))}else f=u.elem("text",d,c.join(" ")).text(p);h.emit("draw",n.extend({type:"label",axis:a,index:r,group:u,element:f,text:p},d))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var r=e.series[t.name];return r.hasOwnProperty(n)?r[n]:e[n]}return e[n]},n.optionsProvider=function(e,r,i){function a(e){var a=o;if(o=n.extend({},c),r)for(u=0;u=2&&e[a]<=e[a-2]?i=!0:(i&&(r.push({pathCoordinates:[],valueData:[]}),i=!1),r[r.length-1].pathCoordinates.push(e[a],e[a+1]),r[r.length-1].valueData.push(n[a/2]));return r}var r={fillHoles:!1};return t=n.extend({},r,t),function i(t,r){var a=e(t,r);if(a.length){if(a.length>1){var s=[];return a.forEach(function(t){s.push(i(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(s)}if(t=a[0].pathCoordinates,r=a[0].valueData,t.length<=4)return n.Interpolation.none()(t,r);var o,u,c=[],l=[],h=t.length/2,f=[],d=[],p=[],m=[];for(o=0;h>o;o++)c[o]=t[2*o],l[o]=t[2*o+1];for(o=0;h-1>o;o++)p[o]=l[o+1]-l[o],m[o]=c[o+1]-c[o],d[o]=p[o]/m[o];for(f[0]=d[0],f[h-1]=d[h-2],o=1;h-1>o;o++)0===d[o]||0===d[o-1]||d[o-1]>0!=d[o]>0?f[o]=0:(f[o]=3*(m[o-1]+m[o])/((2*m[o]+m[o-1])/d[o-1]+(m[o]+2*m[o-1])/d[o]),isFinite(f[o])||(f[o]=0));for(u=(new n.Svg.Path).move(c[0],l[0],!1,r[0]),o=0;h-1>o;o++)u.curve(c[o]+m[o]/3,l[o]+f[o]*m[o]/3,c[o+1]-m[o]/3,l[o+1]-f[o+1]*m[o]/3,c[o+1],l[o+1],!1,r[o+1]);return u}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,r){for(var i,a,s,o=new n.Svg.Path,u=0;u=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return t.currentStyle?t.currentStyle[r(e)]:v.getComputedStyle?v.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function s(t,e,n){try{t.style[r(e)]=n}catch(i){}}function o(t){t.style.display="","none"===i(t,"display")&&(t.style.display="block")}function u(t){var e,r,i,s="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r0&&(s+="&"+a(e.name,e.value));break;case"select-multiple":for(i=0;i0?s.substring(1):""}function c(t,e,r){var i,a,s,o=!1;return t&&(i=t.split(/\s+/),n(function(t){for(s=0;s0?y[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},y),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},y),e},e.removeClass=function(t){return c(t,"remove",y),e},e.toggleClass=function(t){return c(t,"toggle",y),e},e.hasClass=function(t){return c(t,"has",y)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},y),e):y[0]?y[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",y),e},e.htmlAfter=function(t){return l(t,"after",y),e},e.htmlAppend=function(t){return l(t,"append",y),e},e.htmlPrepend=function(t){return l(t,"prepend",y),e},e.attr=function(t,r){if(t){if(t=t.toLowerCase(),"undefined"!=typeof r)return n(function(e){"style"===t?e.style.cssText=r:"class"===t?e.className=r:e.setAttribute(t,r)},y),e;if(y[0])if("style"===t){if(y[0].style.cssText)return y[0].style.cssText}else if("class"===t){if(y[0].className)return y[0].className}else if(y[0].getAttribute(t))return y[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var r,i,a;if(!_.isUndefined(t))return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),i=0;i1?r:r[0];case"INPUT":case"TEXTAREA":case"BUTTON":return y[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)},y),e):!y[0]||"INPUT"!==y[0].nodeName||"checkbox"!==y[0].type&&"radio"!==y[0].type?void 0:!!y[0].checked},e.on=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.addEventListener(r,i,!1):g.attachEvent&&(t[r+i]=function(){return i.apply(t,arguments)},t.attachEvent("on"+r,t[r+i]))},y),e},e.off=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.removeEventListener(r,i,!1):g.attachEvent&&(t.detachEvent("on"+r,t[r+i]),t[r+i]=null)},y),e},e.ajax=function(t,e,n,r){var i,a,s=u(y),o=e?e.toUpperCase():"GET";_.isNumber(r)&&(r={timeout:r});var c=Chartist.extend({},{nocache:!0,timeout:5e3,loader:!0},r);if(s&&"GET"===o&&(t+=-1===t.indexOf("?")?"?"+s:"&"+s,s=null),i=new XMLHttpRequest){if(c.nocache){var l=(+new Date).toString(36);t+=(-1===t.indexOf("?")?"?":"&")+"_="+l}c.loader&&$("#loader").addClass("show"),i.open(o,t,!0),i.timeout=c.timeout,a=setTimeout(function(){errorMsg("XHR timed out."),i.abort(),c.loader&&$("#loader").removeClass("show")},c.timeout+10),i.onreadystatechange=function(){4===i.readyState&&(c.loader&&$("#loader").removeClass("show"),n&&0!=i.status&&n(i.responseText,i.status),clearTimeout(a))},i.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===o&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(s)}return i},e.get=function(t,n,r){return e.ajax(t,"get",n,r)},e.post=function(t,n,r){return e.ajax(t,"post",n,r)},e}var f=[],d=[],p=!1,m=!1,g=document,v=window;g.addEventListener?(g.addEventListener("DOMContentLoaded",t,!1),v.addEventListener("load",e,!1)):g.attachEvent?(g.attachEvent("onreadystatechange",t),v.attachEvent("onload",e)):v.onload=e,v.$=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 r in e)"object"!=typeof e[r]||null===e[r]||e[r]instanceof Array?t[r]=e[r]:t[r]=n.extend({},t[r],e[r])}),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 r=[],i=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(i).forEach(function(n,i){var a=t.map(function(t){return t[i]});r[i]=e.apply(null,a)}),r},n.roundWithPrecision=function(t,e){var r=Math.pow(10,e||n.precision);return Math.round(t*r)/r},n.precision=8,n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),_.escape(t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=_.unescape(t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,r,i){var a;return e=e||"100%",r=r||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),a=new n.Svg("svg").attr({width:e,height:r}).addClass(i).attr({style:"width: "+e+"; height: "+r+";"}),t.appendChild(a._node),a},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,r=n.getDataArray(t);e=r.every(function(t){return t instanceof Array})?Math.max.apply(null,r.map(function(t){return t.length})):r.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;ea.high&&(a.high=n),o&&n0?a.low=0:(a.high=1,a.low=0)),a},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 r,i=2,a=2;if(t%2===0)return 2;do i=n(i)%t,a=n(n(a))%t,r=e(Math.abs(i-a),t);while(1===r);return r},n.getBounds=function(t,e,r,i){var a,s,o,u=0,c={high:e.high,low:e.low};c.valueRange=c.high-c.low,c.oom=n.orderOfMagnitude(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);var l=n.projectLength(t,c.step,c),h=r>l,f=i?n.rho(c.range):0;if(i&&n.projectLength(t,1,c)>=r)c.step=1;else if(i&&f=r)c.step=f;else for(;;){if(h&&n.projectLength(t,c.step,c)<=r)c.step*=2;else{if(h||!(n.projectLength(t,c.step/2,c)>=r))break;if(c.step/=2,i&&c.step%1!==0){c.step*=2;break}}if(u++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(s=c.min,o=c.max;s+c.step<=c.low;)s+=c.step;for(;o-c.step>=c.high;)o-=c.step;for(c.min=s,c.max=o,c.range=c.max-c.min,c.values=[],a=c.min;a<=c.max;a+=c.step)c.values.push(n.roundWithPrecision(a));return c},n.createChartRect=function(t,e,r){var i=!(!e.axisX&&!e.axisY),a=i?e.axisY.offset:0,s=i?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,u=t.height()||n.quantity(e.height).value||0,c=n.normalizePadding(e.chartPadding,r);o=Math.max(o,a+c.left+c.right),u=Math.max(u,s+c.top+c.bottom);var l={padding:c,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===e.axisX.position?(l.y2=c.top+s,l.y1=Math.max(u-c.bottom,l.y2+1)):(l.y2=c.top,l.y1=Math.max(u-c.bottom-s,l.y2+1)),"start"===e.axisY.position?(l.x1=c.left+a,l.x2=Math.max(o-c.right,l.x1+1)):(l.x1=c.left,l.x2=Math.max(o-c.right-a,l.x1+1))):(l.x1=c.left,l.x2=Math.max(o-c.right,l.x1+1),l.y2=c.top,l.y1=Math.max(u-c.bottom,l.y2+1)),l},n.createGrid=function(t,e,r,i,a,s,o,u){var c={};c[r.units.pos+"1"]=Math.round(t)+.5,c[r.units.pos+"2"]=Math.round(t)+.5,c[r.counterUnits.pos+"1"]=i,c[r.counterUnits.pos+"2"]=i+a;var l=s.elem("line",c,o.join(" "));u.emit("draw",n.extend({type:"grid",axis:r,index:e,group:s,element:l},c))},n.createLabel=function(t,e,r,i,a,s,o,u,c,l,h){var f,d={};d[a.units.pos]=t+o[a.units.pos],d[a.counterUnits.pos]=o[a.counterUnits.pos],d[a.units.len]=e,d[a.counterUnits.len]=s-10;var p=i[r];if(_.isNumber(p)&&(p=n.roundWithPrecision(p,2)),l){var m=''+p+"";f=u.foreignObject(m,n.extend({style:"overflow: visible;"},d))}else f=u.elem("text",d,c.join(" ")).text(p);h.emit("draw",n.extend({type:"label",axis:a,index:r,group:u,element:f,text:p},d))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var r=e.series[t.name];return r.hasOwnProperty(n)?r[n]:e[n]}return e[n]},n.optionsProvider=function(e,r,i){function a(e){var a=o;if(o=n.extend({},c),r)for(u=0;u=2&&e[a]<=e[a-2]?i=!0:(i&&(r.push({pathCoordinates:[],valueData:[]}),i=!1),r[r.length-1].pathCoordinates.push(e[a],e[a+1]),r[r.length-1].valueData.push(n[a/2]));return r}var r={fillHoles:!1};return t=n.extend({},r,t),function i(t,r){var a=e(t,r);if(a.length){if(a.length>1){var s=[];return a.forEach(function(t){s.push(i(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(s)}if(t=a[0].pathCoordinates,r=a[0].valueData,t.length<=4)return n.Interpolation.none()(t,r);var o,u,c=[],l=[],h=t.length/2,f=[],d=[],p=[],m=[];for(o=0;h>o;o++)c[o]=t[2*o],l[o]=t[2*o+1];for(o=0;h-1>o;o++)p[o]=l[o+1]-l[o],m[o]=c[o+1]-c[o],d[o]=p[o]/m[o];for(f[0]=d[0],f[h-1]=d[h-2],o=1;h-1>o;o++)0===d[o]||0===d[o-1]||d[o-1]>0!=d[o]>0?f[o]=0:(f[o]=3*(m[o-1]+m[o])/((2*m[o]+m[o-1])/d[o-1]+(m[o]+2*m[o-1])/d[o]),isFinite(f[o])||(f[o]=0));for(u=(new n.Svg.Path).move(c[0],l[0],!1,r[0]),o=0;h-1>o;o++)u.curve(c[o]+m[o]/3,l[o]+f[o]*m[o]/3,c[o+1]-m[o]/3,l[o+1]-f[o+1]*m[o]/3,c[o+1],l[o+1],!1,r[o+1]);return u}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,r){for(var i,a,s,o=new n.Svg.Path,u=0;u1}).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=u.elem("path",{d:n.stringify()},t.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:e.normalized[s],path:n.clone(),series:a,seriesIndex:s,axisX:r,axisY:i,chartRect:c,index:s,group:u,element:o})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:i.bounds,chartRect:c,axisX:r,axisY:i,svg:this.svg,options:t})}function i(t,e,r,i){n.Line["super"].constructor.call(this,t,e,a,n.extend({},a,r),i)}var a={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:i,createChart:r})}(window,document,t),function(t,e,n){"use strict";function r(t){this.data=n.normalizeData(this.data);var e,r={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 i=this.svg.elem("g").addClass(t.classNames.gridGroup),s=this.svg.elem("g"),o=this.svg.elem("g").addClass(t.classNames.labelGroup);if(t.stackBars&&0!==r.normalized.length){var u=n.serialMap(r.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([u],n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y")}else e=n.getHighLow(r.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 c,l,h,f,d,p=n.createChartRect(this.svg,t,a.padding);l=t.distributeSeries&&t.stackBars?r.raw.labels.slice(0,1):r.raw.labels,t.horizontalBars?(c=f=void 0===t.axisX.type?new n.AutoScaleAxis(n.Axis.units.x,r,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})):t.axisX.type.call(n,n.Axis.units.x,r,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})),h=d=void 0===t.axisY.type?new n.StepAxis(n.Axis.units.y,r,p,{ticks:l}):t.axisY.type.call(n,n.Axis.units.y,r,p,t.axisY)):(h=f=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,r,p,{ticks:l}):t.axisX.type.call(n,n.Axis.units.x,r,p,t.axisX),c=d=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,r,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})):t.axisY.type.call(n,n.Axis.units.y,r,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})));var m=t.horizontalBars?p.x1+c.projectValue(0):p.y1-c.projectValue(0),g=[];h.createGridAndLabels(i,o,this.supportsForeignObject,t,this.eventEmitter),c.createGridAndLabels(i,o,this.supportsForeignObject,t,this.eventEmitter),r.raw.series.forEach(function(e,i){var a,o,u=i-(r.raw.series.length-1)/2;a=t.distributeSeries&&!t.stackBars?h.axisLength/r.normalized.length/2:t.distributeSeries&&t.stackBars?h.axisLength/2:h.axisLength/r.normalized[i].length/2,o=s.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(i)].join(" ")),r.normalized[i].forEach(function(s,l){var v,x,y,b;if(b=t.distributeSeries&&!t.stackBars?i:t.distributeSeries&&t.stackBars?0:l,v=t.horizontalBars?{x:p.x1+c.projectValue(s&&s.x?s.x:0,l,r.normalized[i]),y:p.y1-h.projectValue(s&&s.y?s.y:0,b,r.normalized[i])}:{x:p.x1+h.projectValue(s&&s.x?s.x:0,b,r.normalized[i]),y:p.y1-c.projectValue(s&&s.y?s.y:0,l,r.normalized[i])},h instanceof n.StepAxis&&(h.options.stretch||(v[h.units.pos]+=a*(t.horizontalBars?-1:1)),v[h.units.pos]+=t.stackBars||t.distributeSeries?0:u*t.seriesBarDistance*(t.horizontalBars?-1:1)),y=g[l]||m,g[l]=y-(m-v[h.counterUnits.pos]),void 0!==s){var w={};w[h.units.pos+"1"]=v[h.units.pos],w[h.units.pos+"2"]=v[h.units.pos],!t.stackBars||"accumulate"!==t.stackMode&&t.stackMode?(w[h.counterUnits.pos+"1"]=m,w[h.counterUnits.pos+"2"]=v[h.counterUnits.pos]):(w[h.counterUnits.pos+"1"]=y,w[h.counterUnits.pos+"2"]=g[l]),w.x1=Math.min(Math.max(w.x1,p.x1),p.x2),w.x2=Math.min(Math.max(w.x2,p.x1),p.x2),w.y1=Math.min(Math.max(w.y1,p.y2),p.y1),w.y2=Math.min(Math.max(w.y2,p.y2),p.y1),x=o.elem("line",w,t.classNames.bar).attr({"ct:value":[s.x,s.y].filter(n.isNum).join(","),"ct:meta":n.getMetaData(e,l)}),this.eventEmitter.emit("draw",n.extend({type:"bar",value:s,index:l,meta:n.getMetaData(e,l),series:e,seriesIndex:i,axisX:f,axisY:d,chartRect:p,group:o,element:x},w))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:c.bounds,chartRect:p,axisX:f,axisY:d,svg:this.svg,options:t})}function i(t,e,r,i){n.Bar["super"].constructor.call(this,t,e,a,n.extend({},a,r),i)}var a={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:i,createChart:r})}(window,document,t),t}),function(t,e){t["Chartist.plugins.ctAxisTitle"]=e()}(this,function(){return function(t,e,n){"use strict";var r={axisTitle:"",axisClass:"ct-axis-title",offset:{x:0,y:0},textAnchor:"middle",flipText:!1},i={axisX:r,axisY:r};n.plugins=n.plugins||{},n.plugins.ctAxisTitle=function(t){return t=n.extend({},i,t),function(e){e.on("created",function(e){var r,i,a;if(t.axisX.axisTitle&&e.axisX&&(r=e.axisX.axisLength/2+e.options.axisY.offset+e.options.chartPadding.left,i=e.options.chartPadding.top,"end"===e.options.axisY.position&&(r-=e.options.axisY.offset),"end"===e.options.axisX.position&&(i+=e.axisY.axisLength),a=new n.Svg("text"),a.addClass(t.axisX.axisClass),a.text(t.axisX.axisTitle),a.attr({x:r+t.axisX.offset.x,y:i+t.axisX.offset.y,"text-anchor":t.axisX.textAnchor}),e.svg.append(a,!0)),t.axisY.axisTitle&&e.axisY){r=0,i=e.axisY.axisLength/2+e.options.chartPadding.top,"start"===e.options.axisX.position&&(i+=e.options.axisX.offset),"end"===e.options.axisY.position&&(r=e.axisX.axisLength);var s="rotate("+(t.axisY.flipText?-90:90)+", "+r+", "+i+")";a=new n.Svg("text"),a.addClass(t.axisY.axisClass),a.text(t.axisY.axisTitle),a.attr({x:r+t.axisY.offset.x,y:i+t.axisY.offset.y,transform:s,"text-anchor":t.axisY.textAnchor}),e.svg.append(a,!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 r(t){t.attr({style:"display:none"})}function i(t){t.attr({style:"display:block"})}function a(t,e){var n=t.x,r=t.y,i=e.x-n,a=e.y-r;return 0>i&&(i=-i,n=e.x),0>a&&(a=-a,r=e.y),{x:n,y:r,width:i,height:a}}function s(t,e){return o(t.clientX,t.clientY,e)}function o(t,e,n){var r="svg"===n.tagName?n:n.ownerSVGElement,i=r.getScreenCTM(),a=r.createSVGPoint();return a.x=t,a.y=e,a=a.matrixTransform(i.inverse()),a||{x:0,y:0}}function u(t,e){var n=e.bounds.max,r=e.bounds.min;if(e.scale&&"log"===e.scale.type){var i=e.scale.base;return Math.pow(i,t*c(n/r,i)/e.axisLength)*r}return t*e.bounds.range/e.axisLength+r}function c(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=s(t,b);return e.id=t.identifier,e}function c(t){for(var e=0;e1&&(y.attr(a(O[0],O[1])),i(y))}function h(t){for(var e=t.changedTouches,n=0;n1&&(y.attr(a(O[0],O[1])),i(y),t.preventDefault())}function f(t){d(t.changedTouches)}function d(t){for(var e=0;e=0&&O.splice(n,1)}}function p(t){O.length>1&&v(a(O[0],O[1])),d(t.changedTouches),r(y)}function m(t){0===t.button&&(S=s(t,b),y.attr(a(S,S)),i(y),t.preventDefault())}function g(e){if(0===e.button){var n=a(S,s(e,b));v(n),S=null,r(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-E.x1,r=n+t.width,i=E.y1-t.y,a=i-t.height,s=u(n,w),o=u(r,w),c=u(a,A),l=u(i,A),h=e.options.explicitBounds;_.isUndefined(h)||(_.isUndefined(h.xLow)||(s=Math.max(h.xLow,s)),_.isUndefined(h.xHigh)||(o=Math.min(h.xHigh,o)),_.isUndefined(h.yLow)||(c=Math.max(h.yLow,c)),_.isUndefined(h.yHigh)||(l=Math.min(h.yHigh,l))),e.options.axisX.highLow={low:s,high:o},e.options.axisY.highLow={low:c,high:l},e.update(e.data,e.options),C&&C(e,M)}}function x(t){if(S){var e=s(t,b);y.attr(a(S,e)),t.preventDefault()}}if(e instanceof n.Line){var y,b,w,A,E,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){w=t.axisX,A=t.axisY,E=t.chartRect,b=t.svg._node,y=t.svg.elem("rect",{x:10,y:10,width:100,height:100},"ct-zoom-rect"),r(y);var e=t.svg.querySelector("defs")||t.svg.elem("defs"),n=E.width(),i=E.height();e.elem("clipPath",{id:"zoom-mask"}).elem("rect",{x:E.x1,y:E.y2,width:n,height:i,fill:"white"}),b.addEventListener("mousedown",m),b.addEventListener("mouseup",g),b.addEventListener("mousemove",x),b.addEventListener("touchstart",l),b.addEventListener("touchmove",h),b.addEventListener("touchend",p),b.addEventListener("touchcancel",f)});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}),function(){function t(t,e){return t.set(e[0],e[1]),t}function e(t,e){return t.add(e),t}function n(t,e){for(var n=-1,r=t.length;++n-1&&t%1==0&&e>t}function f(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function d(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function p(t){return vn[t]}function m(){}function g(){}function v(t,e){return y(t,e)&&delete t[e]}function x(t,e){if(Gn){var n=t[e];return n===ye?ge:n}return Nn.call(t,e)?t[e]:ge}function y(t,e){return Gn?t[e]!==ge:Nn.call(t,e)}function b(t,e,n){t[e]=Gn&&n===ge?ye:n}function w(t){var e=-1,n=t?t.length:0;for(this.clear();++en)return!1;var r=t.length-1;return n==r?t.pop():Xn.call(t,n,1),!0}function k(t,e){var n=I(t,e);return 0>n?ge:t[n][1]}function z(t,e){return I(t,e)>-1}function I(t,e){for(var n=t.length;n--;)if(Yt(t[n][0],e))return n;return-1}function P(t,e,n){var r=I(t,e);0>r?t.push([e,n]):t[r][1]=n}function B(t,e,n){var r=t[e];Nn.call(t,e)&&Yt(r,n)&&(n!==ge||e in t)||(t[e]=n)}function R(t,e){return t&&pt(e,se(e),t)}function U(t){return"function"==typeof t?t:de}function X(t){return ar(t)?t:Bt(t)}function Y(t,e,r,i,a,s,o){var u;if(i&&(u=s?i(t,a,s,o):i(t)),u!==ge)return u;if(!Gt(t))return t;var c=ar(t);if(c){if(u=Mt(t),!e)return dt(t,u)}else{var h=_t(t),f=h==je||h==Ne;if(sr(t))return st(t,e);if(h==ke||h==Ce||f&&!s){if(l(t))return s?t:{};if(u=Lt(f?{}:t),!e)return u=R(u,t),r?gt(t,u):u}else{if(!mn[h])return s?t:{};u=jt(t,h,e)}}o||(o=new O);var d=o.get(t);return d?d:(o.set(t,u),(c?n:q)(t,function(n,a){B(u,a,Y(n,e,r,i,a,t,o))}),r&&!c?gt(t,u):u)}function D(t){return Gt(t)?Rn(t):{}}function q(t,e){return t&&nr(t,e,se)}function F(t,e){e=Tt(e,t)?[e+""]:X(e);for(var n=0,r=e.length;null!=t&&r>n;)t=t[e[n++]];return n&&n==r?t:ge}function H(t,e){return Nn.call(t,e)||"object"==typeof t&&e in t&&null===Pn(t)}function V(t,e){return e in Object(t)}function G(t,e,n,r,i){return t===e?!0:null==t||null==e||!Gt(t)&&!Wt(e)?t!==t&&e!==e:W(t,e,G,n,r,i)}function W(t,e,n,r,i,a){var s=ar(t),o=ar(e),u=_e,c=_e;s||(u=_t(t),u=u==Ce?ke:u),o||(c=_t(e),c=c==Ce?ke:c);var h=u==ke&&!l(t),f=c==ke&&!l(e),d=u==c;if(d&&!h)return a||(a=new O),s||te(t)?bt(t,e,n,r,i,a):wt(t,e,u,n,r,i,a);if(!(i&we)){var p=h&&Nn.call(t,"__wrapped__"),m=f&&Nn.call(e,"__wrapped__");if(p||m)return a||(a=new O),n(p?t.value():t,m?e.value():e,r,i,a)}return d?(a||(a=new O),At(t,e,n,r,i,a)):!1}function Q(t,e,n,r){var i=n.length,a=i,s=!r;if(null==t)return!a;for(t=Object(t);i--;){var o=n[i];if(s&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++ie&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var a=Array(i);++re?1:-1:ne(r)||0,it(e,n,r,t)}}function bt(t,e,n,r,i,s){var o=-1,u=i&we,c=i&be,l=t.length,h=e.length;if(l!=h&&!(u&&h>l))return!1;var f=s.get(t);if(f)return f==e;var d=!0;for(s.set(t,e);++o-1&&t%1==0&&Ee>=t}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return!!t&&"object"==typeof t}function Qt(t){return null==t?!1:Ht(t)?Tn.test(jn.call(t)):Wt(t)&&(l(t)?Tn:hn).test(t)}function Zt(t){return"number"==typeof t||Wt(t)&&$n.call(t)==Te}function Jt(t){return"string"==typeof t||!ar(t)&&Wt(t)&&$n.call(t)==Pe}function Kt(t){return"symbol"==typeof t||Wt(t)&&$n.call(t)==Be}function te(t){return Wt(t)&&Vt(t.length)&&!!pn[$n.call(t)]}function ee(t){return t===ge}function ne(t){if(Gt(t)){var e=Ht(t.valueOf)?t.valueOf():t;t=Gt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(sn,"");var n=ln.test(t);return n||fn.test(t)?yn(t.slice(2),n?2:8):cn.test(t)?Se:+t}function re(t){if("string"==typeof t)return t;if(null==t)return"";if(Kt(t))return tr?tr.call(t):"";var e=t+"";return"0"==e&&1/t==-Ae?"-0":e}function ie(t,e,n){var r=null==t?ge:F(t,e);return r===ge?n:r}function ae(t,e){return Ot(t,e,V)}function se(t){var e=zt(t);if(!e&&!qt(t))return J(t);var n=Nt(t),r=!!n,i=n||[],a=i.length;for(var s in t)!H(t,s)||r&&("length"==s||h(s,a))||e&&"constructor"==s||i.push(s);return i}function oe(t){return o(t,se(t))}function ue(t){return t=re(t),t&&Ke.test(t)?t.replace(Ze,c):t}function ce(t){return t=re(t),t&&an.test(t)?t.replace(rn,"\\$&"):t}function le(){var t=arguments,e=re(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function he(t){return t=re(t),t&&Je.test(t)?t.replace(Qe,p):t}function fe(t){return function(){return t}}function de(t){return t}function pe(t){return Z("function"==typeof t?t:Y(t,!0))}function me(t){return Tt(t)?nt(t):rt(t)}var ge,ve="4.6.1",xe=200,ye="__lodash_hash_undefined__",be=1,we=2,Ae=1/0,Ee=9007199254740991,Se=NaN,Ce="[object Arguments]",_e="[object Array]",Oe="[object Boolean]",Me="[object Date]",Le="[object Error]",je="[object Function]",Ne="[object GeneratorFunction]",$e="[object Map]",Te="[object Number]",ke="[object Object]",ze="[object RegExp]",Ie="[object Set]",Pe="[object String]",Be="[object Symbol]",Re="[object WeakMap]",Ue="[object ArrayBuffer]",Xe="[object Float32Array]",Ye="[object Float64Array]",De="[object Int8Array]",qe="[object Int16Array]",Fe="[object Int32Array]",He="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Ge="[object Uint16Array]",We="[object Uint32Array]",Qe=/&(?:amp|lt|gt|quot|#39|#96);/g,Ze=/[&<>"'`]/g,Je=RegExp(Qe.source),Ke=RegExp(Ze.source),tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,en=/^\w*$/,nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,rn=/[\\^$.*+?()[\]{}|]/g,an=RegExp(rn.source),sn=/^\s+|\s+$/g,on=/\\(\\)?/g,un=/\w*$/,cn=/^[-+]0x[0-9a-f]+$/i,ln=/^0b[01]+$/i,hn=/^\[object .+?Constructor\]$/,fn=/^0o[0-7]+$/i,dn=/^(?:0|[1-9]\d*)$/,pn={};pn[Xe]=pn[Ye]=pn[De]=pn[qe]=pn[Fe]=pn[He]=pn[Ve]=pn[Ge]=pn[We]=!0,pn[Ce]=pn[_e]=pn[Ue]=pn[Oe]=pn[Me]=pn[Le]=pn[je]=pn[$e]=pn[Te]=pn[ke]=pn[ze]=pn[Ie]=pn[Pe]=pn[Re]=!1;var mn={};mn[Ce]=mn[_e]=mn[Ue]=mn[Oe]=mn[Me]=mn[Xe]=mn[Ye]=mn[De]=mn[qe]=mn[Fe]=mn[$e]=mn[Te]=mn[ke]=mn[ze]=mn[Ie]=mn[Pe]=mn[Be]=mn[He]=mn[Ve]=mn[Ge]=mn[We]=!0,mn[Le]=mn[je]=mn[Re]=!1;var gn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},vn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},xn={"function":!0,object:!0},yn=parseInt,bn=xn[typeof exports]&&exports&&!exports.nodeType?exports:ge,wn=xn[typeof module]&&module&&!module.nodeType?module:ge,An=wn&&wn.exports===bn?bn:ge,En=u(bn&&wn&&"object"==typeof global&&global),Sn=u(xn[typeof self]&&self),Cn=u(xn[typeof window]&&window),_n=u(xn[typeof this]&&this),On=En||Cn!==(_n&&_n.window)&&Cn||Sn||_n||Function("return this")(),Mn=Array.prototype,Ln=Object.prototype,jn=Function.prototype.toString,Nn=Ln.hasOwnProperty,$n=Ln.toString,Tn=RegExp("^"+jn.call(Nn).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kn=An?On.Buffer:ge,zn=On.Symbol,In=On.Uint8Array,Pn=Object.getPrototypeOf,Bn=Object.getOwnPropertySymbols,Rn=Object.create,Un=Ln.propertyIsEnumerable,Xn=Mn.splice,Yn=Math.ceil,Dn=Object.keys,qn=Math.max,Fn=Ct(On,"Map"),Hn=Ct(On,"Set"),Vn=Ct(On,"WeakMap"),Gn=Ct(Object,"create"),Wn=Fn?jn.call(Fn):"",Qn=Hn?jn.call(Hn):"",Zn=Vn?jn.call(Vn):"",Jn=zn?zn.prototype:ge,Kn=Jn?Jn.valueOf:ge,tr=Jn?Jn.toString:ge,er=vt(q),nr=xt(),rr=nt("length"),ir=Bn||function(){return[]};(Fn&&_t(new Fn)!=$e||Hn&&_t(new Hn)!=Ie||Vn&&_t(new Vn)!=Re)&&(_t=function(t){var e=$n.call(t),n=e==ke?t.constructor:null,r="function"==typeof n?jn.call(n):"";if(r)switch(r){case Wn:return $e;case Qn:return Ie;case Zn:return Re}return e});var ar=Array.isArray,sr=kn?function(t){return t instanceof kn}:fe(!1),or=yt();g.prototype=Gn?Gn(null):Ln,w.prototype.clear=A,w.prototype["delete"]=E,w.prototype.get=S,w.prototype.has=C,w.prototype.set=_,O.prototype.clear=M,O.prototype["delete"]=L,O.prototype.get=j,O.prototype.has=N,O.prototype.set=$,m.constant=fe,m.iteratee=pe,m.keys=se,m.map=Xt,m.property=me,m.range=or,m.toPairs=oe,m.eq=Yt,m.escape=ue,m.escapeRegExp=ce,m.forEach=Ut,m.get=ie,m.hasIn=ae,m.identity=de,m.isArguments=Dt,m.isArray=ar,m.isArrayLike=qt,m.isArrayLikeObject=Ft,m.isBuffer=sr,m.isFunction=Ht,m.isLength=Vt,m.isNative=Qt,m.isNumber=Zt,m.isObject=Gt,m.isObjectLike=Wt,m.isString=Jt,m.isSymbol=Kt,m.isTypedArray=te,m.isUndefined=ee,m.last=Rt,m.replace=le,m.toNumber=ne,m.toString=re,m.unescape=he,m.each=Ut,m.VERSION=ve,(Cn||Sn||{})._=m,On._=m}.call(this),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 r=n;n.match(/^\{.*\}$/)||(n="{"+n+"}");var i=new RegExp(_.escapeRegExp(n),"g");t=t.replace(i,e[r])}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(){$(this).hasClass("no-close")||t.hide(this)}),$(".Dialog").on("click",function(t){t.stopImmediatePropagation()}),$(window).on("keydown",function(e){27==e.which&&t.hide(".Modal")})},t}(),notify=function(){var t={},e="#notif";return t.show=function(n,r){$(e).html(n),modal.show(e),_.isUndefined(r)||setTimeout(t.hide,r)},t.hide=function(){var t=$(e);t.removeClass("visible"),setTimeout(function(){t.addClass("hidden")},250)},t.init=function(){$(e).on("click",function(){t.hide(this)})},t}();$().ready(function(){setInterval(function(){$(".anim-dots").each(function(t){var e=$(t),n=e.html()+".";5==n.length&&(n="."),e.html(n)})},1e3),$("input[type=number]").on("mousewheel",function(t){var e=+$(this).val(),n=+($(this).attr("step")||1),r=$(this).attr("min"),i=$(this).attr("max");t.wheelDelta>0?e+=n:e-=n,_.isUndefined(r)||(e=Math.max(e,r)),_.isUndefined(i)||(e=Math.min(e,i)),$(this).val(e),t.preventDefault()}),modal.init(),notify.init()});var page_wifi=function(){function t(t,e){if(200!=e)return void n(5e3);t=JSON.parse(t);var a=!bool(t.result.inProgress)&&t.result.APs.length>0;if(n(a?15e3:1e3),a){var s=$("#ap-list");$(".AP").remove(),s.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 e=document.createElement("div"),n=$(e).data("ssid",t.essid).data("pwd",0!=t.enc).addClass("AP");t.essid==r.current&&n.addClass("selected");var a=document.createElement("div");$(a).addClass("inner").htmlAppend('
{0}
'.format(t.rssi_perc)).htmlAppend('
{0}
'.format(_.escape(t.essid))).htmlAppend('
{0}
'.format(i[t.enc]));n.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()}),e.appendChild(a),s[0].appendChild(e)}})}}function e(){$().get(_root+"/wifi/scan",t)}function n(t){setTimeout(e,t)}var r={},i=["Open","WEP","WPA","WPA2","WPA/WPA2"];return r.init=function(){e()},r}(),page_waveform=function(){function t(t){var e,n,r=window.matchMedia("screen and (min-width: 544px)"),i=!r.matches,s="FFT"==t.stats.format;s?(e="Frequency - [ Hz ]",n="Magnitude - [ mA ]"):(e="Sample time - [ ms ]",n="Current - [ mA ]");var o=Math.max(-t.stats.min,t.stats.max),l=Math.max(o,10);$("#stat-count").html(t.stats.count),$("#stat-f-s").html(numfmt(t.stats.freq,2)),$("#stat-i-peak").html(numfmt(o,2)),$("#stat-i-rms").html(numfmt(t.stats.rms,2)),$(".stats").removeClass("invis");var h=s?t.stats.freq/t.stats.count:1e3/t.stats.freq,f=_.map(t.samples,function(t,e){return{x:e*h,y:t}}),d=[Chartist.plugins.zoom({ resetOnRightMouseBtn:!0,onZoom:function(t,e){a=e,u=t.options.axisX.highLow,c=t.options.axisY.highLow}})];i||d.push(Chartist.plugins.ctAxisTitle({axisX:{axisTitle:e,offset:{x:0,y:55}},axisY:{axisTitle:n,flipText:!0,offset:{x:0,y:15}}}));var p,m,g,v;u?(p=u.high,m=u.low,g=c.high,v=c.low):(g=s?void 0:l,v=s?0:-l),new Chartist.Line("#chart",{series:[{name:"a",data:f}]},{showPoint:!1,showArea:s,fullWidth:!0,chartPadding:i?{right:20,bottom:5,left:0}:{right:25,bottom:30,left:25},series:{a:{lineSmooth:Chartist.Interpolation.monotoneCubic()}},axisX:{type:Chartist.AutoScaleAxis,high:p,low:m},axisY:{type:Chartist.AutoScaleAxis,high:g,low:v},explicitBounds:{xLow:0,yLow:s?0:void 0,xHigh:f[f.length-1].x},plugins:d})}function e(e,n){if(h=!1,200!=n)errorMsg("Request failed.",1e3),f&&i();else{var a=JSON.parse(e);if(!a.success)return errorMsg("Sampling failed.",1e3),void(f&&i());t(a),f&&(p=setTimeout(r,Math.max(0,d-msElapsed(o))))}}function n(){m.count=$("#count").val(),m.freq=$("#freq").val()*("fft"==s?2:1)}function r(){if(h)return!1;h=!0,o=msNow();var t=m.count,n=m.freq,r=_root+"/measure/"+s+"?n="+t+"&fs="+n;return $().get(r,e,estimateLoadTime(n,t)),!0}function i(){d=+$("#ar-time").val(),n(),f=!f,f?r():clearTimeout(p),$("#ar-btn").toggleClass("btn-blue").toggleClass("btn-red").val(f?"Stop":"Auto")}var a,s,o,u,c,l={},h=!1,f=!1,d=1,p=-1,m={count:0,freq:0};return l.init=function(t){function e(){n(),r()}s=t,$("#load").on("click",e),$("#count,#freq").on("keyup",function(t){13==t.which&&e()}),$("#chart").on("contextmenu",function(t){return a&&a(),a=null,u=null,c=null,t.preventDefault(),!1}),$("#ar-btn").on("click",i)},l}(),page_spectrogram=function(){function t(t,e){var n,r,i,a;t/=6,t>1&&(t=1),0>t&&(t=0);for(var s=0;s=o.x&&(n=o.x,i=o.b),t<=o.x&&(r=o.x,a=o.b)}return Math.round(255*(i+(a-i)*((t-n)/(r-n))))}function e(e){var n=e,r=t(n,m.r),i=t(n,m.g),a=t(n,m.b);return"rgb("+r+","+i+","+a+")"}function n(){var t=s.getImageData(f.x+f.dx,f.y,f.w-f.dx,f.h);s.putImageData(t,f.x,f.y)}function r(t){n();for(var r=d.sampCount/2,i=0;r>i;i++){var a,o=r-i-1;a=i>t.length?"#000":e(t[i]),s.fillStyle=a,s.fillRect(f.x+f.w-f.dx,f.y+o*f.dy,f.dx,f.dy)}}function i(t,e){if(u=!1,200==e)try{var n=JSON.parse(t);n.success?r(n.samples):errorMsg("Sampling failed.",1e3)}catch(i){errorMsg(i)}else errorMsg("Request failed.",1e3);p&&(o=setTimeout(a,Math.max(0,d.interval-msElapsed(l))))}function a(){u&&(errorMsg("Request already pending - aborting."),c.abort()),u=!0,l=msNow();var t=d.freq,e=d.sampCount,n=_root+"/measure/fft?n="+e+"&fs="+t;return c=$().get(n,i,estimateLoadTime(t,e)),!0}var s,o,u,c,l,h={},f={x:0,y:0,w:860,h:512,dx:1,dy:1},d={interval:0,sampCount:0,binCount:0,freq:0},p=!1,m={r:[{x:0,b:0},{x:.7,b:0},{x:1,b:1}],g:[{x:0,b:0},{x:.3,b:0},{x:.7,b:1},{x:1,b:1}],b:[{x:0,b:0},{x:.02,b:.3},{x:.3,b:1},{x:1,b:1}]};return h.init=function(){var t=$("#sg")[0];s=t.getContext("2d"),s.fillStyle="#000",s.fillRect(f.x,f.y,f.w,f.h),$("#go-btn").on("click",function(){d.interval=+$("#interval").val(),d.freq=2*$("#freq").val(),d.sampCount=$("#count").val(),f.dx=f.dy=f.h/(d.sampCount/2),p=!p,p?a():clearTimeout(o),$("#go-btn").toggleClass("btn-green").toggleClass("btn-red").html(p?"Stop":"Start")})},h}(),page_status=function(){function t(t,a){if(200!=a)errorMsg("Update failed.");else try{var s=JSON.parse(t);n.j=s,$(".sta-only").toggle(s.sta),$(".ap-only").toggle(s.ap),$("#uptime").html(s.uptime),$("#heap").html(s.heap+" bytes"),$("#wmode").html(s.wifiMode),s.sta&&($("#staSSID").html(s.sta.SSID),$("#staRSSIperc").html(s.sta.RSSIperc),$("#staRSSI").html(s.sta.RSSI),$("#staMAC").html(s.sta.MAC)),s.ap&&($("#apSSID").html(s.ap.SSID),$("#apHidden").html(s.ap.hidden?"Yes":"No"),$("#apAuth").html(s.ap.auth),$(".ap-auth-only").toggle("Open"!=s.ap.auth),$("#apPwd").html(s.ap.pwd),$("#apChan").html(s.ap.chan),$("#apMAC").html(s.ap.MAC))}catch(o){errorMsg(o)}i||setTimeout(e,r)}function e(){$().get(_root+"/system/status",t)}var n={};n.j={};var r=1e4,i=!1;return n.trigReset=function(){var t="#reset-modal";$().get(_root+"/system/reset",function(n,r){if(200==r){modal.show(t),i=!0;var a=setInterval(function(){$().get(_root+"/system/ping",function(n,r){200==r&&(modal.hide(t),e(),clearInterval(a),i=!1)},{timeout:500})},1e3)}})},n.init=function(){e()},n}(); \ No newline at end of file diff --git a/html/pages/sgm.html b/html/pages/sgm.html new file mode 100644 index 0000000..0d2c6e4 --- /dev/null +++ b/html/pages/sgm.html @@ -0,0 +1,73 @@ + + + + + + + + Spectrogram - Current Analyser + + + + + + +
+ +
+ Loading… + +

Spectrogram

+ +
+
+ + +
+
+ + + Hz +
+
+ + + ms +
+
+ Start +
+
+ +
+ +
+ + + + + + +
+
+ + diff --git a/html_src/js-src/lib/chibi.js b/html_src/js-src/lib/chibi.js index 13255e4..4886271 100644 --- a/html_src/js-src/lib/chibi.js +++ b/html_src/js-src/lib/chibi.js @@ -633,7 +633,7 @@ if (xhr) { // prevent caching if (opts.nocache) { - var ts = (+(+new Date())).toString(36); + var ts = (+(new Date())).toString(36); url += ((url.indexOf('?') === -1) ? '?' : '&') + '_=' + ts; } diff --git a/html_src/js/all.js b/html_src/js/all.js index b957a88..9d0c0f7 100644 --- a/html_src/js/all.js +++ b/html_src/js/all.js @@ -1,3 +1,3 @@ -function bool(t){return 1===t||"1"===t||t===!0||"true"===t}function numfmt(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}function estimateLoadTime(t,e){return 1e3/t*e+1500}function msNow(){return+new Date}function msElapsed(t){return msNow()-t}function errorMsg(t,e){notify.show(t,e||3e3)}!function(){"use strict";function t(){var t;for(p=!0,t=0;t=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return t.currentStyle?t.currentStyle[r(e)]:v.getComputedStyle?v.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function s(t,e,n){try{t.style[r(e)]=n}catch(i){}}function o(t){t.style.display="","none"===i(t,"display")&&(t.style.display="block")}function u(t){var e,r,i,s="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r0&&(s+="&"+a(e.name,e.value));break;case"select-multiple":for(i=0;i0?s.substring(1):""}function c(t,e,r){var i,a,s,o=!1;return t&&(i=t.split(/\s+/),n(function(t){for(s=0;s0?y[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},y),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},y),e},e.removeClass=function(t){return c(t,"remove",y),e},e.toggleClass=function(t){return c(t,"toggle",y),e},e.hasClass=function(t){return c(t,"has",y)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},y),e):y[0]?y[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",y),e},e.htmlAfter=function(t){return l(t,"after",y),e},e.htmlAppend=function(t){return l(t,"append",y),e},e.htmlPrepend=function(t){return l(t,"prepend",y),e},e.attr=function(t,r){if(t){if(t=t.toLowerCase(),"undefined"!=typeof r)return n(function(e){"style"===t?e.style.cssText=r:"class"===t?e.className=r:e.setAttribute(t,r)},y),e;if(y[0])if("style"===t){if(y[0].style.cssText)return y[0].style.cssText}else if("class"===t){if(y[0].className)return y[0].className}else if(y[0].getAttribute(t))return y[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var r,i,a;if(!_.isUndefined(t))return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),i=0;i1?r:r[0];case"INPUT":case"TEXTAREA":case"BUTTON":return y[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)},y),e):!y[0]||"INPUT"!==y[0].nodeName||"checkbox"!==y[0].type&&"radio"!==y[0].type?void 0:!!y[0].checked},e.on=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.addEventListener(r,i,!1):g.attachEvent&&(t[r+i]=function(){return i.apply(t,arguments)},t.attachEvent("on"+r,t[r+i]))},y),e},e.off=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.removeEventListener(r,i,!1):g.attachEvent&&(t.detachEvent("on"+r,t[r+i]),t[r+i]=null)},y),e},e.ajax=function(t,e,n,r){var i,a,s=u(y),o=e?e.toUpperCase():"GET";_.isNumber(r)&&(r={timeout:r});var c=Chartist.extend({},{nocache:!0,timeout:5e3,loader:!0},r);if(s&&"GET"===o&&(t+=-1===t.indexOf("?")?"?"+s:"&"+s,s=null),i=new XMLHttpRequest){if(c.nocache){var l=(+ +new Date).toString(36);t+=(-1===t.indexOf("?")?"?":"&")+"_="+l}c.loader&&$("#loader").addClass("show"),i.open(o,t,!0),i.timeout=c.timeout,a=setTimeout(function(){errorMsg("XHR timed out."),i.abort(),c.loader&&$("#loader").removeClass("show")},c.timeout+10),i.onreadystatechange=function(){4===i.readyState&&(c.loader&&$("#loader").removeClass("show"),n&&0!=i.status&&n(i.responseText,i.status),clearTimeout(a))},i.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===o&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(s)}return i},e.get=function(t,n,r){return e.ajax(t,"get",n,r)},e.post=function(t,n,r){return e.ajax(t,"post",n,r)},e}var f=[],d=[],p=!1,m=!1,g=document,v=window;g.addEventListener?(g.addEventListener("DOMContentLoaded",t,!1),v.addEventListener("load",e,!1)):g.attachEvent?(g.attachEvent("onreadystatechange",t),v.attachEvent("onload",e)):v.onload=e,v.$=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 r in e)"object"!=typeof e[r]||null===e[r]||e[r]instanceof Array?t[r]=e[r]:t[r]=n.extend({},t[r],e[r])}),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 r=[],i=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(i).forEach(function(n,i){var a=t.map(function(t){return t[i]});r[i]=e.apply(null,a)}),r},n.roundWithPrecision=function(t,e){var r=Math.pow(10,e||n.precision);return Math.round(t*r)/r},n.precision=8,n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),_.escape(t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=_.unescape(t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,r,i){var a;return e=e||"100%",r=r||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),a=new n.Svg("svg").attr({width:e,height:r}).addClass(i).attr({style:"width: "+e+"; height: "+r+";"}),t.appendChild(a._node),a},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,r=n.getDataArray(t);e=r.every(function(t){return t instanceof Array})?Math.max.apply(null,r.map(function(t){return t.length})):r.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;ea.high&&(a.high=n),o&&n0?a.low=0:(a.high=1,a.low=0)),a},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 r,i=2,a=2;if(t%2===0)return 2;do i=n(i)%t,a=n(n(a))%t,r=e(Math.abs(i-a),t);while(1===r);return r},n.getBounds=function(t,e,r,i){var a,s,o,u=0,c={high:e.high,low:e.low};c.valueRange=c.high-c.low,c.oom=n.orderOfMagnitude(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);var l=n.projectLength(t,c.step,c),h=r>l,f=i?n.rho(c.range):0;if(i&&n.projectLength(t,1,c)>=r)c.step=1;else if(i&&f=r)c.step=f;else for(;;){if(h&&n.projectLength(t,c.step,c)<=r)c.step*=2;else{if(h||!(n.projectLength(t,c.step/2,c)>=r))break;if(c.step/=2,i&&c.step%1!==0){c.step*=2;break}}if(u++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(s=c.min,o=c.max;s+c.step<=c.low;)s+=c.step;for(;o-c.step>=c.high;)o-=c.step;for(c.min=s,c.max=o,c.range=c.max-c.min,c.values=[],a=c.min;a<=c.max;a+=c.step)c.values.push(n.roundWithPrecision(a));return c},n.createChartRect=function(t,e,r){var i=!(!e.axisX&&!e.axisY),a=i?e.axisY.offset:0,s=i?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,u=t.height()||n.quantity(e.height).value||0,c=n.normalizePadding(e.chartPadding,r);o=Math.max(o,a+c.left+c.right),u=Math.max(u,s+c.top+c.bottom);var l={padding:c,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===e.axisX.position?(l.y2=c.top+s,l.y1=Math.max(u-c.bottom,l.y2+1)):(l.y2=c.top,l.y1=Math.max(u-c.bottom-s,l.y2+1)),"start"===e.axisY.position?(l.x1=c.left+a,l.x2=Math.max(o-c.right,l.x1+1)):(l.x1=c.left,l.x2=Math.max(o-c.right-a,l.x1+1))):(l.x1=c.left,l.x2=Math.max(o-c.right,l.x1+1),l.y2=c.top,l.y1=Math.max(u-c.bottom,l.y2+1)),l},n.createGrid=function(t,e,r,i,a,s,o,u){var c={};c[r.units.pos+"1"]=Math.round(t)+.5,c[r.units.pos+"2"]=Math.round(t)+.5,c[r.counterUnits.pos+"1"]=i,c[r.counterUnits.pos+"2"]=i+a;var l=s.elem("line",c,o.join(" "));u.emit("draw",n.extend({type:"grid",axis:r,index:e,group:s,element:l},c))},n.createLabel=function(t,e,r,i,a,s,o,u,c,l,h){var f,d={};d[a.units.pos]=t+o[a.units.pos],d[a.counterUnits.pos]=o[a.counterUnits.pos],d[a.units.len]=e,d[a.counterUnits.len]=s-10;var p=i[r];if(_.isNumber(p)&&(p=n.roundWithPrecision(p,2)),l){var m=''+p+"";f=u.foreignObject(m,n.extend({style:"overflow: visible;"},d))}else f=u.elem("text",d,c.join(" ")).text(p);h.emit("draw",n.extend({type:"label",axis:a,index:r,group:u,element:f,text:p},d))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var r=e.series[t.name];return r.hasOwnProperty(n)?r[n]:e[n]}return e[n]},n.optionsProvider=function(e,r,i){function a(e){var a=o;if(o=n.extend({},c),r)for(u=0;u=2&&e[a]<=e[a-2]?i=!0:(i&&(r.push({pathCoordinates:[],valueData:[]}),i=!1),r[r.length-1].pathCoordinates.push(e[a],e[a+1]),r[r.length-1].valueData.push(n[a/2]));return r}var r={fillHoles:!1};return t=n.extend({},r,t),function i(t,r){var a=e(t,r);if(a.length){if(a.length>1){var s=[];return a.forEach(function(t){s.push(i(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(s)}if(t=a[0].pathCoordinates,r=a[0].valueData,t.length<=4)return n.Interpolation.none()(t,r);var o,u,c=[],l=[],h=t.length/2,f=[],d=[],p=[],m=[];for(o=0;h>o;o++)c[o]=t[2*o],l[o]=t[2*o+1];for(o=0;h-1>o;o++)p[o]=l[o+1]-l[o],m[o]=c[o+1]-c[o],d[o]=p[o]/m[o];for(f[0]=d[0],f[h-1]=d[h-2],o=1;h-1>o;o++)0===d[o]||0===d[o-1]||d[o-1]>0!=d[o]>0?f[o]=0:(f[o]=3*(m[o-1]+m[o])/((2*m[o]+m[o-1])/d[o-1]+(m[o]+2*m[o-1])/d[o]),isFinite(f[o])||(f[o]=0));for(u=(new n.Svg.Path).move(c[0],l[0],!1,r[0]),o=0;h-1>o;o++)u.curve(c[o]+m[o]/3,l[o]+f[o]*m[o]/3,c[o+1]-m[o]/3,l[o+1]-f[o+1]*m[o]/3,c[o+1],l[o+1],!1,r[o+1]);return u}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,r){for(var i,a,s,o=new n.Svg.Path,u=0;u=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return t.currentStyle?t.currentStyle[r(e)]:v.getComputedStyle?v.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function s(t,e,n){try{t.style[r(e)]=n}catch(i){}}function o(t){t.style.display="","none"===i(t,"display")&&(t.style.display="block")}function u(t){var e,r,i,s="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r0&&(s+="&"+a(e.name,e.value));break;case"select-multiple":for(i=0;i0?s.substring(1):""}function c(t,e,r){var i,a,s,o=!1;return t&&(i=t.split(/\s+/),n(function(t){for(s=0;s0?y[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},y),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},y),e},e.removeClass=function(t){return c(t,"remove",y),e},e.toggleClass=function(t){return c(t,"toggle",y),e},e.hasClass=function(t){return c(t,"has",y)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},y),e):y[0]?y[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",y),e},e.htmlAfter=function(t){return l(t,"after",y),e},e.htmlAppend=function(t){return l(t,"append",y),e},e.htmlPrepend=function(t){return l(t,"prepend",y),e},e.attr=function(t,r){if(t){if(t=t.toLowerCase(),"undefined"!=typeof r)return n(function(e){"style"===t?e.style.cssText=r:"class"===t?e.className=r:e.setAttribute(t,r)},y),e;if(y[0])if("style"===t){if(y[0].style.cssText)return y[0].style.cssText}else if("class"===t){if(y[0].className)return y[0].className}else if(y[0].getAttribute(t))return y[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var r,i,a;if(!_.isUndefined(t))return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),i=0;i1?r:r[0];case"INPUT":case"TEXTAREA":case"BUTTON":return y[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)},y),e):!y[0]||"INPUT"!==y[0].nodeName||"checkbox"!==y[0].type&&"radio"!==y[0].type?void 0:!!y[0].checked},e.on=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.addEventListener(r,i,!1):g.attachEvent&&(t[r+i]=function(){return i.apply(t,arguments)},t.attachEvent("on"+r,t[r+i]))},y),e},e.off=function(r,i){return t!==v&&t!==g||(y=[t]),n(function(t){g.addEventListener?t.removeEventListener(r,i,!1):g.attachEvent&&(t.detachEvent("on"+r,t[r+i]),t[r+i]=null)},y),e},e.ajax=function(t,e,n,r){var i,a,s=u(y),o=e?e.toUpperCase():"GET";_.isNumber(r)&&(r={timeout:r});var c=Chartist.extend({},{nocache:!0,timeout:5e3,loader:!0},r);if(s&&"GET"===o&&(t+=-1===t.indexOf("?")?"?"+s:"&"+s,s=null),i=new XMLHttpRequest){if(c.nocache){var l=(+new Date).toString(36);t+=(-1===t.indexOf("?")?"?":"&")+"_="+l}c.loader&&$("#loader").addClass("show"),i.open(o,t,!0),i.timeout=c.timeout,a=setTimeout(function(){errorMsg("XHR timed out."),i.abort(),c.loader&&$("#loader").removeClass("show")},c.timeout+10),i.onreadystatechange=function(){4===i.readyState&&(c.loader&&$("#loader").removeClass("show"),n&&0!=i.status&&n(i.responseText,i.status),clearTimeout(a))},i.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===o&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(s)}return i},e.get=function(t,n,r){return e.ajax(t,"get",n,r)},e.post=function(t,n,r){return e.ajax(t,"post",n,r)},e}var f=[],d=[],p=!1,m=!1,g=document,v=window;g.addEventListener?(g.addEventListener("DOMContentLoaded",t,!1),v.addEventListener("load",e,!1)):g.attachEvent?(g.attachEvent("onreadystatechange",t),v.attachEvent("onload",e)):v.onload=e,v.$=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 r in e)"object"!=typeof e[r]||null===e[r]||e[r]instanceof Array?t[r]=e[r]:t[r]=n.extend({},t[r],e[r])}),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 r=[],i=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(i).forEach(function(n,i){var a=t.map(function(t){return t[i]});r[i]=e.apply(null,a)}),r},n.roundWithPrecision=function(t,e){var r=Math.pow(10,e||n.precision);return Math.round(t*r)/r},n.precision=8,n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),_.escape(t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=_.unescape(t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,r,i){var a;return e=e||"100%",r=r||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),a=new n.Svg("svg").attr({width:e,height:r}).addClass(i).attr({style:"width: "+e+"; height: "+r+";"}),t.appendChild(a._node),a},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,r=n.getDataArray(t);e=r.every(function(t){return t instanceof Array})?Math.max.apply(null,r.map(function(t){return t.length})):r.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;ea.high&&(a.high=n),o&&n0?a.low=0:(a.high=1,a.low=0)),a},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 r,i=2,a=2;if(t%2===0)return 2;do i=n(i)%t,a=n(n(a))%t,r=e(Math.abs(i-a),t);while(1===r);return r},n.getBounds=function(t,e,r,i){var a,s,o,u=0,c={high:e.high,low:e.low};c.valueRange=c.high-c.low,c.oom=n.orderOfMagnitude(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);var l=n.projectLength(t,c.step,c),h=r>l,f=i?n.rho(c.range):0;if(i&&n.projectLength(t,1,c)>=r)c.step=1;else if(i&&f=r)c.step=f;else for(;;){if(h&&n.projectLength(t,c.step,c)<=r)c.step*=2;else{if(h||!(n.projectLength(t,c.step/2,c)>=r))break;if(c.step/=2,i&&c.step%1!==0){c.step*=2;break}}if(u++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(s=c.min,o=c.max;s+c.step<=c.low;)s+=c.step;for(;o-c.step>=c.high;)o-=c.step;for(c.min=s,c.max=o,c.range=c.max-c.min,c.values=[],a=c.min;a<=c.max;a+=c.step)c.values.push(n.roundWithPrecision(a));return c},n.createChartRect=function(t,e,r){var i=!(!e.axisX&&!e.axisY),a=i?e.axisY.offset:0,s=i?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,u=t.height()||n.quantity(e.height).value||0,c=n.normalizePadding(e.chartPadding,r);o=Math.max(o,a+c.left+c.right),u=Math.max(u,s+c.top+c.bottom);var l={padding:c,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===e.axisX.position?(l.y2=c.top+s,l.y1=Math.max(u-c.bottom,l.y2+1)):(l.y2=c.top,l.y1=Math.max(u-c.bottom-s,l.y2+1)),"start"===e.axisY.position?(l.x1=c.left+a,l.x2=Math.max(o-c.right,l.x1+1)):(l.x1=c.left,l.x2=Math.max(o-c.right-a,l.x1+1))):(l.x1=c.left,l.x2=Math.max(o-c.right,l.x1+1),l.y2=c.top,l.y1=Math.max(u-c.bottom,l.y2+1)),l},n.createGrid=function(t,e,r,i,a,s,o,u){var c={};c[r.units.pos+"1"]=Math.round(t)+.5,c[r.units.pos+"2"]=Math.round(t)+.5,c[r.counterUnits.pos+"1"]=i,c[r.counterUnits.pos+"2"]=i+a;var l=s.elem("line",c,o.join(" "));u.emit("draw",n.extend({type:"grid",axis:r,index:e,group:s,element:l},c))},n.createLabel=function(t,e,r,i,a,s,o,u,c,l,h){var f,d={};d[a.units.pos]=t+o[a.units.pos],d[a.counterUnits.pos]=o[a.counterUnits.pos],d[a.units.len]=e,d[a.counterUnits.len]=s-10;var p=i[r];if(_.isNumber(p)&&(p=n.roundWithPrecision(p,2)),l){var m=''+p+"";f=u.foreignObject(m,n.extend({style:"overflow: visible;"},d))}else f=u.elem("text",d,c.join(" ")).text(p);h.emit("draw",n.extend({type:"label",axis:a,index:r,group:u,element:f,text:p},d))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var r=e.series[t.name];return r.hasOwnProperty(n)?r[n]:e[n]}return e[n]},n.optionsProvider=function(e,r,i){function a(e){var a=o;if(o=n.extend({},c),r)for(u=0;u=2&&e[a]<=e[a-2]?i=!0:(i&&(r.push({pathCoordinates:[],valueData:[]}),i=!1),r[r.length-1].pathCoordinates.push(e[a],e[a+1]),r[r.length-1].valueData.push(n[a/2]));return r}var r={fillHoles:!1};return t=n.extend({},r,t),function i(t,r){var a=e(t,r);if(a.length){if(a.length>1){var s=[];return a.forEach(function(t){s.push(i(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(s)}if(t=a[0].pathCoordinates,r=a[0].valueData,t.length<=4)return n.Interpolation.none()(t,r);var o,u,c=[],l=[],h=t.length/2,f=[],d=[],p=[],m=[];for(o=0;h>o;o++)c[o]=t[2*o],l[o]=t[2*o+1];for(o=0;h-1>o;o++)p[o]=l[o+1]-l[o],m[o]=c[o+1]-c[o],d[o]=p[o]/m[o];for(f[0]=d[0],f[h-1]=d[h-2],o=1;h-1>o;o++)0===d[o]||0===d[o-1]||d[o-1]>0!=d[o]>0?f[o]=0:(f[o]=3*(m[o-1]+m[o])/((2*m[o]+m[o-1])/d[o-1]+(m[o]+2*m[o-1])/d[o]),isFinite(f[o])||(f[o]=0));for(u=(new n.Svg.Path).move(c[0],l[0],!1,r[0]),o=0;h-1>o;o++)u.curve(c[o]+m[o]/3,l[o]+f[o]*m[o]/3,c[o+1]-m[o]/3,l[o+1]-f[o+1]*m[o]/3,c[o+1],l[o+1],!1,r[o+1]);return u}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,r){for(var i,a,s,o=new n.Svg.Path,u=0;u1}).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=u.elem("path",{d:n.stringify()},t.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:e.normalized[s],path:n.clone(),series:a,seriesIndex:s,axisX:r,axisY:i,chartRect:c,index:s,group:u,element:o})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:i.bounds,chartRect:c,axisX:r,axisY:i,svg:this.svg,options:t})}function i(t,e,r,i){n.Line["super"].constructor.call(this,t,e,a,n.extend({},a,r),i)}var a={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:i,createChart:r})}(window,document,t),function(t,e,n){"use strict";function r(t){this.data=n.normalizeData(this.data);var e,r={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 i=this.svg.elem("g").addClass(t.classNames.gridGroup),s=this.svg.elem("g"),o=this.svg.elem("g").addClass(t.classNames.labelGroup);if(t.stackBars&&0!==r.normalized.length){var u=n.serialMap(r.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([u],n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y")}else e=n.getHighLow(r.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 c,l,h,f,d,p=n.createChartRect(this.svg,t,a.padding);l=t.distributeSeries&&t.stackBars?r.raw.labels.slice(0,1):r.raw.labels,t.horizontalBars?(c=f=void 0===t.axisX.type?new n.AutoScaleAxis(n.Axis.units.x,r,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})):t.axisX.type.call(n,n.Axis.units.x,r,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})),h=d=void 0===t.axisY.type?new n.StepAxis(n.Axis.units.y,r,p,{ticks:l}):t.axisY.type.call(n,n.Axis.units.y,r,p,t.axisY)):(h=f=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,r,p,{ticks:l}):t.axisX.type.call(n,n.Axis.units.x,r,p,t.axisX),c=d=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,r,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})):t.axisY.type.call(n,n.Axis.units.y,r,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})));var m=t.horizontalBars?p.x1+c.projectValue(0):p.y1-c.projectValue(0),g=[];h.createGridAndLabels(i,o,this.supportsForeignObject,t,this.eventEmitter),c.createGridAndLabels(i,o,this.supportsForeignObject,t,this.eventEmitter),r.raw.series.forEach(function(e,i){var a,o,u=i-(r.raw.series.length-1)/2;a=t.distributeSeries&&!t.stackBars?h.axisLength/r.normalized.length/2:t.distributeSeries&&t.stackBars?h.axisLength/2:h.axisLength/r.normalized[i].length/2,o=s.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(i)].join(" ")),r.normalized[i].forEach(function(s,l){var v,x,y,b;if(b=t.distributeSeries&&!t.stackBars?i:t.distributeSeries&&t.stackBars?0:l,v=t.horizontalBars?{x:p.x1+c.projectValue(s&&s.x?s.x:0,l,r.normalized[i]),y:p.y1-h.projectValue(s&&s.y?s.y:0,b,r.normalized[i])}:{x:p.x1+h.projectValue(s&&s.x?s.x:0,b,r.normalized[i]),y:p.y1-c.projectValue(s&&s.y?s.y:0,l,r.normalized[i])},h instanceof n.StepAxis&&(h.options.stretch||(v[h.units.pos]+=a*(t.horizontalBars?-1:1)),v[h.units.pos]+=t.stackBars||t.distributeSeries?0:u*t.seriesBarDistance*(t.horizontalBars?-1:1)),y=g[l]||m,g[l]=y-(m-v[h.counterUnits.pos]),void 0!==s){var w={};w[h.units.pos+"1"]=v[h.units.pos],w[h.units.pos+"2"]=v[h.units.pos],!t.stackBars||"accumulate"!==t.stackMode&&t.stackMode?(w[h.counterUnits.pos+"1"]=m,w[h.counterUnits.pos+"2"]=v[h.counterUnits.pos]):(w[h.counterUnits.pos+"1"]=y,w[h.counterUnits.pos+"2"]=g[l]),w.x1=Math.min(Math.max(w.x1,p.x1),p.x2),w.x2=Math.min(Math.max(w.x2,p.x1),p.x2),w.y1=Math.min(Math.max(w.y1,p.y2),p.y1),w.y2=Math.min(Math.max(w.y2,p.y2),p.y1),x=o.elem("line",w,t.classNames.bar).attr({"ct:value":[s.x,s.y].filter(n.isNum).join(","),"ct:meta":n.getMetaData(e,l)}),this.eventEmitter.emit("draw",n.extend({type:"bar",value:s,index:l,meta:n.getMetaData(e,l),series:e,seriesIndex:i,axisX:f,axisY:d,chartRect:p,group:o,element:x},w))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:c.bounds,chartRect:p,axisX:f,axisY:d,svg:this.svg,options:t})}function i(t,e,r,i){n.Bar["super"].constructor.call(this,t,e,a,n.extend({},a,r),i)}var a={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:i,createChart:r})}(window,document,t),t}),function(t,e){t["Chartist.plugins.ctAxisTitle"]=e()}(this,function(){return function(t,e,n){"use strict";var r={axisTitle:"",axisClass:"ct-axis-title",offset:{x:0,y:0},textAnchor:"middle",flipText:!1},i={axisX:r,axisY:r};n.plugins=n.plugins||{},n.plugins.ctAxisTitle=function(t){return t=n.extend({},i,t),function(e){e.on("created",function(e){var r,i,a;if(t.axisX.axisTitle&&e.axisX&&(r=e.axisX.axisLength/2+e.options.axisY.offset+e.options.chartPadding.left,i=e.options.chartPadding.top,"end"===e.options.axisY.position&&(r-=e.options.axisY.offset),"end"===e.options.axisX.position&&(i+=e.axisY.axisLength),a=new n.Svg("text"),a.addClass(t.axisX.axisClass),a.text(t.axisX.axisTitle),a.attr({x:r+t.axisX.offset.x,y:i+t.axisX.offset.y,"text-anchor":t.axisX.textAnchor}),e.svg.append(a,!0)),t.axisY.axisTitle&&e.axisY){r=0,i=e.axisY.axisLength/2+e.options.chartPadding.top,"start"===e.options.axisX.position&&(i+=e.options.axisX.offset),"end"===e.options.axisY.position&&(r=e.axisX.axisLength);var s="rotate("+(t.axisY.flipText?-90:90)+", "+r+", "+i+")";a=new n.Svg("text"),a.addClass(t.axisY.axisClass),a.text(t.axisY.axisTitle),a.attr({x:r+t.axisY.offset.x,y:i+t.axisY.offset.y,transform:s,"text-anchor":t.axisY.textAnchor}),e.svg.append(a,!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 r(t){t.attr({style:"display:none"})}function i(t){t.attr({style:"display:block"})}function a(t,e){var n=t.x,r=t.y,i=e.x-n,a=e.y-r;return 0>i&&(i=-i,n=e.x),0>a&&(a=-a,r=e.y),{x:n,y:r,width:i,height:a}}function s(t,e){return o(t.clientX,t.clientY,e)}function o(t,e,n){var r="svg"===n.tagName?n:n.ownerSVGElement,i=r.getScreenCTM(),a=r.createSVGPoint();return a.x=t,a.y=e,a=a.matrixTransform(i.inverse()),a||{x:0,y:0}}function u(t,e){var n=e.bounds.max,r=e.bounds.min;if(e.scale&&"log"===e.scale.type){var i=e.scale.base;return Math.pow(i,t*c(n/r,i)/e.axisLength)*r}return t*e.bounds.range/e.axisLength+r}function c(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=s(t,b);return e.id=t.identifier,e}function c(t){for(var e=0;e1&&(y.attr(a(O[0],O[1])),i(y))}function h(t){for(var e=t.changedTouches,n=0;n1&&(y.attr(a(O[0],O[1])),i(y),t.preventDefault())}function f(t){d(t.changedTouches)}function d(t){for(var e=0;e=0&&O.splice(n,1)}}function p(t){O.length>1&&v(a(O[0],O[1])),d(t.changedTouches),r(y)}function m(t){0===t.button&&(S=s(t,b),y.attr(a(S,S)),i(y),t.preventDefault())}function g(e){if(0===e.button){var n=a(S,s(e,b));v(n),S=null,r(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-E.x1,r=n+t.width,i=E.y1-t.y,a=i-t.height,s=u(n,w),o=u(r,w),c=u(a,A),l=u(i,A),h=e.options.explicitBounds;_.isUndefined(h)||(_.isUndefined(h.xLow)||(s=Math.max(h.xLow,s)),_.isUndefined(h.xHigh)||(o=Math.min(h.xHigh,o)),_.isUndefined(h.yLow)||(c=Math.max(h.yLow,c)),_.isUndefined(h.yHigh)||(l=Math.min(h.yHigh,l))),e.options.axisX.highLow={low:s,high:o},e.options.axisY.highLow={low:c,high:l},e.update(e.data,e.options),C&&C(e,M)}}function x(t){if(S){var e=s(t,b);y.attr(a(S,e)),t.preventDefault()}}if(e instanceof n.Line){var y,b,w,A,E,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){w=t.axisX,A=t.axisY,E=t.chartRect,b=t.svg._node,y=t.svg.elem("rect",{x:10,y:10,width:100,height:100},"ct-zoom-rect"),r(y);var e=t.svg.querySelector("defs")||t.svg.elem("defs"),n=E.width(),i=E.height();e.elem("clipPath",{id:"zoom-mask"}).elem("rect",{x:E.x1,y:E.y2,width:n,height:i,fill:"white"}),b.addEventListener("mousedown",m),b.addEventListener("mouseup",g),b.addEventListener("mousemove",x),b.addEventListener("touchstart",l),b.addEventListener("touchmove",h),b.addEventListener("touchend",p),b.addEventListener("touchcancel",f)});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}),function(){function t(t,e){return t.set(e[0],e[1]),t}function e(t,e){return t.add(e),t}function n(t,e){for(var n=-1,r=t.length;++n-1&&t%1==0&&e>t}function f(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function d(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function p(t){return vn[t]}function m(){}function g(){}function v(t,e){return y(t,e)&&delete t[e]}function x(t,e){if(Gn){var n=t[e];return n===ye?ge:n}return Nn.call(t,e)?t[e]:ge}function y(t,e){return Gn?t[e]!==ge:Nn.call(t,e)}function b(t,e,n){t[e]=Gn&&n===ge?ye:n}function w(t){var e=-1,n=t?t.length:0;for(this.clear();++en)return!1;var r=t.length-1;return n==r?t.pop():Xn.call(t,n,1),!0}function k(t,e){var n=I(t,e);return 0>n?ge:t[n][1]}function z(t,e){return I(t,e)>-1}function I(t,e){for(var n=t.length;n--;)if(Yt(t[n][0],e))return n;return-1}function P(t,e,n){var r=I(t,e);0>r?t.push([e,n]):t[r][1]=n}function B(t,e,n){var r=t[e];Nn.call(t,e)&&Yt(r,n)&&(n!==ge||e in t)||(t[e]=n)}function R(t,e){return t&&pt(e,se(e),t)}function U(t){return"function"==typeof t?t:de}function X(t){return ar(t)?t:Bt(t)}function Y(t,e,r,i,a,s,o){var u;if(i&&(u=s?i(t,a,s,o):i(t)),u!==ge)return u;if(!Gt(t))return t;var c=ar(t);if(c){if(u=Mt(t),!e)return dt(t,u)}else{var h=_t(t),f=h==je||h==Ne;if(sr(t))return st(t,e);if(h==ke||h==Ce||f&&!s){if(l(t))return s?t:{};if(u=Lt(f?{}:t),!e)return u=R(u,t),r?gt(t,u):u}else{if(!mn[h])return s?t:{};u=jt(t,h,e)}}o||(o=new O);var d=o.get(t);return d?d:(o.set(t,u),(c?n:q)(t,function(n,a){B(u,a,Y(n,e,r,i,a,t,o))}),r&&!c?gt(t,u):u)}function D(t){return Gt(t)?Rn(t):{}}function q(t,e){return t&&nr(t,e,se)}function F(t,e){e=Tt(e,t)?[e+""]:X(e);for(var n=0,r=e.length;null!=t&&r>n;)t=t[e[n++]];return n&&n==r?t:ge}function H(t,e){return Nn.call(t,e)||"object"==typeof t&&e in t&&null===Pn(t)}function V(t,e){return e in Object(t)}function G(t,e,n,r,i){return t===e?!0:null==t||null==e||!Gt(t)&&!Wt(e)?t!==t&&e!==e:W(t,e,G,n,r,i)}function W(t,e,n,r,i,a){var s=ar(t),o=ar(e),u=_e,c=_e;s||(u=_t(t),u=u==Ce?ke:u),o||(c=_t(e),c=c==Ce?ke:c);var h=u==ke&&!l(t),f=c==ke&&!l(e),d=u==c;if(d&&!h)return a||(a=new O),s||te(t)?bt(t,e,n,r,i,a):wt(t,e,u,n,r,i,a);if(!(i&we)){var p=h&&Nn.call(t,"__wrapped__"),m=f&&Nn.call(e,"__wrapped__");if(p||m)return a||(a=new O),n(p?t.value():t,m?e.value():e,r,i,a)}return d?(a||(a=new O),At(t,e,n,r,i,a)):!1}function Q(t,e,n,r){var i=n.length,a=i,s=!r;if(null==t)return!a;for(t=Object(t);i--;){var o=n[i];if(s&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++ie&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var a=Array(i);++re?1:-1:ne(r)||0,it(e,n,r,t)}}function bt(t,e,n,r,i,s){var o=-1,u=i&we,c=i&be,l=t.length,h=e.length;if(l!=h&&!(u&&h>l))return!1;var f=s.get(t);if(f)return f==e;var d=!0;for(s.set(t,e);++o-1&&t%1==0&&Ee>=t}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return!!t&&"object"==typeof t}function Qt(t){return null==t?!1:Ht(t)?Tn.test(jn.call(t)):Wt(t)&&(l(t)?Tn:hn).test(t)}function Zt(t){return"number"==typeof t||Wt(t)&&$n.call(t)==Te}function Jt(t){return"string"==typeof t||!ar(t)&&Wt(t)&&$n.call(t)==Pe}function Kt(t){return"symbol"==typeof t||Wt(t)&&$n.call(t)==Be}function te(t){return Wt(t)&&Vt(t.length)&&!!pn[$n.call(t)]}function ee(t){return t===ge}function ne(t){if(Gt(t)){var e=Ht(t.valueOf)?t.valueOf():t;t=Gt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(sn,"");var n=ln.test(t);return n||fn.test(t)?yn(t.slice(2),n?2:8):cn.test(t)?Se:+t}function re(t){if("string"==typeof t)return t;if(null==t)return"";if(Kt(t))return tr?tr.call(t):"";var e=t+"";return"0"==e&&1/t==-Ae?"-0":e}function ie(t,e,n){var r=null==t?ge:F(t,e);return r===ge?n:r}function ae(t,e){return Ot(t,e,V)}function se(t){var e=zt(t);if(!e&&!qt(t))return J(t);var n=Nt(t),r=!!n,i=n||[],a=i.length;for(var s in t)!H(t,s)||r&&("length"==s||h(s,a))||e&&"constructor"==s||i.push(s);return i}function oe(t){return o(t,se(t))}function ue(t){return t=re(t),t&&Ke.test(t)?t.replace(Ze,c):t}function ce(t){return t=re(t),t&&an.test(t)?t.replace(rn,"\\$&"):t}function le(){var t=arguments,e=re(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function he(t){return t=re(t),t&&Je.test(t)?t.replace(Qe,p):t}function fe(t){return function(){return t}}function de(t){return t}function pe(t){return Z("function"==typeof t?t:Y(t,!0))}function me(t){return Tt(t)?nt(t):rt(t)}var ge,ve="4.6.1",xe=200,ye="__lodash_hash_undefined__",be=1,we=2,Ae=1/0,Ee=9007199254740991,Se=NaN,Ce="[object Arguments]",_e="[object Array]",Oe="[object Boolean]",Me="[object Date]",Le="[object Error]",je="[object Function]",Ne="[object GeneratorFunction]",$e="[object Map]",Te="[object Number]",ke="[object Object]",ze="[object RegExp]",Ie="[object Set]",Pe="[object String]",Be="[object Symbol]",Re="[object WeakMap]",Ue="[object ArrayBuffer]",Xe="[object Float32Array]",Ye="[object Float64Array]",De="[object Int8Array]",qe="[object Int16Array]",Fe="[object Int32Array]",He="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Ge="[object Uint16Array]",We="[object Uint32Array]",Qe=/&(?:amp|lt|gt|quot|#39|#96);/g,Ze=/[&<>"'`]/g,Je=RegExp(Qe.source),Ke=RegExp(Ze.source),tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,en=/^\w*$/,nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,rn=/[\\^$.*+?()[\]{}|]/g,an=RegExp(rn.source),sn=/^\s+|\s+$/g,on=/\\(\\)?/g,un=/\w*$/,cn=/^[-+]0x[0-9a-f]+$/i,ln=/^0b[01]+$/i,hn=/^\[object .+?Constructor\]$/,fn=/^0o[0-7]+$/i,dn=/^(?:0|[1-9]\d*)$/,pn={};pn[Xe]=pn[Ye]=pn[De]=pn[qe]=pn[Fe]=pn[He]=pn[Ve]=pn[Ge]=pn[We]=!0,pn[Ce]=pn[_e]=pn[Ue]=pn[Oe]=pn[Me]=pn[Le]=pn[je]=pn[$e]=pn[Te]=pn[ke]=pn[ze]=pn[Ie]=pn[Pe]=pn[Re]=!1;var mn={};mn[Ce]=mn[_e]=mn[Ue]=mn[Oe]=mn[Me]=mn[Xe]=mn[Ye]=mn[De]=mn[qe]=mn[Fe]=mn[$e]=mn[Te]=mn[ke]=mn[ze]=mn[Ie]=mn[Pe]=mn[Be]=mn[He]=mn[Ve]=mn[Ge]=mn[We]=!0,mn[Le]=mn[je]=mn[Re]=!1;var gn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},vn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},xn={"function":!0,object:!0},yn=parseInt,bn=xn[typeof exports]&&exports&&!exports.nodeType?exports:ge,wn=xn[typeof module]&&module&&!module.nodeType?module:ge,An=wn&&wn.exports===bn?bn:ge,En=u(bn&&wn&&"object"==typeof global&&global),Sn=u(xn[typeof self]&&self),Cn=u(xn[typeof window]&&window),_n=u(xn[typeof this]&&this),On=En||Cn!==(_n&&_n.window)&&Cn||Sn||_n||Function("return this")(),Mn=Array.prototype,Ln=Object.prototype,jn=Function.prototype.toString,Nn=Ln.hasOwnProperty,$n=Ln.toString,Tn=RegExp("^"+jn.call(Nn).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kn=An?On.Buffer:ge,zn=On.Symbol,In=On.Uint8Array,Pn=Object.getPrototypeOf,Bn=Object.getOwnPropertySymbols,Rn=Object.create,Un=Ln.propertyIsEnumerable,Xn=Mn.splice,Yn=Math.ceil,Dn=Object.keys,qn=Math.max,Fn=Ct(On,"Map"),Hn=Ct(On,"Set"),Vn=Ct(On,"WeakMap"),Gn=Ct(Object,"create"),Wn=Fn?jn.call(Fn):"",Qn=Hn?jn.call(Hn):"",Zn=Vn?jn.call(Vn):"",Jn=zn?zn.prototype:ge,Kn=Jn?Jn.valueOf:ge,tr=Jn?Jn.toString:ge,er=vt(q),nr=xt(),rr=nt("length"),ir=Bn||function(){return[]};(Fn&&_t(new Fn)!=$e||Hn&&_t(new Hn)!=Ie||Vn&&_t(new Vn)!=Re)&&(_t=function(t){var e=$n.call(t),n=e==ke?t.constructor:null,r="function"==typeof n?jn.call(n):"";if(r)switch(r){case Wn:return $e;case Qn:return Ie;case Zn:return Re}return e});var ar=Array.isArray,sr=kn?function(t){return t instanceof kn}:fe(!1),or=yt();g.prototype=Gn?Gn(null):Ln,w.prototype.clear=A,w.prototype["delete"]=E,w.prototype.get=S,w.prototype.has=C,w.prototype.set=_,O.prototype.clear=M,O.prototype["delete"]=L,O.prototype.get=j,O.prototype.has=N,O.prototype.set=$,m.constant=fe,m.iteratee=pe,m.keys=se,m.map=Xt,m.property=me,m.range=or,m.toPairs=oe,m.eq=Yt,m.escape=ue,m.escapeRegExp=ce,m.forEach=Ut,m.get=ie,m.hasIn=ae,m.identity=de,m.isArguments=Dt,m.isArray=ar,m.isArrayLike=qt,m.isArrayLikeObject=Ft,m.isBuffer=sr,m.isFunction=Ht,m.isLength=Vt,m.isNative=Qt,m.isNumber=Zt,m.isObject=Gt,m.isObjectLike=Wt,m.isString=Jt,m.isSymbol=Kt,m.isTypedArray=te,m.isUndefined=ee,m.last=Rt,m.replace=le,m.toNumber=ne,m.toString=re,m.unescape=he,m.each=Ut,m.VERSION=ve,(Cn||Sn||{})._=m,On._=m}.call(this),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 r=n;n.match(/^\{.*\}$/)||(n="{"+n+"}");var i=new RegExp(_.escapeRegExp(n),"g");t=t.replace(i,e[r])}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(){$(this).hasClass("no-close")||t.hide(this)}),$(".Dialog").on("click",function(t){t.stopImmediatePropagation()}),$(window).on("keydown",function(e){27==e.which&&t.hide(".Modal")})},t}(),notify=function(){var t={},e="#notif";return t.show=function(n,r){$(e).html(n),modal.show(e),_.isUndefined(r)||setTimeout(t.hide,r)},t.hide=function(){var t=$(e);t.removeClass("visible"),setTimeout(function(){t.addClass("hidden")},250)},t.init=function(){$(e).on("click",function(){t.hide(this)})},t}();$().ready(function(){setInterval(function(){$(".anim-dots").each(function(t){var e=$(t),n=e.html()+".";5==n.length&&(n="."),e.html(n)})},1e3),$("input[type=number]").on("mousewheel",function(t){var e=+$(this).val(),n=+($(this).attr("step")||1),r=$(this).attr("min"),i=$(this).attr("max");t.wheelDelta>0?e+=n:e-=n,_.isUndefined(r)||(e=Math.max(e,r)),_.isUndefined(i)||(e=Math.min(e,i)),$(this).val(e),t.preventDefault()}),modal.init(),notify.init()});var page_wifi=function(){function t(t,e){if(200!=e)return void n(5e3);t=JSON.parse(t);var a=!bool(t.result.inProgress)&&t.result.APs.length>0;if(n(a?15e3:1e3),a){var s=$("#ap-list");$(".AP").remove(),s.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 e=document.createElement("div"),n=$(e).data("ssid",t.essid).data("pwd",0!=t.enc).addClass("AP");t.essid==r.current&&n.addClass("selected");var a=document.createElement("div");$(a).addClass("inner").htmlAppend('
{0}
'.format(t.rssi_perc)).htmlAppend('
{0}
'.format(_.escape(t.essid))).htmlAppend('
{0}
'.format(i[t.enc]));n.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()}),e.appendChild(a),s[0].appendChild(e)}})}}function e(){$().get(_root+"/wifi/scan",t)}function n(t){setTimeout(e,t)}var r={},i=["Open","WEP","WPA","WPA2","WPA/WPA2"];return r.init=function(){e()},r}(),page_waveform=function(){function t(t){var e,n,r=window.matchMedia("screen and (min-width: 544px)"),i=!r.matches,s="FFT"==t.stats.format;s?(e="Frequency - [ Hz ]",n="Magnitude - [ mA ]"):(e="Sample time - [ ms ]",n="Current - [ mA ]");var o=Math.max(-t.stats.min,t.stats.max),l=Math.max(o,10);$("#stat-count").html(t.stats.count),$("#stat-f-s").html(numfmt(t.stats.freq,2)),$("#stat-i-peak").html(numfmt(o,2)),$("#stat-i-rms").html(numfmt(t.stats.rms,2)),$(".stats").removeClass("invis");var h=s?t.stats.freq/t.stats.count:1e3/t.stats.freq,f=_.map(t.samples,function(t,e){return{x:e*h,y:t}}),d=[Chartist.plugins.zoom({ resetOnRightMouseBtn:!0,onZoom:function(t,e){a=e,u=t.options.axisX.highLow,c=t.options.axisY.highLow}})];i||d.push(Chartist.plugins.ctAxisTitle({axisX:{axisTitle:e,offset:{x:0,y:55}},axisY:{axisTitle:n,flipText:!0,offset:{x:0,y:15}}}));var p,m,g,v;u?(p=u.high,m=u.low,g=c.high,v=c.low):(g=s?void 0:l,v=s?0:-l),new Chartist.Line("#chart",{series:[{name:"a",data:f}]},{showPoint:!1,showArea:s,fullWidth:!0,chartPadding:i?{right:20,bottom:5,left:0}:{right:25,bottom:30,left:25},series:{a:{lineSmooth:Chartist.Interpolation.monotoneCubic()}},axisX:{type:Chartist.AutoScaleAxis,high:p,low:m},axisY:{type:Chartist.AutoScaleAxis,high:g,low:v},explicitBounds:{xLow:0,yLow:s?0:void 0,xHigh:f[f.length-1].x},plugins:d})}function e(e,n){if(h=!1,200!=n)errorMsg("Request failed.",1e3),f&&i();else{var a=JSON.parse(e);if(!a.success)return errorMsg("Sampling failed.",1e3),void(f&&i());t(a),f&&(p=setTimeout(r,Math.max(0,d-msElapsed(o))))}}function n(){m.count=$("#count").val(),m.freq=$("#freq").val()*("fft"==s?2:1)}function r(){if(h)return!1;h=!0,o=msNow();var t=m.count,n=m.freq,r=_root+"/measure/"+s+"?n="+t+"&fs="+n;return $().get(r,e,estimateLoadTime(n,t)),!0}function i(){d=+$("#ar-time").val(),n(),f=!f,f?r():clearTimeout(p),$("#ar-btn").toggleClass("btn-blue").toggleClass("btn-red").val(f?"Stop":"Auto")}var a,s,o,u,c,l={},h=!1,f=!1,d=1,p=-1,m={count:0,freq:0};return l.init=function(t){function e(){n(),r()}s=t,$("#load").on("click",e),$("#count,#freq").on("keyup",function(t){13==t.which&&e()}),$("#chart").on("contextmenu",function(t){return a&&a(),a=null,u=null,c=null,t.preventDefault(),!1}),$("#ar-btn").on("click",i)},l}(),page_spectrogram=function(){function t(t,e){var n,r,i,a;t/=6,t>1&&(t=1),0>t&&(t=0);for(var s=0;s=o.x&&(n=o.x,i=o.b),t<=o.x&&(r=o.x,a=o.b)}return Math.round(255*(i+(a-i)*((t-n)/(r-n))))}function e(e){var n=e,r=t(n,m.r),i=t(n,m.g),a=t(n,m.b);return"rgb("+r+","+i+","+a+")"}function n(){var t=s.getImageData(f.x+f.dx,f.y,f.w-f.dx,f.h);s.putImageData(t,f.x,f.y)}function r(t){n();for(var r=d.sampCount/2,i=0;r>i;i++){var a,o=r-i-1;a=i>t.length?"#000":e(t[i]),s.fillStyle=a,s.fillRect(f.x+f.w-f.dx,f.y+o*f.dy,f.dx,f.dy)}}function i(t,e){if(u=!1,200==e)try{var n=JSON.parse(t);n.success?r(n.samples):errorMsg("Sampling failed.",1e3)}catch(i){errorMsg(i)}else errorMsg("Request failed.",1e3);p&&(o=setTimeout(a,Math.max(0,d.interval-msElapsed(l))))}function a(){u&&(errorMsg("Request already pending - aborting."),c.abort()),u=!0,l=msNow();var t=d.freq,e=d.sampCount,n=_root+"/measure/fft?n="+e+"&fs="+t;return c=$().get(n,i,estimateLoadTime(t,e)),!0}var s,o,u,c,l,h={},f={x:0,y:0,w:860,h:512,dx:1,dy:1},d={interval:0,sampCount:0,binCount:0,freq:0},p=!1,m={r:[{x:0,b:0},{x:.7,b:0},{x:1,b:1}],g:[{x:0,b:0},{x:.3,b:0},{x:.7,b:1},{x:1,b:1}],b:[{x:0,b:0},{x:.02,b:.3},{x:.3,b:1},{x:1,b:1}]};return h.init=function(){var t=$("#sg")[0];s=t.getContext("2d"),s.fillStyle="#000",s.fillRect(f.x,f.y,f.w,f.h),$("#go-btn").on("click",function(){d.interval=+$("#interval").val(),d.freq=2*$("#freq").val(),d.sampCount=$("#count").val(),f.dx=f.dy=f.h/(d.sampCount/2),p=!p,p?a():clearTimeout(o),$("#go-btn").toggleClass("btn-green").toggleClass("btn-red").html(p?"Stop":"Start")})},h}(),page_status=function(){function t(t,a){if(200!=a)errorMsg("Update failed.");else try{var s=JSON.parse(t);n.j=s,$(".sta-only").toggle(s.sta),$(".ap-only").toggle(s.ap),$("#uptime").html(s.uptime),$("#heap").html(s.heap+" bytes"),$("#wmode").html(s.wifiMode),s.sta&&($("#staSSID").html(s.sta.SSID),$("#staRSSIperc").html(s.sta.RSSIperc),$("#staRSSI").html(s.sta.RSSI),$("#staMAC").html(s.sta.MAC)),s.ap&&($("#apSSID").html(s.ap.SSID),$("#apHidden").html(s.ap.hidden?"Yes":"No"),$("#apAuth").html(s.ap.auth),$(".ap-auth-only").toggle("Open"!=s.ap.auth),$("#apPwd").html(s.ap.pwd),$("#apChan").html(s.ap.chan),$("#apMAC").html(s.ap.MAC))}catch(o){errorMsg(o)}i||setTimeout(e,r)}function e(){$().get(_root+"/system/status",t)}var n={};n.j={};var r=1e4,i=!1;return n.trigReset=function(){var t="#reset-modal";$().get(_root+"/system/reset",function(n,r){if(200==r){modal.show(t),i=!0;var a=setInterval(function(){$().get(_root+"/system/ping",function(n,r){200==r&&(modal.hide(t),e(),clearInterval(a),i=!1)},{timeout:500})},1e3)}})},n.init=function(){e()},n}(); \ No newline at end of file diff --git a/user/routes.c b/user/routes.c index 889c63b..a836f9e 100644 --- a/user/routes.c +++ b/user/routes.c @@ -53,6 +53,7 @@ HttpdBuiltInUrl builtInUrls[] = { ROUTE_TPL_FILE("/about", tplAbout, "/pages/about.tpl"), ROUTE_FILE("/waveform", "/pages/wfm.html"), // static file, html -> can use gzip ROUTE_FILE("/fft", "/pages/fft.html"), // static file, html -> can use gzip + ROUTE_FILE("/spectrogram", "/pages/sgm.html"), // static file, html -> can use gzip // --- WiFi config --- #if WIFI_PROTECT