@quartic/bokehjs
Version:
Interactive, novel data visualization
7 lines • 656 kB
JavaScript
window.Bokeh=Bokeh=function(){var t=void 0;return function e(t,r,o){function i(n){if(!r[n]){if(!t[n]){var s=new Error("Cannot find module '"+n+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[n]={exports:{}},l=function(e){var r=t[n][1][e];return i(r?r:e)};l.modules=i.modules,t[n][0].call(a.exports,l,a,a.exports,e,t,r,o)}return r[n].exports}i.modules=t;var n=i(o[0]);return n.require=i,n}({base:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i={}.hasOwnProperty,n=t("./models/index"),s=t("./core/util/object");r.overrides={},o=s.clone(n),r.Models=function(t){var e,i;if(e=null!=(i=r.overrides[t])?i:o[t],null==e)throw new Error("Model `"+t+"' does not exist. This could be due to a widget or a custom model not being registered before first usage.");return e},r.Models.register=function(t,e){return r.overrides[t]=e},r.Models.unregister=function(t){return delete r.overrides[t]},r.Models.register_models=function(t,e,r){var n,s,a;if(null==e&&(e=!1),null==r&&(r=null),null!=t){a=[];for(s in t)i.call(t,s)&&(n=t[s],e||!o.hasOwnProperty(s)?a.push(o[s]=n):a.push("function"==typeof r?r(s):void 0));return a}},r.Models.registered_names=function(){return Object.keys(o)},r.index={}},{"./core/util/object":"core/util/object","./models/index":"models/index"}],client:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i,n,s,a=t("es6-promise"),l=t("./core/logging"),u=t("./core/util/string"),c=t("./core/util/object"),_=t("./document");r.DEFAULT_SERVER_WEBSOCKET_URL="ws://localhost:5006/ws",r.DEFAULT_SESSION_ID="default",n=function(){function t(t,e,r){this.header=t,this.metadata=e,this.content=r,this.buffers=[]}return t.assemble=function(e,r,o){var i,n,s,a;try{return s=JSON.parse(e),a=JSON.parse(r),i=JSON.parse(o),new t(s,a,i)}catch(u){throw n=u,l.logger.error("Failure parsing json "+n+" "+e+" "+r+" "+o,n),n}},t.create_header=function(t,e){var r;return r={msgid:u.uniqueId(),msgtype:t},c.extend(r,e)},t.create=function(e,r,o){var i;return null==o&&(o={}),i=t.create_header(e,r),new t(i,{},o)},t.prototype.send=function(t){var e,r,o,i;try{return o=JSON.stringify(this.header),i=JSON.stringify(this.metadata),e=JSON.stringify(this.content),t.send(o),t.send(i),t.send(e)}catch(n){throw r=n,l.logger.error("Error sending ",this,r),r}},t.prototype.complete=function(){return null!=this.header&&null!=this.metadata&&null!=this.content&&(!("num_buffers"in this.header)||this.buffers.length===this.header.num_buffers)},t.prototype.add_buffer=function(t){return this.buffers.push(t)},t.prototype._header_field=function(t){return t in this.header?this.header[t]:null},t.prototype.msgid=function(){return this._header_field("msgid")},t.prototype.msgtype=function(){return this._header_field("msgtype")},t.prototype.sessid=function(){return this._header_field("sessid")},t.prototype.reqid=function(){return this._header_field("reqid")},t.prototype.problem=function(){return"msgid"in this.header?"msgtype"in this.header?null:"No msgtype in header":"No msgid in header"},t}(),s={"PATCH-DOC":function(t,e){return t._for_session(function(t){return t._handle_patch(e)})},OK:function(t,e){return l.logger.debug("Unhandled OK reply to "+e.reqid())},ERROR:function(t,e){return l.logger.error("Unhandled ERROR reply to "+e.reqid()+": "+e.content.text)}},o=function(){function t(e,o,i,n,s){this.url=e,this.id=o,this.args_string=i,this._on_have_session_hook=n,this._on_closed_permanently_hook=s,this._number=t._connection_count,t._connection_count=this._number+1,null==this.url&&(this.url=r.DEFAULT_SERVER_WEBSOCKET_URL),null==this.id&&(this.id=r.DEFAULT_SESSION_ID),l.logger.debug("Creating websocket "+this._number+" to '"+this.url+"' session '"+this.id+"'"),this.socket=null,this.closed_permanently=!1,this._fragments=[],this._partial=null,this._current_handler=null,this._pending_ack=null,this._pending_replies={},this.session=null}return t._connection_count=0,t.prototype._for_session=function(t){if(null!==this.session)return t(this.session)},t.prototype.connect=function(){var t,e,r;if(this.closed_permanently)return a.Promise.reject(new Error("Cannot connect() a closed ClientConnection"));if(null!=this.socket)return a.Promise.reject(new Error("Already connected"));this._fragments=[],this._partial=null,this._pending_replies={},this._current_handler=null;try{return r=this.url+"?bokeh-protocol-version=1.0&bokeh-session-id="+this.id,(null!=(e=this.args_string)?e.length:void 0)>0&&(r+="&"+this.args_string),null!=window.MozWebSocket?this.socket=new MozWebSocket(r):this.socket=new WebSocket(r),new a.Promise(function(t){return function(e,r){return t.socket.binarytype="arraybuffer",t.socket.onopen=function(){return t._on_open(e,r)},t.socket.onmessage=function(e){return t._on_message(e)},t.socket.onclose=function(e){return t._on_close(e)},t.socket.onerror=function(){return t._on_error(r)}}}(this))}catch(o){return t=o,l.logger.error("websocket creation failed to url: "+this.url),l.logger.error(" - "+t),a.Promise.reject(t)}},t.prototype.close=function(){if(!this.closed_permanently&&(l.logger.debug("Permanently closing websocket connection "+this._number),this.closed_permanently=!0,null!=this.socket&&this.socket.close(1e3,"close method called on ClientConnection "+this._number),this._for_session(function(t){return t._connection_closed()}),null!=this._on_closed_permanently_hook))return this._on_closed_permanently_hook(),this._on_closed_permanently_hook=null},t.prototype._schedule_reconnect=function(t){var e;return e=function(t){return function(){t.closed_permanently||l.logger.info("Websocket connection "+t._number+" disconnected, will not attempt to reconnect")}}(this),setTimeout(e,t)},t.prototype.send=function(t){var e;try{if(null===this.socket)throw new Error("not connected so cannot send "+t);return t.send(this.socket)}catch(r){return e=r,l.logger.error("Error sending message ",e,t)}},t.prototype.send_event=function(t){var e;return e=n.create("EVENT",{},JSON.stringify(t)),this.send(e)},t.prototype.send_with_reply=function(t){var e;return e=new a.Promise(function(e){return function(r,o){return e._pending_replies[t.msgid()]=[r,o],e.send(t)}}(this)),e.then(function(t){if("ERROR"===t.msgtype())throw new Error("Error reply "+t.content.text);return t},function(t){throw t})},t.prototype._pull_doc_json=function(){var t,e;return t=n.create("PULL-DOC-REQ",{}),e=this.send_with_reply(t),e.then(function(t){if(!("doc"in t.content))throw new Error("No 'doc' field in PULL-DOC-REPLY");return t.content.doc},function(t){throw t})},t.prototype._repull_session_doc=function(){return null===this.session?l.logger.debug("Pulling session for first time"):l.logger.debug("Repulling session"),this._pull_doc_json().then(function(t){return function(e){var r,o,s;return null!==t.session?(t.session.document.replace_with_json(e),l.logger.debug("Updated existing session with new pulled doc")):t.closed_permanently?l.logger.debug("Got new document after connection was already closed"):(r=_.Document.from_json(e),o=_.Document._compute_patch_since_json(e,r),o.events.length>0&&(l.logger.debug("Sending "+o.events.length+" changes from model construction back to server"),s=n.create("PATCH-DOC",{},o),t.send(s)),t.session=new i(t,r,t.id),l.logger.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),l.logger.error("Failed to repull session "+t)})},t.prototype._on_open=function(t,e){return l.logger.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;try{return this._on_message_unchecked(t)}catch(r){return e=r,l.logger.error("Error handling message: "+e+", "+t)}},t.prototype._on_message_unchecked=function(t){var e,r;if(null==this._current_handler&&l.logger.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=n.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(l.logger.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(t){return function(){var e,r,o;r=t._pending_replies;for(o in r)return e=r[o],delete t._pending_replies[o],e;return null}}(this),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 l.logger.debug("Websocket error on socket "+this._number),t(new Error("Could not open websocket"))},t.prototype._close_bad_protocol=function(t){if(l.logger.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 s?s[t.msgtype()](this,t):l.logger.debug("Doing nothing with message "+t.msgtype())},t}(),i=function(){function t(t,e,r){this._connection=t,this.document=e,this.id=r,this.document_listener=function(t){return function(e){return t._document_changed(e)}}(this),this.document.on_change(this.document_listener),this.event_manager=this.document.event_manager,this.event_manager.session=this}return t.prototype.close=function(){return this._connection.close()},t.prototype.send_event=function(t){return this._connection.send_event(t)},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=n.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._document_changed=function(t){var e;if(t.setter_id!==this.id&&(!(t instanceof _.ModelChangedEvent)||t.attr in t.model.serializable_attributes()))return e=n.create("PATCH-DOC",{},this.document.create_json_patch([t])),this._connection.send(e)},t.prototype._handle_patch=function(t){return this.document.apply_json_patch(t.content,this.id)},t}(),r.pull_session=function(t,e,r){var i,n,s;return s=null,i=null,n=new a.Promise(function(n,s){return i=new o(t,e,r,function(t){var e;try{return n(t)}catch(r){throw e=r,l.logger.error("Promise handler threw an error, closing session "+error),t.close(),e}},function(){return s(new Error("Connection was closed before we successfully pulled a session"))}),i.connect().then(function(t){},function(t){throw l.logger.error("Failed to connect to Bokeh server "+t),t})}),n.close=function(){return i.close()},n}},{"./core/logging":"core/logging","./core/util/object":"core/util/object","./core/util/string":"core/util/string","./document":"document","es6-promise":"es6-promise"}],"core/backbone":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
var o=t("./events"),i=t("./util/eq"),n=t("./util/object");r.Model=function(t,e){var r=t||{};e||(e={}),this.attributes={},this.setv(r,e),this.changed={},this.initialize.apply(this,arguments)},n.extend(r.Model.prototype,o.Events,{changed:null,initialize:function(){},getv:function(t){return this.attributes[t]},setv:function(t,e,r){if(null==t)return this;var o;"object"==typeof t?(o=t,r=e):(o={})[t]=e,r||(r={});var s=r.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=n.clone(this.attributes),this.changed={});var u=this.attributes,c=this.changed,_=this._previousAttributes;for(var p in o)e=o[p],i.isEqual(u[p],e)||a.push(p),i.isEqual(_[p],e)?delete c[p]:c[p]=e,u[p]=e;if(!s){a.length&&(this._pending=!0);for(var h=0;h<a.length;h++)this.trigger("change:"+a[h],this,u[a[h]])}if(l)return this;if(!s)for(;this._pending;)this._pending=!1,this.trigger("change",this);return this._pending=!1,this._changing=!1,this},destroy:function(){this.stopListening(),this.trigger("destroy",this)},clone:function(){return new this.constructor(this.attributes)}}),r.View=function(t){t=t||{},this.model=t.model,this.id=t.id,this.el=t.el,this._ensureElement(),this.initialize(t)},n.extend(r.View.prototype,o.Events,{tagName:"div",initialize:function(t){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){var t=this.el.parentNode;null!=t&&t.removeChild(this.el)},setElement:function(t){return this._setElement(t),this},_setElement:function(t){this.el=t},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){this.el?this.setElement(this.el):(this.setElement(this._createElement(this.tagName)),this.id&&this.el.setAttribute("id",this.id),this.className&&this.el.setAttribute("class",this.className))}}),r.Model.getter=r.View.getter=function(t,e){Object.defineProperty(this.prototype,t,{get:e})},r.Model.getters=r.View.getters=function(t){for(var e in t)this.getter(e,t[e])}},{"./events":"core/events","./util/eq":"core/util/eq","./util/object":"core/util/object"}],"core/bokeh_events":[function(t,e,r){"use strict";function o(t){return function(e){e.prototype.event_name=t,u[t]=e}}function i(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var o=t.prototype.applicable_models.concat(e);t.prototype.applicable_models=o}var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),s=this&&this.__decorate||function(t,e,r,o){var i,n=arguments.length,s=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,r,s):i(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s};Object.defineProperty(r,"__esModule",{value:!0});var a=t("./logging"),l=t("./util/object"),u={};r.register_event_class=o,r.register_with_event=i;var c=function(){function t(t){void 0===t&&(t={}),this._options=t,t.model_id&&(this.model_id=t.model_id)}return t.prototype.set_model_id=function(t){return this._options.model_id=t,this.model_id=t,this},t.prototype.is_applicable_to=function(t){return this.applicable_models.some(function(e){return t instanceof e})},t.event_class=function(t){return t.type?u[t.type]:void a.logger.warn("BokehEvent.event_class required events with a string type attribute")},t.prototype.toJSON=function(){return{event_name:this.event_name,event_values:l.clone(this._options)}},t.prototype._customize_event=function(t){return this},t}();r.BokehEvent=c,c.prototype.applicable_models=[];var _=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(c);_=s([o("button_click")],_),r.ButtonClick=_;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(c);r.UIEvent=p;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(p);h=s([o("lodstart")],h),r.LODStart=h;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(p);d=s([o("lodend")],d),r.LODEnd=d;var f=function(t){function e(e){var r=t.call(this,e)||this;return r.sx=e.sx,r.sy=e.sy,r.x=null,r.y=null,r}return n(e,t),e.from_event=function(t,e){return void 0===e&&(e=null),new this({sx:t.bokeh.sx,sy:t.bokeh.sy,model_id:e})},e.prototype._customize_event=function(t){var e=t.plot_canvas.frame.x_mappers["default"],r=t.plot_canvas.frame.y_mappers["default"];return this.x=e.map_from_target(t.plot_canvas.canvas.sx_to_vx(this.sx)),this.y=r.map_from_target(t.plot_canvas.canvas.sy_to_vy(this.sy)),this._options.x=this.x,this._options.y=this.y,this},e}(p);r.PointEvent=f;var m=function(t){function e(e){void 0===e&&(e={});var r=t.call(this,e)||this;return r.delta_x=e.delta_x,r.delta_y=e.delta_y,r}return n(e,t),e.from_event=function(t,e){return void 0===e&&(e=null),new this({sx:t.bokeh.sx,sy:t.bokeh.sy,delta_x:t.deltaX,delta_y:t.deltaY,direction:t.direction,model_id:e})},e}(f);m=s([o("pan")],m),r.Pan=m;var y=function(t){function e(e){void 0===e&&(e={});var r=t.call(this,e)||this;return r.scale=e.scale,r}return n(e,t),e.from_event=function(t,e){return void 0===e&&(e=null),new this({sx:t.bokeh.sx,sy:t.bokeh.sy,scale:t.scale,model_id:e})},e}(f);y=s([o("pinch")],y),r.Pinch=y;var g=function(t){function e(e){void 0===e&&(e={});var r=t.call(this,e)||this;return r.delta=e.delta,r}return n(e,t),e.from_event=function(t,e){return void 0===e&&(e=null),new this({sx:t.bokeh.sx,sy:t.bokeh.sy,delta:t.delta,model_id:e})},e}(f);g=s([o("wheel")],g),r.MouseWheel=g;var v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);v=s([o("mousemove")],v),r.MouseMove=v;var b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);b=s([o("mouseenter")],b),r.MouseEnter=b;var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);w=s([o("mouseleave")],w),r.MouseLeave=w;var x=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);x=s([o("tap")],x),r.Tap=x;var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);k=s([o("doubletap")],k),r.DoubleTap=k;var T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);T=s([o("press")],T),r.Press=T;var M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);M=s([o("panstart")],M),r.PanStart=M;var j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);j=s([o("panend")],j),r.PanEnd=j;var O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);O=s([o("pinchstart")],O),r.PinchStart=O;var S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(f);S=s([o("pinchend")],S),r.PinchEnd=S},{"./logging":"core/logging","./util/object":"core/util/object"}],"core/bokeh_view":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=t("./backbone"),s=t("./util/string");r.BokehView=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.initialize=function(t){if(null==t.id)return this.id=s.uniqueId("BokehView")},e.prototype.toString=function(){return this.model.type+"View("+this.id+")"},e.prototype.bind_bokeh_events=function(){},e.prototype.remove=function(){return this.trigger("remove",this),e.__super__.remove.call(this)},e}(n.View)},{"./backbone":"core/backbone","./util/string":"core/util/string"}],"core/build_views":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t("./util/array"),i=t("./util/object");r.build_views=function(t,e,r,n){var s,a,l,u,c,_,p,h,d,f,m,y,g,v;for(null==n&&(n=[]),a=[],f=e.filter(function(e){return null==t[e.id]}),u=l=0,p=f.length;l<p;u=++l)d=f[u],s=null!=(m=n[u])?m:d.default_view,v=i.extend({model:d},r),t[d.id]=g=new s(v),a.push(g);for(y=o.difference(Object.keys(t),function(){var t,r,o;for(o=[],t=0,r=e.length;t<r;t++)g=e[t],o.push(g.id);return o}()),c=0,h=y.length;c<h;c++)_=y[c],t[_].remove(),delete t[_];return a}},{"./util/array":"core/util/array","./util/object":"core/util/object"}],"core/dom":[function(t,e,r){"use strict";function o(t,e){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return _(t).apply(void 0,[e].concat(r))}function i(t){t.style.display=""}function n(t){t.style.display="none"}function s(t){for(var e;e=t.firstChild;)t.removeChild(e)}function a(t){return{top:t.offsetTop,left:t.offsetLeft}}function l(t){var e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset-document.documentElement.clientTop,left:e.left+window.pageXOffset-document.documentElement.clientLeft}}function u(t,e){var r=t.parentNode;null!=r&&r.replaceChild(e,t)}Object.defineProperty(r,"__esModule",{value:!0});var c=t("./util/types"),_=function(t){return function(e){function r(t){if(t instanceof HTMLElement)n.appendChild(t);else if(c.isString(t))n.appendChild(document.createTextNode(t));else if(null!=t&&t!==!1)throw new Error("expected an HTMLElement, string, false or null, got "+JSON.stringify(t))}void 0===e&&(e={});for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];var n;if("fragment"===t)n=document.createDocumentFragment();else{n=document.createElement(t);for(var s in e){var a=e[s];if(null!=a&&(!c.isBoolean(a)||a))if("class"===s&&c.isArray(a))for(var l=0,u=a;l<u.length;l++){var _=u[l];null!=_&&n.classList.add(_)}else if("style"===s&&c.isObject(a))for(var p in a)n.style[p]=a[p];else n.setAttribute(s,a)}}for(var h=0,d=o;h<d.length;h++){var f=d[h];if(c.isArray(f))for(var m=0,y=f;m<y.length;m++){var g=y[m];r(g)}else r(f)}return n}};r.createElement=o,r.div=_("div"),r.span=_("span"),r.link=_("link"),r.style=_("style"),r.a=_("a"),r.p=_("p"),r.pre=_("pre"),r.input=_("input"),r.label=_("label"),r.canvas=_("canvas"),r.ul=_("ul"),r.ol=_("ol"),r.li=_("li"),r.show=i,r.hide=n,r.empty=s,r.position=a,r.offset=l,r.replaceWith=u},{"./util/types":"core/util/types"}],"core/enums":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AngleUnits=["deg","rad"],r.Dimension=["width","height"],r.Dimensions=["width","height","both"],r.Direction=["clock","anticlock"],r.FontStyle=["normal","italic","bold"],r.LatLon=["lat","lon"],r.LineCap=["butt","round","square"],r.LineJoin=["miter","round","bevel"],r.Location=["above","below","left","right"],r.LegendLocation=["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"],r.Orientation=["vertical","horizontal"],r.RenderLevel=["image","underlay","glyph","annotation","overlay"],r.RenderMode=["canvas","css"],r.Side=["left","right"],r.SpatialUnits=["screen","data"],r.StartEnd=["start","end"],r.TextAlign=["left","right","center"],r.TextBaseline=["top","middle","bottom","alphabetic","hanging","ideographic"],r.DistributionTypes=["uniform","normal"],r.TransformStepModes=["after","before","center"],r.SizingMode=["stretch_both","scale_width","scale_height","scale_both","fixed"]},{}],"core/events":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
var o=t("./util/string"),i=t("./util/callback");r.Events={};var n=/\s+/,s=function(t,e,r,o,i){var a,l=0;if(r&&"object"==typeof r){void 0!==o&&"context"in i&&void 0===i.context&&(i.context=o);for(a=Object.keys(r);l<a.length;l++)e=s(t,e,a[l],r[a[l]],i)}else if(r&&n.test(r))for(a=r.split(n);l<a.length;l++)e=t(e,a[l],o,i);else e=t(e,r,o,i);return e};r.Events.on=function(t,e,r){return a(this,t,e,r)};var a=function(t,e,r,o,i){if(t._events=s(l,t._events||{},e,r,{context:o,ctx:t,listening:i}),i){var n=t._listeners||(t._listeners={});n[i.id]=i}return t};r.Events.listenTo=function(t,e,r){if(!t)return this;var i=t._listenId||(t._listenId=o.uniqueId("l")),n=this._listeningTo||(this._listeningTo={}),s=n[i];if(!s){var l=this._listenId||(this._listenId=o.uniqueId("l"));s=n[i]={obj:t,objId:i,id:l,listeningTo:n,count:0}}return a(t,e,r,this,s),this};var l=function(t,e,r,o){if(r){var i=t[e]||(t[e]=[]),n=o.context,s=o.ctx,a=o.listening;a&&a.count++,i.push({callback:r,context:n,ctx:n||s,listening:a})}return t};r.Events.off=function(t,e,r){return this._events?(this._events=s(u,this._events,t,e,{context:r,listeners:this._listeners}),this):this},r.Events.stopListening=function(t,e,r){var o=this._listeningTo;if(!o)return this;for(var i=t?[t._listenId]:Object.keys(o),n=0;n<i.length;n++){var s=o[i[n]];if(!s)break;s.obj.off(e,r,this)}return this};var u=function(t,e,r,o){if(t){var i,n=0,s=o.context,a=o.listeners;if(e||r||s){for(var l=e?[e]:Object.keys(t);n<l.length;n++){e=l[n];var u=t[e];if(!u)break;for(var c=[],_=0;_<u.length;_++){var p=u[_];r&&r!==p.callback&&r!==p.callback._callback||s&&s!==p.context?c.push(p):(i=p.listening,i&&0===--i.count&&(delete a[i.id],delete i.listeningTo[i.objId]))}c.length?t[e]=c:delete t[e]}return t}for(var h=Object.keys(a);n<h.length;n++)i=a[h[n]],delete a[i.id],delete i.listeningTo[i.objId]}};r.Events.once=function(t,e,r){var o=s(c,{},t,e,this.off.bind(this));return"string"==typeof t&&null==r&&(e=void 0),this.on(o,e,r)},r.Events.listenToOnce=function(t,e,r){var o=s(c,{},e,r,this.stopListening.bind(this,t));return this.listenTo(t,o)};var c=function(t,e,r,o){if(r){var n=t[e]=i.once(function(){o(e,n),r.apply(this,arguments)});n._callback=r}return t};r.Events.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),r=Array(e),o=0;o<e;o++)r[o]=arguments[o+1];return s(_,this._events,t,void 0,r),this};var _=function(t,e,r,o){if(t){var i=t[e],n=t.all;i&&n&&(n=n.slice()),i&&p(i,o),n&&p(n,[e].concat(o))}return t},p=function(t,e){var r,o=-1,i=t.length,n=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++o<i;)(r=t[o]).callback.call(r.ctx);return;case 1:for(;++o<i;)(r=t[o]).callback.call(r.ctx,n);return;case 2:for(;++o<i;)(r=t[o]).callback.call(r.ctx,n,s);return;case 3:for(;++o<i;)(r=t[o]).callback.call(r.ctx,n,s,a);return;default:for(;++o<i;)(r=t[o]).callback.apply(r.ctx,e);return}}},{"./util/callback":"core/util/callback","./util/string":"core/util/string"}],"core/has_props":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=[].slice,s=t("./backbone"),a=t("./logging"),l=t("./property_mixins"),u=t("./util/refs"),c=t("./properties"),_=t("./util/string"),p=t("./util/array"),h=t("./util/object"),d=t("./util/types");r.HasProps=function(t){function e(t,e){var r,o,i,n,s,a;this.document=null,r=t||{},e||(e={}),this.attributes={},this.properties={},n=this.props;for(i in n){if(s=n[i],a=s.type,o=s.default_value,null==a)throw new Error("undefined property type for "+this.type+"."+i);this.properties[i]=new a({obj:this,attr:i,default_value:o})}this._set_after_defaults={},this.setv(r,e),this.changed={},this._computed={},null==r.id&&(this.id=_.uniqueId(this.type)),e.defer_initialization||this.initialize.apply(this,arguments)}return o(e,t),e.prototype.props={},e.prototype.mixins=[],e.define=function(t){var e,r,o;o=[];for(e in t)r=t[e],o.push(function(t){return function(e,r){var o,i,n,s,a;if(null!=t.prototype.props[e])throw new Error("attempted to redefine property '"+t.name+"."+e+"'");if(null!=t.prototype[e])throw new Error("attempted to redefine attribute '"+t.name+"."+e+"'");return Object.defineProperty(t.prototype,e,{get:function(){var t;return t=this.getv(e)},set:function(t){return this.setv(e,t),this}},{configurable:!1,enumerable:!0}),a=r[0],o=r[1],i=r[2],s={type:a,default_value:o,internal:null!=i&&i},n=h.clone(t.prototype.props),n[e]=s,t.prototype.props=n}}(this)(e,r));return o},e.internal=function(t){var e,r,o,i;e={},r=function(t){return function(t,r){var o,i;return i=r[0],o=r[1],e[t]=[i,o,!0]}}(this);for(o in t)i=t[o],r(o,i);return this.define(e)},e.mixin=function(){var t,e;return e=1<=arguments.length?n.call(arguments,0):[],this.define(l.create(e)),t=this.prototype.mixins.concat(e),this.prototype.mixins=t},e.mixins=function(t){return this.mixin.apply(this,t)},e.override=function(t,e){var r,o,i;d.isString(t)?(o={},o[r]=e):o=t,i=[];for(r in o)e=o[r],i.push(function(t){return function(e,r){var o,i;if(i=t.prototype.props[e],null==i)throw new Error("attempted to override nonexistent '"+t.name+"."+e+"'");return o=h.clone(t.prototype.props),o[e]=h.extend({},i,{default_value:r}),t.prototype.props=o}}(this)(r,e));return i},e.define({id:[c.Any]}),e.prototype.toString=function(){return this.type+"("+this.id+")"},e.prototype.initialize=function(t){var e,r,o,i;o=this.properties,i=[];for(e in o)r=o[e],r.update(),r.spec.transform?i.push(this.listenTo(r.spec.transform,"change",function(){return this.trigger("transformchange",this)})):i.push(void 0);return i},e.prototype.setv=function(t,r,o){var n,s,a,l,u;d.isObject(t)||null===t?(n=t,o=r):(n={},n[t]=r);for(t in n)if(i.call(n,t)){if(u=n[t],a=t,null==this.props[a])throw new Error("property "+this.type+"."+a+" wasn't declared");null!=o&&o.defaults||(this._set_after_defaults[t]=!0)}if(!h.isEmpty(n)){s={};for(t in n)r=n[t],s[t]=this.getv(t);if(e.__super__.setv.call(this,n,o),null==(null!=o?o.silent:void 0)){l=[];for(t in n)r=n[t],l.push(this._tell_document_about_change(t,s[t],this.getv(t),o));return l}}},e.prototype.add_dependencies=function(t,e,r){var o,i,n,s,a;for(d.isArray(r)||(r=[r]),s=this._computed[t],s.dependencies=s.dependencies.concat({obj:e,fields:r}),a=[],i=0,n=r.length;i<n;i++)o=r[i],a.push(this.listenTo(e,"change:"+o,s.callbacks.changedep));return a},e.prototype.define_computed_property=function(t,e,r){var o,i,n;if(null==r&&(r=!0),null!=this.props[t]&&console.log("attempted to redefine existing property "+this.type+"."+t),null!=this._computed[t])throw new Error("attempted to redefine existing computed property "+this.type+"."+t);return o=function(e){return function(){return e.trigger("changedep:"+t)}}(this),n=function(e){return function(){var r,o,n;if(r=!0,i.use_cache&&(n=i.cache,i.cache=void 0,o=e._get_computed(t),r=o!==n),r)return e.trigger("change:"+t,e,e._get_computed(t)),e.trigger("change",e)}}(this),i={getter:e,dependencies:[],use_cache:r,callbacks:{changedep:o,propchange:n}},this._computed[t]=i,this.listenTo(this,"changedep:"+t,i.callbacks.propchange),i},e.prototype.set=function(t,e,r){return a.logger.warn("HasProps.set('prop_name', value) is deprecated, use HasProps.prop_name = value instead"),this.setv(t,e,r)},e.prototype.get=function(t){return a.logger.warn("HasProps.get('prop_name') is deprecated, use HasProps.prop_name instead"),this.getv(t)},e.prototype.getv=function(t){if(null==this.props[t])throw new Error("property "+this.type+"."+t+" wasn't declared");return e.__super__.getv.call(this,t)},e.prototype._get_computed=function(t){var e,r,o;if(o=this._computed[t],null==o)throw new Error("computed property "+this.type+"."+t+" wasn't declared");return o.use_cache&&o.cache?o.cache:(r=o.getter,e=r.apply(this,[t]),o.use_cache&&(o.cache=e),e)},e.prototype.ref=function(){return u.create_ref(this)},e.prototype.set_subtype=function(t){return this._subtype=t},e.prototype.attribute_is_serializable=function(t){var e;if(e=this.props[t],null==e)throw new Error(this.type+".attribute_is_serializable('"+t+"'): "+t+" wasn't declared");return!e.internal},e.prototype.serializable_attributes=function(){var t,e,r,o;t={},r=this.attributes;for(e in r)o=r[e],this.attribute_is_serializable(e)&&(t[e]=o);return t},e._value_to_json=function(t,r,o){var n,s,a,l,u,c,_;if(r instanceof e)return r.ref();if(d.isArray(r)){for(l=[],n=s=0,a=r.length;s<a;n=++s)_=r[n],l.push(e._value_to_json(n,_,r));return l}if(d.isObject(r)){u={};for(c in r)i.call(r,c)&&(u[c]=e._value_to_json(c,r[c],r));return u}return r},e.prototype.attributes_as_json=function(t,r){var o,n,s,a;null==t&&(t=!0),null==r&&(r=e._value_to_json),o={},s=this.serializable_attributes();for(n in s)i.call(s,n)&&(a=s[n],t?o[n]=a:n in this._set_after_defaults&&(o[n]=a));return r("attributes",o,this)},e._json_record_references=function(t,r,o,n){var s,a,l,c,_,p,h;if(null==r);else if(u.is_ref(r)){if(!(r.id in o))return _=t.get_model_by_id(r.id),e._value_record_references(_,o,n)}else{if(d.isArray(r)){for(p=[],a=0,c=r.length;a<c;a++)s=r[a],p.push(e._json_record_references(t,s,o,n));return p}if(d.isObject(r)){h=[];for(l in r)i.call(r,l)&&(s=r[l],h.push(e._json_record_references(t,s,o,n)));return h}}},e._value_record_references=function(t,r,o){var n,s,a,l,u,c,_,p,h,f,m;if(null==t);else if(t instanceof e){if(!(t.id in r)&&(r[t.id]=t,o)){for(s=t._immediate_references(),h=[],a=0,c=s.length;a<c;a++)p=s[a],h.push(e._value_record_references(p,r,!0));return h}}else if(t.buffer instanceof ArrayBuffer);else{if(d.isArray(t)){for(f=[],u=0,_=t.length;u<_;u++)n=t[u],f.push(e._value_record_references(n,r,o));return f}if(d.isObject(t)){m=[];for(l in t)i.call(t,l)&&(n=t[l],m.push(e._value_record_references(n,r,o)));return m}}},e.prototype._immediate_references=function(){var t,r,o,i;o={},t=this.serializable_attributes();for(r in t)i=t[r],e._value_record_references(i,o,!1);return h.values(o)},e.prototype.references=function(){var t;return t={},e._value_record_references(this,t,!0),h.values(t)},e.prototype.attach_document=function(t){if(null!==this.document&&this.document!==t)throw new Error("models must be owned by only a single document");if(this.document=t,null!=this._doc_attached)return this._doc_attached()},e.prototype.detach_document=function(){return this.document=null},e.prototype._tell_document_about_change=function(t,r,o,i){var n,s,a,l,u,c,_;if(this.attribute_is_serializable(t)&&null!==this.document){l={},e._value_record_references(o,l,!1),_={},e._value_record_references(r,_,!1),n=!1;for(s in l)if(a=l[s],!(s in _)){n=!0;break}if(!n)for(u in _)if(c=_[u],!(u in l)){n=!0;break}return n&&this.document._invalidate_all_models(),this.document._notify_change(this,t,r,o,i)}},e.prototype.materialize_dataspecs=function(t){var e,r,o,i;e={},i=this.properties;for(r in i)o=i[r],o.dataspec&&(!o.optional||null!==o.spec.value||r in this._set_after_defaults)&&(e["_"+r]=o.array(t),null!=o.spec.field&&o.spec.field in t._shapes&&(e["_"+r+"_shape"]=t._shapes[o.spec.field]),o instanceof c.Distance&&(e["max_"+r]=p.max(e["_"+r])));return e},e}(s.Model)},{"./backbone":"core/backbone","./logging":"core/logging","./properties":"core/properties","./property_mixins":"core/property_mixins","./util/array":"core/util/array","./util/object":"core/util/object","./util/refs":"core/util/refs","./util/string":"core/util/string","./util/types":"core/util/types"}],"core/hittest":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i,n,s=t("./util/array");r.point_in_poly=function(t,e,r,o){var i,n,s,a,l,u,c,_;for(n=!1,l=r[r.length-1],c=o[o.length-1],i=s=0,a=r.length;0<=a?s<a:s>a;i=0<=a?++s:--s)u=r[i],_=o[i],c<e!=_<e&&l+(e-c)/(_-c)*(u-l)<t&&(n=!n),l=u,c=_;return n},i=function(){return null},r.HitTestResult=function(){function t(){this["0d"]={glyph:null,get_view:i,indices:[]},this["1d"]={indices:[]},this["2d"]={indices:{}}}return Object.defineProperty(t.prototype,"_0d",{get:function(){return this["0d"]}}),Object.defineProperty(t.prototype,"_1d",{get:function(){return this["1d"]}}),Object.defineProperty(t.prototype,"_2d",{get:function(){return this["2d"]}}),t.prototype.is_empty=function(){return 0===this._0d.indices.length&&0===this._1d.indices.length},t}(),r.create_hit_test_result=function(){return new r.HitTestResult},r.create_1d_hit_test_result=function(t){var e,o,i;return i=new r.HitTestResult,i["1d"].indices=function(){var r,i,n,a,l;for(n=s.sortBy(t,function(t){var e,r;return e=t[0],r=t[1]}),l=[],r=0,i=n.length;r<i;r++)a=n[r],o=a[0],e=a[1],l.push(o);return l}(),i},r.validate_bbox_coords=function(t,e){var r,o,i,n,s,a;return i=t[0],n=t[1],s=e[0],a=e[1],i>n&&(r=[n,i],i=r[0],n=r[1]),s>a&&(o=[a,s],s=o[0],a=o[1]),{minX:i,minY:s,maxX:n,maxY:a}},n=function(t){return t*t},r.dist_2_pts=function(t,e,r,o){return n(t-r)+n(e-o)},o=function(t,e,o){var i,n;return i=r.dist_2_pts(e.x,e.y,o.x,o.y),0===i?r.dist_2_pts(t.x,t.y,e.x,e.y):(n=((t.x-e.x)*(o.x-e.x)+(t.y-e.y)*(o.y-e.y))/i,n<0?r.dist_2_pts(t.x,t.y,e.x,e.y):n>1?r.dist_2_pts(t.x,t.y,o.x,o.y):r.dist_2_pts(t.x,t.y,e.x+n*(o.x-e.x),e.y+n*(o.y-e.y)))},r.dist_to_segment=function(t,e,r){return Math.sqrt(o(t,e,r))},r.check_2_segments_intersect=function(t,e,r,o,i,n,s,a){var l,u,c,_,p,h,d;return c=(a-n)*(r-t)-(s-i)*(o-e),0===c?{hit:!1,x:null,y:null}:(l=e-n,u=t-i,_=(s-i)*l-(a-n)*u,p=(r-t)*l-(o-e)*u,l=_/c,u=p/c,h=t+l*(r-t),d=e+l*(o-e),{hit:l>0&&l<1&&u>0&&u<1,x:h,y:d})}},{"./util/array":"core/util/array"}],"core/layout/layout_canvas":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=t("./solver"),s=t("../../model"),a=t("../properties");r.LayoutCanvas=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.type="LayoutCanvas",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._top=new n.Variable("top "+this.id),this._left=new n.Variable("left "+this.id),this._width=new n.Variable("width "+this.id),this._height=new n.Variable("height "+this.id),this._right=new n.Variable("right "+this.id),this._bottom=new n.Variable("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:[a.Any]}),e.prototype.get_edit_variables=function(){var t;return t=[],t.push({edit_variable:this._top,strength:n.Strength.strong}),t.push({edit_variable:this._left,strength:n.Strength.strong}),t.push({edit_variable:this._width,strength:n.Strength.strong}),t.push({edit_variable:this._height,strength:n.Strength.strong}),t},e.prototype.get_constraints=function(){return[]},e}(s.Model)},{"../../model":"model","../properties":"core/properties","./solver":"core/layout/solver"}],"core/layout/side_panel":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i,n,s,a,l,u,c,_,p,h,d,f,m,y=function(t,e){function r(){this.constructor=t}for(var o in e)g.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty,v=t("./solver"),b=t("./layout_canvas"),w=t("core/properties"),x=t("core/logging"),k=t("core/util/types");m=Math.PI/2,o="alphabetic",c="top",i="bottom",l="middle",s="hanging",a="left",u="right",n="center",d={above:{parallel:0,normal:-m,horizontal:0,vertical:-m},below:{parallel:0,normal:m,horizontal:0,vertical:m},left:{parallel:-m,normal:0,horizontal:0,vertical:-m},right:{parallel:m,normal:0,horizontal:0,vertical:m}},f={above:{justified:c,parallel:o,normal:l,horizontal:o,vertical:l},below:{justified:i,parallel:s,normal:l,horizontal:s,vertical:l},left:{justified:c,parallel:o,normal:l,horizontal:l,vertical:o},right:{justified:c,parallel:o,normal:l,horizontal:l,vertical:o}},_={above:{justified:n,parallel:n,normal:a,horizontal:n,vertical:a},below:{justified:n,parallel:n,normal:a,horizontal:n,vertical:u},left:{justified:n,parallel:n,normal:u,horizontal:u,vertical:n},right:{justified:n,parallel:n,normal:a,horizontal:a,vertical:n}},p={above:u,below:a,left:u,right:a},h={above:a,below:u,left:u,right:a},r.update_constraints=function(t){var e,r,o,i;if(i=t,(null==i.model.props.visible||i.model.visible!==!1)&&(o=i._get_size(),null==i._last_size&&(i._last_size=-1),o!==i._last_size))return e=i.model.document.solver(),i._last_size=o,null!=i._size_constraint&&e.remove_constraint(i._size_constraint,!0),i._size_constraint=v.GE(i.model.panel._size,-o),e.add_constraint(i._size_constraint),null==i._full_set&&(i._full_set=!1),i._full_set?void 0:(r=i.model.panel.side,"above"!==r&&"below"!==r||e.add_constraint(v.EQ(i.model.panel._width,[-1,i.plot_model.canvas._width])),"left"!==r&&"right"!==r||e.add_constraint(v.EQ(i.model.panel._height,[-1,i.plot_model.canvas._height])),i._full_set=!0)},r.SidePanel=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(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.logger.error("unrecognized side: '"+this.side+"'")}},e.prototype.get_constraints=function(){var t;return t=[],t.push(v.GE(this._top)),t.push(v.GE(this._bottom)),t.push(v.GE(this._left)),t.push(v.GE(this._right)),t.push(v.GE(this._width)),t.push(v.GE(this._height)),t.push(v.EQ(this._left,this._width,[-1,this._right])),t.push(v.EQ(this._bottom,this._height,[-1,this._top])),t},e.prototype.apply_label_text_heuristics=function(t,e){var r,o,i;return i=this.side,k.isString(e)?(o=f[i][e],r=_[i][e]):0===e?(o=f[i][e],r=_[i][e]):e<0?(o="middle",r=p[i]):e>0&&(o="middle",r=h[i]),t.textBaseline=o,t.textAlign=r,t},e.prototype.get_label_angle_heuristic=function(t){var e;return e=this.side,d[e][t]},e}(b.LayoutCanvas)},{"./layout_canvas":"core/layout/layout_canvas","./solver":"core/layout/solver","core/logging":"core/logging","core/properties":"core/properties","core/util/types":"core/util/types"}],"core/layout/solver":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i,n=function(t,e){function r(){this.constructor=t}for(var o in e)s.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=t("kiwi");r.Variable=a.Variable,r.Expression=a.Expression,r.Constraint=a.Constraint,r.Operator=a.Operator,r.Strength=a.Strength;var l=t("../events");o=function(t){return function(e){return function(){var e;return e=Object.create(a.Expression.prototype),a.Expression.apply(e,arguments),new a.Constraint(e,t)}}(this)},i=function(t){return function(){var e,r,o,i;for(r=[null],o=0,i=arguments.length;o<i;o++)e=arguments[o],r.push(e);return new a.Constraint(new(Function.prototype.bind.apply(a.Expression,r)),t,a.Strength.weak)}},r.EQ=o(a.Operator.Eq),r.LE=o(a.Operator.Le),r.GE=o(a.Operator.Ge),r.WEAK_EQ=i(a.Operator.Eq),r.WEAK_LE=i(a.Operator.Le),r.WEAK_GE=i(a.Operator.Ge),r.Solver=function(){function t(){this.solver=new a.Solver}return n(t.prototype,l.Events),t.prototype.clear=function(){return this.solver=new a.Solver},t.prototype.toString=function(){return"Solver[num_constraints="+this.num_constraints()+", num_edit_variables="+this.num_edit_variables()+"]"},t.prototype.num_constraints=function(){return this.solver._cnMap._array.length},t.prototype.num_edit_variables=function(){return this.solver._editMap._array.length},t.prototype.update_variables=function(t){if(null==t&&(t=!0),this.solver.updateVariables(),t)return this.trigger("layout_update")},t.prototype.add_constraint=function(t){return this.solver.addConstraint(t)},t.prototype.remove_constraint=function(t,e){return null==e&&(e=!1),this.solver.removeConstraint(t,e)},t.prototype.add_edit_variable=function(t,e){return this.solver.addEditVariable(t,e)},t.prototype.remove_edit_variable=function(t,e){return null==e&&(e=!1),this.solver.removeEditVariable(t,strength,e)},t.prototype.suggest_value=function(t,e){return this.solver.suggestValue(t,e)},t}()},{"../events":"core/events",kiwi:"kiwi"}],"core/logging":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i,n,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1},l=t("./util/types");s=function(){},n=function(t,e){return null!=console[t]?console[t].bind(console,e):null!=console.log?console.log.bind(console,e):s},i={},o=function(){function t(t,e){this.name=t,this.level=e}return t}(),r.Logger=function(){function t(e,r){null==r&&(r=t.INFO),this._name=e,this.set_level(r)}return t.TRACE=new o("trace",0),t.DEBUG=new o("debug",1),t.INFO=new o("info",2),t.WARN=new o("warn",6),t.ERROR=new o("error",7),t.FATAL=new o("fatal",8),t.OFF=new o("off",9),t.log_levels={trace:t.TRACE,debug:t.DEBUG,info:t.INFO,warn:t.WARN,error:t.ERROR,fatal:t.FATAL,off:t.OFF},Object.defineProperty(t,"levels",{get:function(){return Object.keys(t.log_levels)}}),t.get=function(e,r){var o;if(null==r&&(r=t.INFO),l.isString(e)&&e.length>0)return o=i[e],null==o&&(o=i[e]=new t(e,r)),o;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,i,a,u,c;if(e instanceof o)this._log_level=e;else{if(!l.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]}i="["+this._name+"]",u=t.log_levels,c=[];for(r in u){if(e=u[r],e===t.OFF)break;a=e.name,e.level<this._log_level.level?c.push(this[a]=s):c.push(this[a]=n(a,i))}return c},t}(),r.logger=r.Logger.get("bokeh"),r.set_log_level=function(t){return a.call(r.Logger.levels,t)<0?(console.log("[bokeh] unrecognized logging level '"+t+"' passed to Bokeh.set_log_level(), ignoring"),console.log("[bokeh] valid log levels are: "+r.Logger.levels.join(", "))):(console.log("[bokeh] setting log level to: '"+t+"'"),r.logger.set_level(t))}},{"./util/types":"core/util/types"}],"core/properties":[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty,n=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1},s=t("./events"),a=t("./enums"),l=t("./util/svg_colors"),u=t("./util/color"),c=t("./util/array"),_=t("./util/types");r.Property=function(){function t(t){this.obj=t.obj,this.attr=t.attr,this.default_value=t.default_value,this._init(!1),this.listenTo(this.obj,"change:"+this.attr,function(t){return function(){return t._init(),t.obj.trigger("propchange")}}(this))}return o(t.prototype,s.Events),t.prototype.dataspec=!1,t.prototype.update=function(){return this._init()},t.prototype.init=function(){},t.prototype.transform=function(t){return t},t.prototype.validate=function(t){},t.prototype.value=function(t){var e;if(null==t&&(t=!0),void 0===this.spec.value)throw new Error("attempted to retrieve property value for property without value specification");return e=this.transform([this.spec.value])[0],null!=this.spec.transform&&t&&(e=this.spec.transform.compute(e)),e},t.prototype.array=function(t){var e,r,o,i,n;if(!this.dataspec)throw new Error("attempted to retrieve property array for non-dataspec property");if(e=t.data,null!=this.spec.field){if(!(this.spec.field in e))throw new Error("attempted to retrieve property array for nonexistent field '"+this.spec.field+"'");i=this.transform(t.get_column(this.spec.field))}else o=t.get_length(),null==o&&(o=1),n=this.value(!1),i=function(){var t,e,i;for(i=[],r=t=0,e=o;0<=e?t<e:t>e;r=0<=e?++t:--t)i.push(n);return i}();return null!=this.spec.transform&&(i=this.spec.transform.v_compute(i)),i},t.prototype._init=function(t){var e,r,o,i;if(null==t&&(t=!0),i=this.obj,null==i)throw new Error("missing property object");if(null==i.properties)throw new Error("property object must be a HasProps");if(e=this.attr,null==e)throw new Error("missing property attr");if(r=i.getv(e),void 0===r&&(o=this.default_value,r=function(){switch(!1){case void 0!==o:return null;case!_.isArray(o):return c.copy(o);case!_.isFunction(o):return o(i);default:return o}}(),i.setv(e,r,{silent:!0,defaults:!0})),_.isArray(r)?this.spec={value:r}:_.isObject(r)&&void 0===r.value!=(void 0===r.field)?this.spec=r:this.spec={value:r},null!=this.spec.field&&!_.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}(),r.simple_prop=function(t,e){var i;return i=function(r){function i(){return i.__super__.constructor.apply(this,arguments)}return o(i,r),i.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},i.prototype.validate=function(r){if(!e(r))throw new Error(t+" property '"+this.attr+"' given invalid value: "+JSON.stringify(r))},i}(r.Property)},r.Any=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e}(r.simple_prop("Any",function(t){return!0})),r.Array=function(t){function e(){return e.__super__.constructor.app