i;i++)r=e[i],isNaN(this.sx0[r]+this.sy0[r]+this.sx1[r]+this.sy1[r]+this.scx[r]+this.scy[r])||(t.beginPath(),t.moveTo(this.sx0[r],this.sy0[r]),t.quadraticCurveTo(this.scx[r],this.scy[r],this.sx1[r],this.sy1[r]),n.line_properties.set_vectorize(t,r),s.push(t.stroke()));return s}},n.prototype.draw_legend=function(t,e,n,r,i){return this._generic_line_legend(t,e,n,r,i)},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/ray",["underscore","renderer/properties","./glyph"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._fields=["x","y","angle","length"],n.prototype._properties=["line"],n.prototype._map_data=function(){var t,e,n,r,i,o,s,a;for(o=this.plot_view.map_to_screen(this.x,this.glyph_props.x.units,this.y,this.glyph_props.y.units),this.sx=o[0],this.sy=o[1],r=this.plot_view.view_state.get("width"),t=this.plot_view.view_state.get("height"),n=2*(r+t),a=[],e=i=0,s=this.length.length;s>=0?s>i:i>s;e=s>=0?++i:--i)0===this.length[e]?a.push(this.length[e]=n):a.push(void 0);return a},n.prototype._render=function(t,e,n){var r,i,o,s;if(n.line_properties.do_stroke){for(s=[],i=0,o=e.length;o>i;i++)r=e[i],isNaN(this.sx[r]+this.sy[r]+this.angle[r]+this.length[r])||(t.translate(this.sx[r],this.sy[r]),t.rotate(this.angle[r]),t.beginPath(),t.moveTo(0,0),t.lineTo(this.length[r],0),n.line_properties.set_vectorize(t,r),t.stroke(),t.rotate(-this.angle[r]),s.push(t.translate(-this.sx[r],-this.sy[r])));return s}},n.prototype.draw_legend=function(t,e,n,r,i){return this._generic_line_legend(t,e,n,r,i)},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/rect",["underscore","rbush","renderer/properties","./glyph"],function(t,n,r,i){var o,s,a,l;return s=function(r){function i(){return a=i.__super__.constructor.apply(this,arguments)}return e(i,r),i.prototype._fields=["x","y","width","height","angle"],i.prototype._properties=["line","fill"],i.prototype._map_data=function(){var e,n,r,i,o,s;for(o=this.plot_view.map_to_screen(this.x,this.glyph_props.x.units,this.y,this.glyph_props.y.units),n=o[0],r=o[1],this.sw=this.distance_vector("x","width","center",this.mget("glyphspec").dilate),this.sh=this.distance_vector("y","height","center",this.mget("glyphspec").dilate),this.sx=new Array(n.length),this.sy=new Array(n.length),e=i=0,s=n.length;s>=0?s>i:i>s;e=s>=0?++i:--i)this.sx[e]=Math.abs(n[e]-this.sw[e])<2?Math.round(n[e]):n[e],this.sy[e]=Math.abs(r[e]-this.sh[e])<2?Math.round(r[e]):r[e];return this.max_width=t.max(this.width),this.max_height=t.max(this.height)},i.prototype._set_data=function(){var t,e,r,i;for(this.index=n(),e=[],t=r=0,i=this.x.length;i>=0?i>r:r>i;t=i>=0?++r:--r)isNaN(this.x[t]+this.y[t])||e.push([this.x[t],this.y[t],this.x[t],this.y[t],{i:t}]);return this.index.load(e)},i.prototype._render=function(t,e,n,r,i,o,s){var a,l,c,u,h;if(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.sw),null==s&&(s=this.sh),n.fill_properties.do_fill)for(l=0,u=e.length;u>l;l++)a=e[l],isNaN(r[a]+i[a]+o[a]+s[a]+this.angle[a])||(n.fill_properties.set_vectorize(t,a),this.angle[a]?(t.translate(r[a],i[a]),t.rotate(this.angle[a]),t.fillRect(-o[a]/2,-s[a]/2,o[a],s[a]),t.rotate(-this.angle[a]),t.translate(-r[a],-i[a])):(t.fillRect(r[a]-o[a]/2,i[a]-s[a]/2,o[a],s[a]),t.rect(r[a]-o[a]/2,i[a]-s[a]/2,o[a],s[a])));if(n.line_properties.do_stroke){for(t.beginPath(),c=0,h=e.length;h>c;c++)a=e[c],isNaN(r[a]+i[a]+o[a]+s[a]+this.angle[a])||(this.angle[a]?(t.translate(r[a],i[a]),t.rotate(this.angle[a]),t.rect(-o[a]/2,-s[a]/2,o[a],s[a]),t.rotate(-this.angle[a]),t.translate(-r[a],-i[a])):t.rect(r[a]-o[a]/2,i[a]-s[a]/2,o[a],s[a]),n.line_properties.set_vectorize(t,a),t.stroke(),t.beginPath());return t.stroke()}},i.prototype._hit_point=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j,C,T,M,N,S,A,E,O,P,z;for(O=[t.vx,t.vy],f=O[0],v=O[1],x=this.plot_view.xmapper.map_from_target(f),T=this.plot_view.ymapper.map_from_target(v),C="string"==typeof x,S="string"==typeof T,C||S?n=function(){var t,e,n;for(n=[],s=t=0,e=this.x.length;e>=0?e>t:t>e;s=e>=0?++t:--t)n.push(s);return n}.call(this):("screen"===this.width_units||C?(l=this.max_width,C&&(l=this.plot_view.xmapper.map_to_target(l)),g=f-2*l,m=f+2*l,P=this.plot_view.xmapper.v_map_from_target([g,m]),k=P[0],j=P[1]):(k=x-2*this.max_width,j=x+2*this.max_width),"screen"===this.height_units||S?(a=this.max_height,S&&(a=this.plot_view.ymapper.map_to_target(a)),y=v-2*a,b=v+2*a,z=this.plot_view.ymapper.v_map_from_target([y,b]),M=z[0],N=z[1]):(M=T-2*this.max_height,N=T+2*this.max_height),n=function(){var t,e,n,r;for(n=this.index.search([k,M,j,N]),r=[],t=0,e=n.length;e>t;t++)c=n[t],r.push(c[4].i);return r}.call(this)),o=[],A=0,E=n.length;E>A;A++)s=n[A],d="screen"===this.width_units||C?this.plot_view.view_state.vx_to_sx(f):this.plot_view.view_state.vx_to_sx(this.plot_view.xmapper.map_to_target(x)),_="screen"===this.height_units||S?this.plot_view.view_state.vy_to_sy(v):this.plot_view.view_state.vy_to_sy(this.plot_view.ymapper.map_to_target(T)),this.angle[s]&&(r=Math.sqrt(Math.pow(d-this.sx[s],2)+Math.pow(_-this.sy[s],2)),p=Math.sin(-this.angle[s]),e=Math.cos(-this.angle[s]),u=e*(d-this.sx[s])-p*(_-this.sy[s])+this.sx[s],h=p*(d-this.sx[s])+e*(_-this.sy[s])+this.sy[s],d=u,_=h),w=Math.abs(this.sx[s]-d)<=this.sw[s]/2,i=Math.abs(this.sy[s]-_)<=this.sh[s]/2,i&&w&&o.push(s);return o},i.prototype.draw_legend=function(t,e,n,r,i){var o,s,a,l,c,u,h,p,d;return a=null!=(d=this.get_reference_point())?d:0,s=[a],h={},h[a]=(e+n)/2,p={},p[a]=(r+i)/2,l=this.sw[a]/this.sh[a],o=.8*Math.min(Math.abs(n-e),Math.abs(i-r)),u={},c={},l>1?(u[a]=o,c[a]=o/l):(u[a]=o*l,c[a]=o),this._render(t,s,this.glyph_props,h,p,u,c)},i}(i.View),o=function(n){function r(){return l=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=s,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0,angle:0,dilate:!1})},r}(i.Model),{Model:o,View:s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/square",["underscore","renderer/properties","./marker"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._properties=["line","fill"],n.prototype._render=function(t,e,n,r,i,o){var s,a,l,c;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.size),c=[],a=0,l=e.length;l>a;a++)s=e[a],isNaN(r[s]+i[s]+o[s])||(t.translate(r[s],i[s]),t.beginPath(),t.rect(-o[s]/2,-o[s]/2,o[s],o[s]),n.fill_properties.do_fill&&(n.fill_properties.set_vectorize(t,s),t.fill()),n.line_properties.do_stroke&&(n.line_properties.set_vectorize(t,s),t.stroke()),c.push(t.translate(-r[s],-i[s])));return c},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{size_units:"screen",fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/square_x",["underscore","renderer/properties","./marker"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._properties=["line","fill"],n.prototype._render=function(t,e,n,r,i,o){var s,a,l,c,u;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.size),u=[],l=0,c=e.length;c>l;l++)s=e[l],isNaN(r[s]+i[s]+o[s])||(t.translate(r[s],i[s]),t.beginPath(),t.rect(-o[s]/2,-o[s]/2,o[s],o[s]),n.fill_properties.do_fill&&(n.fill_properties.set_vectorize(t,s),t.fill()),n.line_properties.do_stroke&&(n.line_properties.set_vectorize(t,s),t.stroke(),a=o[s]/2,t.moveTo(-a,+a),t.lineTo(+a,-a),t.moveTo(-a,-a),t.lineTo(+a,+a),t.stroke()),u.push(t.translate(-r[s],-i[s])));return u},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)
}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{size_units:"screen",fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/square_cross",["underscore","renderer/properties","./marker"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._properties=["line","fill"],n.prototype._render=function(t,e,n,r,i,o){var s,a,l,c,u;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.size),u=[],l=0,c=e.length;c>l;l++)s=e[l],isNaN(r[s]+i[s]+o[s])||(t.translate(r[s],i[s]),t.beginPath(),t.rect(-o[s]/2,-o[s]/2,o[s],o[s]),n.fill_properties.do_fill&&(n.fill_properties.set_vectorize(t,s),t.fill()),n.line_properties.do_stroke&&(n.line_properties.set_vectorize(t,s),a=o[s]/2,t.moveTo(0,+a),t.lineTo(0,-a),t.moveTo(-a,0),t.lineTo(+a,0),t.stroke()),u.push(t.translate(-r[s],-i[s])));return u},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{size_units:"screen",fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/segment",["underscore","renderer/properties","./glyph"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._fields=["x0","y0","x1","y1"],n.prototype._properties=["line"],n.prototype._map_data=function(){var t,e;return t=this.plot_view.map_to_screen(this.x0,this.glyph_props.x0.units,this.y0,this.glyph_props.y0.units),this.sx0=t[0],this.sy0=t[1],e=this.plot_view.map_to_screen(this.x1,this.glyph_props.x1.units,this.y1,this.glyph_props.y1.units),this.sx1=e[0],this.sy1=e[1],e},n.prototype._render=function(t,e,n){var r,i,o,s;if(n.line_properties.do_stroke){for(s=[],i=0,o=e.length;o>i;i++)r=e[i],isNaN(this.sx0[r]+this.sy0[r]+this.sx1[r]+this.sy1[r])||(t.beginPath(),t.moveTo(this.sx0[r],this.sy0[r]),t.lineTo(this.sx1[r],this.sy1[r]),n.line_properties.set_vectorize(t,r),s.push(t.stroke()));return s}},n.prototype.draw_legend=function(t,e,n,r,i){return this._generic_line_legend(t,e,n,r,i)},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/text",["underscore","renderer/properties","./glyph"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._fields=["x","y","angle","text:string"],n.prototype._properties=["text"],n.prototype._map_data=function(){var t;return t=this.plot_view.map_to_screen(this.x,this.glyph_props.x.units,this.y,this.glyph_props.y.units),this.sx=t[0],this.sy=t[1],t},n.prototype._render=function(t,e,n){var r,i,o,s;for(s=[],i=0,o=e.length;o>i;i++)r=e[i],isNaN(this.sx[r]+this.sy[r]+this.angle[r])||(t.translate(this.sx[r],this.sy[r]),t.rotate(this.angle[r]),n.text_properties.set_vectorize(t,r),t.fillText(this.text[r],0,0),t.rotate(-this.angle[r]),s.push(t.translate(-this.sx[r],-this.sy[r])));return s},n.prototype.draw_legend=function(t,e,n,r,i){var o,s,a,l;return o=this.glyph_props,l=o.text_properties,t.save(),a=this.get_reference_point(),s=null!=a?a:o,l.set(t,s),t.font=l.font(12),t.textAlign="right",t.textBaseline="middle",t.fillText("txt",n,(r+i)/2),t.restore()},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{text_font:"helvetica",text_font_size:"12pt",text_font_style:"normal",text_color:"#444444",text_alpha:1,text_align:"left",text_baseline:"bottom"})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/triangle",["underscore","renderer/properties","./marker"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._properties=["line","fill"],n.prototype._render=function(t,e,n,r,i,o){var s,a,l,c,u,h,p;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.size),p=[],u=0,h=e.length;h>u;u++)l=e[u],isNaN(r[l]+i[l]+o[l])||(s=o[l]*Math.sqrt(3)/6,c=o[l]/2,a=o[l]*Math.sqrt(3)/2,t.beginPath(),t.moveTo(r[l]-c,i[l]+s),t.lineTo(r[l]+c,i[l]+s),t.lineTo(r[l],i[l]+s-a),t.closePath(),n.fill_properties.do_fill&&(n.fill_properties.set_vectorize(t,l),t.fill()),n.line_properties.do_stroke?(n.line_properties.set_vectorize(t,l),p.push(t.stroke())):p.push(void 0));return p},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/wedge",["underscore","rbush","common/mathutils","renderer/properties","./glyph"],function(t,n,r,i,o){var s,a,l,c;return a=function(i){function o(){return l=o.__super__.constructor.apply(this,arguments)}return e(o,i),o.prototype._fields=["x","y","radius","start_angle","end_angle","direction:string"],o.prototype._properties=["line","fill"],o.prototype._set_data=function(){var e,r,i,o;for(this.max_radius=t.max(this.radius),this.index=n(),r=[],e=i=0,o=this.x.length;o>=0?o>i:i>o;e=o>=0?++i:--i)isNaN(this.x[e]+this.y[e])||r.push([this.x[e],this.y[e],this.x[e],this.y[e],{i:e}]);return this.index.load(r)},o.prototype._map_data=function(){var t;return t=this.plot_view.map_to_screen(this.x,this.glyph_props.x.units,this.y,this.glyph_props.y.units),this.sx=t[0],this.sy=t[1],this.radius=this.distance_vector("x","radius","edge")},o.prototype._render=function(t,e,n,r,i,o){var s,a,l,c;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.radius),c=[],a=0,l=e.length;l>a;a++)s=e[a],isNaN(r[s]+i[s]+o[s]+this.start_angle[s]+this.end_angle[s]+this.direction[s])||(t.beginPath(),t.arc(r[s],i[s],o[s],this.start_angle[s],this.end_angle[s],this.direction[s]),t.lineTo(r[s],i[s]),t.closePath(),n.fill_properties.do_fill&&(n.fill_properties.set_vectorize(t,s),t.fill()),n.line_properties.do_stroke?(n.line_properties.set_vectorize(t,s),c.push(t.stroke())):c.push(void 0));return c},o.prototype._hit_point=function(e){var n,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j,C,T,M,N,S,A,E,O,P,z,D,F,$,q;if(D=[e.vx,e.vy],m=D[0],b=D[1],k=this.plot_view.xmapper.map_from_target(m),T=this.plot_view.ymapper.map_from_target(b),"screen"===this.radius_units?(v=m-this.max_radius,y=m+this.max_radius,F=this.plot_view.xmapper.v_map_from_target([v,y]),j=F[0],C=F[1],w=b-this.max_radius,x=b+this.max_radius,$=this.plot_view.ymapper.v_map_from_target([w,x]),M=$[0],N=$[1]):(j=k-this.max_radius,C=k+this.max_radius,M=T-this.max_radius,N=T+this.max_radius),i=function(){var t,e,n,r;for(n=this.index.search([j,M,C,N]),r=[],t=0,e=n.length;e>t;t++)c=n[t],r.push(c[4].i);return r}.call(this),o=[],"screen"===this.radius_units)for(h=this.plot_view.view_state.vx_to_sx(m),_=this.plot_view.view_state.vy_to_sy(b),S=0,O=i.length;O>S;S++)l=i[S],u=Math.pow(this.radius[l],2),s=Math.pow(this.sx[l]-h,2)+Math.pow(this.sy[l]-_,2),u>=s&&o.push([l,s]);else for(A=0,P=i.length;P>A;A++)l=i[A],u=Math.pow(this.radius[l],2),p=this.plot_view.xmapper.map_to_target(k),d=this.plot_view.xmapper.map_to_target(this.x[l]),f=this.plot_view.ymapper.map_to_target(T),g=this.plot_view.ymapper.map_to_target(this.y[l]),s=Math.pow(p-d,2)+Math.pow(f-g,2),u>=s&&o.push([l,s]);for(a=[],E=0,z=o.length;z>E;E++)q=o[E],l=q[0],s=q[1],h=this.plot_view.view_state.vx_to_sx(m),_=this.plot_view.view_state.vy_to_sy(b),n=Math.atan2(_-this.sy[l],h-this.sx[l]),r.angle_between(-n,-this.start_angle[l],-this.end_angle[l],this.direction[l])&&a.push([l,s]);return a=t.chain(a).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value()},o.prototype.draw_legend=function(t,e,n,r,i){var o,s,a,l,c,u;return a=null!=(u=this.get_reference_point())?u:0,o=[a],l={},l[a]=(e+n)/2,c={},c[a]=(r+i)/2,s={},s[a]=.4*Math.min(Math.abs(n-e),Math.abs(i-r)),this._render(t,o,this.glyph_props,l,c,s)},o}(o.View),s=function(n){function r(){return c=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=a,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{direction:"anticlock",fill_color:"gray",fill_alpha:1,line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(o.Model),{Model:s,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/x",["underscore","renderer/properties","./marker"],function(t,n,r){var i,o,s,a;return o=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype._properties=["line"],n.prototype._render=function(t,e,n,r,i,o){var s,a,l,c,u;for(null==r&&(r=this.sx),null==i&&(i=this.sy),null==o&&(o=this.size),u=[],l=0,c=e.length;c>l;l++)s=e[l],isNaN(r[s]+i[s]+o[s])||(a=o[s]/2,t.beginPath(),t.moveTo(r[s]-a,i[s]+a),t.lineTo(r[s]+a,i[s]-a),t.moveTo(r[s]-a,i[s]-a),t.lineTo(r[s]+a,i[s]+a),n.line_properties.do_stroke?(n.line_properties.set_vectorize(t,s),u.push(t.stroke())):u.push(void 0));return u},n}(r.View),i=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=o,r.prototype.type="Glyph",r.prototype.display_defaults=function(){return t.extend(r.__super__.display_defaults.call(this),{line_color:"red",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},r}(r.Model),{Model:i,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/glyph/glyph_factory",["require","exports","module","underscore","common/has_parent","common/plot_widget","./annular_wedge","./annulus","./arc","./asterisk","./bezier","./circle","./circle_x","./circle_cross","./diamond","./diamond_cross","./image","./image_rgba","./image_uri","./inverted_triangle","./line","./multi_line","./oval","./patch","./patches","./cross","./quad","./quadratic","./ray","./rect","./square","./square_x","./square_cross","./segment","./text","./triangle","./wedge","./x"],function(t){var n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j,C,T,M,N,S,A,E,O,P,z,D,F,$,q,B;return q=t("underscore"),r=t("common/has_parent"),i=t("common/plot_widget"),o=t("./annular_wedge"),s=t("./annulus"),a=t("./arc"),l=t("./asterisk"),c=t("./bezier"),u=t("./circle"),p=t("./circle_x"),h=t("./circle_cross"),_=t("./diamond"),f=t("./diamond_cross"),m=t("./image"),v=t("./image_rgba"),y=t("./image_uri"),b=t("./inverted_triangle"),w=t("./line"),x=t("./multi_line"),k=t("./oval"),j=t("./patch"),C=t("./patches"),d=t("./cross"),T=t("./quad"),M=t("./quadratic"),N=t("./ray"),S=t("./rect"),E=t("./square"),P=t("./square_x"),O=t("./square_cross"),A=t("./segment"),z=t("./text"),D=t("./triangle"),F=t("./wedge"),$=t("./x"),g={annular_wedge:o.Model,annulus:s.Model,arc:a.Model,asterisk:l.Model,bezier:c.Model,circle:u.Model,circle_x:p.Model,circle_cross:h.Model,diamond:_.Model,diamond_cross:f.Model,image:m.Model,image_rgba:v.Model,image_uri:y.Model,inverted_triangle:b.Model,line:w.Model,multi_line:x.Model,oval:k.Model,patch:j.Model,patches:C.Model,cross:d.Model,quad:T.Model,quadratic:M.Model,ray:N.Model,square:E.Model,square_x:P.Model,square_cross:O.Model,rect:S.Model,segment:A.Model,text:z.Model,triangle:D.Model,wedge:F.Model,x:$.Model},n=function(t){function n(){return B=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=function(t,e){var n,r,i;return null==(null!=(i=t.glyphspec)?i.type:void 0)?(console.log("missing glyph type"),void 0):(r=t.glyphspec.type,r in g?(n=g[r],new n(t,e)):(console.log("unknown glyph type '"+r+"'"),void 0))},n}(Backbone.Collection),{Collection:new n}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/guide/axis",["underscore","backbone","common/safebind","common/has_parent","common/plot_widget","renderer/properties"],function(t,n,r,i,o,s){var a,l,c,u,h,p,d,_,f,g,m,v,y;return c=s.glyph_properties,u=s.line_properties,h=s.text_properties,f={top:{parallel:0,normal:-Math.PI/2,horizontal:0,vertical:-Math.PI/2},bottom:{parallel:0,normal:Math.PI/2,horizontal:0,vertical:Math.PI/2},left:{parallel:-Math.PI/2,normal:0,horizontal:0,vertical:-Math.PI/2},right:{parallel:Math.PI/2,normal:0,horizontal:0,vertical:Math.PI/2}},g={top:{parallel:"alphabetic",normal:"middle",horizontal:"alphabetic",vertical:"middle"},bottom:{parallel:"hanging",normal:"middle",horizontal:"hanging",vertical:"middle"},left:{parallel:"alphabetic",normal:"middle",horizontal:"middle",vertical:"alphabetic"},right:{parallel:"alphabetic",normal:"middle",horizontal:"middle",vertical:"alphabetic"}},p={top:{parallel:"center",normal:"left",horizontal:"center",vertical:"left"},bottom:{parallel:"center",normal:"left",horizontal:"center",vertical:"right"},left:{parallel:"center",normal:"right",horizontal:"right",vertical:"center"},right:{parallel:"center",normal:"left",horizontal:"left",vertical:"center"}},d={top:"right",bottom:"left",left:"right",right:"left"},_={top:"left",bottom:"right",left:"right",right:"left"},m=[{norm:{norm:{min:1,max:-1},flip:{min:-1,max:1}},flip:{norm:{min:1,max:-1},flip:{min:-1,max:1}}},{norm:{norm:{min:-1,max:1},flip:{min:-1,max:1}},flip:{norm:{min:1,max:-1},flip:{min:1,max:-1}}}],l=function(n){function i(){return v=i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.initialize=function(t){return i.__super__.initialize.call(this,t),this.rule_props=new u(this,null,"axis_"),this.major_tick_props=new u(this,null,"major_tick_"),this.major_label_props=new h(this,null,"major_label_"),this.axis_label_props=new h(this,null,"axis_label_")},i.prototype.render=function(){var t;return t=this.plot_view.ctx,t.save(),this._draw_rule(t),this._draw_major_ticks(t),this._draw_major_labels(t),this._draw_axis_label(t),t.restore()},i.prototype.bind_bokeh_events=function(){return r(this,this.model,"change",this.request_render)},i.prototype.padding_request=function(){return this._padding_request()},i.prototype._draw_rule=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d;if(this.rule_props.do_stroke){for(u=e=this.mget("rule_coords"),a=u[0],l=u[1],h=this.plot_view.map_to_screen(a,"data",l,"data"),o=h[0],s=h[1],p=this.mget("normals"),r=p[0],i=p[1],this.rule_props.set(t,this),t.beginPath(),t.moveTo(Math.round(o[0]),Math.round(s[0])),n=c=1,d=o.length;d>=1?d>c:c>d;n=d>=1?++c:--c)t.lineTo(Math.round(o[n]),Math.round(s[n]));return t.stroke()}},i.prototype._draw_major_ticks=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g;if(this.major_tick_props.do_stroke){for(p=e=this.mget("major_coords"),c=p[0],u=p[1],d=this.plot_view.map_to_screen(c,"data",u,"data"),o=d[0],s=d[1],_=this.mget("normals"),r=_[0],i=_[1],a=this.mget("major_tick_in"),l=this.mget("major_tick_out"),this.major_tick_props.set(t,this),g=[],n=h=0,f=o.length;f>=0?f>h:h>f;n=f>=0?++h:--h)t.beginPath(),t.moveTo(Math.round(o[n]+r*l),Math.round(s[n]+i*l)),t.lineTo(Math.round(o[n]-r*a),Math.round(s[n]-i*a)),g.push(t.stroke());return g}},i.prototype._draw_major_labels=function(e){var n,r,i,o,s,a,l,c,u,h,p,d,_,g,m,v,y,b,w,x;for(v=r=this.mget("major_coords"),_=v[0],g=v[1],y=this.plot_view.map_to_screen(_,"data",g,"data"),p=y[0],d=y[1],b=this.mget("normals"),a=b[0],l=b[1],i=this.mget("dimension"),u=this.mget("side"),c=this.mget("major_label_orientation"),n=t.isString(c)?f[u][c]:-c,h=this._tick_extent()+this.mget("major_label_standoff"),s=this.mget_obj("formatter").format(r[i]),this.major_label_props.set(e,this),this._apply_location_heuristics(e,u,c),x=[],o=m=0,w=p.length;w>=0?w>m:m>w;o=w>=0?++m:--m)n?(e.translate(p[o]+a*h,d[o]+l*h),e.rotate(n),e.fillText(s[o],0,0),e.rotate(-n),x.push(e.translate(-p[o]-a*h,-d[o]-l*h))):x.push(e.fillText(s[o],Math.round(p[o]+a*h),Math.round(d[o]+l*h)));return x},i.prototype._draw_axis_label=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d,_;return n=this.mget("axis_label"),null!=n?(p=this.mget("rule_coords"),u=p[0],h=p[1],d=this.plot_view.map_to_screen(u,"data",h,"data"),l=d[0],c=d[1],_=this.mget("normals"),r=_[0],i=_[1],s=this.mget("side"),o="parallel",e=f[s][o],a=this._tick_extent()+this._tick_label_extent()+this.mget("axis_label_standoff"),l=(l[0]+l[l.length-1])/2,c=(c[0]+c[c.length-1])/2,this.axis_label_props.set(t,this),this._apply_location_heuristics(t,s,o),e?(t.translate(l+r*a,c+i*a),t.rotate(e),t.fillText(n,0,0),t.rotate(-e),t.translate(-l-r*a,-c-i*a)):t.fillText(n,l+r*a,c+i*a)):void 0},i.prototype._apply_location_heuristics=function(e,n,r){var i,o;return t.isString(r)?(o=g[n][r],i=p[n][r]):0===r?(o=g[n][r],i=p[n][r]):0>r?(o="middle",i=d[n]):r>0&&(o="middle",i=_[n]),e.textBaseline=o,e.textAlign=i},i.prototype._tick_extent=function(){return this.mget("major_tick_out")},i.prototype._tick_label_extent=function(){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,g,m,v,y;if(o=0,i=this.mget("dimension"),r=this.mget("major_coords"),p=this.mget("side"),u=this.mget("major_label_orientation"),c=this.mget_obj("formatter").format(r[i]),this.major_label_props.set(this.plot_view.ctx,this),t.isString(u)?(s=1,e=f[p][u]):(s=2,e=-u),e=Math.abs(e),n=Math.cos(e),h=Math.sin(e),"top"===p||"bottom"===p)for(l=g=0,v=c.length;v>=0?v>g:g>v;l=v>=0?++g:--g)null!=c[l]&&(_=1.1*this.plot_view.ctx.measureText(c[l]).width,a=.9*this.plot_view.ctx.measureText(c[l]).ascent,d=_*h+a/s*n,d>o&&(o=d));else for(l=m=0,y=c.length;y>=0?y>m:m>y;l=y>=0?++m:--m)null!=c[l]&&(_=1.1*this.plot_view.ctx.measureText(c[l]).width,a=.9*this.plot_view.ctx.measureText(c[l]).ascent,d=_*n+a/s*h,d>o&&(o=d));return o>0&&(o+=this.mget("major_label_standoff")),o},i.prototype._axis_label_extent=function(){var t,e,n,r,i,o,s,a;return n=0,s=this.mget("side"),i="parallel",this.major_label_props.set(this.plot_view.ctx,this),t=Math.abs(f[s][i]),e=Math.cos(t),o=Math.sin(t),this.mget("axis_label")&&(n+=this.mget("axis_label_standoff"),this.axis_label_props.set(this.plot_view.ctx,this),a=1.1*this.plot_view.ctx.measureText(this.mget("axis_label")).width,r=.9*this.plot_view.ctx.measureText(this.mget("axis_label")).ascent,n+="top"===s||"bottom"===s?a*o+r*e:a*e+r*o),n},i.prototype._padding_request=function(){var e,n,r,i,o;return r={},i=this.mget("side"),e=null!=(o=this.mget("location"))?o:"min",t.isString(e)?(n=0,n+=this._tick_extent(),n+=this._tick_label_extent(),n+=this._axis_label_extent(),r[i]=n,r):r},i}(o),a=function(n){function r(){return y=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=l,r.prototype.type="Axis",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.register_property("computed_bounds",this._bounds,!1),this.add_dependencies("computed_bounds",this,["bounds"]),this.register_property("rule_coords",this._rule_coords,!1),this.add_dependencies("rule_coords",this,["computed_bounds","dimension","location"]),this.register_property("major_coords",this._major_coords,!1),this.add_dependencies("major_coords",this,["computed_bounds","dimension","location"]),this.register_property("normals",this._normals,!0),this.add_dependencies("normals",this,["computed_bounds","dimension","location"]),this.register_property("side",this._side,!1),this.add_dependencies("side",this,["normals"]),this.register_property("padding_request",this._padding_request,!1)},r.prototype.dinitialize=function(){return this.add_dependencies("computed_bounds",this.get_obj("plot"),["x_range","y_range"])},r.prototype._bounds=function(){var e,n,r,i,o,s,a,l;return n=this.get("dimension"),r=(n+1)%2,o=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],a=null!=(l=this.get("bounds"))?l:"auto",i=[o[n].get("min"),o[n].get("max")],t.isArray(a)?Math.abs(a[0]-a[1])>Math.abs(i[0]-i[1])?(s=Math.max(Math.min(a[0],a[1]),i[0]),e=Math.min(Math.max(a[0],a[1]),i[1])):(s=Math.min(a[0],a[1]),e=Math.max(a[0],a[1])):(s=i[0],e=i[1]),[s,e]},r.prototype._rule_coords=function(){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f;return s=this.get("dimension"),a=(s+1)%2,u=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],c=u[s],r=u[a],_=this.get("computed_bounds"),h=_[0],o=_[1],p=new Array(2),d=new Array(2),n=[p,d],i=r.get("start"),e=r.get("end"),l=null!=(f=this.get("location"))?f:"min",t.isString(l)&&("left"===l||"bottom"===l?l=e>i?"start":"end":("right"===l||"top"===l)&&(l=e>i?"end":"start"),l=r.get(l)),n[s][0]=Math.max(h,c.get("min")),n[s][1]=Math.min(o,c.get("max")),n[s][0]>n[s][1]&&(n[s][0]=n[s][1]=0/0),n[a][0]=l,n[a][1]=l,n},r.prototype._major_coords=function(){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j;if(s=this.get("dimension"),l=(s+1)%2,d=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],u=d[s],r=d[l],b=this.get("computed_bounds"),_=b[0],o=b[1],f=this.get_obj("ticker").get_ticks(_,o,u,{}),i=r.get("start"),e=r.get("end"),c=null!=(w=this.get("location"))?w:"min",t.isString(c)&&("left"===c||"bottom"===c?c=e>i?"start":"end":("right"===c||"top"===c)&&(c=e>i?"end":"start"),c=r.get(c)),g=[],m=[],n=[g,m],"FactorRange"===u.type)for(a=v=0,x=f.length;x>=0?x>v:v>x;a=x>=0?++v:--v)n[s].push(f[a]),n[l].push(c);else for(k=[u.get("min"),u.get("max")],p=k[0],h=k[1],a=y=0,j=f.length;j>=0?j>y:y>j;a=j>=0?++y:--y)f[a]h||(n[s].push(f[a]),n[l].push(c));return n},r.prototype._normals=function(){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f;return o=this.get("dimension"),a=(o+1)%2,p=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],h=p[o],n=p[a],_=this.get("computed_bounds"),d=_[0],i=_[1],r=n.get("start"),e=n.get("end"),c=null!=(f=this.get("location"))?f:"min",u=[0,0],t.isString(c)?(s=d>i?"flip":"norm",r>e?(l="flip","left"===c||"bottom"===c?c="max":("top"===c||"right"===c)&&(c="max")):(l="norm","left"===c||"bottom"===c?c="min":("top"===c||"right"===c)&&(c="max")),u[a]=m[o][s][l][c]):u[a]=0===o?Math.abs(c-r)<=Math.abs(c-e)?1:-1:Math.abs(c-r)<=Math.abs(c-e)?-1:1,u},r.prototype._side=function(){var t,e;return t=this.get("normals"),-1===t[1]?e="top":1===t[1]?e="bottom":-1===t[0]?e="left":1===t[0]&&(e="right"),e},r.prototype.display_defaults=function(){return{level:"overlay",axis_line_color:"black",axis_line_width:1,axis_line_alpha:1,axis_line_join:"miter",axis_line_cap:"butt",axis_line_dash:[],axis_line_dash_offset:0,major_tick_in:2,major_tick_out:6,major_tick_line_color:"black",major_tick_line_width:1,major_tick_line_alpha:1,major_tick_line_join:"miter",major_tick_line_cap:"butt",major_tick_line_dash:[],major_tick_line_dash_offset:0,major_label_standoff:5,major_label_orientation:"horizontal",major_label_text_font:"helvetica",major_label_text_font_size:"10pt",major_label_text_font_style:"normal",major_label_text_color:"#444444",major_label_text_alpha:1,major_label_text_align:"center",major_label_text_baseline:"alphabetic",axis_label:"",axis_label_standoff:5,axis_label_text_font:"helvetica",axis_label_text_font_size:"16pt",axis_label_text_font_style:"normal",axis_label_text_color:"#444444",axis_label_text_alpha:1,axis_label_text_align:"center",axis_label_text_baseline:"alphabetic"}},r}(i),{Model:a,View:l}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/categorical_ticker",["backbone","common/has_properties"],function(t,n){var r,i,o,s;return r=function(t){function n(){return o=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="CategoricalTicker",n.prototype.get_ticks=function(t,e,n,r){var i;return i=r.desired_n_ticks,n.get("factors")},n.prototype.defaults=function(){return n.__super__.defaults.call(this)},n}(n),i=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=r,n}(t.Collection),{Model:r,Collection:new i}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/categorical_tick_formatter",["backbone","common/has_properties"],function(t,n){var r,i,o,s;return r=function(t){function n(){return o=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="CategoricalTickFormatter",n.prototype.initialize=function(t,e){return n.__super__.initialize.call(this,t,e)},n.prototype.format=function(t){return t},n}(n),i=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=r,n.prototype.defaults=function(){return n.__super__.defaults.call(this)},n}(t.Collection),{Model:r,Collection:new i}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/guide/categorical_axis",["backbone","./axis","range/factor_range","ticking/categorical_ticker","ticking/categorical_tick_formatter"],function(t,n,r,i,o){var s,a,l,c,u,h;return l=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n}(n.View),a=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=l,n.prototype.type="CategoricalAxis",n.prototype.dinitialize=function(t,e){return n.__super__.dinitialize.call(this,t,e),null==this.get_obj("ticker")&&this.set_obj("ticker",i.Collection.create()),null==this.get_obj("formatter")?this.set_obj("formatter",o.Collection.create()):void 0},n.prototype._bounds=function(){var t,e,n,r,i;return t=this.get("dimension"),n=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],r=null!=(i=this.get("bounds"))?i:"auto","auto"!==r&&console.log("Categorical Axes only support user_bounds='auto', ignoring"),e=[n[t].get("min"),n[t].get("max")]},n}(n.Model),s=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(t.Collection),{Model:a,Collection:new s,View:l}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/abstract_ticker",["underscore","backbone","common/has_properties"],function(t,n,r){var i,o,s,a,l,c;return a=function(t){var e,n,r,i,o;return null===t?"null":null==t?"undefined":t.constructor===Array?(n=function(){var n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],i.push(a(e));return i}().join(", "),"["+n+"]"):t.constructor===Object?(o=function(){var e;e=[];for(r in t)e.push(""+r+": "+a(t[r]));return e}().join(", "),"{"+o+"}"):t.constructor===String?'"'+t+'"':t.constructor===Function?"":(i=t.toString(),"[object Object]"===i?"<"+t.constructor.name+">":i)},s=6,i=function(n){function r(){return l=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="AbstractTicker",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e)},r.prototype.get_ticks=function(t,e,n,r){var i;return i=r.desired_n_ticks,null==i&&(i=s),this.get_ticks_no_defaults(t,e,i)},r.prototype.get_ticks_no_defaults=function(e,n,r){var i,o,s,a,l,c;return a=this.get_interval(e,n,r),l=Math.floor(e/a),i=Math.ceil(n/a),s=t.isNaN(l)||t.isNaN(i)?[]:t.range(l,i+1),c=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o*a);return n}()},r.prototype.get_interval=void 0,r.prototype.get_min_interval=function(){return this.get("min_interval")},r.prototype.get_max_interval=function(){return this.get("max_interval")},r.prototype.toString=function(){var t,e,n,r;return t=typeof this,r=this.get("toString_properties"),n=function(){var t,n,i;for(i=[],t=0,n=r.length;n>t;t++)e=r[t],i.push(""+e+"="+a(this[e]));return i}.call(this).join(", "),""+t+"("+n+")"},r.prototype.get_ideal_interval=function(t,e,n){var r;return r=e-t,r/n},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{toString_properties:[]})},r}(r),o=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(n.Collection),{Model:i,Collection:new o}})}.call(this),function(){n("ticking/util",["underscore","backbone"],function(t){var e,n,r,i,o,s,a,l,c,u,h;return r=1,s=1e3,i=60*s,n=60*i,e=24*n,o=30*e,a=365*e,l=function(e){var n;return n=t.min(t.range(e.length),function(t){return e[t]})},c=function(t){return new Date(t.getTime())},u=function(t){return t=c(t),t.setUTCDate(1),t.setUTCHours(0),t.setUTCMinutes(0),t.setUTCSeconds(0),t.setUTCMilliseconds(0),t},h=function(t){return t=u(t),t.setUTCMonth(0),t},{argmin:l,copy_date:c,last_month_no_later_than:u,last_year_no_later_than:h,ONE_MILLI:r,ONE_SECOND:s,ONE_MINUTE:i,ONE_HOUR:n,ONE_DAY:e,ONE_MONTH:o,ONE_YEAR:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/adaptive_ticker",["underscore","backbone","ticking/abstract_ticker","ticking/util"],function(t,n,r,i){var o,s,a,l,c,u,h;return a=i.argmin,l=function(t,e,n){return Math.max(e,Math.min(n,t))},c=function(t,e){return null==e&&(e=Math.E),Math.log(t)/Math.log(e)},o=function(n){function r(){return u=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="AdaptiveTicker",r.prototype.initialize=function(e,n){var i,o;return r.__super__.initialize.call(this,e,n),i=t.last(this.get("mantissas"))/this.get("base"),o=t.first(this.get("mantissas"))*this.get("base"),this.extended_mantissas=t.flatten([i,this.get("mantissas"),o]),this.base_factor=0===this.get("min_interval")?1:this.get("min_interval")
},r.prototype.get_interval=function(t,e,n){var r,i,o,s,u,h,p,d,_;return o=e-t,u=this.get_ideal_interval(t,e,n),_=Math.floor(c(u/this.base_factor,this.get("base"))),h=Math.pow(this.get("base"),_)*this.base_factor,p=u/h,i=this.extended_mantissas,s=i.map(function(t){return Math.abs(n-o/(t*h))}),r=i[a(s)],d=r*h,l(d,this.get("min_interval"),this.get("max_interval"))},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{toString_properties:["mantissas","base","min_magnitude","max_magnitude"],base:10,min_interval:0,max_interval:1/0})},r}(r.Model),s=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/composite_ticker",["underscore","backbone","ticking/abstract_ticker","ticking/util"],function(t,n,r,i){var o,s,a,l,c;return a=i.argmin,o=function(n){function r(){return l=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="CompositeTicker",r.prototype.initialize=function(e,n){var i;return r.__super__.initialize.call(this,e,n),i=this.get("tickers"),this.register_property("min_intervals",function(){return t.invoke(i,"get_min_interval")},!0),this.add_dependencies("min_intervals",this,["tickers"]),this.register_property("max_intervals",function(){return t.invoke(i,"get_max_interval")},!0),this.add_dependencies("max_intervals",this,["tickers"]),this.register_property("min_interval",function(){return t.first(this.get("min_intervals"))},!0),this.add_dependencies("min_interval",this,["min_intervals"]),this.register_property("max_interval",function(){return t.first(this.get("max_intervals"))},!0),this.add_dependencies("max_interval",this,["max_interval"])},r.prototype.get_best_ticker=function(e,n,r){var i,o,s,l,c,u,h,p;return l=n-e,u=this.get_ideal_interval(e,n,r),p=[t.sortedIndex(this.get("min_intervals"),u)-1,t.sortedIndex(this.get("max_intervals"),u)],h=[this.get("min_intervals")[p[0]],this.get("max_intervals")[p[1]]],c=h.map(function(t){return Math.abs(r-l/t)}),i=a(c),1/0===i?this.get("tickers")[0]:(s=p[i],o=this.get("tickers")[s])},r.prototype.get_interval=function(t,e,n){var r;return r=this.get_best_ticker(t,e,n),r.get_interval(t,e,n)},r.prototype.get_ticks_no_defaults=function(t,e,n){var r,i;return r=this.get_best_ticker(t,e,n),i=r.get_ticks_no_defaults(t,e,n)},r.prototype.defaults=function(){return r.__super__.defaults.call(this)},r}(r.Model),s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/single_interval_ticker",["underscore","backbone","ticking/abstract_ticker"],function(t,n,r){var i,o,s,a;return i=function(n){function r(){return s=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="SingleIntervalTicker",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.register_property("min_interval",function(){return this.get("interval")},!0),this.add_dependencies("min_interval",this,["interval"]),this.register_property("max_interval",function(){return this.get("interval")},!0),this.add_dependencies("max_interval",this,["interval"])},r.prototype.get_interval=function(){return this.get("interval")},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{toString_properties:["interval"]})},r}(r.Model),o=function(t){function n(){return a=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(n.Collection),{Model:i,Collection:new o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/days_ticker",["underscore","backbone","ticking/single_interval_ticker","ticking/util"],function(t,n,r,i){var o,s,a,l,c,u,h,p;return l=i.copy_date,u=i.last_month_no_later_than,a=i.ONE_DAY,c=function(t,e){var n,r,i,o,s;for(s=u(new Date(t)),i=u(new Date(e)),o=l(i),i.setUTCMonth(i.getUTCMonth()+1),r=[],n=s;;)if(r.push(l(n)),n.setUTCMonth(n.getUTCMonth()+1),n>i)break;return r},o=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="DaysTicker",r.prototype.initialize=function(t,e){var n,i;return r.__super__.initialize.call(this,t,e),n=this.get("days"),i=n.length>1?(n[1]-n[0])*a:31*a,this.set("interval",i)},r.prototype.get_ticks_no_defaults=function(e,n){var r,i,o,s,a,u,h,p;return h=c(e,n),s=this.get("days"),a=function(t,e){var n,r,i,o,a,c;for(n=[],a=0,c=s.length;c>a;a++)r=s[a],i=l(t),i.setUTCDate(r),o=new Date(i.getTime()+e/2),o.getUTCMonth()===t.getUTCMonth()&&n.push(i);return n},u=this.get("interval"),o=t.flatten(function(){var t,e,n;for(n=[],t=0,e=h.length;e>t;t++)i=h[t],n.push(a(i,u));return n}()),r=t.invoke(o,"getTime"),p=t.filter(r,function(t){return t>=e&&n>=t})},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{toString_properties:["days"]})},r}(r.Model),s=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/months_ticker",["underscore","backbone","ticking/single_interval_ticker","ticking/util"],function(t,n,r,i){var o,s,a,l,c,u,h,p;return l=i.copy_date,u=i.last_year_no_later_than,a=i.ONE_MONTH,c=function(t,e){var n,r,i,o;for(o=u(new Date(t)),i=u(new Date(e)),i.setUTCFullYear(i.getUTCFullYear()+1),r=[],n=o;;)if(r.push(l(n)),n.setUTCFullYear(n.getUTCFullYear()+1),n>i)break;return r},o=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="MonthsTicker",r.prototype.initialize=function(t,e){var n,i;return r.__super__.initialize.call(this,t,e),i=this.get("months"),n=i.length>1?(i[1]-i[0])*a:12*a,this.set("interval",n)},r.prototype.get_ticks_no_defaults=function(e,n){var r,i,o,s,a,u,h;return h=c(e,n),s=this.get("months"),a=function(t){return s.map(function(e){var n;return n=l(t),n.setUTCMonth(e),n})},o=t.flatten(function(){var t,e,n;for(n=[],t=0,e=h.length;e>t;t++)i=h[t],n.push(a(i));return n}()),r=t.invoke(o,"getTime"),u=t.filter(r,function(t){return t>=e&&n>=t})},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{toString_properties:["months"]})},r}(r.Model),s=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/basic_ticker",["ticking/adaptive_ticker"],function(t){var n,r,i,o;return n=function(t){function n(){return i=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="BasicTicker",n.prototype.initialize=function(t,e){return n.__super__.initialize.call(this,t,e)},n.prototype.defaults=function(){return _.extend(n.__super__.defaults.call(this),{mantissas:[1,2,5]})},n}(t.Model),r=function(t){function r(){return o=r.__super__.constructor.apply(this,arguments)}return e(r,t),r.prototype.model=n,r}(Backbone.Collection),{Model:n,Collection:new r}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/years_ticker",["underscore","backbone","ticking/basic_ticker","ticking/single_interval_ticker","ticking/util"],function(t,n,r,i,o){var s,a,l,c,u,h;return c=o.last_year_no_later_than,s=o.ONE_YEAR,a=function(n){function i(){return u=i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.type="YearsTicker",i.prototype.initialize=function(t,e){return i.__super__.initialize.call(this,t,e),this.set("interval",s),this.basic_ticker=new r.Model},i.prototype.get_ticks_no_defaults=function(e,n,r){var i,o,s,a,l,u;return s=c(new Date(e)).getUTCFullYear(),o=c(new Date(n)).getUTCFullYear(),u=this.basic_ticker.get_ticks_no_defaults(s,o,r),i=function(){var t,e,n;for(n=[],t=0,e=u.length;e>t;t++)l=u[t],n.push(Date.UTC(l,0,1));return n}(),a=t.filter(i,function(t){return t>=e&&n>=t})},i.prototype.defaults=function(){return t.extend(i.__super__.defaults.call(this),{toString_properties:["years"]})},i}(i.Model),l=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(n.Collection),{Model:a,Collection:new l}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/datetime_ticker",["underscore","ticking/adaptive_ticker","ticking/composite_ticker","ticking/days_ticker","ticking/months_ticker","ticking/years_ticker","ticking/util"],function(t,n,r,i,o,s,a){var l,c,u,h,p,d,_,f,g;return h=a.ONE_MILLI,_=a.ONE_SECOND,p=a.ONE_MINUTE,u=a.ONE_HOUR,d=a.ONE_MONTH,l=function(r){function a(){return f=a.__super__.constructor.apply(this,arguments)}return e(a,r),a.prototype.type="DatetimeTicker",a.prototype.defaults=function(){return t.extend(a.__super__.defaults.call(this),{tickers:[new n.Model({mantissas:[1,2,5],base:10,min_interval:0,max_interval:500*h}),new n.Model({mantissas:[1,2,5,10,15,20,30],base:60,min_interval:_,max_interval:30*p}),new n.Model({mantissas:[1,2,4,6,8,12],base:24,min_interval:u,max_interval:12*u}),new i.Model({days:t.range(1,32)}),new i.Model({days:t.range(1,31,3)}),new i.Model({days:[1,8,15,22]}),new i.Model({days:[1,15]}),new o.Model({months:t.range(0,12,1)}),new o.Model({months:t.range(0,12,2)}),new o.Model({months:t.range(0,12,4)}),new o.Model({months:t.range(0,12,6)}),new s.Model({})]})},a}(r.Model),c=function(t){function n(){return g=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=l,n}(Backbone.Collection),{Model:l,Collection:new c}})}.call(this),function(t){function e(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function n(t,e){for(var n=[];e>0;n[--e]=t);return n.join("")}var r=function(){return r.cache.hasOwnProperty(arguments[0])||(r.cache[arguments[0]]=r.parse(arguments[0])),r.format.call(null,r.cache[arguments[0]],arguments)};r.format=function(t,i){var o,s,a,l,c,u,h,p=1,d=t.length,_="",f=[];for(s=0;d>s;s++)if(_=e(t[s]),"string"===_)f.push(t[s]);else if("array"===_){if(l=t[s],l[2])for(o=i[p],a=0;a>>=0;break;case"x":o=o.toString(16);break;case"X":o=o.toString(16).toUpperCase()}o=/[def]/.test(l[8])&&l[3]&&o>=0?"+"+o:o,u=l[4]?"0"==l[4]?"0":l[4].charAt(1):" ",h=l[6]-String(o).length,c=l[6]?n(u,h):"",f.push(l[5]?o+c:c+o)}return f.join("")},r.cache={},r.parse=function(t){for(var e=t,n=[],r=[],i=0;e;){if(null!==(n=/^[^\x25]+/.exec(e)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(e)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(e)))throw"[sprintf] huh?";if(n[2]){i|=1;var o=[],s=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw"[sprintf] huh?";for(o.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))o.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw"[sprintf] huh?";o.push(a[1])}n[2]=o}else i|=2;if(3===i)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}e=e.substring(n[0].length)}return r};var i=function(t,e,n){return n=e.slice(0),n.splice(0,0,t),r.apply(null,n)};t.sprintf=r,t.vsprintf=i}("undefined"!=typeof exports?exports:window),n("sprintf",function(t){return function(){var e;return e||t.sprintf}}(this)),!function(t){"object"==typeof module&&module.exports?module.exports=t():"function"==typeof n?n("timezone",t):this.tz=t()}(function(){function t(t,e,n){var r,i=e.day[1];do r=new Date(Date.UTC(n,e.month,Math.abs(i++)));while(e.day[0]<7&&r.getUTCDay()!=e.day[0]);return r={clock:e.clock,sort:r.getTime(),rule:e,save:6e4*e.save,offset:t.offset},r[r.clock]=r.sort+6e4*e.time,r.posix?r.wallclock=r[r.clock]+(t.offset+e.saved):r.posix=r[r.clock]-(t.offset+e.saved),r}function e(e,n,r){var i,o,s,a,l,c,u,h=e[e.zone],p=[],d=new Date(r).getUTCFullYear(),_=1;for(i=1,o=h.length;o>i&&!(h[i][n]<=r);i++);if(s=h[i],s.rules){for(c=e[s.rules],u=d+1;u>=d-_;--u)for(i=0,o=c.length;o>i;i++)c[i].from<=u&&u<=c[i].to?p.push(t(s,c[i],u)):c[i].toi;i++)r>=p[i][n]&&p[i][p[i].clock]>s[p[i].clock]&&(a=p[i])}return a&&(a.abbrev=(l=/^(.*)\/(.*)$/.exec(s.format))?l[a.save?2:1]:s.format.replace(/%s/,a.rule.letter)),a||s}function n(t,n){return"UTC"==t.zone?n:(t.entry=e(t,"posix",n),n+t.entry.offset+t.entry.save)}function r(t,n){if("UTC"==t.zone)return n;var r,i;return t.entry=r=e(t,"wallclock",n),i=n-r.wallclock,i>0&&i9)e+=a*h[l-10];else{if(o=new Date(n(t,e)),7>l)for(;a;)o.setUTCDate(o.getUTCDate()+s),o.getUTCDay()==l&&(a-=s);else 7==l?o.setUTCFullYear(o.getUTCFullYear()+a):8==l?o.setUTCMonth(o.getUTCMonth()+a):o.setUTCDate(o.getUTCDate()+a);null==(e=r(t,o.getTime()))&&(e=r(t,o.getTime()+864e5*s)-864e5*s)}return e}function o(t){if(!t.length)return"0.0.23";var e,o,s,a,l,c=Object.create(this),h=[];for(e=0;ee;e++)l[e]=+(l[e]||0);--l[1],l=Date.UTC.apply(Date.UTC,l.slice(0,8))+-l[7]*(36e5*l[8]+6e4*l[9]+1e3*l[10])}else l=Math.floor(l);if(!isNaN(l)){if(o&&(l=r(c,l)),null==l)return l;for(e=0,o=h.length;o>e;e++)l=i(c,l,h[e]);return c.format?(s=new Date(n(c,l)),c.format.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g,function(t,e,n,r,i){var o,a,u="0";if(o=c[i]){for(t=String(o.call(c,s,l,e,n.length)),"_"==(e||o.style)&&(u=" "),a="-"==e?0:o.pad||0;t.length=i?Math.floor((n-i)/7)+1:0}function a(t){var e,n,r;return n=t.getUTCFullYear(),e=new Date(Date.UTC(n,0)).getUTCDay(),r=s(t,1)+(e>1&&4>=e?1:0),r?53!=r||4==e||3==e&&29==new Date(n,1,29).getDate()?[r,t.getUTCFullYear()]:[1,t.getUTCFullYear()+1]:(n=t.getUTCFullYear()-1,e=new Date(Date.UTC(n,0)).getUTCDay(),r=4==e||3==e&&29==new Date(n,1,29).getDate()?53:52,[r,t.getUTCFullYear()-1])}var l={clock:function(){return+new Date},zone:"UTC",entry:{abbrev:"UTC",offset:0,save:0},UTC:1,z:function(t,e,n,r){var i,o,s=this.entry.offset+this.entry.save,a=Math.abs(s/1e3),l=[],c=3600;for(i=0;3>i;i++)l.push(("0"+Math.floor(a/c)).slice(-2)),a%=c,c/=60;return"^"!=n||s?("^"==n&&(r=3),3==r?(o=l.join(":"),o=o.replace(/:00$/,""),"^"!=n&&(o=o.replace(/:00$/,""))):r?(o=l.slice(0,r+1).join(":"),"^"==n&&(o=o.replace(/:00$/,""))):o=l.slice(0,2).join(""),o=(0>s?"-":"+")+o,o=o.replace(/([-+])(0)/,{_:" $1","-":"$1"}[n]||"$1$2")):"Z"},"%":function(){return"%"},n:function(){return"\n"},t:function(){return" "},U:function(t){return s(t,0)},W:function(t){return s(t,1)},V:function(t){return a(t)[0]},G:function(t){return a(t)[1]},g:function(t){return a(t)[1]%100},j:function(t){return Math.floor((t.getTime()-Date.UTC(t.getUTCFullYear(),0))/864e5)+1},s:function(t){return Math.floor(t.getTime()/1e3)},C:function(t){return Math.floor(t.getUTCFullYear()/100)},N:function(t){return 1e6*(t.getTime()%1e3)},m:function(t){return t.getUTCMonth()+1},Y:function(t){return t.getUTCFullYear()},y:function(t){return t.getUTCFullYear()%100},H:function(t){return t.getUTCHours()},M:function(t){return t.getUTCMinutes()},S:function(t){return t.getUTCSeconds()},e:function(t){return t.getUTCDate()},d:function(t){return t.getUTCDate()},u:function(t){return t.getUTCDay()||7},w:function(t){return t.getUTCDay()},l:function(t){return t.getUTCHours()%12||12},I:function(t){return t.getUTCHours()%12||12},k:function(t){return t.getUTCHours()},Z:function(){return this.entry.abbrev},a:function(t){return this[this.locale].day.abbrev[t.getUTCDay()]},A:function(t){return this[this.locale].day.full[t.getUTCDay()]},h:function(t){return this[this.locale].month.abbrev[t.getUTCMonth()]},b:function(t){return this[this.locale].month.abbrev[t.getUTCMonth()]},B:function(t){return this[this.locale].month.full[t.getUTCMonth()]},P:function(t){return this[this.locale].meridiem[Math.floor(t.getUTCHours()/12)].toLowerCase()},p:function(t){return this[this.locale].meridiem[Math.floor(t.getUTCHours()/12)]},R:function(t,e){return this.convert([e,"%H:%M"])},T:function(t,e){return this.convert([e,"%H:%M:%S"])},D:function(t,e){return this.convert([e,"%m/%d/%y"])},F:function(t,e){return this.convert([e,"%Y-%m-%d"])},x:function(t,e){return this.convert([e,this[this.locale].date])},r:function(t,e){return this.convert([e,this[this.locale].time12||"%I:%M:%S"])},X:function(t,e){return this.convert([e,this[this.locale].time24])},c:function(t,e){return this.convert([e,this[this.locale].dateTime])},convert:o,locale:"en_US",en_US:{date:"%m/%d/%Y",time24:"%I:%M:%S %p",time12:"%I:%M:%S %p",dateTime:"%a %d %b %Y %I:%M:%S %p %Z",meridiem:["AM","PM"],month:{abbrev:"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec".split("|"),full:"January|February|March|April|May|June|July|August|September|October|November|December".split("|")},day:{abbrev:"Sun|Mon|Tue|Wed|Thu|Fri|Sat".split("|"),full:"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday".split("|")}}},c="Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond",u=new RegExp("^\\s*([+-])(\\d+)\\s+("+c+")s?\\s*$","i"),h=[36e5,6e4,1e3,1];return c=c.toLowerCase().split("|"),"delmHMSUWVgCIky".replace(/./g,function(t){l[t].pad=2}),l.N.pad=9,l.j.pad=3,l.k.style="_",l.l.style="_",l.e.style="_",function(){return l.convert(arguments)}}),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/datetime_tick_formatter",["underscore","backbone","common/has_properties","sprintf","timezone"],function(t,n,r,i,o){var s,a,l,c,u,h,p,d,_,f;return f=function(t){return i("%3dus",Math.floor(1e3*(t%1)))},u=function(t){var e,n;return e=Math.floor(1e3*(t/1e3%1)),n=Math.floor(1e3*(t%1)),i("%3d.%3dms",e,n)},_=function(t){var e,n;return e=new Date(t),n=e.getFullYear(),e.getMonth()>=7&&(n+=1),i("'%02d",n%100)},c=function(t){var e,n;return e=new Date(t),n=e.getFullYear(),e.getMonth()>=7&&(n+=1),i("%d",n)},l=function(t){return o(t,"%Y %m %d %H %M %S").split(/\s+/).map(function(t){return parseInt(t,10)})},d=function(e,n){return t.isFunction(n)?n(e):o(e,n)},s=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="DatetimeTickFormatter",r.prototype.format_order=["microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"],r.prototype.strip_leading_zeros=!0,r.prototype.initialize=function(t,e){var n,i,s,a,l,h,p,g;r.__super__.initialize.call(this,t,e),this._formats={microseconds:[f,u],milliseconds:["%3Nms","%S.%3Ns"],seconds:["%Ss"],minsec:[":%M:%S"],minutes:[":%M","%Mm"],hourmin:["%H:%M"],hours:["%Hh","%H:%M"],days:["%m/%d","%a%d"],months:["%m/%Y","%b%y"],years:["%Y",_,c]},this.formats={};for(i in this._formats){for(s=this._formats[i],l=[],h=o(new Date),p=0,g=s.length;g>p;p++)n=s[p],a=d(h,n).length,l.push(a);this.formats[i]=[l,s]}},r.prototype._get_resolution_str=function(t,e){var n,r;return n=1.1*t,r=.001>n?"microseconds":1>n?"milliseconds":60>n?e>=60?"minsec":"seconds":3600>n?e>=3600?"hourmin":"minutes":86400>n?"hours":2678400>n?"days":31536e3>n?"months":"years"},r.prototype.format=function(e,n,r,i,o){var s,a,c,u,h,p,_,f,g,m,v,y,b,w,x,k,j,C,T,M,N,S,A,E,O,P,z,D;if(null==n&&(n=null),null==r&&(r=null),null==i&&(i=.3),null==o&&(o=null),0===e.length)return[];if(x=Math.abs(e[e.length-1]-e[0])/1e3,v=o?o.resolution:x/(e.length-1),y=this._get_resolution_str(v,x),P=this.formats[y],M=P[0],u=P[1],c=u[0],r){for(h=[],_=N=0,z=M.length;z>=0?z>N:N>z;_=z>=0?++N:--N)M[_]*e.length0&&(c=t.last(h))}for(f=[],b=this.format_order.indexOf(y),C={},D=this.format_order,S=0,E=D.length;E>S;S++)a=D[S],C[a]=0;for(C.seconds=5,C.minsec=4,C.minutes=4,C.hourmin=3,C.hours=3,A=0,O=e.length;O>A;A++){j=e[A];try{T=l(j),w=d(j,c)}catch(F){s=F,console.log(s),console.log("Unable to convert tick for timestamp "+j),f.push("ERR");continue}for(p=!1,m=b;0===T[C[this.format_order[m]]]&&(m+=1,m!==this.format_order.length);){if(("minsec"===y||"hourmin"===y)&&!p){if("minsec"===y&&0===T[4]&&0!==T[5]||"hourmin"===y&&0===T[3]&&0!==T[4]){g=this.formats[this.format_order[b-1]][1][0],w=d(j,g);break}p=!0}g=this.formats[this.format_order[m]][1][0],w=d(j,g)}this.strip_leading_zeros?(k=w.replace(/^0+/g,""),k===w||""!==k&&isFinite(k[0])||(k="0"+k),f.push(k)):f.push(w)}return f},r.prototype.defaults=function(){return r.__super__.defaults.call(this)},r}(r),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n}(n.Collection),{Model:s,Collection:new a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/guide/datetime_axis",["backbone","./axis","ticking/datetime_ticker","ticking/datetime_tick_formatter"],function(t,n,r,i){var o,s,a,l,c,u;return a=function(t){function n(){return l=n.__super__.constructor.apply(this,arguments)}return e(n,t),n}(n.View),s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=a,n.prototype.type="DatetimeAxis",n.prototype.dinitialize=function(t,e){return n.__super__.dinitialize.call(this,t,e),null==this.get_obj("ticker")&&this.set_obj("ticker",r.Collection.create()),null==this.get_obj("formatter")?this.set_obj("formatter",i.Collection.create()):void 0},n}(n.Model),o=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n}(t.Collection),{Model:s,Collection:new o,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/guide/grid",["underscore","common/safebind","common/has_parent","renderer/properties","common/plot_widget"],function(t,n,r,i,o){var s,a,l,c,u,h,p;return c=i.line_properties,a=function(t){function r(){return u=r.__super__.constructor.apply(this,arguments)}return e(r,t),r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.grid_props=new c(this,null,"grid_")},r.prototype.render=function(){var t;return t=this.plot_view.ctx,t.save(),this._draw_grids(t),t.restore()},r.prototype.bind_bokeh_events=function(){return n(this,this.model,"change",this.request_render)},r.prototype._draw_grids=function(t){var e,n,r,i,o,s,a,l,c,u,h;if(this.grid_props.do_stroke)for(l=this.mget("grid_coords"),i=l[0],o=l[1],this.grid_props.set(t,this),e=s=0,c=i.length;c>=0?c>s:s>c;e=c>=0?++s:--s){for(u=this.plot_view.map_to_screen(i[e],"data",o[e],"data"),n=u[0],r=u[1],t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(r[0])),e=a=1,h=n.length;h>=1?h>a:a>h;e=h>=1?++a:--a)t.lineTo(Math.round(n[e]),Math.round(r[e]));t.stroke()}},r}(o),s=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=a,r.prototype.type="Grid",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.register_property("computed_bounds",this._bounds,!1),this.add_dependencies("computed_bounds",this,["bounds"]),this.register_property("grid_coords",this._grid_coords,!1),this.add_dependencies("grid_coords",this,["computed_bounds","dimension","ticker"])},r.prototype._bounds=function(){var e,n,r,i,o,s,a,l;return n=this.get("dimension"),r=(n+1)%2,o=[this.get_obj("plot").get_obj("x_range"),this.get_obj("plot").get_obj("y_range")],a=null!=(l=this.get("bounds"))?l:"auto",i=[o[n].get("min"),o[n].get("max")],t.isArray(a)?(s=Math.min(a[0],a[1]),e=Math.max(a[0],a[1]),si[1]&&(s=null),e>i[1]?e=i[1]:e=0?k>b:b>k;c=k>=0?++b:--b)if(v[c]!==d&&v[c]!==p){for(o=[],s=[],t=2,_=w=0;t>=0?t>w:w>t;_=t>=0?++w:--w)h=n+(e-n)/(t-1)*_,o.push(v[c]),s.push(h);r[l].push(o),r[u].push(s)}return r},r.prototype.display_defaults=function(){return{level:"underlay",grid_line_color:"#cccccc",grid_line_width:1,grid_line_alpha:1,grid_line_join:"miter",grid_line_cap:"butt",grid_line_dash:[],grid_line_dash_offset:0}},r}(r),l=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n}(Backbone.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("ticking/basic_tick_formatter",["underscore","backbone","common/has_properties"],function(t,n,r){var i,o,s,a;return i=function(n){function r(){return s=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="BasicTickFormatter",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.register_property("scientific_limit_low",function(){return Math.pow(10,this.get("power_limit_low"))},!0),this.add_dependencies("scientific_limit_low",this,["power_limit_low"]),this.register_property("scientific_limit_high",function(){return Math.pow(10,this.get("power_limit_high"))},!0),this.add_dependencies("scientific_limit_high",this,["power_limit_high"]),this.last_precision=3},r.prototype.format=function(e){var n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x;if(0===e.length)return[];if(u=0,e.length>=2&&(u=Math.abs(e[1]-e[0])/1e4),o=!1,this.get("use_scientific"))for(h=0,f=e.length;f>h;h++)if(a=e[h],l=Math.abs(a),l>u&&(l>=this.scientific_limit_high||l<=this.scientific_limit_low)){o=!0;break}if(s=this.get("precision"),t.isNumber(s)){if(i=new Array(e.length),o)for(n=p=0,v=e.length;v>=0?v>p:p>v;n=v>=0?++p:--p)i[n]=e[n].toExponential(s);else for(n=d=0,y=e.length;y>=0?y>d:d>y;n=y>=0?++d:--d)i[n]=e[n].toPrecision(s).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,"");return i}if("auto"===s)for(i=new Array(e.length),c=_=b=this.last_precision;15>=b?15>=_:_>=15;c=15>=b?++_:--_){if(r=!0,o){for(n=g=0,w=e.length;w>=0?w>g:g>w;n=w>=0?++g:--g)if(i[n]=e[n].toExponential(c),n>0&&i[n]===i[n-1]){r=!1;break}if(r)break}else{for(n=m=0,x=e.length;x>=0?x>m:m>x;n=x>=0?++m:--m)if(i[n]=e[n].toPrecision(c).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,""),n>0&&i[n]===i[n-1]){r=!1;break}if(r)break}if(r)return this.last_precision=c,i}return i},r.prototype.defaults=function(){return{precision:"auto",use_scientific:!0,power_limit_high:5,power_limit_low:-3}},r}(r),o=function(t){function n(){return a=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(n.Collection),{Model:i,Collection:new o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/guide/linear_axis",["underscore","backbone","./axis","ticking/basic_ticker","ticking/basic_tick_formatter"],function(t,n,r,i,o){var s,a,l,c,u,h;return l=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n}(r.View),a=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=l,n.prototype.type="LinearAxis",n.prototype.dinitialize=function(t,e){return n.__super__.dinitialize.call(this,t,e),null==this.get_obj("ticker")&&this.set_obj("ticker",i.Collection.create()),null==this.get_obj("formatter")?this.set_obj("formatter",o.Collection.create()):void 0},n}(r.Model),s=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(n.Collection),{Model:a,Collection:new s,View:l}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("renderer/overlay/box_selection",["underscore","common/has_parent","common/plot_widget"],function(t,n,r){var i,o,s,a,l,c;return o=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.initialize=function(t){return this.selecting=!1,this.xrange=[null,null],this.yrange=[null,null],r.__super__.initialize.call(this,t),this.plot_view.$el.find(".bokeh_canvas_wrapper").append(this.$el)},r.prototype.boxselect=function(t,e){return this.xrange=t,this.yrange=e,this.request_render()},r.prototype.startselect=function(){return this.selecting=!0,this.xrange=[null,null],this.yrange=[null,null],this.request_render()},r.prototype.stopselect=function(){return this.selecting=!1,this.xrange=[null,null],this.yrange=[null,null],this.request_render()},r.prototype.bind_bokeh_events=function(){return this.toolview=this.plot_view.tools[this.mget("tool").id],this.listenTo(this.toolview,"boxselect",this.boxselect),this.listenTo(this.toolview,"startselect",this.startselect),this.listenTo(this.toolview,"stopselect",this.stopselect)
},r.prototype.render=function(){var e,n,r,i,o,s,a;return this.selecting?(o=this.xrange,a=this.yrange,t.any(t.map(o,t.isNullOrUndefined))||t.any(t.map(a,t.isNullOrUndefined))?(this.$el.removeClass("shading"),void 0):(n="",o?(i=this.plot_view.view_state.vx_to_sx(Math.min(o[0],o[1])),r=Math.abs(o[1]-o[0])):(i=0,r=this.plot_view.view_state.get("width")),n+="; left:"+i+"px; width:"+r+"px; ",a?(s=this.plot_view.view_state.vy_to_sy(Math.max(a[0],a[1])),e=Math.abs(a[1]-a[0])):(s=0,e=this.plot_view.view_state.get("height")),this.$el.addClass("shading"),n+="top:"+s+"px; height:"+e+"px",this.$el.attr("style",n))):(this.$el.removeClass("shading"),void 0)},r}(r),i=function(t){function n(){return l=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=o,n.prototype.type="BoxSelection",n.prototype.defaults=function(){return{tool:null,level:"overlay"}},n}(n),s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(Backbone.Collection),{Model:i,Collection:new s,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("source/column_data_source",["underscore","backbone","common/has_properties"],function(t,n,r){var i,o,s,a;return i=function(n){function r(){return s=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.type="ColumnDataSource",r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e),this.cont_ranges={},this.discrete_ranges={}},r.prototype.getcolumn=function(t){var e;return null!=(e=this.get("data")[t])?e:null},r.prototype.getcolumn_with_default=function(t){" returns the column, with any undefineds replaced with default";var e;return null!=(e=this.get("data")[t])?e:null},r.prototype.get_length=function(){var e;return e=this.get("data"),e[t.keys(e)[0]].length},r.prototype.columns=function(){return t.keys(this.get("data"))},r.prototype.datapoints=function(){var e,n,r,i,o,s,a,l,c,u;for(e=this.get("data"),r=t.keys(e),s=[],i=a=0,u=e[r[0]].length;u>=0?u>a:a>u;i=u>=0?++a:--a){for(o={},l=0,c=r.length;c>l;l++)n=r[l],o[n]=e[n][i];s.push(o)}return s},r.prototype.defaults=function(){return r.__super__.defaults.call(this)},r}(r),o=function(t){function n(){return a=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(n.Collection),{Model:i,Collection:new o}})}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e={}.hasOwnProperty,r=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};n("source/server_data_source",["underscore","backbone","common/has_properties"],function(e,n,i){var o,s,a,l,c;return a=function(t){var e,n,r,i;return e=!1,i=null,r=!1,n=function(){return e?r?console.log("already bound, ignoreing"):(console.log("busy, so doing it later"),r=!0,i.done(function(){return r=!1,n()})):(console.log("executing"),e=!0,i=t(),i.done(function(){return console.log("done, setting to false"),e=!1,i=null}))}},o=function(n){function i(){return this.heatmap_update=t(this.heatmap_update,this),this.line1d_update=t(this.line1d_update,this),this.initialize=t(this.initialize,this),l=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.type="ServerDataSource",i.prototype.initialize=function(t,e){return i.__super__.initialize.call(this,t,e),this.callbacks={}},i.prototype.stoplistening_for_updates=function(t){var e,n,r,i,o;if(this.callbacks[t.get("id")]){for(i=this.callbacks[t.get("id")],o=[],n=0,r=i.length;r>n;n++)e=i[n],o.push(this.stopListening.apply(this,e));return o}},i.prototype.listen_for_line1d_updates=function(t,n,r,i,o,s){var a,l;return this.stoplistening_for_updates(t),this.line1d_update(t,n,r,i,o,s),l=e.throttle(this.line1d_update,300),a=function(){return l(t,n,r,i,o,s)},this.listenTo(r,"change",a),this.listenTo(n,"change",a),this.callbacks[t.get("id")]=[[r,"change",a],[n,"change",a]]},i.prototype.line1d_update=function(t,n,r,i,o,s){var a,l,c,u,h,p,d;return a=this.get("data_url"),u=this.get("owner_username"),p=this.get_base().Config.prefix,d=""+p+"/bokeh/data/"+u+a,c=(r.get("end")-r.get("start"))/2,c=Math.floor(c),l=[n.get("start"),n.get("end")],e.any(e.map(l,function(t){return e.isNaN(t)}))&&(l="auto"),h=[i,o,s,l,c],h=JSON.stringify(h),$.ajax({dataType:"json",url:d,xhrField:{withCredentials:!0},success:function(e){return"auto"===l&&n.set({start:e.domain_limit[0],end:e.domain_limit[1]},{silent:!0}),t.set("data",e.data)},data:{downsample_function:"line1d",downsample_parameters:h}})},i.prototype.listen_for_heatmap_updates=function(t,e,n,r,i){var o,s,l,c,u,h=this;for(this.stoplistening_for_updates(t),o=a(function(){return h.heatmap_update(t,e,n,r,i)}),o(),this.callbacks[t.get("id")]=[],u=[e,n,r,i],l=0,c=u.length;c>l;l++)s=u[l],this.listenTo(s,"change",o),this.callbacks[t.get("id")].push([s,"change",o]);return this.listenTo(this,"change:index_slice",o),this.callbacks[t.get("id")].push([this,"change:index_slice",o]),this.listenTo(this,"change:data_slice",o),this.callbacks[t.get("id")].push([this,"change:data_slice",o]),null},i.prototype.heatmap_update=function(t,n,r,i,o){var s,a,l,c,u,h,p,d,_,f,g,m,v,y,b;return a=this.get("data_url"),d=this.get("owner_username"),f=this.get_base().Config.prefix,g=""+f+"/bokeh/data/"+d+a,v=i.get("end")-i.get("start"),b=o.get("end")-o.get("start"),m=[n.get("start"),n.get("end")],y=[r.get("start"),r.get("end")],u=this.get("data").global_x_range,h=this.get("data").global_y_range,l=this.get("data").global_offset_x[0],c=this.get("data").global_offset_y[0],p=this.get("index_slice"),s=this.get("data_slice"),_=[u,h,l,c,m,y,v,b,p,s,this.get("transpose")],_=JSON.stringify(_),$.ajax({dataType:"json",url:g,xhrField:{withCredentials:!0},success:function(n){var r;return r=e.clone(t.get("data")),e.extend(r,n),t.set("data",r)},data:{downsample_function:"heatmap",downsample_parameters:_}})},i}(i),s=function(t){function e(){return c=e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.model=o,e}(n.Collection),{Model:o,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/tool",["underscore","common/plot_widget","common/has_parent"],function(t,n,r){var i,o,s,a;return o=function(n){function r(){return s=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t)},r.prototype.bind_bokeh_events=function(){var e,n,r,i,o=this;return e=this.plot_view.eventSink,r={eventBasename:this.cid},i=t.extend(r,this.evgen_options),n=new this.eventGeneratorClass(i),n.bind_bokeh_events(this.plot_view,e),t.each(this.tool_events,function(t,n){var r,i;return r=""+o.cid+":"+n,i=function(e){return o[t](e)},e.on(r,i)}),this.evgen=n,{render:function(){}}},r}(n),i=function(t){function n(){return a=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.display_defaults=function(){return{level:"tool"}},n}(r),{Model:i,View:o}})}.call(this),function(){n("tool/event_generators",[],function(){var t,e,n,r;return r=function(t){var e,n,r;return n=$(t.currentTarget).offset(),e=null!=n?n.left:0,r=null!=n?n.top:0,t.bokehX=t.pageX-e,t.bokehY=t.pageY-r},n=function(){function t(t){this.restrict_to_innercanvas=t.restrict_to_innercanvas,this.options=t,this.toolName=this.options.eventBasename,this.dragging=!1,this.basepoint_set=!1,this.button_activated=!1,this.tool_active=!1}return t.prototype.bind_bokeh_events=function(t,e){var n,i=this;return n=this.toolName,this.plotview=t,this.eventSink=e,this.plotview.moveCallbacks.push(function(t){return i.dragging&&i.tool_active?(r(t),i.basepoint_set?(e.trigger(""+n+":UpdatingMouseMove",t),t.preventDefault(),t.stopPropagation()):(i.dragging=!0,i.basepoint_set=!0,e.trigger(""+n+":SetBasepoint",t))):void 0}),this.plotview.moveCallbacks.push(function(t,e,n){var o,s,a,l,c,u;if(i.dragging){if(r(t),o=i.plotview.view_state.get("inner_range_horizontal"),s=i.plotview.view_state.get("inner_range_vertical"),e=i.plotview.view_state.sx_to_vx(t.bokehX),n=i.plotview.view_state.sy_to_vy(t.bokehY),i.restrict_to_innercanvas?(l=o.get("start"),a=o.get("end"),u=s.get("start"),c=s.get("end")):(l=0,a=i.plotview.view_state.get("outer_width"),u=0,c=i.plotview.view_state.get("outer_height")),l>e||e>a)return i._stop_drag(t),!1;if(u>n||n>c)return i._stop_drag(t),!1}}),$(document).bind("keydown",function(t){return 27===t.keyCode?e.trigger("clear_active_tool"):void 0}),$(document).bind("keyup",function(t){return t[i.options.keyName]?void 0:i._stop_drag(t)}),this.plotview.canvas_wrapper.bind("mousedown",function(t){var e;return e=!1,i.button_activated||i.eventSink.active===i.toolName?e=!0:i.eventSink.active||(null!==i.options.keyName||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey?t[i.options.keyName]===!0&&(e=!0):e=!0),e?(i._start_drag(),!1):void 0}),this.plotview.canvas_wrapper.bind("mouseup",function(t){return i.button_activated?(i._stop_drag(t),!1):void 0}),this.plotview.canvas_wrapper.bind("mouseleave",function(t){return i.button_activated?(i._stop_drag(t),!1):void 0}),this.$tool_button=$(" "+this.options.buttonText+" "),this.plotview,this.plotview.$el.find(".button_bar").append(this.$tool_button),this.$tool_button.click(function(){return i.button_activated?e.trigger("clear_active_tool"):e.trigger("active_tool",n)}),e.on(""+n+":deactivated",function(){return i.tool_active=!1,i.button_activated=!1,i.$tool_button.removeClass("active")}),e.on(""+n+":activated",function(){return i.tool_active=!0,i.$tool_button.addClass("active"),i.button_activated=!0}),e},t.prototype.hide_button=function(){return this.$tool_button.hide()},t.prototype._start_drag=function(){return this._activated_with_button=this.button_activated,this.eventSink.trigger("active_tool",this.toolName),this.dragging||(this.dragging=!0,this.button_activated||this.$tool_button.addClass("active"),null==this.options.cursor)?void 0:this.plotview.canvas_wrapper.css("cursor",this.options.cursor)},t.prototype._stop_drag=function(t){return this.basepoint_set=!1,this.dragging&&(this.dragging=!1,this._activated_with_button===!1&&this.options.auto_deactivate===!0&&this.eventSink.trigger("clear_active_tool"),this.button_activated||this.$tool_button.removeClass("active"),null!=this.options.cursor&&this.plotview.canvas_wrapper.css("cursor",""),r(t),this.eventSink.trigger(""+this.options.eventBasename+":DragEnd",t)),this._activated_with_button=null},t}(),e=function(){function t(t){this.options=t,this.toolName=this.options.eventBasename,this.dragging=!1,this.basepoint_set=!1,this.button_activated=!1,this.tool_active=!1}return t.prototype.bind_bokeh_events=function(t,e){var n,i,o,s=this;return o=this.toolName,this.plotview=t,this.eventSink=e,this.plotview.canvas_wrapper.bind("mousewheel",function(t,n){return s.tool_active||!s.eventSink.active&&t.shiftKey?(r(t),t.delta=n,e.trigger(""+o+":zoom",t),t.preventDefault(),t.stopPropagation()):void 0}),$(document).bind("keydown",function(t){return 27===t.keyCode?e.trigger("clear_active_tool"):void 0}),this.plotview.$el.bind("mousein",function(){return e.trigger("clear_active_tool")}),this.plotview.$el.bind("mouseover",function(){return s.mouseover_count+=1}),this.$tool_button=$(" "+this.options.buttonText+" "),this.plotview.$el.find(".button_bar").append(this.$tool_button),this.$tool_button.click(function(){return s.button_activated?e.trigger("clear_active_tool"):(e.trigger("active_tool",o),s.button_activated=!0)}),n=function(t){return t.setAttribute("old_overflow",t.style.overflow),t.style.overflow="hidden",t!==document.body?n(t.parentNode):void 0},i=function(t){return t.style.overflow=t.getAttribute("old_overflow"),t!==document.body?i(t.parentNode):void 0},e.on(""+o+":deactivated",function(){return s.tool_active=!1,s.button_activated=!1,s.$tool_button.removeClass("active"),document.body.style.overflow=s.old_overflow}),e.on(""+o+":activated",function(){return s.tool_active=!0,s.$tool_button.addClass("active")}),e},t.prototype.hide_button=function(){return this.$tool_button.hide()},t}(),t=function(){function t(t){this.options=t,this.toolName=this.options.eventBasename,this.button_activated=!1,this.tool_active=!1}return t.prototype.bind_bokeh_events=function(t,e){var n,r,i,o=this;return i=this.toolName,this.plotview=t,this.eventSink=e,$(document).bind("keydown",function(t){return 27===t.keyCode?e.trigger("clear_active_tool"):void 0}),this.plotview.$el.bind("mouseover",function(){return o.mouseover_count+=1}),this.$tool_button=$(" "+this.options.buttonText+" "),this.plotview.$el.find(".button_bar").append(this.$tool_button),this.$tool_button.click(function(){return o.button_activated?e.trigger("clear_active_tool"):(e.trigger("active_tool",i),o.button_activated=!0)}),n=function(t){return t.setAttribute("old_overflow",t.style.overflow),t.style.overflow="hidden",t!==document.body?n(t.parentNode):void 0},r=function(t){return t.style.overflow=t.getAttribute("old_overflow"),t!==document.body?r(t.parentNode):void 0},e.on(""+i+":deactivated",function(){return o.tool_active=!1,o.button_activated=!1,o.$tool_button.removeClass("active"),document.body.style.overflow=o.old_overflow}),e.on(""+i+":activated",function(){return o.tool_active=!0,o.$tool_button.addClass("active")}),e},t.prototype.hide_button=function(){return this.$tool_button.hide()},t}(),{TwoPointEventGenerator:n,OnePointWheelEventGenerator:e,ButtonEventGenerator:t}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/box_select_tool",["underscore","backbone","./tool","./event_generators"],function(n,r,i,o){var s,a,l,c,u,h,p;return c=o.TwoPointEventGenerator,a=function(r){function i(){return u=i.__super__.constructor.apply(this,arguments)}return e(i,r),i.prototype.initialize=function(t){return i.__super__.initialize.call(this,t),this.select_every_mousemove=this.mget("select_every_mousemove")},i.prototype.bind_bokeh_events=function(){var t,e,n,r,o,s;for(i.__super__.bind_bokeh_events.call(this),o=this.mget_obj("renderers"),s=[],n=0,r=o.length;r>n;n++)t=o[n],e=this.plot_view.renderers[t.id],this.listenTo(e.xrange(),"change",this.select_callback),this.listenTo(e.yrange(),"change",this.select_callback),s.push(this.listenTo(t,"change",this.select_callback));return s},i.prototype.eventGeneratorClass=c,i.prototype.toolType="BoxSelectTool",i.prototype.evgen_options={keyName:"shiftKey",buttonText:"Select",cursor:"crosshair",restrict_to_innercanvas:!0},i.prototype.tool_events={SetBasepoint:"_start_selecting",UpdatingMouseMove:"_selecting",deactivated:"_stop_selecting",DragEnd:"_dragend"},i.prototype.pause=function(){return null},i.prototype.view_coords=function(t,e){var n,r,i;return i=[this.plot_view.view_state.sx_to_vx(t),this.plot_view.view_state.sy_to_vy(e)],n=i[0],r=i[1],[n,r]},i.prototype._stop_selecting=function(){return this.trigger("stopselect"),this.basepoint_set=!1,this.plot_view.unpause()},i.prototype._start_selecting=function(t){var e,n,r;return this.plot_view.pause(),this.trigger("startselect"),r=this.view_coords(t.bokehX,t.bokehY),e=r[0],n=r[1],this.mset({start_vx:e,start_vy:n,current_vx:null,current_vy:null}),this.basepoint_set=!0},i.prototype._get_selection_range=function(){var t,e;return this.mget("select_x")?(t=[this.mget("start_vx"),this.mget("current_vx")],t=[n.min(t),n.max(t)]):t=null,this.mget("select_y")?(e=[this.mget("start_vy"),this.mget("current_vy")],e=[n.min(e),n.max(e)]):e=null,[t,e]},i.prototype._selecting=function(t){var e,n,r,i;return r=this.view_coords(t.bokehX,t.bokehY),e=r[0],n=r[1],this.mset({current_vx:e,current_vy:n}),i=this._get_selection_range(),this.xrange=i[0],this.yrange=i[1],this.trigger("boxselect",this.xrange,this.yrange),this.select_every_mousemove&&this._select_data(),this.plot_view.render_overlays(!0),null},i.prototype._dragend=function(){return this._select_data()},i.prototype._select_data=function(){var e,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m;if(this.basepoint_set){for(a={type:"rect",vx0:this.xrange[0],vx1:this.xrange[1],vy0:this.yrange[0],vy1:this.yrange[1]},o={},i={},g=this.mget_obj("renderers"),p=0,_=g.length;_>p;p++)c=g[p],e=c.get_obj("data_source"),o[e.id]=e;for(m=this.mget_obj("renderers"),d=0,f=m.length;f>d;d++)c=m[d],r=c.get_obj("data_source").id,n.setdefault(i,r,[]),u=this.plot_view.renderers[c.id].hit_test(a),i[r].push(u);for(l in i)t.call(i,l)&&(h=i[l],u=n.intersection.apply(n,h),s=o[l],s.save({selected:u},{patch:!0}),this.plot_view.unpause());return null}},i}(i.View),s=function(t){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,t),r.prototype.default_view=a,r.prototype.type="BoxSelectTool",r.prototype.defaults=function(){return n.extend(r.__super__.defaults.call(this),{renderers:[],select_x:!0,select_y:!0,select_every_mousemove:!1,data_source_options:{}})},r.prototype.display_defaults=function(){return r.__super__.display_defaults.call(this)},r}(i.Model),l=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n}(r.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/box_zoom_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h;return l=i.TwoPointEventGenerator,s=function(n){function r(){return c=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t)},r.prototype.bind_bokeh_events=function(){return r.__super__.bind_bokeh_events.call(this)},r.prototype.eventGeneratorClass=l,r.prototype.toolType="BoxZoomTool",r.prototype.evgen_options={keyName:"ctrlKey",buttonText:"Box Zoom",cursor:"crosshair",auto_deactivate:!0,restrict_to_innercanvas:!0},r.prototype.tool_events={SetBasepoint:"_start_selecting",UpdatingMouseMove:"_selecting",DragEnd:"_dragend"},r.prototype.pause=function(){return null},r.prototype.view_coords=function(t,e){var n,r,i;return i=[this.plot_view.view_state.sx_to_vx(t),this.plot_view.view_state.sy_to_vy(e)],n=i[0],r=i[1],[n,r]},r.prototype._start_selecting=function(t){var e,n,r;return this.plot_view.pause(),this.trigger("startselect"),r=this.view_coords(t.bokehX,t.bokehY),e=r[0],n=r[1],this.mset({start_vx:e,start_vy:n,current_vx:null,current_vy:null}),this.basepoint_set=!0},r.prototype._get_selection_range=function(){var e,n;return this.mget("select_x")?(e=[this.mget("start_vx"),this.mget("current_vx")],e=[t.min(e),t.max(e)]):e=null,this.mget("select_y")?(n=[this.mget("start_vy"),this.mget("current_vy")],n=[t.min(n),t.max(n)]):n=null,[e,n]},r.prototype._selecting=function(t){var e,n,r,i;return r=this.view_coords(t.bokehX,t.bokehY),e=r[0],n=r[1],this.mset({current_vx:e,current_vy:n}),i=this._get_selection_range(),this.xrange=i[0],this.yrange=i[1],this.trigger("boxselect",this.xrange,this.yrange),this.plot_view.render_overlays(!0),null},r.prototype._dragend=function(){return this._select_data(),this.basepoint_set=!1,this.plot_view.unpause(),this.trigger("stopselect")},r.prototype._select_data=function(){var t,e,n,r,i,o,s;if(this.basepoint_set)return o=this.plot_view.xmapper.v_map_from_target([this.xrange[0],this.xrange[1]]),e=o[0],t=o[1],s=this.plot_view.ymapper.v_map_from_target([this.yrange[0],this.yrange[1]]),r=s[0],n=s[1],i={xr:{start:e,end:t},yr:{start:r,end:n}},this.plot_view.update_range(i)},r}(r.View),o=function(n){function r(){return u=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=s,r.prototype.type="BoxZoomTool",r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{renderers:[],select_x:!0,select_y:!0,select_every_mousemove:!1,data_source_options:{}})},r.prototype.display_defaults=function(){return r.__super__.display_defaults.call(this)},r}(r.Model),a=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new a,View:s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/crosshair_tool",["underscore","backbone","./tool","./event_generators","sprintf"],function(t,n,r,i,o){var s,a,l,c,u,h,p;return c=i.TwoPointEventGenerator,a=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.active=!1},n.prototype.bind_events=function(t){return n.__super__.bind_events.call(this,t)},n.prototype.eventGeneratorClass=c,n.prototype.toolType="CrosshairTool",n.prototype.evgen_options={keyName:"",buttonText:"Crosshair",cursor:"crosshair"},n.prototype.tool_events={activated:"_activate",deactivated:"_deactivate",UpdatingMouseMove:"_drag",SetBasepoint:"_set_base_point"},n.prototype.render=function(){var t,e,n,r;if(this.active)return e=this.plot_view.ctx,n=this.plot_view.view_state.get("canvas_width"),t=this.plot_view.view_state.get("canvas_height"),r=1,e.save(),e.strokeStyle="red",e.globalAlpha=.7,e.lineWidth=r,e.setLineDash([]),e.beginPath(),e.moveTo(0,this.y),e.lineTo(n,this.y),console.log(this.x,this.y),e.moveTo(this.x,0),e.lineTo(this.x,t),e.stroke(),e.restore()},n.prototype.mouse_coords=function(t,e,n){return[e,n]},n.prototype._activate=function(){var t,e,n;if(!this.active)return this.active=!0,this.popup=$(''),t=this.plot_view.$el.find(".bokeh_canvas_wrapper"),this.popup.appendTo(t),e=this.plot_view.view_state.get("outer_height"),n=this.plot_view.view_state.get("outer_width"),this.popup.text("x: 0 y:0"),this.plot_view.$el.css("cursor","crosshair"),null},n.prototype._deactivate=function(){return this.active=!1,this.plot_view.$el.css("cursor","default"),this.popup.remove(),this.request_render(),this.plot_view.request_render(),null},n.prototype._set_base_point=function(t){var e;return e=this.mouse_coords(t,t.bokehX,t.bokehY),this.x=e[0],this.y=e[1],null},n.prototype._drag=function(t){var e,n,r;return this.plot_view.pause(),r=this.mouse_coords(t,t.bokehX,t.bokehY),this.x=r[0],this.y=r[1],e=o("%.4f",this.plot_view.xmapper.map_from_target(x)),n=o("%.4f",this.plot_view.ymapper.map_from_target(y)),this.popup.text("x: "+e+" y: "+n),this.request_render(),this.plot_view.request_render(),this.plot_view.unpause(!0),null},n}(r.View),s=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=a,n.prototype.type="CrosshairTool",n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(r.Model),l=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n}(n.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/data_range_box_select_tool",["underscore","backbone","./box_select_tool"],function(t,n,r){var i,o,s,a,l,c;return o=function(t){function n(){return a=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.bind_bokeh_events=function(){return tool.ToolView.prototype.bind_bokeh_events.call(this)},n.prototype._select_data=function(){var t,e,n,r,i,o;return i=this.plot_view.mapper.map_from_target(this.xrange[0],this.yrange[0]),e=i[0],r=i[1],o=this.plot_view.mapper.map_from_target(this.xrange[1],this.yrange[1]),t=o[0],n=o[1],this.mset("xselect",[e,t]),this.mset("yselect",[r,n]),this.model.save()},n}(r.View),i=function(t){function n(){return l=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=o,n.prototype.type="DataRangeBoxSelectTool",n}(r.Model),s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(n.Collection),{Model:i,Collection:new s,View:o}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/embed_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h,p;return o=i.ButtonEventGenerator,c=function(t){return t.replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/\'/g,"'")},a=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t)},n.prototype.eventGeneratorClass=o,n.prototype.evgen_options={buttonText:"Embed Html"},n.prototype.toolType="EmbedTool",n.prototype.tool_events={activated:"_activated",deactivated:"_close_modal"},n.prototype._activated=function(){var t,e,n,r,i,o,s=this;return console.log("EmbedToolView._activated"),window.tool_view=this,i=this.plot_model.get("id"),n=this.plot_model.get("doc"),e=this.plot_model.get("docapikey"),t=this.plot_model.get("baseurl"),o=c(this.plot_model.get("script_inject_snippet")),r='',$("body").append(r),$("#embedModal > .modal").on("hidden",function(){return s.plot_view.eventSink.trigger("clear_active_tool")}),$("#embedModal > .modal").modal({show:!0})},n.prototype._close_modal=function(){return $("#embedModal").remove(),$("#embedModal > .modal").remove()},n}(r.View),s=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=a,n.prototype.type="EmbedTool",n}(r.Model),l=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(n.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/hover_tool",["underscore","backbone","sprintf","./tool"],function(t,n,r,i){var o,s,a,l,c,u,h,p;return l=function(t){var e,n,r,i,o;return"#"===t.substr(0,1)?t:(n=/(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(t),i=parseInt(n[2]),r=parseInt(n[3]),e=parseInt(n[4]),o=e|r<<8|i<<16,n[1]+"#"+o.toString(16))},c=function(t){return"string"==typeof t?t:Math.floor(t)===t?r("%d",t):Math.abs(t)>.1&&Math.abs(t)<1e3?r("%0.3f",t):r("%0.3e",t)},s=function(n){function r(){return u=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t),this.div=$('
').appendTo("body"),this.div.hide(),this.active=!1},r.prototype.bind_bokeh_events=function(){var t,e=this;return t="hover_tool",this.tool_button=$(" Hover "),this.plot_view.$el.find(".button_bar").append(this.tool_button),this.tool_button.click(function(){return e.active?e.plot_view.eventSink.trigger("clear_active_tool"):e.plot_view.eventSink.trigger("active_tool",t)}),this.plot_view.eventSink.on(""+t+":deactivated",function(){return e.active=!1,e.tool_button.removeClass("active"),e.div.hide()}),this.plot_view.eventSink.on(""+t+":activated",function(){return e.active=!0,e.tool_button.addClass("active")}),this.plot_view.canvas.bind("mousemove",function(t){var n,r,i,o,s,a,l,c,u,h,p,d;if(e.active)return o=$(t.currentTarget).offset(),i=null!=o?o.left:0,s=null!=o?o.top:0,t.bokehX=t.pageX-i,t.bokehY=t.pageY-s,d=e.view_coords(t.bokehX,t.bokehY),a=d[0],l=d[1],n=e.plot_view.view_state.get("inner_range_horizontal"),r=e.plot_view.view_state.get("inner_range_vertical"),u=n.get("start"),c=n.get("end"),p=r.get("start"),h=r.get("end"),u>a||a>c||p>l||l>h?(e.div.hide(),void 0):e._select(a,l,t)}),this.plot_view.canvas_wrapper.css("cursor","crosshair")},r.prototype.view_coords=function(t,e){var n,r,i;return i=[this.plot_view.view_state.sx_to_vx(t),this.plot_view.view_state.sy_to_vy(e)],n=i[0],r=i[1],[n,r]},r.prototype._select=function(e,n,r){var i,o,s,a,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j,C,T,M,N,S,A,E,O,P,z,D,F,q,B,I,L,R;for(g={type:"point",vx:e,vy:n},E=this.plot_view.xmapper.map_from_target(e),O=this.plot_view.ymapper.map_from_target(n),d={},p={},q=this.mget_obj("renderers"),P=0,D=q.length;D>P;P++)x=q[P],u=x.get_obj("data_source"),d[u.id]=u;for(B=this.mget_obj("renderers"),z=0,F=B.length;F>z;z++)if(x=B[z],h=x.get_obj("data_source").id,t.setdefault(p,h,[]),j=this.plot_view.renderers[x.id].hit_test(g),_=d[h],null!==j){if(j.length>0){v=j[0],this.div.empty(),M=$(""),I=this.mget("tooltips");for(y in I){if(A=I[y],k=$(" "),k.append($(" "+y+": ")),N=$(" "),A.indexOf("$color")>=0){if(L=A.match(/\$color(\[.*\])?:(\w*)/),b=L[0],w=L[1],i=L[2],s=_.getcolumn(i),null==s){C=$(""+i+" unknown "),N.append(C);continue}if(m=(null!=w?w.indexOf("hex"):void 0)>=0,T=(null!=w?w.indexOf("swatch"):void 0)>=0,o=s[v],null==o){C=$("(null) "),N.append(C);continue}m&&(o=l(o)),C=$(""+o+" "),N.append(C),T&&(C=$(" "),C.css({backgroundColor:o})),N.append(C)}else{for(A=A.replace("$index",""+v),A=A.replace("$x",""+c(E)),A=A.replace("$y",""+c(O)),A=A.replace("$vx",""+e),A=A.replace("$vy",""+n),A=A.replace("$sx",""+r.bokehX),A=A.replace("$sy",""+r.bokehY);A.indexOf("@")>=0;){if(R=A.match(/(@)(\w*)/),b=R[0],S=R[1],a=R[2],s=_.getcolumn(a),null==s){A=A.replace(a,""+a+" unknown");break}s=_.getcolumn(a),f=s[v],A="number"==typeof f?A.replace(b,""+c(f)):A.replace(b,""+f)}C=$(""+A+" "),N.append(C)}k.append(N),M.append(k)}this.div.append(M),this.div.css({top:r.pageY-this.div.height()/2,left:r.pageX+18}),this.div.show();break}this.div.hide(),p[h].push(j)}return null},r}(i.View),o=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.default_view=s,r.prototype.type="HoverTool",r.prototype.dinitialize=function(t,e){var n;return r.__super__.dinitialize.call(this,t,e),this.set("renderers",function(){var t,e,r,i;for(r=this.get_obj("plot").get("renderers"),i=[],t=0,e=r.length;e>t;t++)n=r[t],"Glyph"===n.type&&i.push(n);return i}.call(this))},r.prototype.defaults=function(){return t.extend(r.__super__.defaults.call(this),{renderers:[],tooltips:{index:"$index","data (x, y)":"($x, $y)","canvas (x, y)":"($sx, $sy)"}})},r.prototype.display_defaults=function(){return r.__super__.display_defaults.call(this)
},r}(i.Model),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new a,View:s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/pan_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h;return l=i.TwoPointEventGenerator,window.render_count=0,s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){var e;return n.__super__.initialize.call(this,t),e=this.mget("dimensions"),0===e.length?console.log("WARN: pan tool given empty dimensions"):1===e.length?"width"===e[0]?this.evgen_options.buttonText="Pan (x-axis)":"height"===e[0]?this.evgen_options.buttonText="Pan (y-axis)":console.log("WARN: pan tool given unrecognized dimensions: "+e):2!==e.length?console.log("WARN: pan tool given more than two dimensions: "+e):e.indexOf("width")<0||e.indexOf("height")<0?console.log("WARN: pan tool given unrecognized dimensions: "+e):void 0},n.prototype.bind_bokeh_events=function(){return n.__super__.bind_bokeh_events.call(this)},n.prototype.eventGeneratorClass=l,n.prototype.toolType="PanTool",n.prototype.evgen_options={keyName:null,buttonText:"Pan",cursor:"move",auto_deactivate:!0,restrict_to_innercanvas:!0},n.prototype.tool_events={UpdatingMouseMove:"_drag",SetBasepoint:"_set_base_point"},n.prototype.mouse_coords=function(t,e,n){var r,i,o;return o=[this.plot_view.view_state.sx_to_vx(e),this.plot_view.view_state.sy_to_vy(n)],r=o[0],i=o[1],[r,i]},n.prototype._set_base_point=function(t){var e;return e=this.mouse_coords(t,t.bokehX,t.bokehY),this.x=e[0],this.y=e[1],null},n.prototype._drag=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b;return y=this.mouse_coords(t,t.bokehX,t.bokehY),c=y[0],_=y[1],u=c-this.x,f=_-this.y,b=[c,_],this.x=b[0],this.y=b[1],p=this.plot_view.view_state.get("inner_range_horizontal"),s=p.get("start")-u,o=p.get("end")-u,m=this.plot_view.view_state.get("inner_range_vertical"),l=m.get("start")-f,a=m.get("end")-f,e=this.mget("dimensions"),e.indexOf("width")>-1?(d=this.plot_view.xmapper.map_from_target(s),h=this.plot_view.xmapper.map_from_target(o),r=-u):(d=this.plot_view.xmapper.map_from_target(p.get("start")),h=this.plot_view.xmapper.map_from_target(p.get("end")),r=0),e.indexOf("height")>-1?(v=this.plot_view.ymapper.map_from_target(l),g=this.plot_view.ymapper.map_from_target(a),i=f):(v=this.plot_view.ymapper.map_from_target(m.get("start")),g=this.plot_view.ymapper.map_from_target(m.get("end")),i=0),n={xr:{start:d,end:h},yr:{start:v,end:g},sdx:r,sdy:i},this.plot_view.update_range(n),null},n}(r.View),o=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=s,n.prototype.type="PanTool",n.prototype.defaults=function(){return{dimensions:["width","height"]}},n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(r.Model),a=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new a,View:s}})}.call(this),n("modal",["jquery"],function(t){function e(){var e=this,r=setTimeout(function(){e.$element.off(t.support.transition.end),n.call(e)},500);this.$element.one(t.support.transition.end,function(){clearTimeout(r),n.call(e)})}function n(){this.$element.hide().trigger("hidden"),r.call(this)}function r(e){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=t.support.transition&&n;this.$backdrop=t('
').appendTo(document.body),"static"!=this.options.backdrop&&this.$backdrop.click(t.proxy(this.hide,this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),r?this.$backdrop.one(t.support.transition.end,e):e()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(t.support.transition.end,t.proxy(i,this)):i.call(this)):e&&e()}function i(){this.$backdrop.remove(),this.$backdrop=null}function o(){var e=this;this.isShown&&this.options.keyboard?t(document).on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||t(document).off("keyup.dismiss.modal")}var s=function(e,n){this.options=n,this.$element=t(e).delegate('[data-dismiss="modal"]',"click.dismiss.modal",t.proxy(this.hide,this))};s.prototype={constructor:s,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var e=this,n=t.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(t("body").addClass("modal-open"),this.isShown=!0,o.call(this),r.call(this,function(){var n=t.support.transition&&e.$element.hasClass("fade");e.$element.parent().length||e.$element.appendTo(document.body),e.$element.show(),n&&e.$element[0].offsetWidth,e.$element.addClass("in"),n?e.$element.one(t.support.transition.end,function(){e.$element.trigger("shown")}):e.$element.trigger("shown")}))},hide:function(r){r&&r.preventDefault(),r=t.Event("hide"),this.$element.trigger(r),this.isShown&&!r.isDefaultPrevented()&&(this.isShown=!1,t("body").removeClass("modal-open"),o.call(this),this.$element.removeClass("in"),t.support.transition&&this.$element.hasClass("fade")?e.call(this):n.call(this))}},t.fn.modal=function(e){return this.each(function(){var n=t(this),r=n.data("modal"),i=t.extend({},t.fn.modal.defaults,n.data(),"object"==typeof e&&e);r||n.data("modal",r=new s(this,i)),"string"==typeof e?r[e]():i.show&&r.show()})},t.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},t.fn.modal.Constructor=s}),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/preview_save_tool",["underscore","jquery","modal","backbone","common/bulk_save","./tool","./event_generators"],function(t,n,r,i,o,s,a){var l,c,u,h,p,d,_;return l=a.ButtonEventGenerator,u=function(t){function r(){return p=r.__super__.constructor.apply(this,arguments)}return e(r,t),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t)},r.prototype.eventGeneratorClass=l,r.prototype.evgen_options={buttonText:"Preview/Save"},r.prototype.toolType="PreviewSaveTool",r.prototype.tool_events={activated:"_activated",deactivated:"_close_modal"},r.prototype._activated=function(){var t,e,r=this;return t=this.plot_view.canvas[0].toDataURL(),this.plot_model.set("png",this.plot_view.canvas[0].toDataURL()),e='\n
\n \n
\n
\n
\n \n
\n
',n("body").append(e),n("#previewModal .modal").on("hidden",function(){return r.plot_view.eventSink.trigger("clear_active_tool")}),n("#previewModal > .modal").modal({show:!0})},r.prototype._close_modal=function(){return n("#previewModal").remove(),n("#previewModal > .modal").remove()},r}(s.View),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=u,n.prototype.type="PreviewSaveTool",n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(s.Model),h=function(t){function n(){return _=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=c,n}(i.Collection),{Model:c,Collection:new h,View:u}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/reset_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h;return o=i.ButtonEventGenerator,a=function(n){function r(){return c=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t)},r.prototype.eventGeneratorClass=o,r.prototype.evgen_options={buttonText:"Reset View"},r.prototype.toolType="ResetTool",r.prototype.tool_events={activated:"_activated"},r.prototype._activated=function(){var e=this;return this.plot_view.update_range(),t.delay(function(){return e.plot_view.eventSink.trigger("clear_active_tool")},100)},r}(r.View),s=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=a,n.prototype.type="ResetTool",n}(r.Model),l=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(n.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/resize_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h;return l=i.TwoPointEventGenerator,s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.active=!1},n.prototype.bind_events=function(t){return n.__super__.bind_events.call(this,t)},n.prototype.eventGeneratorClass=l,n.prototype.toolType="ResizeTool",n.prototype.evgen_options={keyName:"",buttonText:"Resize",cursor:"move"},n.prototype.tool_events={activated:"_activate",deactivated:"_deactivate",UpdatingMouseMove:"_drag",SetBasepoint:"_set_base_point"},n.prototype.render=function(){var t,e,n,r;if(this.active)return e=this.plot_view.ctx,n=this.plot_view.view_state.get("canvas_width"),t=this.plot_view.view_state.get("canvas_height"),r=8,e.save(),e.strokeStyle="grey",e.globalAlpha=.7,e.lineWidth=r,e.setLineDash([]),e.beginPath(),e.rect(r,r,n-2*r,t-2*r),e.moveTo(r,r),e.lineTo(n-r,t-r),e.moveTo(r,t-r),e.lineTo(n-r,r),e.stroke(),e.restore()},n.prototype.mouse_coords=function(t,e,n){return[e,n]},n.prototype._activate=function(){var t,e,n;if(!this.active)return this.active=!0,this.popup=$(''),t=this.plot_view.$el.find(".bokeh_canvas_wrapper"),this.popup.appendTo(t),e=this.plot_view.view_state.get("outer_height"),n=this.plot_view.view_state.get("outer_width"),this.popup.text("width: "+n+" height: "+e),this.request_render(),this.plot_view.request_render(),null},n.prototype._deactivate=function(){return this.active=!1,this.popup.remove(),this.request_render(),this.plot_view.request_render(),null},n.prototype._set_base_point=function(t){var e;return e=this.mouse_coords(t,t.bokehX,t.bokehY),this.x=e[0],this.y=e[1],null},n.prototype._drag=function(t){var e,n,r,i,o,s,a,l;return this.plot_view.pause(),a=this.mouse_coords(t,t.bokehX,t.bokehY),r=a[0],o=a[1],i=r-this.x,s=o-this.y,l=[r,o],this.x=l[0],this.y=l[1],e=this.plot_view.view_state.get("outer_height"),n=this.plot_view.view_state.get("outer_width"),this.popup.text("width: "+n+" height: "+e),this.plot_view.view_state.set("outer_height",e+s,{silent:!0}),this.plot_view.view_state.set("outer_width",n+i,{silent:!0}),this.plot_view.view_state.set("canvas_height",e+s,{silent:!0}),this.plot_view.view_state.set("canvas_width",n+i,{silent:!0}),this.plot_view.view_state.trigger("change:outer_height",e+s),this.plot_view.view_state.trigger("change:outer_width",n+i),this.plot_view.view_state.trigger("change:canvas_height",e+s),this.plot_view.view_state.trigger("change:canvas_width",n+i),this.plot_view.view_state.trigger("change",this.plot_view.view_state),this.plot_view.unpause(!0),null},n}(r.View),o=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=s,n.prototype.type="ResizeTool",n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(r.Model),a=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(n.Collection),{Model:o,Collection:new a,View:s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/wheel_zoom_tool",["underscore","backbone","./tool","./event_generators"],function(t,n,r,i){var o,s,a,l,c,u,h;return o=i.OnePointWheelEventGenerator,a=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){var e;return n.__super__.initialize.call(this,t),e=this.mget("dimensions"),0===e.length?console.log("WARN: wheel zoom tool given empty dimensions"):1===e.length?"width"===e[0]?this.evgen_options.buttonText="Wheel Zoom (x-axis)":"height"===e[0]?this.evgen_options.buttonText="Wheel Zoom (y-axis)":console.log("WARN: wheel tool given unrecognized dimensions: "+e):2!==e.length?console.log("WARN: wheel tool given more than two dimensions: "+e):e.indexOf("width")<0||e.indexOf("height")<0?console.log("WARN: pan tool given unrecognized dimensions: "+e):void 0},n.prototype.eventGeneratorClass=o,n.prototype.evgen_options={buttonText:"Wheel Zoom"},n.prototype.tool_events={zoom:"_zoom"},n.prototype.mouse_coords=function(t,e,n){var r,i,o;return o=[this.plot_view.view_state.sx_to_vx(e),this.plot_view.view_state.sy_to_vy(n)],r=o[0],i=o[1],[r,i]},n.prototype._zoom=function(t){var e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w,x,k,j;return e=t.originalEvent.wheelDelta,i=t.bokehX,o=t.bokehY,b=this.mouse_coords(t,i,o),h=b[0],f=b[1],s=this.mget("speed"),r=s*e,r>.9?r=.9:-.9>r&&(r=-.9),d=this.plot_view.view_state.get("inner_range_horizontal"),l=d.get("start"),a=d.get("end"),m=this.plot_view.view_state.get("inner_range_vertical"),u=m.get("start"),c=m.get("end"),n=this.mget("dimensions"),n.indexOf("width")>-1?(w=this.plot_view.xmapper.v_map_from_target([l-(l-h)*r,a-(a-h)*r]),_=w[0],p=w[1]):(x=this.plot_view.xmapper.v_map_from_target([l,a]),_=x[0],p=x[1]),n.indexOf("height")>-1?(k=this.plot_view.ymapper.v_map_from_target([u-(u-f)*r,c-(c-f)*r]),v=k[0],g=k[1]):(j=this.plot_view.ymapper.v_map_from_target([u,c]),v=j[0],g=j[1]),y={xr:{start:_,end:p},yr:{start:v,end:g},factor:r},this.plot_view.update_range(y),null},n}(r.View),s=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=a,n.prototype.type="WheelZoomTool",n.prototype.defaults=function(){return{dimensions:["width","height"],speed:1/600}},n}(r.Model),l=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=s,n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(n.Collection),{Model:s,Collection:new l,View:a}})}.call(this),function(t){"function"==typeof n&&n.amd?n("jstree",["jquery"],t):"object"==typeof exports?t(e("jquery")):t(jQuery)}(function(t,e){if(!t.jstree){var n,r,i=0,o=!1,s=!1,a=!1,l=[],c=t("script:last").attr("src"),u=document,h=u.createElement("LI");h.setAttribute("role","treeitem"),n=u.createElement("I"),n.className="jstree-icon jstree-ocl",h.appendChild(n),n=u.createElement("A"),n.className="jstree-anchor",n.setAttribute("href","#"),r=u.createElement("I"),r.className="jstree-icon jstree-themeicon",n.appendChild(r),h.appendChild(n),n=r=null,t.jstree={version:"3.0.0-beta9",defaults:{plugins:[]},plugins:{},path:c&&-1!==c.indexOf("/")?c.replace(/\/[^\/]+$/,""):""},t.jstree.create=function(e,n){var r=new t.jstree.core(++i),o=n;return n=t.extend(!0,{},t.jstree.defaults,n),o&&o.plugins&&(n.plugins=o.plugins),t.each(n.plugins,function(t,e){"core"!==t&&(r=r.plugin(e,n[e]))}),r.init(e,n),r},t.jstree.core=function(t){this._id=t,this._cnt=0,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[],last_error:{}}}},t.jstree.reference=function(e){if(e&&!t(e).length){e.id&&(e=e.id);var n=null;return t(".jstree").each(function(){var r=t(this).data("jstree");return r&&r._model.data[e]?(n=r,!1):void 0}),n}return t(e).closest(".jstree").data("jstree")},t.fn.jstree=function(n){var r="string"==typeof n,i=Array.prototype.slice.call(arguments,1),o=null;return this.each(function(){var s=t.jstree.reference(this),a=r&&s?s[n]:null;return o=r&&a?a.apply(s,i):null,s||r||n!==e&&!t.isPlainObject(n)||t(this).data("jstree",new t.jstree.create(this,n)),s&&!r&&(o=s),null!==o&&o!==e?!1:void 0}),null!==o&&o!==e?o:this},t.expr[":"].jstree=t.expr.createPseudo(function(){return function(n){return t(n).hasClass("jstree")&&t(n).data("jstree")!==e}}),t.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:t.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!0},expand_selected_onload:!0},t.jstree.core.prototype={plugin:function(e,n){var r=t.jstree.plugins[e];return r?(this._data[e]={},r.prototype=this,new r(n,this)):this},init:function(e,n){this._model={data:{"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this.element=t(e).addClass("jstree jstree-"+this._id),this.settings=n,this.element.bind("destroyed",t.proxy(this.teardown,this)),this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this._data.core.li_height=this.get_container_ul().children("li:eq(0)").height()||18,this.trigger("loading"),this.load_node("#")},destroy:function(){this.element.unbind("destroyed",this.teardown),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){this.element.on("dblclick.jstree",function(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}}).on("click.jstree",".jstree-ocl",t.proxy(function(t){this.toggle_node(t.target)},this)).on("click.jstree",".jstree-anchor",t.proxy(function(e){e.preventDefault(),t(e.currentTarget).focus(),this.activate_node(e.currentTarget,e)},this)).on("keydown.jstree",".jstree-anchor",t.proxy(function(e){var n=null;switch(e.which){case 13:case 32:e.type="click",t(e.currentTarget).trigger(e);break;case 37:e.preventDefault(),this.is_open(e.currentTarget)?this.close_node(e.currentTarget):(n=this.get_prev_dom(e.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 38:e.preventDefault(),n=this.get_prev_dom(e.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 39:e.preventDefault(),this.is_closed(e.currentTarget)?this.open_node(e.currentTarget,function(t){this.get_node(t,!0).children(".jstree-anchor").focus()}):(n=this.get_next_dom(e.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 40:e.preventDefault(),n=this.get_next_dom(e.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 46:e.preventDefault(),n=this.get_node(e.currentTarget),n&&n.id&&"#"!==n.id&&(n=this.is_selected(n)?this.get_selected():n);break;case 113:e.preventDefault(),n=this.get_node(e.currentTarget)}},this)).on("load_node.jstree",t.proxy(function(e,n){if(n.status&&("#"!==n.node.id||this._data.core.loaded||(this._data.core.loaded=!0,this.trigger("loaded")),!this._data.core.ready&&!this.get_container_ul().find(".jstree-loading:eq(0)").length)){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var r,i,o=[];for(r=0,i=this._data.core.selected.length;i>r;r++)o=o.concat(this._model.data[this._data.core.selected[r]].parents);for(o=t.vakata.array_unique(o),r=0,i=o.length;i>r;r++)this.open_node(o[r],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}setTimeout(t.proxy(function(){this.trigger("ready")},this),0)}},this)).on("init.jstree",t.proxy(function(){var t=this.settings.core.themes;this._data.core.themes.dots=t.dots,this._data.core.themes.stripes=t.stripes,this._data.core.themes.icons=t.icons,this.set_theme(t.name||"default",t.url),this.set_theme_variant(t.variant)},this)).on("loading.jstree",t.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("focus.jstree",".jstree-anchor",t.proxy(function(e){this.element.find(".jstree-hovered").not(e.currentTarget).mouseleave(),t(e.currentTarget).mouseenter()},this)).on("mouseenter.jstree",".jstree-anchor",t.proxy(function(t){this.hover_node(t.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",t.proxy(function(t){this.dehover_node(t.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),t(document).off(".jstree-"+this._id)},trigger:function(t,e){e||(e={}),e.instance=this,this.element.triggerHandler(t.replace(".jstree","")+".jstree",e)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children("ul:eq(0)")},get_string:function(e){var n=this.settings.core.strings;return t.isFunction(n)?n.call(this,e):n&&n[e]?n[e]:e},_firstChild:function(t){for(t=t?t.firstChild:null;null!==t&&1!==t.nodeType;)t=t.nextSibling;return t},_nextSibling:function(t){for(t=t?t.nextSibling:null;null!==t&&1!==t.nodeType;)t=t.nextSibling;return t},_previousSibling:function(t){for(t=t?t.previousSibling:null;null!==t&&1!==t.nodeType;)t=t.previousSibling;return t},get_node:function(e,n){e&&e.id&&(e=e.id);var r;try{if(this._model.data[e])e=this._model.data[e];else if(((r=t(e,this.element)).length||(r=t("#"+e,this.element)).length)&&this._model.data[r.closest("li").attr("id")])e=this._model.data[r.closest("li").attr("id")];else{if(!(r=t(e,this.element)).length||!r.hasClass("jstree"))return!1;e=this._model.data["#"]}return n&&(e="#"===e.id?this.element:t(document.getElementById(e.id))),e}catch(i){return!1}},get_path:function(t,e,n){if(t=t.parents?t:this.get_node(t),!t||"#"===t.id||!t.parents)return!1;var r,i,o=[];for(o.push(n?t.id:t.text),r=0,i=t.parents.length;i>r;r++)o.push(n?t.parents[r]:this.get_text(t.parents[r]));return o=o.reverse().slice(1),e?o.join(e):o},get_next_dom:function(e,n){var r;return e=this.get_node(e,!0),e[0]===this.element[0]?(r=this._firstChild(this.get_container_ul()[0]),r?t(r):!1):e&&e.length?n?(r=this._nextSibling(e[0]),r?t(r):!1):e.hasClass("jstree-open")?(r=this._firstChild(e.children("ul")[0]),r?t(r):!1):null!==(r=this._nextSibling(e[0]))?t(r):e.parentsUntil(".jstree","li").next("li").eq(0):!1},get_prev_dom:function(e,n){var r;if(e=this.get_node(e,!0),e[0]===this.element[0])return r=this.get_container_ul()[0].lastChild,r?t(r):!1;if(!e||!e.length)return!1;if(n)return r=this._previousSibling(e[0]),r?t(r):!1;if(null!==(r=this._previousSibling(e[0]))){for(e=t(r);e.hasClass("jstree-open");)e=e.children("ul:eq(0)").children("li:last");return e}return r=e[0].parentNode.parentNode,r&&"LI"===r.tagName?t(r):!1},get_parent:function(t){return t=this.get_node(t),t&&"#"!==t.id?t.parent:!1},get_children_dom:function(t){return t=this.get_node(t,!0),t[0]===this.element[0]?this.get_container_ul().children("li"):t&&t.length?t.children("ul").children("li"):!1},is_parent:function(t){return t=this.get_node(t),t&&(t.state.loaded===!1||t.children.length>0)},is_loaded:function(t){return t=this.get_node(t),t&&t.state.loaded},is_loading:function(t){return t=this.get_node(t,!0),t&&t.hasClass("jstree-loading")},is_open:function(t){return t=this.get_node(t),t&&t.state.opened},is_closed:function(t){return t=this.get_node(t),t&&this.is_parent(t)&&!t.state.opened},is_leaf:function(t){return!this.is_parent(t)},load_node:function(e,n){var r,i;if(t.isArray(e)){for(e=e.slice(),r=0,i=e.length;i>r;r++)this.load_node(e[r],n);return!0}return(e=this.get_node(e))?(this.get_node(e,!0).addClass("jstree-loading"),this._load_node(e,t.proxy(function(t){e.state.loaded=t,this.get_node(e,!0).removeClass("jstree-loading"),this.trigger("load_node",{node:e,status:t}),n&&n.call(this,e,t)},this)),!0):(n.call(this,e,!1),!1)},_load_node:function(e,n){var r,i=this.settings.core.data;return i?t.isFunction(i)?i.call(this,e,t.proxy(function(r){return r===!1?n.call(this,!1):n.call(this,this["string"==typeof r?"_append_html_data":"_append_json_data"](e,"string"==typeof r?t(r):r))},this)):"object"==typeof i?i.url?(i=t.extend(!0,{},i),t.isFunction(i.url)&&(i.url=i.url.call(this,e)),t.isFunction(i.data)&&(i.data=i.data.call(this,e)),t.ajax(i).done(t.proxy(function(r,i,o){var s=o.getResponseHeader("Content-Type");return-1!==s.indexOf("json")?n.call(this,this._append_json_data(e,r)):-1!==s.indexOf("html")?n.call(this,this._append_html_data(e,t(r))):void 0},this)).fail(t.proxy(function(){n.call(this,!1),this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify(i)},this.settings.core.error.call(this,this._data.core.last_error)},this))):(r=t.isArray(i)||t.isPlainObject(i)?JSON.parse(JSON.stringify(i)):i,n.call(this,this._append_json_data(e,r))):"string"==typeof i?n.call(this,this._append_html_data(e,i)):n.call(this,!1):n.call(this,"#"===e.id?this._append_html_data(e,this._data.core.original_container_html.clone(!0)):!1)},_node_changed:function(t){t=this.get_node(t),t&&this._model.changed.push(t.id)},_append_html_data:function(e,n){e=this.get_node(e),e.children=[],e.children_d=[];var r,i,o,s=n.is("ul")?n.children():n,a=e.id,l=[],c=[],u=this._model.data,h=u[a],p=this._data.core.selected.length;for(s.each(t.proxy(function(e,n){r=this._parse_model_from_html(t(n),a,h.parents.concat()),r&&(l.push(r),c.push(r),u[r].children_d.length&&(c=c.concat(u[r].children_d)))},this)),h.children=l,h.children_d=c,i=0,o=h.parents.length;o>i;i++)u[h.parents[i]].children_d=u[h.parents[i]].children_d.concat(c);return this.trigger("model",{nodes:c,parent:a}),"#"!==a?(this._node_changed(a),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==p&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_append_json_data:function(n,r){n=this.get_node(n),n.children=[],n.children_d=[];var i,o,s,a=r,l=n.id,c=[],u=[],h=this._model.data,p=h[l],d=this._data.core.selected.length;if(a.d&&(a=a.d,"string"==typeof a&&(a=JSON.parse(a))),t.isArray(a)||(a=[a]),a.length&&a[0].id!==e&&a[0].parent!==e){for(o=0,s=a.length;s>o;o++)a[o].children||(a[o].children=[]),h[a[o].id]=a[o];for(o=0,s=a.length;s>o;o++)h[a[o].parent].children.push(a[o].id),p.children_d.push(a[o].id);for(o=0,s=p.children.length;s>o;o++)i=this._parse_model_from_flat_json(h[p.children[o]],l,p.parents.concat()),u.push(i),h[i].children_d.length&&(u=u.concat(h[i].children_d))}else{for(o=0,s=a.length;s>o;o++)i=this._parse_model_from_json(a[o],l,p.parents.concat()),i&&(c.push(i),u.push(i),h[i].children_d.length&&(u=u.concat(h[i].children_d)));for(p.children=c,p.children_d=u,o=0,s=p.parents.length;s>o;o++)h[p.parents[o]].children_d=h[p.parents[o]].children_d.concat(u)}return this.trigger("model",{nodes:u,parent:l}),"#"!==l?(this._node_changed(l),this.redraw()):this.redraw(!0),this._data.core.selected.length!==d&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_parse_model_from_html:function(e,n,r){r=r?[].concat(r):[],n&&r.unshift(n);var i,o,s,a,l,c=this._model.data,u={id:!1,text:!1,icon:!0,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in this._model.default_state)this._model.default_state.hasOwnProperty(s)&&(u.state[s]=this._model.default_state[s]);if(a=t.vakata.attributes(e,!0),t.each(a,function(e,n){return n=t.trim(n),n.length?(u.li_attr[e]=n,"id"===e&&(u.id=n),void 0):!0}),a=e.children("a").eq(0),a.length&&(a=t.vakata.attributes(a,!0),t.each(a,function(e,n){n=t.trim(n),n.length&&(u.a_attr[e]=n)})),a=e.children("a:eq(0)").length?e.children("a:eq(0)").clone():e.clone(),a.children("ins, i, ul").remove(),a=a.html(),a=t("
").html(a),u.text=a.html(),a=e.data(),u.data=a?t.extend(!0,{},a):null,u.state.opened=e.hasClass("jstree-open"),u.state.selected=e.children("a").hasClass("jstree-clicked"),u.state.disabled=e.children("a").hasClass("jstree-disabled"),u.data&&u.data.jstree)for(s in u.data.jstree)u.data.jstree.hasOwnProperty(s)&&(u.state[s]=u.data.jstree[s]);a=e.children("a").children(".jstree-themeicon"),a.length&&(u.icon=a.hasClass("jstree-themeicon-hidden")?!1:a.attr("rel")),u.state.icon&&(u.icon=u.state.icon),a=e.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(c[l]);return u.id=u.li_attr.id||l,a.length?(a.each(t.proxy(function(e,n){i=this._parse_model_from_html(t(n),u.id,r),o=this._model.data[i],u.children.push(i),o.children_d.length&&(u.children_d=u.children_d.concat(o.children_d))},this)),u.children_d=u.children_d.concat(u.children)):e.hasClass("jstree-closed")&&(u.state.loaded=!1),u.li_attr["class"]&&(u.li_attr["class"]=u.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),u.a_attr["class"]&&(u.a_attr["class"]=u.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),c[u.id]=u,u.state.selected&&this._data.core.selected.push(u.id),u.id},_parse_model_from_flat_json:function(t,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l=t.id,c=this._model.data,u=this._model.default_state,h={id:l,text:t.text||"",icon:t.icon!==e?t.icon:!0,parent:n,parents:r,children:t.children||[],children_d:t.children_d||[],data:t.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in u)u.hasOwnProperty(i)&&(h.state[i]=u[i]);if(t&&t.data&&t.data.jstree&&t.data.jstree.icon&&(h.icon=t.data.jstree.icon),t&&t.data&&(h.data=t.data,t.data.jstree))for(i in t.data.jstree)t.data.jstree.hasOwnProperty(i)&&(h.state[i]=t.data.jstree[i]);if(t&&"object"==typeof t.state)for(i in t.state)t.state.hasOwnProperty(i)&&(h.state[i]=t.state[i]);if(t&&"object"==typeof t.li_attr)for(i in t.li_attr)t.li_attr.hasOwnProperty(i)&&(h.li_attr[i]=t.li_attr[i]);if(h.li_attr.id||(h.li_attr.id=l),t&&"object"==typeof t.a_attr)for(i in t.a_attr)t.a_attr.hasOwnProperty(i)&&(h.a_attr[i]=t.a_attr[i]);for(t&&t.children&&t.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),c[h.id]=h,i=0,o=h.children.length;o>i;i++)s=this._parse_model_from_flat_json(c[h.children[i]],h.id,r),a=c[s],h.children_d.push(s),a.children_d.length&&(h.children_d=h.children_d.concat(a.children_d));
return delete t.data,delete t.children,c[h.id].original=t,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(t,n,r){r=r?r.concat():[],n&&r.unshift(n);var i,o,s,a,l,c=!1,u=this._model.data,h=this._model.default_state;do c="j"+this._id+"_"+ ++this._cnt;while(u[c]);l={id:!1,text:"string"==typeof t?t:"",icon:"object"==typeof t&&t.icon!==e?t.icon:!0,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in h)h.hasOwnProperty(i)&&(l.state[i]=h[i]);if(t&&t.id&&(l.id=t.id),t&&t.text&&(l.text=t.text),t&&t.data&&t.data.jstree&&t.data.jstree.icon&&(l.icon=t.data.jstree.icon),t&&t.data&&(l.data=t.data,t.data.jstree))for(i in t.data.jstree)t.data.jstree.hasOwnProperty(i)&&(l.state[i]=t.data.jstree[i]);if(t&&"object"==typeof t.state)for(i in t.state)t.state.hasOwnProperty(i)&&(l.state[i]=t.state[i]);if(t&&"object"==typeof t.li_attr)for(i in t.li_attr)t.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=t.li_attr[i]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id),l.id||(l.id=c),l.li_attr.id||(l.li_attr.id=l.id),t&&"object"==typeof t.a_attr)for(i in t.a_attr)t.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=t.a_attr[i]);if(t&&t.children&&t.children.length){for(i=0,o=t.children.length;o>i;i++)s=this._parse_model_from_json(t.children[i],l.id,r),a=u[s],l.children.push(s),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children_d.concat(l.children)}return t&&t.children&&t.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete t.data,delete t.children,l.original=t,u[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var t,e,n,r=this._model.force_full_redraw?this._model.data["#"].children.concat([]):this._model.changed.concat([]),i=document.createElement("UL");for(e=0,n=r.length;n>e;e++)t=this.redraw_node(r[e],!0,this._model.force_full_redraw),t&&this._model.force_full_redraw&&i.appendChild(t);this._model.force_full_redraw&&(i.className=this.get_container_ul()[0].className,this.element.empty().append(i)),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:r})},redraw:function(t){t&&(this._model.force_full_redraw=!0),this._redraw()},redraw_node:function(e,n,r){var i=this.get_node(e),o=!1,s=!1,a=!1,l=!1,c=!1,u=!1,p="",d=document,_=this._model.data,f=!1,g=!1;if(!i)return!1;if("#"===i.id)return this.redraw(!0);if(n=n||0===i.children.length,e=d.getElementById(i.id))e=t(e),r||(o=e.parent().parent()[0],o===this.element[0]&&(o=null),s=e.index()),n||!i.children.length||e.children("ul").length||(n=!0),n||(a=e.children("UL")[0]),g=e.attr("aria-selected"),f=e.children(".jstree-anchor")[0]===document.activeElement,e.remove();else if(n=!0,!r){if(o="#"!==i.parent?t("#"+i.parent,this.element)[0]:null,!(null===o||o&&_[i.parent].state.opened))return!1;s=t.inArray(i.id,null===o?_["#"].children:_[i.parent].children)}e=h.cloneNode(!0),p="jstree-node ";for(l in i.li_attr)if(i.li_attr.hasOwnProperty(l)){if("id"===l)continue;"class"!==l?e.setAttribute(l,i.li_attr[l]):p+=i.li_attr[l]}g&&"false"!==g&&e.setAttribute("aria-selected",!0),!i.children.length&&i.state.loaded?p+=" jstree-leaf":(p+=i.state.opened?" jstree-open":" jstree-closed",e.setAttribute("aria-expanded",i.state.opened)),null!==i.parent&&_[i.parent].children[_[i.parent].children.length-1]===i.id&&(p+=" jstree-last"),e.id=i.id,e.className=p,p=(i.state.selected?" jstree-clicked":"")+(i.state.disabled?" jstree-disabled":"");for(c in i.a_attr)if(i.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===i.a_attr[c])continue;"class"!==c?e.childNodes[1].setAttribute(c,i.a_attr[c]):p+=" "+i.a_attr[c]}if(p.length&&(e.childNodes[1].className="jstree-anchor "+p),(i.icon&&i.icon!==!0||i.icon===!1)&&(i.icon===!1?e.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===i.icon.indexOf("/")&&-1===i.icon.indexOf(".")?e.childNodes[1].childNodes[0].className+=" "+i.icon+" jstree-themeicon-custom":(e.childNodes[1].childNodes[0].style.backgroundImage="url("+i.icon+")",e.childNodes[1].childNodes[0].style.backgroundPosition="center center",e.childNodes[1].childNodes[0].style.backgroundSize="auto",e.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),e.childNodes[1].innerHTML+=i.text,n&&i.children.length&&i.state.opened){for(u=d.createElement("UL"),u.setAttribute("role","group"),u.className="jstree-children",l=0,c=i.children.length;c>l;l++)u.appendChild(this.redraw_node(i.children[l],n,!0));e.appendChild(u)}return a&&e.appendChild(a),r||(o||(o=this.element[0]),o.getElementsByTagName("UL").length?o=o.getElementsByTagName("UL")[0]:(l=d.createElement("UL"),l.setAttribute("role","group"),l.className="jstree-children",o.appendChild(l),o=l),so;o++)this.open_node(n[o],r,i);return!0}if(n=this.get_node(n),!n||"#"===n.id)return!1;if(i=i===e?this.settings.core.animation:i,!this.is_closed(n))return r&&r.call(this,n,!1),!1;if(this.is_loaded(n))a=this.get_node(n,!0),l=this,a.length&&(n.children.length&&!this._firstChild(a.children("ul")[0])&&(n.state.opened=!0,this.redraw_node(n,!0),a=this.get_node(n,!0)),i?a.children("ul").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children("ul").stop(!0,!0).slideDown(i,function(){this.style.display="",l.trigger("after_open",{node:n})}):(a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].setAttribute("aria-expanded",!0))),n.state.opened=!0,r&&r.call(this,n,!0),this.trigger("open_node",{node:n}),i&&a.length||this.trigger("after_open",{node:n});else{if(this.is_loading(n))return setTimeout(t.proxy(function(){this.open_node(n,r,i)},this),500);this.load_node(n,function(t,e){return e?this.open_node(t,r,i):r?r.call(this,t,!1):!1})}},_open_to:function(e){if(e=this.get_node(e),!e||"#"===e.id)return!1;var n,r,i=e.parents;for(n=0,r=i.length;r>n;n+=1)"#"!==n&&this.open_node(i[n],!1,0);return t(document.getElementById(e.id))},close_node:function(n,r){var i,o,s,a;if(t.isArray(n)){for(n=n.slice(),i=0,o=n.length;o>i;i++)this.close_node(n[i],r);return!0}return n=this.get_node(n),n&&"#"!==n.id?(r=r===e?this.settings.core.animation:r,s=this,a=this.get_node(n,!0),a.length&&(r?a.children("ul").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children("ul").stop(!0,!0).slideUp(r,function(){this.style.display="",a.children("ul").remove(),s.trigger("after_close",{node:n})}):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.attr("aria-expanded",!1).children("ul").remove())),n.state.opened=!1,this.trigger("close_node",{node:n}),r&&a.length||this.trigger("after_close",{node:n}),void 0):!1},toggle_node:function(e){var n,r;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.toggle_node(e[n]);return!0}return this.is_closed(e)?this.open_node(e):this.is_open(e)?this.close_node(e):void 0},open_all:function(t,e,n){if(t||(t="#"),t=this.get_node(t),!t)return!1;var r,i,o,s="#"===t.id?this.get_container_ul():this.get_node(t,!0);if(!s.length){for(r=0,i=t.children_d.length;i>r;r++)this.is_closed(this._model.data[t.children_d[r]])&&(this._model.data[t.children_d[r]].state.opened=!0);return this.trigger("open_all",{node:t})}n=n||s,o=this,s=this.is_closed(t)?s.find("li.jstree-closed").addBack():s.find("li.jstree-closed"),s.each(function(){o.open_node(this,function(t,r){r&&this.is_parent(t)&&this.open_all(t,e,n)},e||0)}),0===n.find("li.jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(t,e){if(t||(t="#"),t=this.get_node(t),!t)return!1;var n,r,i="#"===t.id?this.get_container_ul():this.get_node(t,!0),o=this;if(!i.length){for(n=0,r=t.children_d.length;r>n;n++)this._model.data[t.children_d[n]].state.opened=!1;return this.trigger("close_all",{node:t})}i=this.is_open(t)?i.find("li.jstree-open").addBack():i.find("li.jstree-open"),i.vakata_reverse().each(function(){o.close_node(this,e||0)}),this.trigger("close_all",{node:t})},is_disabled:function(t){return t=this.get_node(t),t&&t.state&&t.state.disabled},enable_node:function(e){var n,r;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.enable_node(e[n]);return!0}return e=this.get_node(e),e&&"#"!==e.id?(e.state.disabled=!1,this.get_node(e,!0).children(".jstree-anchor").removeClass("jstree-disabled"),this.trigger("enable_node",{node:e}),void 0):!1},disable_node:function(e){var n,r;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.disable_node(e[n]);return!0}return e=this.get_node(e),e&&"#"!==e.id?(e.state.disabled=!0,this.get_node(e,!0).children(".jstree-anchor").addClass("jstree-disabled"),this.trigger("disable_node",{node:e}),void 0):!1},activate_node:function(t,e){if(this.is_disabled(t))return!1;if(this.settings.core.multiple&&(e.metaKey||e.ctrlKey||e.shiftKey)&&(!e.shiftKey||this._data.core.last_clicked&&this.get_parent(t)&&this.get_parent(t)===this._data.core.last_clicked.parent))if(e.shiftKey){var n,r,i=this.get_node(t).id,o=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,a=!1;for(n=0,r=s.length;r>n;n+=1)s[n]===i&&(a=!a),s[n]===o&&(a=!a),a||s[n]===i||s[n]===o?this.select_node(s[n],!1,!1,e):this.deselect_node(s[n],!1,!1,e)}else this.is_selected(t)?this.deselect_node(t,!1,!1,e):this.select_node(t,!1,!1,e);else!this.settings.core.multiple&&(e.metaKey||e.ctrlKey||e.shiftKey)&&this.is_selected(t)?this.deselect_node(t,!1,!1,e):(this.deselect_all(!0),this.select_node(t,!1,!1,e),this._data.core.last_clicked=this.get_node(t));this.trigger("activate_node",{node:this.get_node(t)})},hover_node:function(t){if(t=this.get_node(t,!0),!t||!t.length||t.children(".jstree-hovered").length)return!1;var e=this.element.find(".jstree-hovered"),n=this.element;e&&e.length&&this.dehover_node(e),t.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(t)}),setTimeout(function(){n.attr("aria-activedescendant",t[0].id),t.attr("aria-selected",!0)},0)},dehover_node:function(t){return t=this.get_node(t,!0),t&&t.length&&t.children(".jstree-hovered").length?(t.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(t)}),void 0):!1},select_node:function(e,n,r,i){var o,s,a;if(t.isArray(e)){for(e=e.slice(),s=0,a=e.length;a>s;s++)this.select_node(e[s],n,r,i);return!0}return e=this.get_node(e),e&&"#"!==e.id?(o=this.get_node(e,!0),e.state.selected||(e.state.selected=!0,this._data.core.selected.push(e.id),r||(o=this._open_to(e)),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:e,selected:this._data.core.selected,event:i}),n||this.trigger("changed",{action:"select_node",node:e,selected:this._data.core.selected,event:i})),void 0):!1},deselect_node:function(e,n,r){var i,o,s;if(t.isArray(e)){for(e=e.slice(),i=0,o=e.length;o>i;i++)this.deselect_node(e[i],n,r);return!0}return e=this.get_node(e),e&&"#"!==e.id?(s=this.get_node(e,!0),e.state.selected&&(e.state.selected=!1,this._data.core.selected=t.vakata.array_remove_item(this._data.core.selected,e.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:e,selected:this._data.core.selected,event:r}),n||this.trigger("changed",{action:"deselect_node",node:e,selected:this._data.core.selected,event:r})),void 0):!1},select_all:function(t){var e,n,r=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data["#"].children_d.concat(),e=0,n=this._data.core.selected.length;n>e;e++)this._model.data[this._data.core.selected[e]]&&(this._model.data[this._data.core.selected[e]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:r})},deselect_all:function(t){var e,n,r=this._data.core.selected.concat([]);for(e=0,n=this._data.core.selected.length;n>e;e++)this._model.data[this._data.core.selected[e]]&&(this._model.data[this._data.core.selected[e]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked"),this.trigger("deselect_all",{selected:this._data.core.selected,node:r}),t||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:r})},is_selected:function(t){return t=this.get_node(t),t&&"#"!==t.id?t.state.selected:!1},get_selected:function(e){return e?t.map(this._data.core.selected,t.proxy(function(t){return this.get_node(t)},this)):this._data.core.selected},get_state:function(){var t,e={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(t in this._model.data)this._model.data.hasOwnProperty(t)&&"#"!==t&&(this._model.data[t].state.opened&&e.core.open.push(t),this._model.data[t].state.selected&&e.core.selected.push(t));return e},set_state:function(n,r){if(n){if(n.core){var i,o,s,a;if(n.core.open)return t.isArray(n.core.open)?(i=!0,o=!1,s=this,t.each(n.core.open.concat([]),function(e,a){o=s.get_node(a),o&&(s.is_loaded(a)?(s.is_closed(a)&&s.open_node(a,!1,0),n&&n.core&&n.core.open&&t.vakata.array_remove_item(n.core.open,a)):(s.is_loading(a)||s.open_node(a,t.proxy(function(){this.set_state(n,r)},s),0),i=!1))}),i&&(delete n.core.open,this.set_state(n,r)),!1):(delete n.core.open,this.set_state(n,r),!1);if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==e&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==e&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,r),!1;if(n.core.selected)return a=this,this.deselect_all(),t.each(n.core.selected,function(t,e){a.select_node(e)}),delete n.core.selected,this.set_state(n,r),!1;if(t.isEmptyObject(n.core))return delete n.core,this.set_state(n,r),!1}return t.isEmptyObject(n)?(n=null,r&&r.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(e){this._data.core.state=this.get_state(),this._cnt=0,this._model.data={"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}};var n=this.get_container_ul()[0].className;e||this.element.html(""),this.load_node("#",function(e,r){r&&(this.get_container_ul()[0].className=n,this.set_state(t.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},set_id:function(e,n){if(e=this.get_node(e),!e||"#"===e.id)return!1;var r,i,o=this._model.data;for(o[e.parent].children[t.inArray(e.id,o[e.parent].children)]=n,r=0,i=e.parents.length;i>r;r++)o[e.parents[r]].children_d[t.inArray(e.id,o[e.parents[r]].children_d)]=n;for(r=0,i=e.children.length;i>r;r++)o[e.children[r]].parent=n;for(r=0,i=e.children_d.length;i>r;r++)o[e.children_d[r]].parents[t.inArray(e.id,o[e.children_d[r]].parents)]=n;return r=t.inArray(e.id,this._data.core.selected),-1!==r&&(this._data.core.selected[r]=n),r=this.get_node(e.id,!0),r&&r.attr("id",n),delete o[e.id],e.id=n,o[n]=e,!0},get_text:function(t){return t=this.get_node(t),t&&"#"!==t.id?t.text:!1},set_text:function(e,n){var r,i,o,s;if(t.isArray(e)){for(e=e.slice(),r=0,i=e.length;i>r;r++)this.set_text(e[r],n);return!0}return e=this.get_node(e),e&&"#"!==e.id?(e.text=n,o=this.get_node(e,!0),o.length&&(o=o.children(".jstree-anchor:eq(0)"),s=o.children("I").clone(),o.html(n).prepend(s),this.trigger("set_text",{obj:e,text:n})),!0):!1},get_json:function(t,e,n){if(t=this.get_node(t||"#"),!t)return!1;e&&e.flat&&!n&&(n=[]);var r,i,o={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:t.li_attr,a_attr:t.a_attr,state:{},data:e&&e.no_data?!1:t.data};if(e&&e.flat?o.parent=t.parent:o.children=[],!e||!e.no_state)for(r in t.state)t.state.hasOwnProperty(r)&&(o.state[r]=t.state[r]);if(e&&e.no_id&&(delete o.id,o.li_attr&&o.li_attr.id&&delete o.li_attr.id),e&&e.flat&&"#"!==t.id&&n.push(o),!e||!e.no_children)for(r=0,i=t.children.length;i>r;r++)e&&e.flat?this.get_json(t.children[r],e,n):o.children.push(this.get_json(t.children[r],e));return e&&e.flat?n:"#"===t.id?o.children:o},create_node:function(n,r,i,o,s){if(n=this.get_node(n),!n)return!1;if(i=i===e?"last":i,!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(n))return this.load_node(n,function(){this.create_node(n,r,i,o,!0)});r||(r={text:this.get_string("New node")}),r.text===e&&(r.text=this.get_string("New node"));var a,l,c,u;switch("#"===n.id&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":a=this.get_node(n.parent),i=t.inArray(n.id,a.children),n=a;break;case"after":a=this.get_node(n.parent),i=t.inArray(n.id,a.children)+1,n=a;break;case"inside":case"first":i=0;break;case"last":i=n.children.length;break;default:i||(i=0)}if(i>n.children.length&&(i=n.children.length),r.id||(r.id=!0),!this.check("create_node",r,n,i))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(r.id===!0&&delete r.id,r=this._parse_model_from_json(r,n.id,n.parents.concat()),!r)return!1;for(a=this.get_node(r),l=[],l.push(r),l=l.concat(a.children_d),this.trigger("model",{nodes:l,parent:n.id}),n.children_d=n.children_d.concat(l),c=0,u=n.parents.length;u>c;c++)this._model.data[n.parents[c]].children_d=this._model.data[n.parents[c]].children_d.concat(l);for(r=a,a=[],c=0,u=n.children.length;u>c;c++)a[c>=i?c+1:c]=n.children[c];return a[i]=r.id,n.children=a,this.redraw_node(n,!0),o&&o.call(this,this.get_node(r)),this.trigger("create_node",{node:this.get_node(r),parent:n.id,position:i}),r.id},rename_node:function(e,n){var r,i,o;if(t.isArray(e)){for(e=e.slice(),r=0,i=e.length;i>r;r++)this.rename_node(e[r],n);return!0}return e=this.get_node(e),e&&"#"!==e.id?(o=e.text,this.check("rename_node",e,this.get_parent(e),n)?(this.set_text(e,n),this.trigger("rename_node",{node:e,text:n,old:o}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(e){var n,r,i,o,s,a,l,c,u,h;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.delete_node(e[n]);return!0}if(e=this.get_node(e),!e||"#"===e.id)return!1;if(i=this.get_node(e.parent),o=t.inArray(e.id,i.children),h=!1,!this.check("delete_node",e,i,o))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==o&&(i.children=t.vakata.array_remove(i.children,o)),s=e.children_d.concat([]),s.push(e.id),c=0,u=s.length;u>c;c++){for(a=0,l=e.parents.length;l>a;a++)o=t.inArray(s[c],this._model.data[e.parents[a]].children_d),-1!==o&&(this._model.data[e.parents[a]].children_d=t.vakata.array_remove(this._model.data[e.parents[a]].children_d,o));this._model.data[s[c]].state.selected&&(h=!0,o=t.inArray(s[c],this._data.core.selected),-1!==o&&(this._data.core.selected=t.vakata.array_remove(this._data.core.selected,o)))}for(this.trigger("delete_node",{node:e,parent:i.id}),h&&this.trigger("changed",{action:"delete_node",node:e,selected:this._data.core.selected,parent:i.id}),c=0,u=s.length;u>c;c++)delete this._model.data[s[c]];return this.redraw_node(i,!0),!0},check:function(e,n,r,i){n=n&&n.id?n:this.get_node(n),r=r&&r.id?r:this.get_node(r);var o=e.match(/^move_node|copy_node|create_node$/i)?r:n,s=this.settings.core.check_callback;return"move_node"!==e||n.id!==r.id&&t.inArray(n.id,r.children)!==i&&-1===t.inArray(r.id,n.children_d)?(o=this.get_node(o,!0),o.length&&(o=o.data("jstree")),o&&o.functions&&(o.functions[e]===!1||o.functions[e]===!0)?(o.functions[e]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:n&&n.id?n.id:!1,par:r&&r.id?r.id:!1})}),o.functions[e]):s===!1||t.isFunction(s)&&s.call(this,e,n,r,i)===!1||s&&s[e]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:n&&n.id?n.id:!1,par:r&&r.id?r.id:!1})},!1):!0):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:e,pos:i,obj:n&&n.id?n.id:!1,par:r&&r.id?r.id:!1})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(n,r,i,o,s){var a,l,c,u,h,p,d,_,f,g,m,v,y;if(t.isArray(n)){for(n=n.reverse().slice(),a=0,l=n.length;l>a;a++)this.move_node(n[a],r,i,o,s);return!0}if(n=n&&n.id?n:this.get_node(n),r=this.get_node(r),i=i===e?0:i,!r||!n||"#"===n.id)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,function(){this.move_node(n,r,i,o,!0)});if(c=(n.parent||"#").toString(),u=i.toString().match(/^(before|after)$/)&&"#"!==r.id?this.get_node(r.parent):r,h=this._model.data[n.id]?this:t.jstree.reference(n.id),p=!h||!h._id||this._id!==h._id)return this.copy_node(n,r,i,o,s)?(h&&h.delete_node(n),!0):!1;switch("#"===u.id&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=t.inArray(r.id,u.children);break;case"after":i=t.inArray(r.id,u.children)+1;break;case"inside":case"first":i=0;break;case"last":i=u.children.length;break;default:i||(i=0)}if(i>u.children.length&&(i=u.children.length),!this.check("move_node",n,u,i))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(n.parent===u.id){for(d=u.children.concat(),_=t.inArray(n.id,d),-1!==_&&(d=t.vakata.array_remove(d,_),i>_&&i--),_=[],f=0,g=d.length;g>f;f++)_[f>=i?f+1:f]=d[f];_[i]=n.id,u.children=_,this._node_changed(u.id),this.redraw("#"===u.id)}else{for(_=n.children_d.concat(),_.push(n.id),f=0,g=n.parents.length;g>f;f++){for(d=[],y=h._model.data[n.parents[f]].children_d,m=0,v=y.length;v>m;m++)-1===t.inArray(y[m],_)&&d.push(y[m]);h._model.data[n.parents[f]].children_d=d}for(h._model.data[c].children=t.vakata.array_remove_item(h._model.data[c].children,n.id),f=0,g=u.parents.length;g>f;f++)this._model.data[u.parents[f]].children_d=this._model.data[u.parents[f]].children_d.concat(_);for(d=[],f=0,g=u.children.length;g>f;f++)d[f>=i?f+1:f]=u.children[f];for(d[i]=n.id,u.children=d,u.children_d.push(n.id),u.children_d=u.children_d.concat(n.children_d),n.parent=u.id,_=u.parents.concat(),_.unshift(u.id),y=n.parents.length,n.parents=_,_=_.concat(),f=0,g=n.children_d.length;g>f;f++)this._model.data[n.children_d[f]].parents=this._model.data[n.children_d[f]].parents.slice(0,-1*y),Array.prototype.push.apply(this._model.data[n.children_d[f]].parents,_);this._node_changed(c),this._node_changed(u.id),this.redraw("#"===c||"#"===u.id)}return o&&o.call(this,n,u,i),this.trigger("move_node",{node:n,parent:u.id,position:i,old_parent:c,is_multi:p,old_instance:h,new_instance:this}),!0},copy_node:function(n,r,i,o,s){var a,l,c,u,h,p,d,_,f,g,m;if(t.isArray(n)){for(n=n.reverse().slice(),a=0,l=n.length;l>a;a++)this.copy_node(n[a],r,i,o,s);return!0}if(n=n&&n.id?n:this.get_node(n),r=this.get_node(r),i=i===e?0:i,!r||!n||"#"===n.id)return!1;if(!i.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(r))return this.load_node(r,function(){this.copy_node(n,r,i,o,!0)});switch(_=(n.parent||"#").toString(),f=i.toString().match(/^(before|after)$/)&&"#"!==r.id?this.get_node(r.parent):r,g=this._model.data[n.id]?this:t.jstree.reference(n.id),m=!g||!g._id||this._id!==g._id,"#"===f.id&&("before"===i&&(i="first"),"after"===i&&(i="last")),i){case"before":i=t.inArray(r.id,f.children);break;case"after":i=t.inArray(r.id,f.children)+1;break;case"inside":case"first":i=0;break;case"last":i=f.children.length;break;default:i||(i=0)}if(i>f.children.length&&(i=f.children.length),!this.check("copy_node",n,f,i))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d=g?g.get_json(n,{no_id:!0,no_data:!0,no_state:!0}):n,!d)return!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,f.id,f.parents.concat()),!d)return!1;for(u=this.get_node(d),c=[],c.push(d),c=c.concat(u.children_d),this.trigger("model",{nodes:c,parent:f.id}),h=0,p=f.parents.length;p>h;h++)this._model.data[f.parents[h]].children_d=this._model.data[f.parents[h]].children_d.concat(c);for(c=[],h=0,p=f.children.length;p>h;h++)c[h>=i?h+1:h]=f.children[h];return c[i]=u.id,f.children=c,f.children_d.push(u.id),f.children_d=f.children_d.concat(u.children_d),this._node_changed(f.id),this.redraw("#"===f.id),o&&o.call(this,u,f,i),this.trigger("copy_node",{node:u,original:n,parent:f.id,position:i,old_parent:_,is_multi:m,old_instance:g,new_instance:this}),u.id},cut:function(e){if(e||(e=this._data.core.selected.concat()),t.isArray(e)||(e=[e]),!e.length)return!1;var n,r,i,l=[];for(r=0,i=e.length;i>r;r++)n=this.get_node(e[r]),n&&n.id&&"#"!==n.id&&l.push(n);return l.length?(o=l,a=this,s="move_node",this.trigger("cut",{node:e}),void 0):!1},copy:function(e){if(e||(e=this._data.core.selected.concat()),t.isArray(e)||(e=[e]),!e.length)return!1;var n,r,i,l=[];for(r=0,i=e.length;i>r;r++)n=this.get_node(e[r]),n&&n.id&&"#"!==n.id&&l.push(n);return l.length?(o=l,a=this,s="copy_node",this.trigger("copy",{node:e}),void 0):!1},get_buffer:function(){return{mode:s,node:o,inst:a}},can_paste:function(){return s!==!1&&o!==!1},paste:function(t){return t=this.get_node(t),t&&s&&s.match(/^(copy_node|move_node)$/)&&o?(this[s](o,t)&&this.trigger("paste",{parent:t.id,node:o,mode:s}),o=!1,s=!1,a=!1,void 0):!1},edit:function(e,n){if(e=this._open_to(e),!e||!e.length)return!1;var r=this._data.core.rtl,i=this.element.width(),o=e.children(".jstree-anchor"),s=t(""),a="string"==typeof n?n:this.get_text(e),l=t("
",{css:{position:"absolute",top:"-200px",left:r?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=t(" ",{value:a,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:t.proxy(function(){var t=s.children(".jstree-rename-input"),n=t.val();""===n&&(n=a),l.remove(),s.replaceWith(o),s.remove(),this.set_text(e,a),this.rename_node(e,n)===!1&&this.set_text(e,a)},this),keydown:function(t){var e=t.which;27===e&&(this.value=a),(27===e||13===e||37===e||38===e||39===e||40===e||32===e)&&t.stopImmediatePropagation(),(27===e||13===e)&&(t.preventDefault(),this.blur())},click:function(t){t.stopImmediatePropagation()},mousedown:function(t){t.stopImmediatePropagation()},keyup:function(){c.width(Math.min(l.text("pW"+this.value).width(),i))},keypress:function(t){return 13===t.which?!1:void 0}}),u={fontFamily:o.css("fontFamily")||"",fontSize:o.css("fontSize")||"",fontWeight:o.css("fontWeight")||"",fontStyle:o.css("fontStyle")||"",fontStretch:o.css("fontStretch")||"",fontVariant:o.css("fontVariant")||"",letterSpacing:o.css("letterSpacing")||"",wordSpacing:o.css("wordSpacing")||""};this.set_text(e,""),s.attr("class",o.attr("class")).append(o.contents().clone()).append(c),o.replaceWith(s),l.css(u),c.css(u).width(Math.min(l.text("pW"+c[0].value).width(),i))[0].select()},set_theme:function(e,n){if(!e)return!1;if(n===!0){var r=this.settings.core.themes.dir;r||(r=t.jstree.path+"/themes"),n=r+"/"+e+"/style.css"}n&&-1===t.inArray(n,l)&&(t("head").append(' '),l.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=e,this.element.addClass("jstree-"+e),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+e+"-responsive"),this.trigger("set_theme",{theme:e})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(t){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=t,t&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(e,n){var r,i,o,s;if(t.isArray(e)){for(e=e.slice(),r=0,i=e.length;i>r;r++)this.set_icon(e[r],n);return!0}return e=this.get_node(e),e&&"#"!==e.id?(s=e.icon,e.icon=n,o=this.get_node(e,!0).children(".jstree-anchor").children(".jstree-themeicon"),n===!1?this.hide_icon(e):n===!0?o.removeClass("jstree-themeicon-custom "+s).css("background","").removeAttr("rel"):-1===n.indexOf("/")&&-1===n.indexOf(".")?(o.removeClass(s).css("background",""),o.addClass(n+" jstree-themeicon-custom").attr("rel",n)):(o.removeClass(s).css("background",""),o.addClass("jstree-themeicon-custom").css("background","url('"+n+"') center center no-repeat").attr("rel",n)),!0):!1},get_icon:function(t){return t=this.get_node(t),t&&"#"!==t.id?t.icon:!1},hide_icon:function(e){var n,r;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.hide_icon(e[n]);return!0}return e=this.get_node(e),e&&"#"!==e?(e.icon=!1,this.get_node(e,!0).children("a").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(e){var n,r,i;if(t.isArray(e)){for(e=e.slice(),n=0,r=e.length;r>n;n++)this.show_icon(e[n]);return!0}return e=this.get_node(e),e&&"#"!==e?(i=this.get_node(e,!0),e.icon=i.length?i.children("a").children(".jstree-themeicon").attr("rel"):!0,e.icon||(e.icon=!0),i.children("a").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},t.vakata={},t.fn.vakata_reverse=[].reverse,t.vakata.attributes=function(e,n){e=t(e)[0];var r=n?{}:[];return e&&e.attributes&&t.each(e.attributes,function(e,i){-1===t.inArray(i.nodeName.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==i.nodeValue&&""!==t.trim(i.nodeValue)&&(n?r[i.nodeName]=i.nodeValue:r.push(i.nodeName))}),r},t.vakata.array_unique=function(t){var e,n,r,i=[];for(e=0,r=t.length;r>e;e++){for(n=0;e>=n&&t[e]!==t[n];n++);n===e&&i.push(t[e])}return i},t.vakata.array_remove=function(t,e,n){var r=t.slice((n||e)+1||t.length);return t.length=0>e?t.length+e:e,t.push.apply(t,r),t},t.vakata.array_remove_item=function(e,n){var r=t.inArray(n,e);return-1!==r?t.vakata.array_remove(e,r):e},function(){var e={},n=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},r=n(window.navigator.userAgent);r.browser&&(e[r.browser]=!0,e.version=r.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),t.vakata.browser=e}(),t.vakata.browser.msie&&t.vakata.browser.version<8&&(t.jstree.defaults.core.animation=0);var p=document.createElement("I");p.className="jstree-icon jstree-checkbox",t.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0},t.jstree.plugins.checkbox=function(e,n){this.bind=function(){n.bind.call(this),this._data.checkbox.uto=!1,this.element.on("init.jstree",t.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked")
},this)).on("loading.jstree",t.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),this.settings.checkbox.three_state&&this.element.on("changed.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",t.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(t.proxy(this._undetermined,this),50)},this)).on("model.jstree",t.proxy(function(e,n){var r,i,o,s,a,l,c=this._model.data,u=c[n.parent],h=n.nodes,p=[];if(u.state.selected){for(i=0,o=h.length;o>i;i++)c[h[i]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(h)}else for(i=0,o=h.length;o>i;i++)if(c[h[i]].state.selected){for(s=0,a=c[h[i]].children_d.length;a>s;s++)c[c[h[i]].children_d[s]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(c[h[i]].children_d)}for(i=0,o=u.children_d.length;o>i;i++)c[u.children_d[i]].children.length||p.push(c[u.children_d[i]].parent);for(p=t.vakata.array_unique(p),s=0,a=p.length;a>s;s++)for(u=c[p[s]];u&&"#"!==u.id;){for(r=0,i=0,o=u.children.length;o>i;i++)r+=c[u.children[i]].state.selected;if(r!==o)break;u.state.selected=!0,this._data.core.selected.push(u.id),l=this.get_node(u,!0),l&&l.length&&l.children(".jstree-anchor").addClass("jstree-clicked"),u=this.get_node(u.parent)}this._data.core.selected=t.vakata.array_unique(this._data.core.selected)},this)).on("select_node.jstree",t.proxy(function(e,n){var r,i,o,s,a=n.node,l=this._model.data,c=this.get_node(a.parent),u=this.get_node(a,!0);for(this._data.core.selected=t.vakata.array_unique(this._data.core.selected.concat(a.children_d)),r=0,i=a.children_d.length;i>r;r++)l[a.children_d[r]].state.selected=!0;for(;c&&"#"!==c.id;){for(o=0,r=0,i=c.children.length;i>r;r++)o+=l[c.children[r]].state.selected;if(o!==i)break;c.state.selected=!0,this._data.core.selected.push(c.id),s=this.get_node(c,!0),s&&s.length&&s.children(".jstree-anchor").addClass("jstree-clicked"),c=this.get_node(c.parent)}u.length&&u.find(".jstree-anchor").addClass("jstree-clicked")},this)).on("deselect_node.jstree",t.proxy(function(e,n){var r,i,o,s=n.node,a=this.get_node(s,!0);for(r=0,i=s.children_d.length;i>r;r++)this._model.data[s.children_d[r]].state.selected=!1;for(r=0,i=s.parents.length;i>r;r++)this._model.data[s.parents[r]].state.selected=!1,o=this.get_node(s.parents[r],!0),o&&o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked");for(o=[],r=0,i=this._data.core.selected.length;i>r;r++)-1===t.inArray(this._data.core.selected[r],s.children_d)&&-1===t.inArray(this._data.core.selected[r],s.parents)&&o.push(this._data.core.selected[r]);this._data.core.selected=t.vakata.array_unique(o),a.length&&a.find(".jstree-anchor").removeClass("jstree-clicked")},this)).on("delete_node.jstree",t.proxy(function(t,e){for(var n,r,i,o,s=this.get_node(e.parent),a=this._model.data;s&&"#"!==s.id;){for(i=0,n=0,r=s.children.length;r>n;n++)i+=a[s.children[n]].state.selected;if(i!==r)break;s.state.selected=!0,this._data.core.selected.push(s.id),o=this.get_node(s,!0),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked"),s=this.get_node(s.parent)}},this)).on("move_node.jstree",t.proxy(function(e,n){var r,i,o,s,a,l=n.is_multi,c=n.old_parent,u=this.get_node(n.parent),h=this._model.data;if(!l)for(r=this.get_node(c);r&&"#"!==r.id;){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state.selected;if(i!==s)break;r.state.selected=!0,this._data.core.selected.push(r.id),a=this.get_node(r,!0),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"),r=this.get_node(r.parent)}for(r=u;r&&"#"!==r.id;){for(i=0,o=0,s=r.children.length;s>o;o++)i+=h[r.children[o]].state.selected;if(i===s)r.state.selected||(r.state.selected=!0,this._data.core.selected.push(r.id),a=this.get_node(r,!0),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"));else{if(!r.state.selected)break;r.state.selected=!1,this._data.core.selected=t.vakata.array_remove_item(this._data.core.selected,r.id),a=this.get_node(r,!0),a&&a.length&&a.children(".jstree-anchor").removeClass("jstree-clicked")}r=this.get_node(r.parent)}},this))},this._undetermined=function(){var e,n,r=this._model.data,i=this._data.core.selected,o=[],s=this;for(e=0,n=i.length;n>e;e++)r[i[e]]&&r[i[e]].parents&&(o=o.concat(r[i[e]].parents));for(this.element.find(".jstree-closed").not(":has(ul)").each(function(){var t=s.get_node(this);!t.state.loaded&&t.original&&t.original.state&&t.original.state.undetermined&&t.original.state.undetermined===!0&&(o.push(t.id),o=o.concat(t.parents))}),o=t.vakata.array_unique(o),e=t.inArray("#",o),-1!==e&&(o=t.vakata.array_remove(o,e)),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,n=o.length;n>e;e++)r[o[e]].state.selected||(i=this.get_node(o[e],!0),i&&i.length&&i.children("a").children(".jstree-checkbox").addClass("jstree-undetermined"))},this.redraw_node=function(e,r,i){if(e=n.redraw_node.call(this,e,r,i)){var o=e.getElementsByTagName("A")[0];o.insertBefore(p.cloneNode(),o.childNodes[0])}return!i&&this.settings.checkbox.three_state&&(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(t.proxy(this._undetermined,this),50)),e},this.activate_node=function(e,r){return(this.settings.checkbox.whole_node||t(r.target).hasClass("jstree-checkbox"))&&(r.ctrlKey=!0),n.activate_node.call(this,e,r)},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.element.children("ul").removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.element.children("ul").addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()}},t.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.create_node(r,{},"last",function(t){setTimeout(function(){n.edit(t)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.is_selected(r)?n.delete_node(n.get_selected()):n.delete_node(r)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.is_selected(r)?n.cut(n.get_selected()):n.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.is_selected(r)?n.copy(n.get_selected()):n.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(e){return!t.jstree.reference(e.reference).can_paste()},separator_after:!1,label:"Paste",action:function(e){var n=t.jstree.reference(e.reference),r=n.get_node(e.reference);n.paste(r)}}}}}}},t.jstree.plugins.contextmenu=function(n,r){this.bind=function(){r.bind.call(this),this.element.on("contextmenu.jstree",".jstree-anchor",t.proxy(function(t){t.preventDefault(),this.is_loading(t.currentTarget)||this.show_contextmenu(t.currentTarget,t.pageX,t.pageY,t)},this)).on("click.jstree",".jstree-anchor",t.proxy(function(){this._data.contextmenu.visible&&t.vakata.context.hide()},this)),t(document).on("context_hide.vakata",t.proxy(function(){this._data.contextmenu.visible=!1},this))},this.teardown=function(){this._data.contextmenu.visible&&t.vakata.context.hide(),r.teardown.call(this)},this.show_contextmenu=function(n,r,i,o){if(n=this.get_node(n),!n||"#"===n.id)return!1;var s=this.settings.contextmenu,a=this.get_node(n,!0),l=a.children(".jstree-anchor"),c=!1,u=!1;(s.show_at_node||r===e||i===e)&&(c=l.offset(),r=c.left,i=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&(this.deselect_all(),this.select_node(n,!1,!1,o)),u=s.items,t.isFunction(u)&&(u=u.call(this,n,t.proxy(function(t){this._show_contextmenu(n,r,i,t)},this))),t.isPlainObject(u)&&this._show_contextmenu(n,r,i,u)},this._show_contextmenu=function(e,n,r,i){var o=this.get_node(e,!0),s=o.children(".jstree-anchor");t(document).one("context_show.vakata",t.proxy(function(e,n){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";t(n.element).addClass(r)},this)),this._data.contextmenu.visible=!0,t.vakata.context.show(s,{x:n,y:r},i),this.trigger("show_contextmenu",{node:e,x:n,y:r})}},function(t){var e=!1,n={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};t.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(e){t(document).triggerHandler("context_"+e+".vakata",{reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_execute:function(e){return e=n.items[e],e&&(!e._disabled||t.isFunction(e._disabled)&&!e._disabled({item:e,reference:n.reference,element:n.element}))&&e.action?e.action.call(null,{item:e,reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}}):!1},_parse:function(e,r){if(!e)return!1;r||(n.html="",n.items=[]);var i,o="",s=!1;return r&&(o+=""),t.each(e,function(e,r){return r?(n.items.push(r),!s&&r.separator_before&&(o+=" <"+"/a><"+"/li>"),s=!1,o+="",r.separator_after&&(o+=" <"+"/a><"+"/li>",s=!0),void 0):!0}),o=o.replace(/<\/li\>$/,""),r&&(o+=" "),r||(n.html=o,t.vakata.context._trigger("parse")),o.length>10?o:!1},_show_submenu:function(n){if(n=t(n),n.length&&n.children("ul").length){var r=n.children("ul"),i=n.offset().left+n.outerWidth(),o=n.offset().top,s=r.width(),a=r.height(),l=t(window).width()+t(window).scrollLeft(),c=t(window).height()+t(window).scrollTop();e?n[i-(s+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[i+s+10>l?"addClass":"removeClass"]("vakata-context-right"),o+a+10>c&&r.css("bottom","-1px"),r.show()}},show:function(r,i,o){var s,a,l,c,u,h,p,d,_=!0;switch(n.element&&n.element.length&&n.element.width(""),_){case!i&&!r:return!1;case!!i&&!!r:n.reference=r,n.position_x=i.x,n.position_y=i.y;break;case!i&&!!r:n.reference=r,s=r.offset(),n.position_x=s.left+r.outerHeight(),n.position_y=s.top;break;case!!i&&!r:n.position_x=i.x,n.position_y=i.y}r&&!o&&t(r).data("vakata_contextmenu")&&(o=t(r).data("vakata_contextmenu")),t.vakata.context._parse(o)&&n.element.html(n.html),n.items.length&&(a=n.element,l=n.position_x,c=n.position_y,u=a.width(),h=a.height(),p=t(window).width()+t(window).scrollLeft(),d=t(window).height()+t(window).scrollTop(),e&&(l-=a.outerWidth(),lp&&(l=p-(u+20)),c+h+20>d&&(c=d-(h+20)),n.element.css({left:l,top:c}).show().find("a:eq(0)").focus().parent().addClass("vakata-context-hover"),n.is_visible=!0,t.vakata.context._trigger("show"))},hide:function(){n.is_visible&&(n.element.hide().find("ul").hide().end().find(":focus").blur(),n.is_visible=!1,t.vakata.context._trigger("hide"))}},t(function(){e="rtl"===t("body").css("direction");var r=!1;n.element=t(""),n.element.on("mouseenter","li",function(e){e.stopImmediatePropagation(),t.contains(this,e.relatedTarget)||(r&&clearTimeout(r),n.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),t(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),t.vakata.context._show_submenu(this))}).on("mouseleave","li",function(e){t.contains(this,e.relatedTarget)||t(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(){t(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),t.vakata.context.settings.hide_onmouseleave&&(r=setTimeout(function(){return function(){t.vakata.context.hide()}}(this),t.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault()}).on("mouseup","a",function(){t(this).blur().parent().hasClass("vakata-context-disabled")||t.vakata.context._execute(t(this).attr("rel"))===!1||t.vakata.context.hide()}).on("keydown","a",function(e){var r=null;switch(e.which){case 13:case 32:e.type="mouseup",e.preventDefault(),t(e.currentTarget).trigger(e);break;case 37:n.is_visible&&(n.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 38:n.is_visible&&(r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),r.length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),r.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 39:n.is_visible&&(n.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 40:n.is_visible&&(r=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),r.length||(r=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),r.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 27:t.vakata.context.hide(),e.preventDefault()}}).on("keydown",function(t){t.preventDefault();var e=n.element.find(".vakata-contextmenu-shortcut-"+t.which).parent();e.parent().not(".vakata-context-disabled")&&e.mouseup()}).appendTo("body"),t(document).on("mousedown",function(e){n.is_visible&&!t.contains(n.element[0],e.target)&&t.vakata.context.hide()}).on("context_show.vakata",function(){n.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),e&&n.element.addClass("vakata-context-rtl").css("direction","rtl"),n.element.find("ul").hide().end()})})}(t),t.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0},t.jstree.plugins.dnd=function(e,n){this.bind=function(){n.bind.call(this),this.element.on("mousedown touchstart",".jstree-anchor",t.proxy(function(e){var n=this.get_node(e.target),r=this.is_selected(n)?this.get_selected().length:1;return n&&n.id&&"#"!==n.id&&(1===e.which||"touchstart"===e.type)&&(this.settings.dnd.is_draggable===!0||t.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,n))?(this.element.trigger("mousedown.jstree"),t.vakata.dnd.start(e,{jstree:!0,origin:this,obj:this.get_node(n,!0),nodes:r>1?this.get_selected():[n.id]},' '+(r>1?r+" "+this.get_string("nodes"):this.get_text(e.currentTarget,!0))+'+
')):void 0},this))}},t(function(){var e=!1,n=!1,r=!1,i=t('
').hide().appendTo("body");t(document).bind("dnd_start.vakata",function(){e=!1}).bind("dnd_move.vakata",function(o,s){if(r&&clearTimeout(r),s.data.jstree&&(!s.event.target.id||"jstree-marker"!==s.event.target.id)){var a,l,c,u,h,p,d,_,f,g,m,v,y=t.jstree.reference(s.event.target),b=!1,w=!1,x=!1;if(y&&y._data&&y._data.dnd)if(i.attr("class","jstree-"+y.get_theme()),s.helper.children().attr("class","jstree-"+y.get_theme()).find(".jstree-copy:eq(0)")[s.data.origin&&s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)?"show":"hide"](),s.event.target!==y.element[0]&&s.event.target!==y.get_container_ul()[0]||0!==y.get_container_ul().children().length){if(b=t(s.event.target).closest("a"),b&&b.length&&b.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(w=b.offset(),x=s.event.pageY-w.top,c=b.height(),p=c/3>x?["b","i","a"]:x>c-c/3?["a","i","b"]:x>c/2?["i","a","b"]:["i","b","a"],t.each(p,function(o,x){switch(x){case"b":a=w.left-6,l=w.top-5,u=y.get_parent(b),h=b.parent().index();break;case"i":a=w.left-2,l=w.top-5+c/2+1,u=b.parent(),h=0;break;case"a":a=w.left-6,l=w.top-5+c,u=y.get_parent(b),h=b.parent().index()+1}for(d=!0,_=0,f=s.data.nodes.length;f>_;_++)if(g=s.data.origin&&s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)?"copy_node":"move_node",m=h,"move_node"===g&&"a"===x&&s.data.origin&&s.data.origin===y&&u===y.get_parent(s.data.nodes[_])&&(v=y.get_node(u),m>t.inArray(s.data.nodes[_],v.children)&&(m-=1)),d=d&&(y&&y.settings&&y.settings.dnd&&y.settings.dnd.check_while_dragging===!1||y.check(g,s.data.origin&&s.data.origin!==y?s.data.origin.get_node(s.data.nodes[_]):s.data.nodes[_],u,m)),!d){y&&y.last_error&&(n=y.last_error());break}return d?("i"===x&&b.parent().is(".jstree-closed")&&y.settings.dnd.open_timeout&&(r=setTimeout(function(t,e){return function(){t.open_node(e)}}(y,b),y.settings.dnd.open_timeout)),e={ins:y,par:u,pos:h},i.css({left:a+"px",top:l+"px"}).show(),s.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),n={},p=!0,!1):void 0}),p===!0))return}else{for(d=!0,_=0,f=s.data.nodes.length;f>_&&(d=d&&y.check(s.data.origin&&s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)?"copy_node":"move_node",s.data.origin&&s.data.origin!==y?s.data.origin.get_node(s.data.nodes[_]):s.data.nodes[_],"#","last"),d);_++);if(d)return e={ins:y,par:"#",pos:"last"},i.hide(),s.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),void 0}e=!1,s.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.hide()}}).bind("dnd_scroll.vakata",function(t,n){n.data.jstree&&(i.hide(),e=!1,n.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(o,s){if(r&&clearTimeout(r),s.data.jstree){i.hide();var a,l,c=[];if(e){for(a=0,l=s.data.nodes.length;l>a;a++)c[a]=s.data.origin?s.data.origin.get_node(s.data.nodes[a]):s.data.nodes[a];e.ins[s.data.origin&&s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)?"copy_node":"move_node"](c,e.par,e.pos)}else a=t(s.event.target).closest(".jstree"),a.length&&n&&n.error&&"check"===n.error&&(a=a.jstree(!0),a&&a.settings.core.error.call(this,n))}}).bind("keyup keydown",function(e,n){n=t.vakata.dnd._get(),n.data&&n.data.jstree&&n.helper.find(".jstree-copy:eq(0)")[n.data.origin&&n.data.origin.settings.dnd.copy&&(e.metaKey||e.ctrlKey)?"show":"hide"]()})}),function(t){t.fn.vakata_reverse=[].reverse;var e={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1};t.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5},_trigger:function(e,n){var r=t.vakata.dnd._get();r.event=n,t(document).triggerHandler("dnd_"+e+".vakata",r)},_get:function(){return{data:e.data,element:e.element,helper:e.helper}},_clean:function(){e.helper&&e.helper.remove(),e.scroll_i&&(clearInterval(e.scroll_i),e.scroll_i=!1),e={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1},t(document).off("mousemove touchmove",t.vakata.dnd.drag),t(document).off("mouseup touchend",t.vakata.dnd.stop)},_scroll:function(n){if(!e.scroll_e||!e.scroll_l&&!e.scroll_t)return e.scroll_i&&(clearInterval(e.scroll_i),e.scroll_i=!1),!1;if(!e.scroll_i)return e.scroll_i=setInterval(t.vakata.dnd._scroll,100),!1;if(n===!0)return!1;var r=e.scroll_e.scrollTop(),i=e.scroll_e.scrollLeft();e.scroll_e.scrollTop(r+e.scroll_t*t.vakata.dnd.settings.scroll_speed),e.scroll_e.scrollLeft(i+e.scroll_l*t.vakata.dnd.settings.scroll_speed),(r!==e.scroll_e.scrollTop()||i!==e.scroll_e.scrollLeft())&&t.vakata.dnd._trigger("scroll",e.scroll_e)},start:function(n,r,i){"touchstart"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),e.is_drag&&t.vakata.dnd.stop({});try{n.currentTarget.unselectable="on",n.currentTarget.onselectstart=function(){return!1},n.currentTarget.style&&(n.currentTarget.style.MozUserSelect="none")}catch(o){}return e.init_x=n.pageX,e.init_y=n.pageY,e.data=r,e.is_down=!0,e.element=n.currentTarget,i!==!1&&(e.helper=t("
").html(i).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),t(document).bind("mousemove touchmove",t.vakata.dnd.drag),t(document).bind("mouseup touchend",t.vakata.dnd.stop),!1},drag:function(n){if("touchmove"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),e.is_down){if(!e.is_drag){if(!(Math.abs(n.pageX-e.init_x)>t.vakata.dnd.settings.threshold||Math.abs(n.pageY-e.init_y)>t.vakata.dnd.settings.threshold))return;e.helper&&(e.helper.appendTo("body"),e.helper_w=e.helper.outerWidth()),e.is_drag=!0,t.vakata.dnd._trigger("start",n)}var r=!1,i=!1,o=!1,s=!1,a=!1,l=!1,c=!1,u=!1,h=!1,p=!1;e.scroll_t=0,e.scroll_l=0,e.scroll_e=!1,t(n.target).parentsUntil("body").addBack().vakata_reverse().filter(function(){return/^auto|scroll$/.test(t(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var r=t(this),i=r.offset();return this.scrollHeight>this.offsetHeight&&(i.top+r.height()-n.pageYthis.offsetWidth&&(i.left+r.width()-n.pageXs&&n.pageY-cs&&s-(n.pageY-c)l&&n.pageX-ul&&l-(n.pageX-u)o&&(h=o-50),a&&p+e.helper_w>a&&(p=a-(e.helper_w+2)),e.helper.css({left:p+"px",top:h+"px"})),t.vakata.dnd._trigger("move",n)}},stop:function(n){"touchend"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),e.is_drag&&t.vakata.dnd._trigger("stop",n),t.vakata.dnd._clean()}}}(jQuery),t.jstree.defaults.search={ajax:!1,fuzzy:!0,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0},t.jstree.plugins.search=function(e,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=t(),this._data.search.res=[],this._data.search.opn=[],this._data.search.sln=null,this.settings.search.show_only_matches&&this.element.on("search.jstree",function(e,n){n.nodes.length&&(t(this).find("li").hide().filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last"),n.nodes.parentsUntil(".jstree").addBack().show().filter("ul").each(function(){t(this).children("li:visible").eq(-1).addClass("jstree-last")}))}).on("clear_search.jstree",function(e,n){n.nodes.length&&t(this).find("li").css("display","").filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last")})},this.search=function(e,n){if(e===!1||""===t.trim(e))return this.clear_search();var r,i,o=this.settings.search,s=o.ajax?t.extend({},o.ajax):!1,a=null,l=[],c=[];if(this._data.search.res.length&&this.clear_search(),!n&&s!==!1)return s.data||(s.data={}),s.data.str=e,t.ajax(s).fail(t.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(s)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(t.proxy(function(n){n&&n.d&&(n=n.d),this._data.search.sln=t.isArray(n)?n:[],this._search_load(e)},this));if(this._data.search.str=e,this._data.search.dom=t(),this._data.search.res=[],this._data.search.opn=[],a=new t.vakata.search(e,!0,{caseSensitive:o.case_sensitive,fuzzy:o.fuzzy}),t.each(this._model.data,function(t,e){e.text&&a.search(e.text).isMatch&&(l.push(t),c=c.concat(e.parents))}),l.length){for(c=t.vakata.array_unique(c),this._search_open(c),r=0,i=l.length;i>r;r++)a=this.get_node(l[r],!0),a&&(this._data.search.dom=this._data.search.dom.add(a));this._data.search.res=l,this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:e,res:this._data.search.res})},this.clear_search=function(){this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"),this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=t()},this._search_open=function(e){var n=this;t.each(e.concat([]),function(t,r){r=document.getElementById(r),r&&n.is_closed(r)&&(n._data.search.opn.push(r.id),n.open_node(r,function(){n._search_open(e)},0))})},this._search_load=function(e){var n=!0,r=this,i=r._model.data;t.isArray(this._data.search.sln)&&(this._data.search.sln.length?(t.each(this._data.search.sln,function(o,s){i[s]&&(t.vakata.array_remove_item(r._data.search.sln,s),i[s].state.loaded||(r.load_node(s,function(t,n){n&&r._search_load(e)}),n=!1))}),n&&(this._data.search.sln=[],this._search_load(e))):(this._data.search.sln=null,this.search(e,!0)))}},function(t){t.vakata.search=function(t,e,n){n=n||{},n.fuzzy!==!1&&(n.fuzzy=!0),t=n.caseSensitive?t:t.toLowerCase();var r,i,o,s,a=n.location||0,l=n.distance||100,c=n.threshold||.6,u=t.length;return u>32&&(n.fuzzy=!1),n.fuzzy&&(r=1<n;n++)e[t.charAt(n)]=0;for(n=0;u>n;n++)e[t.charAt(n)]|=1<s;s++){for(h=0,p=w;p>h;)o(s,a+p)<=y?h=p:w=p,p=Math.floor((w-h)/2+h);for(w=p,_=Math.max(1,a-p+1),f=Math.min(a+p,v)+u,g=new Array(f+2),g[f+1]=(1<=_;l--)if(m=i[e.charAt(l-1)],g[l]=0===s?(1|g[l+1]<<1)&m:(1|g[l+1]<<1)&m|(1|(d[l+1]|d[l])<<1)|d[l+1],g[l]&r&&(x=o(s,l-1),y>=x)){if(y=x,b=l-1,k.push(b),!(b>a))break;_=Math.max(1,2*a-b)}if(o(s+1,a)>y)break;d=g}return{isMatch:b>=0,score:x}},e===!0?{search:s}:s(e)}}(jQuery),t.jstree.defaults.sort=function(t,e){return this.get_text(t)>this.get_text(e)?1:-1},t.jstree.plugins.sort=function(e,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",t.proxy(function(t,e){this.sort(e.parent,!0)},this)).on("rename_node.jstree create_node.jstree",t.proxy(function(t,e){this.sort(e.parent||e.node.parent,!1),this.redraw_node(e.parent||e.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",t.proxy(function(t,e){this.sort(e.parent,!1),this.redraw_node(e.parent,!0)},this))},this.sort=function(e,n){var r,i;if(e=this.get_node(e),e&&e.children&&e.children.length&&(e.children.sort(t.proxy(this.settings.sort,this)),n))for(r=0,i=e.children_d.length;i>r;r++)this.sort(e.children_d[r],!1)}};var d=!1;t.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree",ttl:!1,filter:!1},t.jstree.plugins.state=function(e,n){this.bind=function(){n.bind.call(this);var e=t.proxy(function(){this.element.on(this.settings.state.events,t.proxy(function(){d&&clearTimeout(d),d=setTimeout(t.proxy(function(){this.save_state()},this),100)},this))},this);this.element.on("ready.jstree",t.proxy(function(){this.element.one("restore_state.jstree",e),this.restore_state()||e()},this))},this.save_state=function(){var e={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};t.vakata.storage.set(this.settings.state.key,JSON.stringify(e))},this.restore_state=function(){var e=t.vakata.storage.get(this.settings.state.key);if(e)try{e=JSON.parse(e)}catch(n){return!1}return e&&e.ttl&&e.sec&&+new Date-e.sec>e.ttl?!1:(e&&e.state&&(e=e.state),e&&t.isFunction(this.settings.state.filter)&&(e=this.settings.state.filter.call(this,e)),e?(this.element.one("set_state.jstree",function(n,r){r.instance.trigger("restore_state",{state:t.extend(!0,{},e)})}),this.set_state(e),!0):!1)},this.clear_state=function(){return t.vakata.storage.del(this.settings.state.key)}},function(t){t.vakata.storage={set:function(t,e){return window.localStorage.setItem(t,e)},get:function(t){return window.localStorage.getItem(t)},del:function(t){return window.localStorage.removeItem(t)}}}(jQuery),t.jstree.defaults.types={"#":{},"default":{}},t.jstree.plugins.types=function(n,r){this.init=function(t,n){var i,o;if(n&&n.types&&n.types["default"])for(i in n.types)if("default"!==i&&"#"!==i&&n.types.hasOwnProperty(i))for(o in n.types["default"])n.types["default"].hasOwnProperty(o)&&n.types[i][o]===e&&(n.types[i][o]=n.types["default"][o]);r.init.call(this,t,n),this._model.data["#"].type="#"},this.bind=function(){r.bind.call(this),this.element.on("model.jstree",t.proxy(function(t,n){var r,i,o=this._model.data,s=n.nodes,a=this.settings.types,l="default";for(r=0,i=s.length;i>r;r++)l="default",o[s[r]].original&&o[s[r]].original.type&&a[o[s[r]].original.type]&&(l=o[s[r]].original.type),o[s[r]].data&&o[s[r]].data.jstree&&o[s[r]].data.jstree.type&&a[o[s[r]].data.jstree.type]&&(l=o[s[r]].data.jstree.type),o[s[r]].type=l,o[s[r]].icon===!0&&a[l].icon!==e&&(o[s[r]].icon=a[l].icon)
},this))},this.get_json=function(e,n,i){var o,s,a=this._model.data,l=n?t.extend(!0,{},n,{no_id:!1}):{},c=r.get_json.call(this,e,l,i);if(c===!1)return!1;if(t.isArray(c))for(o=0,s=c.length;s>o;o++)c[o].type=c[o].id&&a[c[o].id]&&a[c[o].id].type?a[c[o].id].type:"default",n&&n.no_id&&(delete c[o].id,c[o].li_attr&&c[o].li_attr.id&&delete c[o].li_attr.id);else c.type=c.id&&a[c.id]&&a[c.id].type?a[c.id].type:"default",n&&n.no_id&&(c=this._delete_ids(c));return c},this._delete_ids=function(e){if(t.isArray(e)){for(var n=0,r=e.length;r>n;n++)e[n]=this._delete_ids(e[n]);return e}return delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.children&&t.isArray(e.children)&&(e.children=this._delete_ids(e.children)),e},this.check=function(n,i,o,s){if(r.check.call(this,n,i,o,s)===!1)return!1;i=i&&i.id?i:this.get_node(i),o=o&&o.id?o:this.get_node(o);var a,l,c,u,h=i&&i.id?t.jstree.reference(i.id):null;switch(h=h&&h._model&&h._model.data?h._model.data:null,n){case"create_node":case"move_node":case"copy_node":if("move_node"!==n||-1===t.inArray(i.id,o.children)){if(a=this.get_rules(o),a.max_children!==e&&-1!==a.max_children&&a.max_children===o.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:i&&i.id?i.id:!1,par:o&&o.id?o.id:!1})},!1;if(a.valid_children!==e&&-1!==a.valid_children&&-1===t.inArray(i.type,a.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+n,data:JSON.stringify({chk:n,pos:s,obj:i&&i.id?i.id:!1,par:o&&o.id?o.id:!1})},!1;if(h&&i.children_d&&i.parents){for(l=0,c=0,u=i.children_d.length;u>c;c++)l=Math.max(l,h[i.children_d[c]].parents.length);l=l-i.parents.length+1}(0>=l||l===e)&&(l=1);do{if(a.max_depth!==e&&-1!==a.max_depth&&a.max_deptho;o++)this.set_type(n[o],r);return!0}return i=this.settings.types,n=this.get_node(n),i[r]&&n?(a=n.type,l=this.get_icon(n),n.type=r,(l===!0||i[a]&&i[a].icon&&l===i[a].icon)&&this.set_icon(n,i[r].icon!==e?i[r].icon:!0),!0):!1}},t.jstree.plugins.unique=function(e,n){this.check=function(e,r,i,o){if(n.check.call(this,e,r,i,o)===!1)return!1;if(r=r&&r.id?r:this.get_node(r),i=i&&i.id?i:this.get_node(i),!i||!i.children)return!0;var s,a,l="rename_node"===e?o:r.text,c=[],u=this._model.data;for(s=0,a=i.children.length;a>s;s++)c.push(u[i.children[s]].text);switch(e){case"delete_node":return!0;case"rename_node":case"copy_node":return s=-1===t.inArray(l,c),s||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+l+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:o,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})}),s;case"move_node":return s=r.parent===i.id||-1===t.inArray(l,c),s||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+l+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:o,obj:r&&r.id?r.id:!1,par:i&&i.id?i.id:!1})}),s}return!0}};var _=document.createElement("DIV");_.setAttribute("unselectable","on"),_.className="jstree-wholerow",_.innerHTML=" ",t.jstree.plugins.wholerow=function(e,n){this.bind=function(){n.bind.call(this),this.element.on("loading",t.proxy(function(){_.style.height=this._data.core.li_height+"px"},this)).on("ready.jstree set_state.jstree",t.proxy(function(){this.hide_dots()},this)).on("ready.jstree",t.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",t.proxy(function(){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",t.proxy(function(t,e){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var n,r,i=!1;for(n=0,r=e.selected.length;r>n;n++)i=this.get_node(e.selected[n],!0),i&&i.length&&i.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",t.proxy(function(t,e){this.get_node(e.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",t.proxy(function(t,e){this.get_node(e.node,!0).children(".jstree-wholerow")["hover_node"===t.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",t.proxy(function(e){e.preventDefault(),t(e.currentTarget).closest("li").children("a:eq(0)").trigger("contextmenu",e)},this)).on("click.jstree",".jstree-wholerow",function(e){e.stopImmediatePropagation();var n=t.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});t(e.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",t.proxy(function(e){e.stopImmediatePropagation();var n=t.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});t(e.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",t.proxy(function(t){return t.stopImmediatePropagation(),this.hover_node(t.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",t.proxy(function(t){this.dehover_node(t.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(e,r,i){if(e=n.redraw_node.call(this,e,r,i)){var o=_.cloneNode(!0);-1!==t.inArray(e.id,this._data.core.selected)&&(o.className+=" jstree-wholerow-clicked"),e.insertBefore(o,e.childNodes[0])}return e}}}}),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n("util/object_explorer",["underscore","jquery","jstree","common/continuum_view","common/has_properties"],function(n,o,s,a,l){var c,u;return c=function(s){function a(){return this.createContextMenu=t(this.createContextMenu,this),this.onEvent=t(this.onEvent,this),u=a.__super__.constructor.apply(this,arguments)}return i(a,s),a.prototype.initialize=function(t){return a.__super__.initialize.call(this,t),this.onEvent=n.debounce(this.onEvent,t.debounce||200),this.showToolbar=t.showToolbar||!1,this.arrayLimit=t.arrayLimit||100,this.render()},a.prototype.base=function(){return null==this._base&&(this._base=e("common/base")),this._base},a.prototype.delegateEvents=function(t){var e,r,i,o,s;for(a.__super__.delegateEvents.call(this,t),o=n.keys(this.base().locations),s=[],r=0,i=o.length;i>r;r++)e=o[r],s.push(this.base().Collections(e).on("all",this.onEvent));return s},a.prototype.onEvent=function(){return this.reRender()},a.prototype.createTree=function(t){var e,r,i,o,s,a,l;if(null==t&&(t=!0),i=function(){var t,r,i,s,a=this;for(i=n.keys(this.base().locations),s=[],t=0,r=i.length;r>t;t++)o=i[t],e=this.base().Collections(o).map(function(t,e){var n;return n={},n[t.id]=1,a.descend(e,t,n)}),s.push(this.node(o,"collection",e));return s}.call(this),t){for(l=[],s=0,a=i.length;a>s;s++)r=i[s],r.children.length>0&&l.push(r);return l}return i},a.prototype.descend=function(t,e,i){var o,s,a,c,u,h,p,d,_,f,g,m;return this.isRef(e)&&(d=!0,null==i[e.id]?e=this.base().Collections(e.type).get(e.id):console.log("Cyclic reference to "+e.type+":"+e.id)),e instanceof l?(i=n.clone(i),i[e.id]=1,a=function(){var t,n;t=e.attributes,n=[];for(s in t)r.call(t,s)&&(g=t[s],this.isAttr(s)&&n.push(this.descend(s,g,i)));return n}.call(this),f=e.type,g=null,c=null):n.isArray(e)?(_=e.length>this.arrayLimit,o=this.arrayLimit||e.length,a=function(){var t,n,r,o;for(r=e.slice(0,+this.arrayLimit+1||9e9),o=[],h=t=0,n=r.length;n>t;h=++t)g=r[h],o.push(this.descend(h,g,i));return o}.call(this),f="Array["+e.length+"]"+(_?" (showing first "+this.arrayLimit+" items)":""),g=null,c=null):n.isObject(e)?(a=function(){var t;t=[];for(p in e)r.call(e,p)&&(g=e[p],t.push(this.descend(p,g,i)));return t}.call(this),f="Object["+n.keys(e).length+"]",g=null,c=null):(a=[],m=n.isUndefined(e)?[null,null,"orchid"]:n.isNull(e)?[null,null,"teal"]:n.isBoolean(e)?["Boolean",null,"darkmagenta"]:n.isNumber(e)?["Number",null,"green"]:n.isString(e)?["String",'"'+e+'"',"firebrick"]:n.isFunction(e)?["Function",null,null]:n.isDate(e)?["Date",null,null]:n.isRegExp(e)?["RegExp",null,null]:n.isElement(e)?["Element",null,null]:[typeof e,null,null],f=m[0],g=m[1],c=m[2],null==g&&(g=""+e),null==c&&(c="black")),u=[''+t+" "],null!=f&&(u=u.concat([": ",''+f+(d?'* ':"")+" "])),null!=g&&(u=u.concat([" = ",''+g+" "])),this.node(u.join(""),"",a)},a.prototype.isRef=function(t){return n.isObject(t)&&(n.isEqual(n.keys(t),["id","type"])||n.isEqual(n.keys(t),["type","id"]))},a.prototype.isAttr=function(t){return t.length>0&&"_"!==t[0]},a.prototype.node=function(t,e,n,r){return{text:t,type:e,children:n||[],state:{open:r||!1}}},a.prototype.renderToolbar=function(){var t,e,n=this;return e=o('
'),t=o('Refresh '),t.click(function(){return n.reRender()}),e.append(t),this.showToolbar||e.hide(),e},a.prototype.themeUrl=function(){return null},a.prototype.createContextMenu=function(t){var e,n;return e=t.original,n={},"collection"!==e.type&&(n.remove={label:"Remove"}),n},a.prototype.renderTree=function(){return o("
").jstree({core:{data:this.createTree(),themes:{url:this.themeUrl()}},contextmenu:{items:this.createContextMenu},plugins:["contextmenu"]})},a.prototype.render=function(){return this.$toolbar=this.renderToolbar(),this.$tree=this.renderTree(),this.$el.append([this.$toolbar,this.$tree])},a.prototype.reRender=function(){return this.$tree.jstree("destroy"),this.$el.empty(),this.render()},a}(a.View),{View:c}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("tool/object_explorer_tool",["underscore","jquery","modal","backbone","./tool","./event_generators","util/object_explorer"],function(t,n,r,i,o,s,a){var l,c,u,h,p,d,_;return l=s.ButtonEventGenerator,u=function(t){function r(){return p=r.__super__.constructor.apply(this,arguments)}return e(r,t),r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t)},r.prototype.eventGeneratorClass=l,r.prototype.evgen_options={buttonText:"Object Explorer"},r.prototype.toolType="ObjectExplorerTool",r.prototype.tool_events={activated:"_activated",deactivated:"_close_modal"},r.prototype._activated=function(){var t,e=this;return t=n(''),this.$object_explorer_view=new a.View({el:t.find(".modal-body")}),n("body").append(t),n("#objectExplorerModal .modal").on("hidden",function(){return e.plot_view.eventSink.trigger("clear_active_tool")}),n("#objectExplorerModal > .modal").modal({show:!0})},r.prototype._close_modal=function(){return n("#objectExplorerModal").remove(),n("#objectExplorerModal > .modal").remove()},r}(o.View),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=u,n.prototype.type="ObjectExplorerTool",n.prototype.display_defaults=function(){return n.__super__.display_defaults.call(this)},n}(o.Model),h=function(t){function n(){return _=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=c,n}(i.Collection),{Model:c,Collection:new h,View:u}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/data_slider",["common/plot_widget","common/has_parent"],function(n,r){var i,o,s,a,l,c;return o=function(n){function r(){return a=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.attributes={"class":"dataslider pull-left"},r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t),this.render_init(),this.select=_.throttle(this._select,50)},r.prototype.delegateEvents=function(t){return r.__super__.delegateEvents.call(this,t),"pass"},r.prototype.label=function(t,e){return this.$(".minlabel").text(t),this.$(".maxlabel").text(e)},r.prototype.render_init=function(){var t,e,n,r,i=this;return this.$el.html(""),this.$el.append("
"),this.$el.append("
"),this.$el.append("
"),this.plot_view.$(".plotarea").append(this.$el),t=this.mget_obj("data_source").getcolumn(this.mget("field")),r=[_.min(t),_.max(t)],n=r[0],e=r[1],this.$el.find(".slider").slider({orientation:"vertical",animate:"fast",step:(e-n)/50,min:n,max:e,values:[n,e],slide:function(t,e){return i.set_selection_range(t,e),i.select(t,e)}}),this.label(n,e),this.$el.find(".slider").height(this.plot_view.view_state.get("inner_height"))},r.prototype.set_selection_range=function(t,e){var n,r,i,o;return o=_.min(e.values),i=_.max(e.values),this.label(o,i),n=this.mget_obj("data_source"),r=this.mget("field"),null==n.range_selections&&(n.range_selections={}),n.range_selections[r]=[o,i]},r.prototype._select=function(){var e,n,r,i,o,s,a,l,c,u,h,p,d,_;r=this.mget_obj("data_source"),n={},a=0,d=r.range_selections;for(e in d)t.call(d,e)&&(h=d[e],n[e]=r.getcolumn(e),a=n[e].length);for(c=[],i=p=0;a>=0?a>p:p>a;i=a>=0?++p:--p){l=!0,_=r.range_selections;for(e in _)if(t.call(_,e)&&(h=_[e],s=h[0],o=h[1],u=n[e][i],s>u||u>o)){l=!1;break}l&&c.push(i)}return r.save({selected:c},{patch:!0})},r}(n),i=function(t){function n(){return l=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="DataSlider",n.prototype.default_view=o,n.prototype.defaults=function(){return{data_source:null,field:null}},n.prototype.display_defaults=function(){return{level:"tool"}},n}(r),s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=i,n}(Backbone.Collection),{Model:i,Collection:new s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/pandas/ipython_remote_data",["backbone","common/has_properties"],function(t,n){var r,i,o,s;return r=function(t){function n(){return o=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="IPythonRemoteData",n.prototype.defaults={computed_columns:[]},n}(n),i=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=r,n}(t.Collection),{Model:r,Collection:new i}})}.call(this),n("widget/pandas/pandas_pivot_template",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){var t,n,i,o,s,a,l,c,u,h,p,d,f,g,m;if(r(e('\n\n\n \n ")),this.counts&&r(e("\n counts \n ")),r(e("\n index \n ")),f=this.columns,s=0,u=f.length;u>s;s++)t=f[s],r(e("\n ")),this.skip[t]||(r(e('\n ')),r(t),r(e(" \n \n ")),this.sort_ascendings[t]===!0?r(e('\n \n ')):this.sort_ascendings[t]===!1&&r(e('\n \n ')),r(e("\n \n "))),r(e("\n \n "));for(r(e("\n \n ")),g=_.range(this.length),a=0,h=g.length;h>a;a++){for(i=g[a],r(e('\n \n ')),this.selected&&this.selected[i]?(r(e('\n \n ')),r(this.selected[i]),r(e("/")),r(this.counts[i]),r(e("\n \n "))):(r(e("\n ")),r(this.counts[i]),r(e(" \n "))),r(e("\n ")),r(this.index[i]),r(e(" \n ")),m=this.columns,l=0,p=m.length;p>l;l++)t=m[l],r(e("\n ")),this.skip[t]||(r(e(" \n ")),r(this.data[t][i]),r(e(" \n "))),r(e("\n "));r(e("\n \n "))}r(e('\n
\n\n"))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e={}.hasOwnProperty,r=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};n("widget/pandas/pandas_pivot_table",["underscore","backbone","common/has_parent","common/continuum_view","./pandas_pivot_template"],function(e,n,i,o,s){var a,l,c,u,h,p,d;return a=13,u=function(n){function i(){return this.colors=t(this.colors,this),this.pandasend=t(this.pandasend,this),this.pandasnext=t(this.pandasnext,this),this.pandasback=t(this.pandasback,this),this.pandasbeginning=t(this.pandasbeginning,this),this.toggle_more_controls=t(this.toggle_more_controls,this),this.sort=t(this.sort,this),this.rowclick=t(this.rowclick,this),this.toggle_filterselected=t(this.toggle_filterselected,this),this.clearselected=t(this.clearselected,this),this.computedtxtbox=t(this.computedtxtbox,this),this.column_del=t(this.column_del,this),this.search=t(this.search,this),h=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.template=s,i.prototype.initialize=function(t){return i.__super__.initialize.call(this,t),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"change",this.render),this.render()},i.prototype.events={"keyup .pandasgroup":"pandasgroup","keyup .pandasoffset":"pandasoffset","keyup .pandassize":"pandassize","change .pandasagg":"pandasagg","change .tablecontrolstate":"tablecontrolstate","click .pandasbeginning":"pandasbeginning","click .pandasback":"pandasback","click .pandasnext":"pandasnext","click .pandasend":"pandasend","click .controlsmore":"toggle_more_controls","click .pandascolumn":"sort","click .pandasrow":"rowclick","click .filterselected":"toggle_filterselected","click .clearselected":"clearselected","keyup .computedtxtbox":"computedtxtbox","click .column_del":"column_del","keyup .search":"search"},i.prototype.search=function(t){var e,n;return t.keyCode===a?(e=$(t.currentTarget).val(),n=this.model.get_obj("source"),n.rpc("search",[e]),t.preventDefault()):void 0},i.prototype.column_del=function(t){var n,r,i,o;return o=this.model.get_obj("source"),i=o.get("computed_columns"),r=$(t.currentTarget).attr("name"),n=e.filter(i,function(t){return t.name!==r}),o.rpc("set_computed_columns",[n])},i.prototype.computedtxtbox=function(t){var e,n,r,i;return t.keyCode===a?(n=this.$(".computedname").val(),e=this.$(".computedtxtbox").val(),i=this.model.get_obj("source"),r=i.get("computed_columns"),r.push({name:n,code:e}),i.rpc("set_computed_columns",[r]),t.preventDefault()):void 0},i.prototype.clearselected=function(){return this.model.rpc("setselect",[[]])},i.prototype.toggle_filterselected=function(){var t;return t=this.$(".filterselected").is(":checked"),this.mset("filterselected",t),this.model.save()},i.prototype.rowclick=function(t){var n,r,i,o,s,a,l,c,u,h;return r=this.counts(),h=this.selected(),a=function(){var t,i,o,s,a;for(o=e.zip(h,r),a=[],t=0,i=o.length;i>t;t++)s=o[t],u=s[0],n=s[1],a.push(u/n);return a}(),h=function(){var t,e,n;for(n=[],i=t=0,e=a.length;e>t;i=++t)s=a[i],s>.5&&n.push(i);return n}(),c=Number($(t.currentTarget).attr("rownum")),o=h.indexOf(c),l=-1===o?this.model.rpc("select",[[c]]):this.model.rpc("deselect",[[c]]),null},i.prototype.sort=function(t){var e;return e=$(t.currentTarget).text(),this.model.toggle_column_sort(e)},i.prototype.toggle_more_controls=function(){return this.controls_hide=this.controls_hide?!1:!0,this.render()},i.prototype.pandasbeginning=function(){return this.model.go_beginning()},i.prototype.pandasback=function(){return this.model.go_back()},i.prototype.pandasnext=function(){return this.model.go_forward()},i.prototype.pandasend=function(){return this.model.go_end()},i.prototype.pandasoffset=function(t){var n;return t.keyCode===a?(n=this.$el.find(".pandasoffset").val(),n=Number(n),e.isNaN(n)&&(n=this.model.defaults.offset),this.model.save("offset",n,{wait:!0}),t.preventDefault()):void 0},i.prototype.pandassize=function(t){var n,r;return t.keyCode===a?(r=this.$el.find(".pandassize").val(),n=Number(r),(e.isNaN(n)||""===r)&&(n=this.model.defaults.length),n+this.mget("offset")>this.mget("maxlength")&&(n=this.mget("maxlength")-this.mget("offset")),this.model.save("length",n,{wait:!0}),t.preventDefault()):void 0},i.prototype.tablecontrolstate=function(){return this.mset("tablecontrolstate",this.$(".tablecontrolstate").val())},i.prototype.pandasagg=function(){return this.model.save("agg",this.$el.find(".pandasagg").val(),{wait:!0})},i.prototype.fromcsv=function(t){return t?e.map(t.split(","),function(t){return t.trim()}):[]},i.prototype.pandasgroup=function(t){return t.keyCode===a?(this.model.set({group:this.fromcsv(this.$el.find(".pandasgroup").val()),offset:0}),this.model.save(),t.preventDefault(),!1):void 0},i.prototype.counts=function(){return this.mget("tabledata").data._counts},i.prototype.selected=function(){return this.mget("tabledata").data._selected},i.prototype.colors=function(){var t,n;return t=this.counts(),n=this.selected(),t&&n?e.map(e.zip(t,n),function(t){var e,r;return r=t[0],n=t[1],e=.3*n/r,"rgba(0,0,255,"+e+")"}):null},i.prototype.render=function(){var t,n,r,i,o,s,a,l,c,u,h;for(n=this.mget("group"),e.isArray(n)&&(n=n.join(",")),o=this.mget("sort"),e.isArray(o)&&(o=o.join(",")),t=this.colors(),s={},h=this.mget("sort"),c=0,u=h.length;u>c;c++)i=h[c],s[i.column]=i.ascending;return a=this.mget_obj("source"),l={skip:{_counts:!0,_selected:!0,index:!0},tablecontrolstate:this.mget("tablecontrolstate"),computed_columns:this.mget_obj("source").get("computed_columns"),columns:this.mget("tabledata").column_names,data:this.mget("tabledata").data,group:n,sort_ascendings:s,height:this.mget("height"),width:this.mget("width"),offset:this.mget("offset"),length:this.model.length(),filterselected:this.mget("filterselected"),totallength:this.mget("totallength"),counts:this.mget("tabledata").data._counts,selected:this.mget("tabledata").data._selected,controls_hide:this.controls_hide,colors:t,index:this.mget("tabledata").data.index},this.$el.empty(),r=this.template(l),this.$el.html(r),this.$(".pandasagg").find('option[value="'+this.mget("agg")+'"]').attr("selected","selected"),this.$(".tablecontrolstate").find('option[value="'+this.mget("tablecontrolstate")+'"]').attr("selected","selected"),this.$el.addClass("bokehtable")},i}(o.View),l=function(n){function i(){return this.toggle_column_sort=t(this.toggle_column_sort,this),this.dinitialize=t(this.dinitialize,this),p=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.type="PandasPivotTable",i.prototype.initialize=function(t,n){var r=this;return i.__super__.initialize.call(this,t,n),this.throttled_fetch=e.throttle(function(){return r.fetch()},500)},i.prototype.dinitialize=function(t,e){return i.__super__.dinitialize.call(this,t,e)},i.prototype.fetch=function(t){return i.__super__.fetch.call(this,t)},i.prototype.length=function(){return e.values(this.get("tabledata").data)[0].length},i.prototype.toggle_column_sort=function(t){var n,r;return r=this.get("sort"),this.unset("sort",{silent:!0}),n=e.filter(r,function(e){return e.column===t}),n.length>0?(n=n[0],n.ascending?(n.ascending=!1,this.save("sort",r,{wait:!0})):(r=e.filter(r,function(e){return e.column!==t}),this.save("sort",r,{wait:!0})),void 0):(r=e.clone(r),r.push({column:t,ascending:!0}),this.save("sort",r,{wait:!0}),void 0)},i.prototype.go_beginning=function(){return this.set("offset",0),this.save()},i.prototype.go_back=function(){var t;return t=this.get("offset"),t-=this.length(),0>t&&(t=0),this.set("offset",t),this.save()},i.prototype.go_forward=function(){var t,e;return e=this.get("offset"),e+=this.length(),t=this.get("maxlength")-this.length(),e>t&&(e=t),this.set("offset",e),this.save()},i.prototype.go_end=function(){var t;return t=this.get("maxlength")-this.length(),this.set("offset",t),this.save()},i.prototype.default_view=u,i.prototype.defaults=function(){return{sort:[],group:[],agg:"sum",offset:0,length:100,maxlength:1e3,tabledata:null,columns_names:[],width:null,tablecontrolstate:"groupby"}},i}(i),c=function(t){function e(){return d=e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.model=l,e}(n.Collection),{Model:l,Collection:new c,View:u}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/pandas/pandas_plot_source",["backbone","source/column_data_source"],function(t,n){var r,i,o,s;return r=function(t){function n(){return o=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="PandasPlotSource",n}(n.Model),i=function(t){function n(){return s=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=r,n}(t.Collection),{Model:r,Collection:new i}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/paragraph",["common/has_parent","common/continuum_view","backbone"],function(t,n,r){var i,o,s,a,l,c,u,h;return i=n.View,s=function(t){function n(){return c=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.tagName="p",n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.render(),this.listenTo(this.model,"change",this.render)},n.prototype.render=function(){return this.$el.text(this.mget("text"))},n}(i),o=function(t){function n(){return u=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="Paragraph",n.prototype.default_view=s,n.prototype.defaults=function(){return{text:""}},n}(t),a=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=o,n}(r.Collection),l=new a,{Model:o,Collection:l,View:s}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/hbox",["common/has_parent","common/continuum_view","common/build_views","backbone"],function(n,r,i,o){var s,a,l,c,u,h,p,d;return s=r.View,l=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.tag="div",r.prototype.attributes={"class":"bk-hbox"},r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t),this.views={},this.render(),this.listenTo(this.model,"change",this.render)},r.prototype.render=function(){var e,n,r,o,s,a,l,c;n=this.mget_obj("children"),i(this.views,n),l=this.views;for(r in l)t.call(l,r)&&(o=l[r],o.$el.detach());for(this.$el.empty(),c=[],s=0,a=n.length;a>s;s++)e=n[s],c.push(this.$el.append(this.views[e.id].$el));return c},r}(s),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="HBox",n.prototype.default_view=l,n.prototype.defaults=function(){return{children:[]}},n}(n),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(o.Collection),u=new c,{Model:a,Collection:u,View:l}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e
}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/vbox",["common/has_parent","common/continuum_view","common/build_views","backbone"],function(n,r,i,o){var s,a,l,c,u,h,p,d;return s=r.View,l=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.tag="div",r.prototype.attributes={"class":"bk-vbox"},r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t),this.views={},this.render(),this.listenTo(this.model,"change",this.render)},r.prototype.render=function(){var e,n,r,o,s,a,l,c;n=this.mget_obj("children"),i(this.views,n),l=this.views;for(r in l)t.call(l,r)&&(o=l[r],o.$el.detach());for(this.$el.empty(),c=[],s=0,a=n.length;a>s;s++)e=n[s],c.push(this.$el.append(this.views[e.id].$el));return c},r}(s),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="VBox",n.prototype.default_view=l,n.prototype.defaults=function(){return{children:[]}},n}(n),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(o.Collection),u=new c,{Model:a,Collection:u,View:l}})}.call(this),n("widget/textinputtemplate",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){r(e(' ')),r(this.title),r(e(' \n \n'))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/textinput",["common/has_parent","common/continuum_view","common/build_views","backbone","./textinputtemplate"],function(t,n,r,i,o){var s,a,l,c,u,h,p,d;return s=n.View,l=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.tagName="div",n.prototype.attributes={"class":"bk-widget-form-group"},n.prototype.template=o,n.prototype.events={"change input":"change_input"},n.prototype.change_input=function(){return this.mset("value",this.$("input").val()),console.log("set",this.model.attributes)},n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.render(),this.listenTo(this.model,"change",this.render)},n.prototype.render=function(){return this.$el.html(this.template(this.model.attributes)),this},n}(s),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="TextInput",n.prototype.default_view=l,n.prototype.defaults=function(){var t;return t={name:"",value:"",title:""}},n}(t),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(i.Collection),u=new c,{Model:a,Collection:u}})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/vboxmodelform",["common/has_parent","common/continuum_view","common/build_views","backbone"],function(n,r,i,o){var s,a,l,c,u,h,p,d;return s=r.View,l=function(n){function r(){return h=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.tagName="form",r.prototype.attributes={"class":"bk-widget-form",role:"form"},r.prototype.initialize=function(t){return r.__super__.initialize.call(this,t),this.views={},this.render(),this.listenTo(this.model,"change:children",this.change_children),this.bind_children()},r.prototype.change_children=function(){var t,e,n,r,i;for(n=this.model.previous("children"),r=0,i=n.length;i>r;r++)e=n[r],t=this.resolve_ref(e),t&&this.stopListening(t,"change:value");return this.bind_children()},r.prototype.bind_children=function(){var t,e,n,r,i;for(e=this.mget_obj("_children"),i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(this.listenTo(t,{"change:value":this.set_data}));return i},r.prototype.set_data=function(t,e){var n,r,i,o,s,a;if(null!=t)o=[t.get("name"),t.get("value")],n=o[0],e=o[1],e=this.model.convert_val(n,e),this.mset(n,e),this.model.save();else{for(s=this.mget_obj("children"),r=0,i=s.length;i>r;r++)t=s[r],a=[t.get("name"),t.get("value")],n=a[0],e=a[1],null!=n&&null!=e&&(e=this.model.convert_val(n,e),this.mset(n,e));this.model.save()}return console.log(this.model.attributes)},r.prototype.render=function(){var e,n,r,o,s,a,l,c;n=this.mget_obj("_children"),i(this.views,n),l=this.views;for(r in l)t.call(l,r)&&(o=l[r],o.$el.detach());for(this.$el.empty(),c=[],s=0,a=n.length;a>s;s++)e=n[s],this.$el.append(" ')),r(this.title),r(e(' \n\n ')),o=this.options,n=0,i=o.length;i>n;n++)t=o[n],r(e("\n ")),t.value===this.value?(r(e('\n ')),r(t.name),r(e(" \n "))):(r(e('\n ')),r(t.name),r(e(" \n "))),r(e("\n\n "));r(e("\n \n"))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("widget/selectbox",["common/has_parent","common/continuum_view","backbone","underscore","./selecttemplate"],function(t,n,r,i,o){var s,a,l,c,u,h,p,d;return s=n.View,l=function(t){function n(){return h=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.events={"change select":"change_input"},n.prototype.change_input=function(){return this.mset("value",this.$("select").val()),console.log("set",this.model.attributes)},n.prototype.tagName="div",n.prototype.template=o,n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.render(),this.listenTo(this.model,"change",this.render)},n.prototype.render=function(){var t;return this.$el.empty(),t=this.template(this.model.attributes),this.$el.html(t),this},n}(s),a=function(t){function n(){return p=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.type="Select",n.prototype.default_view=l,n.prototype.defaults=function(){var t;return t={title:"",value:"",options:[]}},n}(t),c=function(t){function n(){return d=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.model=a,n}(r.Collection),u=new c,{Model:a,Collection:u,View:l}})}.call(this),n("widget/slidertemplate",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){r(e(' ')),r(this.title),r(e(' \n\n
\n
\n\n'))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),n("jquery_ui/core",["jquery"],function(t){!function(t,e){function n(e,n){var i,o,s,a=e.nodeName.toLowerCase();return"area"===a?(i=e.parentNode,o=i.name,e.href&&o&&"map"===i.nodeName.toLowerCase()?(s=t("img[usemap=#"+o+"]")[0],!!s&&r(s)):!1):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||n:n)&&r(e)}function r(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var i=0,o=/^ui-id-\d+$/;t.ui=t.ui||{},t.ui.version||(t.extend(t.ui,{version:"1.10.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({_focus:t.fn.focus,focus:function(e,n){return"number"==typeof e?this.each(function(){var r=this;setTimeout(function(){t(r).focus(),n&&n.call(r)},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var r,i,o=t(this[0]);o.length&&o[0]!==document;){if(r=o.css("position"),("absolute"===r||"relative"===r||"fixed"===r)&&(i=parseInt(o.css("zIndex"),10),!isNaN(i)&&0!==i))return i;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,r){return!!t.data(e,r[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var r=t.attr(e,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(e,!i)}}),t("
").outerWidth(1).jquery||t.each(["Width","Height"],function(n,r){function i(e,n,r,i){return t.each(o,function(){n-=parseFloat(t.css(e,"padding"+this))||0,r&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0),i&&(n-=parseFloat(t.css(e,"margin"+this))||0)}),n}var o="Width"===r?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+r]=function(n){return n===e?a["inner"+r].call(this):this.each(function(){t(this).css(s,i(this,n)+"px")})},t.fn["outer"+r]=function(e,n){return"number"!=typeof e?a["outer"+r].call(this,e):this.each(function(){t(this).css(s,i(this,e,!0,n)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t(" ").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,n,r){var i,o=t.ui[e].prototype;for(i in r)o.plugins[i]=o.plugins[i]||[],o.plugins[i].push([n,r[i]])},call:function(t,e,n){var r,i=t.plugins[e];if(i&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(r=0;r0?!0:(e[r]=1,i=e[r]>0,e[r]=0,i)}}))}(t)}),n("jquery_ui/widget",["jquery"],function(t){!function(t,e){var n=0,r=Array.prototype.slice,i=t.cleanData;t.cleanData=function(e){for(var n,r=0;null!=(n=e[r]);r++)try{t(n).triggerHandler("remove")}catch(o){}i(e)},t.widget=function(e,n,r){var i,o,s,a,l={},c=e.split(".")[0];e=e.split(".")[1],i=c+"-"+e,r||(r=n,n=t.Widget),t.expr[":"][i.toLowerCase()]=function(e){return!!t.data(e,i)},t[c]=t[c]||{},o=t[c][e],s=t[c][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new s(t,e)},t.extend(s,o,{version:r.version,_proto:t.extend({},r),_childConstructors:[]}),a=new n,a.options=t.widget.extend({},a.options),t.each(r,function(e,r){return t.isFunction(r)?(l[e]=function(){var t=function(){return n.prototype[e].apply(this,arguments)},i=function(t){return n.prototype[e].apply(this,t)};return function(){var e,n=this._super,o=this._superApply;return this._super=t,this._superApply=i,e=r.apply(this,arguments),this._super=n,this._superApply=o,e}}(),void 0):(l[e]=r,void 0)}),s.prototype=t.widget.extend(a,{widgetEventPrefix:o?a.widgetEventPrefix:e},l,{constructor:s,namespace:c,widgetName:e,widgetFullName:i}),o?(t.each(o._childConstructors,function(e,n){var r=n.prototype;t.widget(r.namespace+"."+r.widgetName,s,n._proto)}),delete o._childConstructors):n._childConstructors.push(s),t.widget.bridge(e,s)},t.widget.extend=function(n){for(var i,o,s=r.call(arguments,1),a=0,l=s.length;l>a;a++)for(i in s[a])o=s[a][i],s[a].hasOwnProperty(i)&&o!==e&&(n[i]=t.isPlainObject(o)?t.isPlainObject(n[i])?t.widget.extend({},n[i],o):t.widget.extend({},o):o);return n},t.widget.bridge=function(n,i){var o=i.prototype.widgetFullName||n;t.fn[n]=function(s){var a="string"==typeof s,l=r.call(arguments,1),c=this;return s=!a&&l.length?t.widget.extend.apply(null,[s].concat(l)):s,a?this.each(function(){var r,i=t.data(this,o);return i?t.isFunction(i[s])&&"_"!==s.charAt(0)?(r=i[s].apply(i,l),r!==i&&r!==e?(c=r&&r.jquery?c.pushStack(r.get()):r,!1):void 0):t.error("no such method '"+s+"' for "+n+" widget instance"):t.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+s+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(s||{})._init():t.data(this,o,new i(s,this))}),c}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"",options:{disabled:!1,create:null},_createWidget:function(e,r){r=t(r||this.defaultElement||this)[0],this.element=t(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),r!==this&&(t.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===r&&this.destroy()}}),this.document=t(r.style?r.ownerDocument:r.document||r),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(n,r){var i,o,s,a=n;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof n)if(a={},i=n.split("."),n=i.shift(),i.length){for(o=a[n]=t.widget.extend({},this.options[n]),s=0;s
=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(t)}),n("jquery_ui/slider",["jquery","./core","./mouse","./widget"],function(t){!function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.0",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){var e,n,r=this.options,i=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o=" ",s=[];for(this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this.range=t([]),r.range&&(r.range===!0&&(r.values?r.values.length&&2!==r.values.length?r.values=[r.values[0],r.values[0]]:t.isArray(r.values)&&(r.values=r.values.slice(0)):r.values=[this._valueMin(),this._valueMin()]),this.range=t("
").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+("min"===r.range||"max"===r.range?" ui-slider-range-"+r.range:""))),n=r.values&&r.values.length||1,e=i.length;n>e;e++)s.push(o);this.handles=i.add(t(s.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(t){t.preventDefault()}).mouseenter(function(){r.disabled||t(this).addClass("ui-state-hover")}).mouseleave(function(){t(this).removeClass("ui-state-hover")}).focus(function(){r.disabled?t(this).blur():(t(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),t(this).addClass("ui-state-focus"))}).blur(function(){t(this).removeClass("ui-state-focus")}),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)}),this._setOption("disabled",r.disabled),this._on(this.handles,this._handleEvents),this._refreshValue(),this._animateOff=!1},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var n,r,i,o,s,a,l,c,u=this,h=this.options;return h.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),n={x:e.pageX,y:e.pageY},r=this._normValueFromMouse(n),i=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var n=Math.abs(r-u.values(e));(i>n||i===n&&(e===u._lastChangedValue||u.values(e)===h.min))&&(i=n,o=t(this),s=e)}),a=this._start(e,s),a===!1?!1:(this._mouseSliding=!0,this._handleIndex=s,o.addClass("ui-state-active").focus(),l=o.offset(),c=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=c?{left:0,top:0}:{left:e.pageX-l.left-o.width()/2,top:e.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,s,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},n=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,n),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,n,r,i,o;return"horizontal"===this.orientation?(e=this.elementSize.width,n=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,n=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/e,r>1&&(r=1),0>r&&(r=0),"vertical"===this.orientation&&(r=1-r),i=this._valueMax()-this._valueMin(),o=this._valueMin()+r*i,this._trimAlignValue(o)},_start:function(t,e){var n={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(e),n.values=this.values()),this._trigger("start",t,n)},_slide:function(t,e,n){var r,i,o;this.options.values&&this.options.values.length?(r=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&n>r||1===e&&r>n)&&(n=r),n!==this.values(e)&&(i=this.values(),i[e]=n,o=this._trigger("slide",t,{handle:this.handles[e],value:n,values:i}),r=this.values(e?0:1),o!==!1&&this.values(e,n,!0))):n!==this.value()&&(o=this._trigger("slide",t,{handle:this.handles[e],value:n}),o!==!1&&this.value(n))},_stop:function(t,e){var n={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(e),n.values=this.values()),this._trigger("stop",t,n)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(e),n.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,n)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,n){var r,i,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(n),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(r=this.options.values,i=arguments[0],o=0;or;r+=1)this._change(null,r);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,n,r;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);for(n=this.options.values.slice(),r=0;r=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,n=(t-this._valueMin())%e,r=t-n;return 2*Math.abs(n)>=e&&(r+=n>0?e:-e),parseFloat(r.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,n,r,i,o,s=this.options.range,a=this.options,l=this,c=this._animateOff?!1:a.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=100*((l.values(r)-l._valueMin())/(l._valueMax()-l._valueMin())),u["horizontal"===l.orientation?"left":"bottom"]=n+"%",t(this).stop(1,1)[c?"animate":"css"](u,a.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===r&&l.range.stop(1,1)[c?"animate":"css"]({left:n+"%"},a.animate),1===r&&l.range[c?"animate":"css"]({width:n-e+"%"},{queue:!1,duration:a.animate})):(0===r&&l.range.stop(1,1)[c?"animate":"css"]({bottom:n+"%"},a.animate),1===r&&l.range[c?"animate":"css"]({height:n-e+"%"},{queue:!1,duration:a.animate}))),e=n}):(r=this.value(),i=this._valueMin(),o=this._valueMax(),n=o!==i?100*((r-i)/(o-i)):0,u["horizontal"===this.orientation?"left":"bottom"]=n+"%",this.handle.stop(1,1)[c?"animate":"css"](u,a.animate),"min"===s&&"horizontal"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({width:n+"%"},a.animate),"max"===s&&"horizontal"===this.orientation&&this.range[c?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:a.animate}),"min"===s&&"vertical"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({height:n+"%"},a.animate),"max"===s&&"vertical"===this.orientation&&this.range[c?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:a.animate}))},_handleEvents:{keydown:function(n){var r,i,o,s,a=t(n.target).data("ui-slider-handle-index");switch(n.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(n.target).addClass("ui-state-active"),r=this._start(n,a),r===!1))return
}switch(s=this.options.step,i=o=this.options.values&&this.options.values.length?this.values(a):this.value(),n.keyCode){case t.ui.keyCode.HOME:o=this._valueMin();break;case t.ui.keyCode.END:o=this._valueMax();break;case t.ui.keyCode.PAGE_UP:o=this._trimAlignValue(i+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:o=this._trimAlignValue(i-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(i===this._valueMax())return;o=this._trimAlignValue(i+s);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i===this._valueMin())return;o=this._trimAlignValue(i-s)}this._slide(n,a,o)},keyup:function(e){var n=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,n),this._change(e,n),t(e.target).removeClass("ui-state-active"))}}})}(t)}),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e={}.hasOwnProperty,r=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};n("widget/slider",["common/has_parent","common/continuum_view","backbone","underscore","./slidertemplate","jquery_ui/slider"],function(e,n,i,o,s){var a,l,c,u,h,p,d,_;return a=n.View,c=function(e){function n(){return this.slide=t(this.slide,this),p=n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.tagName="div",n.prototype.template=s,n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.render()},n.prototype.render=function(){var t,e,n,r;return this.$el.empty(),t=this.template(this.model.attributes),this.$el.html(t),e=this.mget("end"),n=this.mget("start"),r=(e-n)/50,console.log("sliderval",n,e,r),this.$(".slider").slider({orientation:this.mget("orientation"),animate:"fast",slide:o.throttle(this.slide,200),value:this.mget("value"),min:n,max:e,step:r})},n.prototype.slide=function(t,e){var n;return n=e.value,console.log("sliding",n),this.mset("value",n)},n}(a),l=function(t){function e(){return d=e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.type="Slider",e.prototype.default_view=c,e.prototype.defaults=function(){var t;return t={title:"",value:.5,start:0,end:1,orientation:"horizontal"}},e}(e),u=function(t){function e(){return _=e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.model=l,e}(i.Collection),h=new u,{Model:l,Collection:h,View:c}})}.call(this),function(){n("common/base",["underscore","require","common/custom","common/gmap_plot","common/grid_plot","common/plot","common/plot_context","mapper/1d/categorical_mapper","mapper/1d/linear_mapper","mapper/2d/grid_mapper","mapper/color/linear_color_mapper","range/data_factor_range","range/data_range1d","range/factor_range","range/range1d","renderer/annotation/legend","renderer/glyph/glyph_factory","renderer/guide/categorical_axis","renderer/guide/datetime_axis","renderer/guide/grid","renderer/guide/linear_axis","renderer/overlay/box_selection","source/column_data_source","source/server_data_source","ticking/abstract_ticker","ticking/adaptive_ticker","ticking/basic_tick_formatter","ticking/basic_ticker","ticking/categorical_tick_formatter","ticking/categorical_ticker","ticking/composite_ticker","ticking/datetime_tick_formatter","ticking/datetime_ticker","ticking/days_ticker","ticking/months_ticker","ticking/single_interval_ticker","ticking/years_ticker","tool/box_select_tool","tool/box_zoom_tool","tool/crosshair_tool","tool/data_range_box_select_tool","tool/embed_tool","tool/hover_tool","tool/pan_tool","tool/preview_save_tool","tool/reset_tool","tool/resize_tool","tool/wheel_zoom_tool","tool/object_explorer_tool","widget/data_slider","widget/pandas/ipython_remote_data","widget/pandas/pandas_pivot_table","widget/pandas/pandas_plot_source","widget/paragraph","widget/hbox","widget/vbox","widget/textinput","widget/vboxmodelform","widget/pretext","widget/selectbox","widget/slider"],function(t,e){var n,r,i,o,s;return e("common/custom").monkey_patch(),r={prefix:""},o={Plot:"common/plot",GMapPlot:"common/gmap_plot",GridPlot:"common/grid_plot",PlotContext:"common/plot_context",PlotList:"common/plot_context",DataFactorRange:"range/data_factor_range",DataRange1d:"range/data_range1d",FactorRange:"range/factor_range",Range1d:"range/range1d",Glyph:"renderer/glyph/glyph_factory",LinearAxis:"renderer/guide/linear_axis",CategoricalAxis:"renderer/guide/categorical_axis",DatetimeAxis:"renderer/guide/datetime_axis",Grid:"renderer/guide/grid",Legend:"renderer/annotation/legend",BoxSelection:"renderer/overlay/box_selection",ColumnDataSource:"source/column_data_source",ServerDataSource:"source/server_data_source",AbstractTicker:"ticking/abstract_ticker",AdaptiveTicker:"ticking/adaptive_ticker",BasicTicker:"ticking/basic_ticker",BasicTickFormatter:"ticking/basic_tick_formatter",CategoricalTicker:"ticking/categorical_ticker",CategoricalTickFormatter:"ticking/categorical_tick_formatter",CompositeTicker:"ticking/composite_ticker",DatetimeTicker:"ticking/datetime_ticker",DatetimeTickFormatter:"ticking/datetime_tick_formatter",DaysTicker:"ticking/days_ticker",MonthsTicker:"ticking/months_ticker",SingleIntervalTicker:"ticking/single_interval_ticker",YearsTicker:"ticking/years_ticker",PanTool:"tool/pan_tool",WheelZoomTool:"tool/wheel_zoom_tool",ResizeTool:"tool/resize_tool",CrosshairTool:"tool/crosshair_tool",BoxSelectTool:"tool/box_select_tool",BoxZoomTool:"tool/box_zoom_tool",HoverTool:"tool/hover_tool",DataRangeBoxSelectTool:"tool/data_range_box_select_tool",PreviewSaveTool:"tool/preview_save_tool",EmbedTool:"tool/embed_tool",ResetTool:"tool/reset_tool",ObjectExplorerTool:"tool/object_explorer_tool",DataSlider:"widget/data_slider",IPythonRemoteData:"widget/pandas/ipython_remote_data",PandasPivotTable:"widget/pandas/pandas_pivot_table",PandasPlotSource:"widget/pandas/pandas_plot_source",Paragraph:"widget/paragraph",HBox:"widget/hbox",VBox:"widget/vbox",VBoxModelForm:"widget/vboxmodelform",TextInput:"widget/textinput",PreText:"widget/pretext",Select:"widget/selectbox",Slider:"widget/slider"},s={},i={},n=function(t){var n;if(i[t])return i[t];if(!o[t])throw"./base: Unknown Collection "+t;return n=o[t],null==s[n]&&(console.log("calling require",n),s[n]=e(n)),s[n].Collection},n.register=function(t,e){return i[t]=e},{collection_overrides:i,mod_cache:s,locations:o,Collections:n,Config:r}})}.call(this),function(){n("common/plotting",["underscore","jquery","./plot","range/data_range1d","range/factor_range","range/range1d","renderer/annotation/legend","renderer/glyph/glyph_factory","renderer/guide/categorical_axis","renderer/guide/linear_axis","renderer/guide/grid","renderer/overlay/box_selection","source/column_data_source","tool/box_select_tool","tool/box_zoom_tool","tool/hover_tool","tool/pan_tool","tool/preview_save_tool","tool/resize_tool","tool/wheel_zoom_tool","tool/reset_tool","renderer/guide/datetime_axis"],function(t,e,n,r,i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w){var x,k,j,C,T,M,N,S,A;return N=function(e){var n,r,i,o;for(t.isArray(e)||(e=[e]),r=[],i=0,o=e.length;o>i;i++)n=e[i],n instanceof p.Model?r.push(n):r.push(p.Collection.create({data:n}));return r},M=function(t,e,n){var s;return"auto"===t?r.Collection.create({sources:function(){var t,r,i;for(i=[],t=0,r=e.length;r>t;t++)s=e[t],i.push({source:s.ref(),columns:n});return i}()}):t instanceof o.Model||t instanceof i.Model?t:"string"==typeof t[0]?i.Collection.create({factors:t}):o.Collection.create({start:t[0],end:t[1]})},T=function(e,n,r,i){var o,s,l,c,u,h,p,d,_,f;for(s=[],t.isArray(n)||(n=[n]),1===r.length&&(r=function(){var t,e,i;for(i=[],t=0,e=n.length;e>t;t++)p=n[t],i.push(r[0]);return i}()),null==i&&(i={fill_alpha:.1,line_alpha:.1}),t.isArray(i)||(i=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)p=n[t],r.push(i);return r}()),f=t.zip(n,i,r),d=0,_=f.length;_>d;d++)h=f[d],u=h[0],l=h[1],c=h[2],o=a.Collection.create({parent:e.ref(),data_source:c.ref(),glyphspec:u,nonselection_glyphspec:l}),s.push(o);return s},x=function(e,n,r,i,o){var s,a,u,h,p,d,_,f,g,m,v,y,b;if(h=[],n)if(n===!0&&(n=["min","max"]),t.isArray(n)||(n=[n]),"datetime"===n[0])a=w.Collection.create({dimension:0,axis_label:"x",location:"min",parent:e.ref(),plot:e.ref()}),h.push(a);else if("FactorRange"===i.type)for(d=0,m=n.length;m>d;d++)u=n[d],a=l.Collection.create({dimension:0,axis_label:"x",location:u,parent:e.ref(),plot:e.ref()}),h.push(a);else for(_=0,v=n.length;v>_;_++)u=n[_],a=c.Collection.create({dimension:0,axis_label:"x",location:u,parent:e.ref(),plot:e.ref()}),h.push(a);if(p=[],r)if(r===!0&&(r=["min","max"]),t.isArray(r)||(r=[r]),"datetime"===r[0])a=w.Collection.create({dimension:1,axis_label:"y",location:"min",parent:e.ref(),plot:e.ref()}),p.push(a);else if("FactorRange"===o.type)for(f=0,y=r.length;y>f;f++)u=r[f],a=l.Collection.create({dimension:1,axis_label:"y",location:u,parent:e.ref(),plot:e.ref()}),p.push(a);else for(g=0,b=r.length;b>g;g++)u=r[g],a=c.Collection.create({dimension:1,axis_label:"y",location:u,parent:e.ref(),plot:e.ref()}),p.push(a);return e.add_renderers(function(){var t,e,n;for(n=[],e=0,t=h.length;t>e;e++)s=h[e],n.push(s.ref());return n}()),e.add_renderers(function(){var t,e,n;for(n=[],e=0,t=p.length;t>e;e++)s=p[e],n.push(s.ref());return n}()),[h,p]},k=function(t,e,n,r,i){var o,s,a;return a=[],e&&r.length>0&&(s=u.Collection.create({dimension:0,parent:t.ref(),plot:t.ref(),axis:r[0].ref()}),a.push(s)),n&&i.length>0?(s=u.Collection.create({dimension:1,parent:t.ref(),plot:t.ref(),axis:i[0].ref()}),a.push(s),t.add_renderers(function(){var t,e,n;for(n=[],t=0,e=a.length;e>t;t++)o=a[t],n.push(o.ref());return n}())):void 0},C=function(t,e,n,r,i){var o,s,a,l,c,u,p,w,x,k,j,C;if(e!==!1)return e===!0&&(e="pan,wheel_zoom,select,resize,preview,reset,box_zoom"),o=[],e.indexOf("pan")>-1&&(u=g.Collection.create({dataranges:[r.ref(),i.ref()],dimensions:["width","height"]}),o.push(u)),e.indexOf("wheel_zoom")>-1&&(C=y.Collection.create({dataranges:[r.ref(),i.ref()],dimensions:["width","height"]}),o.push(C)),e.indexOf("hover")>-1&&(c=f.Collection.create({plot:t.ref()}),o.push(c)),e.indexOf("select")>-1&&(j=d.Collection.create({renderers:function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)l=n[t],r.push(l.ref());return r}()}),k=h.Collection.create({tool:j.ref()}),o.push(j),t.add_renderers([k.ref()])),e.indexOf("resize")>-1&&(x=v.Collection.create(),o.push(x)),e.indexOf("preview")>-1&&(p=m.Collection.create(),o.push(p)),e.indexOf("reset")>-1&&(w=b.Collection.create(),o.push(w)),e.indexOf("box_zoom")>-1&&(a=_.Collection.create(),s=h.Collection.create({tool:a.ref()}),o.push(a),t.add_renderers([s.ref()])),t.set_obj("tools",o)},j=function(t,e,n){var r,i,o,a,l,c;if(e){for(a={},i=l=0,c=n.length;c>l;i=++l)r=n[i],a[e+String(i)]=[r.ref()];return o=s.Collection.create({parent:t.ref(),plot:t.ref(),orientation:"top_right",legends:a}),t.add_renderers([o.ref()])}},S=function(t,e,r){var i,o,s,a,l,c,u,h,p,d,_,f,g,m,v,y,b,w;return l=r.nonselected,h=r.title,i=r.dims,g=r.xrange,b=r.yrange,d=r.xaxes,m=r.yaxes,f=r.xgrid,y=r.ygrid,_=r.xdr,v=r.ydr,p=r.tools,a=r.legend,null==l&&(l=null),null==h&&(h=""),null==i&&(i=[400,400]),null==g&&(g="auto"),null==b&&(b="auto"),null==d&&(d=!0),null==m&&(m=!0),null==f&&(f=!0),null==y&&(y=!0),null==p&&(p=!0),null==a&&(a=!1),u=N(e),_=M(g,u,["x"]),v=M(b,u,["y"]),c=n.Collection.create({x_range:_.ref(),y_range:v.ref(),canvas_width:i[0],canvas_height:i[1],outer_width:i[0],outer_height:i[1],title:h}),s=T(c,t,u,l),c.add_renderers(function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o.ref());return n}()),w=x(c,d,m,_,v),d=w[0],m=w[1],k(c,f,y,d,m),C(c,p,s,_,v),j(c,a,s),c},A=function(n,r){var i,o;return null==r&&(r=!1),i=e('
'),r=r?e(r):e("body"),r.append(i),o=function(){var t;return t=new n.default_view({model:n}),window.pview=t,i.append(t.$el),console.log("added plot: "+n.get("title"))},t.defer(o)},{make_plot:S,create_glyphs:T,show:A}})}.call(this),function(){n("common/affine",[],function(){var t;return t=function(){function t(t,e,n,r,i,o){this.a=null!=t?t:1,this.b=null!=e?e:0,this.c=null!=n?n:0,this.d=null!=r?r:1,this.tx=null!=i?i:0,this.ty=null!=o?o:0}return t.prototype.apply=function(t,e){return[this.a*t+this.b*e+this.tx,this.c*t+this.d*e+this.ty]},t.prototype.v_apply=function(t,e){var n,r,i,o,s;for(r=new Float32Array(t.length),i=new Float32Array(e.length),n=o=0,s=t.length;s>=0?s>o:o>s;n=s>=0?++o:--o)r[n]=this.a*t[n]+this.b*e[n]+this.tx,i[n]=this.c*t[n]+this.d*e[n]+this.ty;return[r,i]},t.prototype.is_identity=function(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty},t.prototype.translate=function(t,e){return this.tx=this.a*t+this.b*e,this.ty=this.c*t+this.d*e},t.prototype.scale=function(t,e){return this.a*=t,this.b*=e,this.c*=t,this.d*=e},t.prototype.rotate=function(t){var e,n,r,i,o,s;return e=Math.cos(t),n=Math.sin(t),r=e*this.a+n*this.b,i=e*this.b-n*this.a,o=e*this.c+n*this.d,s=e*this.d-n*this.c,this.a=r,this.b=i,this.c=o,this.d=s},t.prototype.shear=function(t,e){var n,r,i,o;return n=this.a+t*this.c,r=this.b+t*this.d,i=this.c+e*this.a,o=this.d+e*this.b,this.a=n,this.b=r,this.c=i,this.d=o},t.prototype.reflect_x=function(t){return this.tx=2*this.a*t+this.tx,this.ty=2*this.c*t+this.ty,this.a=-this.a,this.c=-this.c},t.prototype.reflect_y=function(t){return this.tx=2*this.b*t+this.tx,this.ty=2*this.d*t+this.ty,this.b=-this.b,this.d=-this.d},t.prototype.reflect_xy=function(t,e){return this.tx=2*(this.a*t+this.b*e)+this.tx,this.ty=2*(this.c*t+this.d*e)+this.ty,this.a=-this.a,this.b=-this.b,this.c=-this.c,this.d=-this.d},t.prototype.compose_right=function(t){var e,n,r,i,o,s;return e=this.a*t.a+this.b*t.c,n=this.a*t.b+this.b*t.d,r=this.c*t.a+this.d*t.c,i=this.c*t.b+this.d*t.d,o=this.a*t.tx+this.b*t.ty+this.tx,s=this.c*t.tx+this.d*t.ty+this.ty,this.a=e,this.b=n,this.c=r,this.d=i,this.tx=o,this.ty=s},t.prototype.compose_left=function(t){var e,n,r,i,o,s;return e=t.a*this.a+t.b*this.c,n=t.a*this.b+t.b*this.d,r=t.c*this.a+t.d*this.c,i=t.c*this.b+t.d*this.d,o=t.a*this.tx+t.b*this.ty+t.tx,s=t.c*this.tx+t.d*this.ty+t.ty,this.a=e,this.b=n,this.c=r,this.d=i,this.tx=o,this.ty=s},t}()})}.call(this),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("common/png_view",["./continuum_view"],function(t){var n,r;return n=function(t){function n(){return r=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.thumb_x=t.thumb_x||40,this.thumb_y=t.thumb_y||40,this.render(),this},n.prototype.render=function(){var t;return this.$el.html(""),t=this.model.get("png"),this.$el.append($(" "+this.model.get("title")+"
")),this.$el.append($(" "))},n}(t.View)})}.call(this),function(){n("common/random",[],function(){var t;return t=function(){function t(t){this.seed=t,this.multiplier=1664525,this.modulo=4294967296,this.offset=1013904223,null!=this.seed&&t>=0&&ta;a++)s=c[a],n=resolve_ref(s.type,s.id),n&&n.destroy({local:!0});else"status"===r.msgtype&&"subscribesuccess"===r.status[0]?(e=r.status[2],o.clientid=e,$.ajaxSetup({headers:{"Continuum-Clientid":e}})):console.log(r);return null})},a={WebSocketWrapper:s,submodels:l}})}.call(this),function(){n("server/serverutils",["common/base","server/serverutils","common/socket","common/load_models"],function(t,n,r,i){var o,s,a,l,c,u;return o={},s={},l={},a=r.WebSocketWrapper,c=r.submodels,o._doc_loaded=$.Deferred(),o._doc_requested=$.Deferred(),s.doc_loaded=o._doc_loaded.promise(),s.doc_requested=o._doc_requested.promise(),s.doc_promises={},l.wswrapper=null,l.plotcontext=null,l.plotcontextview=null,l.Promises=s,u={load_one_object_chain:function(t,n){var r,o,s;return r=e("common/base").Config,s=""+r.prefix+"/bokeh/objinfo/"+t+"/"+n,console.log(s),o=$.get(s),o.done(function(e){var n,r;return n=e.all_models,i(n),r=e.apikey,c(l.wswrapper,"bokehplot:"+t,r)}),o},load_user:function(){var t;return t=$.get("/bokeh/userinfo/",{})},load_doc_once:function(t){var e;return _.has(s.doc_promises,t)?(console.log("already found "+t+" in promises"),s.doc_promises[t]):(console.log(""+t+" not in promises, loading it"),e=u.load_doc(t),s.doc_promises[t]=e,e)},load_doc_by_title:function(t){var n,r;return n=e("common/base").Config,r=$.get(n.prefix+"/bokeh/doc",{title:t}).done(function(t){var e,n,r;return e=t.all_models,i(e),n=t.apikey,r=t.docid,c(l.wswrapper,"bokehplot:"+r,n)})},load_doc_static:function(t,e){" loads data without making a websocket connection ";var n;return load_data(e.all_models),n=jQuery.Deferred(),n.resolve(),n},load_doc:function(t){var n,r,o;return o=u.make_websocket(),n=e("common/base").Config,r=$.get(n.prefix+("/bokeh/bokehinfo/"+t+"/"),{}).done(function(e){var n,r;return n=e.all_models,i(n),r=e.apikey,c(l.wswrapper,"bokehplot:"+t,r)})},make_websocket:function(){var t,n;return t=e("common/base").Config,n=new a(t.ws_conn_string),l.wswrapper=n,n},render_plots:function(t,n,r){var i,o,s,a;return null==n&&(n=null),null==r&&(r={}),i=e("common/base").Collections,s=i(t.type).get(t.id),n||(n=s.default_view),o=_.extend(r,{model:s}),a=new n(o),s=s,a=a,a.render(),l.plotcontext=s,l.plotcontextview=a},bokeh_connection:function(t,e,n){return _.isUndefined(n)&&(n="https"),"pending"===s.doc_requested.state()?(o._doc_requested.resolve(),$.get(""+n+"://"+t+"/bokeh/publicbokehinfo/"+e,{},function(t){return console.log("instatiate_doc_single, docid",e),t=JSON.parse(t),i(t.all_models),o._doc_loaded.resolve(t)})):void 0}},l.utility=u,l})}.call(this),function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};n("server/embed_core",["common/base","common/load_models","server/serverutils"],function(e,n,r){var i,o,s,a,l,c,u,h,p,d,f,g,m;return m=r.utility,a=function(t,e){return s(t.bokeh_modelid,t.bokeh_modeltype,t.element,e)},s=function(t,r,i,o){var s,a,l;return s=_.keys(o)[0],!s!==t?(console.log("addPlot"),console.log(t,r,i),n(o[s]),a=e.Collections(r).get(t),l=new a.default_view({model:a}),l.render(),_.delay(function(){return $(i).replaceWith(l.$el)})):void 0},o=function(t){return console.log("addDirectPlotWrap"),i(t.bokeh_docid,t.bokeh_ws_conn_string,t.bokeh_docapikey,t.bokeh_root_url,t.bokeh_modelid,t.bokeh_modeltype,t.element)},f=function(t,n,r,i){var o,s;return console.log("serverLoad"),s={"BOKEH-API-KEY":r},$.ajaxSetup({headers:s}),o=e.Config,o.prefix=i,o.ws_conn_string=n,m.load_doc_once(t)},i=function(t,n,r,i,o,s,a){return f(t,n,r,i).done(function(){var t,n,r;return console.log("addPlot"),console.log(o,s,a),n=e.Collections(s),t=n.get(o),r=new t.default_view({model:t}),_.delay(function(){return $(a).replaceWith(r.$el)})})},h=function(t){var e,n;return e=[""+t+"css/bokeh.css",""+t+"css/continuum.css",""+t+"js/vendor/bootstrap/bootstrap-bokeh-2.0.4.css"],n=function(t){var e;return e=document.createElement("link"),e.href=t,e.rel="stylesheet",e.type="text/css",document.body.appendChild(e)},_.map(e,n)},u=[],p=function(t){"this takes a bokeh embed script element and returns the relvant\nattributes through to a dictionary, ";var e,n,r,i,o,s,a;for(n=t.attributes,i=/bokeh.*/,o={},r=0,s=0,a=n.length;a>s;s++)e=n[s],e.name.match(i)&&(o[e.name]=e.value,r++);return r>0?o:!1},g={},c=function(){var e,n,r,i,o,s,a,l,c,h,d;for(i=document.getElementsByTagName("script"),c=/.*embed.js.*/,l=[],h=0,d=i.length;d>h;h++)r=i[h],s=t.call(u,r)<0,a=r.src.match(c),s&&a&&(u.push(r),o=p(r),n=document.createElement("div"),e=document.createElement("div"),e.className="bokeh-container",r.parentNode.insertBefore(e,r),o.element=e,l.push(o));return l},d=function(t){var e,n;return n=function(e,n){var r;return"embeddata"!==e.bokeh_plottype?(o(e),delete g[n]):(r=_.keys(t)[0],n===r?(a(e,t),delete g[n]):void 0)},e=c(),_.each(e,function(t){return g[t.bokeh_modelid]=t}),_.map(g,n)},l={search_and_plot:d,injectCss:h}})}.call(this),n("server/usercontext/userdocstemplate",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){r(e('\n
\n'))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),n("server/usercontext/documentationtemplate",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){r(e("\n \n You have no Plots. Follow the intsructions\n below to create some\n \n
\n"))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),n("server/usercontext/wrappertemplate",[],function(){var t=function(t){var e=function(t){"undefined"==typeof t&&null==t&&(t="");var e=new String(t);return e.ecoSafe=!0,e};return function(){var t=[],n=this,r=function(e){"undefined"!=typeof e&&null!=e&&t.push(e.ecoSafe?e:n.escape(e))};return function(){r(e('\n\n\n\n'))}.call(this),t.join("")}.call(function(){var n,r={escape:function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},safe:e};for(n in t)r[n]=t[n];return r}())};return t}),function(){var t={}.hasOwnProperty,e=function(e,n){function r(){this.constructor=e}for(var i in n)t.call(n,i)&&(e[i]=n[i]);return r.prototype=n.prototype,e.prototype=new r,e.__super__=n.prototype,e};n("server/usercontext/usercontext",["common/base","../serverutils","common/continuum_view","./userdocstemplate","./documentationtemplate","./wrappertemplate","common/has_parent","common/build_views","common/load_models"],function(t,n,r,i,o,s,a,l){var c,u,h,p,d,f,g,m,v,y,b;return f={},c=r.View,g=n.utility,h=function(t){function n(){return m=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.template=s,n.prototype.attributes={"class":"accordion-group"},n.prototype.events={"click .bokehdoclabel":"loaddoc","click .bokehdelete":"deldoc"},n.prototype.deldoc=function(t){return t.preventDefault(),this.model.destroy(),!1},n.prototype.loaddoc=function(){return this.model.load()},n.prototype.initialize=function(t){return n.__super__.initialize.call(this,t),this.render_init()},n.prototype.delegateEvents=function(t){return n.__super__.delegateEvents.call(this,t),this.listenTo(this.model,"loaded",this.render)},n.prototype.render_init=function(){var t;return t=this.template({model:this.model,bodyid:_.uniqueId()}),this.$el.html(t)},n.prototype.render=function(){var t;return t=this.model.get_obj("plot_context"),this.plot_context_view=new t.default_view({model:t}),this.$el.find(".plots").append(this.plot_context_view.el),!0},n}(c),d=function(t){function n(){return v=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.initialize=function(t){return this.docs=t.docs,this.collection=t.collection,this.views={},n.__super__.initialize.call(this,t),this.render()},n.prototype.attributes={"class":"usercontext"},n.prototype.events={"click .bokehrefresh":function(){return this.collection.fetch({update:!0})}},n.prototype.delegateEvents=function(t){var e=this;return n.__super__.delegateEvents.call(this,t),this.listenTo(this.collection,"add",this.render),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"add",function(t){return e.listenTo(t,"loaded",function(){return e.listenTo(t.get_obj("plot_context"),"change",function(){return e.trigger("show")})})}),this.listenTo(this.collection,"remove",function(t){return e.stopListening(t)})},n.prototype.render_docs=function(){return this.$el.html(o()),this.$el.append(this.docs)},n.prototype.render=function(){var t,e,n,r,o;if(0===this.collection.models.length&&this.docs)return this.render_docs();for(t=i(),_.map(_.values(this.views),function(t){return t.$el.detach()}),n=this.collection.models.slice().reverse(),l(this.views,n,{}),this.$el.html(t),r=0,o=n.length;o>r;r++)e=n[r],this.$el.find(".accordion").append(this.views[e.id].el);return this},n}(c),u=function(t){function n(){return y=n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.default_view=h,n.prototype.idAttribute="docid",n.prototype.defaults={docid:null,title:null,plot_context:null,apikey:null},n.prototype.sync=function(){},n.prototype.destroy=function(t){return n.__super__.destroy.call(this,t),$.ajax({url:"/bokeh/doc/"+this.get("docid")+"/",type:"delete"})},n.prototype.load=function(t){var e,n,r,i=this;if(!this.loaded)return t?(r=this.get("title"),n=g.load_doc_by_title(r)):(e=this.get("docid"),n=g.load_doc(e)),n.done(function(t){return i.set("docid",t.docid),i.set("apikey",t.apikey),i.set("plot_context",t.plot_context_ref),i.trigger("loaded"),i.loaded=!0})},n}(a),p=function(n){function r(){return b=r.__super__.constructor.apply(this,arguments)}return e(r,n),r.prototype.model=u,r.prototype.subscribe=function(t,e){return t.subscribe("bokehuser:"+e,null),this.listenTo(t,"msg:bokehuser:"+e,function(t){return t=JSON.parse(t),"docchange"===t.msgtype?this.fetch({update:!0}):void 0})},r.prototype.fetch=function(e){var n,r,i,o=this;return _.isUndefined(e)&&(e={}),i=t.Config.prefix+"/bokeh/userinfo/",n=r=$.get(i,{}),n.done(function(t){var n;return n=t.docs,e.update?o.set(n,e):o.reset(n,e)}),n},r}(Backbone.Collection),f.UserDocs=p,f.UserDocsView=d,f.Doc=u,f.DocView=h,f})}.call(this),function(){n("server/serverrun",["common/base","./serverutils","./usercontext/usercontext","common/has_properties"],function(t,e,n,r){var i,o,s,a,l,c,u;return i=t.Config,o=e.Promises,i.ws_conn_string="ws://"+window.location.host+"/bokeh/sub",a=function(n,i){return r.prototype.sync=Backbone.sync,$(function(){var r,o;return o=e.utility.make_websocket(),r=e.utility.load_one_object_chain(n,i),r.done(function(e){var n,r;return n=t.Collections(e.type).get(i),r=new n.default_view({model:n}),l(r.el)})})},s=function(t){return r.prototype.sync=Backbone.sync,$(function(){var r,i;return i=e.utility.make_websocket(),r=new n.UserDocs,r.subscribe(i,"defaultuser"),window.userdocs=r,s=r.fetch(),s.done(function(){return null!=t?u(r,t):c(r)})})},c=function(t){var e;return e=new n.UserDocsView({collection:t}),l(e.el)},u=function(t,e){var n,r;return n=t.find(function(t){return t.get("title")===e}),null!=n?(n.on("loaded",function(){var t,e;return t=n.get_obj("plot_context"),e=new t.default_view({model:t}),l(e.el)}),n.load()):(r="Document '"+e+"' wasn't found on this server.",l(r),console.error(r))},l=function(t){return $("#PlotPane").append(t)},{load:s,load_one_object:a}})}.call(this),function(){n("main",["require","exports","module","backbone","underscore","common/base","common/base","common/gmap_plot","common/grid_plot","common/has_parent","common/has_properties","common/plot","common/plotting","common/affine","common/build_views","common/bulk_save","common/continuum_view","common/grid_view_state","common/load_models","common/plot_context","common/plot_widget","common/png_view","common/random","common/safebind","common/svg_colors","common/view_state","mapper/1d/linear_mapper","mapper/1d/categorical_mapper","mapper/2d/grid_mapper","mapper/color/linear_color_mapper","palettes/palettes","renderer/annotation/legend","renderer/glyph/glyph","renderer/glyph/glyph_factory","renderer/guide/categorical_axis","renderer/guide/datetime_axis","renderer/guide/grid","renderer/guide/linear_axis","renderer/overlay/box_selection","renderer/properties","server/embed_core","server/serverrun","server/serverutils","source/column_data_source","ticking/abstract_ticker","ticking/adaptive_ticker","ticking/basic_ticker","ticking/basic_tick_formatter","ticking/categorical_ticker","ticking/categorical_tick_formatter","ticking/composite_ticker","ticking/datetime_ticker","ticking/datetime_tick_formatter","ticking/days_ticker","ticking/months_ticker","ticking/single_interval_ticker","ticking/years_ticker","tool/box_select_tool","tool/box_zoom_tool","tool/crosshair_tool","tool/data_range_box_select_tool","tool/embed_tool","tool/hover_tool","tool/pan_tool","tool/preview_save_tool","tool/reset_tool","tool/resize_tool","tool/wheel_zoom_tool","tool/object_explorer_tool","server/serverrun","server/serverrun","widget/data_slider","widget/hbox","widget/vbox","widget/vboxmodelform","widget/textinput","util/object_explorer"],function(t,e){var n,r;return window.Float64Array||(console.warn("Float64Array is not supported. Using generic Array instead."),window.Float64Array=Array),n={},n.version="0.4.4",n.Backbone=t("backbone"),n._=t("underscore"),n.Collections=t("common/base").Collections,n.Config=t("common/base").Config,n.GMapPlot=t("common/gmap_plot"),n.GridPlot=t("common/grid_plot"),n.HasParent=t("common/has_parent"),n.HasProperties=t("common/has_properties"),n.Plot=t("common/plot"),n.Plotting=t("common/plotting"),n.Affine=t("common/affine"),n.build_views=t("common/build_views"),n.bulk_save=t("common/bulk_save"),n.ContinuumView=t("common/continuum_view"),n.GridViewState=t("common/grid_view_state"),n.load_models=t("common/load_models"),n.PlotContext=t("common/plot_context"),n.PlotWidget=t("common/plot_widget"),n.PNGView=t("common/png_view"),n.Random=t("common/random"),n.safebind=t("common/safebind"),n.SVGColors=t("common/svg_colors"),n.ViewState=t("common/view_state"),n.LinearMapper=t("mapper/1d/linear_mapper"),n.CategoricalMapper=t("mapper/1d/categorical_mapper"),n.GridMapper=t("mapper/2d/grid_mapper"),n.LinearColorMapper=t("mapper/color/linear_color_mapper"),n.Palettes=t("palettes/palettes"),n.Legend=t("renderer/annotation/legend"),n.Glyph=t("renderer/glyph/glyph"),r=t("renderer/glyph/glyph_factory"),n.AnnularWedge=r.annular_wedge,n.Annulus=r.annulus,n.Arc=r.arc,n.Asterisk=r.asterisk,n.Bezier=r.bezier,n.Circle=r.circle,n.CircleCross=r.circle_cross,n.CircleX=r.circle_x,n.Cross=r.cross,n.Diamond=r.diamond,n.DiamondCross=r.diamond_cross,n.Image=r.image,n.ImageRGBA=r.image_rgba,n.ImageURI=r.image_uri,n.InvertedTriangle=r.inverted_triangle,n.Line=r.line,n.MultiLine=r.multi_line,n.Oval=r.oval,n.Patch=r.patch,n.Patches=r.patches,n.Quad=r.quad,n.Quadratic=r.quadratic,n.Ray=r.ray,n.Rect=r.rect,n.Segment=r.segment,n.Square=r.square,n.SquareCross=r.square_cross,n.SquareX=r.square_x,n.Text=r.text,n.Triangle=r.triangle,n.Wedge=r.wedge,n.X=r.x,n.CategoricalAxis=t("renderer/guide/categorical_axis"),n.DatetimeAxis=t("renderer/guide/datetime_axis"),n.Grid=t("renderer/guide/grid"),n.LinearAxis=t("renderer/guide/linear_axis"),n.BoxSelection=t("renderer/overlay/box_selection"),n.Properties=t("renderer/properties"),n.embed_core=t("server/embed_core"),n.serverrun=t("server/serverrun"),n.serverutils=t("server/serverutils"),n.ColumnDataSource=t("source/column_data_source"),n.AbstractTicker=t("ticking/abstract_ticker"),n.AdaptiveTicker=t("ticking/adaptive_ticker"),n.BasicTicker=t("ticking/basic_ticker"),n.BasicTickFormatter=t("ticking/basic_tick_formatter"),n.CategoricalTicker=t("ticking/categorical_ticker"),n.CategoricalTickFormatter=t("ticking/categorical_tick_formatter"),n.CompositeTicker=t("ticking/composite_ticker"),n.DatetimeTicker=t("ticking/datetime_ticker"),n.DatetimeTickFormatter=t("ticking/datetime_tick_formatter"),n.DaysTicker=t("ticking/days_ticker"),n.MonthsTicker=t("ticking/months_ticker"),n.SingleIntervalTicker=t("ticking/single_interval_ticker"),n.YearsTicker=t("ticking/years_ticker"),n.BoxSelectTool=t("tool/box_select_tool"),n.BoxZoomTool=t("tool/box_zoom_tool"),n.CrosshairTool=t("tool/crosshair_tool"),n.DataRangeBoxSelectTool=t("tool/data_range_box_select_tool"),n.EmbedTool=t("tool/embed_tool"),n.HoverTool=t("tool/hover_tool"),n.PanTool=t("tool/pan_tool"),n.PreviewSaveTool=t("tool/preview_save_tool"),n.ResetTool=t("tool/reset_tool"),n.ResizeTool=t("tool/resize_tool"),n.WheelZoomTool=t("tool/wheel_zoom_tool"),n.ObjectExplorerTool=t("tool/object_explorer_tool"),n.one_object_page=t("server/serverrun").load_one_object,n.server_page=t("server/serverrun").load,n.DataSlider=t("widget/data_slider"),n.HBox=t("widget/hbox"),n.VBox=t("widget/vbox"),n.VBoxModelForm=t("widget/vboxmodelform"),n.TextInput=t("widget/textinput"),n.ObjectExplorer=t("util/object_explorer"),e.Bokeh=n,n
})}.call(this),e("main")});var _oldJQ=$;jQuery.noConflict(),"undefined"==typeof $&&($=_oldJQ);
/* END /Users/aihara/anaconda/lib/python2.7/site-packages/bokeh/server/static/js/bokeh.min.js */
Configuring embedded BokehJS mode.