window.Bokeh=Bokeh=function(){var t=void 0;return function e(t,r,n){function o(i){if(!r[i]){if(!t[i]){var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[i]={exports:{}},l=function(e){var r=t[i][1][e];return o(r?r:e)};l.modules=o.modules,t[i][0].call(a.exports,l,a,a.exports,e,t,r,n)}return r[i].exports}o.modules=t;for(var i=null,s=0;s0&&(f.debug("Sending "+n.events.length+" changes from model construction back to server"),i=u.create("PATCH-DOC",{},n),t.send(i)),t.session=new o(t,r,t.id),f.debug("Created a new session from new pulled doc"),null!=t._on_have_session_hook?(t._on_have_session_hook(t.session),t._on_have_session_hook=null):void 0)}}(this),function(t){throw t})["catch"](function(t){return null!=console.trace&&console.trace(t),f.error("Failed to repull session "+t)})},t.prototype._on_open=function(t,e){return f.info("Websocket connection "+this._number+" is now open"),this._pending_ack=[t,e],this._current_handler=function(t){return function(e){return t._awaiting_ack_handler(e)}}(this)},t.prototype._on_message=function(t){var e,r;try{return this._on_message_unchecked(t)}catch(r){return e=r,f.error("Error handling message: "+e+", "+t)}},t.prototype._on_message_unchecked=function(t){var e,r;if(null==this._current_handler&&f.error("got a message but haven't set _current_handler"),t.data instanceof ArrayBuffer?null==this._partial||this._partial.complete()?this._close_bad_protocol("Got binary from websocket but we were expecting text"):this._partial.add_buffer(t.data):null!=this._partial?this._close_bad_protocol("Got text from websocket but we were expecting binary"):(this._fragments.push(t.data),3===this._fragments.length&&(this._partial=u.assemble(this._fragments[0],this._fragments[1],this._fragments[2]),this._fragments=[],r=this._partial.problem(),null!==r&&this._close_bad_protocol(r))),null!=this._partial&&this._partial.complete())return e=this._partial,this._partial=null,this._current_handler(e)},t.prototype._on_close=function(t){var e,r;for(f.info("Lost websocket "+this._number+" connection, "+t.code+" ("+t.reason+")"),this.socket=null,null!=this._pending_ack&&(this._pending_ack[1](new Error("Lost websocket connection, "+t.code+" ("+t.reason+")")),this._pending_ack=null),e=function(){var t,e,r;e=this._pending_replies;for(r in e)return t=e[r],delete this._pending_replies[r],t;return null},r=e();null!==r;)r[1]("Disconnected"),r=e();if(!this.closed_permanently)return this._schedule_reconnect(2e3)},t.prototype._on_error=function(t){return f.debug("Websocket error on socket "+this._number),t(new Error("Could not open websocket"))},t.prototype._close_bad_protocol=function(t){if(f.error("Closing connection: "+t),null!=this.socket)return this.socket.close(1002,t)},t.prototype._awaiting_ack_handler=function(t){return"ACK"!==t.msgtype()?this._close_bad_protocol("First message was not an ACK"):(this._current_handler=function(t){return function(e){return t._steady_state_handler(e)}}(this),this._repull_session_doc(),null!=this._pending_ack?(this._pending_ack[0](this),this._pending_ack=null):void 0)},t.prototype._steady_state_handler=function(t){var e;return t.reqid()in this._pending_replies?(e=this._pending_replies[t.reqid()],delete this._pending_replies[t.reqid()],e[0](t)):t.msgtype()in m?m[t.msgtype()](this,t):f.debug("Doing nothing with message "+t.msgtype())},t}(),o=function(){function t(t,e,r){this._connection=t,this.document=e,this.id=r,this._current_patch=null,this.document_listener=function(t){return function(e){return t._document_changed(e)}}(this),this.document.on_change(this.document_listener)}return t.prototype.close=function(){return this._connection.close()},t.prototype._connection_closed=function(){return this.document.remove_on_change(this.document_listener)},t.prototype.request_server_info=function(){var t,e;return t=u.create("SERVER-INFO-REQ",{}),e=this._connection.send_with_reply(t),e.then(function(t){return t.content})},t.prototype.force_roundtrip=function(){return this.request_server_info().then(function(t){})},t.prototype._should_suppress_on_change=function(t,e){var r,n,o,i,s,a,u,p,f,m,g,y,v,b;if(e instanceof c){for(g=t.content.events,n=0,a=g.length;na;o=0<=a?++s:--s)u=r[o],p=n[o],ci&&(r=[i,o],o=r[0],i=r[1]),s>a&&(n=[a,s],s=n[0],a=n[1]),{minX:o,minY:s,maxX:i,maxY:a}},p=function(t){return t*t},s=function(t,e,r,n){return p(t-r)+p(e-n)},l=function(t,e,r){var n,o;return n=s(e.x,e.y,r.x,r.y),0===n?s(t.x,t.y,e.x,e.y):(o=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n,o<0?s(t.x,t.y,e.x,e.y):o>1?s(t.x,t.y,r.x,r.y):s(t.x,t.y,e.x+o*(r.x-e.x),e.y+o*(r.y-e.y)))},a=function(t,e,r){return Math.sqrt(l(t,e,r))},o=function(t,e,r,n,o,i,s,a){var l,u,c,p,h,_,d;return c=(a-i)*(r-t)-(s-o)*(n-e),0===c?{hit:!1,x:null,y:null}:(l=e-i,u=t-o,p=(s-o)*l-(a-i)*u,h=(r-t)*l-(n-e)*u,l=p/c,u=h/c,_=t+l*(r-t),d=e+l*(n-e),{hit:l>0&&l<1&&u>0&&u<1,x:_,y:d})},e.exports={point_in_poly:c,HitTestResult:n,create_hit_test_result:i,dist_2_pts:s,dist_to_segment:a,check_2_segments_intersect:o,validate_bbox_coords:h}},{}],"core/layout/layout_canvas":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;u=t("underscore"),p=t("./solver"),l=p.Variable,n=p.EQ,o=p.GE,a=p.Strength,s=t("../../model"),c=t("../properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="LayoutCanvas",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._top=new l("top "+this.id),this._left=new l("left "+this.id),this._width=new l("width "+this.id),this._height=new l("height "+this.id),this._right=new l("right "+this.id),this._bottom=new l("bottom "+this.id)},e.getters({height:function(){return this._height.value()},width:function(){return this._width.value()},right:function(){return this._right.value()},left:function(){return this._left.value()},top:function(){return this._top.value()},bottom:function(){return this._bottom.value()}}),e.internal({layout_location:[c.Any]}),e.prototype.get_edit_variables=function(){var t;return t=[],t.push({edit_variable:this._top,strength:a.strong}),t.push({edit_variable:this._left,strength:a.strong}),t.push({edit_variable:this._width,strength:a.strong}),t.push({edit_variable:this._height,strength:a.strong}),t},e.prototype.get_constraints=function(){return[]},e}(s),e.exports={Model:i}},{"../../model":"model","../properties":"core/properties","./solver":"core/layout/solver",underscore:"underscore"}],"core/layout/side_panel":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S=function(t,e){function r(){this.constructor=t}for(var n in e)z.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},z={}.hasOwnProperty;f=t("underscore"),M=t("./solver"),s=M.EQ,a=M.GE,c=t("./layout_canvas"),w=t("../../core/properties"),x=t("../../core/logging").logger,k=Math.PI/2,n="alphabetic",d="top",o="bottom",p="middle",l="hanging",u="left",h="right",i="center",v={above:{parallel:0,normal:-k,horizontal:0,vertical:-k},below:{parallel:0,normal:k,horizontal:0,vertical:k},left:{parallel:-k,normal:0,horizontal:0,vertical:-k},right:{parallel:k,normal:0,horizontal:0,vertical:k}},b={above:{justified:d,parallel:n,normal:p,horizontal:n,vertical:p},below:{justified:o,parallel:l,normal:p,horizontal:l,vertical:p},left:{justified:d,parallel:n,normal:p,horizontal:p,vertical:n},right:{justified:d,parallel:n,normal:p,horizontal:p,vertical:n}},m={above:{justified:i,parallel:i,normal:u,horizontal:i,vertical:u},below:{justified:i,parallel:i,normal:u,horizontal:i,vertical:h},left:{justified:i,parallel:i,normal:h,horizontal:h,vertical:i},right:{justified:i,parallel:i,normal:u,horizontal:u,vertical:i}},g={above:h,below:u,left:h,right:u},y={above:u,below:h,left:h,right:u},T=function(t){var e,r,n,o;if(o=t,(null==o.model.props.visible||o.model.visible!==!1)&&(n=o._get_size(),null==o._last_size&&(o._last_size=-1),n!==o._last_size))return e=o.model.document.solver(),o._last_size=n,null!=o._size_constraint&&e.remove_constraint(o._size_constraint),o._size_constraint=a(o.model.panel._size,-n),e.add_constraint(o._size_constraint),null==o._full_set&&(o._full_set=!1),o._full_set?void 0:(r=o.model.panel.side,"above"!==r&&"below"!==r||e.add_constraint(s(o.model.panel._width,[-1,o.plot_model.canvas._width])),"left"!==r&&"right"!==r||e.add_constraint(s(o.model.panel._height,[-1,o.plot_model.canvas._height])),o._full_set=!0)},_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,t),e.internal({side:[w.String],plot:[w.Instance]}),e.prototype.initialize=function(t,r){switch(e.__super__.initialize.call(this,t,r),this.side){case"above":return this._dim=0,this._normals=[0,-1],this._size=this._height,this._anchor=this._bottom;case"below":return this._dim=0,this._normals=[0,1],this._size=this._height,this._anchor=this._top;case"left":return this._dim=1,this._normals=[-1,0],this._size=this._width,this._anchor=this._right;case"right":return this._dim=1,this._normals=[1,0],this._size=this._width,this._anchor=this._left;default:return x.error("unrecognized side: '"+this.side+"'")}},e.prototype.get_constraints=function(){var t;return t=[],t.push(a(this._top)),t.push(a(this._bottom)),t.push(a(this._left)),t.push(a(this._right)),t.push(a(this._width)),t.push(a(this._height)),t.push(s(this._left,this._width,[-1,this._right])),t.push(s(this._bottom,this._height,[-1,this._top])),t},e.prototype.apply_label_text_heuristics=function(t,e){var r,n,o;return o=this.side,f.isString(e)?(n=b[o][e],r=m[o][e]):0===e?(n=b[o][e],r=m[o][e]):e<0?(n="middle",r=g[o]):e>0&&(n="middle",r=y[o]),t.textBaseline=n,t.textAlign=r,t},e.prototype.get_label_angle_heuristic=function(t){var e;return e=this.side,v[e][t]},e}(c.Model),e.exports={Model:_,update_constraints:T}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./layout_canvas":"core/layout/layout_canvas","./solver":"core/layout/solver",underscore:"underscore"}],"core/layout/solver":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_;c=t("underscore"),_=t("kiwi"),o=t("../events").Events,u=_.Variable,i=_.Expression,n=_.Constraint,s=_.Operator,l=_.Strength,p=function(t){return function(e){return function(){var e;return e=Object.create(i.prototype),i.apply(e,arguments),new n(e,t)}}(this)},h=function(t){return function(){var e,r,o,s;for(r=[null],o=0,s=arguments.length;o0)return n=s[e],null==n&&(n=s[e]=new t(e,r)),n;throw new TypeError("Logger.get() expects a string name and an optional log-level")},Object.defineProperty(t.prototype,"level",{get:function(){return this.get_level()}}),t.prototype.get_level=function(){return this._log_level},t.prototype.set_level=function(e){var r,o,s,l,c;if(e instanceof n)this._log_level=e;else{if(!i.isString(e)||null==t.log_levels[e])throw new Error("Logger.set_level() expects a log-level object or a string name of a log-level");this._log_level=t.log_levels[e]}o="["+this._name+"]",l=t.log_levels,c=[];for(r in l){if(e=l[r],e===t.OFF)break;s=e.name,e.levele;r=0<=e?++t:--t)o.push(i);return o}();return null!=this.spec.transform&&(o=this.spec.transform.v_compute(o)),o},t.prototype._init=function(t){var e,r,n,o;if(null==t&&(t=!0),o=this.obj,null==o)throw new Error("missing property object");if(null==o.properties)throw new Error("property object must be a HasProps");if(e=this.attr,null==e)throw new Error("missing property attr");if(r=o.getv(e),V.isUndefined(r)&&(n=this.default_value,r=function(){switch(!1){case!V.isUndefined(n):return null;case!V.isArray(n):return V.clone(n);case!V.isFunction(n):return n(o);default:return n}}(),o.setv(e,r,{silent:!0,defaults:!0})),V.isArray(r)?this.spec={value:r}:V.isObject(r)&&1===V.size(V.pick.apply(null,[r].concat(this.specifiers)))?this.spec=r:this.spec={value:r},null!=this.spec.field&&!V.isString(this.spec.field))throw new Error("field value for property '"+e+"' is not a string");if(null!=this.spec.value&&this.validate(this.spec.value),this.init(),t)return this.trigger("change")},t}(),Y=function(t,e){var r;return r=function(r){function n(){return n.__super__.constructor.apply(this,arguments)}return W(n,r),n.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},n.prototype.validate=function(r){if(!e(r))throw new Error(t+" property '"+this.attr+"' given invalid value: "+r)},n}(P)},a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Any",function(t){return!0})),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Array",function(t){return V.isArray(t)||t instanceof Float64Array})),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Bool",V.isBoolean)),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Color",function(t){return null!=H[t.toLowerCase()]||"#"===t.substring(0,1)||$(t)})),k=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Instance",function(t){return null!=t.properties})),E=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Number",function(t){return V.isNumber(t)||V.isBoolean(t)})),j=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Number",function(t){return(V.isNumber(t)||V.isBoolean(t))&&0<=t&&t<=1})),q=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("String",V.isString)),b=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(q),G=function(t,e){var r;return r=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return W(r,e),r.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},r}(Y(t,function(t){return K.call(e,t)>=0}))},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Anchor",U.LegendLocation)),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("AngleUnits",U.AngleUnits)),d=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.transform=function(t){var e,r,n,o;for(o=new Uint8Array(t.length),e=r=0,n=t.length;0<=n?rn;e=0<=n?++r:--r)switch(t[e]){case"clock":o[e]=!1;break;case"anticlock":o[e]=!0}return o},e}(G("Direction",U.Direction)),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Dimension",U.Dimension)),_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Dimensions",U.Dimensions)),w=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("FontStyle",U.FontStyle)),T=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LineCap",U.LineCap)),S=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LineJoin",U.LineJoin)),M=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LegendLocation",U.LegendLocation)),z=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Location",U.Location)),C=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Orientation",U.Orientation)),R=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TextAlign",U.TextAlign)),L=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TextBaseline",U.TextBaseline)),N=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("RenderLevel",U.RenderLevel)),O=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("RenderMode",U.RenderMode)),D=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("SizingMode",U.SizingMode)),F=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("SpatialUnits",U.SpatialUnits)),y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Distribution",U.DistributionTypes)),B=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TransformStepMode",U.TransformStepModes)),X=function(t,e,r){var n;return n=function(n){function o(){return o.__super__.constructor.apply(this,arguments)}return W(o,n),o.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},o.prototype.init=function(){var n;if(null==this.spec.units&&(this.spec.units=r),this.units=this.spec.units,n=this.spec.units,K.call(e,n)<0)throw new Error(t+" units must be one of "+e+", given invalid value: "+n)},o}(E)},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.transform=function(t){var r;return"deg"===this.spec.units&&(t=function(){var e,n,o;for(o=[],e=0,n=t.length;e0)&&"pinch"===e?(l.debug("Registering scroll on touch screen"),t.listenTo(this,"scroll:"+r,t._scroll)):void 0)},t.prototype._trigger=function(t,e){var r,n,o;if(n=t.split(":")[0],("ontouchstart"in window||navigator.maxTouchPoints>0)&&"scroll"===t&&(n="pinch"),o=this.toolbar.gestures,r=o[n].active,null!=r)return this._trigger_event(t,r,e)},t.prototype._trigger_event=function(t,e,r){if(e.active===!0)return"scroll"===t&&(r.preventDefault(),r.stopPropagation()),this.trigger(t+":"+e.id,r)},t.prototype._bokify_hammer=function(t){var e,r,o,i,s,a,l;return"mouse"===t.pointerType?(a=t.srcEvent.pageX,l=t.srcEvent.pageY):(a=t.pointers[0].pageX,l=t.pointers[0].pageY),r=n(t.target).offset(),e=null!=(o=r.left)?o:0,s=null!=(i=r.top)?i:0,t.bokeh={sx:a-e,sy:l-s}},t.prototype._bokify_jq=function(t){var e,r,o,i,s;return r=n(t.currentTarget).offset(),e=null!=(o=r.left)?o:0,s=null!=(i=r.top)?i:0,t.bokeh={sx:t.pageX-e,sy:t.pageY-s}},t.prototype._tap=function(t){return this._bokify_hammer(t),this._trigger("tap",t)},t.prototype._doubletap=function(t){return this._bokify_hammer(t),this.trigger("doubletap",t)},t.prototype._press=function(t){return this._bokify_hammer(t),this._trigger("press",t)},t.prototype._pan_start=function(t){return this._bokify_hammer(t),t.bokeh.sx-=t.deltaX,t.bokeh.sy-=t.deltaY,this._trigger("pan:start",t)},t.prototype._pan=function(t){return this._bokify_hammer(t),this._trigger("pan",t)},t.prototype._pan_end=function(t){return this._bokify_hammer(t),this._trigger("pan:end",t)},t.prototype._pinch_start=function(t){return this._bokify_hammer(t),this._trigger("pinch:start",t)},t.prototype._pinch=function(t){return this._bokify_hammer(t),this._trigger("pinch",t)},t.prototype._pinch_end=function(t){return this._bokify_hammer(t),this._trigger("pinch:end",t)},t.prototype._rotate_start=function(t){return this._bokify_hammer(t),this._trigger("rotate:start",t)},t.prototype._rotate=function(t){return this._bokify_hammer(t),this._trigger("rotate",t)},t.prototype._rotate_end=function(t){return this._bokify_hammer(t),this._trigger("rotate:end",t)},t.prototype._mouse_enter=function(t){return this._bokify_jq(t),this.trigger("move:enter",t)},t.prototype._mouse_move=function(t){return this._bokify_jq(t),this.trigger("move",t)},t.prototype._mouse_exit=function(t){return this._bokify_jq(t),this.trigger("move:exit",t)},t.prototype._mouse_wheel=function(t,e){return this._bokify_jq(t),t.bokeh.delta=e,this._trigger("scroll",t)},t.prototype._key_down=function(t){return this.trigger("keydown",t)},t.prototype._key_up=function(t){return this.trigger("keyup",t)},t}(),e.exports={UIEvents:s}},{"./events":"core/events","./logging":"core/logging",hammerjs:"hammerjs",jquery:"jquery","jquery-mousewheel":"jquery-mousewheel",underscore:"underscore"}],"core/util/bbox":[function(t,e,r){var n,o;n=function(){return{minX:1/0,minY:1/0,maxX:-(1/0),maxY:-(1/0)}},o=function(t,e){var r;return r={},r.minX=Math.min(t.minX,e.minX),r.maxX=Math.max(t.maxX,e.maxX),r.minY=Math.min(t.minY,e.minY),r.maxY=Math.max(t.maxY,e.maxY),r},e.exports={empty:n,union:o}},{}],"core/util/canvas":[function(t,e,r){var n,o,i,s,a,l;i=function(t){if(t.setLineDash||(t.setLineDash=function(e){return t.mozDash=e,t.webkitLineDash=e}),!t.getLineDash)return t.getLineDash=function(){return t.mozDash}},s=function(t){return t.setLineDashOffset=function(e){return t.lineDashOffset=e,t.mozDashOffset=e,t.webkitLineDashOffset=e},t.getLineDashOffset=function(){return t.mozDashOffset}},o=function(t){return t.setImageSmoothingEnabled=function(e){return t.imageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.oImageSmoothingEnabled=e,t.webkitImageSmoothingEnabled=e},t.getImageSmoothingEnabled=function(){var e;return null==(e=t.imageSmoothingEnabled)||e}},a=function(t){if(t.measureText&&null==t.html5MeasureText)return t.html5MeasureText=t.measureText,t.measureText=function(e){var r;return r=t.html5MeasureText(e),r.ascent=1.6*t.html5MeasureText("m").width,r}},l=function(t,e){var r,n;return e?(n=window.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n/r):1},n=function(t){var e;if(e=function(e,r,n,o,i,s,a,l){var u,c,p;null==l&&(l=!1),u=.551784,t.translate(e,r),t.rotate(i),c=n,p=o,l&&(c=-n,p=-o),t.moveTo(-c,0),t.bezierCurveTo(-c,p*u,-c*u,p,0,p),t.bezierCurveTo(c*u,p,c,p*u,c,0),t.bezierCurveTo(c,-p*u,c*u,-p,0,-p),t.bezierCurveTo(-c*u,-p,-c,-p*u,-c,0),t.rotate(-i),t.translate(-e,-r)},!t.ellipse)return t.ellipse=e},e.exports={fixup_image_smoothing:o,fixup_line_dash:i,fixup_line_dash_offset:s,fixup_measure_text:a,get_scale_ratio:l,fixup_ellipse:n}},{}],"core/util/color":[function(t,e,r){var n,o,i,s,a,l=[].indexOf||function(t){for(var e=0,r=this.length;e=0)throw new Error("color expects rgb to have value between 0 and 255");return!0},e.exports={color2hex:o,color2rgba:i,valid_rgb:a}},{"./svg_colors":"core/util/svg_colors"}],"core/util/data_structures":[function(t,e,r){var n,o,i;i=t("underscore"),n=function(){function t(){this._dict={}}return t.prototype._existing=function(t){return t in this._dict?this._dict[t]:null},t.prototype.add_value=function(t,e){var r;if(null===e)throw new Error("Can't put null in this dict");if(i.isArray(e))throw new Error("Can't put arrays in this dict");return r=this._existing(t),null===r?this._dict[t]=e:i.isArray(r)?r.push(e):this._dict[t]=[r,e]},t.prototype.remove_value=function(t,e){var r,n;return r=this._existing(t),i.isArray(r)?(n=i.without(r,e),n.length>0?this._dict[t]=n:delete this._dict[t]):i.isEqual(r,e)?delete this._dict[t]:void 0},t.prototype.get_one=function(t,e){var r;if(r=this._existing(t),i.isArray(r)){if(1===r.length)return r[0];throw new Error(e)}return r},t}(),o=function(){function t(e){if(e){if(e.constructor===t)return new t(e.values);e.constructor===Array?this.values=t.compact(e):this.values=[e]}else this.values=[]}return t.compact=function(t){var e,r,n,o;for(o=[],r=0,n=t.length;rr&&(r=n);return r},i=function(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t},o=function(t,e){return Math.abs(i(t-e))},n=function(t,e,r,n){var s;return t=i(t),s=o(e,r),"anticlock"===n?o(e,t)<=s&&o(t,r)<=s:!(o(e,t)<=s&&o(t,r)<=s)},u=function(){return Math.random()},l=function(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])},c=function(t,e){var r,n,o;for(r=null,n=null;;)if(r=u(),n=u(),n=(2*n-1)*Math.sqrt(2*(1/Math.E)),-4*r*r*Math.log(r)>=n*n)break;return o=n/r,o=t+e*o},e.exports={array_min:a,array_max:s,angle_norm:i,angle_dist:o,angle_between:n,atan2:l,rnorm:c,random:u}},{}],"core/util/proj4":[function(t,e,r){var n;e.exports=n=t("proj4/lib/core"),n.defaultDatum="WGS84",n.Proj=t("proj4/lib/Proj"),n.WGS84=new n.Proj("WGS84"),n.toPoint=t("proj4/lib/common/toPoint"),n.defs=t("proj4/lib/defs"),n.transform=t("proj4/lib/transform")},{"proj4/lib/Proj":"proj4/lib/Proj","proj4/lib/common/toPoint":"proj4/lib/common/toPoint","proj4/lib/core":"proj4/lib/core","proj4/lib/defs":"proj4/lib/defs","proj4/lib/transform":"proj4/lib/transform"}],"core/util/projections":[function(t,e,r){var n,o,i,s;n=t("./proj4"),s=n.defs("GOOGLE"),i=function(t,e){var r,o,i,a,l,u,c,p;for(a=[],u=[],r=o=0,c=t.length;0<=c?oc;r=0<=c?++o:--o)p=n(s,[t[r],e[r]]),i=p[0],l=p[1],a[r]=i,u[r]=l;return[a,u]},o=function(t,e){var r,n,o,s,a,l,u,c;for(s=[],l=[],r=n=0,u=t.length;0<=u?nu;r=0<=u?++n:--n)c=i(t[r],e[r]),o=c[0],a=c[1],s[r]=o,l[r]=a;return[s,l]},e.exports={project_xy:i,project_xsys:o}},{"./proj4":"core/util/proj4"}],"core/util/refs":[function(t,e,r){var n,o,i,s,a;o=t("underscore"),n=t("../has_props"),s=function(t){var e;if(!(t instanceof n.constructor))throw new Error("can only create refs for HasProps subclasses");return e={type:t.type,id:t.id},null!=t._subtype&&(e.subtype=t._subtype),e},a=function(t){var e;if(o.isObject(t)){if(e=o.keys(t).sort(),2===e.length)return"id"===e[0]&&"type"===e[1];if(3===e.length)return"id"===e[0]&&"subtype"===e[1]&&"type"===e[2]}return!1},i=function(t){return o.isArray(t)?o.map(t,i):t instanceof n.constructor?t.ref():void 0},e.exports={convert_to_ref:i,create_ref:s,is_ref:a}},{"../has_props":"core/has_props",underscore:"underscore"}],"core/util/selection":[function(t,e,r){var n;n=function(t){var e;return e=t.selected,e["0d"].glyph?e["0d"].indices:e["1d"].indices.length>0?e["1d"].indices:e["2d"].indices.length>0?e["2d"].indices:[]},e.exports={get_indices:n}},{}],"core/util/svg_colors":[function(t,e,r){e.exports={indianred:"#CD5C5C",lightcoral:"#F08080",salmon:"#FA8072",darksalmon:"#E9967A",lightsalmon:"#FFA07A",crimson:"#DC143C",red:"#FF0000",firebrick:"#B22222",darkred:"#8B0000",pink:"#FFC0CB",lightpink:"#FFB6C1",hotpink:"#FF69B4",deeppink:"#FF1493",mediumvioletred:"#C71585",palevioletred:"#DB7093",coral:"#FF7F50",tomato:"#FF6347",orangered:"#FF4500",darkorange:"#FF8C00",orange:"#FFA500",gold:"#FFD700",yellow:"#FFFF00",lightyellow:"#FFFFE0",lemonchiffon:"#FFFACD",lightgoldenrodyellow:"#FAFAD2",papayawhip:"#FFEFD5",moccasin:"#FFE4B5",peachpuff:"#FFDAB9",palegoldenrod:"#EEE8AA",khaki:"#F0E68C",darkkhaki:"#BDB76B",lavender:"#E6E6FA",thistle:"#D8BFD8",plum:"#DDA0DD",violet:"#EE82EE",orchid:"#DA70D6",fuchsia:"#FF00FF",magenta:"#FF00FF",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",blueviolet:"#8A2BE2",darkviolet:"#9400D3",darkorchid:"#9932CC",darkmagenta:"#8B008B",purple:"#800080",indigo:"#4B0082",slateblue:"#6A5ACD",darkslateblue:"#483D8B",mediumslateblue:"#7B68EE",greenyellow:"#ADFF2F",chartreuse:"#7FFF00",lawngreen:"#7CFC00",lime:"#00FF00",limegreen:"#32CD32",palegreen:"#98FB98",lightgreen:"#90EE90",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",mediumseagreen:"#3CB371",seagreen:"#2E8B57",forestgreen:"#228B22",green:"#008000",darkgreen:"#006400",yellowgreen:"#9ACD32",olivedrab:"#6B8E23",olive:"#808000",darkolivegreen:"#556B2F",mediumaquamarine:"#66CDAA",darkseagreen:"#8FBC8F",lightseagreen:"#20B2AA",darkcyan:"#008B8B",teal:"#008080",aqua:"#00FFFF",cyan:"#00FFFF",lightcyan:"#E0FFFF",paleturquoise:"#AFEEEE",aquamarine:"#7FFFD4",turquoise:"#40E0D0",mediumturquoise:"#48D1CC",darkturquoise:"#00CED1",cadetblue:"#5F9EA0",steelblue:"#4682B4",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",lightblue:"#ADD8E6",skyblue:"#87CEEB",lightskyblue:"#87CEFA",deepskyblue:"#00BFFF",dodgerblue:"#1E90FF",cornflowerblue:"#6495ED",royalblue:"#4169E1",blue:"#0000FF",mediumblue:"#0000CD",darkblue:"#00008B",navy:"#000080",midnightblue:"#191970",cornsilk:"#FFF8DC",blanchedalmond:"#FFEBCD",bisque:"#FFE4C4",navajowhite:"#FFDEAD",wheat:"#F5DEB3",burlywood:"#DEB887",tan:"#D2B48C",rosybrown:"#BC8F8F",sandybrown:"#F4A460",goldenrod:"#DAA520",darkgoldenrod:"#B8860B",peru:"#CD853F",chocolate:"#D2691E",saddlebrown:"#8B4513",sienna:"#A0522D",brown:"#A52A2A",maroon:"#800000",white:"#FFFFFF",snow:"#FFFAFA",honeydew:"#F0FFF0",mintcream:"#F5FFFA",azure:"#F0FFFF",aliceblue:"#F0F8FF",ghostwhite:"#F8F8FF",whitesmoke:"#F5F5F5",seashell:"#FFF5EE",beige:"#F5F5DC",oldlace:"#FDF5E6",floralwhite:"#FFFAF0",ivory:"#FFFFF0",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lavenderblush:"#FFF0F5",mistyrose:"#FFE4E1",gainsboro:"#DCDCDC",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",silver:"#C0C0C0",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",gray:"#808080",grey:"#808080",dimgray:"#696969",dimgrey:"#696969",lightslategray:"#778899",lightslategrey:"#778899",slategray:"#708090",slategrey:"#708090",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",black:"#000000"}},{}],"core/util/templating":[function(t,e,r){var n,o,i,s,a;i=t("underscore"),o=t("sprintf"),n=t("numbro"),s=function(t){var e;return i.isNumber(t)?(e=function(){switch(!1){case Math.floor(t)!==t:return"%d";case!(Math.abs(t)>.1&&Math.abs(t)<1e3):return"%0.3f";default:return"%0.3e"}}(),o.sprintf(e,t)):""+t},a=function(t,e,r,o){return null==o&&(o={}),t=t.replace(/(^|[^\$])\$(\w+)/g,function(t){return function(t,e,r){return e+"@$"+r}}(this)),t=t.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g,function(t){return function(t,a,l,u,c){var p,h,_;return l=null!=u?u:l,_="$"===l[0]?o[l.substring(1)]:null!=(p=e.get_column(l))?p[r]:void 0,h=null==_?"???":null!=c?n.format(_,c):s(_),""+a+i.escape(h)}}(this))},e.exports={replace_placeholders:a}},{numbro:"numbro",sprintf:"sprintf",underscore:"underscore"}],"core/util/text":[function(t,e,r){var n,o,i;n=t("jquery"),o={},i=function(t){var e,r,i,s,a;if(null!=o[t])return o[t];a=n("Hg").css({font:t}),e=n('
'),i=n("
"),i.append(a,e),r=n("body"),r.append(i);try{s={},e.css({verticalAlign:"baseline"}),s.ascent=e.offset().top-a.offset().top,e.css({verticalAlign:"bottom"}),s.height=e.offset().top-a.offset().top,s.descent=s.height-s.ascent}finally{i.remove()}return o[t]=s,s},e.exports={get_text_height:i}},{jquery:"jquery"}],"core/util/throttle":[function(t,e,r){var n,o,i;n=function(t){return t()},o=("undefined"!=typeof window&&null!==window?window.requestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.mozRequestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.webkitRequestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.msRequestAnimationFrame:void 0)||n,i=function(t,e){var r,n,i,s,a,l,u,c;return l=[null,null,null,null],n=l[0],r=l[1],c=l[2],u=l[3],a=0,s=!1,i=function(){return a=new Date,c=null,s=!1,u=t.apply(n,r)},function(){var t,l;return t=new Date,l=e-(t-a),n=this,r=arguments,l<=0&&!s?(clearTimeout(c),s=!0,o(i)):c||s||(c=setTimeout(function(){return o(i)},l)),u}},e.exports={throttle:i}},{}],"core/util/underscore":[function(t,e,r){var n,o;n=t("underscore"),o=function(){return n.uniqueId=function(t){var e,r,n,o,i;for(o=[],e="0123456789ABCDEF",r=n=0;n<=31;r=++n)o[r]=e.substr(Math.floor(16*Math.random()),1);return o[12]="4",o[16]=e.substr(3&o[16]|8,1),i=o.join(""),t?t+"-"+i:i}},n.isNullOrUndefined=function(t){return n.isNull(t)||n.isUndefined(t)},n.setdefault=function(t,e,r){return n.has(t,e)?t[e]:(t[e]=r,r)},e.exports={patch:o}},{underscore:"underscore"}],"core/util/zoom":[function(t,e,r){var n;n=function(t,e,r,n,o){var i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A;null==r&&(r=!0),null==n&&(n=!0),null==o&&(o=null),s=t.h_range,b=t.v_range,e>.9?e=.9:e<-.9&&(e=-.9),u=[s.start,s.end],k=u[0],w=u[1],c=[b.start,b.end],S=c[0],T=c[1],x=null!=o?o.x:(w+k)/2,M=null!=o?o.y:(T+S)/2,r?(m=k-(k-x)*e,g=w-(w-x)*e):(m=k,g=w),n?(y=S-(S-M)*e,v=T-(T-M)*e):(y=S,v=T),z={},p=t.x_mappers;for(l in p)a=p[l],h=a.v_map_from_target([m,g]),f=h[0],i=h[1],z[l]={start:f,end:i};E={},_=t.y_mappers;for(l in _)a=_[l],d=a.v_map_from_target([y,v]),f=d[0],i=d[1],E[l]={start:f,end:i};return A={xrs:z,yrs:E,factor:e}},e.exports={scale_range:n}},{}],"core/visuals":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),c=t("./property_mixins"),u=t("./util/color").color2rgba,n=function(){function t(t,e){var r,n,o,i,s;for(null==e&&(e=""),this.obj=t,this.prefix=e,this.cache={},n=t.properties[e+this.do_attr].spec,this.doit=!l.isNull(n.value),s=this.attrs,o=0,i=s.length;o0;)t.push(this.remove_root(this._roots[0]));return t}finally{this._pop_all_models_freeze()}},t.prototype._destructively_move=function(t){var e,r,n,o,i,s;if(t===this)throw new Error("Attempted to overwrite a document with itself");t.clear(),s=[],this._push_all_models_freeze();try{for(;this._roots.length>0;)this.remove_root(this._roots[0]),s.push(i)}finally{this._pop_all_models_freeze()}for(e=0,n=s.length;e=0)){this._push_all_models_freeze();try{this._roots.push(t),t._is_root=!0}finally{this._pop_all_models_freeze()}return this._init_solver(),this._trigger_on_change(new _(this,t))}},t.prototype.remove_root=function(t){var e;if(e=this._roots.indexOf(t),!(e<0)){this._push_all_models_freeze();try{this._roots.splice(e,1),t._is_root=!1}finally{this._pop_all_models_freeze()}return this._init_solver(),this._trigger_on_change(new d(this,t))}},t.prototype.title=function(){return this._title},t.prototype.set_title=function(t){if(t!==this._title)return this._title=t,this._trigger_on_change(new g(this,t))},t.prototype.get_model_by_id=function(t){return t in this._all_models?this._all_models[t]:null},t.prototype.get_model_by_name=function(t){return this._all_models_by_name.get_one(t,"Multiple models are named '"+t+"'")},t.prototype.on_change=function(t){if(!(z.call(this._callbacks,t)>=0))return this._callbacks.push(t)},t.prototype.remove_on_change=function(t){var e;if(e=this._callbacks.indexOf(t),e>=0)return this._callbacks.splice(e,1)},t.prototype._trigger_on_change=function(t){var e,r,n,o,i;for(o=this._callbacks,i=[],r=0,n=o.length;r0||v.difference(w,i).length>0)throw new Error("Not implemented: computing add/remove of document roots");T={},n=[],g=r._all_models;for(a in g)_=g[a],a in o&&(M=t._events_to_sync_objects(o[a],x[a],r,T),n=n.concat(M));return{events:n,references:t._references_json(v.values(T),l=!1)}},t.prototype.to_json_string=function(t){return null==t&&(t=!0),JSON.stringify(this.to_json(t))},t.prototype.to_json=function(e){var r,n,o,i,s,a;for(null==e&&(e=!0),s=[],i=this._roots,r=0,n=i.length;r"),n("body").append(e)},z=function(t){var e;return e=n("