galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
August 2014
- 1 participants
- 159 discussions
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f2a70e7bac29/
Changeset: f2a70e7bac29
Branch: next-stable
User: natefoo
Date: 2014-08-11 22:46:18
Summary: Close next-stable for upcoming release_2014.08.11
Affected #: 0 files
https://bitbucket.org/galaxy/galaxy-central/commits/2a2fcdf2af77/
Changeset: 2a2fcdf2af77
Branch: stable
User: natefoo
Date: 2014-08-11 22:46:48
Summary: Updated tag latest_2014.06.02 for changeset 7a4d321c0e38
Affected #: 1 file
diff -r 7a4d321c0e38fa263ea83d29a35a608c3181fcba -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -8,7 +8,7 @@
5e605ed6069fe4c5ca9875e95e91b2713499e8ca release_2014.02.10
9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14
7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02
-8c30e91bc9ae19ee4dc7ec2c22fa825979497108 latest_2014.06.02
+7a4d321c0e38fa263ea83d29a35a608c3181fcba latest_2014.06.02
9661b9d5d5b330483ae3ad2236410e0efaa7c500 latest_2014.04.14
6b0bd93038a843b1585155f0d63f0eea2459c70b latest_2013.01.13
3e62060b14b9afc46f8e0ec02e1a4500d77db9e1 latest_2013.02.08
https://bitbucket.org/galaxy/galaxy-central/commits/ca45b78adb41/
Changeset: ca45b78adb41
Branch: stable
User: natefoo
Date: 2014-08-11 22:47:21
Summary: Merge next-stable branch for release_2014.08.11
Affected #: 624 files
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -11,8 +11,12 @@
scripts/scramble/lib
scripts/scramble/archives
+# Python virtualenv
+.venv
+
# Database stuff
database/beaker_sessions
+database/citations
database/community_files
database/compiled_templates
database/files
@@ -35,6 +39,7 @@
tool_shed_webapp.log
tool_shed_webapp.pid
hgweb.config*
+lib/tool_shed/scripts/bootstrap_tool_shed/user_info.xml
# Reports Runtime Files
reports_webapp.lock
@@ -61,6 +66,7 @@
data_manager_conf.xml
shed_data_manager_conf.xml
object_store_conf.xml
+job_metrics_conf.xml
config/*
static/welcome.html.*
static/welcome.html
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 buildbot_setup.sh
--- a/buildbot_setup.sh
+++ b/buildbot_setup.sh
@@ -58,6 +58,7 @@
tool-data/shared/rviewer/rviewer_build_sites.txt.sample
tool-data/shared/ucsc/builds.txt.sample
tool-data/shared/ucsc/publicbuilds.txt.sample
+tool-data/shared/ucsc/ucsc_build_sites.txt.sample
"
DIRS="
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/app.js
--- a/config/plugins/visualizations/charts/static/app.js
+++ b/config/plugins/visualizations/charts/static/app.js
@@ -1,26 +1,26 @@
// dependencies
define(['mvc/ui/ui-modal', 'mvc/ui/ui-portlet', 'plugin/library/ui', 'utils/utils',
- 'plugin/library/jobs', 'plugin/library/datasets', 'plugin/library/storage',
+ 'plugin/library/jobs', 'plugin/library/datasets', 'plugin/library/storage', 'plugin/library/deferred',
'plugin/views/viewer', 'plugin/views/editor',
'plugin/models/config', 'plugin/models/chart',
'plugin/charts/types'],
- function( Modal, Portlet, Ui, Utils, Jobs, Datasets, Storage,
+ function( Modal, Portlet, Ui, Utils, Jobs, Datasets, Storage, Deferred,
ViewerView, EditorView,
Config, Chart, Types
) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * Main application class.
+ */
+return Backbone.View.extend({
// initialize
- initialize: function(options)
- {
+ initialize: function(options){
// deactivate all debugs outputs
//window.console.debug = function() {};
// link options
this.options = options;
-
+
// link galaxy modal or create one
if (Galaxy && Galaxy.modal) {
this.modal = Galaxy.modal;
@@ -41,6 +41,7 @@
this.jobs = new Jobs(this);
this.datasets = new Datasets(this);
this.storage = new Storage(this);
+ this.deferred = new Deferred();
//
// views
@@ -62,7 +63,7 @@
// draw chart
var self = this;
- this.chart.deferred.execute(function() {
+ this.deferred.execute(function() {
self.chart.trigger('redraw');
});
}
@@ -100,19 +101,6 @@
console.debug('FAILED App:chartPath() - Invalid format: ' + chart_type);
}
return undefined;
- },
-
- // execute command
- execute: function(options) {
- },
-
- // unload
- onunload: function() {
- },
-
- // log
- log: function(location, message) {
- console.log(location + ' ' + message);
}
});
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/build-app.js
--- a/config/plugins/visualizations/charts/static/build-app.js
+++ b/config/plugins/visualizations/charts/static/build-app.js
@@ -3,4 +3,4 @@
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
-define("mvc/ui/ui-modal",[],function(){var e=Backbone.View.extend({elMain:"body",optionsDefault:{title:"ui-modal",body:"",backdrop:!0,height:null,width:null,closing_events:!1,closing_callback:null},buttonList:{},initialize:function(e){e&&this._create(e)},show:function(e){this.initialize(e),this.options.height?(this.$body.css("height",this.options.height),this.$body.css("overflow","hidden")):this.$body.css("max-height",$(window).height()/2),this.options.width&&this.$dialog.css("width",this.options.width),this.visible?this.$el.show():this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.visible=!1,this.$el.fadeOut("fast"),this.options.closing_callback&&this.options.closing_callback()},enableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!1)},disableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!0)},showButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).show()},hideButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).hide()},getButton:function(e){var t=this.buttonList[e];return this.$buttons.find("#"+t)},scrollTop:function(){return this.$body.scrollTop()},_create:function(e){var t=this;this.options=_.defaults(e,this.optionsDefault),this.options.body=="progress"&&(this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')),this.$el&&(this.$el.remove(),$(document).off("keyup.ui-modal")),this.setElement(this._template(this.options.title)),this.$dialog=this.$el.find(".modal-dialog"),this.$body=this.$el.find(".modal-body"),this.$footer=this.$el.find(".modal-footer"),this.$buttons=this.$el.find(".buttons"),this.$backdrop=this.$el.find(".modal-backdrop"),this.$body.html(this.options.body),this.options.backdrop||this.$backdrop.removeClass("in");if(this.options.buttons){this.buttonList={};var n=0;$.each(this.options.buttons,function(e,r){var i="button-"+n++;t.$buttons.append($('<button id="'+i+'"></button>').text(e).click(r)).append(" "),t.buttonList[e]=i})}else this.$footer.hide();$(this.elMain).append($(this.el)),this.options.closing_events&&($(document).on("keyup.ui-modal",function(e){e.keyCode==27&&t.hide()}),this.$el.find(".modal-backdrop").on("click",function(){t.hide()}))},_template:function(e){return'<div class="ui-modal modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+e+"</h4>"+"</div>"+'<div class="modal-body" style="position: static;"></div>'+'<div class="modal-footer">'+'<div class="buttons" style="float: right;"></div>'+"</div>"+"</div"+"</div>"+"</div>"}});return{View:e}}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t==null?x.identity:t);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.unzip=function(e){var t=[];return x.each(e,function(e,n){x.each(e,function(e,r){t.length<=r&&(t[r]=[]),t[r][n]=e})}),t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o,u=0,a=function(){u=new Date,s=null,o=e.apply(r,i)};return function(){var f=new Date;!u&&n===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(s),s=null,u=f,o=e.apply(r,i)):s||(s=setTimeout(a,l)),o}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("libs/underscore",function(e){return function(){var t,n;return t||e._}}(this)),define("utils/utils",["libs/underscore"],function(e){function t(e,t,r){n("GET",e,{},t,r)}function n(e,t,n,r,i){if(e=="GET"||e=="DELETE")t.indexOf("?")==-1?t+="?":t+="&",t+=$.param(n);var s=new XMLHttpRequest;s.open(e,t,!0),s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Cache-Control","no-cache"),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("Content-Type","application/json"),s.onloadend=function(){var e=s.status;try{response=jQuery.parseJSON(s.responseText)}catch(t){response=s.responseText}e==200?r&&r(response):i&&i(response)},e=="GET"||e=="DELETE"?s.send():s.send(JSON.stringify(n))}function r(e,t){var n=$('<div class="'+e+'"></div>');n.appendTo(":eq(0)");var r=n.css(t);return n.remove(),r}function i(e){$('link[href^="'+e+'"]').length||$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}function s(t,n){return t?e.defaults(t,n):n}function o(e,t){var n="";if(e>=1e11)e/=1e11,n="TB";else if(e>=1e8)e/=1e8,n="GB";else if(e>=1e5)e/=1e5,n="MB";else if(e>=100)e/=100,n="KB";else{if(!(e>0))return"<strong>-</strong>";e*=10,n="b"}var r=Math.round(e)/10;return t?r+" "+n:"<strong>"+r+"</strong> "+n}function u(){return"x"+Math.random().toString(36).substring(2,9)}function a(e){var t=$("<p></p>");return t.append(e),t}function f(){var e=new Date,t=(e.getHours()<10?"0":"")+e.getHours(),n=(e.getMinutes()<10?"0":"")+e.getMinutes(),r=e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+", "+t+":"+n;return r}return{cssLoadFile:i,cssGetAttribute:r,get:t,merge:s,bytesToString:o,uuid:u,time:f,wrap:a,request:n}}),define("mvc/ui/ui-portlet",["utils/utils"],function(e){var t=Backbone.View.extend({visible:!1,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,placement:"bottom"},$title:null,$content:null,$buttons:null,$operations:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$content=this.$el.find("#content"),this.$title=this.$el.find("#portlet-header-text");var n=this.$el.find("#portlet-content");this.options.scrollable?n.addClass("scroll"):this.options.title?n.addClass("no-scroll"):n.addClass("no-scroll-no-title"),this.options.nopadding&&(n.css("padding","0px"),this.$content.css("padding","0px")),this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var r=this;$.each(this.options.buttons,function(e,t){t.$el.prop("id",e),r.$buttons.append(t.$el)})}else this.$buttons.remove();this.$operations=$(this.el).find("#operations");if(this.options.operations){var r=this;$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$operations.append(t.$el)})}this.options.body&&this.append(this.options.body)},append:function(t){this.$content.append(e.wrap(t))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){var n=this.$operations.find("#"+e);n.off("click"),n.on("click",t)},title:function(e){var t=this.$title;return e&&t.html(e),t.html()},_template:function(e){var t='<div class="ui-portlet">';return e.title&&(t+='<div id="portlet-header" class="portlet-header"><div id="operations" style="float: right;"></div><h3>',e.icon&&(t+='<i class="icon fa '+e.icon+'"> </i>'),t+='<span id="portlet-header-text">'+e.title+"</span>"+"</h3>"+"</div>"),t+='<div id="portlet-content" class="portlet-content">',e.placement=="top"&&(t+='<div id="buttons" class="buttons"></div>'),t+='<div id="content" class="content"></div>',e.placement=="bottom"&&(t+='<div id="buttons" class="buttons"></div>'),t+="</div></div>",t}});return{View:t}}),define("plugin/library/ui-select",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:!0,wait:!1},selected:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.selected=this.options.value,this.setElement(this._template(this.options)),this.$select=this.$el.find("#select"),this.$icon=this.$el.find("#icon");var n=this;this.$select.on("change",function(){n.value(n.$select.val())}),this.on("change",function(){n.options.onchange&&n.options.onchange(n.value())}),this._refresh(),this.options.visible||this.hide(),this.options.wait?this.wait():this.show()},value:function(e){var t=this.selected;e!==undefined&&(this.selected=e,this.$select.val(e));var n=this.selected;return n&&n!=t&&this.options.onchange&&this.options.onchange(n),n},first:function(){var e=this.$select.find("option");return e.length>0?e.val():undefined},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-caret-down"),this.$select.show(),this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-spinner fa-spin"),this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",!1)},disable:function(){this.$select.prop("disabled",!0)},add:function(e){this.$select.append(this._templateOption(e)),this._refresh()},del:function(e){this.$select.find("option[value="+e+"]").remove(),this.$select.trigger("change"),this._refresh()},update:function(e){this.$select.find("option").remove();for(var t in e)this.$select.append(this._templateOption(e[t]));this._refresh()},setOnChange:function(e){this.options.onchange=e},exists:function(e){return this.$select.find("option[value="+e+"]").length>0},_refresh:function(){this.$select.find("option[value=null]").remove();var e=this.$select.find("option").length;e==0?(this.disable(),this.$select.append(this._templateOption({value:"null",label:this.options.empty}))):this.enable(),this.selected&&this.$select.val(this.selected)},_templateOption:function(e){return'<option value="'+e.value+'">'+e.label+"</option>"},_template:function(e){var t='<div id="'+e.id+'" class="ui-select">'+'<div class="button">'+'<i id="icon"/>'+"</div>"+'<select id="select" class="select '+e.cls+" "+e.id+'">';for(key in e.data){var n=e.data[key],r="";if(n.value==e.value||n.value=="")r="selected";t+='<option value="'+n.value+'" '+r+">"+n.label+"</option>"}return t+="</select></div>",t}});return{View:t}}),define("plugin/library/ui-button-menu",["utils/utils"],function(e){return Backbone.View.extend({optionsDefault:{id:"",title:"","float":"right",icon:null,onclick:null,cls:"icon-btn",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""},$menu:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement($(this._template(this.options)));var n=$(this.el).find(".root"),r=this;n.on("click",function(e){$(".tooltip").hide(),e.preventDefault(),r.options.onclick&&r.options.onclick()}),this.options.visible||this.hide(),n.tooltip({title:t.tooltip,placement:"bottom"})},show:function(){$(this.el).show()},hide:function(){$(this.el).hide()},addMenu:function(t){var n={title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"};n=e.merge(t,n),this.$menu||($(this.el).append(this._templateMenu()),this.$menu=$(this.el).find(".menu"));var r=$(this._templateMenuItem(n));r.on("click",function(e){e.preventDefault(),n.onclick&&n.onclick()}),this.$menu.append(r),n.divider&&this.$menu.append($(this._templateDivider()))},_templateMenuItem:function(e){var t='<li><a href="'+e.href+'" target="'+e.target+'">';return e.icon&&(t+='<i class="fa '+e.icon+'"></i>'),t+=" "+e.title+"</a>"+"</li>",t},_templateMenu:function(){return'<ul class="menu dropdown-menu pull-right" role="menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.float+"; "+t+'" class="ui-button-icon dropdown '+e.cls+'">';return e.title?n+='<div class="root button dropdown-toggle" data-toggle="dropdown"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}})}),define("plugin/library/ui",["utils/utils","plugin/library/ui-select","plugin/library/ui-button-menu","mvc/ui/ui-modal"],function(e,t,n,r){var i=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},_template:function(e){return'<img class="ui-image '+e.cls+'" src="'+e.url+'"/>'}}),s=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},title:function(e){this.$el.html(e)},_template:function(e){return'<label class="ui-label '+e.cls+'">'+e.title+"</label>"},value:function(){return options.title}}),o=Backbone.View.extend({optionsDefault:{"float":"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){return'<div><span class="fa '+e.icon+'" class="ui-icon"/> '+e.title+"</div>"}}),u=Backbone.View.extend({optionsDefault:{id:null,title:"","float":"right",cls:"btn btn-default",icon:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t='<button id="'+e.id+'" type="submit" style="float: '+e.float+';" type="button" class="ui-button '+e.cls+'">';return e.icon&&(t+='<i class="icon fa '+e.icon+'"></i> '),t+=e.title+"</button>",t}}),a=Backbone.View.extend({optionsDefault:{id:null,title:"","float":"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.float+"; "+t+'" class="ui-button-icon '+e.cls+'">';return e.title?n+='<div class="button"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}}),f=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick)},_template:function(e){return'<div><a href="javascript:void(0)" class="ui-anchor '+e.cls+'">'+e.title+"</a></div>"}}),l=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement("<div></div>")},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options)),this.$el.find(".alert").append(t.message),this.$el.fadeIn();if(!t.persistent){var n=this;window.setTimeout(function(){n.$el.is(":visible")?n.$el.fadeOut():n.$el.hide()},3e3)}}else this.$el.fadeOut()},_template:function(e){return'<div class="ui-message alert alert-'+e.status+'"/>'}}),c=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options));var n=this;this.options.onclick&&this.$el.on("submit",function(e){var t=n.$el.find("#search");n.options.onclick(t.val())})},_template:function(e){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+e.searchword+'">'+'<button type="submit" class="btn search-btn">'+'<i class="fa fa-search"></i>'+"</button>"+"</form>"+"</div>"}}),h=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:!1,visible:!0,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return'<input id="'+e.id+'" type="'+e.type+'" value="'+e.value+'" placeholder="'+e.placeholder+'" class="ui-input '+e.cls+'">'}}),p=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:!1,visible:!0,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return'<textarea id="'+e.id+'" class="ui-textarea '+e.cls+'" rows="5"></textarea>'}}),d=Backbone.View.extend({optionsDefault:{value:"",visible:!0,cls:"",data:[],id:e.uuid()},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.visible||this.$el.hide(),this.options.value&&this.value(this.options.value),this.current=this.options.value;var n=this;this.$el.find("input").on("change",function(){n.value(n._getValue())})},value:function(e){var t=this.current;e!==undefined&&(this.$el.find("label").removeClass("active"),this.$el.find('[value="'+e+'"]').closest("label").addClass("active"),this.current=e);var n=this.current;return n!=t&&this.options.onchange&&this.options.onchange(this.current),this.current},_getValue:function(){var e=this.$el.find(":checked"),t=null;return e.length>0&&(t=e.val()),t},_template:function(e){var t='<div class="btn-group ui-radiobutton" data-toggle="buttons">';for(key in e.data){var n=e.data[key];t+='<label class="btn btn-default"><input type="radio" name="'+e.id+'" value="'+n.value+'" selected>'+n.label+"</label>"}return t+="</div>",t}});return{Label:s,Button:u,Icon:o,ButtonIcon:a,Input:h,Anchor:f,Message:l,Searchbox:c,Select:t,ButtonMenu:n,Modal:r,Textarea:p,Image:i,RadioButton:d}}),define("plugin/library/jobs",["utils/utils"],function(e){return Backbone.Model.extend({initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e,t,n,r,i){var s=this;e.state("wait","Requesting job results...");var o=e.get("dataset_id_job");o!=""?s._wait(e,r,i):s._submit(e,t,n,r,i)},cleanup:function(t){var n=this,r=t.get("dataset_id_job");r!=""&&(e.request("PUT",config.root+"api/histories/none/contents/"+r,{deleted:!0},function(){n._refreshHdas()}),t.set("dataset_id_job",""))},_submit:function(t,n,r,i,s){var o=this,u=t.id,a=t.get("type"),f=t.definition;data={tool_id:"charts",inputs:{input:{id:t.get("dataset_id"),src:"hda"},module:f.execute,columns:r,settings:n}},t.state("wait","Sending job request..."),e.request("POST",config.root+"api/tools",data,function(e){if(!e.outputs||e.outputs.length==0)t.state("failed","Job submission failed. No response."),s&&s();else{o._refreshHdas();var n=e.outputs[0];t.state("wait","Your job has been queued. You may close the browser window. The job will run in the background."),t.set("dataset_id_job",n.id),this.app.storage.save(),o._wait(t,i,s)}},function(e){var n="";e&&e.message&&e.message.data&&e.message.data.input&&(n=e.message.data.input+"."),t.state("failed","This visualization requires the 'charts' tool. Please make sure it is installed. "+n),s&&s()})},_wait:function(t,n,r){var i=this;e.request("GET",config.root+"api/datasets/"+t.get("dataset_id_job"),{},function(e){var s=!1;switch(e.state){case"ok":t.state("wait","Job completed successfully..."),n&&n(e),s=!0;break;case"error":t.state("failed","Job has failed. Please check the history for details."),r&&r(e),s=!0;break;case"running":t.state("wait","Your job is running. You may close the browser window. The job will continue in the background.")}s||setTimeout(function(){i._wait(t,n,r)},i.app.config.get("query_timeout"))})},_refreshHdas:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.refreshContents()}})}),define("plugin/library/datasets",["utils/utils"],function(e){return Backbone.Collection.extend({list:{},cache:{},initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e){e.groups?this._get_blocks(e):this._get_dataset(e.id,e.success,e.error)},_get_blocks:function(e){function h(i){c._get(i,function(){var s=!1;for(var o in e.groups){destination_group=e.groups[o],source_group=i.groups[o],destination_group.values||(destination_group.values=[]),destination_group.values=destination_group.values.concat(source_group.values);if(source_group.values.length==0){s=!0;break}}if(++l<a&&!s){n&&n(parseInt(l/a*100));var u=i.start+r;i=$.extend(!0,f,{start:u}),h(i)}else t()})}var t=e.success,n=e.progress,r=this.app.config.get("query_limit"),i=this.app.config.get("query_timeout"),s=e.start||0,o=s+e.query_limit||s+this.app.config.get("query_limit"),u=Math.abs(o-s);if(u<=0){console.debug("FAILED - Datasets::request() - Invalid query range.");return}var a=Math.ceil(u/r)||1,f=$.extend(!0,{},e),l=0,c=this,p=$.extend(!0,f,{start:s});this._get_dataset(e.id,function(){h(p)})},_get_dataset:function(t,n,r){var i=this.list[t];if(i){n(i);return}var s=this;e.request("GET",config.root+"api/datasets/"+t,{},function(e){switch(e.state){case"error":r&&r(e);break;default:s.list[t]=e,n(e)}})},_block_id:function(e,t){return e.id+"_"+e.start+"_"+e.start+this.app.config.get("query_limit")+"_"+t},_get:function(e,t){e.start=e.start||0;var n=[],r={},i=0;for(var s in e.groups){var o=e.groups[s];for(var u in o.columns){var a=o.columns[u].index,f=this._block_id(e,a);if(this.cache[f]||a==="auto"||a==="zero")continue;!r[a]&&a!==undefined&&(r[a]=i,n.push(a),i++)}}if(n.length==0){this._fill_from_cache(e),t(e);return}var l={dataset_id:e.id,start:e.start,columns:n},c=this;this._fetch(l,function(r){for(var i in r){var s=n[i],o=c._block_id(e,s);c.cache[o]=r[i]}c._fill_from_cache(e),t(e)})},_fill_from_cache:function(e){var t=e.start;console.debug("Datasets::_fill_from_cache() - Filling request from cache at "+t+".");var n=0;for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s],u=this._block_id(e,o.index),a=this.cache[u];a&&(n=Math.max(n,a.length))}}n==0&&console.debug("Datasets::_fill_from_cache() - Reached data range limit.");for(var r in e.groups){var i=e.groups[r];i.values=[];for(var f=0;f<n;f++)i.values[f]={x:parseInt(f)+t}}for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s];switch(o.index){case"auto":for(var f=0;f<n;f++){var l=i.values[f];l[s]=parseInt(f)+t}break;case"zero":for(var f=0;f<n;f++){var l=i.values[f];l[s]=0}break;default:var u=this._block_id(e,o.index),a=this.cache[u];for(var f=0;f<n;f++){var l=i.values[f],c=a[f];isNaN(c)&&!o.is_label&&(c=0),l[s]=c}}}}},_fetch:function(t,n){var r=t.start?t.start:0,i=this.app.config.get("query_limit"),s=0;t.columns&&(s=t.columns.length,console.debug("Datasets::_fetch() - Fetching "+s+" column(s) at "+r+".")),s==0&&console.debug("Datasets::_fetch() - No columns requested");var o="";for(var u in t.columns)o+=t.columns[u]+",";o=o.substring(0,o.length-1);var a=this;e.request("GET",config.root+"api/datasets/"+t.dataset_id,{data_type:"raw_data",provider:"dataset-column",limit:i,offset:r,indeces:o},function(e){var t=new Array(s);for(var r=0;r<s;r++)t[r]=[];for(var r in e.data){var i=e.data[r];for(var o in i){var u=i[o];u!==undefined&&u!=2147483647&&t[o].push(u)}}console.debug("Datasets::_fetch() - Fetching complete."),n(t)})}})}),define("plugin/models/group",[],function(){return Backbone.Model.extend({defaults:{key:"Data label",date:""},reset:function(){this.clear({silent:!0}).set(this.defaults),this.trigger("reset",this)}})}),define("plugin/models/groups",["plugin/models/group"],function(e){return Backbone.Collection.extend({model:e})}),define("plugin/library/deferred",["utils/utils"],function(e){return Backbone.Model.extend({queue:[],process:{},counter:0,initialize:function(){this.on("refresh",function(){for(var e in this.queue)if(this.counter==0){var t=this.queue[e];this.queue.splice(e,1),t()}})},execute:function(e){this.queue.push(e),this.trigger("refresh")},register:function(){var t=e.uuid();return this.process[t]=!0,this.counter++,console.debug("Deferred:register() - Registering "+t),t},done:function(e){this.process[e]&&(delete this.process[e],this.counter--,console.debug("Deferred:done() - Unregistering "+e),this.trigger("refresh"))},ready:function(){return this.counter==0}})});var Visualization=Backbone.Model.extend({defaults:{config:{}},urlRoot:function(){var e="/api/visualizations";return window.galaxy_config&&galaxy_config.root?galaxy_config.root+e:e},initialize:function(e){_.isObject(e.config)&&_.isObject(this.defaults.config)&&_.defaults(e.config,this.defaults.config),this._setUpListeners()},_setUpListeners:function(){},set:function(e,t){if(e==="config"){var n=this.get("config");_.isObject(n)&&(t=_.extend(_.clone(n),t))}return Backbone.Model.prototype.set.call(this,e,t),this},toString:function(){var e=this.get("id")||"";return this.get("title")&&(e+=":"+this.get("title")),"Visualization("+e+")"}}),VisualizationCollection=Backbone.Collection.extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(e,t){t=t||{}},set:function(e,t){var n=this;e=_.map(e,function(e){var t=n.get(e.id);if(!t)return e;var r=t.toJSON();return _.extend(r,e),r}),Backbone.Collection.prototype.set.call(this,e,t)},toString:function(){return["VisualizationCollection(",[this.historyId,this.length].join(),")"].join("")}});define("mvc/visualization/visualization-model",function(){}),define("plugin/models/chart",["plugin/models/groups","plugin/library/deferred","mvc/visualization/visualization-model"],function(e,t){return Backbone.Model.extend({defaults:{id:null,title:"",type:"",date:null,state:"",state_info:"",modified:!1,dataset_id:"",dataset_id_job:""},initialize:function(n){this.groups=new e,this.settings=new Backbone.Model,this.deferred=new t},reset:function(){this.clear({silent:!0}).set(this.defaults),this.groups.reset(),this.settings.clear(),this.trigger("reset",this)},copy:function(e){var t=this;t.clear({silent:!0}).set(this.defaults),t.set(e.attributes),t.settings=e.settings.clone(),t.groups.reset(),e.groups.each(function(e){t.groups.add(e.clone())}),t.trigger("change",t)},state:function(e,t){this.set("state",e),this.set("state_info",t),this.trigger("set:state"),console.debug("Chart:state() - "+t+" ("+e+")")}})}),define("plugin/library/storage",["utils/utils","plugin/models/chart","plugin/models/group"],function(e,t,n){return Backbone.Model.extend({vis:null,initialize:function(e){this.app=e,this.chart=this.app.chart,this.options=this.app.options,this.id=this.options.id,this.vis=new Visualization({type:"charts",config:{dataset_id:this.options.config.dataset_id,chart_dict:{}}}),this.id&&(this.vis.id=this.id);var t=this.options.config.chart_dict;t&&(this.vis.get("config").chart_dict=t)},save:function(){var e=this.app.chart;this.vis.get("config").chart_dict={};var t=e.get("title");t!=""&&this.vis.set("title",t);var n={attributes:e.attributes,settings:e.settings.attributes,groups:[]};e.groups.each(function(e){n.groups.push(e.attributes)}),this.vis.get("config").chart_dict=n;var r=this;this.vis.save().fail(function(e,t,n){console.error(e,t,n)}).then(function(e){e&&e.id&&(r.id=e.id)})},load:function(){var e=this.vis.get("config").chart_dict;if(!e.attributes)return!1;var t=e.attributes.type;if(!t)return console.debug("Storage::load() - Chart type not provided. Invalid format."),!1;var r=this.app.types.get(t);if(!r)return console.debug("Storage::load() - Chart type not supported. Please re-configure the chart. Resetting chart."),!1;console.debug("Storage::load() - Loading chart type "+t+"."),this.chart.definition=r,this.chart.set(e.attributes),this.chart.state("ok","Loading saved visualization..."),this.chart.settings.set(e.settings);for(var i in e.groups)this.chart.groups.add(new n(e.groups[i]));return this.chart.set("modified",!1),!0}})}),define("plugin/views/viewport",["mvc/ui/ui-portlet","plugin/library/ui","utils/utils"],function(e,t,n){return Backbone.View.extend({container_list:[],canvas_list:[],initialize:function(e,t){this.app=e,this.chart=this.app.chart,this.options=n.merge(t,this.optionsDefault),this.setElement($(this._template())),this._fullscreen(this.$el,100),this._createContainer("div");var r=this;this.chart.on("redraw",function(){r._draw(r.chart)}),this.chart.on("set:state",function(){var e=r.$el.find("#info"),t=r.$el.find(".charts-viewport-container"),n=e.find("#icon");n.removeClass(),e.show(),e.find("#text").html(r.chart.get("state_info"));var i=r.chart.get("state");switch(i){case"ok":e.hide(),t.show();break;case"failed":n.addClass("icon fa fa-warning"),t.hide();break;default:n.addClass("icon fa fa-spinner fa-spin"),t.show()}})},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_fullscreen:function(e,t){e.css("height",$(window).height()-t),$(window).resize(function(){e.css("height",$(window).height()-t)})},_createContainer:function(e,t){t=t||1;for(var n in this.container_list)this.container_list[n].remove();this.container_list=[],this.canvas_list=[];for(var n=0;n<t;n++){var r=$(this._templateContainer(e,parseInt(100/t)));this.$el.append(r),this.container_list[n]=r,this.canvas_list[n]=r.find(".charts-viewport-canvas").attr("id")}},_draw:function(e){var t=this,n=e.deferred.register(),r=e.get("type");this.chart_definition=e.definition;var i=1;e.settings.get("use_panels")==="true"&&(i=e.groups.length),this._createContainer(this.chart_definition.tag,i),e.state("wait","Please wait...");if(!this.chart_definition.execute||this.chart_definition.execute&&e.get("modified"))this.app.jobs.cleanup(e),e.set("modified",!1);var t=this;require(["plugin/charts/"+this.app.chartPath(r)+"/wrapper"],function(r){if(t.chart_definition.execute)t.app.jobs.request(e,t._defaultSettingsString(e),t._defaultRequestString(e),function(){var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})},function(){e.deferred.done(n)});else var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})})},_defaultRequestString:function(e){var t="",n=0,r=this;return e.groups.each(function(e){n++;for(var i in r.chart_definition.columns)t+=i+"_"+n+":"+(parseInt(e.get(i))+1)+", "}),t.substring(0,t.length-2)},_defaultSettingsString:function(e){var t="";for(key in e.settings.attributes)t+=key+":"+e.settings.get(key)+", ";return t.substring(0,t.length-2)},_defaultRequestDictionary:function(e){var t={groups:[]};this.chart_definition.execute?t.id=e.get("dataset_id_job"):t.id=e.get("dataset_id");var r=0,i=this;return e.groups.each(function(e){var s={};for(var o in i.chart_definition.columns){var u=i.chart_definition.columns[o];s[o]=n.merge({index:e.get(o)},u)}t.groups.push({key:++r+":"+e.get("key"),columns:s})}),t},_template:function(){return'<div class="charts-viewport"><div id="info" class="info"><span id="icon" class="icon"/><span id="text" class="text" /></div></div>'},_templateContainer:function(e,t){return'<div class="charts-viewport-container" style="width:'+t+'%;">'+'<div id="menu"/>'+"<"+e+' id="'+n.uuid()+'" class="charts-viewport-canvas">'+"</div>"}})}),define("plugin/library/screenshot",["libs/underscore"],function(e){function t(e){e.$el.find("svg").length>0?r(e):n(e)}function n(e){try{var t=e.$el.find(".jqplot-target"),n=t.jqplotToImageStr({});n&&(window.location.href=n.replace("image/png","image/octet-stream"))}catch(r){console.debug("FAILED - Screenshot::_fromCanvas() - "+r),e.error&&e.error("Please reduce your chart to a single panel and try again.")}}function r(e){var t=e.$el,n=e.url,r=e.name,s=new XMLSerializer,o=document.createElement("canvas"),u=$(o),a=t.find("svg").length,f=t.find("svg").first(),l=parseInt(f.css("height")),c=parseInt(f.css("width"));u.attr("width",c*a),u.attr("height",l),(!o.getContext||!o.getContext("2d"))&&alert("Your browser doesn't support this feature, please use a modern browser");var h=o.getContext("2d"),p=0;t.find("svg").each(function(){var e=$(this);e.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:c,height:l});var t=s.serializeToString(this);h.drawSvg(t,p,0,c,l),p+=c}),window.location.href=i(o,o.getContext("2d"),"white").replace("image/png","image/octet-stream")}function i(e,t,n){var r=e.width,i=e.height,s;if(n){s=t.getImageData(0,0,r,i);var o=t.globalCompositeOperation;t.globalCompositeOperation="destination-over",t.fillStyle=n,t.fillRect(0,0,r,i)}var u=e.toDataURL("image/png");return n&&(t.clearRect(0,0,r,i),t.putImageData(s,0,0),t.globalCompositeOperation=o),u}function s(e){window.location.href="data:none/none;base64,"+btoa(a(e).string)}function o(e){for(var t in document.styleSheets){var n=document.styleSheets[t],r=n.cssRules;if(r)for(var i=0,s=r.length;i<s;i++)try{e.find(r[i].selectorText).each(function(e,t){t.style.cssText+=r[i].style.cssText})}catch(o){}}}function u(e){var t=a(e),n={filename:name||"chart",type:"application/pdf",height:t.height,width:t.width,scale:2,svg:t.string},r=$("body"),i=r.find("#viewport-form");i.length===0&&(i=$("<form>",{id:"viewport-form",method:"post",action:"http://export.highcharts.com/",display:"none"}),r.append(i)),i.empty();for(name in n){var s=$("<input/>",{type:"hidden",name:name,value:n[name]});i.append(s)}try{i.submit()}catch(o){console.log(o)}}function a(e){if(e.$el.find("svg").length==0&&e.error){e.error("No SVG found. This chart type does not support SVG/PDF export.");return}var t=e.$el,n=t.find("svg").length,r=parseInt(t.find("svg").first().css("height")),i=parseInt(t.find("svg").first().css("width")),s=new XMLSerializer,u=$("<svg/>");u.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:i*n,height:r});var a="",f=0;return t.find("svg").each(function(){var e=$(this).clone();o(e);var t=$('<g transform="translate('+f+', 0)">');t.append(e.find("g").first()),u.append(t),f+=i}),{string:s.serializeToString(u[0]),height:r,width:i}}return{createPNG:t,createSVG:s,createPDF:u}}),define("plugin/views/viewer",["utils/utils","plugin/library/ui","mvc/ui/ui-portlet","plugin/models/group","plugin/views/viewport","plugin/library/screenshot"],function(e,t,n,r,i,s){return Backbone.View.extend({initialize:function(e,r){this.app=e,this.chart=this.app.chart,this.viewport_view=new i(e);var o=this;this.message=new t.Message;var u=new t.ButtonMenu({icon:"fa-camera",title:"Screenshot",tooltip:"Download as PNG, SVG or PDF file"});u.addMenu({id:"button-png",title:"Save as PNG",icon:"fa-file",onclick:function(){o._wait(o.chart,function(){s.createPNG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-svg",title:"Save as SVG",icon:"fa-file-text-o",onclick:function(){o._wait(o.chart,function(){s.createSVG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-png",title:"Save as PDF",icon:"fa-file-o",onclick:function(){o.app.modal.show({title:"Send chart data for PDF creation",body:"Galaxy does not provide integrated PDF export scripts. You may click 'Continue' to create the PDF by using a 3rd party service (https://export.highcharts.com)",buttons:{Cancel:function(){o.app.modal.hide()},Continue:function(){o.app.modal.hide(),o._wait(o.chart,function(){s.createPDF({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}})}}),this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Viewport",scrollable:!1,operations:{edit_button:new t.ButtonIcon({icon:"fa-edit",tooltip:"Customize this chart",title:"Editor",onclick:function(){o._wait(o.chart,function(){o.app.go("editor")})}}),picture_button_menu:u}}),this.portlet.append(this.message.$el),this.portlet.append(this.viewport_view.$el),this.setElement(this.portlet.$el);var o=this;this.chart.on("change:title",function(){o._refreshTitle()})},show:function(){this.$el.show(),$(window).trigger("resize")},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e)},_wait:function(e,t){e.deferred.ready()?t():this.message.update({message:"Your chart is currently being processed. Please wait and try again."})}})}),define("mvc/ui/ui-tabs",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null},initialize:function(t){this.visible=!1,this.$nav=null,this.$content=null,this.first_tab=null,this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$nav=n.find(".tab-navigation"),this.$content=n.find(".tab-content"),this.setElement(n),this.list={};var r=this;this.options.operations&&$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$nav.find(".operations").append(t.$el)});if(this.options.onnew){var i=$(this._template_tab_new(this.options));this.$nav.append(i),i.tooltip({title:"Add a new tab",placement:"bottom",container:r.$el}),i.on("click",function(e){i.tooltip("hide"),r.options.onnew()})}},add:function(e){var t=this,n=e.id,r=$(this._template_tab(e)),i=$(this._template_tab_content(e));this.list[n]=e.ondel?!0:!1,this.options.onnew?this.$nav.find("#new-tab").before(r):this.$nav.append(r),i.append(e.$el),this.$content.append(i),_.size(this.list)==1&&(r.addClass("active"),i.addClass("active"),this.first_tab=n);if(e.ondel){var s=r.find("#delete");s.tooltip({title:"Delete this tab",placement:"bottom",container:t.$el}),s.on("click",function(){return s.tooltip("destroy"),t.$el.find(".tooltip").remove(),e.ondel(),!1})}r.on("click",function(r){r.preventDefault(),e.onclick?e.onclick():t.show(n)})},del:function(e){this.$el.find("#tab-"+e).remove(),this.$el.find("#tab-content-"+e).remove(),this.first_tab==e&&(this.first_tab=null),this.first_tab!=null&&this.show(this.first_tab)},delRemovable:function(){for(var e in this.list)this.list[e]&&this.del(e)},show:function(e){this.$el.fadeIn("fast"),this.visible=!0,e&&(this.$el.find(".tab-element").removeClass("active"),this.$el.find(".tab-pane").removeClass("active"),this.$el.find("#tab-"+e).addClass("active"),this.$el.find("#tab-content-"+e).addClass("active"))},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},hideOperation:function(e){this.$nav.find("#"+e).hide()},showOperation:function(e){this.$nav.find("#"+e).show()},setOperation:function(e,t){var n=this.$nav.find("#"+e);n.off("click"),n.on("click",t)},title:function(e,t){var n=this.$el.find("#tab-title-text-"+e);return t&&n.html(t),n.html()},_template:function(e){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(e){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+e.title_new+"</a>"+"</li>"},_template_tab:function(e){var t='<li id="tab-'+e.id+'" class="tab-element">'+'<a id="tab-title-link-'+e.id+'" title="" href="#tab-content-'+e.id+'" data-original-title="">'+'<span id="tab-title-text-'+e.id+'">'+e.title+"</span>";return e.ondel&&(t+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'),t+="</a></li>",t},_template_tab_content:function(e){return'<div id="tab-content-'+e.id+'" class="tab-pane"/>'}});return{View:t}}),define("plugin/library/ui-table",["utils/utils"],function(e){var t=Backbone.View.extend({row:null,row_count:0,optionsDefault:{content:"No content available.",onchange:null,ondblclick:null,onconfirm:null,cls:""},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(t){this.options=e.merge(t,this.optionsDefault);var n=$(this._template(t));this.$thead=n.find("thead"),this.$tbody=n.find("tbody"),this.$tmessage=n.find("tmessage"),this.setElement(n),this.row=$("<tr></tr>")},addHeader:function(e){var t=$("<th></th>");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=$("<tr></tr>")},add:function(e,t,n){var r=$("<td></td>");t&&r.css("width",t),n&&r.css("text-align",n),r.append(e),this.row.append(r)},append:function(e){this._commit(e)},prepend:function(e){this._commit(e,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),e!==undefined&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return t===undefined?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t){this.del(e),this.row.attr("id",e),t?this.$tbody.prepend(this.row):this.$tbody.append(this.row),this.row=$("<tr></tr>"),this.row_count++,this._refresh()},_onclick:function(e){var t=this.value(),n=$(e.target).closest("tr").attr("id");n!=""&&n&&t!=n&&(this.options.onconfirm?this.options.onconfirm(n):this.value(n))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){this.row_count==0?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'<div><table class="ui-table '+e.cls+'">'+"<thead></thead>"+'<tbody style="cursor: pointer;"></tbody>'+"</table>"+"<tmessage>"+e.content+"</tmessage>"+"<div>"}});return{View:t}}),define("plugin/views/group",["plugin/library/ui-table","plugin/library/ui","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(r,i){this.app=r;var s=this;this.chart=this.app.chart,this.group=i.group,this.group_key=new t.Input({placeholder:"Data label",onchange:function(e){s.group.set("key",e)}}),this.table=new e.View({content:"No data column."});var o=$("<div/>");o.append(n.wrap((new t.Label({title:"Provide a label:"})).$el)),o.append(n.wrap(this.group_key.$el)),o.append(n.wrap((new t.Label({title:"Select columns:"})).$el)),o.append(n.wrap(this.table.$el)),this.setElement(o);var s=this;this.chart.on("change:dataset_id",function(){s._refreshTable()}),this.chart.on("change:type",function(){s._refreshTable()}),this.group.on("change:key",function(){s._refreshGroupKey()}),this.group.on("change",function(){s._refreshGroup()}),this._refreshTable(),this._refreshGroupKey(),this._refreshGroup()},_refreshTable:function(){var e=this.chart.get("dataset_id"),n=this.chart.get("type");if(!e||!n)return;var r=this,i=this.chart.definition;this.table.delAll();var s={};for(var o in i.columns){var u=i.columns[o];if(!u){console.debug("Group::_refreshTable() - Skipping column definition.");continue}var a=new t.Select.View({id:"select_"+o,wait:!0}),f=u.title;u.is_unique&&(f+=" (all data labels)"),this.table.add(f,"25%"),this.table.add(a.$el),this.table.append(o),s[o]=a}this.chart.state("wait","Loading metadata...");var l=this.chart.deferred.register(),c={id:e,success:function(e){for(var t in s)r._addRow(t,e,s,i.columns[t]);r.chart.state("ok","Metadata initialized..."),r.chart.deferred.done(l)}};this.app.datasets.request(c)},_addRow:function(e,t,n,r){var i=this,s=r.is_label,o=r.is_auto,u=r.is_numeric,a=r.is_unique,f=r.is_zero,l=[],c=n[e];o&&l.push({label:"Column: Row Number",value:"auto"}),f&&l.push({label:"Column: None",value:"zero"});var h=t.metadata_column_types;for(var p in h){var d=!1;h[p]=="int"||h[p]=="float"?d=u:d=s,d&&l.push({label:"Column: "+(parseInt(p)+1)+" ["+h[p]+"]",value:p})}c.update(l),a&&this.chart.groups.first()&&this.group.set(e,this.chart.groups.first().get(e));if(!c.exists(this.group.get(e))){var v=c.first();console.debug('Group()::_addRow() - Switching model value from "'+this.group.get(e)+'" to "'+v+'".'),this.group.set(e,v)}c.value(this.group.get(e)),this.group.off("change:"+e),this.group.on("change:"+e,function(){c.value(i.group.get(e))}),c.setOnChange(function(t){a?i.chart.groups.each(function(n){n.set(e,t)}):i.group.set(e,t),i.chart.set("modified",!0)}),c.show()},_refreshGroup:function(){this.group.set("date",n.time())},_refreshGroupKey:function(){var e=this.group.get("key");e===undefined&&(e=""),this.group_key.value(e)}})}),define("plugin/library/ui-table-form",["plugin/library/ui-table","plugin/library/ui","utils/utils"],function(e,t,n){var r=Backbone.View.extend({optionsDefault:{title:"",content:"",mode:""},list:[],initialize:function(r,i){this.app=r,this.options=n.merge(i,this.optionsDefault),this.table_title=new t.Label({title:this.options.title}),this.table=new e.View({content:this.options.content});var s=$('<div class="ui-table-form"/>');this.options.title&&s.append(n.wrap(this.table_title.$el)),s.append(n.wrap(this.table.$el)),this.setElement(s)},title:function(e){this.table_title.title(e)},update:function(e,t){this.table.delAll(),this.list=[];for(var n in e)this._add(e[n].id||n,e[n],t);for(var n in this.list)this.list[n].trigger("change")},_add:function(e,n,r){var i=this,s=null,o=n.type;switch(o){case"text":s=new t.Input({id:"field-"+e,placeholder:n.placeholder,value:r.get(e),onchange:function(t){r.set(e,t)}});break;case"radiobutton":s=new t.RadioButton({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"select":s=new t.Select.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"dataset":s=new t.Select.View({id:"field-"+e,onchange:function(t){r.set(e,t)}}),i.app.datasets.on("all",function(){var t=[];i.app.datasets.each(function(e){e.get("datatype_id")==n.data&&t.push({value:e.get("id"),label:e.get("name")})}),s.update(t),r.get(e)||r.set(e,s.first()),s.value(r.get(e))}),i.app.datasets.trigger("all.datasets");break;case"textarea":s=new t.Textarea({id:"field-"+e,onchange:function(){r.set(e,s.value())}});break;case"separator":s=$("<div/>");break;default:s=new t.Input({id:"field-"+e,placeholder:n.placeholder,type:n.type,onchange:function(){r.set(e,s.value())}})}if(o!="separator"){r.get(e)||r.set(e,n.init),s.value(r.get(e)),this.list[e]=s;var u=$("<div/>");u.append(s.$el),n.info&&u.append('<div class="ui-table-form-info">'+n.info+"</div>"),this.options.style=="bold"?(this.table.add((new t.Label({title:n.title,cls:"form-label"})).$el),this.table.add(u)):(this.table.add('<span class="ui-table-form-title">'+n.title+"</span>","25%"),this.table.add(u))}else this.table.add('<div class="ui-table-form-separator">'+n.title+":<div/>"),this.table.add($("<div/>"));this.table.append(e),n.hide&&this.table.get(e).hide()}});return{View:r}}),define("plugin/views/settings",["plugin/library/ui","plugin/library/ui-table-form","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(e,n){this.app=e;var r=this;this.chart=this.app.chart,this.form=new t.View(e,{content:"This chart type does not provide any options."}),this.setElement(this.form.$el);var r=this;this.chart.on("change",function(){r._refresh()})},_refresh:function(){var e=this.chart.definition;if(!e)return;this.form.title(e.category+" - "+e.title+":"),this.form.update(e.settings,this.chart.settings)}})}),define("plugin/views/types",["utils/utils","plugin/library/ui"],function(e,t){return Backbone.View.extend({optionsDefault:{onchange:null,ondblclick:null},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(n,r){var i=this;this.app=n,this.options=e.merge(r,this.optionsDefault);var s=$('<div class="charts-grid"/>');s.append(e.wrap((new t.Label({title:"How many data points would you like to analyze?"})).$el)),this.library=new t.RadioButton({data:[{label:"Few (<500)",value:"small"},{label:"Some (<10k)",value:"medium"},{label:"Many (>10k)",value:"large"}],onchange:function(e){i._filter(e)}}),s.append(e.wrap(this.library.$el)),this.setElement(s),this._render(),this.library.value("small")},value:function(e){var t=this.$el.find(".current").attr("id");e!==undefined&&(this.$el.find(".current").removeClass("current"),this.$el.find("#"+e).addClass("current"));var n=this.$el.find(".current").attr("id");return n===undefined?null:(n!=t&&this.options.onchange&&this.options.onchange(e),n)},_filter:function(e){this.$el.find(".header").hide();var t=this.app.types.attributes;for(var n in t){var r=t[n],i=this.$el.find("#"+n),s=this.$el.find("#types-header-"+this.categories_index[r.category]),o=r.keywords||"";o.indexOf(e)>=0?(i.show(),s.show()):i.hide()}},_render:function(){this.categories={},this.categories_index={};var t=0,n=this.app.types.attributes;for(var r in n){var i=n[r],s=i.category;this.categories[s]||(this.categories[s]={},this.categories_index[s]=t++),this.categories[s][r]=i}for(var s in this.categories){var o=$('<div style="clear: both;"/>');o.append(e.wrap(this._template_header({id:"types-header-"+this.categories_index[s],title:s})));for(var r in this.categories[s]){var i=this.categories[s][r],u=i.title+" ("+i.library+")";i.zoomable&&(u='<span class="fa fa-search-plus"/>'+u),o.append(e.wrap(this._template_item({id:r,title:u,url:config.app_root+"charts/"+this.app.chartPath(r)+"/logo.png"})))}this.$el.append(e.wrap(o))}},_onclick:function(e){var t=this.value(),n=$(e.target).closest(".item").attr("id");n!=""&&n&&t!=n&&this.value(n)},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_template_header:function(e){return'<div id="'+e.id+'" class="header">'+"• "+e.title+"<div>"},_template_item:function(e){return'<div id="'+e.id+'" class="item">'+'<img class="image" src="'+e.url+'">'+'<div class="title">'+e.title+"</div>"+"<div>"}})}),define("plugin/views/editor",["mvc/ui/ui-tabs","plugin/library/ui","mvc/ui/ui-portlet","utils/utils","plugin/models/chart","plugin/models/group","plugin/views/group","plugin/views/settings","plugin/views/types"],function(e,t,n,r,i,s,o,u,a){return Backbone.View.extend({optionsDefault:{header:!0,content:"No content available."},initialize:function(i,s){var o=this;this.app=i,this.chart=this.app.chart,this.options=r.merge(s,this.optionsDefault),this.message=new t.Message,this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Editor",operations:{save:new t.ButtonIcon({icon:"fa-save",tooltip:"Draw Chart",title:"Draw",onclick:function(){o._saveChart()}}),back:new t.ButtonIcon({icon:"fa-caret-left",tooltip:"Return to Viewer",title:"Cancel",onclick:function(){o.app.go("viewer"),o.app.storage.load()}})}}),this.types=new a(i,{onchange:function(e){var t=o.app.types.get(e);t||console.debug("FAILED - Editor::onchange() - Chart type not supported."),o.chart.definition=t,o.chart.settings.clear(),o.chart.set({type:e}),o.chart.set("modified",!0),console.debug("Editor::onchange() - Switched chart type.")},ondblclick:function(e){o._saveChart()}}),this.tabs=new e.View({title_new:"Add Data",onnew:function(){var e=o._addGroupModel();o.tabs.show(e.id)}}),this.title=new t.Input({placeholder:"Chart title",onchange:function(){o.chart.set("title",o.title.value())}});var f=$("<div/>");f.append(r.wrap((new t.Label({title:"Provide a chart title:"})).$el)),f.append(r.wrap(this.title.$el)),f.append(r.wrap(this.types.$el)),this.tabs.add({id:"main",title:"Start",$el:f}),this.settings=new u(this.app),this.tabs.add({id:"settings",title:"Configuration",$el:this.settings.$el}),this.portlet.append(this.message.$el),this.portlet.append(this.tabs.$el),this.setElement(this.portlet.$el),this.tabs.hideOperation("back");var o=this;this.chart.on("change:title",function(e){o._refreshTitle()}),this.chart.on("change:type",function(e){o.types.value(e.get("type"))}),this.chart.on("reset",function(e){o._resetChart()}),this.app.chart.on("redraw",function(e){o.portlet.showOperation("back")}),this.app.chart.groups.on("add",function(e){o._addGroup(e)}),this.app.chart.groups.on("remove",function(e){o._removeGroup(e)}),this.app.chart.groups.on("reset",function(e){o._removeAllGroups()}),this.app.chart.groups.on("change:key",function(e){o._refreshGroupKey()}),this._resetChart()},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e),this.title.value(e)},_refreshGroupKey:function(){var e=this,t=0;this.chart.groups.each(function(n){var r=n.get("key","");r==""&&(r="Data label"),e.tabs.title(n.id,++t+": "+r)})},_addGroupModel:function(){var e=new s({id:r.uuid()});return this.chart.groups.add(e),e},_addGroup:function(e){var t=this,n=new o(this.app,{group:e});this.tabs.add({id:e.id,$el:n.$el,ondel:function(){t.chart.groups.remove(e.id)}}),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeGroup:function(e){this.tabs.del(e.id),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeAllGroups:function(e){this.tabs.delRemovable()},_resetChart:function(){this.chart.set("id",r.uuid()),this.chart.set("type","nvd3_bar"),this.chart.set("dataset_id",this.app.options.config.dataset_id),this.chart.set("title","New Chart"),this.portlet.hideOperation("back")},_saveChart:function(){this.chart.set({type:this.types.value(),title:this.title.value(),date:r.time()});if(this.chart.groups.length==0){this.message.update({message:"Please select data columns before drawing the chart."});var e=this._addGroupModel();this.tabs.show(e.id);return}var t=this,n=!0,i=this.chart.definition;this.chart.groups.each(function(e){if(!n)return;for(var r in i.columns)if(e.attributes[r]=="null"){t.message.update({status:"danger",message:"This chart type requires column types not found in your tabular file."}),t.tabs.show(e.id),n=!1;return}});if(!n)return;this.app.go("viewer");var t=this;this.chart.deferred.execute(function(){t.app.storage.save(),t.chart.trigger("redraw")})}})}),define("plugin/models/config",[],function(){return Backbone.Model.extend({defaults:{query_limit:500,query_timeout:100}})}),define("plugin/charts/forms/default",[],function(){return{title:"",category:"",library:"",tag:"",keywords:"",query_limit:0,settings:{separator_x:{title:"X axis",type:"separator"},x_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"X-axis",placeholder:"Axis label"},x_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["x_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["x_axis_precision"]}},{label:"Float",value:"f",operations:{show:["x_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["x_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["x_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["x_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["x_axis_precision"]}}]},x_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_y:{title:"Y axis",type:"separator"},y_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"Y-axis",placeholder:"Axis label"},y_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["y_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["y_axis_precision"]}},{label:"Float",value:"f",operations:{show:["y_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["y_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["y_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["y_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["y_axis_precision"]}}]},y_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_legend:{title:"Others",type:"separator"},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"true",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{title:"Use multi-panels",info:"Would you like to separate your data into individual panels?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]}}}}),function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o<r&&t(o);if(s>1)while(o<i){var a=new Date(+o);n(a)%s===0&&u.push(a),t(o)}else while(o<i)u.push(new Date(+o)),t(o);return u}}var e=window.nv||{};e.version="1.1.15b",e.dev=!0,window.nv=e,e.tooltip=e.tooltip||{},e.utils=e.utils||{},e.models=e.models||{},e.charts={},e.graphs=[],e.logs={},e.dispatch=d3.dispatch("render_start","render_end"),e.dev&&(e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)}),e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date),e.logs.totalTime=e.logs.endTime-e.logs.startTime,e.log("total",e.logs.totalTime)})),e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]},e.render=function(n){n=n||1,e.render.active=!0,e.dispatch.render_start(),setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++)t=r.generate(),typeof r.callback==typeof Function&&r.callback(t),e.graphs.push(t);e.render.queue.splice(0,i),e.render.queue.length?setTimeout(arguments.callee,0):(e.dispatch.render_end(),e.render.active=!1)},0)},e.render.active=!1,e.render.queue=[],e.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),e.render.queue.push(t),e.render.active||e.render()},e.identity=function(e){return e},e.strip=function(e){return e.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)},d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1),e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()}),e.interactiveGuideline=function(){function c(o){o.each(function(o){function g(){var e=d3.mouse(this),n=e[0],r=e[1],o=!0,a=!1;l&&(n=d3.event.offsetX,r=d3.event.offsetY,d3.event.target.tagName!=="svg"&&(o=!1),d3.event.target.className.baseVal.match("nv-legend")&&(a=!0)),o&&(n-=i.left,r-=i.top);if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l&&d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass))return;u.elementMouseout({mouseX:n,mouseY:r}),c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f}),d3.event.type==="dblclick"&&u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}var h=d3.select(this),p=n||960,d=r||400,v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]),m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f)return;f.on("mousemove",g,!0).on("mouseout",g,!0).on("dblclick",g),c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0),n.exit().remove()}})}var t=e.models.tooltip(),n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=!0,f=null,l=navigator.userAgent.indexOf("MSIE")!==-1;return c.dispatch=u,c.tooltip=t,c.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.left=typeof e.left!="undefined"?e.left:i.left,c):i},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.xScale=function(e){return arguments.length?(s=e,c):s},c.showGuideLine=function(e){return arguments.length?(a=e,c):a},c.svgContainer=function(e){return arguments.length?(f=e,c):f},c},e.interactiveBisect=function(e,t,n){if(!e instanceof Array)return null;typeof n!="function"&&(n=function(e,t){return e.x});var r=d3.bisector(n).left,i=d3.max([0,r(e,t)-1]),s=n(e[i],i);typeof s=="undefined"&&(s=i);if(s===t)return i;var o=d3.min([i+1,e.length-1]),u=n(e[o],o);return typeof u=="undefined"&&(u=o),Math.abs(u-t)>=Math.abs(s-t)?i:o},e.nearestValueIndex=function(e,t,n){var r=Infinity,i=null;return e.forEach(function(e,s){var o=Math.abs(t-e);o<=r&&o<n&&(r=o,i=s)}),i},function(){window.nv.tooltip={},window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);e.node().tagName!=="svg"&&(e=e.select("svg"));var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n,l.top=l.top*n}}}function b(e){var t;a?t=d3.select(a):t=d3.select("body");var n=t.select(".nvtooltip");return n.node()===null&&(n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)),n.node().innerHTML=e,n.style("top",0).style("left",0).style("opacity",0),n.selectAll("div, table, td, tr").classed(p,!0),n.classed(p,!0),n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left,u=o!=null?o:l.top,h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0],d=p?p.getBoundingClientRect():a.getBoundingClientRect(),v={left:0,top:0};if(p){var E=p.getBoundingClientRect(),S=a.getBoundingClientRect(),x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top),v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft,u+=a.offsetTop+v.top-2*a.scrollTop}return s&&s>0&&(u=Math.floor(u/s)*s),e.tooltip.calcTooltipPosition([t,u],r,i,h),w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=!0,h="nvtooltip-"+Math.floor(Math.random()*1e5),p="nv-pointer-events-none",d=function(e,t){return e},v=function(e){return e},m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table")),r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody"),s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(e){return e.color}),s.append("td").classed("key",!0).html(function(e){return e.key}),s.append("td").classed("value",!0).html(function(e,t){return d(e.value,t)}),s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]),n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;return e.footer!==undefined&&(o+="<div class='footer'>"+e.footer+"</div>"),o},g=function(e){return e&&e.series&&e.series.length>0?!0:!1};return w.nvPointerEventsClass=p,w.content=function(e){return arguments.length?(t=e,w):t},w.tooltipElem=function(){return f},w.contentGenerator=function(e){return arguments.length?(typeof e=="function"&&(m=e),w):m},w.data=function(e){return arguments.length?(n=e,w):n},w.gravity=function(e){return arguments.length?(r=e,w):r},w.distance=function(e){return arguments.length?(i=e,w):i},w.snapDistance=function(e){return arguments.length?(s=e,w):s},w.classes=function(e){return arguments.length?(u=e,w):u},w.chartContainer=function(e){return arguments.length?(a=e,w):a},w.position=function(e){return arguments.length?(l.left=typeof e.left!="undefined"?e.left:l.left,l.top=typeof e.top!="undefined"?e.top:l.top,w):l},w.fixedTop=function(e){return arguments.length?(o=e,w):o},w.enabled=function(e){return arguments.length?(c=e,w):c},w.valueFormatter=function(e){return arguments.length?(typeof e=="function"&&(d=e),w):d},w.headerFormatter=function(e){return arguments.length?(typeof e=="function"&&(v=e),w):v},w.id=function(){return h},w},e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i))a=document.getElementsByTagName("body")[0];u.style.left=0,u.style.top=0,u.style.opacity=0,u.innerHTML=n,a.appendChild(u),s&&(t[0]=t[0]-s.scrollLeft,t[1]=t[1]-s.scrollTop),e.tooltip.calcTooltipPosition(t,r,i,u)},e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null)e=e.parentNode;return e},e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do isNaN(e.offsetTop)||(n+=e.offsetTop);while(e=e.offsetParent);return n},e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do isNaN(e.offsetLeft)||(n+=e.offsetLeft);while(e=e.offsetParent);return n},e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16,u=window.innerHeight>=document.body.scrollHeight?u:u-16,n=n||"s",r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)},d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r,h=t[1]-s/2;var v=d(i),m=p(i);v<l&&(c=t[0]+r>l?t[0]+r:l-v+c),m<f&&(h=f-m+h),m+s>f+a&&(h=f+a-m+h-s);break;case"w":c=t[0]+r,h=t[1]-s/2;var v=d(i),m=p(i);v+o>u&&(c=t[0]-o-r),m<f&&(h=f+5),m+s>f+a&&(h=f+a-m+h-s);break;case"n":c=t[0]-o/2-5,h=t[1]+r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),m+s>f+a&&(h=f+a-m+h-s);break;case"s":c=t[0]-o/2,h=t[1]-s-r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),f>m&&(h=f);break;case"none":c=t[0],h=t[1]-r;var v=d(i),m=p(i)}return i.style.left=c+"px",i.style.top=h+"px",i.style.opacity=1,i.style.position="absolute",i},e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.utils.calcApproxTextWidth=function(e){if(typeof e.style=="function"&&typeof e.text=="function"){var t=parseInt(e.style("font-size").replace("px","")),n=e.text().length;return n*t*.5}return 0},e.utils.NaNtoZero=function(e){return typeof e!="number"||isNaN(e)||e===null||e===Infinity?0:e},e.utils.optionsFunc=function(e){return e&&d3.map(e).forEach(function(e,t){typeof this[e]=="function"&&this[e](t)}.bind(this)),this},e.models.axis=function(){function m(e){return e.each(function(e){var i=d3.select(this),m=i.selectAll("g.nv-wrap.nv-axis").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),y=g.append("g"),b=m.select("g");p!==null?t.ticks(p):(t.orient()=="top"||t.orient()=="bottom")&&t.ticks(Math.abs(s.range()[1]-s.range()[0])/100),b.call(t),v=v||t.scale();var w=t.tickFormat();w==null&&(w=v.tickFormat());var E=b.selectAll("text.nv-axislabel").data([o||null]);E.exit().remove();switch(t.orient()){case"top":E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",0).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var T=36,N=30,C=b.selectAll("g").select("text");if(f%360){C.each(function(e,t){var n=this.getBBox().width;n>N&&(N=n)});var k=Math.abs(Math.sin(f*Math.PI/180)),T=(k?k*N:N)+30;C.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",T).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}c&&C.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+d:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}}E.text(function(e){return e}),u&&(t.orient()==="left"||t.orient()==="right")&&(b.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10)(e>1e-10||e<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0)}),s.domain()[0]==s.domain()[1]&&s.domain()[0]==0&&m.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(u&&(t.orient()==="top"||t.orient()==="bottom")){var L=[];m.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?L.push(s(e)-this.getBBox().width-4):L.push(s(e)+this.getBBox().width+4)}catch(n){t?L.push(s(e)-4):L.push(s(e)+4)}}),b.selectAll("g").each(function(e,t){if(s(e)<L[0]||s(e)>L[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}a&&b.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",!0),v=s.copy()}),m}var t=d3.svg.axis(),n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=!0,a=!0,f=0,l=!0,c=!1,h=!1,p=null,d=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var v;return m.axis=t,d3.rebind(m,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.ticks=function(e){return arguments.length?(p=e,m):p},m.height=function(e){return arguments.length?(i=e,m):i},m.axisLabel=function(e){return arguments.length?(o=e,m):o},m.showMaxMin=function(e){return arguments.length?(u=e,m):u},m.highlightZero=function(e){return arguments.length?(a=e,m):a},m.scale=function(e){return arguments.length?(s=e,t.scale(s),h=typeof s.rangeBands=="function",d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m):s},m.rotateYLabel=function(e){return arguments.length?(l=e,m):l},m.rotateLabels=function(e){return arguments.length?(f=e,m):f},m.staggerLabels=function(e){return arguments.length?(c=e,m):c},m.axisLabelDistance=function(e){return arguments.length?(d=e,m):d},m},e.models.historicalBar=function(){function w(E){return E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f))),c?s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]):s.range(m||[0,E]),o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-bars"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S),A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",!0),y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",!1),y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9),O.attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})}),w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!1,h=!0,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=!0;return w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)},w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",!1)},w.dispatch=y,w.options=e.utils.optionsFunc.bind(w),w.x=function(e){return arguments.length?(u=e,w):u},w.y=function(e){return arguments.length?(a=e,w):a},w.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,w):t},w.width=function(e){return arguments.length?(n=e,w):n},w.height=function(e){return arguments.length?(r=e,w):r},w.xScale=function(e){return arguments.length?(s=e,w):s},w.yScale=function(e){return arguments.length?(o=e,w):o},w.xDomain=function(e){return arguments.length?(d=e,w):d},w.yDomain=function(e){return arguments.length?(v=e,w):v},w.xRange=function(e){return arguments.length?(m=e,w):m},w.yRange=function(e){return arguments.length?(g=e,w):g},w.forceX=function(e){return arguments.length?(f=e,w):f},w.forceY=function(e){return arguments.length?(l=e,w):l},w.padData=function(e){return arguments.length?(c=e,w):c},w.clipEdge=function(e){return arguments.length?(h=e,w):h},w.color=function(t){return arguments.length?(p=e.utils.getColor(t),w):p},w.id=function(e){return arguments.length?(i=e,w):i},w.interactive=function(e){return arguments.length?(b=!1,w):b},w},e.models.bullet=function(){function m(e){return e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this),y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice(),T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]),N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1],A=g.selectAll("g.nv-wrap.nv-bullet").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),M=O.append("g"),_=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax"),M.append("rect").attr("class","nv-range nv-rangeAvg"),M.append("rect").attr("class","nv-range nv-rangeMin"),M.append("rect").attr("class","nv-measure"),M.append("path").attr("class","nv-markerTriangle"),A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))},H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C),_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L),_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k),_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;b[0]?_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})}):_.selectAll("path.nv-markerTriangle").remove(),A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseout({value:e,label:n})})}),m}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");return m.dispatch=v,m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(i=e,m):i},m.markers=function(e){return arguments.length?(s=e,m):s},m.measures=function(e){return arguments.length?(o=e,m):o},m.forceX=function(e){return arguments.length?(l=e,m):l},m.width=function(e){return arguments.length?(c=e,m):c},m.height=function(e){return arguments.length?(h=e,m):h},m.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,m):t},m.tickFormat=function(e){return arguments.length?(p=e,m):p},m.color=function(t){return arguments.length?(d=e.utils.getColor(t),m):d},m},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=n.title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function D(b){return b.each(function(b){function I(e,t){d3.select(D.container).style("cursor","ew-resize")}function q(e,t){M.x=d3.event.x,M.i=Math.round(O.invert(M.x)),nt()}function R(e,t){d3.select(D.container).style("cursor","auto"),x.index=M.i,k.stateChange(x)}function nt(){tt.data([M]);var e=D.transitionDuration();D.transitionDuration(0),D.update(),D.transitionDuration(e)}var L=d3.select(this).classed("nv-chart-"+S,!0),A=this,H=(f||parseInt(L.style("width"))||960)-u.left-u.right,B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom;D.update=function(){L.call(D)},D.container=this,x.disabled=b.map(function(e){return!!e.disabled});if(!T){var j;T={};for(j in x)x[j]instanceof Array?T[j]=x[j].slice(0):T[j]=x[j]}var F=d3.behavior.drag().on("dragstart",I).on("drag",q).on("dragend",R);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var U=L.selectAll(".nv-noData").data([N]);return U.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),U.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e}),D}L.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();if(!y){var z=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return r[0]<-0.95&&(r[0]=-0.95),[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),W=[d3.min(z,function(e){return e[0]}),d3.max(z,function(e){return e[1]})];t.yDomain(W)}else t.yDomain(null);O.domain([0,b[0].values.length-1]).range([0,H]).clamp(!0);var b=P(M.i,b),X=g?"none":"all",V=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]),$=V.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),J=V.select("g");$.append("g").attr("class","nv-interactive"),$.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),$.append("g").attr("class","nv-y nv-axis"),$.append("g").attr("class","nv-background"),$.append("g").attr("class","nv-linesWrap").style("pointer-events",X),$.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),$.append("g").attr("class","nv-legendWrap"),$.append("g").attr("class","nv-controlsWrap"),c&&(i.width(H),J.select(".nv-legendWrap").datum(b).call(i),u.top!=i.height()&&(u.top=i.height(),B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")"));if(m){var K=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),J.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+ -u.top+")").call(s)}V.attr("transform","translate("+u.left+","+u.top+")"),d&&J.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)");var Q=b.filter(function(e){return e.tempDisabled});V.select(".tempDisabled").remove(),Q.length&&V.append("text").attr("class","tempDisabled").attr("x",H/2).attr("y","-.71em").style("text-anchor","end").text(Q.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period."),g&&(o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(L).xScale(w),V.select(".nv-interactive").call(o)),$.select(".nv-background").append("rect"),J.select(".nv-background rect").attr("width",H).attr("height",B),t.y(function(e){return e.display.y}).width(H).height(B).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var G=J.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));G.call(t),b.forEach(function(e,t){e.seriesIndex=t});var Y=b.filter(function(e){return!e.disabled&&!!C(e)}),Z=J.select(".nv-avgLinesWrap").selectAll("line").data(Y,function(e){return e.key}),et=function(e){var t=E(C(e));return t<0?0:t>B?B:t};Z.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.style("stroke-opacity",function(e){var t=E(C(e));return t<0||t>B?0:1}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.exit().remove();var tt=G.selectAll(".nv-indexLine").data([M]);tt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(F),tt.attr("transform",function(e){return"translate("+O(e.i)+",0)"}).attr("height",B),h&&(n.scale(w).ticks(Math.min(b[0].values.length,H/70)).tickSize(-B,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(n)),p&&(r.scale(E).ticks(B/36).tickSize(-H,0),d3.transition(J.select(".nv-y.nv-axis")).call(r)),J.select(".nv-background rect").on("click",function(){M.x=d3.mouse(this)[0],M.i=Math.round(O.invert(M.x)),x.index=M.i,k.stateChange(x),nt()}),t.dispatch.on("elementClick",function(e){M.i=e.pointIndex,M.x=O(M.i),x.index=M.i,k.stateChange(x),nt()}),s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,y=!e.disabled,x.rescaleY=y,k.stateChange(x),D.update()}),i.dispatch.on("stateChange",function(e){x.disabled=e.disabled,k.stateChange(x),D.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,D.x()),t.highlightPoint(r,f,!0);var o=n.values[f];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof l=="undefined"&&(l=D.xScale()(D.x()(o,f))),c.push({key:n.key,value:D.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=D.yScale().invert(i.mouseY),p=Math.abs(D.yScale().domain()[0]-D.yScale().domain()[1]),d=.03*p,m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);m!==null&&(c[m].highlight=!0)}var g=n.tickFormat()(D.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(A.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})(),o.renderGuideLine(l)}),o.dispatch.on("elementMouseout",function(e){k.tooltipHide(),t.clearHighlights()}),k.on("tooltipShow",function(e){v&&_(e,A.parentNode)}),k.on("changeState",function(e){typeof e.disabled!="undefined"&&(b.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),typeof e.index!="undefined"&&(M.i=e.index,M.x=O(M.i),x.index=e.index,tt.data([M])),typeof e.rescaleY!="undefined"&&(y=e.rescaleY),D.update()})}),D}function P(e,n){return n.map(function(n,r){if(!n.values)return n;var i=n.values[e];if(i==null)return n;var s=t.y()(i,e);return s<-0.95&&!A?(n.tempDisabled=!0,n):(n.tempDisabled=!1,n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-s)/(1+s)},e}),n)})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=!0,h=!0,p=!0,d=!1,v=!0,m=!0,g=!1,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=0,A=!1;n.orient("bottom").tickPadding(7),r.orient(d?"right":"left"),s.updateState(!1);var O=d3.scale.linear(),M={i:0,x:0},_=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,D);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)}),k.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),D.dispatch=k,D.lines=t,D.legend=i,D.xAxis=n,D.yAxis=r,D.interactiveLayer=o,d3.rebind(D,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),D.options=e.utils.optionsFunc.bind(D),D.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,D):u},D.width=function(e){return arguments.length?(f=e,D):f},D.height=function(e){return arguments.length?(l=e,D):l},D.color=function(t){return arguments.length?(a=e.utils.getColor(t),i.color(a),D):a},D.rescaleY=function(e){return arguments.length?(y=e,D):y},D.showControls=function(e){return arguments.length?(m=e,D):m},D.useInteractiveGuideline=function(e){return arguments.length?(g=e,e===!0&&(D.interactive(!1),D.useVoronoi(!1)),D):g},D.showLegend=function(e){return arguments.length?(c=e,D):c},D.showXAxis=function(e){return arguments.length?(h=e,D):h},D.showYAxis=function(e){return arguments.length?(p=e,D):p},D.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),D):d},D.tooltips=function(e){return arguments.length?(v=e,D):v},D.tooltipContent=function(e){return arguments.length?(b=e,D):b},D.state=function(e){return arguments.length?(x=e,D):x},D.defaultState=function(e){return arguments.length?(T=e,D):T},D.noData=function(e){return arguments.length?(N=e,D):N},D.average=function(e){return arguments.length?(C=e,D):C},D.transitionDuration=function(e){return arguments.length?(L=e,D):L},D.noErrorCheck=function(e){return arguments.length?(A=e,D):A},D},e.models.discreteBar=function(){function E(e){return e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1),o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f))),c?o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range(m||[E,0]),b=b||s,w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-groups"),N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),A.style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length),c?(M.append("text").attr("text-anchor","middle"),O.select("text").text(function(e,t){return h(a(e,t))}).attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})):O.selectAll("text").remove(),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).attr("width",s.rangeBand()*.9/e.length),O.attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)}),b=s.copy(),w=o.copy()}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar",b,w;return E.dispatch=g,E.options=e.utils.optionsFunc.bind(E),E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(p=e,E):p},E.yDomain=function(e){return arguments.length?(d=e,E):d},E.xRange=function(e){return arguments.length?(v=e,E):v},E.yRange=function(e){return arguments.length?(m=e,E):m},E.forceY=function(e){return arguments.length?(f=e,E):f},E.color=function(t){return arguments.length?(l=e.utils.getColor(t),E):l},E.id=function(e){return arguments.length?(i=e,E):i},E.showValues=function(e){return arguments.length?(c=e,E):c},E.valueFormat=function(e){return arguments.length?(h=e,E):h},E.rectClass=function(e){return arguments.length?(y=e,E):y},E},e.models.discreteBarChart=function(){function w(e){return e.each(function(e){var u=d3.select(this),p=this,y=(s||parseInt(u.style("width"))||960)-i.left-i.right,E=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate(),u.call(w)},w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var S=u.selectAll(".nv-noData").data([m]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",i.left+y/2).attr("y",i.top+E/2).text(function(e){return e}),w}u.selectAll(".nv-noData").remove(),d=t.xScale(),v=t.yScale().clamp(!0);var T=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),C=N.append("defs"),k=T.select("g");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),k.attr("transform","translate("+i.left+","+i.top+")"),l&&k.select(".nv-y.nv-axis").attr("transform","translate("+y+",0)"),t.width(y).height(E);var L=k.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));L.call(t),C.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect"),k.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(y/100).tickSize(-E,0),k.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")"),k.select(".nv-x.nv-axis").call(n);var A=k.select(".nv-x.nv-axis").selectAll("g");c&&A.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}f&&(r.scale(v).ticks(E/36).tickSize(-y,0),k.select(".nv-y.nv-axis").call(r)),k.select(".nv-zeroLine line").attr("x1",0).attr("x2",y).attr("y1",v(0)).attr("y2",v(0)),g.on("tooltipShow",function(e){h&&b(e,p.parentNode)})}),w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis(),i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=!0,f=!0,l=!1,c=!1,h=!0,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=0;n.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top],g.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)}),g.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),w.dispatch=g,w.discretebar=t,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),w.options=e.utils.optionsFunc.bind(w),w.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,w):i},w.width=function(e){return arguments.length?(s=e,w):s},w.height=function(e){return arguments.length?(o=e,w):o},w.color=function(n){return arguments.length?(u=e.utils.getColor(n),t.color(u),w):u},w.showXAxis=function(e){return arguments.length?(a=e,w):a},w.showYAxis=function(e){return arguments.length?(f=e,w):f},w.rightAlignYAxis=function(e){return arguments.length?(l=e,r.orient(e?"right":"left"),w):l},w.staggerLabels=function(e){return arguments.length?(c=e,w):c},w.tooltips=function(e){return arguments.length?(h=e,w):h},w.tooltipContent=function(e){return arguments.length?(p=e,w):p},w.noData=function(e){return arguments.length?(m=e,w):m},w.transitionDuration=function(e){return arguments.length?(y=e,w):y},w},e.models.distribution=function(){function l(e){return e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]),p=h.enter().append("g").attr("class","nvd3 nv-distribution"),d=p.append("g"),v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g"),m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))}),m.exit().selectAll("line.nv-dist"+i).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove(),g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r),g.attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}),f=u.copy()}),l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a,f;return l.options=e.utils.optionsFunc.bind(l),l.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,l):t},l.width=function(e){return arguments.length?(n=e,l):n},l.axis=function(e){return arguments.length?(i=e,l):i},l.size=function(e){return arguments.length?(r=e,l):r},l.getData=function(e){return arguments.length?(s=d3.functor(e),l):s},l.scale=function(e){return arguments.length?(u=e,l):u},l.color=function(t){return arguments.length?(o=e.utils.getColor(t),l):o},l},e.models.historicalBarChart=function(){function x(e){return e.each(function(d){var E=d3.select(this),T=this,N=(u||parseInt(E.style("width"))||960)-s.left-s.right,C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom;x.update=function(){E.call(x)},x.container=this,g.disabled=d.map(function(e){return!!e.disabled});if(!y){var k;y={};for(k in g)g[k]instanceof Array?y[k]=g[k].slice(0):y[k]=g[k]}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var L=E.selectAll(".nv-noData").data([b]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",s.left+N/2).attr("y",s.top+C/2).text(function(e){return e}),x}E.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();var A=E.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),M=A.select("g");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-barsWrap"),O.append("g").attr("class","nv-legendWrap"),f&&(i.width(N),M.select(".nv-legendWrap").datum(d).call(i),s.top!=i.height()&&(s.top=i.height(),C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom),A.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")),A.attr("transform","translate("+s.left+","+s.top+")"),h&&M.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),t.width(N).height(C).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var _=M.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));_.call(t),l&&(n.scale(v).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),M.select(".nv-x.nv-axis").call(n)),c&&(r.scale(m).ticks(C/36).tickSize(-N,0),M.select(".nv-y.nv-axis").call(r)),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,A.selectAll(".nv-series").classed("disabled",!1),e}),g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),e.call(x)}),i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=!0}),e.disabled=!1,g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),x.update()}),w.on("tooltipShow",function(e){p&&S(e,T.parentNode)}),w.on("changeState",function(e){typeof e.disabled!="undefined"&&(d.forEach(function(t,n){t.disabled=e.disabled[n]}),g.disabled=e.disabled),x.update()})}),x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=!1,l=!0,c=!0,h=!1,p=!0,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=0;n.orient("bottom").tickPadding(7),r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),x.dispatch=w,x.bars=t,x.legend=i,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),x.options=e.utils.optionsFunc.bind(x),x.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,x):s},x.width=function(e){return arguments.length?(u=e,x):u},x.height=function(e){return arguments.length?(a=e,x):a},x.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),x):o},x.showLegend=function(e){return arguments.length?(f=e,x):f},x.showXAxis=function(e){return arguments.length?(l=e,x):l},x.showYAxis=function(e){return arguments.length?(c=e,x):c},x.rightAlignYAxis=function(e){return arguments.length?(h=e,r.orient(e?"right":"left"),x):h},x.tooltips=function(e){return arguments.length?(p=e,x):p},x.tooltipContent=function(e){return arguments.length?(d=e,x):d},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},x.transitionDuration=function(e){return arguments.length?(E=e,x):E},x},e.models.indentedTree=function(){function g(e){return e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n)return d3.event.shiftKey=!1,e.values&&e.values.forEach(function(e){(e.values||e._values)&&k(e,0,!0)}),!0;if(!O(e))return!0;e.values?(e._values=e.values,e.values=null):(e.values=e._values,e._values=null),g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this),i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.call(g)},e[0]||(e[0]={key:a});var s=i.nodes(e[0]),y=d3.select(this).selectAll("div").data([[s]]),b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),w=b.append("table"),E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead"),x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody"),t=d3.max(s,function(e){return e.depth}),i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):!0})},function(e,t){return e.id||e.id||++m});N.exit().remove(),N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");t==0&&n.append("img").classed("nv-treeicon",!0).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k),n.each(function(n){!t&&v(n)?d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?t[e.key]?e.format(t[e.key]):"-":t[e.key]||"-"})}),e.showCount&&(n.append("span").attr("class","nv-childrenCount"),N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):!0}).length||e._values&&e._values.filter(function(e){return u?u(e):!0}).length||0)+")":""}))}),N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=!0,u=!1,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url},m=0;return g.options=e.utils.optionsFunc.bind(g),g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),scatter.color(i),g):i},g.id=function(e){return arguments.length?(s=e,g):s},g.header=function(e){return arguments.length?(o=e,g):o},g.noData=function(e){return arguments.length?(a=e,g):a},g.filterZero=function(e){return arguments.length?(u=e,g):u},g.columns=function(e){return arguments.length?(l=e,g):l},g.tableClass=function(e){return arguments.length?(c=e,g):c},g.iconOpen=function(e){return arguments.length?(h=e,g):h},g.iconClose=function(e){return arguments.length?(p=e,g):p},g.getUrl=function(e){return arguments.length?(v=e,g):v},g},e.models.legend=function(){function c(h){return h.each(function(c){var h=n-t.left-t.right,p=d3.select(this),d=p.selectAll("g.nv-legend").data([c]),v=d.enter().append("g").attr("class","nvd3 nv-legend").append("g"),m=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var g=m.selectAll(".nv-series").data(function(e){return e}),y=g.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){l.legendClick(e,t),a&&(f?(c.forEach(function(e){e.disabled=!0}),e.disabled=!1):(e.disabled=!e.disabled,c.every(function(e){return e.disabled})&&c.forEach(function(e){e.disabled=!1})),l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))}).on("dblclick",function(e,t){l.legendDblclick(e,t),a&&(c.forEach(function(e){e.disabled=!0}),e.disabled=!1,l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))});y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),g.classed("disabled",function(e){return e.disabled}),g.exit().remove(),g.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)}),g.select("text").text(i);if(o){var b=[];g.each(function(t,n){var r=d3.select(this).select("text"),i;try{i=r.getComputedTextLength();if(i<=0)throw Error()}catch(s){i=e.utils.calcApproxTextWidth(r)}b.push(i+28)});var w=0,E=0,S=[];while(E<h&&w<b.length)S[w]=b[w],E+=b[w++];w===0&&(w=1);while(E>h&&w>1){S=[],w--;for(var x=0;x<b.length;x++)b[x]>(S[x%w]||0)&&(S[x%w]=b[x]);E=S.reduce(function(e,t,n,r){return e+t})}var T=[];for(var N=0,C=0;N<w;N++)T[N]=C,C+=S[N];g.attr("transform",function(e,t){return"translate("+T[t%w]+","+(5+Math.floor(t/w)*20)+")"}),u?m.attr("transform","translate("+(n-t.right-E)+","+t.top+")"):m.attr("transform","translate(0,"+t.top+")"),r=t.top+t.bottom+Math.ceil(b.length/w)*20}else{var k=5,L=5,A=0,O;g.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;return O=L,n<t.left+t.right+O+i&&(L=O=5,k+=20),L+=i,L>A&&(A=L),"translate("+O+","+k+")"}),m.attr("transform","translate("+(n-t.right-A)+","+t.top+")"),r=t.top+t.bottom+k+15}}),c}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=!0,u=!0,a=!0,f=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return c.dispatch=l,c.options=e.utils.optionsFunc.bind(c),c.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,c):t},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.key=function(e){return arguments.length?(i=e,c):i},c.color=function(t){return arguments.length?(s=e.utils.getColor(t),c):s},c.align=function(e){return arguments.length?(o=e,c):o},c.rightAlign=function(e){return arguments.length?(u=e,c):u},c.updateState=function(e){return arguments.length?(a=e,c):a},c.radioButtonMode=function(e){return arguments.length?(f=e,c):f},c},e.models.line=function(){function m(g){return g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale(),h=t.yScale(),d=d||c,v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]),S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),T=S.append("defs"),N=S.append("g"),C=E.select("g");N.append("g").attr("class","nv-groups"),N.append("g").attr("class","nv-scatterWrap"),E.attr("transform","translate("+n.left+","+n.top+")"),t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.call(t),T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect"),E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b>0?b:0),C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":""),k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),L.exit().remove(),L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)}),L.style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])}),L.exit().selectAll("path.nv-area").remove(),A.attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))})),O.attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))})),d=c.copy(),v=h.copy()}),m}var t=e.models.scatter(),n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=!1,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;return m.dispatch=t.dispatch,m.scatter=t,d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.height=function(e){return arguments.length?(i=e,m):i},m.x=function(e){return arguments.length?(o=e,t.x(e),m):o},m.y=function(e){return arguments.length?(u=e,t.y(e),m):u},m.clipEdge=function(e){return arguments.length?(l=e,m):l},m.color=function(n){return arguments.length?(s=e.utils.getColor(n),t.color(s),m):s},m.interpolate=function(e){return arguments.length?(p=e,m):p},m.defined=function(e){return arguments.length?(a=e,m):a},m.isArea=function(e){return arguments.length?(f=d3.functor(e),m):f},m},e.models.lineChart=function(){function N(m){return m.each(function(m){var x=d3.select(this),C=this,k=(a||parseInt(x.style("width"))||960)-o.left-o.right,L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom;N.update=function(){x.call(N)},N.container=this,b.disabled=m.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b)b[A]instanceof Array?w[A]=b[A].slice(0):w[A]=b[A]}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var O=x.selectAll(".nv-noData").data([E]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e}),N}x.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var M=x.selectAll("g.nv-wrap.nv-lineChart").data([m]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),D=M.select("g");_.append("rect").style("opacity",0),_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-interactive"),D.select("rect").attr("width",k).attr("height",L>0?L:0),l&&(i.width(k),D.select(".nv-legendWrap").datum(m).call(i),o.top!=i.height()&&(o.top=i.height(),L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")),M.attr("transform","translate("+o.left+","+o.top+")"),p&&D.select(".nv-y.nv-axis").attr("transform","translate("+k+",0)"),d&&(s.width(k).height(L).margin({left:o.left,top:o.top}).svgContainer(x).xScale(g),M.select(".nv-interactive").call(s)),t.width(k).height(L).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var P=D.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));P.call(t),c&&(n.scale(g).ticks(k/100).tickSize(-L,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),D.select(".nv-x.nv-axis").call(n)),h&&(r.scale(y).ticks(L/36).tickSize(-k,0),D.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),N.update()}),s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x()),t.highlightPoint(r,f,!0);var s=n.values[f];if(typeof s=="undefined")return;typeof a=="undefined"&&(a=s),typeof l=="undefined"&&(l=N.xScale()(N.x()(s,f))),c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY),p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]),d=.03*p,g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);g!==null&&(c[g].highlight=!0)}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(C.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})(),s.renderGuideLine(l)}),s.dispatch.on("elementMouseout",function(e){S.tooltipHide(),t.clearHighlights()}),S.on("tooltipShow",function(e){v&&T(e,C.parentNode)}),S.on("changeState",function(e){typeof e.disabled!="undefined"&&m.length===e.disabled.length&&(m.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),N.update()})}),N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline(),o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!1,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=0;n.orient("bottom").tickPadding(7),r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),N.dispatch=S,N.lines=t,N.legend=i,N.xAxis=n,N.yAxis=r,N.interactiveLayer=s,d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),N.options=e.utils.optionsFunc.bind(N),N.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,N):o},N.width=function(e){return arguments.length?(a=e,N):a},N.height=function(e){return arguments.length?(f=e,N):f},N.color=function(t){return arguments.length?(u=e.utils.getColor(t),i.color(u),N):u},N.showLegend=function(e){return arguments.length?(l=e,N):l},N.showXAxis=function(e){return arguments.length?(c=e,N):c},N.showYAxis=function(e){return arguments.length?(h=e,N):h},N.rightAlignYAxis=function(e){return arguments.length?(p=e,r.orient(e?"right":"left"),N):p},N.useInteractiveGuideline=function(e){return arguments.length?(d=e,e===!0&&(N.interactive(!1),N.useVoronoi(!1)),N):d},N.tooltips=function(e){return arguments.length?(v=e,N):v},N.tooltipContent=function(e){return arguments.length?(m=e,N):m},N.state=function(e){return arguments.length?(b=e,N):b},N.defaultState=function(e){return arguments.length?(w=e,N):w},N.noData=function(e){return arguments.length?(E=e,N):E},N.transitionDuration=function(e){return arguments.length?(x=e,N):x},N},e.models.linePlusBarChart=function(){function T(e){return e.each(function(e){var l=d3.select(this),c=this,v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.call(T)},b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b)b[C]instanceof Array?w[C]=b[C].slice(0):w[C]=b[C]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e}),T}l.selectAll(".nv-noData").remove();var L=e.filter(function(e){return!e.disabled&&e.bar}),A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale(),g=n.yScale(),y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y1 nv-axis"),M.append("g").attr("class","nv-y2 nv-axis"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-linesWrap"),M.append("g").attr("class","nv-legendWrap"),p&&(o.width(v/2),_.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom),_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")),O.attr("transform","translate("+u.left+","+u.top+")"),t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar})),n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]),P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n),d3.transition(P).call(t),r.scale(m).ticks(v/100).tickSize(-N,0),_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(_.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(N/36).tickSize(-v,0),d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i),s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0),_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)"),d3.transition(_.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),T.update()}),S.on("tooltipShow",function(e){d&&x(e,c.parentNode)}),S.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),T.update()})}),T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(!0),t.clipEdge(!1).padData(!0),r.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),T.dispatch=S,T.legend=o,T.lines=t,T.bars=n,T.xAxis=r,T.y1Axis=i,T.y2Axis=s,d3.rebind(T,t,"defined","size","clipVoronoi","interpolate"),T.options=e.utils.optionsFunc.bind(T),T.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),T):l},T.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),T):c},T.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,T):u},T.width=function(e){return arguments.length?(a=e,T):a},T.height=function(e){return arguments.length?(f=e,T):f},T.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),T):h},T.showLegend=function(e){return arguments.length?(p=e,T):p},T.tooltips=function(e){return arguments.length?(d=e,T):d},T.tooltipContent=function(e){return arguments.length?(v=e,T):v},T.state=function(e){return arguments.length?(b=e,T):b},T.defaultState=function(e){return arguments.length?(w=e,T):w},T.noData=function(e){return arguments.length?(E=e,T):E},T},e.models.lineWithFocusChart=function(){function k(e){return e.each(function(e){function R(e){var t=+(e=="e"),n=t?1:-1,r=O/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),F.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1)return;T.brush({extent:n,brush:a}),U();var s=P.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.call(t),P.select(".nv-focus .nv-x.nv-axis").call(r),P.select(".nv-focus .nv-y.nv-axis").call(i)}var S=d3.select(this),N=this,L=(h||parseInt(S.style("width"))||960)-f.left-f.right,A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,O=d-l.top-l.bottom;k.update=function(){S.call(k)},k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var M=S.selectAll(".nv-noData").data([x]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",f.left+L/2).attr("y",f.top+A/2).text(function(e){return e}),k}S.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var _=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]),D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),P=_.select("g");D.append("g").attr("class","nv-legendWrap");var H=D.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap");var B=D.append("g").attr("class","nv-context");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap"),B.append("g").attr("class","nv-brushBackground"),B.append("g").attr("class","nv-x nv-brush"),b&&(u.width(L),P.select(".nv-legendWrap").datum(e).call(u),f.top!=u.height()&&(f.top=u.height(),A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d),P.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),_.attr("transform","translate("+f.left+","+f.top+")"),t.width(L).height(A).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),n.defined(t.defined()).width(L).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),P.select(".nv-context").attr("transform","translate(0,"+(A+f.bottom+l.top)+")");var j=P.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(j).call(n),r.scale(v).ticks(L/100).tickSize(-A,0),i.scale(m).ticks(A/36).tickSize(-L,0),P.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0),z(),k.transitionDuration(e)}),w&&a.extent(w);var F=P.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),I=F.enter().append("g");I.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",O),I.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",O);var q=P.select(".nv-x.nv-brush").call(a);q.selectAll("rect").attr("height",O),q.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(L/100).tickSize(-O,0),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(P.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(O/36).tickSize(-L,0),d3.transition(P.select(".nv-context .nv-y.nv-axis")).call(o),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("stateChange",function(e){k.update()}),T.on("tooltipShow",function(e){E&&C(e,N.parentNode)})}),k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=0;t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),k.dispatch=T,k.legend=u,k.lines=t,k.lines2=n,k.xAxis=r,k.yAxis=i,k.x2Axis=s,k.y2Axis=o,d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),k.options=e.utils.optionsFunc.bind(k),k.x=function(e){return arguments.length?(t.x(e),n.x(e),k):t.x},k.y=function(e){return arguments.length?(t.y(e),n.y(e),k):t.y},k.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,k):f},k.margin2=function(e){return arguments.length?(l=e,k):l},k.width=function(e){return arguments.length?(h=e,k):h},k.height=function(e){return arguments.length?(p=e,k):p},k.height2=function(e){return arguments.length?(d=e,k):d},k.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),k):c},k.showLegend=function(e){return arguments.length?(b=e,k):b},k.tooltips=function(e){return arguments.length?(E=e,k):E},k.tooltipContent=function(e){return arguments.length?(S=e,k):S},k.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),k):t.interpolate()},k.noData=function(e){return arguments.length?(x=e,k):x},k.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),k):r.tickFormat()},k.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),k):i.tickFormat()},k.brushExtent=function(e){return arguments.length?(w=e,k):w},k.transitionDuration=function(e){return arguments.length?(N=e,k):N},k},e.models.linePlusBarWithFocusChart=function(){function B(e){return e.each(function(e){function tt(e){var t=+(e=="e"),n=t?1:-1,r=I/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function nt(){h.empty()||h.extent(x),Y.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function rt(){x=h.empty()?null:h.extent(),S=h.empty()?k.domain():h.extent(),D.brush({extent:S,brush:h}),nt(),r.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),t.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=$.select(".nv-focus .nv-barsWrap").datum(R.length?R.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}):[{values:[]}]),i=$.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));R.length?C=r.xScale():C=t.xScale(),s.scale(C).ticks(j/100).tickSize(-F,0),s.domain([Math.ceil(S[0]),Math.floor(S[1])]),$.select(".nv-x.nv-axis").call(s),n.call(r),i.call(t),$.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")"),u.scale(L).ticks(F/36).tickSize(-j,0),$.select(".nv-focus .nv-y1.nv-axis").style("opacity",R.length?1:0),a.scale(A).ticks(F/36).tickSize(R.length?0:-j,0),$.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+C.range()[1]+",0)"),$.select(".nv-focus .nv-y1.nv-axis").call(u),$.select(".nv-focus .nv-y2.nv-axis").call(a)}var N=d3.select(this),P=this,j=(v||parseInt(N.style("width"))||960)-p.left-p.right,F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,I=g-d.top-d.bottom;B.update=function(){N.call(B)},B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=N.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",p.left+j/2).attr("y",p.top+F/2).text(function(e){return e}),B}N.selectAll(".nv-noData").remove();var R=e.filter(function(e){return!e.disabled&&e.bar}),U=e.filter(function(e){return!e.bar});C=r.xScale(),k=o.scale(),L=r.yScale(),A=t.yScale(),O=i.yScale(),M=n.yScale();var z=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})}),W=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,j]),k.domain(d3.extent(d3.merge(z.concat(W)),function(e){return e.x})).range([0,j]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),$=X.select("g");V.append("g").attr("class","nv-legendWrap");var J=V.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y1 nv-axis"),J.append("g").attr("class","nv-y2 nv-axis"),J.append("g").attr("class","nv-barsWrap"),J.append("g").attr("class","nv-linesWrap");var K=V.append("g").attr("class","nv-context");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y1 nv-axis"),K.append("g").attr("class","nv-y2 nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-linesWrap"),K.append("g").attr("class","nv-brushBackground"),K.append("g").attr("class","nv-x nv-brush"),E&&(c.width(j/2),$.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(c),p.top!=c.height()&&(p.top=c.height(),F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g),$.select(".nv-legendWrap").attr("transform","translate("+j/2+","+ -p.top+")")),X.attr("transform","translate("+p.left+","+p.top+")"),i.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),n.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var Q=$.select(".nv-context .nv-barsWrap").datum(R.length?R:[{values:[]}]),G=$.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);$.select(".nv-context").attr("transform","translate(0,"+(F+p.bottom+d.top)+")"),Q.call(i),G.call(n),h.x(k).on("brush",rt),x&&h.extent(x);var Y=$.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]),Z=Y.enter().append("g");Z.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),Z.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var et=$.select(".nv-x.nv-brush").call(h);et.selectAll("rect").attr("height",I),et.selectAll(".resize").append("path").attr("d",tt),o.ticks(j/100).tickSize(-I,0),$.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")"),$.select(".nv-context .nv-x.nv-axis").call(o),f.scale(O).ticks(I/36).tickSize(-j,0),$.select(".nv-context .nv-y1.nv-axis").style("opacity",R.length?1:0).attr("transform","translate(0,"+k.range()[0]+")"),$.select(".nv-context .nv-y1.nv-axis").call(f),l.scale(M).ticks(I/36).tickSize(R.length?0:-j,0),$.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+k.range()[1]+",0)"),$.select(".nv-context .nv-y2.nv-axis").call(l),c.dispatch.on("stateChange",function(e){B.update()}),D.on("tooltipShow",function(e){T&&H(e,P.parentNode)}),rt()}),B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush(),p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=!0,S,x=null,T=!0,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(!0),n.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),a.orient("right"),o.orient("bottom").tickPadding(5),f.orient("left"),l.orient("right");var H=function(n,r){S&&(n.pointIndex+=Math.ceil(S[0]));var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),D.on("tooltipHide",function(){T&&e.tooltip.cleanup()}),B.dispatch=D,B.legend=c,B.lines=t,B.lines2=n,B.bars=r,B.bars2=i,B.xAxis=s,B.x2Axis=o,B.y1Axis=u,B.y2Axis=a,B.y3Axis=f,B.y4Axis=l,d3.rebind(B,t,"defined","size","clipVoronoi","interpolate"),B.options=e.utils.optionsFunc.bind(B),B.x=function(e){return arguments.length?(y=e,t.x(e),r.x(e),B):y},B.y=function(e){return arguments.length?(b=e,t.y(e),r.y(e),B):b},B.margin=function(e){return arguments.length?(p.top=typeof e.top!="undefined"?e.top:p.top,p.right=typeof e.right!="undefined"?e.right:p.right,p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom,p.left=typeof e.left!="undefined"?e.left:p.left,B):p},B.width=function(e){return arguments.length?(v=e,B):v},B.height=function(e){return arguments.length?(m=e,B):m},B.color=function(t){return arguments.length?(w=e.utils.getColor(t),c.color(w),B):w},B.showLegend=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(T=e,B):T},B.tooltipContent=function(e){return arguments.length?(N=e,B):N},B.noData=function(e){return arguments.length?(_=e,B):_},B.brushExtent=function(e){return arguments.length?(x=e,B):x},B},e.models.multiBar=function(){function C(e){return e.each(function(e){var g=n-t.left-t.right,C=r-t.top-t.bottom,k=d3.select(this);d&&e.length&&(d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}]),c&&(e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),c&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i,i-=t.size):(t.y1=t.size+r,r+=t.size)})});var L=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(L).map(function(e){return e.x})).rangeBands(w||[0,g],S),s.domain(b||d3.extent(d3.merge(L).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[C,0]),i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1])),T=T||i,N=N||s;var A=k.selectAll("g.nv-wrap.nv-multibar").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),M=O.append("defs"),_=O.append("g"),D=A.select("g");_.append("g").attr("class","nv-groups"),A.attr("transform","translate("+t.left+","+t.top+")"),M.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),A.select("#nv-edge-clip-"+o+" rect").attr("width",g).attr("height",C),D.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var P=A.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});P.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),P.exit().selectAll("rect.nv-bar").attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove(),P.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)}),P.style("stroke-opacity",1).style("fill-opacity",.75);var H=P.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});H.exit().remove();var B=H.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});H.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),v&&(m||(m=e.map(function(){return!0})),H.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})),c?H.attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length)):H.attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0}),T=i.copy(),N=s.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h="zero",p=e.utils.defaultColor(),d=!1,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(i=e,C):i},C.yScale=function(e){return arguments.length?(s=e,C):s},C.xDomain=function(e){return arguments.length?(y=e,C):y},C.yDomain=function(e){return arguments.length?(b=e,C):b},C.xRange=function(e){return arguments.length?(w=e,C):w},C.yRange=function(e){return arguments.length?(E=e,C):E},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(c=e,C):c},C.stackOffset=function(e){return arguments.length?(h=e,C):h},C.clipEdge=function(e){return arguments.length?(l=e,C):l},C.color=function(t){return arguments.length?(p=e.utils.getColor(t),C):p},C.barColor=function(t){return arguments.length?(v=e.utils.getColor(t),C):v},C.disabled=function(e){return arguments.length?(m=e,C):m},C.id=function(e){return arguments.length?(o=e,C):o},C.hideable=function(e){return arguments.length?(d=e,C):d},C.delay=function(e){return arguments.length?(g=e,C):g},C.groupSpacing=function(e){return arguments.length?(S=e,C):S},C},e.models.multiBarChart=function(){function A(e){return e.each(function(e){var b=d3.select(this),k=this,O=(u||parseInt(b.style("width"))||960)-o.left-o.right,M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom;A.update=function(){b.call(A)},A.container=this,S.disabled=e.map(function(e){return!!e.disabled});if(!x){var _;x={};for(_ in S)S[_]instanceof Array?x[_]=S[_].slice(0):x[_]=S[_]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var D=b.selectAll(".nv-noData").data([T]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",o.left+O/2).attr("y",o.top+M/2).text(function(e){return e}),A}b.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();var P=b.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]),H=P.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),B=P.select("g");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-barsWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-controlsWrap"),c&&(i.width(O-C()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),B.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom),B.select(".nv-legendWrap").attr("transform","translate("+C()+","+ -o.top+")"));if(l){var j=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(C()).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -o.top+")").call(s)}P.attr("transform","translate("+o.left+","+o.top+")"),d&&B.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),t.disabled(e.map(function(e){return e.disabled})).width(O).height(M).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var F=B.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));F.call(t);if(h){n.scale(w).ticks(O/100).tickSize(-M,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),B.select(".nv-x.nv-axis").call(n);var I=B.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1);if(m){var q=function(e,t){return"translate("+e+","+t+")"},R=5,U=17;I.selectAll("text").attr("transform",function(e,t,n){return q(0,n%2==0?R:U)});var z=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;B.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return q(0,t===0||z%2!==0?U:R)})}v&&I.filter(function(t,n){return n%Math.ceil(e[0].values.length/(O/100))!==0}).selectAll("text, line").style("opacity",0),g&&I.selectAll(".tick text").attr("transform","rotate("+g+" 0,0)").style("text-anchor",g>0?"start":"end"),B.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}p&&(r.scale(E).ticks(M/36).tickSize(-O,0),B.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){S=e,N.stateChange(S),A.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;j=j.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}S.stacked=t.stacked(),N.stateChange(S),A.update()}),N.on("tooltipShow",function(e){y&&L(e,k.parentNode)}),N.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),S.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),S.stacked=n.stacked),A.update()})}),A}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=!1,g=0,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S={stacked:!1},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=function(){return l?180:0},k=0;t.stacked(!1),n.orient("bottom").tickPadding(7).highlightZero(!0).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(d?"right":"left").tickFormat(d3.format(",.1f")),s.updateState(!1);var L=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,A);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],N.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){y&&e.tooltip.cleanup()}),A.dispatch=N,A.multibar=t,A.legend=i,A.xAxis=n,A.yAxis=r,d3.rebind(A,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing"),A.options=e.utils.optionsFunc.bind(A),A.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,A):o},A.width=function(e){return arguments.length?(u=e,A):u},A.height=function(e){return arguments.length?(a=e,A):a},A.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),A):f},A.showControls=function(e){return arguments.length?(l=e,A):l},A.showLegend=function(e){return arguments.length?(c=e,A):c},A.showXAxis=function(e){return arguments.length?(h=e,A):h},A.showYAxis=function(e){return arguments.length?(p=e,A):p},A.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),A):d},A.reduceXTicks=function(e){return arguments.length?(v=e,A):v},A.rotateLabels=function(e){return arguments.length?(g=e,A):g},A.staggerLabels=function(e){return arguments.length?(m=e,A):m},A.tooltip=function(e){return arguments.length?(b=e,A):b},A.tooltips=function(e){return arguments.length?(y=e,A):y},A.tooltipContent=function(e){return arguments.length?(b=e,A):b},A.state=function(e){return arguments.length?(S=e,A):S},A.defaultState=function(e){return arguments.length?(x=e,A):x},A.noData=function(e){return arguments.length?(T=e,A):T},A.transitionDuration=function(e){return arguments.length?(k=e,A):k},A},e.models.multiBarHorizontal=function(){function C(e){return e.each(function(e){var i=n-t.left-t.right,y=r-t.top-t.bottom,C=d3.select(this);p&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),p&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i-t.size,i-=t.size):(t.y1=r,r+=t.size)})});var k=b&&w?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(b||d3.merge(k).map(function(e){return e.x})).rangeBands(E||[0,y],.1),o.domain(w||d3.extent(d3.merge(k).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f))),d&&!p?o.range(S||[o.domain()[0]<0?m:0,i-(o.domain()[1]>0?m:0)]):o.range(S||[0,i]),T=T||s,N=N||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var L=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),A=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),O=A.append("defs"),M=A.append("g"),_=L.select("g");M.append("g").attr("class","nv-groups"),L.attr("transform","translate("+t.left+","+t.top+")");var D=L.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)}),D.style("stroke-opacity",1).style("fill-opacity",.75);var P=D.selectAll("g.nv-bar").data(function(e){return e.values});P.exit().remove();var H=P.enter().append("g").attr("transform",function(t,n,r){return"translate("+N(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});H.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length)),P.on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.append("text"),d&&!p?(P.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return g(a(e,t))}),P.select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})):P.selectAll("text").text(""),v&&!p?(H.append("text").classed("nv-bar-label",!0),P.select("text.nv-bar-label").attr("text-anchor",function(e,t){return a(e,t)<0?"start":"end"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return u(e,t)}),P.select("text.nv-bar-label").attr("x",function(e,t){return a(e,t)<0?o(0)-o(a(e,t))+4:-4})):P.selectAll("text.nv-bar-label").text(""),P.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}),c&&(h||(h=e.map(function(){return!0})),P.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})),p?P.attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand()):P.attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)}),T=s.copy(),N=o.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=!1,d=!1,v=!1,m=60,g=d3.format(",.2f"),y=1200,b,w,E,S,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(s=e,C):s},C.yScale=function(e){return arguments.length?(o=e,C):o},C.xDomain=function(e){return arguments.length?(b=e,C):b},C.yDomain=function(e){return arguments.length?(w=e,C):w},C.xRange=function(e){return arguments.length?(E=e,C):E},C.yRange=function(e){return arguments.length?(S=e,C):S},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(p=e,C):p},C.color=function(t){return arguments.length?(l=e.utils.getColor(t),C):l},C.barColor=function(t){return arguments.length?(c=e.utils.getColor(t),C):c},C.disabled=function(e){return arguments.length?(h=e,C):h},C.id=function(e){return arguments.length?(i=e,C):i},C.delay=function(e){return arguments.length?(y=e,C):y},C.showValues=function(e){return arguments.length?(d=e,C):d},C.showBarLabels=function(e){return arguments.length?(v=e,C):v},C.valueFormat=function(e){return arguments.length?(g=e,C):g},C.valuePadding=function(e){return arguments.length?(m=e,C):m},C},e.models.multiBarHorizontalChart=function(){function C(e){return e.each(function(e){var d=d3.select(this),m=this,T=(u||parseInt(d.style("width"))||960)-o.left-o.right,k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom;C.update=function(){d.call(C)},C.container=this,b.disabled=e.map(function(e){return!!e.disabled});if(!w){var L;w={};for(L in b)b[L]instanceof Array?w[L]=b[L].slice(0):w[L]=b[L]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var A=d.selectAll(".nv-noData").data([E]);return A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",o.left+T/2).attr("y",o.top+k/2).text(function(e){return e}),C}d.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var O=d.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),c&&(i.width(T-x()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),_.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom),_.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")"));if(l){var D=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]),_.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -o.top+")").call(s)}O.attr("transform","translate("+o.left+","+o.top+")"),t.disabled(e.map(function(e){return e.disabled})).width(T).height(k).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var P=_.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));P.call(t);if(h){n.scale(g).ticks(k/24).tickSize(-T,0),_.select(".nv-x.nv-axis").call(n);var H=_.select(".nv-x.nv-axis").selectAll("g");H.selectAll("line, text")}p&&(r.scale(y).ticks(T/100).tickSize(-k,0),_.select(".nv-y.nv-axis").attr("transform","translate(0,"+k+")"),_.select(".nv-y.nv-axis").call(r)),_.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-k),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),C.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;D=D.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}b.stacked=t.stacked(),S.stateChange(b),C.update()}),S.on("tooltipShow",function(e){v&&N(e,m.parentNode)}),S.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),b.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),b.stacked=n.stacked),C.update()})}),C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"},g,y,b={stacked:d},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=0;t.stacked(d),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f")),s.updateState(!1);var N=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,C);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),C.dispatch=S,C.multibar=t,C.legend=i,C.xAxis=n,C.yAxis=r,d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor"),C.options=e.utils.optionsFunc.bind(C),C.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,C):o},C.width=function(e){return arguments.length?(u=e,C):u},C.height=function(e){return arguments.length?(a=e,C):a},C.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),C):f},C.showControls=function(e){return arguments.length?(l=e,C):l},C.showLegend=function(e){return arguments.length?(c=e,C):c},C.showXAxis=function(e){return arguments.length?(h=e,C):h},C.showYAxis=function(e){return arguments.length?(p=e,C):p},C.tooltip=function(e){return arguments.length?(m=e,C):m},C.tooltips=function(e){return arguments.length?(v=e,C):v},C.tooltipContent=function(e){return arguments.length?(m=e,C):m},C.state=function(e){return arguments.length?(b=e,C):b},C.defaultState=function(e){return arguments.length?(w=e,C):w},C.noData=function(e){return arguments.length?(E=e,C):E},C.transitionDuration=function(e){return arguments.length?(T=e,C):T},C},e.models.multiChart=function(){function C(e){return e.each(function(e){var u=d3.select(this),f=this;C.update=function(){u.call(C)},C.container=this;var k=(r||parseInt(u.style("width"))||960)-t.left-t.right,L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom,A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),_=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,k]);var j=u.selectAll("g.wrap.multiChart").data([e]),F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis"),F.append("g").attr("class","y1 axis"),F.append("g").attr("class","y2 axis"),F.append("g").attr("class","lines1Wrap"),F.append("g").attr("class","lines2Wrap"),F.append("g").attr("class","bars1Wrap"),F.append("g").attr("class","bars2Wrap"),F.append("g").attr("class","stack1Wrap"),F.append("g").attr("class","stack2Wrap"),F.append("g").attr("class","legendWrap");var I=j.select("g");s&&(x.width(k/2),I.select(".legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(x),t.top!=x.height()&&(t.top=x.height(),L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom),I.select(".legendWrap").attr("transform","translate("+k/2+","+ -t.top+")")),d.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"})),v.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"})),m.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"})),g.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"})),y.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"})),b.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"})),I.attr("transform","translate("+t.left+","+t.top+")");var q=I.select(".lines1Wrap").datum(A),R=I.select(".bars1Wrap").datum(M),U=I.select(".stack1Wrap").datum(D),z=I.select(".lines2Wrap").datum(O),W=I.select(".bars2Wrap").datum(_),X=I.select(".stack2Wrap").datum(P),V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],$=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];h.domain(l||d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,L]),p.domain(c||d3.extent(d3.merge(B).concat($),function(e){return e.y})).range([0,L]),d.yDomain(h.domain()),m.yDomain(h.domain()),y.yDomain(h.domain()),v.yDomain(p.domain()),g.yDomain(p.domain()),b.yDomain(p.domain()),D.length&&d3.transition(U).call(y),P.length&&d3.transition(X).call(b),M.length&&d3.transition(R).call(m),_.length&&d3.transition(W).call(g),A.length&&d3.transition(q).call(d),O.length&&d3.transition(z).call(v),w.ticks(k/100).tickSize(-L,0),I.select(".x.axis").attr("transform","translate(0,"+L+")"),d3.transition(I.select(".x.axis")).call(w),E.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y1.axis")).call(E),S.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y2.axis")).call(S),I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),x.dispatch.on("stateChange",function(e){C.update()}),T.on("tooltipShow",function(e){o&&N(e,f.parentNode)})}),C}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},a,f,l,c,a=d3.scale.linear(),h=d3.scale.linear(),p=d3.scale.linear(),d=e.models.line().yScale(h),v=e.models.line().yScale(p),m=e.models.multiBar().stacked(!1).yScale(h),g=e.models.multiBar().stacked(!1).yScale(p),y=e.models.stackedArea().yScale(h),b=e.models.stackedArea().yScale(p),w=e.models.axis().scale(a).orient("bottom").tickPadding(5),E=e.models.axis().scale(h).orient("left"),S=e.models.axis().scale(p).orient("right"),x=e.models.legend().height(30),T=d3.dispatch("tooltipShow","tooltipHide"),N=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=w.tickFormat()(d.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?S:E).tickFormat()(d.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,C);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),m.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),g.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),y.dispatch.on("tooltipShow",function(e){if(!Math.round(y.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),y.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),b.dispatch.on("tooltipShow",function(e){if(!Math.round(b.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),b.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),C.dispatch=T,C.lines1=d,C.lines2=v,C.bars1=m,C.bars2=g,C.stack1=y,C.stack2=b,C.xAxis=w,C.yAxis1=E,C.yAxis2=S,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(getX=e,d.x(e),m.x(e),C):getX},C.y=function(e){return arguments.length?(getY=e,d.y(e),m.y(e),C):getY},C.yDomain1=function(e){return arguments.length?(l=e,C):l},C.yDomain2=function(e){return arguments.length?(c=e,C):c},C.margin=function(e){return arguments.length?(t=e,C):t},C.width=function(e){return arguments.length?(r=e,C):r},C.height=function(e){return arguments.length?(i=e,C):i},C.color=function(e){return arguments.length?(n=e,x.color(e),C):n},C.showLegend=function(e){return arguments.length?(s=e,C):s},C.tooltips=function(e){return arguments.length?(o=e,C):o},C.tooltipContent=function(e){return arguments.length?(u=e,C):u},C},e.models.ohlcBar=function(){function x(e){return e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p))),v?s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range(w||[0,g]),o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-ticks"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x),A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!1,m=!0,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return x.dispatch=S,x.options=e.utils.optionsFunc.bind(x),x.x=function(e){return arguments.length?(u=e,x):u},x.y=function(e){return arguments.length?(a=e,x):a},x.open=function(e){return arguments.length?(f=e,x):f},x.close=function(e){return arguments.length?(l=e,x):l},x.high=function(e){return arguments.length?(c=e,x):c},x.low=function(e){return arguments.length?(h=e,x):h},x.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,x):t},x.width=function(e){return arguments.length?(n=e,x):n},x.height=function(e){return arguments.length?(r=e,x):r},x.xScale=function(e){return arguments.length?(s=e,x):s},x.yScale=function(e){return arguments.length?(o=e,x):o},x.xDomain=function(e){return arguments.length?(y=e,x):y},x.yDomain=function(e){return arguments.length?(b=e,x):b},x.xRange=function(e){return arguments.length?(w=e,x):w},x.yRange=function(e){return arguments.length?(E=e,x):E},x.forceX=function(e){return arguments.length?(p=e,x):p},x.forceY=function(e){return arguments.length?(d=e,x):d},x.padData=function(e){return arguments.length?(v=e,x):v},x.clipEdge=function(e){return arguments.length?(m=e,x):m},x.color=function(t){return arguments.length?(g=e.utils.getColor(t),x):g},x.id=function(e){return arguments.length?(i=e,x):i},x},e.models.pie=function(){function S(e){return e.each(function(e){function q(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function R(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle,e.startAngle=isNaN(e.startAngle)?0:e.startAngle,m||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return A(t(e))}}function U(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return A(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,S=Math.min(o,f)/2,x=S-S/5,T=d3.select(this),N=T.selectAll(".nv-wrap.nv-pie").data(e),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-pie"),k.append("g").attr("class","nv-pieLabels"),N.attr("transform","translate("+t.left+","+t.top+")"),L.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")"),L.select(".nv-pieLabels").attr("transform","translate("+o/2+","+f/2+")"),T.on("click",function(e,t){E.chartClick({data:e,index:t,pos:d3.event,id:u})});var A=d3.svg.arc().outerRadius(x);y&&A.startAngle(y),b&&A.endAngle(b),m&&A.innerRadius(S*w);var O=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)}),M=N.select(".nv-pie").selectAll(".nv-slice").data(O),_=N.select(".nv-pieLabels").selectAll(".nv-label").data(O);M.exit().remove(),_.exit().remove();var D=M.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),E.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),E.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){E.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(e,t){E.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()});M.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var P=D.append("path").each(function(e){this._current=e});M.select("path").attr("d",A);if(l){var H=d3.svg.arc().innerRadius(0);c&&(H=A),h&&(H=d3.svg.arc().outerRadius(A.outerRadius())),_.enter().append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}return e.outerRadius=S+10,e.innerRadius=S+15,"translate("+H.centroid(e)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",g?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var B={},j=14,F=140,I=function(e){return Math.floor(e[0]/F)*F+","+Math.floor(e[1]/j)*j};_.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}e.outerRadius=S+10,e.innerRadius=S+15;var n=H.centroid(e),r=I(n);return B[r]&&(n[1]-=j),B[I(n)]=!0,"translate("+n+")"}),_.select(".nv-label text").style("text-anchor",g?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI),r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>v?r[p]:""})}}),S}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=!0,c=!0,h=!1,p="key",v=.02,m=!1,g=!1,y=!1,b=!1,w=.5,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return S.dispatch=E,S.options=e.utils.optionsFunc.bind(S),S.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,S):t},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.values=function(t){return e.log("pie.values() is no longer supported."),S},S.x=function(e){return arguments.length?(i=e,S):i},S.y=function(e){return arguments.length?(s=d3.functor(e),S):s},S.description=function(e){return arguments.length?(o=e,S):o},S.showLabels=function(e){return arguments.length?(l=e,S):l},S.labelSunbeamLayout=function(e){return arguments.length?(g=e,S):g},S.donutLabelsOutside=function(e){return arguments.length?(h=e,S):h},S.pieLabelsOutside=function(e){return arguments.length?(c=e,S):c},S.labelType=function(e){return arguments.length?(p=e,p=p||"key",S):p},S.donut=function(e){return arguments.length?(m=e,S):m},S.donutRatio=function(e){return arguments.length?(w=e,S):w},S.startAngle=function(e){return arguments.length?(y=e,S):y},S.endAngle=function(e){return arguments.length?(b=e,S):b},S.id=function(e){return arguments.length?(u=e,S):u},S.color=function(t){return arguments.length?(a=e.utils.getColor(t),S):a},S.valueFormat=function(e){return arguments.length?(f=e,S):f},S.labelThreshold=function(e){return arguments.length?(v=e,S):v},S},e.models.pieChart=function(){function v(e){return e.each(function(e){var u=d3.select(this),a=this,f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.call(v)},v.container=this,l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l)l[m]instanceof Array?c[m]=l[m].slice(0):c[m]=l[m]}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);return g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e}),v}u.selectAll(".nv-noData").remove();var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),w=y.select("g");b.append("g").attr("class","nv-pieWrap"),b.append("g").attr("class","nv-legendWrap"),o&&(n.width(f).key(t.x()),y.select(".nv-legendWrap").datum(e).call(n),r.top!=n.height()&&(r.top=n.height(),d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom),y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),y.attr("transform","translate("+r.left+","+r.top+")"),t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t),n.dispatch.on("stateChange",function(e){l=e,p.stateChange(l),v.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)}),p.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),l.disabled=t.disabled),v.update()})}),v}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),d=function(n,r){var i=t.description()(n.point)||t.x()(n.point),s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],p.tooltipShow(e)}),p.on("tooltipShow",function(e){a&&d(e)}),p.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),v.legend=n,v.dispatch=p,v.pie=t,d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,v):r},v.width=function(e){return arguments.length?(i=e,v):i},v.height=function(e){return arguments.length?(s=e,v):s},v.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),v):u},v.showLegend=function(e){return arguments.length?(o=e,v):o},v.tooltips=function(e){return arguments.length?(a=e,v):a},v.tooltipContent=function(e){return arguments.length?(f=e,v):f},v.state=function(e){return arguments.length?(l=e,v):l},v.defaultState=function(e){return arguments.length?(c=e,v):c},v.noData=function(e){return arguments.length?(h=e,v):h},v},e.models.scatter=function(){function I(q){return q.each(function(I){function Q(){if(!g)return!1;var e,i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n),i=l(e,n);return[o(r),u(i),t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===!0){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T),c.exit().remove(),c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}i.length&&(i.push([o.range()[0]-20,u.range()[0]-20,null,null]),i.push([o.range()[1]+20,u.range()[1]+20,null,null]),i.push([o.range()[0]-20,u.range()[0]+20,null,null]),i.push([o.range()[1]+20,u.range()[1]-20,null,null]));var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]),p=1e-6;i=i.sort(function(e,t){return e[0]-t[0]||e[1]-t[1]});for(var d=0;d<i.length-1;)Math.abs(i[d][0]-i[d+1][0])<p&&Math.abs(i[d][1]-i[d+1][1])<p?i.splice(d+1,1):d++;var v=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}}),m=X.select(".nv-point-paths").selectAll("path").data(v);m.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),m.exit().remove(),m.attr("d",function(e){return!e||!e.data||e.data.length===0?"M 0 0":"M"+e.data.join("L")+"Z"});var y=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r=="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};m.on("click",function(e){y(e,_.elementClick)}).on("mouseover",function(e){y(e,_.elementMouseover)}).on("mouseout",function(e,t){y(e,_.elementMouseout)})}else X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})});F=!1}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d))),w&&I[0]?o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]):o.range(k||[0,q]),u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]),a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=!0;o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1])),isNaN(o.domain()[0])&&o.domain([-1,1]),isNaN(u.domain()[0])&&u.domain([-1,1]),P=P||o,H=H||u,B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":"")),$=V.append("defs"),J=V.append("g"),K=X.select("g");J.append("g").attr("class","nv-groups"),J.append("g").attr("class","nv-point-paths"),X.attr("transform","translate("+t.left+","+t.top+")"),$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R>0?R:0),K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":""),F=!0;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),G.exit().remove(),G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),G.style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)}),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j),j=setTimeout(Q,300),P=o.copy(),H=u.copy(),B=a.copy()}),I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=!0,d=[],v=[],m=[],g=!0,y=null,b=function(e){return!e.notActive},w=!1,E=.1,S=!1,x=!0,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=!1,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=!0,P,H,B,j,F=!1;return I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",!1)},I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)},_.on("elementMouseover.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!0)}),_.on("elementMouseout.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!1)}),I.dispatch=_,I.options=e.utils.optionsFunc.bind(I),I.x=function(e){return arguments.length?(f=d3.functor(e),I):f},I.y=function(e){return arguments.length?(l=d3.functor(e),I):l},I.size=function(e){return arguments.length?(c=d3.functor(e),I):c},I.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,I):t},I.width=function(e){return arguments.length?(n=e,I):n},I.height=function(e){return arguments.length?(r=e,I):r},I.xScale=function(e){return arguments.length?(o=e,I):o},I.yScale=function(e){return arguments.length?(u=e,I):u},I.zScale=function(e){return arguments.length?(a=e,I):a},I.xDomain=function(e){return arguments.length?(N=e,I):N},I.yDomain=function(e){return arguments.length?(C=e,I):C},I.sizeDomain=function(e){return arguments.length?(A=e,I):A},I.xRange=function(e){return arguments.length?(k=e,I):k},I.yRange=function(e){return arguments.length?(L=e,I):L},I.sizeRange=function(e){return arguments.length?(O=e,I):O},I.forceX=function(e){return arguments.length?(d=e,I):d},I.forceY=function(e){return arguments.length?(v=e,I):v},I.forceSize=function(e){return arguments.length?(m=e,I):m},I.interactive=function(e){return arguments.length?(g=e,I):g},I.pointKey=function(e){return arguments.length?(y=e,I):y},I.pointActive=function(e){return arguments.length?(b=e,I):b},I.padData=function(e){return arguments.length?(w=e,I):w},I.padDataOuter=function(e){return arguments.length?(E=e,I):E},I.clipEdge=function(e){return arguments.length?(S=e,I):S},I.clipVoronoi=function(e){return arguments.length?(x=e,I):x},I.useVoronoi=function(e){return arguments.length?(D=e,D===!1&&(x=!1),I):D},I.clipRadius=function(e){return arguments.length?(T=e,I):T},I.color=function(t){return arguments.length?(i=e.utils.getColor(t),I):i},I.shape=function(e){return arguments.length?(h=e,I):h},I.onlyCircles=function(e){return arguments.length?(p=e,I):p},I.id=function(e){return arguments.length?(s=e,I):s},I.singlePoint=function(e){return arguments.length?(M=e,I):M},I},e.models.scatterChart=function(){function F(e){return e.each(function(e){function J(){if(T)return W.select(".nv-point-paths").style("pointer-events","all"),!1;W.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]),p.distortion(x).focus(i[1]),W.select(".nv-scatterWrap").call(t),b&&W.select(".nv-x.nv-axis").call(n),w&&W.select(".nv-y.nv-axis").call(r),W.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),W.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this,L=(f||parseInt(C.style("width"))||960)-a.left-a.right,D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.call(F)},F.container=this,A.disabled=e.map(function(e){return!!e.disabled});if(!O){var I;O={};for(I in A)A[I]instanceof Array?O[I]=A[I].slice(0):O[I]=A[I]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=C.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",a.left+L/2).attr("y",a.top+D/2).text(function(e){return e}),F}C.selectAll(".nv-noData").remove(),P=P||h,H=H||p;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]),U=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),z=U.append("g"),W=R.select("g");z.append("rect").attr("class","nvd3 nv-background"),z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-scatterWrap"),z.append("g").attr("class","nv-distWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap");if(y){var X=S?L/2:L;i.width(X),R.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(L-X)+","+ -a.top+")")}S&&(s.width(180).color(["#444"]),W.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)),R.attr("transform","translate("+a.left+","+a.top+")"),E&&W.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),t.width(L).height(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),d!==0&&t.xDomain(null),v!==0&&t.yDomain(null),R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var V=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*V,h.domain()[1]+d*V])}if(v!==0){var $=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*$,p.domain()[1]+v*$])}(v!==0||d!==0)&&R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),b&&(n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-D,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),w&&(r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():D/36).tickSize(-L,0),W.select(".nv-y.nv-axis").call(r)),m&&(o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),W.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),W.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(W.select(".nv-background").attr("width",L).attr("height",D),W.select(".nv-background").on("mousemove",J),W.select(".nv-background").on("click",function(){T=!T}),t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,x=e.disabled?0:2.5,W.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),W.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(x).focus(0),p.distortion(x).focus(0),W.select(".nv-scatterWrap").call(t),W.select(".nv-x.nv-axis").call(n),W.select(".nv-y.nv-axis").call(r)):T=!1,F.update()}),i.dispatch.on("stateChange",function(e){A.disabled=e.disabled,M.stateChange(A),F.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-D}),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],M.tooltipShow(e)}),M.on("tooltipShow",function(e){N&&B(e,k.parentNode)}),M.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),A.disabled=t.disabled),F.update()}),P=h.copy(),H=p.copy()}),F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!0,w=!0,E=!1,S=!!d3.fisheye,x=0,T=!1,N=!0,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(E?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var P,H,B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));C!=null&&e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip"),k!=null&&e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip"),L!=null&&e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)},j=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),M.on("tooltipHide",function(){N&&e.tooltip.cleanup()}),F.dispatch=M,F.scatter=t,F.legend=i,F.controls=s,F.xAxis=n,F.yAxis=r,F.distX=o,F.distY=u,d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),F.options=e.utils.optionsFunc.bind(F),F.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,F):a},F.width=function(e){return arguments.length?(f=e,F):f},F.height=function(e){return arguments.length?(l=e,F):l},F.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),F):c},F.showDistX=function(e){return arguments.length?(m=e,F):m},F.showDistY=function(e){return arguments.length?(g=e,F):g},F.showControls=function(e){return arguments.length?(S=e,F):S},F.showLegend=function(e){return arguments.length?(y=e,F):y},F.showXAxis=function(e){return arguments.length?(b=e,F):b},F.showYAxis=function(e){return arguments.length?(w=e,F):w},F.rightAlignYAxis=function(e){return arguments.length?(E=e,r.orient(e?"right":"left"),F):E},F.fisheye=function(e){return arguments.length?(x=e,F):x},F.xPadding=function(e){return arguments.length?(d=e,F):d},F.yPadding=function(e){return arguments.length?(v=e,F):v},F.tooltips=function(e){return arguments.length?(N=e,F):N},F.tooltipContent=function(e){return arguments.length?(L=e,F):L},F.tooltipXContent=function(e){return arguments.length?(C=e,F):C},F.tooltipYContent=function(e){return arguments.length?(k=e,F):k},F.state=function(e){return arguments.length?(A=e,F):A},F.defaultState=function(e){return arguments.length?(O=e,F):O},F.noData=function(e){return arguments.length?(_=e,F):_},F.transitionDuration=function(e){return arguments.length?(D=e,F):D},F},e.models.scatterPlusLineChart=function(){function B(e){return e.each(function(e){function V(){if(S)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]),p.distortion(E).focus(i[1]),U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),g&&U.select(".nv-x.nv-axis").call(n),y&&U.select(".nv-y.nv-axis").call(r),U.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),U.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,C=(f||parseInt(T.style("width"))||960)-a.left-a.right,M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.call(B)},B.container=this,k.disabled=e.map(function(e){return!!e.disabled});if(!L){var j;L={};for(j in k)k[j]instanceof Array?L[j]=k[j].slice(0):L[j]=k[j]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var F=T.selectAll(".nv-noData").data([O]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",a.left+C/2).attr("y",a.top+M/2).text(function(e){return e}),B}T.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),_=_||h,D=D||p;var I=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),R=q.append("g"),U=I.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+a.left+","+a.top+")"),b&&U.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),m&&(i.width(C/2),I.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),I.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")),w&&(s.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(C).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),I.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var z=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});z.enter().append("g").attr("class","nv-regLines");var W=z.selectAll(".nv-regLine").data(function(e){return[e]}),X=W.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);W.attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),g&&(n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-M,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),y&&(r.scale(p).ticks(r.ticks()?r.ticks():M/36).tickSize(-C,0),U.select(".nv-y.nv-axis").call(r)),d&&(o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(U.select(".nv-background").attr("width",C).attr("height",M),U.select(".nv-background").on("mousemove",V),U.select(".nv-background").on("click",function(){S=!S}),t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,E=e.disabled?0:2.5,U.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(E).focus(0),p.distortion(E).focus(0),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r)):S=!1,B.update()}),i.dispatch.on("stateChange",function(e){k=e,A.stateChange(k),B.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-M),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],A.tooltipShow(e)}),A.on("tooltipShow",function(e){x&&P(e,N.parentNode)}),A.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),k.disabled=t.disabled),B.update()}),_=h.copy(),D=p.copy()}),B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!0,y=!0,b=!1,w=!!d3.fisheye,E=0,S=!1,x=!0,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(b?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var _,D,P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));T!=null&&e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip"),N!=null&&e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip"),C!=null&&e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)},H=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),A.on("tooltipHide",function(){x&&e.tooltip.cleanup()}),B.dispatch=A,B.scatter=t,B.legend=i,B.controls=s,B.xAxis=n,B.yAxis=r,B.distX=o,B.distY=u,d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),B.options=e.utils.optionsFunc.bind(B),B.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,B):a},B.width=function(e){return arguments.length?(f=e,B):f},B.height=function(e){return arguments.length?(l=e,B):l},B.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),B):c},B.showDistX=function(e){return arguments.length?(d=e,B):d},B.showDistY=function(e){return arguments.length?(v=e,B):v},B.showControls=function(e){return arguments.length?(w=e,B):w},B.showLegend=function(e){return arguments.length?(m=e,B):m},B.showXAxis=function(e){return arguments.length?(g=e,B):g},B.showYAxis=function(e){return arguments.length?(y=e,B):y},B.rightAlignYAxis=function(e){return arguments.length?(b=e,r.orient(e?"right":"left"),B):b},B.fisheye=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(x=e,B):x},B.tooltipContent=function(e){return arguments.length?(C=e,B):C},B.tooltipXContent=function(e){return arguments.length?(T=e,B):T},B.tooltipYContent=function(e){return arguments.length?(N=e,B):N},B.state=function(e){return arguments.length?(k=e,B):k},B.defaultState=function(e){return arguments.length?(L=e,B):L},B.noData=function(e){return arguments.length?(O=e,B):O},B.transitionDuration=function(e){return arguments.length?(M=e,B):M},B},e.models.sparkline=function(){function d(e){return e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]),o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),b=g.append("g"),w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path"),E.exit().remove(),E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle"),S.exit().remove(),S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;return d.options=e.utils.optionsFunc.bind(d),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.height=function(e){return arguments.length?(r=e,d):r},d.x=function(e){return arguments.length?(u=d3.functor(e),d):u},d.y=function(e){return arguments.length?(a=d3.functor(e),d):a},d.xScale=function(e){return arguments.length?(s=e,d):s},d.yScale=function(e){return arguments.length?(o=e,d):o},d.xDomain=function(e){return arguments.length?(l=e,d):l},d.yDomain=function(e){return arguments.length?(c=e,d):c},d.xRange=function(e){return arguments.length?(h=e,d):h},d.yRange=function(e){return arguments.length?(p=e,d):p},d.animate=function(e){return arguments.length?(i=e,d):i},d.color=function(t){return arguments.length?(f=e.utils.getColor(t),d):f},d},e.models.sparklinePlus=function(){function v(e){return e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s<e.length;s++)Math.abs(t.x()(e[s],s)-n)<r&&(r=Math.abs(t.x()(e[s],s)-n),i=s);return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))],O()}var m=d3.select(this),g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)},v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e}),v}m.selectAll(".nv-noData").remove();var E=t.y()(c[c.length-1],c.length-1);s=t.xScale(),o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),N=T.append("g"),C=S.select("g");N.append("g").attr("class","nv-sparklineWrap"),N.append("g").attr("class","nv-valueWrap"),N.append("g").attr("class","nv-hoverArea"),S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b),k.call(t);var L=C.select(".nv-valueWrap"),A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start"),A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E)),N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[],O()}),C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)}),v}var t=e.models.sparkline(),n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=!1,f=d3.format(",r"),l=d3.format(",.2f"),c=!0,h=!0,p=!1,d="No Data Available.";return v.sparkline=t,d3.rebind(v,t,"x","y","xScale","yScale","color"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,v):n},v.width=function(e){return arguments.length?(r=e,v):r},v.height=function(e){return arguments.length?(i=e,v):i},v.xTickFormat=function(e){return arguments.length?(f=e,v):f},v.yTickFormat=function(e){return arguments.length?(l=e,v):l},v.showValue=function(e){return arguments.length?(c=e,v):c},v.alignValue=function(e){return arguments.length?(h=e,v):h},v.rightAlignValue=function(e){return arguments.length?(p=e,v):p},v.noData=function(e){return arguments.length?(d=e,v):d},v},e.models.stackedArea=function(){function g(e){return e.each(function(e){var a=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);p=v.xScale(),d=v.yScale();var E=e;e.forEach(function(e,t){e.seriesIndex=t,e.values=e.values.map(function(e,n){return e.index=n,e.seriesIndex=t,e})});var S=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(S);var T=w.selectAll("g.nv-wrap.nv-stackedarea").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-areaWrap"),k.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+t.left+","+t.top+")"),v.width(a).height(b).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var A=L.select(".nv-scatterWrap").datum(e);A.call(v),C.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",b),L.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c),M=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)}),_=L.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});_.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return M(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("click",function(e,t){d3.select(this).classed("hover",!1),m.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}),_.exit().remove(),_.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)}),_.attr("d",function(e,t){return O(e.values,t)}),v.dispatch.on("elementMouseover.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!1)}),g.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<E.length;i++)o+=u(E[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=!1,p,d,v=e.models.scatter(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return v.size(2.2).sizeDomain([2.2,2.2]),v.dispatch.on("elementClick.area",function(e){m.areaClick(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){m.tooltipHide(e)}),g.dispatch=m,g.scatter=v,d3.rebind(g,v,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),g.options=e.utils.optionsFunc.bind(g),g.x=function(e){return arguments.length?(o=d3.functor(e),g):o},g.y=function(e){return arguments.length?(u=d3.functor(e),g):u},g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.clipEdge=function(e){return arguments.length?(h=e,g):h},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),g):i},g.offset=function(e){return arguments.length?(f=e,g):f},g.order=function(e){return arguments.length?(l=e,g):l},g.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":g.offset("zero"),g.order("default");break;case"stream":g.offset("wiggle"),g.order("inside-out");break;case"stream-center":g.offset("silhouette"),g.order("inside-out");break;case"expand":g.offset("expand"),g.order("default");break;case"stack_percent":g.offset(g.d3_stackedOffset_stackPercent),g.order("default")}return g},g.interpolate=function(e){return arguments.length?(c=e,g):c},g},e.models.stackedAreaChart=function(){function M(y){return y.each(function(y){var A=d3.select(this),_=this,D=(a||parseInt(A.style("width"))||960)-u.left-u.right,P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom;M.update=function(){A.call(M)},M.container=this,S.disabled=y.map(function(e){return!!e.disabled});if(!x){var H;x={};for(H in S)S[H]instanceof Array?x[H]=S[H].slice(0):x[H]=S[H]}if(!y||!y.length||!y.filter(function(e){return e.values.length}).length){var B=A.selectAll(".nv-noData").data([T]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",u.left+D/2).attr("y",u.top+P/2).text(function(e){return e}),M}A.selectAll(".nv-noData").remove(),b=t.xScale(),w=t.yScale();var j=A.selectAll("g.nv-wrap.nv-stackedAreaChart").data([y]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),I=j.select("g");F.append("rect").style("opacity",0),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-stackedWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap"),F.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",D).attr("height",P);if(h){var q=c?D-C:D;i.width(q),I.select(".nv-legendWrap").datum(y).call(i),u.top!=i.height()&&(u.top=i.height(),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-legendWrap").attr("transform","translate("+(D-q)+","+ -u.top+")")}if(c){var R=[{key:L.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:L.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:L.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:L.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];C=k.length/3*260,R=R.filter(function(e){return k.indexOf(e.metaKey)!==-1}),s.width(C).color(["#444","#444","#444"]),I.select(".nv-controlsWrap").datum(R).call(s),u.top!=Math.max(s.height(),i.height())&&(u.top=Math.max(s.height(),i.height()),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}j.attr("transform","translate("+u.left+","+u.top+")"),v&&I.select(".nv-y.nv-axis").attr("transform","translate("+D+",0)"),m&&(o.width(D).height(P).margin({left:u.left,top:u.top}).svgContainer(A).xScale(b),j.select(".nv-interactive").call(o)),t.width(D).height(P);var U=I.select(".nv-stackedWrap").datum(y);U.call(t),p&&(n.scale(b).ticks(D/100).tickSize(-P,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+P+")"),I.select(".nv-x.nv-axis").call(n)),d&&(r.scale(w).ticks(t.offset()=="wiggle"?0:P/36).tickSize(-D,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):E),I.select(".nv-y.nv-axis").call(r)),t.dispatch.on("areaClick.toggle",function(e){y.filter(function(e){return!e.disabled}).length===1?y.forEach(function(e){e.disabled=!1}):y.forEach(function(t,n){t.disabled=n!=e.seriesIndex}),S.disabled=y.map(function(e){return!!e.disabled}),N.stateChange(S),M.update()}),i.dispatch.on("stateChange",function(e){S.disabled=e.disabled,N.stateChange(S),M.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;R=R.map(function(e){return e.disabled=!0,e}),e.disabled=!1,t.style(e.style),S.style=t.style(),N.stateChange(S),M.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];y.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,M.x()),t.highlightPoint(r,a,!0);var o=n.values[a];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof f=="undefined"&&(f=M.xScale()(M.x()(o,a)));var u=t.style()=="expand"?o.display.y:M.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})}),c.reverse();if(c.length>2){var h=M.yScale().invert(i.mouseY),p=Infinity,d=null;c.forEach(function(e,t){h=Math.abs(h);var n=Math.abs(e.stackedValue.y0),r=Math.abs(e.stackedValue.y);if(h>=n&&h<=r+n){d=t;return}}),d!=null&&(c[d].highlight=!0)}var v=n.tickFormat()(M.x()(s,a)),m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(_.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})(),o.renderGuideLine(f)}),o.dispatch.on("elementMouseout",function(e){N.tooltipHide(),t.clearHighlights()}),N.on("tooltipShow",function(e){g&&O(e,_.parentNode)}),N.on("changeState",function(e){typeof e.disabled!="undefined"&&y.length===e.disabled.length&&(y.forEach(function(t,n){t.disabled=e.disabled[n]}),S.disabled=e.disabled),typeof e.style!="undefined"&&t.style(e.style),M.update()})}),M}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=!0,h=!0,p=!0,d=!0,v=!1,m=!1,g=!0,y=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},b,w,E=d3.format(",.2f"),S={style:t.style()},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=250,k=["Stacked","Stream","Expanded"],L={},A=0;n.orient("bottom").tickPadding(7),r.orient(v?"right":"left"),s.updateState(!1);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=y(i.series.key,a,f,i,M);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],N.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){g&&e.tooltip.cleanup()}),M.dispatch=N,M.stacked=t,M.legend=i,M.controls=s,M.xAxis=n,M.yAxis=r,M.interactiveLayer=o,d3.rebind(M,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),M.options=e.utils.optionsFunc.bind(M),M.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,M):u},M.width=function(e){return arguments.length?(a=e,M):a},M.height=function(e){return arguments.length?(f=e,M):f},M.color=function(n){return arguments.length?(l=e.utils.getColor(n),i.color(l),t.color(l),M):l},M.showControls=function(e){return arguments.length?(c=e,M):c},M.showLegend=function(e){return arguments.length?(h=e,M):h},M.showXAxis=function(e){return arguments.length?(p=e,M):p},M.showYAxis=function(e){return arguments.length?(d=e,M):d},M.rightAlignYAxis=function(e){return arguments.length?(v=e,r.orient(e?"right":"left"),M):v},M.useInteractiveGuideline=function(e){return arguments.length?(m=e,e===!0&&(M.interactive(!1),M.useVoronoi(!1)),M):m},M.tooltip=function(e){return arguments.length?(y=e,M):y},M.tooltips=function(e){return arguments.length?(g=e,M):g},M.tooltipContent=function(e){return arguments.length?(y=e,M):y},M.state=function(e){return arguments.length?(S=e,M):S},M.defaultState=function(e){return arguments.length?(x=e,M):x},M.noData=function(e){return arguments.length?(T=e,M):T},M.transitionDuration=function(e){return arguments.length?(A=e,M):A},M.controlsData=function(e){return arguments.length?(k=e,M):k},M.controlLabels=function(e){return arguments.length?typeof e!="object"?L:(L=e,M):L},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(E=e,r):E},M}}(),define("plugin/plugins/nvd3/nv.d3",function(){}),define("plugin/charts/nvd3/common/config",["plugin/charts/forms/default","plugin/plugins/nvd3/nv.d3"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"NVD3",tag:"svg",keywords:"small",query_limit:500})}),define("plugin/charts/nvd3/bar/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/line_focus/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line with focus",category:"Others",zoomable:"native",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/pie/config",["plugin/plugins/nvd3/nv.d3"],function(){return $.extend(!0,{},{title:"Pie chart",category:"Area charts",library:"NVD3",tag:"svg",keywords:"small",columns:{label:{title:"Labels",is_label:!0,is_auto:!0},y:{title:"Values",is_numeric:!0}},settings:{main_separator:{type:"separator",title:"Pie chart settings"},donut_ratio:{title:"Donut ratio",info:"Determine how large the donut hole will be.",type:"select",init:"0.5",data:[{label:"50%",value:"0.5"},{label:"25%",value:"0.25"},{label:"10%",value:"0.10"},{label:"0%",value:"0"}]},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},label_separator:{type:"separator",title:"Label settings"},label_type:{title:"Donut label",info:"What would you like to show for each slice?",type:"select",init:"percent",data:[{label:"-- Nothing --",value:"hide",hide:"label_outside"},{label:"Label column",value:"key",show:"label_outside"},{label:"Value column",value:"value",show:"label_outside"},{label:"Percentage",value:"percent",show:"label_outside"}]},label_outside:{title:"Show outside",info:"Would you like to show labels outside the donut?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{init:"true",hide:!0}}})}),define("plugin/charts/nvd3/stackedarea_full/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Expanded",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea_stream/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stream",category:"Area charts",zoomable:!0,keywords:"default small",showmaxmin:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/histogram/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogram",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{x_axis_label:{init:"Values"},y_axis_label:{init:"Density"},y_axis_type:{init:"f"},y_axis_precision:{init:".2"}}})}),define("plugin/charts/nvd3/line/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/scatter/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/common/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"jqPlot",tag:"div",zoomable:!0,keywords:"medium",query_limit:1e4,settings:{separator_grid:{title:"Grids",type:"separator"},x_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the X axis?",type:"radiobutton",init:"false",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]},y_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the Y axis?",type:"radiobutton",init:"true",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]}}})}),define("plugin/charts/jqplot/bar/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/line/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/scatter/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}},settings:{x_axis_grid:{init:"true"}}})}),define("plugin/charts/jqplot/boxplot/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Box plot",category:"Data processing (requires 'charts' tool from Toolshed)",library:"jqPlot",tag:"div",execute:"boxplot",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{show_legend:{init:"false"}}})}),define("plugin/charts/jqplot/histogram_discrete/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Discrete Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogramdiscrete",keywords:"small medium large",columns:{x:{title:"Observations",is_label:!0}},settings:{x_axis_label:{init:"Breaks"},y_axis_label:{init:"Density"}}})}),define("plugin/charts/others/heatmap/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"Heatmap",category:"Others",query_limit:1e3,library:"Custom",tag:"svg",keywords:"small",zoomable:!0,columns:{x:{title:"Column labels",is_label:!0,is_numeric:!0,is_unique:!0},y:{title:"Row labels",is_label:!0,is_numeric:!0,is_unique:!0},z:{title:"Observation",is_numeric:!0}},settings:{use_panels:{init:"true",hide:!0},color_set:{title:"Color scheme",info:"Select a color scheme for your heatmap",type:"select",init:"jet",data:[{label:"Cold-to-Hot",value:"hot"},{label:"Cool",value:"cool"},{label:"Copper",value:"copper"},{label:"Gray scale",value:"gray"},{label:"Jet",value:"jet"},{label:"No-Green",value:"no_green"},{label:"Ocean",value:"ocean"},{label:"Polar",value:"polar"},{label:"Red-to-Green",value:"redgreen"},{label:"Red-to-green (saturated)",value:"red2green"},{label:"Relief",value:"relief"},{label:"Seismograph",value:"seis"},{label:"Sealand",value:"sealand"},{label:"Split",value:"split"},{label:"Wysiwyg",value:"wysiwyg"}]},url_template:{title:"Url template",info:"Enter a url to link the labels with external sources. Use __LABEL__ as placeholder.",type:"text",init:"",placeholder:"http://someurl.com?id=__LABEL__"}}})}),define("plugin/charts/others/heatmap_cluster/config",["plugin/charts/others/heatmap/config"],function(e){return $.extend(!0,{},e,{title:"Clustered Heatmap",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"heatmap",keywords:"small medium large"})}),define("plugin/charts/types",["plugin/charts/nvd3/bar/config","plugin/charts/nvd3/bar_stacked/config","plugin/charts/nvd3/bar_horizontal/config","plugin/charts/nvd3/bar_horizontal_stacked/config","plugin/charts/nvd3/line_focus/config","plugin/charts/nvd3/pie/config","plugin/charts/nvd3/stackedarea_full/config","plugin/charts/nvd3/stackedarea_stream/config","plugin/charts/nvd3/histogram/config","plugin/charts/nvd3/line/config","plugin/charts/nvd3/scatter/config","plugin/charts/nvd3/stackedarea/config","plugin/charts/jqplot/bar/config","plugin/charts/jqplot/line/config","plugin/charts/jqplot/scatter/config","plugin/charts/jqplot/boxplot/config","plugin/charts/jqplot/histogram_discrete/config","plugin/charts/others/heatmap/config","plugin/charts/others/heatmap_cluster/config"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y){return Backbone.Model.extend({defaults:{nvd3_bar:e,nvd3_bar_stacked:t,nvd3_bar_horizontal:n,nvd3_bar_horizontal_stacked:r,nvd3_line_focus:i,nvd3_stackedarea:c,nvd3_stackedarea_full:o,nvd3_stackedarea_stream:u,nvd3_pie:s,nvd3_line:f,nvd3_scatter:l,nvd3_histogram:a,jqplot_bar:h,jqplot_histogram_discrete:m,jqplot_line:p,jqplot_scatter:d,jqplot_boxplot:v,others_heatmap:g,others_heatmap_cluster:y}})}),define("plugin/app",["mvc/ui/ui-modal","mvc/ui/ui-portlet","plugin/library/ui","utils/utils","plugin/library/jobs","plugin/library/datasets","plugin/library/storage","plugin/views/viewer","plugin/views/editor","plugin/models/config","plugin/models/chart","plugin/charts/types"],function(e,t,n,r,i,s,o,u,a,f,l,c){return Backbone.View.extend({initialize:function(t){this.options=t,Galaxy&&Galaxy.modal?this.modal=Galaxy.modal:this.modal=new e.View,this.config=new f,this.types=new c,this.chart=new l,this.jobs=new i(this),this.datasets=new s(this),this.storage=new o(this),this.viewer_view=new u(this),this.editor_view=new a(this),this.$el.append(this.viewer_view.$el),this.$el.append(this.editor_view.$el);if(!this.storage.load())this.go("editor");else{this.go("viewer");var n=this;this.chart.deferred.execute(function(){n.chart.trigger("redraw")})}},go:function(e){$(".tooltip").hide();switch(e){case"editor":this.editor_view.show(),this.viewer_view.hide();break;case"viewer":this.editor_view.hide(),this.viewer_view.show()}},chartPath:function(e){var t=e.split(/_(.+)/);return t.length>=2?t[0]+"/"+t[1]:(console.debug("FAILED App:chartPath() - Invalid format: "+e),undefined)},execute:function(e){},onunload:function(){},log:function(e,t){console.log(e+" "+t)}})});
\ No newline at end of file
+define("mvc/ui/ui-modal",[],function(){var e=Backbone.View.extend({elMain:"body",optionsDefault:{title:"ui-modal",body:"",backdrop:!0,height:null,width:null,closing_events:!1,closing_callback:null},buttonList:{},initialize:function(e){e&&this._create(e)},show:function(e){this.initialize(e),this.options.height?(this.$body.css("height",this.options.height),this.$body.css("overflow","hidden")):this.$body.css("max-height",$(window).height()/2),this.options.width&&this.$dialog.css("width",this.options.width),this.visible?this.$el.show():this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.visible=!1,this.$el.fadeOut("fast"),this.options.closing_callback&&this.options.closing_callback()},enableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!1)},disableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!0)},showButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).show()},hideButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).hide()},getButton:function(e){var t=this.buttonList[e];return this.$buttons.find("#"+t)},scrollTop:function(){return this.$body.scrollTop()},_create:function(e){var t=this;this.options=_.defaults(e,this.optionsDefault),this.options.body=="progress"&&(this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')),this.$el&&(this.$el.remove(),$(document).off("keyup.ui-modal")),this.setElement(this._template(this.options.title)),this.$dialog=this.$el.find(".modal-dialog"),this.$body=this.$el.find(".modal-body"),this.$footer=this.$el.find(".modal-footer"),this.$buttons=this.$el.find(".buttons"),this.$backdrop=this.$el.find(".modal-backdrop"),this.$body.html(this.options.body),this.options.backdrop||this.$backdrop.removeClass("in");if(this.options.buttons){this.buttonList={};var n=0;$.each(this.options.buttons,function(e,r){var i="button-"+n++;t.$buttons.append($('<button id="'+i+'"></button>').text(e).click(r)).append(" "),t.buttonList[e]=i})}else this.$footer.hide();$(this.elMain).append($(this.el)),this.options.closing_events&&($(document).on("keyup.ui-modal",function(e){e.keyCode==27&&t.hide()}),this.$el.find(".modal-backdrop").on("click",function(){t.hide()}))},_template:function(e){return'<div class="ui-modal modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+e+"</h4>"+"</div>"+'<div class="modal-body" style="position: static;"></div>'+'<div class="modal-footer">'+'<div class="buttons" style="float: right;"></div>'+"</div>"+"</div"+"</div>"+"</div>"}});return{View:e}}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t==null?x.identity:t);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.unzip=function(e){var t=[];return x.each(e,function(e,n){x.each(e,function(e,r){t.length<=r&&(t[r]=[]),t[r][n]=e})}),t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o,u=0,a=function(){u=new Date,s=null,o=e.apply(r,i)};return function(){var f=new Date;!u&&n===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(s),s=null,u=f,o=e.apply(r,i)):s||(s=setTimeout(a,l)),o}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("libs/underscore",function(e){return function(){var t,n;return t||e._}}(this)),define("utils/utils",["libs/underscore"],function(e){function t(e,t,r){n("GET",e,{},t,r)}function n(e,t,n,r,i){if(e=="GET"||e=="DELETE")t.indexOf("?")==-1?t+="?":t+="&",t+=$.param(n);var s=new XMLHttpRequest;s.open(e,t,!0),s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Cache-Control","no-cache"),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("Content-Type","application/json"),s.onloadend=function(){var e=s.status;try{response=jQuery.parseJSON(s.responseText)}catch(t){response=s.responseText}e==200?r&&r(response):i&&i(response)},e=="GET"||e=="DELETE"?s.send():s.send(JSON.stringify(n))}function r(e,t){var n=$('<div class="'+e+'"></div>');n.appendTo(":eq(0)");var r=n.css(t);return n.remove(),r}function i(e){$('link[href^="'+e+'"]').length||$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}function s(t,n){return t?e.defaults(t,n):n}function o(e,t){var n="";if(e>=1e11)e/=1e11,n="TB";else if(e>=1e8)e/=1e8,n="GB";else if(e>=1e5)e/=1e5,n="MB";else if(e>=100)e/=100,n="KB";else{if(!(e>0))return"<strong>-</strong>";e*=10,n="b"}var r=Math.round(e)/10;return t?r+" "+n:"<strong>"+r+"</strong> "+n}function u(){return"x"+Math.random().toString(36).substring(2,9)}function a(e){var t=$("<p></p>");return t.append(e),t}function f(){var e=new Date,t=(e.getHours()<10?"0":"")+e.getHours(),n=(e.getMinutes()<10?"0":"")+e.getMinutes(),r=e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+", "+t+":"+n;return r}return{cssLoadFile:i,cssGetAttribute:r,get:t,merge:s,bytesToString:o,uuid:u,time:f,wrap:a,request:n}}),define("mvc/ui/ui-portlet",["utils/utils"],function(e){var t=Backbone.View.extend({visible:!1,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,placement:"bottom"},$title:null,$content:null,$buttons:null,$operations:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$content=this.$el.find("#content"),this.$title=this.$el.find("#portlet-header-text");var n=this.$el.find("#portlet-content");this.options.scrollable?n.addClass("scroll"):this.options.title?n.addClass("no-scroll"):n.addClass("no-scroll-no-title"),this.options.nopadding&&(n.css("padding","0px"),this.$content.css("padding","0px")),this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var r=this;$.each(this.options.buttons,function(e,t){t.$el.prop("id",e),r.$buttons.append(t.$el)})}else this.$buttons.remove();this.$operations=$(this.el).find("#operations");if(this.options.operations){var r=this;$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$operations.append(t.$el)})}this.options.body&&this.append(this.options.body)},append:function(t){this.$content.append(e.wrap(t))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){var n=this.$operations.find("#"+e);n.off("click"),n.on("click",t)},title:function(e){var t=this.$title;return e&&t.html(e),t.html()},_template:function(e){var t='<div class="ui-portlet">';return e.title&&(t+='<div id="portlet-header" class="portlet-header"><div id="operations" style="float: right;"></div><h3>',e.icon&&(t+='<i class="icon fa '+e.icon+'"> </i>'),t+='<span id="portlet-header-text">'+e.title+"</span>"+"</h3>"+"</div>"),t+='<div id="portlet-content" class="portlet-content">',e.placement=="top"&&(t+='<div id="buttons" class="buttons"></div>'),t+='<div id="content" class="content"></div>',e.placement=="bottom"&&(t+='<div id="buttons" class="buttons"></div>'),t+="</div></div>",t}});return{View:t}}),define("plugin/library/ui-select",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:!0,wait:!1},selected:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.selected=this.options.value,this.setElement(this._template(this.options)),this.$select=this.$el.find("#select"),this.$icon=this.$el.find("#icon");var n=this;this.$select.on("change",function(){n.value(n.$select.val())}),this.on("change",function(){n.options.onchange&&n.options.onchange(n.value())}),this._refresh(),this.options.visible||this.hide(),this.options.wait?this.wait():this.show()},value:function(e){var t=this.selected;e!==undefined&&(this.selected=e,this.$select.val(e));var n=this.selected;return n&&n!=t&&this.options.onchange&&this.options.onchange(n),n},first:function(){var e=this.$select.find("option");return e.length>0?e.val():undefined},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-caret-down"),this.$select.show(),this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-spinner fa-spin"),this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",!1)},disable:function(){this.$select.prop("disabled",!0)},add:function(e){this.$select.append(this._templateOption(e)),this._refresh()},del:function(e){this.$select.find("option[value="+e+"]").remove(),this.$select.trigger("change"),this._refresh()},update:function(e){this.$select.find("option").remove();for(var t in e)this.$select.append(this._templateOption(e[t]));this._refresh()},setOnChange:function(e){this.options.onchange=e},exists:function(e){return this.$select.find("option[value="+e+"]").length>0},_refresh:function(){this.$select.find("option[value=null]").remove();var e=this.$select.find("option").length;e==0?(this.disable(),this.$select.append(this._templateOption({value:"null",label:this.options.empty}))):this.enable(),this.selected&&this.$select.val(this.selected)},_templateOption:function(e){return'<option value="'+e.value+'">'+e.label+"</option>"},_template:function(e){var t='<div id="'+e.id+'" class="ui-select">'+'<div class="button">'+'<i id="icon"/>'+"</div>"+'<select id="select" class="select '+e.cls+" "+e.id+'">';for(key in e.data){var n=e.data[key],r="";if(n.value==e.value||n.value=="")r="selected";t+='<option value="'+n.value+'" '+r+">"+n.label+"</option>"}return t+="</select></div>",t}});return{View:t}}),define("plugin/library/ui-button-menu",["utils/utils"],function(e){return Backbone.View.extend({optionsDefault:{id:"",title:"","float":"right",icon:null,onclick:null,cls:"icon-btn",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""},$menu:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement($(this._template(this.options)));var n=$(this.el).find(".root"),r=this;n.on("click",function(e){$(".tooltip").hide(),e.preventDefault(),r.options.onclick&&r.options.onclick()}),this.options.visible||this.hide(),n.tooltip({title:t.tooltip,placement:"bottom"})},show:function(){$(this.el).show()},hide:function(){$(this.el).hide()},addMenu:function(t){var n={title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"};n=e.merge(t,n),this.$menu||($(this.el).append(this._templateMenu()),this.$menu=$(this.el).find(".menu"));var r=$(this._templateMenuItem(n));r.on("click",function(e){e.preventDefault(),n.onclick&&n.onclick()}),this.$menu.append(r),n.divider&&this.$menu.append($(this._templateDivider()))},_templateMenuItem:function(e){var t='<li><a href="'+e.href+'" target="'+e.target+'">';return e.icon&&(t+='<i class="fa '+e.icon+'"></i>'),t+=" "+e.title+"</a>"+"</li>",t},_templateMenu:function(){return'<ul class="menu dropdown-menu pull-right" role="menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.float+"; "+t+'" class="ui-button-icon dropdown '+e.cls+'">';return e.title?n+='<div class="root button dropdown-toggle" data-toggle="dropdown"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}})}),define("plugin/library/ui",["utils/utils","plugin/library/ui-select","plugin/library/ui-button-menu","mvc/ui/ui-modal"],function(e,t,n,r){var i=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},_template:function(e){return'<img class="ui-image '+e.cls+'" src="'+e.url+'"/>'}}),s=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},title:function(e){this.$el.html(e)},_template:function(e){return'<label class="ui-label '+e.cls+'">'+e.title+"</label>"},value:function(){return options.title}}),o=Backbone.View.extend({optionsDefault:{"float":"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){return'<div><span class="fa '+e.icon+'" class="ui-icon"/> '+e.title+"</div>"}}),u=Backbone.View.extend({optionsDefault:{id:null,title:"","float":"right",cls:"btn btn-default",icon:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t='<button id="'+e.id+'" type="submit" style="float: '+e.float+';" type="button" class="ui-button '+e.cls+'">';return e.icon&&(t+='<i class="icon fa '+e.icon+'"></i> '),t+=e.title+"</button>",t}}),a=Backbone.View.extend({optionsDefault:{id:null,title:"","float":"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.float+"; "+t+'" class="ui-button-icon '+e.cls+'">';return e.title?n+='<div class="button"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}}),f=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick)},_template:function(e){return'<div><a href="javascript:void(0)" class="ui-anchor '+e.cls+'">'+e.title+"</a></div>"}}),l=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement("<div></div>")},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options)),this.$el.find(".alert").append(t.message),this.$el.fadeIn();if(!t.persistent){var n=this;window.setTimeout(function(){n.$el.is(":visible")?n.$el.fadeOut():n.$el.hide()},3e3)}}else this.$el.fadeOut()},_template:function(e){return'<div class="ui-message alert alert-'+e.status+'"/>'}}),c=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options));var n=this;this.options.onclick&&this.$el.on("submit",function(e){var t=n.$el.find("#search");n.options.onclick(t.val())})},_template:function(e){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+e.searchword+'">'+'<button type="submit" class="btn search-btn">'+'<i class="fa fa-search"></i>'+"</button>"+"</form>"+"</div>"}}),h=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:!1,visible:!0,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return'<input id="'+e.id+'" type="'+e.type+'" value="'+e.value+'" placeholder="'+e.placeholder+'" class="ui-input '+e.cls+'">'}}),p=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:!1,visible:!0,cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return'<textarea id="'+e.id+'" class="ui-textarea '+e.cls+'" rows="5"></textarea>'}}),d=Backbone.View.extend({optionsDefault:{value:"",visible:!0,cls:"",data:[],id:e.uuid()},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.visible||this.$el.hide(),this.options.value&&this.value(this.options.value),this.current=this.options.value;var n=this;this.$el.find("input").on("change",function(){n.value(n._getValue())})},value:function(e){var t=this.current;e!==undefined&&(this.$el.find("label").removeClass("active"),this.$el.find('[value="'+e+'"]').closest("label").addClass("active"),this.current=e);var n=this.current;return n!=t&&this.options.onchange&&this.options.onchange(this.current),this.current},_getValue:function(){var e=this.$el.find(":checked"),t=null;return e.length>0&&(t=e.val()),t},_template:function(e){var t='<div class="btn-group ui-radiobutton" data-toggle="buttons">';for(key in e.data){var n=e.data[key];t+='<label class="btn btn-default"><input type="radio" name="'+e.id+'" value="'+n.value+'" selected>'+n.label+"</label>"}return t+="</div>",t}});return{Anchor:f,Button:u,ButtonIcon:a,ButtonMenu:n,Icon:o,Image:i,Input:h,Label:s,Message:l,Modal:r,RadioButton:d,Searchbox:c,Select:t,Textarea:p}}),define("plugin/library/jobs",["utils/utils"],function(e){return Backbone.Model.extend({initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e,t,n,r,i){var s=this;e.state("wait","Requesting job results...");var o=e.get("dataset_id_job");o!=""?s._wait(e,r,i):s._submit(e,t,n,r,i)},cleanup:function(t){var n=this,r=t.get("dataset_id_job");r!=""&&(e.request("PUT",config.root+"api/histories/none/contents/"+r,{deleted:!0},function(){n._refreshHdas()}),t.set("dataset_id_job",""))},_submit:function(t,n,r,i,s){var o=this,u=t.id,a=t.get("type"),f=t.definition;data={tool_id:"charts",inputs:{input:{id:t.get("dataset_id"),src:"hda"},module:f.execute,columns:r,settings:n}},t.state("wait","Sending job request..."),e.request("POST",config.root+"api/tools",data,function(e){if(!e.outputs||e.outputs.length==0)t.state("failed","Job submission failed. No response."),s&&s();else{o._refreshHdas();var n=e.outputs[0];t.state("wait","Your job has been queued. You may close the browser window. The job will run in the background."),t.set("dataset_id_job",n.id),this.app.storage.save(),o._wait(t,i,s)}},function(e){var n="";e&&e.message&&e.message.data&&e.message.data.input&&(n=e.message.data.input+"."),t.state("failed","This visualization requires the 'charts' tool. Please make sure it is installed. "+n),s&&s()})},_wait:function(t,n,r){var i=this;e.request("GET",config.root+"api/datasets/"+t.get("dataset_id_job"),{},function(e){var s=!1;switch(e.state){case"ok":t.state("wait","Job completed successfully..."),n&&n(e),s=!0;break;case"error":t.state("failed","Job has failed. Please check the history for details."),r&&r(e),s=!0;break;case"running":t.state("wait","Your job is running. You may close the browser window. The job will continue in the background.")}s||setTimeout(function(){i._wait(t,n,r)},i.app.config.get("query_timeout"))})},_refreshHdas:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.refreshContents()}})}),define("plugin/library/datasets",["utils/utils"],function(e){return Backbone.Collection.extend({list:{},cache:{},initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e){e.groups?this._get_blocks(e):this._get_dataset(e.id,e.success,e.error)},_get_blocks:function(e){function h(i){c._get(i,function(){var s=!1;for(var o in e.groups){destination_group=e.groups[o],source_group=i.groups[o],destination_group.values||(destination_group.values=[]),destination_group.values=destination_group.values.concat(source_group.values);if(source_group.values.length==0){s=!0;break}}if(++l<a&&!s){n&&n(parseInt(l/a*100));var u=i.start+r;i=$.extend(!0,f,{start:u}),h(i)}else t()})}var t=e.success,n=e.progress,r=this.app.config.get("query_limit"),i=this.app.config.get("query_timeout"),s=e.start||0,o=s+e.query_limit||s+this.app.config.get("query_limit"),u=Math.abs(o-s);if(u<=0){console.debug("FAILED - Datasets::request() - Invalid query range.");return}var a=Math.ceil(u/r)||1,f=$.extend(!0,{},e),l=0,c=this,p=$.extend(!0,f,{start:s});this._get_dataset(e.id,function(){h(p)})},_get_dataset:function(t,n,r){var i=this.list[t];if(i){n(i);return}var s=this;e.request("GET",config.root+"api/datasets/"+t,{},function(e){switch(e.state){case"error":r&&r(e);break;default:s.list[t]=e,n(e)}})},_block_id:function(e,t){return e.id+"_"+e.start+"_"+e.start+this.app.config.get("query_limit")+"_"+t},_get:function(e,t){e.start=e.start||0;var n=[],r={},i=0;for(var s in e.groups){var o=e.groups[s];for(var u in o.columns){var a=o.columns[u].index,f=this._block_id(e,a);if(this.cache[f]||a==="auto"||a==="zero")continue;!r[a]&&a!==undefined&&(r[a]=i,n.push(a),i++)}}if(n.length==0){this._fill_from_cache(e),t(e);return}var l={dataset_id:e.id,start:e.start,columns:n},c=this;this._fetch(l,function(r){for(var i in r){var s=n[i],o=c._block_id(e,s);c.cache[o]=r[i]}c._fill_from_cache(e),t(e)})},_fill_from_cache:function(e){var t=e.start;console.debug("Datasets::_fill_from_cache() - Filling request from cache at "+t+".");var n=0;for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s],u=this._block_id(e,o.index),a=this.cache[u];a&&(n=Math.max(n,a.length))}}n==0&&console.debug("Datasets::_fill_from_cache() - Reached data range limit.");for(var r in e.groups){var i=e.groups[r];i.values=[];for(var f=0;f<n;f++)i.values[f]={x:parseInt(f)+t}}for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s];switch(o.index){case"auto":for(var f=0;f<n;f++){var l=i.values[f];l[s]=parseInt(f)+t}break;case"zero":for(var f=0;f<n;f++){var l=i.values[f];l[s]=0}break;default:var u=this._block_id(e,o.index),a=this.cache[u];for(var f=0;f<n;f++){var l=i.values[f],c=a[f];isNaN(c)&&!o.is_label&&(c=0),l[s]=c}}}}},_fetch:function(t,n){var r=t.start?t.start:0,i=this.app.config.get("query_limit"),s=0;t.columns&&(s=t.columns.length,console.debug("Datasets::_fetch() - Fetching "+s+" column(s) at "+r+".")),s==0&&console.debug("Datasets::_fetch() - No columns requested");var o="";for(var u in t.columns)o+=t.columns[u]+",";o=o.substring(0,o.length-1);var a=this;e.request("GET",config.root+"api/datasets/"+t.dataset_id,{data_type:"raw_data",provider:"dataset-column",limit:i,offset:r,indeces:o},function(e){var t=new Array(s);for(var r=0;r<s;r++)t[r]=[];for(var r in e.data){var i=e.data[r];for(var o in i){var u=i[o];u!==undefined&&u!=2147483647&&t[o].push(u)}}console.debug("Datasets::_fetch() - Fetching complete."),n(t)})}})}),define("plugin/models/group",[],function(){return Backbone.Model.extend({defaults:{key:"Data label",date:""},reset:function(){this.clear({silent:!0}).set(this.defaults),this.trigger("reset",this)}})}),define("plugin/models/groups",["plugin/models/group"],function(e){return Backbone.Collection.extend({model:e})}),define("plugin/models/chart",["plugin/models/groups"],function(e){return Backbone.Model.extend({defaults:{id:null,title:"",type:"",date:null,state:"",state_info:"",modified:!1,dataset_id:"",dataset_id_job:""},initialize:function(t){this.groups=new e,this.settings=new Backbone.Model},reset:function(){this.clear({silent:!0}).set(this.defaults),this.groups.reset(),this.settings.clear(),this.trigger("reset",this)},copy:function(e){var t=this;t.clear({silent:!0}).set(this.defaults),t.set(e.attributes),t.settings=e.settings.clone(),t.groups.reset(),e.groups.each(function(e){t.groups.add(e.clone())}),t.trigger("change",t)},state:function(e,t){this.set("state",e),this.set("state_info",t),this.trigger("set:state"),console.debug("Chart:state() - "+t+" ("+e+")")}})});var Visualization=Backbone.Model.extend({defaults:{config:{}},urlRoot:function(){var e="/api/visualizations";return window.galaxy_config&&galaxy_config.root?galaxy_config.root+e:e},initialize:function(e){_.isObject(e.config)&&_.isObject(this.defaults.config)&&_.defaults(e.config,this.defaults.config),this._setUpListeners()},_setUpListeners:function(){},set:function(e,t){if(e==="config"){var n=this.get("config");_.isObject(n)&&(t=_.extend(_.clone(n),t))}return Backbone.Model.prototype.set.call(this,e,t),this},toString:function(){var e=this.get("id")||"";return this.get("title")&&(e+=":"+this.get("title")),"Visualization("+e+")"}}),VisualizationCollection=Backbone.Collection.extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(e,t){t=t||{}},set:function(e,t){var n=this;e=_.map(e,function(e){var t=n.get(e.id);if(!t)return e;var r=t.toJSON();return _.extend(r,e),r}),Backbone.Collection.prototype.set.call(this,e,t)},toString:function(){return["VisualizationCollection(",[this.historyId,this.length].join(),")"].join("")}});define("mvc/visualization/visualization-model",function(){}),define("plugin/library/storage",["utils/utils","plugin/models/chart","plugin/models/group","mvc/visualization/visualization-model"],function(e,t,n){return Backbone.Model.extend({vis:null,initialize:function(e){this.app=e,this.chart=this.app.chart,this.options=this.app.options,this.id=this.options.id,this.vis=new Visualization({type:"charts",config:{dataset_id:this.options.config.dataset_id,chart_dict:{}}}),this.id&&(this.vis.id=this.id);var t=this.options.config.chart_dict;t&&(this.vis.get("config").chart_dict=t)},save:function(){var e=this.app.chart;this.vis.get("config").chart_dict={};var t=e.get("title");t!=""&&this.vis.set("title",t);var n={attributes:e.attributes,settings:e.settings.attributes,groups:[]};e.groups.each(function(e){n.groups.push(e.attributes)}),this.vis.get("config").chart_dict=n;var r=this;this.vis.save().fail(function(e,t,n){console.error(e,t,n)}).then(function(e){e&&e.id&&(r.id=e.id)})},load:function(){var e=this.vis.get("config").chart_dict;if(!e.attributes)return!1;var t=e.attributes.type;if(!t)return console.debug("Storage::load() - Chart type not provided. Invalid format."),!1;var r=this.app.types.get(t);if(!r)return console.debug("Storage::load() - Chart type not supported. Please re-configure the chart. Resetting chart."),!1;console.debug("Storage::load() - Loading chart type "+t+"."),this.chart.definition=r,this.chart.set(e.attributes),this.chart.state("ok","Loading saved visualization..."),this.chart.settings.set(e.settings);for(var i in e.groups)this.chart.groups.add(new n(e.groups[i]));return this.chart.set("modified",!1),!0}})}),define("plugin/library/deferred",["utils/utils"],function(e){return Backbone.Model.extend({queue:[],process:{},counter:0,initialize:function(){this.on("refresh",function(){for(var e in this.queue)if(this.counter==0){var t=this.queue[e];this.queue.splice(e,1),t()}})},execute:function(e){this.queue.push(e),this.trigger("refresh")},register:function(){var t=e.uuid();return this.process[t]=!0,this.counter++,console.debug("Deferred:register() - Registering "+t),t},done:function(e){this.process[e]&&(delete this.process[e],this.counter--,console.debug("Deferred:done() - Unregistering "+e),this.trigger("refresh"))},ready:function(){return this.counter==0}})}),define("plugin/views/viewport",["mvc/ui/ui-portlet","plugin/library/ui","utils/utils"],function(e,t,n){return Backbone.View.extend({container_list:[],canvas_list:[],initialize:function(e,t){this.app=e,this.chart=this.app.chart,this.options=n.merge(t,this.optionsDefault),this.setElement($(this._template())),this._fullscreen(this.$el,100),this._createContainer("div");var r=this;this.chart.on("redraw",function(){r._draw(r.chart)}),this.chart.on("set:state",function(){var e=r.$el.find("#info"),t=r.$el.find(".charts-viewport-container"),n=e.find("#icon");n.removeClass(),e.show(),e.find("#text").html(r.chart.get("state_info"));var i=r.chart.get("state");switch(i){case"ok":e.hide(),t.show();break;case"failed":n.addClass("icon fa fa-warning"),t.hide();break;default:n.addClass("icon fa fa-spinner fa-spin"),t.show()}})},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_fullscreen:function(e,t){e.css("height",$(window).height()-t),$(window).resize(function(){e.css("height",$(window).height()-t)})},_createContainer:function(e,t){t=t||1;for(var n in this.container_list)this.container_list[n].remove();this.container_list=[],this.canvas_list=[];for(var n=0;n<t;n++){var r=$(this._templateContainer(e,parseInt(100/t)));this.$el.append(r),this.container_list[n]=r,this.canvas_list[n]=r.find(".charts-viewport-canvas").attr("id")}},_draw:function(e){var t=this,n=this.app.deferred.register(),r=e.get("type");this.chart_definition=e.definition;var i=1;e.settings.get("use_panels")==="true"&&(i=e.groups.length),this._createContainer(this.chart_definition.tag,i),e.state("wait","Please wait...");if(!this.chart_definition.execute||this.chart_definition.execute&&e.get("modified"))this.app.jobs.cleanup(e),e.set("modified",!1);var t=this;require(["plugin/charts/"+this.app.chartPath(r)+"/wrapper"],function(r){if(t.chart_definition.execute)t.app.jobs.request(e,t._defaultSettingsString(e),t._defaultRequestString(e),function(){var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})},function(){this.app.deferred.done(n)});else var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})})},_defaultRequestString:function(e){var t="",n=0,r=this;return e.groups.each(function(e){n++;for(var i in r.chart_definition.columns)t+=i+"_"+n+":"+(parseInt(e.get(i))+1)+", "}),t.substring(0,t.length-2)},_defaultSettingsString:function(e){var t="";for(key in e.settings.attributes)t+=key+":"+e.settings.get(key)+", ";return t.substring(0,t.length-2)},_defaultRequestDictionary:function(e){var t={groups:[]};this.chart_definition.execute?t.id=e.get("dataset_id_job"):t.id=e.get("dataset_id");var r=0,i=this;return e.groups.each(function(e){var s={};for(var o in i.chart_definition.columns){var u=i.chart_definition.columns[o];s[o]=n.merge({index:e.get(o)},u)}t.groups.push({key:++r+":"+e.get("key"),columns:s})}),t},_template:function(){return'<div class="charts-viewport"><div id="info" class="info"><span id="icon" class="icon"/><span id="text" class="text" /></div></div>'},_templateContainer:function(e,t){return'<div class="charts-viewport-container" style="width:'+t+'%;">'+'<div id="menu"/>'+"<"+e+' id="'+n.uuid()+'" class="charts-viewport-canvas">'+"</div>"}})}),define("plugin/library/screenshot",["libs/underscore"],function(e){function t(e){e.$el.find("svg").length>0?r(e):n(e)}function n(e){try{var t=e.$el.find(".jqplot-target"),n=t.jqplotToImageStr({});n&&(window.location.href=n.replace("image/png","image/octet-stream"))}catch(r){console.debug("FAILED - Screenshot::_fromCanvas() - "+r),e.error&&e.error("Please reduce your chart to a single panel and try again.")}}function r(e){var t=e.$el,n=e.url,r=e.name,s=new XMLSerializer,o=document.createElement("canvas"),u=$(o),a=t.find("svg").length,f=t.find("svg").first(),l=parseInt(f.css("height")),c=parseInt(f.css("width"));u.attr("width",c*a),u.attr("height",l),(!o.getContext||!o.getContext("2d"))&&alert("Your browser doesn't support this feature, please use a modern browser");var h=o.getContext("2d"),p=0;t.find("svg").each(function(){var e=$(this);e.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:c,height:l});var t=s.serializeToString(this);h.drawSvg(t,p,0,c,l),p+=c}),window.location.href=i(o,o.getContext("2d"),"white").replace("image/png","image/octet-stream")}function i(e,t,n){var r=e.width,i=e.height,s;if(n){s=t.getImageData(0,0,r,i);var o=t.globalCompositeOperation;t.globalCompositeOperation="destination-over",t.fillStyle=n,t.fillRect(0,0,r,i)}var u=e.toDataURL("image/png");return n&&(t.clearRect(0,0,r,i),t.putImageData(s,0,0),t.globalCompositeOperation=o),u}function s(e){window.location.href="data:none/none;base64,"+btoa(a(e).string)}function o(e){for(var t in document.styleSheets){var n=document.styleSheets[t],r=n.cssRules;if(r)for(var i=0,s=r.length;i<s;i++)try{e.find(r[i].selectorText).each(function(e,t){t.style.cssText+=r[i].style.cssText})}catch(o){}}}function u(e){var t=a(e),n={filename:name||"chart",type:"application/pdf",height:t.height,width:t.width,scale:2,svg:t.string},r=$("body"),i=r.find("#viewport-form");i.length===0&&(i=$("<form>",{id:"viewport-form",method:"post",action:"http://export.highcharts.com/",display:"none"}),r.append(i)),i.empty();for(name in n){var s=$("<input/>",{type:"hidden",name:name,value:n[name]});i.append(s)}try{i.submit()}catch(o){console.log(o)}}function a(e){if(e.$el.find("svg").length==0&&e.error){e.error("No SVG found. This chart type does not support SVG/PDF export.");return}var t=e.$el,n=t.find("svg").length,r=parseInt(t.find("svg").first().css("height")),i=parseInt(t.find("svg").first().css("width")),s=new XMLSerializer,u=$("<svg/>");u.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:i*n,height:r});var a="",f=0;return t.find("svg").each(function(){var e=$(this).clone();o(e);var t=$('<g transform="translate('+f+', 0)">');t.append(e.find("g").first()),u.append(t),f+=i}),{string:s.serializeToString(u[0]),height:r,width:i}}return{createPNG:t,createSVG:s,createPDF:u}}),define("plugin/views/viewer",["utils/utils","plugin/library/ui","mvc/ui/ui-portlet","plugin/views/viewport","plugin/library/screenshot"],function(e,t,n,r,i){return Backbone.View.extend({initialize:function(e,s){this.app=e,this.chart=this.app.chart,this.viewport_view=new r(e);var o=this;this.message=new t.Message;var u=new t.ButtonMenu({icon:"fa-camera",title:"Screenshot",tooltip:"Download as PNG, SVG or PDF file"});u.addMenu({id:"button-png",title:"Save as PNG",icon:"fa-file",onclick:function(){o._wait(o.chart,function(){i.createPNG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-svg",title:"Save as SVG",icon:"fa-file-text-o",onclick:function(){o._wait(o.chart,function(){i.createSVG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-png",title:"Save as PDF",icon:"fa-file-o",onclick:function(){o.app.modal.show({title:"Send chart data for PDF creation",body:"Galaxy does not provide integrated PDF export scripts. You may click 'Continue' to create the PDF by using a 3rd party service (https://export.highcharts.com)",buttons:{Cancel:function(){o.app.modal.hide()},Continue:function(){o.app.modal.hide(),o._wait(o.chart,function(){i.createPDF({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}})}}),this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Viewport",scrollable:!1,operations:{edit_button:new t.ButtonIcon({icon:"fa-edit",tooltip:"Customize this chart",title:"Editor",onclick:function(){o._wait(o.chart,function(){o.app.go("editor")})}}),picture_button_menu:u}}),this.portlet.append(this.message.$el),this.portlet.append(this.viewport_view.$el),this.setElement(this.portlet.$el);var o=this;this.chart.on("change:title",function(){o._refreshTitle()})},show:function(){this.$el.show(),$(window).trigger("resize")},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e)},_wait:function(e,t){this.app.deferred.ready()?t():this.message.update({message:"Your chart is currently being processed. Please wait and try again."})}})}),define("mvc/ui/ui-tabs",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null},initialize:function(t){this.visible=!1,this.$nav=null,this.$content=null,this.first_tab=null,this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$nav=n.find(".tab-navigation"),this.$content=n.find(".tab-content"),this.setElement(n),this.list={};var r=this;this.options.operations&&$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$nav.find(".operations").append(t.$el)});if(this.options.onnew){var i=$(this._template_tab_new(this.options));this.$nav.append(i),i.tooltip({title:"Add a new tab",placement:"bottom",container:r.$el}),i.on("click",function(e){i.tooltip("hide"),r.options.onnew()})}},add:function(e){var t=this,n=e.id,r=$(this._template_tab(e)),i=$(this._template_tab_content(e));this.list[n]=e.ondel?!0:!1,this.options.onnew?this.$nav.find("#new-tab").before(r):this.$nav.append(r),i.append(e.$el),this.$content.append(i),_.size(this.list)==1&&(r.addClass("active"),i.addClass("active"),this.first_tab=n);if(e.ondel){var s=r.find("#delete");s.tooltip({title:"Delete this tab",placement:"bottom",container:t.$el}),s.on("click",function(){return s.tooltip("destroy"),t.$el.find(".tooltip").remove(),e.ondel(),!1})}r.on("click",function(r){r.preventDefault(),e.onclick?e.onclick():t.show(n)})},del:function(e){this.$el.find("#tab-"+e).remove(),this.$el.find("#tab-content-"+e).remove(),this.first_tab==e&&(this.first_tab=null),this.first_tab!=null&&this.show(this.first_tab)},delRemovable:function(){for(var e in this.list)this.list[e]&&this.del(e)},show:function(e){this.$el.fadeIn("fast"),this.visible=!0,e&&(this.$el.find(".tab-element").removeClass("active"),this.$el.find(".tab-pane").removeClass("active"),this.$el.find("#tab-"+e).addClass("active"),this.$el.find("#tab-content-"+e).addClass("active"))},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},hideOperation:function(e){this.$nav.find("#"+e).hide()},showOperation:function(e){this.$nav.find("#"+e).show()},setOperation:function(e,t){var n=this.$nav.find("#"+e);n.off("click"),n.on("click",t)},title:function(e,t){var n=this.$el.find("#tab-title-text-"+e);return t&&n.html(t),n.html()},_template:function(e){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(e){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+e.title_new+"</a>"+"</li>"},_template_tab:function(e){var t='<li id="tab-'+e.id+'" class="tab-element">'+'<a id="tab-title-link-'+e.id+'" title="" href="#tab-content-'+e.id+'" data-original-title="">'+'<span id="tab-title-text-'+e.id+'">'+e.title+"</span>";return e.ondel&&(t+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'),t+="</a></li>",t},_template_tab_content:function(e){return'<div id="tab-content-'+e.id+'" class="tab-pane"/>'}});return{View:t}}),define("plugin/library/ui-table",["utils/utils"],function(e){var t=Backbone.View.extend({row:null,row_count:0,optionsDefault:{content:"No content available.",onchange:null,ondblclick:null,onconfirm:null,cls:""},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(t){this.options=e.merge(t,this.optionsDefault);var n=$(this._template(t));this.$thead=n.find("thead"),this.$tbody=n.find("tbody"),this.$tmessage=n.find("tmessage"),this.setElement(n),this.row=$("<tr></tr>")},addHeader:function(e){var t=$("<th></th>");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=$("<tr></tr>")},add:function(e,t,n){var r=$("<td></td>");t&&r.css("width",t),n&&r.css("text-align",n),r.append(e),this.row.append(r)},append:function(e){this._commit(e)},prepend:function(e){this._commit(e,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),e!==undefined&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return t===undefined?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t){this.del(e),this.row.attr("id",e),t?this.$tbody.prepend(this.row):this.$tbody.append(this.row),this.row=$("<tr></tr>"),this.row_count++,this._refresh()},_onclick:function(e){var t=this.value(),n=$(e.target).closest("tr").attr("id");n!=""&&n&&t!=n&&(this.options.onconfirm?this.options.onconfirm(n):this.value(n))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){this.row_count==0?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'<div><table class="ui-table '+e.cls+'">'+"<thead></thead>"+'<tbody style="cursor: pointer;"></tbody>'+"</table>"+"<tmessage>"+e.content+"</tmessage>"+"<div>"}});return{View:t}}),define("plugin/views/group",["plugin/library/ui-table","plugin/library/ui","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(r,i){this.app=r;var s=this;this.chart=this.app.chart,this.group=i.group,this.group_key=new t.Input({placeholder:"Data label",onchange:function(e){s.group.set("key",e)}}),this.table=new e.View({content:"No data column."});var o=$("<div/>");o.append(n.wrap((new t.Label({title:"Provide a label:"})).$el)),o.append(n.wrap(this.group_key.$el)),o.append(n.wrap((new t.Label({title:"Select columns:"})).$el)),o.append(n.wrap(this.table.$el)),this.setElement(o);var s=this;this.chart.on("change:dataset_id",function(){s._refreshTable()}),this.chart.on("change:type",function(){s._refreshTable()}),this.group.on("change:key",function(){s._refreshGroupKey()}),this.group.on("change",function(){s._refreshGroup()}),this._refreshTable(),this._refreshGroupKey(),this._refreshGroup()},_refreshTable:function(){var e=this.chart.get("dataset_id"),n=this.chart.get("type");if(!e||!n)return;var r=this,i=this.chart.definition;this.table.delAll();var s={};for(var o in i.columns){var u=i.columns[o];if(!u){console.debug("Group::_refreshTable() - Skipping column definition.");continue}var a=new t.Select.View({id:"select_"+o,wait:!0}),f=u.title;u.is_unique&&(f+=" (all data labels)"),this.table.add(f,"25%"),this.table.add(a.$el),this.table.append(o),s[o]=a}this.chart.state("wait","Loading metadata...");var l=this.app.deferred.register(),c={id:e,success:function(e){for(var t in s)r._addRow(t,e,s,i.columns[t]);r.chart.state("ok","Metadata initialized..."),r.app.deferred.done(l)}};this.app.datasets.request(c)},_addRow:function(e,t,n,r){var i=this,s=r.is_label,o=r.is_auto,u=r.is_numeric,a=r.is_unique,f=r.is_zero,l=[],c=n[e];o&&l.push({label:"Column: Row Number",value:"auto"}),f&&l.push({label:"Column: None",value:"zero"});var h=t.metadata_column_types;for(var p in h){var d=!1;h[p]=="int"||h[p]=="float"?d=u:d=s,d&&l.push({label:"Column: "+(parseInt(p)+1)+" ["+h[p]+"]",value:p})}c.update(l),a&&this.chart.groups.first()&&this.group.set(e,this.chart.groups.first().get(e));if(!c.exists(this.group.get(e))){var v=c.first();console.debug('Group()::_addRow() - Switching model value from "'+this.group.get(e)+'" to "'+v+'".'),this.group.set(e,v)}c.value(this.group.get(e)),this.group.off("change:"+e),this.group.on("change:"+e,function(){c.value(i.group.get(e))}),c.setOnChange(function(t){a?i.chart.groups.each(function(n){n.set(e,t)}):i.group.set(e,t),i.chart.set("modified",!0)}),c.show()},_refreshGroup:function(){this.group.set("date",n.time())},_refreshGroupKey:function(){var e=this.group.get("key");e===undefined&&(e=""),this.group_key.value(e)}})}),define("plugin/library/ui-table-form",["plugin/library/ui-table","plugin/library/ui","utils/utils"],function(e,t,n){var r=Backbone.View.extend({optionsDefault:{title:"",content:"",mode:""},list:[],initialize:function(r,i){this.app=r,this.options=n.merge(i,this.optionsDefault),this.table_title=new t.Label({title:this.options.title}),this.table=new e.View({content:this.options.content});var s=$('<div class="ui-table-form"/>');this.options.title&&s.append(n.wrap(this.table_title.$el)),s.append(n.wrap(this.table.$el)),this.setElement(s)},title:function(e){this.table_title.title(e)},update:function(e,t){this.table.delAll(),this.list=[];for(var n in e)this._add(e[n].id||n,e[n],t);for(var n in this.list)this.list[n].trigger("change")},_add:function(e,n,r){var i=this,s=null,o=n.type;switch(o){case"text":s=new t.Input({id:"field-"+e,placeholder:n.placeholder,value:r.get(e),onchange:function(t){r.set(e,t)}});break;case"radiobutton":s=new t.RadioButton({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"select":s=new t.Select.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"dataset":s=new t.Select.View({id:"field-"+e,onchange:function(t){r.set(e,t)}}),i.app.datasets.on("all",function(){var t=[];i.app.datasets.each(function(e){e.get("datatype_id")==n.data&&t.push({value:e.get("id"),label:e.get("name")})}),s.update(t),r.get(e)||r.set(e,s.first()),s.value(r.get(e))}),i.app.datasets.trigger("all.datasets");break;case"textarea":s=new t.Textarea({id:"field-"+e,onchange:function(){r.set(e,s.value())}});break;case"separator":s=$("<div/>");break;default:s=new t.Input({id:"field-"+e,placeholder:n.placeholder,type:n.type,onchange:function(){r.set(e,s.value())}})}if(o!="separator"){r.get(e)||r.set(e,n.init),s.value(r.get(e)),this.list[e]=s;var u=$("<div/>");u.append(s.$el),n.info&&u.append('<div class="ui-table-form-info">'+n.info+"</div>"),this.options.style=="bold"?(this.table.add((new t.Label({title:n.title,cls:"form-label"})).$el),this.table.add(u)):(this.table.add('<span class="ui-table-form-title">'+n.title+"</span>","25%"),this.table.add(u))}else this.table.add('<div class="ui-table-form-separator">'+n.title+":<div/>"),this.table.add($("<div/>"));this.table.append(e),n.hide&&this.table.get(e).hide()}});return{View:r}}),define("plugin/views/settings",["plugin/library/ui","plugin/library/ui-table-form","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(e,n){this.app=e;var r=this;this.chart=this.app.chart,this.form=new t.View(e,{title:"Configuration",content:"This chart type does not provide any options."}),this.setElement(this.form.$el);var r=this;this.chart.on("change",function(){r._refresh()})},_refresh:function(){var e=this.chart.definition;if(!e)return;this.form.title(e.category+" - "+e.title+":"),this.form.update(e.settings,this.chart.settings)}})}),define("plugin/views/types",["utils/utils","plugin/library/ui"],function(e,t){return Backbone.View.extend({optionsDefault:{onchange:null,ondblclick:null},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(n,r){var i=this;this.app=n,this.options=e.merge(r,this.optionsDefault);var s=$('<div class="charts-grid"/>');s.append(e.wrap((new t.Label({title:"How many data points would you like to analyze?"})).$el)),this.library=new t.RadioButton({data:[{label:"Few (<500)",value:"small"},{label:"Some (<10k)",value:"medium"},{label:"Many (>10k)",value:"large"}],onchange:function(e){i._filter(e)}}),s.append(e.wrap(this.library.$el)),this.setElement(s),this._render(),this.library.value("small")},value:function(e){var t=this.$el.find(".current").attr("id");e!==undefined&&(this.$el.find(".current").removeClass("current"),this.$el.find("#"+e).addClass("current"));var n=this.$el.find(".current").attr("id");return n===undefined?null:(n!=t&&this.options.onchange&&this.options.onchange(e),n)},_filter:function(e){this.$el.find(".header").hide();var t=this.app.types.attributes;for(var n in t){var r=t[n],i=this.$el.find("#"+n),s=this.$el.find("#types-header-"+this.categories_index[r.category]),o=r.keywords||"";o.indexOf(e)>=0?(i.show(),s.show()):i.hide()}},_render:function(){this.categories={},this.categories_index={};var t=0,n=this.app.types.attributes;for(var r in n){var i=n[r],s=i.category;this.categories[s]||(this.categories[s]={},this.categories_index[s]=t++),this.categories[s][r]=i}for(var s in this.categories){var o=$('<div style="clear: both;"/>');o.append(e.wrap(this._template_header({id:"types-header-"+this.categories_index[s],title:s})));for(var r in this.categories[s]){var i=this.categories[s][r],u=i.title+" ("+i.library+")";i.zoomable&&(u='<span class="fa fa-search-plus"/>'+u),o.append(e.wrap(this._template_item({id:r,title:u,url:config.app_root+"charts/"+this.app.chartPath(r)+"/logo.png"})))}this.$el.append(e.wrap(o))}},_onclick:function(e){var t=this.value(),n=$(e.target).closest(".item").attr("id");n!=""&&n&&t!=n&&this.value(n)},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_template_header:function(e){return'<div id="'+e.id+'" class="header">'+"• "+e.title+"<div>"},_template_item:function(e){return'<div id="'+e.id+'" class="item">'+'<img class="image" src="'+e.url+'">'+'<div class="title">'+e.title+"</div>"+"<div>"}})}),define("plugin/views/editor",["mvc/ui/ui-tabs","plugin/library/ui","mvc/ui/ui-portlet","utils/utils","plugin/models/chart","plugin/models/group","plugin/views/group","plugin/views/settings","plugin/views/types"],function(e,t,n,r,i,s,o,u,a){return Backbone.View.extend({initialize:function(i,s){var o=this;this.app=i,this.chart=this.app.chart,this.message=new t.Message,this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Editor",operations:{save:new t.ButtonIcon({icon:"fa-save",tooltip:"Draw Chart",title:"Draw",onclick:function(){o._saveChart()}}),back:new t.ButtonIcon({icon:"fa-caret-left",tooltip:"Return to Viewer",title:"Cancel",onclick:function(){o.app.go("viewer"),o.app.storage.load()}})}}),this.types=new a(i,{onchange:function(e){var t=o.app.types.get(e);t||console.debug("FAILED - Editor::onchange() - Chart type not supported."),o.chart.definition=t,o.chart.settings.clear(),o.chart.set({type:e}),o.chart.set("modified",!0),console.debug("Editor::onchange() - Switched chart type.")},ondblclick:function(e){o._saveChart()}}),this.tabs=new e.View({title_new:"Add Data",onnew:function(){var e=o._addGroupModel();o.tabs.show(e.id)}}),this.title=new t.Input({placeholder:"Chart title",onchange:function(){o.chart.set("title",o.title.value())}});var f=$("<div/>");f.append(r.wrap((new t.Label({title:"Provide a chart title:"})).$el)),f.append(r.wrap(this.title.$el)),f.append(r.wrap(this.types.$el)),this.tabs.add({id:"main",title:"Start",$el:f}),this.settings=new u(this.app),this.tabs.add({id:"settings",title:"Configuration",$el:this.settings.$el}),this.portlet.append(this.message.$el),this.portlet.append(this.tabs.$el),this.setElement(this.portlet.$el),this.tabs.hideOperation("back");var o=this;this.chart.on("change:title",function(e){o._refreshTitle()}),this.chart.on("change:type",function(e){o.types.value(e.get("type"))}),this.chart.on("reset",function(e){o._resetChart()}),this.app.chart.on("redraw",function(e){o.portlet.showOperation("back")}),this.app.chart.groups.on("add",function(e){o._addGroup(e)}),this.app.chart.groups.on("remove",function(e){o._removeGroup(e)}),this.app.chart.groups.on("reset",function(e){o._removeAllGroups()}),this.app.chart.groups.on("change:key",function(e){o._refreshGroupKey()}),this._resetChart()},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e),this.title.value(e)},_refreshGroupKey:function(){var e=this,t=0;this.chart.groups.each(function(n){var r=n.get("key","");r==""&&(r="Data label"),e.tabs.title(n.id,++t+": "+r)})},_addGroupModel:function(){var e=new s({id:r.uuid()});return this.chart.groups.add(e),e},_addGroup:function(e){var t=this,n=new o(this.app,{group:e});this.tabs.add({id:e.id,$el:n.$el,ondel:function(){t.chart.groups.remove(e.id)}}),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeGroup:function(e){this.tabs.del(e.id),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeAllGroups:function(e){this.tabs.delRemovable()},_resetChart:function(){this.chart.set("id",r.uuid()),this.chart.set("type","nvd3_bar"),this.chart.set("dataset_id",this.app.options.config.dataset_id),this.chart.set("title","New Chart"),this.portlet.hideOperation("back")},_saveChart:function(){this.chart.set({type:this.types.value(),title:this.title.value(),date:r.time()});if(this.chart.groups.length==0){this.message.update({message:"Please select data columns before drawing the chart."});var e=this._addGroupModel();this.tabs.show(e.id);return}var t=this,n=!0,i=this.chart.definition;this.chart.groups.each(function(e){if(!n)return;for(var r in i.columns)if(e.attributes[r]=="null"){t.message.update({status:"danger",message:"This chart type requires column types not found in your tabular file."}),t.tabs.show(e.id),n=!1;return}});if(!n)return;this.app.go("viewer");var t=this;this.app.deferred.execute(function(){t.app.storage.save(),t.chart.trigger("redraw")})}})}),define("plugin/models/config",[],function(){return Backbone.Model.extend({defaults:{query_limit:500,query_timeout:100}})}),define("plugin/charts/forms/default",[],function(){return{title:"",category:"",library:"",tag:"",keywords:"",query_limit:0,settings:{separator_x:{title:"X axis",type:"separator"},x_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"X-axis",placeholder:"Axis label"},x_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["x_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["x_axis_precision"]}},{label:"Float",value:"f",operations:{show:["x_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["x_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["x_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["x_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["x_axis_precision"]}}]},x_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_y:{title:"Y axis",type:"separator"},y_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"Y-axis",placeholder:"Axis label"},y_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["y_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["y_axis_precision"]}},{label:"Float",value:"f",operations:{show:["y_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["y_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["y_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["y_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["y_axis_precision"]}}]},y_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_legend:{title:"Others",type:"separator"},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"true",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{title:"Use multi-panels",info:"Would you like to separate your data into individual panels?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]}}}}),function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o<r&&t(o);if(s>1)while(o<i){var a=new Date(+o);n(a)%s===0&&u.push(a),t(o)}else while(o<i)u.push(new Date(+o)),t(o);return u}}var e=window.nv||{};e.version="1.1.15b",e.dev=!0,window.nv=e,e.tooltip=e.tooltip||{},e.utils=e.utils||{},e.models=e.models||{},e.charts={},e.graphs=[],e.logs={},e.dispatch=d3.dispatch("render_start","render_end"),e.dev&&(e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)}),e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date),e.logs.totalTime=e.logs.endTime-e.logs.startTime,e.log("total",e.logs.totalTime)})),e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]},e.render=function(n){n=n||1,e.render.active=!0,e.dispatch.render_start(),setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++)t=r.generate(),typeof r.callback==typeof Function&&r.callback(t),e.graphs.push(t);e.render.queue.splice(0,i),e.render.queue.length?setTimeout(arguments.callee,0):(e.dispatch.render_end(),e.render.active=!1)},0)},e.render.active=!1,e.render.queue=[],e.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),e.render.queue.push(t),e.render.active||e.render()},e.identity=function(e){return e},e.strip=function(e){return e.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)},d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1),e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()}),e.interactiveGuideline=function(){function c(o){o.each(function(o){function g(){var e=d3.mouse(this),n=e[0],r=e[1],o=!0,a=!1;l&&(n=d3.event.offsetX,r=d3.event.offsetY,d3.event.target.tagName!=="svg"&&(o=!1),d3.event.target.className.baseVal.match("nv-legend")&&(a=!0)),o&&(n-=i.left,r-=i.top);if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l&&d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass))return;u.elementMouseout({mouseX:n,mouseY:r}),c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f}),d3.event.type==="dblclick"&&u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}var h=d3.select(this),p=n||960,d=r||400,v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]),m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f)return;f.on("mousemove",g,!0).on("mouseout",g,!0).on("dblclick",g),c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0),n.exit().remove()}})}var t=e.models.tooltip(),n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=!0,f=null,l=navigator.userAgent.indexOf("MSIE")!==-1;return c.dispatch=u,c.tooltip=t,c.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.left=typeof e.left!="undefined"?e.left:i.left,c):i},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.xScale=function(e){return arguments.length?(s=e,c):s},c.showGuideLine=function(e){return arguments.length?(a=e,c):a},c.svgContainer=function(e){return arguments.length?(f=e,c):f},c},e.interactiveBisect=function(e,t,n){if(!e instanceof Array)return null;typeof n!="function"&&(n=function(e,t){return e.x});var r=d3.bisector(n).left,i=d3.max([0,r(e,t)-1]),s=n(e[i],i);typeof s=="undefined"&&(s=i);if(s===t)return i;var o=d3.min([i+1,e.length-1]),u=n(e[o],o);return typeof u=="undefined"&&(u=o),Math.abs(u-t)>=Math.abs(s-t)?i:o},e.nearestValueIndex=function(e,t,n){var r=Infinity,i=null;return e.forEach(function(e,s){var o=Math.abs(t-e);o<=r&&o<n&&(r=o,i=s)}),i},function(){window.nv.tooltip={},window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);e.node().tagName!=="svg"&&(e=e.select("svg"));var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n,l.top=l.top*n}}}function b(e){var t;a?t=d3.select(a):t=d3.select("body");var n=t.select(".nvtooltip");return n.node()===null&&(n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)),n.node().innerHTML=e,n.style("top",0).style("left",0).style("opacity",0),n.selectAll("div, table, td, tr").classed(p,!0),n.classed(p,!0),n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left,u=o!=null?o:l.top,h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0],d=p?p.getBoundingClientRect():a.getBoundingClientRect(),v={left:0,top:0};if(p){var E=p.getBoundingClientRect(),S=a.getBoundingClientRect(),x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top),v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft,u+=a.offsetTop+v.top-2*a.scrollTop}return s&&s>0&&(u=Math.floor(u/s)*s),e.tooltip.calcTooltipPosition([t,u],r,i,h),w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=!0,h="nvtooltip-"+Math.floor(Math.random()*1e5),p="nv-pointer-events-none",d=function(e,t){return e},v=function(e){return e},m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table")),r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody"),s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(e){return e.color}),s.append("td").classed("key",!0).html(function(e){return e.key}),s.append("td").classed("value",!0).html(function(e,t){return d(e.value,t)}),s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]),n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;return e.footer!==undefined&&(o+="<div class='footer'>"+e.footer+"</div>"),o},g=function(e){return e&&e.series&&e.series.length>0?!0:!1};return w.nvPointerEventsClass=p,w.content=function(e){return arguments.length?(t=e,w):t},w.tooltipElem=function(){return f},w.contentGenerator=function(e){return arguments.length?(typeof e=="function"&&(m=e),w):m},w.data=function(e){return arguments.length?(n=e,w):n},w.gravity=function(e){return arguments.length?(r=e,w):r},w.distance=function(e){return arguments.length?(i=e,w):i},w.snapDistance=function(e){return arguments.length?(s=e,w):s},w.classes=function(e){return arguments.length?(u=e,w):u},w.chartContainer=function(e){return arguments.length?(a=e,w):a},w.position=function(e){return arguments.length?(l.left=typeof e.left!="undefined"?e.left:l.left,l.top=typeof e.top!="undefined"?e.top:l.top,w):l},w.fixedTop=function(e){return arguments.length?(o=e,w):o},w.enabled=function(e){return arguments.length?(c=e,w):c},w.valueFormatter=function(e){return arguments.length?(typeof e=="function"&&(d=e),w):d},w.headerFormatter=function(e){return arguments.length?(typeof e=="function"&&(v=e),w):v},w.id=function(){return h},w},e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i))a=document.getElementsByTagName("body")[0];u.style.left=0,u.style.top=0,u.style.opacity=0,u.innerHTML=n,a.appendChild(u),s&&(t[0]=t[0]-s.scrollLeft,t[1]=t[1]-s.scrollTop),e.tooltip.calcTooltipPosition(t,r,i,u)},e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null)e=e.parentNode;return e},e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do isNaN(e.offsetTop)||(n+=e.offsetTop);while(e=e.offsetParent);return n},e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do isNaN(e.offsetLeft)||(n+=e.offsetLeft);while(e=e.offsetParent);return n},e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16,u=window.innerHeight>=document.body.scrollHeight?u:u-16,n=n||"s",r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)},d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r,h=t[1]-s/2;var v=d(i),m=p(i);v<l&&(c=t[0]+r>l?t[0]+r:l-v+c),m<f&&(h=f-m+h),m+s>f+a&&(h=f+a-m+h-s);break;case"w":c=t[0]+r,h=t[1]-s/2;var v=d(i),m=p(i);v+o>u&&(c=t[0]-o-r),m<f&&(h=f+5),m+s>f+a&&(h=f+a-m+h-s);break;case"n":c=t[0]-o/2-5,h=t[1]+r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),m+s>f+a&&(h=f+a-m+h-s);break;case"s":c=t[0]-o/2,h=t[1]-s-r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),f>m&&(h=f);break;case"none":c=t[0],h=t[1]-r;var v=d(i),m=p(i)}return i.style.left=c+"px",i.style.top=h+"px",i.style.opacity=1,i.style.position="absolute",i},e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.utils.calcApproxTextWidth=function(e){if(typeof e.style=="function"&&typeof e.text=="function"){var t=parseInt(e.style("font-size").replace("px","")),n=e.text().length;return n*t*.5}return 0},e.utils.NaNtoZero=function(e){return typeof e!="number"||isNaN(e)||e===null||e===Infinity?0:e},e.utils.optionsFunc=function(e){return e&&d3.map(e).forEach(function(e,t){typeof this[e]=="function"&&this[e](t)}.bind(this)),this},e.models.axis=function(){function m(e){return e.each(function(e){var i=d3.select(this),m=i.selectAll("g.nv-wrap.nv-axis").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),y=g.append("g"),b=m.select("g");p!==null?t.ticks(p):(t.orient()=="top"||t.orient()=="bottom")&&t.ticks(Math.abs(s.range()[1]-s.range()[0])/100),b.call(t),v=v||t.scale();var w=t.tickFormat();w==null&&(w=v.tickFormat());var E=b.selectAll("text.nv-axislabel").data([o||null]);E.exit().remove();switch(t.orient()){case"top":E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",0).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var T=36,N=30,C=b.selectAll("g").select("text");if(f%360){C.each(function(e,t){var n=this.getBBox().width;n>N&&(N=n)});var k=Math.abs(Math.sin(f*Math.PI/180)),T=(k?k*N:N)+30;C.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",T).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}c&&C.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+d:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}}E.text(function(e){return e}),u&&(t.orient()==="left"||t.orient()==="right")&&(b.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10)(e>1e-10||e<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0)}),s.domain()[0]==s.domain()[1]&&s.domain()[0]==0&&m.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(u&&(t.orient()==="top"||t.orient()==="bottom")){var L=[];m.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?L.push(s(e)-this.getBBox().width-4):L.push(s(e)+this.getBBox().width+4)}catch(n){t?L.push(s(e)-4):L.push(s(e)+4)}}),b.selectAll("g").each(function(e,t){if(s(e)<L[0]||s(e)>L[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}a&&b.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",!0),v=s.copy()}),m}var t=d3.svg.axis(),n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=!0,a=!0,f=0,l=!0,c=!1,h=!1,p=null,d=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var v;return m.axis=t,d3.rebind(m,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.ticks=function(e){return arguments.length?(p=e,m):p},m.height=function(e){return arguments.length?(i=e,m):i},m.axisLabel=function(e){return arguments.length?(o=e,m):o},m.showMaxMin=function(e){return arguments.length?(u=e,m):u},m.highlightZero=function(e){return arguments.length?(a=e,m):a},m.scale=function(e){return arguments.length?(s=e,t.scale(s),h=typeof s.rangeBands=="function",d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m):s},m.rotateYLabel=function(e){return arguments.length?(l=e,m):l},m.rotateLabels=function(e){return arguments.length?(f=e,m):f},m.staggerLabels=function(e){return arguments.length?(c=e,m):c},m.axisLabelDistance=function(e){return arguments.length?(d=e,m):d},m},e.models.historicalBar=function(){function w(E){return E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f))),c?s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]):s.range(m||[0,E]),o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-bars"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S),A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",!0),y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",!1),y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9),O.attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})}),w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!1,h=!0,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=!0;return w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)},w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",!1)},w.dispatch=y,w.options=e.utils.optionsFunc.bind(w),w.x=function(e){return arguments.length?(u=e,w):u},w.y=function(e){return arguments.length?(a=e,w):a},w.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,w):t},w.width=function(e){return arguments.length?(n=e,w):n},w.height=function(e){return arguments.length?(r=e,w):r},w.xScale=function(e){return arguments.length?(s=e,w):s},w.yScale=function(e){return arguments.length?(o=e,w):o},w.xDomain=function(e){return arguments.length?(d=e,w):d},w.yDomain=function(e){return arguments.length?(v=e,w):v},w.xRange=function(e){return arguments.length?(m=e,w):m},w.yRange=function(e){return arguments.length?(g=e,w):g},w.forceX=function(e){return arguments.length?(f=e,w):f},w.forceY=function(e){return arguments.length?(l=e,w):l},w.padData=function(e){return arguments.length?(c=e,w):c},w.clipEdge=function(e){return arguments.length?(h=e,w):h},w.color=function(t){return arguments.length?(p=e.utils.getColor(t),w):p},w.id=function(e){return arguments.length?(i=e,w):i},w.interactive=function(e){return arguments.length?(b=!1,w):b},w},e.models.bullet=function(){function m(e){return e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this),y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice(),T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]),N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1],A=g.selectAll("g.nv-wrap.nv-bullet").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),M=O.append("g"),_=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax"),M.append("rect").attr("class","nv-range nv-rangeAvg"),M.append("rect").attr("class","nv-range nv-rangeMin"),M.append("rect").attr("class","nv-measure"),M.append("path").attr("class","nv-markerTriangle"),A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))},H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C),_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L),_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k),_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;b[0]?_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})}):_.selectAll("path.nv-markerTriangle").remove(),A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseout({value:e,label:n})})}),m}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");return m.dispatch=v,m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(i=e,m):i},m.markers=function(e){return arguments.length?(s=e,m):s},m.measures=function(e){return arguments.length?(o=e,m):o},m.forceX=function(e){return arguments.length?(l=e,m):l},m.width=function(e){return arguments.length?(c=e,m):c},m.height=function(e){return arguments.length?(h=e,m):h},m.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,m):t},m.tickFormat=function(e){return arguments.length?(p=e,m):p},m.color=function(t){return arguments.length?(d=e.utils.getColor(t),m):d},m},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=n.title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function D(b){return b.each(function(b){function I(e,t){d3.select(D.container).style("cursor","ew-resize")}function q(e,t){M.x=d3.event.x,M.i=Math.round(O.invert(M.x)),nt()}function R(e,t){d3.select(D.container).style("cursor","auto"),x.index=M.i,k.stateChange(x)}function nt(){tt.data([M]);var e=D.transitionDuration();D.transitionDuration(0),D.update(),D.transitionDuration(e)}var L=d3.select(this).classed("nv-chart-"+S,!0),A=this,H=(f||parseInt(L.style("width"))||960)-u.left-u.right,B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom;D.update=function(){L.call(D)},D.container=this,x.disabled=b.map(function(e){return!!e.disabled});if(!T){var j;T={};for(j in x)x[j]instanceof Array?T[j]=x[j].slice(0):T[j]=x[j]}var F=d3.behavior.drag().on("dragstart",I).on("drag",q).on("dragend",R);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var U=L.selectAll(".nv-noData").data([N]);return U.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),U.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e}),D}L.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();if(!y){var z=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return r[0]<-0.95&&(r[0]=-0.95),[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),W=[d3.min(z,function(e){return e[0]}),d3.max(z,function(e){return e[1]})];t.yDomain(W)}else t.yDomain(null);O.domain([0,b[0].values.length-1]).range([0,H]).clamp(!0);var b=P(M.i,b),X=g?"none":"all",V=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]),$=V.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),J=V.select("g");$.append("g").attr("class","nv-interactive"),$.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),$.append("g").attr("class","nv-y nv-axis"),$.append("g").attr("class","nv-background"),$.append("g").attr("class","nv-linesWrap").style("pointer-events",X),$.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),$.append("g").attr("class","nv-legendWrap"),$.append("g").attr("class","nv-controlsWrap"),c&&(i.width(H),J.select(".nv-legendWrap").datum(b).call(i),u.top!=i.height()&&(u.top=i.height(),B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")"));if(m){var K=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),J.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+ -u.top+")").call(s)}V.attr("transform","translate("+u.left+","+u.top+")"),d&&J.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)");var Q=b.filter(function(e){return e.tempDisabled});V.select(".tempDisabled").remove(),Q.length&&V.append("text").attr("class","tempDisabled").attr("x",H/2).attr("y","-.71em").style("text-anchor","end").text(Q.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period."),g&&(o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(L).xScale(w),V.select(".nv-interactive").call(o)),$.select(".nv-background").append("rect"),J.select(".nv-background rect").attr("width",H).attr("height",B),t.y(function(e){return e.display.y}).width(H).height(B).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var G=J.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));G.call(t),b.forEach(function(e,t){e.seriesIndex=t});var Y=b.filter(function(e){return!e.disabled&&!!C(e)}),Z=J.select(".nv-avgLinesWrap").selectAll("line").data(Y,function(e){return e.key}),et=function(e){var t=E(C(e));return t<0?0:t>B?B:t};Z.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.style("stroke-opacity",function(e){var t=E(C(e));return t<0||t>B?0:1}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.exit().remove();var tt=G.selectAll(".nv-indexLine").data([M]);tt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(F),tt.attr("transform",function(e){return"translate("+O(e.i)+",0)"}).attr("height",B),h&&(n.scale(w).ticks(Math.min(b[0].values.length,H/70)).tickSize(-B,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(n)),p&&(r.scale(E).ticks(B/36).tickSize(-H,0),d3.transition(J.select(".nv-y.nv-axis")).call(r)),J.select(".nv-background rect").on("click",function(){M.x=d3.mouse(this)[0],M.i=Math.round(O.invert(M.x)),x.index=M.i,k.stateChange(x),nt()}),t.dispatch.on("elementClick",function(e){M.i=e.pointIndex,M.x=O(M.i),x.index=M.i,k.stateChange(x),nt()}),s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,y=!e.disabled,x.rescaleY=y,k.stateChange(x),D.update()}),i.dispatch.on("stateChange",function(e){x.disabled=e.disabled,k.stateChange(x),D.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,D.x()),t.highlightPoint(r,f,!0);var o=n.values[f];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof l=="undefined"&&(l=D.xScale()(D.x()(o,f))),c.push({key:n.key,value:D.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=D.yScale().invert(i.mouseY),p=Math.abs(D.yScale().domain()[0]-D.yScale().domain()[1]),d=.03*p,m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);m!==null&&(c[m].highlight=!0)}var g=n.tickFormat()(D.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(A.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})(),o.renderGuideLine(l)}),o.dispatch.on("elementMouseout",function(e){k.tooltipHide(),t.clearHighlights()}),k.on("tooltipShow",function(e){v&&_(e,A.parentNode)}),k.on("changeState",function(e){typeof e.disabled!="undefined"&&(b.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),typeof e.index!="undefined"&&(M.i=e.index,M.x=O(M.i),x.index=e.index,tt.data([M])),typeof e.rescaleY!="undefined"&&(y=e.rescaleY),D.update()})}),D}function P(e,n){return n.map(function(n,r){if(!n.values)return n;var i=n.values[e];if(i==null)return n;var s=t.y()(i,e);return s<-0.95&&!A?(n.tempDisabled=!0,n):(n.tempDisabled=!1,n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-s)/(1+s)},e}),n)})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=!0,h=!0,p=!0,d=!1,v=!0,m=!0,g=!1,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=0,A=!1;n.orient("bottom").tickPadding(7),r.orient(d?"right":"left"),s.updateState(!1);var O=d3.scale.linear(),M={i:0,x:0},_=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,D);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)}),k.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),D.dispatch=k,D.lines=t,D.legend=i,D.xAxis=n,D.yAxis=r,D.interactiveLayer=o,d3.rebind(D,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),D.options=e.utils.optionsFunc.bind(D),D.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,D):u},D.width=function(e){return arguments.length?(f=e,D):f},D.height=function(e){return arguments.length?(l=e,D):l},D.color=function(t){return arguments.length?(a=e.utils.getColor(t),i.color(a),D):a},D.rescaleY=function(e){return arguments.length?(y=e,D):y},D.showControls=function(e){return arguments.length?(m=e,D):m},D.useInteractiveGuideline=function(e){return arguments.length?(g=e,e===!0&&(D.interactive(!1),D.useVoronoi(!1)),D):g},D.showLegend=function(e){return arguments.length?(c=e,D):c},D.showXAxis=function(e){return arguments.length?(h=e,D):h},D.showYAxis=function(e){return arguments.length?(p=e,D):p},D.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),D):d},D.tooltips=function(e){return arguments.length?(v=e,D):v},D.tooltipContent=function(e){return arguments.length?(b=e,D):b},D.state=function(e){return arguments.length?(x=e,D):x},D.defaultState=function(e){return arguments.length?(T=e,D):T},D.noData=function(e){return arguments.length?(N=e,D):N},D.average=function(e){return arguments.length?(C=e,D):C},D.transitionDuration=function(e){return arguments.length?(L=e,D):L},D.noErrorCheck=function(e){return arguments.length?(A=e,D):A},D},e.models.discreteBar=function(){function E(e){return e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1),o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f))),c?o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range(m||[E,0]),b=b||s,w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-groups"),N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),A.style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length),c?(M.append("text").attr("text-anchor","middle"),O.select("text").text(function(e,t){return h(a(e,t))}).attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})):O.selectAll("text").remove(),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).attr("width",s.rangeBand()*.9/e.length),O.attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)}),b=s.copy(),w=o.copy()}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar",b,w;return E.dispatch=g,E.options=e.utils.optionsFunc.bind(E),E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(p=e,E):p},E.yDomain=function(e){return arguments.length?(d=e,E):d},E.xRange=function(e){return arguments.length?(v=e,E):v},E.yRange=function(e){return arguments.length?(m=e,E):m},E.forceY=function(e){return arguments.length?(f=e,E):f},E.color=function(t){return arguments.length?(l=e.utils.getColor(t),E):l},E.id=function(e){return arguments.length?(i=e,E):i},E.showValues=function(e){return arguments.length?(c=e,E):c},E.valueFormat=function(e){return arguments.length?(h=e,E):h},E.rectClass=function(e){return arguments.length?(y=e,E):y},E},e.models.discreteBarChart=function(){function w(e){return e.each(function(e){var u=d3.select(this),p=this,y=(s||parseInt(u.style("width"))||960)-i.left-i.right,E=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate(),u.call(w)},w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var S=u.selectAll(".nv-noData").data([m]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",i.left+y/2).attr("y",i.top+E/2).text(function(e){return e}),w}u.selectAll(".nv-noData").remove(),d=t.xScale(),v=t.yScale().clamp(!0);var T=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),C=N.append("defs"),k=T.select("g");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),k.attr("transform","translate("+i.left+","+i.top+")"),l&&k.select(".nv-y.nv-axis").attr("transform","translate("+y+",0)"),t.width(y).height(E);var L=k.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));L.call(t),C.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect"),k.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(y/100).tickSize(-E,0),k.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")"),k.select(".nv-x.nv-axis").call(n);var A=k.select(".nv-x.nv-axis").selectAll("g");c&&A.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}f&&(r.scale(v).ticks(E/36).tickSize(-y,0),k.select(".nv-y.nv-axis").call(r)),k.select(".nv-zeroLine line").attr("x1",0).attr("x2",y).attr("y1",v(0)).attr("y2",v(0)),g.on("tooltipShow",function(e){h&&b(e,p.parentNode)})}),w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis(),i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=!0,f=!0,l=!1,c=!1,h=!0,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=0;n.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top],g.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)}),g.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),w.dispatch=g,w.discretebar=t,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),w.options=e.utils.optionsFunc.bind(w),w.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,w):i},w.width=function(e){return arguments.length?(s=e,w):s},w.height=function(e){return arguments.length?(o=e,w):o},w.color=function(n){return arguments.length?(u=e.utils.getColor(n),t.color(u),w):u},w.showXAxis=function(e){return arguments.length?(a=e,w):a},w.showYAxis=function(e){return arguments.length?(f=e,w):f},w.rightAlignYAxis=function(e){return arguments.length?(l=e,r.orient(e?"right":"left"),w):l},w.staggerLabels=function(e){return arguments.length?(c=e,w):c},w.tooltips=function(e){return arguments.length?(h=e,w):h},w.tooltipContent=function(e){return arguments.length?(p=e,w):p},w.noData=function(e){return arguments.length?(m=e,w):m},w.transitionDuration=function(e){return arguments.length?(y=e,w):y},w},e.models.distribution=function(){function l(e){return e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]),p=h.enter().append("g").attr("class","nvd3 nv-distribution"),d=p.append("g"),v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g"),m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))}),m.exit().selectAll("line.nv-dist"+i).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove(),g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r),g.attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}),f=u.copy()}),l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a,f;return l.options=e.utils.optionsFunc.bind(l),l.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,l):t},l.width=function(e){return arguments.length?(n=e,l):n},l.axis=function(e){return arguments.length?(i=e,l):i},l.size=function(e){return arguments.length?(r=e,l):r},l.getData=function(e){return arguments.length?(s=d3.functor(e),l):s},l.scale=function(e){return arguments.length?(u=e,l):u},l.color=function(t){return arguments.length?(o=e.utils.getColor(t),l):o},l},e.models.historicalBarChart=function(){function x(e){return e.each(function(d){var E=d3.select(this),T=this,N=(u||parseInt(E.style("width"))||960)-s.left-s.right,C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom;x.update=function(){E.call(x)},x.container=this,g.disabled=d.map(function(e){return!!e.disabled});if(!y){var k;y={};for(k in g)g[k]instanceof Array?y[k]=g[k].slice(0):y[k]=g[k]}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var L=E.selectAll(".nv-noData").data([b]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",s.left+N/2).attr("y",s.top+C/2).text(function(e){return e}),x}E.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();var A=E.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),M=A.select("g");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-barsWrap"),O.append("g").attr("class","nv-legendWrap"),f&&(i.width(N),M.select(".nv-legendWrap").datum(d).call(i),s.top!=i.height()&&(s.top=i.height(),C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom),A.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")),A.attr("transform","translate("+s.left+","+s.top+")"),h&&M.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),t.width(N).height(C).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var _=M.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));_.call(t),l&&(n.scale(v).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),M.select(".nv-x.nv-axis").call(n)),c&&(r.scale(m).ticks(C/36).tickSize(-N,0),M.select(".nv-y.nv-axis").call(r)),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,A.selectAll(".nv-series").classed("disabled",!1),e}),g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),e.call(x)}),i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=!0}),e.disabled=!1,g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),x.update()}),w.on("tooltipShow",function(e){p&&S(e,T.parentNode)}),w.on("changeState",function(e){typeof e.disabled!="undefined"&&(d.forEach(function(t,n){t.disabled=e.disabled[n]}),g.disabled=e.disabled),x.update()})}),x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=!1,l=!0,c=!0,h=!1,p=!0,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=0;n.orient("bottom").tickPadding(7),r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),x.dispatch=w,x.bars=t,x.legend=i,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),x.options=e.utils.optionsFunc.bind(x),x.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,x):s},x.width=function(e){return arguments.length?(u=e,x):u},x.height=function(e){return arguments.length?(a=e,x):a},x.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),x):o},x.showLegend=function(e){return arguments.length?(f=e,x):f},x.showXAxis=function(e){return arguments.length?(l=e,x):l},x.showYAxis=function(e){return arguments.length?(c=e,x):c},x.rightAlignYAxis=function(e){return arguments.length?(h=e,r.orient(e?"right":"left"),x):h},x.tooltips=function(e){return arguments.length?(p=e,x):p},x.tooltipContent=function(e){return arguments.length?(d=e,x):d},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},x.transitionDuration=function(e){return arguments.length?(E=e,x):E},x},e.models.indentedTree=function(){function g(e){return e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n)return d3.event.shiftKey=!1,e.values&&e.values.forEach(function(e){(e.values||e._values)&&k(e,0,!0)}),!0;if(!O(e))return!0;e.values?(e._values=e.values,e.values=null):(e.values=e._values,e._values=null),g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this),i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.call(g)},e[0]||(e[0]={key:a});var s=i.nodes(e[0]),y=d3.select(this).selectAll("div").data([[s]]),b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),w=b.append("table"),E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead"),x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody"),t=d3.max(s,function(e){return e.depth}),i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):!0})},function(e,t){return e.id||e.id||++m});N.exit().remove(),N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");t==0&&n.append("img").classed("nv-treeicon",!0).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k),n.each(function(n){!t&&v(n)?d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?t[e.key]?e.format(t[e.key]):"-":t[e.key]||"-"})}),e.showCount&&(n.append("span").attr("class","nv-childrenCount"),N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):!0}).length||e._values&&e._values.filter(function(e){return u?u(e):!0}).length||0)+")":""}))}),N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=!0,u=!1,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url},m=0;return g.options=e.utils.optionsFunc.bind(g),g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),scatter.color(i),g):i},g.id=function(e){return arguments.length?(s=e,g):s},g.header=function(e){return arguments.length?(o=e,g):o},g.noData=function(e){return arguments.length?(a=e,g):a},g.filterZero=function(e){return arguments.length?(u=e,g):u},g.columns=function(e){return arguments.length?(l=e,g):l},g.tableClass=function(e){return arguments.length?(c=e,g):c},g.iconOpen=function(e){return arguments.length?(h=e,g):h},g.iconClose=function(e){return arguments.length?(p=e,g):p},g.getUrl=function(e){return arguments.length?(v=e,g):v},g},e.models.legend=function(){function c(h){return h.each(function(c){var h=n-t.left-t.right,p=d3.select(this),d=p.selectAll("g.nv-legend").data([c]),v=d.enter().append("g").attr("class","nvd3 nv-legend").append("g"),m=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var g=m.selectAll(".nv-series").data(function(e){return e}),y=g.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){l.legendClick(e,t),a&&(f?(c.forEach(function(e){e.disabled=!0}),e.disabled=!1):(e.disabled=!e.disabled,c.every(function(e){return e.disabled})&&c.forEach(function(e){e.disabled=!1})),l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))}).on("dblclick",function(e,t){l.legendDblclick(e,t),a&&(c.forEach(function(e){e.disabled=!0}),e.disabled=!1,l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))});y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),g.classed("disabled",function(e){return e.disabled}),g.exit().remove(),g.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)}),g.select("text").text(i);if(o){var b=[];g.each(function(t,n){var r=d3.select(this).select("text"),i;try{i=r.getComputedTextLength();if(i<=0)throw Error()}catch(s){i=e.utils.calcApproxTextWidth(r)}b.push(i+28)});var w=0,E=0,S=[];while(E<h&&w<b.length)S[w]=b[w],E+=b[w++];w===0&&(w=1);while(E>h&&w>1){S=[],w--;for(var x=0;x<b.length;x++)b[x]>(S[x%w]||0)&&(S[x%w]=b[x]);E=S.reduce(function(e,t,n,r){return e+t})}var T=[];for(var N=0,C=0;N<w;N++)T[N]=C,C+=S[N];g.attr("transform",function(e,t){return"translate("+T[t%w]+","+(5+Math.floor(t/w)*20)+")"}),u?m.attr("transform","translate("+(n-t.right-E)+","+t.top+")"):m.attr("transform","translate(0,"+t.top+")"),r=t.top+t.bottom+Math.ceil(b.length/w)*20}else{var k=5,L=5,A=0,O;g.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;return O=L,n<t.left+t.right+O+i&&(L=O=5,k+=20),L+=i,L>A&&(A=L),"translate("+O+","+k+")"}),m.attr("transform","translate("+(n-t.right-A)+","+t.top+")"),r=t.top+t.bottom+k+15}}),c}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=!0,u=!0,a=!0,f=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return c.dispatch=l,c.options=e.utils.optionsFunc.bind(c),c.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,c):t},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.key=function(e){return arguments.length?(i=e,c):i},c.color=function(t){return arguments.length?(s=e.utils.getColor(t),c):s},c.align=function(e){return arguments.length?(o=e,c):o},c.rightAlign=function(e){return arguments.length?(u=e,c):u},c.updateState=function(e){return arguments.length?(a=e,c):a},c.radioButtonMode=function(e){return arguments.length?(f=e,c):f},c},e.models.line=function(){function m(g){return g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale(),h=t.yScale(),d=d||c,v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]),S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),T=S.append("defs"),N=S.append("g"),C=E.select("g");N.append("g").attr("class","nv-groups"),N.append("g").attr("class","nv-scatterWrap"),E.attr("transform","translate("+n.left+","+n.top+")"),t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.call(t),T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect"),E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b>0?b:0),C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":""),k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),L.exit().remove(),L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)}),L.style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])}),L.exit().selectAll("path.nv-area").remove(),A.attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))})),O.attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))})),d=c.copy(),v=h.copy()}),m}var t=e.models.scatter(),n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=!1,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;return m.dispatch=t.dispatch,m.scatter=t,d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.height=function(e){return arguments.length?(i=e,m):i},m.x=function(e){return arguments.length?(o=e,t.x(e),m):o},m.y=function(e){return arguments.length?(u=e,t.y(e),m):u},m.clipEdge=function(e){return arguments.length?(l=e,m):l},m.color=function(n){return arguments.length?(s=e.utils.getColor(n),t.color(s),m):s},m.interpolate=function(e){return arguments.length?(p=e,m):p},m.defined=function(e){return arguments.length?(a=e,m):a},m.isArea=function(e){return arguments.length?(f=d3.functor(e),m):f},m},e.models.lineChart=function(){function N(m){return m.each(function(m){var x=d3.select(this),C=this,k=(a||parseInt(x.style("width"))||960)-o.left-o.right,L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom;N.update=function(){x.call(N)},N.container=this,b.disabled=m.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b)b[A]instanceof Array?w[A]=b[A].slice(0):w[A]=b[A]}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var O=x.selectAll(".nv-noData").data([E]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e}),N}x.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var M=x.selectAll("g.nv-wrap.nv-lineChart").data([m]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),D=M.select("g");_.append("rect").style("opacity",0),_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-interactive"),D.select("rect").attr("width",k).attr("height",L>0?L:0),l&&(i.width(k),D.select(".nv-legendWrap").datum(m).call(i),o.top!=i.height()&&(o.top=i.height(),L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")),M.attr("transform","translate("+o.left+","+o.top+")"),p&&D.select(".nv-y.nv-axis").attr("transform","translate("+k+",0)"),d&&(s.width(k).height(L).margin({left:o.left,top:o.top}).svgContainer(x).xScale(g),M.select(".nv-interactive").call(s)),t.width(k).height(L).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var P=D.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));P.call(t),c&&(n.scale(g).ticks(k/100).tickSize(-L,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),D.select(".nv-x.nv-axis").call(n)),h&&(r.scale(y).ticks(L/36).tickSize(-k,0),D.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),N.update()}),s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x()),t.highlightPoint(r,f,!0);var s=n.values[f];if(typeof s=="undefined")return;typeof a=="undefined"&&(a=s),typeof l=="undefined"&&(l=N.xScale()(N.x()(s,f))),c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY),p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]),d=.03*p,g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);g!==null&&(c[g].highlight=!0)}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(C.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})(),s.renderGuideLine(l)}),s.dispatch.on("elementMouseout",function(e){S.tooltipHide(),t.clearHighlights()}),S.on("tooltipShow",function(e){v&&T(e,C.parentNode)}),S.on("changeState",function(e){typeof e.disabled!="undefined"&&m.length===e.disabled.length&&(m.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),N.update()})}),N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline(),o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!1,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=0;n.orient("bottom").tickPadding(7),r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),N.dispatch=S,N.lines=t,N.legend=i,N.xAxis=n,N.yAxis=r,N.interactiveLayer=s,d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),N.options=e.utils.optionsFunc.bind(N),N.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,N):o},N.width=function(e){return arguments.length?(a=e,N):a},N.height=function(e){return arguments.length?(f=e,N):f},N.color=function(t){return arguments.length?(u=e.utils.getColor(t),i.color(u),N):u},N.showLegend=function(e){return arguments.length?(l=e,N):l},N.showXAxis=function(e){return arguments.length?(c=e,N):c},N.showYAxis=function(e){return arguments.length?(h=e,N):h},N.rightAlignYAxis=function(e){return arguments.length?(p=e,r.orient(e?"right":"left"),N):p},N.useInteractiveGuideline=function(e){return arguments.length?(d=e,e===!0&&(N.interactive(!1),N.useVoronoi(!1)),N):d},N.tooltips=function(e){return arguments.length?(v=e,N):v},N.tooltipContent=function(e){return arguments.length?(m=e,N):m},N.state=function(e){return arguments.length?(b=e,N):b},N.defaultState=function(e){return arguments.length?(w=e,N):w},N.noData=function(e){return arguments.length?(E=e,N):E},N.transitionDuration=function(e){return arguments.length?(x=e,N):x},N},e.models.linePlusBarChart=function(){function T(e){return e.each(function(e){var l=d3.select(this),c=this,v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.call(T)},b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b)b[C]instanceof Array?w[C]=b[C].slice(0):w[C]=b[C]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e}),T}l.selectAll(".nv-noData").remove();var L=e.filter(function(e){return!e.disabled&&e.bar}),A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale(),g=n.yScale(),y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y1 nv-axis"),M.append("g").attr("class","nv-y2 nv-axis"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-linesWrap"),M.append("g").attr("class","nv-legendWrap"),p&&(o.width(v/2),_.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom),_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")),O.attr("transform","translate("+u.left+","+u.top+")"),t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar})),n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]),P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n),d3.transition(P).call(t),r.scale(m).ticks(v/100).tickSize(-N,0),_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(_.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(N/36).tickSize(-v,0),d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i),s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0),_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)"),d3.transition(_.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),T.update()}),S.on("tooltipShow",function(e){d&&x(e,c.parentNode)}),S.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),T.update()})}),T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(!0),t.clipEdge(!1).padData(!0),r.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),T.dispatch=S,T.legend=o,T.lines=t,T.bars=n,T.xAxis=r,T.y1Axis=i,T.y2Axis=s,d3.rebind(T,t,"defined","size","clipVoronoi","interpolate"),T.options=e.utils.optionsFunc.bind(T),T.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),T):l},T.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),T):c},T.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,T):u},T.width=function(e){return arguments.length?(a=e,T):a},T.height=function(e){return arguments.length?(f=e,T):f},T.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),T):h},T.showLegend=function(e){return arguments.length?(p=e,T):p},T.tooltips=function(e){return arguments.length?(d=e,T):d},T.tooltipContent=function(e){return arguments.length?(v=e,T):v},T.state=function(e){return arguments.length?(b=e,T):b},T.defaultState=function(e){return arguments.length?(w=e,T):w},T.noData=function(e){return arguments.length?(E=e,T):E},T},e.models.lineWithFocusChart=function(){function k(e){return e.each(function(e){function R(e){var t=+(e=="e"),n=t?1:-1,r=O/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),F.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1)return;T.brush({extent:n,brush:a}),U();var s=P.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.call(t),P.select(".nv-focus .nv-x.nv-axis").call(r),P.select(".nv-focus .nv-y.nv-axis").call(i)}var S=d3.select(this),N=this,L=(h||parseInt(S.style("width"))||960)-f.left-f.right,A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,O=d-l.top-l.bottom;k.update=function(){S.call(k)},k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var M=S.selectAll(".nv-noData").data([x]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",f.left+L/2).attr("y",f.top+A/2).text(function(e){return e}),k}S.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var _=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]),D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),P=_.select("g");D.append("g").attr("class","nv-legendWrap");var H=D.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap");var B=D.append("g").attr("class","nv-context");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap"),B.append("g").attr("class","nv-brushBackground"),B.append("g").attr("class","nv-x nv-brush"),b&&(u.width(L),P.select(".nv-legendWrap").datum(e).call(u),f.top!=u.height()&&(f.top=u.height(),A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d),P.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),_.attr("transform","translate("+f.left+","+f.top+")"),t.width(L).height(A).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),n.defined(t.defined()).width(L).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),P.select(".nv-context").attr("transform","translate(0,"+(A+f.bottom+l.top)+")");var j=P.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(j).call(n),r.scale(v).ticks(L/100).tickSize(-A,0),i.scale(m).ticks(A/36).tickSize(-L,0),P.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0),z(),k.transitionDuration(e)}),w&&a.extent(w);var F=P.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),I=F.enter().append("g");I.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",O),I.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",O);var q=P.select(".nv-x.nv-brush").call(a);q.selectAll("rect").attr("height",O),q.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(L/100).tickSize(-O,0),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(P.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(O/36).tickSize(-L,0),d3.transition(P.select(".nv-context .nv-y.nv-axis")).call(o),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("stateChange",function(e){k.update()}),T.on("tooltipShow",function(e){E&&C(e,N.parentNode)})}),k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=0;t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),k.dispatch=T,k.legend=u,k.lines=t,k.lines2=n,k.xAxis=r,k.yAxis=i,k.x2Axis=s,k.y2Axis=o,d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),k.options=e.utils.optionsFunc.bind(k),k.x=function(e){return arguments.length?(t.x(e),n.x(e),k):t.x},k.y=function(e){return arguments.length?(t.y(e),n.y(e),k):t.y},k.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,k):f},k.margin2=function(e){return arguments.length?(l=e,k):l},k.width=function(e){return arguments.length?(h=e,k):h},k.height=function(e){return arguments.length?(p=e,k):p},k.height2=function(e){return arguments.length?(d=e,k):d},k.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),k):c},k.showLegend=function(e){return arguments.length?(b=e,k):b},k.tooltips=function(e){return arguments.length?(E=e,k):E},k.tooltipContent=function(e){return arguments.length?(S=e,k):S},k.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),k):t.interpolate()},k.noData=function(e){return arguments.length?(x=e,k):x},k.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),k):r.tickFormat()},k.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),k):i.tickFormat()},k.brushExtent=function(e){return arguments.length?(w=e,k):w},k.transitionDuration=function(e){return arguments.length?(N=e,k):N},k},e.models.linePlusBarWithFocusChart=function(){function B(e){return e.each(function(e){function tt(e){var t=+(e=="e"),n=t?1:-1,r=I/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function nt(){h.empty()||h.extent(x),Y.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function rt(){x=h.empty()?null:h.extent(),S=h.empty()?k.domain():h.extent(),D.brush({extent:S,brush:h}),nt(),r.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),t.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=$.select(".nv-focus .nv-barsWrap").datum(R.length?R.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}):[{values:[]}]),i=$.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));R.length?C=r.xScale():C=t.xScale(),s.scale(C).ticks(j/100).tickSize(-F,0),s.domain([Math.ceil(S[0]),Math.floor(S[1])]),$.select(".nv-x.nv-axis").call(s),n.call(r),i.call(t),$.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")"),u.scale(L).ticks(F/36).tickSize(-j,0),$.select(".nv-focus .nv-y1.nv-axis").style("opacity",R.length?1:0),a.scale(A).ticks(F/36).tickSize(R.length?0:-j,0),$.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+C.range()[1]+",0)"),$.select(".nv-focus .nv-y1.nv-axis").call(u),$.select(".nv-focus .nv-y2.nv-axis").call(a)}var N=d3.select(this),P=this,j=(v||parseInt(N.style("width"))||960)-p.left-p.right,F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,I=g-d.top-d.bottom;B.update=function(){N.call(B)},B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=N.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",p.left+j/2).attr("y",p.top+F/2).text(function(e){return e}),B}N.selectAll(".nv-noData").remove();var R=e.filter(function(e){return!e.disabled&&e.bar}),U=e.filter(function(e){return!e.bar});C=r.xScale(),k=o.scale(),L=r.yScale(),A=t.yScale(),O=i.yScale(),M=n.yScale();var z=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})}),W=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,j]),k.domain(d3.extent(d3.merge(z.concat(W)),function(e){return e.x})).range([0,j]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),$=X.select("g");V.append("g").attr("class","nv-legendWrap");var J=V.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y1 nv-axis"),J.append("g").attr("class","nv-y2 nv-axis"),J.append("g").attr("class","nv-barsWrap"),J.append("g").attr("class","nv-linesWrap");var K=V.append("g").attr("class","nv-context");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y1 nv-axis"),K.append("g").attr("class","nv-y2 nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-linesWrap"),K.append("g").attr("class","nv-brushBackground"),K.append("g").attr("class","nv-x nv-brush"),E&&(c.width(j/2),$.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(c),p.top!=c.height()&&(p.top=c.height(),F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g),$.select(".nv-legendWrap").attr("transform","translate("+j/2+","+ -p.top+")")),X.attr("transform","translate("+p.left+","+p.top+")"),i.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),n.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var Q=$.select(".nv-context .nv-barsWrap").datum(R.length?R:[{values:[]}]),G=$.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);$.select(".nv-context").attr("transform","translate(0,"+(F+p.bottom+d.top)+")"),Q.call(i),G.call(n),h.x(k).on("brush",rt),x&&h.extent(x);var Y=$.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]),Z=Y.enter().append("g");Z.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),Z.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var et=$.select(".nv-x.nv-brush").call(h);et.selectAll("rect").attr("height",I),et.selectAll(".resize").append("path").attr("d",tt),o.ticks(j/100).tickSize(-I,0),$.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")"),$.select(".nv-context .nv-x.nv-axis").call(o),f.scale(O).ticks(I/36).tickSize(-j,0),$.select(".nv-context .nv-y1.nv-axis").style("opacity",R.length?1:0).attr("transform","translate(0,"+k.range()[0]+")"),$.select(".nv-context .nv-y1.nv-axis").call(f),l.scale(M).ticks(I/36).tickSize(R.length?0:-j,0),$.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+k.range()[1]+",0)"),$.select(".nv-context .nv-y2.nv-axis").call(l),c.dispatch.on("stateChange",function(e){B.update()}),D.on("tooltipShow",function(e){T&&H(e,P.parentNode)}),rt()}),B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush(),p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=!0,S,x=null,T=!0,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(!0),n.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),a.orient("right"),o.orient("bottom").tickPadding(5),f.orient("left"),l.orient("right");var H=function(n,r){S&&(n.pointIndex+=Math.ceil(S[0]));var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),D.on("tooltipHide",function(){T&&e.tooltip.cleanup()}),B.dispatch=D,B.legend=c,B.lines=t,B.lines2=n,B.bars=r,B.bars2=i,B.xAxis=s,B.x2Axis=o,B.y1Axis=u,B.y2Axis=a,B.y3Axis=f,B.y4Axis=l,d3.rebind(B,t,"defined","size","clipVoronoi","interpolate"),B.options=e.utils.optionsFunc.bind(B),B.x=function(e){return arguments.length?(y=e,t.x(e),r.x(e),B):y},B.y=function(e){return arguments.length?(b=e,t.y(e),r.y(e),B):b},B.margin=function(e){return arguments.length?(p.top=typeof e.top!="undefined"?e.top:p.top,p.right=typeof e.right!="undefined"?e.right:p.right,p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom,p.left=typeof e.left!="undefined"?e.left:p.left,B):p},B.width=function(e){return arguments.length?(v=e,B):v},B.height=function(e){return arguments.length?(m=e,B):m},B.color=function(t){return arguments.length?(w=e.utils.getColor(t),c.color(w),B):w},B.showLegend=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(T=e,B):T},B.tooltipContent=function(e){return arguments.length?(N=e,B):N},B.noData=function(e){return arguments.length?(_=e,B):_},B.brushExtent=function(e){return arguments.length?(x=e,B):x},B},e.models.multiBar=function(){function C(e){return e.each(function(e){var g=n-t.left-t.right,C=r-t.top-t.bottom,k=d3.select(this);d&&e.length&&(d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}]),c&&(e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),c&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i,i-=t.size):(t.y1=t.size+r,r+=t.size)})});var L=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(L).map(function(e){return e.x})).rangeBands(w||[0,g],S),s.domain(b||d3.extent(d3.merge(L).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[C,0]),i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1])),T=T||i,N=N||s;var A=k.selectAll("g.nv-wrap.nv-multibar").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),M=O.append("defs"),_=O.append("g"),D=A.select("g");_.append("g").attr("class","nv-groups"),A.attr("transform","translate("+t.left+","+t.top+")"),M.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),A.select("#nv-edge-clip-"+o+" rect").attr("width",g).attr("height",C),D.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var P=A.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});P.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),P.exit().selectAll("rect.nv-bar").attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove(),P.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)}),P.style("stroke-opacity",1).style("fill-opacity",.75);var H=P.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});H.exit().remove();var B=H.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});H.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),v&&(m||(m=e.map(function(){return!0})),H.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})),c?H.attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length)):H.attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0}),T=i.copy(),N=s.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h="zero",p=e.utils.defaultColor(),d=!1,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(i=e,C):i},C.yScale=function(e){return arguments.length?(s=e,C):s},C.xDomain=function(e){return arguments.length?(y=e,C):y},C.yDomain=function(e){return arguments.length?(b=e,C):b},C.xRange=function(e){return arguments.length?(w=e,C):w},C.yRange=function(e){return arguments.length?(E=e,C):E},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(c=e,C):c},C.stackOffset=function(e){return arguments.length?(h=e,C):h},C.clipEdge=function(e){return arguments.length?(l=e,C):l},C.color=function(t){return arguments.length?(p=e.utils.getColor(t),C):p},C.barColor=function(t){return arguments.length?(v=e.utils.getColor(t),C):v},C.disabled=function(e){return arguments.length?(m=e,C):m},C.id=function(e){return arguments.length?(o=e,C):o},C.hideable=function(e){return arguments.length?(d=e,C):d},C.delay=function(e){return arguments.length?(g=e,C):g},C.groupSpacing=function(e){return arguments.length?(S=e,C):S},C},e.models.multiBarChart=function(){function A(e){return e.each(function(e){var b=d3.select(this),k=this,O=(u||parseInt(b.style("width"))||960)-o.left-o.right,M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom;A.update=function(){b.call(A)},A.container=this,S.disabled=e.map(function(e){return!!e.disabled});if(!x){var _;x={};for(_ in S)S[_]instanceof Array?x[_]=S[_].slice(0):x[_]=S[_]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var D=b.selectAll(".nv-noData").data([T]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",o.left+O/2).attr("y",o.top+M/2).text(function(e){return e}),A}b.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();var P=b.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]),H=P.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),B=P.select("g");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-barsWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-controlsWrap"),c&&(i.width(O-C()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),B.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom),B.select(".nv-legendWrap").attr("transform","translate("+C()+","+ -o.top+")"));if(l){var j=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(C()).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -o.top+")").call(s)}P.attr("transform","translate("+o.left+","+o.top+")"),d&&B.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),t.disabled(e.map(function(e){return e.disabled})).width(O).height(M).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var F=B.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));F.call(t);if(h){n.scale(w).ticks(O/100).tickSize(-M,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),B.select(".nv-x.nv-axis").call(n);var I=B.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1);if(m){var q=function(e,t){return"translate("+e+","+t+")"},R=5,U=17;I.selectAll("text").attr("transform",function(e,t,n){return q(0,n%2==0?R:U)});var z=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;B.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return q(0,t===0||z%2!==0?U:R)})}v&&I.filter(function(t,n){return n%Math.ceil(e[0].values.length/(O/100))!==0}).selectAll("text, line").style("opacity",0),g&&I.selectAll(".tick text").attr("transform","rotate("+g+" 0,0)").style("text-anchor",g>0?"start":"end"),B.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}p&&(r.scale(E).ticks(M/36).tickSize(-O,0),B.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){S=e,N.stateChange(S),A.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;j=j.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}S.stacked=t.stacked(),N.stateChange(S),A.update()}),N.on("tooltipShow",function(e){y&&L(e,k.parentNode)}),N.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),S.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),S.stacked=n.stacked),A.update()})}),A}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=!1,g=0,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S={stacked:!1},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=function(){return l?180:0},k=0;t.stacked(!1),n.orient("bottom").tickPadding(7).highlightZero(!0).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(d?"right":"left").tickFormat(d3.format(",.1f")),s.updateState(!1);var L=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,A);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],N.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){y&&e.tooltip.cleanup()}),A.dispatch=N,A.multibar=t,A.legend=i,A.xAxis=n,A.yAxis=r,d3.rebind(A,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing"),A.options=e.utils.optionsFunc.bind(A),A.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,A):o},A.width=function(e){return arguments.length?(u=e,A):u},A.height=function(e){return arguments.length?(a=e,A):a},A.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),A):f},A.showControls=function(e){return arguments.length?(l=e,A):l},A.showLegend=function(e){return arguments.length?(c=e,A):c},A.showXAxis=function(e){return arguments.length?(h=e,A):h},A.showYAxis=function(e){return arguments.length?(p=e,A):p},A.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),A):d},A.reduceXTicks=function(e){return arguments.length?(v=e,A):v},A.rotateLabels=function(e){return arguments.length?(g=e,A):g},A.staggerLabels=function(e){return arguments.length?(m=e,A):m},A.tooltip=function(e){return arguments.length?(b=e,A):b},A.tooltips=function(e){return arguments.length?(y=e,A):y},A.tooltipContent=function(e){return arguments.length?(b=e,A):b},A.state=function(e){return arguments.length?(S=e,A):S},A.defaultState=function(e){return arguments.length?(x=e,A):x},A.noData=function(e){return arguments.length?(T=e,A):T},A.transitionDuration=function(e){return arguments.length?(k=e,A):k},A},e.models.multiBarHorizontal=function(){function C(e){return e.each(function(e){var i=n-t.left-t.right,y=r-t.top-t.bottom,C=d3.select(this);p&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),p&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i-t.size,i-=t.size):(t.y1=r,r+=t.size)})});var k=b&&w?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(b||d3.merge(k).map(function(e){return e.x})).rangeBands(E||[0,y],.1),o.domain(w||d3.extent(d3.merge(k).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f))),d&&!p?o.range(S||[o.domain()[0]<0?m:0,i-(o.domain()[1]>0?m:0)]):o.range(S||[0,i]),T=T||s,N=N||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var L=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),A=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),O=A.append("defs"),M=A.append("g"),_=L.select("g");M.append("g").attr("class","nv-groups"),L.attr("transform","translate("+t.left+","+t.top+")");var D=L.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)}),D.style("stroke-opacity",1).style("fill-opacity",.75);var P=D.selectAll("g.nv-bar").data(function(e){return e.values});P.exit().remove();var H=P.enter().append("g").attr("transform",function(t,n,r){return"translate("+N(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});H.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length)),P.on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.append("text"),d&&!p?(P.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return g(a(e,t))}),P.select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})):P.selectAll("text").text(""),v&&!p?(H.append("text").classed("nv-bar-label",!0),P.select("text.nv-bar-label").attr("text-anchor",function(e,t){return a(e,t)<0?"start":"end"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return u(e,t)}),P.select("text.nv-bar-label").attr("x",function(e,t){return a(e,t)<0?o(0)-o(a(e,t))+4:-4})):P.selectAll("text.nv-bar-label").text(""),P.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}),c&&(h||(h=e.map(function(){return!0})),P.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})),p?P.attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand()):P.attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)}),T=s.copy(),N=o.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=!1,d=!1,v=!1,m=60,g=d3.format(",.2f"),y=1200,b,w,E,S,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(s=e,C):s},C.yScale=function(e){return arguments.length?(o=e,C):o},C.xDomain=function(e){return arguments.length?(b=e,C):b},C.yDomain=function(e){return arguments.length?(w=e,C):w},C.xRange=function(e){return arguments.length?(E=e,C):E},C.yRange=function(e){return arguments.length?(S=e,C):S},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(p=e,C):p},C.color=function(t){return arguments.length?(l=e.utils.getColor(t),C):l},C.barColor=function(t){return arguments.length?(c=e.utils.getColor(t),C):c},C.disabled=function(e){return arguments.length?(h=e,C):h},C.id=function(e){return arguments.length?(i=e,C):i},C.delay=function(e){return arguments.length?(y=e,C):y},C.showValues=function(e){return arguments.length?(d=e,C):d},C.showBarLabels=function(e){return arguments.length?(v=e,C):v},C.valueFormat=function(e){return arguments.length?(g=e,C):g},C.valuePadding=function(e){return arguments.length?(m=e,C):m},C},e.models.multiBarHorizontalChart=function(){function C(e){return e.each(function(e){var d=d3.select(this),m=this,T=(u||parseInt(d.style("width"))||960)-o.left-o.right,k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom;C.update=function(){d.call(C)},C.container=this,b.disabled=e.map(function(e){return!!e.disabled});if(!w){var L;w={};for(L in b)b[L]instanceof Array?w[L]=b[L].slice(0):w[L]=b[L]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var A=d.selectAll(".nv-noData").data([E]);return A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",o.left+T/2).attr("y",o.top+k/2).text(function(e){return e}),C}d.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var O=d.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),c&&(i.width(T-x()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),_.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom),_.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")"));if(l){var D=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]),_.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -o.top+")").call(s)}O.attr("transform","translate("+o.left+","+o.top+")"),t.disabled(e.map(function(e){return e.disabled})).width(T).height(k).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var P=_.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));P.call(t);if(h){n.scale(g).ticks(k/24).tickSize(-T,0),_.select(".nv-x.nv-axis").call(n);var H=_.select(".nv-x.nv-axis").selectAll("g");H.selectAll("line, text")}p&&(r.scale(y).ticks(T/100).tickSize(-k,0),_.select(".nv-y.nv-axis").attr("transform","translate(0,"+k+")"),_.select(".nv-y.nv-axis").call(r)),_.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-k),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),C.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;D=D.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}b.stacked=t.stacked(),S.stateChange(b),C.update()}),S.on("tooltipShow",function(e){v&&N(e,m.parentNode)}),S.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),b.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),b.stacked=n.stacked),C.update()})}),C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"},g,y,b={stacked:d},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=0;t.stacked(d),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f")),s.updateState(!1);var N=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,C);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),C.dispatch=S,C.multibar=t,C.legend=i,C.xAxis=n,C.yAxis=r,d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor"),C.options=e.utils.optionsFunc.bind(C),C.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,C):o},C.width=function(e){return arguments.length?(u=e,C):u},C.height=function(e){return arguments.length?(a=e,C):a},C.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),C):f},C.showControls=function(e){return arguments.length?(l=e,C):l},C.showLegend=function(e){return arguments.length?(c=e,C):c},C.showXAxis=function(e){return arguments.length?(h=e,C):h},C.showYAxis=function(e){return arguments.length?(p=e,C):p},C.tooltip=function(e){return arguments.length?(m=e,C):m},C.tooltips=function(e){return arguments.length?(v=e,C):v},C.tooltipContent=function(e){return arguments.length?(m=e,C):m},C.state=function(e){return arguments.length?(b=e,C):b},C.defaultState=function(e){return arguments.length?(w=e,C):w},C.noData=function(e){return arguments.length?(E=e,C):E},C.transitionDuration=function(e){return arguments.length?(T=e,C):T},C},e.models.multiChart=function(){function C(e){return e.each(function(e){var u=d3.select(this),f=this;C.update=function(){u.call(C)},C.container=this;var k=(r||parseInt(u.style("width"))||960)-t.left-t.right,L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom,A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),_=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,k]);var j=u.selectAll("g.wrap.multiChart").data([e]),F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis"),F.append("g").attr("class","y1 axis"),F.append("g").attr("class","y2 axis"),F.append("g").attr("class","lines1Wrap"),F.append("g").attr("class","lines2Wrap"),F.append("g").attr("class","bars1Wrap"),F.append("g").attr("class","bars2Wrap"),F.append("g").attr("class","stack1Wrap"),F.append("g").attr("class","stack2Wrap"),F.append("g").attr("class","legendWrap");var I=j.select("g");s&&(x.width(k/2),I.select(".legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(x),t.top!=x.height()&&(t.top=x.height(),L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom),I.select(".legendWrap").attr("transform","translate("+k/2+","+ -t.top+")")),d.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"})),v.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"})),m.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"})),g.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"})),y.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"})),b.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"})),I.attr("transform","translate("+t.left+","+t.top+")");var q=I.select(".lines1Wrap").datum(A),R=I.select(".bars1Wrap").datum(M),U=I.select(".stack1Wrap").datum(D),z=I.select(".lines2Wrap").datum(O),W=I.select(".bars2Wrap").datum(_),X=I.select(".stack2Wrap").datum(P),V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],$=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];h.domain(l||d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,L]),p.domain(c||d3.extent(d3.merge(B).concat($),function(e){return e.y})).range([0,L]),d.yDomain(h.domain()),m.yDomain(h.domain()),y.yDomain(h.domain()),v.yDomain(p.domain()),g.yDomain(p.domain()),b.yDomain(p.domain()),D.length&&d3.transition(U).call(y),P.length&&d3.transition(X).call(b),M.length&&d3.transition(R).call(m),_.length&&d3.transition(W).call(g),A.length&&d3.transition(q).call(d),O.length&&d3.transition(z).call(v),w.ticks(k/100).tickSize(-L,0),I.select(".x.axis").attr("transform","translate(0,"+L+")"),d3.transition(I.select(".x.axis")).call(w),E.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y1.axis")).call(E),S.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y2.axis")).call(S),I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),x.dispatch.on("stateChange",function(e){C.update()}),T.on("tooltipShow",function(e){o&&N(e,f.parentNode)})}),C}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},a,f,l,c,a=d3.scale.linear(),h=d3.scale.linear(),p=d3.scale.linear(),d=e.models.line().yScale(h),v=e.models.line().yScale(p),m=e.models.multiBar().stacked(!1).yScale(h),g=e.models.multiBar().stacked(!1).yScale(p),y=e.models.stackedArea().yScale(h),b=e.models.stackedArea().yScale(p),w=e.models.axis().scale(a).orient("bottom").tickPadding(5),E=e.models.axis().scale(h).orient("left"),S=e.models.axis().scale(p).orient("right"),x=e.models.legend().height(30),T=d3.dispatch("tooltipShow","tooltipHide"),N=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=w.tickFormat()(d.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?S:E).tickFormat()(d.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,C);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),m.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),g.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),y.dispatch.on("tooltipShow",function(e){if(!Math.round(y.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),y.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),b.dispatch.on("tooltipShow",function(e){if(!Math.round(b.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),b.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),C.dispatch=T,C.lines1=d,C.lines2=v,C.bars1=m,C.bars2=g,C.stack1=y,C.stack2=b,C.xAxis=w,C.yAxis1=E,C.yAxis2=S,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(getX=e,d.x(e),m.x(e),C):getX},C.y=function(e){return arguments.length?(getY=e,d.y(e),m.y(e),C):getY},C.yDomain1=function(e){return arguments.length?(l=e,C):l},C.yDomain2=function(e){return arguments.length?(c=e,C):c},C.margin=function(e){return arguments.length?(t=e,C):t},C.width=function(e){return arguments.length?(r=e,C):r},C.height=function(e){return arguments.length?(i=e,C):i},C.color=function(e){return arguments.length?(n=e,x.color(e),C):n},C.showLegend=function(e){return arguments.length?(s=e,C):s},C.tooltips=function(e){return arguments.length?(o=e,C):o},C.tooltipContent=function(e){return arguments.length?(u=e,C):u},C},e.models.ohlcBar=function(){function x(e){return e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p))),v?s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range(w||[0,g]),o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-ticks"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x),A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!1,m=!0,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return x.dispatch=S,x.options=e.utils.optionsFunc.bind(x),x.x=function(e){return arguments.length?(u=e,x):u},x.y=function(e){return arguments.length?(a=e,x):a},x.open=function(e){return arguments.length?(f=e,x):f},x.close=function(e){return arguments.length?(l=e,x):l},x.high=function(e){return arguments.length?(c=e,x):c},x.low=function(e){return arguments.length?(h=e,x):h},x.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,x):t},x.width=function(e){return arguments.length?(n=e,x):n},x.height=function(e){return arguments.length?(r=e,x):r},x.xScale=function(e){return arguments.length?(s=e,x):s},x.yScale=function(e){return arguments.length?(o=e,x):o},x.xDomain=function(e){return arguments.length?(y=e,x):y},x.yDomain=function(e){return arguments.length?(b=e,x):b},x.xRange=function(e){return arguments.length?(w=e,x):w},x.yRange=function(e){return arguments.length?(E=e,x):E},x.forceX=function(e){return arguments.length?(p=e,x):p},x.forceY=function(e){return arguments.length?(d=e,x):d},x.padData=function(e){return arguments.length?(v=e,x):v},x.clipEdge=function(e){return arguments.length?(m=e,x):m},x.color=function(t){return arguments.length?(g=e.utils.getColor(t),x):g},x.id=function(e){return arguments.length?(i=e,x):i},x},e.models.pie=function(){function S(e){return e.each(function(e){function q(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function R(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle,e.startAngle=isNaN(e.startAngle)?0:e.startAngle,m||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return A(t(e))}}function U(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return A(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,S=Math.min(o,f)/2,x=S-S/5,T=d3.select(this),N=T.selectAll(".nv-wrap.nv-pie").data(e),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-pie"),k.append("g").attr("class","nv-pieLabels"),N.attr("transform","translate("+t.left+","+t.top+")"),L.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")"),L.select(".nv-pieLabels").attr("transform","translate("+o/2+","+f/2+")"),T.on("click",function(e,t){E.chartClick({data:e,index:t,pos:d3.event,id:u})});var A=d3.svg.arc().outerRadius(x);y&&A.startAngle(y),b&&A.endAngle(b),m&&A.innerRadius(S*w);var O=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)}),M=N.select(".nv-pie").selectAll(".nv-slice").data(O),_=N.select(".nv-pieLabels").selectAll(".nv-label").data(O);M.exit().remove(),_.exit().remove();var D=M.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),E.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),E.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){E.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(e,t){E.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()});M.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var P=D.append("path").each(function(e){this._current=e});M.select("path").attr("d",A);if(l){var H=d3.svg.arc().innerRadius(0);c&&(H=A),h&&(H=d3.svg.arc().outerRadius(A.outerRadius())),_.enter().append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}return e.outerRadius=S+10,e.innerRadius=S+15,"translate("+H.centroid(e)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",g?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var B={},j=14,F=140,I=function(e){return Math.floor(e[0]/F)*F+","+Math.floor(e[1]/j)*j};_.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}e.outerRadius=S+10,e.innerRadius=S+15;var n=H.centroid(e),r=I(n);return B[r]&&(n[1]-=j),B[I(n)]=!0,"translate("+n+")"}),_.select(".nv-label text").style("text-anchor",g?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI),r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>v?r[p]:""})}}),S}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=!0,c=!0,h=!1,p="key",v=.02,m=!1,g=!1,y=!1,b=!1,w=.5,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return S.dispatch=E,S.options=e.utils.optionsFunc.bind(S),S.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,S):t},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.values=function(t){return e.log("pie.values() is no longer supported."),S},S.x=function(e){return arguments.length?(i=e,S):i},S.y=function(e){return arguments.length?(s=d3.functor(e),S):s},S.description=function(e){return arguments.length?(o=e,S):o},S.showLabels=function(e){return arguments.length?(l=e,S):l},S.labelSunbeamLayout=function(e){return arguments.length?(g=e,S):g},S.donutLabelsOutside=function(e){return arguments.length?(h=e,S):h},S.pieLabelsOutside=function(e){return arguments.length?(c=e,S):c},S.labelType=function(e){return arguments.length?(p=e,p=p||"key",S):p},S.donut=function(e){return arguments.length?(m=e,S):m},S.donutRatio=function(e){return arguments.length?(w=e,S):w},S.startAngle=function(e){return arguments.length?(y=e,S):y},S.endAngle=function(e){return arguments.length?(b=e,S):b},S.id=function(e){return arguments.length?(u=e,S):u},S.color=function(t){return arguments.length?(a=e.utils.getColor(t),S):a},S.valueFormat=function(e){return arguments.length?(f=e,S):f},S.labelThreshold=function(e){return arguments.length?(v=e,S):v},S},e.models.pieChart=function(){function v(e){return e.each(function(e){var u=d3.select(this),a=this,f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.call(v)},v.container=this,l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l)l[m]instanceof Array?c[m]=l[m].slice(0):c[m]=l[m]}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);return g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e}),v}u.selectAll(".nv-noData").remove();var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),w=y.select("g");b.append("g").attr("class","nv-pieWrap"),b.append("g").attr("class","nv-legendWrap"),o&&(n.width(f).key(t.x()),y.select(".nv-legendWrap").datum(e).call(n),r.top!=n.height()&&(r.top=n.height(),d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom),y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),y.attr("transform","translate("+r.left+","+r.top+")"),t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t),n.dispatch.on("stateChange",function(e){l=e,p.stateChange(l),v.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)}),p.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),l.disabled=t.disabled),v.update()})}),v}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),d=function(n,r){var i=t.description()(n.point)||t.x()(n.point),s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],p.tooltipShow(e)}),p.on("tooltipShow",function(e){a&&d(e)}),p.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),v.legend=n,v.dispatch=p,v.pie=t,d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,v):r},v.width=function(e){return arguments.length?(i=e,v):i},v.height=function(e){return arguments.length?(s=e,v):s},v.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),v):u},v.showLegend=function(e){return arguments.length?(o=e,v):o},v.tooltips=function(e){return arguments.length?(a=e,v):a},v.tooltipContent=function(e){return arguments.length?(f=e,v):f},v.state=function(e){return arguments.length?(l=e,v):l},v.defaultState=function(e){return arguments.length?(c=e,v):c},v.noData=function(e){return arguments.length?(h=e,v):h},v},e.models.scatter=function(){function I(q){return q.each(function(I){function Q(){if(!g)return!1;var e,i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n),i=l(e,n);return[o(r),u(i),t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===!0){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T),c.exit().remove(),c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}i.length&&(i.push([o.range()[0]-20,u.range()[0]-20,null,null]),i.push([o.range()[1]+20,u.range()[1]+20,null,null]),i.push([o.range()[0]-20,u.range()[0]+20,null,null]),i.push([o.range()[1]+20,u.range()[1]-20,null,null]));var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]),p=1e-6;i=i.sort(function(e,t){return e[0]-t[0]||e[1]-t[1]});for(var d=0;d<i.length-1;)Math.abs(i[d][0]-i[d+1][0])<p&&Math.abs(i[d][1]-i[d+1][1])<p?i.splice(d+1,1):d++;var v=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}}),m=X.select(".nv-point-paths").selectAll("path").data(v);m.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),m.exit().remove(),m.attr("d",function(e){return!e||!e.data||e.data.length===0?"M 0 0":"M"+e.data.join("L")+"Z"});var y=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r=="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};m.on("click",function(e){y(e,_.elementClick)}).on("mouseover",function(e){y(e,_.elementMouseover)}).on("mouseout",function(e,t){y(e,_.elementMouseout)})}else X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})});F=!1}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d))),w&&I[0]?o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]):o.range(k||[0,q]),u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]),a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=!0;o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1])),isNaN(o.domain()[0])&&o.domain([-1,1]),isNaN(u.domain()[0])&&u.domain([-1,1]),P=P||o,H=H||u,B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":"")),$=V.append("defs"),J=V.append("g"),K=X.select("g");J.append("g").attr("class","nv-groups"),J.append("g").attr("class","nv-point-paths"),X.attr("transform","translate("+t.left+","+t.top+")"),$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R>0?R:0),K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":""),F=!0;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),G.exit().remove(),G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),G.style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)}),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j),j=setTimeout(Q,300),P=o.copy(),H=u.copy(),B=a.copy()}),I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=!0,d=[],v=[],m=[],g=!0,y=null,b=function(e){return!e.notActive},w=!1,E=.1,S=!1,x=!0,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=!1,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=!0,P,H,B,j,F=!1;return I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",!1)},I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)},_.on("elementMouseover.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!0)}),_.on("elementMouseout.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!1)}),I.dispatch=_,I.options=e.utils.optionsFunc.bind(I),I.x=function(e){return arguments.length?(f=d3.functor(e),I):f},I.y=function(e){return arguments.length?(l=d3.functor(e),I):l},I.size=function(e){return arguments.length?(c=d3.functor(e),I):c},I.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,I):t},I.width=function(e){return arguments.length?(n=e,I):n},I.height=function(e){return arguments.length?(r=e,I):r},I.xScale=function(e){return arguments.length?(o=e,I):o},I.yScale=function(e){return arguments.length?(u=e,I):u},I.zScale=function(e){return arguments.length?(a=e,I):a},I.xDomain=function(e){return arguments.length?(N=e,I):N},I.yDomain=function(e){return arguments.length?(C=e,I):C},I.sizeDomain=function(e){return arguments.length?(A=e,I):A},I.xRange=function(e){return arguments.length?(k=e,I):k},I.yRange=function(e){return arguments.length?(L=e,I):L},I.sizeRange=function(e){return arguments.length?(O=e,I):O},I.forceX=function(e){return arguments.length?(d=e,I):d},I.forceY=function(e){return arguments.length?(v=e,I):v},I.forceSize=function(e){return arguments.length?(m=e,I):m},I.interactive=function(e){return arguments.length?(g=e,I):g},I.pointKey=function(e){return arguments.length?(y=e,I):y},I.pointActive=function(e){return arguments.length?(b=e,I):b},I.padData=function(e){return arguments.length?(w=e,I):w},I.padDataOuter=function(e){return arguments.length?(E=e,I):E},I.clipEdge=function(e){return arguments.length?(S=e,I):S},I.clipVoronoi=function(e){return arguments.length?(x=e,I):x},I.useVoronoi=function(e){return arguments.length?(D=e,D===!1&&(x=!1),I):D},I.clipRadius=function(e){return arguments.length?(T=e,I):T},I.color=function(t){return arguments.length?(i=e.utils.getColor(t),I):i},I.shape=function(e){return arguments.length?(h=e,I):h},I.onlyCircles=function(e){return arguments.length?(p=e,I):p},I.id=function(e){return arguments.length?(s=e,I):s},I.singlePoint=function(e){return arguments.length?(M=e,I):M},I},e.models.scatterChart=function(){function F(e){return e.each(function(e){function J(){if(T)return W.select(".nv-point-paths").style("pointer-events","all"),!1;W.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]),p.distortion(x).focus(i[1]),W.select(".nv-scatterWrap").call(t),b&&W.select(".nv-x.nv-axis").call(n),w&&W.select(".nv-y.nv-axis").call(r),W.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),W.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this,L=(f||parseInt(C.style("width"))||960)-a.left-a.right,D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.call(F)},F.container=this,A.disabled=e.map(function(e){return!!e.disabled});if(!O){var I;O={};for(I in A)A[I]instanceof Array?O[I]=A[I].slice(0):O[I]=A[I]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=C.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",a.left+L/2).attr("y",a.top+D/2).text(function(e){return e}),F}C.selectAll(".nv-noData").remove(),P=P||h,H=H||p;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]),U=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),z=U.append("g"),W=R.select("g");z.append("rect").attr("class","nvd3 nv-background"),z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-scatterWrap"),z.append("g").attr("class","nv-distWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap");if(y){var X=S?L/2:L;i.width(X),R.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(L-X)+","+ -a.top+")")}S&&(s.width(180).color(["#444"]),W.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)),R.attr("transform","translate("+a.left+","+a.top+")"),E&&W.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),t.width(L).height(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),d!==0&&t.xDomain(null),v!==0&&t.yDomain(null),R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var V=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*V,h.domain()[1]+d*V])}if(v!==0){var $=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*$,p.domain()[1]+v*$])}(v!==0||d!==0)&&R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),b&&(n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-D,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),w&&(r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():D/36).tickSize(-L,0),W.select(".nv-y.nv-axis").call(r)),m&&(o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),W.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),W.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(W.select(".nv-background").attr("width",L).attr("height",D),W.select(".nv-background").on("mousemove",J),W.select(".nv-background").on("click",function(){T=!T}),t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,x=e.disabled?0:2.5,W.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),W.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(x).focus(0),p.distortion(x).focus(0),W.select(".nv-scatterWrap").call(t),W.select(".nv-x.nv-axis").call(n),W.select(".nv-y.nv-axis").call(r)):T=!1,F.update()}),i.dispatch.on("stateChange",function(e){A.disabled=e.disabled,M.stateChange(A),F.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-D}),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],M.tooltipShow(e)}),M.on("tooltipShow",function(e){N&&B(e,k.parentNode)}),M.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),A.disabled=t.disabled),F.update()}),P=h.copy(),H=p.copy()}),F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!0,w=!0,E=!1,S=!!d3.fisheye,x=0,T=!1,N=!0,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(E?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var P,H,B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));C!=null&&e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip"),k!=null&&e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip"),L!=null&&e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)},j=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),M.on("tooltipHide",function(){N&&e.tooltip.cleanup()}),F.dispatch=M,F.scatter=t,F.legend=i,F.controls=s,F.xAxis=n,F.yAxis=r,F.distX=o,F.distY=u,d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),F.options=e.utils.optionsFunc.bind(F),F.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,F):a},F.width=function(e){return arguments.length?(f=e,F):f},F.height=function(e){return arguments.length?(l=e,F):l},F.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),F):c},F.showDistX=function(e){return arguments.length?(m=e,F):m},F.showDistY=function(e){return arguments.length?(g=e,F):g},F.showControls=function(e){return arguments.length?(S=e,F):S},F.showLegend=function(e){return arguments.length?(y=e,F):y},F.showXAxis=function(e){return arguments.length?(b=e,F):b},F.showYAxis=function(e){return arguments.length?(w=e,F):w},F.rightAlignYAxis=function(e){return arguments.length?(E=e,r.orient(e?"right":"left"),F):E},F.fisheye=function(e){return arguments.length?(x=e,F):x},F.xPadding=function(e){return arguments.length?(d=e,F):d},F.yPadding=function(e){return arguments.length?(v=e,F):v},F.tooltips=function(e){return arguments.length?(N=e,F):N},F.tooltipContent=function(e){return arguments.length?(L=e,F):L},F.tooltipXContent=function(e){return arguments.length?(C=e,F):C},F.tooltipYContent=function(e){return arguments.length?(k=e,F):k},F.state=function(e){return arguments.length?(A=e,F):A},F.defaultState=function(e){return arguments.length?(O=e,F):O},F.noData=function(e){return arguments.length?(_=e,F):_},F.transitionDuration=function(e){return arguments.length?(D=e,F):D},F},e.models.scatterPlusLineChart=function(){function B(e){return e.each(function(e){function V(){if(S)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]),p.distortion(E).focus(i[1]),U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),g&&U.select(".nv-x.nv-axis").call(n),y&&U.select(".nv-y.nv-axis").call(r),U.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),U.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,C=(f||parseInt(T.style("width"))||960)-a.left-a.right,M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.call(B)},B.container=this,k.disabled=e.map(function(e){return!!e.disabled});if(!L){var j;L={};for(j in k)k[j]instanceof Array?L[j]=k[j].slice(0):L[j]=k[j]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var F=T.selectAll(".nv-noData").data([O]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",a.left+C/2).attr("y",a.top+M/2).text(function(e){return e}),B}T.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),_=_||h,D=D||p;var I=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),R=q.append("g"),U=I.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+a.left+","+a.top+")"),b&&U.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),m&&(i.width(C/2),I.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),I.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")),w&&(s.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(C).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),I.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var z=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});z.enter().append("g").attr("class","nv-regLines");var W=z.selectAll(".nv-regLine").data(function(e){return[e]}),X=W.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);W.attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),g&&(n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-M,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),y&&(r.scale(p).ticks(r.ticks()?r.ticks():M/36).tickSize(-C,0),U.select(".nv-y.nv-axis").call(r)),d&&(o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(U.select(".nv-background").attr("width",C).attr("height",M),U.select(".nv-background").on("mousemove",V),U.select(".nv-background").on("click",function(){S=!S}),t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,E=e.disabled?0:2.5,U.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(E).focus(0),p.distortion(E).focus(0),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r)):S=!1,B.update()}),i.dispatch.on("stateChange",function(e){k=e,A.stateChange(k),B.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-M),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],A.tooltipShow(e)}),A.on("tooltipShow",function(e){x&&P(e,N.parentNode)}),A.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),k.disabled=t.disabled),B.update()}),_=h.copy(),D=p.copy()}),B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!0,y=!0,b=!1,w=!!d3.fisheye,E=0,S=!1,x=!0,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(b?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var _,D,P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));T!=null&&e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip"),N!=null&&e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip"),C!=null&&e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)},H=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),A.on("tooltipHide",function(){x&&e.tooltip.cleanup()}),B.dispatch=A,B.scatter=t,B.legend=i,B.controls=s,B.xAxis=n,B.yAxis=r,B.distX=o,B.distY=u,d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),B.options=e.utils.optionsFunc.bind(B),B.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,B):a},B.width=function(e){return arguments.length?(f=e,B):f},B.height=function(e){return arguments.length?(l=e,B):l},B.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),B):c},B.showDistX=function(e){return arguments.length?(d=e,B):d},B.showDistY=function(e){return arguments.length?(v=e,B):v},B.showControls=function(e){return arguments.length?(w=e,B):w},B.showLegend=function(e){return arguments.length?(m=e,B):m},B.showXAxis=function(e){return arguments.length?(g=e,B):g},B.showYAxis=function(e){return arguments.length?(y=e,B):y},B.rightAlignYAxis=function(e){return arguments.length?(b=e,r.orient(e?"right":"left"),B):b},B.fisheye=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(x=e,B):x},B.tooltipContent=function(e){return arguments.length?(C=e,B):C},B.tooltipXContent=function(e){return arguments.length?(T=e,B):T},B.tooltipYContent=function(e){return arguments.length?(N=e,B):N},B.state=function(e){return arguments.length?(k=e,B):k},B.defaultState=function(e){return arguments.length?(L=e,B):L},B.noData=function(e){return arguments.length?(O=e,B):O},B.transitionDuration=function(e){return arguments.length?(M=e,B):M},B},e.models.sparkline=function(){function d(e){return e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]),o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),b=g.append("g"),w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path"),E.exit().remove(),E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle"),S.exit().remove(),S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;return d.options=e.utils.optionsFunc.bind(d),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.height=function(e){return arguments.length?(r=e,d):r},d.x=function(e){return arguments.length?(u=d3.functor(e),d):u},d.y=function(e){return arguments.length?(a=d3.functor(e),d):a},d.xScale=function(e){return arguments.length?(s=e,d):s},d.yScale=function(e){return arguments.length?(o=e,d):o},d.xDomain=function(e){return arguments.length?(l=e,d):l},d.yDomain=function(e){return arguments.length?(c=e,d):c},d.xRange=function(e){return arguments.length?(h=e,d):h},d.yRange=function(e){return arguments.length?(p=e,d):p},d.animate=function(e){return arguments.length?(i=e,d):i},d.color=function(t){return arguments.length?(f=e.utils.getColor(t),d):f},d},e.models.sparklinePlus=function(){function v(e){return e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s<e.length;s++)Math.abs(t.x()(e[s],s)-n)<r&&(r=Math.abs(t.x()(e[s],s)-n),i=s);return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))],O()}var m=d3.select(this),g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)},v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e}),v}m.selectAll(".nv-noData").remove();var E=t.y()(c[c.length-1],c.length-1);s=t.xScale(),o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),N=T.append("g"),C=S.select("g");N.append("g").attr("class","nv-sparklineWrap"),N.append("g").attr("class","nv-valueWrap"),N.append("g").attr("class","nv-hoverArea"),S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b),k.call(t);var L=C.select(".nv-valueWrap"),A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start"),A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E)),N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[],O()}),C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)}),v}var t=e.models.sparkline(),n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=!1,f=d3.format(",r"),l=d3.format(",.2f"),c=!0,h=!0,p=!1,d="No Data Available.";return v.sparkline=t,d3.rebind(v,t,"x","y","xScale","yScale","color"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,v):n},v.width=function(e){return arguments.length?(r=e,v):r},v.height=function(e){return arguments.length?(i=e,v):i},v.xTickFormat=function(e){return arguments.length?(f=e,v):f},v.yTickFormat=function(e){return arguments.length?(l=e,v):l},v.showValue=function(e){return arguments.length?(c=e,v):c},v.alignValue=function(e){return arguments.length?(h=e,v):h},v.rightAlignValue=function(e){return arguments.length?(p=e,v):p},v.noData=function(e){return arguments.length?(d=e,v):d},v},e.models.stackedArea=function(){function g(e){return e.each(function(e){var a=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);p=v.xScale(),d=v.yScale();var E=e;e.forEach(function(e,t){e.seriesIndex=t,e.values=e.values.map(function(e,n){return e.index=n,e.seriesIndex=t,e})});var S=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(S);var T=w.selectAll("g.nv-wrap.nv-stackedarea").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-areaWrap"),k.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+t.left+","+t.top+")"),v.width(a).height(b).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var A=L.select(".nv-scatterWrap").datum(e);A.call(v),C.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",b),L.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c),M=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)}),_=L.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});_.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return M(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("click",function(e,t){d3.select(this).classed("hover",!1),m.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}),_.exit().remove(),_.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)}),_.attr("d",function(e,t){return O(e.values,t)}),v.dispatch.on("elementMouseover.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!1)}),g.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<E.length;i++)o+=u(E[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=!1,p,d,v=e.models.scatter(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return v.size(2.2).sizeDomain([2.2,2.2]),v.dispatch.on("elementClick.area",function(e){m.areaClick(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){m.tooltipHide(e)}),g.dispatch=m,g.scatter=v,d3.rebind(g,v,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),g.options=e.utils.optionsFunc.bind(g),g.x=function(e){return arguments.length?(o=d3.functor(e),g):o},g.y=function(e){return arguments.length?(u=d3.functor(e),g):u},g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.clipEdge=function(e){return arguments.length?(h=e,g):h},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),g):i},g.offset=function(e){return arguments.length?(f=e,g):f},g.order=function(e){return arguments.length?(l=e,g):l},g.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":g.offset("zero"),g.order("default");break;case"stream":g.offset("wiggle"),g.order("inside-out");break;case"stream-center":g.offset("silhouette"),g.order("inside-out");break;case"expand":g.offset("expand"),g.order("default");break;case"stack_percent":g.offset(g.d3_stackedOffset_stackPercent),g.order("default")}return g},g.interpolate=function(e){return arguments.length?(c=e,g):c},g},e.models.stackedAreaChart=function(){function M(y){return y.each(function(y){var A=d3.select(this),_=this,D=(a||parseInt(A.style("width"))||960)-u.left-u.right,P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom;M.update=function(){A.call(M)},M.container=this,S.disabled=y.map(function(e){return!!e.disabled});if(!x){var H;x={};for(H in S)S[H]instanceof Array?x[H]=S[H].slice(0):x[H]=S[H]}if(!y||!y.length||!y.filter(function(e){return e.values.length}).length){var B=A.selectAll(".nv-noData").data([T]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",u.left+D/2).attr("y",u.top+P/2).text(function(e){return e}),M}A.selectAll(".nv-noData").remove(),b=t.xScale(),w=t.yScale();var j=A.selectAll("g.nv-wrap.nv-stackedAreaChart").data([y]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),I=j.select("g");F.append("rect").style("opacity",0),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-stackedWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap"),F.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",D).attr("height",P);if(h){var q=c?D-C:D;i.width(q),I.select(".nv-legendWrap").datum(y).call(i),u.top!=i.height()&&(u.top=i.height(),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-legendWrap").attr("transform","translate("+(D-q)+","+ -u.top+")")}if(c){var R=[{key:L.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:L.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:L.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:L.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];C=k.length/3*260,R=R.filter(function(e){return k.indexOf(e.metaKey)!==-1}),s.width(C).color(["#444","#444","#444"]),I.select(".nv-controlsWrap").datum(R).call(s),u.top!=Math.max(s.height(),i.height())&&(u.top=Math.max(s.height(),i.height()),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}j.attr("transform","translate("+u.left+","+u.top+")"),v&&I.select(".nv-y.nv-axis").attr("transform","translate("+D+",0)"),m&&(o.width(D).height(P).margin({left:u.left,top:u.top}).svgContainer(A).xScale(b),j.select(".nv-interactive").call(o)),t.width(D).height(P);var U=I.select(".nv-stackedWrap").datum(y);U.call(t),p&&(n.scale(b).ticks(D/100).tickSize(-P,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+P+")"),I.select(".nv-x.nv-axis").call(n)),d&&(r.scale(w).ticks(t.offset()=="wiggle"?0:P/36).tickSize(-D,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):E),I.select(".nv-y.nv-axis").call(r)),t.dispatch.on("areaClick.toggle",function(e){y.filter(function(e){return!e.disabled}).length===1?y.forEach(function(e){e.disabled=!1}):y.forEach(function(t,n){t.disabled=n!=e.seriesIndex}),S.disabled=y.map(function(e){return!!e.disabled}),N.stateChange(S),M.update()}),i.dispatch.on("stateChange",function(e){S.disabled=e.disabled,N.stateChange(S),M.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;R=R.map(function(e){return e.disabled=!0,e}),e.disabled=!1,t.style(e.style),S.style=t.style(),N.stateChange(S),M.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];y.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,M.x()),t.highlightPoint(r,a,!0);var o=n.values[a];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof f=="undefined"&&(f=M.xScale()(M.x()(o,a)));var u=t.style()=="expand"?o.display.y:M.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})}),c.reverse();if(c.length>2){var h=M.yScale().invert(i.mouseY),p=Infinity,d=null;c.forEach(function(e,t){h=Math.abs(h);var n=Math.abs(e.stackedValue.y0),r=Math.abs(e.stackedValue.y);if(h>=n&&h<=r+n){d=t;return}}),d!=null&&(c[d].highlight=!0)}var v=n.tickFormat()(M.x()(s,a)),m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(_.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})(),o.renderGuideLine(f)}),o.dispatch.on("elementMouseout",function(e){N.tooltipHide(),t.clearHighlights()}),N.on("tooltipShow",function(e){g&&O(e,_.parentNode)}),N.on("changeState",function(e){typeof e.disabled!="undefined"&&y.length===e.disabled.length&&(y.forEach(function(t,n){t.disabled=e.disabled[n]}),S.disabled=e.disabled),typeof e.style!="undefined"&&t.style(e.style),M.update()})}),M}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=!0,h=!0,p=!0,d=!0,v=!1,m=!1,g=!0,y=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},b,w,E=d3.format(",.2f"),S={style:t.style()},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=250,k=["Stacked","Stream","Expanded"],L={},A=0;n.orient("bottom").tickPadding(7),r.orient(v?"right":"left"),s.updateState(!1);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=y(i.series.key,a,f,i,M);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],N.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){g&&e.tooltip.cleanup()}),M.dispatch=N,M.stacked=t,M.legend=i,M.controls=s,M.xAxis=n,M.yAxis=r,M.interactiveLayer=o,d3.rebind(M,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),M.options=e.utils.optionsFunc.bind(M),M.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,M):u},M.width=function(e){return arguments.length?(a=e,M):a},M.height=function(e){return arguments.length?(f=e,M):f},M.color=function(n){return arguments.length?(l=e.utils.getColor(n),i.color(l),t.color(l),M):l},M.showControls=function(e){return arguments.length?(c=e,M):c},M.showLegend=function(e){return arguments.length?(h=e,M):h},M.showXAxis=function(e){return arguments.length?(p=e,M):p},M.showYAxis=function(e){return arguments.length?(d=e,M):d},M.rightAlignYAxis=function(e){return arguments.length?(v=e,r.orient(e?"right":"left"),M):v},M.useInteractiveGuideline=function(e){return arguments.length?(m=e,e===!0&&(M.interactive(!1),M.useVoronoi(!1)),M):m},M.tooltip=function(e){return arguments.length?(y=e,M):y},M.tooltips=function(e){return arguments.length?(g=e,M):g},M.tooltipContent=function(e){return arguments.length?(y=e,M):y},M.state=function(e){return arguments.length?(S=e,M):S},M.defaultState=function(e){return arguments.length?(x=e,M):x},M.noData=function(e){return arguments.length?(T=e,M):T},M.transitionDuration=function(e){return arguments.length?(A=e,M):A},M.controlsData=function(e){return arguments.length?(k=e,M):k},M.controlLabels=function(e){return arguments.length?typeof e!="object"?L:(L=e,M):L},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(E=e,r):E},M}}(),define("plugin/plugins/nvd3/nv.d3",function(){}),define("plugin/charts/nvd3/common/config",["plugin/charts/forms/default","plugin/plugins/nvd3/nv.d3"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"NVD3",tag:"svg",keywords:"small",query_limit:500})}),define("plugin/charts/nvd3/bar/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/line_focus/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line with focus",category:"Others",zoomable:"native",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/pie/config",["plugin/plugins/nvd3/nv.d3"],function(){return $.extend(!0,{},{title:"Pie chart",category:"Area charts",library:"NVD3",tag:"svg",keywords:"small",columns:{label:{title:"Labels",is_label:!0,is_auto:!0},y:{title:"Values",is_numeric:!0}},settings:{main_separator:{type:"separator",title:"Pie chart settings"},donut_ratio:{title:"Donut ratio",info:"Determine how large the donut hole will be.",type:"select",init:"0.5",data:[{label:"50%",value:"0.5"},{label:"25%",value:"0.25"},{label:"10%",value:"0.10"},{label:"0%",value:"0"}]},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},label_separator:{type:"separator",title:"Label settings"},label_type:{title:"Donut label",info:"What would you like to show for each slice?",type:"select",init:"percent",data:[{label:"-- Nothing --",value:"hide",hide:"label_outside"},{label:"Label column",value:"key",show:"label_outside"},{label:"Value column",value:"value",show:"label_outside"},{label:"Percentage",value:"percent",show:"label_outside"}]},label_outside:{title:"Show outside",info:"Would you like to show labels outside the donut?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{init:"true",hide:!0}}})}),define("plugin/charts/nvd3/stackedarea_full/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Expanded",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea_stream/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stream",category:"Area charts",zoomable:!0,keywords:"default small",showmaxmin:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/histogram/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogram",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{x_axis_label:{init:"Values"},y_axis_label:{init:"Density"},y_axis_type:{init:"f"},y_axis_precision:{init:".2"}}})}),define("plugin/charts/nvd3/line/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/scatter/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/common/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"jqPlot",tag:"div",zoomable:!0,keywords:"medium",query_limit:1e4,settings:{separator_grid:{title:"Grids",type:"separator"},x_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the X axis?",type:"radiobutton",init:"false",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]},y_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the Y axis?",type:"radiobutton",init:"true",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]}}})}),define("plugin/charts/jqplot/bar/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/line/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/scatter/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}},settings:{x_axis_grid:{init:"true"}}})}),define("plugin/charts/jqplot/boxplot/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Box plot",category:"Data processing (requires 'charts' tool from Toolshed)",library:"jqPlot",tag:"div",execute:"boxplot",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{show_legend:{init:"false"}}})}),define("plugin/charts/jqplot/histogram_discrete/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Discrete Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogramdiscrete",keywords:"small medium large",columns:{x:{title:"Observations",is_label:!0}},settings:{x_axis_label:{init:"Breaks"},y_axis_label:{init:"Density"}}})}),define("plugin/charts/others/heatmap/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"Heatmap",category:"Others",query_limit:1e3,library:"Custom",tag:"svg",keywords:"small",zoomable:!0,columns:{x:{title:"Column labels",is_label:!0,is_numeric:!0,is_unique:!0},y:{title:"Row labels",is_label:!0,is_numeric:!0,is_unique:!0},z:{title:"Observation",is_numeric:!0}},settings:{use_panels:{init:"true",hide:!0},color_set:{title:"Color scheme",info:"Select a color scheme for your heatmap",type:"select",init:"jet",data:[{label:"Cold-to-Hot",value:"hot"},{label:"Cool",value:"cool"},{label:"Copper",value:"copper"},{label:"Gray scale",value:"gray"},{label:"Jet",value:"jet"},{label:"No-Green",value:"no_green"},{label:"Ocean",value:"ocean"},{label:"Polar",value:"polar"},{label:"Red-to-Green",value:"redgreen"},{label:"Red-to-green (saturated)",value:"red2green"},{label:"Relief",value:"relief"},{label:"Seismograph",value:"seis"},{label:"Sealand",value:"sealand"},{label:"Split",value:"split"},{label:"Wysiwyg",value:"wysiwyg"}]},url_template:{title:"Url template",info:"Enter a url to link the labels with external sources. Use __LABEL__ as placeholder.",type:"text",init:"",placeholder:"http://someurl.com?id=__LABEL__"}}})}),define("plugin/charts/others/heatmap_cluster/config",["plugin/charts/others/heatmap/config"],function(e){return $.extend(!0,{},e,{title:"Clustered Heatmap",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"heatmap",keywords:"small medium large"})}),define("plugin/charts/types",["plugin/charts/nvd3/bar/config","plugin/charts/nvd3/bar_stacked/config","plugin/charts/nvd3/bar_horizontal/config","plugin/charts/nvd3/bar_horizontal_stacked/config","plugin/charts/nvd3/line_focus/config","plugin/charts/nvd3/pie/config","plugin/charts/nvd3/stackedarea_full/config","plugin/charts/nvd3/stackedarea_stream/config","plugin/charts/nvd3/histogram/config","plugin/charts/nvd3/line/config","plugin/charts/nvd3/scatter/config","plugin/charts/nvd3/stackedarea/config","plugin/charts/jqplot/bar/config","plugin/charts/jqplot/line/config","plugin/charts/jqplot/scatter/config","plugin/charts/jqplot/boxplot/config","plugin/charts/jqplot/histogram_discrete/config","plugin/charts/others/heatmap/config","plugin/charts/others/heatmap_cluster/config"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y){return Backbone.Model.extend({defaults:{nvd3_bar:e,nvd3_bar_stacked:t,nvd3_bar_horizontal:n,nvd3_bar_horizontal_stacked:r,nvd3_line_focus:i,nvd3_stackedarea:c,nvd3_stackedarea_full:o,nvd3_stackedarea_stream:u,nvd3_pie:s,nvd3_line:f,nvd3_scatter:l,nvd3_histogram:a,jqplot_bar:h,jqplot_histogram_discrete:m,jqplot_line:p,jqplot_scatter:d,jqplot_boxplot:v,others_heatmap:g,others_heatmap_cluster:y}})}),define("plugin/app",["mvc/ui/ui-modal","mvc/ui/ui-portlet","plugin/library/ui","utils/utils","plugin/library/jobs","plugin/library/datasets","plugin/library/storage","plugin/library/deferred","plugin/views/viewer","plugin/views/editor","plugin/models/config","plugin/models/chart","plugin/charts/types"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){return Backbone.View.extend({initialize:function(t){this.options=t,Galaxy&&Galaxy.modal?this.modal=Galaxy.modal:this.modal=new e.View,this.config=new l,this.types=new h,this.chart=new c,this.jobs=new i(this),this.datasets=new s(this),this.storage=new o(this),this.deferred=new u,this.viewer_view=new a(this),this.editor_view=new f(this),this.$el.append(this.viewer_view.$el),this.$el.append(this.editor_view.$el);if(!this.storage.load())this.go("editor");else{this.go("viewer");var n=this;this.deferred.execute(function(){n.chart.trigger("redraw")})}},go:function(e){$(".tooltip").hide();switch(e){case"editor":this.editor_view.show(),this.viewer_view.hide();break;case"viewer":this.editor_view.hide(),this.viewer_view.show()}},chartPath:function(e){var t=e.split(/_(.+)/);return t.length>=2?t[0]+"/"+t[1]:(console.debug("FAILED App:chartPath() - Invalid format: "+e),undefined)}})});
\ No newline at end of file
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
@@ -1,9 +1,10 @@
// dependencies
define(['plugin/charts/jqplot/common/plot-config', 'plugin/charts/tools'], function(configmaker, Tools) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * This is the common wrapper for jqplot based visualizations.
+ */
+return Backbone.View.extend({
// initialize
initialize: function(app, options) {
// get parameters
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
@@ -1,9 +1,10 @@
// dependencies
define(['plugin/charts/tools'], function(Tools) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * This is the common wrapper for nvd3 based visualizations.
+ */
+return Backbone.View.extend({
// initialize
initialize: function(app, options) {
// get parameters
@@ -97,6 +98,7 @@
}
});
+ // return
return true;
},
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/charts/nvd3/pie/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/pie/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/pie/wrapper.js
@@ -28,7 +28,7 @@
chart.state('ok', 'Pie chart has been drawn.');
// unregister process
- chart.deferred.done(process_id);
+ app.deferred.done(process_id);
}
// request data
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/charts/tools.js
--- a/config/plugins/visualizations/charts/static/charts/tools.js
+++ b/config/plugins/visualizations/charts/static/charts/tools.js
@@ -2,8 +2,7 @@
define(['utils/utils'], function(Utils) {
// render
-function panelHelper (app, options)
-{
+function panelHelper (app, options) {
// link this
var self = this;
@@ -42,7 +41,7 @@
}
// unregister process
- chart.deferred.done(process_id);
+ app.deferred.done(process_id);
} catch (err) {
// log
console.debug('FAILED: Tools::panelHelper() - ' + err);
@@ -51,7 +50,7 @@
chart.state('failed', err);
// unregister process
- chart.deferred.done(process_id);
+ app.deferred.done(process_id);
}
};
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/datasets.js
--- a/config/plugins/visualizations/charts/static/library/datasets.js
+++ b/config/plugins/visualizations/charts/static/library/datasets.js
@@ -1,7 +1,9 @@
// dependencies
define(['utils/utils'], function(Utils) {
-// widget
+/**
+ * This class handles, formats and caches datasets.
+ */
return Backbone.Collection.extend(
{
// list of datasets
@@ -11,8 +13,7 @@
cache: {},
// initialize
- initialize: function(app, options)
- {
+ initialize: function(app, options){
// link app
this.app = app;
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/deferred.js
--- a/config/plugins/visualizations/charts/static/library/deferred.js
+++ b/config/plugins/visualizations/charts/static/library/deferred.js
@@ -1,9 +1,10 @@
// dependencies
define(['utils/utils'], function(Utils) {
-// deferred process handler
-return Backbone.Model.extend(
-{
+/**
+ * This class handles deferred processes. It makes it easy to handle multiple and overlapping sets of deferred processes.
+ */
+return Backbone.Model.extend({
// queue
queue: [],
@@ -14,8 +15,7 @@
counter: 0,
// initialize
- initialize: function()
- {
+ initialize: function(){
// loop through queue and check states
this.on('refresh', function() {
for (var index in this.queue) {
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/jobs.js
--- a/config/plugins/visualizations/charts/static/library/jobs.js
+++ b/config/plugins/visualizations/charts/static/library/jobs.js
@@ -1,9 +1,10 @@
// dependencies
define(['utils/utils'], function(Utils) {
-// widget
-return Backbone.Model.extend(
-{
+/**
+ * This class handles job submissions to the charts tool.
+ */
+return Backbone.Model.extend({
// initialize
initialize: function(app, options) {
// link app
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/screenshot.js
--- a/config/plugins/visualizations/charts/static/library/screenshot.js
+++ b/config/plugins/visualizations/charts/static/library/screenshot.js
@@ -1,4 +1,6 @@
-// dependencies
+/**
+ * This class enables users to export/download a chart as PNG, SVG or PDF.
+ */
define(["libs/underscore"], function(_) {
//
// PNG export
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/storage.js
--- a/config/plugins/visualizations/charts/static/library/storage.js
+++ b/config/plugins/visualizations/charts/static/library/storage.js
@@ -1,9 +1,10 @@
// dependencies
-define(['utils/utils', 'plugin/models/chart', 'plugin/models/group'], function(Utils, Chart, Group) {
+define(['utils/utils', 'plugin/models/chart', 'plugin/models/group', 'mvc/visualization/visualization-model'], function(Utils, Chart, Group) {
-// collection
-return Backbone.Model.extend(
-{
+/**
+ * This class saves and loads a chart through the api.
+ */
+return Backbone.Model.extend({
// viz model
vis: null,
@@ -44,7 +45,6 @@
// pack and save nested chart model
save: function() {
-
// link chart
var chart = this.app.chart;
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/ui-button-menu.js
--- a/config/plugins/visualizations/charts/static/library/ui-button-menu.js
+++ b/config/plugins/visualizations/charts/static/library/ui-button-menu.js
@@ -1,8 +1,9 @@
// dependencies
-define(['utils/utils'],
- function(Utils) {
+define(['utils/utils'], function(Utils) {
-// return button menu
+/**
+ * This class creates a button with dropdown menu. It extends the functionality of the Ui.ButtonIcon class.
+ */
return Backbone.View.extend({
// main options
optionsDefault: {
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/ui-select.js
--- a/config/plugins/visualizations/charts/static/library/ui-select.js
+++ b/config/plugins/visualizations/charts/static/library/ui-select.js
@@ -1,9 +1,10 @@
// dependencies
define(['utils/utils'], function(Utils) {
-// plugin
-var View = Backbone.View.extend(
-{
+/**
+ * This class creates/wraps a default html select field as backbone class.
+ */
+var View = Backbone.View.extend({
// options
optionsDefault : {
id : '',
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/ui-table-form.js
--- a/config/plugins/visualizations/charts/static/library/ui-table-form.js
+++ b/config/plugins/visualizations/charts/static/library/ui-table-form.js
@@ -2,9 +2,10 @@
define(['plugin/library/ui-table', 'plugin/library/ui', 'utils/utils'],
function(Table, Ui, Utils) {
-// widget
-var View = Backbone.View.extend(
-{
+/**
+ * This class takes a dictionary as input an creates an input form. It uses the Ui.Table element to organize and format the form elements.
+ */
+var View = Backbone.View.extend({
// options
optionsDefault: {
title : '',
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/ui-table.js
--- a/config/plugins/visualizations/charts/static/library/ui-table.js
+++ b/config/plugins/visualizations/charts/static/library/ui-table.js
@@ -1,7 +1,10 @@
+// dependencies
define(['utils/utils'], function(Utils) {
-var View = Backbone.View.extend(
-{
+/**
+ * This class creates a ui table element.
+ */
+var View = Backbone.View.extend({
// current row
row: null,
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/library/ui.js
--- a/config/plugins/visualizations/charts/static/library/ui.js
+++ b/config/plugins/visualizations/charts/static/library/ui.js
@@ -2,9 +2,12 @@
define(['utils/utils', 'plugin/library/ui-select', 'plugin/library/ui-button-menu', 'mvc/ui/ui-modal'],
function(Utils, Select, ButtonMenu, Modal) {
+/**
+ * This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.
+ */
+
// plugin
-var Image = Backbone.View.extend(
-{
+var Image = Backbone.View.extend({
// options
optionsDefault: {
url : '',
@@ -27,8 +30,7 @@
});
// plugin
-var Label = Backbone.View.extend(
-{
+var Label = Backbone.View.extend({
// options
optionsDefault: {
title : '',
@@ -61,8 +63,7 @@
});
// plugin
-var Icon = Backbone.View.extend(
-{
+var Icon = Backbone.View.extend({
// options
optionsDefault: {
float : 'right',
@@ -95,8 +96,7 @@
});
// plugin
-var Button = Backbone.View.extend(
-{
+var Button = Backbone.View.extend({
// options
optionsDefault: {
id : null,
@@ -134,8 +134,7 @@
});
// plugin
-var ButtonIcon = Backbone.View.extend(
-{
+var ButtonIcon = Backbone.View.extend({
// options
optionsDefault: {
id : null,
@@ -188,8 +187,7 @@
});
// plugin
-var Anchor = Backbone.View.extend(
-{
+var Anchor = Backbone.View.extend({
// options
optionsDefault: {
title : '',
@@ -215,8 +213,7 @@
});
// plugin
-var Message = Backbone.View.extend(
-{
+var Message = Backbone.View.extend({
// options
optionsDefault: {
message : '',
@@ -268,8 +265,7 @@
});
// plugin
-var Searchbox = Backbone.View.extend(
-{
+var Searchbox = Backbone.View.extend({
// options
optionsDefault: {
onclick : null,
@@ -308,8 +304,7 @@
});
// plugin
-var Input = Backbone.View.extend(
-{
+var Input = Backbone.View.extend({
// options
optionsDefault: {
value : '',
@@ -362,8 +357,7 @@
});
// plugin
-var Textarea = Backbone.View.extend(
-{
+var Textarea = Backbone.View.extend({
// options
optionsDefault: {
value : '',
@@ -416,8 +410,7 @@
});
// plugin
-var RadioButton = Backbone.View.extend(
-{
+var RadioButton = Backbone.View.extend({
// options
optionsDefault: {
value : '',
@@ -503,19 +496,19 @@
// return
return {
- Label : Label,
- Button : Button,
- Icon : Icon,
- ButtonIcon : ButtonIcon,
- Input : Input,
- Anchor : Anchor,
- Message : Message,
- Searchbox : Searchbox,
- Select : Select,
- ButtonMenu : ButtonMenu,
- Modal: Modal,
- Textarea: Textarea,
- Image: Image,
- RadioButton: RadioButton
+ Anchor : Anchor,
+ Button : Button,
+ ButtonIcon : ButtonIcon,
+ ButtonMenu : ButtonMenu,
+ Icon : Icon,
+ Image : Image,
+ Input : Input,
+ Label : Label,
+ Message : Message,
+ Modal : Modal,
+ RadioButton : RadioButton,
+ Searchbox : Searchbox,
+ Select : Select,
+ Textarea : Textarea
}
});
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/models/chart.js
--- a/config/plugins/visualizations/charts/static/models/chart.js
+++ b/config/plugins/visualizations/charts/static/models/chart.js
@@ -1,11 +1,8 @@
// dependencies
-define(['plugin/models/groups', 'plugin/library/deferred', 'mvc/visualization/visualization-model'],
- function(Groups, Deferred) {
-
+define(['plugin/models/groups'], function(Groups) {
// model
-return Backbone.Model.extend(
-{
+return Backbone.Model.extend({
// defaults
defaults : {
id : null,
@@ -23,7 +20,6 @@
initialize: function(options) {
this.groups = new Groups();
this.settings = new Backbone.Model();
- this.deferred = new Deferred();
},
// reset
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/models/config.js
--- a/config/plugins/visualizations/charts/static/models/config.js
+++ b/config/plugins/visualizations/charts/static/models/config.js
@@ -2,8 +2,7 @@
define([], function() {
// model
-return Backbone.Model.extend(
-{
+return Backbone.Model.extend({
// options
defaults : {
query_limit : 500,
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/models/group.js
--- a/config/plugins/visualizations/charts/static/models/group.js
+++ b/config/plugins/visualizations/charts/static/models/group.js
@@ -2,8 +2,7 @@
define([], function() {
// model
-return Backbone.Model.extend(
-{
+return Backbone.Model.extend({
// options
defaults : {
key : 'Data label',
@@ -11,8 +10,7 @@
},
// reset
- reset: function()
- {
+ reset: function(){
this.clear({silent: true}).set(this.defaults);
this.trigger('reset', this);
}
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/models/groups.js
--- a/config/plugins/visualizations/charts/static/models/groups.js
+++ b/config/plugins/visualizations/charts/static/models/groups.js
@@ -2,8 +2,7 @@
define(['plugin/models/group'], function(Group) {
// collection
-return Backbone.Collection.extend(
-{
+return Backbone.Collection.extend({
model: Group
});
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/plugins/crossfilter/crossfilter.js
--- /dev/null
+++ b/config/plugins/visualizations/charts/static/plugins/crossfilter/crossfilter.js
@@ -0,0 +1,1 @@
+!function(r){function n(r){return r}function t(r,n){for(var t=0,e=n.length,u=Array(e);e>t;++t)u[t]=r[n[t]];return u}function e(r){function n(n,t,e,u){for(;u>e;){var f=e+u>>>1;r(n[f])<t?e=f+1:u=f}return e}function t(n,t,e,u){for(;u>e;){var f=e+u>>>1;t<r(n[f])?u=f:e=f+1}return e}return t.right=t,t.left=n,t}function u(r){function n(r,n,t){for(var u=t-n,f=(u>>>1)+1;--f>0;)e(r,f,u,n);return r}function t(r,n,t){for(var u,f=t-n;--f>0;)u=r[n],r[n]=r[n+f],r[n+f]=u,e(r,1,f,n);return r}function e(n,t,e,u){for(var f,o=n[--u+t],i=r(o);(f=t<<1)<=e&&(e>f&&r(n[u+f])>r(n[u+f+1])&&f++,!(i<=r(n[u+f])));)n[u+t]=n[u+f],t=f;n[u+t]=o}return n.sort=t,n}function f(r){function n(n,e,u,f){var o,i,a,c,l=Array(f=Math.min(u-e,f));for(i=0;f>i;++i)l[i]=n[e++];if(t(l,0,f),u>e){o=r(l[0]);do(a=r(c=n[e])>o)&&(l[0]=c,o=r(t(l,0,f)[0]));while(++e<u)}return l}var t=u(r);return n}function o(r){function n(n,t,e){for(var u=t+1;e>u;++u){for(var f=u,o=n[u],i=r(o);f>t&&r(n[f-1])>i;--f)n[f]=n[f-1];n[f]=o}return n}return n}function i(r){function n(r,n,u){return(N>u-n?e:t)(r,n,u)}function t(t,e,u){var f,o=0|(u-e)/6,i=e+o,a=u-1-o,c=e+u-1>>1,l=c-o,v=c+o,s=t[i],h=r(s),d=t[l],p=r(d),g=t[c],y=r(g),m=t[v],x=r(m),b=t[a],A=r(b);h>p&&(f=s,s=d,d=f,f=h,h=p,p=f),x>A&&(f=m,m=b,b=f,f=x,x=A,A=f),h>y&&(f=s,s=g,g=f,f=h,h=y,y=f),p>y&&(f=d,d=g,g=f,f=p,p=y,y=f),h>x&&(f=s,s=m,m=f,f=h,h=x,x=f),y>x&&(f=g,g=m,m=f,f=y,y=x,x=f),p>A&&(f=d,d=b,b=f,f=p,p=A,A=f),p>y&&(f=d,d=g,g=f,f=p,p=y,y=f),x>A&&(f=m,m=b,b=f,f=x,x=A,A=f);var k=d,O=p,w=m,E=x;t[i]=s,t[l]=t[e],t[c]=g,t[v]=t[u-1],t[a]=b;var M=e+1,U=u-2,z=E>=O&&O>=E;if(z)for(var N=M;U>=N;++N){var C=t[N],S=r(C);if(O>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>O)for(;;){var q=r(t[U]);{if(!(q>O)){if(O>q){t[N]=t[M],t[M++]=t[U],t[U--]=C;break}t[N]=t[U],t[U--]=C;break}U--}}}else for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(O>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>E)for(;;){var q=r(t[U]);{if(!(q>E)){O>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}if(t[e]=t[M-1],t[M-1]=k,t[u-1]=t[U+1],t[U+1]=w,n(t,e,M-1),n(t,U+2,u),z)return t;if(i>M&&U>a){for(var F,q;(F=r(t[M]))<=O&&F>=O;)++M;for(;(q=r(t[U]))<=E&&q>=E;)--U;for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(O>=S&&S>=O)N!==M&&(t[N]=t[M],t[M]=C),M++;else if(E>=S&&S>=E)for(;;){var q=r(t[U]);{if(!(E>=q&&q>=E)){O>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}}return n(t,M,U+1)}var e=o(r);return n}function a(r){for(var n=Array(r),t=-1;++t<r;)n[t]=0;return n}function c(r,n){for(var t=r.length;n>t;)r[t++]=0;return r}function l(r,n){if(n>32)throw Error("invalid array width!");return r}function v(r,n){return function(t){var e=t.length;return[r.left(t,n,0,e),r.right(t,n,0,e)]}}function s(r,n){var t=n[0],e=n[1];return function(n){var u=n.length;return[r.left(n,t,0,u),r.left(n,e,0,u)]}}function h(r){return[0,r.length]}function d(){return null}function p(){return 0}function g(r){return r+1}function y(r){return r-1}function m(r){return function(n,t){return n+ +r(t)}}function x(r){return function(n,t){return n-r(t)}}function b(){function r(r){var n=E,t=r.length;return t&&(b=b.concat(r),z=F(z,E+=t),S.forEach(function(e){e(r,n,t)})),l}function e(){for(var r=A(E,E),n=[],t=0,e=0;E>t;++t)z[t]?r[t]=e++:n.push(t);N.forEach(function(r){r(0,[],n)}),q.forEach(function(n){n(r)});for(var u,t=0,e=0;E>t;++t)(u=z[t])&&(t!==e&&(z[e]=u,b[e]=b[t]),++e);for(b.length=e;E>e;)z[--E]=0}function o(r){function e(n,e,u){T=n.map(r),V=$(k(u),0,u),T=t(T,V);var f,o=_(T),i=o[0],a=o[1];if(W)for(f=0;u>f;++f)W(T[f],f)||(z[V[f]+e]|=Y);else{for(f=0;i>f;++f)z[V[f]+e]|=Y;for(f=a;u>f;++f)z[V[f]+e]|=Y}if(!e)return P=T,Q=V,tn=i,en=a,void 0;var c=P,l=Q,v=0,s=0;for(P=Array(E),Q=A(E,E),f=0;e>v&&u>s;++f)c[v]<T[s]?(P[f]=c[v],Q[f]=l[v++]):(P[f]=T[s],Q[f]=V[s++]+e);for(;e>v;++v,++f)P[f]=c[v],Q[f]=l[v];for(;u>s;++s,++f)P[f]=T[s],Q[f]=V[s]+e;o=_(P),tn=o[0],en=o[1]}function o(r,n,t){rn.forEach(function(r){r(T,V,n,t)}),T=V=null}function a(r){for(var n,t=0,e=0;E>t;++t)z[n=Q[t]]&&(t!==e&&(P[e]=P[t]),Q[e]=r[n],++e);for(P.length=e;E>e;)Q[e++]=0;var u=_(P);tn=u[0],en=u[1]}function c(r){var n=r[0],t=r[1];if(W)return W=null,G(function(r,e){return e>=n&&t>e}),tn=n,en=t,X;var e,u,f,o=[],i=[];if(tn>n)for(e=n,u=Math.min(tn,t);u>e;++e)z[f=Q[e]]^=Y,o.push(f);else if(n>tn)for(e=tn,u=Math.min(n,en);u>e;++e)z[f=Q[e]]^=Y,i.push(f);if(t>en)for(e=Math.max(n,en),u=t;u>e;++e)z[f=Q[e]]^=Y,o.push(f);else if(en>t)for(e=Math.max(tn,t),u=en;u>e;++e)z[f=Q[e]]^=Y,i.push(f);return tn=n,en=t,N.forEach(function(r){r(Y,o,i)}),X}function l(r){return null==r?B():Array.isArray(r)?j(r):"function"==typeof r?D(r):C(r)}function C(r){return c((_=v(w,r))(P))}function j(r){return c((_=s(w,r))(P))}function B(){return c((_=h)(P))}function D(r){return _=h,G(W=r),tn=0,en=E,X}function G(r){var n,t,e,u=[],f=[];for(n=0;E>n;++n)!(z[t=Q[n]]&Y)^(e=r(P[n],n))&&(e?(z[t]&=Z,u.push(t)):(z[t]|=Y,f.push(t)));N.forEach(function(r){r(Y,u,f)})}function H(r){for(var n,t=[],e=en;--e>=tn&&r>0;)z[n=Q[e]]||(t.push(b[n]),--r);return t}function I(r){for(var n,t=[],e=tn;en>e&&r>0;)z[n=Q[e]]||(t.push(b[n]),--r),e++;return t}function J(r){function t(n,t,e,u){function f(){++T===L&&(m=R(m,K<<=1),B=R(B,K),L=O(K))}var l,v,s,h,p,g,y=j,m=A(T,L),x=H,k=J,w=T,M=0,U=0;for(X&&(x=k=d),j=Array(T),T=0,B=w>1?F(B,E):A(E,L),w&&(s=(v=y[0]).key);u>U&&!((h=r(n[U]))>=h);)++U;for(;u>U;){for(v&&h>=s?(p=v,g=s,m[M]=T,(v=y[++M])&&(s=v.key)):(p={key:h,value:k()},g=h),j[T]=p;!(h>g||(B[l=t[U]+e]=T,z[l]&Z||(p.value=x(p.value,b[l])),++U>=u));)h=r(n[U]);f()}for(;w>M;)j[m[M]=T]=y[M++],f();if(T>M)for(M=0;e>M;++M)B[M]=m[B[M]];l=N.indexOf(V),T>1?(V=o,W=a):(1===T?(V=i,W=c):(V=d,W=d),B=null),N[l]=V}function e(){if(T>1){for(var r=T,n=j,t=A(r,r),e=0,u=0;E>e;++e)z[e]&&(t[B[u]=B[e]]=1,++u);for(j=[],T=0,e=0;r>e;++e)t[e]&&(t[e]=T++,j.push(n[e]));if(T>1)for(var e=0;u>e;++e)B[e]=t[B[e]];else B=null;N[N.indexOf(V)]=T>1?(W=a,V=o):1===T?(W=c,V=i):W=V=d}else if(1===T){for(var e=0;E>e;++e)if(z[e])return;j=[],T=0,N[N.indexOf(V)]=V=W=d}}function o(r,n,t){if(r!==Y&&!X){var e,u,f,o;for(e=0,f=n.length;f>e;++e)z[u=n[e]]&Z||(o=j[B[u]],o.value=H(o.value,b[u]));for(e=0,f=t.length;f>e;++e)(z[u=t[e]]&Z)===r&&(o=j[B[u]],o.value=I(o.value,b[u]))}}function i(r,n,t){if(r!==Y&&!X){var e,u,f,o=j[0];for(e=0,f=n.length;f>e;++e)z[u=n[e]]&Z||(o.value=H(o.value,b[u]));for(e=0,f=t.length;f>e;++e)(z[u=t[e]]&Z)===r&&(o.value=I(o.value,b[u]))}}function a(){var r,n;for(r=0;T>r;++r)j[r].value=J();for(r=0;E>r;++r)z[r]&Z||(n=j[B[r]],n.value=H(n.value,b[r]))}function c(){var r,n=j[0];for(n.value=J(),r=0;E>r;++r)z[r]&Z||(n.value=H(n.value,b[r]))}function l(){return X&&(W(),X=!1),j}function v(r){var n=D(l(),0,j.length,r);return G.sort(n,0,n.length)}function s(r,n,t){return H=r,I=n,J=t,X=!0,S}function h(){return s(g,y,p)}function k(r){return s(m(r),x(r),p)}function w(r){function n(n){return r(n.value)}return D=f(n),G=u(n),S}function M(){return w(n)}function U(){return T}function C(){var r=N.indexOf(V);return r>=0&&N.splice(r,1),r=rn.indexOf(t),r>=0&&rn.splice(r,1),r=q.indexOf(e),r>=0&&q.splice(r,1),S}var S={top:v,all:l,reduce:s,reduceCount:h,reduceSum:k,order:w,orderNatural:M,size:U,dispose:C,remove:C};nn.push(S);var j,B,D,G,H,I,J,K=8,L=O(K),T=0,V=d,W=d,X=!0;return arguments.length<1&&(r=n),N.push(V),rn.push(t),q.push(e),t(P,Q,0,E),h().orderNatural()}function K(){var r=J(d),n=r.all;return delete r.all,delete r.top,delete r.order,delete r.orderNatural,delete r.size,r.value=function(){return n()[0].value},r}function L(){nn.forEach(function(r){r.dispose()});var r=S.indexOf(e);for(r>=0&&S.splice(r,1),r=S.indexOf(o),r>=0&&S.splice(r,1),r=q.indexOf(a),r>=0&&q.splice(r,1),r=0;E>r;++r)z[r]&=Z;return M&=Z,X}var P,Q,T,V,W,X={filter:l,filterExact:C,filterRange:j,filterFunction:D,filterAll:B,top:H,bottom:I,group:J,groupAll:K,dispose:L,remove:L},Y=~M&-~M,Z=~Y,$=i(function(r){return T[r]}),_=h,rn=[],nn=[],tn=0,en=0;return S.unshift(e),S.push(o),q.push(a),M|=Y,(U>=32?!Y:M&(1<<U)-1)&&(z=R(z,U<<=1)),e(b,0,E),o(b,0,E),X}function a(){function r(r,n){var t;if(!h)for(t=n;E>t;++t)z[t]||(a=c(a,b[t]))}function n(r,n,t){var e,u,f;if(!h){for(e=0,f=n.length;f>e;++e)z[u=n[e]]||(a=c(a,b[u]));for(e=0,f=t.length;f>e;++e)z[u=t[e]]===r&&(a=l(a,b[u]))}}function t(){var r;for(a=v(),r=0;E>r;++r)z[r]||(a=c(a,b[r]))}function e(r,n,t){return c=r,l=n,v=t,h=!0,s}function u(){return e(g,y,p)}function f(r){return e(m(r),x(r),p)}function o(){return h&&(t(),h=!1),a}function i(){var t=N.indexOf(n);return t>=0&&N.splice(t),t=S.indexOf(r),t>=0&&S.splice(t),s}var a,c,l,v,s={reduce:e,reduceCount:u,reduceSum:f,value:o,dispose:i,remove:i},h=!0;return N.push(n),S.push(r),r(b,0,E),u()}function c(){return E}var l={add:r,remove:e,dimension:o,groupAll:a,size:c},b=[],E=0,M=0,U=8,z=C(0),N=[],S=[],q=[];return arguments.length?r(arguments[0]):l}function A(r,n){return(257>n?C:65537>n?S:q)(r)}function k(r){for(var n=A(r,r),t=-1;++t<r;)n[t]=t;return n}function O(r){return 8===r?256:16===r?65536:4294967296}b.version="1.3.7",b.permute=t;var w=b.bisect=e(n);w.by=e;var E=b.heap=u(n);E.by=u;var M=b.heapselect=f(n);M.by=f;var U=b.insertionsort=o(n);U.by=o;var z=b.quicksort=i(n);z.by=i;var N=32,C=a,S=a,q=a,F=c,R=l;"undefined"!=typeof Uint8Array&&(C=function(r){return new Uint8Array(r)},S=function(r){return new Uint16Array(r)},q=function(r){return new Uint32Array(r)},F=function(r,n){if(r.length>=n)return r;var t=new r.constructor(n);return t.set(r),t},R=function(r,n){var t;switch(n){case 16:t=S(r.length);break;case 32:t=q(r.length);break;default:throw Error("invalid array width!")}return t.set(r),t}),r.crossfilter=b}("undefined"!=typeof exports&&exports||this);
\ No newline at end of file
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/editor.js
--- a/config/plugins/visualizations/charts/static/views/editor.js
+++ b/config/plugins/visualizations/charts/static/views/editor.js
@@ -4,18 +4,13 @@
'plugin/views/group', 'plugin/views/settings', 'plugin/views/types'],
function(Tabs, Ui, Portlet, Utils, Chart, Group, GroupView, SettingsView, TypesView) {
-// widget
-return Backbone.View.extend(
-{
- // defaults options
- optionsDefault: {
- header : true,
- content : 'No content available.'
- },
-
+/**
+ * The charts editor holds the tabs for selecting chart types, chart configuration
+ * and data group selections.
+ */
+return Backbone.View.extend({
// initialize
- initialize: function(app, options)
- {
+ initialize: function(app, options){
// link this
var self = this;
@@ -25,9 +20,6 @@
// get current chart object
this.chart = this.app.chart;
- // configure options
- this.options = Utils.merge(options, this.optionsDefault);
-
// message element
this.message = new Ui.Message();
@@ -49,7 +41,7 @@
tooltip : 'Return to Viewer',
title : 'Cancel',
onclick : function() {
- // show viewport
+ // show viewer/viewport
self.app.go('viewer');
// reset chart
@@ -200,7 +192,7 @@
this.title.value(title);
},
- // update
+ // refresh group
_refreshGroupKey: function() {
var self = this;
var counter = 0;
@@ -213,7 +205,7 @@
});
},
- // new group
+ // add group model
_addGroupModel: function() {
var group = new Group({
id : Utils.uuid()
@@ -222,7 +214,7 @@
return group;
},
- // add group
+ // add group tab
_addGroup: function(group) {
// link this
var self = this;
@@ -319,7 +311,7 @@
// wait until chart is ready
var self = this;
- this.chart.deferred.execute(function() {
+ this.app.deferred.execute(function() {
// save
self.app.storage.save();
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/group.js
--- a/config/plugins/visualizations/charts/static/views/group.js
+++ b/config/plugins/visualizations/charts/static/views/group.js
@@ -2,9 +2,10 @@
define(['plugin/library/ui-table', 'plugin/library/ui', 'utils/utils'],
function(Table, Ui, Utils) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * This class renders the data group selection fields.
+ */
+return Backbone.View.extend({
// initialize
initialize: function(app, options) {
// link app
@@ -59,7 +60,7 @@
this._refreshGroup();
},
- // update dataset
+ // update group selection table
_refreshTable: function() {
// identify datasets
var dataset_id = this.chart.get('dataset_id');
@@ -116,7 +117,7 @@
this.chart.state('wait', 'Loading metadata...');
// register process
- var process_id = this.chart.deferred.register();
+ var process_id = this.app.deferred.register();
// request dictionary
var request_dictionary = {
@@ -131,7 +132,7 @@
self.chart.state('ok', 'Metadata initialized...');
// unregister
- self.chart.deferred.done(process_id);
+ self.app.deferred.done(process_id);
}
};
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/settings.js
--- a/config/plugins/visualizations/charts/static/views/settings.js
+++ b/config/plugins/visualizations/charts/static/views/settings.js
@@ -2,9 +2,10 @@
define(['plugin/library/ui', 'plugin/library/ui-table-form', 'utils/utils'],
function(Ui, TableForm, Utils) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * This class renders the chart configuration form.
+ */
+return Backbone.View.extend({
// initialize
initialize: function(app, options) {
// link app
@@ -18,6 +19,7 @@
// create settings
this.form = new TableForm.View(app, {
+ title : 'Configuration',
content : 'This chart type does not provide any options.'
});
@@ -36,7 +38,7 @@
// get settings
var chart_definition = this.chart.definition;
- // check if dataset is available
+ // check if chart definition is available
if (!chart_definition) {
return;
}
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/types.js
--- a/config/plugins/visualizations/charts/static/views/types.js
+++ b/config/plugins/visualizations/charts/static/views/types.js
@@ -1,7 +1,10 @@
+// dependencies
define(['utils/utils', 'plugin/library/ui'], function(Utils, Ui) {
-return Backbone.View.extend(
-{
+/**
+ * This class renders the chart type selection grid.
+ */
+return Backbone.View.extend({
// defaults options
optionsDefault: {
onchange : null,
@@ -16,7 +19,6 @@
// initialize
initialize : function(app, options) {
-
// link this
var self = this;
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/viewer.js
--- a/config/plugins/visualizations/charts/static/views/viewer.js
+++ b/config/plugins/visualizations/charts/static/views/viewer.js
@@ -1,14 +1,14 @@
// dependencies
define(['utils/utils', 'plugin/library/ui', 'mvc/ui/ui-portlet',
- 'plugin/models/group', 'plugin/views/viewport', 'plugin/library/screenshot'],
- function(Utils, Ui, Portlet, Group, ViewportView, Screenshot) {
+ 'plugin/views/viewport', 'plugin/library/screenshot'],
+ function(Utils, Ui, Portlet, ViewportView, Screenshot) {
-// widget
-return Backbone.View.extend(
-{
+/**
+ * This class renders the chart viewer which encapsulates the chart viewport.
+ */
+return Backbone.View.extend({
// initialize
- initialize: function(app, options)
- {
+ initialize: function(app, options){
// link app
this.app = app;
@@ -152,7 +152,7 @@
// wait for chart to be ready
_wait: function(chart, callback) {
// get chart
- if (chart.deferred.ready()) {
+ if (this.app.deferred.ready()) {
callback();
} else {
this.message.update({message: 'Your chart is currently being processed. Please wait and try again.'});
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/static/views/viewport.js
--- a/config/plugins/visualizations/charts/static/views/viewport.js
+++ b/config/plugins/visualizations/charts/static/views/viewport.js
@@ -2,7 +2,11 @@
define(['mvc/ui/ui-portlet', 'plugin/library/ui', 'utils/utils'],
function(Portlet, Ui, Utils) {
-// widget
+/**
+ * The viewport creates and manages the dom elements used by the visualization plugins to draw the chart.
+ * Additionally, this class creates default request strings and request dictionaries parsed to the visualization plugins.
+ * This is the last class of the charts core classes before handing control over to the visualization plugins.
+ */
return Backbone.View.extend({
// list of canvas elements
@@ -26,7 +30,7 @@
// use full screen for viewer
this._fullscreen(this.$el, 100);
- // create canvas element
+ // create container element
this._createContainer('div');
// events
@@ -126,7 +130,7 @@
var self = this;
// register process
- var process_id = chart.deferred.register();
+ var process_id = this.app.deferred.register();
// identify chart type
var chart_type = chart.get('type');
@@ -171,7 +175,7 @@
});
},
function() {
- chart.deferred.done(process_id);
+ this.app.deferred.done(process_id);
}
);
} else {
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 config/plugins/visualizations/charts/templates/charts.mako
--- a/config/plugins/visualizations/charts/templates/charts.mako
+++ b/config/plugins/visualizations/charts/templates/charts.mako
@@ -21,6 +21,9 @@
## shared css
${h.css( 'base' )}
+ ## crossfilter
+ ${h.javascript_link( app_root + "plugins/crossfilter/crossfilter.js" )}
+
## canvg
${h.javascript_link( app_root + "plugins/canvg/rgbcolor.js" )}
${h.javascript_link( app_root + "plugins/canvg/canvg.js" )}
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample
+++ b/datatypes_conf.xml.sample
@@ -177,6 +177,7 @@
<datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/><datatype extension="tabular" type="galaxy.datatypes.tabular:Tabular" display_in_upload="true" description="Any data in tab delimited format (tabular)." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Tabular_.28tab_delimited.29"/><datatype extension="twobit" type="galaxy.datatypes.binary:TwoBit" mimetype="application/octet-stream" display_in_upload="true"/>
+ <datatype extension="sqlite" type="galaxy.datatypes.binary:SQlite" mimetype="application/octet-stream" display_in_upload="true"/><datatype extension="txt" type="galaxy.datatypes.data:Text" display_in_upload="true" description="Any text file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Plain_text"/><datatype extension="linecount" type="galaxy.datatypes.data:LineCount" display_in_upload="false"/><datatype extension="memexml" type="galaxy.datatypes.xml:MEMEXml" mimetype="application/xml" display_in_upload="true"/>
@@ -262,6 +263,7 @@
--><sniffer type="galaxy.datatypes.tabular:Vcf"/><sniffer type="galaxy.datatypes.binary:TwoBit"/>
+ <sniffer type="galaxy.datatypes.binary:SQlite"/><sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/><sniffer type="galaxy.datatypes.xml:Phyloxml"/>
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/bam.xml
--- a/display_applications/igb/bam.xml
+++ b/display_applications/igb/bam.xml
@@ -7,8 +7,8 @@
#set nm=$bam_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="bai_file" url="${niceName}.bam.bai" metadata="bam_index" strip_https="True" />
- <param type="data" name="bam_file" url="${niceName}.bam" strip_https="True" />
+ <param type="data" name="bai_file" url="${niceName}.bam.bai" metadata="bam_index" />
+ <param type="data" name="bam_file" url="${niceName}.bam" /></link></display>
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/bb.xml
--- a/display_applications/igb/bb.xml
+++ b/display_applications/igb/bb.xml
@@ -8,7 +8,7 @@
#set nm=$bigbed_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="bigbed_file" url="${niceName}.bigbed" strip_https="True" />
+ <param type="data" name="bigbed_file" url="${niceName}.bigbed" /></link></display>
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/bed.xml
--- a/display_applications/igb/bed.xml
+++ b/display_applications/igb/bed.xml
@@ -8,7 +8,7 @@
#set nm=$bed_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="bed_file" url="${niceName}.bed" strip_https="True" />
+ <param type="data" name="bed_file" url="${niceName}.bed" /><param type="template" name="bioviz" strip="True" >
http://bioviz.org/igb/galaxy.html?version=${bed_file.dbkey}&loadresidue…
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/bedgraph.xml
--- a/display_applications/igb/bedgraph.xml
+++ b/display_applications/igb/bedgraph.xml
@@ -8,7 +8,7 @@
#set nm=$bedgraph_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="bedgraph_file" url="${niceName}.bed.bedgraph" strip_https="True" />
+ <param type="data" name="bedgraph_file" url="${niceName}.bed.bedgraph" /><param type="template" name="bioviz" strip="True" >
http://bioviz.org/igb/galaxy.html?version=${bedgraph_file.dbkey}&loadre…
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/bigwig.xml
--- a/display_applications/igb/bigwig.xml
+++ b/display_applications/igb/bigwig.xml
@@ -8,7 +8,7 @@
#set nm=$bigwig_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="bigwig_file" url="${niceName}.bigwig" strip_https="True" />
+ <param type="data" name="bigwig_file" url="${niceName}.bigwig" /><!--<param type="template" name="position" strip="True" >
#set chrom, start, end = $bigwig_file.datatype.get_estimated_display_viewport( $bigwig_file )
#if $chrom is not None:
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/gtf.xml
--- a/display_applications/igb/gtf.xml
+++ b/display_applications/igb/gtf.xml
@@ -8,7 +8,7 @@
#set nm=$gtf_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="gtf_file" url="${niceName}.gtf" strip_https="True" />
+ <param type="data" name="gtf_file" url="${niceName}.gtf" /><param type="template" name="bioviz" strip="True" >
http://bioviz.org/igb/galaxy.html?version=${gtf_file.dbkey}&loadresidue…
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 display_applications/igb/wig.xml
--- a/display_applications/igb/wig.xml
+++ b/display_applications/igb/wig.xml
@@ -8,7 +8,7 @@
#set nm=$wig_file_for_name.name
${re.sub('\W',"_",nm)}
</param>
- <param type="data" name="wig_file" url="${niceName}.wig" strip_https="True" />
+ <param type="data" name="wig_file" url="${niceName}.wig" /><param type="template" name="position" strip="True" >
#set chrom, start, end = $wig_file.datatype.get_estimated_display_viewport( $wig_file )
#if $chrom is not None:
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 eggs.ini
--- a/eggs.ini
+++ b/eggs.ini
@@ -26,25 +26,24 @@
pysqlite = 2.5.6
python_lzo = 1.08_2.03_static
PyYAML = 3.10
-threadframe = 0.2
guppy = 0.1.10
SQLAlchemy = 0.7.9
; msgpack_python = 0.2.4
[eggs:noplatform]
-amqp = 1.4.3
+amqp = 1.4.5
anyjson = 0.3.3
Beaker = 1.4
bioblend = 0.4.2
boto = 2.27.0
decorator = 3.1.2
docutils = 0.7
-drmaa = 0.6
+drmaa = 0.7.6
elementtree = 1.2.6_20050316
Fabric = 1.7.0
GeneTrack = 2.0.0_beta_1
importlib = 1.0.3
-kombu = 3.0.12
+kombu = 3.0.13
lrucache = 0.2
Mako = 0.4.1
mock = 1.0.1
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 job_conf.xml.sample_advanced
--- a/job_conf.xml.sample_advanced
+++ b/job_conf.xml.sample_advanced
@@ -19,27 +19,30 @@
<!-- Override the $DRMAA_LIBRARY_PATH environment variable --><param id="drmaa_library_path">/sge/lib/libdrmaa.so</param></plugin>
- <plugin id="lwr" type="runner" load="galaxy.jobs.runners.lwr:LwrJobRunner">
- <!-- More information on LWR can be found at https://lwr.readthedocs.org -->
- <!-- Uncomment following line to use libcurl to perform HTTP calls (defaults to urllib) -->
+ <plugin id="cli" type="runner" load="galaxy.jobs.runners.cli:ShellJobRunner" />
+ <plugin id="condor" type="runner" load="galaxy.jobs.runners.condor:CondorJobRunner" />
+ <plugin id="slurm" type="runner" load="galaxy.jobs.runners.slurm:SlurmJobRunner" />
+ <!-- Pulsar runners (see more at https://pulsar.readthedocs.org) -->
+ <plugin id="pulsar_rest" type="runner" load="galaxy.jobs.runners.pulsar:PulsarRESTJobRunner">
+ <!-- Allow optimized HTTP calls with libcurl (defaults to urllib) --><!-- <param id="transport">curl</param> -->
- <!-- *Experimental Caching*: Uncomment next parameters to enable
- caching and specify the number of caching threads to enable on Galaxy
- side. Likely will not work with newer features such as MQ support.
- If this is enabled be sure to specify a `file_cache_dir` in the remote
- LWR's main configuration file.
+
+ <!-- *Experimental Caching*: Next parameter enables caching.
+ Likely will not work with newer features such as MQ support.
+
+ If this is enabled be sure to specify a `file_cache_dir` in
+ the remote Pulsar's servers main configuration file.
--><!-- <param id="cache">True</param> -->
- <!-- <param id="transfer_threads">2</param> --></plugin>
- <plugin id="amqp_lwr" type="runner" load="galaxy.jobs.runners.lwr:LwrJobRunner">
- <param id="url">amqp://guest:guest@localhost:5672//</param>
- <!-- If using message queue driven LWR - the LWR will generally
- initiate file transfers so a the URL of this Galaxy instance
- must be configured. -->
- <param id="galaxy_url">http://localhost:8080/</param>
- <!-- If multiple managers configured on the LWR, specify which one
- this plugin targets. -->
+ <plugin id="pulsar_mq" type="runner" load="galaxy.jobs.runners.pulsar:PulsarMQJobRunner">
+ <!-- AMQP URL to connect to. -->
+ <param id="amqp_url">amqp://guest:guest@localhost:5672//</param>
+ <!-- URL remote Pulsar apps should transfer files to this Galaxy
+ instance to/from. -->
+ <param id="galaxy_url">http://localhost:8080</param>
+ <!-- Pulsar job manager to communicate with (see Pulsar
+ docs for information on job managers). --><!-- <param id="manager">_default_</param> --><!-- The AMQP client can provide an SSL client certificate (e.g. for
validation), the following options configure that certificate
@@ -58,9 +61,17 @@
higher value (in seconds) (or `None` to use blocking connections). --><!-- <param id="amqp_consumer_timeout">None</param> --></plugin>
- <plugin id="cli" type="runner" load="galaxy.jobs.runners.cli:ShellJobRunner" />
- <plugin id="condor" type="runner" load="galaxy.jobs.runners.condor:CondorJobRunner" />
- <plugin id="slurm" type="runner" load="galaxy.jobs.runners.slurm:SlurmJobRunner" />
+ <plugin id="pulsar_legacy" type="runner" load="galaxy.jobs.runners.pulsar:PulsarLegacyJobRunner">
+ <!-- Pulsar job runner with default parameters matching those
+ of old LWR job runner. If your Pulsar server is running on a
+ Windows machine for instance this runner should still be used.
+
+ These destinations still needs to target a Pulsar server,
+ older LWR plugins and destinations still work in Galaxy can
+ target LWR servers, but this support should be considered
+ deprecated and will disappear with a future release of Galaxy.
+ -->
+ </plugin></plugins><handlers default="handlers"><!-- Additional job handlers - the id should match the name of a
@@ -91,12 +102,107 @@
<!-- Warning: Local slot count doesn't tie up additional worker threads, to prevent over
allocating machine define a second local runner with different name and fewer workers
to run this destination. -->
+ <param id="embed_metadata_in_job">True</param>
+ <!-- Above parameter will be default (with no option to set
+ to False) in an upcoming release of Galaxy, but you can
+ try it early - it will slightly speed up local jobs by
+ embedding metadata calculation in job script itself.
+ --><job_metrics /><!-- Above element demonstrates embedded job metrics definition - see
job_metrics_conf.xml.sample for full documentation on possible nested
elements. This empty block will simply disable job metrics for the
corresponding destination. --></destination>
+ <destination id="docker_local" runner="local">
+ <param id="docker_enabled">true</param>
+ <!-- docker_volumes can be used to configure volumes to expose to docker,
+ For added isolation append :ro to the path to mount it read only.
+ Galaxy will attempt to infer a reasonable set of defaults which
+ volumes should be exposed how based on Galaxy's settings and the
+ destination - but be sure to add any library paths or data incides
+ that may be needed read-only.
+ -->
+ <!--
+ <param id="docker_volumes">$defaults,/mnt/galaxyData/libraries:ro,/mnt/galaxyData/indices:ro</param>
+ -->
+ <!-- For a stock Galaxy instance and traditional job runner $defaults will
+ expand out as:
+
+ $galaxy_root:ro,$tool_directory:ro,$working_directory:rw,$default_file_path:rw
+
+ This assumes most of what is needed is available under Galaxy's root directory,
+ the tool directory, and the Galaxy's file_path (if using object store creatively
+ you will definitely need to expand defaults).
+
+ This configuration allows any docker instance to write to any Galaxy
+ file - for greater isolation set outputs_to_working_directory in
+ universe_wsgi.ini. This will cause $defaults to allow writing to much
+ less. It will then expand as follows:
+
+ $galaxy_root:ro,$tool_directory:ro,$working_directory:rw,$default_file_path:ro
+
+ If using the Pulsar, defaults will be even further restricted because the
+ Pulsar will (by default) stage all needed inputs into the job's job_directory
+ (so there is not need to allow the docker container to read all the
+ files - let alone write over them). Defaults in this case becomes:
+
+ $job_directory:ro,$tool_directory:ro,$job_directory/outputs:rw,$working_directory:rw
+
+ Python string.Template is used to expand volumes and values $defaults,
+ $galaxy_root, $default_file_path, $tool_directory, $working_directory,
+ are available to all jobs and $job_directory is also available for
+ Pulsar jobs.
+ -->
+ <!-- One can run docker using volumes-from tag by setting the following
+ parameter. For more information on volumes-from check out the following
+ docker tutorial. https://docs.docker.com/userguide/dockervolumes/
+ -->
+ <!-- <param id="docker_volumes_from">parent_container_name</param> -->
+ <!-- Control memory allocatable by docker container with following option:
+ -->
+ <!-- <param id="docker_memory">24G</param> -->
+ <!-- By default Docker will need to runnable by Galaxy using
+ password-less sudo - this can be configured by adding the
+ following line to the sudoers file of all compute nodes
+ with docker enabled:
+
+ galaxy ALL = (root) NOPASSWD: SETENV: /usr/bin/docker
+
+ The follow option is set to false to disable sudo (docker
+ must likewise be configured to allow this).
+ -->
+ <!-- <param id="docker_sudo">false</param> -->
+ <!-- Following option can be used to tweak sudo command used by
+ default. -->
+ <!-- <param id="docker_sudo_cmd">/usr/bin/sudo -extra_param</param> -->
+ <!-- By default, docker container will not have any networking
+ enabled. host networking can be bridged by uncommenting next option
+ http://docs.docker.io/reference/run/#network-settings
+ -->
+ <!-- <param id="docker_net">bridge</param> -->
+ <!-- Following command can be used to tweak docker command. -->
+ <!-- <param id="docker_cmd">/usr/local/custom_docker/docker</param> -->
+ <!-- Following can be used to connect to docke server in different
+ ways (translated as -H argument to docker client). -->
+ <!-- <param id="docker_host">unix:///var/run/docker.sock</param> -->
+ <!-- <param id="docker_host">:5555</param> -->
+ <!-- <param id="docker_host">:5555</param> -->
+ <!-- <param id="docker_host">tcp://127.0.0.1:4243</param> -->
+
+ <!-- If deployer wants to use docker for isolation, but does not
+ trust tool's specified container - a destination wide override
+ can be set. This will cause all jobs on this destination to use
+ that docker image. -->
+ <!-- <param id="docker_container_id_override">busybox:ubuntu-14.04</param> -->
+
+ <!-- Likewise, if deployer wants to use docker for isolation and
+ does trust tool's specified container - but also wants tool's not
+ configured to run in a container the following option can provide
+ a fallback. -->
+ <!-- <param id="docker_default_container_id">busybox:ubuntu-14.04</param> -->
+
+ </destination><destination id="pbs" runner="pbs" tags="mycluster"/><destination id="pbs_longjobs" runner="pbs" tags="mycluster,longjobs"><!-- Define parameters that are native to the job runner plugin. -->
@@ -129,87 +235,71 @@
<!-- A destination that represents a method in the dynamic runner. --><param id="function">foo</param></destination>
- <destination id="secure_lwr" runner="lwr">
- <param id="url">https://windowshost.examle.com:8913/</param>
- <!-- If set, private_token must match token remote LWR server configured with. -->
+ <destination id="secure_pulsar_rest_dest" runner="pulsar_rest">
+ <param id="url">https://examle.com:8913/</param>
+ <!-- If set, private_token must match token in remote Pulsar's
+ configuration. --><param id="private_token">123456789changeme</param><!-- Uncomment the following statement to disable file staging (e.g.
- if there is a shared file system between Galaxy and the LWR
+ if there is a shared file system between Galaxy and the Pulsar
server). Alternatively action can be set to 'copy' - to replace
http transfers with file system copies, 'remote_transfer' to cause
- the lwr to initiate HTTP transfers instead of Galaxy, or
- 'remote_copy' to cause lwr to initiate file system copies.
+ the Pulsar to initiate HTTP transfers instead of Galaxy, or
+ 'remote_copy' to cause Pulsar to initiate file system copies.
If setting this to 'remote_transfer' be sure to specify a
'galaxy_url' attribute on the runner plugin above. --><!-- <param id="default_file_action">none</param> --><!-- The above option is just the default, the transfer behavior
none|copy|http can be configured on a per path basis via the
- following file. See lib/galaxy/jobs/runners/lwr_client/action_mapper.py
- for examples of how to configure this file. This is very beta
- and nature of file will likely change.
+ following file. See Pulsar documentation for more details and
+ examples.
-->
- <!-- <param id="file_action_config">file_actions.json</param> -->
- <!-- Uncomment following option to disable Galaxy tool dependency
- resolution and utilize remote LWR's configuraiton of tool
- dependency resolution instead (same options as Galaxy for
- dependency resolution are available in LWR). At a minimum
- the remote LWR server should define a tool_dependencies_dir in
- its `server.ini` configuration. The LWR will not attempt to
- stage dependencies - so ensure the the required galaxy or tool
- shed packages are available remotely (exact same tool shed
- installed changesets are required).
+ <!-- <param id="file_action_config">file_actions.yaml</param> -->
+ <!-- The non-legacy Pulsar runners will attempt to resolve Galaxy
+ dependencies remotely - to enable this set a tool_dependency_dir
+ in Pulsar's configuration (can work with all the same dependency
+ resolutions mechanisms as Galaxy - tool Shed installs, Galaxy
+ packages, etc...). To disable this behavior, set the follow parameter
+ to none. To generate the dependency resolution command locally
+ set the following parameter local.
-->
- <!-- <param id="dependency_resolution">remote</params> -->
- <!-- Traditionally, the LWR allow Galaxy to generate a command line
- as if it were going to run the command locally and then the
- LWR client rewrites it after the fact using regular
- expressions. Setting the following value to true causes the
- LWR runner to insert itself into the command line generation
- process and generate the correct command line from the get go.
- This will likely be the default someday - but requires a newer
- LWR version and is less well tested. -->
- <!-- <param id="rewrite_parameters">true</params> -->
+ <!-- <param id="dependency_resolution">none</params> --><!-- Uncomment following option to enable setting metadata on remote
- LWR server. The 'use_remote_datatypes' option is available for
+ Pulsar server. The 'use_remote_datatypes' option is available for
determining whether to use remotely configured datatypes or local
ones (both alternatives are a little brittle). --><!-- <param id="remote_metadata">true</param> --><!-- <param id="use_remote_datatypes">false</param> --><!-- <param id="remote_property_galaxy_home">/path/to/remote/galaxy-central</param> -->
- <!-- If remote LWR server is configured to run jobs as the real user,
+ <!-- If remote Pulsar server is configured to run jobs as the real user,
uncomment the following line to pass the current Galaxy user
along. --><!-- <param id="submit_user">$__user_name__</param> -->
- <!-- Various other submission parameters can be passed along to the LWR
- whose use will depend on the remote LWR's configured job manager.
+ <!-- Various other submission parameters can be passed along to the Pulsar
+ whose use will depend on the remote Pulsar's configured job manager.
For instance:
-->
- <!-- <param id="submit_native_specification">-P bignodes -R y -pe threads 8</param> -->
+ <!-- <param id="submit_native_specification">-P bignodes -R y -pe threads 8</param> -->
+ <!-- Disable parameter rewriting and rewrite generated commands
+ instead. This may be required if remote host is Windows machine
+ but probably not otherwise.
+ -->
+ <!-- <param id="rewrite_parameters">false</params> --></destination>
- <destination id="amqp_lwr_dest" runner="amqp_lwr" >
- <!-- url and private_token are not valid when using MQ driven LWR. The plugin above
- determines which queue/manager to target and the underlying MQ server should be
- used to configure security.
- -->
- <!-- Traditionally, the LWR client sends request to LWR
- server to populate various system properties. This
+ <destination id="pulsar_mq_dest" runner="amqp_pulsar" >
+ <!-- The RESTful Pulsar client sends a request to Pulsar
+ to populate various system properties. This
extra step can be disabled and these calculated here
on client by uncommenting jobs_directory and
specifying any additional remote_property_ of
interest, this is not optional when using message
queues.
-->
- <param id="jobs_directory">/path/to/remote/lwr/lwr_staging/</param>
- <!-- Default the LWR send files to and pull files from Galaxy when
- using message queues (in the more traditional mode Galaxy sends
- files to and pull files from the LWR - this is obviously less
- appropriate when using a message queue).
-
- The default_file_action currently requires pycurl be available
- to Galaxy (presumably in its virtualenv). Making this dependency
- optional is an open task.
+ <param id="jobs_directory">/path/to/remote/pulsar/files/staging/</param>
+ <!-- Otherwise MQ and Legacy pulsar destinations can be supplied
+ all the same destination parameters as the RESTful client documented
+ above (though url and private_token are ignored when using a MQ).
-->
- <param id="default_file_action">remote_transfer</param></destination><destination id="ssh_torque" runner="cli"><param id="shell_plugin">SecureShell</param>
@@ -239,7 +329,40 @@
--><param id="request_cpus">8</param></destination>
+
+ <!-- Jobs that hit the walltime on one destination can be automatically
+ resubmitted to another destination. Walltime detection is
+ currently only implemented in the slurm runner.
+
+ Multiple resubmit tags can be defined, the first resubmit matching
+ the terminal condition of a job will be used.
+
+ The 'condition' attribute is optional, if not present, the
+ resubmit destination will be used for all conditions. Currently,
+ only the "walltime_reached" condition is implemented.
+
+ The 'handler' tag is optional, if not present, the job's original
+ handler will be reused for the resubmitted job.
+ -->
+ <destination id="short_fast" runner="slurm">
+ <param id="nativeSpecification">--time=00:05:00 --nodes=1</param>
+ <resubmit condition="walltime_reached" destination="long_slow" handler="sge_handler" />
+ </destination>
+ <destination id="long_slow" runner="sge">
+ <!-- The destination that you resubmit jobs to can be any runner type -->
+ <param id="nativeSpecification">-l h_rt=96:00:00</param>
+ </destination>
+
</destinations>
+ <resources default="default">
+ <!-- Group different parameters defined in job_resource_params_conf.xml
+ together and assign these groups ids. Tool section below can map
+ tools to different groups. This is experimental functionality!
+ -->
+ <group id="default"></group>
+ <group id="memoryonly">memory</group>
+ <group id="all">processors,memory,time,project</group>
+ </resources><tools><!-- Tools can be configured to use specific destinations or handlers,
identified by either the "id" or "tags" attribute. If assigned to
@@ -250,15 +373,57 @@
<param id="source">trackster</param></tool><tool id="bar" destination="dynamic"/>
+ <!-- Next example defines resource group to insert into tool interface
+ and pass to dynamic destination (as resource_params argument). -->
+ <tool id="longbar" destination="dynamic" resources="all" /><tool id="baz" handler="special_handlers" destination="bigmem"/></tools><limits>
- <!-- Certain limits can be defined. -->
+ <!-- Certain limits can be defined. The 'concurrent_jobs' limits all
+ control the number of jobs that can be "active" at a time, that
+ is, dispatched to a runner and in the 'queued' or 'running'
+ states.
+
+ A race condition exists that will allow destination_* concurrency
+ limits to be surpassed when multiple handlers are allowed to
+ handle jobs for the same destination. To prevent this, assign all
+ jobs for a specific destination to a single handler.
+ -->
+ <!-- registered_user_concurrent_jobs:
+ Limit on the number of jobs a user with a registered Galaxy
+ account can have active across all destinations.
+ --><limit type="registered_user_concurrent_jobs">2</limit>
+ <!-- anonymous_user_concurrent_jobs:
+ Likewise, but for unregistered/anonymous users.
+ --><limit type="anonymous_user_concurrent_jobs">1</limit>
+ <!-- destination_user_concurrent_jobs:
+ The number of jobs a user can have active in the specified
+ destination, or across all destinations identified by the
+ specified tag. (formerly: concurrent_jobs)
+ -->
+ <limit type="destination_user_concurrent_jobs" id="local">1</limit>
+ <limit type="destination_user_concurrent_jobs" tag="mycluster">2</limit>
+ <limit type="destination_user_concurrent_jobs" tag="longjobs">1</limit>
+ <!-- destination_total_concurrent_jobs:
+ The number of jobs that can be active in the specified
+ destination (or across all destinations identified by the
+ specified tag) by any/all users.
+ -->
+ <limit type="destination_total_concurrent_jobs" id="local">16</limit>
+ <limit type="destination_total_concurrent_jobs" tag="longjobs">100</limit>
+ <!-- walltime:
+ Amount of time a job can run (in any destination) before it
+ will be terminated by Galaxy.
+ --><limit type="walltime">24:00:00</limit>
- <limit type="concurrent_jobs" id="local">1</limit>
- <limit type="concurrent_jobs" tag="mycluster">2</limit>
- <limit type="concurrent_jobs" tag="longjobs">1</limit>
+ <!-- output_size:
+ Size that any defined tool output can grow to before the job
+ will be terminated. This does not include temporary files
+ created by the job. Format is flexible, e.g.:
+ '10GB' = '10g' = '10240 Mb' = '10737418240'
+ -->
+ <limit type="output_size">10GB</limit></limits></job_conf>
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 job_resource_params_conf.xml.sample
--- /dev/null
+++ b/job_resource_params_conf.xml.sample
@@ -0,0 +1,6 @@
+<parameters>
+ <param label="Processors" name="processors" type="integer" size="2" min="1" max="64" value="" help="Number of processing cores, 'ppn' value (1-64). Leave blank to use default value." />
+ <param label="Memory" name="memory" type="integer" size="3" min="1" max="256" value="" help="Memory size in gigabytes, 'pmem' value (1-256). Leave blank to use default value." />
+ <param label="Time" name="time" type="integer" size="3" min="1" max="744" value="" help="Maximum job time in hours, 'walltime' value (1-744). Leave blank to use default value." />
+ <param label="Project" name="project" type="text" value="" help="Project to assign resource allocation to. Leave blank to use default value." />
+</parameters>
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/app.py
--- a/lib/galaxy/app.py
+++ b/lib/galaxy/app.py
@@ -12,13 +12,13 @@
from galaxy.visualization.data_providers.registry import DataProviderRegistry
from galaxy.visualization.registry import VisualizationsRegistry
from galaxy.tools.imp_exp import load_history_imp_exp_tools
-from galaxy.tools.genome_index import load_genome_index_tools
from galaxy.sample_tracking import external_service_types
from galaxy.openid.providers import OpenIDProviders
from galaxy.tools.data_manager.manager import DataManagers
from galaxy.jobs import metrics as job_metrics
from galaxy.web.base import pluginframework
from galaxy.queue_worker import GalaxyQueueWorker
+from tool_shed.galaxy_install import update_repository_manager
import logging
log = logging.getLogger( __name__ )
@@ -80,12 +80,8 @@
# Load Data Manager
self.data_managers = DataManagers( self )
- # If enabled, poll respective tool sheds to see if updates are available for any installed tool shed repositories.
- if self.config.get_bool( 'enable_tool_shed_check', False ):
- from tool_shed.galaxy_install import update_manager
- self.update_manager = update_manager.UpdateManager( self )
- else:
- self.update_manager = None
+ # Load the update repository manager.
+ self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self )
# Load proprietary datatype converters and display applications.
self.installed_repository_manager.load_proprietary_converters_and_display_applications()
# Load datatype display applications defined in local datatypes_conf.xml
@@ -96,8 +92,6 @@
self.datatypes_registry.load_external_metadata_tool( self.toolbox )
# Load history import/export tools.
load_history_imp_exp_tools( self.toolbox )
- # Load genome indexer tool.
- load_genome_index_tools( self.toolbox )
# visualizations registry: associates resources with visualizations, controls how to render
self.visualizations_registry = None
if self.config.visualization_plugins_directory:
@@ -159,8 +153,7 @@
self.object_store.shutdown()
if self.heartbeat:
self.heartbeat.shutdown()
- if self.update_manager:
- self.update_manager.shutdown()
+ self.update_repository_manager.shutdown()
if self.control_worker:
self.control_worker.shutdown()
try:
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -15,13 +15,12 @@
from galaxy.web.formatting import expand_pretty_datetime_format
from galaxy.util import string_as_bool
from galaxy.util import listify
-from galaxy.util import parse_xml
from galaxy.util.dbkeys import GenomeBuilds
from galaxy import eggs
-import pkg_resources
log = logging.getLogger( __name__ )
+
def resolve_path( path, root ):
"""If 'path' is relative make absolute by prepending 'root'"""
if not( os.path.isabs( path ) ):
@@ -40,9 +39,9 @@
self.config_dict = kwargs
self.root = kwargs.get( 'root_dir', '.' )
# Collect the umask and primary gid from the environment
- self.umask = os.umask( 077 ) # get the current umask
- os.umask( self.umask ) # can't get w/o set, so set it back
- self.gid = os.getgid() # if running under newgrp(1) we'll need to fix the group of data created on the cluster
+ self.umask = os.umask( 077 ) # get the current umask
+ os.umask( self.umask ) # can't get w/o set, so set it back
+ self.gid = os.getgid() # if running under newgrp(1) we'll need to fix the group of data created on the cluster
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root )
@@ -65,8 +64,6 @@
tempfile.tempdir = self.new_file_path
self.openid_consumer_cache_path = resolve_path( kwargs.get( "openid_consumer_cache_path", "database/openid_consumer_cache" ), self.root )
self.cookie_path = kwargs.get( "cookie_path", "/" )
- self.genome_data_path = kwargs.get( "genome_data_path", "tool-data/genome" )
- self.rsync_url = kwargs.get( "rsync_url", "rsync://datacache.galaxyproject.org/indexes" )
# Galaxy OpenID settings
self.enable_openid = string_as_bool( kwargs.get( 'enable_openid', False ) )
self.openid_config = kwargs.get( 'openid_config_file', 'openid_conf.xml' )
@@ -75,7 +72,7 @@
self.enable_unique_workflow_defaults = string_as_bool( kwargs.get( 'enable_unique_workflow_defaults', False ) )
self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root )
self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "tool-data" ), os.getcwd() )
- self.len_file_path = resolve_path( kwargs.get( "len_file_path", os.path.join( self.tool_data_path, 'shared','ucsc','chrom') ), self.root )
+ self.len_file_path = resolve_path( kwargs.get( "len_file_path", os.path.join( self.tool_data_path, 'shared', 'ucsc', 'chrom') ), self.root )
self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root )
# The value of migrated_tools_config is the file reserved for containing only those tools that have been eliminated from the distribution
# and moved to the tool shed.
@@ -105,7 +102,6 @@
self.shed_tool_data_path = self.tool_data_path
self.tool_data_table_config_path = [ resolve_path( x, self.root ) for x in kwargs.get( 'tool_data_table_config_path', 'tool_data_table_conf.xml' ).split( ',' ) ]
self.shed_tool_data_table_config = resolve_path( kwargs.get( 'shed_tool_data_table_config', 'shed_tool_data_table_conf.xml' ), self.root )
- self.enable_tool_shed_check = string_as_bool( kwargs.get( 'enable_tool_shed_check', False ) )
self.manage_dependency_relationships = string_as_bool( kwargs.get( 'manage_dependency_relationships', False ) )
self.running_functional_tests = string_as_bool( kwargs.get( 'running_functional_tests', False ) )
self.hours_between_check = kwargs.get( 'hours_between_check', 12 )
@@ -152,6 +148,7 @@
self.dependency_resolvers_config_file = resolve_path( kwargs.get( 'dependency_resolvers_config_file', 'dependency_resolvers_conf.xml' ), self.root )
self.job_metrics_config_file = resolve_path( kwargs.get( 'job_metrics_config_file', 'job_metrics_conf.xml' ), self.root )
self.job_config_file = resolve_path( kwargs.get( 'job_config_file', 'job_conf.xml' ), self.root )
+ self.job_resource_params_file = resolve_path( kwargs.get( 'job_resource_params_file', 'job_resource_params_conf.xml' ), self.root )
self.local_job_queue_workers = int( kwargs.get( "local_job_queue_workers", "5" ) )
self.cluster_job_queue_workers = int( kwargs.get( "cluster_job_queue_workers", "3" ) )
self.job_queue_cleanup_interval = int( kwargs.get("job_queue_cleanup_interval", "5") )
@@ -167,8 +164,9 @@
h, m, s = [ int( v ) for v in self.job_walltime.split( ':' ) ]
self.job_walltime_delta = timedelta( 0, s, 0, 0, m, h )
self.admin_users = kwargs.get( "admin_users", "" )
+ self.admin_users_list = [u.strip() for u in self.admin_users.split(',') if u]
self.reset_password_length = int( kwargs.get('reset_password_length', '15') )
- self.mailing_join_addr = kwargs.get('mailing_join_addr',"galaxy-announce-join(a)bx.psu.edu")
+ self.mailing_join_addr = kwargs.get('mailing_join_addr', 'galaxy-announce-join(a)bx.psu.edu')
self.error_email_to = kwargs.get( 'error_email_to', None )
self.activation_email = kwargs.get( 'activation_email', None )
self.user_activation_on = string_as_bool( kwargs.get( 'user_activation_on', False ) )
@@ -270,9 +268,9 @@
self.object_store_cache_path = resolve_path( kwargs.get( "object_store_cache_path", "database/object_store_cache" ), self.root )
# Handle AWS-specific config options for backward compatibility
if kwargs.get( 'aws_access_key', None) is not None:
- self.os_access_key= kwargs.get( 'aws_access_key', None )
- self.os_secret_key= kwargs.get( 'aws_secret_key', None )
- self.os_bucket_name= kwargs.get( 's3_bucket', None )
+ self.os_access_key = kwargs.get( 'aws_access_key', None )
+ self.os_secret_key = kwargs.get( 'aws_secret_key', None )
+ self.os_bucket_name = kwargs.get( 's3_bucket', None )
self.os_use_reduced_redundancy = kwargs.get( 'use_reduced_redundancy', False )
else:
self.os_access_key = kwargs.get( 'os_access_key', None )
@@ -375,6 +373,12 @@
self.fluent_port = int( kwargs.get( 'fluent_port', 24224 ) )
# visualization plugin framework
self.visualization_plugins_directory = kwargs.get( 'visualization_plugins_directory', None )
+ # Default chunk size for chunkable datatypes -- 64k
+ self.display_chunk_size = int( kwargs.get( 'display_chunk_size', 65536) )
+
+ self.citation_cache_type = kwargs.get( "citation_cache_type", "file" )
+ self.citation_cache_data_dir = self.resolve_path( kwargs.get( "citation_cache_data_dir", "database/citations/data" ) )
+ self.citation_cache_lock_dir = self.resolve_path( kwargs.get( "citation_cache_lock_dir", "database/citations/locks" ) )
@property
def sentry_dsn_public( self ):
@@ -451,19 +455,13 @@
except Exception, e:
raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) )
# Create the directories that it makes sense to create
- for path in self.file_path, \
- self.new_file_path, \
- self.job_working_directory, \
- self.cluster_files_directory, \
- self.template_cache, \
- self.ftp_upload_dir, \
- self.library_import_dir, \
- self.user_library_import_dir, \
- self.nginx_upload_store, \
- './static/genetrack/plots', \
- self.whoosh_index_dir, \
- self.object_store_cache_path, \
- os.path.join( self.tool_data_path, 'shared', 'jars' ):
+ for path in (self.file_path, self.new_file_path,
+ self.job_working_directory, self.cluster_files_directory,
+ self.template_cache, self.ftp_upload_dir,
+ self.library_import_dir, self.user_library_import_dir,
+ self.nginx_upload_store, './static/genetrack/plots',
+ self.whoosh_index_dir, self.object_store_cache_path,
+ os.path.join( self.tool_data_path, 'shared', 'jars' )):
self._ensure_directory( path )
# Check that required files exist
tool_configs = self.tool_configs
@@ -479,7 +477,7 @@
if key in self.deprecated_options:
log.warning( "Config option '%s' is deprecated and will be removed in a future release. Please consult the latest version of the sample configuration file." % key )
- def is_admin_user( self,user ):
+ def is_admin_user( self, user ):
"""
Determine if the provided user is listed in `admin_users`.
@@ -494,12 +492,13 @@
"""
return resolve_path( path, self.root )
+
def get_database_engine_options( kwargs, model_prefix='' ):
"""
Allow options for the SQLAlchemy database engine to be passed by using
the prefix "database_engine_option".
"""
- conversions = {
+ conversions = {
'convert_unicode': string_as_bool,
'pool_timeout': int,
'echo': string_as_bool,
@@ -521,6 +520,7 @@
rval[ key ] = value
return rval
+
def configure_logging( config ):
"""
Allow some basic logging configuration to be read from ini file.
@@ -555,7 +555,7 @@
root.addHandler( handler )
# If sentry is configured, also log to it
if config.sentry_dsn:
- pkg_resources.require( "raven" )
+ eggs.require( "raven" )
from raven.handlers.logging import SentryHandler
sentry_handler = SentryHandler( config.sentry_dsn )
sentry_handler.setLevel( logging.WARN )
@@ -574,12 +574,26 @@
tool_configs = self.config.tool_configs
if self.config.migrated_tools_config not in tool_configs:
tool_configs.append( self.config.migrated_tools_config )
+
+ from galaxy.managers.citations import CitationsManager
+ self.citations_manager = CitationsManager( self )
+
from galaxy import tools
self.toolbox = tools.ToolBox( tool_configs, self.config.tool_path, self )
# Search support for tools
import galaxy.tools.search
self.toolbox_search = galaxy.tools.search.ToolBoxSearch( self.toolbox )
+ from galaxy.tools.deps import containers
+ galaxy_root_dir = os.path.abspath(self.config.root)
+ file_path = os.path.abspath(getattr(self.config, "file_path"))
+ app_info = containers.AppInfo(
+ galaxy_root_dir,
+ default_file_path=file_path,
+ outputs_to_working_directory=self.config.outputs_to_working_directory
+ )
+ self.container_finder = galaxy.tools.deps.containers.ContainerFinder(app_info)
+
def _configure_tool_data_tables( self, from_shed_config ):
from galaxy.tools.data import ToolDataTableManager
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/dataset_collections/__init__.py
--- a/lib/galaxy/dataset_collections/__init__.py
+++ b/lib/galaxy/dataset_collections/__init__.py
@@ -138,6 +138,21 @@
changed = self._set_from_dict( trans, dataset_collection_instance, payload )
return changed
+ def copy(
+ self,
+ trans,
+ parent, # PRECONDITION: security checks on ability to add to parent occurred during load.
+ source,
+ encoded_source_id,
+ ):
+ assert source == "hdca" # for now
+ source_hdca = self.__get_history_collection_instance( trans, encoded_source_id )
+ new_hdca = source_hdca.copy()
+ parent.add_dataset_collection( new_hdca )
+ trans.sa_session.add( new_hdca )
+ trans.sa_session.flush()
+ return source_hdca
+
def _set_from_dict( self, trans, dataset_collection_instance, new_data ):
# Blatantly stolen from UsesHistoryDatasetAssociationMixin.set_hda_from_dict.
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/dataset_collections/util.py
--- a/lib/galaxy/dataset_collections/util.py
+++ b/lib/galaxy/dataset_collections/util.py
@@ -70,7 +70,7 @@
encoded_id = security.encode_id( dataset_colleciton_instance.id )
if isinstance( parent, model.History ):
encoded_history_id = security.encode_id( parent.id )
- dict_value[ 'url' ] = web.url_for( 'history_content', history_id=encoded_history_id, id=encoded_id, type="dataset_collection" )
+ dict_value[ 'url' ] = web.url_for( 'history_content_typed', history_id=encoded_history_id, id=encoded_id, type="dataset_collection" )
elif isinstance( parent, model.LibraryFolder ):
encoded_library_id = security.encode_id( parent.library.id )
encoded_folder_id = security.encode_id( parent.id )
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -12,6 +12,7 @@
import subprocess
import tempfile
import zipfile
+import sqlite3
from urllib import urlencode, quote_plus
from galaxy import eggs
@@ -545,3 +546,45 @@
return "Binary TwoBit format nucleotide file (%s)" % (data.nice_size(dataset.get_size()))
Binary.register_sniffable_binary_format("twobit", "twobit", TwoBit)
+
+
+(a)dataproviders.decorators.has_dataproviders
+class SQlite ( Binary ):
+ file_ext = "sqlite"
+
+ # Connects and runs a query that should work on any real database
+ # If the file is not sqlite, an exception will be thrown and the sniffer will return false
+ def sniff( self, filename ):
+ try:
+ conn = sqlite3.connect(filename)
+ schema_version=conn.cursor().execute("pragma schema_version").fetchone()
+ conn.close()
+ if schema_version is not None:
+ return True
+ return False
+ except:
+ return False
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = "SQLite Database"
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def display_peek( self, dataset ):
+ try:
+ return dataset.peek
+ except:
+ return "SQLite Database (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+
+ @dataproviders.decorators.dataprovider_factory( 'sqlite', dataproviders.dataset.SQliteDataProvider.settings )
+ def sqlite_dataprovider( self, dataset, **settings ):
+ dataset_source = dataproviders.dataset.DatasetDataProvider( dataset )
+ return dataproviders.dataset.SQliteDataProvider( dataset_source, **settings )
+
+
+Binary.register_sniffable_binary_format("sqlite","sqlite",SQlite)
+
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/datatypes/dataproviders/dataset.py
--- a/lib/galaxy/datatypes/dataproviders/dataset.py
+++ b/lib/galaxy/datatypes/dataproviders/dataset.py
@@ -11,6 +11,8 @@
import line
import column
import external
+from galaxy.util import sqlite
+import re
from galaxy import eggs
eggs.require( 'bx-python' )
@@ -700,3 +702,27 @@
#TODO: as samtools - need more info on output format
raise NotImplementedError()
super( BGzipTabixDataProvider, self ).__init__( dataset, **kwargs )
+
+
+class SQliteDataProvider( base.DataProvider ):
+ """
+ Data provider that uses a sqlite database file as its source.
+
+ Allows any query to be run and returns the resulting rows as sqlite3 row objects
+ """
+ settings = {
+ 'query': 'str'
+ }
+
+ def __init__( self, source, query=None, **kwargs ):
+ self.query = query
+ self.connection = sqlite.connect(source.dataset.file_name)
+ super( SQliteDataProvider, self ).__init__( source, **kwargs )
+
+ def __iter__( self ):
+ if (self.query is not None) and sqlite.is_read_only_query(self.query):
+ for row in self.connection.cursor().execute(self.query):
+ yield row
+ else:
+ yield
+
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/datatypes/metadata.py
--- a/lib/galaxy/datatypes/metadata.py
+++ b/lib/galaxy/datatypes/metadata.py
@@ -126,25 +126,43 @@
rval[key] = self.spec[key].param.make_copy( value, target_context=self, source_context=to_copy )
return rval
- def from_JSON_dict( self, filename ):
+ def from_JSON_dict( self, filename=None, path_rewriter=None, json_dict=None ):
dataset = self.parent
- log.debug( 'loading metadata from file for: %s %s' % ( dataset.__class__.__name__, dataset.id ) )
- JSONified_dict = json.load( open( filename ) )
+ if filename is not None:
+ log.debug( 'loading metadata from file for: %s %s' % ( dataset.__class__.__name__, dataset.id ) )
+ JSONified_dict = json.load( open( filename ) )
+ elif json_dict is not None:
+ log.debug( 'loading metadata from dict for: %s %s' % ( dataset.__class__.__name__, dataset.id ) )
+ if isinstance( json_dict, basestring ):
+ JSONified_dict = json.loads( json_dict )
+ elif isinstance( json_dict, dict ):
+ JSONified_dict = json_dict
+ else:
+ raise ValueError( "json_dict must be either a dictionary or a string, got %s." % ( type( json_dict ) ) )
+ else:
+ raise ValueError( "You must provide either a filename or a json_dict" )
for name, spec in self.spec.items():
if name in JSONified_dict:
- dataset._metadata[ name ] = spec.param.from_external_value( JSONified_dict[ name ], dataset )
+ from_ext_kwds = {}
+ external_value = JSONified_dict[ name ]
+ param = spec.param
+ if isinstance( param, FileParameter ):
+ from_ext_kwds[ 'path_rewriter' ] = path_rewriter
+ dataset._metadata[ name ] = param.from_external_value( external_value, dataset, **from_ext_kwds )
elif name in dataset._metadata:
#if the metadata value is not found in our externally set metadata but it has a value in the 'old'
#metadata associated with our dataset, we'll delete it from our dataset's metadata dict
del dataset._metadata[ name ]
- def to_JSON_dict( self, filename ):
+ def to_JSON_dict( self, filename=None ):
#galaxy.model.customtypes.json_encoder.encode()
meta_dict = {}
dataset_meta_dict = self.parent._metadata
for name, spec in self.spec.items():
if name in dataset_meta_dict:
meta_dict[ name ] = spec.param.to_external_value( dataset_meta_dict[ name ] )
+ if filename is None:
+ return json.dumps( meta_dict )
json.dump( meta_dict, open( filename, 'wb+' ) )
def __getstate__( self ):
@@ -521,7 +539,7 @@
value = value.id
return value
- def from_external_value( self, value, parent ):
+ def from_external_value( self, value, parent, path_rewriter=None ):
"""
Turns a value read from a external dict into its value to be pushed directly into the metadata dict.
"""
@@ -532,8 +550,13 @@
if mf is None:
mf = self.new_file( dataset = parent, **value.kwds )
# Ensure the metadata file gets updated with content
- parent.dataset.object_store.update_from_file( mf, file_name=value.file_name, extra_dir='_metadata_files', extra_dir_at_root=True, alt_name=os.path.basename(mf.file_name) )
- os.unlink( value.file_name )
+ file_name = value.file_name
+ if path_rewriter:
+ # Job may have run with a different (non-local) tmp/working
+ # directory. Correct.
+ file_name = path_rewriter( file_name )
+ parent.dataset.object_store.update_from_file( mf, file_name=file_name, extra_dir='_metadata_files', extra_dir_at_root=True, alt_name=os.path.basename(mf.file_name) )
+ os.unlink( file_name )
value = mf.id
return value
@@ -722,7 +745,7 @@
sa_session.flush()
metadata_files_list.append( metadata_files )
#return command required to build
- return "%s %s %s %s %s %s %s %s" % ( os.path.join( exec_dir, 'set_metadata.sh' ), dataset_files_path, tmp_dir, config_root, config_file, datatypes_config, job_metadata, " ".join( map( __metadata_files_list_to_cmd_line, metadata_files_list ) ) )
+ return "%s %s %s %s %s %s %s %s" % ( os.path.join( exec_dir, 'set_metadata.sh' ), dataset_files_path, compute_tmp_dir or tmp_dir, config_root, config_file, datatypes_config, job_metadata, " ".join( map( __metadata_files_list_to_cmd_line, metadata_files_list ) ) )
def external_metadata_set_successfully( self, dataset, sa_session ):
metadata_files = self.get_output_filenames_by_dataset( dataset, sa_session )
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/datatypes/sniff.py
--- a/lib/galaxy/datatypes/sniff.py
+++ b/lib/galaxy/datatypes/sniff.py
@@ -90,19 +90,19 @@
f.close()
return False
-def convert_newlines( fname, in_place=True ):
+def convert_newlines( fname, in_place=True, tmp_dir=None, tmp_prefix=None ):
"""
Converts in place a file from universal line endings
to Posix line endings.
>>> fname = get_test_fname('temp.txt')
>>> file(fname, 'wt').write("1 2\\r3 4")
- >>> convert_newlines(fname)
+ >>> convert_newlines(fname, tmp_prefix="gxtest", tmp_dir=tempfile.gettempdir())
(2, None)
>>> file(fname).read()
'1 2\\n3 4\\n'
"""
- fd, temp_name = tempfile.mkstemp()
+ fd, temp_name = tempfile.mkstemp( prefix=tmp_prefix, dir=tmp_dir )
fp = os.fdopen( fd, "wt" )
i = None
for i, line in enumerate( file( fname, "U" ) ):
@@ -150,20 +150,20 @@
else:
return ( i, temp_name )
-def convert_newlines_sep2tabs( fname, in_place=True, patt="\\s+" ):
+def convert_newlines_sep2tabs( fname, in_place=True, patt="\\s+", tmp_dir=None, tmp_prefix=None ):
"""
Combines above methods: convert_newlines() and sep2tabs()
so that files do not need to be read twice
>>> fname = get_test_fname('temp.txt')
>>> file(fname, 'wt').write("1 2\\r3 4")
- >>> convert_newlines_sep2tabs(fname)
+ >>> convert_newlines_sep2tabs(fname, tmp_prefix="gxtest", tmp_dir=tempfile.gettempdir())
(2, None)
>>> file(fname).read()
'1\\t2\\n3\\t4\\n'
"""
regexp = re.compile( patt )
- fd, temp_name = tempfile.mkstemp()
+ fd, temp_name = tempfile.mkstemp( prefix=tmp_prefix, dir=tmp_dir )
fp = os.fdopen( fd, "wt" )
for i, line in enumerate( file( fname, "U" ) ):
line = line.rstrip( '\r\n' )
diff -r 2a2fcdf2af7797c5288c0ae68081097a27a92dd2 -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -25,7 +25,6 @@
# All tabular data is chunkable.
CHUNKABLE = True
- CHUNK_SIZE = 50000
"""Add metadata elements"""
MetadataElement( name="comment_lines", default=0, desc="Number of comment lines", readonly=False, optional=True, no_value=0 )
@@ -262,13 +261,13 @@
def get_chunk(self, trans, dataset, chunk):
ck_index = int(chunk)
f = open(dataset.file_name)
- f.seek(ck_index * self.CHUNK_SIZE)
+ f.seek(ck_index * trans.app.config.display_chunk_size)
# If we aren't at the start of the file, seek to next newline. Do this better eventually.
if f.tell() != 0:
cursor = f.read(1)
while cursor and cursor != '\n':
cursor = f.read(1)
- ck_data = f.read(self.CHUNK_SIZE)
+ ck_data = f.read(trans.app.config.display_chunk_size)
cursor = f.read(1)
while cursor and ck_data[-1] != '\n':
ck_data += cursor
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/52b5cc75a175/
Changeset: 52b5cc75a175
Branch: stable
User: natefoo
Date: 2014-08-11 22:47:34
Summary: Added tag release_2014.08.11 for changeset ca45b78adb41
Affected #: 1 file
diff -r ca45b78adb4152fc6e7395514d46eba6b7d0b838 -r 52b5cc75a1757eddfb94ee373193c9d8fa2ec442 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -17,3 +17,4 @@
9ed84cd208e07e8985ec917cb025fcbbb09edcfb latest_2013.08.12
81fbe25bd02edcd53065e8e4476dd1dfb5a72cf2 latest_2013.11.04
2a756ca2cb1826db7796018e77d12e2dd7b67603 latest_2014.02.10
+ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/dd2d3e453ed0/
Changeset: dd2d3e453ed0
Branch: next-stable
User: jgoecks
Date: 2014-08-11 17:05:07
Summary: Increase reference sequence size to data provider to support reference-based compression of spliced reads.
Affected #: 1 file
diff -r d85ae37476a17205c9869d633f3aafd104b48a98 -r dd2d3e453ed074f152751bf5d9ea281ed60abc80 lib/galaxy/webapps/galaxy/api/datasets.py
--- a/lib/galaxy/webapps/galaxy/api/datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/datasets.py
@@ -199,12 +199,12 @@
if isinstance( data_provider, (SamDataProvider, BamDataProvider ) ):
# Get reference sequence.
if dataset.dbkey:
- # FIXME: increase region 500bp each way to provide sequence for overlapping reads. As reads
- # get longer, this will need to be increased and/or a handle to the genomic data may be need
- # to be given to the data provider.
+ # FIXME: increase region 1M each way to provide sequence for
+ # spliced/gapped reads. Probably should provide refseq object
+ # directly to data provider.
region = self.app.genomes.reference( trans, dbkey=dataset.dbkey, chrom=chrom,
- low=( max( 0, int( low ) - 500 ) ),
- high=( int( high ) + 500 ) )
+ low=( max( 0, int( low ) - 1000000 ) ),
+ high=( int( high ) + 1000000 ) )
# Get mean depth.
if not indexer:
https://bitbucket.org/galaxy/galaxy-central/commits/2d9628d776a2/
Changeset: 2d9628d776a2
Branch: next-stable
User: jgoecks
Date: 2014-08-11 17:18:46
Summary: Trackster: fix location of gap line and read-pair connector line.
Affected #: 2 files
diff -r dd2d3e453ed074f152751bf5d9ea281ed60abc80 -r 2d9628d776a22cc6f0a3629176c0ee04de8be422 static/scripts/packed/viz/trackster/painters.js
--- a/static/scripts/packed/viz/trackster/painters.js
+++ b/static/scripts/packed/viz/trackster/painters.js
@@ -1,1 +1,1 @@
-define(["libs/underscore"],function(_){var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(first_region,second_region){var first_start=first_region[0],first_end=first_region[1],second_start=second_region[0],second_end=second_region[1],overlap;if(first_start<second_start){if(first_end<=second_start){overlap=BEFORE}else{if(first_end<=second_end){overlap=OVERLAP_START}else{overlap=CONTAINS}}}else{if(first_start>second_end){overlap=AFTER}else{if(first_end<=second_end){overlap=CONTAINED_BY}else{overlap=OVERLAP_END}}}return overlap};var is_overlap=function(first_region,second_region){var overlap=compute_overlap(first_region,second_region);return(overlap!==BEFORE&&overlap!==AFTER)};var dashedLine=function(ctx,x1,y1,x2,y2,dashLen){if(dashLen===undefined){dashLen=4}var dX=x2-x1;var dY=y2-y1;var dashes=Math.floor(Math.sqrt(dX*dX+dY*dY)/dashLen);var dashX=dX/dashes;var dashY=dY/dashes;var q;for(q=0;q<dashes;q++,x1+=dashX,y1+=dashY){if(q%2!==0){continue}ctx.fillRect(x1,y1,dashLen,1)}};var drawDownwardEquilateralTriangle=function(ctx,down_vertex_x,down_vertex_y,side_len){var x1=down_vertex_x-side_len/2,x2=down_vertex_x+side_len/2,y=down_vertex_y-Math.sqrt(side_len*3/2);ctx.beginPath();ctx.moveTo(x1,y);ctx.lineTo(x2,y);ctx.lineTo(down_vertex_x,down_vertex_y);ctx.lineTo(x1,y);ctx.strokeStyle=this.fillStyle;ctx.fill();ctx.stroke();ctx.closePath()};var Scaler=function(default_val){this.default_val=(default_val?default_val:1)};Scaler.prototype.gen_val=function(input){return this.default_val};var DrawResults=function(options){this.incomplete_features=options.incomplete_features;this.feature_mapper=options.feature_mapper};var Painter=function(data,view_start,view_end,prefs,mode){this.data=data;this.view_start=view_start;this.view_end=view_end;this.prefs=_.extend({},this.default_prefs,prefs);this.mode=mode};Painter.prototype.default_prefs={};Painter.prototype.draw=function(ctx,width,height,w_scale){};var LinePainter=function(data,view_start,view_end,prefs,mode){Painter.call(this,data,view_start,view_end,prefs,mode);if(this.prefs.min_value===undefined){this.prefs.min_value=_.min(_.map(this.data,function(d){return d[1]}))||0}if(this.prefs.max_value===undefined){this.prefs.max_value=_.max(_.map(this.data,function(d){return d[1]}))||0}};LinePainter.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};LinePainter.prototype.draw=function(ctx,width,height,w_scale){var in_path=false,min_value=this.prefs.min_value,max_value=this.prefs.max_value,vertical_range=max_value-min_value,height_px=height,view_start=this.view_start,mode=this.mode,data=this.data;ctx.save();var y_zero=Math.round(height+min_value/vertical_range*height);if(mode!=="Intensity"){ctx.fillStyle="#aaa";ctx.fillRect(0,y_zero,width,1)}ctx.beginPath();var x_scaled,y,delta_x_px;if(data.length>1){delta_x_px=Math.ceil((data[1][0]-data[0][0])*w_scale)}else{delta_x_px=10}var painter_color=this.prefs.block_color||this.prefs.color,pref_color=parseInt(painter_color.slice(1),16),pref_r=(pref_color&16711680)>>16,pref_g=(pref_color&65280)>>8,pref_b=pref_color&255,top_overflow=false,bot_overflow=false;for(var i=0,len=data.length;i<len;i++){ctx.fillStyle=ctx.strokeStyle=painter_color;top_overflow=bot_overflow=false;x_scaled=Math.ceil((data[i][0]-view_start)*w_scale);y=data[i][1];if(y===null){if(in_path&&mode==="Filled"){ctx.lineTo(x_scaled,height_px)}in_path=false;continue}if(y<min_value){bot_overflow=true;y=min_value}else{if(y>max_value){top_overflow=true;y=max_value}}if(mode==="Histogram"){y=Math.round(y/vertical_range*height_px);ctx.fillRect(x_scaled,y_zero,delta_x_px,-y)}else{if(mode==="Intensity"){var saturation=(y-min_value)/vertical_range,new_r=Math.round(pref_r+(255-pref_r)*(1-saturation)),new_g=Math.round(pref_g+(255-pref_g)*(1-saturation)),new_b=Math.round(pref_b+(255-pref_b)*(1-saturation));ctx.fillStyle="rgb("+new_r+","+new_g+","+new_b+")";ctx.fillRect(x_scaled,0,delta_x_px,height_px)}else{y=Math.round(height_px-(y-min_value)/vertical_range*height_px);if(in_path){ctx.lineTo(x_scaled,y)}else{in_path=true;if(mode==="Filled"){ctx.moveTo(x_scaled,height_px);ctx.lineTo(x_scaled,y)}else{ctx.moveTo(x_scaled,y)}}}}ctx.fillStyle=this.prefs.overflow_color;if(top_overflow||bot_overflow){var overflow_x;if(mode==="Histogram"||mode==="Intensity"){overflow_x=delta_x_px}else{x_scaled-=2;overflow_x=4}if(top_overflow){ctx.fillRect(x_scaled,0,overflow_x,3)}if(bot_overflow){ctx.fillRect(x_scaled,height_px-3,overflow_x,3)}}ctx.fillStyle=painter_color}if(mode==="Filled"){if(in_path){ctx.lineTo(x_scaled,y_zero);ctx.lineTo(0,y_zero)}ctx.fill()}else{ctx.stroke()}ctx.restore()};var FeaturePositionMapper=function(slot_height){this.feature_positions={};this.slot_height=slot_height;this.translation=0;this.y_translation=0};FeaturePositionMapper.prototype.map_feature_data=function(feature_data,slot,x_start,x_end){if(!this.feature_positions[slot]){this.feature_positions[slot]=[]}this.feature_positions[slot].push({data:feature_data,x_start:x_start,x_end:x_end})};FeaturePositionMapper.prototype.get_feature_data=function(x,y){var slot=Math.floor((y-this.y_translation)/this.slot_height),feature_dict;if(!this.feature_positions[slot]){return null}x+=this.translation;for(var i=0;i<this.feature_positions[slot].length;i++){feature_dict=this.feature_positions[slot][i];if(x>=feature_dict.x_start&&x<=feature_dict.x_end){return feature_dict.data}}};var FeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){Painter.call(this,data,view_start,view_end,prefs,mode);this.alpha_scaler=(alpha_scaler?alpha_scaler:new Scaler());this.height_scaler=(height_scaler?height_scaler:new Scaler());this.max_label_length=200};FeaturePainter.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};_.extend(FeaturePainter.prototype,{get_required_height:function(rows_required,width){var required_height=this.get_row_height(),y_scale=required_height,mode=this.mode;if(mode==="no_detail"||mode==="Squish"||mode==="Pack"){required_height=rows_required*y_scale}return required_height+this.get_top_padding(width)},get_top_padding:function(width){return 0},draw:function(ctx,width,height,w_scale,slots){var data=this.data,view_start=this.view_start,view_end=this.view_end;ctx.save();ctx.fillStyle=this.prefs.block_color;ctx.textAlign="right";var y_scale=this.get_row_height(),feature_mapper=new FeaturePositionMapper(y_scale),x_draw_coords,incomplete_features=[];for(var i=0,len=data.length;i<len;i++){var feature=data[i],feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],slot=(slots&&slots[feature_uid]!==undefined?slots[feature_uid]:null);if((this.mode==="Dense"||slot!==null)&&(feature_start<view_end&&feature_end>view_start)){x_draw_coords=this.draw_element(ctx,this.mode,feature,slot,view_start,view_end,w_scale,y_scale,width);feature_mapper.map_feature_data(feature,slot,x_draw_coords[0],x_draw_coords[1]);if(feature_start<view_start||feature_end>view_end){incomplete_features.push(feature)}}}ctx.restore();feature_mapper.y_translation=this.get_top_padding(width);return new DrawResults({incomplete_features:incomplete_features,feature_mapper:feature_mapper})},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){return[0,0]}});var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=1,DENSE_FEATURE_HEIGHT=9,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,CONNECTOR_COLOR="#ccc";var LinkedFeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){FeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.draw_background_connector=true;this.draw_individual_connectors=false};_.extend(LinkedFeaturePainter.prototype,FeaturePainter.prototype,{get_row_height:function(){var mode=this.mode,height;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="no_detail"){height=NO_DETAIL_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT}}}return height},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){var feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],feature_name=feature[3],feature_strand=feature[4],f_start=Math.floor(Math.max(0,(feature_start-tile_low-0.5)*w_scale)),f_end=Math.ceil(Math.min(width,Math.max(0,(feature_end-tile_low-0.5)*w_scale))),draw_start=f_start,draw_end=f_end,y_start=(mode==="Dense"?0:(0+slot))*y_scale+this.get_top_padding(width),thickness,y_start,thick_start=null,thick_end=null,block_color=(!feature_strand||feature_strand==="+"||feature_strand==="."?this.prefs.block_color:this.prefs.reverse_strand_color);label_color=this.prefs.label_color;ctx.globalAlpha=this.alpha_scaler.gen_val(feature);if(mode==="Dense"){slot=1}if(mode==="no_detail"){ctx.fillStyle=block_color;ctx.fillRect(f_start,y_start+5,f_end-f_start,NO_DETAIL_FEATURE_HEIGHT)}else{var feature_ts=feature[5],feature_te=feature[6],feature_blocks=feature[7],full_height=true;if(feature_ts&&feature_te){thick_start=Math.floor(Math.max(0,(feature_ts-tile_low)*w_scale));thick_end=Math.ceil(Math.min(width,Math.max(0,(feature_te-tile_low)*w_scale)))}var thin_height,thick_height;if(mode==="Squish"){thin_height=1;thick_height=SQUISH_FEATURE_HEIGHT;full_height=false}else{if(mode==="Dense"){thin_height=5;thick_height=DENSE_FEATURE_HEIGHT}else{thin_height=5;thick_height=PACK_FEATURE_HEIGHT}}if(!feature_blocks){ctx.fillStyle=block_color;ctx.fillRect(f_start,y_start+1,f_end-f_start,thick_height);if(feature_strand&&full_height){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand_inv")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand_inv")}}ctx.fillRect(f_start,y_start+1,f_end-f_start,thick_height)}}else{var cur_y_start,cur_height;if(mode==="Squish"||mode==="Dense"){cur_y_start=y_start+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;cur_height=1}else{if(feature_strand){cur_y_start=y_start;cur_height=thick_height}else{cur_y_start+=(SQUISH_FEATURE_HEIGHT/2)+1;cur_height=1}}if(this.draw_background_connector){if(mode==="Squish"||mode==="Dense"){ctx.fillStyle=CONNECTOR_COLOR}else{if(feature_strand){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand")}}}else{ctx.fillStyle=CONNECTOR_COLOR}}ctx.fillRect(f_start,cur_y_start,f_end-f_start,cur_height)}var start_and_height;for(var k=0,k_len=feature_blocks.length;k<k_len;k++){var block=feature_blocks[k],block_start=Math.floor(Math.max(0,(block[0]-tile_low-0.5)*w_scale)),block_end=Math.ceil(Math.min(width,Math.max((block[1]-tile_low-0.5)*w_scale))),last_block_start,last_block_end;if(block_start>block_end){continue}ctx.fillStyle=block_color;ctx.fillRect(block_start,y_start+(thick_height-thin_height)/2+1,block_end-block_start,thin_height);if(thick_start!==undefined&&feature_te>feature_ts&&!(block_start>thick_end||block_end<thick_start)){var block_thick_start=Math.max(block_start,thick_start),block_thick_end=Math.min(block_end,thick_end);ctx.fillRect(block_thick_start,y_start+1,block_thick_end-block_thick_start,thick_height);if(feature_blocks.length===1&&mode==="Pack"){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand_inv")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand_inv")}}if(block_thick_start+14<block_thick_end){block_thick_start+=2;block_thick_end-=2}ctx.fillRect(block_thick_start,y_start+1,block_thick_end-block_thick_start,thick_height)}}if(this.draw_individual_connectors&&last_block_start){this.draw_connector(ctx,last_block_start,last_block_end,block_start,block_end,y_start)}last_block_start=block_start;last_block_end=block_end}if(mode==="Pack"){ctx.globalAlpha=1;ctx.fillStyle="white";var hscale_factor=this.height_scaler.gen_val(feature),new_height=Math.ceil(thick_height*hscale_factor),ws_height=Math.round((thick_height-new_height)/2);if(hscale_factor!==1){ctx.fillRect(f_start,cur_y_start+1,f_end-f_start,ws_height);ctx.fillRect(f_start,cur_y_start+thick_height-ws_height+1,f_end-f_start,ws_height)}}}ctx.globalAlpha=1;if(feature_name&&mode==="Pack"&&feature_start>tile_low){ctx.fillStyle=label_color;if(tile_low===0&&f_start-ctx.measureText(feature_name).width<0){ctx.textAlign="left";ctx.fillText(feature_name,f_end+LABEL_SPACING,y_start+8,this.max_label_length);draw_end+=ctx.measureText(feature_name).width+LABEL_SPACING}else{ctx.textAlign="right";ctx.fillText(feature_name,f_start-LABEL_SPACING,y_start+8,this.max_label_length);draw_start-=ctx.measureText(feature_name).width+LABEL_SPACING}}}ctx.globalAlpha=1;return[draw_start,draw_end]}});var ReadPainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler,ref_seq,base_color_fn){FeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.ref_seq=(ref_seq?ref_seq.data:null);this.base_color_fn=base_color_fn};_.extend(ReadPainter.prototype,FeaturePainter.prototype,{get_row_height:function(){var height,mode=this.mode;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT;if(this.prefs.show_insertions){height*=2}}}return height},_parse_cigar:function(cigar_str){var cigar_ops="MIDNSHP=X";var blocks=[[0,0]],cur_block=blocks[0],base_pos=0,parsed_cigar=_.map(cigar_str.match(/[0-9]+[MIDNSHP=X]/g),function(op){var op_len=parseInt(op.slice(0,-1),10),op_char=op.slice(-1);if(op_char==="N"){if(cur_block[1]!==0){cur_block=[base_pos+op_len,base_pos+op_len];blocks.push(cur_block)}}else{if("ISHP".indexOf(op_char)===-1){cur_block[1]+=op_len;base_pos+=op_len}}return[cigar_ops.indexOf(op_char),op_len]});return{blocks:blocks,cigar:parsed_cigar}},draw_read:function(ctx,mode,w_scale,y_start,tile_low,tile_high,feature_start,cigar,strand,read_seq){var update_base_offset=function(offset,cig_op,cig_len){if("M=NXD".indexOf(cig_op)!==-1){offset+=cig_len}return offset},update_seq_offset=function(offset,cig_op,cig_len){if("IX".indexOf(cig_op)!==-1){offset+=cig_len}return offset},get_draw_coord=function(sequence_coord){return Math.floor(Math.max(0,(sequence_coord-tile_low-0.5)*w_scale))};ctx.textAlign="center";var tile_region=[tile_low,tile_high],base_offset=0,seq_offset=0,gap=Math.round(w_scale/2),char_width_px=ctx.canvas.manager.char_width_px,block_color=(strand==="+"?this.prefs.detail_block_color:this.prefs.reverse_strand_color),pack_mode=(mode==="Pack"),draw_height=(pack_mode?PACK_FEATURE_HEIGHT:SQUISH_FEATURE_HEIGHT),rect_y=y_start+1,paint_utils=new ReadPainterUtils(ctx,draw_height,w_scale,mode),drawing_blocks=[],s_start,s_end;var draw_last=[];var t=this._parse_cigar(cigar);cigar=t.cigar;drawing_blocks=t.blocks;for(var i=0;i<drawing_blocks.length;i++){var block=drawing_blocks[i];if(is_overlap([feature_start+block[0],feature_start+block[1]],tile_region)){s_start=get_draw_coord(feature_start+block[0]);s_end=get_draw_coord(feature_start+block[1]);if(s_start===s_end){s_end+=1}ctx.fillStyle=block_color;ctx.fillRect(s_start,rect_y,s_end-s_start,draw_height)}}for(var cig_id=0,len=cigar.length;cig_id<len;cig_id++){var cig=cigar[cig_id],cig_op="MIDNSHP=X"[cig[0]],cig_len=cig[1];var seq_start=feature_start+base_offset;s_start=get_draw_coord(seq_start);s_end=get_draw_coord(seq_start+cig_len);if(!is_overlap([seq_start,seq_start+cig_len],tile_region)){base_offset=update_base_offset(base_offset,cig_op,cig_len);seq_offset=update_seq_offset(seq_offset,cig_op,cig_len);continue}if(s_start===s_end){s_end+=1}switch(cig_op){case"H":case"S":case"P":break;case"M":base_offset+=cig_len;break;case"=":case"X":var cur_seq="";if(cig_op==="X"){cur_seq=read_seq.slice(seq_offset,seq_offset+cig_len)}else{if(this.ref_seq){cur_seq=this.ref_seq.slice(Math.max(0,seq_start-tile_low),Math.min(seq_start-tile_low+cig_len,tile_high-tile_low))}}var start_pos=Math.max(seq_start,tile_low);for(var c=0;c<cur_seq.length;c++){if(cur_seq&&!this.prefs.show_differences||cig_op==="X"){var c_start=Math.floor(Math.max(0,(start_pos+c-tile_low)*w_scale));ctx.fillStyle=this.base_color_fn(cur_seq[c]);if(pack_mode&&w_scale>char_width_px){ctx.fillText(cur_seq[c],c_start,y_start+9)}else{if(w_scale>0.05){ctx.fillRect(c_start-gap,rect_y,Math.max(1,Math.round(w_scale)),draw_height)}}}}if(cig_op==="X"){seq_offset+=cig_len}base_offset+=cig_len;break;case"N":ctx.fillStyle=CONNECTOR_COLOR;ctx.fillRect(s_start,y_start+5,s_end-s_start,1);base_offset+=cig_len;break;case"D":paint_utils.draw_deletion(s_start,rect_y,cig_len);base_offset+=cig_len;break;case"I":var insert_x_coord=s_start-gap;if(is_overlap([seq_start,seq_start+cig_len],tile_region)){var seq=read_seq.slice(seq_offset,seq_offset+cig_len);if(this.prefs.show_insertions){var x_center=s_start-(s_end-s_start)/2;if((mode==="Pack"||this.mode==="Auto")&&read_seq!==undefined&&w_scale>char_width_px){ctx.fillStyle="yellow";ctx.fillRect(x_center-gap,y_start-9,s_end-s_start,9);draw_last[draw_last.length]={type:"triangle",data:[insert_x_coord,y_start+4,5]};ctx.fillStyle=CONNECTOR_COLOR;switch(compute_overlap([seq_start,seq_start+cig_len],tile_region)){case (OVERLAP_START):seq=seq.slice(tile_low-seq_start);break;case (OVERLAP_END):seq=seq.slice(0,seq_start-tile_high);break;case (CONTAINED_BY):break;case (CONTAINS):seq=seq.slice(tile_low-seq_start,seq_start-tile_high);break}for(var c=0,str_len=seq.length;c<str_len;c++){var c_start=Math.floor(Math.max(0,(seq_start+c-tile_low)*w_scale));ctx.fillText(seq[c],c_start-(s_end-s_start)/2,y_start)}}else{ctx.fillStyle="yellow";ctx.fillRect(x_center,y_start+(this.mode!=="Dense"?2:5),s_end-s_start,(mode!=="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}else{if((mode==="Pack"||this.mode==="Auto")&&read_seq!==undefined&&w_scale>char_width_px){draw_last.push({type:"text",data:[seq.length,insert_x_coord,y_start+9]})}else{}}}seq_offset+=cig_len;break}}ctx.fillStyle="yellow";var item,type,data;for(var i=0;i<draw_last.length;i++){item=draw_last[i];type=item.type;data=item.data;if(type==="text"){ctx.save();ctx.font="bold "+ctx.font;ctx.fillText(data[0],data[1],data[2]);ctx.restore()}else{if(type==="triangle"){drawDownwardEquilateralTriangle(ctx,data[0],data[1],data[2])}}}},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){var feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],feature_name=feature[3],f_start=Math.floor(Math.max(-0.5*w_scale,(feature_start-tile_low-0.5)*w_scale)),f_end=Math.ceil(Math.min(width,Math.max(0,(feature_end-tile_low-0.5)*w_scale))),y_start=(mode==="Dense"?0:(0+slot))*y_scale,label_color=this.prefs.label_color;if(feature[5] instanceof Array){var connector=true;if(feature[4][1]>=tile_low&&feature[4][0]<=tile_high&&feature[4][2]){this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature[4][0],feature[4][2],feature[4][3],feature[4][4])}else{connector=false}if(feature[5][1]>=tile_low&&feature[5][0]<=tile_high&&feature[5][2]){this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature[5][0],feature[5][2],feature[5][3],feature[5][4])}else{connector=false}var b1_end=Math.ceil(Math.min(width,Math.max(-0.5*w_scale,(feature[4][1]-tile_low-0.5)*w_scale))),b2_start=Math.floor(Math.max(-0.5*w_scale,(feature[5][0]-tile_low-0.5)*w_scale));if(connector&&b2_start>b1_end){ctx.fillStyle=CONNECTOR_COLOR;dashedLine(ctx,b1_end,y_start+5,b2_start,y_start+5)}}else{this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature_start,feature[4],feature[5],feature[6])}if(mode==="Pack"&&feature_start>=tile_low&&feature_name!=="."){ctx.fillStyle=this.prefs.label_color;if(tile_low===0&&f_start-ctx.measureText(feature_name).width<0){ctx.textAlign="left";ctx.fillText(feature_name,f_end+LABEL_SPACING,y_start+9,this.max_label_length)}else{ctx.textAlign="right";ctx.fillText(feature_name,f_start-LABEL_SPACING,y_start+9,this.max_label_length)}}return[0,0]}});var ArcLinkedFeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){LinkedFeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.longest_feature_length=this.calculate_longest_feature_length();this.draw_background_connector=false;this.draw_individual_connectors=true};_.extend(ArcLinkedFeaturePainter.prototype,FeaturePainter.prototype,LinkedFeaturePainter.prototype,{calculate_longest_feature_length:function(){var longest_feature_length=0;for(var i=0,len=this.data.length;i<len;i++){var feature=this.data[i],feature_start=feature[1],feature_end=feature[2];longest_feature_length=Math.max(longest_feature_length,feature_end-feature_start)}return longest_feature_length},get_top_padding:function(width){var view_range=this.view_end-this.view_start,w_scale=width/view_range;return Math.min(128,Math.ceil((this.longest_feature_length/2)*w_scale))},draw_connector:function(ctx,block1_start,block1_end,block2_start,block2_end,y_start){var x_center=(block1_end+block2_start)/2,radius=block2_start-x_center;var angle1=Math.PI,angle2=0;if(radius>0){ctx.beginPath();ctx.arc(x_center,y_start,block2_start-x_center,Math.PI,0);ctx.stroke()}}});var Color=function(rgb,a){if(Array.isArray(rgb)){this.rgb=rgb}else{if(rgb.length==6){this.rgb=rgb.match(/.{2}/g).map(function(c){return parseInt(c,16)})}else{if(rgb.length==7){this.rgb=rgb.substring(1,7).match(/.{2}/g).map(function(c){return parseInt(c,16)})}else{this.rgb=rgb.split("").map(function(c){return parseInt(c+c,16)})}}}this.alpha=typeof(a)==="number"?a:1};Color.prototype={eval:function(){return this},toCSS:function(){if(this.alpha<1){return"rgba("+this.rgb.map(function(c){return Math.round(c)}).concat(this.alpha).join(", ")+")"}else{return"#"+this.rgb.map(function(i){i=Math.round(i);i=(i>255?255:(i<0?0:i)).toString(16);return i.length===1?"0"+i:i}).join("")}},toHSL:function(){var r=this.rgb[0]/255,g=this.rgb[1]/255,b=this.rgb[2]/255,a=this.alpha;var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2,d=max-min;if(max===min){h=s=0}else{s=l>0.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break}h/=6}return{h:h*360,s:s,l:l,a:a}},toARGB:function(){var argb=[Math.round(this.alpha*255)].concat(this.rgb);return"#"+argb.map(function(i){i=Math.round(i);i=(i>255?255:(i<0?0:i)).toString(16);return i.length===1?"0"+i:i}).join("")},mix:function(color2,weight){color1=this;var p=weight;var w=p*2-1;var a=color1.toHSL().a-color2.toHSL().a;var w1=(((w*a==-1)?w:(w+a)/(1+w*a))+1)/2;var w2=1-w1;var rgb=[color1.rgb[0]*w1+color2.rgb[0]*w2,color1.rgb[1]*w1+color2.rgb[1]*w2,color1.rgb[2]*w1+color2.rgb[2]*w2];var alpha=color1.alpha*p+color2.alpha*(1-p);return new Color(rgb,alpha)}};var LinearRamp=function(start_color,end_color,start_value,end_value){this.start_color=new Color(start_color);this.end_color=new Color(end_color);this.start_value=start_value;this.end_value=end_value;this.value_range=end_value-start_value};LinearRamp.prototype.map_value=function(value){value=Math.max(value,this.start_value);value=Math.min(value,this.end_value);value=(value-this.start_value)/this.value_range;return this.start_color.mix(this.end_color,1-value).toCSS()};var SplitRamp=function(start_color,middle_color,end_color,start_value,end_value){this.positive_ramp=new LinearRamp(middle_color,end_color,0,end_value);this.negative_ramp=new LinearRamp(middle_color,start_color,0,-start_value);this.start_value=start_value;this.end_value=end_value};SplitRamp.prototype.map_value=function(value){value=Math.max(value,this.start_value);value=Math.min(value,this.end_value);if(value>=0){return this.positive_ramp.map_value(value)}else{return this.negative_ramp.map_value(-value)}};var DiagonalHeatmapPainter=function(data,view_start,view_end,prefs,mode){Painter.call(this,data,view_start,view_end,prefs,mode);var i,len;if(this.prefs.min_value===undefined){var min_value=Infinity;for(i=0,len=this.data.length;i<len;i++){min_value=Math.min(min_value,this.data[i][5])}this.prefs.min_value=min_value}if(this.prefs.max_value===undefined){var max_value=-Infinity;for(i=0,len=this.data.length;i<len;i++){max_value=Math.max(max_value,this.data[i][5])}this.prefs.max_value=max_value}};DiagonalHeatmapPainter.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Heatmap",pos_color:"#FF8C00",neg_color:"#4169E1"};DiagonalHeatmapPainter.prototype.draw=function(ctx,width,height,w_scale){var min_value=this.prefs.min_value,max_value=this.prefs.max_value,value_range=max_value-min_value,height_px=height,view_start=this.view_start,mode=this.mode,data=this.data,invsqrt2=1/Math.sqrt(2);var ramp=(new SplitRamp(this.prefs.neg_color,"#FFFFFF",this.prefs.pos_color,min_value,max_value));var d,s1,e1,s2,e2,value;var scale=function(p){return(p-view_start)*w_scale};ctx.save();ctx.rotate(-45*Math.PI/180);ctx.scale(invsqrt2,invsqrt2);for(var i=0,len=data.length;i<len;i++){d=data[i];s1=scale(d[1]);e1=scale(d[2]);s2=scale(d[4]);e2=scale(d[5]);value=d[6];ctx.fillStyle=(ramp.map_value(value));ctx.fillRect(s1,s2,(e1-s1),(e2-s2))}ctx.restore()};var ReadPainterUtils=function(ctx,row_height,px_per_base,mode){this.ctx=ctx;this.row_height=row_height;this.px_per_base=px_per_base;this.draw_details=(mode==="Pack"||mode==="Auto")&&(px_per_base>=ctx.canvas.manager.char_width_px);this.delete_details_thickness=0.2};_.extend(ReadPainterUtils.prototype,{draw_deletion:function(x,y,len){this.ctx.fillStyle="black";var thickness=(this.draw_details?this.delete_details_thickness:1)*this.row_height;y+=0.5*(this.row_height-thickness);this.ctx.fillRect(x,y,len*this.px_per_base,thickness)}});var VariantPainter=function(data,view_start,view_end,prefs,mode,base_color_fn){Painter.call(this,data,view_start,view_end,prefs,mode);this.base_color_fn=base_color_fn;this.divider_height=1};_.extend(VariantPainter.prototype,Painter.prototype,{get_row_height:function(){var mode=this.mode,height;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT}}return height},get_required_height:function(num_samples){var height=this.prefs.summary_height;if(num_samples>1&&this.prefs.show_sample_data){height+=this.divider_height+num_samples*this.get_row_height()}return height},draw:function(ctx,width,height,w_scale){ctx.save();var get_deletion_info=function(ref,alt){var ref_len=ref.length,alt_len=alt.length,start=0,len=1,is_delete=false;if(alt==="-"){is_delete=true;len=ref.length}else{if(ref.indexOf(alt)===0&&ref_len>alt_len){is_delete=true;len=ref_len=alt_len;start+=alt_len}}return(is_delete?{start:start,len:len}:null)};var locus_data,pos,id,ref,alt,qual,filter,sample_gts,allele_counts,variant,draw_x_start,char_x_start,draw_y_start,genotype,base_px=Math.max(1,Math.floor(w_scale)),num_samples=(this.data.length?this.data[0][7].split(",").length:0),row_height=(this.mode==="Squish"?SQUISH_TRACK_HEIGHT:PACK_TRACK_HEIGHT),feature_height=(w_scale<0.1?row_height:(this.mode==="Squish"?SQUISH_FEATURE_HEIGHT:PACK_FEATURE_HEIGHT)),draw_summary=true,paint_utils=new ReadPainterUtils(ctx,row_height,w_scale,this.mode),j;if(num_samples===1){row_height=feature_height=(w_scale<ctx.canvas.manager.char_width_px?this.prefs.summary_height:row_height);paint_utils.row_height=row_height;draw_summary=false}if(this.prefs.show_sample_data&&draw_summary){ctx.fillStyle="#F3F3F3";ctx.globalAlpha=1;ctx.fillRect(0,this.prefs.summary_height-this.divider_height,width,this.divider_height)}ctx.textAlign="center";for(var i=0;i<this.data.length;i++){locus_data=this.data[i];pos=locus_data[1];ref=locus_data[3];alt=[locus_data[4].split(",")];sample_gts=locus_data[7].split(",");allele_counts=locus_data.slice(8);alt=_.map(_.flatten(alt),function(a){var type,alt_info={},delete_info=get_deletion_info(ref,a);if(delete_info){type="deletion";_.extend(alt_info,delete_info)}else{type="snp"}return _.extend(alt_info,{type:type,value:a,})});if(pos<this.view_start||pos>this.view_end){continue}draw_x_start=Math.floor(Math.max(-0.5*w_scale,(pos-this.view_start-0.5)*w_scale));char_x_start=Math.floor(Math.max(0,(pos-this.view_start)*w_scale));if(draw_summary){ctx.fillStyle="#999999";ctx.globalAlpha=1;ctx.fillRect(draw_x_start,0,base_px,this.prefs.summary_height);draw_y_start=this.prefs.summary_height;for(j=0;j<alt.length;j++){ctx.fillStyle=(alt[j].type==="deletion"?"black":this.base_color_fn(alt[j].value));allele_frac=allele_counts/sample_gts.length;draw_height=Math.ceil(this.prefs.summary_height*allele_frac);ctx.fillRect(draw_x_start,draw_y_start-draw_height,base_px,draw_height);draw_y_start-=draw_height}}if(!this.prefs.show_sample_data){continue}draw_y_start=(draw_summary?this.prefs.summary_height+this.divider_height:0);for(j=0;j<sample_gts.length;j++,draw_y_start+=row_height){genotype=(sample_gts[j]?sample_gts[j].split(/\/|\|/):["0","0"]);variant=null;if(genotype[0]===genotype[1]){if(genotype[0]==="."){}else{if(genotype[0]!=="0"){variant=alt[parseInt(genotype[0],10)-1];ctx.globalAlpha=1}}}else{variant=(genotype[0]!=="0"?genotype[0]:genotype[1]);variant=alt[parseInt(variant,10)-1];ctx.globalAlpha=0.5}if(variant){if(variant.type==="snp"){var snp=variant.value;ctx.fillStyle=this.base_color_fn(snp);if(paint_utils.draw_details){ctx.fillText(snp,char_x_start,draw_y_start+row_height)}else{ctx.fillRect(draw_x_start,draw_y_start+1,base_px,feature_height)}}else{if(variant.type==="deletion"){paint_utils.draw_deletion(draw_x_start+base_px*variant.start,draw_y_start+1,variant.len)}else{}}}}}ctx.restore()}});return{Scaler:Scaler,LinePainter:LinePainter,LinkedFeaturePainter:LinkedFeaturePainter,ReadPainter:ReadPainter,ArcLinkedFeaturePainter:ArcLinkedFeaturePainter,DiagonalHeatmapPainter:DiagonalHeatmapPainter,VariantPainter:VariantPainter}});
\ No newline at end of file
+define(["libs/underscore"],function(_){var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(first_region,second_region){var first_start=first_region[0],first_end=first_region[1],second_start=second_region[0],second_end=second_region[1],overlap;if(first_start<second_start){if(first_end<=second_start){overlap=BEFORE}else{if(first_end<=second_end){overlap=OVERLAP_START}else{overlap=CONTAINS}}}else{if(first_start>second_end){overlap=AFTER}else{if(first_end<=second_end){overlap=CONTAINED_BY}else{overlap=OVERLAP_END}}}return overlap};var is_overlap=function(first_region,second_region){var overlap=compute_overlap(first_region,second_region);return(overlap!==BEFORE&&overlap!==AFTER)};var dashedLine=function(ctx,x1,y1,x2,y2,dashLen){if(dashLen===undefined){dashLen=4}var dX=x2-x1;var dY=y2-y1;var dashes=Math.floor(Math.sqrt(dX*dX+dY*dY)/dashLen);var dashX=dX/dashes;var dashY=dY/dashes;var q;for(q=0;q<dashes;q++,x1+=dashX,y1+=dashY){if(q%2!==0){continue}ctx.fillRect(x1,y1,dashLen,1)}};var drawDownwardEquilateralTriangle=function(ctx,down_vertex_x,down_vertex_y,side_len){var x1=down_vertex_x-side_len/2,x2=down_vertex_x+side_len/2,y=down_vertex_y-Math.sqrt(side_len*3/2);ctx.beginPath();ctx.moveTo(x1,y);ctx.lineTo(x2,y);ctx.lineTo(down_vertex_x,down_vertex_y);ctx.lineTo(x1,y);ctx.strokeStyle=this.fillStyle;ctx.fill();ctx.stroke();ctx.closePath()};var Scaler=function(default_val){this.default_val=(default_val?default_val:1)};Scaler.prototype.gen_val=function(input){return this.default_val};var DrawResults=function(options){this.incomplete_features=options.incomplete_features;this.feature_mapper=options.feature_mapper};var Painter=function(data,view_start,view_end,prefs,mode){this.data=data;this.view_start=view_start;this.view_end=view_end;this.prefs=_.extend({},this.default_prefs,prefs);this.mode=mode};Painter.prototype.default_prefs={};Painter.prototype.draw=function(ctx,width,height,w_scale){};var LinePainter=function(data,view_start,view_end,prefs,mode){Painter.call(this,data,view_start,view_end,prefs,mode);if(this.prefs.min_value===undefined){this.prefs.min_value=_.min(_.map(this.data,function(d){return d[1]}))||0}if(this.prefs.max_value===undefined){this.prefs.max_value=_.max(_.map(this.data,function(d){return d[1]}))||0}};LinePainter.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};LinePainter.prototype.draw=function(ctx,width,height,w_scale){var in_path=false,min_value=this.prefs.min_value,max_value=this.prefs.max_value,vertical_range=max_value-min_value,height_px=height,view_start=this.view_start,mode=this.mode,data=this.data;ctx.save();var y_zero=Math.round(height+min_value/vertical_range*height);if(mode!=="Intensity"){ctx.fillStyle="#aaa";ctx.fillRect(0,y_zero,width,1)}ctx.beginPath();var x_scaled,y,delta_x_px;if(data.length>1){delta_x_px=Math.ceil((data[1][0]-data[0][0])*w_scale)}else{delta_x_px=10}var painter_color=this.prefs.block_color||this.prefs.color,pref_color=parseInt(painter_color.slice(1),16),pref_r=(pref_color&16711680)>>16,pref_g=(pref_color&65280)>>8,pref_b=pref_color&255,top_overflow=false,bot_overflow=false;for(var i=0,len=data.length;i<len;i++){ctx.fillStyle=ctx.strokeStyle=painter_color;top_overflow=bot_overflow=false;x_scaled=Math.ceil((data[i][0]-view_start)*w_scale);y=data[i][1];if(y===null){if(in_path&&mode==="Filled"){ctx.lineTo(x_scaled,height_px)}in_path=false;continue}if(y<min_value){bot_overflow=true;y=min_value}else{if(y>max_value){top_overflow=true;y=max_value}}if(mode==="Histogram"){y=Math.round(y/vertical_range*height_px);ctx.fillRect(x_scaled,y_zero,delta_x_px,-y)}else{if(mode==="Intensity"){var saturation=(y-min_value)/vertical_range,new_r=Math.round(pref_r+(255-pref_r)*(1-saturation)),new_g=Math.round(pref_g+(255-pref_g)*(1-saturation)),new_b=Math.round(pref_b+(255-pref_b)*(1-saturation));ctx.fillStyle="rgb("+new_r+","+new_g+","+new_b+")";ctx.fillRect(x_scaled,0,delta_x_px,height_px)}else{y=Math.round(height_px-(y-min_value)/vertical_range*height_px);if(in_path){ctx.lineTo(x_scaled,y)}else{in_path=true;if(mode==="Filled"){ctx.moveTo(x_scaled,height_px);ctx.lineTo(x_scaled,y)}else{ctx.moveTo(x_scaled,y)}}}}ctx.fillStyle=this.prefs.overflow_color;if(top_overflow||bot_overflow){var overflow_x;if(mode==="Histogram"||mode==="Intensity"){overflow_x=delta_x_px}else{x_scaled-=2;overflow_x=4}if(top_overflow){ctx.fillRect(x_scaled,0,overflow_x,3)}if(bot_overflow){ctx.fillRect(x_scaled,height_px-3,overflow_x,3)}}ctx.fillStyle=painter_color}if(mode==="Filled"){if(in_path){ctx.lineTo(x_scaled,y_zero);ctx.lineTo(0,y_zero)}ctx.fill()}else{ctx.stroke()}ctx.restore()};var FeaturePositionMapper=function(slot_height){this.feature_positions={};this.slot_height=slot_height;this.translation=0;this.y_translation=0};FeaturePositionMapper.prototype.map_feature_data=function(feature_data,slot,x_start,x_end){if(!this.feature_positions[slot]){this.feature_positions[slot]=[]}this.feature_positions[slot].push({data:feature_data,x_start:x_start,x_end:x_end})};FeaturePositionMapper.prototype.get_feature_data=function(x,y){var slot=Math.floor((y-this.y_translation)/this.slot_height),feature_dict;if(!this.feature_positions[slot]){return null}x+=this.translation;for(var i=0;i<this.feature_positions[slot].length;i++){feature_dict=this.feature_positions[slot][i];if(x>=feature_dict.x_start&&x<=feature_dict.x_end){return feature_dict.data}}};var FeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){Painter.call(this,data,view_start,view_end,prefs,mode);this.alpha_scaler=(alpha_scaler?alpha_scaler:new Scaler());this.height_scaler=(height_scaler?height_scaler:new Scaler());this.max_label_length=200};FeaturePainter.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};_.extend(FeaturePainter.prototype,{get_required_height:function(rows_required,width){var required_height=this.get_row_height(),y_scale=required_height,mode=this.mode;if(mode==="no_detail"||mode==="Squish"||mode==="Pack"){required_height=rows_required*y_scale}return required_height+this.get_top_padding(width)},get_top_padding:function(width){return 0},draw:function(ctx,width,height,w_scale,slots){var data=this.data,view_start=this.view_start,view_end=this.view_end;ctx.save();ctx.fillStyle=this.prefs.block_color;ctx.textAlign="right";var y_scale=this.get_row_height(),feature_mapper=new FeaturePositionMapper(y_scale),x_draw_coords,incomplete_features=[];for(var i=0,len=data.length;i<len;i++){var feature=data[i],feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],slot=(slots&&slots[feature_uid]!==undefined?slots[feature_uid]:null);if((this.mode==="Dense"||slot!==null)&&(feature_start<view_end&&feature_end>view_start)){x_draw_coords=this.draw_element(ctx,this.mode,feature,slot,view_start,view_end,w_scale,y_scale,width);feature_mapper.map_feature_data(feature,slot,x_draw_coords[0],x_draw_coords[1]);if(feature_start<view_start||feature_end>view_end){incomplete_features.push(feature)}}}ctx.restore();feature_mapper.y_translation=this.get_top_padding(width);return new DrawResults({incomplete_features:incomplete_features,feature_mapper:feature_mapper})},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){return[0,0]}});var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=1,DENSE_FEATURE_HEIGHT=9,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,CONNECTOR_COLOR="#ccc";var LinkedFeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){FeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.draw_background_connector=true;this.draw_individual_connectors=false};_.extend(LinkedFeaturePainter.prototype,FeaturePainter.prototype,{get_row_height:function(){var mode=this.mode,height;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="no_detail"){height=NO_DETAIL_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT}}}return height},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){var feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],feature_name=feature[3],feature_strand=feature[4],f_start=Math.floor(Math.max(0,(feature_start-tile_low-0.5)*w_scale)),f_end=Math.ceil(Math.min(width,Math.max(0,(feature_end-tile_low-0.5)*w_scale))),draw_start=f_start,draw_end=f_end,y_start=(mode==="Dense"?0:(0+slot))*y_scale+this.get_top_padding(width),thickness,y_start,thick_start=null,thick_end=null,block_color=(!feature_strand||feature_strand==="+"||feature_strand==="."?this.prefs.block_color:this.prefs.reverse_strand_color);label_color=this.prefs.label_color;ctx.globalAlpha=this.alpha_scaler.gen_val(feature);if(mode==="Dense"){slot=1}if(mode==="no_detail"){ctx.fillStyle=block_color;ctx.fillRect(f_start,y_start+5,f_end-f_start,NO_DETAIL_FEATURE_HEIGHT)}else{var feature_ts=feature[5],feature_te=feature[6],feature_blocks=feature[7],full_height=true;if(feature_ts&&feature_te){thick_start=Math.floor(Math.max(0,(feature_ts-tile_low)*w_scale));thick_end=Math.ceil(Math.min(width,Math.max(0,(feature_te-tile_low)*w_scale)))}var thin_height,thick_height;if(mode==="Squish"){thin_height=1;thick_height=SQUISH_FEATURE_HEIGHT;full_height=false}else{if(mode==="Dense"){thin_height=5;thick_height=DENSE_FEATURE_HEIGHT}else{thin_height=5;thick_height=PACK_FEATURE_HEIGHT}}if(!feature_blocks){ctx.fillStyle=block_color;ctx.fillRect(f_start,y_start+1,f_end-f_start,thick_height);if(feature_strand&&full_height){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand_inv")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand_inv")}}ctx.fillRect(f_start,y_start+1,f_end-f_start,thick_height)}}else{var cur_y_start,cur_height;if(mode==="Squish"||mode==="Dense"){cur_y_start=y_start+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;cur_height=1}else{if(feature_strand){cur_y_start=y_start;cur_height=thick_height}else{cur_y_start+=(SQUISH_FEATURE_HEIGHT/2)+1;cur_height=1}}if(this.draw_background_connector){if(mode==="Squish"||mode==="Dense"){ctx.fillStyle=CONNECTOR_COLOR}else{if(feature_strand){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand")}}}else{ctx.fillStyle=CONNECTOR_COLOR}}ctx.fillRect(f_start,cur_y_start,f_end-f_start,cur_height)}var start_and_height;for(var k=0,k_len=feature_blocks.length;k<k_len;k++){var block=feature_blocks[k],block_start=Math.floor(Math.max(0,(block[0]-tile_low-0.5)*w_scale)),block_end=Math.ceil(Math.min(width,Math.max((block[1]-tile_low-0.5)*w_scale))),last_block_start,last_block_end;if(block_start>block_end){continue}ctx.fillStyle=block_color;ctx.fillRect(block_start,y_start+(thick_height-thin_height)/2+1,block_end-block_start,thin_height);if(thick_start!==undefined&&feature_te>feature_ts&&!(block_start>thick_end||block_end<thick_start)){var block_thick_start=Math.max(block_start,thick_start),block_thick_end=Math.min(block_end,thick_end);ctx.fillRect(block_thick_start,y_start+1,block_thick_end-block_thick_start,thick_height);if(feature_blocks.length===1&&mode==="Pack"){if(feature_strand==="+"){ctx.fillStyle=ctx.canvas.manager.get_pattern("right_strand_inv")}else{if(feature_strand==="-"){ctx.fillStyle=ctx.canvas.manager.get_pattern("left_strand_inv")}}if(block_thick_start+14<block_thick_end){block_thick_start+=2;block_thick_end-=2}ctx.fillRect(block_thick_start,y_start+1,block_thick_end-block_thick_start,thick_height)}}if(this.draw_individual_connectors&&last_block_start){this.draw_connector(ctx,last_block_start,last_block_end,block_start,block_end,y_start)}last_block_start=block_start;last_block_end=block_end}if(mode==="Pack"){ctx.globalAlpha=1;ctx.fillStyle="white";var hscale_factor=this.height_scaler.gen_val(feature),new_height=Math.ceil(thick_height*hscale_factor),ws_height=Math.round((thick_height-new_height)/2);if(hscale_factor!==1){ctx.fillRect(f_start,cur_y_start+1,f_end-f_start,ws_height);ctx.fillRect(f_start,cur_y_start+thick_height-ws_height+1,f_end-f_start,ws_height)}}}ctx.globalAlpha=1;if(feature_name&&mode==="Pack"&&feature_start>tile_low){ctx.fillStyle=label_color;if(tile_low===0&&f_start-ctx.measureText(feature_name).width<0){ctx.textAlign="left";ctx.fillText(feature_name,f_end+LABEL_SPACING,y_start+8,this.max_label_length);draw_end+=ctx.measureText(feature_name).width+LABEL_SPACING}else{ctx.textAlign="right";ctx.fillText(feature_name,f_start-LABEL_SPACING,y_start+8,this.max_label_length);draw_start-=ctx.measureText(feature_name).width+LABEL_SPACING}}}ctx.globalAlpha=1;return[draw_start,draw_end]}});var ReadPainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler,ref_seq,base_color_fn){FeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.ref_seq=(ref_seq?ref_seq.data:null);this.base_color_fn=base_color_fn};_.extend(ReadPainter.prototype,FeaturePainter.prototype,{get_row_height:function(){var height,mode=this.mode;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT;if(this.prefs.show_insertions){height*=2}}}return height},_parse_cigar:function(cigar_str){var cigar_ops="MIDNSHP=X";var blocks=[[0,0]],cur_block=blocks[0],base_pos=0,parsed_cigar=_.map(cigar_str.match(/[0-9]+[MIDNSHP=X]/g),function(op){var op_len=parseInt(op.slice(0,-1),10),op_char=op.slice(-1);if(op_char==="N"){if(cur_block[1]!==0){cur_block=[base_pos+op_len,base_pos+op_len];blocks.push(cur_block)}}else{if("ISHP".indexOf(op_char)===-1){cur_block[1]+=op_len;base_pos+=op_len}}return[cigar_ops.indexOf(op_char),op_len]});return{blocks:blocks,cigar:parsed_cigar}},draw_read:function(ctx,mode,w_scale,y_start,tile_low,tile_high,feature_start,cigar,strand,read_seq){var update_base_offset=function(offset,cig_op,cig_len){if("M=NXD".indexOf(cig_op)!==-1){offset+=cig_len}return offset},update_seq_offset=function(offset,cig_op,cig_len){if("IX".indexOf(cig_op)!==-1){offset+=cig_len}return offset},get_draw_coord=function(sequence_coord){return Math.floor(Math.max(0,(sequence_coord-tile_low-0.5)*w_scale))};ctx.textAlign="center";var tile_region=[tile_low,tile_high],base_offset=0,seq_offset=0,gap=Math.round(w_scale/2),char_width_px=ctx.canvas.manager.char_width_px,block_color=(strand==="+"?this.prefs.detail_block_color:this.prefs.reverse_strand_color),pack_mode=(mode==="Pack"),draw_height=(pack_mode?PACK_FEATURE_HEIGHT:SQUISH_FEATURE_HEIGHT),rect_y=y_start+1,paint_utils=new ReadPainterUtils(ctx,draw_height,w_scale,mode),drawing_blocks=[],s_start,s_end;var draw_last=[];var t=this._parse_cigar(cigar);cigar=t.cigar;drawing_blocks=t.blocks;for(var i=0;i<drawing_blocks.length;i++){var block=drawing_blocks[i];if(is_overlap([feature_start+block[0],feature_start+block[1]],tile_region)){s_start=get_draw_coord(feature_start+block[0]);s_end=get_draw_coord(feature_start+block[1]);if(s_start===s_end){s_end+=1}ctx.fillStyle=block_color;ctx.fillRect(s_start,rect_y,s_end-s_start,draw_height)}}for(var cig_id=0,len=cigar.length;cig_id<len;cig_id++){var cig=cigar[cig_id],cig_op="MIDNSHP=X"[cig[0]],cig_len=cig[1];var seq_start=feature_start+base_offset;s_start=get_draw_coord(seq_start);s_end=get_draw_coord(seq_start+cig_len);if(!is_overlap([seq_start,seq_start+cig_len],tile_region)){base_offset=update_base_offset(base_offset,cig_op,cig_len);seq_offset=update_seq_offset(seq_offset,cig_op,cig_len);continue}if(s_start===s_end){s_end+=1}switch(cig_op){case"H":case"S":case"P":break;case"M":base_offset+=cig_len;break;case"=":case"X":var cur_seq="";if(cig_op==="X"){cur_seq=read_seq.slice(seq_offset,seq_offset+cig_len)}else{if(this.ref_seq){cur_seq=this.ref_seq.slice(Math.max(0,seq_start-tile_low),Math.min(seq_start-tile_low+cig_len,tile_high-tile_low))}}var start_pos=Math.max(seq_start,tile_low);for(var c=0;c<cur_seq.length;c++){if(cur_seq&&!this.prefs.show_differences||cig_op==="X"){var c_start=Math.floor(Math.max(0,(start_pos+c-tile_low)*w_scale));ctx.fillStyle=this.base_color_fn(cur_seq[c]);if(pack_mode&&w_scale>char_width_px){ctx.fillText(cur_seq[c],c_start,y_start+9)}else{if(w_scale>0.05){ctx.fillRect(c_start-gap,rect_y,Math.max(1,Math.round(w_scale)),draw_height)}}}}if(cig_op==="X"){seq_offset+=cig_len}base_offset+=cig_len;break;case"N":ctx.fillStyle=CONNECTOR_COLOR;ctx.fillRect(s_start,rect_y+(draw_height-1)/2,s_end-s_start,1);base_offset+=cig_len;break;case"D":paint_utils.draw_deletion(s_start,rect_y,cig_len);base_offset+=cig_len;break;case"I":var insert_x_coord=s_start-gap;if(is_overlap([seq_start,seq_start+cig_len],tile_region)){var seq=read_seq.slice(seq_offset,seq_offset+cig_len);if(this.prefs.show_insertions){var x_center=s_start-(s_end-s_start)/2;if((mode==="Pack"||this.mode==="Auto")&&read_seq!==undefined&&w_scale>char_width_px){ctx.fillStyle="yellow";ctx.fillRect(x_center-gap,y_start-9,s_end-s_start,9);draw_last[draw_last.length]={type:"triangle",data:[insert_x_coord,y_start+4,5]};ctx.fillStyle=CONNECTOR_COLOR;switch(compute_overlap([seq_start,seq_start+cig_len],tile_region)){case (OVERLAP_START):seq=seq.slice(tile_low-seq_start);break;case (OVERLAP_END):seq=seq.slice(0,seq_start-tile_high);break;case (CONTAINED_BY):break;case (CONTAINS):seq=seq.slice(tile_low-seq_start,seq_start-tile_high);break}for(var c=0,str_len=seq.length;c<str_len;c++){var c_start=Math.floor(Math.max(0,(seq_start+c-tile_low)*w_scale));ctx.fillText(seq[c],c_start-(s_end-s_start)/2,y_start)}}else{ctx.fillStyle="yellow";ctx.fillRect(x_center,y_start+(this.mode!=="Dense"?2:5),s_end-s_start,(mode!=="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}else{if((mode==="Pack"||this.mode==="Auto")&&read_seq!==undefined&&w_scale>char_width_px){draw_last.push({type:"text",data:[seq.length,insert_x_coord,y_start+9]})}else{}}}seq_offset+=cig_len;break}}ctx.fillStyle="yellow";var item,type,data;for(var i=0;i<draw_last.length;i++){item=draw_last[i];type=item.type;data=item.data;if(type==="text"){ctx.save();ctx.font="bold "+ctx.font;ctx.fillText(data[0],data[1],data[2]);ctx.restore()}else{if(type==="triangle"){drawDownwardEquilateralTriangle(ctx,data[0],data[1],data[2])}}}},draw_element:function(ctx,mode,feature,slot,tile_low,tile_high,w_scale,y_scale,width){var feature_uid=feature[0],feature_start=feature[1],feature_end=feature[2],feature_name=feature[3],f_start=Math.floor(Math.max(-0.5*w_scale,(feature_start-tile_low-0.5)*w_scale)),f_end=Math.ceil(Math.min(width,Math.max(0,(feature_end-tile_low-0.5)*w_scale))),y_start=(mode==="Dense"?0:(0+slot))*y_scale,draw_height=(mode==="Pack"?PACK_FEATURE_HEIGHT:SQUISH_FEATURE_HEIGHT),label_color=this.prefs.label_color;if(feature[5] instanceof Array){var connector=true;if(feature[4][1]>=tile_low&&feature[4][0]<=tile_high&&feature[4][2]){this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature[4][0],feature[4][2],feature[4][3],feature[4][4])}else{connector=false}if(feature[5][1]>=tile_low&&feature[5][0]<=tile_high&&feature[5][2]){this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature[5][0],feature[5][2],feature[5][3],feature[5][4])}else{connector=false}var b1_end=Math.ceil(Math.min(width,Math.max(-0.5*w_scale,(feature[4][1]-tile_low-0.5)*w_scale))),b2_start=Math.floor(Math.max(-0.5*w_scale,(feature[5][0]-tile_low-0.5)*w_scale));if(connector&&b2_start>b1_end){ctx.fillStyle=CONNECTOR_COLOR;var line_height=y_start+1+(draw_height-1)/2;dashedLine(ctx,b1_end,line_height,b2_start,line_height)}}else{this.draw_read(ctx,mode,w_scale,y_start,tile_low,tile_high,feature_start,feature[4],feature[5],feature[6])}if(mode==="Pack"&&feature_start>=tile_low&&feature_name!=="."){ctx.fillStyle=this.prefs.label_color;if(tile_low===0&&f_start-ctx.measureText(feature_name).width<0){ctx.textAlign="left";ctx.fillText(feature_name,f_end+LABEL_SPACING,y_start+9,this.max_label_length)}else{ctx.textAlign="right";ctx.fillText(feature_name,f_start-LABEL_SPACING,y_start+9,this.max_label_length)}}return[0,0]}});var ArcLinkedFeaturePainter=function(data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler){LinkedFeaturePainter.call(this,data,view_start,view_end,prefs,mode,alpha_scaler,height_scaler);this.longest_feature_length=this.calculate_longest_feature_length();this.draw_background_connector=false;this.draw_individual_connectors=true};_.extend(ArcLinkedFeaturePainter.prototype,FeaturePainter.prototype,LinkedFeaturePainter.prototype,{calculate_longest_feature_length:function(){var longest_feature_length=0;for(var i=0,len=this.data.length;i<len;i++){var feature=this.data[i],feature_start=feature[1],feature_end=feature[2];longest_feature_length=Math.max(longest_feature_length,feature_end-feature_start)}return longest_feature_length},get_top_padding:function(width){var view_range=this.view_end-this.view_start,w_scale=width/view_range;return Math.min(128,Math.ceil((this.longest_feature_length/2)*w_scale))},draw_connector:function(ctx,block1_start,block1_end,block2_start,block2_end,y_start){var x_center=(block1_end+block2_start)/2,radius=block2_start-x_center;var angle1=Math.PI,angle2=0;if(radius>0){ctx.beginPath();ctx.arc(x_center,y_start,block2_start-x_center,Math.PI,0);ctx.stroke()}}});var Color=function(rgb,a){if(Array.isArray(rgb)){this.rgb=rgb}else{if(rgb.length==6){this.rgb=rgb.match(/.{2}/g).map(function(c){return parseInt(c,16)})}else{if(rgb.length==7){this.rgb=rgb.substring(1,7).match(/.{2}/g).map(function(c){return parseInt(c,16)})}else{this.rgb=rgb.split("").map(function(c){return parseInt(c+c,16)})}}}this.alpha=typeof(a)==="number"?a:1};Color.prototype={eval:function(){return this},toCSS:function(){if(this.alpha<1){return"rgba("+this.rgb.map(function(c){return Math.round(c)}).concat(this.alpha).join(", ")+")"}else{return"#"+this.rgb.map(function(i){i=Math.round(i);i=(i>255?255:(i<0?0:i)).toString(16);return i.length===1?"0"+i:i}).join("")}},toHSL:function(){var r=this.rgb[0]/255,g=this.rgb[1]/255,b=this.rgb[2]/255,a=this.alpha;var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2,d=max-min;if(max===min){h=s=0}else{s=l>0.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break}h/=6}return{h:h*360,s:s,l:l,a:a}},toARGB:function(){var argb=[Math.round(this.alpha*255)].concat(this.rgb);return"#"+argb.map(function(i){i=Math.round(i);i=(i>255?255:(i<0?0:i)).toString(16);return i.length===1?"0"+i:i}).join("")},mix:function(color2,weight){color1=this;var p=weight;var w=p*2-1;var a=color1.toHSL().a-color2.toHSL().a;var w1=(((w*a==-1)?w:(w+a)/(1+w*a))+1)/2;var w2=1-w1;var rgb=[color1.rgb[0]*w1+color2.rgb[0]*w2,color1.rgb[1]*w1+color2.rgb[1]*w2,color1.rgb[2]*w1+color2.rgb[2]*w2];var alpha=color1.alpha*p+color2.alpha*(1-p);return new Color(rgb,alpha)}};var LinearRamp=function(start_color,end_color,start_value,end_value){this.start_color=new Color(start_color);this.end_color=new Color(end_color);this.start_value=start_value;this.end_value=end_value;this.value_range=end_value-start_value};LinearRamp.prototype.map_value=function(value){value=Math.max(value,this.start_value);value=Math.min(value,this.end_value);value=(value-this.start_value)/this.value_range;return this.start_color.mix(this.end_color,1-value).toCSS()};var SplitRamp=function(start_color,middle_color,end_color,start_value,end_value){this.positive_ramp=new LinearRamp(middle_color,end_color,0,end_value);this.negative_ramp=new LinearRamp(middle_color,start_color,0,-start_value);this.start_value=start_value;this.end_value=end_value};SplitRamp.prototype.map_value=function(value){value=Math.max(value,this.start_value);value=Math.min(value,this.end_value);if(value>=0){return this.positive_ramp.map_value(value)}else{return this.negative_ramp.map_value(-value)}};var DiagonalHeatmapPainter=function(data,view_start,view_end,prefs,mode){Painter.call(this,data,view_start,view_end,prefs,mode);var i,len;if(this.prefs.min_value===undefined){var min_value=Infinity;for(i=0,len=this.data.length;i<len;i++){min_value=Math.min(min_value,this.data[i][5])}this.prefs.min_value=min_value}if(this.prefs.max_value===undefined){var max_value=-Infinity;for(i=0,len=this.data.length;i<len;i++){max_value=Math.max(max_value,this.data[i][5])}this.prefs.max_value=max_value}};DiagonalHeatmapPainter.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Heatmap",pos_color:"#FF8C00",neg_color:"#4169E1"};DiagonalHeatmapPainter.prototype.draw=function(ctx,width,height,w_scale){var min_value=this.prefs.min_value,max_value=this.prefs.max_value,value_range=max_value-min_value,height_px=height,view_start=this.view_start,mode=this.mode,data=this.data,invsqrt2=1/Math.sqrt(2);var ramp=(new SplitRamp(this.prefs.neg_color,"#FFFFFF",this.prefs.pos_color,min_value,max_value));var d,s1,e1,s2,e2,value;var scale=function(p){return(p-view_start)*w_scale};ctx.save();ctx.rotate(-45*Math.PI/180);ctx.scale(invsqrt2,invsqrt2);for(var i=0,len=data.length;i<len;i++){d=data[i];s1=scale(d[1]);e1=scale(d[2]);s2=scale(d[4]);e2=scale(d[5]);value=d[6];ctx.fillStyle=(ramp.map_value(value));ctx.fillRect(s1,s2,(e1-s1),(e2-s2))}ctx.restore()};var ReadPainterUtils=function(ctx,row_height,px_per_base,mode){this.ctx=ctx;this.row_height=row_height;this.px_per_base=px_per_base;this.draw_details=(mode==="Pack"||mode==="Auto")&&(px_per_base>=ctx.canvas.manager.char_width_px);this.delete_details_thickness=0.2};_.extend(ReadPainterUtils.prototype,{draw_deletion:function(x,y,len){this.ctx.fillStyle="black";var thickness=(this.draw_details?this.delete_details_thickness:1)*this.row_height;y+=0.5*(this.row_height-thickness);this.ctx.fillRect(x,y,len*this.px_per_base,thickness)}});var VariantPainter=function(data,view_start,view_end,prefs,mode,base_color_fn){Painter.call(this,data,view_start,view_end,prefs,mode);this.base_color_fn=base_color_fn;this.divider_height=1};_.extend(VariantPainter.prototype,Painter.prototype,{get_row_height:function(){var mode=this.mode,height;if(mode==="Dense"){height=DENSE_TRACK_HEIGHT}else{if(mode==="Squish"){height=SQUISH_TRACK_HEIGHT}else{height=PACK_TRACK_HEIGHT}}return height},get_required_height:function(num_samples){var height=this.prefs.summary_height;if(num_samples>1&&this.prefs.show_sample_data){height+=this.divider_height+num_samples*this.get_row_height()}return height},draw:function(ctx,width,height,w_scale){ctx.save();var get_deletion_info=function(ref,alt){var ref_len=ref.length,alt_len=alt.length,start=0,len=1,is_delete=false;if(alt==="-"){is_delete=true;len=ref.length}else{if(ref.indexOf(alt)===0&&ref_len>alt_len){is_delete=true;len=ref_len=alt_len;start+=alt_len}}return(is_delete?{start:start,len:len}:null)};var locus_data,pos,id,ref,alt,qual,filter,sample_gts,allele_counts,variant,draw_x_start,char_x_start,draw_y_start,genotype,base_px=Math.max(1,Math.floor(w_scale)),num_samples=(this.data.length?this.data[0][7].split(",").length:0),row_height=(this.mode==="Squish"?SQUISH_TRACK_HEIGHT:PACK_TRACK_HEIGHT),feature_height=(w_scale<0.1?row_height:(this.mode==="Squish"?SQUISH_FEATURE_HEIGHT:PACK_FEATURE_HEIGHT)),draw_summary=true,paint_utils=new ReadPainterUtils(ctx,row_height,w_scale,this.mode),j;if(num_samples===1){row_height=feature_height=(w_scale<ctx.canvas.manager.char_width_px?this.prefs.summary_height:row_height);paint_utils.row_height=row_height;draw_summary=false}if(this.prefs.show_sample_data&&draw_summary){ctx.fillStyle="#F3F3F3";ctx.globalAlpha=1;ctx.fillRect(0,this.prefs.summary_height-this.divider_height,width,this.divider_height)}ctx.textAlign="center";for(var i=0;i<this.data.length;i++){locus_data=this.data[i];pos=locus_data[1];ref=locus_data[3];alt=[locus_data[4].split(",")];sample_gts=locus_data[7].split(",");allele_counts=locus_data.slice(8);alt=_.map(_.flatten(alt),function(a){var type,alt_info={},delete_info=get_deletion_info(ref,a);if(delete_info){type="deletion";_.extend(alt_info,delete_info)}else{type="snp"}return _.extend(alt_info,{type:type,value:a,})});if(pos<this.view_start||pos>this.view_end){continue}draw_x_start=Math.floor(Math.max(-0.5*w_scale,(pos-this.view_start-0.5)*w_scale));char_x_start=Math.floor(Math.max(0,(pos-this.view_start)*w_scale));if(draw_summary){ctx.fillStyle="#999999";ctx.globalAlpha=1;ctx.fillRect(draw_x_start,0,base_px,this.prefs.summary_height);draw_y_start=this.prefs.summary_height;for(j=0;j<alt.length;j++){ctx.fillStyle=(alt[j].type==="deletion"?"black":this.base_color_fn(alt[j].value));allele_frac=allele_counts/sample_gts.length;draw_height=Math.ceil(this.prefs.summary_height*allele_frac);ctx.fillRect(draw_x_start,draw_y_start-draw_height,base_px,draw_height);draw_y_start-=draw_height}}if(!this.prefs.show_sample_data){continue}draw_y_start=(draw_summary?this.prefs.summary_height+this.divider_height:0);for(j=0;j<sample_gts.length;j++,draw_y_start+=row_height){genotype=(sample_gts[j]?sample_gts[j].split(/\/|\|/):["0","0"]);variant=null;if(genotype[0]===genotype[1]){if(genotype[0]==="."){}else{if(genotype[0]!=="0"){variant=alt[parseInt(genotype[0],10)-1];ctx.globalAlpha=1}}}else{variant=(genotype[0]!=="0"?genotype[0]:genotype[1]);variant=alt[parseInt(variant,10)-1];ctx.globalAlpha=0.5}if(variant){if(variant.type==="snp"){var snp=variant.value;ctx.fillStyle=this.base_color_fn(snp);if(paint_utils.draw_details){ctx.fillText(snp,char_x_start,draw_y_start+row_height)}else{ctx.fillRect(draw_x_start,draw_y_start+1,base_px,feature_height)}}else{if(variant.type==="deletion"){paint_utils.draw_deletion(draw_x_start+base_px*variant.start,draw_y_start+1,variant.len)}else{}}}}}ctx.restore()}});return{Scaler:Scaler,LinePainter:LinePainter,LinkedFeaturePainter:LinkedFeaturePainter,ReadPainter:ReadPainter,ArcLinkedFeaturePainter:ArcLinkedFeaturePainter,DiagonalHeatmapPainter:DiagonalHeatmapPainter,VariantPainter:VariantPainter}});
\ No newline at end of file
diff -r dd2d3e453ed074f152751bf5d9ea281ed60abc80 -r 2d9628d776a22cc6f0a3629176c0ee04de8be422 static/scripts/viz/trackster/painters.js
--- a/static/scripts/viz/trackster/painters.js
+++ b/static/scripts/viz/trackster/painters.js
@@ -907,7 +907,7 @@
break;
case "N": // Skipped bases.
ctx.fillStyle = CONNECTOR_COLOR;
- ctx.fillRect(s_start, y_start + 5, s_end - s_start, 1);
+ ctx.fillRect(s_start, rect_y + (draw_height - 1)/2, s_end - s_start, 1);
// No change in seq_offset because sequence not used when skipping.
base_offset += cig_len;
break;
@@ -1017,6 +1017,7 @@
f_start = Math.floor( Math.max(-0.5 * w_scale, (feature_start - tile_low - 0.5) * w_scale) ),
f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low - 0.5) * w_scale)) ),
y_start = (mode === "Dense" ? 0 : (0 + slot)) * y_scale,
+ draw_height = (mode === 'Pack' ? PACK_FEATURE_HEIGHT : SQUISH_FEATURE_HEIGHT),
label_color = this.prefs.label_color;
// Draw read.
@@ -1049,7 +1050,8 @@
b2_start = Math.floor( Math.max(-0.5 * w_scale, (feature[5][0] - tile_low - 0.5) * w_scale) );
if (connector && b2_start > b1_end) {
ctx.fillStyle = CONNECTOR_COLOR;
- dashedLine(ctx, b1_end, y_start + 5, b2_start, y_start + 5);
+ var line_height = y_start + 1 + (draw_height - 1)/2;
+ dashedLine(ctx, b1_end, line_height, b2_start, line_height);
}
} else {
// Read is single.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: HDA/Collections client-side refactoring for drill down view
by commits-noreply@bitbucket.org 11 Aug '14
by commits-noreply@bitbucket.org 11 Aug '14
11 Aug '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/700560884da7/
Changeset: 700560884da7
User: carlfeberhard
Date: 2014-08-11 17:07:34
Summary: HDA/Collections client-side refactoring for drill down view
Affected #: 48 files
diff -r bdc4017c2e7e9ecb5dfa3d36798f535402ec80aa -r 700560884da71e8bd3bdad6ddbe4edfde9566f7f static/scripts/mvc/base-mvc.js
--- a/static/scripts/mvc/base-mvc.js
+++ b/static/scripts/mvc/base-mvc.js
@@ -53,6 +53,7 @@
//==============================================================================
/** Backbone model that syncs to the browser's sessionStorage API.
+ * This all largely happens behind the scenes and no special calls are required.
*/
var SessionStorageModel = Backbone.Model.extend({
initialize : function( initialAttrs ){
@@ -147,13 +148,128 @@
//==============================================================================
+/** A mixin for models that allow T/F/Matching to their attributes - useful when
+ * searching or filtering collections of models.
+ * @example:
+ * see hda-model for searchAttribute and searchAliases definition examples.
+ * see history-contents.matches for how collections are filtered
+ * and see readonly-history-panel.searchHdas for how user input is connected to the filtering
+ */
+var SearchableModelMixin = {
+
+ /** what attributes of an HDA will be used in a text search */
+ searchAttributes : [
+ // override
+ ],
+
+ /** our attr keys don't often match the labels we display to the user - so, when using
+ * attribute specifiers ('name="bler"') in a term, allow passing in aliases for the
+ * following attr keys.
+ */
+ searchAliases : {
+ // override
+ },
+
+ /** search the attribute with key attrKey for the string searchFor; T/F if found */
+ searchAttribute : function( attrKey, searchFor ){
+ var attrVal = this.get( attrKey );
+ //this.debug( 'searchAttribute', attrKey, attrVal, searchFor );
+ // bail if empty searchFor or unsearchable values
+ if( !searchFor
+ || ( attrVal === undefined || attrVal === null ) ){
+ return false;
+ }
+ // pass to sep. fn for deep search of array attributes
+ if( _.isArray( attrVal ) ){ return this._searchArrayAttribute( attrVal, searchFor ); }
+ return ( attrVal.toString().toLowerCase().indexOf( searchFor.toLowerCase() ) !== -1 );
+ },
+
+ /** deep(er) search for array attributes; T/F if found */
+ _searchArrayAttribute : function( array, searchFor ){
+ //this.debug( '_searchArrayAttribute', array, searchFor );
+ searchFor = searchFor.toLowerCase();
+ //precondition: searchFor has already been validated as non-empty string
+ //precondition: assumes only 1 level array
+ //TODO: could possibly break up searchFor more (CSV...)
+ return _.any( array, function( elem ){
+ return ( elem.toString().toLowerCase().indexOf( searchFor.toLowerCase() ) !== -1 );
+ });
+ },
+
+ /** search all searchAttributes for the string searchFor,
+ * returning a list of keys of attributes that contain searchFor
+ */
+ search : function( searchFor ){
+ var model = this;
+ return _.filter( this.searchAttributes, function( key ){
+ return model.searchAttribute( key, searchFor );
+ });
+ },
+
+ /** alias of search, but returns a boolean; accepts attribute specifiers where
+ * the attributes searched can be narrowed to a single attribute using
+ * the form: matches( 'genome_build=hg19' )
+ * (the attribute keys allowed can also be aliases to the true attribute key;
+ * see searchAliases above)
+ * @param {String} term plain text or ATTR_SPECIFIER sep. key=val pair
+ * @returns {Boolean} was term found in (any) attribute(s)
+ */
+ matches : function( term ){
+ var ATTR_SPECIFIER = '=',
+ split = term.split( ATTR_SPECIFIER );
+ // attribute is specified - search only that
+ if( split.length >= 2 ){
+ var attrKey = split[0];
+ attrKey = this.searchAliases[ attrKey ] || attrKey;
+ return this.searchAttribute( attrKey, split[1] );
+ }
+ // no attribute is specified - search all attributes in searchAttributes
+ return !!this.search( term ).length;
+ },
+
+ /** an implicit AND search for all terms; IOW, a model must match all terms given
+ * where terms is a whitespace separated value string.
+ * e.g. given terms of: 'blah bler database=hg19'
+ * an HDA would have to have attributes containing blah AND bler AND a genome_build == hg19
+ * To include whitespace in terms: wrap the term in double quotations (name="blah bler").
+ */
+ matchesAll : function( terms ){
+ var model = this;
+ // break the terms up by whitespace and filter out the empty strings
+ terms = terms.match( /(".*"|\w*=".*"|\S*)/g ).filter( function( s ){ return !!s; });
+ return _.all( terms, function( term ){
+ term = term.replace( /"/g, '' );
+ return model.matches( term );
+ });
+ }
+};
+
+
+//==============================================================================
+/** A view that renders hidden and shows when some activator is clicked.
+ * options:
+ * showFn: the effect used to show/hide the View (defaults to jq.toggle)
+ * $elementShown: some jqObject (defaults to this.$el) to be shown/hidden
+ * onShowFirstTime: fn called the first time the view is shown
+ * onshow: fn called every time the view is shown
+ * onhide: fn called every time the view is hidden
+ * events:
+ * hiddenUntilActivated:shown (the view is passed as an arg)
+ * hiddenUntilActivated:hidden (the view is passed as an arg)
+ * instance vars:
+ * view.hidden {boolean} is the view in the hidden state
+ */
var HiddenUntilActivatedViewMixin = /** @lends hiddenUntilActivatedMixin# */{
//TODO: since this is a mixin, consider moving toggle, hidden into HUAVOptions
- /** */
+ /** call this in your initialize to set up the mixin
+ * @param {jQuery} $activator the 'button' that's clicked to show/hide the view
+ * @param {Object} hash with mixin options
+ */
hiddenUntilActivated : function( $activator, options ){
// call this in your view's initialize fn
options = options || {};
+//TODO: flesh out options - show them all here
this.HUAVOptions = {
$elementShown : this.$el,
showFn : jQuery.prototype.toggle,
@@ -172,12 +288,15 @@
}
},
+//TODO:?? remove? use .hidden?
+ /** returns T/F if the view is hidden */
isHidden : function(){
return ( this.HUAVOptions.$elementShown.is( ':hidden' ) );
},
- /** */
+ /** toggle the hidden state, show/hide $elementShown, call onshow/hide, trigger events */
toggle : function(){
+//TODO: more specific name - toggle is too general
// can be called manually as well with normal toggle arguments
//TODO: better as a callback (when the show/hide is actually done)
// show
@@ -207,60 +326,101 @@
}
};
+
//==============================================================================
+/** Function that allows mixing of hashs into bbone MVC while showing the mixins first
+ * (before the more local class overrides/hash).
+ * Basically, a simple reversal of param order on _.defaults() - to show mixins in top of definition.
+ * @example:
+ * var NewModel = Something.extend( mixin( MyMixinA, MyMixinB, { ... myVars : ... }) );
+ *
+ * NOTE: this does not combine any hashes (like events, etc.) and you're expected to handle that
+ */
function mixin( mixinHash1, /* mixinHash2, etc: ... variadic */ propsHash ){
- // usage: var NewModel = Something.extend( mixin( MyMixinA, MyMixinB, { ... }) );
- //NOTE: this does not combine any hashes (like events, etc.) and you're expected to handle that
-
- // simple reversal of param order on _.defaults() - to show mixins in top of definition
var args = Array.prototype.slice.call( arguments, 0 ),
lastArg = args.pop();
args.unshift( lastArg );
return _.defaults.apply( _, args );
}
+//==============================================================================
+/** Return an underscore template fn from an array of strings.
+ * @param {String[]} template the template strings to compile into the underscore template fn
+ * @param {String} jsonNamespace an optional namespace for the json data passed in (defaults to 'model')
+ * @returns {Function} the (wrapped) underscore template fn
+ * The function accepts:
+ *
+ * The template strings can access:
+ * the json/model hash using model ("<%- model.myAttr %>) using the jsonNamespace above
+ * _l: the localizer function
+ * view (if passed): ostensibly, the view using the template (handy for view instance vars)
+ * Because they're namespaced, undefined attributes will not throw an error.
+ *
+ * @example:
+ * templateBler : BASE_MVC.wrapTemplate([
+ * '<div class="myclass <%- mynamespace.modelClass %>">',
+ * '<span><% print( _l( mynamespace.message ) ); %>:<%= view.status %></span>'
+ * '</div>'
+ * ], 'mynamespace' )
+ *
+ * Meant to be called in a View's definition in order to compile only once.
+ *
+ */
+function wrapTemplate( template, jsonNamespace ){
+ jsonNamespace = jsonNamespace || 'model';
+ var templateFn = _.template( template.join( '' ) );
+ return function( json, view ){
+ var templateVars = { view : view || {}, _l : _l };
+ templateVars[ jsonNamespace ] = json || {};
+ return templateFn( templateVars );
+ };
+}
//==============================================================================
+/** A view which, when first rendered, shows only summary data/attributes, but
+ * can be expanded to show further details (and optionally fetch those
+ * details from the server).
+ */
var ExpandableView = Backbone.View.extend( LoggableMixin ).extend({
//TODO: Although the reasoning behind them is different, this shares a lot with HiddenUntilActivated above: combine them
//PRECONDITION: model must have method hasDetails
+ //PRECONDITION: subclasses must have templates.el and templates.details
initialize : function( attributes ){
/** are the details of this view expanded/shown or not? */
this.expanded = attributes.expanded || false;
- this.log( '\t expanded:', this.expanded );
+ //this.log( '\t expanded:', this.expanded );
},
// ........................................................................ render main
-//TODO: for lack of a better place, add rendering logic here
+ /** jq fx speed */
fxSpeed : 'fast',
/** Render this content, set up ui.
- * @param {Integer} speed the speed of the render
- * @fires rendered when rendered
- * @fires rendered:ready when first rendered and NO running HDAs
- * @returns {Object} this HDABaseView
+ * @param {Number or String} speed the speed of the render
*/
render : function( speed ){
var $newRender = this._buildNewRender();
+ this._setUpBehaviors( $newRender );
this._queueNewRender( $newRender, speed );
return this;
},
+ /** Build a temp div containing the new children for the view's $el.
+ * If the view is already expanded, build the details as well.
+ */
_buildNewRender : function(){
// create a new render using a skeleton template, render title buttons, render body, and set up events, etc.
- var $newRender = $( this.templates.skeleton( this.model.toJSON() ) );
+ var $newRender = $( this.templates.el( this.model.toJSON(), this ) );
if( this.expanded ){
- $newRender.children( '.details' ).replaceWith( this._renderDetails() );
+ this.$details( $newRender ).replaceWith( this._renderDetails().show() );
}
- this._setUpBehaviors( $newRender );
return $newRender;
},
- /** Fade out the old el, replace with new dom, then fade in.
- * @param {Boolean} fade whether or not to fade out/in when re-rendering
+ /** Fade out the old el, swap in the new contents, then fade in.
+ * @param {Number or String} speed jq speed to use for rendering effects
* @fires rendered when rendered
- * @fires rendered:ready when first rendered and NO running HDAs
*/
_queueNewRender : function( $newRender, speed ) {
speed = ( speed === undefined )?( this.fxSpeed ):( speed );
@@ -280,6 +440,7 @@
]);
},
+ /** empty out the current el, move the $newRender's children in */
_swapNewRender : function( $newRender ){
return this.$el.empty().attr( 'class', this.className ).append( $newRender.children() );
},
@@ -287,21 +448,29 @@
/** set up js behaviors, event handlers for elements within the given container
* @param {jQuery} $container jq object that contains the elements to process (defaults to this.$el)
*/
- _setUpBehaviors : function( $container ){
- $container = $container || this.$el;
+ _setUpBehaviors : function( $where ){
+ $where = $where || this.$el;
// set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)
- make_popup_menus( $container );
- $container.find( '[title]' ).tooltip({ placement : 'bottom' });
+ make_popup_menus( $where );
+ $where.find( '[title]' ).tooltip({ placement : 'bottom' });
},
// ......................................................................... details
+ /** shortcut to details DOM (as jQ) */
+ $details : function( $where ){
+ $where = $where || this.$el;
+ return $where.find( '.details' );
+ },
+
+ /** build the DOM for the details and set up behaviors on it */
_renderDetails : function(){
- // override this
- return null;
+ var $newDetails = $( this.templates.details( this.model.toJSON(), this ) );
+ this._setUpBehaviors( $newDetails );
+ return $newDetails;
},
// ......................................................................... expansion/details
- /** Show or hide the body/details of history content.
+ /** Show or hide the details
* @param {Boolean} expand if true, expand; if false, collapse
*/
toggleExpanded : function( expand ){
@@ -320,26 +489,26 @@
*/
expand : function(){
var view = this;
-
- function _renderDetailsAndExpand(){
- view.$( '.details' ).replaceWith( view._renderDetails() );
- // needs to be set after the above or the slide will not show
- view.expanded = true;
- view.$( '.details' ).slideDown( view.fxSpeed, function(){
+ return view._fetchModelDetails()
+ .always(function(){
+ var $newDetails = view._renderDetails();
+ view.$details().replaceWith( $newDetails );
+ // needs to be set after the above or the slide will not show
+ view.expanded = true;
+ $newDetails.slideDown( view.fxSpeed, function(){
view.trigger( 'expanded', view );
});
+ });
+ },
+
+ /** Check for model details and, if none, fetch them.
+ * @returns {jQuery.promise} the model.fetch.xhr if details are being fetched, an empty promise if not
+ */
+ _fetchModelDetails : function(){
+ if( !this.model.hasDetails() ){
+ return this.model.fetch();
}
-//TODO:?? remove
- // fetch first if no details in the model
- if( !view.model.hasDetails() ){
- // we need the change event on HDCA's for the elements to be processed - so silent == false
- view.model.fetch().always( function( model ){
- _renderDetailsAndExpand();
- });
-//TODO: no error handling
- } else {
- _renderDetailsAndExpand();
- }
+ return jQuery.when();
},
/** Hide the body/details of an HDA.
@@ -348,19 +517,378 @@
collapse : function(){
var view = this;
view.expanded = false;
- this.$( '.details' ).slideUp( view.fxSpeed, function(){
+ this.$details().slideUp( view.fxSpeed, function(){
view.trigger( 'collapsed', view );
});
}
});
+
+//==============================================================================
+/** Mixin for views that can be dragged and dropped
+ * Allows for the drag behavior to be turned on/off, setting/removing jQuery event
+ * handlers each time.
+ * dataTransfer data is set to the JSON string of the view's model.toJSON
+ * Override '$dragHandle' to define the draggable DOM sub-element.
+ */
+var DraggableViewMixin = {
+
+ /** set up instance vars to track whether this view is currently draggable */
+ initialize : function( attributes ){
+ /** is the body of this hda view expanded/not? */
+ this.draggable = attributes.draggable || false;
+ },
+
+ /** what part of the view's DOM triggers the dragging */
+ $dragHandle : function(){
+//TODO: make abstract/general - move this to listItem
+ // override to the element you want to be your view's handle
+ return this.$( '.title-bar' );
+ },
+
+ /** toggle whether this view is draggable */
+ toggleDraggable : function(){
+ if( this.draggable ){
+ this.draggableOff();
+ } else {
+ this.draggableOn();
+ }
+ },
+
+ /** allow the view to be dragged, set up event handlers */
+ draggableOn : function(){
+ this.draggable = true;
+ //TODO: I have no idea why this doesn't work with the events hash or jq.on()...
+ //this.$el.find( '.title-bar' )
+ // .attr( 'draggable', true )
+ // .bind( 'dragstart', this.dragStartHandler, false )
+ // .bind( 'dragend', this.dragEndHandler, false );
+ this.dragStartHandler = _.bind( this._dragStartHandler, this );
+ this.dragEndHandler = _.bind( this._dragEndHandler, this );
+
+ var handle = this.$dragHandle().attr( 'draggable', true ).get(0);
+ handle.addEventListener( 'dragstart', this.dragStartHandler, false );
+ handle.addEventListener( 'dragend', this.dragEndHandler, false );
+ },
+
+ /** turn of view dragging and remove event listeners */
+ draggableOff : function(){
+ this.draggable = false;
+ var handle = this.$dragHandle().attr( 'draggable', false ).get(0);
+ handle.removeEventListener( 'dragstart', this.dragStartHandler, false );
+ handle.removeEventListener( 'dragend', this.dragEndHandler, false );
+ },
+
+ /** sets the dataTransfer data to the model's toJSON
+ * @fires dragstart (bbone event) which is passed this view
+ */
+ _dragStartHandler : function( event ){
+ //this.debug( 'dragStartHandler:', this, event, arguments )
+ this.trigger( 'dragstart', this );
+ event.dataTransfer.effectAllowed = 'move';
+ //TODO: all except IE: should be 'application/json', IE: must be 'text'
+ event.dataTransfer.setData( 'text', JSON.stringify( this.model.toJSON() ) );
+ return false;
+ },
+
+ /** handle the dragend
+ * @fires dragend (bbone event) which is passed this view
+ */
+ _dragEndHandler : function( event ){
+ this.trigger( 'dragend', this );
+ //this.debug( 'dragEndHandler:', event )
+ return false;
+ }
+};
+
+
+//==============================================================================
+/** Mixin that allows a view to be selected (gen. from a list).
+ * Selection controls ($selector) may be hidden/shown/toggled.
+ * The bbone event 'selectable' is fired when the controls are shown/hidden (passed T/F).
+ * Default rendering is a font-awesome checkbox.
+ * Default selector is '.selector' within the view's $el.
+ * The bbone events 'selected' and 'de-selected' are fired when the $selector is clicked.
+ * Both events are passed the view and the (jQuery) event.
+ */
+var SelectableViewMixin = {
+
+ /** Set up instance state vars for whether the selector is shown and whether the view has been selected */
+ initialize : function( attributes ){
+ /** is the view currently in selection mode? */
+ this.selectable = attributes.selectable || false;
+ /** is the view currently selected? */
+ this.selected = attributes.selected || false;
+ },
+
+ /** $el sub-element where the selector is rendered and what can be clicked to select. */
+ $selector : function(){
+ return this.$( '.selector' );
+ },
+
+ /** How the selector is rendered - defaults to font-awesome checkbox */
+ _renderSelected : function(){
+ // override
+ this.$selector().find( 'span' )
+ .toggleClass( 'fa-check-square-o', this.selected ).toggleClass( 'fa-square-o', !this.selected );
+ },
+
+ /** Toggle whether the selector is shown */
+ toggleSelector : function(){
+//TODO: use this.selectable
+ if( !this.$selector().is( ':visible' ) ){
+ this.showSelector();
+ } else {
+ this.hideSelector();
+ }
+ },
+
+ /** Display the selector control.
+ * @param {Number} a jQuery fx speed
+ * @fires: selectable which is passed true (IOW, the selector is shown) and the view
+ */
+ showSelector : function( speed ){
+ speed = speed !== undefined? speed : this.fxSpeed;
+ // make sure selected state is represented properly
+ this.selectable = true;
+ this.trigger( 'selectable', true, this );
+ this._renderSelected();
+ this.$selector().show( speed );
+ },
+
+ /** remove the selector control
+ * @param {Number} a jQuery fx speed
+ * @fires: selectable which is passed false (IOW, the selector is not shown) and the view
+ */
+ hideSelector : function( speed ){
+ speed = speed !== undefined? speed : this.fxSpeed;
+ // reverse the process from showSelect
+ this.selectable = false;
+ this.trigger( 'selectable', false, this );
+ this.$selector().hide( speed );
+ },
+
+ /** Toggle whether the view is selected */
+ toggleSelect : function( event ){
+ if( this.selected ){
+ this.deselect( event );
+ } else {
+ this.select( event );
+ }
+ },
+
+ /** Select this view and re-render the selector control to show it
+ * @param {Event} a jQuery event that caused the selection
+ * @fires: selected which is passed the view and the DOM event that triggered it (optionally)
+ */
+ select : function( event ){
+ // switch icon, set selected, and trigger event
+ if( !this.selected ){
+ this.trigger( 'selected', this, event );
+ this.selected = true;
+ this._renderSelected();
+ }
+ return false;
+ },
+
+ /** De-select this view and re-render the selector control to show it
+ * @param {Event} a jQuery event that caused the selection
+ * @fires: de-selected which is passed the view and the DOM event that triggered it (optionally)
+ */
+ deselect : function( event ){
+ // switch icon, set selected, and trigger event
+ if( this.selected ){
+ this.trigger( 'de-selected', this, event );
+ this.selected = false;
+ this._renderSelected();
+ }
+ return false;
+ }
+};
+
+
+//==============================================================================
+/** A view that is displayed in some larger list/grid/collection.
+ * Inherits from Expandable, Selectable, Draggable.
+ * The DOM contains warnings, a title bar, and a series of primary action controls.
+ * Primary actions are meant to be easily accessible item functions (such as delete)
+ * that are rendered in the title bar.
+ *
+ * Details are rendered when the user clicks the title bar or presses enter/space when
+ * the title bar is in focus.
+ *
+ * Designed as a base class for history panel contents - but usable elsewhere (I hope).
+ */
+var ListItemView = ExpandableView.extend( mixin( SelectableViewMixin, DraggableViewMixin, {
+
+//TODO: that's a little contradictory
+ tagName : 'div',
+ className : 'list-item',
+
+ /** Set up the base class and all mixins */
+ initialize : function( attributes ){
+ ExpandableView.prototype.initialize.call( this, attributes );
+ SelectableViewMixin.initialize.call( this, attributes );
+ DraggableViewMixin.initialize.call( this, attributes );
+ },
+
+ // ........................................................................ rendering
+ /** In this override, call methods to build warnings, titlebar and primary actions */
+ _buildNewRender : function(){
+ var $newRender = ExpandableView.prototype._buildNewRender.call( this );
+ $newRender.find( '.warnings' ).replaceWith( this._renderWarnings() );
+ $newRender.find( '.title-bar' ).replaceWith( this._renderTitleBar() );
+ $newRender.find( '.primary-actions' ).append( this._renderPrimaryActions() );
+ $newRender.find( '.subtitle' ).replaceWith( this._renderSubtitle() );
+ return $newRender;
+ },
+
+ /** In this override, render the selector controls and set up dragging before the swap */
+ _swapNewRender : function( $newRender ){
+ ExpandableView.prototype._swapNewRender.call( this, $newRender );
+ if( this.selectable ){ this.showSelector( 0 ); }
+ if( this.draggable ){ this.draggableOn(); }
+ return this.$el;
+ },
+
+ /** Render any warnings the item may need to show (e.g. "I'm deleted") */
+ _renderWarnings : function(){
+ var view = this,
+ $warnings = $( '<div class="warnings"></div>' ),
+ json = view.model.toJSON();
+//TODO:! unordered (map)
+ _.each( view.templates.warnings, function( templateFn ){
+ $warnings.append( $( templateFn( json, view ) ) );
+ });
+ return $warnings;
+ },
+
+ /** Render the title bar (the main/exposed SUMMARY dom element) */
+ _renderTitleBar : function(){
+ return $( this.templates.titleBar( this.model.toJSON(), this ) );
+ },
+
+ /** Return an array of jQ objects containing common/easily-accessible item controls */
+ _renderPrimaryActions : function(){
+ // override this
+ return [];
+ },
+
+ /** Render the title bar (the main/exposed SUMMARY dom element) */
+ _renderSubtitle : function(){
+ return $( this.templates.subtitle( this.model.toJSON(), this ) );
+ },
+
+ // ......................................................................... events
+ /** event map */
+ events : {
+ // expand the body when the title is clicked or when in focus and space or enter is pressed
+ 'click .title-bar' : '_clickTitleBar',
+ 'keydown .title-bar' : '_keyDownTitleBar',
+
+ // dragging - don't work, originalEvent === null
+ //'dragstart .dataset-title-bar' : 'dragStartHandler',
+ //'dragend .dataset-title-bar' : 'dragEndHandler'
+
+ 'click .selector' : 'toggleSelect'
+ },
+
+ /** expand when the title bar is clicked */
+ _clickTitleBar : function( event ){
+ event.stopPropagation();
+ this.toggleExpanded();
+ },
+
+ /** expand when the title bar is in focus and enter or space is pressed */
+ _keyDownTitleBar : function( event ){
+ // bail (with propagation) if keydown and not space or enter
+ var KEYCODE_SPACE = 32, KEYCODE_RETURN = 13;
+ if( event && ( event.type === 'keydown' )
+ &&( event.keyCode === KEYCODE_SPACE || event.keyCode === KEYCODE_RETURN ) ){
+ this.toggleExpanded();
+ event.stopPropagation();
+ return false;
+ }
+ return true;
+ },
+
+ // ......................................................................... misc
+ /** String representation */
+ toString : function(){
+ var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
+ return 'ListItemView(' + modelString + ')';
+ }
+}));
+
+// ............................................................................ TEMPLATES
+/** underscore templates */
+ListItemView.prototype.templates = (function(){
+//TODO: move to require text! plugin
+
+ var elTemplato = wrapTemplate([
+ '<div class="list-element">',
+ // errors, messages, etc.
+ '<div class="warnings"></div>',
+
+ // multi-select checkbox
+ '<div class="selector">',
+ '<span class="fa fa-2x fa-square-o"></span>',
+ '</div>',
+ // space for title bar buttons - gen. floated to the right
+ '<div class="primary-actions"></div>',
+ '<div class="title-bar"></div>',
+
+ // expandable area for more details
+ '<div class="details"></div>',
+ '</div>'
+ ]);
+
+ var warnings = {};
+
+ var titleBarTemplate = wrapTemplate([
+ // adding a tabindex here allows focusing the title bar and the use of keydown to expand the dataset display
+ '<div class="title-bar clear" tabindex="0">',
+//TODO: prob. belongs in dataset-list-item
+ '<span class="state-icon"></span>',
+ '<div class="title">',
+ '<span class="name"><%- element.name %></span>',
+ '</div>',
+ '<div class="subtitle"></div>',
+ '</div>'
+ ], 'element' );
+
+ var subtitleTemplate = wrapTemplate([
+ // override this
+ '<div class="subtitle"></div>'
+ ]);
+
+ var detailsTemplate = wrapTemplate([
+ // override this
+ '<div class="details"></div>'
+ ]);
+
+ return {
+ el : elTemplato,
+ warnings : warnings,
+ titleBar : titleBarTemplate,
+ subtitle : subtitleTemplate,
+ details : detailsTemplate
+ };
+}());
+
+
//==============================================================================
return {
LoggableMixin : LoggableMixin,
SessionStorageModel : SessionStorageModel,
+ SearchableModelMixin : SearchableModelMixin,
HiddenUntilActivatedViewMixin : HiddenUntilActivatedViewMixin,
mixin : mixin,
- ExpandableView : ExpandableView
+ wrapTemplate : wrapTemplate,
+ ExpandableView : ExpandableView,
+ DraggableViewMixin : DraggableViewMixin,
+ SelectableViewMixin : SelectableViewMixin,
+ ListItemView : ListItemView
};
});
diff -r bdc4017c2e7e9ecb5dfa3d36798f535402ec80aa -r 700560884da71e8bd3bdad6ddbe4edfde9566f7f static/scripts/mvc/collection/collection-model.js
--- a/static/scripts/mvc/collection/collection-model.js
+++ b/static/scripts/mvc/collection/collection-model.js
@@ -1,29 +1,57 @@
define([
- "mvc/dataset/hda-model",
+ "mvc/dataset/dataset-model",
"mvc/base-mvc",
"utils/localization"
-], function( HDA_MODEL, BASE_MVC, _l ){
+], function( DATASET, BASE_MVC, _l ){
//==============================================================================
-/** @class Backbone model for Dataset collection elements.
- * DC Elements contain a sub-model named 'object'. This class moves that
- * 'object' from the JSON in the attributes list to a full, instantiated
- * sub-model found in this.object. This is done on intialization and
- * everytime the 'change:object' event is fired.
- *
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
+/*
+Notes:
+
+Terminology:
+ DatasetCollection/DC : a container of datasets or nested DatasetCollections
+ Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection
+ HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history
+
+
+This all seems too complex unfortunately:
+
+- Terminology collision between DatasetCollections (DCs) and Backbone Collections.
+- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*
+ either a dataset or a nested DC. This would make the hierarchy much taller. I've
+ decided to merge the contained JSON with the DC element json - making the 'has a'
+ relation into an 'is a' relation. This seems simpler to me and allowed a lot of
+ DRY in both models and views, but may make tracking or tracing within these models
+ more difficult (since DatasetCollectionElements are now *also* DatasetAssociations
+ or DatasetCollections (nested)). This also violates the rule of thumb about
+ favoring aggregation over inheritance.
+- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.
+ These each should a) be usable on their own, b) be usable in the context of
+ nesting within a collection model (at least in the case of ListPaired), and
+ c) be usable within the context of other container models (like History or
+ LibraryFolder, etc.). I've tried to separate/extract classes in order to
+ handle those three situations, but it's proven difficult to do in a simple,
+ readable manner.
+- Ideally, histories and libraries would inherit from the same server models as
+ dataset collections do since they are (in essence) dataset collections themselves -
+ making the whole nested structure simpler. This would be a large, error-prone
+ refactoring and migration.
+
+Many of the classes and heirarchy are meant as extension points so, while the
+relations and flow may be difficult to understand initially, they'll allow us to
+handle the growth or flux dataset collection in the future (w/o actually implementing
+any YAGNI).
+
+*/
+//_________________________________________________________________________________________________ ELEMENTS
+/** @class mixin for Dataset collection elements.
+ * When collection elements are passed from the API, the underlying element is
+ * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).
+ * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues
+ * effectively changing a DCE from a container to a subclass.
*/
-var DatasetCollectionElement = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
-/** @lends DatasetCollectionElement.prototype */{
+var DatasetCollectionElementMixin = {
- //TODO:?? this model may be unneccessary - it reflects the api structure, but...
- // if we munge the element with the element.object at parse, we can flatten the entire hierarchy
-
- /** logger used to record this.log messages, commonly set to console */
- // comment this out to suppress log output
- //logger : console,
-
+ /** default attributes used by elements in a dataset collection */
defaults : {
model_class : 'DatasetCollectionElement',
element_identifier : null,
@@ -31,137 +59,52 @@
element_type : null
},
- /** Set up.
- * @see Backbone.Collection#initialize
- */
- initialize : function( model, options ){
- this.info( this + '.initialize:', model, options );
- options = options || {};
- //this._setUpListeners();
-
- this.object = this._createObjectModel();
- this.on( 'change:object', function(){
- //this.log( 'change:object' );
-//TODO: prob. better to update the sub-model instead of re-creating it
- this.object = this._createObjectModel();
- });
+ /** merge the attributes of the sub-object 'object' into this model */
+ _mergeObject : function( attributes ){
+ _.extend( attributes, attributes.object );
+ delete attributes.object;
+ return attributes;
},
- _createObjectModel : function(){
- //this.log( '_createObjectModel', this.get( 'object' ), this.object );
- //TODO: same patterns as HDCA _createElementsModel - refactor to BASE_MVC.hasSubModel?
- if( _.isUndefined( this.object ) ){ this.object = null; }
- if( !this.get( 'object' ) ){ return this.object; }
-
- var object = this.get( 'object' ),
- ObjectClass = this._getObjectClass();
- this.unset( 'object', { silent: true });
- this.object = new ObjectClass( object );
-
- return this.object;
+ /** override to merge this.object into this */
+ constructor : function( attributes, options ){
+ this.debug( '\t DatasetCollectionElement.constructor:', attributes, options );
+ attributes = this._mergeObject( attributes );
+ Backbone.Model.apply( this, arguments );
},
- _getObjectClass : function(){
- this.debug( 'DCE, element_type:', this.get( 'element_type' ) );
- switch( this.get( 'element_type' ) ){
- case 'dataset_collection':
- return DatasetCollection;
- case 'hda':
- return HDA_MODEL.HistoryDatasetAssociation;
- }
- throw new TypeError( 'Unknown element_type: ' + this.get( 'element_type' ) );
- },
+ /** when the model is fetched, merge this.object into this */
+ parse : function( response, options ){
+ var attributes = response;
+ attributes = this._mergeObject( attributes );
+ return attributes;
+ }
+};
- toJSON : function(){
- var json = Backbone.Model.prototype.toJSON.call( this );
- if( this.object ){
- json.object = this.object.toJSON();
- }
- return json;
- },
+//TODO: unused?
+/** Concrete class of Generic DatasetCollectionElement */
+var DatasetCollectionElement = Backbone.Model
+ .extend( BASE_MVC.LoggableMixin )
+ .extend( DatasetCollectionElementMixin );
- hasDetails : function(){
- return ( this.object !== null
- && this.object.hasDetails() );
- },
-
- /** String representation. */
- toString : function(){
- var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
- return ([ 'DatasetCollectionElement(', objStr, ')' ].join( '' ));
- }
-});
-
-
+
//==============================================================================
-/** @class Backbone model for
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
- */
-var HDADCE = DatasetCollectionElement.extend(
-/** @lends DatasetCollectionElement.prototype */{
-
- _getObjectClass : function(){
- return HDA_MODEL.HistoryDatasetAssociation;
- },
-
- /** String representation. */
- toString : function(){
- var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
- return ([ 'HDADCE(', objStr, ')' ].join( '' ));
- }
-});
-
-
-//==============================================================================
-/** @class Backbone model for
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
- */
-var DCDCE = DatasetCollectionElement.extend(
-/** @lends DatasetCollectionElement.prototype */{
-
- _getObjectClass : function(){
- return DatasetCollection;
- },
-
- getVisibleContents : function(){
- return this.object? this.object.getVisibleContents(): [];
- },
-
- /** String representation. */
- toString : function(){
- var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
- return ([ 'DCDCE(', objStr, ')' ].join( '' ));
- }
-});
-
-
-//==============================================================================
-/** @class Backbone collection for DCEs.
- * NOTE: used *only* in second level of list:paired collections (a
- * collection that contains collections)
- *
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
- */
+/** @class Base/Abstract Backbone collection for Generic DCEs. */
var DCECollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(
-/** @lends DatasetCollectionElementCollection.prototype */{
+/** @lends DCECollection.prototype */{
model: DatasetCollectionElement,
// comment this out to suppress log output
/** logger used to record this.log messages, commonly set to console */
//logger : console,
+//TODO: unused?
/** Set up.
* @see Backbone.Collection#initialize
*/
- initialize : function( models, options ){
+ initialize : function( attributes, options ){
+ this.debug( this + '(DCECollection).initialize:', attributes, options );
options = options || {};
- this.info( this + '.initialize:', models, options );
//this._setUpListeners();
},
@@ -173,69 +116,98 @@
//==============================================================================
-/** @class Backbone collection for
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
+/** @class Backbone model for a dataset collection element that is a dataset (HDA).
*/
-var HDADCECollection = DCECollection.extend(
-/** @lends DatasetCollectionElementCollection.prototype */{
- model: HDADCE,
+var DatasetDCE = DATASET.DatasetAssociation.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,
+/** @lends DatasetDCE.prototype */{
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ defaults : _.extend( {}, DATASET.DatasetAssociation.prototype.defaults, DatasetCollectionElementMixin.defaults ),
+
+ // because all objects have constructors (as this hashmap would even if this next line wasn't present)
+ // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model
+ // - re-apply manually it now
+ /** call the mixin constructor */
+ constructor : function( attributes, options ){
+ this.debug( '\t DatasetDCE.constructor:', attributes, options );
+ //DATASET.DatasetAssociation.prototype.constructor.call( this, attributes, options );
+ DatasetCollectionElementMixin.constructor.call( this, attributes, options );
+ },
+
+//TODO: unused?
+ /** set up */
+ initialize : function( attributes, options ){
+ this.debug( this + '(DatasetDCE).initialize:', attributes, options );
+ DATASET.DatasetAssociation.prototype.initialize.call( this, attributes, options );
+ },
/** String representation. */
toString : function(){
- return ([ 'HDADCECollection(', this.length, ')' ].join( '' ));
+ var objStr = this.get( 'element_identifier' );
+ return ([ 'DatasetDCE(', objStr, ')' ].join( '' ));
+ }
+}));
+
+
+//==============================================================================
+/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).
+ */
+var DatasetDCECollection = DCECollection.extend(
+/** @lends DatasetDCECollection.prototype */{
+ model: DatasetDCE,
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+//TODO: unused?
+ /** */
+ initialize : function( attributes, options ){
+ this.debug( this + '(DatasetDCECollection).initialize:', attributes, options );
+ DCECollection.prototype.initialize.call( this, attributes, options );
+ },
+
+ /** String representation. */
+ toString : function(){
+ return ([ 'DatasetDCECollection(', this.length, ')' ].join( '' ));
}
});
-//==============================================================================
-/** @class Backbone collection for
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
+//_________________________________________________________________________________________________ COLLECTIONS
+/** @class Backbone model for Dataset Collections.
+ * The DC API returns an array of JSON objects under the attribute elements.
+ * This model:
+ * - removes that array/attribute ('elements') from the model,
+ * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),
+ * - passes that json onto the bbone collection
+ * - caches the bbone collection in this.elements
*/
-var DCDCECollection = DCECollection.extend(
-/** @lends DatasetCollectionElementCollection.prototype */{
- model: DCDCE,
+var DatasetCollection = Backbone.Model
+ .extend( BASE_MVC.LoggableMixin )
+ .extend( BASE_MVC.SearchableModelMixin )
+.extend(/** @lends DatasetCollection.prototype */{
- /** String representation. */
- toString : function(){
- return ([ 'DCDCECollection(', this.length, ')' ].join( '' ));
- }
-});
-
-
-//==============================================================================
-/** @class Backbone model for Dataset Collections.
- * DCs contain a bbone collection named 'elements' using the class found in
- * this.collectionClass (gen. DatasetCollectionElementCollection). DCs move
- * that 'object' from the JSON in the attributes list to a full, instantiated
- * collection found in this.elements. This is done on intialization and
- * everytime the 'change:elements' event is fired.
- *
- * @borrows LoggableMixin#logger as #logger
- * @borrows LoggableMixin#log as #log
- * @constructs
- */
-var DatasetCollection = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
-/** @lends ListDatasetCollection.prototype */{
-
- //logger : console,
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
/** default attributes for a model */
defaults : {
- collection_type : 'list'
+ /* 'list', 'paired', or 'list:paired' */
+ collection_type : null,
+ //??
+ deleted : false
},
+ /** Which class to use for elements */
collectionClass : DCECollection,
/** */
initialize : function( model, options ){
- this.info( 'DatasetCollection.initialize:', model, options );
+ this.debug( this + '(DatasetCollection).initialize:', model, options, this );
//historyContent.HistoryContent.prototype.initialize.call( this, attrs, options );
this.elements = this._createElementsModel();
-//TODO:?? no way to use parse here?
this.on( 'change:elements', function(){
this.log( 'change:elements' );
//TODO: prob. better to update the collection instead of re-creating it
@@ -245,15 +217,17 @@
/** move elements model attribute to full collection */
_createElementsModel : function(){
- this.log( '_createElementsModel', this.get( 'elements' ), this.elements );
+ this.debug( this + '._createElementsModel', this.collectionClass, this.get( 'elements' ), this.elements );
//TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?
var elements = this.get( 'elements' ) || [];
- this.info( 'elements:', elements );
this.unset( 'elements', { silent: true });
this.elements = new this.collectionClass( elements );
+ //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );
return this.elements;
},
+ // ........................................................................ common queries
+ /** pass the elements back within the model json when this is serialized */
toJSON : function(){
var json = Backbone.Model.prototype.toJSON.call( this );
if( this.elements ){
@@ -262,17 +236,43 @@
return json;
},
+ /** is the collection done with updates and ready to be used? (finished running, etc.) */
+ inReadyState : function(){
+//TODO: state currenly unimplemented for collections
+ return true;
+ },
+
+ //TODO:?? the following are the same interface as DatasetAssociation - can we combine?
+ /** Does the DC contain any elements yet? Is a fetch() required? */
hasDetails : function(){
//TODO: this is incorrect for (accidentally) empty collections
this.debug( 'hasDetails:', this.elements.length );
return this.elements.length !== 0;
},
+ /** Given the filters, what models in this.elements would be returned? */
getVisibleContents : function( filters ){
- //TODO: filters unused for now
+ // filters unused for now
return this.elements;
},
+ // ........................................................................ ajax
+ /** save this dataset, _Mark_ing it as deleted (just a flag) */
+ 'delete' : function( options ){
+ if( this.get( 'deleted' ) ){ return jQuery.when(); }
+ return this.save( { deleted: true }, options );
+ },
+ /** save this dataset, _Mark_ing it as undeleted */
+ undelete : function( options ){
+ if( !this.get( 'deleted' ) || this.get( 'purged' ) ){ return jQuery.when(); }
+ return this.save( { deleted: false }, options );
+ },
+
+ // ........................................................................ searchable
+ searchAttributes : [
+ 'name'
+ ],
+
// ........................................................................ misc
/** String representation */
toString : function(){
@@ -283,10 +283,21 @@
//==============================================================================
+/** Model for a DatasetCollection containing datasets (non-nested).
+ */
var ListDatasetCollection = DatasetCollection.extend(
/** @lends ListDatasetCollection.prototype */{
- collectionClass : HDADCECollection,
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ collectionClass : DatasetDCECollection,
+
+//TODO: unused?
+ initialize : function( attrs, options ){
+ this.debug( this + '(ListDatasetCollection).initialize:', attrs, options );
+ DatasetCollection.prototype.initialize.call( this, attrs, options );
+ },
/** String representation. */
toString : function(){
@@ -296,8 +307,20 @@
//==============================================================================
+/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).
+ */
var PairDatasetCollection = ListDatasetCollection.extend(
-/** @lends ListDatasetCollection.prototype */{
+/** @lends PairDatasetCollection.prototype */{
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+//TODO: unused?
+ /** */
+ initialize : function( attrs, options ){
+ this.debug( this + '(PairDatasetCollection).initialize:', attrs, options );
+ ListDatasetCollection.prototype.initialize.call( this, attrs, options );
+ },
/** String representation. */
toString : function(){
@@ -306,14 +329,129 @@
});
+//_________________________________________________________________________________________________ NESTED COLLECTIONS
+// this is where things get weird, man. Weird.
+//TODO: it might be possible to compact all the following...I think.
//==============================================================================
+/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection
+ * (a nested collection). Currently only list:paired.
+ */
+var NestedDCDCE = DatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,
+/** @lends NestedDCDCE.prototype */{
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ // because all objects have constructors (as this hashmap would even if this next line wasn't present)
+ // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model
+ // - re-apply manually it now
+ /** call the mixin constructor */
+ constructor : function( attributes, options ){
+ this.debug( '\t NestedDCDCE.constructor:', attributes, options );
+ DatasetCollectionElementMixin.constructor.call( this, attributes, options );
+ },
+
+ /** String representation. */
+ toString : function(){
+ var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
+ return ([ 'NestedDCDCE(', objStr, ')' ].join( '' ));
+ }
+}));
+
+
+//==============================================================================
+/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).
+ */
+var NestedDCDCECollection = DCECollection.extend(
+/** @lends NestedDCDCECollection.prototype */{
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ model: NestedDCDCE,
+
+//TODO: unused?
+ /** */
+ initialize : function( attrs, options ){
+ this.debug( this + '(NestedDCDCECollection).initialize:', attrs, options );
+ DCECollection.prototype.initialize.call( this, attrs, options );
+ },
+
+ /** String representation. */
+ toString : function(){
+ return ([ 'NestedDCDCECollection(', this.length, ')' ].join( '' ));
+ }
+});
+
+
+//==============================================================================
+/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.
+ */
+var NestedPairDCDCE = PairDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,
+/** @lends NestedPairDCDCE.prototype */{
+//TODO:?? possibly rename to NestedDatasetCollection?
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ /** */
+ constructor : function( attributes, options ){
+ this.debug( '\t NestedPairDCDCE.constructor:', attributes, options );
+ //DatasetCollection.constructor.call( this, attributes, options );
+ DatasetCollectionElementMixin.constructor.call( this, attributes, options );
+ },
+
+ /** String representation. */
+ toString : function(){
+ var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
+ return ([ 'NestedPairDCDCE(', objStr, ')' ].join( '' ));
+ }
+}));
+
+
+//==============================================================================
+/** @class Backbone collection for a backbone collection containing paired dataset collections.
+ */
+var NestedPairDCDCECollection = NestedDCDCECollection.extend(
+/** @lends PairDCDCECollection.prototype */{
+
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
+
+ model: NestedPairDCDCE,
+
+//TODO: unused?
+ /** */
+ initialize : function( attrs, options ){
+ this.debug( this + '(NestedPairDCDCECollection).initialize:', attrs, options );
+ NestedDCDCECollection.prototype.initialize.call( this, attrs, options );
+ },
+
+ /** String representation. */
+ toString : function(){
+ return ([ 'NestedPairDCDCECollection(', this.length, ')' ].join( '' ));
+ }
+});
+
+
+//==============================================================================
+/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).
+ */
var ListPairedDatasetCollection = DatasetCollection.extend(
-/** @lends ListDatasetCollection.prototype */{
+/** @lends ListPairedDatasetCollection.prototype */{
- collectionClass : DCDCECollection,
+ /** logger used to record this.log messages, commonly set to console */
+ //logger : console,
// list:paired is the only collection that itself contains collections
- //collectionClass : DatasetCollectionCollection,
+ collectionClass : NestedPairDCDCECollection,
+
+//TODO: unused?
+ /** */
+ initialize : function( attributes, options ){
+ this.debug( this + '(ListPairedDatasetCollection).initialize:', attributes, options );
+ DatasetCollection.prototype.initialize.call( this, attributes, options );
+ },
/** String representation. */
toString : function(){
@@ -324,7 +462,6 @@
//==============================================================================
return {
- //DatasetCollection : DatasetCollection,
ListDatasetCollection : ListDatasetCollection,
PairDatasetCollection : PairDatasetCollection,
ListPairedDatasetCollection : ListPairedDatasetCollection
diff -r bdc4017c2e7e9ecb5dfa3d36798f535402ec80aa -r 700560884da71e8bd3bdad6ddbe4edfde9566f7f static/scripts/mvc/collection/collection-panel.js
--- a/static/scripts/mvc/collection/collection-panel.js
+++ b/static/scripts/mvc/collection/collection-panel.js
@@ -21,7 +21,6 @@
//MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)
/** logger used to record this.log messages, commonly set to console */
- // comment this out to suppress log output
//logger : console,
tagName : 'div',
@@ -30,7 +29,8 @@
/** (in ms) that jquery effects will use */
fxSpeed : 'fast',
- DCEViewClass : DC_BASE.DCEBaseView,
+ DatasetDCEViewClass : DC_BASE.DatasetDCEBaseView,
+ NestedDCEViewClass : DC_BASE.NestedDCEBaseView,
// ......................................................................... SET UP
/** Set up the view, set up storage, bind listeners to HistoryContents events
@@ -47,8 +47,6 @@
this.hasUser = attributes.hasUser;
this.panelStack = [];
this.parentName = attributes.parentName;
-
- window.collectionPanel = this;
},
/** create any event listeners for the panel
@@ -194,10 +192,8 @@
//this.debug( 'content json:', JSON.stringify( content, null, ' ' ) );
var contentView = null,
ContentClass = this._getContentClass( content );
- //this.debug( 'content.object json:', JSON.stringify( content.object, null, ' ' ) );
this.debug( 'ContentClass:', ContentClass );
- //this.debug( 'content:', content );
- this.debug( 'content.object:', content.object );
+ this.debug( 'content:', content );
contentView = new ContentClass({
model : content,
linkTarget : this.linkTarget,
@@ -213,6 +209,7 @@
/** */
_getContentClass : function( content ){
this.debug( this + '._getContentClass:', content );
+ this.debug( 'DCEViewClass:', this.DCEViewClass );
switch( content.get( 'element_type' ) ){
case 'hda':
return this.DCEViewClass;
@@ -336,7 +333,9 @@
// =============================================================================
/** @class non-editable, read-only View/Controller for a dataset collection. */
var ListCollectionPanel = CollectionPanel.extend({
- DCEViewClass : DC_BASE.HDADCEBaseView,
+
+ DCEViewClass : DC_BASE.DatasetDCEBaseView,
+
// ........................................................................ misc
/** string rep */
toString : function(){
@@ -348,6 +347,7 @@
// =============================================================================
/** @class non-editable, read-only View/Controller for a dataset collection. */
var PairCollectionPanel = ListCollectionPanel.extend({
+
// ........................................................................ misc
/** string rep */
toString : function(){
@@ -359,7 +359,9 @@
// =============================================================================
/** @class non-editable, read-only View/Controller for a dataset collection. */
var ListOfPairsCollectionPanel = CollectionPanel.extend({
- DCEViewClass : DC_BASE.DCDCEBaseView,
+
+ DCEViewClass : DC_BASE.NestedDCDCEBaseView,
+
// ........................................................................ misc
/** string rep */
toString : function(){
This diff is so big that we needed to truncate the remainder.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
9 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f58a9199e992/
Changeset: f58a9199e992
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Fix failing test test/unit/workflows/test_extract_summary.py.
Affected #: 1 file
diff -r de2e33813275b89a04e7de4e95b21f6d2e100d4e -r f58a9199e9922c3bef27240aa613a9a3c5bae67e test/unit/workflows/test_extract_summary.py
--- a/test/unit/workflows/test_extract_summary.py
+++ b/test/unit/workflows/test_extract_summary.py
@@ -71,6 +71,10 @@
def __init__( self ):
self.active_datasets = []
+ @property
+ def active_contents( self ):
+ return self.active_datasets
+
class MockTrans( object ):
@@ -87,6 +91,7 @@
self.id = 123
self.state = state
self.copied_from_history_dataset_association = None
+ self.history_content_type = "dataset"
if job is not UNDEFINED_JOB:
if not job:
job = model.Job()
https://bitbucket.org/galaxy/galaxy-central/commits/f1a1c52f8495/
Changeset: f1a1c52f8495
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Move galaxy.dataset_collections.util to galaxy.managers.collections_util to prevent circular dependency error.
Still some problems with histories and hda managers when loading from unit tests:
======================================================================
ERROR: Failure: ImportError (cannot import name histories)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
addr.filename, addr.module)
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/john/workspace/galaxy-central/test/unit/workflows/test_workflow_run_request.py", line 4, in <module>
from galaxy.workflow import run_request
File "/home/john/workspace/galaxy-central/lib/galaxy/workflow/run_request.py", line 4, in <module>
import galaxy.managers.histories
File "/home/john/workspace/galaxy-central/lib/galaxy/managers/histories.py", line 12, in <module>
import galaxy.managers.hdas
File "/home/john/workspace/galaxy-central/lib/galaxy/managers/hdas.py", line 11, in <module>
from galaxy.managers import histories as history_manager
ImportError: cannot import name histories
Affected #: 9 files
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/dataset_collections/__init__.py
--- a/lib/galaxy/dataset_collections/__init__.py
+++ b/lib/galaxy/dataset_collections/__init__.py
@@ -1,7 +1,6 @@
from .registry import DatasetCollectionTypesRegistry
from .matching import MatchingCollections
from .type_description import CollectionTypeDescriptionFactory
-from .util import validate_input_element_identifiers
from galaxy import model
@@ -14,7 +13,7 @@
UsesTagsMixin,
)
from galaxy.managers import hdas # TODO: Refactor all mixin use into managers.
-
+from galaxy.managers.collections_util import validate_input_element_identifiers
from galaxy.util import validation
from galaxy.util import odict
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/dataset_collections/util.py
--- a/lib/galaxy/dataset_collections/util.py
+++ /dev/null
@@ -1,95 +0,0 @@
-from galaxy import exceptions
-from galaxy import web
-from galaxy import model
-
-import logging
-log = logging.getLogger( __name__ )
-
-ERROR_MESSAGE_UNKNOWN_SRC = "Unknown dataset source (src) %s."
-ERROR_MESSAGE_NO_NESTED_IDENTIFIERS = "Dataset source new_collection requires nested element_identifiers for new collection."
-ERROR_MESSAGE_NO_NAME = "Cannot load invalid dataset identifier - missing name - %s"
-ERROR_MESSAGE_NO_COLLECTION_TYPE = "No collection_type define for nested collection %s."
-ERROR_MESSAGE_INVALID_PARAMETER_FOUND = "Found invalid parameter %s in element identifier description %s."
-ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND = "Found duplicated element identifier name %s."
-
-
-def api_payload_to_create_params( payload ):
- """
- Cleanup API payload to pass into dataset_collections.
- """
- required_parameters = [ "collection_type", "element_identifiers" ]
- missing_parameters = [ p for p in required_parameters if p not in payload ]
- if missing_parameters:
- message = "Missing required parameters %s" % missing_parameters
- raise exceptions.ObjectAttributeMissingException( message )
-
- params = dict(
- collection_type=payload.get( "collection_type" ),
- element_identifiers=payload.get( "element_identifiers" ),
- name=payload.get( "name", None ),
- )
-
- return params
-
-
-def validate_input_element_identifiers( element_identifiers ):
- """ Scan through the list of element identifiers supplied by the API consumer
- and verify the structure is valid.
- """
- log.debug( "Validating %d element identifiers for collection creation." % len( element_identifiers ) )
- identifier_names = set()
- for element_identifier in element_identifiers:
- if "__object__" in element_identifier:
- message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier )
- raise exceptions.RequestParameterInvalidException( message )
- if "name" not in element_identifier:
- message = ERROR_MESSAGE_NO_NAME % element_identifier
- raise exceptions.RequestParameterInvalidException( message )
- name = element_identifier[ "name" ]
- if name in identifier_names:
- message = ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND % name
- raise exceptions.RequestParameterInvalidException( message )
- else:
- identifier_names.add( name )
- src = element_identifier.get( "src", "hda" )
- if src not in [ "hda", "hdca", "ldda", "new_collection" ]:
- message = ERROR_MESSAGE_UNKNOWN_SRC % src
- raise exceptions.RequestParameterInvalidException( message )
- if src == "new_collection":
- if "element_identifiers" not in element_identifier:
- message = ERROR_MESSAGE_NO_NESTED_IDENTIFIERS
- raise exceptions.RequestParameterInvalidException( ERROR_MESSAGE_NO_NESTED_IDENTIFIERS )
- if "collection_type" not in element_identifier:
- message = ERROR_MESSAGE_NO_COLLECTION_TYPE % element_identifier
- raise exceptions.RequestParameterInvalidException( message )
- validate_input_element_identifiers( element_identifier[ "element_identifiers" ] )
-
-
-def dictify_dataset_collection_instance( dataset_colleciton_instance, parent, security, view="element" ):
- dict_value = dataset_colleciton_instance.to_dict( view=view )
- encoded_id = security.encode_id( dataset_colleciton_instance.id )
- if isinstance( parent, model.History ):
- encoded_history_id = security.encode_id( parent.id )
- dict_value[ 'url' ] = web.url_for( 'history_content_typed', history_id=encoded_history_id, id=encoded_id, type="dataset_collection" )
- elif isinstance( parent, model.LibraryFolder ):
- encoded_library_id = security.encode_id( parent.library.id )
- encoded_folder_id = security.encode_id( parent.id )
- # TODO: Work in progress - this end-point is not right yet...
- dict_value[ 'url' ] = web.url_for( 'library_content', library_id=encoded_library_id, id=encoded_id, folder_id=encoded_folder_id )
- if view == "element":
- dict_value[ 'elements' ] = map( dictify_element, dataset_colleciton_instance.collection.elements )
- security.encode_all_ids( dict_value, recursive=True ) # TODO: Use Kyle's recusrive formulation of this.
- return dict_value
-
-
-def dictify_element( element ):
- dictified = element.to_dict( view="element" )
- object_detials = element.element_object.to_dict()
- if element.child_collection:
- # Recursively yield elements for each nested collection...
- object_detials[ "elements" ] = map( dictify_element, element.child_collection.elements )
-
- dictified[ "object" ] = object_detials
- return dictified
-
-__all__ = [ api_payload_to_create_params, dictify_dataset_collection_instance ]
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/managers/collections.py
--- /dev/null
+++ b/lib/galaxy/managers/collections.py
@@ -0,0 +1,1 @@
+""" Future home of dataset collections managers. """
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/managers/collections_util.py
--- /dev/null
+++ b/lib/galaxy/managers/collections_util.py
@@ -0,0 +1,95 @@
+from galaxy import exceptions
+from galaxy import web
+from galaxy import model
+
+import logging
+log = logging.getLogger( __name__ )
+
+ERROR_MESSAGE_UNKNOWN_SRC = "Unknown dataset source (src) %s."
+ERROR_MESSAGE_NO_NESTED_IDENTIFIERS = "Dataset source new_collection requires nested element_identifiers for new collection."
+ERROR_MESSAGE_NO_NAME = "Cannot load invalid dataset identifier - missing name - %s"
+ERROR_MESSAGE_NO_COLLECTION_TYPE = "No collection_type define for nested collection %s."
+ERROR_MESSAGE_INVALID_PARAMETER_FOUND = "Found invalid parameter %s in element identifier description %s."
+ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND = "Found duplicated element identifier name %s."
+
+
+def api_payload_to_create_params( payload ):
+ """
+ Cleanup API payload to pass into dataset_collections.
+ """
+ required_parameters = [ "collection_type", "element_identifiers" ]
+ missing_parameters = [ p for p in required_parameters if p not in payload ]
+ if missing_parameters:
+ message = "Missing required parameters %s" % missing_parameters
+ raise exceptions.ObjectAttributeMissingException( message )
+
+ params = dict(
+ collection_type=payload.get( "collection_type" ),
+ element_identifiers=payload.get( "element_identifiers" ),
+ name=payload.get( "name", None ),
+ )
+
+ return params
+
+
+def validate_input_element_identifiers( element_identifiers ):
+ """ Scan through the list of element identifiers supplied by the API consumer
+ and verify the structure is valid.
+ """
+ log.debug( "Validating %d element identifiers for collection creation." % len( element_identifiers ) )
+ identifier_names = set()
+ for element_identifier in element_identifiers:
+ if "__object__" in element_identifier:
+ message = ERROR_MESSAGE_INVALID_PARAMETER_FOUND % ( "__model_object__", element_identifier )
+ raise exceptions.RequestParameterInvalidException( message )
+ if "name" not in element_identifier:
+ message = ERROR_MESSAGE_NO_NAME % element_identifier
+ raise exceptions.RequestParameterInvalidException( message )
+ name = element_identifier[ "name" ]
+ if name in identifier_names:
+ message = ERROR_MESSAGE_DUPLICATED_IDENTIFIER_FOUND % name
+ raise exceptions.RequestParameterInvalidException( message )
+ else:
+ identifier_names.add( name )
+ src = element_identifier.get( "src", "hda" )
+ if src not in [ "hda", "hdca", "ldda", "new_collection" ]:
+ message = ERROR_MESSAGE_UNKNOWN_SRC % src
+ raise exceptions.RequestParameterInvalidException( message )
+ if src == "new_collection":
+ if "element_identifiers" not in element_identifier:
+ message = ERROR_MESSAGE_NO_NESTED_IDENTIFIERS
+ raise exceptions.RequestParameterInvalidException( ERROR_MESSAGE_NO_NESTED_IDENTIFIERS )
+ if "collection_type" not in element_identifier:
+ message = ERROR_MESSAGE_NO_COLLECTION_TYPE % element_identifier
+ raise exceptions.RequestParameterInvalidException( message )
+ validate_input_element_identifiers( element_identifier[ "element_identifiers" ] )
+
+
+def dictify_dataset_collection_instance( dataset_colleciton_instance, parent, security, view="element" ):
+ dict_value = dataset_colleciton_instance.to_dict( view=view )
+ encoded_id = security.encode_id( dataset_colleciton_instance.id )
+ if isinstance( parent, model.History ):
+ encoded_history_id = security.encode_id( parent.id )
+ dict_value[ 'url' ] = web.url_for( 'history_content_typed', history_id=encoded_history_id, id=encoded_id, type="dataset_collection" )
+ elif isinstance( parent, model.LibraryFolder ):
+ encoded_library_id = security.encode_id( parent.library.id )
+ encoded_folder_id = security.encode_id( parent.id )
+ # TODO: Work in progress - this end-point is not right yet...
+ dict_value[ 'url' ] = web.url_for( 'library_content', library_id=encoded_library_id, id=encoded_id, folder_id=encoded_folder_id )
+ if view == "element":
+ dict_value[ 'elements' ] = map( dictify_element, dataset_colleciton_instance.collection.elements )
+ security.encode_all_ids( dict_value, recursive=True ) # TODO: Use Kyle's recusrive formulation of this.
+ return dict_value
+
+
+def dictify_element( element ):
+ dictified = element.to_dict( view="element" )
+ object_detials = element.element_object.to_dict()
+ if element.child_collection:
+ # Recursively yield elements for each nested collection...
+ object_detials[ "elements" ] = map( dictify_element, element.child_collection.elements )
+
+ dictified[ "object" ] = object_detials
+ return dictified
+
+__all__ = [ api_payload_to_create_params, dictify_dataset_collection_instance ]
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/managers/histories.py
--- a/lib/galaxy/managers/histories.py
+++ b/lib/galaxy/managers/histories.py
@@ -10,9 +10,9 @@
from galaxy.managers import base as manager_base
import galaxy.managers.hdas
+import galaxy.managers.collections_util
import galaxy.web
-import galaxy.dataset_collections.util
import logging
log = logging.getLogger( __name__ )
@@ -141,7 +141,7 @@
history and an array of serialized history contents respectively.
"""
hda_mgr = galaxy.managers.hdas.HDAManager()
- collection_dictifier = galaxy.dataset_collections.util.dictify_dataset_collection_instance
+ collection_dictifier = galaxy.managers.collections_util.dictify_dataset_collection_instance
history_dictionary = {}
contents_dictionaries = []
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/webapps/galaxy/api/dataset_collections.py
--- a/lib/galaxy/webapps/galaxy/api/dataset_collections.py
+++ b/lib/galaxy/webapps/galaxy/api/dataset_collections.py
@@ -4,8 +4,7 @@
from galaxy.web.base.controller import UsesHistoryMixin
from galaxy.web.base.controller import UsesLibraryMixinItems
-from galaxy.dataset_collections.util import api_payload_to_create_params
-from galaxy.dataset_collections.util import dictify_dataset_collection_instance
+from galaxy.managers.collections_util import api_payload_to_create_params, dictify_dataset_collection_instance
from logging import getLogger
log = getLogger( __name__ )
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -16,12 +16,9 @@
from galaxy.web.base.controller import UsesLibraryMixinItems
from galaxy.web.base.controller import UsesTagsMixin
-from galaxy.dataset_collections.util import api_payload_to_create_params
-from galaxy.dataset_collections.util import dictify_dataset_collection_instance
-
-
from galaxy.managers import histories
from galaxy.managers import hdas
+from galaxy.managers.collections_util import api_payload_to_create_params, dictify_dataset_collection_instance
import logging
log = logging.getLogger( __name__ )
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -5,11 +5,10 @@
from galaxy import web
from galaxy import exceptions
from galaxy.web import _future_expose_api as expose_api
-from galaxy.dataset_collections.util import api_payload_to_create_params
-from galaxy.dataset_collections.util import dictify_dataset_collection_instance
from galaxy.web.base.controller import BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems
from galaxy.web.base.controller import UsesHistoryDatasetAssociationMixin
from galaxy.web.base.controller import HTTPBadRequest, url_for
+from galaxy.managers.collections_util import api_payload_to_create_params, dictify_dataset_collection_instance
from galaxy.model import ExtendedMetadata, ExtendedMetadataIndex
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.orm.exc import NoResultFound
diff -r f58a9199e9922c3bef27240aa613a9a3c5bae67e -r f1a1c52f8495d1035d1c0a5e21b710974db0908e lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -9,7 +9,8 @@
from galaxy.visualization.genomes import GenomeRegion
from galaxy.util.json import to_json_string
from galaxy.visualization.data_providers.genome import *
-from galaxy.dataset_collections.util import dictify_dataset_collection_instance
+
+from galaxy.managers.collections_util import dictify_dataset_collection_instance
import logging
log = logging.getLogger( __name__ )
https://bitbucket.org/galaxy/galaxy-central/commits/b17747153f1a/
Changeset: b17747153f1a
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Extract all the workflow run API param handling out...
This should allow for the reuse of all of this in asynchronous workflow running and make unit testing of all the different paths easier (though that is not included in this commit - the API functional test coverage for this code is pretty decent at this point).
Affected #: 2 files
diff -r f1a1c52f8495d1035d1c0a5e21b710974db0908e -r b17747153f1a55292a03392cf2c9f5a6c69c5460 lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -15,7 +15,7 @@
from galaxy.web.base.controller import SharableMixin
from galaxy.workflow.extract import extract_workflow
from galaxy.workflow.run import invoke
-from galaxy.workflow.run import WorkflowRunConfig
+from galaxy.workflow.run_request import build_workflow_run_config
log = logging.getLogger(__name__)
@@ -212,105 +212,12 @@
message = "Invalid workflow_id specified."
raise exceptions.RequestParameterInvalidException( message )
- # Pull other parameters out of payload.
- param_map = payload.get( 'parameters', {} )
- inputs = payload.get( 'inputs', None )
- inputs_by = payload.get( 'inputs_by', None )
- if inputs is None:
- # Default to legacy behavior - read ds_map and reference steps
- # by unencoded step id (a raw database id).
- inputs = payload.get( 'ds_map', {} )
- inputs_by = inputs_by or 'step_id'
- else:
- inputs = inputs or {}
- # New default is to reference steps by index of workflow step
- # which is intrinsic to the workflow and independent of the state
- # of Galaxy at the time of workflow import.
- inputs_by = inputs_by or 'step_index'
-
- valid_inputs_by = [ 'step_id', 'step_index', 'name' ]
- if inputs_by not in valid_inputs_by:
- trans.response.status = 403
- error_message_template = "Invalid inputs_by specified '%s' must be one of %s"
- error_message = error_message_template % ( inputs_by, valid_inputs_by )
- raise ValueError( error_message )
-
- add_to_history = 'no_add_to_history' not in payload
- history_param = payload.get('history', '')
-
# Get workflow + accessibility check.
stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
workflow = stored_workflow.latest_workflow
- # Sanity checks.
- if len( workflow.steps ) == 0:
- raise exceptions.MessageException( "Workflow cannot be run because it does not have any steps" )
- if workflow.has_cycles:
- raise exceptions.MessageException( "Workflow cannot be run because it contains cycles" )
- if workflow.has_errors:
- message = "Workflow cannot be run because of validation errors in some steps"
- raise exceptions.MessageException( message )
-
- # Get target history.
- if history_param.startswith('hist_id='):
- # Passing an existing history to use.
- encoded_history_id = history_param[ 8: ]
- history_id = self.__decode_id( trans, encoded_history_id, model_type="history" )
- history = self.history_manager.get( trans, history_id, check_ownership=True )
- else:
- # Send workflow outputs to new history.
- history = self.app.model.History(name=history_param, user=trans.user)
- trans.sa_session.add(history)
- trans.sa_session.flush()
-
- # Set workflow inputs.
- for k in inputs:
- try:
- if inputs[k]['src'] == 'ldda':
- ldda = trans.sa_session.query(self.app.model.LibraryDatasetDatasetAssociation).get(
- trans.security.decode_id(inputs[k]['id']))
- assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
- content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
- elif inputs[k]['src'] == 'ld':
- ldda = trans.sa_session.query(self.app.model.LibraryDataset).get(
- trans.security.decode_id(inputs[k]['id'])).library_dataset_dataset_association
- assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
- content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
- elif inputs[k]['src'] == 'hda':
- # Get dataset handle, add to dict and history if necessary
- content = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(
- trans.security.decode_id(inputs[k]['id']))
- assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), content.dataset )
- elif inputs[k]['src'] == 'hdca':
- content = self.app.dataset_collections_service.get_dataset_collection_instance(
- trans,
- 'history',
- inputs[k]['id']
- )
- else:
- message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
- raise exceptions.RequestParameterInvalidException( message )
- if add_to_history and content.history != history:
- content = content.copy()
- if isinstance( content, self.app.model.HistoryDatasetAssociation ):
- history.add_dataset( content )
- else:
- history.add_dataset_collection( content )
- inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
- except AssertionError:
- message = "Invalid workflow input '%s' specified" % inputs[k]['id']
- raise exceptions.ItemAccessibilityException( message )
-
- # Run each step, connecting outputs to inputs
- replacement_dict = payload.get('replacement_params', {})
-
- run_config = WorkflowRunConfig(
- target_history=history,
- replacement_dict=replacement_dict,
- inputs=inputs,
- inputs_by=inputs_by,
- param_map=param_map,
- )
+ run_config = build_workflow_run_config( trans, workflow, payload )
+ history = run_config.target_history
# invoke may throw MessageExceptions on tool erors, failure
# to match up inputs, etc...
@@ -525,8 +432,8 @@
return stored_workflow
def __get_stored_workflow( self, trans, workflow_id ):
+ workflow_id = self.__decode_id( trans, workflow_id )
try:
- workflow_id = self.__decode_id( trans, workflow_id )
query = trans.sa_session.query( trans.app.model.StoredWorkflow )
stored_workflow = query.get( workflow_id )
except Exception:
diff -r f1a1c52f8495d1035d1c0a5e21b710974db0908e -r b17747153f1a55292a03392cf2c9f5a6c69c5460 lib/galaxy/workflow/run_request.py
--- /dev/null
+++ b/lib/galaxy/workflow/run_request.py
@@ -0,0 +1,114 @@
+from galaxy import exceptions
+
+from galaxy.managers import histories
+from galaxy.workflow.run import WorkflowRunConfig
+
+
+def build_workflow_run_config( trans, workflow, payload ):
+ app = trans.app
+ history_manager = histories.HistoryManager()
+
+ # Pull other parameters out of payload.
+ param_map = payload.get( 'parameters', {} )
+ inputs = payload.get( 'inputs', None )
+ inputs_by = payload.get( 'inputs_by', None )
+ if inputs is None:
+ # Default to legacy behavior - read ds_map and reference steps
+ # by unencoded step id (a raw database id).
+ inputs = payload.get( 'ds_map', {} )
+ inputs_by = inputs_by or 'step_id'
+ else:
+ inputs = inputs or {}
+ # New default is to reference steps by index of workflow step
+ # which is intrinsic to the workflow and independent of the state
+ # of Galaxy at the time of workflow import.
+ inputs_by = inputs_by or 'step_index'
+
+ valid_inputs_by = [ 'step_id', 'step_index', 'name' ]
+ if inputs_by not in valid_inputs_by:
+ trans.response.status = 403
+ error_message_template = "Invalid inputs_by specified '%s' must be one of %s"
+ error_message = error_message_template % ( inputs_by, valid_inputs_by )
+ raise ValueError( error_message )
+
+ add_to_history = 'no_add_to_history' not in payload
+ history_param = payload.get('history', '')
+
+ # Sanity checks.
+ if len( workflow.steps ) == 0:
+ raise exceptions.MessageException( "Workflow cannot be run because it does not have any steps" )
+ if workflow.has_cycles:
+ raise exceptions.MessageException( "Workflow cannot be run because it contains cycles" )
+ if workflow.has_errors:
+ message = "Workflow cannot be run because of validation errors in some steps"
+ raise exceptions.MessageException( message )
+
+ # Get target history.
+ if history_param.startswith('hist_id='):
+ # Passing an existing history to use.
+ encoded_history_id = history_param[ 8: ]
+ history_id = __decode_id( trans, encoded_history_id, model_type="history" )
+ history = history_manager.get( trans, history_id, check_ownership=True )
+ else:
+ # Send workflow outputs to new history.
+ history = app.model.History(name=history_param, user=trans.user)
+ trans.sa_session.add(history)
+ trans.sa_session.flush()
+
+ # Set workflow inputs.
+ for k in inputs:
+ try:
+ if inputs[k]['src'] == 'ldda':
+ ldda = trans.sa_session.query(app.model.LibraryDatasetDatasetAssociation).get(
+ trans.security.decode_id(inputs[k]['id']))
+ assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
+ content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
+ elif inputs[k]['src'] == 'ld':
+ ldda = trans.sa_session.query(app.model.LibraryDataset).get(
+ trans.security.decode_id(inputs[k]['id'])).library_dataset_dataset_association
+ assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
+ content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
+ elif inputs[k]['src'] == 'hda':
+ # Get dataset handle, add to dict and history if necessary
+ content = trans.sa_session.query(app.model.HistoryDatasetAssociation).get(
+ trans.security.decode_id(inputs[k]['id']))
+ assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), content.dataset )
+ elif inputs[k]['src'] == 'hdca':
+ content = app.dataset_collections_service.get_dataset_collection_instance(
+ trans,
+ 'history',
+ inputs[k]['id']
+ )
+ else:
+ message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
+ raise exceptions.RequestParameterInvalidException( message )
+ if add_to_history and content.history != history:
+ content = content.copy()
+ if isinstance( content, app.model.HistoryDatasetAssociation ):
+ history.add_dataset( content )
+ else:
+ history.add_dataset_collection( content )
+ inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
+ except AssertionError:
+ message = "Invalid workflow input '%s' specified" % inputs[k]['id']
+ raise exceptions.ItemAccessibilityException( message )
+
+ # Run each step, connecting outputs to inputs
+ replacement_dict = payload.get('replacement_params', {})
+
+ run_config = WorkflowRunConfig(
+ target_history=history,
+ replacement_dict=replacement_dict,
+ inputs=inputs,
+ inputs_by=inputs_by,
+ param_map=param_map,
+ )
+ return run_config
+
+
+def __decode_id( trans, workflow_id, model_type="workflow" ):
+ try:
+ return trans.security.decode_id( workflow_id )
+ except Exception:
+ message = "Malformed %s id ( %s ) specified, unable to decode" % ( model_type, workflow_id )
+ raise exceptions.MalformedId( message )
https://bitbucket.org/galaxy/galaxy-central/commits/041779f857a1/
Changeset: 041779f857a1
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Hack to get around circular dependency by histories and hdas manager modules.
======================================================================
ERROR: Failure: ImportError (cannot import name histories)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
addr.filename, addr.module)
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/john/workspace/lwr/.venv/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/john/workspace/galaxy-central/test/unit/workflows/test_workflow_run_request.py", line 4, in <module>
from galaxy.workflow import run_request
File "/home/john/workspace/galaxy-central/lib/galaxy/workflow/run_request.py", line 4, in <module>
import galaxy.managers.histories
File "/home/john/workspace/galaxy-central/lib/galaxy/managers/histories.py", line 12, in <module>
import galaxy.managers.hdas
File "/home/john/workspace/galaxy-central/lib/galaxy/managers/hdas.py", line 11, in <module>
from galaxy.managers import histories as history_manager
ImportError: cannot import name histories
Affected #: 1 file
diff -r b17747153f1a55292a03392cf2c9f5a6c69c5460 -r 041779f857a178092e216a628b62d3c04a4c8977 lib/galaxy/managers/histories.py
--- a/lib/galaxy/managers/histories.py
+++ b/lib/galaxy/managers/histories.py
@@ -9,7 +9,6 @@
from galaxy.model import orm
from galaxy.managers import base as manager_base
-import galaxy.managers.hdas
import galaxy.managers.collections_util
import galaxy.web
@@ -140,6 +139,8 @@
Returns a dictionary containing ``history`` and ``contents``, serialized
history and an array of serialized history contents respectively.
"""
+ # import here prevents problems related to circular dependecy between histories and hdas managers.
+ import galaxy.managers.hdas
hda_mgr = galaxy.managers.hdas.HDAManager()
collection_dictifier = galaxy.managers.collections_util.dictify_dataset_collection_instance
https://bitbucket.org/galaxy/galaxy-central/commits/7772ff282e95/
Changeset: 7772ff282e95
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Cleanup repeated dictionary access in build_workflow_run_config, better error handling.
Affected #: 1 file
diff -r 041779f857a178092e216a628b62d3c04a4c8977 -r 7772ff282e95516a4d39ef0a87afeabb8b123d23 lib/galaxy/workflow/run_request.py
--- a/lib/galaxy/workflow/run_request.py
+++ b/lib/galaxy/workflow/run_request.py
@@ -56,31 +56,39 @@
trans.sa_session.flush()
# Set workflow inputs.
- for k in inputs:
+ for input_dict in inputs.itervalues():
+ if 'src' not in input_dict:
+ message = "Not input source type defined for input '%s'." % input_dict
+ raise exceptions.RequestParameterInvalidException( message )
+ if 'id' not in input_dict:
+ message = "Not input id defined for input '%s'." % input_dict
+ raise exceptions.RequestParameterInvalidException( message )
+ input_source = input_dict['src']
+ input_id = input_dict['id']
try:
- if inputs[k]['src'] == 'ldda':
+ if input_source == 'ldda':
ldda = trans.sa_session.query(app.model.LibraryDatasetDatasetAssociation).get(
- trans.security.decode_id(inputs[k]['id']))
+ trans.security.decode_id(input_id))
assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
- elif inputs[k]['src'] == 'ld':
+ elif input_source == 'ld':
ldda = trans.sa_session.query(app.model.LibraryDataset).get(
- trans.security.decode_id(inputs[k]['id'])).library_dataset_dataset_association
+ trans.security.decode_id(input_id)).library_dataset_dataset_association
assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset )
content = ldda.to_history_dataset_association(history, add_to_history=add_to_history)
- elif inputs[k]['src'] == 'hda':
+ elif input_source == 'hda':
# Get dataset handle, add to dict and history if necessary
content = trans.sa_session.query(app.model.HistoryDatasetAssociation).get(
- trans.security.decode_id(inputs[k]['id']))
+ trans.security.decode_id(input_id))
assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), content.dataset )
- elif inputs[k]['src'] == 'hdca':
+ elif input_source == 'hdca':
content = app.dataset_collections_service.get_dataset_collection_instance(
trans,
'history',
- inputs[k]['id']
+ input_id
)
else:
- message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
+ message = "Unknown workflow input source '%s' specified." % input_source
raise exceptions.RequestParameterInvalidException( message )
if add_to_history and content.history != history:
content = content.copy()
@@ -88,9 +96,9 @@
history.add_dataset( content )
else:
history.add_dataset_collection( content )
- inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
+ input_dict['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
except AssertionError:
- message = "Invalid workflow input '%s' specified" % inputs[k]['id']
+ message = "Invalid workflow input '%s' specified" % input_id
raise exceptions.ItemAccessibilityException( message )
# Run each step, connecting outputs to inputs
https://bitbucket.org/galaxy/galaxy-central/commits/84caa9526b5f/
Changeset: 84caa9526b5f
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Change 'hda' input name in workflow inputs dict to 'content'...
... 'content' better reflects that this can be either an HDA or an HDCA.
Affected #: 2 files
diff -r 7772ff282e95516a4d39ef0a87afeabb8b123d23 -r 84caa9526b5fe407718082dcdd7c8b65cb210175 lib/galaxy/workflow/run.py
--- a/lib/galaxy/workflow/run.py
+++ b/lib/galaxy/workflow/run.py
@@ -224,7 +224,7 @@
else:
raise Exception("Unknown history content encountered")
if self.inputs:
- outputs[ step.id ][ 'output' ] = self.inputs_by_step_id[ step.id ][ 'hda' ]
+ outputs[ step.id ][ 'output' ] = self.inputs_by_step_id[ step.id ][ 'content' ]
return job
diff -r 7772ff282e95516a4d39ef0a87afeabb8b123d23 -r 84caa9526b5fe407718082dcdd7c8b65cb210175 lib/galaxy/workflow/run_request.py
--- a/lib/galaxy/workflow/run_request.py
+++ b/lib/galaxy/workflow/run_request.py
@@ -63,6 +63,9 @@
if 'id' not in input_dict:
message = "Not input id defined for input '%s'." % input_dict
raise exceptions.RequestParameterInvalidException( message )
+ if 'content' in input_dict:
+ message = "Input cannot specify explicit 'content' attribute %s'." % input_dict
+ raise exceptions.RequestParameterInvalidException( message )
input_source = input_dict['src']
input_id = input_dict['id']
try:
@@ -96,7 +99,7 @@
history.add_dataset( content )
else:
history.add_dataset_collection( content )
- input_dict['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
+ input_dict['content'] = content
except AssertionError:
message = "Invalid workflow input '%s' specified" % input_id
raise exceptions.ItemAccessibilityException( message )
https://bitbucket.org/galaxy/galaxy-central/commits/483ceff2d2b6/
Changeset: 483ceff2d2b6
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Normalize workflow step parameters earlier...
... this will allow linking to actual steps (referential integrity) if/when we store workflow requests in the database.
Also unit tests.
Affected #: 4 files
diff -r 84caa9526b5fe407718082dcdd7c8b65cb210175 -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde lib/galaxy/workflow/run.py
--- a/lib/galaxy/workflow/run.py
+++ b/lib/galaxy/workflow/run.py
@@ -41,9 +41,9 @@
that step ('name').
:type inputs_by: str
- :param param_map: Override tool and/or step parameters (see documentation on
- _update_step_parameters below).
- :type param_map:
+ :param param_map: Override step parameters - should be dict with step id keys and
+ tool param name-value dicts as values.
+ :type param_map: dict
"""
def __init__( self, target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, inputs_by='step_id', param_map={} ):
@@ -304,36 +304,9 @@
self.inputs_by_step_id[ step.id ] = self.inputs[ key ]
-def _update_step_parameters(step, param_map):
- """
- Update ``step`` parameters based on the user-provided ``param_map`` dict.
-
- ``param_map`` should be structured as follows::
-
- PARAM_MAP = {STEP_ID: PARAM_DICT, ...}
- PARAM_DICT = {NAME: VALUE, ...}
-
- For backwards compatibility, the following (deprecated) format is
- also supported for ``param_map``::
-
- PARAM_MAP = {TOOL_ID: PARAM_DICT, ...}
-
- in which case PARAM_DICT affects all steps with the given tool id.
- If both by-tool-id and by-step-id specifications are used, the
- latter takes precedence.
-
- Finally (again, for backwards compatibility), PARAM_DICT can also
- be specified as::
-
- PARAM_DICT = {'param': NAME, 'value': VALUE}
-
- Note that this format allows only one parameter to be set per step.
- """
- param_dict = param_map.get(step.tool_id, {}).copy()
- param_dict.update(param_map.get(str(step.id), {}))
+def _update_step_parameters(step, normalized_param_map):
+ param_dict = normalized_param_map.get(step.id, {})
if param_dict:
- if 'param' in param_dict and 'value' in param_dict:
- param_dict[param_dict['param']] = param_dict['value']
step.state.inputs.update(param_dict)
diff -r 84caa9526b5fe407718082dcdd7c8b65cb210175 -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde lib/galaxy/workflow/run_request.py
--- a/lib/galaxy/workflow/run_request.py
+++ b/lib/galaxy/workflow/run_request.py
@@ -4,12 +4,62 @@
from galaxy.workflow.run import WorkflowRunConfig
+def normalize_step_parameters(steps, param_map):
+ """ Take a complex param_map that can reference parameters by
+ step_id in the new flexible way or in the old one-parameter
+ per tep fashion or by tool id and normalize the parameters so
+ everything is referenced by a numeric step id.
+ """
+ normalized_param_map = {}
+ for step in steps:
+ param_dict = _step_parameters(step, param_map)
+ if param_dict:
+ normalized_param_map[step.id] = param_dict
+ return normalized_param_map
+
+
+def _step_parameters(step, param_map):
+ """
+ Update ``step`` parameters based on the user-provided ``param_map`` dict.
+
+ ``param_map`` should be structured as follows::
+
+ PARAM_MAP = {STEP_ID: PARAM_DICT, ...}
+ PARAM_DICT = {NAME: VALUE, ...}
+
+ For backwards compatibility, the following (deprecated) format is
+ also supported for ``param_map``::
+
+ PARAM_MAP = {TOOL_ID: PARAM_DICT, ...}
+
+ in which case PARAM_DICT affects all steps with the given tool id.
+ If both by-tool-id and by-step-id specifications are used, the
+ latter takes precedence.
+
+ Finally (again, for backwards compatibility), PARAM_DICT can also
+ be specified as::
+
+ PARAM_DICT = {'param': NAME, 'value': VALUE}
+
+ Note that this format allows only one parameter to be set per step.
+ """
+ param_dict = param_map.get(step.tool_id, {}).copy()
+ param_dict.update(param_map.get(str(step.id), {}))
+ if param_dict:
+ if 'param' in param_dict and 'value' in param_dict:
+ param_dict[param_dict['param']] = param_dict['value']
+ del param_dict[ 'param' ]
+ del param_dict[ 'value' ]
+ return param_dict
+
+
def build_workflow_run_config( trans, workflow, payload ):
app = trans.app
history_manager = histories.HistoryManager()
# Pull other parameters out of payload.
param_map = payload.get( 'parameters', {} )
+ param_map = normalize_step_parameters( workflow.steps, param_map )
inputs = payload.get( 'inputs', None )
inputs_by = payload.get( 'inputs_by', None )
if inputs is None:
diff -r 84caa9526b5fe407718082dcdd7c8b65cb210175 -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde test/unit/workflows/test_run_parameters.py
--- /dev/null
+++ b/test/unit/workflows/test_run_parameters.py
@@ -0,0 +1,84 @@
+from .workflow_support import MockTrans
+
+from galaxy import model
+from galaxy.workflow.run_request import normalize_step_parameters
+
+
+def test_normalize_parameters_empty():
+ normalized_params = __normalize_parameters_against_fixture( {} )
+ assert normalized_params == {}
+
+
+def test_normalize_parameters_by_tool():
+ normalized_params = __normalize_parameters_against_fixture( {
+ 'cat1': { 'foo': 'bar' }
+ } )
+ # Tool specified parameters are expanded out.
+ assert normalized_params[ 3 ] == { 'foo': 'bar' }
+ assert normalized_params[ 4 ] == { 'foo': 'bar' }
+ assert len( normalized_params.keys() ) == 2
+
+
+def test_step_parameters():
+ normalized_params = __normalize_parameters_against_fixture( {
+ '1': { 'foo': 'bar' }
+ } )
+ assert normalized_params[ 1 ] == { 'foo': 'bar' }
+ assert len( normalized_params.keys() ) == 1
+
+
+def test_step_parameters_legacy():
+ normalized_params = __normalize_parameters_against_fixture( {
+ '1': { 'param': 'foo', 'value': 'bar' }
+ } )
+ assert normalized_params[ 1 ] == { 'foo': 'bar' }, normalized_params
+ assert len( normalized_params.keys() ) == 1
+
+
+def __normalize_parameters_against_fixture( params ):
+ trans = MockTrans()
+ workflow = __workflow_fixure( trans )
+ normalized_params = normalize_step_parameters( workflow.steps, params )
+ return normalized_params
+
+
+def __workflow_fixure( trans ):
+ user = model.User(
+ email="testworkflow_params(a)bx.psu.edu",
+ password="pass"
+ )
+ stored_workflow = model.StoredWorkflow()
+ stored_workflow.user = user
+ workflow = model.Workflow()
+ workflow.stored_workflow = stored_workflow
+
+ def add_step( **kwds ):
+ workflow_step = model.WorkflowStep()
+ for key, value in kwds.iteritems():
+ setattr(workflow_step, key, value)
+ workflow.steps.append( workflow_step )
+
+ trans.app.model.context.add(
+ workflow,
+ )
+
+ add_step(
+ type="input",
+ order_index=0,
+ )
+ add_step(
+ type="input",
+ order_index=1,
+ )
+ add_step(
+ type="tool",
+ tool_id="cat1",
+ order_index=2,
+ )
+ add_step(
+ type="tool",
+ tool_id="cat1",
+ order_index=4,
+ )
+ trans.app.model.context.flush()
+ return workflow
diff -r 84caa9526b5fe407718082dcdd7c8b65cb210175 -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde test/unit/workflows/workflow_support.py
--- /dev/null
+++ b/test/unit/workflows/workflow_support.py
@@ -0,0 +1,19 @@
+from galaxy.util import bunch
+from galaxy.model import mapping
+
+
+class MockTrans( object ):
+
+ def __init__( self ):
+ self.app = TestApp()
+
+
+class TestApp( object ):
+
+ def __init__( self ):
+ self.config = bunch.Bunch( )
+ self.model = mapping.init(
+ "/tmp",
+ "sqlite:///:memory:",
+ create_tables=True
+ )
https://bitbucket.org/galaxy/galaxy-central/commits/9664ed5cbb9f/
Changeset: 9664ed5cbb9f
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Normalize workflow input dataset dict earlier...
... this will allow linking to actual steps (referential integrity) if/when we store workflow requests in the database and failing faster.
Also more unit tests.
Affected #: 3 files
diff -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde -r 9664ed5cbb9fa654da1972772b5a3065450d2a15 lib/galaxy/workflow/run.py
--- a/lib/galaxy/workflow/run.py
+++ b/lib/galaxy/workflow/run.py
@@ -46,12 +46,11 @@
:type param_map: dict
"""
- def __init__( self, target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, inputs_by='step_id', param_map={} ):
+ def __init__( self, target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={} ):
self.target_history = target_history
self.replacement_dict = replacement_dict
self.copy_inputs_to_history = copy_inputs_to_history
self.inputs = inputs
- self.inputs_by = inputs_by
self.param_map = param_map
@@ -73,9 +72,7 @@
self.target_history = workflow_run_config.target_history
self.replacement_dict = workflow_run_config.replacement_dict
self.copy_inputs_to_history = workflow_run_config.copy_inputs_to_history
- self.inputs = workflow_run_config.inputs
- self.inputs_by = workflow_run_config.inputs_by
- self.inputs_by_step_id = {}
+ self.inputs_by_step_id = workflow_run_config.inputs
self.param_map = workflow_run_config.param_map
self.outputs = odict()
@@ -223,8 +220,8 @@
outputs[ step.id ][ 'input_ds_copy' ] = new_hdca
else:
raise Exception("Unknown history content encountered")
- if self.inputs:
- outputs[ step.id ][ 'output' ] = self.inputs_by_step_id[ step.id ][ 'content' ]
+ if self.inputs_by_step_id:
+ outputs[ step.id ][ 'output' ] = self.inputs_by_step_id[ step.id ]
return job
@@ -289,20 +286,6 @@
step.module = modules.module_factory.from_workflow_step( self.trans, step )
step.state = step.module.get_runtime_state()
- # This is an input step. Make sure we have an available input.
- if step.type in [ 'data_input', 'data_collection_input' ]:
- if self.inputs_by == "step_id":
- key = str( step.id )
- elif self.inputs_by == "name":
- key = step.tool_inputs.get( 'name', None )
- else:
- key = str( step.order_index )
- if key not in self.inputs:
- message = "Workflow cannot be run because an expected input step '%s' has no input dataset." % step.id
- raise exceptions.MessageException( message )
- else:
- self.inputs_by_step_id[ step.id ] = self.inputs[ key ]
-
def _update_step_parameters(step, normalized_param_map):
param_dict = normalized_param_map.get(step.id, {})
diff -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde -r 9664ed5cbb9fa654da1972772b5a3065450d2a15 lib/galaxy/workflow/run_request.py
--- a/lib/galaxy/workflow/run_request.py
+++ b/lib/galaxy/workflow/run_request.py
@@ -3,6 +3,32 @@
from galaxy.managers import histories
from galaxy.workflow.run import WorkflowRunConfig
+INPUT_STEP_TYPES = [ 'data_input', 'data_collection_input' ]
+
+
+def normalize_inputs(steps, inputs, inputs_by):
+ normalized_inputs = {}
+ for step in steps:
+ if step.type not in INPUT_STEP_TYPES:
+ continue
+
+ if inputs_by == "step_id":
+ inputs_key = str( step.id )
+ elif inputs_by == "step_index":
+ inputs_key = str( step.order_index )
+ elif inputs_by == "name":
+ inputs_key = step.tool_inputs.get( 'name', None )
+ else:
+ message = "Workflow cannot be run because unexpected inputs_by value specified."
+ raise exceptions.MessageException( message )
+ if inputs_key not in inputs:
+ message = "Workflow cannot be run because an expected input step '%s' has no input dataset." % step.id
+ raise exceptions.MessageException( message )
+
+ normalized_inputs[ step.id ] = inputs[ inputs_key ][ 'content' ]
+
+ return normalized_inputs
+
def normalize_step_parameters(steps, param_map):
""" Take a complex param_map that can reference parameters by
@@ -74,13 +100,6 @@
# of Galaxy at the time of workflow import.
inputs_by = inputs_by or 'step_index'
- valid_inputs_by = [ 'step_id', 'step_index', 'name' ]
- if inputs_by not in valid_inputs_by:
- trans.response.status = 403
- error_message_template = "Invalid inputs_by specified '%s' must be one of %s"
- error_message = error_message_template % ( inputs_by, valid_inputs_by )
- raise ValueError( error_message )
-
add_to_history = 'no_add_to_history' not in payload
history_param = payload.get('history', '')
@@ -154,14 +173,15 @@
message = "Invalid workflow input '%s' specified" % input_id
raise exceptions.ItemAccessibilityException( message )
+ normalized_inputs = normalize_inputs( workflow.steps, inputs, inputs_by )
+
# Run each step, connecting outputs to inputs
replacement_dict = payload.get('replacement_params', {})
run_config = WorkflowRunConfig(
target_history=history,
replacement_dict=replacement_dict,
- inputs=inputs,
- inputs_by=inputs_by,
+ inputs=normalized_inputs,
param_map=param_map,
)
return run_config
diff -r 483ceff2d2b6f41432cd16f4dbf539355c3f4dde -r 9664ed5cbb9fa654da1972772b5a3065450d2a15 test/unit/workflows/test_run_parameters.py
--- a/test/unit/workflows/test_run_parameters.py
+++ b/test/unit/workflows/test_run_parameters.py
@@ -2,6 +2,9 @@
from galaxy import model
from galaxy.workflow.run_request import normalize_step_parameters
+from galaxy.workflow.run_request import normalize_inputs
+
+STEP_ID_OFFSET = 4 # Offset a little so ids and order index are different.
def test_normalize_parameters_empty():
@@ -14,34 +17,87 @@
'cat1': { 'foo': 'bar' }
} )
# Tool specified parameters are expanded out.
- assert normalized_params[ 3 ] == { 'foo': 'bar' }
- assert normalized_params[ 4 ] == { 'foo': 'bar' }
+ assert normalized_params[ STEP_ID_OFFSET + 3 ] == { 'foo': 'bar' }
+ assert normalized_params[ STEP_ID_OFFSET + 4 ] == { 'foo': 'bar' }
assert len( normalized_params.keys() ) == 2
def test_step_parameters():
normalized_params = __normalize_parameters_against_fixture( {
- '1': { 'foo': 'bar' }
+ str( STEP_ID_OFFSET + 1 ): { 'foo': 'bar' }
} )
- assert normalized_params[ 1 ] == { 'foo': 'bar' }
+ assert normalized_params[ STEP_ID_OFFSET + 1 ] == { 'foo': 'bar' }
assert len( normalized_params.keys() ) == 1
def test_step_parameters_legacy():
normalized_params = __normalize_parameters_against_fixture( {
- '1': { 'param': 'foo', 'value': 'bar' }
+ str( STEP_ID_OFFSET + 1 ): { 'param': 'foo', 'value': 'bar' }
} )
- assert normalized_params[ 1 ] == { 'foo': 'bar' }, normalized_params
+ assert normalized_params[ STEP_ID_OFFSET + 1 ] == { 'foo': 'bar' }, normalized_params
assert len( normalized_params.keys() ) == 1
+def test_inputs_by_step_id():
+ input1 = __new_input()
+ input2 = __new_input()
+ normalized_inputs = __normalize_inputs_against_fixture( {
+ str( STEP_ID_OFFSET + 1 ): input1,
+ str( STEP_ID_OFFSET + 2 ): input2
+ }, inputs_by="step_id" )
+ assert normalized_inputs[ STEP_ID_OFFSET + 1 ] == input1[ 'content' ]
+ assert normalized_inputs[ STEP_ID_OFFSET + 2 ] == input2[ 'content' ]
+
+
+def test_inputs_by_step_index():
+ input1 = __new_input()
+ input2 = __new_input()
+ normalized_inputs = __normalize_inputs_against_fixture( {
+ str( 0 ): input1,
+ str( 1 ): input2
+ }, inputs_by="step_index" )
+ assert normalized_inputs[ STEP_ID_OFFSET + 1 ] == input1[ 'content' ]
+ assert normalized_inputs[ STEP_ID_OFFSET + 2 ] == input2[ 'content' ]
+
+
+def test_inputs_by_name():
+ input1 = __new_input()
+ input2 = __new_input()
+ normalized_inputs = __normalize_inputs_against_fixture( {
+ "input1": input1,
+ "input2": input2
+ }, inputs_by="name" )
+ print normalized_inputs
+ assert normalized_inputs[ STEP_ID_OFFSET + 1 ] == input1[ 'content' ]
+ assert normalized_inputs[ STEP_ID_OFFSET + 2 ] == input2[ 'content' ]
+
+
def __normalize_parameters_against_fixture( params ):
trans = MockTrans()
+ # Create a throw away workflow so step ids and order_index
+ # are different for actual fixture.
+ __workflow_fixure( trans )
+
workflow = __workflow_fixure( trans )
normalized_params = normalize_step_parameters( workflow.steps, params )
return normalized_params
+def __normalize_inputs_against_fixture( inputs, inputs_by ):
+ trans = MockTrans()
+ # Create a throw away workflow so step ids and order_index
+ # are different for actual fixture.
+ __workflow_fixure( trans )
+
+ workflow = __workflow_fixure( trans )
+ normalized_inputs = normalize_inputs( workflow.steps, inputs, inputs_by )
+ return normalized_inputs
+
+
+def __new_input( ):
+ return dict( content=model.HistoryDatasetAssociation() )
+
+
def __workflow_fixure( trans ):
user = model.User(
email="testworkflow_params(a)bx.psu.edu",
@@ -63,12 +119,14 @@
)
add_step(
- type="input",
+ type="data_input",
order_index=0,
+ tool_inputs={"name": "input1"}
)
add_step(
- type="input",
+ type="data_input",
order_index=1,
+ tool_inputs={"name": "input2"}
)
add_step(
type="tool",
@@ -81,4 +139,8 @@
order_index=4,
)
trans.app.model.context.flush()
- return workflow
+ # Expunge and reload to ensure step state is as expected from database.
+ workflow_id = workflow.id
+ trans.app.model.context.expunge_all()
+
+ return trans.app.model.context.query( model.Workflow ).get( workflow_id )
https://bitbucket.org/galaxy/galaxy-central/commits/bdc4017c2e7e/
Changeset: bdc4017c2e7e
User: jmchilton
Date: 2014-08-10 20:05:31
Summary: Move WorkflowConfig so run_request doesn't need to import run.
This is a more logical organization of these modules.
Affected #: 2 files
diff -r 9664ed5cbb9fa654da1972772b5a3065450d2a15 -r bdc4017c2e7e9ecb5dfa3d36798f535402ec80aa lib/galaxy/workflow/run.py
--- a/lib/galaxy/workflow/run.py
+++ b/lib/galaxy/workflow/run.py
@@ -13,47 +13,12 @@
from galaxy.tools.execute import execute
from galaxy.util.odict import odict
from galaxy.workflow import modules
+from galaxy.workflow.run_request import WorkflowRunConfig
import logging
log = logging.getLogger( __name__ )
-class WorkflowRunConfig( object ):
- """ Wrapper around all the ways a workflow execution can be parameterized.
-
- :param target_history: History to execute workflow in.
- :type target_history: galaxy.model.History.
-
- :param replacement_dict: Workflow level parameters used for renaming post
- job actions.
- :type replacement_dict: dict
-
- :param copy_inputs_to_history: Should input data parameters be copied to
- target_history. (Defaults to False)
- :type copy_inputs_to_history: bool
-
- :param inputs: Map from step ids to dict's containing HDA for these steps.
- :type inputs: dict
-
- :param inputs_by: How inputs maps to inputs (datasets/collections) to workflows
- steps - by unencoded database id ('step_id'), index in workflow
- 'step_index' (independent of database), or by input name for
- that step ('name').
- :type inputs_by: str
-
- :param param_map: Override step parameters - should be dict with step id keys and
- tool param name-value dicts as values.
- :type param_map: dict
- """
-
- def __init__( self, target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={} ):
- self.target_history = target_history
- self.replacement_dict = replacement_dict
- self.copy_inputs_to_history = copy_inputs_to_history
- self.inputs = inputs
- self.param_map = param_map
-
-
def invoke( trans, workflow, workflow_run_config ):
""" Run the supplied workflow in the supplied target_history.
"""
diff -r 9664ed5cbb9fa654da1972772b5a3065450d2a15 -r bdc4017c2e7e9ecb5dfa3d36798f535402ec80aa lib/galaxy/workflow/run_request.py
--- a/lib/galaxy/workflow/run_request.py
+++ b/lib/galaxy/workflow/run_request.py
@@ -1,11 +1,46 @@
from galaxy import exceptions
from galaxy.managers import histories
-from galaxy.workflow.run import WorkflowRunConfig
INPUT_STEP_TYPES = [ 'data_input', 'data_collection_input' ]
+class WorkflowRunConfig( object ):
+ """ Wrapper around all the ways a workflow execution can be parameterized.
+
+ :param target_history: History to execute workflow in.
+ :type target_history: galaxy.model.History.
+
+ :param replacement_dict: Workflow level parameters used for renaming post
+ job actions.
+ :type replacement_dict: dict
+
+ :param copy_inputs_to_history: Should input data parameters be copied to
+ target_history. (Defaults to False)
+ :type copy_inputs_to_history: bool
+
+ :param inputs: Map from step ids to dict's containing HDA for these steps.
+ :type inputs: dict
+
+ :param inputs_by: How inputs maps to inputs (datasets/collections) to workflows
+ steps - by unencoded database id ('step_id'), index in workflow
+ 'step_index' (independent of database), or by input name for
+ that step ('name').
+ :type inputs_by: str
+
+ :param param_map: Override step parameters - should be dict with step id keys and
+ tool param name-value dicts as values.
+ :type param_map: dict
+ """
+
+ def __init__( self, target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={} ):
+ self.target_history = target_history
+ self.replacement_dict = replacement_dict
+ self.copy_inputs_to_history = copy_inputs_to_history
+ self.inputs = inputs
+ self.param_map = param_map
+
+
def normalize_inputs(steps, inputs, inputs_by):
normalized_inputs = {}
for step in steps:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Trackster: refine label track position calculation.
by commits-noreply@bitbucket.org 09 Aug '14
by commits-noreply@bitbucket.org 09 Aug '14
09 Aug '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d85ae37476a1/
Changeset: d85ae37476a1
Branch: next-stable
User: jgoecks
Date: 2014-08-09 21:38:33
Summary: Trackster: refine label track position calculation.
Affected #: 2 files
diff -r 990bc0688199410ab08d5e8a418770b516c6f4e2 -r d85ae37476a17205c9869d633f3aafd104b48a98 static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/viz_views","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools","utils/config"],function(ab,w,V,j,s,J,h,X,P,R){var o=ab.extend;var l={};var i=function(ac,ad){l[ac.attr("id")]=ad};var k=function(ac,ad,af,ae){af=".group";l[ac.attr("id")]=ae;ac.bind("drag",{handle:"."+ad,relative:true},function(an,ao){var am=$(this),ar=$(this).parent(),aj=ar.children(".track,.group"),al=l[$(this).attr("id")],ai,ah,ap,ag,ak;ah=$(this).parents(af);if(ah.length!==0){ap=ah.position().top;ag=ap+ah.outerHeight();var aq=l[ah.attr("id")];if(ao.offsetY<ap){$(this).insertBefore(ah);aq.remove_drawable(al);aq.container.add_drawable_before(al,aq);return}else{if(ao.offsetY>ag){$(this).insertAfter(ah);aq.remove_drawable(al);aq.container.add_drawable(al);return}}}ah=null;for(ak=0;ak<aj.length;ak++){ai=$(aj.get(ak));ap=ai.position().top;ag=ap+ai.outerHeight();if(ai.is(af)&&this!==ai.get(0)&&ao.offsetY>=ap&&ao.offsetY<=ag){if(ao.offsetY-ap<ag-ao.offsetY){ai.find(".content-div").prepend(this)}else{ai.find(".content-div").append(this)}if(al.container){al.container.remove_drawable(al)}l[ai.attr("id")].add_drawable(al);return}}for(ak=0;ak<aj.length;ak++){ai=$(aj.get(ak));if(ao.offsetY<ai.position().top&&!(ai.hasClass("reference-track")||ai.hasClass("intro"))){break}}if(ak===aj.length){if(this!==aj.get(ak-1)){ar.append(this);l[ar.attr("id")].move_drawable(al,ak)}}else{if(this!==aj.get(ak)){$(this).insertBefore(aj.get(ak));l[ar.attr("id")].move_drawable(al,(ao.deltaY>0?ak-1:ak))}}}).bind("dragstart",function(){$(this).addClass("dragging")}).bind("dragend",function(){$(this).removeClass("dragging")})};var D=20,z=100,G=12000,Q=400,I=5000,v=100,m="Cannot display dataset due to an error. ",H="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",T="Ready for display",O=10,F=20,A=["Histogram","Line","Filled","Intensity"];function U(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var p=function(ad,ac,ag){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.view=ad;this.container=ac;this.drag_handle_class=ag.drag_handle_class;this.is_overview=false;this.action_icons={};this.config=R.ConfigSettingCollection.from_models_and_saved_values(this.config_params,ag.prefs);if(!this.config.get_value("name")){this.config.set_value("name",ag.name)}if(this.config_onchange){this.config.on("change",this.config_onchange,this)}this.container_div=this.build_container_div();this.header_div=null;if(ag.header!==false){var ae=new V.TrackHeaderView({model:this,id:this.id});this.header_div=ae.$el;this.container_div.append(this.header_div);var af=ae.icons_div;this.action_icons=ae.action_icons;this.container_div.hover(function(){af.show()},function(){af.hide()})}};p.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.config.get_value("content_visible")){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.config.set_value("content_visible",false)}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.config.set_value("content_visible",true);ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"gear",on_click_fn:function(ad){var ac=new R.ConfigSettingCollectionView({collection:ad.config});ac.render_in_modal("Configure Track")}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".tooltip").remove();ac.remove()}}];o(p.prototype,{config_params:[{key:"name",label:"Name",type:"text",default_value:""},{key:"content_visible",type:"bool",default_value:true,hidden:true}],config_onchange:function(){},init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.config.get_value("content_visible")){return true}return false},request_draw:function(){},_draw:function(ac){},to_dict:function(){},set_name:function(ac){this.old_name=this.config.get_value("name");this.config.set_value("name",ac)},revert_name:function(){if(this.old_name){this.config.set_value("name",this.old_name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ad,ac,ae){p.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};o(y.prototype,p.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=n(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(ac){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad]._draw(ac)}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{prefs:this.config.to_key_value_dict(),obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(af){var ac=this.drawables.slice(0),ad=[],ae;while(ac.length!==0){ae=ac.shift();if(ae instanceof af){ad.push(ae)}else{if(ae.drawables){ac=ac.concat(ae.drawables)}}}return ad}});var N=function(ad,ac,af){o(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);i(this.container_div,this);i(this.content_div,this);k(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new h.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.filters_manager.parent_div.after($("<div style='clear: both'/>"));this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new h.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};o(N.prototype,p.prototype,y.prototype,{action_icons_def:[p.prototype.action_icons_def[0],p.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"ui-slider-050",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw({clear_tile_cache:true})}ac.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){this.action_icons.composite_icon.toggle(this.drawables[0] instanceof e);this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao&&this.drawables[0] instanceof g){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new h.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}this.action_icons.filters_icon.toggle(this.filters_manager.filters.length>0)}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ad=new e(this.view,this.view,{name:this.config.get_value("name"),drawables:this.drawables});var ac=this.container.replace_drawable(this,ad,true);ad.request_draw()},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){y.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=o(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac){ab.each(this.drawables,function(ad){ad.request_draw(ac)})}});var Y=Backbone.View.extend({initialize:function(ac){o(ac,{obj_type:"View"});y.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=R.ConfigSettingCollection.from_models_and_saved_values([{key:"name",label:"Name",type:"text",default_value:""},{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],{name:ac.name})},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;i(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container);var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(n(ah,ac,ac))})})});this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).addClass("chrom-nav").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}ag.stopPropagation()};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_tracks(c),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})},minLength:2})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div/>").addClass("zoom-area").css("height",ac.browser_content_div.height()+ac.top_labeltrack.height()+1).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ac){return this.config.get_value(ac.toLowerCase()+"_color")||this.config.get_value("n_color")}});o(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){this.intro_div.toggle(this.drawables.length===0)},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=v;var ac=this,ad=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){var ah=new B(ac);ac.add_label_track(ah);ac.reference_track=ah}ac.chrom_data=ag.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,af=ac.chrom_data.length;aj<af;aj++){var ai=ac.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ag.prev_chroms){ak+='<option value="previous">Previous '+v+"</option>"}if(ag.next_chroms){ak+='<option value="next">Next '+v+"</option>"}ac.chrom_select.html(ak);ac.chrom_start_index=ag.start_index;ad.resolve(ag.chrom_info)},error:function(){alert("Could not load chroms for this dbkey: "+ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-v});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+v});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad===undefined&&aj===undefined){ae.low=0;ae.high=ae.max_high}else{ae.low=(ad!==undefined?Math.max(ad,0):0);if(aj===undefined){ae.low=Math.max(ae.low-15,0);ae.high=ae.low+30}else{ae.high=Math.min(aj,ae.max_high)}}ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/,/g,"");ag=ag.replace(/:|\-/g," ");var ad=ag.split(/\s+/),af=ad[0],ae=(ad[1]?parseInt(ad[1],10):undefined),ac=(ad[2]?parseInt(ad[2],10):undefined);this.change_chrom(af,ae,ac)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ac.request_redraw()},200);var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);ad.init();this.changed();this.update_intro_div();var ac=this;ad.config.on("change",function(){ac.changed()})},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){y.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ad,ae){var ac=this,af=(ae?[ae]:ac.drawables);ab.each(af,function(ag){var ah=ab.find(ac.tracks_to_be_redrawn,function(ai){return ai[0]===ag});if(ah){ah[1]=ad}else{ac.tracks_to_be_redrawn.push([ag,ad])}});if(!this.requested_redraw){requestAnimationFrame(function(){ac._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ac=this.low,ag=this.high;if(ac<this.max_low){ac=this.max_low}if(ag>this.max_high){ag=this.max_high}var ad=this.high-this.low;if(this.high!==0&&ad<this.min_separation){ag=ac+this.min_separation}this.low=Math.floor(ac);this.high=Math.ceil(ag);this.update_location(this.low,this.high);this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:af,width:Math.max(ae,ah)}).show();if(ah<ae){this.overview_box.css("left",af-(ae-ah)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:ah})}ab.each(this.tracks_to_be_redrawn,function(ak){var ai=ak[0],aj=ak[1];if(ai){ai._draw(aj)}});this.tracks_to_be_redrawn=[];ab.each(this.label_tracks,function(ai){ai._draw()})},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_viewport:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height())},resize_window:function(){this.resize_viewport();this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ae.dataset.id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=P.Tool.extend({defaults:{track:null},initialize:function(ac){P.Tool.prototype.initialize.call(this,ac);var ad=true;if(ac.tool_state!==undefined&&ac.tool_state.hidden!==undefined){ad=ac.tool_state.hidden}this.set("hidden",ad);this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ac){return ab.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var t=Backbone.View.extend({events:{"change :input":"update_value"},render:function(){var ae=this.$el.addClass("param-row"),af=this.model;var ac=$("<div>").addClass("param-label").text(af.get("label")).appendTo(ae);var ad=$("<div/>").addClass("param-input").html(af.get("html")).appendTo(ae);ad.find(":input").val(af.get("value"));$("<div style='clear: both;'/>").appendTo(ae)},update_value:function(ac){this.model.set_value($(ac.target).val())}});var aa=Backbone.View.extend({initialize:function(ac){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ad=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ah){ah.stopPropagation()}).click(function(ah){ah.stopPropagation()}).bind("dblclick",function(ah){ah.stopPropagation()}).keydown(function(ah){ah.stopPropagation()});var ae=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(ai){var ah=new t({model:ai});ah.render();parent_div.append(ah.$el)});parent_div.find("input").click(function(){$(this).select()});var af=$("<div>").addClass("param-row").appendTo(parent_div);var ag=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(af);var ac=$("<input type='submit'>").attr("value","Run on visible region").appendTo(af);ac.click(function(){ad.run_on_region()});ag.click(function(){ad.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){this.$el.toggle(this.model.is_visible())},update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},run_on_dataset:function(){var ac=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ac.id},null,function(ad){Galaxy.modal.show({title:ac.get("name")+" is Running",body:ac.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",buttons:{Close:function(){Galaxy.modal.hide()}}})})},run_on_region:function(){var ad=this.model.get("track"),ag=this.model,ai=new w.GenomeRegion({chrom:ad.view.chrom,start:ad.view.low,end:ad.view.high}),aj={target_dataset_id:ad.dataset.id,action:"rerun",tool_id:ag.id,regions:[ai.toJSON()]},ah=ad,al=ag.get("name")+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ak=new N(view,view,{name:ad.config.get_value("name")});var af=ah.container.replace_drawable(ah,ak,false);ak.container_div.insertBefore(ah.view.content_div.children()[af]);ak.add_drawable(ah);ah.container_div.appendTo(ak.content_div);ac=ak}else{ac=ah.container}var ae=new ah.constructor(view,ac,{name:al,hda_ldda:"hda"});ae.init_for_tool_data();ae.change_mode(ah.mode);ae.set_filters_manager(ah.filters_manager.copy(ae));ae.update_icons();ac.add_drawable(ae);ae.tiles_div.text("Starting job.");this.run(aj,ae,function(am){ae.set_dataset(new X.Dataset(am));ae.tiles_div.text("Running job.");ae.init()})},run:function(ac,ae,af){ac.inputs=this.model.get_inputs_dict();var ad=new j.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(H)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(x+ag.message)}else{af(ag)}}})}});var C=function(ac,ad){J.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var b=function(ac,af,ag,ad,ae){this.track=ac;this.region=af;this.low=af.get("start");this.high=af.get("end");this.w_scale=ag;this.canvas=ad;this.html_elt=$("<div class='track-tile'/>").append(ad);this.data=ae;this.stale=false};b.prototype.predisplay_actions=function(){};var K=function(ac,af,ag,ad,ae){b.call(this,ac,af,ag,ad,ae)};K.prototype.predisplay_actions=function(){};var M=function(ae,aj,al,ad,ag,ah,am,ac,ai,af,ak){b.call(this,ae,aj,al,ad,ag);this.mode=ah;this.all_slotted=ac;this.feature_mapper=ai;this.has_icons=false;this.incomplete_features=af;this.other_tiles_features_drawn={};this.seq_data=ak};o(M.prototype,b.prototype);M.prototype.predisplay_actions=function(){};var f=function(ad,ac,ae){o(ae,{drag_handle_class:"draghandle"});p.call(this,ad,ac,ae);this.dataset=null;if(ae.dataset){this.dataset=(ae.dataset instanceof Backbone.Model?ae.dataset:new X.Dataset(ae.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:I);this.data_manager=("data_manager" in ae?ae.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ad.dbkey,chroms_info:{chrom_info:ad.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=this.config.get_value("height");this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};o(f.prototype,p.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},p.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"application-dock-270",on_click_fn:function(ac){ac.view.set_overview(ac)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"ui-slider-050",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.tool.toggle();if(ac.tool.is_visible()){ac.set_name(ac.config.get_value("name")+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<strong>Tool</strong>: <%= track.tool.get("name") %><br/><strong>Dataset</strong>: <%= track.config.get_value("name") %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ae=ab.template(af,{track:ac});var ah=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new w.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}Galaxy.modal.hide();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ac.dataset.id,hda_ldda:ac.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};Galaxy.modal.show({title:"Visualize tool parameter space and output from different parameter settings?",body:ae,buttons:{No:ah,Yes:ad}})}},p.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&p.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id)},set_dataset:function(ac){this.dataset=ac;this.data_manager.set("dataset",ac)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.config.get_value("content_visible")){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.set_value("height",ac.visible_height_px);ac.changed()}).appendTo(ac.container_div)},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof g){return"LineTrack"}else{if(this instanceof S){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof e){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},show_message:function(ac){this.tiles_div.remove();return $("<span/>").addClass("message").html(ac).appendTo(this.content_div)},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.content_div.children().remove();ad.container_div.removeClass("nodata error pending");ad.tiles_div=$("<div/>").addClass("tiles").appendTo(ad.content_div);if(!ad.dataset.id){return}var ac=$.Deferred(),af={hda_ldda:ad.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");var ah=ad.show_message(m);if(ag.message){ah.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){Galaxy.modal.show({title:"Trackster Error",body:"<pre>"+ag.message+"</pre>",buttons:{Close:function(){Galaxy.modal.hide()}}})}));ah.append($("<span/>").text(" "));ah.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.show_message(H)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.show_message(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.show_message(u);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(T);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when.apply($,ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(af&&af.min&&af.max){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_default_value("min_value",ae);ac.config.set_default_value("max_value",ag);ac.config.set_value("min_value",ae);ac.config.set_value("max_value",ag)}})},get_drawables:function(){return this}});var L=function(ae,ad,ag){f.call(this,ae,ad,ag);var ac=this;k(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new h.FiltersManager(this,("filters" in ag?ag.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ag.tool?new q(ab.extend(ag.tool,{track:this,tool_state:ag.tool_state})):null);this.tile_cache=new w.Cache(O);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var af=new aa({model:this.tool});af.render();this.dynamic_tool_div=af.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);if(!this.config.get_value("content_visible")){this.tiles_div.hide()}this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ag.mode){this.change_mode(ag.mode)}};o(L.prototype,p.prototype,f.prototype,{action_icons_def:f.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ac){var ad=this.to_dict();o(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.config.to_key_value_dict(),mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(isNaN(parseFloat(ac.config.get_value("min_value")))||isNaN(parseFloat(ac.config.get_value("max_value")))){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_value("min_value",ae);ac.config.set_value("max_value",ag)}})},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.set_value("mode",ad);if(ad==="Auto"){this.data_manager.clear()}ac.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;ac.action_icons.filters_icon.toggle(ac.filters_available);ac.action_icons.tools_icon.toggle(ac.tool!==null);ac.action_icons.param_space_viz_icon.toggle(ac.tool!==null)},_gen_tile_cache_key:function(ad,ac){return ad+"_"+ac},request_draw:function(ac){if(ac&&ac.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ac,this)},before_draw:function(){this.max_height_px=0},_draw:function(aq){if(!this.can_draw()){return}var an=aq&&aq.clear_after,al=this.view.low,ag=this.view.high,aj=ag-al,ad=this.view.container.width(),ap=this.view.resolution_px_b,af=1/ap;if(this.is_overview){al=this.view.max_low;ag=this.view.max_high;ap=ad/(view.max_high-view.max_low);af=1/ap}this.before_draw();this.tiles_div.children().addClass("remove");var ak=Math.floor(Q*af),ac=Math.floor(al/ak),am,ah,ai=[],ao=[];while((ac*ak)<ag){am=new w.GenomeRegion({chrom:this.view.chrom,start:ac*ak,end:Math.min((ac+1)*ak,this.view.max_high)});ah=this.draw_helper(am,ap,aq);ai.push(ah);$.when(ah).then(function(ar){ao.push(ar)});ac+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var ae=this;$.when.apply($,ai).then(function(){ae.tiles_div.children(".remove").remove();ao=ab.filter(ao,function(ar){return ar!==null});if(ao.length!==0){ae.postdraw_actions(ao,ad,ap,an)}})},_add_yaxis_label:function(af,ah){var ad=this,ag=(af==="max"?"top":"bottom"),ai=(af==="max"?"max":"min"),ac=(af==="max"?"max_value":"min_value"),ae=this.container_div.find(".yaxislabel."+ag);ah=ah||function(){ad.request_draw({clear_tile_cache:true})};if(ae.length!==0){ae.text(ad.config.get_value(ac))}else{ae=$("<div/>").text(ad.config.get_value(ac)).make_text_editable({num_cols:12,on_finish:function(aj){$(".tooltip").remove();ad.config.set_value(ac,aj);ah()},help_text:"Set "+ai+" value"}).addClass("yaxislabel "+ag).css("color",this.config.get_value("label_color"));this.container_div.prepend(ae)}},postdraw_actions:function(af,ag,ai,ac){var ae=ab.filter(af,function(aj){return(aj instanceof K)});if(ae.length>0){this.max_height_px=0;var ad=this;ab.each(af,function(aj){if(!(aj instanceof K)){aj.html_elt.remove();ad.draw_helper(aj.region,ai,{force:true,mode:"Coverage"})}});ad._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ah=ab.find(af,function(aj){return aj.has_icons});if(ah){ab.each(af,function(aj){if(!aj.has_icons){aj.html_elt.css("padding-top",D)}})}}},get_mode:function(ac){return this.mode},update_auto_mode:function(ac){},_get_drawables:function(){return[this]},draw_helper:function(al,an,ao){if(!ao){ao={}}var ad=ao.force,ai=ao.mode||this.mode,af=1/an,ae=this,ag=this._get_drawables(),am=this._gen_tile_cache_key(an,al),ah=function(ap){return(ap&&"track" in ap)};var aj=(ad?undefined:ae.tile_cache.get_elt(am));if(aj){if(ah(aj)){ae.show_tile(aj,an)}return aj}if(ao.data_fetch===false){return null}var ak=function(){var ap=(ab.find(A,function(ar){return ar===ai})?"Coverage":ai);var aq=ab.map(ag,function(ar){return ar.data_manager.get_data(al,ap,af,ae.data_url_extra_params)});if(view.reference_track){aq.push(view.reference_track.data_manager.get_data(al,ai,af,view.reference_track.data_url_extra_params))}return aq};var ac=$.Deferred();ae.tile_cache.set_elt(am,ac);$.when.apply($,ak()).then(function(){var ap=ak(),av=ap,aB;if(ab.find(ap,function(aD){return j.is_deferred(aD)})){ae.tile_cache.set_elt(am,undefined);$.when(ae.draw_helper(al,an,ao)).then(function(aD){ac.resolve(aD)});return}if(view.reference_track){aB=view.reference_track.data_manager.subset_entry(ap.pop(),al)}var aw=[],at=[];ab.each(ag,function(aG,aD){var aF=aG.mode,aE=av[aD];if(aF==="Auto"){aF=aG.get_mode(aE);aG.update_auto_mode(aF)}aw.push(aF);at.push(aG.get_canvas_height(aE,aF,an,aq))});var au=ae.view.canvas_manager.new_canvas(),ax=al.get("start"),aC=al.get("end"),ar=0,aq=Math.ceil((aC-ax)*an)+ae.left_offset,az=ab.max(at),ay;au.width=aq;au.height=(ao.height||az);var aA=au.getContext("2d");aA.translate(ae.left_offset,0);if(ag.length>1){aA.globalAlpha=0.5;aA.globalCompositeOperation="source-over"}ab.each(ag,function(aE,aD){ay=aE.draw_tile(av[aD],aA,aw[aD],al,an,aB)});if(ay!==undefined){ae.tile_cache.set_elt(am,ay);ae.show_tile(ay,an)}ac.resolve(ay)});return ac},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},_draw_line_track_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new J.LinePainter(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah);ad.draw(ae,af.width,af.height,ai);return new K(this,ag,ai,af,ac.data)},draw_tile:function(ac,ad,ag,af,ah,ae){},show_tile:function(ae,ah){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=Math.round((ae.low-(this.is_overview?this.view.max_low:this.view.low))*ah);if(this.left_offset){ag-=this.left_offset}ac.css("left",ag);if(ac.hasClass("remove")){ac.removeClass("remove")}else{this.tiles_div.append(ac)}ac.css("height","auto");this.max_height_px=Math.max(this.max_height_px,ac.height()-2);ac.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},tool_region_and_parameters_str:function(af){var ac=this,ae=(af!==undefined?af.toString():"all"),ad=ab.values(ac.tool.get_inputs_dict()).join(", ");return" - region=["+ae+"], parameters=["+ad+"]"},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="bigwig"}else{if(ac.dataset_type==="bigwig"||ac.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ac){if(ac.message||ac.extra_info==="no_detail"){return false}else{if(ac.dataset_type==="bigwig"){return(ac.data[1][0]-ac.data[0][0]===1)}}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var W=function(ad,ac){f.call(this,ad,ac,{resize:false,header:false});this.container_div.addClass("label-track")};o(W.prototype,f.prototype,{init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ag){var ae=this.view,af=ae.high-ae.low,aj=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/aj)*aj,ah=this.view.container.width(),ad=$("<div/>").addClass("label-container");while(ac<ae.high){var ai=(ac-ae.low)/af*ah;ad.append($("<div/>").addClass("label").text(commatize(ac)).css({left:ai}));ac+=aj}this.content_div.children(":first").remove();this.content_div.append(ad)}});var e=function(ad,ac,ag){L.call(this,ad,ac,ag);this.drawables=[];if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=n(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}ab.each(this.drawables,function(ah){if(ah instanceof c||ah instanceof S){ah.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};o(e.prototype,L.prototype,{display_modes:A,config_params:ab.union(p.prototype.config_params,[{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}]),action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_group()}}].concat(L.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},on_resize:function(){var ac=this.visible_height_px;ab.each(this.drawables,function(ad){ad.visible_height_px=ac});f.prototype.on_resize.call(this)},change_mode:function(ac){L.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:p.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var af=new N(this.view,this.container,{name:this.config.get_value("name")}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw({clear_tile_cache:true})},before_draw:function(){var ad=ab.min(ab.map(this.drawables,function(ae){return ae.config.get_value("min_value")})),ac=ab.max(ab.map(this.drawables,function(ae){return ae.config.get_value("max_value")}));this.config.set_value("min_value",ad);this.config.set_value("max_value",ac);ab.each(this.drawables,function(ae){ae.config.set_value("min_value",ad);ae.config.set_value("max_value",ac)})},update_all_min_max:function(){var ad=this,ac=this.config.get_value("min_value"),ae=this.config.get_value("max_value");ab.each(this.drawables,function(af){af.config.set_value("min_value",ac);af.config.set_value("max_value",ae)});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ai,ac,al,ah){var ag=-1,ae;for(ae=0;ae<ai.length;ae++){var aj=ai[ae].html_elt.find("canvas").height();if(aj>ag){ag=aj}}for(ae=0;ae<ai.length;ae++){var af=ai[ae];if(af.html_elt.find("canvas").height()!==ag){this.draw_helper(af.region,al,{force:true,height:ag});af.html_elt.remove()}}var ad=this,ak=function(){ad.update_all_min_max()};this._add_yaxis_label("min",ak);this._add_yaxis_label("max",ak)}});var B=function(ac){L.call(this,ac,{content_div:ac.top_labeltrack},{resize:false,header:false});this.left_offset=ac.canvas_manager.char_width_px;this.container_div.addClass("reference-track");this.data_url=galaxy_config.root+"api/genomes/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};o(B.prototype,p.prototype,L.prototype,{config_params:ab.union(p.prototype.config_params,[{key:"height",type:"int",default_value:13,hidden:true}]),init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:p.prototype.can_draw,draw_helper:function(af,ah,ad){var ac=this.tiles_div.is(":visible"),ag,ae=null;if(ah>this.view.canvas_manager.char_width_px){this.tiles_div.show();ag=true;ae=L.prototype.draw_helper.call(this,af,ah,ad)}else{ag=false;this.tiles_div.hide()}if(ac!==ag){this.view.resize_viewport()}return ae},can_subset:function(ac){return true},draw_tile:function(ae,ak,af,ah,al){var ad=this.data_manager.subset_entry(ae,ah),aj=ad.data;var ac=ak.canvas;ak.font=ak.canvas.manager.default_font;ak.textAlign="center";for(var ag=0,ai=aj.length;ag<ai;ag++){ak.fillStyle=this.view.get_base_color(aj[ag]);ak.fillText(aj[ag],Math.floor(ag*al),10)}return new b(this,ah,al,ac,ad)}});var g=function(ad,ac,ae){this.mode="Histogram";L.call(this,ad,ac,ae)};o(g.prototype,p.prototype,L.prototype,{display_modes:A,config_params:ab.union(p.prototype.config_params,[{key:"color",label:"Color",type:"color"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},before_draw:function(){},draw_tile:function(ac,ad,af,ae,ag){return this._draw_line_track_tile(ac,ad,af,ae,ag)},can_subset:function(ac){return(ac.data[1][0]-ac.data[0][0]===1)},postdraw_actions:function(ad,ae,af,ac){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var r=function(ad,ac,ae){this.mode="Heatmap";L.call(this,ad,ac,ae)};o(r.prototype,p.prototype,L.prototype,{display_modes:["Heatmap"],config_params:ab.union(p.prototype.config_params,[{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new J.DiagonalHeatmapPainter(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah);ad.draw(ae,af.width,af.height,ai);return new b(this,ag,ai,af,ac.data)}});var c=function(ad,ac,ae){L.call(this,ad,ac,ae);this.container_div.addClass("feature-track");this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,L.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(p.prototype.config_params,[{key:"block_color",label:"Block color",type:"color"},{key:"reverse_strand_color",label:"Antisense strand color",type:"color"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.set_painter_from_config();this.request_draw({clear_tile_cache:true})},set_painter_from_config:function(){if(this.config.get_value("connector_style")==="arcs"){this.painter=J.ArcLinkedFeaturePainter}else{this.painter=J.LinkedFeaturePainter}},postdraw_actions:function(ao,af,aq,an){L.prototype.postdraw_actions.call(this,ao,af,aq,an);var ah=this,ai,am=ab.filter(ao,function(ar){return(ar instanceof K)});if(am.length===0){var ac={};ab.each(ab.pluck(ao,"incomplete_features"),function(ar){ab.each(ar,function(at){ac[at[0]]=at})});var ap=this;ab.each(ao,function(av){var aw=ab.omit(ac,ab.map(av.incomplete_features,function(ay){return ay[0]}));aw=ab.omit(aw,ab.keys(av.other_tiles_features_drawn));if(ab.size(aw)!==0){var at={data:ab.values(aw)},au=ap.view.canvas_manager.new_canvas(),ar=au.getContext("2d");au.height=Math.max(av.canvas.height,ap.get_canvas_height(at,av.mode,av.w_scale,100));au.width=av.canvas.width;ar.drawImage(av.canvas,0,0);ar.translate(ah.left_offset,0);var ax=ap.draw_tile(at,ar,av.mode,av.region,av.w_scale,av.seq_data);$(av.canvas).replaceWith($(ax.canvas));av.canvas=au;ab.extend(av.other_tiles_features_drawn,ac)}})}if(ah.filters_manager){var ag=ah.filters_manager.filters,ak;for(ak=0;ak<ag.length;ak++){ag[ak].update_ui_elt()}var aj=false,al,ae;for(ai=0;ai<ao.length;ai++){if(ao[ai].data.length){al=ao[ai].data[0];for(ak=0;ak<ag.length;ak++){ae=ag[ak];if(ae.applies_to(al)&&ae.min!==ae.max){aj=true;break}}}}if(ah.filters_available!==aj){ah.filters_available=aj;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}if(ao[0] instanceof M){var ad=true;for(ai=0;ai<ao.length;ai++){if(!ao[ai].all_slotted){ad=false;break}}this.action_icons.show_more_rows_icon.toggle(!ad)}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (s.FeatureSlotter)(ag,af,z,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>G){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="Coverage"||ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.config.to_key_value_dict(),ag);return Math.max(this.min_height_px,ae.get_required_height(af,ad))}},draw_tile:function(an,at,aq,ag,ak,af,ao){var ar=this,ae=at.canvas,az=ag.get("start"),ad=ag.get("end"),ah=this.left_offset;if(an.dataset_type==="bigwig"){return this._draw_line_track_tile(an,at,aq,ag,ak)}var aj=[],ap=this.slotters[ak].slots;all_slotted=true;if(an.data){var al=this.filters_manager.filters;for(var au=0,aw=an.data.length;au<aw;au++){var ai=an.data[au];var av=false;var am;for(var ay=0,aD=al.length;ay<aD;ay++){am=al[ay];am.update_attrs(ai);if(!am.keep(ai)){av=true;break}}if(!av){aj.push(ai);if(!(ai[0] in ap)){all_slotted=false}}}}var aC=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),aA=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aB=new (this.painter)(aj,az,ad,this.config.to_key_value_dict(),aq,aC,aA,af,function(aE){return ar.view.get_base_color(aE)});var ax=null;at.fillStyle=this.config.get_value("block_color");at.font=at.canvas.manager.default_font;at.textAlign="right";if(an.data){var ac=aB.draw(at,ae.width,ae.height,ak,ap);ax=ac.feature_mapper;incomplete_features=ac.incomplete_features;ax.translation=-ah}if(!ao){return new M(ar,ag,ak,ae,an.data,aq,an.message,all_slotted,ax,incomplete_features,af)}}});var Z=function(ad,ac,ae){L.call(this,ad,ac,ae);this.painter=J.VariantPainter;this.summary_draw_height=30;this.left_offset=30};o(Z.prototype,p.prototype,L.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(p.prototype.config_params,[{key:"color",label:"Histogram color",type:"color"},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,af,ah,ag,ai){if(ac.dataset_type==="bigwig"){return this._draw_line_track_tile(ac,af,"Histogram",ag,ai)}else{var ae=this.view,ad=new (this.painter)(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah,function(aj){return ae.get_base_color(aj)});ad.draw(af,af.canvas.width,af.canvas.height,ai);return new b(this,ag,ai,af.canvas,ac.data)}},get_canvas_height:function(ac,ag,ah,ae){if(ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var ad=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ad===0&&ac.data.length!==0){ad=ac.data[0][7].match(/,/g);if(ad===null){ad=1}else{ad=ad.length+1}}var af=new (this.painter)(null,null,null,this.config.to_key_value_dict(),ag);return af.get_required_height(ad)}},predraw_init:function(){var ac=[f.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ac.push(this.dataset.fetch())}return ac},postdraw_actions:function(ag,ah,aj,ad){L.prototype.postdraw_actions.call(this,ag,ah,aj,ad);var af=ab.filter(ag,function(ak){return(ak instanceof K)});var ae=this.dataset.get_metadata("sample_names");if(af.length===0&&this.config.get_value("show_labels")&&ae&&ae.length>1){var ac;if(this.container_div.find(".yaxislabel.variant").length===0){ac=this.config.get_value("summary_height")/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ac+"px",top:(this.config.get_value("summary_height")-ac)/2+"px"}));if(this.config.get_value("show_sample_data")){var ai=ae.join("<br/>");this.tiles_div.prepend($("<div/>").html(ai).addClass("yaxislabel variant top sample").css({top:this.config.get_value("summary_height")}))}}ac=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ac,"line-height":ac});$(this.tiles_div).find(".yaxislabel").css("color",this.config.get_value("label_color"))}else{this.container_div.find(".yaxislabel.variant").remove()}}});var S=function(ad,ac,ae){c.call(this,ad,ac,ae);this.painter=J.ReadPainter;this.update_icons()};o(S.prototype,p.prototype,L.prototype,c.prototype,{config_params:ab.union(p.prototype.config_params,[{key:"block_color",label:"Histogram color",type:"color"},{key:"detail_block_color",label:"Sense strand block color",type:"color",default_value:"#AAAAAA"},{key:"reverse_strand_color",label:"Antisense strand block color",type:"color",default_value:"#DDDDDD"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})}});var d={CompositeTrack:e,DrawableGroup:N,DiagonalHeatmapTrack:r,FeatureTrack:c,LineTrack:g,ReadTrack:S,VariantTrack:Z,VcfTrack:Z};var n=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Y,DrawableGroup:N,LineTrack:g,FeatureTrack:c,DiagonalHeatmapTrack:r,ReadTrack:S,VariantTrack:Z,CompositeTrack:e,object_from_template:n}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/viz_views","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools","utils/config"],function(ab,w,V,j,s,J,h,X,P,R){var o=ab.extend;var l={};var i=function(ac,ad){l[ac.attr("id")]=ad};var k=function(ac,ad,af,ae){af=".group";l[ac.attr("id")]=ae;ac.bind("drag",{handle:"."+ad,relative:true},function(an,ao){var am=$(this),ar=$(this).parent(),aj=ar.children(".track,.group"),al=l[$(this).attr("id")],ai,ah,ap,ag,ak;ah=$(this).parents(af);if(ah.length!==0){ap=ah.position().top;ag=ap+ah.outerHeight();var aq=l[ah.attr("id")];if(ao.offsetY<ap){$(this).insertBefore(ah);aq.remove_drawable(al);aq.container.add_drawable_before(al,aq);return}else{if(ao.offsetY>ag){$(this).insertAfter(ah);aq.remove_drawable(al);aq.container.add_drawable(al);return}}}ah=null;for(ak=0;ak<aj.length;ak++){ai=$(aj.get(ak));ap=ai.position().top;ag=ap+ai.outerHeight();if(ai.is(af)&&this!==ai.get(0)&&ao.offsetY>=ap&&ao.offsetY<=ag){if(ao.offsetY-ap<ag-ao.offsetY){ai.find(".content-div").prepend(this)}else{ai.find(".content-div").append(this)}if(al.container){al.container.remove_drawable(al)}l[ai.attr("id")].add_drawable(al);return}}for(ak=0;ak<aj.length;ak++){ai=$(aj.get(ak));if(ao.offsetY<ai.position().top&&!(ai.hasClass("reference-track")||ai.hasClass("intro"))){break}}if(ak===aj.length){if(this!==aj.get(ak-1)){ar.append(this);l[ar.attr("id")].move_drawable(al,ak)}}else{if(this!==aj.get(ak)){$(this).insertBefore(aj.get(ak));l[ar.attr("id")].move_drawable(al,(ao.deltaY>0?ak-1:ak))}}}).bind("dragstart",function(){$(this).addClass("dragging")}).bind("dragend",function(){$(this).removeClass("dragging")})};var D=20,z=100,G=12000,Q=400,I=5000,v=100,m="Cannot display dataset due to an error. ",H="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",T="Ready for display",O=10,F=20,A=["Histogram","Line","Filled","Intensity"];function U(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var p=function(ad,ac,ag){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.view=ad;this.container=ac;this.drag_handle_class=ag.drag_handle_class;this.is_overview=false;this.action_icons={};this.config=R.ConfigSettingCollection.from_models_and_saved_values(this.config_params,ag.prefs);if(!this.config.get_value("name")){this.config.set_value("name",ag.name)}if(this.config_onchange){this.config.on("change",this.config_onchange,this)}this.container_div=this.build_container_div();this.header_div=null;if(ag.header!==false){var ae=new V.TrackHeaderView({model:this,id:this.id});this.header_div=ae.$el;this.container_div.append(this.header_div);var af=ae.icons_div;this.action_icons=ae.action_icons;this.container_div.hover(function(){af.show()},function(){af.hide()})}};p.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.config.get_value("content_visible")){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.config.set_value("content_visible",false)}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.config.set_value("content_visible",true);ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"gear",on_click_fn:function(ad){var ac=new R.ConfigSettingCollectionView({collection:ad.config});ac.render_in_modal("Configure Track")}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".tooltip").remove();ac.remove()}}];o(p.prototype,{config_params:[{key:"name",label:"Name",type:"text",default_value:""},{key:"content_visible",type:"bool",default_value:true,hidden:true}],config_onchange:function(){},init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.config.get_value("content_visible")){return true}return false},request_draw:function(){},_draw:function(ac){},to_dict:function(){},set_name:function(ac){this.old_name=this.config.get_value("name");this.config.set_value("name",ac)},revert_name:function(){if(this.old_name){this.config.set_value("name",this.old_name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ad,ac,ae){p.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};o(y.prototype,p.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=n(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(ac){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad]._draw(ac)}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{prefs:this.config.to_key_value_dict(),obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(af){var ac=this.drawables.slice(0),ad=[],ae;while(ac.length!==0){ae=ac.shift();if(ae instanceof af){ad.push(ae)}else{if(ae.drawables){ac=ac.concat(ae.drawables)}}}return ad}});var N=function(ad,ac,af){o(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);i(this.container_div,this);i(this.content_div,this);k(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new h.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.filters_manager.parent_div.after($("<div style='clear: both'/>"));this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new h.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};o(N.prototype,p.prototype,y.prototype,{action_icons_def:[p.prototype.action_icons_def[0],p.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"ui-slider-050",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw({clear_tile_cache:true})}ac.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){this.action_icons.composite_icon.toggle(this.drawables[0] instanceof e);this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao&&this.drawables[0] instanceof g){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new h.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}this.action_icons.filters_icon.toggle(this.filters_manager.filters.length>0)}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ad=new e(this.view,this.view,{name:this.config.get_value("name"),drawables:this.drawables});var ac=this.container.replace_drawable(this,ad,true);ad.request_draw()},add_drawable:function(ac){y.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){y.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=o(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac){ab.each(this.drawables,function(ad){ad.request_draw(ac)})}});var Y=Backbone.View.extend({initialize:function(ac){o(ac,{obj_type:"View"});y.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=R.ConfigSettingCollection.from_models_and_saved_values([{key:"name",label:"Name",type:"text",default_value:""},{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],{name:ac.name})},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;i(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container);var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(n(ah,ac,ac))})})});this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).addClass("chrom-nav").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}ag.stopPropagation()};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_tracks(c),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})},minLength:2})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div/>").addClass("zoom-area").css("height",ac.browser_content_div.height()+ac.top_labeltrack.height()+1).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ac){return this.config.get_value(ac.toLowerCase()+"_color")||this.config.get_value("n_color")}});o(Y.prototype,y.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){this.intro_div.toggle(this.drawables.length===0)},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=v;var ac=this,ad=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){var ah=new B(ac);ac.add_label_track(ah);ac.reference_track=ah}ac.chrom_data=ag.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,af=ac.chrom_data.length;aj<af;aj++){var ai=ac.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ag.prev_chroms){ak+='<option value="previous">Previous '+v+"</option>"}if(ag.next_chroms){ak+='<option value="next">Next '+v+"</option>"}ac.chrom_select.html(ak);ac.chrom_start_index=ag.start_index;ad.resolve(ag.chrom_info)},error:function(){alert("Could not load chroms for this dbkey: "+ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-v});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+v});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad===undefined&&aj===undefined){ae.low=0;ae.high=ae.max_high}else{ae.low=(ad!==undefined?Math.max(ad,0):0);if(aj===undefined){ae.low=Math.max(ae.low-15,0);ae.high=ae.low+30}else{ae.high=Math.min(aj,ae.max_high)}}ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/,/g,"");ag=ag.replace(/:|\-/g," ");var ad=ag.split(/\s+/),af=ad[0],ae=(ad[1]?parseInt(ad[1],10):undefined),ac=(ad[2]?parseInt(ad[2],10):undefined);this.change_chrom(af,ae,ac)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ac.request_redraw()},200);var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);ad.init();this.changed();this.update_intro_div();var ac=this;ad.config.on("change",function(){ac.changed()})},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){y.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ad,ae){var ac=this,af=(ae?[ae]:ac.drawables);ab.each(af,function(ag){var ah=ab.find(ac.tracks_to_be_redrawn,function(ai){return ai[0]===ag});if(ah){ah[1]=ad}else{ac.tracks_to_be_redrawn.push([ag,ad])}});if(!this.requested_redraw){requestAnimationFrame(function(){ac._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ac=this.low,ag=this.high;if(ac<this.max_low){ac=this.max_low}if(ag>this.max_high){ag=this.max_high}var ad=this.high-this.low;if(this.high!==0&&ad<this.min_separation){ag=ac+this.min_separation}this.low=Math.floor(ac);this.high=Math.ceil(ag);this.update_location(this.low,this.high);this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:af,width:Math.max(ae,ah)}).show();if(ah<ae){this.overview_box.css("left",af-(ae-ah)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:ah})}ab.each(this.tracks_to_be_redrawn,function(ak){var ai=ak[0],aj=ak[1];if(ai){ai._draw(aj)}});this.tracks_to_be_redrawn=[];ab.each(this.label_tracks,function(ai){ai._draw()})},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_viewport:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height())},resize_window:function(){this.resize_viewport();this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ae.dataset.id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=P.Tool.extend({defaults:{track:null},initialize:function(ac){P.Tool.prototype.initialize.call(this,ac);var ad=true;if(ac.tool_state!==undefined&&ac.tool_state.hidden!==undefined){ad=ac.tool_state.hidden}this.set("hidden",ad);this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ac){return ab.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var t=Backbone.View.extend({events:{"change :input":"update_value"},render:function(){var ae=this.$el.addClass("param-row"),af=this.model;var ac=$("<div>").addClass("param-label").text(af.get("label")).appendTo(ae);var ad=$("<div/>").addClass("param-input").html(af.get("html")).appendTo(ae);ad.find(":input").val(af.get("value"));$("<div style='clear: both;'/>").appendTo(ae)},update_value:function(ac){this.model.set_value($(ac.target).val())}});var aa=Backbone.View.extend({initialize:function(ac){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ad=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ah){ah.stopPropagation()}).click(function(ah){ah.stopPropagation()}).bind("dblclick",function(ah){ah.stopPropagation()}).keydown(function(ah){ah.stopPropagation()});var ae=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(ai){var ah=new t({model:ai});ah.render();parent_div.append(ah.$el)});parent_div.find("input").click(function(){$(this).select()});var af=$("<div>").addClass("param-row").appendTo(parent_div);var ag=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(af);var ac=$("<input type='submit'>").attr("value","Run on visible region").appendTo(af);ac.click(function(){ad.run_on_region()});ag.click(function(){ad.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){this.$el.toggle(this.model.is_visible())},update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},run_on_dataset:function(){var ac=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ac.id},null,function(ad){Galaxy.modal.show({title:ac.get("name")+" is Running",body:ac.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",buttons:{Close:function(){Galaxy.modal.hide()}}})})},run_on_region:function(){var ad=this.model.get("track"),ag=this.model,ai=new w.GenomeRegion({chrom:ad.view.chrom,start:ad.view.low,end:ad.view.high}),aj={target_dataset_id:ad.dataset.id,action:"rerun",tool_id:ag.id,regions:[ai.toJSON()]},ah=ad,al=ag.get("name")+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ak=new N(view,view,{name:ad.config.get_value("name")});var af=ah.container.replace_drawable(ah,ak,false);ak.container_div.insertBefore(ah.view.content_div.children()[af]);ak.add_drawable(ah);ah.container_div.appendTo(ak.content_div);ac=ak}else{ac=ah.container}var ae=new ah.constructor(view,ac,{name:al,hda_ldda:"hda"});ae.init_for_tool_data();ae.change_mode(ah.mode);ae.set_filters_manager(ah.filters_manager.copy(ae));ae.update_icons();ac.add_drawable(ae);ae.tiles_div.text("Starting job.");this.run(aj,ae,function(am){ae.set_dataset(new X.Dataset(am));ae.tiles_div.text("Running job.");ae.init()})},run:function(ac,ae,af){ac.inputs=this.model.get_inputs_dict();var ad=new j.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(H)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(x+ag.message)}else{af(ag)}}})}});var C=function(ac,ad){J.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var b=function(ac,af,ag,ad,ae){this.track=ac;this.region=af;this.low=af.get("start");this.high=af.get("end");this.w_scale=ag;this.canvas=ad;this.html_elt=$("<div class='track-tile'/>").append(ad);this.data=ae;this.stale=false};b.prototype.predisplay_actions=function(){};var K=function(ac,af,ag,ad,ae){b.call(this,ac,af,ag,ad,ae)};K.prototype.predisplay_actions=function(){};var M=function(ae,aj,al,ad,ag,ah,am,ac,ai,af,ak){b.call(this,ae,aj,al,ad,ag);this.mode=ah;this.all_slotted=ac;this.feature_mapper=ai;this.has_icons=false;this.incomplete_features=af;this.other_tiles_features_drawn={};this.seq_data=ak};o(M.prototype,b.prototype);M.prototype.predisplay_actions=function(){};var f=function(ad,ac,ae){o(ae,{drag_handle_class:"draghandle"});p.call(this,ad,ac,ae);this.dataset=null;if(ae.dataset){this.dataset=(ae.dataset instanceof Backbone.Model?ae.dataset:new X.Dataset(ae.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:I);this.data_manager=("data_manager" in ae?ae.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ad.dbkey,chroms_info:{chrom_info:ad.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=this.config.get_value("height");this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};o(f.prototype,p.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},p.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"application-dock-270",on_click_fn:function(ac){ac.view.set_overview(ac)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"ui-slider-050",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.tool.toggle();if(ac.tool.is_visible()){ac.set_name(ac.config.get_value("name")+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<strong>Tool</strong>: <%= track.tool.get("name") %><br/><strong>Dataset</strong>: <%= track.config.get_value("name") %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ae=ab.template(af,{track:ac});var ah=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new w.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}Galaxy.modal.hide();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ac.dataset.id,hda_ldda:ac.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};Galaxy.modal.show({title:"Visualize tool parameter space and output from different parameter settings?",body:ae,buttons:{No:ah,Yes:ad}})}},p.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&p.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id)},set_dataset:function(ac){this.dataset=ac;this.data_manager.set("dataset",ac)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.config.get_value("content_visible")){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.set_value("height",ac.visible_height_px);ac.changed()}).appendTo(ac.container_div)},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof g){return"LineTrack"}else{if(this instanceof S){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof e){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},show_message:function(ac){this.tiles_div.remove();return $("<span/>").addClass("message").html(ac).appendTo(this.content_div)},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.content_div.children().remove();ad.container_div.removeClass("nodata error pending");ad.tiles_div=$("<div/>").addClass("tiles").appendTo(ad.content_div);if(!ad.dataset.id){return}var ac=$.Deferred(),af={hda_ldda:ad.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");var ah=ad.show_message(m);if(ag.message){ah.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){Galaxy.modal.show({title:"Trackster Error",body:"<pre>"+ag.message+"</pre>",buttons:{Close:function(){Galaxy.modal.hide()}}})}));ah.append($("<span/>").text(" "));ah.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.show_message(H)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.show_message(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.show_message(u);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(T);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when.apply($,ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(af&&af.min&&af.max){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_default_value("min_value",ae);ac.config.set_default_value("max_value",ag);ac.config.set_value("min_value",ae);ac.config.set_value("max_value",ag)}})},get_drawables:function(){return this}});var L=function(ae,ad,ag){f.call(this,ae,ad,ag);var ac=this;k(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new h.FiltersManager(this,("filters" in ag?ag.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ag.tool?new q(ab.extend(ag.tool,{track:this,tool_state:ag.tool_state})):null);this.tile_cache=new w.Cache(O);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var af=new aa({model:this.tool});af.render();this.dynamic_tool_div=af.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);if(!this.config.get_value("content_visible")){this.tiles_div.hide()}this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ag.mode){this.change_mode(ag.mode)}};o(L.prototype,p.prototype,f.prototype,{action_icons_def:f.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ac){var ad=this.to_dict();o(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.config.to_key_value_dict(),mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(isNaN(parseFloat(ac.config.get_value("min_value")))||isNaN(parseFloat(ac.config.get_value("max_value")))){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_value("min_value",ae);ac.config.set_value("max_value",ag)}})},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.set_value("mode",ad);if(ad==="Auto"){this.data_manager.clear()}ac.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;ac.action_icons.filters_icon.toggle(ac.filters_available);ac.action_icons.tools_icon.toggle(ac.tool!==null);ac.action_icons.param_space_viz_icon.toggle(ac.tool!==null)},_gen_tile_cache_key:function(ad,ac){return ad+"_"+ac},request_draw:function(ac){if(ac&&ac.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ac,this)},before_draw:function(){this.max_height_px=0},_draw:function(aq){if(!this.can_draw()){return}var an=aq&&aq.clear_after,al=this.view.low,ag=this.view.high,aj=ag-al,ad=this.view.container.width(),ap=this.view.resolution_px_b,af=1/ap;if(this.is_overview){al=this.view.max_low;ag=this.view.max_high;ap=ad/(view.max_high-view.max_low);af=1/ap}this.before_draw();this.tiles_div.children().addClass("remove");var ak=Math.floor(Q*af),ac=Math.floor(al/ak),am,ah,ai=[],ao=[];while((ac*ak)<ag){am=new w.GenomeRegion({chrom:this.view.chrom,start:ac*ak,end:Math.min((ac+1)*ak,this.view.max_high)});ah=this.draw_helper(am,ap,aq);ai.push(ah);$.when(ah).then(function(ar){ao.push(ar)});ac+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var ae=this;$.when.apply($,ai).then(function(){ae.tiles_div.children(".remove").remove();ao=ab.filter(ao,function(ar){return ar!==null});if(ao.length!==0){ae.postdraw_actions(ao,ad,ap,an)}})},_add_yaxis_label:function(af,ah){var ad=this,ag=(af==="max"?"top":"bottom"),ai=(af==="max"?"max":"min"),ac=(af==="max"?"max_value":"min_value"),ae=this.container_div.find(".yaxislabel."+ag);ah=ah||function(){ad.request_draw({clear_tile_cache:true})};if(ae.length!==0){ae.text(ad.config.get_value(ac))}else{ae=$("<div/>").text(ad.config.get_value(ac)).make_text_editable({num_cols:12,on_finish:function(aj){$(".tooltip").remove();ad.config.set_value(ac,aj);ah()},help_text:"Set "+ai+" value"}).addClass("yaxislabel "+ag).css("color",this.config.get_value("label_color"));this.container_div.prepend(ae)}},postdraw_actions:function(af,ag,ai,ac){var ae=ab.filter(af,function(aj){return(aj instanceof K)});if(ae.length>0){this.max_height_px=0;var ad=this;ab.each(af,function(aj){if(!(aj instanceof K)){aj.html_elt.remove();ad.draw_helper(aj.region,ai,{force:true,mode:"Coverage"})}});ad._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ah=ab.find(af,function(aj){return aj.has_icons});if(ah){ab.each(af,function(aj){if(!aj.has_icons){aj.html_elt.css("padding-top",D)}})}}},get_mode:function(ac){return this.mode},update_auto_mode:function(ac){},_get_drawables:function(){return[this]},draw_helper:function(al,an,ao){if(!ao){ao={}}var ad=ao.force,ai=ao.mode||this.mode,af=1/an,ae=this,ag=this._get_drawables(),am=this._gen_tile_cache_key(an,al),ah=function(ap){return(ap&&"track" in ap)};var aj=(ad?undefined:ae.tile_cache.get_elt(am));if(aj){if(ah(aj)){ae.show_tile(aj,an)}return aj}if(ao.data_fetch===false){return null}var ak=function(){var ap=(ab.find(A,function(ar){return ar===ai})?"Coverage":ai);var aq=ab.map(ag,function(ar){return ar.data_manager.get_data(al,ap,af,ae.data_url_extra_params)});if(view.reference_track){aq.push(view.reference_track.data_manager.get_data(al,ai,af,view.reference_track.data_url_extra_params))}return aq};var ac=$.Deferred();ae.tile_cache.set_elt(am,ac);$.when.apply($,ak()).then(function(){var ap=ak(),av=ap,aB;if(ab.find(ap,function(aD){return j.is_deferred(aD)})){ae.tile_cache.set_elt(am,undefined);$.when(ae.draw_helper(al,an,ao)).then(function(aD){ac.resolve(aD)});return}if(view.reference_track){aB=view.reference_track.data_manager.subset_entry(ap.pop(),al)}var aw=[],at=[];ab.each(ag,function(aG,aD){var aF=aG.mode,aE=av[aD];if(aF==="Auto"){aF=aG.get_mode(aE);aG.update_auto_mode(aF)}aw.push(aF);at.push(aG.get_canvas_height(aE,aF,an,aq))});var au=ae.view.canvas_manager.new_canvas(),ax=al.get("start"),aC=al.get("end"),ar=0,aq=Math.ceil((aC-ax)*an)+ae.left_offset,az=ab.max(at),ay;au.width=aq;au.height=(ao.height||az);var aA=au.getContext("2d");aA.translate(ae.left_offset,0);if(ag.length>1){aA.globalAlpha=0.5;aA.globalCompositeOperation="source-over"}ab.each(ag,function(aE,aD){ay=aE.draw_tile(av[aD],aA,aw[aD],al,an,aB)});if(ay!==undefined){ae.tile_cache.set_elt(am,ay);ae.show_tile(ay,an)}ac.resolve(ay)});return ac},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},_draw_line_track_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new J.LinePainter(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah);ad.draw(ae,af.width,af.height,ai);return new K(this,ag,ai,af,ac.data)},draw_tile:function(ac,ad,ag,af,ah,ae){},show_tile:function(ae,ah){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=Math.round((ae.low-(this.is_overview?this.view.max_low:this.view.low))*ah);if(this.left_offset){ag-=this.left_offset}ac.css("left",ag);if(ac.hasClass("remove")){ac.removeClass("remove")}else{this.tiles_div.append(ac)}ac.css("height","auto");this.max_height_px=Math.max(this.max_height_px,ac.height()-2);ac.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},tool_region_and_parameters_str:function(af){var ac=this,ae=(af!==undefined?af.toString():"all"),ad=ab.values(ac.tool.get_inputs_dict()).join(", ");return" - region=["+ae+"], parameters=["+ad+"]"},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="bigwig"}else{if(ac.dataset_type==="bigwig"||ac.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ac){if(ac.message||ac.extra_info==="no_detail"){return false}else{if(ac.dataset_type==="bigwig"){return(ac.data[1][0]-ac.data[0][0]===1)}}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var W=function(ad,ac){f.call(this,ad,ac,{resize:false,header:false});this.container_div.addClass("label-track")};o(W.prototype,f.prototype,{init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ag){var ae=this.view,af=ae.high-ae.low,aj=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/aj)*aj,ah=this.view.container.width(),ad=$("<div/>").addClass("label-container");while(ac<ae.high){var ai=Math.floor((ac-ae.low)/af*ah);ad.append($("<div/>").addClass("label").text(commatize(ac)).css({left:ai}));ac+=aj}this.content_div.children(":first").remove();this.content_div.append(ad)}});var e=function(ad,ac,ag){L.call(this,ad,ac,ag);this.drawables=[];if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=n(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}ab.each(this.drawables,function(ah){if(ah instanceof c||ah instanceof S){ah.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};o(e.prototype,L.prototype,{display_modes:A,config_params:ab.union(p.prototype.config_params,[{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}]),action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_group()}}].concat(L.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},on_resize:function(){var ac=this.visible_height_px;ab.each(this.drawables,function(ad){ad.visible_height_px=ac});f.prototype.on_resize.call(this)},change_mode:function(ac){L.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:p.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var af=new N(this.view,this.container,{name:this.config.get_value("name")}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw({clear_tile_cache:true})},before_draw:function(){var ad=ab.min(ab.map(this.drawables,function(ae){return ae.config.get_value("min_value")})),ac=ab.max(ab.map(this.drawables,function(ae){return ae.config.get_value("max_value")}));this.config.set_value("min_value",ad);this.config.set_value("max_value",ac);ab.each(this.drawables,function(ae){ae.config.set_value("min_value",ad);ae.config.set_value("max_value",ac)})},update_all_min_max:function(){var ad=this,ac=this.config.get_value("min_value"),ae=this.config.get_value("max_value");ab.each(this.drawables,function(af){af.config.set_value("min_value",ac);af.config.set_value("max_value",ae)});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ai,ac,al,ah){var ag=-1,ae;for(ae=0;ae<ai.length;ae++){var aj=ai[ae].html_elt.find("canvas").height();if(aj>ag){ag=aj}}for(ae=0;ae<ai.length;ae++){var af=ai[ae];if(af.html_elt.find("canvas").height()!==ag){this.draw_helper(af.region,al,{force:true,height:ag});af.html_elt.remove()}}var ad=this,ak=function(){ad.update_all_min_max()};this._add_yaxis_label("min",ak);this._add_yaxis_label("max",ak)}});var B=function(ac){L.call(this,ac,{content_div:ac.top_labeltrack},{resize:false,header:false});this.left_offset=ac.canvas_manager.char_width_px;this.container_div.addClass("reference-track");this.data_url=galaxy_config.root+"api/genomes/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};o(B.prototype,p.prototype,L.prototype,{config_params:ab.union(p.prototype.config_params,[{key:"height",type:"int",default_value:13,hidden:true}]),init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:p.prototype.can_draw,draw_helper:function(af,ah,ad){var ac=this.tiles_div.is(":visible"),ag,ae=null;if(ah>this.view.canvas_manager.char_width_px){this.tiles_div.show();ag=true;ae=L.prototype.draw_helper.call(this,af,ah,ad)}else{ag=false;this.tiles_div.hide()}if(ac!==ag){this.view.resize_viewport()}return ae},can_subset:function(ac){return true},draw_tile:function(ae,ak,af,ah,al){var ad=this.data_manager.subset_entry(ae,ah),aj=ad.data;var ac=ak.canvas;ak.font=ak.canvas.manager.default_font;ak.textAlign="center";for(var ag=0,ai=aj.length;ag<ai;ag++){ak.fillStyle=this.view.get_base_color(aj[ag]);ak.fillText(aj[ag],Math.floor(ag*al),10)}return new b(this,ah,al,ac,ad)}});var g=function(ad,ac,ae){this.mode="Histogram";L.call(this,ad,ac,ae)};o(g.prototype,p.prototype,L.prototype,{display_modes:A,config_params:ab.union(p.prototype.config_params,[{key:"color",label:"Color",type:"color"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},before_draw:function(){},draw_tile:function(ac,ad,af,ae,ag){return this._draw_line_track_tile(ac,ad,af,ae,ag)},can_subset:function(ac){return(ac.data[1][0]-ac.data[0][0]===1)},postdraw_actions:function(ad,ae,af,ac){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var r=function(ad,ac,ae){this.mode="Heatmap";L.call(this,ad,ac,ae)};o(r.prototype,p.prototype,L.prototype,{display_modes:["Heatmap"],config_params:ab.union(p.prototype.config_params,[{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new J.DiagonalHeatmapPainter(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah);ad.draw(ae,af.width,af.height,ai);return new b(this,ag,ai,af,ac.data)}});var c=function(ad,ac,ae){L.call(this,ad,ac,ae);this.container_div.addClass("feature-track");this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,L.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(p.prototype.config_params,[{key:"block_color",label:"Block color",type:"color"},{key:"reverse_strand_color",label:"Antisense strand color",type:"color"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.set_painter_from_config();this.request_draw({clear_tile_cache:true})},set_painter_from_config:function(){if(this.config.get_value("connector_style")==="arcs"){this.painter=J.ArcLinkedFeaturePainter}else{this.painter=J.LinkedFeaturePainter}},postdraw_actions:function(ao,af,aq,an){L.prototype.postdraw_actions.call(this,ao,af,aq,an);var ah=this,ai,am=ab.filter(ao,function(ar){return(ar instanceof K)});if(am.length===0){var ac={};ab.each(ab.pluck(ao,"incomplete_features"),function(ar){ab.each(ar,function(at){ac[at[0]]=at})});var ap=this;ab.each(ao,function(av){var aw=ab.omit(ac,ab.map(av.incomplete_features,function(ay){return ay[0]}));aw=ab.omit(aw,ab.keys(av.other_tiles_features_drawn));if(ab.size(aw)!==0){var at={data:ab.values(aw)},au=ap.view.canvas_manager.new_canvas(),ar=au.getContext("2d");au.height=Math.max(av.canvas.height,ap.get_canvas_height(at,av.mode,av.w_scale,100));au.width=av.canvas.width;ar.drawImage(av.canvas,0,0);ar.translate(ah.left_offset,0);var ax=ap.draw_tile(at,ar,av.mode,av.region,av.w_scale,av.seq_data);$(av.canvas).replaceWith($(ax.canvas));av.canvas=au;ab.extend(av.other_tiles_features_drawn,ac)}})}if(ah.filters_manager){var ag=ah.filters_manager.filters,ak;for(ak=0;ak<ag.length;ak++){ag[ak].update_ui_elt()}var aj=false,al,ae;for(ai=0;ai<ao.length;ai++){if(ao[ai].data.length){al=ao[ai].data[0];for(ak=0;ak<ag.length;ak++){ae=ag[ak];if(ae.applies_to(al)&&ae.min!==ae.max){aj=true;break}}}}if(ah.filters_available!==aj){ah.filters_available=aj;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}if(ao[0] instanceof M){var ad=true;for(ai=0;ai<ao.length;ai++){if(!ao[ai].all_slotted){ad=false;break}}this.action_icons.show_more_rows_icon.toggle(!ad)}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (s.FeatureSlotter)(ag,af,z,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>G){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="Coverage"||ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.config.to_key_value_dict(),ag);return Math.max(this.min_height_px,ae.get_required_height(af,ad))}},draw_tile:function(an,at,aq,ag,ak,af,ao){var ar=this,ae=at.canvas,az=ag.get("start"),ad=ag.get("end"),ah=this.left_offset;if(an.dataset_type==="bigwig"){return this._draw_line_track_tile(an,at,aq,ag,ak)}var aj=[],ap=this.slotters[ak].slots;all_slotted=true;if(an.data){var al=this.filters_manager.filters;for(var au=0,aw=an.data.length;au<aw;au++){var ai=an.data[au];var av=false;var am;for(var ay=0,aD=al.length;ay<aD;ay++){am=al[ay];am.update_attrs(ai);if(!am.keep(ai)){av=true;break}}if(!av){aj.push(ai);if(!(ai[0] in ap)){all_slotted=false}}}}var aC=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),aA=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aB=new (this.painter)(aj,az,ad,this.config.to_key_value_dict(),aq,aC,aA,af,function(aE){return ar.view.get_base_color(aE)});var ax=null;at.fillStyle=this.config.get_value("block_color");at.font=at.canvas.manager.default_font;at.textAlign="right";if(an.data){var ac=aB.draw(at,ae.width,ae.height,ak,ap);ax=ac.feature_mapper;incomplete_features=ac.incomplete_features;ax.translation=-ah}if(!ao){return new M(ar,ag,ak,ae,an.data,aq,an.message,all_slotted,ax,incomplete_features,af)}}});var Z=function(ad,ac,ae){L.call(this,ad,ac,ae);this.painter=J.VariantPainter;this.summary_draw_height=30;this.left_offset=30};o(Z.prototype,p.prototype,L.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(p.prototype.config_params,[{key:"color",label:"Histogram color",type:"color"},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,af,ah,ag,ai){if(ac.dataset_type==="bigwig"){return this._draw_line_track_tile(ac,af,"Histogram",ag,ai)}else{var ae=this.view,ad=new (this.painter)(ac.data,ag.get("start"),ag.get("end"),this.config.to_key_value_dict(),ah,function(aj){return ae.get_base_color(aj)});ad.draw(af,af.canvas.width,af.canvas.height,ai);return new b(this,ag,ai,af.canvas,ac.data)}},get_canvas_height:function(ac,ag,ah,ae){if(ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var ad=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ad===0&&ac.data.length!==0){ad=ac.data[0][7].match(/,/g);if(ad===null){ad=1}else{ad=ad.length+1}}var af=new (this.painter)(null,null,null,this.config.to_key_value_dict(),ag);return af.get_required_height(ad)}},predraw_init:function(){var ac=[f.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ac.push(this.dataset.fetch())}return ac},postdraw_actions:function(ag,ah,aj,ad){L.prototype.postdraw_actions.call(this,ag,ah,aj,ad);var af=ab.filter(ag,function(ak){return(ak instanceof K)});var ae=this.dataset.get_metadata("sample_names");if(af.length===0&&this.config.get_value("show_labels")&&ae&&ae.length>1){var ac;if(this.container_div.find(".yaxislabel.variant").length===0){ac=this.config.get_value("summary_height")/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ac+"px",top:(this.config.get_value("summary_height")-ac)/2+"px"}));if(this.config.get_value("show_sample_data")){var ai=ae.join("<br/>");this.tiles_div.prepend($("<div/>").html(ai).addClass("yaxislabel variant top sample").css({top:this.config.get_value("summary_height")}))}}ac=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ac,"line-height":ac});$(this.tiles_div).find(".yaxislabel").css("color",this.config.get_value("label_color"))}else{this.container_div.find(".yaxislabel.variant").remove()}}});var S=function(ad,ac,ae){c.call(this,ad,ac,ae);this.painter=J.ReadPainter;this.update_icons()};o(S.prototype,p.prototype,L.prototype,c.prototype,{config_params:ab.union(p.prototype.config_params,[{key:"block_color",label:"Histogram color",type:"color"},{key:"detail_block_color",label:"Sense strand block color",type:"color",default_value:"#AAAAAA"},{key:"reverse_strand_color",label:"Antisense strand block color",type:"color",default_value:"#DDDDDD"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.config.get_value("name"));this.request_draw({clear_tile_cache:true})}});var d={CompositeTrack:e,DrawableGroup:N,DiagonalHeatmapTrack:r,FeatureTrack:c,LineTrack:g,ReadTrack:S,VariantTrack:Z,VcfTrack:Z};var n=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Y,DrawableGroup:N,LineTrack:g,FeatureTrack:c,DiagonalHeatmapTrack:r,ReadTrack:S,VariantTrack:Z,CompositeTrack:e,object_from_template:n}});
\ No newline at end of file
diff -r 990bc0688199410ab08d5e8a418770b516c6f4e2 -r d85ae37476a17205c9869d633f3aafd104b48a98 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -3242,7 +3242,7 @@
width = this.view.container.width(),
new_div = $("<div/>").addClass('label-container');
while ( position < view.high ) {
- var screenPosition = ( position - view.low ) / range * width;
+ var screenPosition = Math.floor( ( position - view.low ) / range * width );
new_div.append( $("<div/>").addClass('label').text(commatize( position )).css( {
left: screenPosition
}));
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in jmchilton/galaxy-central-fork-1 (pull request #452)
by commits-noreply@bitbucket.org 09 Aug '14
by commits-noreply@bitbucket.org 09 Aug '14
09 Aug '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/de2e33813275/
Changeset: de2e33813275
User: jmchilton
Date: 2014-08-09 15:15:11
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #452)
More RESTful workflow API (attempt 3)
Affected #: 4 files
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -1664,7 +1664,7 @@
session.flush()
return imported_stored
- def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False ):
+ def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False, publish=False ):
"""
Creates a workflow from a dict. Created workflow is stored in the database and returned.
"""
@@ -1752,6 +1752,7 @@
workflow.stored_workflow = stored
stored.latest_workflow = workflow
stored.user = trans.user
+ stored.published = publish
if data[ 'annotation' ]:
self.add_item_annotation( trans.sa_session, stored.user, stored, data[ 'annotation' ] )
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -6,11 +6,13 @@
import logging
from sqlalchemy import desc, or_
-from galaxy import exceptions, util, web
+from galaxy import exceptions, util
from galaxy.model.item_attrs import UsesAnnotations
+from galaxy.managers import histories
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, url_for, UsesStoredWorkflowMixin
from galaxy.web.base.controller import UsesHistoryMixin
+from galaxy.web.base.controller import SharableMixin
from galaxy.workflow.extract import extract_workflow
from galaxy.workflow.run import invoke
from galaxy.workflow.run import WorkflowRunConfig
@@ -18,9 +20,13 @@
log = logging.getLogger(__name__)
-class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations):
+class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations, SharableMixin):
- @web.expose_api
+ def __init__( self, app ):
+ super( BaseAPIController, self ).__init__( app )
+ self.history_manager = histories.HistoryManager()
+
+ @expose_api
def index(self, trans, **kwd):
"""
GET /api/workflows
@@ -54,30 +60,21 @@
rval.append(item)
return rval
- @web.expose_api
+ @expose_api
def show(self, trans, id, **kwd):
"""
GET /api/workflows/{encoded_workflow_id}
Displays information needed to run a workflow from the command line.
"""
- workflow_id = id
- try:
- decoded_workflow_id = trans.security.decode_id(workflow_id)
- except TypeError:
- trans.response.status = 400
- return "Malformed workflow id ( %s ) specified, unable to decode." % str(workflow_id)
- try:
- stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).get(decoded_workflow_id)
- if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is neither importable, nor owned by or shared with current user")
- except:
- trans.response.status = 400
- return "That workflow does not exist."
+ stored_workflow = self.__get_stored_workflow( trans, id )
+ if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is neither importable, nor owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
item = stored_workflow.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
- item['url'] = url_for('workflow', id=workflow_id)
+ item['url'] = url_for('workflow', id=id)
item['owner'] = stored_workflow.user.username
latest_workflow = stored_workflow.latest_workflow
inputs = {}
@@ -114,7 +111,7 @@
item['steps'] = steps
return item
- @web.expose_api
+ @expose_api
def create(self, trans, payload, **kwd):
"""
POST /api/workflows
@@ -161,10 +158,20 @@
:param workflow_name: If from_history_id is set - name of the workflow to create when extracting a workflow from history
:type workflow_name: str
"""
+ ways_to_create = set( [
+ 'workflow_id',
+ 'installed_repository_file',
+ 'from_history_id',
+ 'shared_workflow_id',
+ 'workflow',
+ ] ).intersection( payload )
+ if len( ways_to_create ) == 0:
+ message = "One parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterMissingException( message )
- if len( set( ['workflow_id', 'installed_repository_file', 'from_history_id'] ).intersection( payload ) ) > 1:
- trans.response.status = 403
- return "Only one among 'workflow_id', 'installed_repository_file', 'from_history_id' must be specified"
+ if len( ways_to_create ) > 1:
+ message = "Only one parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterInvalidException( message )
if 'installed_repository_file' in payload:
workflow_controller = trans.webapp.controllers[ 'workflow' ]
@@ -193,10 +200,17 @@
item[ 'url' ] = url_for( 'workflow', id=item[ 'id' ] )
return item
+ if 'shared_workflow_id' in payload:
+ workflow_id = payload[ 'shared_workflow_id' ]
+ return self.__api_import_shared_workflow( trans, workflow_id, payload )
+
+ if 'workflow' in payload:
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+
workflow_id = payload.get( 'workflow_id', None )
if not workflow_id:
- trans.response.status = 403
- return "Either workflow_id, installed_repository_file or from_history_id must be specified"
+ message = "Invalid workflow_id specified."
+ raise exceptions.RequestParameterInvalidException( message )
# Pull other parameters out of payload.
param_map = payload.get( 'parameters', {} )
@@ -225,34 +239,24 @@
history_param = payload.get('history', '')
# Get workflow + accessibility check.
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
workflow = stored_workflow.latest_workflow
# Sanity checks.
- if not workflow:
- trans.response.status = 400
- return "Workflow not found."
if len( workflow.steps ) == 0:
- trans.response.status = 400
- return "Workflow cannot be run because it does not have any steps"
+ raise exceptions.MessageException( "Workflow cannot be run because it does not have any steps" )
if workflow.has_cycles:
- trans.response.status = 400
- return "Workflow cannot be run because it contains cycles"
+ raise exceptions.MessageException( "Workflow cannot be run because it contains cycles" )
if workflow.has_errors:
- trans.response.status = 400
- return "Workflow cannot be run because of validation errors in some steps"
+ message = "Workflow cannot be run because of validation errors in some steps"
+ raise exceptions.MessageException( message )
# Get target history.
if history_param.startswith('hist_id='):
# Passing an existing history to use.
- history = trans.sa_session.query(self.app.model.History).get(trans.security.decode_id(history_param[8:]))
- if history.user != trans.user and not trans.user_is_admin():
- trans.response.status = 400
- return "Invalid History specified."
+ encoded_history_id = history_param[ 8: ]
+ history_id = self.__decode_id( trans, encoded_history_id, model_type="history" )
+ history = self.history_manager.get( trans, history_id, check_ownership=True )
else:
# Send workflow outputs to new history.
history = self.app.model.History(name=history_param, user=trans.user)
@@ -284,8 +288,8 @@
inputs[k]['id']
)
else:
- trans.response.status = 400
- return "Unknown dataset source '%s' specified." % inputs[k]['src']
+ message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
+ raise exceptions.RequestParameterInvalidException( message )
if add_to_history and content.history != history:
content = content.copy()
if isinstance( content, self.app.model.HistoryDatasetAssociation ):
@@ -294,8 +298,8 @@
history.add_dataset_collection( content )
inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
except AssertionError:
- trans.response.status = 400
- return "Invalid Dataset '%s' Specified" % inputs[k]['id']
+ message = "Invalid workflow input '%s' specified" % inputs[k]['id']
+ raise exceptions.ItemAccessibilityException( message )
# Run each step, connecting outputs to inputs
replacement_dict = payload.get('replacement_params', {})
@@ -308,6 +312,8 @@
param_map=param_map,
)
+ # invoke may throw MessageExceptions on tool erors, failure
+ # to match up inputs, etc...
outputs = invoke(
trans=trans,
workflow=workflow,
@@ -327,30 +333,22 @@
return rval
- @web.expose_api
+ @expose_api
def workflow_dict( self, trans, workflow_id, **kwd ):
"""
GET /api/workflows/{encoded_workflow_id}/download
Returns a selected workflow as a json dictionary.
"""
- try:
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- except Exception, e:
- return ("Workflow with ID='%s' can not be found\n Exception: %s") % (workflow_id, str( e ))
- # check to see if user has permissions to selected workflow
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
ret_dict = self._workflow_to_dict( trans, stored_workflow )
if not ret_dict:
# This workflow has a tool that's missing from the distribution
- trans.response.status = 400
- return "Workflow cannot be exported due to missing tools."
+ message = "Workflow cannot be exported due to missing tools."
+ raise exceptions.MessageException( message )
return ret_dict
- @web.expose_api
+ @expose_api
def delete( self, trans, id, **kwd ):
"""
DELETE /api/workflows/{encoded_workflow_id}
@@ -379,19 +377,39 @@
# TODO: Unsure of response message to let api know that a workflow was successfully deleted
return ( "Workflow '%s' successfully deleted" % stored_workflow.name )
- @web.expose_api
- def import_new_workflow(self, trans, payload, **kwd):
+ @expose_api
+ def import_new_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/upload
Importing dynamic workflows from the api. Return newly generated workflow id.
Author: rpark
# currently assumes payload['workflow'] is a json representation of a workflow to be inserted into the database
+
+ Deprecated in favor to POST /api/workflows with encoded 'workflow' in
+ payload the same way.
"""
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+ def __api_import_new_workflow( self, trans, payload, **kwd ):
data = payload['workflow']
- workflow, missing_tool_tups = self._workflow_from_dict( trans, data, source="API" )
+ publish = util.string_as_bool( payload.get( "publish", False ) )
+ # If 'publish' set, default to importable.
+ importable = util.string_as_bool( payload.get( "importable", publish ) )
+
+ if publish and not importable:
+ raise exceptions.RequestParameterInvalidException( "Published workflow must be importable." )
+
+ from_dict_kwds = dict(
+ source="API",
+ publish=publish,
+ )
+ workflow, missing_tool_tups = self._workflow_from_dict( trans, data, **from_dict_kwds )
+
+ if importable:
+ self._make_item_accessible( trans.sa_session, workflow )
+ trans.sa_session.flush()
# galaxy workflow newly created id
workflow_id = workflow.id
@@ -409,7 +427,7 @@
return item
@expose_api
- def import_shared_workflow(self, trans, payload, **kwd):
+ def import_shared_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/import
Import a workflow shared by other users.
@@ -423,14 +441,17 @@
workflow_id = payload.get('workflow_id', None)
if workflow_id is None:
raise exceptions.ObjectAttributeMissingException( "Missing required parameter 'workflow_id'." )
+ self.__api_import_shared_workflow( trans, workflow_id, payload )
+
+ def __api_import_shared_workflow( self, trans, workflow_id, payload, **kwd ):
try:
stored_workflow = self.get_stored_workflow( trans, workflow_id, check_ownership=False )
except:
raise exceptions.ObjectNotFound( "Malformed workflow id ( %s ) specified." % workflow_id )
if stored_workflow.importable is False:
- raise exceptions.MessageException( 'The owner of this workflow has disabled imports via this link.' )
+ raise exceptions.ItemAccessibilityException( 'The owner of this workflow has disabled imports via this link.' )
elif stored_workflow.deleted:
- raise exceptions.MessageException( "You can't import this workflow because it has been deleted." )
+ raise exceptions.ItemDeletionException( "You can't import this workflow because it has been deleted." )
imported_workflow = self._import_shared_workflow( trans, stored_workflow )
item = imported_workflow.to_dict( value_mapper={ 'id': trans.security.encode_id } )
encoded_id = trans.security.encode_id(imported_workflow.id)
@@ -491,3 +512,32 @@
if out is not None:
return self.encode_all_ids( trans, out.to_dict('element'), True)
return None
+
+ def __get_stored_accessible_workflow( self, trans, workflow_id ):
+ stored_workflow = self.__get_stored_workflow( trans, workflow_id )
+
+ # check to see if user has permissions to selected workflow
+ if stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is not owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
+ return stored_workflow
+
+ def __get_stored_workflow( self, trans, workflow_id ):
+ try:
+ workflow_id = self.__decode_id( trans, workflow_id )
+ query = trans.sa_session.query( trans.app.model.StoredWorkflow )
+ stored_workflow = query.get( workflow_id )
+ except Exception:
+ raise exceptions.ObjectNotFound( "No such workflow found - invalid workflow identifier." )
+ if stored_workflow is None:
+ raise exceptions.ObjectNotFound( "No such workflow found." )
+ return stored_workflow
+
+ def __decode_id( self, trans, workflow_id, model_type="workflow" ):
+ try:
+ return trans.security.decode_id( workflow_id )
+ except Exception:
+ message = "Malformed %s id ( %s ) specified, unable to decode" % ( model_type, workflow_id )
+ raise exceptions.MalformedId( message )
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -213,13 +213,13 @@
webapp.add_route( '/visualization/show/:visualization_name',
controller='visualization', action='render', visualization_name=None )
- # "POST /api/workflows/import" => ``workflows.import_workflow()``.
- # Defines a named route "import_workflow".
- webapp.mapper.connect( 'import_workflow', '/api/workflows/upload', controller='workflows', action='import_new_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with 'workflow' in payload.
+ webapp.mapper.connect( 'import_workflow_deprecated', '/api/workflows/upload', controller='workflows', action='import_new_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_dict', '/api/workflows/{workflow_id}/download', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
# Preserve the following download route for now for dependent applications -- deprecate at some point
webapp.mapper.connect( 'workflow_dict', '/api/workflows/download/{workflow_id}', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
- webapp.mapper.connect( 'import_shared_workflow', '/api/workflows/import', controller='workflows', action='import_shared_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with shared_workflow_id in payload.
+ webapp.mapper.connect( 'import_shared_workflow_deprecated', '/api/workflows/import', controller='workflows', action='import_shared_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_usage', '/api/workflows/{workflow_id}/usage', controller='workflows', action='workflow_usage', conditions=dict(method=['GET']))
webapp.mapper.connect( 'workflow_usage_contents', '/api/workflows/{workflow_id}/usage/{usage_id}', controller='workflows', action='workflow_usage_contents', conditions=dict(method=['GET']))
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e test/api/test_workflows.py
--- a/test/api/test_workflows.py
+++ b/test/api/test_workflows.py
@@ -9,6 +9,7 @@
from .helpers import skip_without_tool
from base.interactor import delete_request # requests like delete
+from galaxy.exceptions import error_codes
# Workflow API TODO:
@@ -24,6 +25,16 @@
self.dataset_populator = DatasetPopulator( self.galaxy_interactor )
self.dataset_collection_populator = DatasetCollectionPopulator( self.galaxy_interactor )
+ def test_show_invalid_is_404( self ):
+ show_response = self._get( "workflow/%s" % self._random_key() )
+ self._assert_status_code_is( show_response, 404 )
+
+ def test_cannot_show_private_workflow( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ show_response = self._get( "workflows/%s" % workflow_id )
+ self._assert_status_code_is( show_response, 403 )
+
def test_delete( self ):
workflow_id = self.workflow_populator.simple_workflow( "test_delete" )
workflow_name = "test_delete (imported from API)"
@@ -46,14 +57,44 @@
self._assert_status_code_is( index_response, 200 )
assert isinstance( index_response.json(), list )
- def test_import( self ):
+ def test_upload( self ):
+ self.__test_upload( use_deprecated_route=False )
+
+ def test_upload_deprecated( self ):
+ self.__test_upload( use_deprecated_route=True )
+
+ def __test_upload( self, use_deprecated_route ):
data = dict(
workflow=dumps( self.workflow_populator.load_workflow( name="test_import" ) ),
)
- upload_response = self._post( "workflows/upload", data=data )
+ if use_deprecated_route:
+ route = "workflows/upload"
+ else:
+ route = "workflows"
+ upload_response = self._post( route, data=data )
self._assert_status_code_is( upload_response, 200 )
self._assert_user_has_workflow_with_name( "test_import (imported from API)" )
+ def test_import_deprecated( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published_deprecated", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published_deprecated (imported from API)")
+
+ def test_not_importable_prevents_import( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 403 )
+
+ def test_import_published( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id, deprecated_route=True )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published (imported from API)")
+
def test_export( self ):
uploaded_workflow_id = self.workflow_populator.simple_workflow( "test_for_export" )
download_response = self._get( "workflows/%s/download" % uploaded_workflow_id )
@@ -85,6 +126,29 @@
self._assert_status_code_is( run_workflow_response, 200 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
+ def test_cannot_run_inaccessible_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_cannot_access" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
+ def test_404_on_invalid_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ workflow_request[ "workflow_id" ] = self._random_key()
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 404 )
+
+ def test_cannot_run_against_other_users_history( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ other_history_id = self.dataset_populator.new_history()
+ workflow_request[ "history" ] = "hist_id=%s" % other_history_id
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
@skip_without_tool( "cat1" )
@skip_without_tool( "collection_two_paired" )
def test_run_workflow_collection_params( self ):
@@ -233,6 +297,20 @@
collection_step_state = loads( collection_step[ "tool_state" ] )
self.assertEquals( collection_step_state[ "collection_type" ], u"paired" )
+ def test_empty_create( self ):
+ response = self._post( "workflows" )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_MISSING_PARAMETER )
+
+ def test_invalid_create_multiple_types( self ):
+ data = {
+ 'shared_workflow_id': '1234567890abcdef',
+ 'from_history_id': '1234567890abcdef'
+ }
+ response = self._post( "workflows", data )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_INVALID_PARAMETER )
+
@skip_without_tool( "random_lines1" )
def test_extract_mapping_workflow_from_history( self ):
history_id = self.dataset_populator.new_history()
@@ -551,3 +629,16 @@
self._assert_status_code_is( index_response, 200 )
names = map( lambda w: w[ "name" ], index_response.json() )
return names
+
+ def __import_workflow( self, workflow_id, deprecated_route=False ):
+ if deprecated_route:
+ route = "workflows/import"
+ import_data = dict(
+ workflow_id=workflow_id,
+ )
+ else:
+ route = "workflows"
+ import_data = dict(
+ shared_workflow_id=workflow_id,
+ )
+ return self._post( route, import_data )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
5 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d7ebdeca53d2/
Changeset: d7ebdeca53d2
User: jmchilton
Date: 2014-08-08 15:16:55
Summary: More RESTful shared workflow import.
Previous route was "POST /api/workflows/shared", this still works but should be condisdered deprecated in favor of POSTing to /api/workflows with shared_workflow_id in the payload.
Affected #: 2 files
diff -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 -r d7ebdeca53d28ac3d21e7e242629811a81f68082 lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -161,8 +161,13 @@
:param workflow_name: If from_history_id is set - name of the workflow to create when extracting a workflow from history
:type workflow_name: str
"""
-
- if len( set( ['workflow_id', 'installed_repository_file', 'from_history_id'] ).intersection( payload ) ) > 1:
+ ways_to_create = set( [
+ 'workflow_id',
+ 'installed_repository_file',
+ 'from_history_id',
+ 'shared_workflow_id',
+ ] )
+ if len( ways_to_create.intersection( payload ) ) > 1:
trans.response.status = 403
return "Only one among 'workflow_id', 'installed_repository_file', 'from_history_id' must be specified"
@@ -193,6 +198,10 @@
item[ 'url' ] = url_for( 'workflow', id=item[ 'id' ] )
return item
+ if 'shared_workflow_id' in payload:
+ workflow_id = payload[ 'shared_workflow_id' ]
+ return self.__api_import_shared_workflow( trans, workflow_id, payload )
+
workflow_id = payload.get( 'workflow_id', None )
if not workflow_id:
trans.response.status = 403
@@ -409,7 +418,7 @@
return item
@expose_api
- def import_shared_workflow(self, trans, payload, **kwd):
+ def import_shared_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/import
Import a workflow shared by other users.
@@ -423,6 +432,9 @@
workflow_id = payload.get('workflow_id', None)
if workflow_id is None:
raise exceptions.ObjectAttributeMissingException( "Missing required parameter 'workflow_id'." )
+ self.__api_import_shared_workflow( trans, workflow_id, payload )
+
+ def __api_import_shared_workflow( self, trans, workflow_id, payload, **kwd ):
try:
stored_workflow = self.get_stored_workflow( trans, workflow_id, check_ownership=False )
except:
diff -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 -r d7ebdeca53d28ac3d21e7e242629811a81f68082 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -219,7 +219,8 @@
webapp.mapper.connect( 'workflow_dict', '/api/workflows/{workflow_id}/download', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
# Preserve the following download route for now for dependent applications -- deprecate at some point
webapp.mapper.connect( 'workflow_dict', '/api/workflows/download/{workflow_id}', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
- webapp.mapper.connect( 'import_shared_workflow', '/api/workflows/import', controller='workflows', action='import_shared_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with shared_workflow_id in payload.
+ webapp.mapper.connect( 'import_shared_workflow_deprecated', '/api/workflows/import', controller='workflows', action='import_shared_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_usage', '/api/workflows/{workflow_id}/usage', controller='workflows', action='workflow_usage', conditions=dict(method=['GET']))
webapp.mapper.connect( 'workflow_usage_contents', '/api/workflows/{workflow_id}/usage/{usage_id}', controller='workflows', action='workflow_usage_contents', conditions=dict(method=['GET']))
https://bitbucket.org/galaxy/galaxy-central/commits/479397aedd2b/
Changeset: 479397aedd2b
User: jmchilton
Date: 2014-08-08 15:16:55
Summary: More RESTful direct workflow creation from JSON.
Previous route was "POST /api/workflows/upload", this still works but should be condisdered deprecated in favor
of POSTing to /api/workflows with 'workflow' in the payload.
Affected #: 3 files
diff -r d7ebdeca53d28ac3d21e7e242629811a81f68082 -r 479397aedd2b4cb074ac978377f4d27fa92476a6 lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -166,6 +166,7 @@
'installed_repository_file',
'from_history_id',
'shared_workflow_id',
+ 'workflow',
] )
if len( ways_to_create.intersection( payload ) ) > 1:
trans.response.status = 403
@@ -202,6 +203,9 @@
workflow_id = payload[ 'shared_workflow_id' ]
return self.__api_import_shared_workflow( trans, workflow_id, payload )
+ if 'workflow' in payload:
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+
workflow_id = payload.get( 'workflow_id', None )
if not workflow_id:
trans.response.status = 403
@@ -389,15 +393,20 @@
return ( "Workflow '%s' successfully deleted" % stored_workflow.name )
@web.expose_api
- def import_new_workflow(self, trans, payload, **kwd):
+ def import_new_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/upload
Importing dynamic workflows from the api. Return newly generated workflow id.
Author: rpark
# currently assumes payload['workflow'] is a json representation of a workflow to be inserted into the database
+
+ Deprecated in favor to POST /api/workflows with encoded 'workflow' in
+ payload the same way.
"""
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+ def __api_import_new_workflow( self, trans, payload, **kwd ):
data = payload['workflow']
workflow, missing_tool_tups = self._workflow_from_dict( trans, data, source="API" )
diff -r d7ebdeca53d28ac3d21e7e242629811a81f68082 -r 479397aedd2b4cb074ac978377f4d27fa92476a6 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -213,9 +213,8 @@
webapp.add_route( '/visualization/show/:visualization_name',
controller='visualization', action='render', visualization_name=None )
- # "POST /api/workflows/import" => ``workflows.import_workflow()``.
- # Defines a named route "import_workflow".
- webapp.mapper.connect( 'import_workflow', '/api/workflows/upload', controller='workflows', action='import_new_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with 'workflow' in payload.
+ webapp.mapper.connect( 'import_workflow_deprecated', '/api/workflows/upload', controller='workflows', action='import_new_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_dict', '/api/workflows/{workflow_id}/download', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
# Preserve the following download route for now for dependent applications -- deprecate at some point
webapp.mapper.connect( 'workflow_dict', '/api/workflows/download/{workflow_id}', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
diff -r d7ebdeca53d28ac3d21e7e242629811a81f68082 -r 479397aedd2b4cb074ac978377f4d27fa92476a6 test/api/test_workflows.py
--- a/test/api/test_workflows.py
+++ b/test/api/test_workflows.py
@@ -46,11 +46,21 @@
self._assert_status_code_is( index_response, 200 )
assert isinstance( index_response.json(), list )
- def test_import( self ):
+ def test_upload( self ):
+ self.__test_upload( use_deprecated_route=False )
+
+ def test_upload_deprecated( self ):
+ self.__test_upload( use_deprecated_route=True )
+
+ def __test_upload( self, use_deprecated_route ):
data = dict(
workflow=dumps( self.workflow_populator.load_workflow( name="test_import" ) ),
)
- upload_response = self._post( "workflows/upload", data=data )
+ if use_deprecated_route:
+ route = "workflows/upload"
+ else:
+ route = "workflows"
+ upload_response = self._post( route, data=data )
self._assert_status_code_is( upload_response, 200 )
self._assert_user_has_workflow_with_name( "test_import (imported from API)" )
https://bitbucket.org/galaxy/galaxy-central/commits/ecc4c38e0529/
Changeset: ecc4c38e0529
User: jmchilton
Date: 2014-08-08 15:16:55
Summary: Work toward making workflows API use newer standards.
Convert workflow API to use new-style API decorator throughout.
Improved workflow exception handling - now more explicit status code setting and returning of raw error strings in the API. Most obvious exceptional paths out of the API are now coming through MessageExceptions of things even more specific. Add API tests for many of these exceptional conditions.
Use more helper methods to reduce method length, duplication.
Affected #: 2 files
diff -r 479397aedd2b4cb074ac978377f4d27fa92476a6 -r ecc4c38e0529fb3352ad0534e71929f6f6b29e7f lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -6,8 +6,9 @@
import logging
from sqlalchemy import desc, or_
-from galaxy import exceptions, util, web
+from galaxy import exceptions, util
from galaxy.model.item_attrs import UsesAnnotations
+from galaxy.managers import histories
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, url_for, UsesStoredWorkflowMixin
from galaxy.web.base.controller import UsesHistoryMixin
@@ -20,7 +21,11 @@
class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations):
- @web.expose_api
+ def __init__( self, app ):
+ super( BaseAPIController, self ).__init__( app )
+ self.history_manager = histories.HistoryManager()
+
+ @expose_api
def index(self, trans, **kwd):
"""
GET /api/workflows
@@ -54,30 +59,21 @@
rval.append(item)
return rval
- @web.expose_api
+ @expose_api
def show(self, trans, id, **kwd):
"""
GET /api/workflows/{encoded_workflow_id}
Displays information needed to run a workflow from the command line.
"""
- workflow_id = id
- try:
- decoded_workflow_id = trans.security.decode_id(workflow_id)
- except TypeError:
- trans.response.status = 400
- return "Malformed workflow id ( %s ) specified, unable to decode." % str(workflow_id)
- try:
- stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).get(decoded_workflow_id)
- if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is neither importable, nor owned by or shared with current user")
- except:
- trans.response.status = 400
- return "That workflow does not exist."
+ stored_workflow = self.__get_stored_workflow( trans, id )
+ if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is neither importable, nor owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
item = stored_workflow.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
- item['url'] = url_for('workflow', id=workflow_id)
+ item['url'] = url_for('workflow', id=id)
item['owner'] = stored_workflow.user.username
latest_workflow = stored_workflow.latest_workflow
inputs = {}
@@ -114,7 +110,7 @@
item['steps'] = steps
return item
- @web.expose_api
+ @expose_api
def create(self, trans, payload, **kwd):
"""
POST /api/workflows
@@ -167,10 +163,14 @@
'from_history_id',
'shared_workflow_id',
'workflow',
- ] )
- if len( ways_to_create.intersection( payload ) ) > 1:
- trans.response.status = 403
- return "Only one among 'workflow_id', 'installed_repository_file', 'from_history_id' must be specified"
+ ] ).intersection( payload )
+ if len( ways_to_create ) == 0:
+ message = "One parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterMissingException( message )
+
+ if len( ways_to_create ) > 1:
+ message = "Only one parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterInvalidException( message )
if 'installed_repository_file' in payload:
workflow_controller = trans.webapp.controllers[ 'workflow' ]
@@ -208,8 +208,8 @@
workflow_id = payload.get( 'workflow_id', None )
if not workflow_id:
- trans.response.status = 403
- return "Either workflow_id, installed_repository_file or from_history_id must be specified"
+ message = "Invalid workflow_id specified."
+ raise exceptions.RequestParameterInvalidException( message )
# Pull other parameters out of payload.
param_map = payload.get( 'parameters', {} )
@@ -238,34 +238,24 @@
history_param = payload.get('history', '')
# Get workflow + accessibility check.
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
workflow = stored_workflow.latest_workflow
# Sanity checks.
- if not workflow:
- trans.response.status = 400
- return "Workflow not found."
if len( workflow.steps ) == 0:
- trans.response.status = 400
- return "Workflow cannot be run because it does not have any steps"
+ raise exceptions.MessageException( "Workflow cannot be run because it does not have any steps" )
if workflow.has_cycles:
- trans.response.status = 400
- return "Workflow cannot be run because it contains cycles"
+ raise exceptions.MessageException( "Workflow cannot be run because it contains cycles" )
if workflow.has_errors:
- trans.response.status = 400
- return "Workflow cannot be run because of validation errors in some steps"
+ message = "Workflow cannot be run because of validation errors in some steps"
+ raise exceptions.MessageException( message )
# Get target history.
if history_param.startswith('hist_id='):
# Passing an existing history to use.
- history = trans.sa_session.query(self.app.model.History).get(trans.security.decode_id(history_param[8:]))
- if history.user != trans.user and not trans.user_is_admin():
- trans.response.status = 400
- return "Invalid History specified."
+ encoded_history_id = history_param[ 8: ]
+ history_id = self.__decode_id( trans, encoded_history_id, model_type="history" )
+ history = self.history_manager.get( trans, history_id, check_ownership=True )
else:
# Send workflow outputs to new history.
history = self.app.model.History(name=history_param, user=trans.user)
@@ -297,8 +287,8 @@
inputs[k]['id']
)
else:
- trans.response.status = 400
- return "Unknown dataset source '%s' specified." % inputs[k]['src']
+ message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
+ raise exceptions.RequestParameterInvalidException( message )
if add_to_history and content.history != history:
content = content.copy()
if isinstance( content, self.app.model.HistoryDatasetAssociation ):
@@ -307,8 +297,8 @@
history.add_dataset_collection( content )
inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
except AssertionError:
- trans.response.status = 400
- return "Invalid Dataset '%s' Specified" % inputs[k]['id']
+ message = "Invalid workflow input '%s' specified" % inputs[k]['id']
+ raise exceptions.ItemAccessibilityException( message )
# Run each step, connecting outputs to inputs
replacement_dict = payload.get('replacement_params', {})
@@ -321,6 +311,8 @@
param_map=param_map,
)
+ # invoke may throw MessageExceptions on tool erors, failure
+ # to match up inputs, etc...
outputs = invoke(
trans=trans,
workflow=workflow,
@@ -340,30 +332,22 @@
return rval
- @web.expose_api
+ @expose_api
def workflow_dict( self, trans, workflow_id, **kwd ):
"""
GET /api/workflows/{encoded_workflow_id}/download
Returns a selected workflow as a json dictionary.
"""
- try:
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- except Exception, e:
- return ("Workflow with ID='%s' can not be found\n Exception: %s") % (workflow_id, str( e ))
- # check to see if user has permissions to selected workflow
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
ret_dict = self._workflow_to_dict( trans, stored_workflow )
if not ret_dict:
# This workflow has a tool that's missing from the distribution
- trans.response.status = 400
- return "Workflow cannot be exported due to missing tools."
+ message = "Workflow cannot be exported due to missing tools."
+ raise exceptions.MessageException( message )
return ret_dict
- @web.expose_api
+ @expose_api
def delete( self, trans, id, **kwd ):
"""
DELETE /api/workflows/{encoded_workflow_id}
@@ -392,7 +376,7 @@
# TODO: Unsure of response message to let api know that a workflow was successfully deleted
return ( "Workflow '%s' successfully deleted" % stored_workflow.name )
- @web.expose_api
+ @expose_api
def import_new_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/upload
@@ -512,3 +496,32 @@
if out is not None:
return self.encode_all_ids( trans, out.to_dict('element'), True)
return None
+
+ def __get_stored_accessible_workflow( self, trans, workflow_id ):
+ stored_workflow = self.__get_stored_workflow( trans, workflow_id )
+
+ # check to see if user has permissions to selected workflow
+ if stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is not owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
+ return stored_workflow
+
+ def __get_stored_workflow( self, trans, workflow_id ):
+ try:
+ workflow_id = self.__decode_id( trans, workflow_id )
+ query = trans.sa_session.query( trans.app.model.StoredWorkflow )
+ stored_workflow = query.get( workflow_id )
+ except Exception:
+ raise exceptions.ObjectNotFound( "No such workflow found - invalid workflow identifier." )
+ if stored_workflow is None:
+ raise exceptions.ObjectNotFound( "No such workflow found." )
+ return stored_workflow
+
+ def __decode_id( self, trans, workflow_id, model_type="workflow" ):
+ try:
+ return trans.security.decode_id( workflow_id )
+ except Exception:
+ message = "Malformed %s id ( %s ) specified, unable to decode" % ( model_type, workflow_id )
+ raise exceptions.MalformedId( message )
diff -r 479397aedd2b4cb074ac978377f4d27fa92476a6 -r ecc4c38e0529fb3352ad0534e71929f6f6b29e7f test/api/test_workflows.py
--- a/test/api/test_workflows.py
+++ b/test/api/test_workflows.py
@@ -9,6 +9,7 @@
from .helpers import skip_without_tool
from base.interactor import delete_request # requests like delete
+from galaxy.exceptions import error_codes
# Workflow API TODO:
@@ -24,6 +25,16 @@
self.dataset_populator = DatasetPopulator( self.galaxy_interactor )
self.dataset_collection_populator = DatasetCollectionPopulator( self.galaxy_interactor )
+ def test_show_invalid_is_404( self ):
+ show_response = self._get( "workflow/%s" % self._random_key() )
+ self._assert_status_code_is( show_response, 404 )
+
+ def test_cannot_show_private_workflow( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ show_response = self._get( "workflows/%s" % workflow_id )
+ self._assert_status_code_is( show_response, 403 )
+
def test_delete( self ):
workflow_id = self.workflow_populator.simple_workflow( "test_delete" )
workflow_name = "test_delete (imported from API)"
@@ -95,6 +106,29 @@
self._assert_status_code_is( run_workflow_response, 200 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
+ def test_cannot_run_inaccessible_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_cannot_access" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
+ def test_404_on_invalid_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ workflow_request[ "workflow_id" ] = self._random_key()
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 404 )
+
+ def test_cannot_run_against_other_users_history( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ other_history_id = self.dataset_populator.new_history()
+ workflow_request[ "history" ] = "hist_id=%s" % other_history_id
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
@skip_without_tool( "cat1" )
@skip_without_tool( "collection_two_paired" )
def test_run_workflow_collection_params( self ):
@@ -243,6 +277,20 @@
collection_step_state = loads( collection_step[ "tool_state" ] )
self.assertEquals( collection_step_state[ "collection_type" ], u"paired" )
+ def test_empty_create( self ):
+ response = self._post( "workflows" )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_MISSING_PARAMETER )
+
+ def test_invalid_create_multiple_types( self ):
+ data = {
+ 'shared_workflow_id': '1234567890abcdef',
+ 'from_history_id': '1234567890abcdef'
+ }
+ response = self._post( "workflows", data )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_INVALID_PARAMETER )
+
@skip_without_tool( "random_lines1" )
def test_extract_mapping_workflow_from_history( self ):
history_id = self.dataset_populator.new_history()
https://bitbucket.org/galaxy/galaxy-central/commits/a3ac64b85faa/
Changeset: a3ac64b85faa
User: jmchilton
Date: 2014-08-08 15:16:55
Summary: Allow workflow uploads to specify publishable/importable.
Use new capabilities to improve workflow testing.
Affected #: 3 files
diff -r ecc4c38e0529fb3352ad0534e71929f6f6b29e7f -r a3ac64b85faa4e59d331277a801a2b5570a8ca7e lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -1664,7 +1664,7 @@
session.flush()
return imported_stored
- def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False ):
+ def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False, publish=False ):
"""
Creates a workflow from a dict. Created workflow is stored in the database and returned.
"""
@@ -1752,6 +1752,7 @@
workflow.stored_workflow = stored
stored.latest_workflow = workflow
stored.user = trans.user
+ stored.published = publish
if data[ 'annotation' ]:
self.add_item_annotation( trans.sa_session, stored.user, stored, data[ 'annotation' ] )
diff -r ecc4c38e0529fb3352ad0534e71929f6f6b29e7f -r a3ac64b85faa4e59d331277a801a2b5570a8ca7e lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -12,6 +12,7 @@
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, url_for, UsesStoredWorkflowMixin
from galaxy.web.base.controller import UsesHistoryMixin
+from galaxy.web.base.controller import SharableMixin
from galaxy.workflow.extract import extract_workflow
from galaxy.workflow.run import invoke
from galaxy.workflow.run import WorkflowRunConfig
@@ -19,7 +20,7 @@
log = logging.getLogger(__name__)
-class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations):
+class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations, SharableMixin):
def __init__( self, app ):
super( BaseAPIController, self ).__init__( app )
@@ -393,7 +394,22 @@
def __api_import_new_workflow( self, trans, payload, **kwd ):
data = payload['workflow']
- workflow, missing_tool_tups = self._workflow_from_dict( trans, data, source="API" )
+ publish = util.string_as_bool( payload.get( "publish", False ) )
+ # If 'publish' set, default to importable.
+ importable = util.string_as_bool( payload.get( "importable", publish ) )
+
+ if publish and not importable:
+ raise exceptions.RequestParameterInvalidException( "Published workflow must be importable." )
+
+ from_dict_kwds = dict(
+ source="API",
+ publish=publish,
+ )
+ workflow, missing_tool_tups = self._workflow_from_dict( trans, data, **from_dict_kwds )
+
+ if importable:
+ self._make_item_accessible( trans.sa_session, workflow )
+ trans.sa_session.flush()
# galaxy workflow newly created id
workflow_id = workflow.id
@@ -433,9 +449,9 @@
except:
raise exceptions.ObjectNotFound( "Malformed workflow id ( %s ) specified." % workflow_id )
if stored_workflow.importable is False:
- raise exceptions.MessageException( 'The owner of this workflow has disabled imports via this link.' )
+ raise exceptions.ItemAccessibilityException( 'The owner of this workflow has disabled imports via this link.' )
elif stored_workflow.deleted:
- raise exceptions.MessageException( "You can't import this workflow because it has been deleted." )
+ raise exceptions.ItemDeletionException( "You can't import this workflow because it has been deleted." )
imported_workflow = self._import_shared_workflow( trans, stored_workflow )
item = imported_workflow.to_dict( value_mapper={ 'id': trans.security.encode_id } )
encoded_id = trans.security.encode_id(imported_workflow.id)
diff -r ecc4c38e0529fb3352ad0534e71929f6f6b29e7f -r a3ac64b85faa4e59d331277a801a2b5570a8ca7e test/api/test_workflows.py
--- a/test/api/test_workflows.py
+++ b/test/api/test_workflows.py
@@ -75,6 +75,26 @@
self._assert_status_code_is( upload_response, 200 )
self._assert_user_has_workflow_with_name( "test_import (imported from API)" )
+ def test_import_deprecated( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published_deprecated", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published_deprecated (imported from API)")
+
+ def test_not_importable_prevents_import( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 403 )
+
+ def test_import_published( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id, deprecated_route=True )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published (imported from API)")
+
def test_export( self ):
uploaded_workflow_id = self.workflow_populator.simple_workflow( "test_for_export" )
download_response = self._get( "workflows/%s/download" % uploaded_workflow_id )
@@ -609,3 +629,16 @@
self._assert_status_code_is( index_response, 200 )
names = map( lambda w: w[ "name" ], index_response.json() )
return names
+
+ def __import_workflow( self, workflow_id, deprecated_route=False ):
+ if deprecated_route:
+ route = "workflows/import"
+ import_data = dict(
+ workflow_id=workflow_id,
+ )
+ else:
+ route = "workflows"
+ import_data = dict(
+ shared_workflow_id=workflow_id,
+ )
+ return self._post( route, import_data )
https://bitbucket.org/galaxy/galaxy-central/commits/de2e33813275/
Changeset: de2e33813275
User: jmchilton
Date: 2014-08-09 15:15:11
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #452)
More RESTful workflow API (attempt 3)
Affected #: 4 files
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -1664,7 +1664,7 @@
session.flush()
return imported_stored
- def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False ):
+ def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False, publish=False ):
"""
Creates a workflow from a dict. Created workflow is stored in the database and returned.
"""
@@ -1752,6 +1752,7 @@
workflow.stored_workflow = stored
stored.latest_workflow = workflow
stored.user = trans.user
+ stored.published = publish
if data[ 'annotation' ]:
self.add_item_annotation( trans.sa_session, stored.user, stored, data[ 'annotation' ] )
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/webapps/galaxy/api/workflows.py
--- a/lib/galaxy/webapps/galaxy/api/workflows.py
+++ b/lib/galaxy/webapps/galaxy/api/workflows.py
@@ -6,11 +6,13 @@
import logging
from sqlalchemy import desc, or_
-from galaxy import exceptions, util, web
+from galaxy import exceptions, util
from galaxy.model.item_attrs import UsesAnnotations
+from galaxy.managers import histories
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, url_for, UsesStoredWorkflowMixin
from galaxy.web.base.controller import UsesHistoryMixin
+from galaxy.web.base.controller import SharableMixin
from galaxy.workflow.extract import extract_workflow
from galaxy.workflow.run import invoke
from galaxy.workflow.run import WorkflowRunConfig
@@ -18,9 +20,13 @@
log = logging.getLogger(__name__)
-class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations):
+class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesHistoryMixin, UsesAnnotations, SharableMixin):
- @web.expose_api
+ def __init__( self, app ):
+ super( BaseAPIController, self ).__init__( app )
+ self.history_manager = histories.HistoryManager()
+
+ @expose_api
def index(self, trans, **kwd):
"""
GET /api/workflows
@@ -54,30 +60,21 @@
rval.append(item)
return rval
- @web.expose_api
+ @expose_api
def show(self, trans, id, **kwd):
"""
GET /api/workflows/{encoded_workflow_id}
Displays information needed to run a workflow from the command line.
"""
- workflow_id = id
- try:
- decoded_workflow_id = trans.security.decode_id(workflow_id)
- except TypeError:
- trans.response.status = 400
- return "Malformed workflow id ( %s ) specified, unable to decode." % str(workflow_id)
- try:
- stored_workflow = trans.sa_session.query(trans.app.model.StoredWorkflow).get(decoded_workflow_id)
- if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is neither importable, nor owned by or shared with current user")
- except:
- trans.response.status = 400
- return "That workflow does not exist."
+ stored_workflow = self.__get_stored_workflow( trans, id )
+ if stored_workflow.importable is False and stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is neither importable, nor owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
item = stored_workflow.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } )
- item['url'] = url_for('workflow', id=workflow_id)
+ item['url'] = url_for('workflow', id=id)
item['owner'] = stored_workflow.user.username
latest_workflow = stored_workflow.latest_workflow
inputs = {}
@@ -114,7 +111,7 @@
item['steps'] = steps
return item
- @web.expose_api
+ @expose_api
def create(self, trans, payload, **kwd):
"""
POST /api/workflows
@@ -161,10 +158,20 @@
:param workflow_name: If from_history_id is set - name of the workflow to create when extracting a workflow from history
:type workflow_name: str
"""
+ ways_to_create = set( [
+ 'workflow_id',
+ 'installed_repository_file',
+ 'from_history_id',
+ 'shared_workflow_id',
+ 'workflow',
+ ] ).intersection( payload )
+ if len( ways_to_create ) == 0:
+ message = "One parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterMissingException( message )
- if len( set( ['workflow_id', 'installed_repository_file', 'from_history_id'] ).intersection( payload ) ) > 1:
- trans.response.status = 403
- return "Only one among 'workflow_id', 'installed_repository_file', 'from_history_id' must be specified"
+ if len( ways_to_create ) > 1:
+ message = "Only one parameter among - %s - must be specified" % ", ".join( ways_to_create )
+ raise exceptions.RequestParameterInvalidException( message )
if 'installed_repository_file' in payload:
workflow_controller = trans.webapp.controllers[ 'workflow' ]
@@ -193,10 +200,17 @@
item[ 'url' ] = url_for( 'workflow', id=item[ 'id' ] )
return item
+ if 'shared_workflow_id' in payload:
+ workflow_id = payload[ 'shared_workflow_id' ]
+ return self.__api_import_shared_workflow( trans, workflow_id, payload )
+
+ if 'workflow' in payload:
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+
workflow_id = payload.get( 'workflow_id', None )
if not workflow_id:
- trans.response.status = 403
- return "Either workflow_id, installed_repository_file or from_history_id must be specified"
+ message = "Invalid workflow_id specified."
+ raise exceptions.RequestParameterInvalidException( message )
# Pull other parameters out of payload.
param_map = payload.get( 'parameters', {} )
@@ -225,34 +239,24 @@
history_param = payload.get('history', '')
# Get workflow + accessibility check.
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
workflow = stored_workflow.latest_workflow
# Sanity checks.
- if not workflow:
- trans.response.status = 400
- return "Workflow not found."
if len( workflow.steps ) == 0:
- trans.response.status = 400
- return "Workflow cannot be run because it does not have any steps"
+ raise exceptions.MessageException( "Workflow cannot be run because it does not have any steps" )
if workflow.has_cycles:
- trans.response.status = 400
- return "Workflow cannot be run because it contains cycles"
+ raise exceptions.MessageException( "Workflow cannot be run because it contains cycles" )
if workflow.has_errors:
- trans.response.status = 400
- return "Workflow cannot be run because of validation errors in some steps"
+ message = "Workflow cannot be run because of validation errors in some steps"
+ raise exceptions.MessageException( message )
# Get target history.
if history_param.startswith('hist_id='):
# Passing an existing history to use.
- history = trans.sa_session.query(self.app.model.History).get(trans.security.decode_id(history_param[8:]))
- if history.user != trans.user and not trans.user_is_admin():
- trans.response.status = 400
- return "Invalid History specified."
+ encoded_history_id = history_param[ 8: ]
+ history_id = self.__decode_id( trans, encoded_history_id, model_type="history" )
+ history = self.history_manager.get( trans, history_id, check_ownership=True )
else:
# Send workflow outputs to new history.
history = self.app.model.History(name=history_param, user=trans.user)
@@ -284,8 +288,8 @@
inputs[k]['id']
)
else:
- trans.response.status = 400
- return "Unknown dataset source '%s' specified." % inputs[k]['src']
+ message = "Unknown workflow input source '%s' specified." % inputs[k]['src']
+ raise exceptions.RequestParameterInvalidException( message )
if add_to_history and content.history != history:
content = content.copy()
if isinstance( content, self.app.model.HistoryDatasetAssociation ):
@@ -294,8 +298,8 @@
history.add_dataset_collection( content )
inputs[k]['hda'] = content # TODO: rename key to 'content', prescreen input ensure not populated explicitly
except AssertionError:
- trans.response.status = 400
- return "Invalid Dataset '%s' Specified" % inputs[k]['id']
+ message = "Invalid workflow input '%s' specified" % inputs[k]['id']
+ raise exceptions.ItemAccessibilityException( message )
# Run each step, connecting outputs to inputs
replacement_dict = payload.get('replacement_params', {})
@@ -308,6 +312,8 @@
param_map=param_map,
)
+ # invoke may throw MessageExceptions on tool erors, failure
+ # to match up inputs, etc...
outputs = invoke(
trans=trans,
workflow=workflow,
@@ -327,30 +333,22 @@
return rval
- @web.expose_api
+ @expose_api
def workflow_dict( self, trans, workflow_id, **kwd ):
"""
GET /api/workflows/{encoded_workflow_id}/download
Returns a selected workflow as a json dictionary.
"""
- try:
- stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id))
- except Exception, e:
- return ("Workflow with ID='%s' can not be found\n Exception: %s") % (workflow_id, str( e ))
- # check to see if user has permissions to selected workflow
- if stored_workflow.user != trans.user and not trans.user_is_admin():
- if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
- trans.response.status = 400
- return("Workflow is not owned by or shared with current user")
+ stored_workflow = self.__get_stored_accessible_workflow( trans, workflow_id )
ret_dict = self._workflow_to_dict( trans, stored_workflow )
if not ret_dict:
# This workflow has a tool that's missing from the distribution
- trans.response.status = 400
- return "Workflow cannot be exported due to missing tools."
+ message = "Workflow cannot be exported due to missing tools."
+ raise exceptions.MessageException( message )
return ret_dict
- @web.expose_api
+ @expose_api
def delete( self, trans, id, **kwd ):
"""
DELETE /api/workflows/{encoded_workflow_id}
@@ -379,19 +377,39 @@
# TODO: Unsure of response message to let api know that a workflow was successfully deleted
return ( "Workflow '%s' successfully deleted" % stored_workflow.name )
- @web.expose_api
- def import_new_workflow(self, trans, payload, **kwd):
+ @expose_api
+ def import_new_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/upload
Importing dynamic workflows from the api. Return newly generated workflow id.
Author: rpark
# currently assumes payload['workflow'] is a json representation of a workflow to be inserted into the database
+
+ Deprecated in favor to POST /api/workflows with encoded 'workflow' in
+ payload the same way.
"""
+ return self.__api_import_new_workflow( trans, payload, **kwd )
+ def __api_import_new_workflow( self, trans, payload, **kwd ):
data = payload['workflow']
- workflow, missing_tool_tups = self._workflow_from_dict( trans, data, source="API" )
+ publish = util.string_as_bool( payload.get( "publish", False ) )
+ # If 'publish' set, default to importable.
+ importable = util.string_as_bool( payload.get( "importable", publish ) )
+
+ if publish and not importable:
+ raise exceptions.RequestParameterInvalidException( "Published workflow must be importable." )
+
+ from_dict_kwds = dict(
+ source="API",
+ publish=publish,
+ )
+ workflow, missing_tool_tups = self._workflow_from_dict( trans, data, **from_dict_kwds )
+
+ if importable:
+ self._make_item_accessible( trans.sa_session, workflow )
+ trans.sa_session.flush()
# galaxy workflow newly created id
workflow_id = workflow.id
@@ -409,7 +427,7 @@
return item
@expose_api
- def import_shared_workflow(self, trans, payload, **kwd):
+ def import_shared_workflow_deprecated(self, trans, payload, **kwd):
"""
POST /api/workflows/import
Import a workflow shared by other users.
@@ -423,14 +441,17 @@
workflow_id = payload.get('workflow_id', None)
if workflow_id is None:
raise exceptions.ObjectAttributeMissingException( "Missing required parameter 'workflow_id'." )
+ self.__api_import_shared_workflow( trans, workflow_id, payload )
+
+ def __api_import_shared_workflow( self, trans, workflow_id, payload, **kwd ):
try:
stored_workflow = self.get_stored_workflow( trans, workflow_id, check_ownership=False )
except:
raise exceptions.ObjectNotFound( "Malformed workflow id ( %s ) specified." % workflow_id )
if stored_workflow.importable is False:
- raise exceptions.MessageException( 'The owner of this workflow has disabled imports via this link.' )
+ raise exceptions.ItemAccessibilityException( 'The owner of this workflow has disabled imports via this link.' )
elif stored_workflow.deleted:
- raise exceptions.MessageException( "You can't import this workflow because it has been deleted." )
+ raise exceptions.ItemDeletionException( "You can't import this workflow because it has been deleted." )
imported_workflow = self._import_shared_workflow( trans, stored_workflow )
item = imported_workflow.to_dict( value_mapper={ 'id': trans.security.encode_id } )
encoded_id = trans.security.encode_id(imported_workflow.id)
@@ -491,3 +512,32 @@
if out is not None:
return self.encode_all_ids( trans, out.to_dict('element'), True)
return None
+
+ def __get_stored_accessible_workflow( self, trans, workflow_id ):
+ stored_workflow = self.__get_stored_workflow( trans, workflow_id )
+
+ # check to see if user has permissions to selected workflow
+ if stored_workflow.user != trans.user and not trans.user_is_admin():
+ if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0:
+ message = "Workflow is not owned by or shared with current user"
+ raise exceptions.ItemAccessibilityException( message )
+
+ return stored_workflow
+
+ def __get_stored_workflow( self, trans, workflow_id ):
+ try:
+ workflow_id = self.__decode_id( trans, workflow_id )
+ query = trans.sa_session.query( trans.app.model.StoredWorkflow )
+ stored_workflow = query.get( workflow_id )
+ except Exception:
+ raise exceptions.ObjectNotFound( "No such workflow found - invalid workflow identifier." )
+ if stored_workflow is None:
+ raise exceptions.ObjectNotFound( "No such workflow found." )
+ return stored_workflow
+
+ def __decode_id( self, trans, workflow_id, model_type="workflow" ):
+ try:
+ return trans.security.decode_id( workflow_id )
+ except Exception:
+ message = "Malformed %s id ( %s ) specified, unable to decode" % ( model_type, workflow_id )
+ raise exceptions.MalformedId( message )
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -213,13 +213,13 @@
webapp.add_route( '/visualization/show/:visualization_name',
controller='visualization', action='render', visualization_name=None )
- # "POST /api/workflows/import" => ``workflows.import_workflow()``.
- # Defines a named route "import_workflow".
- webapp.mapper.connect( 'import_workflow', '/api/workflows/upload', controller='workflows', action='import_new_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with 'workflow' in payload.
+ webapp.mapper.connect( 'import_workflow_deprecated', '/api/workflows/upload', controller='workflows', action='import_new_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_dict', '/api/workflows/{workflow_id}/download', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
# Preserve the following download route for now for dependent applications -- deprecate at some point
webapp.mapper.connect( 'workflow_dict', '/api/workflows/download/{workflow_id}', controller='workflows', action='workflow_dict', conditions=dict( method=['GET'] ) )
- webapp.mapper.connect( 'import_shared_workflow', '/api/workflows/import', controller='workflows', action='import_shared_workflow', conditions=dict( method=['POST'] ) )
+ # Deprecated in favor of POST /api/workflows with shared_workflow_id in payload.
+ webapp.mapper.connect( 'import_shared_workflow_deprecated', '/api/workflows/import', controller='workflows', action='import_shared_workflow_deprecated', conditions=dict( method=['POST'] ) )
webapp.mapper.connect( 'workflow_usage', '/api/workflows/{workflow_id}/usage', controller='workflows', action='workflow_usage', conditions=dict(method=['GET']))
webapp.mapper.connect( 'workflow_usage_contents', '/api/workflows/{workflow_id}/usage/{usage_id}', controller='workflows', action='workflow_usage_contents', conditions=dict(method=['GET']))
diff -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 -r de2e33813275b89a04e7de4e95b21f6d2e100d4e test/api/test_workflows.py
--- a/test/api/test_workflows.py
+++ b/test/api/test_workflows.py
@@ -9,6 +9,7 @@
from .helpers import skip_without_tool
from base.interactor import delete_request # requests like delete
+from galaxy.exceptions import error_codes
# Workflow API TODO:
@@ -24,6 +25,16 @@
self.dataset_populator = DatasetPopulator( self.galaxy_interactor )
self.dataset_collection_populator = DatasetCollectionPopulator( self.galaxy_interactor )
+ def test_show_invalid_is_404( self ):
+ show_response = self._get( "workflow/%s" % self._random_key() )
+ self._assert_status_code_is( show_response, 404 )
+
+ def test_cannot_show_private_workflow( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ show_response = self._get( "workflows/%s" % workflow_id )
+ self._assert_status_code_is( show_response, 403 )
+
def test_delete( self ):
workflow_id = self.workflow_populator.simple_workflow( "test_delete" )
workflow_name = "test_delete (imported from API)"
@@ -46,14 +57,44 @@
self._assert_status_code_is( index_response, 200 )
assert isinstance( index_response.json(), list )
- def test_import( self ):
+ def test_upload( self ):
+ self.__test_upload( use_deprecated_route=False )
+
+ def test_upload_deprecated( self ):
+ self.__test_upload( use_deprecated_route=True )
+
+ def __test_upload( self, use_deprecated_route ):
data = dict(
workflow=dumps( self.workflow_populator.load_workflow( name="test_import" ) ),
)
- upload_response = self._post( "workflows/upload", data=data )
+ if use_deprecated_route:
+ route = "workflows/upload"
+ else:
+ route = "workflows"
+ upload_response = self._post( route, data=data )
self._assert_status_code_is( upload_response, 200 )
self._assert_user_has_workflow_with_name( "test_import (imported from API)" )
+ def test_import_deprecated( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published_deprecated", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published_deprecated (imported from API)")
+
+ def test_not_importable_prevents_import( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id )
+ self._assert_status_code_is( other_import_response, 403 )
+
+ def test_import_published( self ):
+ workflow_id = self.workflow_populator.simple_workflow( "test_import_published", publish=True )
+ with self._different_user():
+ other_import_response = self.__import_workflow( workflow_id, deprecated_route=True )
+ self._assert_status_code_is( other_import_response, 200 )
+ self._assert_user_has_workflow_with_name( "imported: test_import_published (imported from API)")
+
def test_export( self ):
uploaded_workflow_id = self.workflow_populator.simple_workflow( "test_for_export" )
download_response = self._get( "workflows/%s/download" % uploaded_workflow_id )
@@ -85,6 +126,29 @@
self._assert_status_code_is( run_workflow_response, 200 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
+ def test_cannot_run_inaccessible_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_cannot_access" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
+ def test_404_on_invalid_workflow( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ workflow_request[ "workflow_id" ] = self._random_key()
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 404 )
+
+ def test_cannot_run_against_other_users_history( self ):
+ workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" )
+ workflow_request, history_id = self._setup_workflow_run( workflow )
+ with self._different_user():
+ other_history_id = self.dataset_populator.new_history()
+ workflow_request[ "history" ] = "hist_id=%s" % other_history_id
+ run_workflow_response = self._post( "workflows", data=workflow_request )
+ self._assert_status_code_is( run_workflow_response, 403 )
+
@skip_without_tool( "cat1" )
@skip_without_tool( "collection_two_paired" )
def test_run_workflow_collection_params( self ):
@@ -233,6 +297,20 @@
collection_step_state = loads( collection_step[ "tool_state" ] )
self.assertEquals( collection_step_state[ "collection_type" ], u"paired" )
+ def test_empty_create( self ):
+ response = self._post( "workflows" )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_MISSING_PARAMETER )
+
+ def test_invalid_create_multiple_types( self ):
+ data = {
+ 'shared_workflow_id': '1234567890abcdef',
+ 'from_history_id': '1234567890abcdef'
+ }
+ response = self._post( "workflows", data )
+ self._assert_status_code_is( response, 400 )
+ self._assert_error_code_is( response, error_codes.USER_REQUEST_INVALID_PARAMETER )
+
@skip_without_tool( "random_lines1" )
def test_extract_mapping_workflow_from_history( self ):
history_id = self.dataset_populator.new_history()
@@ -551,3 +629,16 @@
self._assert_status_code_is( index_response, 200 )
names = map( lambda w: w[ "name" ], index_response.json() )
return names
+
+ def __import_workflow( self, workflow_id, deprecated_route=False ):
+ if deprecated_route:
+ route = "workflows/import"
+ import_data = dict(
+ workflow_id=workflow_id,
+ )
+ else:
+ route = "workflows"
+ import_data = dict(
+ shared_workflow_id=workflow_id,
+ )
+ return self._post( route, import_data )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d0133648ddb9/
Changeset: d0133648ddb9
User: jmchilton
Date: 2014-08-08 17:42:20
Summary: Cleanup unused parameter left over in workflow controller.
Affected #: 1 file
diff -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 -r d0133648ddb96fc3e0c030c86802e0b6186b7f92 lib/galaxy/webapps/galaxy/controllers/workflow.py
--- a/lib/galaxy/webapps/galaxy/controllers/workflow.py
+++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py
@@ -1226,7 +1226,7 @@
url_for( controller='workflow', action='run', id=workflow_id ) ) )
@web.expose
- def run( self, trans, id, history_id=None, multiple_input_mode="product", hide_fixed_params=False, **kwargs ):
+ def run( self, trans, id, history_id=None, hide_fixed_params=False, **kwargs ):
stored = self.get_stored_workflow( trans, id, check_ownership=False )
user = trans.get_user()
if stored.user != user:
@@ -1269,7 +1269,7 @@
# been POSTed
# List to gather values for the template
invocations = []
- for (kwargs, multi_input_keys) in _expand_multiple_inputs(kwargs, mode=multiple_input_mode):
+ for (kwargs, multi_input_keys) in _expand_multiple_inputs(kwargs):
for step in workflow.steps:
step.upgrade_messages = {}
# Connections by input name
@@ -1653,9 +1653,9 @@
return " on %s and %s" % (", ".join(instance_ds_names[0:-1]), instance_ds_names[-1])
-def _expand_multiple_inputs(kwargs, mode):
+def _expand_multiple_inputs(kwargs):
(single_inputs, matched_multi_inputs, multiplied_multi_inputs) = \
- _split_inputs(kwargs, mode)
+ _split_inputs(kwargs)
# Build up every combination of inputs to be run together.
input_combos = _extend_with_matched_combos(single_inputs, matched_multi_inputs)
@@ -1714,7 +1714,7 @@
return new_inputs
-def _split_inputs(kwargs, mode):
+def _split_inputs(kwargs):
"""
"""
input_keys = filter(lambda a: a.endswith('|input'), kwargs)
https://bitbucket.org/galaxy/galaxy-central/commits/fcbd2849ebd1/
Changeset: fcbd2849ebd1
User: jmchilton
Date: 2014-08-08 17:42:20
Summary: Some PEP-8 fixes for lib/galaxy/webapps/galaxy/controllers/workflow.py.
Affected #: 1 file
diff -r d0133648ddb96fc3e0c030c86802e0b6186b7f92 -r fcbd2849ebd17a80e66e0fbdac9df7bb37f88fa2 lib/galaxy/webapps/galaxy/controllers/workflow.py
--- a/lib/galaxy/webapps/galaxy/controllers/workflow.py
+++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py
@@ -51,7 +51,7 @@
use_panels = True
title = "Saved Workflows"
model_class = model.StoredWorkflow
- default_filter = { "name" : "All", "tags": "All" }
+ default_filter = { "name": "All", "tags": "All" }
default_sort_key = "-update_time"
columns = [
grids.TextColumn( "Name", key="name", attach_popup=True, filterable="advanced" ),
@@ -62,10 +62,11 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search", visible=False, filterable="standard"
+ )
+ )
operations = [
grids.GridOperation( "Edit", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ),
grids.GridOperation( "Run", condition=( lambda item: not item.deleted ), async_compatible=False ),
@@ -95,19 +96,24 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search name, annotation, owner, and tags",
- cols_to_filter=[ columns[0], columns[1], columns[2], columns[4] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search name, annotation, owner, and tags",
+ cols_to_filter=[ columns[0], columns[1], columns[2], columns[4] ],
+ key="free-text-search", visible=False, filterable="standard"
+ )
+ )
operations = [
- grids.GridOperation( "Import",
- condition=( lambda item: not item.deleted ),
- allow_multiple=False,
- url_args=dict( action="imp" ) ),
- grids.GridOperation( "Save as File",
- condition=( lambda item: not item.deleted ),
- allow_multiple=False,
- url_args=dict( action="export_to_file" ) ),
+ grids.GridOperation(
+ "Import",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( action="imp")
+ ),
+ grids.GridOperation(
+ "Save as File",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( action="export_to_file" )
+ ),
]
def build_initial_query( self, trans, **kwargs ):
@@ -275,7 +281,7 @@
user_item_rating = 0
ave_item_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, stored_workflow )
return trans.fill_template_mako( "workflow/display.mako", item=stored_workflow, item_data=stored_workflow.latest_workflow.steps,
- user_item_rating=user_item_rating, ave_item_rating=ave_item_rating, num_ratings=num_ratings )
+ user_item_rating=user_item_rating, ave_item_rating=ave_item_rating, num_ratings=num_ratings )
@web.expose
def get_item_content_async( self, trans, id ):
@@ -390,7 +396,7 @@
# Do import.
stored = self.get_stored_workflow( trans, id, check_ownership=False )
- if stored.importable == False:
+ if stored.importable is False:
return trans.show_error_message( "The owner of this workflow has disabled imports via this link.<br>You can %s" % referer_message, use_panels=True )
elif stored.deleted:
return trans.show_error_message( "You can't import this workflow because it has been deleted.<br>You can %s" % referer_message, use_panels=True )
@@ -415,7 +421,7 @@
if 'annotation' in kwargs:
# Set workflow annotation; sanitize annotation before adding it.
annotation = sanitize_html( kwargs[ 'annotation' ], 'utf-8', 'text/html' )
- self.add_item_annotation( trans.sa_session, trans.get_user(), stored, annotation )
+ self.add_item_annotation( trans.sa_session, trans.get_user(), stored, annotation )
trans.sa_session.flush()
return trans.fill_template( 'workflow/edit_attributes.mako',
stored=stored,
@@ -511,7 +517,7 @@
""" Returns workflow's name and link. """
stored = self.get_stored_workflow( trans, id )
- return_dict = { "name" : stored.name, "link" : url_for(controller='workflow', action="display_by_username_and_slug", username=stored.user.username, slug=stored.slug ) }
+ return_dict = { "name": stored.name, "link": url_for(controller='workflow', action="display_by_username_and_slug", username=stored.user.username, slug=stored.slug ) }
return return_dict
@web.expose
@@ -583,8 +589,8 @@
return self.editor( trans, id=trans.security.encode_id(stored_workflow.id ))
else:
return form( url_for(controller="workflow", action="create"), "Create New Workflow", submit_text="Create", use_panels=True ) \
- .add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" ) \
- .add_text( "workflow_annotation", "Workflow Annotation", value="", help="A description of the workflow; annotation is shown alongside shared or published workflows." )
+ .add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" ) \
+ .add_text( "workflow_annotation", "Workflow Annotation", value="", help="A description of the workflow; annotation is shown alongside shared or published workflows." )
@web.expose
def delete( self, trans, id=None ):
@@ -665,7 +671,7 @@
module = module_factory.new( trans, type, **kwargs )
return {
'type': module.type,
- 'name': module.get_name(),
+ 'name': module.get_name(),
'tool_id': module.get_tool_id(),
'tool_state': module.get_state(),
'tooltip': module.get_tooltip( static_path=url_for( '/static' ) ),
@@ -750,9 +756,9 @@
'data_inputs': module.get_data_inputs(),
'data_outputs': module.get_data_outputs(),
'form_html': module.get_config_form(),
- 'annotation' : annotation_str,
- 'post_job_actions' : {},
- 'workflow_outputs' : []
+ 'annotation': annotation_str,
+ 'post_job_actions': {},
+ 'workflow_outputs': []
}
# Connections
input_connections = step.input_connections
@@ -838,8 +844,8 @@
errors.append("Step %s requires tool '%s'." % (step_dict['id'], step_dict['tool_id']))
if errors:
return dict( name=workflow.name,
- message="This workflow includes missing or invalid tools. It cannot be saved until the following steps are removed or the missing tools are enabled.",
- errors=errors)
+ message="This workflow includes missing or invalid tools. It cannot be saved until the following steps are removed or the missing tools are enabled.",
+ errors=errors )
# First pass to build step objects and populate basic values
for key, step_dict in data['steps'].iteritems():
# Create the model class for the step
@@ -932,18 +938,19 @@
workflow_content = json.dumps( workflow_dict, indent=4, sort_keys=True )
# Create myExperiment request.
- request_raw = trans.fill_template( "workflow/myexp_export.mako", \
- workflow_name=workflow_dict['name'], \
- workflow_description=workflow_dict['annotation'], \
- workflow_content=workflow_content, \
- workflow_svg=self._workflow_to_svg_canvas( trans, stored ).standalone_xml()
- )
+ request_raw = trans.fill_template(
+ "workflow/myexp_export.mako",
+ workflow_name=workflow_dict['name'],
+ workflow_description=workflow_dict['annotation'],
+ workflow_content=workflow_content,
+ workflow_svg=self._workflow_to_svg_canvas( trans, stored ).standalone_xml()
+ )
# strip() b/c myExperiment XML parser doesn't allow white space before XML; utf-8 handles unicode characters.
request = unicode( request_raw.strip(), 'utf-8' )
# Do request and get result.
auth_header = base64.b64encode( '%s:%s' % ( myexp_username, myexp_password ))
- headers = { "Content-type": "text/xml", "Accept": "text/xml", "Authorization" : "Basic %s" % auth_header }
+ headers = { "Content-type": "text/xml", "Accept": "text/xml", "Authorization": "Basic %s" % auth_header }
myexp_url = trans.app.config.get( "myexperiment_url", self.__myexp_url )
conn = httplib.HTTPConnection( myexp_url )
# NOTE: blocks web thread.
@@ -958,14 +965,14 @@
myexp_workflow_id = parser.tag_content
workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for( controller='workflow', action='list' )
if myexp_workflow_id:
- return trans.show_message( \
+ return trans.show_message(
"""Workflow '%s' successfully exported to myExperiment. <br/><a href="http://%s/workflows/%s">Click here to view the workflow on myExperiment</a> %s
""" % ( stored.name, myexp_url, myexp_workflow_id, workflow_list_str ),
use_panels=True )
else:
- return trans.show_error_message( \
- "Workflow '%s' could not be exported to myExperiment. Error: %s %s" % \
+ return trans.show_error_message(
+ "Workflow '%s' could not be exported to myExperiment. Error: %s %s" %
( stored.name, response_data, workflow_list_str ), use_panels=True )
@web.json_pretty
@@ -1205,10 +1212,10 @@
jobs, warnings = summarize( trans )
# Render
return trans.fill_template(
- "workflow/build_from_current_history.mako",
- jobs=jobs,
- warnings=warnings,
- history=history
+ "workflow/build_from_current_history.mako",
+ jobs=jobs,
+ warnings=warnings,
+ history=history
)
else:
stored_workflow = extract_workflow(
@@ -1223,7 +1230,7 @@
workflow_id = trans.security.encode_id( stored_workflow.id )
return trans.show_message( 'Workflow "%s" created from current history. You can <a href="%s" target="_parent">edit</a> or <a href="%s">run</a> the workflow.' %
( workflow_name, url_for( controller='workflow', action='editor', id=workflow_id ),
- url_for( controller='workflow', action='run', id=workflow_id ) ) )
+ url_for( controller='workflow', action='run', id=workflow_id ) ) )
@web.expose
def run( self, trans, id, history_id=None, hide_fixed_params=False, **kwargs ):
@@ -1350,8 +1357,8 @@
trans.sa_session.flush()
if invocations:
return trans.fill_template( "workflow/run_complete.mako",
- workflow=stored,
- invocations=invocations )
+ workflow=stored,
+ invocations=invocations )
else:
# Prepare each step
missing_tools = []
@@ -1388,24 +1395,27 @@
step.input_connections_by_name = dict( ( conn.input_name, conn ) for conn in step.input_connections )
if missing_tools:
stored.annotation = self.get_item_annotation_str( trans.sa_session, trans.user, stored )
- return trans.fill_template("workflow/run.mako",
- steps=[],
- workflow=stored,
- hide_fixed_params=hide_fixed_params,
- missing_tools=missing_tools)
+ return trans.fill_template(
+ "workflow/run.mako",
+ steps=[],
+ workflow=stored,
+ hide_fixed_params=hide_fixed_params,
+ missing_tools=missing_tools
+ )
# Render the form
stored.annotation = self.get_item_annotation_str( trans.sa_session, trans.user, stored )
return trans.fill_template(
- "workflow/run.mako",
- steps=workflow.steps,
- workflow=stored,
- has_upgrade_messages=has_upgrade_messages,
- step_version_changes=step_version_changes,
- errors=errors,
- incoming=kwargs,
- history_id=history_id,
- hide_fixed_params=hide_fixed_params,
- enable_unique_defaults=trans.app.config.enable_unique_workflow_defaults)
+ "workflow/run.mako",
+ steps=workflow.steps,
+ workflow=stored,
+ has_upgrade_messages=has_upgrade_messages,
+ step_version_changes=step_version_changes,
+ errors=errors,
+ incoming=kwargs,
+ history_id=history_id,
+ hide_fixed_params=hide_fixed_params,
+ enable_unique_defaults=trans.app.config.enable_unique_workflow_defaults
+ )
finally:
# restore the active history
if saved_history is not None:
@@ -1484,12 +1494,12 @@
step.input_connections_by_name = dict( ( conn.input_name, conn ) for conn in step.input_connections )
# Render the form
return trans.fill_template(
- "workflow/tag_outputs.mako",
- steps=workflow.steps,
- workflow=stored,
- has_upgrade_messages=has_upgrade_messages,
- errors=errors,
- incoming=kwargs
+ "workflow/tag_outputs.mako",
+ steps=workflow.steps,
+ workflow=stored,
+ has_upgrade_messages=has_upgrade_messages,
+ errors=errors,
+ incoming=kwargs
)
@web.expose
@@ -1539,7 +1549,7 @@
shared_by_others=shared_by_others,
ids_in_menu=ids_in_menu,
message=message,
- refresh_frames=['tools'] )
+ refresh_frames=refresh_frames )
def _workflow_to_svg_canvas( self, trans, stored ):
workflow = stored.latest_workflow
@@ -1619,17 +1629,17 @@
if len(step_dict['data_inputs']) > 0:
box_height += 15
sep_y = y + len(step_dict['data_inputs']) * line_px + 40
- text.append( svgfig.Line(x-margin, sep_y, x+width-margin, sep_y).SVG() ) #
+ text.append( svgfig.Line(x - margin, sep_y, x + width - margin, sep_y).SVG() )
# input/output box
- boxes.append( svgfig.Rect(x-margin, y+30, x+width-margin, y+30+box_height, fill="#ffffff").SVG() )
+ boxes.append( svgfig.Rect(x - margin, y + 30, x + width - margin, y + 30 + box_height, fill="#ffffff").SVG() )
for conn, output_dict in step_dict['input_connections'].iteritems():
in_coords = in_pos[step_dict['id']][conn]
out_conn_pos = out_pos[output_dict['id']][output_dict['output_name']]
adjusted = (out_conn_pos[0] + widths[output_dict['id']], out_conn_pos[1])
- text.append( svgfig.SVG("circle", cx=out_conn_pos[0]+widths[output_dict['id']]-margin, cy=out_conn_pos[1]-margin, r=5, fill="#ffffff" ) )
- connectors.append( svgfig.Line(adjusted[0], adjusted[1]-margin, in_coords[0]-10, in_coords[1], arrow_end="true" ).SVG() )
+ text.append( svgfig.SVG("circle", cx=out_conn_pos[0] + widths[output_dict['id']] - margin, cy=out_conn_pos[1] - margin, r=5, fill="#ffffff" ) )
+ connectors.append( svgfig.Line(adjusted[0], adjusted[1] - margin, in_coords[0] - 10, in_coords[1], arrow_end="true" ).SVG() )
canvas.append(connectors)
canvas.append(boxes)
@@ -1654,16 +1664,14 @@
def _expand_multiple_inputs(kwargs):
- (single_inputs, matched_multi_inputs, multiplied_multi_inputs) = \
- _split_inputs(kwargs)
+ (single_inputs, matched_multi_inputs, multiplied_multi_inputs) = _split_inputs(kwargs)
# Build up every combination of inputs to be run together.
input_combos = _extend_with_matched_combos(single_inputs, matched_multi_inputs)
input_combos = _extend_with_multiplied_combos(input_combos, multiplied_multi_inputs)
# Input name that are multiply specified
- multi_input_keys = \
- matched_multi_inputs.keys() + multiplied_multi_inputs.keys()
+ multi_input_keys = matched_multi_inputs.keys() + multiplied_multi_inputs.keys()
for input_combo in input_combos:
for key, value in input_combo.iteritems():
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: natefoo: Bug fix for display site changes.
by commits-noreply@bitbucket.org 07 Aug '14
by commits-noreply@bitbucket.org 07 Aug '14
07 Aug '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5f663734a26e/
Changeset: 5f663734a26e
User: natefoo
Date: 2014-08-07 17:35:20
Summary: Bug fix for display site changes.
Affected #: 3 files
diff -r 103697ebdd339377424063fba0459cb3cc2b707c -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py
+++ b/lib/galaxy/datatypes/genetics.py
@@ -85,7 +85,7 @@
if not dataset.dbkey:
dataset.dbkey = 'hg18' # punt!
if dataset.has_data():
- for site_name, site_url in app.build_sites.get_ucsc_by_build(dataset.dbkey):
+ for site_name, site_url in app.build_sites.get_ucsc_sites_by_build(dataset.dbkey):
if site_name in app.config.ucsc_display_sites:
site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
internal_url = "%s" % url_for( controller='dataset',
diff -r 103697ebdd339377424063fba0459cb3cc2b707c -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -234,7 +234,7 @@
# Filter UCSC sites to only those that are supported by this build and
# enabled.
valid_sites = [ ( name, url )
- for name, url in app.build_sites.get_ucsc_by_build( dataset.dbkey )
+ for name, url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey )
if name in app.config.ucsc_display_sites ]
if not valid_sites:
return []
@@ -750,7 +750,7 @@
ret_val = []
seqid, start, stop = self.get_estimated_display_viewport( dataset )
if seqid is not None:
- for site_name, site_url in app.build_sites.get_ucsc_by_build( dataset.dbkey ):
+ for site_name, site_url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey ):
if site_name in app.config.ucsc_display_sites:
redirect_url = urllib.quote_plus(
"%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" %
@@ -1103,7 +1103,7 @@
ret_val = []
chrom, start, stop = self.get_estimated_display_viewport( dataset )
if chrom is not None:
- for site_name, site_url in app.build_sites.get_ucsc_by_build( dataset.dbkey ):
+ for site_name, site_url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey ):
if site_name in app.config.ucsc_display_sites:
redirect_url = urllib.quote_plus( "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" % ( site_url, dataset.dbkey, chrom, start, stop ) )
link = self._get_remote_call_url( redirect_url, site_name, dataset, type, app, base_url )
@@ -1285,7 +1285,7 @@
ret_val = []
chrom, start, stop = self.get_estimated_display_viewport(dataset)
if chrom is not None:
- for site_name, site_url in app.build_sites.get_ucsc_by_build(dataset.dbkey):
+ for site_name, site_url in app.build_sites.get_ucsc_sites_by_build(dataset.dbkey):
if site_name in app.config.ucsc_display_sites:
internal_url = "%s" % url_for( controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name )
display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (base_url, url_for( controller='root' ), dataset.id, type) )
diff -r 103697ebdd339377424063fba0459cb3cc2b707c -r 5f663734a26e8e2d1c462320741c86c9b5d9aef6 lib/galaxy/util/build_sites.py
--- a/lib/galaxy/util/build_sites.py
+++ b/lib/galaxy/util/build_sites.py
@@ -38,7 +38,7 @@
self._build_sites['ucsc'] = self.read_build_sites( self._app.config.ucsc_build_sites )
self._build_sites['gbrowse'] = self.read_build_sites( self._app.config.gbrowse_build_sites )
- def get_site_by_build( self, site_type, build ):
+ def _get_site_by_build( self, site_type, build ):
sites = []
for site in self._build_sites[site_type]:
if build in site['builds']:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d7bf7ad5c578/
Changeset: d7bf7ad5c578
Branch: next-stable
User: jmchilton
Date: 2014-08-07 15:35:43
Summary: Bugfix: Deal with BibTeX fields in a case insensitive fashion.
Would have thought the parser would have done this already - oh well.
Affected #: 2 files
diff -r 3976f4d59bc0d7b65575e7573f13fb7470c9bf53 -r d7bf7ad5c578e7d27a4a94c559ef336b2eb3eab0 static/scripts/mvc/citation/citation-model.js
--- a/static/scripts/mvc/citation/citation-model.js
+++ b/static/scripts/mvc/citation/citation-model.js
@@ -18,12 +18,19 @@
var bibtex = this.attributes.content;
var entry = new BibtexParser(bibtex).entries[0];
this.entry = entry;
+ this._fields = {};
+ var rawFields = entry.Fields;
+ for(key in rawFields) {
+ var value = rawFields[ key ];
+ var lowerKey = key.toLowerCase();
+ this._fields[ lowerKey ] = value;
+ }
},
entryType: function() {
return this.entry.EntryType;
},
fields: function() {
- return this.entry.Fields;
+ return this._fields;
}
} );
diff -r 3976f4d59bc0d7b65575e7573f13fb7470c9bf53 -r d7bf7ad5c578e7d27a4a94c559ef336b2eb3eab0 static/scripts/mvc/citation/citation-view.js
--- a/static/scripts/mvc/citation/citation-view.js
+++ b/static/scripts/mvc/citation/citation-view.js
@@ -55,9 +55,9 @@
this._asSentence(fields.note);
}
var doiUrl = "";
- if( fields.DOI ) {
- doiUrl = 'http://dx.doi.org/' + fields.DOI;
- ref += '[<a href="' + doiUrl + '">doi:' + fields.DOI + "</a>]";
+ if( fields.doi ) {
+ doiUrl = 'http://dx.doi.org/' + fields.doi;
+ ref += '[<a href="' + doiUrl + '">doi:' + fields.doi + "</a>]";
}
var url = fields.url || doiUrl;
if( url ) {
https://bitbucket.org/galaxy/galaxy-central/commits/ee8efcfd787f/
Changeset: ee8efcfd787f
Branch: next-stable
User: jmchilton
Date: 2014-08-07 15:35:43
Summary: Relax BibTeX parsing and accept header to handle figshare DOIs.
For instance 10.6084/m9.figshare.979190 reported by Michael Crusoe. JavaScript parser didn't like @data entries produced by figshare and when requesting the entry dx.doi.org returns a 403 response for type accept type text/bibliography, also allowing application/x-bibtex fixes this. Interestingly dx.doi.org throws 500 exceptions if application/x-bibtex is the only acceptable type or appears first for some other DOIs.
Affected #: 2 files
diff -r d7bf7ad5c578e7d27a4a94c559ef336b2eb3eab0 -r ee8efcfd787f93c77eb4e451084d64ce4dc6b85e lib/galaxy/managers/citations.py
--- a/lib/galaxy/managers/citations.py
+++ b/lib/galaxy/managers/citations.py
@@ -49,7 +49,7 @@
def _raw_get_bibtex( self, doi ):
dx_url = "http://dx.doi.org/" + doi
- headers = {'Accept': "text/bibliography; style=bibtex" }
+ headers = {'Accept': 'text/bibliography; style=bibtex, application/x-bibtex'}
req = urllib2.Request(dx_url, data="", headers=headers)
response = urllib2.urlopen(req)
bibtex = response.read()
diff -r d7bf7ad5c578e7d27a4a94c559ef336b2eb3eab0 -r ee8efcfd787f93c77eb4e451084d64ce4dc6b85e static/scripts/libs/bibtex.js
--- a/static/scripts/libs/bibtex.js
+++ b/static/scripts/libs/bibtex.js
@@ -93,6 +93,7 @@
'booklet' : 14,
'masterthesis' : 15,
'conference' : 16
+ ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.
}
/** @private */ this.MACROS_ = {
'jan' : 'January',
https://bitbucket.org/galaxy/galaxy-central/commits/990bc0688199/
Changeset: 990bc0688199
Branch: next-stable
User: jmchilton
Date: 2014-08-07 15:36:18
Summary: Pack scripts.
Affected #: 3 files
diff -r ee8efcfd787f93c77eb4e451084d64ce4dc6b85e -r 990bc0688199410ab08d5e8a418770b516c6f4e2 static/scripts/packed/libs/bibtex.js
--- a/static/scripts/packed/libs/bibtex.js
+++ b/static/scripts/packed/libs/bibtex.js
@@ -1,1 +1,1 @@
-function BibtexParser(c){if(typeof c=="string"){var d={};var a=[];function b(f){a.push(f)}var e=BibtexParser.call(d,b);e.parse(c);return{entries:a,errors:e.getErrors()}}if(typeof c!="function"){throw"Invalid parser construction."}this.STATES_={ENTRY_OR_JUNK:0,OBJECT_TYPE:1,ENTRY_KEY:2,KV_KEY:3,EQUALS:4,KV_VALUE:5};this.DATA_={};this.CALLBACK_=c;this.CHAR_=0;this.LINE_=1;this.CHAR_IN_LINE_=0;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={};this.SKIPTILLEOL_=false;this.VALBRACES_=null;this.BRACETYPE_=null;this.BRACECOUNT_=0;this.STATE_=this.STATES_.ENTRY_OR_JUNK;this.ERRORS_=[];this.ENTRY_TYPES_={inproceedings:1,proceedings:2,article:3,techreport:4,misc:5,mastersthesis:6,book:7,phdthesis:8,incollection:9,unpublished:10,inbook:11,manual:12,periodical:13,booklet:14,masterthesis:15,conference:16};this.MACROS_={jan:"January",feb:"February",mar:"March",apr:"April",may:"May",jun:"June",jul:"July",aug:"August",sep:"September",oct:"October",nov:"November",dec:"December",Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"};this.getErrors=function(){return this.ERRORS_};this.parse=function(f){for(var g=0;g<f.length;g++){this.processCharacter_(f[g])}};this.error_=function(f){this.ERRORS_.push([this.LINE_,this.CHAR_IN_LINE_,this.CHAR_,f])};this.processEntry_=function(){var h=this.DATA_;if(h.Fields){for(var k in h.Fields){var p=h.Fields[k];for(var j=0;j<this.CHARCONV_.length;j++){var q=this.CHARCONV_[j][0];var n=this.CHARCONV_[j][1];p=p.replace(q,n)}p=p.replace(/[\n\r\t]/g," ").replace(/\s\s+/g," ").replace(/^\s+|\s+$/g,"");var l=p.length;var g="";for(var j=0;j<l;j++){var m=p[j];var o=false;if(m=="\\"&&j<l-1){m=p[++j]}else{if(m=="{"||m=="}"){o=true}}if(!o){g+=m}}h.Fields[k]=g}}if(h.ObjectType=="string"){for(var k in h.Fields){this.MACROS_[k]=h.Fields[k]}}else{this.CALLBACK_(h)}};this.processCharacter_=function(l){this.CHAR_++;this.CHAR_IN_LINE_++;if(l=="\n"){this.LINE_++;this.CHAR_IN_LINE_=1}if(this.SKIPTILLEOL_){if(l=="\n"){this.SKIPTILLEOL_=false}return}if(this.SKIPCOMMENT_&&l=="%"){this.SKIPTILLEOL_=true;return}if(this.SKIPWS_&&/\s/.test(l)){return}this.SKIPWS_=false;this.SKIPCOMMENT_=false;this.SKIPTILLEOL_=false;var f=true;while(f){f=false;switch(this.STATE_){case this.STATES_.ENTRY_OR_JUNK:if(l=="@"){this.STATE_=this.STATES_.OBJECT_TYPE;this.DATA_={ObjectType:""}}this.BRACETYPE_=null;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break;case this.STATES_.OBJECT_TYPE:if(/[A-Za-z]/.test(l)){this.DATA_.ObjectType+=l.toLowerCase();this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{var i=this.DATA_.ObjectType;if(i=="comment"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i=="string"){this.DATA_.ObjectType=i;this.DATA_.Fields={};this.BRACETYPE_=l;this.BRACECOUNT_=1;this.STATE_=this.STATES_.KV_KEY;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={Key:""}}else{if(i=="preamble"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i in this.ENTRY_TYPES_){this.DATA_.ObjectType="entry";this.DATA_.EntryType=i;this.DATA_.EntryKey="";this.STATE_=this.STATES_.ENTRY_KEY;f=true}else{this.error_('Unrecognized object type: "'+this.DATA_.ObjectType+'"');this.STATE_=this.STATES_.ENTRY_OR_JUNK}}}}}break;case this.STATES_.ENTRY_KEY:if((l==="{"||l==="(")&&this.BRACETYPE_==null){this.BRACETYPE_=l;this.BRACECOUNT_=1;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break}if(/[,%\s]/.test(l)){if(this.DATA_.EntryKey.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{if(this.BRACETYPE_==null){this.error_("No opening brace for object.");this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;f=true;this.STATE_=this.STATES_.KV_KEY;this.PARSETMP_.Key="";this.DATA_.Fields={}}}}else{this.DATA_.EntryKey+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}break;case this.STATES_.KV_KEY:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(/[\-A-Za-z:]/.test(l)){this.PARSETMP_.Key+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{if(this.PARSETMP_.Key.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.EQUALS;f=true}}break;case this.STATES_.EQUALS:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.error_('Key-value pair has key "'+this.PARSETMP_.Key+'", but no value.');this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(l=="="){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_VALUE;this.PARSETMP_.Value="";this.VALBRACES_={'"':[],"{":[]}}break;case this.STATES_.KV_VALUE:var k=this.VALBRACES_;var j=this.PARSETMP_.Value;var h=false;if(l=='"'||l=="{"||l=="}"||l==","){if(l==","){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}h=true}}if(l=='"'){if(0===k['"'].length+k["{"].length){k['"'].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false;break}if(k['"'].length==1&&k["{"].length==0&&(j.length==0||j[j.length-1]!="\\")){h=true}else{}}if(l=="{"){if(j.length==0||j[j.length-1]!="\\"){k["{"].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{}}if(l=="}"){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}f=true;h=true}else{if(j.length==0||j[j.length-1]!="\\"){if(k["{"].length>0){k["{"].splice(k["{"].length-1,1);if(0==k["{"].length+k['"'].length){h=true}else{}}}else{}}}}if(h){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_KEY;this.DATA_.Fields[this.PARSETMP_.Key]=this.PARSETMP_.Value;this.PARSETMP_={Key:""};this.VALBRACES_=null}else{this.PARSETMP_.Value+=l}break}}};this.CHARCONV_=[[/\\space /g,"\u0020"],[/\\textdollar /g,"\u0024"],[/\\textquotesingle /g,"\u0027"],[/\\ast /g,"\u002A"],[/\\textbackslash /g,"\u005C"],[/\\\^\{\}/g,"\u005E"],[/\\textasciigrave /g,"\u0060"],[/\\lbrace /g,"\u007B"],[/\\vert /g,"\u007C"],[/\\rbrace /g,"\u007D"],[/\\textasciitilde /g,"\u007E"],[/\\textexclamdown /g,"\u00A1"],[/\\textcent /g,"\u00A2"],[/\\textsterling /g,"\u00A3"],[/\\textcurrency /g,"\u00A4"],[/\\textyen /g,"\u00A5"],[/\\textbrokenbar /g,"\u00A6"],[/\\textsection /g,"\u00A7"],[/\\textasciidieresis /g,"\u00A8"],[/\\textcopyright /g,"\u00A9"],[/\\textordfeminine /g,"\u00AA"],[/\\guillemotleft /g,"\u00AB"],[/\\lnot /g,"\u00AC"],[/\\textregistered /g,"\u00AE"],[/\\textasciimacron /g,"\u00AF"],[/\\textdegree /g,"\u00B0"],[/\\pm /g,"\u00B1"],[/\\textasciiacute /g,"\u00B4"],[/\\mathrm\{\\mu\}/g,"\u00B5"],[/\\textparagraph /g,"\u00B6"],[/\\cdot /g,"\u00B7"],[/\\c\{\}/g,"\u00B8"],[/\\textordmasculine /g,"\u00BA"],[/\\guillemotright /g,"\u00BB"],[/\\textonequarter /g,"\u00BC"],[/\\textonehalf /g,"\u00BD"],[/\\textthreequarters /g,"\u00BE"],[/\\textquestiondown /g,"\u00BF"],[/\\`\{A\}/g,"\u00C0"],[/\\'\{A\}/g,"\u00C1"],[/\\\^\{A\}/g,"\u00C2"],[/\\~\{A\}/g,"\u00C3"],[/\\"\{A\}/g,"\u00C4"],[/\\AA /g,"\u00C5"],[/\\AE /g,"\u00C6"],[/\\c\{C\}/g,"\u00C7"],[/\\`\{E\}/g,"\u00C8"],[/\\'\{E\}/g,"\u00C9"],[/\\\^\{E\}/g,"\u00CA"],[/\\"\{E\}/g,"\u00CB"],[/\\`\{I\}/g,"\u00CC"],[/\\'\{I\}/g,"\u00CD"],[/\\\^\{I\}/g,"\u00CE"],[/\\"\{I\}/g,"\u00CF"],[/\\DH /g,"\u00D0"],[/\\~\{N\}/g,"\u00D1"],[/\\`\{O\}/g,"\u00D2"],[/\\'\{O\}/g,"\u00D3"],[/\\\^\{O\}/g,"\u00D4"],[/\\~\{O\}/g,"\u00D5"],[/\\"\{O\}/g,"\u00D6"],[/\\texttimes /g,"\u00D7"],[/\\O /g,"\u00D8"],[/\\`\{U\}/g,"\u00D9"],[/\\'\{U\}/g,"\u00DA"],[/\\\^\{U\}/g,"\u00DB"],[/\\"\{U\}/g,"\u00DC"],[/\\'\{Y\}/g,"\u00DD"],[/\\TH /g,"\u00DE"],[/\\ss /g,"\u00DF"],[/\\`\{a\}/g,"\u00E0"],[/\\'\{a\}/g,"\u00E1"],[/\\\^\{a\}/g,"\u00E2"],[/\\~\{a\}/g,"\u00E3"],[/\\"\{a\}/g,"\u00E4"],[/\\aa /g,"\u00E5"],[/\\ae /g,"\u00E6"],[/\\c\{c\}/g,"\u00E7"],[/\\`\{e\}/g,"\u00E8"],[/\\'\{e\}/g,"\u00E9"],[/\\\^\{e\}/g,"\u00EA"],[/\\"\{e\}/g,"\u00EB"],[/\\`\{\\i\}/g,"\u00EC"],[/\\'\{\\i\}/g,"\u00ED"],[/\\\^\{\\i\}/g,"\u00EE"],[/\\"\{\\i\}/g,"\u00EF"],[/\\dh /g,"\u00F0"],[/\\~\{n\}/g,"\u00F1"],[/\\`\{o\}/g,"\u00F2"],[/\\'\{o\}/g,"\u00F3"],[/\\\^\{o\}/g,"\u00F4"],[/\\~\{o\}/g,"\u00F5"],[/\\"\{o\}/g,"\u00F6"],[/\\div /g,"\u00F7"],[/\\o /g,"\u00F8"],[/\\`\{u\}/g,"\u00F9"],[/\\'\{u\}/g,"\u00FA"],[/\\\^\{u\}/g,"\u00FB"],[/\\"\{u\}/g,"\u00FC"],[/\\'\{y\}/g,"\u00FD"],[/\\th /g,"\u00FE"],[/\\"\{y\}/g,"\u00FF"],[/\\=\{A\}/g,"\u0100"],[/\\=\{a\}/g,"\u0101"],[/\\u\{A\}/g,"\u0102"],[/\\u\{a\}/g,"\u0103"],[/\\k\{A\}/g,"\u0104"],[/\\k\{a\}/g,"\u0105"],[/\\'\{C\}/g,"\u0106"],[/\\'\{c\}/g,"\u0107"],[/\\\^\{C\}/g,"\u0108"],[/\\\^\{c\}/g,"\u0109"],[/\\.\{C\}/g,"\u010A"],[/\\.\{c\}/g,"\u010B"],[/\\v\{C\}/g,"\u010C"],[/\\v\{c\}/g,"\u010D"],[/\\v\{D\}/g,"\u010E"],[/\\v\{d\}/g,"\u010F"],[/\\DJ /g,"\u0110"],[/\\dj /g,"\u0111"],[/\\=\{E\}/g,"\u0112"],[/\\=\{e\}/g,"\u0113"],[/\\u\{E\}/g,"\u0114"],[/\\u\{e\}/g,"\u0115"],[/\\.\{E\}/g,"\u0116"],[/\\.\{e\}/g,"\u0117"],[/\\k\{E\}/g,"\u0118"],[/\\k\{e\}/g,"\u0119"],[/\\v\{E\}/g,"\u011A"],[/\\v\{e\}/g,"\u011B"],[/\\\^\{G\}/g,"\u011C"],[/\\\^\{g\}/g,"\u011D"],[/\\u\{G\}/g,"\u011E"],[/\\u\{g\}/g,"\u011F"],[/\\.\{G\}/g,"\u0120"],[/\\.\{g\}/g,"\u0121"],[/\\c\{G\}/g,"\u0122"],[/\\c\{g\}/g,"\u0123"],[/\\\^\{H\}/g,"\u0124"],[/\\\^\{h\}/g,"\u0125"],[/\\Elzxh /g,"\u0127"],[/\\~\{I\}/g,"\u0128"],[/\\~\{\\i\}/g,"\u0129"],[/\\=\{I\}/g,"\u012A"],[/\\=\{\\i\}/g,"\u012B"],[/\\u\{I\}/g,"\u012C"],[/\\u\{\\i\}/g,"\u012D"],[/\\k\{I\}/g,"\u012E"],[/\\k\{i\}/g,"\u012F"],[/\\.\{I\}/g,"\u0130"],[/\\i /g,"\u0131"],[/\\\^\{J\}/g,"\u0134"],[/\\\^\{\\j\}/g,"\u0135"],[/\\c\{K\}/g,"\u0136"],[/\\c\{k\}/g,"\u0137"],[/\\'\{L\}/g,"\u0139"],[/\\'\{l\}/g,"\u013A"],[/\\c\{L\}/g,"\u013B"],[/\\c\{l\}/g,"\u013C"],[/\\v\{L\}/g,"\u013D"],[/\\v\{l\}/g,"\u013E"],[/\\L /g,"\u0141"],[/\\l /g,"\u0142"],[/\\'\{N\}/g,"\u0143"],[/\\'\{n\}/g,"\u0144"],[/\\c\{N\}/g,"\u0145"],[/\\c\{n\}/g,"\u0146"],[/\\v\{N\}/g,"\u0147"],[/\\v\{n\}/g,"\u0148"],[/\\NG /g,"\u014A"],[/\\ng /g,"\u014B"],[/\\=\{O\}/g,"\u014C"],[/\\=\{o\}/g,"\u014D"],[/\\u\{O\}/g,"\u014E"],[/\\u\{o\}/g,"\u014F"],[/\\H\{O\}/g,"\u0150"],[/\\H\{o\}/g,"\u0151"],[/\\OE /g,"\u0152"],[/\\oe /g,"\u0153"],[/\\'\{R\}/g,"\u0154"],[/\\'\{r\}/g,"\u0155"],[/\\c\{R\}/g,"\u0156"],[/\\c\{r\}/g,"\u0157"],[/\\v\{R\}/g,"\u0158"],[/\\v\{r\}/g,"\u0159"],[/\\'\{S\}/g,"\u015A"],[/\\'\{s\}/g,"\u015B"],[/\\\^\{S\}/g,"\u015C"],[/\\\^\{s\}/g,"\u015D"],[/\\c\{S\}/g,"\u015E"],[/\\c\{s\}/g,"\u015F"],[/\\v\{S\}/g,"\u0160"],[/\\v\{s\}/g,"\u0161"],[/\\c\{T\}/g,"\u0162"],[/\\c\{t\}/g,"\u0163"],[/\\v\{T\}/g,"\u0164"],[/\\v\{t\}/g,"\u0165"],[/\\~\{U\}/g,"\u0168"],[/\\~\{u\}/g,"\u0169"],[/\\=\{U\}/g,"\u016A"],[/\\=\{u\}/g,"\u016B"],[/\\u\{U\}/g,"\u016C"],[/\\u\{u\}/g,"\u016D"],[/\\r\{U\}/g,"\u016E"],[/\\r\{u\}/g,"\u016F"],[/\\H\{U\}/g,"\u0170"],[/\\H\{u\}/g,"\u0171"],[/\\k\{U\}/g,"\u0172"],[/\\k\{u\}/g,"\u0173"],[/\\\^\{W\}/g,"\u0174"],[/\\\^\{w\}/g,"\u0175"],[/\\\^\{Y\}/g,"\u0176"],[/\\\^\{y\}/g,"\u0177"],[/\\"\{Y\}/g,"\u0178"],[/\\'\{Z\}/g,"\u0179"],[/\\'\{z\}/g,"\u017A"],[/\\.\{Z\}/g,"\u017B"],[/\\.\{z\}/g,"\u017C"],[/\\v\{Z\}/g,"\u017D"],[/\\v\{z\}/g,"\u017E"],[/\\texthvlig /g,"\u0195"],[/\\textnrleg /g,"\u019E"],[/\\eth /g,"\u01AA"],[/\\textdoublepipe /g,"\u01C2"],[/\\'\{g\}/g,"\u01F5"],[/\\Elztrna /g,"\u0250"],[/\\Elztrnsa /g,"\u0252"],[/\\Elzopeno /g,"\u0254"],[/\\Elzrtld /g,"\u0256"],[/\\Elzschwa /g,"\u0259"],[/\\varepsilon /g,"\u025B"],[/\\Elzpgamma /g,"\u0263"],[/\\Elzpbgam /g,"\u0264"],[/\\Elztrnh /g,"\u0265"],[/\\Elzbtdl /g,"\u026C"],[/\\Elzrtll /g,"\u026D"],[/\\Elztrnm /g,"\u026F"],[/\\Elztrnmlr /g,"\u0270"],[/\\Elzltlmr /g,"\u0271"],[/\\Elzltln /g,"\u0272"],[/\\Elzrtln /g,"\u0273"],[/\\Elzclomeg /g,"\u0277"],[/\\textphi /g,"\u0278"],[/\\Elztrnr /g,"\u0279"],[/\\Elztrnrl /g,"\u027A"],[/\\Elzrttrnr /g,"\u027B"],[/\\Elzrl /g,"\u027C"],[/\\Elzrtlr /g,"\u027D"],[/\\Elzfhr /g,"\u027E"],[/\\Elzrtls /g,"\u0282"],[/\\Elzesh /g,"\u0283"],[/\\Elztrnt /g,"\u0287"],[/\\Elzrtlt /g,"\u0288"],[/\\Elzpupsil /g,"\u028A"],[/\\Elzpscrv /g,"\u028B"],[/\\Elzinvv /g,"\u028C"],[/\\Elzinvw /g,"\u028D"],[/\\Elztrny /g,"\u028E"],[/\\Elzrtlz /g,"\u0290"],[/\\Elzyogh /g,"\u0292"],[/\\Elzglst /g,"\u0294"],[/\\Elzreglst /g,"\u0295"],[/\\Elzinglst /g,"\u0296"],[/\\textturnk /g,"\u029E"],[/\\Elzdyogh /g,"\u02A4"],[/\\Elztesh /g,"\u02A7"],[/\\textasciicaron /g,"\u02C7"],[/\\Elzverts /g,"\u02C8"],[/\\Elzverti /g,"\u02CC"],[/\\Elzlmrk /g,"\u02D0"],[/\\Elzhlmrk /g,"\u02D1"],[/\\Elzsbrhr /g,"\u02D2"],[/\\Elzsblhr /g,"\u02D3"],[/\\Elzrais /g,"\u02D4"],[/\\Elzlow /g,"\u02D5"],[/\\textasciibreve /g,"\u02D8"],[/\\textperiodcentered /g,"\u02D9"],[/\\r\{\}/g,"\u02DA"],[/\\k\{\}/g,"\u02DB"],[/\\texttildelow /g,"\u02DC"],[/\\H\{\}/g,"\u02DD"],[/\\tone\{55\}/g,"\u02E5"],[/\\tone\{44\}/g,"\u02E6"],[/\\tone\{33\}/g,"\u02E7"],[/\\tone\{22\}/g,"\u02E8"],[/\\tone\{11\}/g,"\u02E9"],[/\\cyrchar\\C/g,"\u030F"],[/\\Elzpalh /g,"\u0321"],[/\\Elzrh /g,"\u0322"],[/\\Elzsbbrg /g,"\u032A"],[/\\Elzxl /g,"\u0335"],[/\\Elzbar /g,"\u0336"],[/\\'\{A\}/g,"\u0386"],[/\\'\{E\}/g,"\u0388"],[/\\'\{H\}/g,"\u0389"],[/\\'\{\}\{I\}/g,"\u038A"],[/\\'\{\}O/g,"\u038C"],[/\\mathrm\{'Y\}/g,"\u038E"],[/\\mathrm\{'\\Omega\}/g,"\u038F"],[/\\acute\{\\ddot\{\\iota\}\}/g,"\u0390"],[/\\Alpha /g,"\u0391"],[/\\Beta /g,"\u0392"],[/\\Gamma /g,"\u0393"],[/\\Delta /g,"\u0394"],[/\\Epsilon /g,"\u0395"],[/\\Zeta /g,"\u0396"],[/\\Eta /g,"\u0397"],[/\\Theta /g,"\u0398"],[/\\Iota /g,"\u0399"],[/\\Kappa /g,"\u039A"],[/\\Lambda /g,"\u039B"],[/\\Xi /g,"\u039E"],[/\\Pi /g,"\u03A0"],[/\\Rho /g,"\u03A1"],[/\\Sigma /g,"\u03A3"],[/\\Tau /g,"\u03A4"],[/\\Upsilon /g,"\u03A5"],[/\\Phi /g,"\u03A6"],[/\\Chi /g,"\u03A7"],[/\\Psi /g,"\u03A8"],[/\\Omega /g,"\u03A9"],[/\\mathrm\{\\ddot\{I\}\}/g,"\u03AA"],[/\\mathrm\{\\ddot\{Y\}\}/g,"\u03AB"],[/\\'\{\$\\alpha\$\}/g,"\u03AC"],[/\\acute\{\\epsilon\}/g,"\u03AD"],[/\\acute\{\\eta\}/g,"\u03AE"],[/\\acute\{\\iota\}/g,"\u03AF"],[/\\acute\{\\ddot\{\\upsilon\}\}/g,"\u03B0"],[/\\alpha /g,"\u03B1"],[/\\beta /g,"\u03B2"],[/\\gamma /g,"\u03B3"],[/\\delta /g,"\u03B4"],[/\\epsilon /g,"\u03B5"],[/\\zeta /g,"\u03B6"],[/\\eta /g,"\u03B7"],[/\\texttheta /g,"\u03B8"],[/\\iota /g,"\u03B9"],[/\\kappa /g,"\u03BA"],[/\\lambda /g,"\u03BB"],[/\\mu /g,"\u03BC"],[/\\nu /g,"\u03BD"],[/\\xi /g,"\u03BE"],[/\\pi /g,"\u03C0"],[/\\rho /g,"\u03C1"],[/\\varsigma /g,"\u03C2"],[/\\sigma /g,"\u03C3"],[/\\tau /g,"\u03C4"],[/\\upsilon /g,"\u03C5"],[/\\varphi /g,"\u03C6"],[/\\chi /g,"\u03C7"],[/\\psi /g,"\u03C8"],[/\\omega /g,"\u03C9"],[/\\ddot\{\\iota\}/g,"\u03CA"],[/\\ddot\{\\upsilon\}/g,"\u03CB"],[/\\'\{o\}/g,"\u03CC"],[/\\acute\{\\upsilon\}/g,"\u03CD"],[/\\acute\{\\omega\}/g,"\u03CE"],[/\\Pisymbol\{ppi022\}\{87\}/g,"\u03D0"],[/\\textvartheta /g,"\u03D1"],[/\\Upsilon /g,"\u03D2"],[/\\phi /g,"\u03D5"],[/\\varpi /g,"\u03D6"],[/\\Stigma /g,"\u03DA"],[/\\Digamma /g,"\u03DC"],[/\\digamma /g,"\u03DD"],[/\\Koppa /g,"\u03DE"],[/\\Sampi /g,"\u03E0"],[/\\varkappa /g,"\u03F0"],[/\\varrho /g,"\u03F1"],[/\\textTheta /g,"\u03F4"],[/\\backepsilon /g,"\u03F6"],[/\\cyrchar\\CYRYO /g,"\u0401"],[/\\cyrchar\\CYRDJE /g,"\u0402"],[/\\cyrchar\{\\'\\CYRG\}/g,"\u0403"],[/\\cyrchar\\CYRIE /g,"\u0404"],[/\\cyrchar\\CYRDZE /g,"\u0405"],[/\\cyrchar\\CYRII /g,"\u0406"],[/\\cyrchar\\CYRYI /g,"\u0407"],[/\\cyrchar\\CYRJE /g,"\u0408"],[/\\cyrchar\\CYRLJE /g,"\u0409"],[/\\cyrchar\\CYRNJE /g,"\u040A"],[/\\cyrchar\\CYRTSHE /g,"\u040B"],[/\\cyrchar\{\\'\\CYRK\}/g,"\u040C"],[/\\cyrchar\\CYRUSHRT /g,"\u040E"],[/\\cyrchar\\CYRDZHE /g,"\u040F"],[/\\cyrchar\\CYRA /g,"\u0410"],[/\\cyrchar\\CYRB /g,"\u0411"],[/\\cyrchar\\CYRV /g,"\u0412"],[/\\cyrchar\\CYRG /g,"\u0413"],[/\\cyrchar\\CYRD /g,"\u0414"],[/\\cyrchar\\CYRE /g,"\u0415"],[/\\cyrchar\\CYRZH /g,"\u0416"],[/\\cyrchar\\CYRZ /g,"\u0417"],[/\\cyrchar\\CYRI /g,"\u0418"],[/\\cyrchar\\CYRISHRT /g,"\u0419"],[/\\cyrchar\\CYRK /g,"\u041A"],[/\\cyrchar\\CYRL /g,"\u041B"],[/\\cyrchar\\CYRM /g,"\u041C"],[/\\cyrchar\\CYRN /g,"\u041D"],[/\\cyrchar\\CYRO /g,"\u041E"],[/\\cyrchar\\CYRP /g,"\u041F"],[/\\cyrchar\\CYRR /g,"\u0420"],[/\\cyrchar\\CYRS /g,"\u0421"],[/\\cyrchar\\CYRT /g,"\u0422"],[/\\cyrchar\\CYRU /g,"\u0423"],[/\\cyrchar\\CYRF /g,"\u0424"],[/\\cyrchar\\CYRH /g,"\u0425"],[/\\cyrchar\\CYRC /g,"\u0426"],[/\\cyrchar\\CYRCH /g,"\u0427"],[/\\cyrchar\\CYRSH /g,"\u0428"],[/\\cyrchar\\CYRSHCH /g,"\u0429"],[/\\cyrchar\\CYRHRDSN /g,"\u042A"],[/\\cyrchar\\CYRERY /g,"\u042B"],[/\\cyrchar\\CYRSFTSN /g,"\u042C"],[/\\cyrchar\\CYREREV /g,"\u042D"],[/\\cyrchar\\CYRYU /g,"\u042E"],[/\\cyrchar\\CYRYA /g,"\u042F"],[/\\cyrchar\\cyra /g,"\u0430"],[/\\cyrchar\\cyrb /g,"\u0431"],[/\\cyrchar\\cyrv /g,"\u0432"],[/\\cyrchar\\cyrg /g,"\u0433"],[/\\cyrchar\\cyrd /g,"\u0434"],[/\\cyrchar\\cyre /g,"\u0435"],[/\\cyrchar\\cyrzh /g,"\u0436"],[/\\cyrchar\\cyrz /g,"\u0437"],[/\\cyrchar\\cyri /g,"\u0438"],[/\\cyrchar\\cyrishrt /g,"\u0439"],[/\\cyrchar\\cyrk /g,"\u043A"],[/\\cyrchar\\cyrl /g,"\u043B"],[/\\cyrchar\\cyrm /g,"\u043C"],[/\\cyrchar\\cyrn /g,"\u043D"],[/\\cyrchar\\cyro /g,"\u043E"],[/\\cyrchar\\cyrp /g,"\u043F"],[/\\cyrchar\\cyrr /g,"\u0440"],[/\\cyrchar\\cyrs /g,"\u0441"],[/\\cyrchar\\cyrt /g,"\u0442"],[/\\cyrchar\\cyru /g,"\u0443"],[/\\cyrchar\\cyrf /g,"\u0444"],[/\\cyrchar\\cyrh /g,"\u0445"],[/\\cyrchar\\cyrc /g,"\u0446"],[/\\cyrchar\\cyrch /g,"\u0447"],[/\\cyrchar\\cyrsh /g,"\u0448"],[/\\cyrchar\\cyrshch /g,"\u0449"],[/\\cyrchar\\cyrhrdsn /g,"\u044A"],[/\\cyrchar\\cyrery /g,"\u044B"],[/\\cyrchar\\cyrsftsn /g,"\u044C"],[/\\cyrchar\\cyrerev /g,"\u044D"],[/\\cyrchar\\cyryu /g,"\u044E"],[/\\cyrchar\\cyrya /g,"\u044F"],[/\\cyrchar\\cyryo /g,"\u0451"],[/\\cyrchar\\cyrdje /g,"\u0452"],[/\\cyrchar\{\\'\\cyrg\}/g,"\u0453"],[/\\cyrchar\\cyrie /g,"\u0454"],[/\\cyrchar\\cyrdze /g,"\u0455"],[/\\cyrchar\\cyrii /g,"\u0456"],[/\\cyrchar\\cyryi /g,"\u0457"],[/\\cyrchar\\cyrje /g,"\u0458"],[/\\cyrchar\\cyrlje /g,"\u0459"],[/\\cyrchar\\cyrnje /g,"\u045A"],[/\\cyrchar\\cyrtshe /g,"\u045B"],[/\\cyrchar\{\\'\\cyrk\}/g,"\u045C"],[/\\cyrchar\\cyrushrt /g,"\u045E"],[/\\cyrchar\\cyrdzhe /g,"\u045F"],[/\\cyrchar\\CYROMEGA /g,"\u0460"],[/\\cyrchar\\cyromega /g,"\u0461"],[/\\cyrchar\\CYRYAT /g,"\u0462"],[/\\cyrchar\\CYRIOTE /g,"\u0464"],[/\\cyrchar\\cyriote /g,"\u0465"],[/\\cyrchar\\CYRLYUS /g,"\u0466"],[/\\cyrchar\\cyrlyus /g,"\u0467"],[/\\cyrchar\\CYRIOTLYUS /g,"\u0468"],[/\\cyrchar\\cyriotlyus /g,"\u0469"],[/\\cyrchar\\CYRBYUS /g,"\u046A"],[/\\cyrchar\\CYRIOTBYUS /g,"\u046C"],[/\\cyrchar\\cyriotbyus /g,"\u046D"],[/\\cyrchar\\CYRKSI /g,"\u046E"],[/\\cyrchar\\cyrksi /g,"\u046F"],[/\\cyrchar\\CYRPSI /g,"\u0470"],[/\\cyrchar\\cyrpsi /g,"\u0471"],[/\\cyrchar\\CYRFITA /g,"\u0472"],[/\\cyrchar\\CYRIZH /g,"\u0474"],[/\\cyrchar\\CYRUK /g,"\u0478"],[/\\cyrchar\\cyruk /g,"\u0479"],[/\\cyrchar\\CYROMEGARND /g,"\u047A"],[/\\cyrchar\\cyromegarnd /g,"\u047B"],[/\\cyrchar\\CYROMEGATITLO /g,"\u047C"],[/\\cyrchar\\cyromegatitlo /g,"\u047D"],[/\\cyrchar\\CYROT /g,"\u047E"],[/\\cyrchar\\cyrot /g,"\u047F"],[/\\cyrchar\\CYRKOPPA /g,"\u0480"],[/\\cyrchar\\cyrkoppa /g,"\u0481"],[/\\cyrchar\\cyrthousands /g,"\u0482"],[/\\cyrchar\\cyrhundredthousands /g,"\u0488"],[/\\cyrchar\\cyrmillions /g,"\u0489"],[/\\cyrchar\\CYRSEMISFTSN /g,"\u048C"],[/\\cyrchar\\cyrsemisftsn /g,"\u048D"],[/\\cyrchar\\CYRRTICK /g,"\u048E"],[/\\cyrchar\\cyrrtick /g,"\u048F"],[/\\cyrchar\\CYRGUP /g,"\u0490"],[/\\cyrchar\\cyrgup /g,"\u0491"],[/\\cyrchar\\CYRGHCRS /g,"\u0492"],[/\\cyrchar\\cyrghcrs /g,"\u0493"],[/\\cyrchar\\CYRGHK /g,"\u0494"],[/\\cyrchar\\cyrghk /g,"\u0495"],[/\\cyrchar\\CYRZHDSC /g,"\u0496"],[/\\cyrchar\\cyrzhdsc /g,"\u0497"],[/\\cyrchar\\CYRZDSC /g,"\u0498"],[/\\cyrchar\\cyrzdsc /g,"\u0499"],[/\\cyrchar\\CYRKDSC /g,"\u049A"],[/\\cyrchar\\cyrkdsc /g,"\u049B"],[/\\cyrchar\\CYRKVCRS /g,"\u049C"],[/\\cyrchar\\cyrkvcrs /g,"\u049D"],[/\\cyrchar\\CYRKHCRS /g,"\u049E"],[/\\cyrchar\\cyrkhcrs /g,"\u049F"],[/\\cyrchar\\CYRKBEAK /g,"\u04A0"],[/\\cyrchar\\cyrkbeak /g,"\u04A1"],[/\\cyrchar\\CYRNDSC /g,"\u04A2"],[/\\cyrchar\\cyrndsc /g,"\u04A3"],[/\\cyrchar\\CYRNG /g,"\u04A4"],[/\\cyrchar\\cyrng /g,"\u04A5"],[/\\cyrchar\\CYRPHK /g,"\u04A6"],[/\\cyrchar\\cyrphk /g,"\u04A7"],[/\\cyrchar\\CYRABHHA /g,"\u04A8"],[/\\cyrchar\\cyrabhha /g,"\u04A9"],[/\\cyrchar\\CYRSDSC /g,"\u04AA"],[/\\cyrchar\\cyrsdsc /g,"\u04AB"],[/\\cyrchar\\CYRTDSC /g,"\u04AC"],[/\\cyrchar\\cyrtdsc /g,"\u04AD"],[/\\cyrchar\\CYRY /g,"\u04AE"],[/\\cyrchar\\cyry /g,"\u04AF"],[/\\cyrchar\\CYRYHCRS /g,"\u04B0"],[/\\cyrchar\\cyryhcrs /g,"\u04B1"],[/\\cyrchar\\CYRHDSC /g,"\u04B2"],[/\\cyrchar\\cyrhdsc /g,"\u04B3"],[/\\cyrchar\\CYRTETSE /g,"\u04B4"],[/\\cyrchar\\cyrtetse /g,"\u04B5"],[/\\cyrchar\\CYRCHRDSC /g,"\u04B6"],[/\\cyrchar\\cyrchrdsc /g,"\u04B7"],[/\\cyrchar\\CYRCHVCRS /g,"\u04B8"],[/\\cyrchar\\cyrchvcrs /g,"\u04B9"],[/\\cyrchar\\CYRSHHA /g,"\u04BA"],[/\\cyrchar\\cyrshha /g,"\u04BB"],[/\\cyrchar\\CYRABHCH /g,"\u04BC"],[/\\cyrchar\\cyrabhch /g,"\u04BD"],[/\\cyrchar\\CYRABHCHDSC /g,"\u04BE"],[/\\cyrchar\\cyrabhchdsc /g,"\u04BF"],[/\\cyrchar\\CYRpalochka /g,"\u04C0"],[/\\cyrchar\\CYRKHK /g,"\u04C3"],[/\\cyrchar\\cyrkhk /g,"\u04C4"],[/\\cyrchar\\CYRNHK /g,"\u04C7"],[/\\cyrchar\\cyrnhk /g,"\u04C8"],[/\\cyrchar\\CYRCHLDSC /g,"\u04CB"],[/\\cyrchar\\cyrchldsc /g,"\u04CC"],[/\\cyrchar\\CYRAE /g,"\u04D4"],[/\\cyrchar\\cyrae /g,"\u04D5"],[/\\cyrchar\\CYRSCHWA /g,"\u04D8"],[/\\cyrchar\\cyrschwa /g,"\u04D9"],[/\\cyrchar\\CYRABHDZE /g,"\u04E0"],[/\\cyrchar\\cyrabhdze /g,"\u04E1"],[/\\cyrchar\\CYROTLD /g,"\u04E8"],[/\\cyrchar\\cyrotld /g,"\u04E9"],[/\\hspace\{0.6em\}/g,"\u2002"],[/\\hspace\{1em\}/g,"\u2003"],[/\\hspace\{0.33em\}/g,"\u2004"],[/\\hspace\{0.25em\}/g,"\u2005"],[/\\hspace\{0.166em\}/g,"\u2006"],[/\\hphantom\{0\}/g,"\u2007"],[/\\hphantom\{,\}/g,"\u2008"],[/\\hspace\{0.167em\}/g,"\u2009"],[/\\mkern1mu /g,"\u200A"],[/\\textendash /g,"\u2013"],[/\\textemdash /g,"\u2014"],[/\\rule\{1em\}\{1pt\}/g,"\u2015"],[/\\Vert /g,"\u2016"],[/\\Elzreapos /g,"\u201B"],[/\\textquotedblleft /g,"\u201C"],[/\\textquotedblright /g,"\u201D"],[/\\textdagger /g,"\u2020"],[/\\textdaggerdbl /g,"\u2021"],[/\\textbullet /g,"\u2022"],[/\\ldots /g,"\u2026"],[/\\textperthousand /g,"\u2030"],[/\\textpertenthousand /g,"\u2031"],[/\\backprime /g,"\u2035"],[/\\guilsinglleft /g,"\u2039"],[/\\guilsinglright /g,"\u203A"],[/\\mkern4mu /g,"\u205F"],[/\\nolinebreak /g,"\u2060"],[/\\ensuremath\{\\Elzpes\}/g,"\u20A7"],[/\\mbox\{\\texteuro\} /g,"\u20AC"],[/\\dddot /g,"\u20DB"],[/\\ddddot /g,"\u20DC"],[/\\mathbb\{C\}/g,"\u2102"],[/\\mathscr\{g\}/g,"\u210A"],[/\\mathscr\{H\}/g,"\u210B"],[/\\mathfrak\{H\}/g,"\u210C"],[/\\mathbb\{H\}/g,"\u210D"],[/\\hslash /g,"\u210F"],[/\\mathscr\{I\}/g,"\u2110"],[/\\mathfrak\{I\}/g,"\u2111"],[/\\mathscr\{L\}/g,"\u2112"],[/\\mathscr\{l\}/g,"\u2113"],[/\\mathbb\{N\}/g,"\u2115"],[/\\cyrchar\\textnumero /g,"\u2116"],[/\\wp /g,"\u2118"],[/\\mathbb\{P\}/g,"\u2119"],[/\\mathbb\{Q\}/g,"\u211A"],[/\\mathscr\{R\}/g,"\u211B"],[/\\mathfrak\{R\}/g,"\u211C"],[/\\mathbb\{R\}/g,"\u211D"],[/\\Elzxrat /g,"\u211E"],[/\\texttrademark /g,"\u2122"],[/\\mathbb\{Z\}/g,"\u2124"],[/\\Omega /g,"\u2126"],[/\\mho /g,"\u2127"],[/\\mathfrak\{Z\}/g,"\u2128"],[/\\ElsevierGlyph\{2129\}/g,"\u2129"],[/\\AA /g,"\u212B"],[/\\mathscr\{B\}/g,"\u212C"],[/\\mathfrak\{C\}/g,"\u212D"],[/\\mathscr\{e\}/g,"\u212F"],[/\\mathscr\{E\}/g,"\u2130"],[/\\mathscr\{F\}/g,"\u2131"],[/\\mathscr\{M\}/g,"\u2133"],[/\\mathscr\{o\}/g,"\u2134"],[/\\aleph /g,"\u2135"],[/\\beth /g,"\u2136"],[/\\gimel /g,"\u2137"],[/\\daleth /g,"\u2138"],[/\\textfrac\{1\}\{3\}/g,"\u2153"],[/\\textfrac\{2\}\{3\}/g,"\u2154"],[/\\textfrac\{1\}\{5\}/g,"\u2155"],[/\\textfrac\{2\}\{5\}/g,"\u2156"],[/\\textfrac\{3\}\{5\}/g,"\u2157"],[/\\textfrac\{4\}\{5\}/g,"\u2158"],[/\\textfrac\{1\}\{6\}/g,"\u2159"],[/\\textfrac\{5\}\{6\}/g,"\u215A"],[/\\textfrac\{1\}\{8\}/g,"\u215B"],[/\\textfrac\{3\}\{8\}/g,"\u215C"],[/\\textfrac\{5\}\{8\}/g,"\u215D"],[/\\textfrac\{7\}\{8\}/g,"\u215E"],[/\\leftarrow /g,"\u2190"],[/\\uparrow /g,"\u2191"],[/\\rightarrow /g,"\u2192"],[/\\downarrow /g,"\u2193"],[/\\leftrightarrow /g,"\u2194"],[/\\updownarrow /g,"\u2195"],[/\\nwarrow /g,"\u2196"],[/\\nearrow /g,"\u2197"],[/\\searrow /g,"\u2198"],[/\\swarrow /g,"\u2199"],[/\\nleftarrow /g,"\u219A"],[/\\nrightarrow /g,"\u219B"],[/\\arrowwaveright /g,"\u219C"],[/\\arrowwaveright /g,"\u219D"],[/\\twoheadleftarrow /g,"\u219E"],[/\\twoheadrightarrow /g,"\u21A0"],[/\\leftarrowtail /g,"\u21A2"],[/\\rightarrowtail /g,"\u21A3"],[/\\mapsto /g,"\u21A6"],[/\\hookleftarrow /g,"\u21A9"],[/\\hookrightarrow /g,"\u21AA"],[/\\looparrowleft /g,"\u21AB"],[/\\looparrowright /g,"\u21AC"],[/\\leftrightsquigarrow /g,"\u21AD"],[/\\nleftrightarrow /g,"\u21AE"],[/\\Lsh /g,"\u21B0"],[/\\Rsh /g,"\u21B1"],[/\\ElsevierGlyph\{21B3\}/g,"\u21B3"],[/\\curvearrowleft /g,"\u21B6"],[/\\curvearrowright /g,"\u21B7"],[/\\circlearrowleft /g,"\u21BA"],[/\\circlearrowright /g,"\u21BB"],[/\\leftharpoonup /g,"\u21BC"],[/\\leftharpoondown /g,"\u21BD"],[/\\upharpoonright /g,"\u21BE"],[/\\upharpoonleft /g,"\u21BF"],[/\\rightharpoonup /g,"\u21C0"],[/\\rightharpoondown /g,"\u21C1"],[/\\downharpoonright /g,"\u21C2"],[/\\downharpoonleft /g,"\u21C3"],[/\\rightleftarrows /g,"\u21C4"],[/\\dblarrowupdown /g,"\u21C5"],[/\\leftrightarrows /g,"\u21C6"],[/\\leftleftarrows /g,"\u21C7"],[/\\upuparrows /g,"\u21C8"],[/\\rightrightarrows /g,"\u21C9"],[/\\downdownarrows /g,"\u21CA"],[/\\leftrightharpoons /g,"\u21CB"],[/\\rightleftharpoons /g,"\u21CC"],[/\\nLeftarrow /g,"\u21CD"],[/\\nLeftrightarrow /g,"\u21CE"],[/\\nRightarrow /g,"\u21CF"],[/\\Leftarrow /g,"\u21D0"],[/\\Uparrow /g,"\u21D1"],[/\\Rightarrow /g,"\u21D2"],[/\\Downarrow /g,"\u21D3"],[/\\Leftrightarrow /g,"\u21D4"],[/\\Updownarrow /g,"\u21D5"],[/\\Lleftarrow /g,"\u21DA"],[/\\Rrightarrow /g,"\u21DB"],[/\\rightsquigarrow /g,"\u21DD"],[/\\DownArrowUpArrow /g,"\u21F5"],[/\\forall /g,"\u2200"],[/\\complement /g,"\u2201"],[/\\partial /g,"\u2202"],[/\\exists /g,"\u2203"],[/\\nexists /g,"\u2204"],[/\\varnothing /g,"\u2205"],[/\\nabla /g,"\u2207"],[/\\in /g,"\u2208"],[/\\not\\in /g,"\u2209"],[/\\ni /g,"\u220B"],[/\\not\\ni /g,"\u220C"],[/\\prod /g,"\u220F"],[/\\coprod /g,"\u2210"],[/\\sum /g,"\u2211"],[/\\mp /g,"\u2213"],[/\\dotplus /g,"\u2214"],[/\\setminus /g,"\u2216"],[/\\circ /g,"\u2218"],[/\\bullet /g,"\u2219"],[/\\surd /g,"\u221A"],[/\\propto /g,"\u221D"],[/\\infty /g,"\u221E"],[/\\rightangle /g,"\u221F"],[/\\angle /g,"\u2220"],[/\\measuredangle /g,"\u2221"],[/\\sphericalangle /g,"\u2222"],[/\\mid /g,"\u2223"],[/\\nmid /g,"\u2224"],[/\\parallel /g,"\u2225"],[/\\nparallel /g,"\u2226"],[/\\wedge /g,"\u2227"],[/\\vee /g,"\u2228"],[/\\cap /g,"\u2229"],[/\\cup /g,"\u222A"],[/\\int /g,"\u222B"],[/\\int\\!\\int /g,"\u222C"],[/\\int\\!\\int\\!\\int /g,"\u222D"],[/\\oint /g,"\u222E"],[/\\surfintegral /g,"\u222F"],[/\\volintegral /g,"\u2230"],[/\\clwintegral /g,"\u2231"],[/\\ElsevierGlyph\{2232\}/g,"\u2232"],[/\\ElsevierGlyph\{2233\}/g,"\u2233"],[/\\therefore /g,"\u2234"],[/\\because /g,"\u2235"],[/\\Colon /g,"\u2237"],[/\\ElsevierGlyph\{2238\}/g,"\u2238"],[/\\mathbin\{\{:\}\\!\\!\{\-\}\\!\\!\{:\}\}/g,"\u223A"],[/\\homothetic /g,"\u223B"],[/\\sim /g,"\u223C"],[/\\backsim /g,"\u223D"],[/\\lazysinv /g,"\u223E"],[/\\wr /g,"\u2240"],[/\\not\\sim /g,"\u2241"],[/\\ElsevierGlyph\{2242\}/g,"\u2242"],[/\\NotEqualTilde /g,"\u2242-00338"],[/\\simeq /g,"\u2243"],[/\\not\\simeq /g,"\u2244"],[/\\cong /g,"\u2245"],[/\\approxnotequal /g,"\u2246"],[/\\not\\cong /g,"\u2247"],[/\\approx /g,"\u2248"],[/\\not\\approx /g,"\u2249"],[/\\approxeq /g,"\u224A"],[/\\tildetrpl /g,"\u224B"],[/\\not\\apid /g,"\u224B-00338"],[/\\allequal /g,"\u224C"],[/\\asymp /g,"\u224D"],[/\\Bumpeq /g,"\u224E"],[/\\NotHumpDownHump /g,"\u224E-00338"],[/\\bumpeq /g,"\u224F"],[/\\NotHumpEqual /g,"\u224F-00338"],[/\\doteq /g,"\u2250"],[/\\not\\doteq/g,"\u2250-00338"],[/\\doteqdot /g,"\u2251"],[/\\fallingdotseq /g,"\u2252"],[/\\risingdotseq /g,"\u2253"],[/\\eqcirc /g,"\u2256"],[/\\circeq /g,"\u2257"],[/\\estimates /g,"\u2259"],[/\\ElsevierGlyph\{225A\}/g,"\u225A"],[/\\starequal /g,"\u225B"],[/\\triangleq /g,"\u225C"],[/\\ElsevierGlyph\{225F\}/g,"\u225F"],[/\\not =/g,"\u2260"],[/\\equiv /g,"\u2261"],[/\\not\\equiv /g,"\u2262"],[/\\leq /g,"\u2264"],[/\\geq /g,"\u2265"],[/\\leqq /g,"\u2266"],[/\\geqq /g,"\u2267"],[/\\lneqq /g,"\u2268"],[/\\lvertneqq /g,"\u2268-0FE00"],[/\\gneqq /g,"\u2269"],[/\\gvertneqq /g,"\u2269-0FE00"],[/\\ll /g,"\u226A"],[/\\NotLessLess /g,"\u226A-00338"],[/\\gg /g,"\u226B"],[/\\NotGreaterGreater /g,"\u226B-00338"],[/\\between /g,"\u226C"],[/\\not\\kern\-0.3em\\times /g,"\u226D"],[/\\not</g,"\u226E"],[/\\not>/g,"\u226F"],[/\\not\\leq /g,"\u2270"],[/\\not\\geq /g,"\u2271"],[/\\lessequivlnt /g,"\u2272"],[/\\greaterequivlnt /g,"\u2273"],[/\\ElsevierGlyph\{2274\}/g,"\u2274"],[/\\ElsevierGlyph\{2275\}/g,"\u2275"],[/\\lessgtr /g,"\u2276"],[/\\gtrless /g,"\u2277"],[/\\notlessgreater /g,"\u2278"],[/\\notgreaterless /g,"\u2279"],[/\\prec /g,"\u227A"],[/\\succ /g,"\u227B"],[/\\preccurlyeq /g,"\u227C"],[/\\succcurlyeq /g,"\u227D"],[/\\precapprox /g,"\u227E"],[/\\NotPrecedesTilde /g,"\u227E-00338"],[/\\succapprox /g,"\u227F"],[/\\NotSucceedsTilde /g,"\u227F-00338"],[/\\not\\prec /g,"\u2280"],[/\\not\\succ /g,"\u2281"],[/\\subset /g,"\u2282"],[/\\supset /g,"\u2283"],[/\\not\\subset /g,"\u2284"],[/\\not\\supset /g,"\u2285"],[/\\subseteq /g,"\u2286"],[/\\supseteq /g,"\u2287"],[/\\not\\subseteq /g,"\u2288"],[/\\not\\supseteq /g,"\u2289"],[/\\subsetneq /g,"\u228A"],[/\\varsubsetneqq /g,"\u228A-0FE00"],[/\\supsetneq /g,"\u228B"],[/\\varsupsetneq /g,"\u228B-0FE00"],[/\\uplus /g,"\u228E"],[/\\sqsubset /g,"\u228F"],[/\\NotSquareSubset /g,"\u228F-00338"],[/\\sqsupset /g,"\u2290"],[/\\NotSquareSuperset /g,"\u2290-00338"],[/\\sqsubseteq /g,"\u2291"],[/\\sqsupseteq /g,"\u2292"],[/\\sqcap /g,"\u2293"],[/\\sqcup /g,"\u2294"],[/\\oplus /g,"\u2295"],[/\\ominus /g,"\u2296"],[/\\otimes /g,"\u2297"],[/\\oslash /g,"\u2298"],[/\\odot /g,"\u2299"],[/\\circledcirc /g,"\u229A"],[/\\circledast /g,"\u229B"],[/\\circleddash /g,"\u229D"],[/\\boxplus /g,"\u229E"],[/\\boxminus /g,"\u229F"],[/\\boxtimes /g,"\u22A0"],[/\\boxdot /g,"\u22A1"],[/\\vdash /g,"\u22A2"],[/\\dashv /g,"\u22A3"],[/\\top /g,"\u22A4"],[/\\perp /g,"\u22A5"],[/\\truestate /g,"\u22A7"],[/\\forcesextra /g,"\u22A8"],[/\\Vdash /g,"\u22A9"],[/\\Vvdash /g,"\u22AA"],[/\\VDash /g,"\u22AB"],[/\\nvdash /g,"\u22AC"],[/\\nvDash /g,"\u22AD"],[/\\nVdash /g,"\u22AE"],[/\\nVDash /g,"\u22AF"],[/\\vartriangleleft /g,"\u22B2"],[/\\vartriangleright /g,"\u22B3"],[/\\trianglelefteq /g,"\u22B4"],[/\\trianglerighteq /g,"\u22B5"],[/\\original /g,"\u22B6"],[/\\image /g,"\u22B7"],[/\\multimap /g,"\u22B8"],[/\\hermitconjmatrix /g,"\u22B9"],[/\\intercal /g,"\u22BA"],[/\\veebar /g,"\u22BB"],[/\\rightanglearc /g,"\u22BE"],[/\\ElsevierGlyph\{22C0\}/g,"\u22C0"],[/\\ElsevierGlyph\{22C1\}/g,"\u22C1"],[/\\bigcap /g,"\u22C2"],[/\\bigcup /g,"\u22C3"],[/\\diamond /g,"\u22C4"],[/\\cdot /g,"\u22C5"],[/\\star /g,"\u22C6"],[/\\divideontimes /g,"\u22C7"],[/\\bowtie /g,"\u22C8"],[/\\ltimes /g,"\u22C9"],[/\\rtimes /g,"\u22CA"],[/\\leftthreetimes /g,"\u22CB"],[/\\rightthreetimes /g,"\u22CC"],[/\\backsimeq /g,"\u22CD"],[/\\curlyvee /g,"\u22CE"],[/\\curlywedge /g,"\u22CF"],[/\\Subset /g,"\u22D0"],[/\\Supset /g,"\u22D1"],[/\\Cap /g,"\u22D2"],[/\\Cup /g,"\u22D3"],[/\\pitchfork /g,"\u22D4"],[/\\lessdot /g,"\u22D6"],[/\\gtrdot /g,"\u22D7"],[/\\verymuchless /g,"\u22D8"],[/\\verymuchgreater /g,"\u22D9"],[/\\lesseqgtr /g,"\u22DA"],[/\\gtreqless /g,"\u22DB"],[/\\curlyeqprec /g,"\u22DE"],[/\\curlyeqsucc /g,"\u22DF"],[/\\not\\sqsubseteq /g,"\u22E2"],[/\\not\\sqsupseteq /g,"\u22E3"],[/\\Elzsqspne /g,"\u22E5"],[/\\lnsim /g,"\u22E6"],[/\\gnsim /g,"\u22E7"],[/\\precedesnotsimilar /g,"\u22E8"],[/\\succnsim /g,"\u22E9"],[/\\ntriangleleft /g,"\u22EA"],[/\\ntriangleright /g,"\u22EB"],[/\\ntrianglelefteq /g,"\u22EC"],[/\\ntrianglerighteq /g,"\u22ED"],[/\\vdots /g,"\u22EE"],[/\\cdots /g,"\u22EF"],[/\\upslopeellipsis /g,"\u22F0"],[/\\downslopeellipsis /g,"\u22F1"],[/\\barwedge /g,"\u2305"],[/\\perspcorrespond /g,"\u2306"],[/\\lceil /g,"\u2308"],[/\\rceil /g,"\u2309"],[/\\lfloor /g,"\u230A"],[/\\rfloor /g,"\u230B"],[/\\recorder /g,"\u2315"],[/\\mathchar"2208/g,"\u2316"],[/\\ulcorner /g,"\u231C"],[/\\urcorner /g,"\u231D"],[/\\llcorner /g,"\u231E"],[/\\lrcorner /g,"\u231F"],[/\\frown /g,"\u2322"],[/\\smile /g,"\u2323"],[/\\langle /g,"\u2329"],[/\\rangle /g,"\u232A"],[/\\ElsevierGlyph\{E838\}/g,"\u233D"],[/\\Elzdlcorn /g,"\u23A3"],[/\\lmoustache /g,"\u23B0"],[/\\rmoustache /g,"\u23B1"],[/\\textvisiblespace /g,"\u2423"],[/\\ding\{172\}/g,"\u2460"],[/\\ding\{173\}/g,"\u2461"],[/\\ding\{174\}/g,"\u2462"],[/\\ding\{175\}/g,"\u2463"],[/\\ding\{176\}/g,"\u2464"],[/\\ding\{177\}/g,"\u2465"],[/\\ding\{178\}/g,"\u2466"],[/\\ding\{179\}/g,"\u2467"],[/\\ding\{180\}/g,"\u2468"],[/\\ding\{181\}/g,"\u2469"],[/\\circledS /g,"\u24C8"],[/\\Elzdshfnc /g,"\u2506"],[/\\Elzsqfnw /g,"\u2519"],[/\\diagup /g,"\u2571"],[/\\ding\{110\}/g,"\u25A0"],[/\\square /g,"\u25A1"],[/\\blacksquare /g,"\u25AA"],[/\\fbox\{~~\}/g,"\u25AD"],[/\\Elzvrecto /g,"\u25AF"],[/\\ElsevierGlyph\{E381\}/g,"\u25B1"],[/\\ding\{115\}/g,"\u25B2"],[/\\bigtriangleup /g,"\u25B3"],[/\\blacktriangle /g,"\u25B4"],[/\\vartriangle /g,"\u25B5"],[/\\blacktriangleright /g,"\u25B8"],[/\\triangleright /g,"\u25B9"],[/\\ding\{116\}/g,"\u25BC"],[/\\bigtriangledown /g,"\u25BD"],[/\\blacktriangledown /g,"\u25BE"],[/\\triangledown /g,"\u25BF"],[/\\blacktriangleleft /g,"\u25C2"],[/\\triangleleft /g,"\u25C3"],[/\\ding\{117\}/g,"\u25C6"],[/\\lozenge /g,"\u25CA"],[/\\bigcirc /g,"\u25CB"],[/\\ding\{108\}/g,"\u25CF"],[/\\Elzcirfl /g,"\u25D0"],[/\\Elzcirfr /g,"\u25D1"],[/\\Elzcirfb /g,"\u25D2"],[/\\ding\{119\}/g,"\u25D7"],[/\\Elzrvbull /g,"\u25D8"],[/\\Elzsqfl /g,"\u25E7"],[/\\Elzsqfr /g,"\u25E8"],[/\\Elzsqfse /g,"\u25EA"],[/\\bigcirc /g,"\u25EF"],[/\\ding\{72\}/g,"\u2605"],[/\\ding\{73\}/g,"\u2606"],[/\\ding\{37\}/g,"\u260E"],[/\\ding\{42\}/g,"\u261B"],[/\\ding\{43\}/g,"\u261E"],[/\\rightmoon /g,"\u263E"],[/\\mercury /g,"\u263F"],[/\\venus /g,"\u2640"],[/\\male /g,"\u2642"],[/\\jupiter /g,"\u2643"],[/\\saturn /g,"\u2644"],[/\\uranus /g,"\u2645"],[/\\neptune /g,"\u2646"],[/\\pluto /g,"\u2647"],[/\\aries /g,"\u2648"],[/\\taurus /g,"\u2649"],[/\\gemini /g,"\u264A"],[/\\cancer /g,"\u264B"],[/\\leo /g,"\u264C"],[/\\virgo /g,"\u264D"],[/\\libra /g,"\u264E"],[/\\scorpio /g,"\u264F"],[/\\sagittarius /g,"\u2650"],[/\\capricornus /g,"\u2651"],[/\\aquarius /g,"\u2652"],[/\\pisces /g,"\u2653"],[/\\ding\{171\}/g,"\u2660"],[/\\diamond /g,"\u2662"],[/\\ding\{168\}/g,"\u2663"],[/\\ding\{170\}/g,"\u2665"],[/\\ding\{169\}/g,"\u2666"],[/\\quarternote /g,"\u2669"],[/\\eighthnote /g,"\u266A"],[/\\flat /g,"\u266D"],[/\\natural /g,"\u266E"],[/\\sharp /g,"\u266F"],[/\\ding\{33\}/g,"\u2701"],[/\\ding\{34\}/g,"\u2702"],[/\\ding\{35\}/g,"\u2703"],[/\\ding\{36\}/g,"\u2704"],[/\\ding\{38\}/g,"\u2706"],[/\\ding\{39\}/g,"\u2707"],[/\\ding\{40\}/g,"\u2708"],[/\\ding\{41\}/g,"\u2709"],[/\\ding\{44\}/g,"\u270C"],[/\\ding\{45\}/g,"\u270D"],[/\\ding\{46\}/g,"\u270E"],[/\\ding\{47\}/g,"\u270F"],[/\\ding\{48\}/g,"\u2710"],[/\\ding\{49\}/g,"\u2711"],[/\\ding\{50\}/g,"\u2712"],[/\\ding\{51\}/g,"\u2713"],[/\\ding\{52\}/g,"\u2714"],[/\\ding\{53\}/g,"\u2715"],[/\\ding\{54\}/g,"\u2716"],[/\\ding\{55\}/g,"\u2717"],[/\\ding\{56\}/g,"\u2718"],[/\\ding\{57\}/g,"\u2719"],[/\\ding\{58\}/g,"\u271A"],[/\\ding\{59\}/g,"\u271B"],[/\\ding\{60\}/g,"\u271C"],[/\\ding\{61\}/g,"\u271D"],[/\\ding\{62\}/g,"\u271E"],[/\\ding\{63\}/g,"\u271F"],[/\\ding\{64\}/g,"\u2720"],[/\\ding\{65\}/g,"\u2721"],[/\\ding\{66\}/g,"\u2722"],[/\\ding\{67\}/g,"\u2723"],[/\\ding\{68\}/g,"\u2724"],[/\\ding\{69\}/g,"\u2725"],[/\\ding\{70\}/g,"\u2726"],[/\\ding\{71\}/g,"\u2727"],[/\\ding\{73\}/g,"\u2729"],[/\\ding\{74\}/g,"\u272A"],[/\\ding\{75\}/g,"\u272B"],[/\\ding\{76\}/g,"\u272C"],[/\\ding\{77\}/g,"\u272D"],[/\\ding\{78\}/g,"\u272E"],[/\\ding\{79\}/g,"\u272F"],[/\\ding\{80\}/g,"\u2730"],[/\\ding\{81\}/g,"\u2731"],[/\\ding\{82\}/g,"\u2732"],[/\\ding\{83\}/g,"\u2733"],[/\\ding\{84\}/g,"\u2734"],[/\\ding\{85\}/g,"\u2735"],[/\\ding\{86\}/g,"\u2736"],[/\\ding\{87\}/g,"\u2737"],[/\\ding\{88\}/g,"\u2738"],[/\\ding\{89\}/g,"\u2739"],[/\\ding\{90\}/g,"\u273A"],[/\\ding\{91\}/g,"\u273B"],[/\\ding\{92\}/g,"\u273C"],[/\\ding\{93\}/g,"\u273D"],[/\\ding\{94\}/g,"\u273E"],[/\\ding\{95\}/g,"\u273F"],[/\\ding\{96\}/g,"\u2740"],[/\\ding\{97\}/g,"\u2741"],[/\\ding\{98\}/g,"\u2742"],[/\\ding\{99\}/g,"\u2743"],[/\\ding\{100\}/g,"\u2744"],[/\\ding\{101\}/g,"\u2745"],[/\\ding\{102\}/g,"\u2746"],[/\\ding\{103\}/g,"\u2747"],[/\\ding\{104\}/g,"\u2748"],[/\\ding\{105\}/g,"\u2749"],[/\\ding\{106\}/g,"\u274A"],[/\\ding\{107\}/g,"\u274B"],[/\\ding\{109\}/g,"\u274D"],[/\\ding\{111\}/g,"\u274F"],[/\\ding\{112\}/g,"\u2750"],[/\\ding\{113\}/g,"\u2751"],[/\\ding\{114\}/g,"\u2752"],[/\\ding\{118\}/g,"\u2756"],[/\\ding\{120\}/g,"\u2758"],[/\\ding\{121\}/g,"\u2759"],[/\\ding\{122\}/g,"\u275A"],[/\\ding\{123\}/g,"\u275B"],[/\\ding\{124\}/g,"\u275C"],[/\\ding\{125\}/g,"\u275D"],[/\\ding\{126\}/g,"\u275E"],[/\\ding\{161\}/g,"\u2761"],[/\\ding\{162\}/g,"\u2762"],[/\\ding\{163\}/g,"\u2763"],[/\\ding\{164\}/g,"\u2764"],[/\\ding\{165\}/g,"\u2765"],[/\\ding\{166\}/g,"\u2766"],[/\\ding\{167\}/g,"\u2767"],[/\\ding\{182\}/g,"\u2776"],[/\\ding\{183\}/g,"\u2777"],[/\\ding\{184\}/g,"\u2778"],[/\\ding\{185\}/g,"\u2779"],[/\\ding\{186\}/g,"\u277A"],[/\\ding\{187\}/g,"\u277B"],[/\\ding\{188\}/g,"\u277C"],[/\\ding\{189\}/g,"\u277D"],[/\\ding\{190\}/g,"\u277E"],[/\\ding\{191\}/g,"\u277F"],[/\\ding\{192\}/g,"\u2780"],[/\\ding\{193\}/g,"\u2781"],[/\\ding\{194\}/g,"\u2782"],[/\\ding\{195\}/g,"\u2783"],[/\\ding\{196\}/g,"\u2784"],[/\\ding\{197\}/g,"\u2785"],[/\\ding\{198\}/g,"\u2786"],[/\\ding\{199\}/g,"\u2787"],[/\\ding\{200\}/g,"\u2788"],[/\\ding\{201\}/g,"\u2789"],[/\\ding\{202\}/g,"\u278A"],[/\\ding\{203\}/g,"\u278B"],[/\\ding\{204\}/g,"\u278C"],[/\\ding\{205\}/g,"\u278D"],[/\\ding\{206\}/g,"\u278E"],[/\\ding\{207\}/g,"\u278F"],[/\\ding\{208\}/g,"\u2790"],[/\\ding\{209\}/g,"\u2791"],[/\\ding\{210\}/g,"\u2792"],[/\\ding\{211\}/g,"\u2793"],[/\\ding\{212\}/g,"\u2794"],[/\\ding\{216\}/g,"\u2798"],[/\\ding\{217\}/g,"\u2799"],[/\\ding\{218\}/g,"\u279A"],[/\\ding\{219\}/g,"\u279B"],[/\\ding\{220\}/g,"\u279C"],[/\\ding\{221\}/g,"\u279D"],[/\\ding\{222\}/g,"\u279E"],[/\\ding\{223\}/g,"\u279F"],[/\\ding\{224\}/g,"\u27A0"],[/\\ding\{225\}/g,"\u27A1"],[/\\ding\{226\}/g,"\u27A2"],[/\\ding\{227\}/g,"\u27A3"],[/\\ding\{228\}/g,"\u27A4"],[/\\ding\{229\}/g,"\u27A5"],[/\\ding\{230\}/g,"\u27A6"],[/\\ding\{231\}/g,"\u27A7"],[/\\ding\{232\}/g,"\u27A8"],[/\\ding\{233\}/g,"\u27A9"],[/\\ding\{234\}/g,"\u27AA"],[/\\ding\{235\}/g,"\u27AB"],[/\\ding\{236\}/g,"\u27AC"],[/\\ding\{237\}/g,"\u27AD"],[/\\ding\{238\}/g,"\u27AE"],[/\\ding\{239\}/g,"\u27AF"],[/\\ding\{241\}/g,"\u27B1"],[/\\ding\{242\}/g,"\u27B2"],[/\\ding\{243\}/g,"\u27B3"],[/\\ding\{244\}/g,"\u27B4"],[/\\ding\{245\}/g,"\u27B5"],[/\\ding\{246\}/g,"\u27B6"],[/\\ding\{247\}/g,"\u27B7"],[/\\ding\{248\}/g,"\u27B8"],[/\\ding\{249\}/g,"\u27B9"],[/\\ding\{250\}/g,"\u27BA"],[/\\ding\{251\}/g,"\u27BB"],[/\\ding\{252\}/g,"\u27BC"],[/\\ding\{253\}/g,"\u27BD"],[/\\ding\{254\}/g,"\u27BE"],[/\\longleftarrow /g,"\u27F5"],[/\\longrightarrow /g,"\u27F6"],[/\\longleftrightarrow /g,"\u27F7"],[/\\Longleftarrow /g,"\u27F8"],[/\\Longrightarrow /g,"\u27F9"],[/\\Longleftrightarrow /g,"\u27FA"],[/\\longmapsto /g,"\u27FC"],[/\\sim\\joinrel\\leadsto/g,"\u27FF"],[/\\ElsevierGlyph\{E212\}/g,"\u2905"],[/\\UpArrowBar /g,"\u2912"],[/\\DownArrowBar /g,"\u2913"],[/\\ElsevierGlyph\{E20C\}/g,"\u2923"],[/\\ElsevierGlyph\{E20D\}/g,"\u2924"],[/\\ElsevierGlyph\{E20B\}/g,"\u2925"],[/\\ElsevierGlyph\{E20A\}/g,"\u2926"],[/\\ElsevierGlyph\{E211\}/g,"\u2927"],[/\\ElsevierGlyph\{E20E\}/g,"\u2928"],[/\\ElsevierGlyph\{E20F\}/g,"\u2929"],[/\\ElsevierGlyph\{E210\}/g,"\u292A"],[/\\ElsevierGlyph\{E21C\}/g,"\u2933"],[/\\ElsevierGlyph\{E21D\}/g,"\u2933-00338"],[/\\ElsevierGlyph\{E21A\}/g,"\u2936"],[/\\ElsevierGlyph\{E219\}/g,"\u2937"],[/\\Elolarr /g,"\u2940"],[/\\Elorarr /g,"\u2941"],[/\\ElzRlarr /g,"\u2942"],[/\\ElzrLarr /g,"\u2944"],[/\\Elzrarrx /g,"\u2947"],[/\\LeftRightVector /g,"\u294E"],[/\\RightUpDownVector /g,"\u294F"],[/\\DownLeftRightVector /g,"\u2950"],[/\\LeftUpDownVector /g,"\u2951"],[/\\LeftVectorBar /g,"\u2952"],[/\\RightVectorBar /g,"\u2953"],[/\\RightUpVectorBar /g,"\u2954"],[/\\RightDownVectorBar /g,"\u2955"],[/\\DownLeftVectorBar /g,"\u2956"],[/\\DownRightVectorBar /g,"\u2957"],[/\\LeftUpVectorBar /g,"\u2958"],[/\\LeftDownVectorBar /g,"\u2959"],[/\\LeftTeeVector /g,"\u295A"],[/\\RightTeeVector /g,"\u295B"],[/\\RightUpTeeVector /g,"\u295C"],[/\\RightDownTeeVector /g,"\u295D"],[/\\DownLeftTeeVector /g,"\u295E"],[/\\DownRightTeeVector /g,"\u295F"],[/\\LeftUpTeeVector /g,"\u2960"],[/\\LeftDownTeeVector /g,"\u2961"],[/\\UpEquilibrium /g,"\u296E"],[/\\ReverseUpEquilibrium /g,"\u296F"],[/\\RoundImplies /g,"\u2970"],[/\\ElsevierGlyph\{E214\}/g,"\u297C"],[/\\ElsevierGlyph\{E215\}/g,"\u297D"],[/\\Elztfnc /g,"\u2980"],[/\\ElsevierGlyph\{3018\}/g,"\u2985"],[/\\Elroang /g,"\u2986"],[/\\ElsevierGlyph\{E291\}/g,"\u2994"],[/\\Elzddfnc /g,"\u2999"],[/\\Angle /g,"\u299C"],[/\\Elzlpargt /g,"\u29A0"],[/\\ElsevierGlyph\{E260\}/g,"\u29B5"],[/\\ElsevierGlyph\{E61B\}/g,"\u29B6"],[/\\ElzLap /g,"\u29CA"],[/\\Elzdefas /g,"\u29CB"],[/\\LeftTriangleBar /g,"\u29CF"],[/\\NotLeftTriangleBar /g,"\u29CF-00338"],[/\\RightTriangleBar /g,"\u29D0"],[/\\NotRightTriangleBar /g,"\u29D0-00338"],[/\\ElsevierGlyph\{E372\}/g,"\u29DC"],[/\\blacklozenge /g,"\u29EB"],[/\\RuleDelayed /g,"\u29F4"],[/\\Elxuplus /g,"\u2A04"],[/\\ElzThr /g,"\u2A05"],[/\\Elxsqcup /g,"\u2A06"],[/\\ElzInf /g,"\u2A07"],[/\\ElzSup /g,"\u2A08"],[/\\ElzCint /g,"\u2A0D"],[/\\clockoint /g,"\u2A0F"],[/\\ElsevierGlyph\{E395\}/g,"\u2A10"],[/\\sqrint /g,"\u2A16"],[/\\ElsevierGlyph\{E25A\}/g,"\u2A25"],[/\\ElsevierGlyph\{E25B\}/g,"\u2A2A"],[/\\ElsevierGlyph\{E25C\}/g,"\u2A2D"],[/\\ElsevierGlyph\{E25D\}/g,"\u2A2E"],[/\\ElzTimes /g,"\u2A2F"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A34"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A35"],[/\\ElsevierGlyph\{E259\}/g,"\u2A3C"],[/\\amalg /g,"\u2A3F"],[/\\ElzAnd /g,"\u2A53"],[/\\ElzOr /g,"\u2A54"],[/\\ElsevierGlyph\{E36E\}/g,"\u2A55"],[/\\ElOr /g,"\u2A56"],[/\\perspcorrespond /g,"\u2A5E"],[/\\Elzminhat /g,"\u2A5F"],[/\\ElsevierGlyph\{225A\}/g,"\u2A63"],[/\\stackrel\{*\}\{=\}/g,"\u2A6E"],[/\\Equal /g,"\u2A75"],[/\\leqslant /g,"\u2A7D"],[/\\nleqslant /g,"\u2A7D-00338"],[/\\geqslant /g,"\u2A7E"],[/\\ngeqslant /g,"\u2A7E-00338"],[/\\lessapprox /g,"\u2A85"],[/\\gtrapprox /g,"\u2A86"],[/\\lneq /g,"\u2A87"],[/\\gneq /g,"\u2A88"],[/\\lnapprox /g,"\u2A89"],[/\\gnapprox /g,"\u2A8A"],[/\\lesseqqgtr /g,"\u2A8B"],[/\\gtreqqless /g,"\u2A8C"],[/\\eqslantless /g,"\u2A95"],[/\\eqslantgtr /g,"\u2A96"],[/\\Pisymbol\{ppi020\}\{117\}/g,"\u2A9D"],[/\\Pisymbol\{ppi020\}\{105\}/g,"\u2A9E"],[/\\NestedLessLess /g,"\u2AA1"],[/\\NotNestedLessLess /g,"\u2AA1-00338"],[/\\NestedGreaterGreater /g,"\u2AA2"],[/\\NotNestedGreaterGreater /g,"\u2AA2-00338"],[/\\preceq /g,"\u2AAF"],[/\\not\\preceq /g,"\u2AAF-00338"],[/\\succeq /g,"\u2AB0"],[/\\not\\succeq /g,"\u2AB0-00338"],[/\\precneqq /g,"\u2AB5"],[/\\succneqq /g,"\u2AB6"],[/\\precapprox /g,"\u2AB7"],[/\\succapprox /g,"\u2AB8"],[/\\precnapprox /g,"\u2AB9"],[/\\succnapprox /g,"\u2ABA"],[/\\subseteqq /g,"\u2AC5"],[/\\nsubseteqq /g,"\u2AC5-00338"],[/\\supseteqq /g,"\u2AC6"],[/\\nsupseteqq/g,"\u2AC6-00338"],[/\\subsetneqq /g,"\u2ACB"],[/\\supsetneqq /g,"\u2ACC"],[/\\ElsevierGlyph\{E30D\}/g,"\u2AEB"],[/\\Elztdcol /g,"\u2AF6"],[/\\ElsevierGlyph\{300A\}/g,"\u300A"],[/\\ElsevierGlyph\{300B\}/g,"\u300B"],[/\\ElsevierGlyph\{3018\}/g,"\u3018"],[/\\ElsevierGlyph\{3019\}/g,"\u3019"],[/\\openbracketleft /g,"\u301A"],[/\\openbracketright /g,"\u301B"]];return this}if(typeof module!=="undefined"&&module.exports){module.exports=BibtexParser};
\ No newline at end of file
+function BibtexParser(c){if(typeof c=="string"){var d={};var a=[];function b(f){a.push(f)}var e=BibtexParser.call(d,b);e.parse(c);return{entries:a,errors:e.getErrors()}}if(typeof c!="function"){throw"Invalid parser construction."}this.STATES_={ENTRY_OR_JUNK:0,OBJECT_TYPE:1,ENTRY_KEY:2,KV_KEY:3,EQUALS:4,KV_VALUE:5};this.DATA_={};this.CALLBACK_=c;this.CHAR_=0;this.LINE_=1;this.CHAR_IN_LINE_=0;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={};this.SKIPTILLEOL_=false;this.VALBRACES_=null;this.BRACETYPE_=null;this.BRACECOUNT_=0;this.STATE_=this.STATES_.ENTRY_OR_JUNK;this.ERRORS_=[];this.ENTRY_TYPES_={inproceedings:1,proceedings:2,article:3,techreport:4,misc:5,mastersthesis:6,book:7,phdthesis:8,incollection:9,unpublished:10,inbook:11,manual:12,periodical:13,booklet:14,masterthesis:15,conference:16,data:999};this.MACROS_={jan:"January",feb:"February",mar:"March",apr:"April",may:"May",jun:"June",jul:"July",aug:"August",sep:"September",oct:"October",nov:"November",dec:"December",Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"};this.getErrors=function(){return this.ERRORS_};this.parse=function(f){for(var g=0;g<f.length;g++){this.processCharacter_(f[g])}};this.error_=function(f){this.ERRORS_.push([this.LINE_,this.CHAR_IN_LINE_,this.CHAR_,f])};this.processEntry_=function(){var h=this.DATA_;if(h.Fields){for(var k in h.Fields){var p=h.Fields[k];for(var j=0;j<this.CHARCONV_.length;j++){var q=this.CHARCONV_[j][0];var n=this.CHARCONV_[j][1];p=p.replace(q,n)}p=p.replace(/[\n\r\t]/g," ").replace(/\s\s+/g," ").replace(/^\s+|\s+$/g,"");var l=p.length;var g="";for(var j=0;j<l;j++){var m=p[j];var o=false;if(m=="\\"&&j<l-1){m=p[++j]}else{if(m=="{"||m=="}"){o=true}}if(!o){g+=m}}h.Fields[k]=g}}if(h.ObjectType=="string"){for(var k in h.Fields){this.MACROS_[k]=h.Fields[k]}}else{this.CALLBACK_(h)}};this.processCharacter_=function(l){this.CHAR_++;this.CHAR_IN_LINE_++;if(l=="\n"){this.LINE_++;this.CHAR_IN_LINE_=1}if(this.SKIPTILLEOL_){if(l=="\n"){this.SKIPTILLEOL_=false}return}if(this.SKIPCOMMENT_&&l=="%"){this.SKIPTILLEOL_=true;return}if(this.SKIPWS_&&/\s/.test(l)){return}this.SKIPWS_=false;this.SKIPCOMMENT_=false;this.SKIPTILLEOL_=false;var f=true;while(f){f=false;switch(this.STATE_){case this.STATES_.ENTRY_OR_JUNK:if(l=="@"){this.STATE_=this.STATES_.OBJECT_TYPE;this.DATA_={ObjectType:""}}this.BRACETYPE_=null;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break;case this.STATES_.OBJECT_TYPE:if(/[A-Za-z]/.test(l)){this.DATA_.ObjectType+=l.toLowerCase();this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{var i=this.DATA_.ObjectType;if(i=="comment"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i=="string"){this.DATA_.ObjectType=i;this.DATA_.Fields={};this.BRACETYPE_=l;this.BRACECOUNT_=1;this.STATE_=this.STATES_.KV_KEY;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={Key:""}}else{if(i=="preamble"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i in this.ENTRY_TYPES_){this.DATA_.ObjectType="entry";this.DATA_.EntryType=i;this.DATA_.EntryKey="";this.STATE_=this.STATES_.ENTRY_KEY;f=true}else{this.error_('Unrecognized object type: "'+this.DATA_.ObjectType+'"');this.STATE_=this.STATES_.ENTRY_OR_JUNK}}}}}break;case this.STATES_.ENTRY_KEY:if((l==="{"||l==="(")&&this.BRACETYPE_==null){this.BRACETYPE_=l;this.BRACECOUNT_=1;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break}if(/[,%\s]/.test(l)){if(this.DATA_.EntryKey.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{if(this.BRACETYPE_==null){this.error_("No opening brace for object.");this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;f=true;this.STATE_=this.STATES_.KV_KEY;this.PARSETMP_.Key="";this.DATA_.Fields={}}}}else{this.DATA_.EntryKey+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}break;case this.STATES_.KV_KEY:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(/[\-A-Za-z:]/.test(l)){this.PARSETMP_.Key+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{if(this.PARSETMP_.Key.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.EQUALS;f=true}}break;case this.STATES_.EQUALS:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.error_('Key-value pair has key "'+this.PARSETMP_.Key+'", but no value.');this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(l=="="){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_VALUE;this.PARSETMP_.Value="";this.VALBRACES_={'"':[],"{":[]}}break;case this.STATES_.KV_VALUE:var k=this.VALBRACES_;var j=this.PARSETMP_.Value;var h=false;if(l=='"'||l=="{"||l=="}"||l==","){if(l==","){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}h=true}}if(l=='"'){if(0===k['"'].length+k["{"].length){k['"'].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false;break}if(k['"'].length==1&&k["{"].length==0&&(j.length==0||j[j.length-1]!="\\")){h=true}else{}}if(l=="{"){if(j.length==0||j[j.length-1]!="\\"){k["{"].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{}}if(l=="}"){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}f=true;h=true}else{if(j.length==0||j[j.length-1]!="\\"){if(k["{"].length>0){k["{"].splice(k["{"].length-1,1);if(0==k["{"].length+k['"'].length){h=true}else{}}}else{}}}}if(h){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_KEY;this.DATA_.Fields[this.PARSETMP_.Key]=this.PARSETMP_.Value;this.PARSETMP_={Key:""};this.VALBRACES_=null}else{this.PARSETMP_.Value+=l}break}}};this.CHARCONV_=[[/\\space /g,"\u0020"],[/\\textdollar /g,"\u0024"],[/\\textquotesingle /g,"\u0027"],[/\\ast /g,"\u002A"],[/\\textbackslash /g,"\u005C"],[/\\\^\{\}/g,"\u005E"],[/\\textasciigrave /g,"\u0060"],[/\\lbrace /g,"\u007B"],[/\\vert /g,"\u007C"],[/\\rbrace /g,"\u007D"],[/\\textasciitilde /g,"\u007E"],[/\\textexclamdown /g,"\u00A1"],[/\\textcent /g,"\u00A2"],[/\\textsterling /g,"\u00A3"],[/\\textcurrency /g,"\u00A4"],[/\\textyen /g,"\u00A5"],[/\\textbrokenbar /g,"\u00A6"],[/\\textsection /g,"\u00A7"],[/\\textasciidieresis /g,"\u00A8"],[/\\textcopyright /g,"\u00A9"],[/\\textordfeminine /g,"\u00AA"],[/\\guillemotleft /g,"\u00AB"],[/\\lnot /g,"\u00AC"],[/\\textregistered /g,"\u00AE"],[/\\textasciimacron /g,"\u00AF"],[/\\textdegree /g,"\u00B0"],[/\\pm /g,"\u00B1"],[/\\textasciiacute /g,"\u00B4"],[/\\mathrm\{\\mu\}/g,"\u00B5"],[/\\textparagraph /g,"\u00B6"],[/\\cdot /g,"\u00B7"],[/\\c\{\}/g,"\u00B8"],[/\\textordmasculine /g,"\u00BA"],[/\\guillemotright /g,"\u00BB"],[/\\textonequarter /g,"\u00BC"],[/\\textonehalf /g,"\u00BD"],[/\\textthreequarters /g,"\u00BE"],[/\\textquestiondown /g,"\u00BF"],[/\\`\{A\}/g,"\u00C0"],[/\\'\{A\}/g,"\u00C1"],[/\\\^\{A\}/g,"\u00C2"],[/\\~\{A\}/g,"\u00C3"],[/\\"\{A\}/g,"\u00C4"],[/\\AA /g,"\u00C5"],[/\\AE /g,"\u00C6"],[/\\c\{C\}/g,"\u00C7"],[/\\`\{E\}/g,"\u00C8"],[/\\'\{E\}/g,"\u00C9"],[/\\\^\{E\}/g,"\u00CA"],[/\\"\{E\}/g,"\u00CB"],[/\\`\{I\}/g,"\u00CC"],[/\\'\{I\}/g,"\u00CD"],[/\\\^\{I\}/g,"\u00CE"],[/\\"\{I\}/g,"\u00CF"],[/\\DH /g,"\u00D0"],[/\\~\{N\}/g,"\u00D1"],[/\\`\{O\}/g,"\u00D2"],[/\\'\{O\}/g,"\u00D3"],[/\\\^\{O\}/g,"\u00D4"],[/\\~\{O\}/g,"\u00D5"],[/\\"\{O\}/g,"\u00D6"],[/\\texttimes /g,"\u00D7"],[/\\O /g,"\u00D8"],[/\\`\{U\}/g,"\u00D9"],[/\\'\{U\}/g,"\u00DA"],[/\\\^\{U\}/g,"\u00DB"],[/\\"\{U\}/g,"\u00DC"],[/\\'\{Y\}/g,"\u00DD"],[/\\TH /g,"\u00DE"],[/\\ss /g,"\u00DF"],[/\\`\{a\}/g,"\u00E0"],[/\\'\{a\}/g,"\u00E1"],[/\\\^\{a\}/g,"\u00E2"],[/\\~\{a\}/g,"\u00E3"],[/\\"\{a\}/g,"\u00E4"],[/\\aa /g,"\u00E5"],[/\\ae /g,"\u00E6"],[/\\c\{c\}/g,"\u00E7"],[/\\`\{e\}/g,"\u00E8"],[/\\'\{e\}/g,"\u00E9"],[/\\\^\{e\}/g,"\u00EA"],[/\\"\{e\}/g,"\u00EB"],[/\\`\{\\i\}/g,"\u00EC"],[/\\'\{\\i\}/g,"\u00ED"],[/\\\^\{\\i\}/g,"\u00EE"],[/\\"\{\\i\}/g,"\u00EF"],[/\\dh /g,"\u00F0"],[/\\~\{n\}/g,"\u00F1"],[/\\`\{o\}/g,"\u00F2"],[/\\'\{o\}/g,"\u00F3"],[/\\\^\{o\}/g,"\u00F4"],[/\\~\{o\}/g,"\u00F5"],[/\\"\{o\}/g,"\u00F6"],[/\\div /g,"\u00F7"],[/\\o /g,"\u00F8"],[/\\`\{u\}/g,"\u00F9"],[/\\'\{u\}/g,"\u00FA"],[/\\\^\{u\}/g,"\u00FB"],[/\\"\{u\}/g,"\u00FC"],[/\\'\{y\}/g,"\u00FD"],[/\\th /g,"\u00FE"],[/\\"\{y\}/g,"\u00FF"],[/\\=\{A\}/g,"\u0100"],[/\\=\{a\}/g,"\u0101"],[/\\u\{A\}/g,"\u0102"],[/\\u\{a\}/g,"\u0103"],[/\\k\{A\}/g,"\u0104"],[/\\k\{a\}/g,"\u0105"],[/\\'\{C\}/g,"\u0106"],[/\\'\{c\}/g,"\u0107"],[/\\\^\{C\}/g,"\u0108"],[/\\\^\{c\}/g,"\u0109"],[/\\.\{C\}/g,"\u010A"],[/\\.\{c\}/g,"\u010B"],[/\\v\{C\}/g,"\u010C"],[/\\v\{c\}/g,"\u010D"],[/\\v\{D\}/g,"\u010E"],[/\\v\{d\}/g,"\u010F"],[/\\DJ /g,"\u0110"],[/\\dj /g,"\u0111"],[/\\=\{E\}/g,"\u0112"],[/\\=\{e\}/g,"\u0113"],[/\\u\{E\}/g,"\u0114"],[/\\u\{e\}/g,"\u0115"],[/\\.\{E\}/g,"\u0116"],[/\\.\{e\}/g,"\u0117"],[/\\k\{E\}/g,"\u0118"],[/\\k\{e\}/g,"\u0119"],[/\\v\{E\}/g,"\u011A"],[/\\v\{e\}/g,"\u011B"],[/\\\^\{G\}/g,"\u011C"],[/\\\^\{g\}/g,"\u011D"],[/\\u\{G\}/g,"\u011E"],[/\\u\{g\}/g,"\u011F"],[/\\.\{G\}/g,"\u0120"],[/\\.\{g\}/g,"\u0121"],[/\\c\{G\}/g,"\u0122"],[/\\c\{g\}/g,"\u0123"],[/\\\^\{H\}/g,"\u0124"],[/\\\^\{h\}/g,"\u0125"],[/\\Elzxh /g,"\u0127"],[/\\~\{I\}/g,"\u0128"],[/\\~\{\\i\}/g,"\u0129"],[/\\=\{I\}/g,"\u012A"],[/\\=\{\\i\}/g,"\u012B"],[/\\u\{I\}/g,"\u012C"],[/\\u\{\\i\}/g,"\u012D"],[/\\k\{I\}/g,"\u012E"],[/\\k\{i\}/g,"\u012F"],[/\\.\{I\}/g,"\u0130"],[/\\i /g,"\u0131"],[/\\\^\{J\}/g,"\u0134"],[/\\\^\{\\j\}/g,"\u0135"],[/\\c\{K\}/g,"\u0136"],[/\\c\{k\}/g,"\u0137"],[/\\'\{L\}/g,"\u0139"],[/\\'\{l\}/g,"\u013A"],[/\\c\{L\}/g,"\u013B"],[/\\c\{l\}/g,"\u013C"],[/\\v\{L\}/g,"\u013D"],[/\\v\{l\}/g,"\u013E"],[/\\L /g,"\u0141"],[/\\l /g,"\u0142"],[/\\'\{N\}/g,"\u0143"],[/\\'\{n\}/g,"\u0144"],[/\\c\{N\}/g,"\u0145"],[/\\c\{n\}/g,"\u0146"],[/\\v\{N\}/g,"\u0147"],[/\\v\{n\}/g,"\u0148"],[/\\NG /g,"\u014A"],[/\\ng /g,"\u014B"],[/\\=\{O\}/g,"\u014C"],[/\\=\{o\}/g,"\u014D"],[/\\u\{O\}/g,"\u014E"],[/\\u\{o\}/g,"\u014F"],[/\\H\{O\}/g,"\u0150"],[/\\H\{o\}/g,"\u0151"],[/\\OE /g,"\u0152"],[/\\oe /g,"\u0153"],[/\\'\{R\}/g,"\u0154"],[/\\'\{r\}/g,"\u0155"],[/\\c\{R\}/g,"\u0156"],[/\\c\{r\}/g,"\u0157"],[/\\v\{R\}/g,"\u0158"],[/\\v\{r\}/g,"\u0159"],[/\\'\{S\}/g,"\u015A"],[/\\'\{s\}/g,"\u015B"],[/\\\^\{S\}/g,"\u015C"],[/\\\^\{s\}/g,"\u015D"],[/\\c\{S\}/g,"\u015E"],[/\\c\{s\}/g,"\u015F"],[/\\v\{S\}/g,"\u0160"],[/\\v\{s\}/g,"\u0161"],[/\\c\{T\}/g,"\u0162"],[/\\c\{t\}/g,"\u0163"],[/\\v\{T\}/g,"\u0164"],[/\\v\{t\}/g,"\u0165"],[/\\~\{U\}/g,"\u0168"],[/\\~\{u\}/g,"\u0169"],[/\\=\{U\}/g,"\u016A"],[/\\=\{u\}/g,"\u016B"],[/\\u\{U\}/g,"\u016C"],[/\\u\{u\}/g,"\u016D"],[/\\r\{U\}/g,"\u016E"],[/\\r\{u\}/g,"\u016F"],[/\\H\{U\}/g,"\u0170"],[/\\H\{u\}/g,"\u0171"],[/\\k\{U\}/g,"\u0172"],[/\\k\{u\}/g,"\u0173"],[/\\\^\{W\}/g,"\u0174"],[/\\\^\{w\}/g,"\u0175"],[/\\\^\{Y\}/g,"\u0176"],[/\\\^\{y\}/g,"\u0177"],[/\\"\{Y\}/g,"\u0178"],[/\\'\{Z\}/g,"\u0179"],[/\\'\{z\}/g,"\u017A"],[/\\.\{Z\}/g,"\u017B"],[/\\.\{z\}/g,"\u017C"],[/\\v\{Z\}/g,"\u017D"],[/\\v\{z\}/g,"\u017E"],[/\\texthvlig /g,"\u0195"],[/\\textnrleg /g,"\u019E"],[/\\eth /g,"\u01AA"],[/\\textdoublepipe /g,"\u01C2"],[/\\'\{g\}/g,"\u01F5"],[/\\Elztrna /g,"\u0250"],[/\\Elztrnsa /g,"\u0252"],[/\\Elzopeno /g,"\u0254"],[/\\Elzrtld /g,"\u0256"],[/\\Elzschwa /g,"\u0259"],[/\\varepsilon /g,"\u025B"],[/\\Elzpgamma /g,"\u0263"],[/\\Elzpbgam /g,"\u0264"],[/\\Elztrnh /g,"\u0265"],[/\\Elzbtdl /g,"\u026C"],[/\\Elzrtll /g,"\u026D"],[/\\Elztrnm /g,"\u026F"],[/\\Elztrnmlr /g,"\u0270"],[/\\Elzltlmr /g,"\u0271"],[/\\Elzltln /g,"\u0272"],[/\\Elzrtln /g,"\u0273"],[/\\Elzclomeg /g,"\u0277"],[/\\textphi /g,"\u0278"],[/\\Elztrnr /g,"\u0279"],[/\\Elztrnrl /g,"\u027A"],[/\\Elzrttrnr /g,"\u027B"],[/\\Elzrl /g,"\u027C"],[/\\Elzrtlr /g,"\u027D"],[/\\Elzfhr /g,"\u027E"],[/\\Elzrtls /g,"\u0282"],[/\\Elzesh /g,"\u0283"],[/\\Elztrnt /g,"\u0287"],[/\\Elzrtlt /g,"\u0288"],[/\\Elzpupsil /g,"\u028A"],[/\\Elzpscrv /g,"\u028B"],[/\\Elzinvv /g,"\u028C"],[/\\Elzinvw /g,"\u028D"],[/\\Elztrny /g,"\u028E"],[/\\Elzrtlz /g,"\u0290"],[/\\Elzyogh /g,"\u0292"],[/\\Elzglst /g,"\u0294"],[/\\Elzreglst /g,"\u0295"],[/\\Elzinglst /g,"\u0296"],[/\\textturnk /g,"\u029E"],[/\\Elzdyogh /g,"\u02A4"],[/\\Elztesh /g,"\u02A7"],[/\\textasciicaron /g,"\u02C7"],[/\\Elzverts /g,"\u02C8"],[/\\Elzverti /g,"\u02CC"],[/\\Elzlmrk /g,"\u02D0"],[/\\Elzhlmrk /g,"\u02D1"],[/\\Elzsbrhr /g,"\u02D2"],[/\\Elzsblhr /g,"\u02D3"],[/\\Elzrais /g,"\u02D4"],[/\\Elzlow /g,"\u02D5"],[/\\textasciibreve /g,"\u02D8"],[/\\textperiodcentered /g,"\u02D9"],[/\\r\{\}/g,"\u02DA"],[/\\k\{\}/g,"\u02DB"],[/\\texttildelow /g,"\u02DC"],[/\\H\{\}/g,"\u02DD"],[/\\tone\{55\}/g,"\u02E5"],[/\\tone\{44\}/g,"\u02E6"],[/\\tone\{33\}/g,"\u02E7"],[/\\tone\{22\}/g,"\u02E8"],[/\\tone\{11\}/g,"\u02E9"],[/\\cyrchar\\C/g,"\u030F"],[/\\Elzpalh /g,"\u0321"],[/\\Elzrh /g,"\u0322"],[/\\Elzsbbrg /g,"\u032A"],[/\\Elzxl /g,"\u0335"],[/\\Elzbar /g,"\u0336"],[/\\'\{A\}/g,"\u0386"],[/\\'\{E\}/g,"\u0388"],[/\\'\{H\}/g,"\u0389"],[/\\'\{\}\{I\}/g,"\u038A"],[/\\'\{\}O/g,"\u038C"],[/\\mathrm\{'Y\}/g,"\u038E"],[/\\mathrm\{'\\Omega\}/g,"\u038F"],[/\\acute\{\\ddot\{\\iota\}\}/g,"\u0390"],[/\\Alpha /g,"\u0391"],[/\\Beta /g,"\u0392"],[/\\Gamma /g,"\u0393"],[/\\Delta /g,"\u0394"],[/\\Epsilon /g,"\u0395"],[/\\Zeta /g,"\u0396"],[/\\Eta /g,"\u0397"],[/\\Theta /g,"\u0398"],[/\\Iota /g,"\u0399"],[/\\Kappa /g,"\u039A"],[/\\Lambda /g,"\u039B"],[/\\Xi /g,"\u039E"],[/\\Pi /g,"\u03A0"],[/\\Rho /g,"\u03A1"],[/\\Sigma /g,"\u03A3"],[/\\Tau /g,"\u03A4"],[/\\Upsilon /g,"\u03A5"],[/\\Phi /g,"\u03A6"],[/\\Chi /g,"\u03A7"],[/\\Psi /g,"\u03A8"],[/\\Omega /g,"\u03A9"],[/\\mathrm\{\\ddot\{I\}\}/g,"\u03AA"],[/\\mathrm\{\\ddot\{Y\}\}/g,"\u03AB"],[/\\'\{\$\\alpha\$\}/g,"\u03AC"],[/\\acute\{\\epsilon\}/g,"\u03AD"],[/\\acute\{\\eta\}/g,"\u03AE"],[/\\acute\{\\iota\}/g,"\u03AF"],[/\\acute\{\\ddot\{\\upsilon\}\}/g,"\u03B0"],[/\\alpha /g,"\u03B1"],[/\\beta /g,"\u03B2"],[/\\gamma /g,"\u03B3"],[/\\delta /g,"\u03B4"],[/\\epsilon /g,"\u03B5"],[/\\zeta /g,"\u03B6"],[/\\eta /g,"\u03B7"],[/\\texttheta /g,"\u03B8"],[/\\iota /g,"\u03B9"],[/\\kappa /g,"\u03BA"],[/\\lambda /g,"\u03BB"],[/\\mu /g,"\u03BC"],[/\\nu /g,"\u03BD"],[/\\xi /g,"\u03BE"],[/\\pi /g,"\u03C0"],[/\\rho /g,"\u03C1"],[/\\varsigma /g,"\u03C2"],[/\\sigma /g,"\u03C3"],[/\\tau /g,"\u03C4"],[/\\upsilon /g,"\u03C5"],[/\\varphi /g,"\u03C6"],[/\\chi /g,"\u03C7"],[/\\psi /g,"\u03C8"],[/\\omega /g,"\u03C9"],[/\\ddot\{\\iota\}/g,"\u03CA"],[/\\ddot\{\\upsilon\}/g,"\u03CB"],[/\\'\{o\}/g,"\u03CC"],[/\\acute\{\\upsilon\}/g,"\u03CD"],[/\\acute\{\\omega\}/g,"\u03CE"],[/\\Pisymbol\{ppi022\}\{87\}/g,"\u03D0"],[/\\textvartheta /g,"\u03D1"],[/\\Upsilon /g,"\u03D2"],[/\\phi /g,"\u03D5"],[/\\varpi /g,"\u03D6"],[/\\Stigma /g,"\u03DA"],[/\\Digamma /g,"\u03DC"],[/\\digamma /g,"\u03DD"],[/\\Koppa /g,"\u03DE"],[/\\Sampi /g,"\u03E0"],[/\\varkappa /g,"\u03F0"],[/\\varrho /g,"\u03F1"],[/\\textTheta /g,"\u03F4"],[/\\backepsilon /g,"\u03F6"],[/\\cyrchar\\CYRYO /g,"\u0401"],[/\\cyrchar\\CYRDJE /g,"\u0402"],[/\\cyrchar\{\\'\\CYRG\}/g,"\u0403"],[/\\cyrchar\\CYRIE /g,"\u0404"],[/\\cyrchar\\CYRDZE /g,"\u0405"],[/\\cyrchar\\CYRII /g,"\u0406"],[/\\cyrchar\\CYRYI /g,"\u0407"],[/\\cyrchar\\CYRJE /g,"\u0408"],[/\\cyrchar\\CYRLJE /g,"\u0409"],[/\\cyrchar\\CYRNJE /g,"\u040A"],[/\\cyrchar\\CYRTSHE /g,"\u040B"],[/\\cyrchar\{\\'\\CYRK\}/g,"\u040C"],[/\\cyrchar\\CYRUSHRT /g,"\u040E"],[/\\cyrchar\\CYRDZHE /g,"\u040F"],[/\\cyrchar\\CYRA /g,"\u0410"],[/\\cyrchar\\CYRB /g,"\u0411"],[/\\cyrchar\\CYRV /g,"\u0412"],[/\\cyrchar\\CYRG /g,"\u0413"],[/\\cyrchar\\CYRD /g,"\u0414"],[/\\cyrchar\\CYRE /g,"\u0415"],[/\\cyrchar\\CYRZH /g,"\u0416"],[/\\cyrchar\\CYRZ /g,"\u0417"],[/\\cyrchar\\CYRI /g,"\u0418"],[/\\cyrchar\\CYRISHRT /g,"\u0419"],[/\\cyrchar\\CYRK /g,"\u041A"],[/\\cyrchar\\CYRL /g,"\u041B"],[/\\cyrchar\\CYRM /g,"\u041C"],[/\\cyrchar\\CYRN /g,"\u041D"],[/\\cyrchar\\CYRO /g,"\u041E"],[/\\cyrchar\\CYRP /g,"\u041F"],[/\\cyrchar\\CYRR /g,"\u0420"],[/\\cyrchar\\CYRS /g,"\u0421"],[/\\cyrchar\\CYRT /g,"\u0422"],[/\\cyrchar\\CYRU /g,"\u0423"],[/\\cyrchar\\CYRF /g,"\u0424"],[/\\cyrchar\\CYRH /g,"\u0425"],[/\\cyrchar\\CYRC /g,"\u0426"],[/\\cyrchar\\CYRCH /g,"\u0427"],[/\\cyrchar\\CYRSH /g,"\u0428"],[/\\cyrchar\\CYRSHCH /g,"\u0429"],[/\\cyrchar\\CYRHRDSN /g,"\u042A"],[/\\cyrchar\\CYRERY /g,"\u042B"],[/\\cyrchar\\CYRSFTSN /g,"\u042C"],[/\\cyrchar\\CYREREV /g,"\u042D"],[/\\cyrchar\\CYRYU /g,"\u042E"],[/\\cyrchar\\CYRYA /g,"\u042F"],[/\\cyrchar\\cyra /g,"\u0430"],[/\\cyrchar\\cyrb /g,"\u0431"],[/\\cyrchar\\cyrv /g,"\u0432"],[/\\cyrchar\\cyrg /g,"\u0433"],[/\\cyrchar\\cyrd /g,"\u0434"],[/\\cyrchar\\cyre /g,"\u0435"],[/\\cyrchar\\cyrzh /g,"\u0436"],[/\\cyrchar\\cyrz /g,"\u0437"],[/\\cyrchar\\cyri /g,"\u0438"],[/\\cyrchar\\cyrishrt /g,"\u0439"],[/\\cyrchar\\cyrk /g,"\u043A"],[/\\cyrchar\\cyrl /g,"\u043B"],[/\\cyrchar\\cyrm /g,"\u043C"],[/\\cyrchar\\cyrn /g,"\u043D"],[/\\cyrchar\\cyro /g,"\u043E"],[/\\cyrchar\\cyrp /g,"\u043F"],[/\\cyrchar\\cyrr /g,"\u0440"],[/\\cyrchar\\cyrs /g,"\u0441"],[/\\cyrchar\\cyrt /g,"\u0442"],[/\\cyrchar\\cyru /g,"\u0443"],[/\\cyrchar\\cyrf /g,"\u0444"],[/\\cyrchar\\cyrh /g,"\u0445"],[/\\cyrchar\\cyrc /g,"\u0446"],[/\\cyrchar\\cyrch /g,"\u0447"],[/\\cyrchar\\cyrsh /g,"\u0448"],[/\\cyrchar\\cyrshch /g,"\u0449"],[/\\cyrchar\\cyrhrdsn /g,"\u044A"],[/\\cyrchar\\cyrery /g,"\u044B"],[/\\cyrchar\\cyrsftsn /g,"\u044C"],[/\\cyrchar\\cyrerev /g,"\u044D"],[/\\cyrchar\\cyryu /g,"\u044E"],[/\\cyrchar\\cyrya /g,"\u044F"],[/\\cyrchar\\cyryo /g,"\u0451"],[/\\cyrchar\\cyrdje /g,"\u0452"],[/\\cyrchar\{\\'\\cyrg\}/g,"\u0453"],[/\\cyrchar\\cyrie /g,"\u0454"],[/\\cyrchar\\cyrdze /g,"\u0455"],[/\\cyrchar\\cyrii /g,"\u0456"],[/\\cyrchar\\cyryi /g,"\u0457"],[/\\cyrchar\\cyrje /g,"\u0458"],[/\\cyrchar\\cyrlje /g,"\u0459"],[/\\cyrchar\\cyrnje /g,"\u045A"],[/\\cyrchar\\cyrtshe /g,"\u045B"],[/\\cyrchar\{\\'\\cyrk\}/g,"\u045C"],[/\\cyrchar\\cyrushrt /g,"\u045E"],[/\\cyrchar\\cyrdzhe /g,"\u045F"],[/\\cyrchar\\CYROMEGA /g,"\u0460"],[/\\cyrchar\\cyromega /g,"\u0461"],[/\\cyrchar\\CYRYAT /g,"\u0462"],[/\\cyrchar\\CYRIOTE /g,"\u0464"],[/\\cyrchar\\cyriote /g,"\u0465"],[/\\cyrchar\\CYRLYUS /g,"\u0466"],[/\\cyrchar\\cyrlyus /g,"\u0467"],[/\\cyrchar\\CYRIOTLYUS /g,"\u0468"],[/\\cyrchar\\cyriotlyus /g,"\u0469"],[/\\cyrchar\\CYRBYUS /g,"\u046A"],[/\\cyrchar\\CYRIOTBYUS /g,"\u046C"],[/\\cyrchar\\cyriotbyus /g,"\u046D"],[/\\cyrchar\\CYRKSI /g,"\u046E"],[/\\cyrchar\\cyrksi /g,"\u046F"],[/\\cyrchar\\CYRPSI /g,"\u0470"],[/\\cyrchar\\cyrpsi /g,"\u0471"],[/\\cyrchar\\CYRFITA /g,"\u0472"],[/\\cyrchar\\CYRIZH /g,"\u0474"],[/\\cyrchar\\CYRUK /g,"\u0478"],[/\\cyrchar\\cyruk /g,"\u0479"],[/\\cyrchar\\CYROMEGARND /g,"\u047A"],[/\\cyrchar\\cyromegarnd /g,"\u047B"],[/\\cyrchar\\CYROMEGATITLO /g,"\u047C"],[/\\cyrchar\\cyromegatitlo /g,"\u047D"],[/\\cyrchar\\CYROT /g,"\u047E"],[/\\cyrchar\\cyrot /g,"\u047F"],[/\\cyrchar\\CYRKOPPA /g,"\u0480"],[/\\cyrchar\\cyrkoppa /g,"\u0481"],[/\\cyrchar\\cyrthousands /g,"\u0482"],[/\\cyrchar\\cyrhundredthousands /g,"\u0488"],[/\\cyrchar\\cyrmillions /g,"\u0489"],[/\\cyrchar\\CYRSEMISFTSN /g,"\u048C"],[/\\cyrchar\\cyrsemisftsn /g,"\u048D"],[/\\cyrchar\\CYRRTICK /g,"\u048E"],[/\\cyrchar\\cyrrtick /g,"\u048F"],[/\\cyrchar\\CYRGUP /g,"\u0490"],[/\\cyrchar\\cyrgup /g,"\u0491"],[/\\cyrchar\\CYRGHCRS /g,"\u0492"],[/\\cyrchar\\cyrghcrs /g,"\u0493"],[/\\cyrchar\\CYRGHK /g,"\u0494"],[/\\cyrchar\\cyrghk /g,"\u0495"],[/\\cyrchar\\CYRZHDSC /g,"\u0496"],[/\\cyrchar\\cyrzhdsc /g,"\u0497"],[/\\cyrchar\\CYRZDSC /g,"\u0498"],[/\\cyrchar\\cyrzdsc /g,"\u0499"],[/\\cyrchar\\CYRKDSC /g,"\u049A"],[/\\cyrchar\\cyrkdsc /g,"\u049B"],[/\\cyrchar\\CYRKVCRS /g,"\u049C"],[/\\cyrchar\\cyrkvcrs /g,"\u049D"],[/\\cyrchar\\CYRKHCRS /g,"\u049E"],[/\\cyrchar\\cyrkhcrs /g,"\u049F"],[/\\cyrchar\\CYRKBEAK /g,"\u04A0"],[/\\cyrchar\\cyrkbeak /g,"\u04A1"],[/\\cyrchar\\CYRNDSC /g,"\u04A2"],[/\\cyrchar\\cyrndsc /g,"\u04A3"],[/\\cyrchar\\CYRNG /g,"\u04A4"],[/\\cyrchar\\cyrng /g,"\u04A5"],[/\\cyrchar\\CYRPHK /g,"\u04A6"],[/\\cyrchar\\cyrphk /g,"\u04A7"],[/\\cyrchar\\CYRABHHA /g,"\u04A8"],[/\\cyrchar\\cyrabhha /g,"\u04A9"],[/\\cyrchar\\CYRSDSC /g,"\u04AA"],[/\\cyrchar\\cyrsdsc /g,"\u04AB"],[/\\cyrchar\\CYRTDSC /g,"\u04AC"],[/\\cyrchar\\cyrtdsc /g,"\u04AD"],[/\\cyrchar\\CYRY /g,"\u04AE"],[/\\cyrchar\\cyry /g,"\u04AF"],[/\\cyrchar\\CYRYHCRS /g,"\u04B0"],[/\\cyrchar\\cyryhcrs /g,"\u04B1"],[/\\cyrchar\\CYRHDSC /g,"\u04B2"],[/\\cyrchar\\cyrhdsc /g,"\u04B3"],[/\\cyrchar\\CYRTETSE /g,"\u04B4"],[/\\cyrchar\\cyrtetse /g,"\u04B5"],[/\\cyrchar\\CYRCHRDSC /g,"\u04B6"],[/\\cyrchar\\cyrchrdsc /g,"\u04B7"],[/\\cyrchar\\CYRCHVCRS /g,"\u04B8"],[/\\cyrchar\\cyrchvcrs /g,"\u04B9"],[/\\cyrchar\\CYRSHHA /g,"\u04BA"],[/\\cyrchar\\cyrshha /g,"\u04BB"],[/\\cyrchar\\CYRABHCH /g,"\u04BC"],[/\\cyrchar\\cyrabhch /g,"\u04BD"],[/\\cyrchar\\CYRABHCHDSC /g,"\u04BE"],[/\\cyrchar\\cyrabhchdsc /g,"\u04BF"],[/\\cyrchar\\CYRpalochka /g,"\u04C0"],[/\\cyrchar\\CYRKHK /g,"\u04C3"],[/\\cyrchar\\cyrkhk /g,"\u04C4"],[/\\cyrchar\\CYRNHK /g,"\u04C7"],[/\\cyrchar\\cyrnhk /g,"\u04C8"],[/\\cyrchar\\CYRCHLDSC /g,"\u04CB"],[/\\cyrchar\\cyrchldsc /g,"\u04CC"],[/\\cyrchar\\CYRAE /g,"\u04D4"],[/\\cyrchar\\cyrae /g,"\u04D5"],[/\\cyrchar\\CYRSCHWA /g,"\u04D8"],[/\\cyrchar\\cyrschwa /g,"\u04D9"],[/\\cyrchar\\CYRABHDZE /g,"\u04E0"],[/\\cyrchar\\cyrabhdze /g,"\u04E1"],[/\\cyrchar\\CYROTLD /g,"\u04E8"],[/\\cyrchar\\cyrotld /g,"\u04E9"],[/\\hspace\{0.6em\}/g,"\u2002"],[/\\hspace\{1em\}/g,"\u2003"],[/\\hspace\{0.33em\}/g,"\u2004"],[/\\hspace\{0.25em\}/g,"\u2005"],[/\\hspace\{0.166em\}/g,"\u2006"],[/\\hphantom\{0\}/g,"\u2007"],[/\\hphantom\{,\}/g,"\u2008"],[/\\hspace\{0.167em\}/g,"\u2009"],[/\\mkern1mu /g,"\u200A"],[/\\textendash /g,"\u2013"],[/\\textemdash /g,"\u2014"],[/\\rule\{1em\}\{1pt\}/g,"\u2015"],[/\\Vert /g,"\u2016"],[/\\Elzreapos /g,"\u201B"],[/\\textquotedblleft /g,"\u201C"],[/\\textquotedblright /g,"\u201D"],[/\\textdagger /g,"\u2020"],[/\\textdaggerdbl /g,"\u2021"],[/\\textbullet /g,"\u2022"],[/\\ldots /g,"\u2026"],[/\\textperthousand /g,"\u2030"],[/\\textpertenthousand /g,"\u2031"],[/\\backprime /g,"\u2035"],[/\\guilsinglleft /g,"\u2039"],[/\\guilsinglright /g,"\u203A"],[/\\mkern4mu /g,"\u205F"],[/\\nolinebreak /g,"\u2060"],[/\\ensuremath\{\\Elzpes\}/g,"\u20A7"],[/\\mbox\{\\texteuro\} /g,"\u20AC"],[/\\dddot /g,"\u20DB"],[/\\ddddot /g,"\u20DC"],[/\\mathbb\{C\}/g,"\u2102"],[/\\mathscr\{g\}/g,"\u210A"],[/\\mathscr\{H\}/g,"\u210B"],[/\\mathfrak\{H\}/g,"\u210C"],[/\\mathbb\{H\}/g,"\u210D"],[/\\hslash /g,"\u210F"],[/\\mathscr\{I\}/g,"\u2110"],[/\\mathfrak\{I\}/g,"\u2111"],[/\\mathscr\{L\}/g,"\u2112"],[/\\mathscr\{l\}/g,"\u2113"],[/\\mathbb\{N\}/g,"\u2115"],[/\\cyrchar\\textnumero /g,"\u2116"],[/\\wp /g,"\u2118"],[/\\mathbb\{P\}/g,"\u2119"],[/\\mathbb\{Q\}/g,"\u211A"],[/\\mathscr\{R\}/g,"\u211B"],[/\\mathfrak\{R\}/g,"\u211C"],[/\\mathbb\{R\}/g,"\u211D"],[/\\Elzxrat /g,"\u211E"],[/\\texttrademark /g,"\u2122"],[/\\mathbb\{Z\}/g,"\u2124"],[/\\Omega /g,"\u2126"],[/\\mho /g,"\u2127"],[/\\mathfrak\{Z\}/g,"\u2128"],[/\\ElsevierGlyph\{2129\}/g,"\u2129"],[/\\AA /g,"\u212B"],[/\\mathscr\{B\}/g,"\u212C"],[/\\mathfrak\{C\}/g,"\u212D"],[/\\mathscr\{e\}/g,"\u212F"],[/\\mathscr\{E\}/g,"\u2130"],[/\\mathscr\{F\}/g,"\u2131"],[/\\mathscr\{M\}/g,"\u2133"],[/\\mathscr\{o\}/g,"\u2134"],[/\\aleph /g,"\u2135"],[/\\beth /g,"\u2136"],[/\\gimel /g,"\u2137"],[/\\daleth /g,"\u2138"],[/\\textfrac\{1\}\{3\}/g,"\u2153"],[/\\textfrac\{2\}\{3\}/g,"\u2154"],[/\\textfrac\{1\}\{5\}/g,"\u2155"],[/\\textfrac\{2\}\{5\}/g,"\u2156"],[/\\textfrac\{3\}\{5\}/g,"\u2157"],[/\\textfrac\{4\}\{5\}/g,"\u2158"],[/\\textfrac\{1\}\{6\}/g,"\u2159"],[/\\textfrac\{5\}\{6\}/g,"\u215A"],[/\\textfrac\{1\}\{8\}/g,"\u215B"],[/\\textfrac\{3\}\{8\}/g,"\u215C"],[/\\textfrac\{5\}\{8\}/g,"\u215D"],[/\\textfrac\{7\}\{8\}/g,"\u215E"],[/\\leftarrow /g,"\u2190"],[/\\uparrow /g,"\u2191"],[/\\rightarrow /g,"\u2192"],[/\\downarrow /g,"\u2193"],[/\\leftrightarrow /g,"\u2194"],[/\\updownarrow /g,"\u2195"],[/\\nwarrow /g,"\u2196"],[/\\nearrow /g,"\u2197"],[/\\searrow /g,"\u2198"],[/\\swarrow /g,"\u2199"],[/\\nleftarrow /g,"\u219A"],[/\\nrightarrow /g,"\u219B"],[/\\arrowwaveright /g,"\u219C"],[/\\arrowwaveright /g,"\u219D"],[/\\twoheadleftarrow /g,"\u219E"],[/\\twoheadrightarrow /g,"\u21A0"],[/\\leftarrowtail /g,"\u21A2"],[/\\rightarrowtail /g,"\u21A3"],[/\\mapsto /g,"\u21A6"],[/\\hookleftarrow /g,"\u21A9"],[/\\hookrightarrow /g,"\u21AA"],[/\\looparrowleft /g,"\u21AB"],[/\\looparrowright /g,"\u21AC"],[/\\leftrightsquigarrow /g,"\u21AD"],[/\\nleftrightarrow /g,"\u21AE"],[/\\Lsh /g,"\u21B0"],[/\\Rsh /g,"\u21B1"],[/\\ElsevierGlyph\{21B3\}/g,"\u21B3"],[/\\curvearrowleft /g,"\u21B6"],[/\\curvearrowright /g,"\u21B7"],[/\\circlearrowleft /g,"\u21BA"],[/\\circlearrowright /g,"\u21BB"],[/\\leftharpoonup /g,"\u21BC"],[/\\leftharpoondown /g,"\u21BD"],[/\\upharpoonright /g,"\u21BE"],[/\\upharpoonleft /g,"\u21BF"],[/\\rightharpoonup /g,"\u21C0"],[/\\rightharpoondown /g,"\u21C1"],[/\\downharpoonright /g,"\u21C2"],[/\\downharpoonleft /g,"\u21C3"],[/\\rightleftarrows /g,"\u21C4"],[/\\dblarrowupdown /g,"\u21C5"],[/\\leftrightarrows /g,"\u21C6"],[/\\leftleftarrows /g,"\u21C7"],[/\\upuparrows /g,"\u21C8"],[/\\rightrightarrows /g,"\u21C9"],[/\\downdownarrows /g,"\u21CA"],[/\\leftrightharpoons /g,"\u21CB"],[/\\rightleftharpoons /g,"\u21CC"],[/\\nLeftarrow /g,"\u21CD"],[/\\nLeftrightarrow /g,"\u21CE"],[/\\nRightarrow /g,"\u21CF"],[/\\Leftarrow /g,"\u21D0"],[/\\Uparrow /g,"\u21D1"],[/\\Rightarrow /g,"\u21D2"],[/\\Downarrow /g,"\u21D3"],[/\\Leftrightarrow /g,"\u21D4"],[/\\Updownarrow /g,"\u21D5"],[/\\Lleftarrow /g,"\u21DA"],[/\\Rrightarrow /g,"\u21DB"],[/\\rightsquigarrow /g,"\u21DD"],[/\\DownArrowUpArrow /g,"\u21F5"],[/\\forall /g,"\u2200"],[/\\complement /g,"\u2201"],[/\\partial /g,"\u2202"],[/\\exists /g,"\u2203"],[/\\nexists /g,"\u2204"],[/\\varnothing /g,"\u2205"],[/\\nabla /g,"\u2207"],[/\\in /g,"\u2208"],[/\\not\\in /g,"\u2209"],[/\\ni /g,"\u220B"],[/\\not\\ni /g,"\u220C"],[/\\prod /g,"\u220F"],[/\\coprod /g,"\u2210"],[/\\sum /g,"\u2211"],[/\\mp /g,"\u2213"],[/\\dotplus /g,"\u2214"],[/\\setminus /g,"\u2216"],[/\\circ /g,"\u2218"],[/\\bullet /g,"\u2219"],[/\\surd /g,"\u221A"],[/\\propto /g,"\u221D"],[/\\infty /g,"\u221E"],[/\\rightangle /g,"\u221F"],[/\\angle /g,"\u2220"],[/\\measuredangle /g,"\u2221"],[/\\sphericalangle /g,"\u2222"],[/\\mid /g,"\u2223"],[/\\nmid /g,"\u2224"],[/\\parallel /g,"\u2225"],[/\\nparallel /g,"\u2226"],[/\\wedge /g,"\u2227"],[/\\vee /g,"\u2228"],[/\\cap /g,"\u2229"],[/\\cup /g,"\u222A"],[/\\int /g,"\u222B"],[/\\int\\!\\int /g,"\u222C"],[/\\int\\!\\int\\!\\int /g,"\u222D"],[/\\oint /g,"\u222E"],[/\\surfintegral /g,"\u222F"],[/\\volintegral /g,"\u2230"],[/\\clwintegral /g,"\u2231"],[/\\ElsevierGlyph\{2232\}/g,"\u2232"],[/\\ElsevierGlyph\{2233\}/g,"\u2233"],[/\\therefore /g,"\u2234"],[/\\because /g,"\u2235"],[/\\Colon /g,"\u2237"],[/\\ElsevierGlyph\{2238\}/g,"\u2238"],[/\\mathbin\{\{:\}\\!\\!\{\-\}\\!\\!\{:\}\}/g,"\u223A"],[/\\homothetic /g,"\u223B"],[/\\sim /g,"\u223C"],[/\\backsim /g,"\u223D"],[/\\lazysinv /g,"\u223E"],[/\\wr /g,"\u2240"],[/\\not\\sim /g,"\u2241"],[/\\ElsevierGlyph\{2242\}/g,"\u2242"],[/\\NotEqualTilde /g,"\u2242-00338"],[/\\simeq /g,"\u2243"],[/\\not\\simeq /g,"\u2244"],[/\\cong /g,"\u2245"],[/\\approxnotequal /g,"\u2246"],[/\\not\\cong /g,"\u2247"],[/\\approx /g,"\u2248"],[/\\not\\approx /g,"\u2249"],[/\\approxeq /g,"\u224A"],[/\\tildetrpl /g,"\u224B"],[/\\not\\apid /g,"\u224B-00338"],[/\\allequal /g,"\u224C"],[/\\asymp /g,"\u224D"],[/\\Bumpeq /g,"\u224E"],[/\\NotHumpDownHump /g,"\u224E-00338"],[/\\bumpeq /g,"\u224F"],[/\\NotHumpEqual /g,"\u224F-00338"],[/\\doteq /g,"\u2250"],[/\\not\\doteq/g,"\u2250-00338"],[/\\doteqdot /g,"\u2251"],[/\\fallingdotseq /g,"\u2252"],[/\\risingdotseq /g,"\u2253"],[/\\eqcirc /g,"\u2256"],[/\\circeq /g,"\u2257"],[/\\estimates /g,"\u2259"],[/\\ElsevierGlyph\{225A\}/g,"\u225A"],[/\\starequal /g,"\u225B"],[/\\triangleq /g,"\u225C"],[/\\ElsevierGlyph\{225F\}/g,"\u225F"],[/\\not =/g,"\u2260"],[/\\equiv /g,"\u2261"],[/\\not\\equiv /g,"\u2262"],[/\\leq /g,"\u2264"],[/\\geq /g,"\u2265"],[/\\leqq /g,"\u2266"],[/\\geqq /g,"\u2267"],[/\\lneqq /g,"\u2268"],[/\\lvertneqq /g,"\u2268-0FE00"],[/\\gneqq /g,"\u2269"],[/\\gvertneqq /g,"\u2269-0FE00"],[/\\ll /g,"\u226A"],[/\\NotLessLess /g,"\u226A-00338"],[/\\gg /g,"\u226B"],[/\\NotGreaterGreater /g,"\u226B-00338"],[/\\between /g,"\u226C"],[/\\not\\kern\-0.3em\\times /g,"\u226D"],[/\\not</g,"\u226E"],[/\\not>/g,"\u226F"],[/\\not\\leq /g,"\u2270"],[/\\not\\geq /g,"\u2271"],[/\\lessequivlnt /g,"\u2272"],[/\\greaterequivlnt /g,"\u2273"],[/\\ElsevierGlyph\{2274\}/g,"\u2274"],[/\\ElsevierGlyph\{2275\}/g,"\u2275"],[/\\lessgtr /g,"\u2276"],[/\\gtrless /g,"\u2277"],[/\\notlessgreater /g,"\u2278"],[/\\notgreaterless /g,"\u2279"],[/\\prec /g,"\u227A"],[/\\succ /g,"\u227B"],[/\\preccurlyeq /g,"\u227C"],[/\\succcurlyeq /g,"\u227D"],[/\\precapprox /g,"\u227E"],[/\\NotPrecedesTilde /g,"\u227E-00338"],[/\\succapprox /g,"\u227F"],[/\\NotSucceedsTilde /g,"\u227F-00338"],[/\\not\\prec /g,"\u2280"],[/\\not\\succ /g,"\u2281"],[/\\subset /g,"\u2282"],[/\\supset /g,"\u2283"],[/\\not\\subset /g,"\u2284"],[/\\not\\supset /g,"\u2285"],[/\\subseteq /g,"\u2286"],[/\\supseteq /g,"\u2287"],[/\\not\\subseteq /g,"\u2288"],[/\\not\\supseteq /g,"\u2289"],[/\\subsetneq /g,"\u228A"],[/\\varsubsetneqq /g,"\u228A-0FE00"],[/\\supsetneq /g,"\u228B"],[/\\varsupsetneq /g,"\u228B-0FE00"],[/\\uplus /g,"\u228E"],[/\\sqsubset /g,"\u228F"],[/\\NotSquareSubset /g,"\u228F-00338"],[/\\sqsupset /g,"\u2290"],[/\\NotSquareSuperset /g,"\u2290-00338"],[/\\sqsubseteq /g,"\u2291"],[/\\sqsupseteq /g,"\u2292"],[/\\sqcap /g,"\u2293"],[/\\sqcup /g,"\u2294"],[/\\oplus /g,"\u2295"],[/\\ominus /g,"\u2296"],[/\\otimes /g,"\u2297"],[/\\oslash /g,"\u2298"],[/\\odot /g,"\u2299"],[/\\circledcirc /g,"\u229A"],[/\\circledast /g,"\u229B"],[/\\circleddash /g,"\u229D"],[/\\boxplus /g,"\u229E"],[/\\boxminus /g,"\u229F"],[/\\boxtimes /g,"\u22A0"],[/\\boxdot /g,"\u22A1"],[/\\vdash /g,"\u22A2"],[/\\dashv /g,"\u22A3"],[/\\top /g,"\u22A4"],[/\\perp /g,"\u22A5"],[/\\truestate /g,"\u22A7"],[/\\forcesextra /g,"\u22A8"],[/\\Vdash /g,"\u22A9"],[/\\Vvdash /g,"\u22AA"],[/\\VDash /g,"\u22AB"],[/\\nvdash /g,"\u22AC"],[/\\nvDash /g,"\u22AD"],[/\\nVdash /g,"\u22AE"],[/\\nVDash /g,"\u22AF"],[/\\vartriangleleft /g,"\u22B2"],[/\\vartriangleright /g,"\u22B3"],[/\\trianglelefteq /g,"\u22B4"],[/\\trianglerighteq /g,"\u22B5"],[/\\original /g,"\u22B6"],[/\\image /g,"\u22B7"],[/\\multimap /g,"\u22B8"],[/\\hermitconjmatrix /g,"\u22B9"],[/\\intercal /g,"\u22BA"],[/\\veebar /g,"\u22BB"],[/\\rightanglearc /g,"\u22BE"],[/\\ElsevierGlyph\{22C0\}/g,"\u22C0"],[/\\ElsevierGlyph\{22C1\}/g,"\u22C1"],[/\\bigcap /g,"\u22C2"],[/\\bigcup /g,"\u22C3"],[/\\diamond /g,"\u22C4"],[/\\cdot /g,"\u22C5"],[/\\star /g,"\u22C6"],[/\\divideontimes /g,"\u22C7"],[/\\bowtie /g,"\u22C8"],[/\\ltimes /g,"\u22C9"],[/\\rtimes /g,"\u22CA"],[/\\leftthreetimes /g,"\u22CB"],[/\\rightthreetimes /g,"\u22CC"],[/\\backsimeq /g,"\u22CD"],[/\\curlyvee /g,"\u22CE"],[/\\curlywedge /g,"\u22CF"],[/\\Subset /g,"\u22D0"],[/\\Supset /g,"\u22D1"],[/\\Cap /g,"\u22D2"],[/\\Cup /g,"\u22D3"],[/\\pitchfork /g,"\u22D4"],[/\\lessdot /g,"\u22D6"],[/\\gtrdot /g,"\u22D7"],[/\\verymuchless /g,"\u22D8"],[/\\verymuchgreater /g,"\u22D9"],[/\\lesseqgtr /g,"\u22DA"],[/\\gtreqless /g,"\u22DB"],[/\\curlyeqprec /g,"\u22DE"],[/\\curlyeqsucc /g,"\u22DF"],[/\\not\\sqsubseteq /g,"\u22E2"],[/\\not\\sqsupseteq /g,"\u22E3"],[/\\Elzsqspne /g,"\u22E5"],[/\\lnsim /g,"\u22E6"],[/\\gnsim /g,"\u22E7"],[/\\precedesnotsimilar /g,"\u22E8"],[/\\succnsim /g,"\u22E9"],[/\\ntriangleleft /g,"\u22EA"],[/\\ntriangleright /g,"\u22EB"],[/\\ntrianglelefteq /g,"\u22EC"],[/\\ntrianglerighteq /g,"\u22ED"],[/\\vdots /g,"\u22EE"],[/\\cdots /g,"\u22EF"],[/\\upslopeellipsis /g,"\u22F0"],[/\\downslopeellipsis /g,"\u22F1"],[/\\barwedge /g,"\u2305"],[/\\perspcorrespond /g,"\u2306"],[/\\lceil /g,"\u2308"],[/\\rceil /g,"\u2309"],[/\\lfloor /g,"\u230A"],[/\\rfloor /g,"\u230B"],[/\\recorder /g,"\u2315"],[/\\mathchar"2208/g,"\u2316"],[/\\ulcorner /g,"\u231C"],[/\\urcorner /g,"\u231D"],[/\\llcorner /g,"\u231E"],[/\\lrcorner /g,"\u231F"],[/\\frown /g,"\u2322"],[/\\smile /g,"\u2323"],[/\\langle /g,"\u2329"],[/\\rangle /g,"\u232A"],[/\\ElsevierGlyph\{E838\}/g,"\u233D"],[/\\Elzdlcorn /g,"\u23A3"],[/\\lmoustache /g,"\u23B0"],[/\\rmoustache /g,"\u23B1"],[/\\textvisiblespace /g,"\u2423"],[/\\ding\{172\}/g,"\u2460"],[/\\ding\{173\}/g,"\u2461"],[/\\ding\{174\}/g,"\u2462"],[/\\ding\{175\}/g,"\u2463"],[/\\ding\{176\}/g,"\u2464"],[/\\ding\{177\}/g,"\u2465"],[/\\ding\{178\}/g,"\u2466"],[/\\ding\{179\}/g,"\u2467"],[/\\ding\{180\}/g,"\u2468"],[/\\ding\{181\}/g,"\u2469"],[/\\circledS /g,"\u24C8"],[/\\Elzdshfnc /g,"\u2506"],[/\\Elzsqfnw /g,"\u2519"],[/\\diagup /g,"\u2571"],[/\\ding\{110\}/g,"\u25A0"],[/\\square /g,"\u25A1"],[/\\blacksquare /g,"\u25AA"],[/\\fbox\{~~\}/g,"\u25AD"],[/\\Elzvrecto /g,"\u25AF"],[/\\ElsevierGlyph\{E381\}/g,"\u25B1"],[/\\ding\{115\}/g,"\u25B2"],[/\\bigtriangleup /g,"\u25B3"],[/\\blacktriangle /g,"\u25B4"],[/\\vartriangle /g,"\u25B5"],[/\\blacktriangleright /g,"\u25B8"],[/\\triangleright /g,"\u25B9"],[/\\ding\{116\}/g,"\u25BC"],[/\\bigtriangledown /g,"\u25BD"],[/\\blacktriangledown /g,"\u25BE"],[/\\triangledown /g,"\u25BF"],[/\\blacktriangleleft /g,"\u25C2"],[/\\triangleleft /g,"\u25C3"],[/\\ding\{117\}/g,"\u25C6"],[/\\lozenge /g,"\u25CA"],[/\\bigcirc /g,"\u25CB"],[/\\ding\{108\}/g,"\u25CF"],[/\\Elzcirfl /g,"\u25D0"],[/\\Elzcirfr /g,"\u25D1"],[/\\Elzcirfb /g,"\u25D2"],[/\\ding\{119\}/g,"\u25D7"],[/\\Elzrvbull /g,"\u25D8"],[/\\Elzsqfl /g,"\u25E7"],[/\\Elzsqfr /g,"\u25E8"],[/\\Elzsqfse /g,"\u25EA"],[/\\bigcirc /g,"\u25EF"],[/\\ding\{72\}/g,"\u2605"],[/\\ding\{73\}/g,"\u2606"],[/\\ding\{37\}/g,"\u260E"],[/\\ding\{42\}/g,"\u261B"],[/\\ding\{43\}/g,"\u261E"],[/\\rightmoon /g,"\u263E"],[/\\mercury /g,"\u263F"],[/\\venus /g,"\u2640"],[/\\male /g,"\u2642"],[/\\jupiter /g,"\u2643"],[/\\saturn /g,"\u2644"],[/\\uranus /g,"\u2645"],[/\\neptune /g,"\u2646"],[/\\pluto /g,"\u2647"],[/\\aries /g,"\u2648"],[/\\taurus /g,"\u2649"],[/\\gemini /g,"\u264A"],[/\\cancer /g,"\u264B"],[/\\leo /g,"\u264C"],[/\\virgo /g,"\u264D"],[/\\libra /g,"\u264E"],[/\\scorpio /g,"\u264F"],[/\\sagittarius /g,"\u2650"],[/\\capricornus /g,"\u2651"],[/\\aquarius /g,"\u2652"],[/\\pisces /g,"\u2653"],[/\\ding\{171\}/g,"\u2660"],[/\\diamond /g,"\u2662"],[/\\ding\{168\}/g,"\u2663"],[/\\ding\{170\}/g,"\u2665"],[/\\ding\{169\}/g,"\u2666"],[/\\quarternote /g,"\u2669"],[/\\eighthnote /g,"\u266A"],[/\\flat /g,"\u266D"],[/\\natural /g,"\u266E"],[/\\sharp /g,"\u266F"],[/\\ding\{33\}/g,"\u2701"],[/\\ding\{34\}/g,"\u2702"],[/\\ding\{35\}/g,"\u2703"],[/\\ding\{36\}/g,"\u2704"],[/\\ding\{38\}/g,"\u2706"],[/\\ding\{39\}/g,"\u2707"],[/\\ding\{40\}/g,"\u2708"],[/\\ding\{41\}/g,"\u2709"],[/\\ding\{44\}/g,"\u270C"],[/\\ding\{45\}/g,"\u270D"],[/\\ding\{46\}/g,"\u270E"],[/\\ding\{47\}/g,"\u270F"],[/\\ding\{48\}/g,"\u2710"],[/\\ding\{49\}/g,"\u2711"],[/\\ding\{50\}/g,"\u2712"],[/\\ding\{51\}/g,"\u2713"],[/\\ding\{52\}/g,"\u2714"],[/\\ding\{53\}/g,"\u2715"],[/\\ding\{54\}/g,"\u2716"],[/\\ding\{55\}/g,"\u2717"],[/\\ding\{56\}/g,"\u2718"],[/\\ding\{57\}/g,"\u2719"],[/\\ding\{58\}/g,"\u271A"],[/\\ding\{59\}/g,"\u271B"],[/\\ding\{60\}/g,"\u271C"],[/\\ding\{61\}/g,"\u271D"],[/\\ding\{62\}/g,"\u271E"],[/\\ding\{63\}/g,"\u271F"],[/\\ding\{64\}/g,"\u2720"],[/\\ding\{65\}/g,"\u2721"],[/\\ding\{66\}/g,"\u2722"],[/\\ding\{67\}/g,"\u2723"],[/\\ding\{68\}/g,"\u2724"],[/\\ding\{69\}/g,"\u2725"],[/\\ding\{70\}/g,"\u2726"],[/\\ding\{71\}/g,"\u2727"],[/\\ding\{73\}/g,"\u2729"],[/\\ding\{74\}/g,"\u272A"],[/\\ding\{75\}/g,"\u272B"],[/\\ding\{76\}/g,"\u272C"],[/\\ding\{77\}/g,"\u272D"],[/\\ding\{78\}/g,"\u272E"],[/\\ding\{79\}/g,"\u272F"],[/\\ding\{80\}/g,"\u2730"],[/\\ding\{81\}/g,"\u2731"],[/\\ding\{82\}/g,"\u2732"],[/\\ding\{83\}/g,"\u2733"],[/\\ding\{84\}/g,"\u2734"],[/\\ding\{85\}/g,"\u2735"],[/\\ding\{86\}/g,"\u2736"],[/\\ding\{87\}/g,"\u2737"],[/\\ding\{88\}/g,"\u2738"],[/\\ding\{89\}/g,"\u2739"],[/\\ding\{90\}/g,"\u273A"],[/\\ding\{91\}/g,"\u273B"],[/\\ding\{92\}/g,"\u273C"],[/\\ding\{93\}/g,"\u273D"],[/\\ding\{94\}/g,"\u273E"],[/\\ding\{95\}/g,"\u273F"],[/\\ding\{96\}/g,"\u2740"],[/\\ding\{97\}/g,"\u2741"],[/\\ding\{98\}/g,"\u2742"],[/\\ding\{99\}/g,"\u2743"],[/\\ding\{100\}/g,"\u2744"],[/\\ding\{101\}/g,"\u2745"],[/\\ding\{102\}/g,"\u2746"],[/\\ding\{103\}/g,"\u2747"],[/\\ding\{104\}/g,"\u2748"],[/\\ding\{105\}/g,"\u2749"],[/\\ding\{106\}/g,"\u274A"],[/\\ding\{107\}/g,"\u274B"],[/\\ding\{109\}/g,"\u274D"],[/\\ding\{111\}/g,"\u274F"],[/\\ding\{112\}/g,"\u2750"],[/\\ding\{113\}/g,"\u2751"],[/\\ding\{114\}/g,"\u2752"],[/\\ding\{118\}/g,"\u2756"],[/\\ding\{120\}/g,"\u2758"],[/\\ding\{121\}/g,"\u2759"],[/\\ding\{122\}/g,"\u275A"],[/\\ding\{123\}/g,"\u275B"],[/\\ding\{124\}/g,"\u275C"],[/\\ding\{125\}/g,"\u275D"],[/\\ding\{126\}/g,"\u275E"],[/\\ding\{161\}/g,"\u2761"],[/\\ding\{162\}/g,"\u2762"],[/\\ding\{163\}/g,"\u2763"],[/\\ding\{164\}/g,"\u2764"],[/\\ding\{165\}/g,"\u2765"],[/\\ding\{166\}/g,"\u2766"],[/\\ding\{167\}/g,"\u2767"],[/\\ding\{182\}/g,"\u2776"],[/\\ding\{183\}/g,"\u2777"],[/\\ding\{184\}/g,"\u2778"],[/\\ding\{185\}/g,"\u2779"],[/\\ding\{186\}/g,"\u277A"],[/\\ding\{187\}/g,"\u277B"],[/\\ding\{188\}/g,"\u277C"],[/\\ding\{189\}/g,"\u277D"],[/\\ding\{190\}/g,"\u277E"],[/\\ding\{191\}/g,"\u277F"],[/\\ding\{192\}/g,"\u2780"],[/\\ding\{193\}/g,"\u2781"],[/\\ding\{194\}/g,"\u2782"],[/\\ding\{195\}/g,"\u2783"],[/\\ding\{196\}/g,"\u2784"],[/\\ding\{197\}/g,"\u2785"],[/\\ding\{198\}/g,"\u2786"],[/\\ding\{199\}/g,"\u2787"],[/\\ding\{200\}/g,"\u2788"],[/\\ding\{201\}/g,"\u2789"],[/\\ding\{202\}/g,"\u278A"],[/\\ding\{203\}/g,"\u278B"],[/\\ding\{204\}/g,"\u278C"],[/\\ding\{205\}/g,"\u278D"],[/\\ding\{206\}/g,"\u278E"],[/\\ding\{207\}/g,"\u278F"],[/\\ding\{208\}/g,"\u2790"],[/\\ding\{209\}/g,"\u2791"],[/\\ding\{210\}/g,"\u2792"],[/\\ding\{211\}/g,"\u2793"],[/\\ding\{212\}/g,"\u2794"],[/\\ding\{216\}/g,"\u2798"],[/\\ding\{217\}/g,"\u2799"],[/\\ding\{218\}/g,"\u279A"],[/\\ding\{219\}/g,"\u279B"],[/\\ding\{220\}/g,"\u279C"],[/\\ding\{221\}/g,"\u279D"],[/\\ding\{222\}/g,"\u279E"],[/\\ding\{223\}/g,"\u279F"],[/\\ding\{224\}/g,"\u27A0"],[/\\ding\{225\}/g,"\u27A1"],[/\\ding\{226\}/g,"\u27A2"],[/\\ding\{227\}/g,"\u27A3"],[/\\ding\{228\}/g,"\u27A4"],[/\\ding\{229\}/g,"\u27A5"],[/\\ding\{230\}/g,"\u27A6"],[/\\ding\{231\}/g,"\u27A7"],[/\\ding\{232\}/g,"\u27A8"],[/\\ding\{233\}/g,"\u27A9"],[/\\ding\{234\}/g,"\u27AA"],[/\\ding\{235\}/g,"\u27AB"],[/\\ding\{236\}/g,"\u27AC"],[/\\ding\{237\}/g,"\u27AD"],[/\\ding\{238\}/g,"\u27AE"],[/\\ding\{239\}/g,"\u27AF"],[/\\ding\{241\}/g,"\u27B1"],[/\\ding\{242\}/g,"\u27B2"],[/\\ding\{243\}/g,"\u27B3"],[/\\ding\{244\}/g,"\u27B4"],[/\\ding\{245\}/g,"\u27B5"],[/\\ding\{246\}/g,"\u27B6"],[/\\ding\{247\}/g,"\u27B7"],[/\\ding\{248\}/g,"\u27B8"],[/\\ding\{249\}/g,"\u27B9"],[/\\ding\{250\}/g,"\u27BA"],[/\\ding\{251\}/g,"\u27BB"],[/\\ding\{252\}/g,"\u27BC"],[/\\ding\{253\}/g,"\u27BD"],[/\\ding\{254\}/g,"\u27BE"],[/\\longleftarrow /g,"\u27F5"],[/\\longrightarrow /g,"\u27F6"],[/\\longleftrightarrow /g,"\u27F7"],[/\\Longleftarrow /g,"\u27F8"],[/\\Longrightarrow /g,"\u27F9"],[/\\Longleftrightarrow /g,"\u27FA"],[/\\longmapsto /g,"\u27FC"],[/\\sim\\joinrel\\leadsto/g,"\u27FF"],[/\\ElsevierGlyph\{E212\}/g,"\u2905"],[/\\UpArrowBar /g,"\u2912"],[/\\DownArrowBar /g,"\u2913"],[/\\ElsevierGlyph\{E20C\}/g,"\u2923"],[/\\ElsevierGlyph\{E20D\}/g,"\u2924"],[/\\ElsevierGlyph\{E20B\}/g,"\u2925"],[/\\ElsevierGlyph\{E20A\}/g,"\u2926"],[/\\ElsevierGlyph\{E211\}/g,"\u2927"],[/\\ElsevierGlyph\{E20E\}/g,"\u2928"],[/\\ElsevierGlyph\{E20F\}/g,"\u2929"],[/\\ElsevierGlyph\{E210\}/g,"\u292A"],[/\\ElsevierGlyph\{E21C\}/g,"\u2933"],[/\\ElsevierGlyph\{E21D\}/g,"\u2933-00338"],[/\\ElsevierGlyph\{E21A\}/g,"\u2936"],[/\\ElsevierGlyph\{E219\}/g,"\u2937"],[/\\Elolarr /g,"\u2940"],[/\\Elorarr /g,"\u2941"],[/\\ElzRlarr /g,"\u2942"],[/\\ElzrLarr /g,"\u2944"],[/\\Elzrarrx /g,"\u2947"],[/\\LeftRightVector /g,"\u294E"],[/\\RightUpDownVector /g,"\u294F"],[/\\DownLeftRightVector /g,"\u2950"],[/\\LeftUpDownVector /g,"\u2951"],[/\\LeftVectorBar /g,"\u2952"],[/\\RightVectorBar /g,"\u2953"],[/\\RightUpVectorBar /g,"\u2954"],[/\\RightDownVectorBar /g,"\u2955"],[/\\DownLeftVectorBar /g,"\u2956"],[/\\DownRightVectorBar /g,"\u2957"],[/\\LeftUpVectorBar /g,"\u2958"],[/\\LeftDownVectorBar /g,"\u2959"],[/\\LeftTeeVector /g,"\u295A"],[/\\RightTeeVector /g,"\u295B"],[/\\RightUpTeeVector /g,"\u295C"],[/\\RightDownTeeVector /g,"\u295D"],[/\\DownLeftTeeVector /g,"\u295E"],[/\\DownRightTeeVector /g,"\u295F"],[/\\LeftUpTeeVector /g,"\u2960"],[/\\LeftDownTeeVector /g,"\u2961"],[/\\UpEquilibrium /g,"\u296E"],[/\\ReverseUpEquilibrium /g,"\u296F"],[/\\RoundImplies /g,"\u2970"],[/\\ElsevierGlyph\{E214\}/g,"\u297C"],[/\\ElsevierGlyph\{E215\}/g,"\u297D"],[/\\Elztfnc /g,"\u2980"],[/\\ElsevierGlyph\{3018\}/g,"\u2985"],[/\\Elroang /g,"\u2986"],[/\\ElsevierGlyph\{E291\}/g,"\u2994"],[/\\Elzddfnc /g,"\u2999"],[/\\Angle /g,"\u299C"],[/\\Elzlpargt /g,"\u29A0"],[/\\ElsevierGlyph\{E260\}/g,"\u29B5"],[/\\ElsevierGlyph\{E61B\}/g,"\u29B6"],[/\\ElzLap /g,"\u29CA"],[/\\Elzdefas /g,"\u29CB"],[/\\LeftTriangleBar /g,"\u29CF"],[/\\NotLeftTriangleBar /g,"\u29CF-00338"],[/\\RightTriangleBar /g,"\u29D0"],[/\\NotRightTriangleBar /g,"\u29D0-00338"],[/\\ElsevierGlyph\{E372\}/g,"\u29DC"],[/\\blacklozenge /g,"\u29EB"],[/\\RuleDelayed /g,"\u29F4"],[/\\Elxuplus /g,"\u2A04"],[/\\ElzThr /g,"\u2A05"],[/\\Elxsqcup /g,"\u2A06"],[/\\ElzInf /g,"\u2A07"],[/\\ElzSup /g,"\u2A08"],[/\\ElzCint /g,"\u2A0D"],[/\\clockoint /g,"\u2A0F"],[/\\ElsevierGlyph\{E395\}/g,"\u2A10"],[/\\sqrint /g,"\u2A16"],[/\\ElsevierGlyph\{E25A\}/g,"\u2A25"],[/\\ElsevierGlyph\{E25B\}/g,"\u2A2A"],[/\\ElsevierGlyph\{E25C\}/g,"\u2A2D"],[/\\ElsevierGlyph\{E25D\}/g,"\u2A2E"],[/\\ElzTimes /g,"\u2A2F"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A34"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A35"],[/\\ElsevierGlyph\{E259\}/g,"\u2A3C"],[/\\amalg /g,"\u2A3F"],[/\\ElzAnd /g,"\u2A53"],[/\\ElzOr /g,"\u2A54"],[/\\ElsevierGlyph\{E36E\}/g,"\u2A55"],[/\\ElOr /g,"\u2A56"],[/\\perspcorrespond /g,"\u2A5E"],[/\\Elzminhat /g,"\u2A5F"],[/\\ElsevierGlyph\{225A\}/g,"\u2A63"],[/\\stackrel\{*\}\{=\}/g,"\u2A6E"],[/\\Equal /g,"\u2A75"],[/\\leqslant /g,"\u2A7D"],[/\\nleqslant /g,"\u2A7D-00338"],[/\\geqslant /g,"\u2A7E"],[/\\ngeqslant /g,"\u2A7E-00338"],[/\\lessapprox /g,"\u2A85"],[/\\gtrapprox /g,"\u2A86"],[/\\lneq /g,"\u2A87"],[/\\gneq /g,"\u2A88"],[/\\lnapprox /g,"\u2A89"],[/\\gnapprox /g,"\u2A8A"],[/\\lesseqqgtr /g,"\u2A8B"],[/\\gtreqqless /g,"\u2A8C"],[/\\eqslantless /g,"\u2A95"],[/\\eqslantgtr /g,"\u2A96"],[/\\Pisymbol\{ppi020\}\{117\}/g,"\u2A9D"],[/\\Pisymbol\{ppi020\}\{105\}/g,"\u2A9E"],[/\\NestedLessLess /g,"\u2AA1"],[/\\NotNestedLessLess /g,"\u2AA1-00338"],[/\\NestedGreaterGreater /g,"\u2AA2"],[/\\NotNestedGreaterGreater /g,"\u2AA2-00338"],[/\\preceq /g,"\u2AAF"],[/\\not\\preceq /g,"\u2AAF-00338"],[/\\succeq /g,"\u2AB0"],[/\\not\\succeq /g,"\u2AB0-00338"],[/\\precneqq /g,"\u2AB5"],[/\\succneqq /g,"\u2AB6"],[/\\precapprox /g,"\u2AB7"],[/\\succapprox /g,"\u2AB8"],[/\\precnapprox /g,"\u2AB9"],[/\\succnapprox /g,"\u2ABA"],[/\\subseteqq /g,"\u2AC5"],[/\\nsubseteqq /g,"\u2AC5-00338"],[/\\supseteqq /g,"\u2AC6"],[/\\nsupseteqq/g,"\u2AC6-00338"],[/\\subsetneqq /g,"\u2ACB"],[/\\supsetneqq /g,"\u2ACC"],[/\\ElsevierGlyph\{E30D\}/g,"\u2AEB"],[/\\Elztdcol /g,"\u2AF6"],[/\\ElsevierGlyph\{300A\}/g,"\u300A"],[/\\ElsevierGlyph\{300B\}/g,"\u300B"],[/\\ElsevierGlyph\{3018\}/g,"\u3018"],[/\\ElsevierGlyph\{3019\}/g,"\u3019"],[/\\openbracketleft /g,"\u301A"],[/\\openbracketright /g,"\u301B"]];return this}if(typeof module!=="undefined"&&module.exports){module.exports=BibtexParser};
\ No newline at end of file
diff -r ee8efcfd787f93c77eb4e451084d64ce4dc6b85e -r 990bc0688199410ab08d5e8a418770b516c6f4e2 static/scripts/packed/mvc/citation/citation-model.js
--- a/static/scripts/packed/mvc/citation/citation-model.js
+++ b/static/scripts/packed/mvc/citation/citation-model.js
@@ -1,1 +1,1 @@
-define(["mvc/base-mvc","utils/localization"],function(a,e){var f=Backbone.Model.extend(a.LoggableMixin).extend({initialize:function(){var g=this.attributes.content;var h=new BibtexParser(g).entries[0];this.entry=h},entryType:function(){return this.entry.EntryType},fields:function(){return this.entry.Fields}});var b=Backbone.Collection.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api",partial:true,model:f,});var d=b.extend({url:function(){return this.urlRoot+"/histories/"+this.history_id+"/citations"}});var c=b.extend({url:function(){return this.urlRoot+"/tools/"+this.tool_id+"/citations"},partial:false,});return{Citation:f,HistoryCitationCollection:d,ToolCitationCollection:c}});
\ No newline at end of file
+define(["mvc/base-mvc","utils/localization"],function(a,e){var f=Backbone.Model.extend(a.LoggableMixin).extend({initialize:function(){var g=this.attributes.content;var i=new BibtexParser(g).entries[0];this.entry=i;this._fields={};var k=i.Fields;for(key in k){var j=k[key];var h=key.toLowerCase();this._fields[h]=j}},entryType:function(){return this.entry.EntryType},fields:function(){return this._fields}});var b=Backbone.Collection.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api",partial:true,model:f,});var d=b.extend({url:function(){return this.urlRoot+"/histories/"+this.history_id+"/citations"}});var c=b.extend({url:function(){return this.urlRoot+"/tools/"+this.tool_id+"/citations"},partial:false,});return{Citation:f,HistoryCitationCollection:d,ToolCitationCollection:c}});
\ No newline at end of file
diff -r ee8efcfd787f93c77eb4e451084d64ce4dc6b85e -r 990bc0688199410ab08d5e8a418770b516c6f4e2 static/scripts/packed/mvc/citation/citation-view.js
--- a/static/scripts/packed/mvc/citation/citation-view.js
+++ b/static/scripts/packed/mvc/citation/citation-view.js
@@ -1,1 +1,1 @@
-define(["mvc/base-mvc","mvc/citation/citation-model","utils/localization"],function(a,d,c){var b=Backbone.View.extend({tagName:"div",className:"citations",render:function(){this.$el.append("<p>"+this.formattedReference()+"</p>");return this},formattedReference:function(){var j=this.model;var i=j.entryType();var k=j.fields();var g="";var n=this._asSentence((k.author?k.author:"")+(k.year?(" ("+k.year+")"):""))+" ";var m=k.title||"";var h=k.pages?("pp. "+k.pages):"";var o=k.address;if(i=="article"){g=n+this._asSentence(m)+(k.journal?("In <em>"+k.journal+", "):"")+(k.volume?k.volume:"")+(k.number?("("+k.number+"), "):", ")+this._asSentence(h)+this._asSentence(k.address)+"</em>"}else{if(i=="inproceedings"||i=="proceedings"){g=n+this._asSentence(m)+(k.booktitle?("In <em>"+k.booktitle+", "):"")+(h?h:"")+(o?", "+o:"")+".</em>"}else{if(i=="mastersthesis"||i=="phdthesis"){g=n+this._asSentence(m)+(k.howpublished?k.howpublished+". ":"")+(k.note?k.note+".":"")}else{if(i=="techreport"){g=n+". "+this._asSentence(m)+this._asSentence(k.institution)+this._asSentence(k.number)+this._asSentence(k.type)}else{if(i=="book"||i=="inbook"||i=="incollection"){g=this._asSentence(n)+" "+this._formatBookInfo(k)}else{g=this._asSentence(n)+" "+this._asSentence(m)+this._asSentence(k.howpublished)+this._asSentence(k.note)}}}}}var l="";if(k.DOI){l="http://dx.doi.org/"+k.DOI;g+='[<a href="'+l+'">doi:'+k.DOI+"</a>]"}var f=k.url||l;if(f){g+='[<a href="'+f+'">Link</a>]'}return g},_formatBookInfo:function(f){var g="";if(f.chapter){g+=f.chapter+" in "}if(f.title){g+="<em>"+f.title+"</em>"}if(f.editor){g+=", Edited by "+f.editor+", "}if(f.publisher){g+=", "+f.publisher}if(f.pages){g+=", pp. "+f.pages+""}if(f.series){g+=", <em>"+f.series+"</em>"}if(f.volume){g+=", Vol."+f.volume}if(f.issn){g+=", ISBN: "+f.issn}return g+"."},_asSentence:function(f){return(f&&f.trim())?f+". ":""}});var e=Backbone.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(g){var f=new b({model:g});this.$(".citations-formatted").append(f.render().el);var h=this.$(".citations-bibtex-text");h.val(h.val()+"\n\r"+g.attributes.content)},render:function(){this.$el.html(this.citationsElement());this.collection.each(function(f){this.renderCitation(f)},this);this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show();this.$(".citations-to-bibtex").hide();this.$(".citations-bibtex").show();this.$(".citations-formatted").hide();this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide();this.$(".citations-to-bibtex").show();this.$(".citations-bibtex").hide();this.$(".citations-formatted").show()},partialWarningElement:function(){if(this.collection.partial){return['<div style="padding:5px 10px">',"<b>Warning: This is a experimental feature.</b> Most Galaxy tools will not annotate"," citations explicitly at this time. When writing up your analysis, please manually"," review your histories and find all references"," that should be cited in order to completely describe your work. Also, please remember to",' <a href="https://wiki.galaxyproject.org/CitingGalaxy">cite Galaxy</a>.',"</div>",].join("")}else{return""}},citationsElement:function(){return['<div class="toolForm">','<div class="toolFormTitle">',c("Citations"),' <i class="fa fa-pencil-square-o citations-to-bibtex" title="Select all as BibTeX."></i>',' <i class="fa fa-times citations-to-formatted" title="Return to formatted citation list."></i>',"</div>",'<div class="toolFormBody" style="padding:5px 10px">',this.partialWarningElement(),'<span class="citations-formatted"></span>',"</div>",'<div class="citations-bibtex toolFormBody" style="padding:5px 10px">','<textarea style="width: 100%; height: 500px;" class="citations-bibtex-text"></textarea>',"</div>","</div>"].join("")}});return{CitationView:b,CitationListView:e}});
\ No newline at end of file
+define(["mvc/base-mvc","mvc/citation/citation-model","utils/localization"],function(a,d,c){var b=Backbone.View.extend({tagName:"div",className:"citations",render:function(){this.$el.append("<p>"+this.formattedReference()+"</p>");return this},formattedReference:function(){var j=this.model;var i=j.entryType();var k=j.fields();var g="";var n=this._asSentence((k.author?k.author:"")+(k.year?(" ("+k.year+")"):""))+" ";var m=k.title||"";var h=k.pages?("pp. "+k.pages):"";var o=k.address;if(i=="article"){g=n+this._asSentence(m)+(k.journal?("In <em>"+k.journal+", "):"")+(k.volume?k.volume:"")+(k.number?("("+k.number+"), "):", ")+this._asSentence(h)+this._asSentence(k.address)+"</em>"}else{if(i=="inproceedings"||i=="proceedings"){g=n+this._asSentence(m)+(k.booktitle?("In <em>"+k.booktitle+", "):"")+(h?h:"")+(o?", "+o:"")+".</em>"}else{if(i=="mastersthesis"||i=="phdthesis"){g=n+this._asSentence(m)+(k.howpublished?k.howpublished+". ":"")+(k.note?k.note+".":"")}else{if(i=="techreport"){g=n+". "+this._asSentence(m)+this._asSentence(k.institution)+this._asSentence(k.number)+this._asSentence(k.type)}else{if(i=="book"||i=="inbook"||i=="incollection"){g=this._asSentence(n)+" "+this._formatBookInfo(k)}else{g=this._asSentence(n)+" "+this._asSentence(m)+this._asSentence(k.howpublished)+this._asSentence(k.note)}}}}}var l="";if(k.doi){l="http://dx.doi.org/"+k.doi;g+='[<a href="'+l+'">doi:'+k.doi+"</a>]"}var f=k.url||l;if(f){g+='[<a href="'+f+'">Link</a>]'}return g},_formatBookInfo:function(f){var g="";if(f.chapter){g+=f.chapter+" in "}if(f.title){g+="<em>"+f.title+"</em>"}if(f.editor){g+=", Edited by "+f.editor+", "}if(f.publisher){g+=", "+f.publisher}if(f.pages){g+=", pp. "+f.pages+""}if(f.series){g+=", <em>"+f.series+"</em>"}if(f.volume){g+=", Vol."+f.volume}if(f.issn){g+=", ISBN: "+f.issn}return g+"."},_asSentence:function(f){return(f&&f.trim())?f+". ":""}});var e=Backbone.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(g){var f=new b({model:g});this.$(".citations-formatted").append(f.render().el);var h=this.$(".citations-bibtex-text");h.val(h.val()+"\n\r"+g.attributes.content)},render:function(){this.$el.html(this.citationsElement());this.collection.each(function(f){this.renderCitation(f)},this);this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show();this.$(".citations-to-bibtex").hide();this.$(".citations-bibtex").show();this.$(".citations-formatted").hide();this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide();this.$(".citations-to-bibtex").show();this.$(".citations-bibtex").hide();this.$(".citations-formatted").show()},partialWarningElement:function(){if(this.collection.partial){return['<div style="padding:5px 10px">',"<b>Warning: This is a experimental feature.</b> Most Galaxy tools will not annotate"," citations explicitly at this time. When writing up your analysis, please manually"," review your histories and find all references"," that should be cited in order to completely describe your work. Also, please remember to",' <a href="https://wiki.galaxyproject.org/CitingGalaxy">cite Galaxy</a>.',"</div>",].join("")}else{return""}},citationsElement:function(){return['<div class="toolForm">','<div class="toolFormTitle">',c("Citations"),' <i class="fa fa-pencil-square-o citations-to-bibtex" title="Select all as BibTeX."></i>',' <i class="fa fa-times citations-to-formatted" title="Return to formatted citation list."></i>',"</div>",'<div class="toolFormBody" style="padding:5px 10px">',this.partialWarningElement(),'<span class="citations-formatted"></span>',"</div>",'<div class="citations-bibtex toolFormBody" style="padding:5px 10px">','<textarea style="width: 100%; height: 500px;" class="citations-bibtex-text"></textarea>',"</div>","</div>"].join("")}});return{CitationView:b,CitationListView:e}});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/103697ebdd33/
Changeset: 103697ebdd33
User: jmchilton
Date: 2014-08-07 15:36:41
Summary: Merge next-stable.
Affected #: 7 files
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c lib/galaxy/managers/citations.py
--- a/lib/galaxy/managers/citations.py
+++ b/lib/galaxy/managers/citations.py
@@ -49,7 +49,7 @@
def _raw_get_bibtex( self, doi ):
dx_url = "http://dx.doi.org/" + doi
- headers = {'Accept': "text/bibliography; style=bibtex" }
+ headers = {'Accept': 'text/bibliography; style=bibtex, application/x-bibtex'}
req = urllib2.Request(dx_url, data="", headers=headers)
response = urllib2.urlopen(req)
bibtex = response.read()
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/libs/bibtex.js
--- a/static/scripts/libs/bibtex.js
+++ b/static/scripts/libs/bibtex.js
@@ -93,6 +93,7 @@
'booklet' : 14,
'masterthesis' : 15,
'conference' : 16
+ ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.
}
/** @private */ this.MACROS_ = {
'jan' : 'January',
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/mvc/citation/citation-model.js
--- a/static/scripts/mvc/citation/citation-model.js
+++ b/static/scripts/mvc/citation/citation-model.js
@@ -18,12 +18,19 @@
var bibtex = this.attributes.content;
var entry = new BibtexParser(bibtex).entries[0];
this.entry = entry;
+ this._fields = {};
+ var rawFields = entry.Fields;
+ for(key in rawFields) {
+ var value = rawFields[ key ];
+ var lowerKey = key.toLowerCase();
+ this._fields[ lowerKey ] = value;
+ }
},
entryType: function() {
return this.entry.EntryType;
},
fields: function() {
- return this.entry.Fields;
+ return this._fields;
}
} );
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/mvc/citation/citation-view.js
--- a/static/scripts/mvc/citation/citation-view.js
+++ b/static/scripts/mvc/citation/citation-view.js
@@ -55,9 +55,9 @@
this._asSentence(fields.note);
}
var doiUrl = "";
- if( fields.DOI ) {
- doiUrl = 'http://dx.doi.org/' + fields.DOI;
- ref += '[<a href="' + doiUrl + '">doi:' + fields.DOI + "</a>]";
+ if( fields.doi ) {
+ doiUrl = 'http://dx.doi.org/' + fields.doi;
+ ref += '[<a href="' + doiUrl + '">doi:' + fields.doi + "</a>]";
}
var url = fields.url || doiUrl;
if( url ) {
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/packed/libs/bibtex.js
--- a/static/scripts/packed/libs/bibtex.js
+++ b/static/scripts/packed/libs/bibtex.js
@@ -1,1 +1,1 @@
-function BibtexParser(c){if(typeof c=="string"){var d={};var a=[];function b(f){a.push(f)}var e=BibtexParser.call(d,b);e.parse(c);return{entries:a,errors:e.getErrors()}}if(typeof c!="function"){throw"Invalid parser construction."}this.STATES_={ENTRY_OR_JUNK:0,OBJECT_TYPE:1,ENTRY_KEY:2,KV_KEY:3,EQUALS:4,KV_VALUE:5};this.DATA_={};this.CALLBACK_=c;this.CHAR_=0;this.LINE_=1;this.CHAR_IN_LINE_=0;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={};this.SKIPTILLEOL_=false;this.VALBRACES_=null;this.BRACETYPE_=null;this.BRACECOUNT_=0;this.STATE_=this.STATES_.ENTRY_OR_JUNK;this.ERRORS_=[];this.ENTRY_TYPES_={inproceedings:1,proceedings:2,article:3,techreport:4,misc:5,mastersthesis:6,book:7,phdthesis:8,incollection:9,unpublished:10,inbook:11,manual:12,periodical:13,booklet:14,masterthesis:15,conference:16};this.MACROS_={jan:"January",feb:"February",mar:"March",apr:"April",may:"May",jun:"June",jul:"July",aug:"August",sep:"September",oct:"October",nov:"November",dec:"December",Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"};this.getErrors=function(){return this.ERRORS_};this.parse=function(f){for(var g=0;g<f.length;g++){this.processCharacter_(f[g])}};this.error_=function(f){this.ERRORS_.push([this.LINE_,this.CHAR_IN_LINE_,this.CHAR_,f])};this.processEntry_=function(){var h=this.DATA_;if(h.Fields){for(var k in h.Fields){var p=h.Fields[k];for(var j=0;j<this.CHARCONV_.length;j++){var q=this.CHARCONV_[j][0];var n=this.CHARCONV_[j][1];p=p.replace(q,n)}p=p.replace(/[\n\r\t]/g," ").replace(/\s\s+/g," ").replace(/^\s+|\s+$/g,"");var l=p.length;var g="";for(var j=0;j<l;j++){var m=p[j];var o=false;if(m=="\\"&&j<l-1){m=p[++j]}else{if(m=="{"||m=="}"){o=true}}if(!o){g+=m}}h.Fields[k]=g}}if(h.ObjectType=="string"){for(var k in h.Fields){this.MACROS_[k]=h.Fields[k]}}else{this.CALLBACK_(h)}};this.processCharacter_=function(l){this.CHAR_++;this.CHAR_IN_LINE_++;if(l=="\n"){this.LINE_++;this.CHAR_IN_LINE_=1}if(this.SKIPTILLEOL_){if(l=="\n"){this.SKIPTILLEOL_=false}return}if(this.SKIPCOMMENT_&&l=="%"){this.SKIPTILLEOL_=true;return}if(this.SKIPWS_&&/\s/.test(l)){return}this.SKIPWS_=false;this.SKIPCOMMENT_=false;this.SKIPTILLEOL_=false;var f=true;while(f){f=false;switch(this.STATE_){case this.STATES_.ENTRY_OR_JUNK:if(l=="@"){this.STATE_=this.STATES_.OBJECT_TYPE;this.DATA_={ObjectType:""}}this.BRACETYPE_=null;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break;case this.STATES_.OBJECT_TYPE:if(/[A-Za-z]/.test(l)){this.DATA_.ObjectType+=l.toLowerCase();this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{var i=this.DATA_.ObjectType;if(i=="comment"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i=="string"){this.DATA_.ObjectType=i;this.DATA_.Fields={};this.BRACETYPE_=l;this.BRACECOUNT_=1;this.STATE_=this.STATES_.KV_KEY;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={Key:""}}else{if(i=="preamble"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i in this.ENTRY_TYPES_){this.DATA_.ObjectType="entry";this.DATA_.EntryType=i;this.DATA_.EntryKey="";this.STATE_=this.STATES_.ENTRY_KEY;f=true}else{this.error_('Unrecognized object type: "'+this.DATA_.ObjectType+'"');this.STATE_=this.STATES_.ENTRY_OR_JUNK}}}}}break;case this.STATES_.ENTRY_KEY:if((l==="{"||l==="(")&&this.BRACETYPE_==null){this.BRACETYPE_=l;this.BRACECOUNT_=1;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break}if(/[,%\s]/.test(l)){if(this.DATA_.EntryKey.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{if(this.BRACETYPE_==null){this.error_("No opening brace for object.");this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;f=true;this.STATE_=this.STATES_.KV_KEY;this.PARSETMP_.Key="";this.DATA_.Fields={}}}}else{this.DATA_.EntryKey+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}break;case this.STATES_.KV_KEY:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(/[\-A-Za-z:]/.test(l)){this.PARSETMP_.Key+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{if(this.PARSETMP_.Key.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.EQUALS;f=true}}break;case this.STATES_.EQUALS:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.error_('Key-value pair has key "'+this.PARSETMP_.Key+'", but no value.');this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(l=="="){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_VALUE;this.PARSETMP_.Value="";this.VALBRACES_={'"':[],"{":[]}}break;case this.STATES_.KV_VALUE:var k=this.VALBRACES_;var j=this.PARSETMP_.Value;var h=false;if(l=='"'||l=="{"||l=="}"||l==","){if(l==","){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}h=true}}if(l=='"'){if(0===k['"'].length+k["{"].length){k['"'].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false;break}if(k['"'].length==1&&k["{"].length==0&&(j.length==0||j[j.length-1]!="\\")){h=true}else{}}if(l=="{"){if(j.length==0||j[j.length-1]!="\\"){k["{"].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{}}if(l=="}"){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}f=true;h=true}else{if(j.length==0||j[j.length-1]!="\\"){if(k["{"].length>0){k["{"].splice(k["{"].length-1,1);if(0==k["{"].length+k['"'].length){h=true}else{}}}else{}}}}if(h){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_KEY;this.DATA_.Fields[this.PARSETMP_.Key]=this.PARSETMP_.Value;this.PARSETMP_={Key:""};this.VALBRACES_=null}else{this.PARSETMP_.Value+=l}break}}};this.CHARCONV_=[[/\\space /g,"\u0020"],[/\\textdollar /g,"\u0024"],[/\\textquotesingle /g,"\u0027"],[/\\ast /g,"\u002A"],[/\\textbackslash /g,"\u005C"],[/\\\^\{\}/g,"\u005E"],[/\\textasciigrave /g,"\u0060"],[/\\lbrace /g,"\u007B"],[/\\vert /g,"\u007C"],[/\\rbrace /g,"\u007D"],[/\\textasciitilde /g,"\u007E"],[/\\textexclamdown /g,"\u00A1"],[/\\textcent /g,"\u00A2"],[/\\textsterling /g,"\u00A3"],[/\\textcurrency /g,"\u00A4"],[/\\textyen /g,"\u00A5"],[/\\textbrokenbar /g,"\u00A6"],[/\\textsection /g,"\u00A7"],[/\\textasciidieresis /g,"\u00A8"],[/\\textcopyright /g,"\u00A9"],[/\\textordfeminine /g,"\u00AA"],[/\\guillemotleft /g,"\u00AB"],[/\\lnot /g,"\u00AC"],[/\\textregistered /g,"\u00AE"],[/\\textasciimacron /g,"\u00AF"],[/\\textdegree /g,"\u00B0"],[/\\pm /g,"\u00B1"],[/\\textasciiacute /g,"\u00B4"],[/\\mathrm\{\\mu\}/g,"\u00B5"],[/\\textparagraph /g,"\u00B6"],[/\\cdot /g,"\u00B7"],[/\\c\{\}/g,"\u00B8"],[/\\textordmasculine /g,"\u00BA"],[/\\guillemotright /g,"\u00BB"],[/\\textonequarter /g,"\u00BC"],[/\\textonehalf /g,"\u00BD"],[/\\textthreequarters /g,"\u00BE"],[/\\textquestiondown /g,"\u00BF"],[/\\`\{A\}/g,"\u00C0"],[/\\'\{A\}/g,"\u00C1"],[/\\\^\{A\}/g,"\u00C2"],[/\\~\{A\}/g,"\u00C3"],[/\\"\{A\}/g,"\u00C4"],[/\\AA /g,"\u00C5"],[/\\AE /g,"\u00C6"],[/\\c\{C\}/g,"\u00C7"],[/\\`\{E\}/g,"\u00C8"],[/\\'\{E\}/g,"\u00C9"],[/\\\^\{E\}/g,"\u00CA"],[/\\"\{E\}/g,"\u00CB"],[/\\`\{I\}/g,"\u00CC"],[/\\'\{I\}/g,"\u00CD"],[/\\\^\{I\}/g,"\u00CE"],[/\\"\{I\}/g,"\u00CF"],[/\\DH /g,"\u00D0"],[/\\~\{N\}/g,"\u00D1"],[/\\`\{O\}/g,"\u00D2"],[/\\'\{O\}/g,"\u00D3"],[/\\\^\{O\}/g,"\u00D4"],[/\\~\{O\}/g,"\u00D5"],[/\\"\{O\}/g,"\u00D6"],[/\\texttimes /g,"\u00D7"],[/\\O /g,"\u00D8"],[/\\`\{U\}/g,"\u00D9"],[/\\'\{U\}/g,"\u00DA"],[/\\\^\{U\}/g,"\u00DB"],[/\\"\{U\}/g,"\u00DC"],[/\\'\{Y\}/g,"\u00DD"],[/\\TH /g,"\u00DE"],[/\\ss /g,"\u00DF"],[/\\`\{a\}/g,"\u00E0"],[/\\'\{a\}/g,"\u00E1"],[/\\\^\{a\}/g,"\u00E2"],[/\\~\{a\}/g,"\u00E3"],[/\\"\{a\}/g,"\u00E4"],[/\\aa /g,"\u00E5"],[/\\ae /g,"\u00E6"],[/\\c\{c\}/g,"\u00E7"],[/\\`\{e\}/g,"\u00E8"],[/\\'\{e\}/g,"\u00E9"],[/\\\^\{e\}/g,"\u00EA"],[/\\"\{e\}/g,"\u00EB"],[/\\`\{\\i\}/g,"\u00EC"],[/\\'\{\\i\}/g,"\u00ED"],[/\\\^\{\\i\}/g,"\u00EE"],[/\\"\{\\i\}/g,"\u00EF"],[/\\dh /g,"\u00F0"],[/\\~\{n\}/g,"\u00F1"],[/\\`\{o\}/g,"\u00F2"],[/\\'\{o\}/g,"\u00F3"],[/\\\^\{o\}/g,"\u00F4"],[/\\~\{o\}/g,"\u00F5"],[/\\"\{o\}/g,"\u00F6"],[/\\div /g,"\u00F7"],[/\\o /g,"\u00F8"],[/\\`\{u\}/g,"\u00F9"],[/\\'\{u\}/g,"\u00FA"],[/\\\^\{u\}/g,"\u00FB"],[/\\"\{u\}/g,"\u00FC"],[/\\'\{y\}/g,"\u00FD"],[/\\th /g,"\u00FE"],[/\\"\{y\}/g,"\u00FF"],[/\\=\{A\}/g,"\u0100"],[/\\=\{a\}/g,"\u0101"],[/\\u\{A\}/g,"\u0102"],[/\\u\{a\}/g,"\u0103"],[/\\k\{A\}/g,"\u0104"],[/\\k\{a\}/g,"\u0105"],[/\\'\{C\}/g,"\u0106"],[/\\'\{c\}/g,"\u0107"],[/\\\^\{C\}/g,"\u0108"],[/\\\^\{c\}/g,"\u0109"],[/\\.\{C\}/g,"\u010A"],[/\\.\{c\}/g,"\u010B"],[/\\v\{C\}/g,"\u010C"],[/\\v\{c\}/g,"\u010D"],[/\\v\{D\}/g,"\u010E"],[/\\v\{d\}/g,"\u010F"],[/\\DJ /g,"\u0110"],[/\\dj /g,"\u0111"],[/\\=\{E\}/g,"\u0112"],[/\\=\{e\}/g,"\u0113"],[/\\u\{E\}/g,"\u0114"],[/\\u\{e\}/g,"\u0115"],[/\\.\{E\}/g,"\u0116"],[/\\.\{e\}/g,"\u0117"],[/\\k\{E\}/g,"\u0118"],[/\\k\{e\}/g,"\u0119"],[/\\v\{E\}/g,"\u011A"],[/\\v\{e\}/g,"\u011B"],[/\\\^\{G\}/g,"\u011C"],[/\\\^\{g\}/g,"\u011D"],[/\\u\{G\}/g,"\u011E"],[/\\u\{g\}/g,"\u011F"],[/\\.\{G\}/g,"\u0120"],[/\\.\{g\}/g,"\u0121"],[/\\c\{G\}/g,"\u0122"],[/\\c\{g\}/g,"\u0123"],[/\\\^\{H\}/g,"\u0124"],[/\\\^\{h\}/g,"\u0125"],[/\\Elzxh /g,"\u0127"],[/\\~\{I\}/g,"\u0128"],[/\\~\{\\i\}/g,"\u0129"],[/\\=\{I\}/g,"\u012A"],[/\\=\{\\i\}/g,"\u012B"],[/\\u\{I\}/g,"\u012C"],[/\\u\{\\i\}/g,"\u012D"],[/\\k\{I\}/g,"\u012E"],[/\\k\{i\}/g,"\u012F"],[/\\.\{I\}/g,"\u0130"],[/\\i /g,"\u0131"],[/\\\^\{J\}/g,"\u0134"],[/\\\^\{\\j\}/g,"\u0135"],[/\\c\{K\}/g,"\u0136"],[/\\c\{k\}/g,"\u0137"],[/\\'\{L\}/g,"\u0139"],[/\\'\{l\}/g,"\u013A"],[/\\c\{L\}/g,"\u013B"],[/\\c\{l\}/g,"\u013C"],[/\\v\{L\}/g,"\u013D"],[/\\v\{l\}/g,"\u013E"],[/\\L /g,"\u0141"],[/\\l /g,"\u0142"],[/\\'\{N\}/g,"\u0143"],[/\\'\{n\}/g,"\u0144"],[/\\c\{N\}/g,"\u0145"],[/\\c\{n\}/g,"\u0146"],[/\\v\{N\}/g,"\u0147"],[/\\v\{n\}/g,"\u0148"],[/\\NG /g,"\u014A"],[/\\ng /g,"\u014B"],[/\\=\{O\}/g,"\u014C"],[/\\=\{o\}/g,"\u014D"],[/\\u\{O\}/g,"\u014E"],[/\\u\{o\}/g,"\u014F"],[/\\H\{O\}/g,"\u0150"],[/\\H\{o\}/g,"\u0151"],[/\\OE /g,"\u0152"],[/\\oe /g,"\u0153"],[/\\'\{R\}/g,"\u0154"],[/\\'\{r\}/g,"\u0155"],[/\\c\{R\}/g,"\u0156"],[/\\c\{r\}/g,"\u0157"],[/\\v\{R\}/g,"\u0158"],[/\\v\{r\}/g,"\u0159"],[/\\'\{S\}/g,"\u015A"],[/\\'\{s\}/g,"\u015B"],[/\\\^\{S\}/g,"\u015C"],[/\\\^\{s\}/g,"\u015D"],[/\\c\{S\}/g,"\u015E"],[/\\c\{s\}/g,"\u015F"],[/\\v\{S\}/g,"\u0160"],[/\\v\{s\}/g,"\u0161"],[/\\c\{T\}/g,"\u0162"],[/\\c\{t\}/g,"\u0163"],[/\\v\{T\}/g,"\u0164"],[/\\v\{t\}/g,"\u0165"],[/\\~\{U\}/g,"\u0168"],[/\\~\{u\}/g,"\u0169"],[/\\=\{U\}/g,"\u016A"],[/\\=\{u\}/g,"\u016B"],[/\\u\{U\}/g,"\u016C"],[/\\u\{u\}/g,"\u016D"],[/\\r\{U\}/g,"\u016E"],[/\\r\{u\}/g,"\u016F"],[/\\H\{U\}/g,"\u0170"],[/\\H\{u\}/g,"\u0171"],[/\\k\{U\}/g,"\u0172"],[/\\k\{u\}/g,"\u0173"],[/\\\^\{W\}/g,"\u0174"],[/\\\^\{w\}/g,"\u0175"],[/\\\^\{Y\}/g,"\u0176"],[/\\\^\{y\}/g,"\u0177"],[/\\"\{Y\}/g,"\u0178"],[/\\'\{Z\}/g,"\u0179"],[/\\'\{z\}/g,"\u017A"],[/\\.\{Z\}/g,"\u017B"],[/\\.\{z\}/g,"\u017C"],[/\\v\{Z\}/g,"\u017D"],[/\\v\{z\}/g,"\u017E"],[/\\texthvlig /g,"\u0195"],[/\\textnrleg /g,"\u019E"],[/\\eth /g,"\u01AA"],[/\\textdoublepipe /g,"\u01C2"],[/\\'\{g\}/g,"\u01F5"],[/\\Elztrna /g,"\u0250"],[/\\Elztrnsa /g,"\u0252"],[/\\Elzopeno /g,"\u0254"],[/\\Elzrtld /g,"\u0256"],[/\\Elzschwa /g,"\u0259"],[/\\varepsilon /g,"\u025B"],[/\\Elzpgamma /g,"\u0263"],[/\\Elzpbgam /g,"\u0264"],[/\\Elztrnh /g,"\u0265"],[/\\Elzbtdl /g,"\u026C"],[/\\Elzrtll /g,"\u026D"],[/\\Elztrnm /g,"\u026F"],[/\\Elztrnmlr /g,"\u0270"],[/\\Elzltlmr /g,"\u0271"],[/\\Elzltln /g,"\u0272"],[/\\Elzrtln /g,"\u0273"],[/\\Elzclomeg /g,"\u0277"],[/\\textphi /g,"\u0278"],[/\\Elztrnr /g,"\u0279"],[/\\Elztrnrl /g,"\u027A"],[/\\Elzrttrnr /g,"\u027B"],[/\\Elzrl /g,"\u027C"],[/\\Elzrtlr /g,"\u027D"],[/\\Elzfhr /g,"\u027E"],[/\\Elzrtls /g,"\u0282"],[/\\Elzesh /g,"\u0283"],[/\\Elztrnt /g,"\u0287"],[/\\Elzrtlt /g,"\u0288"],[/\\Elzpupsil /g,"\u028A"],[/\\Elzpscrv /g,"\u028B"],[/\\Elzinvv /g,"\u028C"],[/\\Elzinvw /g,"\u028D"],[/\\Elztrny /g,"\u028E"],[/\\Elzrtlz /g,"\u0290"],[/\\Elzyogh /g,"\u0292"],[/\\Elzglst /g,"\u0294"],[/\\Elzreglst /g,"\u0295"],[/\\Elzinglst /g,"\u0296"],[/\\textturnk /g,"\u029E"],[/\\Elzdyogh /g,"\u02A4"],[/\\Elztesh /g,"\u02A7"],[/\\textasciicaron /g,"\u02C7"],[/\\Elzverts /g,"\u02C8"],[/\\Elzverti /g,"\u02CC"],[/\\Elzlmrk /g,"\u02D0"],[/\\Elzhlmrk /g,"\u02D1"],[/\\Elzsbrhr /g,"\u02D2"],[/\\Elzsblhr /g,"\u02D3"],[/\\Elzrais /g,"\u02D4"],[/\\Elzlow /g,"\u02D5"],[/\\textasciibreve /g,"\u02D8"],[/\\textperiodcentered /g,"\u02D9"],[/\\r\{\}/g,"\u02DA"],[/\\k\{\}/g,"\u02DB"],[/\\texttildelow /g,"\u02DC"],[/\\H\{\}/g,"\u02DD"],[/\\tone\{55\}/g,"\u02E5"],[/\\tone\{44\}/g,"\u02E6"],[/\\tone\{33\}/g,"\u02E7"],[/\\tone\{22\}/g,"\u02E8"],[/\\tone\{11\}/g,"\u02E9"],[/\\cyrchar\\C/g,"\u030F"],[/\\Elzpalh /g,"\u0321"],[/\\Elzrh /g,"\u0322"],[/\\Elzsbbrg /g,"\u032A"],[/\\Elzxl /g,"\u0335"],[/\\Elzbar /g,"\u0336"],[/\\'\{A\}/g,"\u0386"],[/\\'\{E\}/g,"\u0388"],[/\\'\{H\}/g,"\u0389"],[/\\'\{\}\{I\}/g,"\u038A"],[/\\'\{\}O/g,"\u038C"],[/\\mathrm\{'Y\}/g,"\u038E"],[/\\mathrm\{'\\Omega\}/g,"\u038F"],[/\\acute\{\\ddot\{\\iota\}\}/g,"\u0390"],[/\\Alpha /g,"\u0391"],[/\\Beta /g,"\u0392"],[/\\Gamma /g,"\u0393"],[/\\Delta /g,"\u0394"],[/\\Epsilon /g,"\u0395"],[/\\Zeta /g,"\u0396"],[/\\Eta /g,"\u0397"],[/\\Theta /g,"\u0398"],[/\\Iota /g,"\u0399"],[/\\Kappa /g,"\u039A"],[/\\Lambda /g,"\u039B"],[/\\Xi /g,"\u039E"],[/\\Pi /g,"\u03A0"],[/\\Rho /g,"\u03A1"],[/\\Sigma /g,"\u03A3"],[/\\Tau /g,"\u03A4"],[/\\Upsilon /g,"\u03A5"],[/\\Phi /g,"\u03A6"],[/\\Chi /g,"\u03A7"],[/\\Psi /g,"\u03A8"],[/\\Omega /g,"\u03A9"],[/\\mathrm\{\\ddot\{I\}\}/g,"\u03AA"],[/\\mathrm\{\\ddot\{Y\}\}/g,"\u03AB"],[/\\'\{\$\\alpha\$\}/g,"\u03AC"],[/\\acute\{\\epsilon\}/g,"\u03AD"],[/\\acute\{\\eta\}/g,"\u03AE"],[/\\acute\{\\iota\}/g,"\u03AF"],[/\\acute\{\\ddot\{\\upsilon\}\}/g,"\u03B0"],[/\\alpha /g,"\u03B1"],[/\\beta /g,"\u03B2"],[/\\gamma /g,"\u03B3"],[/\\delta /g,"\u03B4"],[/\\epsilon /g,"\u03B5"],[/\\zeta /g,"\u03B6"],[/\\eta /g,"\u03B7"],[/\\texttheta /g,"\u03B8"],[/\\iota /g,"\u03B9"],[/\\kappa /g,"\u03BA"],[/\\lambda /g,"\u03BB"],[/\\mu /g,"\u03BC"],[/\\nu /g,"\u03BD"],[/\\xi /g,"\u03BE"],[/\\pi /g,"\u03C0"],[/\\rho /g,"\u03C1"],[/\\varsigma /g,"\u03C2"],[/\\sigma /g,"\u03C3"],[/\\tau /g,"\u03C4"],[/\\upsilon /g,"\u03C5"],[/\\varphi /g,"\u03C6"],[/\\chi /g,"\u03C7"],[/\\psi /g,"\u03C8"],[/\\omega /g,"\u03C9"],[/\\ddot\{\\iota\}/g,"\u03CA"],[/\\ddot\{\\upsilon\}/g,"\u03CB"],[/\\'\{o\}/g,"\u03CC"],[/\\acute\{\\upsilon\}/g,"\u03CD"],[/\\acute\{\\omega\}/g,"\u03CE"],[/\\Pisymbol\{ppi022\}\{87\}/g,"\u03D0"],[/\\textvartheta /g,"\u03D1"],[/\\Upsilon /g,"\u03D2"],[/\\phi /g,"\u03D5"],[/\\varpi /g,"\u03D6"],[/\\Stigma /g,"\u03DA"],[/\\Digamma /g,"\u03DC"],[/\\digamma /g,"\u03DD"],[/\\Koppa /g,"\u03DE"],[/\\Sampi /g,"\u03E0"],[/\\varkappa /g,"\u03F0"],[/\\varrho /g,"\u03F1"],[/\\textTheta /g,"\u03F4"],[/\\backepsilon /g,"\u03F6"],[/\\cyrchar\\CYRYO /g,"\u0401"],[/\\cyrchar\\CYRDJE /g,"\u0402"],[/\\cyrchar\{\\'\\CYRG\}/g,"\u0403"],[/\\cyrchar\\CYRIE /g,"\u0404"],[/\\cyrchar\\CYRDZE /g,"\u0405"],[/\\cyrchar\\CYRII /g,"\u0406"],[/\\cyrchar\\CYRYI /g,"\u0407"],[/\\cyrchar\\CYRJE /g,"\u0408"],[/\\cyrchar\\CYRLJE /g,"\u0409"],[/\\cyrchar\\CYRNJE /g,"\u040A"],[/\\cyrchar\\CYRTSHE /g,"\u040B"],[/\\cyrchar\{\\'\\CYRK\}/g,"\u040C"],[/\\cyrchar\\CYRUSHRT /g,"\u040E"],[/\\cyrchar\\CYRDZHE /g,"\u040F"],[/\\cyrchar\\CYRA /g,"\u0410"],[/\\cyrchar\\CYRB /g,"\u0411"],[/\\cyrchar\\CYRV /g,"\u0412"],[/\\cyrchar\\CYRG /g,"\u0413"],[/\\cyrchar\\CYRD /g,"\u0414"],[/\\cyrchar\\CYRE /g,"\u0415"],[/\\cyrchar\\CYRZH /g,"\u0416"],[/\\cyrchar\\CYRZ /g,"\u0417"],[/\\cyrchar\\CYRI /g,"\u0418"],[/\\cyrchar\\CYRISHRT /g,"\u0419"],[/\\cyrchar\\CYRK /g,"\u041A"],[/\\cyrchar\\CYRL /g,"\u041B"],[/\\cyrchar\\CYRM /g,"\u041C"],[/\\cyrchar\\CYRN /g,"\u041D"],[/\\cyrchar\\CYRO /g,"\u041E"],[/\\cyrchar\\CYRP /g,"\u041F"],[/\\cyrchar\\CYRR /g,"\u0420"],[/\\cyrchar\\CYRS /g,"\u0421"],[/\\cyrchar\\CYRT /g,"\u0422"],[/\\cyrchar\\CYRU /g,"\u0423"],[/\\cyrchar\\CYRF /g,"\u0424"],[/\\cyrchar\\CYRH /g,"\u0425"],[/\\cyrchar\\CYRC /g,"\u0426"],[/\\cyrchar\\CYRCH /g,"\u0427"],[/\\cyrchar\\CYRSH /g,"\u0428"],[/\\cyrchar\\CYRSHCH /g,"\u0429"],[/\\cyrchar\\CYRHRDSN /g,"\u042A"],[/\\cyrchar\\CYRERY /g,"\u042B"],[/\\cyrchar\\CYRSFTSN /g,"\u042C"],[/\\cyrchar\\CYREREV /g,"\u042D"],[/\\cyrchar\\CYRYU /g,"\u042E"],[/\\cyrchar\\CYRYA /g,"\u042F"],[/\\cyrchar\\cyra /g,"\u0430"],[/\\cyrchar\\cyrb /g,"\u0431"],[/\\cyrchar\\cyrv /g,"\u0432"],[/\\cyrchar\\cyrg /g,"\u0433"],[/\\cyrchar\\cyrd /g,"\u0434"],[/\\cyrchar\\cyre /g,"\u0435"],[/\\cyrchar\\cyrzh /g,"\u0436"],[/\\cyrchar\\cyrz /g,"\u0437"],[/\\cyrchar\\cyri /g,"\u0438"],[/\\cyrchar\\cyrishrt /g,"\u0439"],[/\\cyrchar\\cyrk /g,"\u043A"],[/\\cyrchar\\cyrl /g,"\u043B"],[/\\cyrchar\\cyrm /g,"\u043C"],[/\\cyrchar\\cyrn /g,"\u043D"],[/\\cyrchar\\cyro /g,"\u043E"],[/\\cyrchar\\cyrp /g,"\u043F"],[/\\cyrchar\\cyrr /g,"\u0440"],[/\\cyrchar\\cyrs /g,"\u0441"],[/\\cyrchar\\cyrt /g,"\u0442"],[/\\cyrchar\\cyru /g,"\u0443"],[/\\cyrchar\\cyrf /g,"\u0444"],[/\\cyrchar\\cyrh /g,"\u0445"],[/\\cyrchar\\cyrc /g,"\u0446"],[/\\cyrchar\\cyrch /g,"\u0447"],[/\\cyrchar\\cyrsh /g,"\u0448"],[/\\cyrchar\\cyrshch /g,"\u0449"],[/\\cyrchar\\cyrhrdsn /g,"\u044A"],[/\\cyrchar\\cyrery /g,"\u044B"],[/\\cyrchar\\cyrsftsn /g,"\u044C"],[/\\cyrchar\\cyrerev /g,"\u044D"],[/\\cyrchar\\cyryu /g,"\u044E"],[/\\cyrchar\\cyrya /g,"\u044F"],[/\\cyrchar\\cyryo /g,"\u0451"],[/\\cyrchar\\cyrdje /g,"\u0452"],[/\\cyrchar\{\\'\\cyrg\}/g,"\u0453"],[/\\cyrchar\\cyrie /g,"\u0454"],[/\\cyrchar\\cyrdze /g,"\u0455"],[/\\cyrchar\\cyrii /g,"\u0456"],[/\\cyrchar\\cyryi /g,"\u0457"],[/\\cyrchar\\cyrje /g,"\u0458"],[/\\cyrchar\\cyrlje /g,"\u0459"],[/\\cyrchar\\cyrnje /g,"\u045A"],[/\\cyrchar\\cyrtshe /g,"\u045B"],[/\\cyrchar\{\\'\\cyrk\}/g,"\u045C"],[/\\cyrchar\\cyrushrt /g,"\u045E"],[/\\cyrchar\\cyrdzhe /g,"\u045F"],[/\\cyrchar\\CYROMEGA /g,"\u0460"],[/\\cyrchar\\cyromega /g,"\u0461"],[/\\cyrchar\\CYRYAT /g,"\u0462"],[/\\cyrchar\\CYRIOTE /g,"\u0464"],[/\\cyrchar\\cyriote /g,"\u0465"],[/\\cyrchar\\CYRLYUS /g,"\u0466"],[/\\cyrchar\\cyrlyus /g,"\u0467"],[/\\cyrchar\\CYRIOTLYUS /g,"\u0468"],[/\\cyrchar\\cyriotlyus /g,"\u0469"],[/\\cyrchar\\CYRBYUS /g,"\u046A"],[/\\cyrchar\\CYRIOTBYUS /g,"\u046C"],[/\\cyrchar\\cyriotbyus /g,"\u046D"],[/\\cyrchar\\CYRKSI /g,"\u046E"],[/\\cyrchar\\cyrksi /g,"\u046F"],[/\\cyrchar\\CYRPSI /g,"\u0470"],[/\\cyrchar\\cyrpsi /g,"\u0471"],[/\\cyrchar\\CYRFITA /g,"\u0472"],[/\\cyrchar\\CYRIZH /g,"\u0474"],[/\\cyrchar\\CYRUK /g,"\u0478"],[/\\cyrchar\\cyruk /g,"\u0479"],[/\\cyrchar\\CYROMEGARND /g,"\u047A"],[/\\cyrchar\\cyromegarnd /g,"\u047B"],[/\\cyrchar\\CYROMEGATITLO /g,"\u047C"],[/\\cyrchar\\cyromegatitlo /g,"\u047D"],[/\\cyrchar\\CYROT /g,"\u047E"],[/\\cyrchar\\cyrot /g,"\u047F"],[/\\cyrchar\\CYRKOPPA /g,"\u0480"],[/\\cyrchar\\cyrkoppa /g,"\u0481"],[/\\cyrchar\\cyrthousands /g,"\u0482"],[/\\cyrchar\\cyrhundredthousands /g,"\u0488"],[/\\cyrchar\\cyrmillions /g,"\u0489"],[/\\cyrchar\\CYRSEMISFTSN /g,"\u048C"],[/\\cyrchar\\cyrsemisftsn /g,"\u048D"],[/\\cyrchar\\CYRRTICK /g,"\u048E"],[/\\cyrchar\\cyrrtick /g,"\u048F"],[/\\cyrchar\\CYRGUP /g,"\u0490"],[/\\cyrchar\\cyrgup /g,"\u0491"],[/\\cyrchar\\CYRGHCRS /g,"\u0492"],[/\\cyrchar\\cyrghcrs /g,"\u0493"],[/\\cyrchar\\CYRGHK /g,"\u0494"],[/\\cyrchar\\cyrghk /g,"\u0495"],[/\\cyrchar\\CYRZHDSC /g,"\u0496"],[/\\cyrchar\\cyrzhdsc /g,"\u0497"],[/\\cyrchar\\CYRZDSC /g,"\u0498"],[/\\cyrchar\\cyrzdsc /g,"\u0499"],[/\\cyrchar\\CYRKDSC /g,"\u049A"],[/\\cyrchar\\cyrkdsc /g,"\u049B"],[/\\cyrchar\\CYRKVCRS /g,"\u049C"],[/\\cyrchar\\cyrkvcrs /g,"\u049D"],[/\\cyrchar\\CYRKHCRS /g,"\u049E"],[/\\cyrchar\\cyrkhcrs /g,"\u049F"],[/\\cyrchar\\CYRKBEAK /g,"\u04A0"],[/\\cyrchar\\cyrkbeak /g,"\u04A1"],[/\\cyrchar\\CYRNDSC /g,"\u04A2"],[/\\cyrchar\\cyrndsc /g,"\u04A3"],[/\\cyrchar\\CYRNG /g,"\u04A4"],[/\\cyrchar\\cyrng /g,"\u04A5"],[/\\cyrchar\\CYRPHK /g,"\u04A6"],[/\\cyrchar\\cyrphk /g,"\u04A7"],[/\\cyrchar\\CYRABHHA /g,"\u04A8"],[/\\cyrchar\\cyrabhha /g,"\u04A9"],[/\\cyrchar\\CYRSDSC /g,"\u04AA"],[/\\cyrchar\\cyrsdsc /g,"\u04AB"],[/\\cyrchar\\CYRTDSC /g,"\u04AC"],[/\\cyrchar\\cyrtdsc /g,"\u04AD"],[/\\cyrchar\\CYRY /g,"\u04AE"],[/\\cyrchar\\cyry /g,"\u04AF"],[/\\cyrchar\\CYRYHCRS /g,"\u04B0"],[/\\cyrchar\\cyryhcrs /g,"\u04B1"],[/\\cyrchar\\CYRHDSC /g,"\u04B2"],[/\\cyrchar\\cyrhdsc /g,"\u04B3"],[/\\cyrchar\\CYRTETSE /g,"\u04B4"],[/\\cyrchar\\cyrtetse /g,"\u04B5"],[/\\cyrchar\\CYRCHRDSC /g,"\u04B6"],[/\\cyrchar\\cyrchrdsc /g,"\u04B7"],[/\\cyrchar\\CYRCHVCRS /g,"\u04B8"],[/\\cyrchar\\cyrchvcrs /g,"\u04B9"],[/\\cyrchar\\CYRSHHA /g,"\u04BA"],[/\\cyrchar\\cyrshha /g,"\u04BB"],[/\\cyrchar\\CYRABHCH /g,"\u04BC"],[/\\cyrchar\\cyrabhch /g,"\u04BD"],[/\\cyrchar\\CYRABHCHDSC /g,"\u04BE"],[/\\cyrchar\\cyrabhchdsc /g,"\u04BF"],[/\\cyrchar\\CYRpalochka /g,"\u04C0"],[/\\cyrchar\\CYRKHK /g,"\u04C3"],[/\\cyrchar\\cyrkhk /g,"\u04C4"],[/\\cyrchar\\CYRNHK /g,"\u04C7"],[/\\cyrchar\\cyrnhk /g,"\u04C8"],[/\\cyrchar\\CYRCHLDSC /g,"\u04CB"],[/\\cyrchar\\cyrchldsc /g,"\u04CC"],[/\\cyrchar\\CYRAE /g,"\u04D4"],[/\\cyrchar\\cyrae /g,"\u04D5"],[/\\cyrchar\\CYRSCHWA /g,"\u04D8"],[/\\cyrchar\\cyrschwa /g,"\u04D9"],[/\\cyrchar\\CYRABHDZE /g,"\u04E0"],[/\\cyrchar\\cyrabhdze /g,"\u04E1"],[/\\cyrchar\\CYROTLD /g,"\u04E8"],[/\\cyrchar\\cyrotld /g,"\u04E9"],[/\\hspace\{0.6em\}/g,"\u2002"],[/\\hspace\{1em\}/g,"\u2003"],[/\\hspace\{0.33em\}/g,"\u2004"],[/\\hspace\{0.25em\}/g,"\u2005"],[/\\hspace\{0.166em\}/g,"\u2006"],[/\\hphantom\{0\}/g,"\u2007"],[/\\hphantom\{,\}/g,"\u2008"],[/\\hspace\{0.167em\}/g,"\u2009"],[/\\mkern1mu /g,"\u200A"],[/\\textendash /g,"\u2013"],[/\\textemdash /g,"\u2014"],[/\\rule\{1em\}\{1pt\}/g,"\u2015"],[/\\Vert /g,"\u2016"],[/\\Elzreapos /g,"\u201B"],[/\\textquotedblleft /g,"\u201C"],[/\\textquotedblright /g,"\u201D"],[/\\textdagger /g,"\u2020"],[/\\textdaggerdbl /g,"\u2021"],[/\\textbullet /g,"\u2022"],[/\\ldots /g,"\u2026"],[/\\textperthousand /g,"\u2030"],[/\\textpertenthousand /g,"\u2031"],[/\\backprime /g,"\u2035"],[/\\guilsinglleft /g,"\u2039"],[/\\guilsinglright /g,"\u203A"],[/\\mkern4mu /g,"\u205F"],[/\\nolinebreak /g,"\u2060"],[/\\ensuremath\{\\Elzpes\}/g,"\u20A7"],[/\\mbox\{\\texteuro\} /g,"\u20AC"],[/\\dddot /g,"\u20DB"],[/\\ddddot /g,"\u20DC"],[/\\mathbb\{C\}/g,"\u2102"],[/\\mathscr\{g\}/g,"\u210A"],[/\\mathscr\{H\}/g,"\u210B"],[/\\mathfrak\{H\}/g,"\u210C"],[/\\mathbb\{H\}/g,"\u210D"],[/\\hslash /g,"\u210F"],[/\\mathscr\{I\}/g,"\u2110"],[/\\mathfrak\{I\}/g,"\u2111"],[/\\mathscr\{L\}/g,"\u2112"],[/\\mathscr\{l\}/g,"\u2113"],[/\\mathbb\{N\}/g,"\u2115"],[/\\cyrchar\\textnumero /g,"\u2116"],[/\\wp /g,"\u2118"],[/\\mathbb\{P\}/g,"\u2119"],[/\\mathbb\{Q\}/g,"\u211A"],[/\\mathscr\{R\}/g,"\u211B"],[/\\mathfrak\{R\}/g,"\u211C"],[/\\mathbb\{R\}/g,"\u211D"],[/\\Elzxrat /g,"\u211E"],[/\\texttrademark /g,"\u2122"],[/\\mathbb\{Z\}/g,"\u2124"],[/\\Omega /g,"\u2126"],[/\\mho /g,"\u2127"],[/\\mathfrak\{Z\}/g,"\u2128"],[/\\ElsevierGlyph\{2129\}/g,"\u2129"],[/\\AA /g,"\u212B"],[/\\mathscr\{B\}/g,"\u212C"],[/\\mathfrak\{C\}/g,"\u212D"],[/\\mathscr\{e\}/g,"\u212F"],[/\\mathscr\{E\}/g,"\u2130"],[/\\mathscr\{F\}/g,"\u2131"],[/\\mathscr\{M\}/g,"\u2133"],[/\\mathscr\{o\}/g,"\u2134"],[/\\aleph /g,"\u2135"],[/\\beth /g,"\u2136"],[/\\gimel /g,"\u2137"],[/\\daleth /g,"\u2138"],[/\\textfrac\{1\}\{3\}/g,"\u2153"],[/\\textfrac\{2\}\{3\}/g,"\u2154"],[/\\textfrac\{1\}\{5\}/g,"\u2155"],[/\\textfrac\{2\}\{5\}/g,"\u2156"],[/\\textfrac\{3\}\{5\}/g,"\u2157"],[/\\textfrac\{4\}\{5\}/g,"\u2158"],[/\\textfrac\{1\}\{6\}/g,"\u2159"],[/\\textfrac\{5\}\{6\}/g,"\u215A"],[/\\textfrac\{1\}\{8\}/g,"\u215B"],[/\\textfrac\{3\}\{8\}/g,"\u215C"],[/\\textfrac\{5\}\{8\}/g,"\u215D"],[/\\textfrac\{7\}\{8\}/g,"\u215E"],[/\\leftarrow /g,"\u2190"],[/\\uparrow /g,"\u2191"],[/\\rightarrow /g,"\u2192"],[/\\downarrow /g,"\u2193"],[/\\leftrightarrow /g,"\u2194"],[/\\updownarrow /g,"\u2195"],[/\\nwarrow /g,"\u2196"],[/\\nearrow /g,"\u2197"],[/\\searrow /g,"\u2198"],[/\\swarrow /g,"\u2199"],[/\\nleftarrow /g,"\u219A"],[/\\nrightarrow /g,"\u219B"],[/\\arrowwaveright /g,"\u219C"],[/\\arrowwaveright /g,"\u219D"],[/\\twoheadleftarrow /g,"\u219E"],[/\\twoheadrightarrow /g,"\u21A0"],[/\\leftarrowtail /g,"\u21A2"],[/\\rightarrowtail /g,"\u21A3"],[/\\mapsto /g,"\u21A6"],[/\\hookleftarrow /g,"\u21A9"],[/\\hookrightarrow /g,"\u21AA"],[/\\looparrowleft /g,"\u21AB"],[/\\looparrowright /g,"\u21AC"],[/\\leftrightsquigarrow /g,"\u21AD"],[/\\nleftrightarrow /g,"\u21AE"],[/\\Lsh /g,"\u21B0"],[/\\Rsh /g,"\u21B1"],[/\\ElsevierGlyph\{21B3\}/g,"\u21B3"],[/\\curvearrowleft /g,"\u21B6"],[/\\curvearrowright /g,"\u21B7"],[/\\circlearrowleft /g,"\u21BA"],[/\\circlearrowright /g,"\u21BB"],[/\\leftharpoonup /g,"\u21BC"],[/\\leftharpoondown /g,"\u21BD"],[/\\upharpoonright /g,"\u21BE"],[/\\upharpoonleft /g,"\u21BF"],[/\\rightharpoonup /g,"\u21C0"],[/\\rightharpoondown /g,"\u21C1"],[/\\downharpoonright /g,"\u21C2"],[/\\downharpoonleft /g,"\u21C3"],[/\\rightleftarrows /g,"\u21C4"],[/\\dblarrowupdown /g,"\u21C5"],[/\\leftrightarrows /g,"\u21C6"],[/\\leftleftarrows /g,"\u21C7"],[/\\upuparrows /g,"\u21C8"],[/\\rightrightarrows /g,"\u21C9"],[/\\downdownarrows /g,"\u21CA"],[/\\leftrightharpoons /g,"\u21CB"],[/\\rightleftharpoons /g,"\u21CC"],[/\\nLeftarrow /g,"\u21CD"],[/\\nLeftrightarrow /g,"\u21CE"],[/\\nRightarrow /g,"\u21CF"],[/\\Leftarrow /g,"\u21D0"],[/\\Uparrow /g,"\u21D1"],[/\\Rightarrow /g,"\u21D2"],[/\\Downarrow /g,"\u21D3"],[/\\Leftrightarrow /g,"\u21D4"],[/\\Updownarrow /g,"\u21D5"],[/\\Lleftarrow /g,"\u21DA"],[/\\Rrightarrow /g,"\u21DB"],[/\\rightsquigarrow /g,"\u21DD"],[/\\DownArrowUpArrow /g,"\u21F5"],[/\\forall /g,"\u2200"],[/\\complement /g,"\u2201"],[/\\partial /g,"\u2202"],[/\\exists /g,"\u2203"],[/\\nexists /g,"\u2204"],[/\\varnothing /g,"\u2205"],[/\\nabla /g,"\u2207"],[/\\in /g,"\u2208"],[/\\not\\in /g,"\u2209"],[/\\ni /g,"\u220B"],[/\\not\\ni /g,"\u220C"],[/\\prod /g,"\u220F"],[/\\coprod /g,"\u2210"],[/\\sum /g,"\u2211"],[/\\mp /g,"\u2213"],[/\\dotplus /g,"\u2214"],[/\\setminus /g,"\u2216"],[/\\circ /g,"\u2218"],[/\\bullet /g,"\u2219"],[/\\surd /g,"\u221A"],[/\\propto /g,"\u221D"],[/\\infty /g,"\u221E"],[/\\rightangle /g,"\u221F"],[/\\angle /g,"\u2220"],[/\\measuredangle /g,"\u2221"],[/\\sphericalangle /g,"\u2222"],[/\\mid /g,"\u2223"],[/\\nmid /g,"\u2224"],[/\\parallel /g,"\u2225"],[/\\nparallel /g,"\u2226"],[/\\wedge /g,"\u2227"],[/\\vee /g,"\u2228"],[/\\cap /g,"\u2229"],[/\\cup /g,"\u222A"],[/\\int /g,"\u222B"],[/\\int\\!\\int /g,"\u222C"],[/\\int\\!\\int\\!\\int /g,"\u222D"],[/\\oint /g,"\u222E"],[/\\surfintegral /g,"\u222F"],[/\\volintegral /g,"\u2230"],[/\\clwintegral /g,"\u2231"],[/\\ElsevierGlyph\{2232\}/g,"\u2232"],[/\\ElsevierGlyph\{2233\}/g,"\u2233"],[/\\therefore /g,"\u2234"],[/\\because /g,"\u2235"],[/\\Colon /g,"\u2237"],[/\\ElsevierGlyph\{2238\}/g,"\u2238"],[/\\mathbin\{\{:\}\\!\\!\{\-\}\\!\\!\{:\}\}/g,"\u223A"],[/\\homothetic /g,"\u223B"],[/\\sim /g,"\u223C"],[/\\backsim /g,"\u223D"],[/\\lazysinv /g,"\u223E"],[/\\wr /g,"\u2240"],[/\\not\\sim /g,"\u2241"],[/\\ElsevierGlyph\{2242\}/g,"\u2242"],[/\\NotEqualTilde /g,"\u2242-00338"],[/\\simeq /g,"\u2243"],[/\\not\\simeq /g,"\u2244"],[/\\cong /g,"\u2245"],[/\\approxnotequal /g,"\u2246"],[/\\not\\cong /g,"\u2247"],[/\\approx /g,"\u2248"],[/\\not\\approx /g,"\u2249"],[/\\approxeq /g,"\u224A"],[/\\tildetrpl /g,"\u224B"],[/\\not\\apid /g,"\u224B-00338"],[/\\allequal /g,"\u224C"],[/\\asymp /g,"\u224D"],[/\\Bumpeq /g,"\u224E"],[/\\NotHumpDownHump /g,"\u224E-00338"],[/\\bumpeq /g,"\u224F"],[/\\NotHumpEqual /g,"\u224F-00338"],[/\\doteq /g,"\u2250"],[/\\not\\doteq/g,"\u2250-00338"],[/\\doteqdot /g,"\u2251"],[/\\fallingdotseq /g,"\u2252"],[/\\risingdotseq /g,"\u2253"],[/\\eqcirc /g,"\u2256"],[/\\circeq /g,"\u2257"],[/\\estimates /g,"\u2259"],[/\\ElsevierGlyph\{225A\}/g,"\u225A"],[/\\starequal /g,"\u225B"],[/\\triangleq /g,"\u225C"],[/\\ElsevierGlyph\{225F\}/g,"\u225F"],[/\\not =/g,"\u2260"],[/\\equiv /g,"\u2261"],[/\\not\\equiv /g,"\u2262"],[/\\leq /g,"\u2264"],[/\\geq /g,"\u2265"],[/\\leqq /g,"\u2266"],[/\\geqq /g,"\u2267"],[/\\lneqq /g,"\u2268"],[/\\lvertneqq /g,"\u2268-0FE00"],[/\\gneqq /g,"\u2269"],[/\\gvertneqq /g,"\u2269-0FE00"],[/\\ll /g,"\u226A"],[/\\NotLessLess /g,"\u226A-00338"],[/\\gg /g,"\u226B"],[/\\NotGreaterGreater /g,"\u226B-00338"],[/\\between /g,"\u226C"],[/\\not\\kern\-0.3em\\times /g,"\u226D"],[/\\not</g,"\u226E"],[/\\not>/g,"\u226F"],[/\\not\\leq /g,"\u2270"],[/\\not\\geq /g,"\u2271"],[/\\lessequivlnt /g,"\u2272"],[/\\greaterequivlnt /g,"\u2273"],[/\\ElsevierGlyph\{2274\}/g,"\u2274"],[/\\ElsevierGlyph\{2275\}/g,"\u2275"],[/\\lessgtr /g,"\u2276"],[/\\gtrless /g,"\u2277"],[/\\notlessgreater /g,"\u2278"],[/\\notgreaterless /g,"\u2279"],[/\\prec /g,"\u227A"],[/\\succ /g,"\u227B"],[/\\preccurlyeq /g,"\u227C"],[/\\succcurlyeq /g,"\u227D"],[/\\precapprox /g,"\u227E"],[/\\NotPrecedesTilde /g,"\u227E-00338"],[/\\succapprox /g,"\u227F"],[/\\NotSucceedsTilde /g,"\u227F-00338"],[/\\not\\prec /g,"\u2280"],[/\\not\\succ /g,"\u2281"],[/\\subset /g,"\u2282"],[/\\supset /g,"\u2283"],[/\\not\\subset /g,"\u2284"],[/\\not\\supset /g,"\u2285"],[/\\subseteq /g,"\u2286"],[/\\supseteq /g,"\u2287"],[/\\not\\subseteq /g,"\u2288"],[/\\not\\supseteq /g,"\u2289"],[/\\subsetneq /g,"\u228A"],[/\\varsubsetneqq /g,"\u228A-0FE00"],[/\\supsetneq /g,"\u228B"],[/\\varsupsetneq /g,"\u228B-0FE00"],[/\\uplus /g,"\u228E"],[/\\sqsubset /g,"\u228F"],[/\\NotSquareSubset /g,"\u228F-00338"],[/\\sqsupset /g,"\u2290"],[/\\NotSquareSuperset /g,"\u2290-00338"],[/\\sqsubseteq /g,"\u2291"],[/\\sqsupseteq /g,"\u2292"],[/\\sqcap /g,"\u2293"],[/\\sqcup /g,"\u2294"],[/\\oplus /g,"\u2295"],[/\\ominus /g,"\u2296"],[/\\otimes /g,"\u2297"],[/\\oslash /g,"\u2298"],[/\\odot /g,"\u2299"],[/\\circledcirc /g,"\u229A"],[/\\circledast /g,"\u229B"],[/\\circleddash /g,"\u229D"],[/\\boxplus /g,"\u229E"],[/\\boxminus /g,"\u229F"],[/\\boxtimes /g,"\u22A0"],[/\\boxdot /g,"\u22A1"],[/\\vdash /g,"\u22A2"],[/\\dashv /g,"\u22A3"],[/\\top /g,"\u22A4"],[/\\perp /g,"\u22A5"],[/\\truestate /g,"\u22A7"],[/\\forcesextra /g,"\u22A8"],[/\\Vdash /g,"\u22A9"],[/\\Vvdash /g,"\u22AA"],[/\\VDash /g,"\u22AB"],[/\\nvdash /g,"\u22AC"],[/\\nvDash /g,"\u22AD"],[/\\nVdash /g,"\u22AE"],[/\\nVDash /g,"\u22AF"],[/\\vartriangleleft /g,"\u22B2"],[/\\vartriangleright /g,"\u22B3"],[/\\trianglelefteq /g,"\u22B4"],[/\\trianglerighteq /g,"\u22B5"],[/\\original /g,"\u22B6"],[/\\image /g,"\u22B7"],[/\\multimap /g,"\u22B8"],[/\\hermitconjmatrix /g,"\u22B9"],[/\\intercal /g,"\u22BA"],[/\\veebar /g,"\u22BB"],[/\\rightanglearc /g,"\u22BE"],[/\\ElsevierGlyph\{22C0\}/g,"\u22C0"],[/\\ElsevierGlyph\{22C1\}/g,"\u22C1"],[/\\bigcap /g,"\u22C2"],[/\\bigcup /g,"\u22C3"],[/\\diamond /g,"\u22C4"],[/\\cdot /g,"\u22C5"],[/\\star /g,"\u22C6"],[/\\divideontimes /g,"\u22C7"],[/\\bowtie /g,"\u22C8"],[/\\ltimes /g,"\u22C9"],[/\\rtimes /g,"\u22CA"],[/\\leftthreetimes /g,"\u22CB"],[/\\rightthreetimes /g,"\u22CC"],[/\\backsimeq /g,"\u22CD"],[/\\curlyvee /g,"\u22CE"],[/\\curlywedge /g,"\u22CF"],[/\\Subset /g,"\u22D0"],[/\\Supset /g,"\u22D1"],[/\\Cap /g,"\u22D2"],[/\\Cup /g,"\u22D3"],[/\\pitchfork /g,"\u22D4"],[/\\lessdot /g,"\u22D6"],[/\\gtrdot /g,"\u22D7"],[/\\verymuchless /g,"\u22D8"],[/\\verymuchgreater /g,"\u22D9"],[/\\lesseqgtr /g,"\u22DA"],[/\\gtreqless /g,"\u22DB"],[/\\curlyeqprec /g,"\u22DE"],[/\\curlyeqsucc /g,"\u22DF"],[/\\not\\sqsubseteq /g,"\u22E2"],[/\\not\\sqsupseteq /g,"\u22E3"],[/\\Elzsqspne /g,"\u22E5"],[/\\lnsim /g,"\u22E6"],[/\\gnsim /g,"\u22E7"],[/\\precedesnotsimilar /g,"\u22E8"],[/\\succnsim /g,"\u22E9"],[/\\ntriangleleft /g,"\u22EA"],[/\\ntriangleright /g,"\u22EB"],[/\\ntrianglelefteq /g,"\u22EC"],[/\\ntrianglerighteq /g,"\u22ED"],[/\\vdots /g,"\u22EE"],[/\\cdots /g,"\u22EF"],[/\\upslopeellipsis /g,"\u22F0"],[/\\downslopeellipsis /g,"\u22F1"],[/\\barwedge /g,"\u2305"],[/\\perspcorrespond /g,"\u2306"],[/\\lceil /g,"\u2308"],[/\\rceil /g,"\u2309"],[/\\lfloor /g,"\u230A"],[/\\rfloor /g,"\u230B"],[/\\recorder /g,"\u2315"],[/\\mathchar"2208/g,"\u2316"],[/\\ulcorner /g,"\u231C"],[/\\urcorner /g,"\u231D"],[/\\llcorner /g,"\u231E"],[/\\lrcorner /g,"\u231F"],[/\\frown /g,"\u2322"],[/\\smile /g,"\u2323"],[/\\langle /g,"\u2329"],[/\\rangle /g,"\u232A"],[/\\ElsevierGlyph\{E838\}/g,"\u233D"],[/\\Elzdlcorn /g,"\u23A3"],[/\\lmoustache /g,"\u23B0"],[/\\rmoustache /g,"\u23B1"],[/\\textvisiblespace /g,"\u2423"],[/\\ding\{172\}/g,"\u2460"],[/\\ding\{173\}/g,"\u2461"],[/\\ding\{174\}/g,"\u2462"],[/\\ding\{175\}/g,"\u2463"],[/\\ding\{176\}/g,"\u2464"],[/\\ding\{177\}/g,"\u2465"],[/\\ding\{178\}/g,"\u2466"],[/\\ding\{179\}/g,"\u2467"],[/\\ding\{180\}/g,"\u2468"],[/\\ding\{181\}/g,"\u2469"],[/\\circledS /g,"\u24C8"],[/\\Elzdshfnc /g,"\u2506"],[/\\Elzsqfnw /g,"\u2519"],[/\\diagup /g,"\u2571"],[/\\ding\{110\}/g,"\u25A0"],[/\\square /g,"\u25A1"],[/\\blacksquare /g,"\u25AA"],[/\\fbox\{~~\}/g,"\u25AD"],[/\\Elzvrecto /g,"\u25AF"],[/\\ElsevierGlyph\{E381\}/g,"\u25B1"],[/\\ding\{115\}/g,"\u25B2"],[/\\bigtriangleup /g,"\u25B3"],[/\\blacktriangle /g,"\u25B4"],[/\\vartriangle /g,"\u25B5"],[/\\blacktriangleright /g,"\u25B8"],[/\\triangleright /g,"\u25B9"],[/\\ding\{116\}/g,"\u25BC"],[/\\bigtriangledown /g,"\u25BD"],[/\\blacktriangledown /g,"\u25BE"],[/\\triangledown /g,"\u25BF"],[/\\blacktriangleleft /g,"\u25C2"],[/\\triangleleft /g,"\u25C3"],[/\\ding\{117\}/g,"\u25C6"],[/\\lozenge /g,"\u25CA"],[/\\bigcirc /g,"\u25CB"],[/\\ding\{108\}/g,"\u25CF"],[/\\Elzcirfl /g,"\u25D0"],[/\\Elzcirfr /g,"\u25D1"],[/\\Elzcirfb /g,"\u25D2"],[/\\ding\{119\}/g,"\u25D7"],[/\\Elzrvbull /g,"\u25D8"],[/\\Elzsqfl /g,"\u25E7"],[/\\Elzsqfr /g,"\u25E8"],[/\\Elzsqfse /g,"\u25EA"],[/\\bigcirc /g,"\u25EF"],[/\\ding\{72\}/g,"\u2605"],[/\\ding\{73\}/g,"\u2606"],[/\\ding\{37\}/g,"\u260E"],[/\\ding\{42\}/g,"\u261B"],[/\\ding\{43\}/g,"\u261E"],[/\\rightmoon /g,"\u263E"],[/\\mercury /g,"\u263F"],[/\\venus /g,"\u2640"],[/\\male /g,"\u2642"],[/\\jupiter /g,"\u2643"],[/\\saturn /g,"\u2644"],[/\\uranus /g,"\u2645"],[/\\neptune /g,"\u2646"],[/\\pluto /g,"\u2647"],[/\\aries /g,"\u2648"],[/\\taurus /g,"\u2649"],[/\\gemini /g,"\u264A"],[/\\cancer /g,"\u264B"],[/\\leo /g,"\u264C"],[/\\virgo /g,"\u264D"],[/\\libra /g,"\u264E"],[/\\scorpio /g,"\u264F"],[/\\sagittarius /g,"\u2650"],[/\\capricornus /g,"\u2651"],[/\\aquarius /g,"\u2652"],[/\\pisces /g,"\u2653"],[/\\ding\{171\}/g,"\u2660"],[/\\diamond /g,"\u2662"],[/\\ding\{168\}/g,"\u2663"],[/\\ding\{170\}/g,"\u2665"],[/\\ding\{169\}/g,"\u2666"],[/\\quarternote /g,"\u2669"],[/\\eighthnote /g,"\u266A"],[/\\flat /g,"\u266D"],[/\\natural /g,"\u266E"],[/\\sharp /g,"\u266F"],[/\\ding\{33\}/g,"\u2701"],[/\\ding\{34\}/g,"\u2702"],[/\\ding\{35\}/g,"\u2703"],[/\\ding\{36\}/g,"\u2704"],[/\\ding\{38\}/g,"\u2706"],[/\\ding\{39\}/g,"\u2707"],[/\\ding\{40\}/g,"\u2708"],[/\\ding\{41\}/g,"\u2709"],[/\\ding\{44\}/g,"\u270C"],[/\\ding\{45\}/g,"\u270D"],[/\\ding\{46\}/g,"\u270E"],[/\\ding\{47\}/g,"\u270F"],[/\\ding\{48\}/g,"\u2710"],[/\\ding\{49\}/g,"\u2711"],[/\\ding\{50\}/g,"\u2712"],[/\\ding\{51\}/g,"\u2713"],[/\\ding\{52\}/g,"\u2714"],[/\\ding\{53\}/g,"\u2715"],[/\\ding\{54\}/g,"\u2716"],[/\\ding\{55\}/g,"\u2717"],[/\\ding\{56\}/g,"\u2718"],[/\\ding\{57\}/g,"\u2719"],[/\\ding\{58\}/g,"\u271A"],[/\\ding\{59\}/g,"\u271B"],[/\\ding\{60\}/g,"\u271C"],[/\\ding\{61\}/g,"\u271D"],[/\\ding\{62\}/g,"\u271E"],[/\\ding\{63\}/g,"\u271F"],[/\\ding\{64\}/g,"\u2720"],[/\\ding\{65\}/g,"\u2721"],[/\\ding\{66\}/g,"\u2722"],[/\\ding\{67\}/g,"\u2723"],[/\\ding\{68\}/g,"\u2724"],[/\\ding\{69\}/g,"\u2725"],[/\\ding\{70\}/g,"\u2726"],[/\\ding\{71\}/g,"\u2727"],[/\\ding\{73\}/g,"\u2729"],[/\\ding\{74\}/g,"\u272A"],[/\\ding\{75\}/g,"\u272B"],[/\\ding\{76\}/g,"\u272C"],[/\\ding\{77\}/g,"\u272D"],[/\\ding\{78\}/g,"\u272E"],[/\\ding\{79\}/g,"\u272F"],[/\\ding\{80\}/g,"\u2730"],[/\\ding\{81\}/g,"\u2731"],[/\\ding\{82\}/g,"\u2732"],[/\\ding\{83\}/g,"\u2733"],[/\\ding\{84\}/g,"\u2734"],[/\\ding\{85\}/g,"\u2735"],[/\\ding\{86\}/g,"\u2736"],[/\\ding\{87\}/g,"\u2737"],[/\\ding\{88\}/g,"\u2738"],[/\\ding\{89\}/g,"\u2739"],[/\\ding\{90\}/g,"\u273A"],[/\\ding\{91\}/g,"\u273B"],[/\\ding\{92\}/g,"\u273C"],[/\\ding\{93\}/g,"\u273D"],[/\\ding\{94\}/g,"\u273E"],[/\\ding\{95\}/g,"\u273F"],[/\\ding\{96\}/g,"\u2740"],[/\\ding\{97\}/g,"\u2741"],[/\\ding\{98\}/g,"\u2742"],[/\\ding\{99\}/g,"\u2743"],[/\\ding\{100\}/g,"\u2744"],[/\\ding\{101\}/g,"\u2745"],[/\\ding\{102\}/g,"\u2746"],[/\\ding\{103\}/g,"\u2747"],[/\\ding\{104\}/g,"\u2748"],[/\\ding\{105\}/g,"\u2749"],[/\\ding\{106\}/g,"\u274A"],[/\\ding\{107\}/g,"\u274B"],[/\\ding\{109\}/g,"\u274D"],[/\\ding\{111\}/g,"\u274F"],[/\\ding\{112\}/g,"\u2750"],[/\\ding\{113\}/g,"\u2751"],[/\\ding\{114\}/g,"\u2752"],[/\\ding\{118\}/g,"\u2756"],[/\\ding\{120\}/g,"\u2758"],[/\\ding\{121\}/g,"\u2759"],[/\\ding\{122\}/g,"\u275A"],[/\\ding\{123\}/g,"\u275B"],[/\\ding\{124\}/g,"\u275C"],[/\\ding\{125\}/g,"\u275D"],[/\\ding\{126\}/g,"\u275E"],[/\\ding\{161\}/g,"\u2761"],[/\\ding\{162\}/g,"\u2762"],[/\\ding\{163\}/g,"\u2763"],[/\\ding\{164\}/g,"\u2764"],[/\\ding\{165\}/g,"\u2765"],[/\\ding\{166\}/g,"\u2766"],[/\\ding\{167\}/g,"\u2767"],[/\\ding\{182\}/g,"\u2776"],[/\\ding\{183\}/g,"\u2777"],[/\\ding\{184\}/g,"\u2778"],[/\\ding\{185\}/g,"\u2779"],[/\\ding\{186\}/g,"\u277A"],[/\\ding\{187\}/g,"\u277B"],[/\\ding\{188\}/g,"\u277C"],[/\\ding\{189\}/g,"\u277D"],[/\\ding\{190\}/g,"\u277E"],[/\\ding\{191\}/g,"\u277F"],[/\\ding\{192\}/g,"\u2780"],[/\\ding\{193\}/g,"\u2781"],[/\\ding\{194\}/g,"\u2782"],[/\\ding\{195\}/g,"\u2783"],[/\\ding\{196\}/g,"\u2784"],[/\\ding\{197\}/g,"\u2785"],[/\\ding\{198\}/g,"\u2786"],[/\\ding\{199\}/g,"\u2787"],[/\\ding\{200\}/g,"\u2788"],[/\\ding\{201\}/g,"\u2789"],[/\\ding\{202\}/g,"\u278A"],[/\\ding\{203\}/g,"\u278B"],[/\\ding\{204\}/g,"\u278C"],[/\\ding\{205\}/g,"\u278D"],[/\\ding\{206\}/g,"\u278E"],[/\\ding\{207\}/g,"\u278F"],[/\\ding\{208\}/g,"\u2790"],[/\\ding\{209\}/g,"\u2791"],[/\\ding\{210\}/g,"\u2792"],[/\\ding\{211\}/g,"\u2793"],[/\\ding\{212\}/g,"\u2794"],[/\\ding\{216\}/g,"\u2798"],[/\\ding\{217\}/g,"\u2799"],[/\\ding\{218\}/g,"\u279A"],[/\\ding\{219\}/g,"\u279B"],[/\\ding\{220\}/g,"\u279C"],[/\\ding\{221\}/g,"\u279D"],[/\\ding\{222\}/g,"\u279E"],[/\\ding\{223\}/g,"\u279F"],[/\\ding\{224\}/g,"\u27A0"],[/\\ding\{225\}/g,"\u27A1"],[/\\ding\{226\}/g,"\u27A2"],[/\\ding\{227\}/g,"\u27A3"],[/\\ding\{228\}/g,"\u27A4"],[/\\ding\{229\}/g,"\u27A5"],[/\\ding\{230\}/g,"\u27A6"],[/\\ding\{231\}/g,"\u27A7"],[/\\ding\{232\}/g,"\u27A8"],[/\\ding\{233\}/g,"\u27A9"],[/\\ding\{234\}/g,"\u27AA"],[/\\ding\{235\}/g,"\u27AB"],[/\\ding\{236\}/g,"\u27AC"],[/\\ding\{237\}/g,"\u27AD"],[/\\ding\{238\}/g,"\u27AE"],[/\\ding\{239\}/g,"\u27AF"],[/\\ding\{241\}/g,"\u27B1"],[/\\ding\{242\}/g,"\u27B2"],[/\\ding\{243\}/g,"\u27B3"],[/\\ding\{244\}/g,"\u27B4"],[/\\ding\{245\}/g,"\u27B5"],[/\\ding\{246\}/g,"\u27B6"],[/\\ding\{247\}/g,"\u27B7"],[/\\ding\{248\}/g,"\u27B8"],[/\\ding\{249\}/g,"\u27B9"],[/\\ding\{250\}/g,"\u27BA"],[/\\ding\{251\}/g,"\u27BB"],[/\\ding\{252\}/g,"\u27BC"],[/\\ding\{253\}/g,"\u27BD"],[/\\ding\{254\}/g,"\u27BE"],[/\\longleftarrow /g,"\u27F5"],[/\\longrightarrow /g,"\u27F6"],[/\\longleftrightarrow /g,"\u27F7"],[/\\Longleftarrow /g,"\u27F8"],[/\\Longrightarrow /g,"\u27F9"],[/\\Longleftrightarrow /g,"\u27FA"],[/\\longmapsto /g,"\u27FC"],[/\\sim\\joinrel\\leadsto/g,"\u27FF"],[/\\ElsevierGlyph\{E212\}/g,"\u2905"],[/\\UpArrowBar /g,"\u2912"],[/\\DownArrowBar /g,"\u2913"],[/\\ElsevierGlyph\{E20C\}/g,"\u2923"],[/\\ElsevierGlyph\{E20D\}/g,"\u2924"],[/\\ElsevierGlyph\{E20B\}/g,"\u2925"],[/\\ElsevierGlyph\{E20A\}/g,"\u2926"],[/\\ElsevierGlyph\{E211\}/g,"\u2927"],[/\\ElsevierGlyph\{E20E\}/g,"\u2928"],[/\\ElsevierGlyph\{E20F\}/g,"\u2929"],[/\\ElsevierGlyph\{E210\}/g,"\u292A"],[/\\ElsevierGlyph\{E21C\}/g,"\u2933"],[/\\ElsevierGlyph\{E21D\}/g,"\u2933-00338"],[/\\ElsevierGlyph\{E21A\}/g,"\u2936"],[/\\ElsevierGlyph\{E219\}/g,"\u2937"],[/\\Elolarr /g,"\u2940"],[/\\Elorarr /g,"\u2941"],[/\\ElzRlarr /g,"\u2942"],[/\\ElzrLarr /g,"\u2944"],[/\\Elzrarrx /g,"\u2947"],[/\\LeftRightVector /g,"\u294E"],[/\\RightUpDownVector /g,"\u294F"],[/\\DownLeftRightVector /g,"\u2950"],[/\\LeftUpDownVector /g,"\u2951"],[/\\LeftVectorBar /g,"\u2952"],[/\\RightVectorBar /g,"\u2953"],[/\\RightUpVectorBar /g,"\u2954"],[/\\RightDownVectorBar /g,"\u2955"],[/\\DownLeftVectorBar /g,"\u2956"],[/\\DownRightVectorBar /g,"\u2957"],[/\\LeftUpVectorBar /g,"\u2958"],[/\\LeftDownVectorBar /g,"\u2959"],[/\\LeftTeeVector /g,"\u295A"],[/\\RightTeeVector /g,"\u295B"],[/\\RightUpTeeVector /g,"\u295C"],[/\\RightDownTeeVector /g,"\u295D"],[/\\DownLeftTeeVector /g,"\u295E"],[/\\DownRightTeeVector /g,"\u295F"],[/\\LeftUpTeeVector /g,"\u2960"],[/\\LeftDownTeeVector /g,"\u2961"],[/\\UpEquilibrium /g,"\u296E"],[/\\ReverseUpEquilibrium /g,"\u296F"],[/\\RoundImplies /g,"\u2970"],[/\\ElsevierGlyph\{E214\}/g,"\u297C"],[/\\ElsevierGlyph\{E215\}/g,"\u297D"],[/\\Elztfnc /g,"\u2980"],[/\\ElsevierGlyph\{3018\}/g,"\u2985"],[/\\Elroang /g,"\u2986"],[/\\ElsevierGlyph\{E291\}/g,"\u2994"],[/\\Elzddfnc /g,"\u2999"],[/\\Angle /g,"\u299C"],[/\\Elzlpargt /g,"\u29A0"],[/\\ElsevierGlyph\{E260\}/g,"\u29B5"],[/\\ElsevierGlyph\{E61B\}/g,"\u29B6"],[/\\ElzLap /g,"\u29CA"],[/\\Elzdefas /g,"\u29CB"],[/\\LeftTriangleBar /g,"\u29CF"],[/\\NotLeftTriangleBar /g,"\u29CF-00338"],[/\\RightTriangleBar /g,"\u29D0"],[/\\NotRightTriangleBar /g,"\u29D0-00338"],[/\\ElsevierGlyph\{E372\}/g,"\u29DC"],[/\\blacklozenge /g,"\u29EB"],[/\\RuleDelayed /g,"\u29F4"],[/\\Elxuplus /g,"\u2A04"],[/\\ElzThr /g,"\u2A05"],[/\\Elxsqcup /g,"\u2A06"],[/\\ElzInf /g,"\u2A07"],[/\\ElzSup /g,"\u2A08"],[/\\ElzCint /g,"\u2A0D"],[/\\clockoint /g,"\u2A0F"],[/\\ElsevierGlyph\{E395\}/g,"\u2A10"],[/\\sqrint /g,"\u2A16"],[/\\ElsevierGlyph\{E25A\}/g,"\u2A25"],[/\\ElsevierGlyph\{E25B\}/g,"\u2A2A"],[/\\ElsevierGlyph\{E25C\}/g,"\u2A2D"],[/\\ElsevierGlyph\{E25D\}/g,"\u2A2E"],[/\\ElzTimes /g,"\u2A2F"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A34"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A35"],[/\\ElsevierGlyph\{E259\}/g,"\u2A3C"],[/\\amalg /g,"\u2A3F"],[/\\ElzAnd /g,"\u2A53"],[/\\ElzOr /g,"\u2A54"],[/\\ElsevierGlyph\{E36E\}/g,"\u2A55"],[/\\ElOr /g,"\u2A56"],[/\\perspcorrespond /g,"\u2A5E"],[/\\Elzminhat /g,"\u2A5F"],[/\\ElsevierGlyph\{225A\}/g,"\u2A63"],[/\\stackrel\{*\}\{=\}/g,"\u2A6E"],[/\\Equal /g,"\u2A75"],[/\\leqslant /g,"\u2A7D"],[/\\nleqslant /g,"\u2A7D-00338"],[/\\geqslant /g,"\u2A7E"],[/\\ngeqslant /g,"\u2A7E-00338"],[/\\lessapprox /g,"\u2A85"],[/\\gtrapprox /g,"\u2A86"],[/\\lneq /g,"\u2A87"],[/\\gneq /g,"\u2A88"],[/\\lnapprox /g,"\u2A89"],[/\\gnapprox /g,"\u2A8A"],[/\\lesseqqgtr /g,"\u2A8B"],[/\\gtreqqless /g,"\u2A8C"],[/\\eqslantless /g,"\u2A95"],[/\\eqslantgtr /g,"\u2A96"],[/\\Pisymbol\{ppi020\}\{117\}/g,"\u2A9D"],[/\\Pisymbol\{ppi020\}\{105\}/g,"\u2A9E"],[/\\NestedLessLess /g,"\u2AA1"],[/\\NotNestedLessLess /g,"\u2AA1-00338"],[/\\NestedGreaterGreater /g,"\u2AA2"],[/\\NotNestedGreaterGreater /g,"\u2AA2-00338"],[/\\preceq /g,"\u2AAF"],[/\\not\\preceq /g,"\u2AAF-00338"],[/\\succeq /g,"\u2AB0"],[/\\not\\succeq /g,"\u2AB0-00338"],[/\\precneqq /g,"\u2AB5"],[/\\succneqq /g,"\u2AB6"],[/\\precapprox /g,"\u2AB7"],[/\\succapprox /g,"\u2AB8"],[/\\precnapprox /g,"\u2AB9"],[/\\succnapprox /g,"\u2ABA"],[/\\subseteqq /g,"\u2AC5"],[/\\nsubseteqq /g,"\u2AC5-00338"],[/\\supseteqq /g,"\u2AC6"],[/\\nsupseteqq/g,"\u2AC6-00338"],[/\\subsetneqq /g,"\u2ACB"],[/\\supsetneqq /g,"\u2ACC"],[/\\ElsevierGlyph\{E30D\}/g,"\u2AEB"],[/\\Elztdcol /g,"\u2AF6"],[/\\ElsevierGlyph\{300A\}/g,"\u300A"],[/\\ElsevierGlyph\{300B\}/g,"\u300B"],[/\\ElsevierGlyph\{3018\}/g,"\u3018"],[/\\ElsevierGlyph\{3019\}/g,"\u3019"],[/\\openbracketleft /g,"\u301A"],[/\\openbracketright /g,"\u301B"]];return this}if(typeof module!=="undefined"&&module.exports){module.exports=BibtexParser};
\ No newline at end of file
+function BibtexParser(c){if(typeof c=="string"){var d={};var a=[];function b(f){a.push(f)}var e=BibtexParser.call(d,b);e.parse(c);return{entries:a,errors:e.getErrors()}}if(typeof c!="function"){throw"Invalid parser construction."}this.STATES_={ENTRY_OR_JUNK:0,OBJECT_TYPE:1,ENTRY_KEY:2,KV_KEY:3,EQUALS:4,KV_VALUE:5};this.DATA_={};this.CALLBACK_=c;this.CHAR_=0;this.LINE_=1;this.CHAR_IN_LINE_=0;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={};this.SKIPTILLEOL_=false;this.VALBRACES_=null;this.BRACETYPE_=null;this.BRACECOUNT_=0;this.STATE_=this.STATES_.ENTRY_OR_JUNK;this.ERRORS_=[];this.ENTRY_TYPES_={inproceedings:1,proceedings:2,article:3,techreport:4,misc:5,mastersthesis:6,book:7,phdthesis:8,incollection:9,unpublished:10,inbook:11,manual:12,periodical:13,booklet:14,masterthesis:15,conference:16,data:999};this.MACROS_={jan:"January",feb:"February",mar:"March",apr:"April",may:"May",jun:"June",jul:"July",aug:"August",sep:"September",oct:"October",nov:"November",dec:"December",Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"};this.getErrors=function(){return this.ERRORS_};this.parse=function(f){for(var g=0;g<f.length;g++){this.processCharacter_(f[g])}};this.error_=function(f){this.ERRORS_.push([this.LINE_,this.CHAR_IN_LINE_,this.CHAR_,f])};this.processEntry_=function(){var h=this.DATA_;if(h.Fields){for(var k in h.Fields){var p=h.Fields[k];for(var j=0;j<this.CHARCONV_.length;j++){var q=this.CHARCONV_[j][0];var n=this.CHARCONV_[j][1];p=p.replace(q,n)}p=p.replace(/[\n\r\t]/g," ").replace(/\s\s+/g," ").replace(/^\s+|\s+$/g,"");var l=p.length;var g="";for(var j=0;j<l;j++){var m=p[j];var o=false;if(m=="\\"&&j<l-1){m=p[++j]}else{if(m=="{"||m=="}"){o=true}}if(!o){g+=m}}h.Fields[k]=g}}if(h.ObjectType=="string"){for(var k in h.Fields){this.MACROS_[k]=h.Fields[k]}}else{this.CALLBACK_(h)}};this.processCharacter_=function(l){this.CHAR_++;this.CHAR_IN_LINE_++;if(l=="\n"){this.LINE_++;this.CHAR_IN_LINE_=1}if(this.SKIPTILLEOL_){if(l=="\n"){this.SKIPTILLEOL_=false}return}if(this.SKIPCOMMENT_&&l=="%"){this.SKIPTILLEOL_=true;return}if(this.SKIPWS_&&/\s/.test(l)){return}this.SKIPWS_=false;this.SKIPCOMMENT_=false;this.SKIPTILLEOL_=false;var f=true;while(f){f=false;switch(this.STATE_){case this.STATES_.ENTRY_OR_JUNK:if(l=="@"){this.STATE_=this.STATES_.OBJECT_TYPE;this.DATA_={ObjectType:""}}this.BRACETYPE_=null;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break;case this.STATES_.OBJECT_TYPE:if(/[A-Za-z]/.test(l)){this.DATA_.ObjectType+=l.toLowerCase();this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{var i=this.DATA_.ObjectType;if(i=="comment"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i=="string"){this.DATA_.ObjectType=i;this.DATA_.Fields={};this.BRACETYPE_=l;this.BRACECOUNT_=1;this.STATE_=this.STATES_.KV_KEY;this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.PARSETMP_={Key:""}}else{if(i=="preamble"){this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{if(i in this.ENTRY_TYPES_){this.DATA_.ObjectType="entry";this.DATA_.EntryType=i;this.DATA_.EntryKey="";this.STATE_=this.STATES_.ENTRY_KEY;f=true}else{this.error_('Unrecognized object type: "'+this.DATA_.ObjectType+'"');this.STATE_=this.STATES_.ENTRY_OR_JUNK}}}}}break;case this.STATES_.ENTRY_KEY:if((l==="{"||l==="(")&&this.BRACETYPE_==null){this.BRACETYPE_=l;this.BRACECOUNT_=1;this.SKIPWS_=true;this.SKIPCOMMENT_=true;break}if(/[,%\s]/.test(l)){if(this.DATA_.EntryKey.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{if(this.BRACETYPE_==null){this.error_("No opening brace for object.");this.STATE_=this.STATES_.ENTRY_OR_JUNK}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;f=true;this.STATE_=this.STATES_.KV_KEY;this.PARSETMP_.Key="";this.DATA_.Fields={}}}}else{this.DATA_.EntryKey+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}break;case this.STATES_.KV_KEY:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(/[\-A-Za-z:]/.test(l)){this.PARSETMP_.Key+=l;this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{if(this.PARSETMP_.Key.length<1){this.SKIPWS_=true;this.SKIPCOMMENT_=true}else{this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.EQUALS;f=true}}break;case this.STATES_.EQUALS:if((l=="}"&&this.BRACETYPE_=="{")||(l==")"&&this.BRACETYPE_=="(")){this.error_('Key-value pair has key "'+this.PARSETMP_.Key+'", but no value.');this.processEntry_();this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.ENTRY_OR_JUNK;break}if(l=="="){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_VALUE;this.PARSETMP_.Value="";this.VALBRACES_={'"':[],"{":[]}}break;case this.STATES_.KV_VALUE:var k=this.VALBRACES_;var j=this.PARSETMP_.Value;var h=false;if(l=='"'||l=="{"||l=="}"||l==","){if(l==","){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}h=true}}if(l=='"'){if(0===k['"'].length+k["{"].length){k['"'].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false;break}if(k['"'].length==1&&k["{"].length==0&&(j.length==0||j[j.length-1]!="\\")){h=true}else{}}if(l=="{"){if(j.length==0||j[j.length-1]!="\\"){k["{"].push(this.CHAR_);this.SKIPWS_=false;this.SKIPCOMMENT_=false}else{}}if(l=="}"){if(0===k['"'].length+k["{"].length){var g=this.PARSETMP_.Value.trim();if(g in this.MACROS_){this.PARSETMP_.Value=this.MACROS_[g]}else{this.error_("Reference to an undefined macro: "+g)}f=true;h=true}else{if(j.length==0||j[j.length-1]!="\\"){if(k["{"].length>0){k["{"].splice(k["{"].length-1,1);if(0==k["{"].length+k['"'].length){h=true}else{}}}else{}}}}if(h){this.SKIPWS_=true;this.SKIPCOMMENT_=true;this.STATE_=this.STATES_.KV_KEY;this.DATA_.Fields[this.PARSETMP_.Key]=this.PARSETMP_.Value;this.PARSETMP_={Key:""};this.VALBRACES_=null}else{this.PARSETMP_.Value+=l}break}}};this.CHARCONV_=[[/\\space /g,"\u0020"],[/\\textdollar /g,"\u0024"],[/\\textquotesingle /g,"\u0027"],[/\\ast /g,"\u002A"],[/\\textbackslash /g,"\u005C"],[/\\\^\{\}/g,"\u005E"],[/\\textasciigrave /g,"\u0060"],[/\\lbrace /g,"\u007B"],[/\\vert /g,"\u007C"],[/\\rbrace /g,"\u007D"],[/\\textasciitilde /g,"\u007E"],[/\\textexclamdown /g,"\u00A1"],[/\\textcent /g,"\u00A2"],[/\\textsterling /g,"\u00A3"],[/\\textcurrency /g,"\u00A4"],[/\\textyen /g,"\u00A5"],[/\\textbrokenbar /g,"\u00A6"],[/\\textsection /g,"\u00A7"],[/\\textasciidieresis /g,"\u00A8"],[/\\textcopyright /g,"\u00A9"],[/\\textordfeminine /g,"\u00AA"],[/\\guillemotleft /g,"\u00AB"],[/\\lnot /g,"\u00AC"],[/\\textregistered /g,"\u00AE"],[/\\textasciimacron /g,"\u00AF"],[/\\textdegree /g,"\u00B0"],[/\\pm /g,"\u00B1"],[/\\textasciiacute /g,"\u00B4"],[/\\mathrm\{\\mu\}/g,"\u00B5"],[/\\textparagraph /g,"\u00B6"],[/\\cdot /g,"\u00B7"],[/\\c\{\}/g,"\u00B8"],[/\\textordmasculine /g,"\u00BA"],[/\\guillemotright /g,"\u00BB"],[/\\textonequarter /g,"\u00BC"],[/\\textonehalf /g,"\u00BD"],[/\\textthreequarters /g,"\u00BE"],[/\\textquestiondown /g,"\u00BF"],[/\\`\{A\}/g,"\u00C0"],[/\\'\{A\}/g,"\u00C1"],[/\\\^\{A\}/g,"\u00C2"],[/\\~\{A\}/g,"\u00C3"],[/\\"\{A\}/g,"\u00C4"],[/\\AA /g,"\u00C5"],[/\\AE /g,"\u00C6"],[/\\c\{C\}/g,"\u00C7"],[/\\`\{E\}/g,"\u00C8"],[/\\'\{E\}/g,"\u00C9"],[/\\\^\{E\}/g,"\u00CA"],[/\\"\{E\}/g,"\u00CB"],[/\\`\{I\}/g,"\u00CC"],[/\\'\{I\}/g,"\u00CD"],[/\\\^\{I\}/g,"\u00CE"],[/\\"\{I\}/g,"\u00CF"],[/\\DH /g,"\u00D0"],[/\\~\{N\}/g,"\u00D1"],[/\\`\{O\}/g,"\u00D2"],[/\\'\{O\}/g,"\u00D3"],[/\\\^\{O\}/g,"\u00D4"],[/\\~\{O\}/g,"\u00D5"],[/\\"\{O\}/g,"\u00D6"],[/\\texttimes /g,"\u00D7"],[/\\O /g,"\u00D8"],[/\\`\{U\}/g,"\u00D9"],[/\\'\{U\}/g,"\u00DA"],[/\\\^\{U\}/g,"\u00DB"],[/\\"\{U\}/g,"\u00DC"],[/\\'\{Y\}/g,"\u00DD"],[/\\TH /g,"\u00DE"],[/\\ss /g,"\u00DF"],[/\\`\{a\}/g,"\u00E0"],[/\\'\{a\}/g,"\u00E1"],[/\\\^\{a\}/g,"\u00E2"],[/\\~\{a\}/g,"\u00E3"],[/\\"\{a\}/g,"\u00E4"],[/\\aa /g,"\u00E5"],[/\\ae /g,"\u00E6"],[/\\c\{c\}/g,"\u00E7"],[/\\`\{e\}/g,"\u00E8"],[/\\'\{e\}/g,"\u00E9"],[/\\\^\{e\}/g,"\u00EA"],[/\\"\{e\}/g,"\u00EB"],[/\\`\{\\i\}/g,"\u00EC"],[/\\'\{\\i\}/g,"\u00ED"],[/\\\^\{\\i\}/g,"\u00EE"],[/\\"\{\\i\}/g,"\u00EF"],[/\\dh /g,"\u00F0"],[/\\~\{n\}/g,"\u00F1"],[/\\`\{o\}/g,"\u00F2"],[/\\'\{o\}/g,"\u00F3"],[/\\\^\{o\}/g,"\u00F4"],[/\\~\{o\}/g,"\u00F5"],[/\\"\{o\}/g,"\u00F6"],[/\\div /g,"\u00F7"],[/\\o /g,"\u00F8"],[/\\`\{u\}/g,"\u00F9"],[/\\'\{u\}/g,"\u00FA"],[/\\\^\{u\}/g,"\u00FB"],[/\\"\{u\}/g,"\u00FC"],[/\\'\{y\}/g,"\u00FD"],[/\\th /g,"\u00FE"],[/\\"\{y\}/g,"\u00FF"],[/\\=\{A\}/g,"\u0100"],[/\\=\{a\}/g,"\u0101"],[/\\u\{A\}/g,"\u0102"],[/\\u\{a\}/g,"\u0103"],[/\\k\{A\}/g,"\u0104"],[/\\k\{a\}/g,"\u0105"],[/\\'\{C\}/g,"\u0106"],[/\\'\{c\}/g,"\u0107"],[/\\\^\{C\}/g,"\u0108"],[/\\\^\{c\}/g,"\u0109"],[/\\.\{C\}/g,"\u010A"],[/\\.\{c\}/g,"\u010B"],[/\\v\{C\}/g,"\u010C"],[/\\v\{c\}/g,"\u010D"],[/\\v\{D\}/g,"\u010E"],[/\\v\{d\}/g,"\u010F"],[/\\DJ /g,"\u0110"],[/\\dj /g,"\u0111"],[/\\=\{E\}/g,"\u0112"],[/\\=\{e\}/g,"\u0113"],[/\\u\{E\}/g,"\u0114"],[/\\u\{e\}/g,"\u0115"],[/\\.\{E\}/g,"\u0116"],[/\\.\{e\}/g,"\u0117"],[/\\k\{E\}/g,"\u0118"],[/\\k\{e\}/g,"\u0119"],[/\\v\{E\}/g,"\u011A"],[/\\v\{e\}/g,"\u011B"],[/\\\^\{G\}/g,"\u011C"],[/\\\^\{g\}/g,"\u011D"],[/\\u\{G\}/g,"\u011E"],[/\\u\{g\}/g,"\u011F"],[/\\.\{G\}/g,"\u0120"],[/\\.\{g\}/g,"\u0121"],[/\\c\{G\}/g,"\u0122"],[/\\c\{g\}/g,"\u0123"],[/\\\^\{H\}/g,"\u0124"],[/\\\^\{h\}/g,"\u0125"],[/\\Elzxh /g,"\u0127"],[/\\~\{I\}/g,"\u0128"],[/\\~\{\\i\}/g,"\u0129"],[/\\=\{I\}/g,"\u012A"],[/\\=\{\\i\}/g,"\u012B"],[/\\u\{I\}/g,"\u012C"],[/\\u\{\\i\}/g,"\u012D"],[/\\k\{I\}/g,"\u012E"],[/\\k\{i\}/g,"\u012F"],[/\\.\{I\}/g,"\u0130"],[/\\i /g,"\u0131"],[/\\\^\{J\}/g,"\u0134"],[/\\\^\{\\j\}/g,"\u0135"],[/\\c\{K\}/g,"\u0136"],[/\\c\{k\}/g,"\u0137"],[/\\'\{L\}/g,"\u0139"],[/\\'\{l\}/g,"\u013A"],[/\\c\{L\}/g,"\u013B"],[/\\c\{l\}/g,"\u013C"],[/\\v\{L\}/g,"\u013D"],[/\\v\{l\}/g,"\u013E"],[/\\L /g,"\u0141"],[/\\l /g,"\u0142"],[/\\'\{N\}/g,"\u0143"],[/\\'\{n\}/g,"\u0144"],[/\\c\{N\}/g,"\u0145"],[/\\c\{n\}/g,"\u0146"],[/\\v\{N\}/g,"\u0147"],[/\\v\{n\}/g,"\u0148"],[/\\NG /g,"\u014A"],[/\\ng /g,"\u014B"],[/\\=\{O\}/g,"\u014C"],[/\\=\{o\}/g,"\u014D"],[/\\u\{O\}/g,"\u014E"],[/\\u\{o\}/g,"\u014F"],[/\\H\{O\}/g,"\u0150"],[/\\H\{o\}/g,"\u0151"],[/\\OE /g,"\u0152"],[/\\oe /g,"\u0153"],[/\\'\{R\}/g,"\u0154"],[/\\'\{r\}/g,"\u0155"],[/\\c\{R\}/g,"\u0156"],[/\\c\{r\}/g,"\u0157"],[/\\v\{R\}/g,"\u0158"],[/\\v\{r\}/g,"\u0159"],[/\\'\{S\}/g,"\u015A"],[/\\'\{s\}/g,"\u015B"],[/\\\^\{S\}/g,"\u015C"],[/\\\^\{s\}/g,"\u015D"],[/\\c\{S\}/g,"\u015E"],[/\\c\{s\}/g,"\u015F"],[/\\v\{S\}/g,"\u0160"],[/\\v\{s\}/g,"\u0161"],[/\\c\{T\}/g,"\u0162"],[/\\c\{t\}/g,"\u0163"],[/\\v\{T\}/g,"\u0164"],[/\\v\{t\}/g,"\u0165"],[/\\~\{U\}/g,"\u0168"],[/\\~\{u\}/g,"\u0169"],[/\\=\{U\}/g,"\u016A"],[/\\=\{u\}/g,"\u016B"],[/\\u\{U\}/g,"\u016C"],[/\\u\{u\}/g,"\u016D"],[/\\r\{U\}/g,"\u016E"],[/\\r\{u\}/g,"\u016F"],[/\\H\{U\}/g,"\u0170"],[/\\H\{u\}/g,"\u0171"],[/\\k\{U\}/g,"\u0172"],[/\\k\{u\}/g,"\u0173"],[/\\\^\{W\}/g,"\u0174"],[/\\\^\{w\}/g,"\u0175"],[/\\\^\{Y\}/g,"\u0176"],[/\\\^\{y\}/g,"\u0177"],[/\\"\{Y\}/g,"\u0178"],[/\\'\{Z\}/g,"\u0179"],[/\\'\{z\}/g,"\u017A"],[/\\.\{Z\}/g,"\u017B"],[/\\.\{z\}/g,"\u017C"],[/\\v\{Z\}/g,"\u017D"],[/\\v\{z\}/g,"\u017E"],[/\\texthvlig /g,"\u0195"],[/\\textnrleg /g,"\u019E"],[/\\eth /g,"\u01AA"],[/\\textdoublepipe /g,"\u01C2"],[/\\'\{g\}/g,"\u01F5"],[/\\Elztrna /g,"\u0250"],[/\\Elztrnsa /g,"\u0252"],[/\\Elzopeno /g,"\u0254"],[/\\Elzrtld /g,"\u0256"],[/\\Elzschwa /g,"\u0259"],[/\\varepsilon /g,"\u025B"],[/\\Elzpgamma /g,"\u0263"],[/\\Elzpbgam /g,"\u0264"],[/\\Elztrnh /g,"\u0265"],[/\\Elzbtdl /g,"\u026C"],[/\\Elzrtll /g,"\u026D"],[/\\Elztrnm /g,"\u026F"],[/\\Elztrnmlr /g,"\u0270"],[/\\Elzltlmr /g,"\u0271"],[/\\Elzltln /g,"\u0272"],[/\\Elzrtln /g,"\u0273"],[/\\Elzclomeg /g,"\u0277"],[/\\textphi /g,"\u0278"],[/\\Elztrnr /g,"\u0279"],[/\\Elztrnrl /g,"\u027A"],[/\\Elzrttrnr /g,"\u027B"],[/\\Elzrl /g,"\u027C"],[/\\Elzrtlr /g,"\u027D"],[/\\Elzfhr /g,"\u027E"],[/\\Elzrtls /g,"\u0282"],[/\\Elzesh /g,"\u0283"],[/\\Elztrnt /g,"\u0287"],[/\\Elzrtlt /g,"\u0288"],[/\\Elzpupsil /g,"\u028A"],[/\\Elzpscrv /g,"\u028B"],[/\\Elzinvv /g,"\u028C"],[/\\Elzinvw /g,"\u028D"],[/\\Elztrny /g,"\u028E"],[/\\Elzrtlz /g,"\u0290"],[/\\Elzyogh /g,"\u0292"],[/\\Elzglst /g,"\u0294"],[/\\Elzreglst /g,"\u0295"],[/\\Elzinglst /g,"\u0296"],[/\\textturnk /g,"\u029E"],[/\\Elzdyogh /g,"\u02A4"],[/\\Elztesh /g,"\u02A7"],[/\\textasciicaron /g,"\u02C7"],[/\\Elzverts /g,"\u02C8"],[/\\Elzverti /g,"\u02CC"],[/\\Elzlmrk /g,"\u02D0"],[/\\Elzhlmrk /g,"\u02D1"],[/\\Elzsbrhr /g,"\u02D2"],[/\\Elzsblhr /g,"\u02D3"],[/\\Elzrais /g,"\u02D4"],[/\\Elzlow /g,"\u02D5"],[/\\textasciibreve /g,"\u02D8"],[/\\textperiodcentered /g,"\u02D9"],[/\\r\{\}/g,"\u02DA"],[/\\k\{\}/g,"\u02DB"],[/\\texttildelow /g,"\u02DC"],[/\\H\{\}/g,"\u02DD"],[/\\tone\{55\}/g,"\u02E5"],[/\\tone\{44\}/g,"\u02E6"],[/\\tone\{33\}/g,"\u02E7"],[/\\tone\{22\}/g,"\u02E8"],[/\\tone\{11\}/g,"\u02E9"],[/\\cyrchar\\C/g,"\u030F"],[/\\Elzpalh /g,"\u0321"],[/\\Elzrh /g,"\u0322"],[/\\Elzsbbrg /g,"\u032A"],[/\\Elzxl /g,"\u0335"],[/\\Elzbar /g,"\u0336"],[/\\'\{A\}/g,"\u0386"],[/\\'\{E\}/g,"\u0388"],[/\\'\{H\}/g,"\u0389"],[/\\'\{\}\{I\}/g,"\u038A"],[/\\'\{\}O/g,"\u038C"],[/\\mathrm\{'Y\}/g,"\u038E"],[/\\mathrm\{'\\Omega\}/g,"\u038F"],[/\\acute\{\\ddot\{\\iota\}\}/g,"\u0390"],[/\\Alpha /g,"\u0391"],[/\\Beta /g,"\u0392"],[/\\Gamma /g,"\u0393"],[/\\Delta /g,"\u0394"],[/\\Epsilon /g,"\u0395"],[/\\Zeta /g,"\u0396"],[/\\Eta /g,"\u0397"],[/\\Theta /g,"\u0398"],[/\\Iota /g,"\u0399"],[/\\Kappa /g,"\u039A"],[/\\Lambda /g,"\u039B"],[/\\Xi /g,"\u039E"],[/\\Pi /g,"\u03A0"],[/\\Rho /g,"\u03A1"],[/\\Sigma /g,"\u03A3"],[/\\Tau /g,"\u03A4"],[/\\Upsilon /g,"\u03A5"],[/\\Phi /g,"\u03A6"],[/\\Chi /g,"\u03A7"],[/\\Psi /g,"\u03A8"],[/\\Omega /g,"\u03A9"],[/\\mathrm\{\\ddot\{I\}\}/g,"\u03AA"],[/\\mathrm\{\\ddot\{Y\}\}/g,"\u03AB"],[/\\'\{\$\\alpha\$\}/g,"\u03AC"],[/\\acute\{\\epsilon\}/g,"\u03AD"],[/\\acute\{\\eta\}/g,"\u03AE"],[/\\acute\{\\iota\}/g,"\u03AF"],[/\\acute\{\\ddot\{\\upsilon\}\}/g,"\u03B0"],[/\\alpha /g,"\u03B1"],[/\\beta /g,"\u03B2"],[/\\gamma /g,"\u03B3"],[/\\delta /g,"\u03B4"],[/\\epsilon /g,"\u03B5"],[/\\zeta /g,"\u03B6"],[/\\eta /g,"\u03B7"],[/\\texttheta /g,"\u03B8"],[/\\iota /g,"\u03B9"],[/\\kappa /g,"\u03BA"],[/\\lambda /g,"\u03BB"],[/\\mu /g,"\u03BC"],[/\\nu /g,"\u03BD"],[/\\xi /g,"\u03BE"],[/\\pi /g,"\u03C0"],[/\\rho /g,"\u03C1"],[/\\varsigma /g,"\u03C2"],[/\\sigma /g,"\u03C3"],[/\\tau /g,"\u03C4"],[/\\upsilon /g,"\u03C5"],[/\\varphi /g,"\u03C6"],[/\\chi /g,"\u03C7"],[/\\psi /g,"\u03C8"],[/\\omega /g,"\u03C9"],[/\\ddot\{\\iota\}/g,"\u03CA"],[/\\ddot\{\\upsilon\}/g,"\u03CB"],[/\\'\{o\}/g,"\u03CC"],[/\\acute\{\\upsilon\}/g,"\u03CD"],[/\\acute\{\\omega\}/g,"\u03CE"],[/\\Pisymbol\{ppi022\}\{87\}/g,"\u03D0"],[/\\textvartheta /g,"\u03D1"],[/\\Upsilon /g,"\u03D2"],[/\\phi /g,"\u03D5"],[/\\varpi /g,"\u03D6"],[/\\Stigma /g,"\u03DA"],[/\\Digamma /g,"\u03DC"],[/\\digamma /g,"\u03DD"],[/\\Koppa /g,"\u03DE"],[/\\Sampi /g,"\u03E0"],[/\\varkappa /g,"\u03F0"],[/\\varrho /g,"\u03F1"],[/\\textTheta /g,"\u03F4"],[/\\backepsilon /g,"\u03F6"],[/\\cyrchar\\CYRYO /g,"\u0401"],[/\\cyrchar\\CYRDJE /g,"\u0402"],[/\\cyrchar\{\\'\\CYRG\}/g,"\u0403"],[/\\cyrchar\\CYRIE /g,"\u0404"],[/\\cyrchar\\CYRDZE /g,"\u0405"],[/\\cyrchar\\CYRII /g,"\u0406"],[/\\cyrchar\\CYRYI /g,"\u0407"],[/\\cyrchar\\CYRJE /g,"\u0408"],[/\\cyrchar\\CYRLJE /g,"\u0409"],[/\\cyrchar\\CYRNJE /g,"\u040A"],[/\\cyrchar\\CYRTSHE /g,"\u040B"],[/\\cyrchar\{\\'\\CYRK\}/g,"\u040C"],[/\\cyrchar\\CYRUSHRT /g,"\u040E"],[/\\cyrchar\\CYRDZHE /g,"\u040F"],[/\\cyrchar\\CYRA /g,"\u0410"],[/\\cyrchar\\CYRB /g,"\u0411"],[/\\cyrchar\\CYRV /g,"\u0412"],[/\\cyrchar\\CYRG /g,"\u0413"],[/\\cyrchar\\CYRD /g,"\u0414"],[/\\cyrchar\\CYRE /g,"\u0415"],[/\\cyrchar\\CYRZH /g,"\u0416"],[/\\cyrchar\\CYRZ /g,"\u0417"],[/\\cyrchar\\CYRI /g,"\u0418"],[/\\cyrchar\\CYRISHRT /g,"\u0419"],[/\\cyrchar\\CYRK /g,"\u041A"],[/\\cyrchar\\CYRL /g,"\u041B"],[/\\cyrchar\\CYRM /g,"\u041C"],[/\\cyrchar\\CYRN /g,"\u041D"],[/\\cyrchar\\CYRO /g,"\u041E"],[/\\cyrchar\\CYRP /g,"\u041F"],[/\\cyrchar\\CYRR /g,"\u0420"],[/\\cyrchar\\CYRS /g,"\u0421"],[/\\cyrchar\\CYRT /g,"\u0422"],[/\\cyrchar\\CYRU /g,"\u0423"],[/\\cyrchar\\CYRF /g,"\u0424"],[/\\cyrchar\\CYRH /g,"\u0425"],[/\\cyrchar\\CYRC /g,"\u0426"],[/\\cyrchar\\CYRCH /g,"\u0427"],[/\\cyrchar\\CYRSH /g,"\u0428"],[/\\cyrchar\\CYRSHCH /g,"\u0429"],[/\\cyrchar\\CYRHRDSN /g,"\u042A"],[/\\cyrchar\\CYRERY /g,"\u042B"],[/\\cyrchar\\CYRSFTSN /g,"\u042C"],[/\\cyrchar\\CYREREV /g,"\u042D"],[/\\cyrchar\\CYRYU /g,"\u042E"],[/\\cyrchar\\CYRYA /g,"\u042F"],[/\\cyrchar\\cyra /g,"\u0430"],[/\\cyrchar\\cyrb /g,"\u0431"],[/\\cyrchar\\cyrv /g,"\u0432"],[/\\cyrchar\\cyrg /g,"\u0433"],[/\\cyrchar\\cyrd /g,"\u0434"],[/\\cyrchar\\cyre /g,"\u0435"],[/\\cyrchar\\cyrzh /g,"\u0436"],[/\\cyrchar\\cyrz /g,"\u0437"],[/\\cyrchar\\cyri /g,"\u0438"],[/\\cyrchar\\cyrishrt /g,"\u0439"],[/\\cyrchar\\cyrk /g,"\u043A"],[/\\cyrchar\\cyrl /g,"\u043B"],[/\\cyrchar\\cyrm /g,"\u043C"],[/\\cyrchar\\cyrn /g,"\u043D"],[/\\cyrchar\\cyro /g,"\u043E"],[/\\cyrchar\\cyrp /g,"\u043F"],[/\\cyrchar\\cyrr /g,"\u0440"],[/\\cyrchar\\cyrs /g,"\u0441"],[/\\cyrchar\\cyrt /g,"\u0442"],[/\\cyrchar\\cyru /g,"\u0443"],[/\\cyrchar\\cyrf /g,"\u0444"],[/\\cyrchar\\cyrh /g,"\u0445"],[/\\cyrchar\\cyrc /g,"\u0446"],[/\\cyrchar\\cyrch /g,"\u0447"],[/\\cyrchar\\cyrsh /g,"\u0448"],[/\\cyrchar\\cyrshch /g,"\u0449"],[/\\cyrchar\\cyrhrdsn /g,"\u044A"],[/\\cyrchar\\cyrery /g,"\u044B"],[/\\cyrchar\\cyrsftsn /g,"\u044C"],[/\\cyrchar\\cyrerev /g,"\u044D"],[/\\cyrchar\\cyryu /g,"\u044E"],[/\\cyrchar\\cyrya /g,"\u044F"],[/\\cyrchar\\cyryo /g,"\u0451"],[/\\cyrchar\\cyrdje /g,"\u0452"],[/\\cyrchar\{\\'\\cyrg\}/g,"\u0453"],[/\\cyrchar\\cyrie /g,"\u0454"],[/\\cyrchar\\cyrdze /g,"\u0455"],[/\\cyrchar\\cyrii /g,"\u0456"],[/\\cyrchar\\cyryi /g,"\u0457"],[/\\cyrchar\\cyrje /g,"\u0458"],[/\\cyrchar\\cyrlje /g,"\u0459"],[/\\cyrchar\\cyrnje /g,"\u045A"],[/\\cyrchar\\cyrtshe /g,"\u045B"],[/\\cyrchar\{\\'\\cyrk\}/g,"\u045C"],[/\\cyrchar\\cyrushrt /g,"\u045E"],[/\\cyrchar\\cyrdzhe /g,"\u045F"],[/\\cyrchar\\CYROMEGA /g,"\u0460"],[/\\cyrchar\\cyromega /g,"\u0461"],[/\\cyrchar\\CYRYAT /g,"\u0462"],[/\\cyrchar\\CYRIOTE /g,"\u0464"],[/\\cyrchar\\cyriote /g,"\u0465"],[/\\cyrchar\\CYRLYUS /g,"\u0466"],[/\\cyrchar\\cyrlyus /g,"\u0467"],[/\\cyrchar\\CYRIOTLYUS /g,"\u0468"],[/\\cyrchar\\cyriotlyus /g,"\u0469"],[/\\cyrchar\\CYRBYUS /g,"\u046A"],[/\\cyrchar\\CYRIOTBYUS /g,"\u046C"],[/\\cyrchar\\cyriotbyus /g,"\u046D"],[/\\cyrchar\\CYRKSI /g,"\u046E"],[/\\cyrchar\\cyrksi /g,"\u046F"],[/\\cyrchar\\CYRPSI /g,"\u0470"],[/\\cyrchar\\cyrpsi /g,"\u0471"],[/\\cyrchar\\CYRFITA /g,"\u0472"],[/\\cyrchar\\CYRIZH /g,"\u0474"],[/\\cyrchar\\CYRUK /g,"\u0478"],[/\\cyrchar\\cyruk /g,"\u0479"],[/\\cyrchar\\CYROMEGARND /g,"\u047A"],[/\\cyrchar\\cyromegarnd /g,"\u047B"],[/\\cyrchar\\CYROMEGATITLO /g,"\u047C"],[/\\cyrchar\\cyromegatitlo /g,"\u047D"],[/\\cyrchar\\CYROT /g,"\u047E"],[/\\cyrchar\\cyrot /g,"\u047F"],[/\\cyrchar\\CYRKOPPA /g,"\u0480"],[/\\cyrchar\\cyrkoppa /g,"\u0481"],[/\\cyrchar\\cyrthousands /g,"\u0482"],[/\\cyrchar\\cyrhundredthousands /g,"\u0488"],[/\\cyrchar\\cyrmillions /g,"\u0489"],[/\\cyrchar\\CYRSEMISFTSN /g,"\u048C"],[/\\cyrchar\\cyrsemisftsn /g,"\u048D"],[/\\cyrchar\\CYRRTICK /g,"\u048E"],[/\\cyrchar\\cyrrtick /g,"\u048F"],[/\\cyrchar\\CYRGUP /g,"\u0490"],[/\\cyrchar\\cyrgup /g,"\u0491"],[/\\cyrchar\\CYRGHCRS /g,"\u0492"],[/\\cyrchar\\cyrghcrs /g,"\u0493"],[/\\cyrchar\\CYRGHK /g,"\u0494"],[/\\cyrchar\\cyrghk /g,"\u0495"],[/\\cyrchar\\CYRZHDSC /g,"\u0496"],[/\\cyrchar\\cyrzhdsc /g,"\u0497"],[/\\cyrchar\\CYRZDSC /g,"\u0498"],[/\\cyrchar\\cyrzdsc /g,"\u0499"],[/\\cyrchar\\CYRKDSC /g,"\u049A"],[/\\cyrchar\\cyrkdsc /g,"\u049B"],[/\\cyrchar\\CYRKVCRS /g,"\u049C"],[/\\cyrchar\\cyrkvcrs /g,"\u049D"],[/\\cyrchar\\CYRKHCRS /g,"\u049E"],[/\\cyrchar\\cyrkhcrs /g,"\u049F"],[/\\cyrchar\\CYRKBEAK /g,"\u04A0"],[/\\cyrchar\\cyrkbeak /g,"\u04A1"],[/\\cyrchar\\CYRNDSC /g,"\u04A2"],[/\\cyrchar\\cyrndsc /g,"\u04A3"],[/\\cyrchar\\CYRNG /g,"\u04A4"],[/\\cyrchar\\cyrng /g,"\u04A5"],[/\\cyrchar\\CYRPHK /g,"\u04A6"],[/\\cyrchar\\cyrphk /g,"\u04A7"],[/\\cyrchar\\CYRABHHA /g,"\u04A8"],[/\\cyrchar\\cyrabhha /g,"\u04A9"],[/\\cyrchar\\CYRSDSC /g,"\u04AA"],[/\\cyrchar\\cyrsdsc /g,"\u04AB"],[/\\cyrchar\\CYRTDSC /g,"\u04AC"],[/\\cyrchar\\cyrtdsc /g,"\u04AD"],[/\\cyrchar\\CYRY /g,"\u04AE"],[/\\cyrchar\\cyry /g,"\u04AF"],[/\\cyrchar\\CYRYHCRS /g,"\u04B0"],[/\\cyrchar\\cyryhcrs /g,"\u04B1"],[/\\cyrchar\\CYRHDSC /g,"\u04B2"],[/\\cyrchar\\cyrhdsc /g,"\u04B3"],[/\\cyrchar\\CYRTETSE /g,"\u04B4"],[/\\cyrchar\\cyrtetse /g,"\u04B5"],[/\\cyrchar\\CYRCHRDSC /g,"\u04B6"],[/\\cyrchar\\cyrchrdsc /g,"\u04B7"],[/\\cyrchar\\CYRCHVCRS /g,"\u04B8"],[/\\cyrchar\\cyrchvcrs /g,"\u04B9"],[/\\cyrchar\\CYRSHHA /g,"\u04BA"],[/\\cyrchar\\cyrshha /g,"\u04BB"],[/\\cyrchar\\CYRABHCH /g,"\u04BC"],[/\\cyrchar\\cyrabhch /g,"\u04BD"],[/\\cyrchar\\CYRABHCHDSC /g,"\u04BE"],[/\\cyrchar\\cyrabhchdsc /g,"\u04BF"],[/\\cyrchar\\CYRpalochka /g,"\u04C0"],[/\\cyrchar\\CYRKHK /g,"\u04C3"],[/\\cyrchar\\cyrkhk /g,"\u04C4"],[/\\cyrchar\\CYRNHK /g,"\u04C7"],[/\\cyrchar\\cyrnhk /g,"\u04C8"],[/\\cyrchar\\CYRCHLDSC /g,"\u04CB"],[/\\cyrchar\\cyrchldsc /g,"\u04CC"],[/\\cyrchar\\CYRAE /g,"\u04D4"],[/\\cyrchar\\cyrae /g,"\u04D5"],[/\\cyrchar\\CYRSCHWA /g,"\u04D8"],[/\\cyrchar\\cyrschwa /g,"\u04D9"],[/\\cyrchar\\CYRABHDZE /g,"\u04E0"],[/\\cyrchar\\cyrabhdze /g,"\u04E1"],[/\\cyrchar\\CYROTLD /g,"\u04E8"],[/\\cyrchar\\cyrotld /g,"\u04E9"],[/\\hspace\{0.6em\}/g,"\u2002"],[/\\hspace\{1em\}/g,"\u2003"],[/\\hspace\{0.33em\}/g,"\u2004"],[/\\hspace\{0.25em\}/g,"\u2005"],[/\\hspace\{0.166em\}/g,"\u2006"],[/\\hphantom\{0\}/g,"\u2007"],[/\\hphantom\{,\}/g,"\u2008"],[/\\hspace\{0.167em\}/g,"\u2009"],[/\\mkern1mu /g,"\u200A"],[/\\textendash /g,"\u2013"],[/\\textemdash /g,"\u2014"],[/\\rule\{1em\}\{1pt\}/g,"\u2015"],[/\\Vert /g,"\u2016"],[/\\Elzreapos /g,"\u201B"],[/\\textquotedblleft /g,"\u201C"],[/\\textquotedblright /g,"\u201D"],[/\\textdagger /g,"\u2020"],[/\\textdaggerdbl /g,"\u2021"],[/\\textbullet /g,"\u2022"],[/\\ldots /g,"\u2026"],[/\\textperthousand /g,"\u2030"],[/\\textpertenthousand /g,"\u2031"],[/\\backprime /g,"\u2035"],[/\\guilsinglleft /g,"\u2039"],[/\\guilsinglright /g,"\u203A"],[/\\mkern4mu /g,"\u205F"],[/\\nolinebreak /g,"\u2060"],[/\\ensuremath\{\\Elzpes\}/g,"\u20A7"],[/\\mbox\{\\texteuro\} /g,"\u20AC"],[/\\dddot /g,"\u20DB"],[/\\ddddot /g,"\u20DC"],[/\\mathbb\{C\}/g,"\u2102"],[/\\mathscr\{g\}/g,"\u210A"],[/\\mathscr\{H\}/g,"\u210B"],[/\\mathfrak\{H\}/g,"\u210C"],[/\\mathbb\{H\}/g,"\u210D"],[/\\hslash /g,"\u210F"],[/\\mathscr\{I\}/g,"\u2110"],[/\\mathfrak\{I\}/g,"\u2111"],[/\\mathscr\{L\}/g,"\u2112"],[/\\mathscr\{l\}/g,"\u2113"],[/\\mathbb\{N\}/g,"\u2115"],[/\\cyrchar\\textnumero /g,"\u2116"],[/\\wp /g,"\u2118"],[/\\mathbb\{P\}/g,"\u2119"],[/\\mathbb\{Q\}/g,"\u211A"],[/\\mathscr\{R\}/g,"\u211B"],[/\\mathfrak\{R\}/g,"\u211C"],[/\\mathbb\{R\}/g,"\u211D"],[/\\Elzxrat /g,"\u211E"],[/\\texttrademark /g,"\u2122"],[/\\mathbb\{Z\}/g,"\u2124"],[/\\Omega /g,"\u2126"],[/\\mho /g,"\u2127"],[/\\mathfrak\{Z\}/g,"\u2128"],[/\\ElsevierGlyph\{2129\}/g,"\u2129"],[/\\AA /g,"\u212B"],[/\\mathscr\{B\}/g,"\u212C"],[/\\mathfrak\{C\}/g,"\u212D"],[/\\mathscr\{e\}/g,"\u212F"],[/\\mathscr\{E\}/g,"\u2130"],[/\\mathscr\{F\}/g,"\u2131"],[/\\mathscr\{M\}/g,"\u2133"],[/\\mathscr\{o\}/g,"\u2134"],[/\\aleph /g,"\u2135"],[/\\beth /g,"\u2136"],[/\\gimel /g,"\u2137"],[/\\daleth /g,"\u2138"],[/\\textfrac\{1\}\{3\}/g,"\u2153"],[/\\textfrac\{2\}\{3\}/g,"\u2154"],[/\\textfrac\{1\}\{5\}/g,"\u2155"],[/\\textfrac\{2\}\{5\}/g,"\u2156"],[/\\textfrac\{3\}\{5\}/g,"\u2157"],[/\\textfrac\{4\}\{5\}/g,"\u2158"],[/\\textfrac\{1\}\{6\}/g,"\u2159"],[/\\textfrac\{5\}\{6\}/g,"\u215A"],[/\\textfrac\{1\}\{8\}/g,"\u215B"],[/\\textfrac\{3\}\{8\}/g,"\u215C"],[/\\textfrac\{5\}\{8\}/g,"\u215D"],[/\\textfrac\{7\}\{8\}/g,"\u215E"],[/\\leftarrow /g,"\u2190"],[/\\uparrow /g,"\u2191"],[/\\rightarrow /g,"\u2192"],[/\\downarrow /g,"\u2193"],[/\\leftrightarrow /g,"\u2194"],[/\\updownarrow /g,"\u2195"],[/\\nwarrow /g,"\u2196"],[/\\nearrow /g,"\u2197"],[/\\searrow /g,"\u2198"],[/\\swarrow /g,"\u2199"],[/\\nleftarrow /g,"\u219A"],[/\\nrightarrow /g,"\u219B"],[/\\arrowwaveright /g,"\u219C"],[/\\arrowwaveright /g,"\u219D"],[/\\twoheadleftarrow /g,"\u219E"],[/\\twoheadrightarrow /g,"\u21A0"],[/\\leftarrowtail /g,"\u21A2"],[/\\rightarrowtail /g,"\u21A3"],[/\\mapsto /g,"\u21A6"],[/\\hookleftarrow /g,"\u21A9"],[/\\hookrightarrow /g,"\u21AA"],[/\\looparrowleft /g,"\u21AB"],[/\\looparrowright /g,"\u21AC"],[/\\leftrightsquigarrow /g,"\u21AD"],[/\\nleftrightarrow /g,"\u21AE"],[/\\Lsh /g,"\u21B0"],[/\\Rsh /g,"\u21B1"],[/\\ElsevierGlyph\{21B3\}/g,"\u21B3"],[/\\curvearrowleft /g,"\u21B6"],[/\\curvearrowright /g,"\u21B7"],[/\\circlearrowleft /g,"\u21BA"],[/\\circlearrowright /g,"\u21BB"],[/\\leftharpoonup /g,"\u21BC"],[/\\leftharpoondown /g,"\u21BD"],[/\\upharpoonright /g,"\u21BE"],[/\\upharpoonleft /g,"\u21BF"],[/\\rightharpoonup /g,"\u21C0"],[/\\rightharpoondown /g,"\u21C1"],[/\\downharpoonright /g,"\u21C2"],[/\\downharpoonleft /g,"\u21C3"],[/\\rightleftarrows /g,"\u21C4"],[/\\dblarrowupdown /g,"\u21C5"],[/\\leftrightarrows /g,"\u21C6"],[/\\leftleftarrows /g,"\u21C7"],[/\\upuparrows /g,"\u21C8"],[/\\rightrightarrows /g,"\u21C9"],[/\\downdownarrows /g,"\u21CA"],[/\\leftrightharpoons /g,"\u21CB"],[/\\rightleftharpoons /g,"\u21CC"],[/\\nLeftarrow /g,"\u21CD"],[/\\nLeftrightarrow /g,"\u21CE"],[/\\nRightarrow /g,"\u21CF"],[/\\Leftarrow /g,"\u21D0"],[/\\Uparrow /g,"\u21D1"],[/\\Rightarrow /g,"\u21D2"],[/\\Downarrow /g,"\u21D3"],[/\\Leftrightarrow /g,"\u21D4"],[/\\Updownarrow /g,"\u21D5"],[/\\Lleftarrow /g,"\u21DA"],[/\\Rrightarrow /g,"\u21DB"],[/\\rightsquigarrow /g,"\u21DD"],[/\\DownArrowUpArrow /g,"\u21F5"],[/\\forall /g,"\u2200"],[/\\complement /g,"\u2201"],[/\\partial /g,"\u2202"],[/\\exists /g,"\u2203"],[/\\nexists /g,"\u2204"],[/\\varnothing /g,"\u2205"],[/\\nabla /g,"\u2207"],[/\\in /g,"\u2208"],[/\\not\\in /g,"\u2209"],[/\\ni /g,"\u220B"],[/\\not\\ni /g,"\u220C"],[/\\prod /g,"\u220F"],[/\\coprod /g,"\u2210"],[/\\sum /g,"\u2211"],[/\\mp /g,"\u2213"],[/\\dotplus /g,"\u2214"],[/\\setminus /g,"\u2216"],[/\\circ /g,"\u2218"],[/\\bullet /g,"\u2219"],[/\\surd /g,"\u221A"],[/\\propto /g,"\u221D"],[/\\infty /g,"\u221E"],[/\\rightangle /g,"\u221F"],[/\\angle /g,"\u2220"],[/\\measuredangle /g,"\u2221"],[/\\sphericalangle /g,"\u2222"],[/\\mid /g,"\u2223"],[/\\nmid /g,"\u2224"],[/\\parallel /g,"\u2225"],[/\\nparallel /g,"\u2226"],[/\\wedge /g,"\u2227"],[/\\vee /g,"\u2228"],[/\\cap /g,"\u2229"],[/\\cup /g,"\u222A"],[/\\int /g,"\u222B"],[/\\int\\!\\int /g,"\u222C"],[/\\int\\!\\int\\!\\int /g,"\u222D"],[/\\oint /g,"\u222E"],[/\\surfintegral /g,"\u222F"],[/\\volintegral /g,"\u2230"],[/\\clwintegral /g,"\u2231"],[/\\ElsevierGlyph\{2232\}/g,"\u2232"],[/\\ElsevierGlyph\{2233\}/g,"\u2233"],[/\\therefore /g,"\u2234"],[/\\because /g,"\u2235"],[/\\Colon /g,"\u2237"],[/\\ElsevierGlyph\{2238\}/g,"\u2238"],[/\\mathbin\{\{:\}\\!\\!\{\-\}\\!\\!\{:\}\}/g,"\u223A"],[/\\homothetic /g,"\u223B"],[/\\sim /g,"\u223C"],[/\\backsim /g,"\u223D"],[/\\lazysinv /g,"\u223E"],[/\\wr /g,"\u2240"],[/\\not\\sim /g,"\u2241"],[/\\ElsevierGlyph\{2242\}/g,"\u2242"],[/\\NotEqualTilde /g,"\u2242-00338"],[/\\simeq /g,"\u2243"],[/\\not\\simeq /g,"\u2244"],[/\\cong /g,"\u2245"],[/\\approxnotequal /g,"\u2246"],[/\\not\\cong /g,"\u2247"],[/\\approx /g,"\u2248"],[/\\not\\approx /g,"\u2249"],[/\\approxeq /g,"\u224A"],[/\\tildetrpl /g,"\u224B"],[/\\not\\apid /g,"\u224B-00338"],[/\\allequal /g,"\u224C"],[/\\asymp /g,"\u224D"],[/\\Bumpeq /g,"\u224E"],[/\\NotHumpDownHump /g,"\u224E-00338"],[/\\bumpeq /g,"\u224F"],[/\\NotHumpEqual /g,"\u224F-00338"],[/\\doteq /g,"\u2250"],[/\\not\\doteq/g,"\u2250-00338"],[/\\doteqdot /g,"\u2251"],[/\\fallingdotseq /g,"\u2252"],[/\\risingdotseq /g,"\u2253"],[/\\eqcirc /g,"\u2256"],[/\\circeq /g,"\u2257"],[/\\estimates /g,"\u2259"],[/\\ElsevierGlyph\{225A\}/g,"\u225A"],[/\\starequal /g,"\u225B"],[/\\triangleq /g,"\u225C"],[/\\ElsevierGlyph\{225F\}/g,"\u225F"],[/\\not =/g,"\u2260"],[/\\equiv /g,"\u2261"],[/\\not\\equiv /g,"\u2262"],[/\\leq /g,"\u2264"],[/\\geq /g,"\u2265"],[/\\leqq /g,"\u2266"],[/\\geqq /g,"\u2267"],[/\\lneqq /g,"\u2268"],[/\\lvertneqq /g,"\u2268-0FE00"],[/\\gneqq /g,"\u2269"],[/\\gvertneqq /g,"\u2269-0FE00"],[/\\ll /g,"\u226A"],[/\\NotLessLess /g,"\u226A-00338"],[/\\gg /g,"\u226B"],[/\\NotGreaterGreater /g,"\u226B-00338"],[/\\between /g,"\u226C"],[/\\not\\kern\-0.3em\\times /g,"\u226D"],[/\\not</g,"\u226E"],[/\\not>/g,"\u226F"],[/\\not\\leq /g,"\u2270"],[/\\not\\geq /g,"\u2271"],[/\\lessequivlnt /g,"\u2272"],[/\\greaterequivlnt /g,"\u2273"],[/\\ElsevierGlyph\{2274\}/g,"\u2274"],[/\\ElsevierGlyph\{2275\}/g,"\u2275"],[/\\lessgtr /g,"\u2276"],[/\\gtrless /g,"\u2277"],[/\\notlessgreater /g,"\u2278"],[/\\notgreaterless /g,"\u2279"],[/\\prec /g,"\u227A"],[/\\succ /g,"\u227B"],[/\\preccurlyeq /g,"\u227C"],[/\\succcurlyeq /g,"\u227D"],[/\\precapprox /g,"\u227E"],[/\\NotPrecedesTilde /g,"\u227E-00338"],[/\\succapprox /g,"\u227F"],[/\\NotSucceedsTilde /g,"\u227F-00338"],[/\\not\\prec /g,"\u2280"],[/\\not\\succ /g,"\u2281"],[/\\subset /g,"\u2282"],[/\\supset /g,"\u2283"],[/\\not\\subset /g,"\u2284"],[/\\not\\supset /g,"\u2285"],[/\\subseteq /g,"\u2286"],[/\\supseteq /g,"\u2287"],[/\\not\\subseteq /g,"\u2288"],[/\\not\\supseteq /g,"\u2289"],[/\\subsetneq /g,"\u228A"],[/\\varsubsetneqq /g,"\u228A-0FE00"],[/\\supsetneq /g,"\u228B"],[/\\varsupsetneq /g,"\u228B-0FE00"],[/\\uplus /g,"\u228E"],[/\\sqsubset /g,"\u228F"],[/\\NotSquareSubset /g,"\u228F-00338"],[/\\sqsupset /g,"\u2290"],[/\\NotSquareSuperset /g,"\u2290-00338"],[/\\sqsubseteq /g,"\u2291"],[/\\sqsupseteq /g,"\u2292"],[/\\sqcap /g,"\u2293"],[/\\sqcup /g,"\u2294"],[/\\oplus /g,"\u2295"],[/\\ominus /g,"\u2296"],[/\\otimes /g,"\u2297"],[/\\oslash /g,"\u2298"],[/\\odot /g,"\u2299"],[/\\circledcirc /g,"\u229A"],[/\\circledast /g,"\u229B"],[/\\circleddash /g,"\u229D"],[/\\boxplus /g,"\u229E"],[/\\boxminus /g,"\u229F"],[/\\boxtimes /g,"\u22A0"],[/\\boxdot /g,"\u22A1"],[/\\vdash /g,"\u22A2"],[/\\dashv /g,"\u22A3"],[/\\top /g,"\u22A4"],[/\\perp /g,"\u22A5"],[/\\truestate /g,"\u22A7"],[/\\forcesextra /g,"\u22A8"],[/\\Vdash /g,"\u22A9"],[/\\Vvdash /g,"\u22AA"],[/\\VDash /g,"\u22AB"],[/\\nvdash /g,"\u22AC"],[/\\nvDash /g,"\u22AD"],[/\\nVdash /g,"\u22AE"],[/\\nVDash /g,"\u22AF"],[/\\vartriangleleft /g,"\u22B2"],[/\\vartriangleright /g,"\u22B3"],[/\\trianglelefteq /g,"\u22B4"],[/\\trianglerighteq /g,"\u22B5"],[/\\original /g,"\u22B6"],[/\\image /g,"\u22B7"],[/\\multimap /g,"\u22B8"],[/\\hermitconjmatrix /g,"\u22B9"],[/\\intercal /g,"\u22BA"],[/\\veebar /g,"\u22BB"],[/\\rightanglearc /g,"\u22BE"],[/\\ElsevierGlyph\{22C0\}/g,"\u22C0"],[/\\ElsevierGlyph\{22C1\}/g,"\u22C1"],[/\\bigcap /g,"\u22C2"],[/\\bigcup /g,"\u22C3"],[/\\diamond /g,"\u22C4"],[/\\cdot /g,"\u22C5"],[/\\star /g,"\u22C6"],[/\\divideontimes /g,"\u22C7"],[/\\bowtie /g,"\u22C8"],[/\\ltimes /g,"\u22C9"],[/\\rtimes /g,"\u22CA"],[/\\leftthreetimes /g,"\u22CB"],[/\\rightthreetimes /g,"\u22CC"],[/\\backsimeq /g,"\u22CD"],[/\\curlyvee /g,"\u22CE"],[/\\curlywedge /g,"\u22CF"],[/\\Subset /g,"\u22D0"],[/\\Supset /g,"\u22D1"],[/\\Cap /g,"\u22D2"],[/\\Cup /g,"\u22D3"],[/\\pitchfork /g,"\u22D4"],[/\\lessdot /g,"\u22D6"],[/\\gtrdot /g,"\u22D7"],[/\\verymuchless /g,"\u22D8"],[/\\verymuchgreater /g,"\u22D9"],[/\\lesseqgtr /g,"\u22DA"],[/\\gtreqless /g,"\u22DB"],[/\\curlyeqprec /g,"\u22DE"],[/\\curlyeqsucc /g,"\u22DF"],[/\\not\\sqsubseteq /g,"\u22E2"],[/\\not\\sqsupseteq /g,"\u22E3"],[/\\Elzsqspne /g,"\u22E5"],[/\\lnsim /g,"\u22E6"],[/\\gnsim /g,"\u22E7"],[/\\precedesnotsimilar /g,"\u22E8"],[/\\succnsim /g,"\u22E9"],[/\\ntriangleleft /g,"\u22EA"],[/\\ntriangleright /g,"\u22EB"],[/\\ntrianglelefteq /g,"\u22EC"],[/\\ntrianglerighteq /g,"\u22ED"],[/\\vdots /g,"\u22EE"],[/\\cdots /g,"\u22EF"],[/\\upslopeellipsis /g,"\u22F0"],[/\\downslopeellipsis /g,"\u22F1"],[/\\barwedge /g,"\u2305"],[/\\perspcorrespond /g,"\u2306"],[/\\lceil /g,"\u2308"],[/\\rceil /g,"\u2309"],[/\\lfloor /g,"\u230A"],[/\\rfloor /g,"\u230B"],[/\\recorder /g,"\u2315"],[/\\mathchar"2208/g,"\u2316"],[/\\ulcorner /g,"\u231C"],[/\\urcorner /g,"\u231D"],[/\\llcorner /g,"\u231E"],[/\\lrcorner /g,"\u231F"],[/\\frown /g,"\u2322"],[/\\smile /g,"\u2323"],[/\\langle /g,"\u2329"],[/\\rangle /g,"\u232A"],[/\\ElsevierGlyph\{E838\}/g,"\u233D"],[/\\Elzdlcorn /g,"\u23A3"],[/\\lmoustache /g,"\u23B0"],[/\\rmoustache /g,"\u23B1"],[/\\textvisiblespace /g,"\u2423"],[/\\ding\{172\}/g,"\u2460"],[/\\ding\{173\}/g,"\u2461"],[/\\ding\{174\}/g,"\u2462"],[/\\ding\{175\}/g,"\u2463"],[/\\ding\{176\}/g,"\u2464"],[/\\ding\{177\}/g,"\u2465"],[/\\ding\{178\}/g,"\u2466"],[/\\ding\{179\}/g,"\u2467"],[/\\ding\{180\}/g,"\u2468"],[/\\ding\{181\}/g,"\u2469"],[/\\circledS /g,"\u24C8"],[/\\Elzdshfnc /g,"\u2506"],[/\\Elzsqfnw /g,"\u2519"],[/\\diagup /g,"\u2571"],[/\\ding\{110\}/g,"\u25A0"],[/\\square /g,"\u25A1"],[/\\blacksquare /g,"\u25AA"],[/\\fbox\{~~\}/g,"\u25AD"],[/\\Elzvrecto /g,"\u25AF"],[/\\ElsevierGlyph\{E381\}/g,"\u25B1"],[/\\ding\{115\}/g,"\u25B2"],[/\\bigtriangleup /g,"\u25B3"],[/\\blacktriangle /g,"\u25B4"],[/\\vartriangle /g,"\u25B5"],[/\\blacktriangleright /g,"\u25B8"],[/\\triangleright /g,"\u25B9"],[/\\ding\{116\}/g,"\u25BC"],[/\\bigtriangledown /g,"\u25BD"],[/\\blacktriangledown /g,"\u25BE"],[/\\triangledown /g,"\u25BF"],[/\\blacktriangleleft /g,"\u25C2"],[/\\triangleleft /g,"\u25C3"],[/\\ding\{117\}/g,"\u25C6"],[/\\lozenge /g,"\u25CA"],[/\\bigcirc /g,"\u25CB"],[/\\ding\{108\}/g,"\u25CF"],[/\\Elzcirfl /g,"\u25D0"],[/\\Elzcirfr /g,"\u25D1"],[/\\Elzcirfb /g,"\u25D2"],[/\\ding\{119\}/g,"\u25D7"],[/\\Elzrvbull /g,"\u25D8"],[/\\Elzsqfl /g,"\u25E7"],[/\\Elzsqfr /g,"\u25E8"],[/\\Elzsqfse /g,"\u25EA"],[/\\bigcirc /g,"\u25EF"],[/\\ding\{72\}/g,"\u2605"],[/\\ding\{73\}/g,"\u2606"],[/\\ding\{37\}/g,"\u260E"],[/\\ding\{42\}/g,"\u261B"],[/\\ding\{43\}/g,"\u261E"],[/\\rightmoon /g,"\u263E"],[/\\mercury /g,"\u263F"],[/\\venus /g,"\u2640"],[/\\male /g,"\u2642"],[/\\jupiter /g,"\u2643"],[/\\saturn /g,"\u2644"],[/\\uranus /g,"\u2645"],[/\\neptune /g,"\u2646"],[/\\pluto /g,"\u2647"],[/\\aries /g,"\u2648"],[/\\taurus /g,"\u2649"],[/\\gemini /g,"\u264A"],[/\\cancer /g,"\u264B"],[/\\leo /g,"\u264C"],[/\\virgo /g,"\u264D"],[/\\libra /g,"\u264E"],[/\\scorpio /g,"\u264F"],[/\\sagittarius /g,"\u2650"],[/\\capricornus /g,"\u2651"],[/\\aquarius /g,"\u2652"],[/\\pisces /g,"\u2653"],[/\\ding\{171\}/g,"\u2660"],[/\\diamond /g,"\u2662"],[/\\ding\{168\}/g,"\u2663"],[/\\ding\{170\}/g,"\u2665"],[/\\ding\{169\}/g,"\u2666"],[/\\quarternote /g,"\u2669"],[/\\eighthnote /g,"\u266A"],[/\\flat /g,"\u266D"],[/\\natural /g,"\u266E"],[/\\sharp /g,"\u266F"],[/\\ding\{33\}/g,"\u2701"],[/\\ding\{34\}/g,"\u2702"],[/\\ding\{35\}/g,"\u2703"],[/\\ding\{36\}/g,"\u2704"],[/\\ding\{38\}/g,"\u2706"],[/\\ding\{39\}/g,"\u2707"],[/\\ding\{40\}/g,"\u2708"],[/\\ding\{41\}/g,"\u2709"],[/\\ding\{44\}/g,"\u270C"],[/\\ding\{45\}/g,"\u270D"],[/\\ding\{46\}/g,"\u270E"],[/\\ding\{47\}/g,"\u270F"],[/\\ding\{48\}/g,"\u2710"],[/\\ding\{49\}/g,"\u2711"],[/\\ding\{50\}/g,"\u2712"],[/\\ding\{51\}/g,"\u2713"],[/\\ding\{52\}/g,"\u2714"],[/\\ding\{53\}/g,"\u2715"],[/\\ding\{54\}/g,"\u2716"],[/\\ding\{55\}/g,"\u2717"],[/\\ding\{56\}/g,"\u2718"],[/\\ding\{57\}/g,"\u2719"],[/\\ding\{58\}/g,"\u271A"],[/\\ding\{59\}/g,"\u271B"],[/\\ding\{60\}/g,"\u271C"],[/\\ding\{61\}/g,"\u271D"],[/\\ding\{62\}/g,"\u271E"],[/\\ding\{63\}/g,"\u271F"],[/\\ding\{64\}/g,"\u2720"],[/\\ding\{65\}/g,"\u2721"],[/\\ding\{66\}/g,"\u2722"],[/\\ding\{67\}/g,"\u2723"],[/\\ding\{68\}/g,"\u2724"],[/\\ding\{69\}/g,"\u2725"],[/\\ding\{70\}/g,"\u2726"],[/\\ding\{71\}/g,"\u2727"],[/\\ding\{73\}/g,"\u2729"],[/\\ding\{74\}/g,"\u272A"],[/\\ding\{75\}/g,"\u272B"],[/\\ding\{76\}/g,"\u272C"],[/\\ding\{77\}/g,"\u272D"],[/\\ding\{78\}/g,"\u272E"],[/\\ding\{79\}/g,"\u272F"],[/\\ding\{80\}/g,"\u2730"],[/\\ding\{81\}/g,"\u2731"],[/\\ding\{82\}/g,"\u2732"],[/\\ding\{83\}/g,"\u2733"],[/\\ding\{84\}/g,"\u2734"],[/\\ding\{85\}/g,"\u2735"],[/\\ding\{86\}/g,"\u2736"],[/\\ding\{87\}/g,"\u2737"],[/\\ding\{88\}/g,"\u2738"],[/\\ding\{89\}/g,"\u2739"],[/\\ding\{90\}/g,"\u273A"],[/\\ding\{91\}/g,"\u273B"],[/\\ding\{92\}/g,"\u273C"],[/\\ding\{93\}/g,"\u273D"],[/\\ding\{94\}/g,"\u273E"],[/\\ding\{95\}/g,"\u273F"],[/\\ding\{96\}/g,"\u2740"],[/\\ding\{97\}/g,"\u2741"],[/\\ding\{98\}/g,"\u2742"],[/\\ding\{99\}/g,"\u2743"],[/\\ding\{100\}/g,"\u2744"],[/\\ding\{101\}/g,"\u2745"],[/\\ding\{102\}/g,"\u2746"],[/\\ding\{103\}/g,"\u2747"],[/\\ding\{104\}/g,"\u2748"],[/\\ding\{105\}/g,"\u2749"],[/\\ding\{106\}/g,"\u274A"],[/\\ding\{107\}/g,"\u274B"],[/\\ding\{109\}/g,"\u274D"],[/\\ding\{111\}/g,"\u274F"],[/\\ding\{112\}/g,"\u2750"],[/\\ding\{113\}/g,"\u2751"],[/\\ding\{114\}/g,"\u2752"],[/\\ding\{118\}/g,"\u2756"],[/\\ding\{120\}/g,"\u2758"],[/\\ding\{121\}/g,"\u2759"],[/\\ding\{122\}/g,"\u275A"],[/\\ding\{123\}/g,"\u275B"],[/\\ding\{124\}/g,"\u275C"],[/\\ding\{125\}/g,"\u275D"],[/\\ding\{126\}/g,"\u275E"],[/\\ding\{161\}/g,"\u2761"],[/\\ding\{162\}/g,"\u2762"],[/\\ding\{163\}/g,"\u2763"],[/\\ding\{164\}/g,"\u2764"],[/\\ding\{165\}/g,"\u2765"],[/\\ding\{166\}/g,"\u2766"],[/\\ding\{167\}/g,"\u2767"],[/\\ding\{182\}/g,"\u2776"],[/\\ding\{183\}/g,"\u2777"],[/\\ding\{184\}/g,"\u2778"],[/\\ding\{185\}/g,"\u2779"],[/\\ding\{186\}/g,"\u277A"],[/\\ding\{187\}/g,"\u277B"],[/\\ding\{188\}/g,"\u277C"],[/\\ding\{189\}/g,"\u277D"],[/\\ding\{190\}/g,"\u277E"],[/\\ding\{191\}/g,"\u277F"],[/\\ding\{192\}/g,"\u2780"],[/\\ding\{193\}/g,"\u2781"],[/\\ding\{194\}/g,"\u2782"],[/\\ding\{195\}/g,"\u2783"],[/\\ding\{196\}/g,"\u2784"],[/\\ding\{197\}/g,"\u2785"],[/\\ding\{198\}/g,"\u2786"],[/\\ding\{199\}/g,"\u2787"],[/\\ding\{200\}/g,"\u2788"],[/\\ding\{201\}/g,"\u2789"],[/\\ding\{202\}/g,"\u278A"],[/\\ding\{203\}/g,"\u278B"],[/\\ding\{204\}/g,"\u278C"],[/\\ding\{205\}/g,"\u278D"],[/\\ding\{206\}/g,"\u278E"],[/\\ding\{207\}/g,"\u278F"],[/\\ding\{208\}/g,"\u2790"],[/\\ding\{209\}/g,"\u2791"],[/\\ding\{210\}/g,"\u2792"],[/\\ding\{211\}/g,"\u2793"],[/\\ding\{212\}/g,"\u2794"],[/\\ding\{216\}/g,"\u2798"],[/\\ding\{217\}/g,"\u2799"],[/\\ding\{218\}/g,"\u279A"],[/\\ding\{219\}/g,"\u279B"],[/\\ding\{220\}/g,"\u279C"],[/\\ding\{221\}/g,"\u279D"],[/\\ding\{222\}/g,"\u279E"],[/\\ding\{223\}/g,"\u279F"],[/\\ding\{224\}/g,"\u27A0"],[/\\ding\{225\}/g,"\u27A1"],[/\\ding\{226\}/g,"\u27A2"],[/\\ding\{227\}/g,"\u27A3"],[/\\ding\{228\}/g,"\u27A4"],[/\\ding\{229\}/g,"\u27A5"],[/\\ding\{230\}/g,"\u27A6"],[/\\ding\{231\}/g,"\u27A7"],[/\\ding\{232\}/g,"\u27A8"],[/\\ding\{233\}/g,"\u27A9"],[/\\ding\{234\}/g,"\u27AA"],[/\\ding\{235\}/g,"\u27AB"],[/\\ding\{236\}/g,"\u27AC"],[/\\ding\{237\}/g,"\u27AD"],[/\\ding\{238\}/g,"\u27AE"],[/\\ding\{239\}/g,"\u27AF"],[/\\ding\{241\}/g,"\u27B1"],[/\\ding\{242\}/g,"\u27B2"],[/\\ding\{243\}/g,"\u27B3"],[/\\ding\{244\}/g,"\u27B4"],[/\\ding\{245\}/g,"\u27B5"],[/\\ding\{246\}/g,"\u27B6"],[/\\ding\{247\}/g,"\u27B7"],[/\\ding\{248\}/g,"\u27B8"],[/\\ding\{249\}/g,"\u27B9"],[/\\ding\{250\}/g,"\u27BA"],[/\\ding\{251\}/g,"\u27BB"],[/\\ding\{252\}/g,"\u27BC"],[/\\ding\{253\}/g,"\u27BD"],[/\\ding\{254\}/g,"\u27BE"],[/\\longleftarrow /g,"\u27F5"],[/\\longrightarrow /g,"\u27F6"],[/\\longleftrightarrow /g,"\u27F7"],[/\\Longleftarrow /g,"\u27F8"],[/\\Longrightarrow /g,"\u27F9"],[/\\Longleftrightarrow /g,"\u27FA"],[/\\longmapsto /g,"\u27FC"],[/\\sim\\joinrel\\leadsto/g,"\u27FF"],[/\\ElsevierGlyph\{E212\}/g,"\u2905"],[/\\UpArrowBar /g,"\u2912"],[/\\DownArrowBar /g,"\u2913"],[/\\ElsevierGlyph\{E20C\}/g,"\u2923"],[/\\ElsevierGlyph\{E20D\}/g,"\u2924"],[/\\ElsevierGlyph\{E20B\}/g,"\u2925"],[/\\ElsevierGlyph\{E20A\}/g,"\u2926"],[/\\ElsevierGlyph\{E211\}/g,"\u2927"],[/\\ElsevierGlyph\{E20E\}/g,"\u2928"],[/\\ElsevierGlyph\{E20F\}/g,"\u2929"],[/\\ElsevierGlyph\{E210\}/g,"\u292A"],[/\\ElsevierGlyph\{E21C\}/g,"\u2933"],[/\\ElsevierGlyph\{E21D\}/g,"\u2933-00338"],[/\\ElsevierGlyph\{E21A\}/g,"\u2936"],[/\\ElsevierGlyph\{E219\}/g,"\u2937"],[/\\Elolarr /g,"\u2940"],[/\\Elorarr /g,"\u2941"],[/\\ElzRlarr /g,"\u2942"],[/\\ElzrLarr /g,"\u2944"],[/\\Elzrarrx /g,"\u2947"],[/\\LeftRightVector /g,"\u294E"],[/\\RightUpDownVector /g,"\u294F"],[/\\DownLeftRightVector /g,"\u2950"],[/\\LeftUpDownVector /g,"\u2951"],[/\\LeftVectorBar /g,"\u2952"],[/\\RightVectorBar /g,"\u2953"],[/\\RightUpVectorBar /g,"\u2954"],[/\\RightDownVectorBar /g,"\u2955"],[/\\DownLeftVectorBar /g,"\u2956"],[/\\DownRightVectorBar /g,"\u2957"],[/\\LeftUpVectorBar /g,"\u2958"],[/\\LeftDownVectorBar /g,"\u2959"],[/\\LeftTeeVector /g,"\u295A"],[/\\RightTeeVector /g,"\u295B"],[/\\RightUpTeeVector /g,"\u295C"],[/\\RightDownTeeVector /g,"\u295D"],[/\\DownLeftTeeVector /g,"\u295E"],[/\\DownRightTeeVector /g,"\u295F"],[/\\LeftUpTeeVector /g,"\u2960"],[/\\LeftDownTeeVector /g,"\u2961"],[/\\UpEquilibrium /g,"\u296E"],[/\\ReverseUpEquilibrium /g,"\u296F"],[/\\RoundImplies /g,"\u2970"],[/\\ElsevierGlyph\{E214\}/g,"\u297C"],[/\\ElsevierGlyph\{E215\}/g,"\u297D"],[/\\Elztfnc /g,"\u2980"],[/\\ElsevierGlyph\{3018\}/g,"\u2985"],[/\\Elroang /g,"\u2986"],[/\\ElsevierGlyph\{E291\}/g,"\u2994"],[/\\Elzddfnc /g,"\u2999"],[/\\Angle /g,"\u299C"],[/\\Elzlpargt /g,"\u29A0"],[/\\ElsevierGlyph\{E260\}/g,"\u29B5"],[/\\ElsevierGlyph\{E61B\}/g,"\u29B6"],[/\\ElzLap /g,"\u29CA"],[/\\Elzdefas /g,"\u29CB"],[/\\LeftTriangleBar /g,"\u29CF"],[/\\NotLeftTriangleBar /g,"\u29CF-00338"],[/\\RightTriangleBar /g,"\u29D0"],[/\\NotRightTriangleBar /g,"\u29D0-00338"],[/\\ElsevierGlyph\{E372\}/g,"\u29DC"],[/\\blacklozenge /g,"\u29EB"],[/\\RuleDelayed /g,"\u29F4"],[/\\Elxuplus /g,"\u2A04"],[/\\ElzThr /g,"\u2A05"],[/\\Elxsqcup /g,"\u2A06"],[/\\ElzInf /g,"\u2A07"],[/\\ElzSup /g,"\u2A08"],[/\\ElzCint /g,"\u2A0D"],[/\\clockoint /g,"\u2A0F"],[/\\ElsevierGlyph\{E395\}/g,"\u2A10"],[/\\sqrint /g,"\u2A16"],[/\\ElsevierGlyph\{E25A\}/g,"\u2A25"],[/\\ElsevierGlyph\{E25B\}/g,"\u2A2A"],[/\\ElsevierGlyph\{E25C\}/g,"\u2A2D"],[/\\ElsevierGlyph\{E25D\}/g,"\u2A2E"],[/\\ElzTimes /g,"\u2A2F"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A34"],[/\\ElsevierGlyph\{E25E\}/g,"\u2A35"],[/\\ElsevierGlyph\{E259\}/g,"\u2A3C"],[/\\amalg /g,"\u2A3F"],[/\\ElzAnd /g,"\u2A53"],[/\\ElzOr /g,"\u2A54"],[/\\ElsevierGlyph\{E36E\}/g,"\u2A55"],[/\\ElOr /g,"\u2A56"],[/\\perspcorrespond /g,"\u2A5E"],[/\\Elzminhat /g,"\u2A5F"],[/\\ElsevierGlyph\{225A\}/g,"\u2A63"],[/\\stackrel\{*\}\{=\}/g,"\u2A6E"],[/\\Equal /g,"\u2A75"],[/\\leqslant /g,"\u2A7D"],[/\\nleqslant /g,"\u2A7D-00338"],[/\\geqslant /g,"\u2A7E"],[/\\ngeqslant /g,"\u2A7E-00338"],[/\\lessapprox /g,"\u2A85"],[/\\gtrapprox /g,"\u2A86"],[/\\lneq /g,"\u2A87"],[/\\gneq /g,"\u2A88"],[/\\lnapprox /g,"\u2A89"],[/\\gnapprox /g,"\u2A8A"],[/\\lesseqqgtr /g,"\u2A8B"],[/\\gtreqqless /g,"\u2A8C"],[/\\eqslantless /g,"\u2A95"],[/\\eqslantgtr /g,"\u2A96"],[/\\Pisymbol\{ppi020\}\{117\}/g,"\u2A9D"],[/\\Pisymbol\{ppi020\}\{105\}/g,"\u2A9E"],[/\\NestedLessLess /g,"\u2AA1"],[/\\NotNestedLessLess /g,"\u2AA1-00338"],[/\\NestedGreaterGreater /g,"\u2AA2"],[/\\NotNestedGreaterGreater /g,"\u2AA2-00338"],[/\\preceq /g,"\u2AAF"],[/\\not\\preceq /g,"\u2AAF-00338"],[/\\succeq /g,"\u2AB0"],[/\\not\\succeq /g,"\u2AB0-00338"],[/\\precneqq /g,"\u2AB5"],[/\\succneqq /g,"\u2AB6"],[/\\precapprox /g,"\u2AB7"],[/\\succapprox /g,"\u2AB8"],[/\\precnapprox /g,"\u2AB9"],[/\\succnapprox /g,"\u2ABA"],[/\\subseteqq /g,"\u2AC5"],[/\\nsubseteqq /g,"\u2AC5-00338"],[/\\supseteqq /g,"\u2AC6"],[/\\nsupseteqq/g,"\u2AC6-00338"],[/\\subsetneqq /g,"\u2ACB"],[/\\supsetneqq /g,"\u2ACC"],[/\\ElsevierGlyph\{E30D\}/g,"\u2AEB"],[/\\Elztdcol /g,"\u2AF6"],[/\\ElsevierGlyph\{300A\}/g,"\u300A"],[/\\ElsevierGlyph\{300B\}/g,"\u300B"],[/\\ElsevierGlyph\{3018\}/g,"\u3018"],[/\\ElsevierGlyph\{3019\}/g,"\u3019"],[/\\openbracketleft /g,"\u301A"],[/\\openbracketright /g,"\u301B"]];return this}if(typeof module!=="undefined"&&module.exports){module.exports=BibtexParser};
\ No newline at end of file
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/packed/mvc/citation/citation-model.js
--- a/static/scripts/packed/mvc/citation/citation-model.js
+++ b/static/scripts/packed/mvc/citation/citation-model.js
@@ -1,1 +1,1 @@
-define(["mvc/base-mvc","utils/localization"],function(a,e){var f=Backbone.Model.extend(a.LoggableMixin).extend({initialize:function(){var g=this.attributes.content;var h=new BibtexParser(g).entries[0];this.entry=h},entryType:function(){return this.entry.EntryType},fields:function(){return this.entry.Fields}});var b=Backbone.Collection.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api",partial:true,model:f,});var d=b.extend({url:function(){return this.urlRoot+"/histories/"+this.history_id+"/citations"}});var c=b.extend({url:function(){return this.urlRoot+"/tools/"+this.tool_id+"/citations"},partial:false,});return{Citation:f,HistoryCitationCollection:d,ToolCitationCollection:c}});
\ No newline at end of file
+define(["mvc/base-mvc","utils/localization"],function(a,e){var f=Backbone.Model.extend(a.LoggableMixin).extend({initialize:function(){var g=this.attributes.content;var i=new BibtexParser(g).entries[0];this.entry=i;this._fields={};var k=i.Fields;for(key in k){var j=k[key];var h=key.toLowerCase();this._fields[h]=j}},entryType:function(){return this.entry.EntryType},fields:function(){return this._fields}});var b=Backbone.Collection.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api",partial:true,model:f,});var d=b.extend({url:function(){return this.urlRoot+"/histories/"+this.history_id+"/citations"}});var c=b.extend({url:function(){return this.urlRoot+"/tools/"+this.tool_id+"/citations"},partial:false,});return{Citation:f,HistoryCitationCollection:d,ToolCitationCollection:c}});
\ No newline at end of file
diff -r 6ebb0a47a2a3088ba9ed313d8f323d7e1f5c9bb6 -r 103697ebdd339377424063fba0459cb3cc2b707c static/scripts/packed/mvc/citation/citation-view.js
--- a/static/scripts/packed/mvc/citation/citation-view.js
+++ b/static/scripts/packed/mvc/citation/citation-view.js
@@ -1,1 +1,1 @@
-define(["mvc/base-mvc","mvc/citation/citation-model","utils/localization"],function(a,d,c){var b=Backbone.View.extend({tagName:"div",className:"citations",render:function(){this.$el.append("<p>"+this.formattedReference()+"</p>");return this},formattedReference:function(){var j=this.model;var i=j.entryType();var k=j.fields();var g="";var n=this._asSentence((k.author?k.author:"")+(k.year?(" ("+k.year+")"):""))+" ";var m=k.title||"";var h=k.pages?("pp. "+k.pages):"";var o=k.address;if(i=="article"){g=n+this._asSentence(m)+(k.journal?("In <em>"+k.journal+", "):"")+(k.volume?k.volume:"")+(k.number?("("+k.number+"), "):", ")+this._asSentence(h)+this._asSentence(k.address)+"</em>"}else{if(i=="inproceedings"||i=="proceedings"){g=n+this._asSentence(m)+(k.booktitle?("In <em>"+k.booktitle+", "):"")+(h?h:"")+(o?", "+o:"")+".</em>"}else{if(i=="mastersthesis"||i=="phdthesis"){g=n+this._asSentence(m)+(k.howpublished?k.howpublished+". ":"")+(k.note?k.note+".":"")}else{if(i=="techreport"){g=n+". "+this._asSentence(m)+this._asSentence(k.institution)+this._asSentence(k.number)+this._asSentence(k.type)}else{if(i=="book"||i=="inbook"||i=="incollection"){g=this._asSentence(n)+" "+this._formatBookInfo(k)}else{g=this._asSentence(n)+" "+this._asSentence(m)+this._asSentence(k.howpublished)+this._asSentence(k.note)}}}}}var l="";if(k.DOI){l="http://dx.doi.org/"+k.DOI;g+='[<a href="'+l+'">doi:'+k.DOI+"</a>]"}var f=k.url||l;if(f){g+='[<a href="'+f+'">Link</a>]'}return g},_formatBookInfo:function(f){var g="";if(f.chapter){g+=f.chapter+" in "}if(f.title){g+="<em>"+f.title+"</em>"}if(f.editor){g+=", Edited by "+f.editor+", "}if(f.publisher){g+=", "+f.publisher}if(f.pages){g+=", pp. "+f.pages+""}if(f.series){g+=", <em>"+f.series+"</em>"}if(f.volume){g+=", Vol."+f.volume}if(f.issn){g+=", ISBN: "+f.issn}return g+"."},_asSentence:function(f){return(f&&f.trim())?f+". ":""}});var e=Backbone.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(g){var f=new b({model:g});this.$(".citations-formatted").append(f.render().el);var h=this.$(".citations-bibtex-text");h.val(h.val()+"\n\r"+g.attributes.content)},render:function(){this.$el.html(this.citationsElement());this.collection.each(function(f){this.renderCitation(f)},this);this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show();this.$(".citations-to-bibtex").hide();this.$(".citations-bibtex").show();this.$(".citations-formatted").hide();this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide();this.$(".citations-to-bibtex").show();this.$(".citations-bibtex").hide();this.$(".citations-formatted").show()},partialWarningElement:function(){if(this.collection.partial){return['<div style="padding:5px 10px">',"<b>Warning: This is a experimental feature.</b> Most Galaxy tools will not annotate"," citations explicitly at this time. When writing up your analysis, please manually"," review your histories and find all references"," that should be cited in order to completely describe your work. Also, please remember to",' <a href="https://wiki.galaxyproject.org/CitingGalaxy">cite Galaxy</a>.',"</div>",].join("")}else{return""}},citationsElement:function(){return['<div class="toolForm">','<div class="toolFormTitle">',c("Citations"),' <i class="fa fa-pencil-square-o citations-to-bibtex" title="Select all as BibTeX."></i>',' <i class="fa fa-times citations-to-formatted" title="Return to formatted citation list."></i>',"</div>",'<div class="toolFormBody" style="padding:5px 10px">',this.partialWarningElement(),'<span class="citations-formatted"></span>',"</div>",'<div class="citations-bibtex toolFormBody" style="padding:5px 10px">','<textarea style="width: 100%; height: 500px;" class="citations-bibtex-text"></textarea>',"</div>","</div>"].join("")}});return{CitationView:b,CitationListView:e}});
\ No newline at end of file
+define(["mvc/base-mvc","mvc/citation/citation-model","utils/localization"],function(a,d,c){var b=Backbone.View.extend({tagName:"div",className:"citations",render:function(){this.$el.append("<p>"+this.formattedReference()+"</p>");return this},formattedReference:function(){var j=this.model;var i=j.entryType();var k=j.fields();var g="";var n=this._asSentence((k.author?k.author:"")+(k.year?(" ("+k.year+")"):""))+" ";var m=k.title||"";var h=k.pages?("pp. "+k.pages):"";var o=k.address;if(i=="article"){g=n+this._asSentence(m)+(k.journal?("In <em>"+k.journal+", "):"")+(k.volume?k.volume:"")+(k.number?("("+k.number+"), "):", ")+this._asSentence(h)+this._asSentence(k.address)+"</em>"}else{if(i=="inproceedings"||i=="proceedings"){g=n+this._asSentence(m)+(k.booktitle?("In <em>"+k.booktitle+", "):"")+(h?h:"")+(o?", "+o:"")+".</em>"}else{if(i=="mastersthesis"||i=="phdthesis"){g=n+this._asSentence(m)+(k.howpublished?k.howpublished+". ":"")+(k.note?k.note+".":"")}else{if(i=="techreport"){g=n+". "+this._asSentence(m)+this._asSentence(k.institution)+this._asSentence(k.number)+this._asSentence(k.type)}else{if(i=="book"||i=="inbook"||i=="incollection"){g=this._asSentence(n)+" "+this._formatBookInfo(k)}else{g=this._asSentence(n)+" "+this._asSentence(m)+this._asSentence(k.howpublished)+this._asSentence(k.note)}}}}}var l="";if(k.doi){l="http://dx.doi.org/"+k.doi;g+='[<a href="'+l+'">doi:'+k.doi+"</a>]"}var f=k.url||l;if(f){g+='[<a href="'+f+'">Link</a>]'}return g},_formatBookInfo:function(f){var g="";if(f.chapter){g+=f.chapter+" in "}if(f.title){g+="<em>"+f.title+"</em>"}if(f.editor){g+=", Edited by "+f.editor+", "}if(f.publisher){g+=", "+f.publisher}if(f.pages){g+=", pp. "+f.pages+""}if(f.series){g+=", <em>"+f.series+"</em>"}if(f.volume){g+=", Vol."+f.volume}if(f.issn){g+=", ISBN: "+f.issn}return g+"."},_asSentence:function(f){return(f&&f.trim())?f+". ":""}});var e=Backbone.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(g){var f=new b({model:g});this.$(".citations-formatted").append(f.render().el);var h=this.$(".citations-bibtex-text");h.val(h.val()+"\n\r"+g.attributes.content)},render:function(){this.$el.html(this.citationsElement());this.collection.each(function(f){this.renderCitation(f)},this);this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show();this.$(".citations-to-bibtex").hide();this.$(".citations-bibtex").show();this.$(".citations-formatted").hide();this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide();this.$(".citations-to-bibtex").show();this.$(".citations-bibtex").hide();this.$(".citations-formatted").show()},partialWarningElement:function(){if(this.collection.partial){return['<div style="padding:5px 10px">',"<b>Warning: This is a experimental feature.</b> Most Galaxy tools will not annotate"," citations explicitly at this time. When writing up your analysis, please manually"," review your histories and find all references"," that should be cited in order to completely describe your work. Also, please remember to",' <a href="https://wiki.galaxyproject.org/CitingGalaxy">cite Galaxy</a>.',"</div>",].join("")}else{return""}},citationsElement:function(){return['<div class="toolForm">','<div class="toolFormTitle">',c("Citations"),' <i class="fa fa-pencil-square-o citations-to-bibtex" title="Select all as BibTeX."></i>',' <i class="fa fa-times citations-to-formatted" title="Return to formatted citation list."></i>',"</div>",'<div class="toolFormBody" style="padding:5px 10px">',this.partialWarningElement(),'<span class="citations-formatted"></span>',"</div>",'<div class="citations-bibtex toolFormBody" style="padding:5px 10px">','<textarea style="width: 100%; height: 500px;" class="citations-bibtex-text"></textarea>',"</div>","</div>"].join("")}});return{CitationView:b,CitationListView:e}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0