j1-template 2022.3.3 → 2022.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/assets/themes/j1/adapter/js/j1.js +150 -75
  3. data/assets/themes/j1/adapter/js/nbinteract.js +1 -0
  4. data/assets/themes/j1/adapter/js/rangeSlider.js +27 -10
  5. data/assets/themes/j1/modules/nbInteract/js/nbinteract/nbinteract-core.js +1 -1
  6. data/assets/themes/j1/modules/nbInteract/js/nbinteract/nbinteract-core.js.map +1 -1
  7. data/assets/themes/j1/modules/nbInteract/js/nbinteract/nbinteract-core.min.js +1 -1
  8. data/assets/themes/j1/modules/rangeSlider/css/theme/uno/nouislider.css +5 -0
  9. data/assets/themes/j1/modules/rangeSlider/css/theme/uno/nouislider.min.css +1 -1
  10. data/lib/j1/version.rb +1 -1
  11. data/lib/starter_web/Gemfile +1 -1
  12. data/lib/starter_web/_config.yml +1 -1
  13. data/lib/starter_web/_data/j1_config.yml +22 -7
  14. data/lib/starter_web/_data/modules/rangeSlider.yml +38 -1
  15. data/lib/starter_web/_plugins/asciidoctor-extensions/range-slider-block.rb +44 -0
  16. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  17. data/lib/starter_web/package.json +1 -1
  18. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_odes_in_python.ipynb +16 -16
  19. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -919
  20. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_odes_in_python.html +10 -10
  21. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_graphing.html +473 -473
  22. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +2 -2
  23. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  24. data/lib/starter_web/utilsrv/package.json +1 -1
  25. metadata +3 -7
  26. data/assets/themes/j1/modules/nbInteract/js/nbinteract/_new/nbinteract-core.js +0 -94
  27. data/assets/themes/j1/modules/nbInteract/js/nbinteract/_new/nbinteract-core.js.map +0 -1
  28. data/assets/themes/j1/modules/nbInteract/js/nbinteract/_old/j1-nbinteract-core.js +0 -94
  29. data/assets/themes/j1/modules/nbInteract/js/nbinteract/_old/j1-nbinteract-core.js.map +0 -1
  30. data/lib/starter_web/pages/public/se/se-fake.adoc +0 -47
@@ -90,5 +90,5 @@ t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,c=l>>1,u=-7,h=n?i-1:0,d=
90
90
  * Copyright jQuery Foundation and other contributors
91
91
  * Released under the MIT license.
92
92
  * http://jquery.org/license
93
- */!function(s){"use strict";i=[n(11),n(51)],void 0===(o="function"==typeof(r=function(e){return e.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}})?r.apply(t,i):r)||(e.exports=o)}()},function(e){e.exports=JSON.parse('{"name":"@jupyter-widgets/controls","version":"1.5.3","description":"Jupyter interactive widgets","repository":{"type":"git","url":"https://github.com/jupyter-widgets/ipywidgets.git"},"license":"BSD-3-Clause","author":"Project Jupyter","files":["lib/**/*.d.ts","lib/**/*.js","css/*.css","dist/"],"main":"lib/index.js","typings":"lib/index.d.ts","scripts":{"build":"npm run build:src && npm run build:css","build:css":"postcss --use postcss-import --use postcss-cssnext -o css/widgets.built.css css/widgets.css","build:src":"tsc","build:test":"tsc --project test && webpack --config test/webpack.conf.js","clean":"npm run clean:src","clean:src":"rimraf lib && rimraf tsconfig.tsbuildinfo","lint":"tslint --project tslint.json --format stylish","prepublish":"npm run clean && npm run build","test":"npm run test:unit","test:coverage":"npm run build:test && webpack --config test/webpack-cov.conf.js && karma start test/karma-cov.conf.js","test:unit":"npm run test:unit:firefox && npm run test:unit:chrome","test:unit:chrome":"npm run test:unit:default -- --browsers=Chrome","test:unit:default":"npm run build:test && karma start test/karma.conf.js --log-level debug","test:unit:firefox":"npm run test:unit:default -- --browsers=Firefox","test:unit:ie":"npm run test:unit:default -- --browsers=IE"},"dependencies":{"@jupyter-widgets/base":"^2.0.2","@phosphor/algorithm":"^1.1.0","@phosphor/domutils":"^1.1.0","@phosphor/messaging":"^1.2.1","@phosphor/signaling":"^1.2.0","@phosphor/widgets":"^1.3.0","d3-format":"^1.3.0","jquery":"^3.1.1","jquery-ui":"^1.12.1","underscore":"^1.8.3"},"devDependencies":{"@jupyterlab/services":"^2.0.0 || ^3.0.0 || ^4.0.0","@types/d3-format":"^1.3.1","@types/expect.js":"^0.3.29","@types/mathjax":"^0.0.35","@types/mocha":"^5.2.7","@types/node":"^12.0.10","chai":"^4.0.0","css-loader":"^3.0.0","expect.js":"^0.3.1","file-loader":"^4.0.0","istanbul-instrumenter-loader":"^3.0.1","json-loader":"^0.5.7","karma":"^4.1.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.2","karma-firefox-launcher":"^1.1.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","karma-webpack":"^4.0.2","mocha":"^6.1.4","npm-run-all":"^4.1.5","postcss-cli":"^6.1.2","postcss-cssnext":"^3.1.0","postcss-import":"^12.0.1","postcss-loader":"^3.0.0","rimraf":"^2.6.1","sinon":"^7.3.2","sinon-chai":"^3.3.0","style-loader":"^0.23.1","tslint":"^5.18.0","typescript":"~3.5.2","url-loader":"^2.0.0","webpack":"^4.35.0"},"gitHead":"92d7d42c00a1b0d9ce921533acb08beefdea3eb2"}')},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(37),a=n(99),l=a.PROTOCOL_VERSION.split(".",1)[0],c=function(){function e(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}return e.prototype.display_model=function(e,t,n){var r=this;return void 0===n&&(n={}),this.create_view(t,n).then((function(t){return r.display_view(e,t,n)})).catch(s.reject("Could not create view",!0))},e.prototype.setViewOptions=function(e){return void 0===e&&(e={}),e},e.prototype.create_view=function(e,t){var n=this;void 0===t&&(t={});var r=e.state_change=e.state_change.then((function(){return n.loadClass(e.get("_view_name"),e.get("_view_module"),e.get("_view_module_version")).then((function(r){var i=new r({model:e,options:n.setViewOptions(t)});return i.listenTo(e,"destroy",i.remove),Promise.resolve(i.render()).then((function(){return i}))})).catch(s.reject("Could not create a view for model id "+e.model_id,!0))})),i=s.uuid();return e.views[i]=r,r.then((function(e){e.once("remove",(function(){delete e.model.views[i]}),n)})),e.state_change},e.prototype.callbacks=function(e){return{}},e.prototype.get_model=function(e){return this._models[e]},e.prototype.handle_comm_open=function(e,t){var n=(t.metadata||{}).version||"";if(n.split(".",1)[0]!==l){var r="Wrong widget protocol version: received protocol version '"+n+"', but was expecting major version '"+l+"'";return console.error(r),Promise.reject(r)}var i=t.content.data,o=i.buffer_paths||[],a=(t.buffers||[]).map((function(e){return e instanceof DataView?e:new DataView(e instanceof ArrayBuffer?e:e.buffer)}));return s.put_buffers(i.state,o,a),this.new_model({model_name:i.state._model_name,model_module:i.state._model_module,model_module_version:i.state._model_module_version,comm:e},i.state).catch(s.reject("Could not create a model.",!0))},e.prototype.new_widget=function(e,t){var n,i=this;if(void 0===t&&(t={}),void 0===e.view_name||void 0===e.view_module||void 0===e.view_module_version)return Promise.reject("new_widget(...) must be given view information in the options.");n=e.comm?Promise.resolve(e.comm):this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:a.PROTOCOL_VERSION});var o=r({},e);return n.then((function(e){return o.comm=e,i.new_model(o,t).then((function(e){return e.sync("create",e),e}))}),(function(){return o.model_id||(o.model_id=s.uuid()),i.new_model(o,t)}))},e.prototype.register_model=function(e,t){var n=this;this._models[e]=t,t.then((function(t){t.once("comm:close",(function(){delete n._models[e]}))}))},e.prototype.new_model=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n,r;return o(this,(function(i){switch(i.label){case 0:if(e.model_id)n=e.model_id;else{if(!e.comm)throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");n=e.model_id=e.comm.comm_id}return r=this._make_model(e,t),this.register_model(n,r),[4,r];case 1:return[2,i.sent()]}}))}))},e.prototype._make_model=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n,r,i,s,a,l,c;return o(this,(function(o){switch(o.label){case 0:n=e.model_id,r=this.loadClass(e.model_name,e.model_module,e.model_module_version),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r];case 2:return i=o.sent(),[3,4];case 3:throw s=o.sent(),console.error("Could not instantiate widget"),s;case 4:if(!i)throw new Error("Cannot find model module "+e.model_module+"@"+e.model_module_version+", "+e.model_name);return[4,i._deserialize_state(t,this)];case 5:return a=o.sent(),l={widget_manager:this,model_id:n,comm:e.comm},(c=new i(a,l)).name=e.model_name,c.module=e.model_module,[2,c]}}))}))},e.prototype.clear_state=function(){var e=this;return s.resolvePromisesDict(this._models).then((function(t){Object.keys(t).forEach((function(e){return t[e].close()})),e._models=Object.create(null)}))},e.prototype.get_state=function(e){var t=this;void 0===e&&(e={});var n=Object.keys(this._models).map((function(e){return t._models[e]}));return Promise.all(n).then((function(t){return u(t,e)}))},e.prototype.set_state=function(e){var t=this;if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";var n=e.state;return this._get_comm_info().then((function(e){return Promise.all(Object.keys(n).map((function(r){var i={base64:s.base64ToBuffer,hex:s.hexToBuffer},o=n[r],a=o.state;if(o.buffers){var l=o.buffers.map((function(e){return e.path})),c=o.buffers.map((function(e){return new DataView(i[e.encoding](e.data))}));s.put_buffers(o.state,l,c)}if(t._models[r])return t._models[r].then((function(e){return e.constructor._deserialize_state(a||{},t).then((function(t){return e.set_state(t),e}))}));var u={model_id:r,model_name:o.model_name,model_module:o.model_module,model_module_version:o.model_module_version};return e.hasOwnProperty(r)?t._create_comm(t.comm_target_name,r).then((function(e){return u.comm=e,t.new_model(u)})):t.new_model(u,a)})))}))},e.prototype.disconnect=function(){var e=this;Object.keys(this._models).forEach((function(t){e._models[t].then((function(e){e.comm_live=!1}))}))},e.prototype.resolveUrl=function(e){return Promise.resolve(e)},e.prototype.filterExistingModelState=function(e){var t=this,n=e.state;return n=Object.keys(n).filter((function(e){return!t._models[e]})).reduce((function(e,t){return e[t]=n[t],e}),{}),r({},e,{state:n})},e}();function u(e,t){void 0===t&&(t={});var n={};return e.forEach((function(e){var r=e.model_id,i=s.remove_buffers(e.serialize(e.get_state(t.drop_defaults))),o=i.buffers.map((function(e,t){return{data:s.bufferToBase64(e),path:i.buffer_paths[t],encoding:"base64"}}));n[r]={model_name:e.name,model_module:e.module,model_module_version:e.get("_model_module_version"),state:i.state},o.length>0&&(n[r].buffers=o)})),{version_major:2,version_minor:0,state:n}}t.ManagerBase=c,t.serialize_state=u},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(37);t.set=function(e,t,n){if(null==e)return this;var o;if("object"==typeof e?(o=e,n=t):(o={})[e]=t,n||(n={}),!this._validate(o,n))return!1;var s=n.unset,a=n.silent,l=[],c=this._changing;this._changing=!0,c||(this._previousAttributes=r({},this.attributes),this.changed={});var u=this.attributes,h=this.changed,d=this._previousAttributes;for(var p in o)t=o[p],i.isEqual(u[p],t)||l.push(p),i.isEqual(d[p],t)?delete h[p]:h[p]=t,s?delete u[p]:u[p]=t;if(this.id=this.get(this.idAttribute),!a){l.length&&(this._pending=n);for(var f=0;f<l.length;f++)this.trigger("change:"+l[f],this,u[l[f]],n)}if(c)return this;if(!a)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(38),s=Element.prototype,a=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._removeElement=function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.prototype._setElement=function(e){this.el=e},t.prototype._setAttributes=function(e){for(var t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])},t.prototype.delegate=function(e,t,n){"string"!=typeof t&&(n=t,t=null),void 0===this._domEvents&&(this._domEvents=[]);var r=this.el,i=t?function(e){for(var i=e.target||e.srcElement;i&&i!==r;i=i.parentNode)if(a.call(i,t))return e.delegateTarget=i,n.handleEvent?n.handleEvent(e):n(e)}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({eventName:e,handler:i,listener:n,selector:t}),i},t.prototype.undelegate=function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el&&this._domEvents)for(var r=this._domEvents.slice(),i=r.length;i--;){var o=r[i];!(o.eventName!==e||n&&o.listener!==n||t&&o.selector!==t)&&(this.el.removeEventListener(o.eventName,o.handler,!1),this._domEvents.splice(i,1))}return this},t.prototype.undelegateEvents=function(){if(this.el&&this._domEvents){for(var e=this._domEvents.length,t=0;t<e;t++){var n=this._domEvents[t];this.el.removeEventListener(n.eventName,n.handler,!1)}this._domEvents.length=0}return this},t}(o.View);t.NativeView=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(100),a={align_content:null,align_items:null,align_self:null,border:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,overflow_x:null,overflow_y:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){return o.assign(e.prototype.defaults.call(this),{_model_name:"LayoutModel",_view_name:"LayoutView"},a)},t}(s.WidgetModel);t.LayoutModel=l;var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.initialize=function(t){this._traitNames=[],e.prototype.initialize.call(this,t);for(var n=0,r=Object.keys(a);n<r.length;n++){var i=r[n];this.registerTrait(i)}},t.prototype.registerTrait=function(e){var t=this;if(this._traitNames.push(e),"overflow_x"===e||"overflow_y"===e)return this.listenTo(this.model,"change:"+e,(function(n,r){t.handleOverflowChange(e,r)})),void this.handleOverflowChange(e,this.model.get(e));this.listenTo(this.model,"change:"+e,(function(n,r){t.handleChange(e,r)})),this.handleChange(e,this.model.get(e))},t.prototype.css_name=function(e){return e.replace(/_/g,"-")},t.prototype.handleChange=function(e,t){var n=this.options.parent;n?null===t?n.el.style.removeProperty(this.css_name(e)):n.el.style[this.css_name(e)]=t:console.warn("Style not applied because a parent view does not exist")},t.prototype.handleOverflowChange=function(e,t){var n=this.options.parent;n?null===t?null===this.model.get("overflow")&&n.el.style.removeProperty(this.css_name(e)):n.el.style[this.css_name(e)]=t:console.warn("Style not applied because a parent view does not exist")},t.prototype.unlayout=function(){var e=this,t=this.options.parent;this._traitNames.forEach((function(n){t?t.el.style.removeProperty(e.css_name(n)):console.warn("Style not removed because a parent view does not exist")}),this)},t}(s.WidgetView);t.LayoutView=c},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(100),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){var t=this.constructor;return o.assign(e.prototype.defaults.call(this),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(t.styleProperties).reduce((function(e,n){return e[n]=t.styleProperties[n].default,e}),{}))},t.styleProperties={},t}(s.WidgetModel);t.StyleModel=a;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.initialize=function(t){this._traitNames=[],e.prototype.initialize.call(this,t);for(var n=this.model.constructor,r=0,i=Object.keys(n.styleProperties);r<i.length;r++){var o=i[r];this.registerTrait(o)}this.style()},t.prototype.registerTrait=function(e){var t=this;this._traitNames.push(e),this.listenTo(this.model,"change:"+e,(function(n,r){t.handleChange(e,r)}))},t.prototype.handleChange=function(e,t){var n=this.options.parent;if(n){var r=this.model.constructor.styleProperties,i=r[e].attribute,o=r[e].selector,s=o?n.el.querySelectorAll(o):[n.el];if(null===t)for(var a=0;a!==s.length;++a)s[a].style.removeProperty(i);else for(a=0;a!==s.length;++a)s[a].style[i]=t}else console.warn("Style not applied because a parent view does not exist")},t.prototype.style=function(){for(var e=0,t=this._traitNames;e<t.length;e++){var n=t[e];this.handleChange(n,this.model.get(n))}},t.prototype.unstyle=function(){var e=this.options.parent,t=this.model.constructor.styleProperties;this._traitNames.forEach((function(n){if(e)for(var r=t[n].attribute,i=t[n].selector,o=i?e.el.querySelectorAll(i):[e.el],s=0;s!==o.length;++s)o[s].style.removeProperty(r);else console.warn("Style not removed because a parent view does not exist")}),this)},t}(s.WidgetView);t.StyleView=l},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),function(e){!function(e){var t=function(){function e(e){this.targets=Object.create(null),this.comms=Object.create(null),this.kernel=null,this.jsServicesKernel=null,this.init_kernel(e)}return e.prototype.init_kernel=function(e){this.kernel=e,this.jsServicesKernel=e},e.prototype.new_comm=function(e,t,o,s,a,l){return r(this,void 0,void 0,(function(){var r,c;return i(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve(this.jsServicesKernel.connectToComm(e,a))];case 1:return r=i.sent(),c=new n(r),this.register_comm(c),c.open(t,o,s,l),[2,c]}}))}))},e.prototype.register_target=function(e,t){var r=this,i=this.jsServicesKernel.registerCommTarget(e,(function(e,i){var o=new n(e);r.register_comm(o);try{return t(o,i)}catch(e){o.close(),console.error(e),console.error(new Error("Exception opening new comm"))}}));this.targets[e]=i},e.prototype.unregister_target=function(e,t){this.targets[e].dispose(),delete this.targets[e]},e.prototype.register_comm=function(e){return this.comms[e.comm_id]=Promise.resolve(e),e.kernel=this.kernel,e.comm_id},e}();e.CommManager=t;var n=function(){function e(e){this.jsServicesComm=null,this.kernel=null,this.jsServicesComm=e}return Object.defineProperty(e.prototype,"comm_id",{get:function(){return this.jsServicesComm.commId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target_name",{get:function(){return this.jsServicesComm.targetName},enumerable:!0,configurable:!0}),e.prototype.open=function(e,t,n,r){var i=this.jsServicesComm.open(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.send=function(e,t,n,r){var i=this.jsServicesComm.send(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.close=function(e,t,n,r){var i=this.jsServicesComm.close(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.on_msg=function(e){this.jsServicesComm.onMsg=e.bind(this)},e.prototype.on_close=function(e){this.jsServicesComm.onClose=e.bind(this)},e.prototype._hookupCallbacks=function(e,t){t&&(e.onReply=function(e){t.shell&&t.shell.reply&&t.shell.reply(e)},e.onStdin=function(e){t.input&&t.input(e)},e.onIOPub=function(e){if(t.iopub)if(t.iopub.status&&"status"===e.header.msg_type)t.iopub.status(e);else if(t.iopub.clear_output&&"clear_output"===e.header.msg_type)t.iopub.clear_output(e);else if(t.iopub.output)switch(e.header.msg_type){case"display_data":case"execute_result":t.iopub.output(e)}})},e}();e.Comm=n}(e.services||(e.services={}))}(t.shims||(t.shims={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n){this.initialize(e,t,n)}return e.prototype.initialize=function(e,t,n){this._handler_context=n||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=t||function(e){e.remove()}},e.prototype.update=function(e,t,n,r){var i=n||this._remove_view,o=t||this._create_view;r=r||this._handler_context;for(var s=0;s<e.length&&!(s>=this._models.length||e[s]!==this._models[s]);s++);for(var a=s,l=this.views.splice(a,this.views.length-a),c=0;c<l.length;c++)l[c].then((function(e){i.call(r,e)}));for(;s<e.length;s++)this.views.push(Promise.resolve(o.call(r,e[s],s)));return this._models=e.slice(),Promise.all(this.views)},e.prototype.remove=function(){var e=this;return Promise.all(this.views).then((function(t){t.forEach((function(t){return e._remove_view.call(e._handler_context,t)})),e.views=[],e._models=[]}))},e.prototype.dispose=function(){this.views=null,this._models=null},e}();t.ViewList=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12);t.IJupyterWidgetRegistry=new r.Token("jupyter.extensions.jupyterWidgetRegistry")},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(72),a=n(5),l=n(55),c=n(11);n(494);var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){return o({},e.prototype.defaults.call(this),{msg_id:""})},t.prototype.initialize=function(t,n){e.prototype.initialize.call(this,t,n),this._outputs=new l.OutputAreaModel({values:t.outputs,trusted:!0})},Object.defineProperty(t.prototype,"outputs",{get:function(){return this._outputs},enumerable:!0,configurable:!0}),t}(s.OutputModel);t.OutputModel=u;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._createElement=function(e){return this.pWidget=new a.Panel,this.pWidget.node},t.prototype._setElement=function(e){if(this.el||e!==this.pWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.pWidget.node,this.$el=c(this.pWidget.node)},t.prototype.render=function(){var e=this.model.widget_manager.renderMime;this._outputView=new l.OutputArea({rendermime:e,model:this.model.outputs}),this.pWidget.insertWidget(0,this._outputView),this.pWidget.addClass("jupyter-widgets"),this.pWidget.addClass("widget-output"),this.update()},t}(s.OutputView);t.OutputView=h},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var s=n(9);t.OUTPUT_WIDGET_VERSION="1.0.0";var a=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.defaults=function(){return o({},e.prototype.defaults.call(this),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:t.OUTPUT_WIDGET_VERSION,_view_module_version:t.OUTPUT_WIDGET_VERSION})},n}(s.DOMWidgetModel);t.OutputModel=a;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(s.DOMWidgetView);t.OutputView=l},function(e,t,n){var r=n(483);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/*-----------------------------------------------------------------------------\n| Private CSS variables\n|----------------------------------------------------------------------------*/\n\n\n:root {\n}\n\n\n/*-----------------------------------------------------------------------------\n| Main OutputArea\n| OutputArea has a list of Outputs\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea {\n overflow-y: auto;\n}\n\n\n.jp-OutputArea-child {\n display: flex;\n flex-direction: row;\n}\n\n\n\n.jp-OutputPrompt {\n flex: 0 0 var(--jp-cell-prompt-width);\n color: var(--jp-cell-outprompt-font-color);\n font-family: var(--jp-cell-prompt-font-family);\n padding: var(--jp-code-padding);\n letter-spacing: var(--jp-cell-prompt-letter-spacing);\n line-height: var(--jp-code-line-height);\n font-size: var(--jp-code-font-size);\n border: var(--jp-border-width) solid transparent;\n opacity: var(--jp-cell-prompt-opacity);\n /* Right align prompt text, don't wrap to handle large prompt numbers */\n text-align: right;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n /* Disable text selection */\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.jp-OutputArea-output {\n flex-grow: 1;\n flex-shrink: 1;\n height: auto;\n overflow-x: auto;\n user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n -ms-user-select: text;\n}\n\n\n/**\n * Isolated output.\n */\n .jp-OutputArea-output.jp-mod-isolated {\n width: 100%;\n display: block;\n}\n\n\n/*\nWhen drag events occur, `p-mod-override-cursor` is added to the body.\nBecause iframes steal all cursor events, the following two rules are necessary\nto suppress pointer events while resize drags are occuring. There may be a\nbetter solution to this problem.\n*/\nbody.p-mod-override-cursor .jp-OutputArea-output.jp-mod-isolated {\n position: relative;\n}\n\nbody.p-mod-override-cursor .jp-OutputArea-output.jp-mod-isolated:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: transparent;\n}\n\n\n/* pre */\n\n.jp-OutputArea-output pre {\n border: none;\n margin: 0px;\n padding: 0px;\n overflow-x: auto;\n overflow-y: auto;\n word-break: break-all;\n word-wrap: break-word;\n white-space: pre-wrap;\n}\n\n\n/* tables */\n\n.jp-OutputArea-output.jp-RenderedHTMLCommon table {\n margin-left: 0;\n margin-right: 0;\n}\n\n\n/* Hide the gutter in case of\n * - nested output areas (e.g. in the case of output widgets)\n * - mirrored output areas\n */\n.jp-OutputArea .jp-OutputArea .jp-OutputArea-prompt {\n display: none;\n}\n\n/*-----------------------------------------------------------------------------\n| executeResult is added to any Output-result for the display of the object\n| returned by a cell\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea-output.jp-OutputArea-executeResult {\n margin-left: 0px;\n flex: 1 1 auto;\n}\n\n\n.jp-OutputArea-executeResult.jp-RenderedText {\n padding-top: var(--jp-code-padding);\n}\n\n\n\n/*-----------------------------------------------------------------------------\n| The Stdin output\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea-stdin {\n line-height: var(--jp-code-line-height);\n padding-top: var(--jp-code-padding);\n display: flex;\n}\n\n\n.jp-Stdin-prompt {\n padding-right: var(--jp-code-padding);\n vertical-align: baseline;\n flex: 0 0 auto;\n}\n\n\n.jp-Stdin-input {\n font-family: var(--jp-code-font-family);\n font-size: inherit;\n color: inherit;\n width: auto;\n /* make sure input baseline aligns with prompt */\n vertical-align: baseline;\n /* padding + margin = 0.5em between prompt and cursor */\n padding: 0em 0.25em;\n margin: 0em 0.25em;\n flex: 0 0 70%;\n}\n\n\n.jp-Stdin-input:focus {\n box-shadow: none;\n}\n",""])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(6),o=n(18),s=n(183),a=n(54),l=function(){function e(t){void 0===t&&(t={});var n=this;this.clearNext=!1,this.list=null,this._trusted=!1,this._isDisposed=!1,this._stateChanged=new i.Signal(this),this._changed=new i.Signal(this),this._modelDB=null,this._serialized=null,this._changeGuard=!1,this._trusted=!!t.trusted,this.contentFactory=t.contentFactory||e.defaultContentFactory,this.list=new s.ObservableList,t.values&&r.each(t.values,(function(e){n._add(e)})),this.list.changed.connect(this._onListChanged,this),t.modelDB&&(this._modelDB=t.modelDB,this._serialized=this._modelDB.createValue("outputs"),this._serialized.get()?this.fromJSON(this._serialized.get()):this._serialized.set(this.toJSON()),this._serialized.changed.connect(this._onSerializedChanged,this))}return Object.defineProperty(e.prototype,"stateChanged",{get:function(){return this._stateChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.list?this.list.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trusted",{get:function(){return this._trusted},set:function(e){if(e!==this._trusted)for(var t=this._trusted=e,n=0;n<this.list.length;n++){var r=this.list.get(n),i=r.toJSON();r.dispose(),r=this._createItem({value:i,trusted:t}),this.list.set(n,r)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(this._isDisposed=!0,this.list.dispose(),i.Signal.clearData(this))},e.prototype.get=function(e){return this.list.get(e)},e.prototype.set=function(e,t){this._normalize(t);var n=this._createItem({value:t,trusted:this._trusted});this.list.set(e,n)},e.prototype.add=function(e){return this.clearNext&&(this.clear(),this.clearNext=!1),this._add(e)},e.prototype.clear=function(e){void 0===e&&(e=!1),this._lastStream="",e?this.clearNext=!0:(r.each(this.list,(function(e){e.dispose()})),this.list.clear())},e.prototype.fromJSON=function(e){var t=this;this.clear(),r.each(e,(function(e){t._add(e)}))},e.prototype.toJSON=function(){return r.toArray(r.map(this.list,(function(e){return e.toJSON()})))},e.prototype._add=function(e){var t=this._trusted;if(this._normalize(e),o.nbformat.isStream(e)&&this._lastStream&&e.name===this._lastName){this._lastStream+=e.text,e.text=this._lastStream,this._removeOverwrittenChars(e);var n=this._createItem({value:e,trusted:t}),r=this.length-1;return this.list.get(r).dispose(),this.list.set(r,n),r}o.nbformat.isStream(e)&&this._removeOverwrittenChars(e);var i=this._createItem({value:e,trusted:t});return o.nbformat.isStream(e)?(this._lastStream=e.text,this._lastName=e.name):this._lastStream="",this.list.push(i)},e.prototype._normalize=function(e){o.nbformat.isStream(e)&&Array.isArray(e.text)&&(e.text=e.text.join("\n"))},e.prototype._fixBackspace=function(e){var t=e;do{t=(e=t).replace(/[^\n]\x08/gm,"")}while(t.length<e.length);return e},e.prototype._fixCarriageReturn=function(e){var t=e;t=t.replace(/\r\r+\n/gm,"\r\n");do{t=t.replace(/^[^\n]*(?:\r(?!\n))+/gm,"")}while(t.search(/\r(?!\n)/)>-1);do{t=t.replace(/\r\n/gm,"\n")}while(t.indexOf("\r\n")>-1);return t},e.prototype._removeOverwrittenChars=function(e){var t=e.text;e.text=this._fixCarriageReturn(this._fixBackspace(t))},e.prototype._createItem=function(e){var t=this.contentFactory.createOutputModel(e);return t.changed.connect(this._onGenericChange,this),t.changed.connect(this._onGenericChange,this),t},e.prototype._onListChanged=function(e,t){this._serialized&&!this._changeGuard&&(this._changeGuard=!0,this._serialized.set(this.toJSON()),this._changeGuard=!1),this._changed.emit(t),this._stateChanged.emit(void 0)},e.prototype._onSerializedChanged=function(e,t){this._changeGuard||(this._changeGuard=!0,this.fromJSON(t.newValue),this._changeGuard=!1)},e.prototype._onGenericChange=function(){this._stateChanged.emit(void 0)},e}();t.OutputAreaModel=l,function(e){var t=function(){function e(){}return e.prototype.createOutputModel=function(e){return new a.OutputModel(e)},e}();e.ContentFactory=t,e.defaultContentFactory=new t}(l=t.OutputAreaModel||(t.OutputAreaModel={})),t.OutputAreaModel=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45),i=n(6),o=n(12),s=n(101),a=n(184),l=n(185),c=n(186),u=function(){function e(e){void 0===e&&(e=null),this._value=null,this._changed=new i.Signal(this),this._isDisposed=!1,this._value=e}return Object.defineProperty(e.prototype,"type",{get:function(){return"Value"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),e.prototype.get=function(){return this._value},e.prototype.set=function(e){var t=this._value;o.JSONExt.deepEqual(t,e)||(this._value=e,this._changed.emit({oldValue:t,newValue:e}))},e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,i.Signal.clearData(this),this._value=null)},e}();t.ObservableValue=u,function(e){var t=function(){};e.IChangedArgs=t}(u=t.ObservableValue||(t.ObservableValue={})),t.ObservableValue=u;var h=function(){function e(e){void 0===e&&(e={}),this.isPrepopulated=!1,this.isCollaborative=!1,this.connected=Promise.resolve(void 0),this._toDispose=!1,this._isDisposed=!1,this._disposables=new r.DisposableSet,this._basePath=e.basePath||"",e.baseDB?this._db=e.baseDB:(this._db=new s.ObservableMap,this._toDispose=!0)}return Object.defineProperty(e.prototype,"basePath",{get:function(){return this._basePath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),e.prototype.get=function(e){return this._db.get(this._resolvePath(e))},e.prototype.has=function(e){return this._db.has(this._resolvePath(e))},e.prototype.createString=function(e){var t=new l.ObservableString;return this._disposables.add(t),this.set(e,t),t},e.prototype.createList=function(e){var t=new c.ObservableUndoableList(new c.ObservableUndoableList.IdentitySerializer);return this._disposables.add(t),this.set(e,t),t},e.prototype.createMap=function(e){var t=new a.ObservableJSON;return this._disposables.add(t),this.set(e,t),t},e.prototype.createValue=function(e){var t=new u;return this._disposables.add(t),this.set(e,t),t},e.prototype.getValue=function(e){var t=this.get(e);if(!t||"Value"!==t.type)throw Error("Can only call getValue for an ObservableValue");return t.get()},e.prototype.setValue=function(e,t){var n=this.get(e);if(!n||"Value"!==n.type)throw Error("Can only call setValue on an ObservableValue");n.set(t)},e.prototype.view=function(t){var n=new e({basePath:t,baseDB:this});return this._disposables.add(n),n},e.prototype.set=function(e,t){this._db.set(this._resolvePath(e),t)},e.prototype.dispose=function(){this.isDisposed||(this._isDisposed=!0,this._toDispose&&this._db.dispose(),this._disposables.dispose())},e.prototype._resolvePath=function(e){return this._basePath&&(e=this._basePath+"."+e),e},e}();t.ModelDB=h},function(e,t,n){var r=n(487);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,'/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n\n/*-----------------------------------------------------------------------------\n| RenderedText\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedText {\n text-align: left;\n padding-left: var(--jp-code-padding);\n font-size: var(--jp-code-font-size);\n line-height: var(--jp-code-line-height);\n font-family: var(--jp-code-font-family);\n}\n\n\n.jp-RenderedText pre,\n.jp-RenderedHTMLCommon pre {\n color: var(--jp-content-font-color1);\n border: none;\n margin: 0px;\n padding: 0px;\n}\n\n\n/* ansi_up creates classed spans for console foregrounds and backgrounds. */\n.jp-RenderedText pre .ansi-black-fg { color: #3E424D; }\n.jp-RenderedText pre .ansi-red-fg { color: #E75C58; }\n.jp-RenderedText pre .ansi-green-fg { color: #00A250; }\n.jp-RenderedText pre .ansi-yellow-fg { color: #DDB62B; }\n.jp-RenderedText pre .ansi-blue-fg { color: #208FFB; }\n.jp-RenderedText pre .ansi-magenta-fg { color: #D160C4; }\n.jp-RenderedText pre .ansi-cyan-fg { color: #60C6C8; }\n.jp-RenderedText pre .ansi-white-fg { color: #C5C1B4; }\n\n.jp-RenderedText pre .ansi-black-bg { background-color: #3E424D; }\n.jp-RenderedText pre .ansi-red-bg { background-color: #E75C58; }\n.jp-RenderedText pre .ansi-green-bg { background-color: #00A250; }\n.jp-RenderedText pre .ansi-yellow-bg { background-color: #DDB62B; }\n.jp-RenderedText pre .ansi-blue-bg { background-color: #208FFB; }\n.jp-RenderedText pre .ansi-magenta-bg { background-color: #D160C4; }\n.jp-RenderedText pre .ansi-cyan-bg { background-color: #60C6C8; }\n.jp-RenderedText pre .ansi-white-bg { background-color: #C5C1B4; }\n\n.jp-RenderedText pre .ansi-bright-black-fg { color: #282C36; }\n.jp-RenderedText pre .ansi-bright-red-fg { color: #B22B31; }\n.jp-RenderedText pre .ansi-bright-green-fg { color: #007427; }\n.jp-RenderedText pre .ansi-bright-yellow-fg { color: #B27D12; }\n.jp-RenderedText pre .ansi-bright-blue-fg { color: #0065CA; }\n.jp-RenderedText pre .ansi-bright-magenta-fg { color: #A03196; }\n.jp-RenderedText pre .ansi-bright-cyan-fg { color: #258F8F; }\n.jp-RenderedText pre .ansi-bright-white-fg { color: #A1A6B2; }\n\n.jp-RenderedText pre .ansi-bright-black-bg { background-color: #282C36; }\n.jp-RenderedText pre .ansi-bright-red-bg { background-color: #B22B31; }\n.jp-RenderedText pre .ansi-bright-green-bg { background-color: #007427; }\n.jp-RenderedText pre .ansi-bright-yellow-bg { background-color: #B27D12; }\n.jp-RenderedText pre .ansi-bright-blue-bg { background-color: #0065CA; }\n.jp-RenderedText pre .ansi-bright-magenta-bg { background-color: #A03196; }\n.jp-RenderedText pre .ansi-bright-cyan-bg { background-color: #258F8F; }\n.jp-RenderedText pre .ansi-bright-white-bg { background-color: #A1A6B2; }\n\n\n.jp-RenderedText[data-mime-type="application/vnd.jupyter.stderr"] {\n background: var(--jp-rendermime-error-background);\n}\n\n\n/*-----------------------------------------------------------------------------\n| RenderedLatex\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedLatex {\n color: var(--jp-content-font-color1);\n font-size: var(--jp-content-font-size1);\n line-height: var(--jp-content-line-height);\n}\n\n\n/*-----------------------------------------------------------------------------\n| RenderedHTML\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedHTMLCommon {\n color: var(--jp-content-font-color1);\n font-size: var(--jp-content-font-size1);\n line-height: var(--jp-content-line-height);\n /* Give a bit more R padding on Markdown text to keep line lengths reasonable */\n padding-right: 20px;\n}\n\n\n.jp-RenderedHTMLCommon .MathJax_Display {\n margin: 0;\n}\n\n\n.jp-RenderedHTMLCommon em {\n font-style: italic;\n}\n\n\n.jp-RenderedHTMLCommon strong {\n font-weight: bold;\n}\n\n\n.jp-RenderedHTMLCommon u {\n text-decoration: underline;\n}\n\n\n.jp-RenderedHTMLCommon a:link {\n text-decoration: none;\n color: var(--jp-content-link-color);\n}\n\n\n.jp-RenderedHTMLCommon a:hover {\n text-decoration: underline;\n color: var(--jp-content-link-color);\n}\n\n\n.jp-RenderedHTMLCommon a:visited {\n text-decoration: none;\n color: var(--jp-content-link-color);\n}\n\n\n/* Headings */\n\n.jp-RenderedHTMLCommon h1,\n.jp-RenderedHTMLCommon h2,\n.jp-RenderedHTMLCommon h3,\n.jp-RenderedHTMLCommon h4,\n.jp-RenderedHTMLCommon h5,\n.jp-RenderedHTMLCommon h6 {\n line-height: var(--jp-content-heading-line-height);\n font-weight: var(--jp-content-heading-font-weight);\n font-style: normal;\n margin: var(--jp-content-heading-margin-top) 0 var(--jp-content-heading-margin-bottom) 0;\n}\n\n\n.jp-RenderedHTMLCommon h1:first-child,\n.jp-RenderedHTMLCommon h2:first-child,\n.jp-RenderedHTMLCommon h3:first-child,\n.jp-RenderedHTMLCommon h4:first-child,\n.jp-RenderedHTMLCommon h5:first-child,\n.jp-RenderedHTMLCommon h6:first-child {\n margin-top: calc( 0.5 * var(--jp-content-heading-margin-top) );\n}\n\n\n.jp-RenderedHTMLCommon h1:last-child,\n.jp-RenderedHTMLCommon h2:last-child,\n.jp-RenderedHTMLCommon h3:last-child,\n.jp-RenderedHTMLCommon h4:last-child,\n.jp-RenderedHTMLCommon h5:last-child,\n.jp-RenderedHTMLCommon h6:last-child {\n margin-bottom: calc( 0.5 * var(--jp-content-heading-margin-bottom) );\n}\n\n\n.jp-RenderedHTMLCommon h1 {\n font-size: var(--jp-content-font-size5);\n}\n\n\n.jp-RenderedHTMLCommon h2 {\n font-size: var(--jp-content-font-size4);\n}\n\n\n.jp-RenderedHTMLCommon h3 {\n font-size: var(--jp-content-font-size3);\n}\n\n\n.jp-RenderedHTMLCommon h4 {\n font-size: var(--jp-content-font-size2);\n}\n\n\n.jp-RenderedHTMLCommon h5 {\n font-size: var(--jp-content-font-size1);\n}\n\n\n.jp-RenderedHTMLCommon h6 {\n font-size: var(--jp-content-font-size0);\n}\n\n/* Lists */\n\n.jp-RenderedHTMLCommon ul:not(.list-inline),\n.jp-RenderedHTMLCommon ol:not(.list-inline) {\n padding-left: 2em;\n}\n\n\n.jp-RenderedHTMLCommon ul {\n list-style: disc;\n}\n\n\n.jp-RenderedHTMLCommon ul ul {\n list-style: square;\n}\n\n\n.jp-RenderedHTMLCommon ul ul ul {\n list-style: circle;\n}\n\n\n.jp-RenderedHTMLCommon ol {\n list-style: decimal;\n}\n\n\n.jp-RenderedHTMLCommon ol ol {\n list-style: upper-alpha;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol {\n list-style: lower-alpha;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol ol {\n list-style: lower-roman;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol ol ol {\n list-style: decimal;\n}\n\n\n.jp-RenderedHTMLCommon ol,\n.jp-RenderedHTMLCommon ul {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon ul ul,\n.jp-RenderedHTMLCommon ul ol,\n.jp-RenderedHTMLCommon ol ul,\n.jp-RenderedHTMLCommon ol ol {\n margin-bottom: 0em;\n}\n\n\n.jp-RenderedHTMLCommon hr {\n color: var(--jp-border-color2);\n background-color: var(--jp-border-color1);\n margin-top: 1em;\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon > pre {\n margin: 1.5em 2em;\n}\n\n\n.jp-RenderedHTMLCommon pre,\n.jp-RenderedHTMLCommon code {\n border: 0;\n background-color: var(--jp-layout-color0);\n color: var(--jp-content-font-color1);\n font-family: var(--jp-code-font-family);\n font-size: var(--jp-code-font-size);\n line-height: var(--jp-code-line-height);\n padding: 0px;\n}\n\n/* Tables */\n\n.jp-RenderedHTMLCommon table {\n border-collapse: collapse;\n border-spacing: 0;\n border: none;\n color: var(--jp-ui-font-color1);\n font-size: 12px;\n table-layout: fixed;\n margin-left: auto;\n margin-right: auto;\n}\n\n\n.jp-RenderedHTMLCommon thead {\n border-bottom: var(--jp-border-width) solid var(--jp-border-color1);\n vertical-align: bottom;\n}\n\n\n.jp-RenderedHTMLCommon td,\n.jp-RenderedHTMLCommon th,\n.jp-RenderedHTMLCommon tr {\n text-align: right;\n vertical-align: middle;\n padding: 0.5em 0.5em;\n line-height: normal;\n white-space: normal;\n max-width: none;\n border: none;\n}\n\n\n.jp-RenderedMarkdown.jp-RenderedHTMLCommon td,\n.jp-RenderedMarkdown.jp-RenderedHTMLCommon th {\n max-width: none;\n}\n\n\n.jp-RenderedHTMLCommon th {\n font-weight: bold;\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:nth-child(odd) {\n background: var(--jp-layout-color0);\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:nth-child(even) {\n background: var( --jp-rendermime-table-row-background);\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:hover {\n background: var( --jp-rendermime-table-row-hover-background);\n}\n\n\n.jp-RenderedHTMLCommon table {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon p {\n text-align: left;\n margin: 0px;\n}\n\n\n.jp-RenderedHTMLCommon p {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon img {\n -moz-force-broken-image-icon: 1;\n}\n\n\n/* Restrict to direct children as other images could be nested in other content. */\n.jp-RenderedHTMLCommon > img {\n display: block;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon img,\n.jp-RenderedImage img,\n.jp-RenderedHTMLCommon svg,\n.jp-RenderedSVG svg {\n max-width: 100%;\n height: auto;\n}\n\n\n.jp-RenderedHTMLCommon img.jp-mod-unconfined,\n.jp-RenderedImage img.jp-mod-unconfined,\n.jp-RenderedHTMLCommon svg.jp-mod-unconfined,\n.jp-RenderedSVG svg.jp-mod-unconfined {\n max-width: none;\n}\n\n\n.jp-RenderedHTMLCommon .alert {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon blockquote {\n margin: 1em 2em;\n padding: 0 1em;\n border-left: 5px solid var(--jp-border-color2);\n}\n\na.jp-InternalAnchorLink {\n visibility: hidden;\n margin-left: 8px;\n color: var(--md-blue-800);\n}\n\nh1:hover .jp-InternalAnchorLink,\nh2:hover .jp-InternalAnchorLink,\nh3:hover .jp-InternalAnchorLink,\nh4:hover .jp-InternalAnchorLink,\nh5:hover .jp-InternalAnchorLink,\nh6:hover .jp-InternalAnchorLink {\n visibility: visible;\n}\n\n\n/* Most direct children of .jp-RenderedHTMLCommon have a margin-bottom of 1.0.\n * At the bottom of cells this is a bit too much as there is also spacing\n * between cells. Going all the way to 0 gets too tight between markdown and\n * code cells.\n */\n.jp-RenderedHTMLCommon > *:last-child {\n margin-bottom: 0.5em;\n}\n\n\n\n/*-----------------------------------------------------------------------------\n| RenderedPDF\n|----------------------------------------------------------------------------*/\n\n.jp-RenderedPDF {\n font-size: var(--jp-ui-font-size1);\n}\n',""])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(188);t.htmlRendererFactory={safe:!0,mimeTypes:["text/html"],defaultRank:50,createRenderer:function(e){return new r.RenderedHTML(e)}},t.imageRendererFactory={safe:!0,mimeTypes:["image/bmp","image/png","image/jpeg","image/gif"],defaultRank:90,createRenderer:function(e){return new r.RenderedImage(e)}},t.latexRendererFactory={safe:!0,mimeTypes:["text/latex"],defaultRank:70,createRenderer:function(e){return new r.RenderedLatex(e)}},t.markdownRendererFactory={safe:!0,mimeTypes:["text/markdown"],defaultRank:60,createRenderer:function(e){return new r.RenderedMarkdown(e)}},t.svgRendererFactory={safe:!1,mimeTypes:["image/svg+xml"],defaultRank:80,createRenderer:function(e){return new r.RenderedSVG(e)}},t.textRendererFactory={safe:!0,mimeTypes:["text/plain","application/vnd.jupyter.stdout","application/vnd.jupyter.stderr"],defaultRank:120,createRenderer:function(e){return new r.RenderedText(e)}},t.javaScriptRendererFactory={safe:!1,mimeTypes:["text/javascript","application/javascript"],defaultRank:110,createRenderer:function(e){return new r.RenderedJavaScript(e)}},t.standardRendererFactories=[t.htmlRendererFactory,t.markdownRendererFactory,t.latexRendererFactory,t.svgRendererFactory,t.imageRendererFactory,t.javaScriptRendererFactory,t.textRendererFactory]},function(e,t,n){var r;!function(n,i){var o,s,a=void 0!==e,l=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]];function c(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0}c.prototype.setup_palette=function(){s=[],function(){var e,t;for(e=0;e<2;++e)for(t=0;t<8;++t)s.push(l[e][t].color)}(),function(){var e,t,n,r=[0,95,135,175,215,255],i=function(e,t,n){return r[e]+", "+r[t]+", "+r[n]};for(e=0;e<6;++e)for(t=0;t<6;++t)for(n=0;n<6;++n)s.push(i.call(this,e,t,n))}(),function(){var e,t=8,n=function(e){return e+", "+e+", "+e};for(e=0;e<24;++e,t+=10)s.push(n.call(this,t))}()},c.prototype.escape_for_html=function(e){return e.replace(/[&<>]/gm,(function(e){return"&"==e?"&amp;":"<"==e?"&lt;":">"==e?"&gt;":void 0}))},c.prototype.linkify=function(e){return e.replace(/(https?:\/\/[^\s]+)/gm,(function(e){return'<a href="'+e+'">'+e+"</a>"}))},c.prototype.ansi_to_html=function(e,t){return this.process(e,t,!0)},c.prototype.ansi_to_text=function(e){return this.process(e,{},!1)},c.prototype.process=function(e,t,n){var r=this,i=e.split(/\033\[/),o=i.shift(),s=i.map((function(e){return r.process_chunk(e,t,n)}));return s.unshift(o),s.join("")},c.prototype.process_chunk=function(e,t,n){var r=void 0!==(t=void 0===t?{}:t).use_classes&&t.use_classes,i=r?"class":"color",o=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!o)return e;var a=o[4],c=o[2].split(";");if(""!==o[1]||"m"!==o[3])return a;if(!n)return a;for(var u=this;c.length>0;){var h=c.shift(),d=parseInt(h);isNaN(d)||0===d?(u.fg=u.bg=null,u.bright=0):1===d?u.bright=1:39==d?u.fg=null:49==d?u.bg=null:d>=30&&d<38?u.fg=l[u.bright][d%10][i]:d>=90&&d<98?u.fg=l[1][d%10][i]:d>=40&&d<48?u.bg=l[0][d%10][i]:d>=100&&d<108?u.bg=l[1][d%10][i]:38!==d&&48!==d||function(){var e=38===d;if(c.length>=1){var t=c.shift();if("5"===t&&c.length>=1){var n=parseInt(c.shift());if(n>=0&&n<=255)if(r){var i=n>=16?"ansi-palette-"+n:l[n>7?1:0][n%8].class;e?u.fg=i:u.bg=i}else s||u.setup_palette.call(u),e?u.fg=s[n]:u.bg=s[n]}else if("2"===t&&c.length>=3){var o=parseInt(c.shift()),a=parseInt(c.shift()),h=parseInt(c.shift());if(o>=0&&o<=255&&a>=0&&a<=255&&h>=0&&h<=255){var p=o+", "+a+", "+h;r?e?(u.fg="ansi-truecolor",u.fg_truecolor=p):(u.bg="ansi-truecolor",u.bg_truecolor=p):e?u.fg=p:u.bg=p}}}}()}if(null===u.fg&&null===u.bg)return a;var p=[],f=[],g={},m=function(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push("data-"+t+'="'+this.escape_for_html(e[t])+'"');return n.length>0?" "+n.join(" "):""};return u.fg&&(r?(f.push(u.fg+"-fg"),null!==u.fg_truecolor&&(g["ansi-truecolor-fg"]=u.fg_truecolor,u.fg_truecolor=null)):p.push("color:rgb("+u.fg+")")),u.bg&&(r?(f.push(u.bg+"-bg"),null!==u.bg_truecolor&&(g["ansi-truecolor-bg"]=u.bg_truecolor,u.bg_truecolor=null)):p.push("background-color:rgb("+u.bg+")")),r?'<span class="'+f.join(" ")+'"'+m.call(u,g)+">"+a+"</span>":'<span style="'+p.join(";")+'"'+m.call(u,g)+">"+a+"</span>"},o={escape_for_html:function(e){return(new c).escape_for_html(e)},linkify:function(e){return(new c).linkify(e)},ansi_to_html:function(e,t){return(new c).ansi_to_html(e,t)},ansi_to_text:function(e){return(new c).ansi_to_text(e)},ansi_to_html_obj:function(){return new c}},a&&(e.exports=o),"undefined"!=typeof window&&"undefined"==typeof ender&&(window.ansi_up=o),void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}(Date)},function(e,t,n){(function(t){!function(t){"use strict";var n={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:g,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:g,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:g,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n?(?!hr|heading|lheading| {0,3}>|tag)[^\n]+)+)/,text:/^[^\n]+/};function r(e){this.tokens=[],this.tokens.links={},this.options=e||_.defaults,this.rules=n.normal,this.options.gfm&&(this.options.tables?this.rules=n.tables:this.rules=n.gfm)}n._label=/(?:\\[\[\]]|[^\[\]])+/,n._title=/(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/,n.def=h(n.def).replace("label",n._label).replace("title",n._title).getRegex(),n.bullet=/(?:[*+-]|\d+\.)/,n.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,n.item=h(n.item,"gm").replace(/bull/g,n.bullet).getRegex(),n.list=h(n.list).replace(/bull/g,n.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+n.def.source+")").getRegex(),n._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b",n.html=h(n.html).replace("comment",/<!--[\s\S]*?-->/).replace("closed",/<(tag)[\s\S]+?<\/\1>/).replace("closing",/<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>\s]*)*?\/?>/).replace(/tag/g,n._tag).getRegex(),n.paragraph=h(n.paragraph).replace("hr",n.hr).replace("heading",n.heading).replace("lheading",n.lheading).replace("tag","<"+n._tag).getRegex(),n.blockquote=h(n.blockquote).replace("paragraph",n.paragraph).getRegex(),n.normal=m({},n),n.gfm=m({},n.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),n.gfm.paragraph=h(n.paragraph).replace("(?!","(?!"+n.gfm.fences.source.replace("\\1","\\2")+"|"+n.list.source.replace("\\1","\\3")+"|").getRegex(),n.tables=m({},n.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),r.rules=n,r.lex=function(e,t){return new r(t).lex(e)},r.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},r.prototype.token=function(e,t){var r,i,o,s,a,l,c,u,h,d,p;for(e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].split(/ *\| */);this.tokens.push(l)}else if(o=this.rules.hr.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,t),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),p=(s=o[2]).length>1,this.tokens.push({type:"list_start",ordered:p,start:p?+s:""}),r=!1,d=(o=o[0].match(this.rules.item)).length,u=0;u<d;u++)c=(l=o[u]).length,~(l=l.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==d-1&&(s===(a=n.bullet.exec(o[u+1])[0])||s.length>1&&a.length>1||(e=o.slice(u+1).join("\n")+e,u=d-1)),i=r||/\n\n(?!\s*$)/.test(l),u!==d-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(l,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),o[3]&&(o[3]=o[3].substring(1,o[3].length-1)),h=o[1].toLowerCase(),this.tokens.links[h]||(this.tokens.links[h]={href:o[2],title:o[3]});else if(t&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(o=this.rules.lheading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"text",text:o[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var i={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:/^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:g,text:/^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function o(e,t){if(this.options=t||_.defaults,this.links=e,this.rules=i.normal,this.renderer=this.options.renderer||new s,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=i.breaks:this.rules=i.gfm:this.options.pedantic&&(this.rules=i.pedantic)}function s(e){this.options=e||{}}function a(){}function l(e){this.tokens=[],this.token=null,this.options=e||_.defaults,this.options.renderer=this.options.renderer||new s,this.renderer=this.options.renderer,this.renderer.options=this.options}function c(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function u(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}function h(e,t){return e=e.source,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function d(e,t){return p[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?p[" "+e]=e+"/":p[" "+e]=e.replace(/[^/]*$/,"")),e=p[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}i._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,i._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,i.autolink=h(i.autolink).replace("scheme",i._scheme).replace("email",i._email).getRegex(),i._inside=/(?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/,i._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,i.link=h(i.link).replace("inside",i._inside).replace("href",i._href).getRegex(),i.reflink=h(i.reflink).replace("inside",i._inside).getRegex(),i.normal=m({},i),i.pedantic=m({},i.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),i.gfm=m({},i.normal,{escape:h(i.escape).replace("])","~|])").getRegex(),url:h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",i._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:h(i.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),i.breaks=m({},i.gfm,{br:h(i.br).replace("{2,}","*").getRegex(),text:h(i.gfm.text).replace("{2,}","*").getRegex()}),o.rules=i,o.output=function(e,t,n){return new o(t,n).output(e)},o.prototype.output=function(e){for(var t,n,r,i,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=c(this.mangle(i[1]))):n=c(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):c(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,o+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(c(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),o+=this.renderer.text(c(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else i[0]=this.rules._backpedal.exec(i[0])[0],e=e.substring(i[0].length),"@"===i[2]?r="mailto:"+(n=c(i[0])):(n=c(i[0]),r="www."===i[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},o.prototype.outputLink=function(e,t){var n=c(t.href),r=t.title?c(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,c(e[1]))},o.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},o.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},s.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+c(t,!0)+'">'+(n?e:c(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"\n</code></pre>"},s.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},s.prototype.html=function(e){return e},s.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},s.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},s.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},s.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},s.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},s.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},s.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},s.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},s.prototype.strong=function(e){return"<strong>"+e+"</strong>"},s.prototype.em=function(e){return"<em>"+e+"</em>"},s.prototype.codespan=function(e){return"<code>"+e+"</code>"},s.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},s.prototype.del=function(e){return"<del>"+e+"</del>"},s.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(u(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!f.test(e)&&(e=d(this.options.baseUrl,e));var i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"},s.prototype.image=function(e,t,n){this.options.baseUrl&&!f.test(e)&&(e=d(this.options.baseUrl,e));var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},s.prototype.text=function(e){return e},a.prototype.strong=a.prototype.em=a.prototype.codespan=a.prototype.del=a.prototype.text=function(e){return e},a.prototype.link=a.prototype.image=function(e,t,n){return""+n},a.prototype.br=function(){return""},l.parse=function(e,t){return new l(t).parse(e)},l.prototype.parse=function(e){this.inline=new o(e.links,this.options),this.inlineText=new o(e.links,m({},this.options,{renderer:new a})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},l.prototype.next=function(){return this.token=this.tokens.pop()},l.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},l.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},l.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,u(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i="",o="";for(n="",e=0;e<this.token.header.length;e++)n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(i+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});o+=this.renderer.tablerow(n)}return this.renderer.table(i,o);case"blockquote_start":for(o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":o="";for(var s=this.token.ordered,a=this.token.start;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,s,a);case"list_item_start":for(o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}};var p={},f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(){}function m(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function _(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(n||"function"==typeof t){n||(n=t,t=null);var i,o,s=(t=m({},_.defaults,t||{})).highlight,a=0;try{i=r.lex(e,t)}catch(e){return n(e)}o=i.length;var u=function(e){if(e)return t.highlight=s,n(e);var r;try{r=l.parse(i,t)}catch(t){e=t}return t.highlight=s,e?n(e):n(null,r)};if(!s||s.length<3)return u();if(delete t.highlight,!o)return u();for(;a<i.length;a++)!function(e){"code"!==e.type?--o||u():s(e.text,e.lang,(function(t,n){return t?u(t):null==n||n===e.text?--o||u():(e.text=n,e.escaped=!0,void(--o||u()))}))}(i[a])}else try{return t&&(t=m({},_.defaults,t)),l.parse(r.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(t||_.defaults).silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}}g.exec=g,_.options=_.setOptions=function(e){return m(_.defaults,e),_},_.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new s,xhtml:!1,baseUrl:null},_.Parser=l,_.parser=l.parse,_.Renderer=s,_.TextRenderer=a,_.Lexer=r,_.lexer=r.lex,_.InlineLexer=o,_.inlineLexer=o.output,_.parse=_,e.exports=_}(this||"undefined"!=typeof window&&window)}).call(this,n(17))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(12),o=n(6),s=n(18),a=n(183),l=function(){function e(e){this._changed=new o.Signal(this),this._raw={};var t=r.getBundleOptions(e),n=t.data,i=t.metadata,l=t.trusted;this._data=new a.ObservableJSON({values:n}),this._rawData=n,this._metadata=new a.ObservableJSON({values:i}),this._rawMetadata=i,this.trusted=l;var c=e.value;for(var u in c)switch(u){case"data":case"metadata":break;default:this._raw[u]=r.extract(c,u)}this.type=c.output_type,s.nbformat.isExecuteResult(c)?this.executionCount=c.execution_count:this.executionCount=null}return Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._data.dispose(),this._metadata.dispose(),o.Signal.clearData(this)},Object.defineProperty(e.prototype,"data",{get:function(){return this._rawData},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return this._rawMetadata},enumerable:!0,configurable:!0}),e.prototype.setData=function(e){e.data&&(this._updateObservable(this._data,e.data),this._rawData=e.data),e.metadata&&(this._updateObservable(this._metadata,e.metadata),this._rawMetadata=e.metadata),this._changed.emit(void 0)},e.prototype.toJSON=function(){var e={};for(var t in this._raw)e[t]=r.extract(this._raw,t);switch(this.type){case"display_data":case"execute_result":case"update_display_data":e.data=this.data,e.metadata=this.metadata}return delete e.transient,e},e.prototype._updateObservable=function(e,t){for(var n=e.keys(),r=Object.keys(t),i=0,o=n;i<o.length;i++){var s=o[i];-1===r.indexOf(s)&&e.delete(s)}for(var a=0,l=r;a<l.length;a++){s=l[a];var c=e.get(s),u=t[s];c!==u&&e.set(s,u)}},e}();t.OutputModel=l,function(e){e.getData=function(e){return r.getData(e)},e.getMetadata=function(e){return r.getMetadata(e)}}(l=t.OutputModel||(t.OutputModel={})),t.OutputModel=l,function(e){function t(e){var t={};if(s.nbformat.isExecuteResult(e)||s.nbformat.isDisplayData(e)||s.nbformat.isDisplayUpdate(e))t=e.data;else if(s.nbformat.isStream(e))"stderr"===e.name?t["application/vnd.jupyter.stderr"]=e.text:t["application/vnd.jupyter.stdout"]=e.text;else if(s.nbformat.isError(e)){var n=e.traceback.join("\n");t["application/vnd.jupyter.stderr"]=n||e.ename+": "+e.evalue}return function(e){var t=Object.create(null);for(var n in e){var r=e[n];i.JSONExt.isArray(r)?r=r.join("\n"):i.JSONExt.isPrimitive(r)||(r=JSON.parse(JSON.stringify(r))),t[n]=r}return t}(t)}function n(e){var t=Object.create(null);if(s.nbformat.isExecuteResult(e)||s.nbformat.isDisplayData(e))for(var n in e.metadata)t[n]=r(e.metadata,n);return t}function r(e,t){var n=e[t];return i.JSONExt.isPrimitive(n)?n:JSON.parse(JSON.stringify(n))}e.getData=t,e.getMetadata=n,e.getBundleOptions=function(e){return{data:t(e.value),metadata:n(e.value),trusted:!!e.trusted}},e.extract=r}(r||(r={}))},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(18),o=n(7),s=n(12),a=n(191);t.IRenderMimeRegistry=new s.Token("@jupyterlab/rendermime:IRenderMimeRegistry"),t.ILatexTypesetter=new s.Token("@jupyterlab/rendermime:ILatexTypesetter");var l,c=function(){function e(e){if(void 0===e&&(e={}),this._id=0,this._ranks={},this._types=null,this._factories={},this.resolver=e.resolver||null,this.linkHandler=e.linkHandler||null,this.latexTypesetter=e.latexTypesetter||null,this.sanitizer=e.sanitizer||o.defaultSanitizer,e.initialFactories)for(var t=0,n=e.initialFactories;t<n.length;t++){var r=n[t];this.addFactory(r)}}return Object.defineProperty(e.prototype,"mimeTypes",{get:function(){return this._types||(this._types=l.sortedTypes(this._ranks))},enumerable:!0,configurable:!0}),e.prototype.preferredMimeType=function(e,t){if(t)for(var n=0,r=this.mimeTypes;n<r.length;n++){if((s=r[n])in e&&this._factories[s].safe)return s}for(var i=0,o=this.mimeTypes;i<o.length;i++){var s;if((s=o[i])in e)return s}},e.prototype.createRenderer=function(e){if(!(e in this._factories))throw new Error("No factory for mime type: '"+e+"'");return this._factories[e].createRenderer({mimeType:e,resolver:this.resolver,sanitizer:this.sanitizer,linkHandler:this.linkHandler,latexTypesetter:this.latexTypesetter})},e.prototype.createModel=function(e){return void 0===e&&(e={}),new a.MimeModel(e)},e.prototype.clone=function(t){void 0===t&&(t={});var n=new e({resolver:t.resolver||this.resolver||void 0,sanitizer:t.sanitizer||this.sanitizer||void 0,linkHandler:t.linkHandler||this.linkHandler||void 0,latexTypesetter:t.latexTypesetter||this.latexTypesetter});return n._factories=r({},this._factories),n._ranks=r({},this._ranks),n._id=this._id,n},e.prototype.getFactory=function(e){return this._factories[e]},e.prototype.addFactory=function(e,t){void 0===t&&void 0===(t=e.defaultRank)&&(t=100);for(var n=0,r=e.mimeTypes;n<r.length;n++){var i=r[n];this._factories[i]=e,this._ranks[i]={rank:t,id:this._id++}}this._types=null},e.prototype.removeMimeType=function(e){delete this._factories[e],delete this._ranks[e],this._types=null},e.prototype.getRank=function(e){var t=this._ranks[e];return t&&t.rank},e.prototype.setRank=function(e,t){if(this._ranks[e]){var n=this._id++;this._ranks[e]={rank:t,id:n},this._types=null}},e}();t.RenderMimeRegistry=c,function(e){var t=function(){function e(e){this._session=e.session,this._contents=e.contents}return e.prototype.resolveUrl=function(e){if(i.URLExt.isLocal(e)){var t=i.PathExt.dirname(this._session.path);e=i.PathExt.resolve(t,e)}return Promise.resolve(e)},e.prototype.getDownloadUrl=function(e){return i.URLExt.isLocal(e)?this._contents.getDownloadUrl(e):Promise.resolve(e)},e}();e.UrlResolver=t}(c=t.RenderMimeRegistry||(t.RenderMimeRegistry={})),t.RenderMimeRegistry=c,function(e){e.sortedTypes=function(e){return Object.keys(e).sort((function(t,n){var r=e[t],i=e[n];return r.rank!==i.rank?r.rank-i.rank:r.id-i.id}))}}(l||(l={}))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),s=n(5),a=n(5),l=n(14),c=function(e){function t(n){var r=e.call(this)||this;r.outputLengthChanged=new o.Signal(r),r._onIOPub=function(e){var t,n,i=r.model,o=e.header.msg_type,s=(e.content.transient||{}).display_id;switch(o){case"execute_result":case"display_data":case"stream":case"error":(t=e.content).output_type=o,i.add(t);break;case"clear_output":var a=e.content.wait;i.clear(a);break;case"update_display_data":if((t=e.content).output_type="display_data",n=r._displayIdMap.get(s))for(var l=0,c=n;l<c.length;l++){var u=c[l];i.set(u,t)}}s&&"display_data"===o&&((n=r._displayIdMap.get(s)||[]).push(i.length-1),r._displayIdMap.set(s,n))},r._onExecuteReply=function(e){var t=r.model,n=e.content,i=n&&n.payload;if(i&&i.length){var o=i.filter((function(e){return"page"===e.source}));if(o.length){var s={output_type:"display_data",data:JSON.parse(JSON.stringify(o[0])).data,metadata:{}};t.add(s)}}},r._minHeightTimeout=null,r._future=null,r._displayIdMap=new Map;var i=r.model=n.model;r.addClass("jp-OutputArea"),r.rendermime=n.rendermime,r.contentFactory=n.contentFactory||t.defaultContentFactory,r.layout=new s.PanelLayout;for(var a=0;a<i.length;a++){var l=i.get(a);r._insertOutput(a,l)}return i.changed.connect(r.onModelChanged,r),r}return i(t,e),Object.defineProperty(t.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"future",{get:function(){return this._future},set:function(e){var t=this;if(this.model.isDisposed)throw Error("Model is disposed");this._future!==e&&(this._future&&this._future.dispose(),this._future=e,this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(this.model.length)),e.onIOPub=this._onIOPub,e.onReply=this._onExecuteReply,e.onStdin=function(n){l.KernelMessage.isInputRequestMsg(n)&&t._onInputRequest(n,e)})},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._future&&this._future.dispose(),this._future=null,this._displayIdMap.clear(),e.prototype.dispose.call(this)},t.prototype.onModelChanged=function(e,t){var n;switch(t.type){case"add":n=this._modelToLayoutIndex(t.newIndex),this._insertOutput(n,t.newValues[0]),this.outputLengthChanged.emit(this.model.length);break;case"remove":this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(this.model.length));break;case"set":n=this._modelToLayoutIndex(t.newIndex),this._setOutput(n,t.newValues[0]),this.outputLengthChanged.emit(this.model.length)}},t.prototype._clear=function(){var e=this;if(this.widgets.length){for(var t=this.widgets.length,n=0;n<t;n++){var r=this.widgets[0];r.parent=null,r.dispose()}this._displayIdMap.clear();var i=this.node.getBoundingClientRect();this.node.style.minHeight=i.height+"px",this._minHeightTimeout&&clearTimeout(this._minHeightTimeout),this._minHeightTimeout=window.setTimeout((function(){e.isDisposed||(e.node.style.minHeight="")}),50)}},t.prototype._onInputRequest=function(e,t){var n=this.contentFactory,r=e.content.prompt,i=e.content.password,o=new s.Panel;o.addClass("jp-OutputArea-child"),o.addClass("jp-OutputArea-stdin-item");var a=n.createOutputPrompt();a.addClass("jp-OutputArea-prompt"),o.addWidget(a);var l=n.createStdin({prompt:r,password:i,future:t});l.addClass("jp-OutputArea-output"),o.addWidget(l),this.layout.addWidget(o)},t.prototype._setOutput=function(e,t){this.layout.widgets[e].dispose(),this._insertOutput(e,t)},t.prototype._insertOutput=function(e,t){var n=this._createOutputItem(t);n.toggleClass("jp-OutputArea-executeResult",null!==t.executionCount),this.layout.insertWidget(e,n)},t.prototype._modelToLayoutIndex=function(e){var t,n=this.widgets,r=-1;for(t=0;t<n.length&&(n[t].hasClass("jp-OutputArea-stdin-item")||++r!==e);t++);return t},t.prototype._createOutputItem=function(e){var t=new s.Panel;t.addClass("jp-OutputArea-child");var n=this.contentFactory.createOutputPrompt();n.executionCount=e.executionCount,n.addClass("jp-OutputArea-prompt"),t.addWidget(n);var r=this.rendermime.preferredMimeType(e.data,!e.trusted);if(r){var i=e.metadata,o=i[r],a=!1;a=o&&void 0!==o.isolated?o.isolated:i.isolated;var l=this.rendermime.createRenderer(r);!0===a&&(l=new h.IsolatedRenderer(l)),l.renderModel(e),l.addClass("jp-OutputArea-output"),t.addWidget(l)}return t},t}(a.Widget);t.OutputArea=c,function(e){e.execute=function(e,t,n){var r={code:e,stop_on_error:!0};if(!n.kernel)return Promise.reject("Session has no kernel.");var i=n.kernel.requestExecute(r,!1);return t.future=i,i.done};var t=function(){function e(){}return e.prototype.createOutputPrompt=function(){return new u},e.prototype.createStdin=function(e){return new d(e)},e}();e.ContentFactory=t,e.defaultContentFactory=new t}(c=t.OutputArea||(t.OutputArea={})),t.OutputArea=c;var u=function(e){function t(){var t=e.call(this)||this;return t._executionCount=null,t.addClass("jp-OutputPrompt"),t}return i(t,e),Object.defineProperty(t.prototype,"executionCount",{get:function(){return this._executionCount},set:function(e){this._executionCount=e,this.node.textContent=null===e?"":"Out["+e+"]:"},enumerable:!0,configurable:!0}),t}(a.Widget);t.OutputPrompt=u;var h,d=function(e){function t(t){var n=e.call(this,{node:h.createInputWidgetNode(t.prompt,t.password)})||this;return n._future=null,n._input=null,n.addClass("jp-Stdin"),n._input=n.node.getElementsByTagName("input")[0],n._input.focus(),n._future=t.future,n}return i(t,e),t.prototype.handleEvent=function(e){var t=this._input;if("keydown"===e.type&&13===e.keyCode){this._future.sendInputReply({value:t.value});var n=document.createElement("span");n.className="jp-Stdin-rendered","password"===t.type?n.textContent=Array(t.value.length+1).join("·"):n.textContent=t.value,t.parentElement.replaceChild(n,t)}},t.prototype.onAfterAttach=function(e){this._input.addEventListener("keydown",this),this.update()},t.prototype.onUpdateRequest=function(e){this._input.focus()},t.prototype.onBeforeDetach=function(e){this._input.removeEventListener("keydown",this)},t}(a.Widget);t.Stdin=d,function(e){e.createInputWidgetNode=function(e,t){var n=document.createElement("div"),r=document.createElement("pre");r.className="jp-Stdin-prompt",r.textContent=e;var i=document.createElement("input");return i.className="jp-Stdin-input",t&&(i.type="password"),n.appendChild(r),r.appendChild(i),n};var t=function(e){function t(t){var n=e.call(this,{node:document.createElement("iframe")})||this;n.addClass("jp-mod-isolated"),n._wrapped=t;var r=n.node;return r.frameBorder="0",r.scrolling="auto",r.addEventListener("load",(function(){r.contentDocument.open(),r.contentDocument.write(n._wrapped.node.innerHTML),r.contentDocument.close();var e=r.contentDocument.body;r.style.height=e.scrollHeight+"px"})),n}return i(t,e),t.prototype.renderModel=function(e){var t=this;return this._wrapped.renderModel(e).then((function(){var e=t.node.contentWindow;e&&e.location.reload()}))},t}(a.Widget);e.IsolatedRenderer=t}(h||(h={}))},function(e,t,n){var r=n(495);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n.jp-OutputArea-child {\n margin-top: 1em;\n margin-bottom: 1em;\n}\n\n.jp-RenderedText pre {\n padding-left: 1em;\n padding-top: 0.8em;\n padding-bottom: 0.8em;\n}\n",""])},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5);t.WIDGET_MIMETYPE="application/vnd.jupyter.widget-view+json";var l=function(e){function t(t,n){var r=e.call(this)||this;return r.mimeType=t.mimeType,r._manager=n,r}return i(t,e),t.prototype.renderModel=function(e){return o(this,void 0,void 0,(function(){var t,n,r,i;return s(this,(function(o){switch(o.label){case 0:if(t=e.data[this.mimeType],!(n=this._manager.get_model(t.model_id)))return[3,6];o.label=1;case 1:return o.trys.push([1,4,,5]),[4,n];case 2:return r=o.sent(),[4,this._manager.display_model(null,r,{el:this.node})];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),console.log("Error displaying widget"),console.log(i),this.node.textContent="Error displaying widget",[3,5];case 5:return[3,7];case 6:return this.node.textContent="Error creating widget: could not find model",[2,Promise.resolve()];case 7:return[2]}}))}))},t}(a.Widget);t.WidgetRenderer=l},function(e){e.exports=JSON.parse('{"name":"@jupyter-widgets/html-manager","version":"0.11.10","description":"Standalone package for rendering Jupyter widgets outside notebooks","main":"lib/index.js","typings":"lib/index.d.ts","repository":{"type":"git","url":"https://github.com/jupyter-widgets/ipywidgets.git"},"files":["lib/**/*.d.ts","lib/**/*.js","dist/","css/*.css"],"scripts":{"clean":"rimraf lib && rimraf dist","build:src":"tsc --project src","build:embed-amd":"node scripts/concat-amd-build.js && rimraf dist/amd","build:test":"tsc --project test/src && webpack --config test/webpack.conf.js","build":"npm run build:src && webpack && npm run build:embed-amd","lint":"tslint --project tslint.json --format stylish","test":"npm run test:unit","test:unit":"npm run test:unit:firefox && npm run test:unit:chrome","test:unit:default":"npm run build:test && karma start test/karma.conf.js --log-level debug --browsers=Firefox","test:unit:firefox":"npm run test:unit:default -- --browsers=Firefox","test:unit:chrome":"npm run test:unit:default -- --browsers=Chrome","prepublish":"npm run clean && npm run build"},"author":"Jupyter Project","license":"BSD-3-Clause","bugs":{"url":"https://github.com/jupyter-widgets/ipywidgets/issues"},"homepage":"https://github.com/jupyter-widgets/ipywidgets#readme","dependencies":{"@jupyter-widgets/base":"^1.1.8","@jupyter-widgets/controls":"^1.1.6","@jupyter-widgets/output":"^1.0.15","@jupyter-widgets/schema":"^0.3.2","@jupyterlab/outputarea":"^0.15.0","@jupyterlab/rendermime":"^0.15.0","@jupyterlab/rendermime-interfaces":"^1.0.1","@phosphor/widgets":"^1.3.0","ajv":"^5.2.2","font-awesome":"^4.7.0","jquery":"^3.1.1"},"devDependencies":{"@types/mocha":"^2.2.41","@types/requirejs":"^2.1.28","chai":"^4.0.0","css-loader":"^0.28.4","file-loader":"^0.11.2","json-loader":"^0.5.4","karma":"^1.6.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.3","mocha":"^3.3.0","postcss":"^6.0.2","postcss-cssnext":"^3.0.2","postcss-import":"^10.0.0","postcss-loader":"^2.0.6","rimraf":"^2.6.1","style-loader":"^0.18.1","tslint":"^5.8.0","typescript":"~2.6.2","url-loader":"^0.5.9","webpack":"^3.5.5"}}')},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:function(){return r.extend(i.MarkModel.prototype.defaults(),{_model_name:"GridHeatMapModel",_view_name:"GridHeatMap",row:[],column:[],color:null,scales_metadata:{row:{orientation:"vertical",dimension:"y"},column:{orientation:"horizontal",dimension:"x"},color:{dimension:"color"}},null_color:"black",row_align:"start",column_align:"start",stroke:"black",opacity:1,anchor_style:{fill:"white",stroke:"blue"}})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["row","column","color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this;this.colors=this.get_typed_field("color"),this.rows=this.get_typed_field("row"),this.columns=this.get_typed_field("column");this.colors.length;var t=this.colors[0].length,n=[];n=n.concat.apply(n,this.colors),this.mark_data=n.map((function(n,r){var i=Math.floor(r/t),o=r%t;return{row_num:i,row:e.rows[i],column:e.columns[o],column_num:o,color:n,_cell_num:r}})),this.identify_modes(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.row,n=e.column,r=e.color;this.get("preserve_domain").row?t.del_domain([],this.model_id+"_row"):t.compute_and_set_domain(this.rows,this.model_id+"_row"),this.get("preserve_domain").column?n.del_domain([],this.model_id+"_column"):n.compute_and_set_domain(this.columns,this.model_id+"_column"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.color})),this.model_id+"_color"))}},get_data_dict:function(e,t){return e},identify_modes:function(){var e={},t=this.get("scales"),n=t.row,r=t.column,i=this.colors.length,o=this.colors[0].length;"ordinal"===n.type?e.row="middle":i===this.rows.length-1?e.row="boundaries":i===this.rows.length?e.row="expand_one":i===this.rows.length+1&&(e.row="expand_two"),"ordinal"===r.type?e.column="middle":o===this.columns.length-1?e.column="boundaries":o===this.columns.length?e.column="expand_one":o===this.columns.length+1&&(e.column="expand_two"),this.modes=e}});e.exports={GridHeatMapModel:o}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(r.WidgetModel.prototype.defaults(),{_model_name:"AxisModel",_view_name:"Axis",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,orientation:"horizontal",side:null,label:"",grid_lines:"solid",tick_format:null,scale:void 0,num_ticks:null,tick_values:[],offset:{},label_location:"middle",label_color:null,grid_color:null,color:null,label_offset:null,visible:!0,tick_style:{},tick_rotate:0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("change:side",this.validate_orientation,this),this.on("change:orientation",this.validate_side,this),this.validate_orientation(),this.validate_side()},validate_side:function(){var e=this.get("orientation"),t=this.get("side");"vertical"===e?"left"!==t&&"right"!==t&&this.set("side","left"):"bottom"!==t&&"top"!==t&&this.set("side","bottom"),this.save_changes()},validate_orientation:function(){this.get("orientation");var e=this.get("side");e&&("left"===e||"right"===e?this.set("orientation","vertical"):this.set("orientation","horizontal"),this.save_changes())}},{serializers:i.extend({scale:{deserialize:r.unpack_models},offset:{deserialize:r.unpack_models}},r.WidgetModel.serializers)}),l=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"ColorAxisModel",_view_name:"ColorAxis"})}});e.exports={AxisModel:a,ColorAxisModel:l}},function(e,t,n){var r=n(1),i=n(13),o=n(68).Interaction.extend({render:function(){o.__super__.render.apply(this),this.d3el.style({cursor:"crosshair"}),this.active=!1;var e=this;this.set_lines_view().then((function(){e.d3el.on("mousedown",(function(){return e.mousedown()})),e.set_limits()})),this.update_line_index(),this.listenTo(this.model,"change:line_index",this.update_line_index,this),this.model.on_some_change(["min_x","max_x"],this.set_limits,this)},set_lines_view:function(){var e=this.parent,t=this.model.get("lines"),n=this;return Promise.all(e.mark_views.views).then((function(r){var i=e.mark_views._models.map((function(e){return e.model_id})).indexOf(t.model_id);n.lines_view=r[i]}))},mousedown:function(){this.active=!0,this.mouse_entry(!1);var e=this;this.d3el.on("mousemove",(function(){e.mousemove()})),this.d3el.on("mouseleave",(function(){e.mouseup()})),this.d3el.on("mouseup",(function(){e.mouseup()}))},mouseup:function(){if(this.active){this.mouse_entry(!0);var e=this.model.get("lines");e.set_typed_field("y",i.deepCopy(e.y_data)),this.lines_view.touch(),this.active=!1,this.d3el.on("mousemove",null),this.d3el.on("mouseleave",null),this.d3el.on("mouseup",null)}},mousemove:function(){this.mouse_entry(!0)},mouse_entry:function(e){if(this.active){var t=this.model.get("lines"),n=Math.min(this.line_index,t.x_data.length-1),i=r.mouse(this.el);e&&"previous_pos"in this||(this.previous_pos=i);for(var o=this.lines_view.scales.x.scale,s=this.lines_view.scales.y.scale,a=o.invert(i[0]),l=s.invert(i[1]),c=o.invert(this.previous_pos[0]),u=(s.invert(this.previous_pos[1]),this.nns(t.x_data[n],c)),h=this.nns(t.x_data[n],a),d=Math.min(u,h),p=Math.max(u,h),f=d;f<=p;++f)(!this.valid_min||t.x_data[n][f]>=this.min_x)&&(!this.valid_max||t.x_data[n][f]<=this.max_x)&&(t.y_data[this.line_index][f]=l);var g=this,m=t.x_data[n].map((function(e,n){return{x:e,y:t.y_data[g.line_index][n]}}));this.lines_view.d3el.select("#curve"+(g.line_index+1)).attr("d",(function(e){return g.lines_view.line(m)})),this.previous_pos=i}},capnfloor:function(e){return Math.max(Math.min(e,this.model.get("max_x")),this.model.get("min_x"))},set_limits:function(){"date"==this.lines_view.scales.x.model.type?(this.min_x=this.model.get_date_elem("min_x"),this.valid_min=!(null===this.min_x||void 0===this.min_x||isNaN(this.min_x.getTime())),this.max_x=this.model.get_date_elem("max_x"),this.valid_max=!(null===this.max_x||void 0===this.max_x||isNaN(this.max_x.getTime()))):(this.min_x=this.model.get("min_x"),this.max_x=this.model.get("max_x"),this.valid_min=!(null===this.min_x||void 0===this.min_x),this.valid_max=!(null===this.max_x||void 0===this.max_x))},nns:function(e,t){var n=this.lines_view.bisect(e,t);return t-e[n-1]>e[n]-t?n:n-1},update_line_index:function(){this.line_index=this.model.get("line_index")}});e.exports={HandDraw:o}},function(e,t,n){var r=n(1),i=n(0),o=n(19),s=n(13),a=o.Mark.extend({render:function(){this.padding=this.model.get("padding");var e=a.__super__.render.apply(this);this.set_internal_scales(),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["bar","legendtext"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_scale_orientation:function(){this.model.get("orientation");this.dom_scale=this.scales.x,this.range_scale=this.scales.y},set_ranges:function(){var e=this.model.get("orientation");this.set_scale_orientation();var t=this.dom_scale,n=this.range_scale,r="vertical"===e?"x":"y",i="vertical"===e?"y":"x";"ordinal"!==t.model.type?t.set_range(this.parent.padded_range(r,t.model)):t.set_range(this.parent.padded_range(r,t.model),this.padding),n.set_range(this.parent.padded_range(i,n.model)),this.dom_offset=0,this.range_offset="vertical"===e?n.offset:-n.offset},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},set_internal_scales:function(){this.x=r.scale.ordinal(),this.x1=r.scale.ordinal()},adjust_offset:function(){"ordinal"!==this.dom_scale.model.type?"center"===this.model.get("align")?this.dom_offset=-(this.x.rangeBand()/2).toFixed(2):"left"===this.model.get("align")?this.dom_offset=-this.x.rangeBand().toFixed(2):this.dom_offset=0:"center"===this.model.get("align")?this.dom_offset=0:"left"===this.model.get("align")?this.dom_offset=-this.x.rangeBand()/2:this.dom_offset=this.x.rangeBand()/2},create_listeners:function(){a.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"colors_updated",this.update_colors,this),this.listenTo(this.model,"change:type",this.update_type,this),this.listenTo(this.model,"change:align",this.realign,this),this.listenTo(this.model,"change:orientation",this.relayout,this),this.listenTo(this.model,"change:padding",this.relayout,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=i.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=i.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},realign:function(){this.relayout()},draw_zero_line:function(){this.set_scale_orientation();var e=this.range_scale;"vertical"===this.model.get("orientation")?this.d3el.select(".zeroLine").attr("x1",0).attr("x2",this.parent.plotarea_width).attr("y1",e.scale(this.model.base_value)).attr("y2",e.scale(this.model.base_value)):this.d3el.select(".zeroLine").attr("x1",e.scale(this.model.base_value)).attr("x2",e.scale(this.model.base_value)).attr("y1",0).attr("y2",this.parent.plotarea_height)},relayout:function(){this.set_ranges(),this.compute_view_padding();this.range_scale;this.draw_zero_line(),this.x.rangeRoundBands(this.set_x_range(),this.padding),this.adjust_offset(),this.x1.rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),this.draw_bars()},invert_point:function(e){if(void 0===e)return this.model.set("selected",null),void this.touch();var t=this.x_pixels.map((function(t){return Math.abs(t-e)}));this.model.set("selected",[t.indexOf(r.min(t))]),this.touch()},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=this.pixel_coords,r=i.range(n.length),o=i.filter(r,(function(e){for(var r=n[e],i=0;i<r.length;i++)if(t(r[i]))return!0;return!1}));this.model.set("selected",o),this.touch()},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},draw:function(e){this.set_ranges();this.model.get("colors");var t=this,n=this.d3el.selectAll(".bargroup").data(this.model.mark_data,(function(e){return e.key})),r=this.dom_scale;this.range_scale;if("ordinal"!==r.model.type){var o=this.model.mark_data.map((function(e){return e.key}));this.x.domain(o)}else this.x.domain(r.scale.domain());this.x.rangeRoundBands(this.set_x_range(),this.padding),this.adjust_offset(),this.x1.rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),this.model.mark_data.length>0&&this.x1.domain(i.range(this.model.mark_data[0].values.length)).rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),n.enter().append("g").attr("class","bargroup"),n.order(),n.on("click",(function(e,n){return t.event_dispatcher("element_clicked",{data:e,index:n})})),n.exit().remove();var s=n.selectAll(".bar").data((function(e){return e.values}));s.enter().append("rect").attr("class","bar").attr("width",0).attr("height",0),s.exit().remove(),this.draw_bars(e),this.apply_styles(),this.d3el.selectAll(".zeroLine").remove(),this.d3el.append("g").append("line").attr("class","zeroLine"),this.draw_zero_line()},draw_bars:function(e){var t=this.d3el.selectAll(".bargroup"),n=t.selectAll(".bar"),i=!0===e?this.parent.model.get("animation_duration"):0,o=this,s=this.model.get("orientation"),a=this.dom_scale,l=this.range_scale,c="vertical"===s?"x":"y",u="vertical"===s?"y":"x",h="vertical"===s?"width":"height",d="vertical"===s?"height":"width";if("ordinal"===a.model.type){var p=r.max(this.parent.range(c));t.attr("transform",(function(e){return"vertical"===s?"translate("+((void 0!==a.scale(e.key)?a.scale(e.key):p)+o.dom_offset)+", 0)":"translate(0, "+((void 0!==a.scale(e.key)?a.scale(e.key):p)+o.dom_offset)+")"}))}else t.attr("transform",(function(e){return"vertical"===s?"translate("+(a.scale(e.key)+o.dom_offset)+", 0)":"translate(0, "+(a.scale(e.key)+o.dom_offset)+")"}));var f="stacked"===this.model.get("type");f?n.transition("draw_bars").duration(i).attr(c,0).attr(h,this.x.rangeBand().toFixed(2)).attr(u,(function(e){return"y"===u?l.scale(e.y1):l.scale(e.y0)})).attr(d,(function(e){return Math.abs(l.scale(e.y1+e.y_ref)-l.scale(e.y1))})):n.transition("draw_bars").duration(i).attr(c,(function(e,t){return o.x1(t)})).attr(h,this.x1.rangeBand().toFixed(2)).attr(u,(function(e){return r.min([l.scale(e.y),l.scale(o.model.base_value)])})).attr(d,(function(e){return Math.abs(l.scale(o.model.base_value)-l.scale(e.y_ref))})),this.pixel_coords=this.model.mark_data.map((function(e){var t=e.key,n=a.scale(t)+o.dom_offset;return e.values.map((function(e){var t={};return t[c]=f?n:n+o.x1(e.sub_index),t[u]=f?"y"===u?l.scale(e.y1):l.scale(e.y0):r.min([l.scale(e.y),l.scale(o.model.base_value)]),t[h]=f?o.x.rangeBand():o.x1.rangeBand(),t[d]=f?Math.abs(l.scale(e.y1+e.y_ref)-l.scale(e.y1)):Math.abs(l.scale(o.model.base_value)-l.scale(e.y_ref)),[[t.x,t.x+t.width],[t.y,t.y+t.height]]}))})),this.x_pixels=this.model.mark_data.map((function(e){return a.scale(e.key)+a.offset}))},update_type:function(e,t){this.model.update_domains(),this.draw()},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.d3el.selectAll(".bar").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},update_colors:function(){var e=this,t=this.scales.color;this.model.mark_data.length>0&&(this.model.is_y_2d?this.d3el.selectAll(".bargroup").selectAll(".bar").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)})):this.d3el.selectAll(".bar").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)}))),this.legend_el&&(this.legend_el.selectAll(".legendrect").style("fill",(function(n,r){return n.color&&t?t.scale(n.color):e.get_colors(n.color_index)})),this.legend_el.selectAll(".legendtext").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)})))},draw_legend:function(e,t,n,o,s){if(!this.model.is_y_2d&&1!==this.model.get("colors").length&&"element"!==this.model.get("color_mode"))return[0,0];var a=this.model.mark_data[0].values.map((function(e){return{index:e.sub_index,color:e.color,color_index:e.color_index}})),l=this.scales.color;this.legend_el=e.selectAll(".legend"+this.uuid).data(a);var c=this,u=.8*s;this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",i.bind((function(){this.event_dispatcher("legend_mouse_over")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("legend_mouse_out")}),this)).on("click",i.bind((function(){this.event_dispatcher("legend_clicked")}),this)).append("rect").classed("legendrect",!0).style("fill",(function(e,t){return void 0!==e.color&&void 0!==l?l.scale(e.color):c.get_colors(e.color_index)})).attr({x:0,y:0,width:u,height:u}),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*u).attr("y",u/2).attr("dy","0.35em").text((function(e,t){return c.model.get("labels")[t]})).style("fill",(function(e,t){return void 0!==e.color&&void 0!==l?l.scale(e.color):c.get_colors(e.color_index)}));var h=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[this.model.mark_data[0].values.length,h]},clear_style:function(e,t){var n=this.d3el.selectAll(".bargroup");void 0!==t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.selectAll(".bar").style(r)},set_style_on_elements:function(e,t){if(null!=t&&0!==t.length&&0!==Object.keys(e).length){var n=this.d3el.selectAll(".bargroup");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).selectAll(".bar").style(e)}},set_default_style:function(e){this.update_colors(),this.update_stroke_and_opacities()},set_x_range:function(){var e=this.dom_scale;return"ordinal"===e.model.type?e.scale.rangeExtent():[e.scale(r.min(this.x.domain())),e.scale(r.max(this.x.domain()))]},bar_click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),o=n?s.deepCopy(n):[],a=o.indexOf(t),l=r.event.ctrlKey||r.event.metaKey;if(a>-1&&l)o.splice(a,1);else if(r.event.shiftKey){if(a>-1)return;var c=0!==o.length?r.min(o):-1,u=0!==o.length?r.max(o):this.model.mark_data.length;t>u?i.range(u+1,t+1).forEach((function(e){o.push(e)})):t<c&&i.range(t,c).forEach((function(e){o.push(e)}))}else l?o.push(t):(o=[]).push(t);this.model.set("selected",0===o.length?null:o,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var h=r.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault()},reset_selection:function(){this.model.set("selected",null),this.selected_indices=null,this.touch()},compute_view_padding:function(){var e=this.dom_scale,t=this.model.get("orientation"),n=0,r="vertical"===t?this.parent.plotarea_width:this.parent.plotarea_height;e&&null!==this.x&&void 0!==this.x&&0!==this.x.domain().length&&("ordinal"!==e.model.type?"center"===this.model.get("align")?n=r/(2*this.x.domain().length)+1:"left"!==this.model.get("align")&&"right"!==this.model.get("align")||(n=r/this.x.domain().length+1):"left"!==this.model.get("align")&&"right"!==this.model.get("align")||(n=(this.x.rangeBand()/2).toFixed(2))),"vertical"===t?n!==this.x_padding&&(this.x_padding=n,this.trigger("mark_padding_updated")):n!==this.y_padding&&(this.y_padding=n,this.trigger("mark_padding_updated"))}});e.exports={Bars:a}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(r.WidgetModel.prototype.defaults(),{_model_name:"HandDrawModel",_view_name:"HandDraw",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,lines:null,line_index:0,min_x:null,max_x:null})}},{serializers:i.extend({lines:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={HandDrawModel:a}},function(e,t,n){var r=n(1),i=n(0),o=n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.create_listeners(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.y;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind(this.mouse_over,this)).on("mousemove",i.bind(this.mouse_move,this)).on("mouseout",i.bind(this.mouse_out,this)),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width,this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:opacities",this.update_opacities,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"format_updated",this.draw,this),this.listenTo(this.model,"data_updated",this.draw)},update_stroke:function(){var e=this.model.get("stroke");this.d3el.selectAll(".stick").style("stroke",e),this.legend_el&&(this.legend_el.selectAll("path").style("stroke",e),this.legend_el.selectAll("text").style("fill",e))},update_stroke_width:function(){var e=this.model.get("stroke_width");this.d3el.selectAll(".stick").attr("stroke-width",e)},update_colors:function(){var e=this,t=this.model.get("colors"),n=t[0]?t[0]:"none",r=t[1]?t[1]:"none";this.d3el.selectAll(".stick").style("fill",(function(t){return t.y[e.model.px.o]>t.y[e.model.px.c]?r:n})),this.legend_el&&this.legend_el.selectAll("path").style("fill",n)},update_opacities:function(){var e=this.model.get("opacities");this.d3el.selectAll(".stick").style("opacity",(function(t,n){return e[n]})),this.legend_el&&this.legend_el.selectAll("path").attr("opacity",(function(t,n){return e[n]}))},update_marker:function(){var e=this.model.get("marker");this.legend_el&&this.rect_dim&&this.draw_legend_icon(this.rect_dim,this.legend_el),this.draw_mark_paths(e,this.d3el,this.model.mark_data.map((function(e,t){return e[1]})))},update_selected_colors:function(e,t){this.d3el.selectAll(".stick");var n=i.range(e,t+1);n.length==this.model.mark_data.length&&(n=[]);var r=this,o=this.model.get("stroke"),s=this.model.get("colors"),a=s[0]?s[0]:o,l=s[1]?s[1]:o,c=this.model.px;i.range(0,this.model.mark_data.length).forEach((function(e){r.d3el.selectAll("#stick"+e).style("stroke",o)})),n.forEach((function(e){r.d3el.selectAll("#stick"+e).style("stroke",(function(e){return e[c.o]>e[c.c]?l:a}))}))},invert_range:function(e,t){if(void 0===e||void 0===t||0===this.model.mark_data.length)return this.update_selected_colors(-1,-1),o=[];var n=i.range(this.model.mark_data.length),r=this,o=i.filter(n,(function(n){var i=r.x_pixels[n];return i>=e&&i<=t})),s=this.scales.x,a=-1,l=-1;return o.length>0&&(e!==s.scale.range()[0]||t!==s.scale.range()[1])&&(a=o[0],l=o[o.length-1]),this.update_selected_colors(a,l),this.model.set("selected",o),this.touch(),o},invert_point:function(e){this.scales.x;var t=this.x_pixels.map((function(t){return Math.abs(t-e)})),n=t.indexOf(r.min(t));return this.update_selected_colors(n,n),this.model.set("selected",[n]),this.touch(),n},draw:function(){var e=this.scales.x,t=this.scales.y;this.set_ranges();var n=this.model.get("colors"),i=this.model.get("opacities"),o=n[0]?n[0]:"none",s=n[1]?n[1]:"none",a=this.model.px,l=this.d3el.selectAll(".stick").data(this.model.mark_data.map((function(e,t){return{x:e[0],y:e[1],index:t}}))),c=l.enter().append("g").attr("class","stick").attr("id",(function(e,t){return"stick"+t})).style("stroke",this.model.get("stroke")).style("opacity",(function(e,t){return i[t]}));c.append("path").attr("class","stick_head"),c.append("path").attr("class","stick_tail"),c.append("path").attr("class","stick_body"),l.exit().remove();var u=this,h=a.h;if(-1===a.h&&(h=a.o),this.d3el.selectAll(".stick").style("fill",(function(e,t){return e.y[a.o]>e.y[a.c]?s:o})).attr("stroke-width",this.model.get("stroke_width")),"ordinal"===e.model.type){var d=r.max(this.parent.range("x"));this.d3el.selectAll(".stick").attr("transform",(function(n,r){return"translate("+((void 0!==e.scale(u.model.mark_data[r][0])?e.scale(u.model.mark_data[r][0]):d)+e.scale.rangeBand()/2)+","+(t.scale(n.y[h])+t.offset)+")"}))}else this.d3el.selectAll(".stick").attr("transform",(function(n,r){return"translate("+(e.scale(u.model.mark_data[r][0])+e.offset)+","+(t.scale(n.y[h])+t.offset)+")"}));this.draw_mark_paths(this.model.get("marker"),this.d3el,this.model.mark_data.map((function(e){return e[1]}))),this.x_pixels=this.model.mark_data.map((function(t){return e.scale(t[0])+e.offset}))},draw_mark_paths:function(e,t,n){for(var r,i,o=this.model.px,s=this,a=[],l=[],c=[],u=[],h=[],d=[],p=[],f=[],g=this.calculate_mark_width(),m=this.scales.x,_=this.scales.y,v=0;v<n.length;v++)-1===o.o?a[v]=void 0:a[v]=_.scale(n[v][o.o]),-1===o.c?u[v]=void 0:u[v]=_.scale(n[v][o.c]),-1!==o.o&&-1!==o.c&&(h[v]=n[v][o.o]>n[v][o.c]?a[v]:u[v],d[v]=n[v][o.o]<n[v][o.c]?a[v]:u[v]),-1===o.h||-1===o.l?(l[v]=a[v],c[v]=u[v]):(l[v]=_.scale(n[v][o.h]),c[v]=_.scale(n[v][o.l])),i=s.model.mark_data[v][0],g instanceof Date&&(g=g.getTime()),i instanceof Date&&(i=i.getTime()),r=i+g,"ordinal"===m.model.type?f[v]=.75*m.scale.rangeBand():f[v]=.75*(m.scale(r)-m.scale(i)),p[v]=-1*f[v]/2;"candle"==e&&-1!==o.o&&-1!==o.c?(-1!==o.h||-1!==o.l?(t.selectAll(".stick_head").attr("d",(function(e,t){return s.head_path_candle(h[t]-l[t])})),t.selectAll(".stick_tail").attr("d",(function(e,t){return s.tail_path_candle(d[t]-l[t],c[t]-d[t])}))):(t.selectAll(".stick_head").attr("d",""),t.selectAll(".stick_tail").attr("d","")),t.selectAll(".stick_body").attr("d",(function(e,t){return s.body_path_candle(p[t],a[t]-l[t],f[t],u[t]-a[t])}))):(-1!==o.o?t.selectAll(".stick_head").attr("d",(function(e,t){return s.head_path_bar(p[t],a[t]-l[t],-1*p[t])})):t.selectAll(".stick_head").attr("d",""),-1!==o.c?t.selectAll(".stick_tail").attr("d",(function(e,t){return s.tail_path_bar(u[t]-l[t],-1*p[t])})):t.selectAll(".stick_tail").attr("d",""),t.selectAll(".stick_body").attr("d",(function(e,t){return s.body_path_bar(c[t]-l[t])})))},head_path_candle:function(e){return"m0,0 l0,"+e},tail_path_candle:function(e,t){return"m0,"+e+" l0,"+t},body_path_candle:function(e,t,n,r){return"m"+e+","+t+" l"+n+",0 l0,"+r+" l"+-1*n+",0 z"},head_path_bar:function(e,t,n){return"m"+e+","+t+" l"+n+",0"},tail_path_bar:function(e,t){return"m0,"+e+" l"+t+",0"},body_path_bar:function(e){return"m0,0 l0,"+e},calculate_mark_width:function(){for(var e=Number.POSITIVE_INFINITY,t=this.model.get("scales").x,n=1;n<this.model.mark_data.length;n++){var r=this.model.mark_data[n][0]-this.model.mark_data[n-1][0];r<e&&(e=r)}return e===Number.POSITIVE_INFINITY&&(e=(t.domain[1]-t.domain[0])/2),e<0&&(e*=-1),e},relayout:function(){o.__super__.relayout.apply(this),this.set_ranges(),this.d3el.select(".intselmouse").attr("width",this.width).attr("height",this.height),this.draw()},draw_legend:function(e,t,n,o,s){var a=this.model.get("stroke"),l=this.model.get("colors"),c=l[0]?l[0]:"none";l[1]&&l[1];this.rect_dim=.8*s;var u=this;this.legend_el=e.selectAll("#legend"+this.uuid).data([this.model.mark_data]);var h=this.legend_el.enter().append("g").attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).attr("class","legend").attr("id","legend"+this.uuid).style("fill",c).on("mouseover",i.bind(this.highlight_axes,this)).on("mouseout",i.bind(this.unhighlight_axes,this));h.append("path").attr("class","stick_head stick"),h.append("path").attr("class","stick_tail stick"),h.append("path").attr("class","stick_body stick").style("fill",c),h.selectAll("path").style("stroke",a).attr("transform","translate("+u.rect_dim/2+",0)"),this.draw_legend_icon(u.rect_dim,h),this.legend_el.append("text").attr("class","legendtext sticktext").attr("x",1.2*u.rect_dim).attr("y",u.rect_dim/2).attr("dy","0.35em").text((function(e,t){return u.model.get("labels")[t]})).style("fill",a);var d=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,d]},draw_legend_icon:function(e,t){var n=e,r=e/2,i=3*e/4,o=e/4;"candle"===this.model.get("marker")?(t.selectAll(".stick_head").attr("d",this.head_path_candle(r/2)),t.selectAll(".stick_tail").attr("d",this.tail_path_candle(i,r/2)),t.selectAll(".stick_body").attr("d",this.body_path_candle(-1*r/2,o,r,n/2))):(t.selectAll(".stick_head").attr("d",this.head_path_bar(-1*r/2,i,r/2)),t.selectAll(".stick_tail").attr("d",this.tail_path_bar(o,r/2)),t.selectAll(".stick_body").attr("d",this.body_path_bar(n)))}});e.exports={OHLC:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"BarsModel",_view_name:"Bars",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},color_mode:"auto",type:"stacked",colors:r.scale.category10().range(),padding:.05,stroke:null,base:0,opacities:[],orientation:"vertical",align:"center"})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.is_y_2d=!1,this.on_some_change(["x","y","base"],this.update_data,this),this.on("change:color",(function(){this.update_color(),this.trigger("colors_updated")}),this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_color(),this.update_domains()},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y"),n=this.get("scales");n.x,n.y;t=0===t.length||t[0]instanceof Array?t:[t];var i=this;this.base_value=this.get("base"),void 0!==this.base_value&&null!==this.base_value||(this.base_value=0),0===e.length||0===t.length?(this.mark_data=[],this.is_y_2d=!1):(e=e.slice(0,r.min(t.map((function(e){return e.length})))),this.mark_data=e.map((function(e,n){var r={},o=i.base_value,s=i.base_value,a=i.base_value;return r.key=e,r.values=t.map((function(t,r){var l=t[n]-i.base_value,c=l>=0;return{index:n,sub_index:r,x:e,y0:c?o:a+=l,y1:c?o+=l:(s+=l)-l,y_ref:l,y:t[n]}})),r.pos_max=o,r.neg_max=s,r})),this.is_y_2d=this.mark_data[0].values.length>1,this.update_color()),this.update_domains(),this.trigger("data_updated")},get_data_dict:function(e,t,n){return e},update_color:function(){if(this.mark_data){var e=this.get_typed_field("color"),t=this.get("scales").color,n=this.get("color_mode"),r="group"===n||"auto"===n&&!this.is_y_2d;this.mark_data.forEach((function(t,n){t.values.forEach((function(t,i){t.color_index=r?n:i,t.color=e[t.color_index]}))})),t&&e.length>0&&(this.get("preserve_domain").color?t.del_domain([],this.model_id+"_color"):t.compute_and_set_domain(e,this.model_id+"_color"))}},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=(this.get("orientation"),e.x),n=e.y;if(this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.map((function(e){return e.key})),this.model_id+"_x"),this.get("preserve_domain").y)n.del_domain([],this.model_id+"_y");else if("stacked"===this.get("type"))n.compute_and_set_domain([r.min(this.mark_data,(function(e){return e.neg_max})),r.max(this.mark_data,(function(e){return e.pos_max})),this.base_value],this.model_id+"_y");else{var i=r.min(this.mark_data,(function(e){return r.min(e.values,(function(e){return e.y_ref}))})),o=r.max(this.mark_data,(function(e){return r.max(e.values,(function(e){return e.y_ref}))}));n.compute_and_set_domain([i,o,this.base_value],this.model_id+"_y")}}}});e.exports={BarsModel:s}},function(e,t,n){var r=n(0),i=n(1),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this);this.bars_selected=[],this.display_el_classes=["rect","legendtext"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.draw(),t.update_selected(t.model,t.model.get("selected"))}))},set_ranges:function(){var e=this.scales.sample;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.count;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.sample,t=this.scales.count;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.model.update_data()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){s.__super__.create_listeners.apply(this),this.d3el.on("mouseover",r.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",r.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",r.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.listenTo(this.model,"change:selected",this.update_selected,this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");r.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=r.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=r.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},update_colors:function(e,t){this.d3el.selectAll(".bargroup").selectAll("rect").style("fill",this.get_colors(0)),e.get("labels")&&t.length>1&&this.d3el.selectAll(".bargroup").selectAll("text").style("fill",this.get_colors(1)),this.legend_el&&(this.legend_el.selectAll("rect").style("fill",this.get_colors(0)),this.legend_el.selectAll("text").style("fill",this.get_colors(0)))},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.d3el.selectAll(".rect").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},calculate_bar_width:function(){var e=this.scales.sample,t=(e.scale(this.model.max_x)-e.scale(this.model.min_x))/this.model.num_bins;return t>=10&&(t-=2),t},relayout:function(){this.set_ranges();var e=this.scales.sample,t=this.scales.count;this.d3el.selectAll(".bargroup").attr("transform",(function(n){return"translate("+e.scale(n.x)+","+t.scale(n.y)+")"}));var n=this.calculate_bar_width();this.d3el.selectAll(".bargroup").select("rect").transition("relayout").duration(this.parent.model.get("animation_duration")).attr("x",2).attr("width",n).attr("height",(function(e){return t.scale(0)-t.scale(e.y)}))},draw:function(){this.set_ranges();var e=this.model.get("colors"),t=e[0],n=(e.length>1&&e[1],[]);this.model.mark_data.forEach((function(e,t){n.push(t)}));var r=this.scales.sample,i=this.scales.count,o=this,s=this.calculate_bar_width(),a=this.d3el.selectAll(".bargroup").data(this.model.mark_data);a.enter().append("g").attr("class","bargroup").append("rect").attr("class","rect").attr("x",2).attr("width",0).attr("height",0),a.attr("transform",(function(e){return"translate("+r.scale(e.x)+","+i.scale(e.y)+")"})),a.select(".rect").style("fill",t).on("click",(function(e,t){return o.event_dispatcher("element_clicked",{data:e,index:t})})).attr("id",(function(e,t){return"rect"+t})).transition("draw").duration(this.parent.model.get("animation_duration")).attr("width",s).attr("height",(function(e){return i.scale(0)-i.scale(e.y)})),a.exit().remove(),this.bin_pixels=this.model.x_bins.map((function(e){return r.scale(e)+r.offset})),this.pixel_coords=this.model.mark_data.map((function(e){var t=r.scale(e.x);return[[t,t+s],[0,e.y].map(i.scale)]})),this.update_stroke_and_opacities()},bar_click_handler:function(e){e.data;var t=e.index,n=this.bars_selected,s=n?o.deepCopy(n):[],a=s.indexOf(t),l=i.event.ctrlKey||i.event.metaKey;if(a>-1&&l)s.splice(a,1);else if(i.event.shiftKey){if(a>-1)return;var c=0!==s.length?i.min(s):-1,u=0!==s.length?i.max(s):this.model.mark_data.length;t>u?r.range(u+1,t+1).forEach((function(e){s.push(e)})):t<c&&r.range(t,c).forEach((function(e){s.push(e)}))}else l?s.push(t):(s=[]).push(t);this.bars_selected=s,this.model.set("selected",0===s.length?null:this.calc_data_indices(s),{updated_view:this}),this.touch(),i.event||(i.event=window.event);var h=i.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault()},draw_legend:function(e,t,n,o,s){this.legend_el=e.selectAll(".legend"+this.uuid).data([this.model.mark_data[0]]);var a=this,l=.8*s;this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",r.bind((function(){this.event_dispatcher("legend_mouse_over")}),this)).on("mouseout",r.bind((function(){this.event_dispatcher("legend_mouse_out")}),this)).on("click",r.bind((function(){this.event_dispatcher("legend_clicked")}),this)).append("rect").style("fill",(function(e,t){return a.get_colors(t)})).attr({x:0,y:0,width:l,height:l}),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*l).attr("y",l/2).attr("dy","0.35em").text((function(e,t){return a.model.get("labels")[t]})).style("fill",(function(e,t){return a.get_colors(t)}));var c=i.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,c]},reset_colors:function(e,t){this.d3el.selectAll("#rect"+e).style("fill",t)},update_selected:function(e,t){if(null!=t&&0!==t.length){var n=this.calc_bar_indices_from_data_idx(t);this.update_selected_colors(n)}else this.update_selected_colors([])},update_selected_colors:function(e){var t=this.model.get("colors"),n=t.length>1?t[1]:"red",i=t[0],o=(this.d3el.selectAll(".bargroup"),this);r.difference(r.range(0,this.model.num_bins),e).forEach((function(e){o.d3el.selectAll("#rect"+e).style("fill",i)})),e.forEach((function(e){o.d3el.selectAll("#rect"+e).style("fill",n)}))},invert_point:function(e){if(void 0===e)return this.model.set("selected",null),void this.touch();var t=this.calculate_bar_width(),n=(this.scales.sample,this.bin_pixels.map((function(n){return Math.abs(n+t/2-e)}))),r=n.indexOf(i.min(n));this.model.set("selected",this.calc_data_indices([r])),this.touch()},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=this.pixel_coords,i=r.range(n.length),o=r.filter(i,(function(e){return t(n[e])}));this.model.set("selected",this.calc_data_indices(o)),this.touch()},calc_data_indices:function(e){var t=this.reduce_intervals(e);if(0===t.length)return[];var n=this.model.get_typed_field("sample"),i=t.length;return r.filter(r.range(n.length),(function(e){var r=n[e],o=0;for(o=0;o<i;o++)if(r<=t[o][1]&&r>=t[o][0])return!0;return!1}))},reduce_intervals:function(e){var t=[];if(0!==e.length){e.sort();for(var n=e[0],r=e[0],i=1;i<e.length;i++)e[i]===r+1?r++:(t.push([this.model.x_bins[n],this.model.x_bins[r+1]]),n=r=e[i]);t.push([this.model.x_bins[n],this.model.x_bins[r+1]])}return t},calc_data_indices_from_data_range:function(e,t){this.scales.sample;var n=i.max([0,i.bisectLeft(this.bin_pixels,e)-1]),o=i.min([this.model.num_bins,i.bisectRight(this.bin_pixels,t)]),s=this.model.get_typed_field("sample"),a=this;return r.filter(r.range(s.length),(function(e){return s[e]>=a.model.x_bins[n]&&s[e]<=a.model.x_bins[o]}))},calc_bar_indices_from_data_idx:function(e){for(var t=this.model.get_typed_field("sample"),n=e.map((function(e){return t[e]})),i=[],o=0;o<n.length;o++){var s=Math.min(r.indexOf(this.model.x_bins,n[o],!0),this.model.x_bins.length-2);-1===s&&(s=r.sortedIndex(this.model.x_bins,n[o])-1),i.push(s)}return i.sort(),i=r.uniq(i,!0)},reset_selection:function(){this.bars_selected=[],this.model.set("selected",null),this.touch()}});e.exports={Hist:s}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"OHLCModel",_view_name:"OHLC",x:[],y:[],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}},stroke:null,box_fill_color:"dodgerblue",outlier_fill_color:"gray",opacities:[]})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.on("change:format",this.update_format,this),this.px={o:-1,h:-1,l:-1,c:-1},this.mark_data=[],this.display_el_classes=["stick_body"],this.update_data(),this.update_domains(),this.update_format()},update_format:function(){this.update_data(),this.trigger("format_updated")},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y"),n=this.get("format");function o(e){console&&console.error("Invalid OHLC format: '"+e+"'")}if(this.px=n.toLowerCase().split("").reduce((function(r,i,s){return-1!==r[i]&&(o(n),e=[],t=[]),r[i]=s,r}),{o:-1,h:-1,l:-1,c:-1}),-1!==this.px.h&&-1===this.px.l||-1===this.px.h&&-1!==this.px.l||n.length<2||n.length>4)o(n),e=[],t=[];else{var s=this.px;(-1===this.px.h||t.every((function(e){return e[s.h]===r.max(e)&&e[s.l]===r.min(e)})))&&t.every((function(e){return e.length===n.length}))||(e=[],t=[],console&&console.error("Invalid OHLC data"))}e.length>t.length?e=e.slice(0,t.length):e.length<t.length&&(t=t.slice(0,e.length)),this.mark_data=i.zip(e,t),this.mark_data.forEach((function(e,t){e.index=t})),this.update_domains(),this.trigger("data_updated")},update_domains:function(){if(this.mark_data){for(var e,t,n=this.get("scales"),i=n.x,o=n.y,s=Number.POSITIVE_INFINITY,a=0,l=0,c=0,u=0;u<this.mark_data.length;u++)u>0&&(l=this.mark_data[u][0]-this.mark_data[u-1][0])<s&&(s=l),(c=this.mark_data[u][this.px.h]-this.mark_data[u][this.px.l])>a&&(a=c);if(this.mark_data.length<2&&(s=0),this.get("preserve_domain").x||0===this.mark_data.length?i.del_domain([],this.model_id+"_x"):"ordinal"===i.type?i.compute_and_set_domain(this.mark_data.map((function(e){return e[0]}))):(e=r.min(this.mark_data.map((function(e){return e[0]}))),(t=r.max(this.mark_data.map((function(e){return e[0]}))))instanceof Date&&(t=t.getTime()),i.set_domain([e-s/2,t+s/2],this.model_id+"_x")),this.get("preserve_domain").y||0===this.mark_data.length)o.del_domain([],this.model_id+"_y");else{var h=this.px.h,d=this.px.l;-1!==h&&-1!==d||(h=this.px.o,d=this.px.c),e=r.min(this.mark_data.map((function(e){return e[1][d]<e[1][h]?e[1][d]:e[1][h]}))),(t=r.max(this.mark_data.map((function(e){return e[1][h]>e[1][d]?e[1][h]:e[1][d]}))))instanceof Date&&(t=t.getTime()),o.set_domain([e-a,t+a],this.model_id+"_y")}}},get_data_dict:function(e,t){var n=this,r={};return r.index=t,r.x=e.x,["open","low","high","close"].forEach((function(t){r[t]=e.y[n.px[t.substr(0,1)]]})),r}});e.exports={OHLCModel:s}},function(e,t,n){var r=n(0),i=n(1),o=n(20),s=o.MarkModel.extend({defaults:function(){return r.extend(o.MarkModel.prototype.defaults(),{_model_name:"HistModel",_view_name:"Hist",sample:[],count:[],scales_metadata:{sample:{orientation:"horizontal",dimension:"x"},count:{orientation:"vertical",dimension:"y"}},bins:10,midpoints:[],colors:i.scale.category10().range(),stroke:null,opacities:[],normalized:!1})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.mark_data=[],this.on_some_change(["bins","sample","preserve_domain"],this.update_data,this),this.update_data(),this.on("change:normalized",(function(){this.normalize_data(!0)}),this),this.normalize_data(!0)},update_data:function(){var e=this.get_typed_field("sample"),t=this.get("scales").sample;if(this.num_bins=this.get("bins"),0==e.length)this.mark_data=[],this.x_mid=[],this.count=[],this.x_bins=[];else{this.get("preserve_domain").sample?t.del_domain([],this.model_id+"_sample"):t.compute_and_set_domain(e,this.model_id+"_sample"),this.min_x=t.domain[0],this.max_x=t.domain[1];var n=this,r=(e=e.filter((function(e){return e<=n.max_x&&e>=n.min_x}))).map((function(e,t){return{index:t,value:e}}));this.x_bins=this.create_uniform_bins(this.min_x,this.max_x,this.num_bins),this.x_mid=this.x_bins.map((function(e,t){return.5*(e+n.x_bins[t-1])})).slice(1),this.mark_data=i.layout.histogram().bins(this.x_bins).value((function(e){return e.value}))(r),this.mark_data.forEach((function(e,t){e.index=t}))}this.normalize_data(!1),this.set("midpoints",this.x_mid),this.set_typed_field("count",this.count),this.update_domains(),this.save_changes(),this.trigger("data_updated")},normalize_data:function(e){if(this.count=this.mark_data.map((function(e){return e.length})),this.get("normalized")){var t=1;this.mark_data.length>0&&(t=this.mark_data[0].dx);var n=this.count.reduce((function(e,t){return e+t}),0);0!=n&&(this.count=this.count.map((function(e){return e/(n*t)})))}var r=this;this.mark_data.forEach((function(e,t){e.y=r.count[t]})),e&&(this.set_typed_field("count",this.count),this.update_domains(),this.save_changes(),this.trigger("data_updated"))},get_data_dict:function(e,t){var n={};return n.midpoint=this.x_mid[t],n.bin_start=this.x_bins[t],n.bin_end=this.x_bins[t+1],n.index=t,n.count=this.count[t],n},update_domains:function(){if(this.mark_data){var e=this.get("scales").count;this.get("preserve_domain").count||e.set_domain([0,1.05*i.max(this.mark_data,(function(e){return e.y}))],this.model_id+"_count")}},create_uniform_bins:function(e,t,n){for(var r=(t-e)/n,i=[],o=0;o<n;o++)i[o]=e+o*r;return i[n]=t,i}});e.exports={HistModel:s}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"SelectorModel",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,marks:[]})}},{serializers:i.extend({marks:{deserialize:r.unpack_models}},o.BaseModel.serializers)}),l=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"OneDSelectorModel",scale:null})}},{serializers:i.extend({scale:{deserialize:r.unpack_models}},a.serializers)}),c=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"TwoDSelectorModel",x_scale:null,y_scale:null})}},{serializers:i.extend({x_scale:{deserialize:r.unpack_models},y_scale:{deserialize:r.unpack_models}},a.serializers)}),u=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"FastIntervalSelectorModel",_view_name:"FastIntervalSelector",selected:{},color:null,size:null})}}),h=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"IndexSelectorModel",_view_name:"IndexSelector",selected:{},line_width:2,color:null})}}),d=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"BrushIntervalSelectorModel",_view_name:"BrushIntervalSelector",brushing:!1,selected:{},color:null,orientation:"horizontal"})}}),p=c.extend({defaults:function(){return i.extend(c.prototype.defaults(),{_model_name:"BrushSelectorModel",_view_name:"BrushSelector",clear:!1,brushing:!1,selected_x:{},selected_y:{},color:null})}}),f=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"MultiSelectorModel",_view_name:"MultiSelector",names:[],brushing:!1,selected:{},_selected:{},show_names:!0})}}),g=c.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"LassoSelectorModel",_view_name:"LassoSelector",color:null})}});e.exports={SelectorModel:a,OneDSelectorModel:l,TwoDSelectorModel:c,FastIntervalSelectorModel:u,IndexSelectorModel:h,BrushIntervalSelectorModel:d,BrushSelectorModel:p,MultiSelectorModel:f,LassoSelectorModel:g}},function(e,t,n){var r=n(1),i=n(0),o=n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return e.then((function(){t.create_listeners(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.y;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.x;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()}));var t=this.scales.y;this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:opacities",this.update_opacities,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"change:outlier_fill_color",this.update_outlier_fill_color,this),this.listenTo(this.model,"change:box_fill_color",this.update_box_fill_color,this),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:box_width",this.update_box_width,this)},update_stroke:function(){var e=this.model.get("stroke");this.d3el.selectAll(".boxplot").selectAll("path, rect").style("stroke",e),this.d3el.selectAll(".outlier").style("stroke",e),this.legend_el&&(this.legend_el.selectAll("path").attr("stroke",e),this.legend_el.selectAll("text").style("fill",e))},update_outlier_fill_color:function(){this.d3el.selectAll(".outlier").style("fill",this.model.get("outlier_fill_color"))},update_box_fill_color:function(){this.d3el.selectAll(".box").style("fill",this.model.get("box_fill_color"))},update_opacities:function(){var e=this.model.get("opacities");this.d3el.selectAll(".boxplot").style("opacity",(function(t,n){return e[n]})),this.legend_el&&this.legend_el.selectAll("path").attr("opacity",(function(t,n){return e[n]}))},update_marker:function(){var e=this.model.get("marker");if(this.legend_el&&this.rect_dim){var t=[1/4*this.rect_dim,0,this.rect_dim,3/4*this.rect_dim];this.draw_mark_paths(e,this.rect_dim/2,this.legend_el,[t])}this.draw_mark_paths(e,this.calculate_mark_max_width(),this.d3el,this.model.mark_data)},get_box_width:function(){var e=this.model.get("box_width");if(!e){var t=this.parent.plotarea_width,n=t/10;e=t/(this.model.mark_data.length+1)/1.5,e=Math.min(e,n)}return e},compute_view_padding:function(){var e=this.get_box_width()/2+1;e!==this.x_padding&&(this.x_padding=e,this.trigger("mark_padding_updated"))},update_box_width:function(){this.compute_view_padding(),this.draw()},update_idx_selected:function(e,t){this.selected_indices=t,this.apply_styles(t)},apply_styles:function(e){var t=i.range(this.model.mark_data.length);this.set_default_style(t),this.set_style_on_elements(this.selected_style,this.selected_indices);var n=void 0===e?[]:i.difference(t,e);this.set_style_on_elements(this.unselected_style,n)},set_style_on_elements:function(e,t){if(void 0!==t&&0!==t.length){var n=this.d3el.selectAll(".boxplot");(n=n.filter((function(e,n){return-1!=t.indexOf(n)}))).style(e)}},set_default_style:function(e){if(void 0!==e&&0!==e.length){var t=this.model.get("color"),n=this.model.get("stroke"),r=this.model.get("opacities"),i=this.d3el.selectAll(".boxplot").filter((function(t,n){return-1!=e.indexOf(n)}));i.style("fill",(function(e){return e[0]>e[3]?t:"none"})).style("opacity",(function(e,t){return r[t]})),i.selectAll("path, rect").style("stroke",n),i.selectAll(".outliers").style("stroke",n)}},clear_style:function(e,t){var n=this.d3el.selectAll(".boxplot");void 0!==t&&(n=n.filter((function(e,n){return-1!=t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},style_updated:function(e,t){this.set_default_style(t),this.set_style_on_elements(e,t)},selected_style_updated:function(e,t){this.selected_style=t,this.style_updated(t,this.selected_indices)},unselected_style_updated:function(e,t){this.unselected_style=t;var n=this.selected_indices,r=n?i.range(this.model.mark_data.length).filter((function(e){return-1==n.indexOf(e)})):[];this.style_updated(t,r)},update_selected_colors:function(e){var t=this.model.get("stroke"),n=t;this.d3el.selectAll(".boxplot").style("stroke",(function(r,i){return e.indexOf(i)>-1?n:t}))},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),this.update_selected_colors([]),[];var n=this.pixel_coords,r=i.range(n.length),o=i.filter(r,(function(e){return t(n[e])}));this.update_selected_colors(o),this.model.set("selected",o),this.touch()},invert_point:function(e){if(void 0===e)return this.update_selected_colors([]),this.model.set("selected",null),void this.touch();var t=this.x_pixels.map((function(t){return Math.abs(t-e)})),n=t.indexOf(r.min(t));return this.model.set("selected",[n]),this.update_selected_colors([n]),this.touch(),n},prepareBoxPlots:function(){var e=this.scales.x,t=this.scales.y;this.plotData=[];for(var n=0;n<this.model.mark_data.length;++n){var i=this.model.mark_data[n],o={};o.x=e.scale(i[0]),o.boxUpper=t.scale(r.quantile(i[1],.75)),o.boxLower=t.scale(r.quantile(i[1],.25)),o.boxMedian=t.scale(r.quantile(i[1],.5));var s=o.boxLower-o.boxUpper,a=o.boxLower+1.5*s,l=o.boxUpper-1.5*s;o.outliers=[],o.whiskerMax=Number.MAX_VALUE,o.whiskerMin=Number.MIN_VALUE;for(var c=0;c<i[1].length;++c){var u=t.scale(i[1][c]);u>a||u<l?o.outliers.push(u):(u>o.whiskerMin&&(o.whiskerMin=u),u<o.whiskerMax&&(o.whiskerMax=u))}this.plotData.push(o)}},draw:function(){this.set_ranges();var e=this.scales.x;this.prepareBoxPlots();var t=this.plotData;this.draw_mark_paths(".boxplot",this.d3el,t),this.x_pixels=this.model.mark_data.map((function(t){return e.scale(t[0])+e.offset}));var n=this.get_box_width()/2;this.pixel_coords=t.map((function(e){return[[e.x-n,e.x+n],[e.boxLower,e.boxUpper]]}))},draw_mark_paths:function(e,t,n){this.calculate_mark_max_width();var r=this.model.get("color"),i=this.d3el.selectAll(e).data(n),o=this.model.get("box_fill_color"),s=(this.model.get("start_time"),i.enter().append("g").attr("class","boxplot").attr("id",(function(e,t){return"boxplot"+t})));s.append("path").attr("class","whisker_max"),s.append("path").attr("class","whisker_max_end"),s.append("path").attr("class","whisker_min"),s.append("path").attr("class","whisker_min_end"),s.append("rect").attr("class","box"),s.append("path").attr("class","median_line"),s.append("g").attr("class","outliers");var a=0,l=this.scales.x;"ordinal"===l.model.type&&(a=l.scale.rangeBand()/2),t.selectAll(".boxplot").style("stroke",this.model.get("stroke")).style("opacity",r).attr("transform",(function(e,t){return"translate("+(e.x+a)+", 0)"}));var c=this.get_box_width();t.selectAll(".box").style("fill",o).attr("x",-c/2).attr("width",c).attr("y",(function(e,t){return e.boxUpper})).attr("height",(function(e,t){return e.boxLower-e.boxUpper})),t.selectAll(".median_line").style("stroke-width",2).attr("d",(function(e,t){var n=e.boxMedian;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n})),t.selectAll(".whisker_max").attr("d",(function(e,t){return"M0,"+e.whiskerMax+" L0,"+e.boxUpper})).attr("stroke-dasharray",(function(e,t){return"5,5"})),t.selectAll(".whisker_max_end").attr("d",(function(e,t){var n=e.whiskerMax;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n})),t.selectAll(".whisker_min").attr("d",(function(e,t){return"M0,"+e.whiskerMin+" L0,"+e.boxLower})).attr("stroke-dasharray",(function(e,t){return"5,5"})),t.selectAll(".whisker_min_end").attr("d",(function(e,t){var n=e.whiskerMin;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n}));var u=t.selectAll(".outliers").selectAll("circle").data((function(e){return e.outliers}));u.enter().append("circle").attr("class","outlier"),t.selectAll(".outlier").style("fill",this.model.get("outlier_fill_color")).attr("class","outlier").attr("cx",0).attr("r",3).attr("cy",(function(e){return e})),u.exit().remove(),i.exit().remove(),this.apply_styles(this.selected_indices)},calculate_mark_max_width:function(){for(var e=1/0,t=this.scales.x,n=1;n<this.model.mark_data.length;n++){var r=t.scale(this.model.mark_data[n][0])-t.scale(this.model.mark_data[n-1][0]);(r=r<0?-1*r:r)<e&&(e=r)}return e==1/0?(t.scale(this.model.max_x)-t.scale(this.model.min_x))/2:e},relayout:function(){o.__super__.relayout.apply(this),this.set_ranges(),this.compute_view_padding(),this.d3el.select(".intselmouse").attr("width",this.width).attr("height",this.height),this.draw()},draw_legend:function(e,t,n,o,s){var a=this.model.get("stroke");this.model.get("colors");this.rect_dim=.8*s;var l=this;this.legend_el=e.selectAll(".legend"+this.uuid).data([this.model.mark_data]),this.legend_el.enter().append("g").attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).attr("class","legend"+this.uuid).on("mouseover",i.bind(this.highlight_axes,this)).on("mouseout",i.bind(this.unhighlight_axes,this)).selectAll("path").attr("stroke",a).attr("transform","translate("+l.rect_dim/2+",0)"),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*l.rect_dim).attr("y",l.rect_dim/2).attr("dy","0.35em").text((function(e,t){return l.model.get("labels")[t]})).style("fill",a);var c=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,c]}});e.exports={Boxplot:o}},function(e,t,n){var r=n(1),i=n(0),o=n(52).BaseXSelector.extend({render:function(){o.__super__.render.apply(this),this.active=!1,this.dirty=!1;var e=this,t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.line=e.d3el.append("line").attr("class","selector indsel").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke-width",e.model.get("line_width")).attr("pointer-events","none").attr("visibility","hidden"),e.color_change(),e.background=e.d3el.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("class","selector selectormouse").attr("pointer-events","all").attr("visibility","hidden"),e.background.on("mousemove",i.bind(e.mousemove,e)).on("click",i.bind(e.initial_click,e)),e.create_listeners(),e.selected_changed()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this)},color_change:function(){null!==this.model.get("color")&&this.line.style("stroke",this.model.get("color"))},initial_click:function(){this.line.attr("visibility","visible"),this.click(),this.background.on("click",i.bind(this.click,this))},click:function(){this.active=!this.active},mousemove:function(){if(this.active){this.dirty=!0;var e=r.mouse(this.background.node())[0];this.line.attr({x1:e,x2:e}),this.model.set_typed_field("selected",[this.invert_pixel(e)]),i.each(this.mark_views,(function(t){t.invert_point(e)})),this.touch(),this.dirty=!1}},invert_pixel:function(e){return this.scale.invert(e)},reset:function(){this.active=!1,void 0!==this.line&&null!==this.line&&this.line.attr({x1:0,x2:0,visibility:"hidden"}),void 0!==this.background&&null!==this.background&&this.background.on("click",i.bind(this.initial_click,this)),this.model.set_typed_field("selected",{}),i.each(this.mark_views,(function(e){e.invert_point()})),this.touch()},update_scale_domain:function(e){o.__super__.update_scale_domain.apply(this),!0!==e&&this.selected_changed()},selected_changed:function(e,t){if(!this.dirty){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(1!=n.length)return;var r=this.scale.scale(n[0]);void 0!==this.line&&null!==this.line&&this.line.attr({x1:r,x2:r,visibility:"visible"}),this.background.on("click",i.bind(this.click,this)),i.each(this.mark_views,(function(e){e.invert_point(r)}))}}},relayout:function(){o.__super__.relayout.apply(this),this.line.attr("y1",0).attr("y2",this.height),this.background.attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},scale_changed:function(){this.reset(),this.scale=this.parent.x_scale},set_range:function(e){for(var t=0;t<e.length;t++)e[t].set_range([0,this.width])}});e.exports={IndexSelector:o}},function(e,t,n){n(1);var r=n(193),i=n(102),o=r.OrdinalScale.extend({render:function(){o.__super__.render.apply(this),this.listenTo(this.model,"domain_changed",this.model_domain_changed,this),this.listenTo(this.model,"set_ticks",this.model_ticks_changed,this),this.model.on_some_change(["colors","scheme"],this.colors_changed,this),this.set_range()},set_range:function(){this.model.get("colors").length>0?this.scale.range(i.cycle_colors(this.model.get("colors"),this.scale.domain().length)):this.scale.range(i.get_ordinal_scale_range(this.model.get("scheme"),this.scale.domain().length)),this.trigger("color_scale_range_changed")},model_domain_changed:function(){o.__super__.model_domain_changed.apply(this),this.set_range()},colors_changed:function(){this.set_range()}});e.exports={OrdinalColorScale:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"BoxplotModel",_view_name:"Boxplot",x:[],y:[],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}},stroke:null,box_fill_color:"dodgerblue",outlier_fill_color:"gray",opacities:[],box_width:null})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y");t.forEach((function(e){e.sort((function(e,t){return e-t}))})),e.length>t.length?e=e.slice(0,t.length):e.length<t.length&&(t=t.slice(0,e.length)),this.mark_data=i.zip(e,t),this.update_domains(),this.trigger("data_updated")},update_domains:function(){var e=this.get("scales"),t=e.x,n=e.y;e.size,e.opacity;if(!this.get("preserve_domain").x&&this.mark_data?t.compute_and_set_domain(this.mark_data.map((function(e){return e[0]})),this.model_id+"_x"):t.del_domain([],this.model_id+"_x"),!this.get("preserve_domain").y&&this.mark_data){var i=r.min(this.mark_data.map((function(e){return e[1][0]}))),o=r.max(this.mark_data.map((function(e){var t=e[1];return t[t.length-1]})));n.set_domain([i,o],this.model_id+"_y")}else n.del_domain([],this.model_id+"_y")}});e.exports={BoxplotModel:s}},function(e,t,n){var r=n(1),i=n(195).ScatterBase.extend({create_listeners:function(){i.__super__.create_listeners.apply(this),this.model.on_some_change(["font_weight","font_size","colors","align","font_unit"],this.update_style,this),this.model.on_some_change(["x","y","x_offset","y_offset","rotate_angle"],this.update_position,this)},update_default_opacities:function(e){if(!this.model.dirty){this.model.get("default_opacities").length;var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_opacities").duration(t).style("opacity",(function(e,t){return n.get_element_opacity(e,t)}))}},update_default_size:function(e){if(this.compute_view_padding(),!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_size").duration(t).style("font-size",(function(e,t){return n.get_element_size(e)}))}},create_listeners:function(){i.__super__.create_listeners.apply(this),this.model.on_some_change(["font_weight","default_size","colors","align","font_unit"],this.update_style,this),this.model.on_some_change(["x","y","x_offset","y_offset","rotate_angle"],this.update_position,this)},relayout:function(){this.set_ranges(),this.update_position()},draw_elements:function(e,t){t.append("text").classed("label element",!0),this.update_text(),this.update_style(),this.update_default_opacities(!0)},update_text:function(){this.d3el.selectAll(".object_grp").select(".label").text((function(e){return e.text}))},get_element_size:function(e){var t=this.scales.size,n=this.model.get("font_unit");return t&&void 0!==e.size?t.scale(e.size)+n:this.model.get("default_size")+n},get_element_rotation:function(e){var t=this.scales.rotation;return t&&e.rotation?"rotate("+t.scale(e.rotation)+")":"rotate("+this.model.get("rotate_angle")+")"},update_position:function(){var e=this,t=this.x_scale,n=this.y_scale,r=("date"===t.model.type?this.model.get_date_elem("x"):this.model.get("x"),"date"===n.model.type?this.model.get_date_elem("y"):this.model.get("y"),this.model.get("x_offset")),i=this.model.get("y_offset");this.d3el.selectAll(".object_grp").attr("transform",(function(o){return"translate("+(t.scale(o.x)+t.offset+r)+","+(n.scale(o.y)+n.offset+i)+")"+e.get_element_rotation(o)}))},update_style:function(){var e=this;this.d3el.selectAll(".object_grp").select("text").attr("dominant-baseline","central").style("font-size",(function(t,n){return e.get_element_size(t)})).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")),this.d3el.selectAll(".label").style("fill",(function(t,n){return e.get_element_color(t,n)}))},color_scale_updated:function(e){var t=this,n=!0===e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").transition("color_scale_updated").duration(n).style("fill",(function(e,n){return t.get_element_color(e,n)}))},set_default_style:function(e){if(e&&0!==e.length){var t=this.d3el.selectAll(".element").filter((function(t,n){return-1!==e.indexOf(n)})),n=this;t.style("font-size",(function(e,t){return n.get_element_size(e)})).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")).style("fill",(function(e,t){return n.get_element_color(e,t)}))}},set_drag_style:function(e,t,n){var i=this.model.get("drag_size")*this.model.get("default_size")+this.model.get("font_unit");r.select(n).select("text").classed("drag_label",!0).transition("set_drag_style").style("font-size",i)},reset_drag_style:function(e,t,n){r.select(n).select("text").classed("drag_label",!1).transition("reset_drag_style").style("font-size",this.get_element_size(e))}});e.exports={Label:i}},function(e,t,n){n(1);var r=n(0),i=n(196),o=i.ScatterBaseModel.extend({defaults:function(){return r.extend(i.ScatterBaseModel.prototype.defaults(),{_model_name:"LabelModel",_view_name:"Label",x_offset:0,y_offset:0,rotate_angle:0,text:[],font_size:16,font_unit:"px",drag_size:1,font_weight:"bold",align:"start"})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on("change:text",this.update_data,this)},update_mark_data:function(){o.__super__.update_mark_data.apply(this);var e=this.get_typed_field("text");this.mark_data.forEach((function(t,n){t.text=e[n]}))},update_unique_ids:function(){this.mark_data.forEach((function(e,t){e.unique_id="Label"+t}))}});e.exports={LabelModel:o}},function(e,t,n){var r=n(0),i=(n(1),n(70)),o=i.ScaleModel.extend({defaults:function(){return r.extend(i.ScaleModel.prototype.defaults(),{_model_name:"OrdinalScaleModel",_view_name:"OrdinalScale",min:null,max:null})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="ordinal",this.min_from_data=!0,this.max_from_data=!0},set_listeners:function(){this.on("change:domain",this.domain_changed,this),this.domain_changed(),this.on("change:reverse",this.reverse_changed,this),this.reverse_changed()},domain_changed:function(){this.ord_domain=this.get("domain"),null!==this.ord_domain&&0!==this.ord_domain.length?(this.max_from_data=!1,this.min_from_data=!1,this.domain=this.ord_domain.map((function(e){return e})),this.trigger("domain_changed")):(this.max_from_data=!0,this.min_from_data=!0,this.domain=[],this.update_domain())},reverse_changed:function(e,t,n){var r=void 0!==e&&e.previous("reverse");this.reverse=this.get("reverse");var i=(r+this.reverse)%2;this.domain.length>0&&1===i&&(this.domain.reverse(),this.trigger("domain_changed",this.domain))},update_domain:function(){var e=[];for(var t in this.domains)e=r.union(e,this.domains[t]);this.domain.length===e.length&&r.intersection(this.domain,e).length===e.length||(this.domain=e,this.trigger("domain_changed",e))},compute_and_set_domain:function(e,t){if(this.min_from_data||this.max_from_data)if(0!==e.length){var n=r.flatten(e);this.get("reverse")&&n.reverse(),this.set_domain(n,t)}else this.set_domain([],t)}});e.exports={OrdinalScaleModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(52),s=n(13),a=n(103),l={brush_render:function(){var e=this,t=this.create_scales();this.brushing=!1,Promise.all([this.mark_views_promise,t]).then((function(){e.brush=r.svg.brush().on("brushstart",i.bind(e.brush_start,e)).on("brush",i.bind(e.brush_move,e)).on("brushend",i.bind(e.brush_end,e)),e.set_brush_scale(),e.d3el.attr("class","selector brushintsel"),e.brushsel=e.d3el.call(e.brush),e.adjust_rectangle(),e.color_change(),e.create_listeners(),e.selected_changed()}))},color_change:function(){null!==this.model.get("color")&&this.brushsel.style("fill",this.model.get("color"))},brush_start:function(){this.model.set("brushing",!0),this.touch(),this.brushing=!0},brush_move:function(){var e=this.brush.empty()?[]:this.brush.extent();this.convert_and_save(e)},brush_end:function(){var e=this.brush.empty()?[]:this.brush.extent();this.model.set("brushing",!1),this.convert_and_save(e),this.brushing=!1},scale_changed:function(){this.brush.clear(),this.create_scales(),this.set_brush_scale()},adjust_rectangle:function(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)},_update_brush:function(){this.brushsel=this.d3el.call(this.brush),this.d3el.call(this.brush.event)},update_mark_selected:function(e,t){if(void 0!==e&&0!==e.length){if(void 0===t)var n=this.model.get("orientation"),r="vertical"==n?[]:e,o="vertical"==n?e:[];else r=e,o=t;var s=function(e){return a.point_in_rectangle(e,r,o)},l=function(e){return a.rect_inter_rect(e[0],e[1],r,o)};i.each(this.mark_views,(function(e){e.selector_changed(s,l)}),this)}else i.each(this.mark_views,(function(e){return e.selector_changed()}))}},c=o.BaseXYSelector.extend(l).extend({render:function(){c.__super__.render.apply(this),this.brush_render()},create_listeners:function(){c.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this),this.listenTo(this.model,"change:selected_x",this.selected_changed),this.listenTo(this.model,"change:selected_y",this.selected_changed)},reset:function(){this.brush.clear(),this._update_brush(),this.model.set("selected_x",{}),this.model.set("selected_y",{}),this.update_mark_selected(),this.touch()},convert_and_save:function(e){if(0!==e.length){var t=[e[0][0],e[1][0]],n=[e[0][1],e[1][1]],r="ordinal"===this.x_scale.model.type,i="ordinal"===this.y_scale.model.type,o=r?t:t.map(this.x_scale.scale),s=i?n:n.map(this.y_scale.scale);t=r?this.x_scale.invert_range(t):t,n=i?this.y_scale.invert_range(n):n,this.update_mark_selected(o,s),this.model.set_typed_field("selected_x",t),this.model.set_typed_field("selected_y",n),this.touch()}else this.update_mark_selected([])},selected_changed:function(e,t){if(!this.brushing){var n=this.model.get_typed_field("selected_x"),r=this.model.get_typed_field("selected_y");if(0===n.length||0===r.length)this.reset();else{if(2!=n.length||2!=r.length)return;var i=[[n[0],r[0]],[n[1],r[1]]];this.brush.extent(i),this._update_brush();var o=n.map(this.x_scale.scale).sort((function(e,t){return e-t})),s=r.map(this.y_scale.scale).sort((function(e,t){return e-t}));this.update_mark_selected(o,s)}}},relayout:function(){c.__super__.relayout.apply(this),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_x_range([this.x_scale]),this.set_y_range([this.y_scale])},adjust_rectangle:function(){},set_brush_scale:function(){this.brush.y(this.y_scale.scale).x(this.x_scale.scale)},update_xscale_domain:function(){c.__super__.update_xscale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.brush.x(this.x_scale.scale)},update_yscale_domain:function(){c.__super__.update_yscale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.brush.y(this.y_scale.scale)}}),u=o.BaseXSelector.extend(l).extend({render:function(){u.__super__.render.apply(this),this.brush_render()},create_listeners:function(){u.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.change_color,this)},reset:function(){this.brush.clear(),this._update_brush(),this.model.set("selected",{}),this.update_mark_selected(),this.touch()},convert_and_save:function(e){if(0!==e.length){var t="ordinal"===this.scale.model.type,n=t?e:e.map(this.scale.scale);e=t?this.scale.invert_range(e):e,this.update_mark_selected(n),this.model.set_typed_field("selected",e),this.touch()}else this.update_mark_selected([])},update_scale_domain:function(e){u.__super__.update_scale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.set_brush_scale(),!0!==e&&this.selected_changed()},set_brush_scale:function(){"vertical"==this.model.get("orientation")?this.brush.y(this.scale.scale):this.brush.x(this.scale.scale)},selected_changed:function(e,t){if(!this.brushing){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(2!=n.length)return;var r=[n[0],n[1]];this.brush.extent(r),this._update_brush();var i=r.map(this.scale.scale).sort((function(e,t){return e-t}));this.update_mark_selected(i)}}},remove:function(){this.brush.clear(),u.__super__.remove.apply(this)},relayout:function(){u.__super__.relayout.apply(this),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale])}}),h=function(e,t,n){n&&n.forEach((function(t){e.classed(t,!1)})),t&&t.forEach((function(t){e.classed(t,!0)}))},d=o.BaseXSelector.extend(l).extend({render:function(){d.__super__.render.apply(this);var e=this;this.names=this.model.get("names"),this.curr_index=0;var t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.d3el.attr("class","multiselector"),e.create_brush(),e.selecting_brush=!1,e.create_listeners()}))},create_listeners:function(){d.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:names",this.labels_change,this),this.listenTo(this.model,"change:color",this.color_change,this)},labels_change:function(e,t){var n=e.previous("names");this.names=t;var r=i.range(this.curr_index+1),o=this,a=s.deepCopy(this.model.get("selected"));r.forEach((function(e){var t=o.get_label(e),r=o.get_label(e,n);r!==t&&(o.d3el.select(".brush_text_"+e).text(t),a[t]=a[r],delete a[r])})),this.model.set_typed_field("_selected",a),this.touch()},create_brush:function(e){var t=this,n=this.curr_index,i=r.svg.brush().on("brushstart",(function(){t.brush_start()})).on("brush",(function(){t.brush_move(n,this)})).on("brushend",(function(){t.brush_end(n,this)})),o=this.d3el.append("g").attr("class","selector brushintsel active");o.append("text").text(this.get_label(this.curr_index)).attr("class","brush_text_"+this.curr_index).style("text-anchor","middle").style("stroke","yellow").style("font-size","16px").style("display","none"),"vertical"==this.model.get("orientation")?(i.y(this.scale.scale),o.select("text").attr("x",30)):(i.x(this.scale.scale),o.select("text").attr("y",30)),o.call(i),this.color_change(),this.adjust_rectangle();var s=o.on("mousedown.brush");o.on("mousedown.brush",(function(){h(t.d3el.selectAll(".selector"),["inactive"],["visible"]),h(r.select(this),["active"],["inactive"]),s.call(this),r.select(this).on("mousedown.brush",(function(){var e=r.event.ctrlKey||r.event.metaKey;r.event.shiftKey&&e&&r.event.altKey?t.reset():e?(h(r.select(this),["inactive"],["active"]),t.create_brush(r.event)):r.event.shiftKey&&!1===t.selecting_brush?(h(t.d3el.selectAll(".selector"),["visible"],["active","inactive"]),t.selecting_brush=!0):(h(t.d3el.selectAll(".selector"),["inactive"],["visible"]),h(r.select(this),["active"],["inactive"]),s.call(this),t.selecting_brush=!1)}))})),this.curr_index=this.curr_index+1},get_label:function(e,t){return null==t&&(t=this.names),t.length>e?t[e]:e},brush_start:function(){this.model.set("brushing",!0),this.touch()},brush_move:function(e,t){var n=r.event.target,i=n.empty()?this.scale.scale.domain():n.extent(),o=!this.model.get("show_names");r.select(t).select("text").style("display",n.empty()||o?"none":"inline"),this.set_text_location(t,i),this.convert_and_save(i,e)},set_text_location:function(e,t){var n=(t[0]+t[1])/2;"date"===this.scale.model.type&&(n=new Date((t[0].getTime()+t[1].getTime())/2));var i="vertical"==this.model.get("orientation")?"y":"x";r.select(e).select("text").attr(i,this.scale.scale(n))},brush_end:function(e,t){var n=r.event.target,i=n.empty()?this.scale.scale.domain():n.extent();this.model.set("brushing",!1),this.convert_and_save(i,e)},reset:function(){this.d3el.selectAll(".selector").remove(),this.model.set("_selected",{}),this.curr_index=0,this.touch(),this.create_brush()},convert_and_save:function(e,t){var n=s.deepCopy(this.model.get("_selected"));n[this.get_label(t)]=e;var r=e.map(this.scale.scale);this.update_mark_selected(r),this.model.set("_selected",n),this.touch()},scale_changed:function(){this.d3el.selectAll(".selector").remove(),this.curr_index=0,this.create_scale(),this.create_brush()},color_change:function(){null!==this.model.get("color")&&this.d3el.selectAll(".selector").style("fill",this.model.get("color"))},relayout:function(){d.__super__.relayout.apply(this),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},remove:function(){this.model.off("change:names",null,this),d.__super__.remove.apply(this)}});e.exports={BrushSelector:c,BrushIntervalSelector:u,MultiSelector:d}},function(e,t,n){var r=n(1),i=n(0),o=(n(13),n(52)),s=n(103),a=o.BaseXYSelector.extend({render:function(){a.__super__.render.apply(this);var e=this.create_scales();this.line=r.svg.line(),this.all_vertices={},this.lasso_counter=0;var t=this;Promise.all([this.mark_views_promise,e]).then((function(){var e=r.behavior.drag().on("dragstart",i.bind(t.drag_start,t)).on("drag",i.bind(t.drag_move,t)).on("dragend",i.bind(t.drag_end,t));r.select(window).on("keydown",i.bind(t.keydown,t)),t.d3el.attr("class","lassoselector"),t.background=t.d3el.append("rect").attr("x",0).attr("y",0).attr("width",t.width).attr("height",t.height).attr("visibility","hidden").attr("pointer-events","all").style("cursor","crosshair").call(e),t.create_listeners()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.change_color,this)},change_color:function(e,t){t&&this.d3el.selectAll("path").style("stroke",t)},create_new_lasso:function(){var e=this.d3el.append("path").attr("id","l"+ ++this.lasso_counter).on("click",(function(){var e=r.select(this);e.classed("selected",!e.classed("selected"))})),t=this.model.get("color");t&&e.style("stroke",t)},drag_start:function(){this.current_vertices=[],this.create_new_lasso()},drag_move:function(){this.current_vertices.push(r.mouse(this.background.node())),this.d3el.select("#l"+this.lasso_counter).attr("d",this.line(this.current_vertices))},drag_end:function(){var e="l"+this.lasso_counter;this.d3el.select("#"+e).attr("d",this.line(this.current_vertices)+"Z"),this.all_vertices[e]=this.current_vertices,this.update_mark_selected(this.all_vertices)},update_mark_selected:function(e){void 0!==e&&0!==e.length||i.each(this.mark_views,(function(e){return e.selector_changed()}));var t=function(t){for(var n in e)if(s.point_in_lasso(t,e[n]))return!0;return!1},n=function(t){for(var n in e)if(s.lasso_inter_rect(t[0],t[1],e[n]))return!0;return!1};i.each(this.mark_views,(function(e){e.selector_changed(t,n)}),this)},relayout:function(){a.__super__.relayout.apply(this),this.background.attr("width",this.width).attr("height",this.height)},keydown:function(){if(46===r.event.keyCode){var e=this.d3el.selectAll(".selected"),t=this.all_vertices;e.each((function(){var e=r.select(this).attr("id");delete t[e]})),e.remove(),this.update_mark_selected(this.all_vertices)}},reset:function(){this.lasso_counter=0,this.all_vertices={},this.d3el.selectAll("path").remove(),this.update_mark_selected()}});e.exports={LassoSelector:a}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(68).Interaction.extend({render:function(){s.__super__.render.apply(this);var e=this;this.d3el.style({cursor:"move"}).on("mousedown",(function(){e.mousedown()})).on("mousemove",(function(){e.mousemove()})).on("mouseup",(function(){e.mouseup()})).on("mousewheel",(function(){e.mousewheel()})).on("DOMMouseScroll.zoom",(function(){e.mousewheel()})).on("mousewheel.zoom",null).on("wheel.zoom",null),this.active=!1,this.update_scales(),this.listenTo(this.model,"change:scales",this.update_scales,this),this.set_ranges(),this.listenTo(this.parent,"margin_updated",this.set_ranges,this)},update_scales:function(){var e=this.model.get("scales"),t=this;this.scale_promises=r.resolvePromisesDict({x:Promise.all((e.x||[]).map((function(e){return t.create_child_view(e)}))),y:Promise.all((e.y||[]).map((function(e){return t.create_child_view(e)})))}),r.resolvePromisesDict(this.scale_promises).then(i.bind(this.set_ranges,this))},set_ranges:function(){var e,t=this;this.scale_promises.then((function(n){var r=n.x;for(e=0;e<r.length;e++)r[e].set_range(t.parent.padded_range("x",r[e].model));var i=n.y;for(e=0;e<i.length;e++)i[e].set_range(t.parent.padded_range("y",i[e].model))}))},mousedown:function(){var e=this.model.get("scales");this.active=!0,this.d3el.style({cursor:"move"}),this.previous_pos=o.mouse(this.el),this.domains={x:(e.x||[]).map((function(e){return e.domain.slice(0)})),y:(e.y||[]).map((function(e){return e.domain.slice(0)}))}},mouseup:function(){this.active=!1},mousemove:function(){if(this.active&&this.model.get("allow_pan")){var e=o.mouse(this.el);"previous_pos"in this||(this.previous_pos=e);var t=this.model.get("scales"),n=this;this.scale_promises.then((function(r){var i,o,s,a,l=r.x,c=n.domains.x,u=l.map((function(t){if(t.scale.invert)return t.scale.invert(e[0])-t.scale.invert(n.previous_pos[0])}));for(i=0;i<l.length;i++)s=(o=c[i])[0]-u[i],a=o[1]-u[i],n.set_scale_attribute(t.x[i],"min",s),n.set_scale_attribute(t.x[i],"max",a),l[i].touch();var h=r.y,d=n.domains.y,p=h.map((function(t){if(t.scale.invert)return t.scale.invert(e[1])-t.scale.invert(n.previous_pos[1])}));for(i=0;i<h.length;i++)s=(o=d[i])[0]-p[i],a=o[1]-p[i],n.set_scale_attribute(t.y[i],"min",s),n.set_scale_attribute(t.y[i],"max",a),h[i].touch()}))}},mousewheel:function(){if(this.model.get("allow_zoom")){o.event.preventDefault();var e=o.event.wheelDelta||-40*o.event.detail,t=o.mouse(this.el);if(e){e>0?this.d3el.style({cursor:"zoom-in"}):this.d3el.style({cursor:"zoom-out"});var n=this.model.get("scales"),r=this;this.scale_promises.then((function(i){var o,s,a,l,c=i.x,u=c.map((function(e){return e.scale.invert(t[0])})),h=Math.exp(.001*-e);for(o=0;o<c.length;o++)a=(s=n.x[o].domain)[0],l=s[1],r.set_scale_attribute(n.x[o],"min",(1-h)*u[o]+h*a),r.set_scale_attribute(n.x[o],"max",(1-h)*u[o]+h*l),c[o].touch();var d=i.y,p=d.map((function(e){return e.scale.invert(t[1])}));for(o=0;o<d.length;o++)a=(s=n.y[o].domain)[0],l=s[1],r.set_scale_attribute(n.y[o],"min",(1-h)*p[o]+h*a),r.set_scale_attribute(n.y[o],"max",(1-h)*p[o]+h*l),d[o].touch()}))}}},set_scale_attribute:function(e,t,n){"date"==e.type?(n=n instanceof Date?n:new Date(n),e.set_date_elem(t,n)):e.set(t,n)}});e.exports={PanZoom:s}},function(e,t,n){var r=n(1),i=(n(0),n(13),n(192).Axis.extend({render:function(){this.parent=this.options.parent,this.margin=this.parent.margin,this.vertical="vertical"===this.model.get("orientation"),this.height=this.parent.height-(this.margin.top+this.margin.bottom),this.width=this.parent.width-(this.margin.left+this.margin.right);var e=this.set_scale(this.model.get("scale"));this.side=this.model.get("side"),this.x_offset=100,this.y_offset=40,this.bar_height=20,this.d3el.attr("class","ColorBar").attr("display",this.model.get("visible")?"inline":"none").attr("transform",this.get_topg_transform()),this.ordinal=!1,this.num_ticks=this.model.get("num_ticks");var t=this;e.then((function(){t.create_listeners(),t.tick_format=t.generate_tick_formatter(),t.set_scales_range(),t.append_axis()}))},create_listeners:function(){this.listenTo(this.model,"change:scale",(function(e,t){this.update_scale(e.previous("scale"),t),this.axis.scale(this.axis_scale.scale),this.rescale_axis()}),this),this.listenTo(this.model,"change:tick_format",this.tickformat_changed,this),this.axis_scale.on("domain_changed",this.redraw_axisline,this),this.axis_scale.on("color_scale_range_changed",this.redraw_axis,this),this.axis_scale.on("highlight_axis",this.highlight,this),this.axis_scale.on("unhighlight_axis",this.unhighlight,this),this.parent.on("margin_updated",this.parent_margin_updated,this),this.listenTo(this.model,"change:visible",this.update_visibility,this),this.listenTo(this.model,"change:label",this.update_label,this),this.model.on_some_change(["side","orientation"],this.update_display,this)},update_display:function(){this.side=this.model.get("side"),this.vertical="vertical"===this.model.get("orientation"),this.rescale_axis(),this.d3el.select("#colorBarG"+this.cid).attr("transform",this.get_colorbar_transform()),this.d3el.select("#colorBarG"+this.cid).select(".g-rect").attr("transform",this.vertical?"rotate(-90)":""),this.redraw_axisline()},set_scale:function(e){var t=this;return this.axis_scale&&this.axis_scale.remove(),this.create_child_view(e).then((function(e){t.displayed.then((function(){e.trigger("displayed")})),t.axis_scale=e,"date_color_linear"===t.axis_scale.model.type?t.axis_line_scale=r.time.scale().nice():"ordinal"===t.axis_scale.model.type?(t.axis_line_scale=r.scale.ordinal(),t.ordinal=!0):t.axis_line_scale=r.scale.linear()}))},append_axis:function(){void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.append("g").attr("transform",this.get_label_transform()).attr("class","axis label_g").append("text").append("tspan").attr("id","text_elem").attr("dy","0.5ex").text(this.model.get("label")).attr("class","axislabel").style("text-anchor",this.vertical?"middle":"end");var e=this.d3el.append("g").attr("id","colorBarG"+this.cid);this.draw_color_bar(),this.set_axisline_domain(),this.g_axisline=e.append("g").attr("class","axis"),this.axis=r.svg.axis().tickFormat(this.tick_format),this.redraw_axisline()},draw_color_bar:function(){var e=this.d3el.select("#colorBarG"+this.cid);e.attr("transform",this.get_colorbar_transform());var t=this;e.selectAll(".g-rect").remove(),e.selectAll(".g-defs").remove(),this.colors=this.axis_scale.scale.range();var n=100/(this.colors.length-1);if(this.ordinal){var r=this.get_color_bar_width()/this.colors.length,i=e.append("g").attr("class","g-rect axis").selectAll("rect").data(this.colors);i.enter().append("rect").attr("y",0).attr("height",this.bar_height).attr("width",r).style("fill",(function(e){return e})),this.vertical?i.attr("x",(function(e,n){return n*r-(t.height-2*t.x_offset)})):i.attr("x",(function(e,t){return t*r}))}else e.append("g").attr("class","g-defs").append("defs").append("linearGradient").attr({id:"colorBarGradient"+this.cid,x1:"0%",y1:"0%",x2:"100%",y2:"0%"}).selectAll("stop").data(this.colors).enter().append("stop").attr({offset:function(e,t){return n*t+"%"},"stop-color":function(e,n){return t.colors[n]},"stop-opacity":1}),e.append("g").attr("class","g-rect axis").append("rect").attr({width:this.get_color_bar_width(),height:this.bar_height,x:this.vertical?-(this.height-2*this.x_offset):0,y:0,"stroke-width":1}).style("fill","url(#colorBarGradient"+this.cid+")");this.vertical&&e.select(".g-rect").attr("transform","rotate(-90)")},get_topg_transform:function(){return this.vertical?"right"===this.side?"translate("+String(this.get_basic_transform()+this.margin.right/2-this.bar_height)+", 0)":"translate("+String(this.get_basic_transform()-this.margin.left/2+this.bar_height)+", 0)":"top"===this.side?"translate(0, "+String(this.get_basic_transform()-this.margin.top+this.bar_height+24)+")":"translate(0, "+String(this.get_basic_transform()+this.margin.bottom-this.bar_height-24)+")"},get_label_transform:function(){return this.vertical?"translate("+("right"===this.side?this.bar_height/2:-this.bar_height/2)+", "+(this.x_offset-15)+")":"translate("+(this.x_offset-5)+", "+this.bar_height/2+")"},get_colorbar_transform:function(){return this.vertical?"translate(0, "+String(this.x_offset)+")":"translate("+String(this.x_offset)+", 0)"},set_axisline_scale_range:function(){var e=this.vertical?[this.height-2*this.x_offset,0]:[0,this.width-2*this.x_offset];if(this.ordinal)this.axis_line_scale.rangeRoundBands(e,.05);else{var t=this.axis_scale.model.mid;null==t?this.axis_line_scale.range(e):this.axis_line_scale.range([e[0],.5*(e[0]+e[1]),e[1]])}},set_scales_range:function(){this.axis_scale.set_range(),this.set_axisline_scale_range()},get_color_bar_width:function(){return this.vertical?this.height-2*this.x_offset:this.width-2*this.x_offset},update_label:function(e,t){this.d3el.select("#text_elem").text(this.model.get("label"))},rescale_axis:function(){this.set_axisline_scale_range(),this.d3el.attr("transform",this.get_topg_transform());var e=this,t=this.get_color_bar_width()/this.colors.length;if(this.ordinal){var n=this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",t);this.vertical?n.attr("x",(function(n,r){return r*t-(e.height-2*e.x_offset)})):n.attr("x",(function(e,n){return n*t}))}else this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",this.get_color_bar_width()).attr("x",this.vertical?-(this.height-2*this.x_offset):0);void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.select(".label_g").attr("transform",this.get_label_transform()).select("#text_elem").style("text-anchor",this.vertical?"middle":"end"),this.g_axisline.call(this.axis)},redraw_axisline:function(){var e;this.axis&&(this.set_axisline_domain(),this.set_axisline_scale_range(),this.axis.orient(this.side).scale(this.axis_line_scale),this.set_tick_values(),e=this.vertical?"translate("+("right"===this.side?this.bar_height:0)+", 0)":"translate(0, "+("top"===this.side?0:this.bar_height)+")",this.g_axisline.attr("transform",e).call(this.axis))},set_axisline_domain:function(){var e=this.axis_scale.scale.domain(),t=this.axis_scale.model.mid;null==t?this.axis_line_scale.domain([e[0],e[e.length-1]]):this.axis_line_scale.domain([e[0],t,e[e.length-1]])},redraw_axis:function(){this.draw_color_bar(),this.redraw_axisline()}}));e.exports={ColorAxis:i}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"PanZoomModel",_view_name:"PanZoom",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,scales:{},allow_pan:!0,allow_zoom:!0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("change:scales",this.snapshot_scales,this),this.snapshot_scales()},reset_scales:function(){var e=this;r.resolvePromisesDict(this.get("scales")).then((function(t){i.each(Object.keys(t),(function(n){i.each(t[n],(function(t,r){t.set_state(e.scales_states[n][r])}),e)}),e)}))},snapshot_scales:function(){var e=this;r.resolvePromisesDict(this.get("scales")).then((function(t){e.scales_states=Object.keys(t).reduce((function(e,n){return e[n]=t[n].map((function(e){return e.get_state()})),e}),{})}))}},{serializers:i.extend({scales:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={PanZoomModel:a}},function(e,t,n){var r=n(1),i=n(19),o=n(13),s=n(0),a=i.Mark.extend({render:function(){var e=a.__super__.render.apply(this);this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["slice","text"];var t=this;this.pie_g=this.d3el.append("g").attr("class","pie"),this.pie_g.append("g").attr("class","slices"),this.pie_g.append("g").attr("class","labels"),this.pie_g.append("g").attr("class","lines");var n=this.model.get("radius"),i=this.model.get("inner_radius");return"outside"===this.model.get("display_labels")?(this.arc=r.svg.arc().outerRadius(.8*n).innerRadius(.8*i),this.outer_arc=r.svg.arc().innerRadius(.9*n).outerRadius(.9*n)):this.arc=r.svg.arc().outerRadius(n).innerRadius(i),this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.join_key=function(e){return e.data.label},e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&(e.set_range(this.parent.padded_range("x",e.model)),this.x_offset=e.offset);var t=this.scales.y;t&&(t.set_range(this.parent.padded_range("y",t.model)),this.y_offset=t.offset)},set_positional_scales:function(){var e=this.scales.x?this.scales.x:this.parent.scale_x,t=this.scales.y?this.scales.y:this.parent.scale_y,n=this;this.listenTo(e,"domain_changed",(function(){n.model.dirty||n.draw()})),this.listenTo(t,"domain_changed",(function(){n.model.dirty||n.draw()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.d3el.on("mouseover",s.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",s.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",s.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"colors_updated",this.update_colors,this),this.model.on_some_change(["inner_radius","radius"],(function(){this.compute_view_padding();this.update_radii(!0)}),this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.model.on_some_change(["x","y"],this.position_center,this),this.model.on_some_change(["display_labels","label_color","font_size","font_weight"],this.update_labels,this),this.model.on_some_change(["start_angle","end_angle","sort"],(function(){this.draw(!0)}),this),this.model.on_some_change(["display_values","values_format"],this.update_values,this),this.listenTo(this.model,"labels_updated",this.update_values,this),this.listenTo(this.model,"change:selected",(function(){this.selected_indices=this.model.get("selected"),this.apply_styles()}),this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");s.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=s.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=s.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},relayout:function(){this.set_ranges(),this.position_center(),this.update_radii()},position_center:function(e){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this.scales.x?this.scales.x:this.parent.scale_x,r=this.scales.y?this.scales.y:this.parent.scale_y,i="date"===n.model.type?this.model.get_date_elem("x"):this.model.get("x"),o="date"===r.model.type?this.model.get_date_elem("y"):this.model.get("y"),s="translate("+(n.scale(i)+n.offset)+", "+(r.scale(o)+r.offset)+")";this.pie_g.transition("position_center").duration(t).attr("transform",s)},update_radii:function(e){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this.model.get("radius"),r=this.model.get("inner_radius"),i=this.model.get("display_labels");"inside"===i?this.arc.outerRadius(n).innerRadius(r):"outside"===i&&(this.arc.outerRadius(.8*n).innerRadius(.8*r),this.outer_arc.innerRadius(.9*n).outerRadius(.9*n));var o=this.pie_g.select(".slices"),s=this.pie_g.select(".labels"),a=this.pie_g.select(".lines"),l=this;o.selectAll("path.slice").transition("update_radii").duration(t).attr("d",this.arc),"inside"===i?s.selectAll("text").transition("update_radii").duration(t).attr("transform",(function(e){return"translate("+l.arc.centroid(e)+")"})):"outside"===i&&(s.selectAll("text").transition("update_radii").duration(t).attr("transform",(function(e){var t=l.outer_arc.centroid(e);return t[0]=n*(l.is_mid_angle_left(e)?-1:1),"translate("+t+")"})),a.selectAll("polyline").transition("update_radii").duration(t).attr("points",(function(e){var t=l.outer_arc.centroid(e);return t[0]=.95*n*(l.is_mid_angle_left(e)?-1:1),[l.arc.centroid(e),l.outer_arc.centroid(e),t]})))},outer_join:function(e,t){var n=r.set(e.concat(t).map((function(e){return e.label}))).values().sort(),i={};e.forEach((function(e){i[e.label]=e}));var s={};t.forEach((function(e){s[e.label]=e}));var a=[],l=[];return n.forEach((function(e){var t;e in i?a.push(i[e]):((t=o.deepCopy(s[e])).size=0,a.push(t));e in s?l.push(s[e]):((t=o.deepCopy(i[e])).size=0,l.push(t))})),{first:a,second:l}},is_mid_angle_left:function(e){var t=(e.startAngle+e.endAngle)/2;return t>Math.PI||t<0&&t>-Math.PI},draw:function(e){this.set_ranges(),this.position_center(e);var t=this.model.mark_data,n=this.pie_g.select(".slices").selectAll("path.slice").data().map((function(e){return e.data}));0===n.length&&(n=t);var i=this.outer_join(n,t),o=i.first,s=i.second,a=r.layout.pie().startAngle(2*this.model.get("start_angle")*Math.PI/360).endAngle(2*this.model.get("end_angle")*Math.PI/360).value((function(e){return e.size}));this.model.get("sort")||a.sort(null);var l=this,c=!0===e?this.parent.model.get("animation_duration"):0,u=this.pie_g.select(".slices").selectAll("path.slice").data(a(o),this.join_key);u.enter().insert("path").attr("class","slice").style("fill",(function(e,t){return l.get_colors(t)})).each((function(e){this._current=e})),(u=this.pie_g.select(".slices").selectAll("path.slice").data(a(s),this.join_key)).transition("draw").duration(c).attrTween("d",(function(e){var t=r.interpolate(this._current,e),n=this;return function(e){return n._current=t(e),l.arc(n._current)}})),(u=this.pie_g.select(".slices").selectAll("path.slice").data(a(t),this.join_key)).exit().transition("draw").delay(c).duration(0).remove();var h=this.pie_g.select(".labels").selectAll("text").data(a(o),this.join_key);h.enter().append("text").attr("dy",".35em").style("opacity",0).text((function(e){return e.data.label})).each((function(e){this._current=e}));var d=(h=this.pie_g.select(".labels").selectAll("text").data(a(s),this.join_key)).transition("draw").duration(c).style("opacity",(function(e){return 0===e.data.value?0:1})),p=this.model.get("display_labels");if("inside"===p?d.attr("transform",(function(e){return"translate("+l.arc.centroid(e)+")"})).style("text-anchor","middle"):"outside"===p&&d.attrTween("transform",(function(e){var t=r.interpolate(this._current,e),n=this;return function(e){var r=t(e);n._current=r;var i=l.outer_arc.centroid(r);return i[0]=l.model.get("radius")*(l.is_mid_angle_left(r)?-1:1),"translate("+i+")"}})).styleTween("text-anchor",(function(e){var t=r.interpolate(this._current,e);return function(e){var n=t(e);return l.is_mid_angle_left(n)?"end":"start"}})),(h=this.pie_g.select(".labels").selectAll("text").data(a(t),this.join_key)).exit().transition("draw").delay(c).remove(),"outside"===p){var f=this.pie_g.select(".lines").selectAll("polyline").data(a(o),this.join_key);f.enter().append("polyline").style("opacity",0).each((function(e){this._current=e})),(f=this.pie_g.select(".lines").selectAll("polyline").data(a(s),this.join_key)).transition("draw").duration(c).style("opacity",(function(e){return 0===e.data.value?0:.5})).attrTween("points",(function(e){this._current=this._current;var t=r.interpolate(this._current,e),n=this;return function(e){var r=t(e);n._current=r;var i=l.outer_arc.centroid(r);return i[0]=.95*l.model.get("radius")*(l.is_mid_angle_left(r)?-1:1),[l.arc.centroid(r),l.outer_arc.centroid(r),i]}})),(f=this.pie_g.select(".lines").selectAll("polyline").data(a(t),this.join_key)).exit().transition("draw").delay(c).remove()}u.order(),u.on("click",(function(e,t){return l.event_dispatcher("element_clicked",{data:e,index:t})})),this.update_labels(),this.update_values(),this.apply_styles()},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.pie_g.selectAll("path.slice").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},update_colors:function(){var e=this,t=this.scales.color;this.pie_g.select(".slices").selectAll("path.slice").style("fill",(function(n,r){return void 0!==n.data.color&&void 0!==t?t.scale(n.data.color):e.get_colors(n.data.index)}))},update_labels:function(){var e=this.model.get("display_labels"),t=this.pie_g.selectAll(".labels text").style("visibility","none"===e?"hidden":"visible").style("font-weight",this.model.get("font_weight")).style("font-size",this.model.get("font_size")),n=this.model.get("label_color");void 0!==n&&t.style("fill",n)},update_values:function(){var e=this.model.get("display_values"),t=r.format(this.model.get("values_format"));this.pie_g.selectAll(".labels text").text((function(n){return n.data.label+(e?": "+t(n.data.size):"")}))},clear_style:function(e,t){var n=this.pie_g.selectAll("path.slice");t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},set_style_on_elements:function(e,t){if(null!=t&&0!==t.length){var n=this.pie_g.selectAll(".slice");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).style(e)}},set_default_style:function(e){this.update_colors(),this.update_stroke_and_opacities()},click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),i=n?o.deepCopy(n):[],a=i.indexOf(t),l=r.event.ctrlKey||r.event.metaKey;if(a>-1&&l)i.splice(a,1);else{if(r.event.shiftKey){if(a>-1)return;var c=0!==i.length?r.min(i):-1,u=0!==i.length?r.max(i):this.model.mark_data.length;t>u?s.range(u+1,t).forEach((function(e){i.push(e)})):t<c&&s.range(t+1,c).forEach((function(e){i.push(e)}))}else l||(i=[]);i.push(t)}this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var h=r.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault(),this.selected_indices=i,this.apply_styles()},reset_selection:function(){this.model.set("selected",null),this.touch(),this.selected_indices=null,this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.set_default_style()},compute_view_padding:function(){var e=this.model.get("scales"),t=r.max([this.model.get("radius"),this.model.get("inner_radius")]),n=e.x?t+1:0,i=e.y?t+1:0;n===this.x_padding&&i===this.y_padding||(this.x_padding=n,this.y_padding=i,this.trigger("mark_padding_updated"))}});e.exports={Pie:a}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"PieModel",_view_name:"Pie",sizes:[],color:null,x:.5,y:.5,scales_metadata:{color:{dimension:"color"}},sort:!1,colors:r.scale.category10().range(),stroke:null,opacities:[],radius:180,inner_radius:.1,start_angle:0,end_angle:360})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on("change:sizes",this.update_data,this),this.on("change:color",(function(){this.update_color(),this.trigger("colors_updated")}),this),this.on("change:labels",this.update_labels,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_color(),this.update_labels(),this.update_domains()},update_data:function(){var e=this.get_typed_field("sizes"),t=this.get_typed_field("color"),n=this.get("labels");this.mark_data=e.map((function(e,r){return{size:e,color:t[r],label:null==n[r]?"S"+(r+1):n[r],index:r}})),this.update_color(),this.update_domains(),this.trigger("data_updated")},update_labels:function(){if(this.mark_data){var e=this.get("labels");this.mark_data.forEach((function(t,n){t.label=null==e[n]?"S"+(n+1):e[n]})),this.trigger("labels_updated")}},update_color:function(){if(this.mark_data){var e=this.get_typed_field("color"),t=this.get("scales").color;t&&(this.get("preserve_domain").color?t.del_domain([],this.model_id+"_color"):t.compute_and_set_domain(e,this.model_id+"_color"))}},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y;if(t){var r="date"===t.type?this.get_date_elem("x"):this.get("x");this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain([r],this.model_id+"_x")}n&&(this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain([this.get("y")],this.model_id+"_y"))}},get_data_dict:function(e,t){return e.data}});e.exports={PieModel:s}},function(e,t,n){var r=n(1),i=n(198).ColorScale.extend({create_d3_scale:function(){this.scale=r.time.scale()}});e.exports={DateColorScale:i}},function(e,t,n){n(1);var r=n(0),i=n(199),o=i.ColorScaleModel.extend({defaults:function(){return r.extend(i.ColorScaleModel.prototype.defaults(),{_model_name:"DateColorScaleModel",_view_name:"DateColorScale"})},set_init_state:function(){this.type="date_color_linear",this.color_range=[],this.mid=null,this.global_min=(new Date).setTime(0),this.global_max=new Date},min_max_changed:function(){this.min=this.get_date_elem("min"),this.max=this.get_date_elem("max"),this.min_from_data=null===this.min,this.max_from_data=null===this.max,this.update_domain()}});e.exports={DateColorScaleModel:o}},function(e,t,n){var r=n(1),i=(n(0),n(104).LinearScale.extend({render:function(){this.scale=r.time.scale(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}}));e.exports={DateScale:i}},function(e,t,n){var r=n(195),i=n(105),o=n(1),s=i.symbol,a=r.ScatterBase.extend({render:function(){return this.dot=s().type(this.model.get("marker")).size(this.model.get("default_size")).skew(this.model.get("default_skew")),a.__super__.render.apply(this)},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width,this),this.listenTo(this.model,"change:default_opacities",this.update_default_opacities,this),this.listenTo(this.model,"change:default_skew",this.update_default_skew,this),this.listenTo(this.model,"change:default_rotation",this.update_xy_position,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"change:default_size",this.update_default_size,this),this.listenTo(this.model,"change:fill",this.update_fill,this),this.listenTo(this.model,"change:display_names",this.update_names,this)},update_colors:function(e,t){if(!this.model.dirty){var n=this,r=this.model.get("stroke"),i=t.length;this.d3el.selectAll(".dot").style("fill",this.model.get("fill")?function(e,t){return n.get_element_color(e,t)}:"none").style("stroke",r||function(e,t){return n.get_element_color(e,t)}),this.legend_el&&(this.legend_el.select("path").style("fill",(function(e,n){return t[n%i]})).style("stroke",r||function(e,n){return t[n%i]}),this.legend_el.select("text").style("fill",this.model.get("fill")?function(e,n){return t[n%i]}:"none"))}},update_fill:function(e,t){var n=this,r=this.model.get("colors"),i=r.length;this.d3el.selectAll(".dot").style("fill",t?function(e,t){return n.get_element_color(e,t)}:"none"),this.legend_el&&this.legend_el.selectAll("path").style("fill",t?function(e,t){return r[t%i]}:"none")},update_stroke_width:function(){var e=this.model.get("stroke_width");this.d3el.selectAll(".dot").style("stroke-width",e),this.legend_el&&this.legend_el.selectAll("path").style("stroke-width",e)},update_stroke:function(e,t){var n=this,r=this.model.get("stroke");this.d3el.selectAll(".dot").style("stroke",r||function(e,t){return n.get_element_color(e,t)}),this.legend_el&&this.legend_el.selectAll("path").style("stroke",r)},update_default_opacities:function(e){if(!this.model.dirty){var t=this.model.get("default_opacities"),n=this.model.get("colors"),r=n.length,i=t.length,o=!0===e?this.parent.model.get("animation_duration"):0,s=this;this.d3el.selectAll(".dot").transition("update_default_opacities").duration(o).style("opacity",(function(e,t){return s.get_element_opacity(e,t)})),this.legend_el&&this.legend_el.select("path").style("opacity",(function(e,n){return t[n%i]})).style("fill",(function(e,t){return n[t%r]}))}},update_marker:function(e,t){this.model.dirty||(this.d3el.selectAll(".dot").transition("update_marker").duration(this.parent.model.get("animation_duration")).attr("d",this.dot.type(t)),this.legend_el.select("path").attr("d",this.dot.type(t)))},update_default_skew:function(e){if(!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_skew").duration(t).attr("d",this.dot.skew((function(e){return n.get_element_skew(e)})))}},update_default_size:function(e){if(this.compute_view_padding(),!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_size").duration(t).attr("d",this.dot.size((function(e){return n.get_element_size(e)}))),this.update_names(e)}},update_names:function(e){var t=this,n=this.model.get_typed_field("names"),r=this.model.get("display_names")&&0!==n.length,i=e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").text((function(e){return e.name})).transition("update_names").duration(i).attr("transform",(function(e){var n=Math.sqrt(t.get_element_size(e))/2;return"translate("+n+","+-n+")"})).attr("display",(function(e){return r?"inline":"none"}))},color_scale_updated:function(e){var t=this,n=this.model.get("fill"),r=this.model.get("stroke"),i=!0===e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("path").transition("color_scale_updated").duration(i).style("fill",n?function(e,n){return t.get_element_color(e,n)}:"none").style("stroke",r||function(e,n){return t.get_element_color(e,n)})},draw_elements:function(e,t){var n=this,r=!0===e?this.parent.model.get("animation_duration"):0,i=this.d3el.selectAll(".object_grp");t.append("path").attr("class","dot element"),t.append("text").attr("class","dot_text"),i.select("path").transition("draw_elements").duration(r).attr("d",this.dot.size((function(e){return n.get_element_size(e)})).skew((function(e){return n.get_element_skew(e)}))),this.update_names(e),this.apply_styles()},draw_legend_elements:function(e,t){var n=this.model.get("colors"),r=n.length,i=this.model.get("stroke");e.append("path").attr("transform",(function(e,n){return"translate( "+t/2+", "+t/2+")"})).attr("d",this.dot.size(64)).style("fill",this.model.get("fill")?function(e,t){return n[t%r]}:"none").style("stroke",i||function(e,t){return n[t%r]})},set_default_style:function(e){if(e&&0!==e.length){var t=this.d3el.selectAll(".element").filter((function(t,n){return-1!==e.indexOf(n)})),n=this.model.get("fill"),r=this.model.get("stroke"),i=this.model.get("stroke_width"),o=this;t.style("fill",n?function(e,t){return o.get_element_color(e,t)}:"none").style("stroke",r||function(e,t){return o.get_element_color(e,t)}).style("opacity",(function(e,t){return o.get_element_opacity(e,t)})).style("stroke-width",i)}},set_drag_style:function(e,t,n){o.select(n).select("path").classed("drag_scatter",!0).transition("set_drag_style").attr("d",this.dot.size(5*this.model.get("default_size")));var r=this.model.get("drag_color");r&&o.select(n).select("path").style("fill",r).style("stroke",r)},reset_drag_style:function(e,t,n){var r=this.model.get("stroke"),i=this.get_element_color(e,t);o.select(n).select("path").classed("drag_scatter",!1).transition("reset_drag_style").attr("d",this.dot.size(this.get_element_size(e))),this.model.get("drag_color")&&o.select(n).select("path").style("fill",i).style("stroke",r||i)}});e.exports={Scatter:a}},function(e,t,n){n(1);var r=n(0),i=n(71),o=i.LinearScaleModel.extend({defaults:function(){return r.extend(i.LinearScaleModel.prototype.defaults(),{_model_name:"DateScaleModel",_view_name:"DateScale"})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="date",this.global_min=(new Date).setTime(0),this.global_max=new Date},min_max_changed:function(){this.min=this.get_date_elem("min"),this.max=this.get_date_elem("max"),this.min_from_data=null===this.min,this.max_from_data=null===this.max,this.update_domain()}});e.exports={DateScaleModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"LinesModel",_view_name:"Lines",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:r.scale.category10().range(),fill_colors:r.scale.category10().range(),stroke_width:2,labels_visibility:"none",curves_subset:[],line_style:"solid",interpolation:"linear",close_path:!1,fill:"none",marker:null,marker_size:64,opacities:[],fill_opacities:[]})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color"],this.update_data,this),this.on("change:labels",this.update_labels,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this;this.x_data=this.get_typed_field("x"),this.y_data=this.get_typed_field("y"),this.color_data=this.get_typed_field("color");var t=this.get("scales"),n=(t.x,t.y,this.get("labels"));if(0===this.x_data.length||0===this.y_data.length)this.mark_data=[];else{this.x_data=this.x_data[0]instanceof Array?this.x_data:[this.x_data],this.y_data=this.y_data[0]instanceof Array?this.y_data:[this.y_data],n=this.get_labels();var i=this.y_data.length;1==this.x_data.length&&i>1?this.mark_data=n.map((function(t,n){return{name:t,values:e.y_data[n].map((function(t,r){return{x:e.x_data[0][r],y:t,y0:e.y_data[Math.min(n+1,i-1)][r],sub_index:r}})),color:e.color_data[n],index:n}})):this.mark_data=n.map((function(t,n){return{name:t,values:r.zip(e.x_data[n],e.y_data[n]).map((function(t,r){return{x:t[0],y:t[1],y0:e.y_data[Math.min(n+1,i-1)][r],sub_index:r}})),color:e.color_data[n],index:n}}))}this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_labels:function(){var e=this.get_labels();this.mark_data.forEach((function(t,n){t.name=e[n]})),this.trigger("labels_updated")},get_labels:function(){var e=this.get("labels"),t=1==this.x_data.length?this.y_data.length:Math.min(this.x_data.length,this.y_data.length);return e.length>t?e=e.slice(0,t):e.length<t&&i.range(e.length,t).forEach((function(t){e[t]="C"+(t+1)})),e},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color;this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.x}))})),this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.y}))})),this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.color})),this.model_id+"_color"))}},get_data_dict:function(e,t){return e}}),a=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"FlexLineModel",_view_name:"FlexLine",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:r.scale.category10().range(),fill_colors:r.scale.category10().range(),stroke_width:2,labels_visibility:"none",curves_subset:[],line_style:"solid",interpolation:"linear",close_path:!1,fill:"none",marker:null,marker_size:64,opacities:[],fill_opacities:[]})},update_data:function(){this.dirty=!0;var e=this;this.x_data=this.get_typed_field("x"),this.y_data=this.get_typed_field("y");var t=this.get("scales"),n=(t.x,t.y,this.get("labels"));if(0===this.x_data.length||0===this.y_data.length)this.mark_data=[],this.data_len=0;else{this.x_data=this.x_data[0]instanceof Array?this.x_data:[this.x_data],this.y_data=this.y_data[0]instanceof Array?this.y_data:[this.y_data],n=this.get_labels();var r=this.get_typed_field("color"),o=this.get_typed_field("width");this.data_len=Math.min(this.x_data[0].length,this.y_data[0].length),this.mark_data=[{name:n[0],values:i.range(this.data_len-1).map((function(t,n){return{x1:e.x_data[0][n],y1:e.y_data[0][n],x2:e.x_data[0][n+1],y2:e.y_data[0][n+1],color:r[n],size:o[n]}}))}]}this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color,i=e.width;this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.x_data[0].slice(0,this.data_len),this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.y_data[0].slice(0,this.data_len),this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.color}))})),this.model_id+"_color")),null!=i&&(this.get("preserve_domain").width?i.del_domain([],this.model_id+"_width"):i.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.size}))})),this.model_id+"_width"))}}});e.exports={LinesModel:s,FlexLineModel:a}},function(e,t,n){n(1);var r=n(0),i=n(196),o=i.ScatterBaseModel.extend({defaults:function(){return r.extend(i.ScatterBaseModel.prototype.defaults(),{_model_name:"ScatterModel",_view_name:"Scatter",skew:null,marker:"circle",stroke:null,stroke_width:1.5,default_skew:.5,default_size:64,names:[],display_names:!0,fill:!0,drag_color:null,drag_size:5,names_unique:!0})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on("change:skew",this.update_data,this),this.on_some_change(["names","names_unique"],(function(){this.update_unique_ids(),this.trigger("data_updated")}),this)},update_mark_data:function(){o.__super__.update_mark_data.apply(this);var e=this.get_typed_field("skew");this.mark_data.forEach((function(t,n){t.skew=e[n]}))},update_unique_ids:function(){var e=this.get_typed_field("names"),t=0!==e.length;e=t?e:this.mark_data.map((function(e,t){return"Dot"+t}));var n=[];n=this.get("names_unique")?e.slice(0):r.range(this.mark_data.length),this.mark_data.forEach((function(t,r){t.name=e[r],t.unique_id=n[r]}))}});e.exports={ScatterModel:o}},function(e,t,n){var r=n(0),i=n(1),o=n(52),s=(n(19),n(103)),a=o.BaseXSelector.extend({render:function(){a.__super__.render.apply(this),this.freeze_but_move=!0,this.freeze_dont_move=!1,this.active=!1,this.dirty=!1,this.size=this.model.get("size"),this.width=this.parent.width-this.parent.margin.left-this.parent.margin.right,this.height=this.parent.height-this.parent.margin.top-this.parent.margin.bottom;var e=this,t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.background=e.d3el.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("class","selector selectormouse").attr("pointer-events","all").attr("visibility","hidden"),e.background.on("mousemove",r.bind(e.mousemove,e)).on("click",r.bind(e.click,e)).on("dblclick",r.bind(e.dblclick,e)),e.rect=e.d3el.append("rect").attr("class","selector intsel").attr("x",0).attr("y",0).attr("width",e.size).attr("height",e.height).attr("pointer-events","none").attr("display","none"),e.color_change(),e.selected_changed(),e.create_listeners()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this)},color_change:function(){null!==this.model.get("color")&&this.rect.style("fill",this.model.get("color"))},click:function(){this.active=!0,this.rect.style("display","inline"),this.freeze_but_move=!!this.model.get("size")||!this.freeze_but_move},dblclick:function(){this.freeze_dont_move=!this.freeze_dont_move},mousemove:function(){if(!this.freeze_dont_move&&this.active){this.dirty=!0;var e,t=i.mouse(this.background.node()),n=this.size>0?this.size:parseInt(this.rect.attr("width")),r=(this.height-t[1])/this.height,o=this.freeze_but_move?n:Math.round(r*this.width);e=t[0]-o/2<0?0:t[0]+o/2>this.width?this.width-o:t[0]-o/2,this.rect.attr("x",e),this.rect.attr("width",o);var s=[e,e+o];this.model.set_typed_field("selected",this.scale.invert_range(s)),this.update_mark_selected(s),this.touch(),this.dirty=!1}},update_mark_selected:function(e,t){if(void 0!==e&&0!==e.length||r.each(this.mark_views,(function(e){return e.selector_changed()})),void 0===t)var n=this.model.get("orientation"),i="vertical"==n?[]:e,o="vertical"==n?e:[];else i=e,o=t;var a=function(e){return s.point_in_rectangle(e,i,o)},l=function(e){return s.rect_inter_rect(e[0],e[1],i,o)};r.each(this.mark_views,(function(e){e.selector_changed(a,l)}),this)},scale_changed:function(){this.reset(),this.create_scale()},relayout:function(){a.__super__.relayout.apply(this),this.adjust_rectangle(),this.background.attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},reset:function(){this.rect.attr("x",0).attr("width",0),this.model.set_typed_field("selected",{}),this.update_mark_selected(),this.touch()},update_scale_domain:function(e){a.__super__.update_scale_domain.apply(this),!0!==e&&this.selected_changed()},selected_changed:function(e,t){if(!this.dirty){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(2!=n.length)return;var r=n.map(this.scale.scale);r=r.sort((function(e,t){return e-t})),this.rect.attr({x:r[0],width:r[1]-r[0]}).style("display","inline"),this.active=!0,this.update_mark_selected(r)}}},adjust_rectangle:function(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)}});e.exports={FastIntervalSelector:a}},function(e,t,n){var r=n(1),i=n(104).LinearScale.extend({render:function(){this.scale=r.scale.log(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}});e.exports={LogScale:i}},function(e,t,n){n(1);var r=n(0),i=n(71),o=i.LinearScaleModel.extend({defaults:function(){return r.extend(i.LinearScaleModel.prototype.defaults(),{_model_name:"LogScaleModel",_view_name:"LogScale",domain:[]})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="log",this.global_min=Number.MIN_VALUE,this.global_max=Number.POSITIVE_INFINITY}});e.exports={LogScaleModel:o}},function(e,t,n){var r=n(9),i=(n(0),n(1)),o=r.DOMWidgetView.extend({render:function(){this.width=this.model.get("width"),this.height=this.model.get("height"),this.margin=this.model.get("margin"),this.el.style.width=this.width+this.margin.left+this.margin.right,this.el.style.height=this.height+this.margin.top+this.margin.bottom;var e=this.model.get("data");this.colors=this.model.get("colors"),this.mode=this.model.get("mode");var t=i.scale.category10();this.d3el.append("div").style("position","relative").style("width",this.width+this.margin.left+this.margin.right+"px").style("height",this.height+this.margin.top+this.margin.bottom+"px").style("left",this.margin.left+"px").style("top",this.margin.top+"px"),this.margin=this.model.get("margin"),this.tree_map=i.layout.treemap().size([this.width,this.height]).sticky(!0).padding(null).mode(this.mode).value((function(e){return e.size}));this.d3el.datum(e).selectAll(".node").data(this.tree_map.nodes).enter().append("div").attr("class","node").call(this.position).style({background:function(e,n){return e.children?t(e.name):null},border:"solid white"}).text((function(e){return e.children?null:e.name})).style({font:"11px sans-serif",position:"absolute","text-align":"center",overflow:"hidden",color:"white"})},position:function(){this.style("left",(function(e){return e.x+"px"})).style("top",(function(e){return e.y+"px"})).style("width",(function(e){return Math.max(0,e.dx-1)+"px"})).style("height",(function(e){return Math.max(0,e.dy-1)+"px"}))}});e.exports={SquareMarketMap:o}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"FigureModel",_view_name:"Figure",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,title:"",axes:[],marks:[],interaction:null,scale_x:void 0,scale_y:void 0,fig_color:null,title_style:{},background_style:{},legend_style:{},legend_text:{},preserve_aspect:!1,min_aspect_ratio:0,max_aspect_ratio:100,fig_margin:{top:60,bottom:60,left:60,right:60},padding_x:0,padding_y:.025,legend_location:"top-right",animation_duration:0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("msg:custom",this.handle_custom_messages,this)},handle_custom_messages:function(e){"save_png"===e.type?this.trigger("save_png",e.filename):"save_svg"===e.type&&this.trigger("save_svg",e.filename)},save_png:function(){this.trigger("save_png")}},{serializers:i.extend({marks:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},interaction:{deserialize:r.unpack_models},scale_x:{deserialize:r.unpack_models},scale_y:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={FigureModel:a}},function(e,t,n){var r=n(9),i=n(1),o=n(0),s=n(19),a=n(13),l=s.Mark.extend({render:function(){var e=l.__super__.render.apply(this);this.map=this.d3el.append("svg").attr("viewBox","0 0 1200 980"),this.width=this.parent.plotarea_width,this.height=this.parent.plotarea_height,this.map_id=r.uuid(),this.enable_hover=this.model.get("enable_hover"),this.display_el_classes=["event_layer"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.draw()}))},set_ranges:function(){},set_positional_scales:function(){var e=this.scales.projection;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.update_style()})),e.on("color_scale_range_changed",this.update_style,this))},remove_map:function(){i.selectAll(".world_map.map"+this.map_id).remove()},draw:function(){this.set_ranges();var e=this;this.remove_map(),this.transformed_g=this.map.append("g").attr("class","world_map map"+this.map_id),this.fill_g=this.transformed_g.append("g"),this.highlight_g=this.transformed_g.append("g"),this.stroke_g=this.transformed_g.append("g");var t=this.scales.projection;this.fill_g.selectAll("path").data(e.model.geodata).enter().append("path").attr("d",t.path).style("fill",(function(t,n){return e.fill_g_colorfill(t,n)})),this.stroke_g.selectAll("path").data(e.model.geodata).enter().append("path").attr("class","event_layer").attr("d",t.path).style("fill-opacity",0).on("click",(function(t,n){return e.event_dispatcher("element_clicked",{data:t,index:n})})),this.validate_color(this.model.get("stroke_color"))&&this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color")),this.zoom=i.behavior.zoom().scaleExtent([1,8]).on("zoom",(function(){e.zoomed(e,!1)})),this.parent.bg.call(this.zoom),this.parent.bg.on("dblclick.zoom",null),this.parent.bg.on("dblclick",(function(){e.zoomed(e,!0)}))},validate_color:function(e){return""!==e},mouseover_handler:function(){if(this.model.get("hover_highlight")){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=e.data()[0],n=this.model.get("selected"),r=n?a.deepCopy(n):[],o=this.highlight_g.append((function(){return e.node().cloneNode(!0)}));o.classed("hovered",!0),o.classed("event_layer",!1),this.validate_color(this.model.get("hovered_styles").hovered_stroke)&&-1===r.indexOf(t.id)&&o.style("stroke",this.model.get("hovered_styles").hovered_stroke).style("stroke-width",this.model.get("hovered_styles").hovered_stroke_width);var s=this;this.validate_color(this.model.get("hovered_styles").hovered_fill)&&-1===r.indexOf(t.id)&&o.style("fill-opacity",1).style("fill",(function(){return s.model.get("hovered_styles").hovered_fill}))}}},mouseout_handler:function(){if(this.model.get("hover_highlight")){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=this;e.transition("mouseout_handler").style("fill",(function(e,n){return t.fill_g_colorfill(e,n)})).style("stroke",(function(e,n){return t.hoverfill(e,n)})),t.highlight_g.selectAll(".hovered").remove()}}},click_handler:function(){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=e.data()[0],n=this.model.get("selected"),r=n?a.deepCopy(n):[],o=r.indexOf(t.id);if(o>-1){r.splice(o,1),e.transition("click_handler").style("fill-opacity",0),this.highlight_g.selectAll(".hovered").remove();var s="#c".concat(t.id.toString());i.select(s).remove()}else this.highlight_g.selectAll(".hovered").remove(),this.highlight_g.append((function(){return e.node().cloneNode(!0)})).attr("id","c"+t.id).classed("selected",!0).classed("event_layer",!1),this.validate_color(this.model.get("selected_styles").selected_fill)&&this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill),this.validate_color(this.model.get("selected_styles").selected_stroke)&&this.highlight_g.selectAll(".selected").style("stroke",this.model.get("selected_styles").selected_stroke).style("stroke-width",this.model.get("selected_styles").selected_stroke_width),r.push(t.id),this.model.set("selected",r),this.touch();this.model.set("selected",0===r.length?null:r,{updated_view:this}),this.touch()}},zoomed:function(e,t){var n=t?[0,0]:i.event.translate,r=t?1:i.event.scale,o=e.height/3,s=t?e.width:2*e.width;n[0]=Math.min(e.width/2*(r-1),Math.max(s/2*(1-r),n[0])),n[1]=Math.min(e.height/2*(r-1)+this.height*r,Math.max(o/2*(1-r)-e.width*r,n[1])),e.zoom.translate(n),t&&e.zoom.scale(r),e.transformed_g.style("stroke-width",1/r).attr("transform","translate("+n+")scale("+r+")")},create_listeners:function(){var e=this;this.d3el.on("mouseover",o.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",o.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",o.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:color",this.update_style,this),this.listenTo(this.model,"change:stroke_color",this.change_stroke_color,this),this.listenTo(this.model,"change:colors",this.change_map_color,this),this.listenTo(this.model,"change:selected",this.change_selected,this),this.listenTo(this.model,"change:selected_styles",(function(){e.change_selected_fill(),e.change_selected_stroke()})),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");o.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=function(){return this.mouseover_handler(),this.refresh_tooltip()},this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=function(){return this.mouseout_handler(),this.hide_tooltip()}):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){})},change_selected_fill:function(){this.validate_color(this.model.get("selected_styles").selected_fill)?this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill):this.highlight_g.selectAll(".selected").style("fill-opacity",0)},change_selected_stroke:function(){this.validate_color(this.model.get("selected_styles").selected_stroke)?this.highlight_g.selectAll(".selected").style("stroke-width",this.model.get("selected_styles").selected_stroke_width).style("stroke",this.model.get("selected_styles").selected_stroke):this.highlight_g.selectAll(".selected").style("stroke-width",0)},change_selected:function(){this.highlight_g.selectAll("path").remove();var e=this,t=this.model.get("selected"),n=t||[],r=this.stroke_g.selectAll("path").data();this.stroke_g.selectAll("path").style("stroke",(function(t,n){return e.hoverfill(t,n)}));for(var i=this.stroke_g.selectAll("path"),o=0;o<r.length;o++)n.indexOf(r[o].id)>-1&&e.highlight_g.append((function(){return i[0][o].cloneNode(!0)})).attr("id",r[o].id).style("fill-opacity",(function(){return e.validate_color(e.model.get("selected_styles").selected_fill)?1:0})).style("fill",e.model.get("selected_styles").selected_fill).style("stroke-opacity",(function(){return e.validate_color(e.model.get("selected_styles").selected_stroke)?1:0})).style("stroke",e.model.get("selected_styles").selected_stroke).style("stroke-width",e.model.get("selected_styles").selected_stroke_width).classed("selected",!0)},reset_selection:function(){this.model.set("selected",[]),this.touch(),this.highlight_g.selectAll(".selected").remove(),i.select(this.d3el.parentNode).selectAll("path").classed("selected",!1),i.select(this.d3el.parentNode).selectAll("path").classed("hovered",!1);var e=this;this.stroke_g.selectAll("path").style("stroke",(function(t,n){return e.hoverfill(t,n)})),this.fill_g.selectAll("path").classed("selected",!1).style("fill",(function(t,n){return e.fill_g_colorfill(t,n)}))},change_stroke_color:function(){this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color"))},change_map_color:function(){var e=this;this.is_object_empty(this.model.get("color"))&&this.fill_g.selectAll("path").style("fill",(function(t,n){return e.fill_g_colorfill(t,n)}))},update_style:function(){var e=this.model.get("color"),t=this;this.is_object_empty(e)||this.fill_g.selectAll("path").style("fill",(function(e,n){return t.fill_g_colorfill(e,n)}))},is_object_empty:function(e){var t=!0;for(var n in e){t=!1;break}return t},hoverfill:function(e,t){var n=this.model.get("selected");return(n||[]).indexOf(e.id)>-1&&this.validate_color(this.model.get("selected_styles").selected_stroke)?this.model.get("selected_styles").selected_stroke:this.model.get("stroke_color")},fill_g_colorfill:function(e,t){var n=this.scales.color,r=this.model.get("selected"),i=r||[],o=this.model.get("color"),s=this.model.get("colors");return i.indexOf(e.id)>-1?this.model.get("selected_styles").selected_fill:this.is_object_empty(o)?s[e.id]||s.default_color:void 0===o[e.id]||null===o[e.id]||"nan"===o[e.id]||void 0===n?s.default_color:n.scale(o[e.id])}});e.exports={Map:l}},function(e,t,n){var r=n(9),i=n(1),o=n(13),s=n(0),a=r.DOMWidgetView.extend({initialize:function(){this.d3el=i.select(this.el),a.__super__.initialize.apply(this,arguments)},render:function(){this.parent=this.options.parent,this.update_formats(),this.create_listeners(),this.create_table()},create_listeners:function(){this.listenTo(this.parent,"update_tooltip",this.update_tooltip),this.model.on_some_change(["fields","show_labels","labels"],this.create_table,this),this.listenTo(this.model,"change:formats",this.update_formats)},update_formats:function(){var e=this.model.get("fields"),t=this.model.get("formats");this.tooltip_formats=e.map((function(e,n){var r=t[n];return void 0===r||""===r?function(e){return e}:o.is_valid_time_format(r)?i.time.format(r):i.format(r)}))},update_tooltip:function(e){var t=this;this.d3el.select("table").selectAll("tr").select(".datavalue").text((function(n,r){return t.tooltip_formats[r](e[n])}))},create_table:function(){for(var e=this.model.get("fields"),t=s.clone(this.model.get("labels")),n=t.length;n<e.length;n++)t[n]=e[n];this.d3el.select("table").remove();var r=this.d3el.append("table").selectAll("tr").data(e);r.exit().remove();var i=r.enter().append("tr").attr("class","datarow");this.model.get("show_labels")&&i.append("td").text((function(e,n){return t[n]})).attr("class","tooltiptext datafield"),i.append("td").attr("class","tooltiptext datavalue"),this.update_formats()}});e.exports={Tooltip:a}},function(e,t,n){var r=n(9),i=n(0),o="^"+n(21).version,s=r.DOMWidgetModel.extend({defaults:function(){return i.extend(r.DOMWidgetModel.prototype.defaults(),{_model_name:"TooltipModel",_view_name:"Tooltip",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o,_view_module_version:o,fields:[],formats:[],show_labels:!0,labels:[]})}});e.exports={TooltipModel:s}},function(e,t,n){var r=n(1),i=n(0),o=n(200),s=o.Lines.extend({render:function(){var e=o.Lines.__super__.render.apply(this),t=this;return e.then((function(){t.scales.x,t.scales.y;t.create_listeners(),t.draw()}))},set_ranges:function(){s.__super__.set_ranges.apply(this);var e=this.scales.width;e&&e.set_range([.5,this.model.get("stroke_width")])},create_listeners:function(){s.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:labels_visibility",this.update_legend_labels,this),this.listenTo(this.model,"change:color change:width",this.update_and_draw,this)},draw_legend:function(e,t,n,o,s){var a=e.selectAll(".legend"+this.uuid).data(this.model.mark_data,(function(e,t){return e.name})),l=this,c=.8*s;a.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",i.bind(this.make_axis_bold,this)).on("mouseout",i.bind(this.make_axis_non_bold,this)).append("line").style("stroke",(function(e,t){return l.get_colors(t)})).attr({x1:0,x2:c,y1:c/2,y2:c/2}),a.append("text").attr("class","legendtext").attr("x",1.2*c).attr("y",c/2).attr("dy","0.35em").text((function(e,t){return l.model.get("labels")[t]})).style("fill",(function(e,t){return l.get_colors(t)}));var u=r.max(this.model.get("labels"),(function(e){return e.length}));return a.exit().remove(),[this.model.mark_data.length,u]},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.draw()})),e.on("color_scale_range_changed",this.draw,this))},draw:function(){this.set_ranges();var e=this.d3el.selectAll(".curve").data(this.model.mark_data,(function(e,t){return e.name}));e.enter().append("g").attr("class","curve"),e.exit().transition("draw").duration(this.parent.model.get("animation_duration")).remove();var t=this.scales.x,n=this.scales.y,i=this;e[0].forEach((function(e,o){var s=r.select(e).selectAll("line").data(i.model.mark_data[o].values);s.enter().append("line"),s.attr("class","line-elem").attr({x1:function(e){return t.scale(e.x1)},x2:function(e){return t.scale(e.x2)},y1:function(e){return n.scale(e.y1)},y2:function(e){return n.scale(e.y2)}}).attr("stroke",(function(e){return i.get_element_color(e)})).attr("stroke-width",(function(e){return i.get_element_width(e)}))}))},get_element_color:function(e){var t=this.scales.color;return void 0!==t&&void 0!==e.color?t.scale(e.color):this.model.get("colors")[0]},get_element_width:function(e){var t=this.scales.width;return void 0!==t&&void 0!==e.size?t.scale(e.size):this.model.get("stroke_width")},relayout:function(){o.Lines.__super__.relayout.apply(this),this.set_ranges();var e=this.scales.x,t=this.scales.y;this.d3el.selectAll(".curve").selectAll(".line-elem").transition("relayout").duration(this.parent.model.get("animation_duration")).attr({x1:function(t){return e.scale(t.x1)},x2:function(t){return e.scale(t.x2)},y1:function(e){return t.scale(e.y1)},y2:function(e){return t.scale(e.y2)}})},create_labels:function(){}});e.exports={FlexLine:s}},function(e,t,n){var r=n(0),i=n(20),o=n(540),s=i.MarkModel.extend({defaults:function(){return r.extend(i.MarkModel.prototype.defaults(),{_model_name:"MapModel",_view_name:"Map",color:{},hover_highlight:!0,hovered_styles:{hovered_fill:"Orange",hovered_stroke:null,hovered_stroke_width:2},stroke_color:null,default_color:null,scales_metadata:{color:{dimension:"color"},projection:{dimension:"geo"}},selected:[],selected_styles:{selected_fill:"Red",selected_stroke:null,selected_stroke_width:2},map_data:void 0})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on("change:map_data",this.update_data,this),this.on("change:color",this.color_data_updated,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this.get("map_data");"Topology"==e.type?this.geodata=o.feature(e,e.objects.subunits).features:this.geodata=e.features,this.color_data_updated(),this.dirty=!1,this.trigger("data_updated")},update_properties:function(e){e.properties?e.properties.color=this.color_data[e.id]:e.properties={color:this.color_data[e.id]}},color_data_updated:function(){var e=this;this.update_domains(),this.geodata.map((function(t){return e.update_properties(t)}))},update_domains:function(){var e=this.get("scales"),t=this,n=e.color;this.color_data=this.get("color"),null!=n&&(this.get("preserve_domain").color?n.del_domain([],this.model_id+"_color"):n.compute_and_set_domain(Object.keys(this.color_data).map((function(e){return t.color_data[e]})),this.model_id+"_color"))},get_data_dict:function(e,t){return r.extend(e.properties,{id:e.id})}});e.exports={MapModel:s}},function(e,t,n){!function(e){"use strict";function t(){}function n(e){if(!e)return t;var n,r,i=e.scale[0],o=e.scale[1],s=e.translate[0],a=e.translate[1];return function(e,t){t||(n=r=0),e[0]=(n+=e[0])*i+s,e[1]=(r+=e[1])*o+a}}function r(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function i(e,t){var n={type:"Feature",id:t.id,properties:t.properties||{},geometry:o(e,t)};return null==t.id&&delete n.id,n}function o(e,t){var r=n(e.transform),i=e.arcs;function o(e,t){t.length&&t.pop();for(var n,o=i[e<0?~e:e],s=0,a=o.length;s<a;++s)t.push(n=o[s].slice()),r(n,s);e<0&&function(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}(t,a)}function s(e){return e=e.slice(),r(e,0),e}function a(e){for(var t=[],n=0,r=e.length;n<r;++n)o(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function l(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function c(e){return e.map(l)}var u={Point:function(e){return s(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(s)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return c(e.arcs)},MultiPolygon:function(e){return e.arcs.map(c)}};return function e(t){var n=t.type;return"GeometryCollection"===n?{type:n,geometries:t.geometries.map(e)}:n in u?{type:n,coordinates:u[n](t)}:null}(t)}function s(e,t){var n={},r={},i={},o=[],s=-1;function a(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach((function(e){n[e<0?~e:e]=1})),o.push(i)}}return t.forEach((function(n,r){var i,o=e.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++s],t[s]=n,t[r]=i)})),t.forEach((function(t){var n,o,s=function(t){var n,r=e.arcs[t<0?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=r[r.length-1],t<0?[n,i]:[i,n]}(t),a=s[0],l=s[1];if(n=i[a])if(delete i[n.end],n.push(t),n.end=l,o=r[l]){delete r[o.start];var c=o===n?n:n.concat(o);r[c.start=n.start]=i[c.end=o.end]=c}else r[n.start]=i[n.end]=n;else if(n=r[l])if(delete r[n.start],n.unshift(t),n.start=a,o=i[a]){delete i[o.end];var u=o===n?n:o.concat(n);r[u.start=o.start]=i[u.end=n.end]=u}else r[n.start]=i[n.end]=n;else r[(n=[t]).start=a]=i[n.end=l]=n})),a(i,r),a(r,i),t.forEach((function(e){n[e<0?~e:e]||o.push([e])})),o}function a(e,t,n){var r=[];function i(e){var t=e<0?~e:e;(u[t]||(u[t]=[])).push({i:e,g:c})}function o(e){e.forEach(i)}function a(e){e.forEach(o)}function l(e){"GeometryCollection"===e.type?e.geometries.forEach(l):e.type in h&&(c=e,h[e.type](e.arcs))}if(arguments.length>1){var c,u=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};l(t),u.forEach(arguments.length<3?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)})}else for(var d=0,p=e.arcs.length;d<p;++d)r.push(d);return{type:"MultiLineString",arcs:s(e,r)}}function l(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function c(e,t){var n={},r=[],i=[];function a(e){e.forEach((function(t){t.forEach((function(t){(n[t=t<0?~t:t]||(n[t]=[])).push(e)}))})),r.push(e)}function l(t){return Math.abs(function(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++n<r;)t=i,i=e[n],o+=t[0]*i[1]-t[1]*i[0];return o/2}(o(e,{type:"Polygon",arcs:[t]}).coordinates[0]))}return t.forEach((function(e){"Polygon"===e.type?a(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(a)})),r.forEach((function(e){if(!e._){var t=[],r=[e];for(e._=1,i.push(t);e=r.pop();)t.push(e),e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].forEach((function(e){e._||(e._=1,r.push(e))}))}))}))}})),r.forEach((function(e){delete e._})),{type:"MultiPolygon",arcs:i.map((function(t){var r,i=[];if(t.forEach((function(e){e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].length<2&&i.push(e)}))}))})),(r=(i=s(e,i)).length)>1)for(var o,a,c=1,u=l(i[0]);c<r;++c)(o=l(i[c]))>u&&(a=i[0],i[0]=i[c],i[c]=a,u=o);return i}))}}function u(e,t){return e[1][2]-t[1][2]}e.version="1.6.27",e.mesh=function(e){return o(e,a.apply(this,arguments))},e.meshArcs=a,e.merge=function(e){return o(e,c.apply(this,arguments))},e.mergeArcs=c,e.feature=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return i(e,t)}))}:i(e,t)},e.neighbors=function(e){var t={},n=e.map((function(){return[]}));function i(e,n){e.forEach((function(e){e<0&&(e=~e);var r=t[e];r?r.push(n):t[e]=[n]}))}function o(e,t){e.forEach((function(e){i(e,t)}))}var s={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e,t){e.forEach((function(e){o(e,t)}))}};for(var a in e.forEach((function e(t,n){"GeometryCollection"===t.type?t.geometries.forEach((function(t){e(t,n)})):t.type in s&&s[t.type](t.arcs,n)})),t)for(var l=t[a],c=l.length,u=0;u<c;++u)for(var h=u+1;h<c;++h){var d,p=l[u],f=l[h];(d=n[p])[a=r(d,f)]!==f&&d.splice(a,0,f),(d=n[f])[a=r(d,p)]!==p&&d.splice(a,0,p)}return n},e.presimplify=function(e,r){var i=n(e.transform),o=function(e){if(!e)return t;var n,r,i=e.scale[0],o=e.scale[1],s=e.translate[0],a=e.translate[1];return function(e,t){t||(n=r=0);var l=Math.round((e[0]-s)/i),c=Math.round((e[1]-a)/o);e[0]=l-n,e[1]=c-r,n=l,r=c}}(e.transform),s=function(){var e={},t=[],n=0;function r(e,n){for(;n>0;){var r=(n+1>>1)-1,i=t[r];if(u(e,i)>=0)break;t[i._=n]=i,t[e._=n=r]=e}}function i(e,r){for(;;){var i=r+1<<1,o=i-1,s=r,a=t[s];if(o<n&&u(t[o],a)<0&&(a=t[s=o]),i<n&&u(t[i],a)<0&&(a=t[s=i]),s===r)break;t[a._=r]=a,t[e._=r=s]=e}}return e.push=function(e){return r(t[e._=n]=e,n++),n},e.pop=function(){if(!(n<=0)){var e,r=t[0];return--n>0&&(e=t[n],i(t[e._=0]=e,0)),r}},e.remove=function(e){var o,s=e._;if(t[s]===e)return s!==--n&&(u(o=t[n],e)<0?r:i)(t[o._=s]=o,s),s},e}();function a(e){s.remove(e),e[1][2]=r(e),s.push(e)}return r||(r=l),e.arcs.forEach((function(e){var t,n,l,c,u=[],h=0;for(n=0,l=e.length;n<l;++n)c=e[n],i(e[n]=[c[0],c[1],1/0],n);for(n=1,l=e.length-1;n<l;++n)(t=e.slice(n-1,n+2))[1][2]=r(t),u.push(t),s.push(t);for(n=0,l=u.length;n<l;++n)(t=u[n]).previous=u[n-1],t.next=u[n+1];for(;t=s.pop();){var d=t.previous,p=t.next;t[1][2]<h?t[1][2]=h:h=t[1][2],d&&(d.next=p,d[2]=t[2],a(d)),p&&(p.previous=d,p[0]=t[0],a(p))}e.forEach(o)})),e},Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){var r=n(1),i=n(9).WidgetView.extend({render:function(){this.set_projection(),this.listenTo(this.model,"attribute_changed",this.reset_scale)},set_projection:function(){this.path=r.geo.path().projection(this.model.projection),this.scale=this.model.projection},reset_scale:function(){this.set_projection(),this.trigger("domain_changed",null)}}),o=i.extend({}),s=i.extend({}),a=i.extend({}),l=i.extend({}),c=i.extend({}),u=i.extend({}),h=i.extend({});e.exports={GeoScale:i,Mercator:o,Albers:s,AlbersUSA:a,EquiRectangular:l,Orthographic:c,Gnomonic:u,Stereographic:h}},function(e,t,n){var r=n(1),i=n(0),o=n(70),s=o.ScaleModel.extend({defaults:function(){return i.extend(o.ScaleModel.prototype.defaults(),{_model_name:"GeoScaleModel",_view_name:"GeoScale"})}}),a=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"MercatorModel",_view_name:"Mercator",scale_factor:190,center:[0,60],rotate:[0,0]})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","rotate"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.mercator().center(this.get("center")).scale(this.get("scale_factor")).rotate(this.get("rotate")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),l=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"AlbersModel",_view_name:"Albers",scale_factor:250,center:[0,60],parallels:[29.5,45.5],precision:.1})},initialize:function(){l.__super__.initialize.apply(this,arguments),this.on_some_change(["rotate","center","parallels","scale_factor","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.albers().rotate(this.get("rotate")).center(this.get("center")).parallels(this.get("parallels")).scale(this.get("scale_factor")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),c=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"AlbersUSAModel",_view_name:"AlbersUSA",scale_factor:1200,translate:[600,490]})},initialize:function(){c.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","translate"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.albersUsa().scale(this.get("scale_factor")).translate(this.get("translate")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),u=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"EquiRectangularModel",_view_name:"EquiRectangular",scale_factor:145})},initialize:function(){u.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.equirectangular().center(this.get("center")).scale(this.get("scale_factor")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),h=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"OrthographicModel",_view_name:"Orthographic",scale_factor:145,center:[0,60],rotate:[0,0],clip_angle:90,precision:.1})},initialize:function(){h.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","clip_angle","rotate","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.orthographic().center(this.get("center")).scale(this.get("scale_factor")).clipAngle(this.get("clip_angle")).rotate(this.get("rotate")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),d=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"GnomonicModel",_view_name:"Gnomonic",scale_factor:145,center:[0,60],precision:.1,clip_angle:89.999})},initialize:function(){d.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","precision","clip_angle"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.gnomonic().clipAngle(this.get("clip_angle")).scale(this.get("scale_factor")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),p=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"StereographicModel",_view_name:"StereographicModel",scale_factor:245,center:[0,60],precision:.1,rotate:[96,0],clip_angle:179.9999})},initialize:function(){p.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","clip_angle","rotate","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.stereographic().scale(this.get("scale_factor")).rotate(this.get("rotate")).clipAngle(this.get("clip_angle")).center(this.get("center")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}});e.exports={GeoScaleModel:s,MercatorModel:a,AlbersModel:l,AlbersUSAModel:c,EquiRectangularModel:u,OrthographicModel:h,GnomonicModel:d,StereographicModel:p}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(201),a=n(202),l=n(203);l.__esModule&&(l=l.default);var c=s.Figure.extend({render:function(e){this.id=r.uuid();var t=String(this.model.get("layout").get("min_width")),n=String(this.model.get("layout").get("min_height")),i=this._get_height_width(n.slice(0,-2),t.slice(0,-2));this.width=i.width,this.height=i.height,this.scales={},this.set_top_el_style();var s=this;this.margin=this.model.get("map_margin"),this.num_rows=this.model.get("rows"),this.num_cols=this.model.get("cols"),this.row_groups=this.model.get("row_groups"),this.enable_select=this.model.get("enable_select"),this.update_data(),this.set_area_dimensions(this.data.length),this.model.get("theme")&&this.svg.classed(this.model.get("theme"),!0),this.fig=this.svg.append("g").attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.fig_map=this.fig.append("g"),this.fig_axes=this.fig.append("g"),this.fig_click=this.fig.append("g"),this.fig_hover=this.fig.append("g"),this.fig_names=this.fig.append("g").style("display",this.model.get("show_groups")?"inline":"none"),this.fig_map.classed("g-map",!0),this.fig_axes.classed("g-axes",!0),this.fig_click.classed("g-click",!0),this.fig_hover.classed("g-hover",!0),this.fig_names.classed("g-names",!0),this.axis=[],this.tooltip_div=o.select(document.createElement("div")).attr("class","mark_tooltip").style("opacity",0).style("pointer-events","none"),this.popper_reference=new a.ElementReference(this.svg.node()),this.popper=new l(this.popper_reference,this.tooltip_div.node(),{placement:"auto"}),this.update_default_tooltip(),this.selected_stroke=this.model.get("selected_stroke"),this.hovered_stroke=this.model.get("hovered_stroke"),this.update_plotarea_dimensions(),this.title=this.fig.append("text").attr("class","mainheading").attr({x:.5*this.plotarea_width,y:-this.margin.top/2,dy:"1em"}).text(this.model.get("title")).style(this.model.get("title_style")),this.create_scale_views().then((function(){s.create_listeners(),s.axis_views=new r.ViewList(s.add_axis,null,s),s.axis_views.update(s.model.get("axes")),s.model.on("change:axes",(function(e,t,n){s.axis_views.update(t)}))})),this.displayed.then((function(){document.body.appendChild(s.tooltip_div.node()),s.relayout(),s.draw_group_names(),s.create_tooltip_widget()}))},set_top_el_style:function(){this.el.style["user-select"]="none",this.el.style["ms-user-select"]="none",this.el.style["moz-user-select"]="none",this.el.style["khtml-user-select"]="none",this.el.style["webkit-user-select"]="none"},update_plotarea_dimensions:function(){this.plotarea_width=this.width-this.margin.left-this.margin.right,this.plotarea_height=this.height-this.margin.top-this.margin.bottom,this.column_width=parseFloat((this.plotarea_width/this.num_cols).toFixed(2)),this.row_height=parseFloat((this.plotarea_height/this.num_rows).toFixed(2))},reset_drawing_controls:function(){this.prev_x=0,this.prev_y=-1,this.y_direction=1,this.x_direction=1,this.group_iter=1},create_listeners:function(){this.listenTo(this.model,"change:scales",this.create_scale_views,this),this.listenTo(this.model,"change:color",this.recolor_chart,this),this.listenTo(this.model,"change:colors",this.colors_updated,this),this.listenTo(this.model,"change:show_groups",this.show_groups,this),this.listenTo(this.model,"change:selected_stroke",this.update_selected_stroke,this),this.listenTo(this.model,"change:hovered_stroke",this.update_hovered_stroke,this),this.listenTo(this.model,"change:font_style",this.update_font_style,this),this.model.on_some_change(["title","title_style"],this.update_title,this),this.listenTo(this.model,"change:selected",(function(){this.clear_selected(),this.apply_selected()}),this),this.model.on_some_change(["names","groups","ref_data"],(function(){this.update_data(),this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:rows",(function(e,t){this.num_rows=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:cols",(function(e,t){this.num_cols=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:row_groups",(function(e,t){this.row_groups=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:tooltip_widget",this.create_tooltip_widget,this),this.listenTo(this.model,"change:tooltip_fields",this.update_default_tooltip,this),this.listenTo(this.model,"change:tooltip_formats",this.update_default_tooltip,this)},update_title:function(e,t){this.title.text(this.model.get("title")).style(this.model.get("title_style"))},relayout:function(){var e=this,t=this._get_height_width(this.el.clientHeight,this.el.clientWidth);this.width=t.width,this.height=t.height,window.requestAnimationFrame((function(){e.margin=e.model.get("map_margin"),e.update_plotarea_dimensions(),e.fig.attr("transform","translate("+e.margin.left+","+e.margin.top+")"),e.title.attr({x:.5*e.plotarea_width,y:-e.margin.top/2,dy:"1em"}),e.draw_map(),e.clear_selected(),e.apply_selected(),e.fig_hover.selectAll("rect").remove(),e.hide_tooltip(),e.trigger("margin_updated")}))},update_data:function(){var e=this;this.data=this.model.get_typed_field("names"),this.ref_data=this.model.get("ref_data"),this.group_data=this.model.get_typed_field("groups"),this.groups=i.uniq(this.group_data,!0);var t=this.model.get_typed_field("display_text");t=void 0===t||0===t.length?this.data:t,this.colors=this.model.get("colors");var n=this.colors.length;this.colors_map=function(t){return e.get_color(t,n)};var r=this.model.get_typed_field("color"),o=this.data.map((function(n,i){return{display:t[i],name:n,color:r[i],group:e.group_data[i],ref_data:null===e.ref_data||void 0===e.ref_data?null:e.ref_data[i]}}));this.update_domains(),this.grouped_data=i.groupBy(o,(function(t,n){return e.group_data[n]})),this.groups=[],this.running_sums=[],this.running_sums[0]=0;var s=0;for(var a in this.grouped_data)this.groups.push(a),s+=this.grouped_data[a].length,this.running_sums.push(s);this.running_sums.pop()},update_domains:function(){var e=this.model.get("scales").color,t=this.model.get_typed_field("color");e&&t.length>0&&e.compute_and_set_domain(t,this.model.model_id)},set_area_dimensions:function(e){this.num_rows=this.model.get("rows"),this.num_cols=this.model.get("cols"),this.row_groups=this.model.get("row_groups"),void 0!==this.num_cols&&null!==this.num_cols&&0!==this.num_cols?(this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(e/this.num_cols),this.num_rows=e%this.num_cols==0?this.num_rows:this.num_rows+1):void 0!==this.num_rows&&null!==this.num_rows&&0!==this.num_rows?(this.num_cols=Math.floor(e/this.num_rows),this.num_cols=e%this.num_rows==0?this.num_cols:this.num_cols+1,this.row_groups>1&&this.num_cols%2==0&&this.num_cols++):(this.num_cols=Math.floor(Math.sqrt(e)),this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(e/this.num_cols),this.num_rows=e%this.num_cols==0?this.num_rows:this.num_rows+1),this.row_groups=Math.min(this.row_groups,this.num_rows),1==this.row_groups&&(this.num_cols=Math.floor(e/this.num_rows),this.num_cols=e%this.num_rows==0?this.num_cols:this.num_cols+1),this.set_row_limits()},compute_dimensions_and_draw:function(){this.set_area_dimensions(this.data.length),this.update_plotarea_dimensions(),this.draw_map(),this.clear_selected(),this.apply_selected(),this.fig_hover.selectAll("rect").remove(),this.hide_tooltip()},update_default_tooltip:function(){this.tooltip_fields=this.model.get("tooltip_fields");var e=this.model.get("tooltip_formats");this.tooltip_formats=this.tooltip_fields.map((function(t,n){var r=e[n];return void 0===r||""===r?function(e){return e}:o.format(r)}))},create_scale_views:function(){for(var e in this.scales)this.stopListening(this.scales[e]);var t=this.model.get("scales"),n=this,o={};return i.each(t,(function(e,t){o[t]=n.create_child_view(e)})),r.resolvePromisesDict(o).then((function(e){n.scales=e,n.set_scales()}))},set_scales:function(){var e=this,t=this.scales.color;t&&(t.set_range(),t.on("color_scale_range_changed",e.update_map_colors,e),this.update_domains(),this.listenTo(t,"domain_changed",(function(){e.update_map_colors()})),this.update_map_colors())},show_groups:function(e,t){this.fig_names.style("display",t?"inline":"none"),this.fig_map.selectAll(".market_map_text").style("opacity",t?.2:1),this.fig_map.selectAll(".market_map_rect").style("stroke-opacity",t?.2:1)},draw_map:function(){this.reset_drawing_controls(),this.fig_map.selectAll(".element_group").remove(),this.fig_names.selectAll(".names_object").remove(),this.rect_groups=this.fig_map.selectAll(".element_group").data(this.groups);var e=this.scales.color,t=this;this.rect_groups.enter().append("g").attr("class","element_group").attr("transform",(function(e,n){return t.get_group_transform(n)})),this.rect_groups.exit().remove(),this.end_points=[],this.rect_groups[0].forEach((function(n,r){var i=t.grouped_data[t.groups[r]],s=(t.colors_map(r),t.get_new_cords()),a=t.get_end_points(s[2],i.length,s[0],s[1],s[3],s[4]);a.forEach((function(e){t.end_points.push(e)}));var l=t.running_sums[r],c=o.select(n).selectAll(".rect_element").data(i),u=c.enter().append("g").classed("rect_element",!0);u.append("rect").attr("x",0).attr("y",0).classed("market_map_rect",!0),u.append("text").classed("market_map_text",!0).style({"text-anchor":"middle",fill:"black","pointer-events":"none"}).style(t.model.get("font_style")),c.attr("transform",(function(e,n){return t.get_cell_transform(n)})).on("click",(function(e,n){t.cell_click_handler(e,l+n,this)})).on("mouseover",(function(e,n){t.mouseover_handler(e,l+n,this)})).on("mousemove",(function(e){t.mousemove_handler(e)})).on("mouseout",(function(e,n){t.mouseout_handler(e,l+n,this)})).attr("class",(function(e,t){return o.select(this).attr("class")+" rect_"+(l+t)})).attr("id",(function(e){return"market_map_element_"+e.name})),c.selectAll(".market_map_rect").attr("width",t.column_width).attr("height",t.row_height).style("stroke-opacity",t.model.get("show_groups")?.2:1).style({stroke:t.model.get("stroke"),fill:function(n,i){return e&&void 0!==n.color&&null!==n.color?e.scale(n.color):t.colors_map(r)}}),c.selectAll(".market_map_text").attr("x",t.column_width/2).attr("y",t.row_height/2).text((function(e,t){return e.display})).style("opacity",t.model.get("show_groups")?.2:1),c.exit().remove();t.create_bounding_path(n,a);var h=o.min(a,(function(e){return e.x})),d=o.min(a,(function(e){return e.y}));t.fig_names.append("foreignObject").attr("class","names_object").attr("x",h).attr("y",d).append("xhtml:div").attr("class","names_div").style({display:"flex","flex-direction":"row","align-content":"center","align-items":"center",width:"100%",height:"100%","justify-content":"center","word-wrap":"break-word",font:"24px sans-serif",color:"black"}).text(t.groups[r])})),this.draw_group_names()},draw_group_names:function(){var e=this.svg.selectAll(".bounding_path")[0].map((function(e){return e.getBoundingClientRect()}));this.fig_names.selectAll(".names_object").data(e).attr("width",(function(e){return e.width})).attr("height",(function(e){return e.height}))},recolor_chart:function(){var e=this;this.update_data(),this.rect_groups=this.fig.selectAll(".element_group").data(this.groups);var t=this.scales.color;this.rect_groups[0].forEach((function(n,r){var i=e.grouped_data[e.groups[r]];e.colors_map(r),o.select(n).selectAll(".rect_element").data(i).select("rect").style({stroke:e.model.get("stroke"),fill:function(n,i){return t&&void 0!==n.color&&null!==n.color?t.scale(n.color):e.colors_map(r)}})}))},update_font_style:function(e,t){this.svg.selectAll(".market_map_text").style(t)},update_map_colors:function(){var e=this,t=this.scales.color;void 0!==this.rect_groups&&null!==this.rect_groups&&this.rect_groups[0].forEach((function(n,r){var i=e.grouped_data[e.groups[r]];e.colors_map(r),o.select(n).selectAll(".rect_element").data(i).select("rect").style({stroke:e.model.get("stroke"),fill:function(n,i){return t&&void 0!==n.color&&null!==n.color?t.scale(n.color):e.colors_map(r)}})}))},cell_click_handler:function(e,t,n){if(this.model.get("enable_select")){var r=this.model.get("selected").slice(),i=r.indexOf(e.name),s=o.select(n).attr("id");if(-1==i){r.push(e.name);var a=o.select(n).attr("transform");this.add_selected_cell(s,a)}else this.fig_click.select("#click_"+s).remove(),r.splice(i,1);this.model.set("selected",r),this.touch()}},apply_selected:function(){var e=this.model.get("selected"),t=this;null==e||0===e.length?this.clear_selected():e.forEach((function(e){var n="market_map_element_"+e;if(t.fig_click.select("#click_"+n).remove(),1==t.fig_map.selectAll("#"+n)[0].length){var r=t.fig_map.selectAll("#"+n).attr("transform");t.add_selected_cell(n,r)}}))},clear_selected:function(){this.fig_click.selectAll("rect").remove()},add_selected_cell:function(e,t){this.fig_click.append("rect").attr("id","click_"+e).attr("transform",t).attr("x",0).attr("y",0).attr("width",this.column_width).attr("height",this.row_height).style({stroke:this.selected_stroke,"stroke-width":"4px",fill:"none"})},mouseover_handler:function(e,t,n){var r=o.select(n).attr("transform");this.model.get("enable_hover")&&(this.fig_hover.append("rect").attr("class","hover_"+t).attr("transform",r).attr("x",0).attr("y",0).attr("width",this.column_width).attr("height",this.row_height).style({stroke:this.hovered_stroke,"stroke-width":"3px",fill:"none","pointer-events":"none"}),this.show_tooltip(o.event,e),this.send({event:"hover",data:e.name,ref_data:e.ref_data}))},update_selected_stroke:function(e,t){this.selected_stroke=t;this.fig_click.selectAll("rect").style({stroke:t})},update_hovered_stroke:function(e,t){this.hovered_stroke=t},mouseout_handler:function(e,t,n){this.fig_hover.select(".hover_"+t).remove(),this.hide_tooltip()},show_tooltip:function(e,t){o.mouse(this.el);var n=this;if(this.tooltip_view||this.tooltip_fields&&0!=this.tooltip_fields.length){var r=this.tooltip_div;r.transition().style("opacity",.9).style("display",null),this.move_tooltip(),r.select("table").remove();var i=t.ref_data;if(!this.tooltip_view){var s=r.append("table").selectAll("tr").data(this.tooltip_fields);s.exit().remove();var a=s.enter().append("tr");a.append("td").attr("class","tooltiptext").text((function(e){return e})),a.append("td").attr("class","tooltiptext").text((function(e,t){return null==i?null:n.tooltip_formats[t](i[e])}))}this.popper.enableEventListeners(),this.move_tooltip()}},mousemove_handler:function(e){this.move_tooltip(e)},move_tooltip:function(e){this.popper_reference.x=o.event.clientX,this.popper_reference.y=o.event.clientY,this.popper.scheduleUpdate()},hide_tooltip:function(){this.tooltip_div.style("pointer-events","none"),this.tooltip_div.transition().style("opacity",0).style("display","none"),this.popper.disableEventListeners()},create_tooltip_widget:function(){var e=this.model.get("tooltip_widget");null!==this.tooltip_view&&void 0!==this.tooltip_view&&(this.tooltip_view.remove(),this.tooltip_view=null);var t=this;e&&this.create_child_view(e).then((function(e){t.tooltip_view=e,t.tooltip_div.node().appendChild(e.el),e.trigger("displayed",{add_to_dom_only:!0})}))},get_group_transform:function(e){return"translate(0, 0)"},get_cell_transform:function(e){return this.past_border_y()?this.prev_y+=this.y_direction:this.past_border_x()?(this.y_direction=-1*this.y_direction,this.prev_x+=this.x_direction):(this.x_direction=-1*this.x_direction,this.prev_y+=this.y_direction,this.group_iter+=1),"translate("+this.prev_x*this.column_width+", "+this.prev_y*this.row_height+")"},get_new_cords:function(){var e=this.prev_x,t=this.prev_y,n=this.y_direction,r=this.x_direction,i=this.group_iter;return this.past_border_y()?t+=this.y_direction:this.past_border_x()?(n=-1*this.y_direction,e+=this.x_direction):(r=-1*this.x_direction,t+=this.y_direction,i+=1),[e,t,i,r,n,e*this.column_width,t*this.row_height]},past_border_y:function(){return 1==this.y_direction?this.prev_y+1<this.row_limits[this.group_iter]:this.prev_y-1>this.row_limits[this.group_iter-1]-1},past_border_x:function(){return 1==this.x_direction?this.prev_x+1<this.num_cols:this.prev_x-1>-1},colors_updated:function(){this.colors=this.model.get("colors"),this.recolor_chart()},get_color:function(e,t){return this.colors[e%t]},set_row_limits:function(){var e=Math.floor(this.num_rows/this.row_groups);this.row_limits=[];for(var t=this.row_groups-1;t>-1;t--)this.row_limits.unshift(t*e);this.row_limits[this.row_groups]=this.num_rows},get_end_points:function(e,t,n,r,i,o){var s,a=this.row_limits[e-1],l=this.row_limits[e],c=!1,u=i,h=o,d=[],p=1==h?l-r:r-a+1,f=1==u?this.num_cols-1-n:n,g=t,m=l-a;if(0!==g){this.calc_end_point_source(n,r,u,h).forEach((function(e){d.push(e)}));var _=Math.min(p,g);if(_===g)return this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),s=r+(g-1)*h,this.calc_end_point_dest(n,s,-1*u,h).forEach((function(e){d.push(e)})),this.calc_end_point_dest(n,s,u,h).forEach((function(e){d.push(e)})),d;if(g-=_,0===f?this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})):p!==l-a?(this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),g>m&&this.calc_end_point_dest(n+u,1==h?a:l-1,-1*u,-1*h).forEach((function(e){d.push(e)}))):g<m&&this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),r+=h*(_-1),this.calc_end_point_dest(n,r,-1*u,h).forEach((function(e){d.push(e)})),0===g)return this.calc_end_point_dest(n,r,u,h).forEach((function(e){d.push(e)})),d;0!==f&&g>m&&(n+=u)}for(;g>m;){var v;if(m*f<g){var y=g-(v=f)*m;v+=Math.floor(y/(this.row_limits[e+1]-this.row_limits[e]))}else v=Math.floor(g/m);v>f?(n=1===u?this.num_cols-1:0,0!==f&&this.calc_end_point_dest(n,a,u,-1).forEach((function(e){d.push(e)})),v=f,f=this.num_cols,e+=1,a=l,l=this.row_limits[e],r=a,u*=-1,h=Math.pow(-1,v)*h*-1,this.calc_end_point_dest(n,l-1,-1*u,1).forEach((function(e){d.push(e)}))):v===f?(n=1===u?this.num_cols-1:0,0!==f&&this.calc_end_point_dest(n,a,u,-1).forEach((function(e){d.push(e)})),v=f,f=this.num_cols,(e+=1)<this.row_limits.length?(a=l,l=this.row_limits[e],r=a,u*=-1,h=Math.pow(-1,v)*h*-1,c=!0):(h=1,u=1)):(r=1===(h=Math.pow(-1,v)*h)?a:l-1,n+=u*(v-1),this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)}))),g-=v*m,m=l-a}return 0===g?(r=1===h?l-1:a,u=c?-1*u:u,this.calc_end_point_dest(n,r,u,h).forEach((function(e){d.push(e)}))):(r=1===(h*=-1)?a:l-1,n=c?n:n+u,this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),s=r+(g-1)*h,this.calc_end_point_dest(n,s,u,h).forEach((function(e){d.push(e)})),this.calc_end_point_dest(n,s,-1*u,h).forEach((function(e){d.push(e)}))),d},create_bounding_path:function(e,t){t[0].x,t[0].y;var n=[],r=t.slice();n.push(t[0]),r.splice(0,1);for(var i=["x","y"],s=0,a=i[s%2],l=i[(s+1)%2],c=n[0],u=c[a],h=c[l],d=2*r.length,p=0;r.length>1&&d>0;){var f=r.filter((function(e){return e[a]==u}));if(f.length>0){s++;var g=o.min(f,(function(e){return e[l]})),m=o.max(f,(function(e){return e[l]}));if(g<h&&m>h)if("y"==a)p=1==this.x_direction?m:g;else{var _=f.filter((function(e){return e[l]<h})),v=f.filter((function(e){return e[l]>h}));p=1==_.length?g:1==v.length?m:o.max(_,(function(e){return e[l]}))}else p=g>h?g:m;r.filter((function(e){return e[a]==u&&e[l]==p})).forEach((function(e){r.splice(r.indexOf(e),1)}));var y={};y[a]=u,y[l]=p,n.push(y)}else p=h;var b=a;a=l,l=b,h=u,u=p,d--}r.length>0&&n.push(r[0]),n.push(t[0]);var w=o.svg.line().interpolate("linear").x((function(e){return e.x})).y((function(e){return e.y}));return o.select(e).append("path").attr("class","bounding_path").attr("d",(function(){return w(n)})).attr("fill","none").style("stroke",this.model.get("group_stroke")).style("stroke-width",3)},calc_end_point_source:function(e,t,n,r){return t=1==r?t:t+1,[{x:(e=1==n?e:e+1)*this.column_width,y:t*this.row_height}]},calc_end_point_dest:function(e,t,n,r){return t=-1==r?t:t+1,[{x:(e=-1==n?e:e+1)*this.column_width,y:t*this.row_height}]}});e.exports={MarketMap:c}},function(e,t,n){var r=n(1),i=n(0),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.anchor_style=this.model.get("anchor_style"),this.display_el_classes=["heatmapcell"],e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.row;if(e){var t=this.parent.padded_range("y",e.model);e.set_range(t)}var n=this.scales.column;n&&n.set_range(this.parent.padded_range("x",n.model))},set_positional_scales:function(){var e=this.scales.column,t=this.scales.row;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},expand_scale_domain:function(e,t,n,i){var o,s;if("expand_one"===n){var a=(o=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return e-o[t]}));s=0,a[0]<0?(i=!i,s=r.max(a)):s=r.min(a);var l=0;return i?(l=o[o.length-1]+s,[t[0],e.invert(l)]):(l=o[0]-s,[e.invert(l),t[o.length-1]])}if("expand_two"===n){o=t.map((function(t){return e.scale(t)})),s=r.min(o.slice(1).map((function(e,t){return e-o[t]})));var c=o[o.length-1]+s,u=o[0]-s;return[e.invert(u),e.invert(c)]}},create_listeners:function(){s.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:opacity",this.update_opacity,this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")})),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions)},click_handler:function(e){e.data;var t=this.model.colors[0].length,n=e.row_num*t+e.column_num,s=e.row_num,a=e.column_num,l=this,c=this.model.get("selected")?o.deepCopy(this.model.get("selected")):[],u=o.deepCopy(this._cell_nums_from_indices(c)),h=u.indexOf(n),d=r.event.ctrlKey||r.event.metaKey;if(h>-1&&d)c.splice(h,1);else if(d||(u=[],c=[]),c.push([s,a]),u.push(l._cell_nums_from_indices([[s,a]])[0]),r.event.shiftKey){if(h>-1)return;var p=0!==u.length?l.anchor_cell_index[0]:s,f=0!==u.length?l.anchor_cell_index[1]:a;i.range(Math.min(s,p),Math.max(s,p)+1).forEach((function(e){i.range(Math.min(a,f),Math.max(a,f)+1).forEach((function(t){var n=l._cell_nums_from_indices([[e,t]])[0];-1===u.indexOf(n)&&(u.push(n),c.push([e,t]))}))}))}else this.anchor_cell_index=[s,a];this.model.set("selected",0===c.length?null:c,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var g=r.event;void 0!==g.cancelBubble&&(g.cancelBubble=!0),g.stopPropagation&&g.stopPropagation(),g.preventDefault(),this.selected_indices=c,this.apply_styles()},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},set_style_on_elements:function(e,t,n){t&&(0!==t.length||n&&0!==n.length)&&0!==Object.keys(e).length&&(n=n&&0!==n.length?n:this._filter_cells_by_index(t)).style(e)},set_default_style:function(e,t){if(e&&(0!==e.length||t&&0!==t.length)){t=t&&0!==t.length?t:this._filter_cells_by_index(e);var n=this.model.get("stroke"),r=this.model.get("opacity"),i=this;t.style("fill",(function(e){return i.get_element_fill(e)})).style("opacity",r).style("stroke",n)}},clear_style:function(e,t,n){if(0!==Object.keys(e).length){n&&0!==n.length||(n=t?this._filter_cells_by_index(t):this.display_cells);var r={};for(var i in e)r[i]=null;n.style(r)}},_filter_cells_by_cell_num:function(e){return null==e?[]:this.display_cells.filter((function(t){return-1!==e.indexOf(t._cell_num)}))},selected_style_updated:function(e,t){this.selected_style=t,this.clear_style(e.previous("selected_style"),this.selected_indices,this.selected_elements),this.style_updated(t,this.selected_indices,this.selected_elements)},unselected_style_updated:function(e,t){this.unselected_style=t,this.clear_style(e.previous("unselected_style"),[],this.unselected_elements),this.style_updated(t,[],this.unselected_elements)},apply_styles:function(){var e=this.model.colors.length,t=this.model.colors[0].length;this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells);var n=this._cell_nums_from_indices(this.selected_indices),r=null===n?[]:i.difference(i.range(e*t),n);if(this.selected_elements=this._filter_cells_by_cell_num(n),this.set_style_on_elements(this.selected_style,this.selected_indices,this.selected_elements),this.unselected_elements=this._filter_cells_by_cell_num(r),this.set_style_on_elements(this.unselected_style,[],this.unselected_elements),null!==this.anchor_cell_index&&void 0!==this.anchor_cell_index){var o=this._cell_nums_from_indices([this.anchor_cell_index]);this.anchor_element=this._filter_cells_by_cell_num(o),this.set_style_on_elements(this.anchor_style,[],this.anchor_element)}},style_updated:function(e,t,n){this.set_default_style(t,n),this.set_style_on_elements(e,t,n)},reset_selection:function(){this.model.set("selected",null),this.touch(),this.selected_indices=null,this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells)},relayout:function(){this.set_ranges(),this.compute_view_padding(),this.draw()},_cell_nums_from_indices:function(e){if(null==e)return null;var t=this.model.colors[0].length;return e.map((function(e){return e[0]*t+e[1]}))},invert_point:function(e){},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=i.range(this.model.colors[0].length),r=i.range(this.model.colors.length),o=this,s=i.filter(n,(function(e){return t([o.column_pixels[e],[]])})),a=i.filter(r,(function(e){return t([[],o.row_pixels[e]])})),l=s.map((function(e){return a.map((function(t){return[t,e]}))}));l=i.flatten(l,!0),this.model.set("selected",l),this.touch()},draw:function(){this.set_ranges();var e,t=this,n=this.model.colors.length,o=this.model.colors[0].length,s=this.scales.row,a=this.scales.column,l="start"===this.model.get("row_align"),c="start"===this.model.get("column_align");"middle"!==this.model.modes.row&&"boundaries"!==this.model.modes.row&&(e=this.expand_scale_domain(s,this.model.rows,this.model.modes.row,l),(r.min(e)<r.min(s.model.domain)||r.max(e)>r.max(s.model.domain))&&s.model.compute_and_set_domain(e,s.model.model_id)),"middle"!==this.model.modes.column&&"boundaries"!==this.model.modes.column&&(e=this.expand_scale_domain(a,this.model.columns,this.model.modes.column,c),(r.min(e)<r.min(a.model.domain)||r.max(e)>r.max(a.model.domain))&&a.model.compute_and_set_domain(e,a.model.model_id));var u=this.get_tile_plotting_data(s,this.model.rows,this.model.modes.row,l),h=this.get_tile_plotting_data(a,this.model.columns,this.model.modes.column,c);this.row_pixels=u.start.map((function(e,t){return[e,e+u.widths[t]]})),this.column_pixels=h.start.map((function(e,t){return[e,e+h.widths[t]]})),this.display_rows=this.d3el.selectAll(".heatmaprow").data(i.range(n)),this.display_rows.enter().append("g").attr("class","heatmaprow"),this.display_rows.attr("transform",(function(e){return"translate(0, "+u.start[e]+")"}));var d=i.range(o),p=i.range(n).map((function(e){return d.map((function(n){return t.model.mark_data[e*o+n]}))}));this.display_cells=this.display_rows.selectAll(".heatmapcell").data((function(e,t){return p[t]})),this.display_cells.enter().append("rect").attr("class","heatmapcell").on("click",i.bind((function(){this.event_dispatcher("element_clicked")}),this));var f=this.model.get("stroke"),g=this.model.get("opacity");this.display_cells.attr({x:function(e,t){return h.start[t]},y:0}).attr("width",(function(e,t){return h.widths[t]})).attr("height",(function(e){return u.widths[e.row_num]})).style("fill",(function(e){return t.get_element_fill(e)})).style({stroke:f,opacity:g}),this.display_cells.on("click",(function(e,n){return t.event_dispatcher("element_clicked",{data:e.color,index:n,row_num:e.row_num,column_num:e.column_num})}))},update_stroke:function(e,t){this.display_cells.style("stroke",t)},update_opacity:function(e,t){this.display_cells.style("opacity",t)},get_tile_plotting_data:function(e,t,n,i){var o,s=[],a=[];if("middle"===n)return s=t.map((function(t){return e.scale(t)})),a=t.map((function(t){return e.scale.rangeBand()})),{start:s,widths:a};if("boundaries"===n){var l=t.map((function(t){return e.scale(t)}));a=[];for(var c=1;c<l.length;++c)a[c-1]=Math.abs(l[c]-l[c-1]);return{start:s=l[1]>l[0]?l.slice(0,-1):l.slice(1),widths:a}}if("expand_one"===n)return i?(a=(s=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return Math.abs(e-s[t])})),o=r.max(e.scale.range()),a=s[0]<s[1]?Array.prototype.concat(a,[Math.abs(o-r.max(s))]):Array.prototype.concat([Math.abs(o-r.max(s))],a)):(a=(s=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return Math.abs(e-s[t])})),o=r.min(e.scale.range()),o=r.min(e.scale.range()),s[1]>s[0]?(s.splice(0,0,Math.abs(0,0,o)),a.splice(0,0,s[1]-s[0]),s.splice(-1,1)):(a=Array.prototype.concat(a,[Math.abs(o-s.slice(-1)[0])]),(s=Array.prototype.concat(s,o)).splice(0,1))),{widths:a,start:s};if("expand_two"===n){var u=(s=t.map((function(t){return e.scale(t)})))[1]-s[0]>0,h=u?r.min(e.scale.range()):r.max(e.scale.range());return s.splice(0,0,h),a=s.slice(1).map((function(e,t){return Math.abs(e-s[t])})),h=u?r.max(e.scale.range()):r.min(e.scale.range()),a[a.length]=Math.abs(h-s.slice(-1)[0]),{start:s,widths:a}}},get_element_fill:function(e){return null===e.color?this.model.get("null_color"):this.scales.color.scale(e.color)},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"==e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover())}});e.exports={GridHeatMap:s}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(28),a="^"+n(21).version,l=s.BaseModel.extend({defaults:function(){return i.extend(s.BaseModel.prototype.defaults(),{_model_name:"MarketMapModel",_view_name:"MarketMap",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:a,_view_module_version:a,map_width:1080,map_height:800,names:[],groups:[],display_text:[],ref_data:void 0,title:"",tooltip_fields:[],tooltip_formats:[],show_groups:!1,cols:0,rows:0,row_groups:1,colors:o.scale.category20().range(),scales:{},axes:[],color:[],map_margin:{top:50,right:50,left:50,bottom:50},preserve_aspect:!1,stroke:"white",group_stroke:"black",selected_stroke:"dodgerblue",hovered_stroke:"orangered",font_style:{},title_style:{},selected:[],enable_hover:!0,enable_select:!0,tooltip_widget:null})}},{serializers:i.extend({scales:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},tooltip_widget:{deserialize:r.unpack_models},style:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models}},s.BaseModel.serializers)});e.exports={MarketMapModel:l}},function(e,t,n){var r=n(1),i=n(0),o=(n(13),n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.image=r.select(this.el).append("image").classed("heatmap",!0).attr("width",this.parent.width).attr("height",this.parent.height),this.canvas=document.createElement("canvas"),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.x;if(e){var t=this.parent.padded_range("x",e.model);e.set_range(t)}var n=this.scales.y;n&&n.set_range(this.parent.padded_range("y",n.model))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.draw()})),e.on("color_scale_range_changed",this.draw,this))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")})),this.listenTo(this.model,"change:interactions",this.process_interactions)},click_handler:function(e){},process_interactions:function(e){},relayout:function(){this.set_ranges(),this.compute_view_padding(),this.draw()},draw_canvas:function(){this.image.attr("href",this.canvas.toDataURL("image/png"))},draw:function(){this.set_ranges();var e=this,t=this.get_x_plotting_data(this.model.mark_data.x),n=this.get_y_plotting_data(this.model.mark_data.y);this.canvas.setAttribute("width",t.total_width),this.canvas.setAttribute("height",n.total_height);var r=this.canvas.getContext("2d");this.model.mark_data.color.forEach((function(i,o){var s=n.heights[o],a=n.start[o];i.forEach((function(n,i){var o=t.widths[i],l=t.start[i];r.fillStyle=e.get_element_fill(n),r.fillRect(l,a,o+.5,s+.5)}))})),this.image.attr("width",t.total_width).attr("height",n.total_height).attr("x",t.x0).attr("y",n.y0),this.draw_canvas()},get_x_plotting_data:function(e){var t=e.map(this.scales.x.scale),n=this.get_x_padding(t),r=e.length,i=t.map((function(e,i){return 0==i?.5*(t[1]-e)+n.left:i==r-1?.5*(e-t[i-1])+n.right:.5*(t[i+1]-t[i-1])})),o=t[0]-n.left,s=t.map((function(e,n){return 0==n?0:.5*(e+t[n-1])-o}));return{widths:i,total_width:t[r-1]-t[0]+n.left+n.right,start:s,x0:o}},get_x_padding:function(e){var t=e.length;return{left:.5*(e[1]-e[0]),right:.5*(e[t-1]-e[t-2])}},get_y_plotting_data:function(e){var t=e.map(this.scales.y.scale),n=this.get_y_padding(t),r=e.length,i=t.map((function(e,i){return 0==i?.5*-(t[1]-e)+n.bottom:i==r-1?.5*-(e-t[i-1])+n.top:.5*-(t[i+1]-t[i-1])})),o=t[r-1]-n.top,s=t.map((function(e,n){return n==r-1?0:.5*(e+t[n+1])-o}));return{heights:i,total_height:t[0]-t[r-1]+n.top+n.bottom,start:s,y0:o}},get_y_padding:function(e){var t=e.length;return{bottom:.5*-(e[1]-e[0]),top:.5*-(e[t-1]-e[t-2])}},get_element_fill:function(e){return null===e?this.model.get("null_color"):this.scales.color.scale(e)}}));e.exports={HeatMap:o}},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:r.extend({},i.MarkModel.prototype.defaults,{_model_name:"HeatMapModel",_view_name:"HeatMap",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},null_color:"black"}),initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0,this.mark_data={x:this.get_typed_field("x"),y:this.get_typed_field("y"),color:this.get_typed_field("color")},this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color,i=[].concat.apply([],this.mark_data.color);this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.x,this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(i,this.model_id+"_color"))}},get_data_dict:function(e,t){return e}});e.exports={HeatMapModel:o}},function(e,t,n){var r=n(9),i=n(0),o="^"+n(21).version,s=r.DOMWidgetModel.extend({defaults:function(){return i.extend(r.DOMWidgetModel.prototype.defaults(),{_model_name:"ToolbarModel",_view_name:"Toolbar",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o,_view_module_version:o,figure:void 0,_panning:!1,_panzoom:null})},panzoom:function(){var e=this.get("figure");if(this.get("_panning"))e&&(e.set("interaction",this.cached_interaction),e.save_changes()),this.set("_panning",!1),this.save_changes();else{if(e){this.cached_interaction=e.get("interaction");var t=this,n=this.get("_panzoom");n?(e.set("interaction",n),e.save_changes()):this._create_panzoom_model(e).then((function(n){t.set("_panzoom",n),t.save_changes(),e.set("interaction",n),e.save_changes()}))}this.set("_panning",!0),this.save_changes()}},reset:function(){var e=this.get("figure");this.get("_panning");if(e){e.set("interaction",this.cached_interaction),e.save_changes();var t=this.get("_panzoom");t.reset_scales(),t.close(),this.set("_panzoom",null),this.set("_panning",!1),this.save_changes()}},save_png:function(){var e=this.get("figure");e&&e.save_png()},_create_panzoom_model:function(e){return this.widget_manager.new_widget({model_name:"PanZoomModel",model_module:"bqplot",model_module_version:e.get("_model_module_version"),view_name:"PanZoom",view_module:"bqplot",view_module_version:e.get("_view_module_version")}).then((function(t){return Promise.all(e.get("marks")).then((function(e){for(var n=[],r=[],o=0;o<e.length;++o){var s=e[o].get("preserve_domain"),a=e[o].get("scales");i.each(a,(function(t,i){var l=e[o].get("scales_metadata")[i].dimension;"x"!==l||s[i]||n.push(a[i]),"y"!==l||s[i]||r.push(a[i])}))}return t.set("scales",{x:n,y:r}),t.save_changes(),t}))}))}},{serializers:i.extend({figure:{deserialize:r.unpack_models},_panzoom:{deserialize:r.unpack_models}},r.DOMWidgetModel.serializers)}),a=r.DOMWidgetView.extend({render:function(){var e=this;this.el.classList.add("jupyter-widget"),this.el.classList.add("widget-hbox");var t=document.createElement("button");t.classList.add("jupyter-widgets"),t.classList.add("jupyter-button"),t.classList.add("widget-toggle-button"),t.setAttribute("data-toggle","tooltip"),t.setAttribute("title","PanZoom"),t.onclick=function(t){t.preventDefault(),e.model.panzoom()};var n=document.createElement("i");n.className="fa fa-arrows",t.appendChild(n);var r=document.createElement("button");r.classList.add("jupyter-widgets"),r.classList.add("jupyter-button"),r.classList.add("widget-button"),r.setAttribute("data-toggle","tooltip"),r.setAttribute("title","Reset"),r.onclick=function(t){t.preventDefault(),e.model.reset()};var i=document.createElement("i");i.className="fa fa-refresh",r.appendChild(i);var o=document.createElement("button");o.classList.add("jupyter-widgets"),o.classList.add("jupyter-button"),o.classList.add("widget-button"),o.setAttribute("data-toggle","tooltip"),o.setAttribute("title","Save"),o.onclick=function(t){t.preventDefault(),e.model.save_png()};var s=document.createElement("i");s.className="fa fa-save",o.appendChild(s),this.el.appendChild(t),this.el.appendChild(r),this.el.appendChild(o),this._panzoom=t,this.update()},update:function(){this.model.get("_panning")?this._panzoom.classList.add("mod-active"):this._panzoom.classList.remove("mod-active")}});e.exports={Toolbar:a,ToolbarModel:s}},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:function(){return r.extend({},i.MarkModel.prototype.defaults,{_model_name:"GraphModel",_view_name:"Graph",x:[],y:[],color:null,hovered_point:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:[]})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color","link_color","node_data","link_data","link_color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()},update_node_data:function(){var e=this.get("node_data"),t=this.get_typed_field("x"),n=this.get_typed_field("y"),r=this.get_typed_field("color"),i=this.get("scales"),o=(i.x,i.y,i.color);e.length>0&&"string"==typeof e[0]&&(e=e.map((function(e){return{label:e}}))),this.mark_data=[];var s=this;e.forEach((function(e,t){e.label=e.label||"N"+t,e.label_display=e.label_display||"center",e.shape=e.shape||"circle",e.shape_attrs=function(e,t){var n={};switch(e){case"circle":n.r=t.r||15;break;case"rect":n.width=t.width||25,n.height=t.height||.8*n.width,n.rx=t.rx||0,n.ry=t.ry||0;break;case"ellipse":n.rx=t.rx||20,n.ry=t.ry||.6*n.rx;break;default:console.log("Invalid shape passed - ",e)}return n}(e.shape,e.shape_attrs||{}),e.value=e.value||null,s.mark_data.push(e)})),0!==t.length&&0!==n.length&&(o&&(this.get("preserve_domain").color?o.del_domain([],this.model_id+"_color"):o.compute_and_set_domain(r,this.model_id+"_color")),this.mark_data.forEach((function(e,i){e.xval=t[i],e.yval=n[i],e.color=r[i]})))},update_link_data:function(){var e=this.get("scales").link_color;this.link_data=this.get("link_data");var t=this.get_typed_field("link_matrix"),n=this.get_typed_field("link_color"),r=this;void 0!==e&&n.length>0&&(t=n),0===this.link_data.length&&t.length>0&&t.forEach((function(e,t){e.forEach((function(e,n){null!==e&&r.link_data.push({source:t,target:n,value:e})}))}))},update_data:function(){this.dirty=!0,this.update_node_data(),this.update_link_data(),this.update_unique_ids(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_unique_ids:function(){},get_data_dict:function(e,t){return e},update_domains:function(){var e={x:"xval",y:"yval"};if(this.mark_data){var t=this.get("scales");for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];this.get("preserve_domain")[n]?r.del_domain([],this.model_id+n):r.compute_and_set_domain(this.mark_data.map((function(t){return t[n]||t[e[n]]})),this.model_id+n)}}}});e.exports={GraphModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this),t=this;return this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.selected_indices=this.model.get("selected"),this.hovered_style=this.model.get("hovered_style"),this.unhovered_style=this.model.get("unhovered_style"),this.hovered_index=this.model.get("hovered_point")?[this.model.get("hovered_point")]:null,this.display_el_classes=["element"],this.event_metadata={mouse_over:{msg_name:"hover",lookup_data:!1,hit_test:!0},element_clicked:{msg_name:"element_click",lookup_data:!1,hit_test:!0},parent_clicked:{msg_name:"background_click",hit_test:!1}},this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.d3el.attr("class","network"),this.arrow=this.parent.svg.append("defs").append("marker").attr("id","arrow").attr("refX",0).attr("refY",3).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("path").attr("class","linkarrow").attr("d","M0,0 L0,6 L9,3 z"),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.x,t=this.scales.y;e&&e.set_range(this.parent.padded_range("x",e.model)),t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){this.x_scale=this.scales.x,this.y_scale=this.scales.y,this.x_scale||(this.x_scale=this.parent.scale_x),this.y_scale||(this.y_scale=this.parent.scale_y),this.listenTo(this.x_scale,"domain_changed",(function(){this.model.dirty||this.update_position()})),this.listenTo(this.y_scale,"domain_changed",(function(){this.model.dirty||this.update_position()}))},relayout:function(){this.set_ranges(),this.update_position()},update_position:function(){var e=this.scales.x,t=this.scales.y;this.set_ranges();e&&t&&(this.model.mark_data.forEach((function(n){n.x=e.scale(n.xval)+e.offset,n.y=t.scale(n.yval)+t.offset})),this.force_layout&&(this.force_layout.nodes(this.model.mark_data).links(this.model.link_data).start(),this.links&&this.links.data(this.force_layout.links()),this.nodes&&this.nodes.data(this.force_layout.nodes()),this.nodes&&this.links&&this.tick()))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.color_scale_updated()})),e.on("color_scale_range_changed",this.color_scale_updated,this));var t=this.scales.link_color;t&&this.listenTo(t,"domain_changed",(function(){this.link_color_scale_updated()}))},create_listeners:function(){s.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"change:charge",this.update_charge),this.listenTo(this.model,"change:link_distance",this.update_link_distance),this.listenTo(this.model,"data_updated",this.data_updated,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.model,"change:enable_hover",(function(){this.hide_tooltip()}),this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:hovered_point",this.update_hovered),this.listenTo(this.model,"change:hovered_style",this.hovered_style_updated,this),this.listenTo(this.model,"change:unhovered_style",this.unhovered_style_updated,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},data_updated:function(){this.draw(),this.relayout()},get_node_color:function(e,t){var n=this.scales.color,r=this.model.get("colors"),i=r.length;return n&&void 0!==e.color?n.scale(e.color):r[t%i]},draw:function(){this.set_ranges();var e=this.scales.x,t=this.scales.y,n=(this.scales.color,this.scales.link_color);this.d3el.selectAll(".node").remove(),this.d3el.selectAll(".link").remove(),this.force_layout=r.layout.force().size([this.parent.width,this.parent.height]).linkDistance(this.model.get("link_distance")),e&&t&&this.model.mark_data.forEach((function(n){n.x=e.scale(n.xval)+e.offset,n.y=t.scale(n.yval)+t.offset})),this.force_layout.nodes(this.model.mark_data).links(this.model.link_data),e||t||this.force_layout.charge(this.model.get("charge")).on("tick",i.bind(this.tick,this)).start();var o=this.model.get("directed");this.links=this.d3el.selectAll(".link").data(this.force_layout.links()).enter().append("path").attr("class","link").style("stroke",(function(e){return n?n.scale(e.value):null})).style("stroke-width",(function(e){return e.link_width})).attr("marker-mid",o?"url(#arrow)":null);var s=this;this.nodes=this.d3el.selectAll(".node").data(this.force_layout.nodes()).enter().append("g").attr("class","node").call(this.force_layout.drag),this.nodes.append((function(e){return document.createElementNS(r.ns.prefix.svg,e.shape)})).attr("class","element").each((function(e){var t=r.select(this);for(var n in e.shape_attrs)t.attr(n,e.shape_attrs[n])})).style("fill",(function(e,t){return s.get_node_color(e,t)})),this.nodes.append("text").attr("class","label").attr("text-anchor",(function(e){return"center"===e.label_display?"middle":"start"})).attr("x",(function(e){var t=0;if("outside"===e.label_display)switch(e.shape){case"rect":t=e.shape_attrs.width/2+5;break;case"circle":t=e.shape_attrs.r+5;break;case"ellipse":t=e.shape_attrs.rx+5;break;default:t=0}return t})).attr("y",".31em").text((function(e){return e.label})).style("display",(function(e){return"none"===e.label_display?"none":"inline"})),this.nodes.on("click",i.bind((function(e,t){this.event_dispatcher("element_clicked",{data:e,index:t})}),this)),this.nodes.on("mouseover",i.bind((function(e,t){this.hover_handler({data:e,index:t})}),this)),this.nodes.on("mouseout",i.bind((function(){this.reset_hover()}),this))},color_scale_updated:function(){var e=this;this.nodes.selectAll(".element").style("fill",(function(t,n){return e.get_node_color(t,n)}))},link_color_scale_updated:function(){var e=this.scales.link_color;this.links.style("stroke",(function(t){return e?e.scale(t.value):null}))},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"==e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover())},reset_hover:function(){this.links.style("opacity",1),this.model.set("hovered_point",null),this.hovered_index=null,this.touch()},hover_handler:function(e){var t=e.data,n=e.index;this.model.get("highlight_links")?this.links.style("opacity",(function(e){return e.source.label===t.label||e.target.label===t.label?1:.1})):this.links.style("opacity",1),this.model.set("hovered_point",n,{updated_view:this}),this.touch()},reset_selection:function(){this.model.set("selected",null),this.selected_indices=null,this.touch()},click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),i=n?o.deepCopy(n):[],s=i.indexOf(t),a=r.event.ctrlKey||r.event.metaKey;s>-1&&a?i.splice(s,1):a?i.push(t):(i=[]).push(t),this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var l=r.event;void 0!==l.cancelBubble&&(l.cancelBubble=!0),l.stopPropagation&&l.stopPropagation(),l.preventDefault()},hovered_style_updated:function(e,t){this.hovered_style=t,this.clear_style(e.previous("hovered_style"),this.hovered_index),this.style_updated(t,this.hovered_index)},unhovered_style_updated:function(e,t){this.unhovered_style=t;var n=this.hovered_index,r=n?i.range(this.model.mark_data.length).filter((function(e){return-1===n.indexOf(e)})):[];this.clear_style(e.previous("unhovered_style"),r),this.style_updated(t,r)},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},update_hovered:function(e,t){this.hovered_index=null===t?t:[t],this.apply_styles()},apply_styles:function(e){null==e&&(e=[this.selected_style,this.unselected_style,this.hovered_style,this.unhovered_style]),s.__super__.apply_styles.apply(this,[e]);var t=i.range(this.model.mark_data.length);this.set_style_on_elements(this.hovered_style,this.hovered_index);var n=this.hovered_index?i.difference(t,this.hovered_index):[];this.set_style_on_elements(this.unhovered_style,n)},clear_style:function(e,t){var n=this.d3el.selectAll(".element");t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},set_style_on_elements:function(e,t){if(t&&0!==t.length&&(void 0===e||0!==Object.keys(e).length)){var n=this.d3el.selectAll(".element");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).style(e)}},compute_view_padding:function(){var e=r.max(this.model.mark_data.map((function(e){return(e.shape_attrs.r||e.shape_attrs.width/2||e.shape_attrs.rx)+1}))),t=r.max(this.model.mark_data.map((function(e){return(e.shape_attrs.r||e.shape_attrs.height/2||e.shape_attrs.ry)+1})));e===this.x_padding&&t===this.y_padding||(this.x_padding=e,this.y_padding=e,this.trigger("mark_padding_updated"))},selected_deleter:function(){r.event.stopPropagation()},update_link_distance:function(){var e=this.scales.x,t=this.scales.y,n=this.model.get("link_distance");e||t||this.force_layout.linkDistance(n).start()},update_charge:function(){var e=this.scales.x,t=this.scales.y,n=this.model.get("charge");e||t||this.force_layout.charge(n).start()},link_arc:function(e){var t=e.target.x-e.source.x,n=e.target.y-e.source.y,r=Math.sqrt(t*t+n*n);return"M"+e.source.x+","+e.source.y+"A"+r+","+r+" 0 0,1 "+e.target.x+","+e.target.y},link_line:function(e){var t=(e.source.x+e.target.x)/2,n=(e.source.y+e.target.y)/2;return"M"+e.source.x+","+e.source.y+"L"+t+","+n+"L"+e.target.x+","+e.target.y},link_slant_line:function(e){var t=(e.source.x+e.target.x)/2;return"M"+e.source.x+","+e.source.y+"L"+t+","+e.target.y+"L"+e.target.x+","+e.target.y},tick:function(){var e=this.model.get("link_type");this.nodes.attr("transform",(function(e){return"translate("+e.x+","+e.y+")"})),this.nodes.select("rect").attr("transform",(function(e){return"translate("+-e.shape_attrs.width/2+","+-e.shape_attrs.height/2+")"}));var t=this.link_arc;switch(e){case"arc":t=this.link_arc;break;case"line":t=this.link_line;break;case"slant_line":t=this.link_slant_line;break;default:t=this.link_arc}this.links.attr("d",(function(e){return t(e)}))}});e.exports={Graph:s}},function(e,t,n){n(1);var r=n(19),i=(n(13),n(0),r.Mark.extend({render:function(){var e=i.__super__.render.apply(this),t=this.d3el||this.el;window.last_el=t,window.last_image=this,this.im=t.append("image").attr("x",0).attr("y",0).attr("width",1).attr("height",1).attr("preserveAspectRatio","none"),this.update_image();var n=this;return e.then((function(){n.create_listeners(),n.listenTo(n.parent,"margin_updated",(function(){n.draw()}))}))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},set_ranges:function(){var e=this.scales.x,t=this.scales.y;e&&e.set_range(this.parent.padded_range("x",e.model)),t&&t.set_range(this.parent.padded_range("y",t.model))},create_listeners:function(){i.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:image",this.update_image,this),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this)},update_image:function(){this.im.attr("href")&&URL.revokeObjectURL(this.im.attr("href"));var e=this.model.get("image"),t=new Blob([e.get("value")],{type:"image/"+e.get("format")}),n=URL.createObjectURL(t);this.im.attr("href",n)},remove:function(){URL.revokeObjectURL(this.im.attr("href")),i.__super__.remove.apply(this)},relayout:function(){this.draw(!0)},draw:function(e){this.set_ranges();var t=this.scales.x?this.scales.x:this.parent.scale_x,n=this.scales.y?this.scales.y:this.parent.scale_y,r=e?this.parent.model.get("animation_duration"):0,i=this.d3el||this.el,o=this.model.mark_data.x.map(t.scale),s=this.model.mark_data.y.map(n.scale);i.selectAll("image").transition().duration(r).attr("transform",(function(e){return"translate("+(o[0]+t.offset)+","+(s[1]+n.offset)+") scale("+(o[1]-o[0])+", "+(s[0]-s[1])+")"}))}}));e.exports={Image:i}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"ImageModel",_view_name:"Image",x:1,y:1,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}}})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()},update_data:function(){this.mark_data={x:this.get_typed_field("x"),y:this.get_typed_field("y")},this.update_domains(),this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y;t&&(this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.x,this.model_id+"_x")),n&&(this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"))}}},{serializers:i.extend({image:{deserialize:r.unpack_models}},o.MarkModel.serializers)});e.exports={ImageModel:s}},function(e,t,n){var r=n(554);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(555),""),t.i(n(557),""),t.push([e.i,"/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n",""])},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(556),""),t.push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/*\nThis file is copied from the JupyterLab project to define default styling for\nwhen the widget styling is compiled down to eliminate CSS variables. We make one\nchange - we comment out the font import below.\n*/\n\n/*\nThe following CSS variables define the main, public API for styling JupyterLab.\nThese variables should be used by all plugins wherever possible. In other\nwords, plugins should not define custom colors, sizes, etc unless absolutely\nnecessary. This enables users to change the visual theme of JupyterLab\nby changing these variables.\n\nMany variables appear in an ordered sequence (0,1,2,3). These sequences\nare designed to work well together, so for example, `--jp-border-color1` should\nbe used with `--jp-layout-color1`. The numbers have the following meanings:\n\n* 0: super-primary, reserved for special emphasis\n* 1: primary, most important under normal situations\n* 2: secondary, next most important under normal situations\n* 3: tertiary, next most important under normal situations\n\nThroughout JupyterLab, we are mostly following principles from Google's\nMaterial Design when selecting colors. We are not, however, following\nall of MD as it is not optimized for dense, information rich UIs.\n*/\n\n\n/*\n * Optional monospace font for input/output prompt.\n */\n /* Commented out in ipywidgets since we don't need it. */\n/* @import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); */\n\n/*\n * Added for compabitility with output area\n */\n:root {\n --jp-icon-search: none;\n --jp-ui-select-caret: none;\n}\n\n\n:root {\n\n /* Borders\n\n The following variables, specify the visual styling of borders in JupyterLab.\n */\n\n --jp-border-width: 1px;\n --jp-border-color0: var(--md-grey-700);\n --jp-border-color1: var(--md-grey-500);\n --jp-border-color2: var(--md-grey-300);\n --jp-border-color3: var(--md-grey-100);\n\n /* UI Fonts\n\n The UI font CSS variables are used for the typography all of the JupyterLab\n user interface elements that are not directly user generated content.\n */\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n --jp-ui-icon-font-size: 14px; /* Ensures px perfect FontAwesome icons */\n --jp-ui-font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n\n /* Use these font colors against the corresponding main layout colors.\n In a light theme, these go from dark to light.\n */\n\n --jp-ui-font-color0: rgba(0,0,0,1.0);\n --jp-ui-font-color1: rgba(0,0,0,0.8);\n --jp-ui-font-color2: rgba(0,0,0,0.5);\n --jp-ui-font-color3: rgba(0,0,0,0.3);\n\n /* Use these against the brand/accent/warn/error colors.\n These will typically go from light to darker, in both a dark and light theme\n */\n\n --jp-inverse-ui-font-color0: rgba(255,255,255,1);\n --jp-inverse-ui-font-color1: rgba(255,255,255,1.0);\n --jp-inverse-ui-font-color2: rgba(255,255,255,0.7);\n --jp-inverse-ui-font-color3: rgba(255,255,255,0.5);\n\n /* Content Fonts\n\n Content font variables are used for typography of user generated content.\n */\n\n --jp-content-font-size: 13px;\n --jp-content-line-height: 1.5;\n --jp-content-font-color0: black;\n --jp-content-font-color1: black;\n --jp-content-font-color2: var(--md-grey-700);\n --jp-content-font-color3: var(--md-grey-500);\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n\n --jp-code-font-size: 13px;\n --jp-code-line-height: 1.307;\n --jp-code-padding: 5px;\n --jp-code-font-family: monospace;\n\n\n /* Layout\n\n The following are the main layout colors use in JupyterLab. In a light\n theme these would go from light to dark.\n */\n\n --jp-layout-color0: white;\n --jp-layout-color1: white;\n --jp-layout-color2: var(--md-grey-200);\n --jp-layout-color3: var(--md-grey-400);\n\n /* Brand/accent */\n\n --jp-brand-color0: var(--md-blue-700);\n --jp-brand-color1: var(--md-blue-500);\n --jp-brand-color2: var(--md-blue-300);\n --jp-brand-color3: var(--md-blue-100);\n\n --jp-accent-color0: var(--md-green-700);\n --jp-accent-color1: var(--md-green-500);\n --jp-accent-color2: var(--md-green-300);\n --jp-accent-color3: var(--md-green-100);\n\n /* State colors (warn, error, success, info) */\n\n --jp-warn-color0: var(--md-orange-700);\n --jp-warn-color1: var(--md-orange-500);\n --jp-warn-color2: var(--md-orange-300);\n --jp-warn-color3: var(--md-orange-100);\n\n --jp-error-color0: var(--md-red-700);\n --jp-error-color1: var(--md-red-500);\n --jp-error-color2: var(--md-red-300);\n --jp-error-color3: var(--md-red-100);\n\n --jp-success-color0: var(--md-green-700);\n --jp-success-color1: var(--md-green-500);\n --jp-success-color2: var(--md-green-300);\n --jp-success-color3: var(--md-green-100);\n\n --jp-info-color0: var(--md-cyan-700);\n --jp-info-color1: var(--md-cyan-500);\n --jp-info-color2: var(--md-cyan-300);\n --jp-info-color3: var(--md-cyan-100);\n\n /* Cell specific styles */\n\n --jp-cell-padding: 5px;\n --jp-cell-editor-background: #f7f7f7;\n --jp-cell-editor-border-color: #cfcfcf;\n --jp-cell-editor-background-edit: var(--jp-ui-layout-color1);\n --jp-cell-editor-border-color-edit: var(--jp-brand-color1);\n --jp-cell-prompt-width: 100px;\n --jp-cell-prompt-font-family: 'Roboto Mono', monospace;\n --jp-cell-prompt-letter-spacing: 0px;\n --jp-cell-prompt-opacity: 1.0;\n --jp-cell-prompt-opacity-not-active: 0.4;\n --jp-cell-prompt-font-color-not-active: var(--md-grey-700);\n /* A custom blend of MD grey and blue 600\n * See https://meyerweb.com/eric/tools/color-blend/#546E7A:1E88E5:5:hex */\n --jp-cell-inprompt-font-color: #307FC1;\n /* A custom blend of MD grey and orange 600\n * https://meyerweb.com/eric/tools/color-blend/#546E7A:F4511E:5:hex */\n --jp-cell-outprompt-font-color: #BF5B3D;\n\n /* Notebook specific styles */\n\n --jp-notebook-padding: 10px;\n --jp-notebook-scroll-padding: 100px;\n\n /* Console specific styles */\n\n --jp-console-background: var(--md-grey-100);\n\n /* Toolbar specific styles */\n\n --jp-toolbar-border-color: var(--md-grey-400);\n --jp-toolbar-micro-height: 8px;\n --jp-toolbar-background: var(--jp-layout-color0);\n --jp-toolbar-box-shadow: 0px 0px 2px 0px rgba(0,0,0,0.24);\n --jp-toolbar-header-margin: 4px 4px 0px 4px;\n --jp-toolbar-active-background: var(--md-grey-300);\n}\n",""])},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,'/**\n * The material design colors are adapted from google-material-color v1.2.6\n * https://github.com/danlevan/google-material-color\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/dist/palette.var.css\n *\n * The license for the material design color CSS variables is as follows (see\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/LICENSE)\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 Dan Le Van\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n:root {\n --md-red-50: #FFEBEE;\n --md-red-100: #FFCDD2;\n --md-red-200: #EF9A9A;\n --md-red-300: #E57373;\n --md-red-400: #EF5350;\n --md-red-500: #F44336;\n --md-red-600: #E53935;\n --md-red-700: #D32F2F;\n --md-red-800: #C62828;\n --md-red-900: #B71C1C;\n --md-red-A100: #FF8A80;\n --md-red-A200: #FF5252;\n --md-red-A400: #FF1744;\n --md-red-A700: #D50000;\n\n --md-pink-50: #FCE4EC;\n --md-pink-100: #F8BBD0;\n --md-pink-200: #F48FB1;\n --md-pink-300: #F06292;\n --md-pink-400: #EC407A;\n --md-pink-500: #E91E63;\n --md-pink-600: #D81B60;\n --md-pink-700: #C2185B;\n --md-pink-800: #AD1457;\n --md-pink-900: #880E4F;\n --md-pink-A100: #FF80AB;\n --md-pink-A200: #FF4081;\n --md-pink-A400: #F50057;\n --md-pink-A700: #C51162;\n\n --md-purple-50: #F3E5F5;\n --md-purple-100: #E1BEE7;\n --md-purple-200: #CE93D8;\n --md-purple-300: #BA68C8;\n --md-purple-400: #AB47BC;\n --md-purple-500: #9C27B0;\n --md-purple-600: #8E24AA;\n --md-purple-700: #7B1FA2;\n --md-purple-800: #6A1B9A;\n --md-purple-900: #4A148C;\n --md-purple-A100: #EA80FC;\n --md-purple-A200: #E040FB;\n --md-purple-A400: #D500F9;\n --md-purple-A700: #AA00FF;\n\n --md-deep-purple-50: #EDE7F6;\n --md-deep-purple-100: #D1C4E9;\n --md-deep-purple-200: #B39DDB;\n --md-deep-purple-300: #9575CD;\n --md-deep-purple-400: #7E57C2;\n --md-deep-purple-500: #673AB7;\n --md-deep-purple-600: #5E35B1;\n --md-deep-purple-700: #512DA8;\n --md-deep-purple-800: #4527A0;\n --md-deep-purple-900: #311B92;\n --md-deep-purple-A100: #B388FF;\n --md-deep-purple-A200: #7C4DFF;\n --md-deep-purple-A400: #651FFF;\n --md-deep-purple-A700: #6200EA;\n\n --md-indigo-50: #E8EAF6;\n --md-indigo-100: #C5CAE9;\n --md-indigo-200: #9FA8DA;\n --md-indigo-300: #7986CB;\n --md-indigo-400: #5C6BC0;\n --md-indigo-500: #3F51B5;\n --md-indigo-600: #3949AB;\n --md-indigo-700: #303F9F;\n --md-indigo-800: #283593;\n --md-indigo-900: #1A237E;\n --md-indigo-A100: #8C9EFF;\n --md-indigo-A200: #536DFE;\n --md-indigo-A400: #3D5AFE;\n --md-indigo-A700: #304FFE;\n\n --md-blue-50: #E3F2FD;\n --md-blue-100: #BBDEFB;\n --md-blue-200: #90CAF9;\n --md-blue-300: #64B5F6;\n --md-blue-400: #42A5F5;\n --md-blue-500: #2196F3;\n --md-blue-600: #1E88E5;\n --md-blue-700: #1976D2;\n --md-blue-800: #1565C0;\n --md-blue-900: #0D47A1;\n --md-blue-A100: #82B1FF;\n --md-blue-A200: #448AFF;\n --md-blue-A400: #2979FF;\n --md-blue-A700: #2962FF;\n\n --md-light-blue-50: #E1F5FE;\n --md-light-blue-100: #B3E5FC;\n --md-light-blue-200: #81D4FA;\n --md-light-blue-300: #4FC3F7;\n --md-light-blue-400: #29B6F6;\n --md-light-blue-500: #03A9F4;\n --md-light-blue-600: #039BE5;\n --md-light-blue-700: #0288D1;\n --md-light-blue-800: #0277BD;\n --md-light-blue-900: #01579B;\n --md-light-blue-A100: #80D8FF;\n --md-light-blue-A200: #40C4FF;\n --md-light-blue-A400: #00B0FF;\n --md-light-blue-A700: #0091EA;\n\n --md-cyan-50: #E0F7FA;\n --md-cyan-100: #B2EBF2;\n --md-cyan-200: #80DEEA;\n --md-cyan-300: #4DD0E1;\n --md-cyan-400: #26C6DA;\n --md-cyan-500: #00BCD4;\n --md-cyan-600: #00ACC1;\n --md-cyan-700: #0097A7;\n --md-cyan-800: #00838F;\n --md-cyan-900: #006064;\n --md-cyan-A100: #84FFFF;\n --md-cyan-A200: #18FFFF;\n --md-cyan-A400: #00E5FF;\n --md-cyan-A700: #00B8D4;\n\n --md-teal-50: #E0F2F1;\n --md-teal-100: #B2DFDB;\n --md-teal-200: #80CBC4;\n --md-teal-300: #4DB6AC;\n --md-teal-400: #26A69A;\n --md-teal-500: #009688;\n --md-teal-600: #00897B;\n --md-teal-700: #00796B;\n --md-teal-800: #00695C;\n --md-teal-900: #004D40;\n --md-teal-A100: #A7FFEB;\n --md-teal-A200: #64FFDA;\n --md-teal-A400: #1DE9B6;\n --md-teal-A700: #00BFA5;\n\n --md-green-50: #E8F5E9;\n --md-green-100: #C8E6C9;\n --md-green-200: #A5D6A7;\n --md-green-300: #81C784;\n --md-green-400: #66BB6A;\n --md-green-500: #4CAF50;\n --md-green-600: #43A047;\n --md-green-700: #388E3C;\n --md-green-800: #2E7D32;\n --md-green-900: #1B5E20;\n --md-green-A100: #B9F6CA;\n --md-green-A200: #69F0AE;\n --md-green-A400: #00E676;\n --md-green-A700: #00C853;\n\n --md-light-green-50: #F1F8E9;\n --md-light-green-100: #DCEDC8;\n --md-light-green-200: #C5E1A5;\n --md-light-green-300: #AED581;\n --md-light-green-400: #9CCC65;\n --md-light-green-500: #8BC34A;\n --md-light-green-600: #7CB342;\n --md-light-green-700: #689F38;\n --md-light-green-800: #558B2F;\n --md-light-green-900: #33691E;\n --md-light-green-A100: #CCFF90;\n --md-light-green-A200: #B2FF59;\n --md-light-green-A400: #76FF03;\n --md-light-green-A700: #64DD17;\n\n --md-lime-50: #F9FBE7;\n --md-lime-100: #F0F4C3;\n --md-lime-200: #E6EE9C;\n --md-lime-300: #DCE775;\n --md-lime-400: #D4E157;\n --md-lime-500: #CDDC39;\n --md-lime-600: #C0CA33;\n --md-lime-700: #AFB42B;\n --md-lime-800: #9E9D24;\n --md-lime-900: #827717;\n --md-lime-A100: #F4FF81;\n --md-lime-A200: #EEFF41;\n --md-lime-A400: #C6FF00;\n --md-lime-A700: #AEEA00;\n\n --md-yellow-50: #FFFDE7;\n --md-yellow-100: #FFF9C4;\n --md-yellow-200: #FFF59D;\n --md-yellow-300: #FFF176;\n --md-yellow-400: #FFEE58;\n --md-yellow-500: #FFEB3B;\n --md-yellow-600: #FDD835;\n --md-yellow-700: #FBC02D;\n --md-yellow-800: #F9A825;\n --md-yellow-900: #F57F17;\n --md-yellow-A100: #FFFF8D;\n --md-yellow-A200: #FFFF00;\n --md-yellow-A400: #FFEA00;\n --md-yellow-A700: #FFD600;\n\n --md-amber-50: #FFF8E1;\n --md-amber-100: #FFECB3;\n --md-amber-200: #FFE082;\n --md-amber-300: #FFD54F;\n --md-amber-400: #FFCA28;\n --md-amber-500: #FFC107;\n --md-amber-600: #FFB300;\n --md-amber-700: #FFA000;\n --md-amber-800: #FF8F00;\n --md-amber-900: #FF6F00;\n --md-amber-A100: #FFE57F;\n --md-amber-A200: #FFD740;\n --md-amber-A400: #FFC400;\n --md-amber-A700: #FFAB00;\n\n --md-orange-50: #FFF3E0;\n --md-orange-100: #FFE0B2;\n --md-orange-200: #FFCC80;\n --md-orange-300: #FFB74D;\n --md-orange-400: #FFA726;\n --md-orange-500: #FF9800;\n --md-orange-600: #FB8C00;\n --md-orange-700: #F57C00;\n --md-orange-800: #EF6C00;\n --md-orange-900: #E65100;\n --md-orange-A100: #FFD180;\n --md-orange-A200: #FFAB40;\n --md-orange-A400: #FF9100;\n --md-orange-A700: #FF6D00;\n\n --md-deep-orange-50: #FBE9E7;\n --md-deep-orange-100: #FFCCBC;\n --md-deep-orange-200: #FFAB91;\n --md-deep-orange-300: #FF8A65;\n --md-deep-orange-400: #FF7043;\n --md-deep-orange-500: #FF5722;\n --md-deep-orange-600: #F4511E;\n --md-deep-orange-700: #E64A19;\n --md-deep-orange-800: #D84315;\n --md-deep-orange-900: #BF360C;\n --md-deep-orange-A100: #FF9E80;\n --md-deep-orange-A200: #FF6E40;\n --md-deep-orange-A400: #FF3D00;\n --md-deep-orange-A700: #DD2C00;\n\n --md-brown-50: #EFEBE9;\n --md-brown-100: #D7CCC8;\n --md-brown-200: #BCAAA4;\n --md-brown-300: #A1887F;\n --md-brown-400: #8D6E63;\n --md-brown-500: #795548;\n --md-brown-600: #6D4C41;\n --md-brown-700: #5D4037;\n --md-brown-800: #4E342E;\n --md-brown-900: #3E2723;\n\n --md-grey-50: #FAFAFA;\n --md-grey-100: #F5F5F5;\n --md-grey-200: #EEEEEE;\n --md-grey-300: #E0E0E0;\n --md-grey-400: #BDBDBD;\n --md-grey-500: #9E9E9E;\n --md-grey-600: #757575;\n --md-grey-700: #616161;\n --md-grey-800: #424242;\n --md-grey-900: #212121;\n\n --md-blue-grey-50: #ECEFF1;\n --md-blue-grey-100: #CFD8DC;\n --md-blue-grey-200: #B0BEC5;\n --md-blue-grey-300: #90A4AE;\n --md-blue-grey-400: #78909C;\n --md-blue-grey-500: #607D8B;\n --md-blue-grey-600: #546E7A;\n --md-blue-grey-700: #455A64;\n --md-blue-grey-800: #37474F;\n --md-blue-grey-900: #263238;\n}',""])},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(558),""),t.push([e.i,'/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n/*\n * We assume that the CSS variables in\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\n * have been defined.\n */\n\n:root {\n --jp-widgets-color: var(--jp-content-font-color1);\n --jp-widgets-label-color: var(--jp-widgets-color);\n --jp-widgets-readout-color: var(--jp-widgets-color);\n --jp-widgets-font-size: var(--jp-ui-font-size1);\n --jp-widgets-margin: 2px;\n --jp-widgets-inline-height: 28px;\n --jp-widgets-inline-width: 300px;\n --jp-widgets-inline-width-short: calc(var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-width-tiny: calc(var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\n --jp-widgets-inline-label-width: 80px;\n --jp-widgets-border-width: var(--jp-border-width);\n --jp-widgets-vertical-height: 200px;\n --jp-widgets-horizontal-tab-height: 24px;\n --jp-widgets-horizontal-tab-width: 144px;\n --jp-widgets-horizontal-tab-top-border: 2px;\n --jp-widgets-progress-thickness: 20px;\n --jp-widgets-container-padding: 15px;\n --jp-widgets-input-padding: 4px;\n --jp-widgets-radio-item-height-adjustment: 8px;\n --jp-widgets-radio-item-height: calc(var(--jp-widgets-inline-height) - var(--jp-widgets-radio-item-height-adjustment));\n --jp-widgets-slider-track-thickness: 4px;\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\n --jp-widgets-slider-handle-size: 16px;\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\n --jp-widgets-menu-item-height: 24px;\n --jp-widgets-dropdown-arrow: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg");\n --jp-widgets-input-color: var(--jp-ui-font-color1);\n --jp-widgets-input-background-color: var(--jp-layout-color1);\n --jp-widgets-input-border-color: var(--jp-border-color1);\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\n --jp-widgets-disabled-opacity: 0.6;\n\n /* From Material Design Lite */\n --md-shadow-key-umbra-opacity: 0.2;\n --md-shadow-key-penumbra-opacity: 0.14;\n --md-shadow-ambient-shadow-opacity: 0.12;\n}\n\n.jupyter-widgets {\n margin: var(--jp-widgets-margin);\n box-sizing: border-box;\n color: var(--jp-widgets-color);\n overflow: visible;\n}\n\n.jupyter-widgets.jupyter-widgets-disconnected::before {\n line-height: var(--jp-widgets-inline-height);\n height: var(--jp-widgets-inline-height);\n}\n\n.jp-Output-result > .jupyter-widgets {\n margin-left: 0;\n margin-right: 0;\n}\n\n/* vbox and hbox */\n\n.widget-inline-hbox {\n /* Horizontal widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: row;\n align-items: baseline;\n}\n\n.widget-inline-vbox {\n /* Vertical Widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.widget-box {\n box-sizing: border-box;\n display: flex;\n margin: 0;\n overflow: auto;\n}\n\n.widget-gridbox {\n box-sizing: border-box;\n display: grid;\n margin: 0;\n overflow: auto;\n}\n\n.widget-hbox {\n flex-direction: row;\n}\n\n.widget-vbox {\n flex-direction: column;\n}\n\n/* General Button Styling */\n\n.jupyter-button {\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 0px;\n padding-bottom: 0px;\n display: inline-block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n font-size: var(--jp-widgets-font-size);\n cursor: pointer;\n\n height: var(--jp-widgets-inline-height);\n border: 0px solid;\n line-height: var(--jp-widgets-inline-height);\n box-shadow: none;\n\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color2);\n border-color: var(--jp-border-color2);\n border: none;\n user-select: none;\n}\n\n.jupyter-button i.fa {\n margin-right: var(--jp-widgets-inline-margin);\n pointer-events: none;\n}\n\n.jupyter-button:empty:before {\n content: "\\200B"; /* zero-width space */\n}\n\n.jupyter-widgets.jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n.jupyter-button i.fa.center {\n margin-right: 0;\n}\n\n.jupyter-button:hover:enabled, .jupyter-button:focus:enabled {\n /* MD Lite 2dp shadow */\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\n}\n\n.jupyter-button:active, .jupyter-button.mod-active {\n /* MD Lite 4dp shadow */\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color3);\n}\n\n.jupyter-button:focus:enabled {\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\n}\n\n/* Button "Primary" Styling */\n\n.jupyter-button.mod-primary {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-brand-color1);\n}\n\n.jupyter-button.mod-primary.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n.jupyter-button.mod-primary:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n/* Button "Success" Styling */\n\n.jupyter-button.mod-success {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-success-color1);\n}\n\n.jupyter-button.mod-success.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n.jupyter-button.mod-success:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n /* Button "Info" Styling */\n\n.jupyter-button.mod-info {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-info-color1);\n}\n\n.jupyter-button.mod-info.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n.jupyter-button.mod-info:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n/* Button "Warning" Styling */\n\n.jupyter-button.mod-warning {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-warn-color1);\n}\n\n.jupyter-button.mod-warning.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n.jupyter-button.mod-warning:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n/* Button "Danger" Styling */\n\n.jupyter-button.mod-danger {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-error-color1);\n}\n\n.jupyter-button.mod-danger.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n.jupyter-button.mod-danger:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n/* Widget Button, Widget Toggle Button, Widget Upload */\n\n.widget-button, .widget-toggle-button, .widget-upload {\n width: var(--jp-widgets-inline-width-short);\n}\n\n/* Widget Label Styling */\n\n/* Override Bootstrap label css */\n.jupyter-widgets label {\n margin-bottom: initial;\n}\n\n.widget-label-basic {\n /* Basic Label */\n color: var(--jp-widgets-label-color);\n font-size: var(--jp-widgets-font-size);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-label {\n /* Label */\n color: var(--jp-widgets-label-color);\n font-size: var(--jp-widgets-font-size);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-inline-hbox .widget-label {\n /* Horizontal Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: right;\n margin-right: calc( var(--jp-widgets-inline-margin) * 2 );\n width: var(--jp-widgets-inline-label-width);\n flex-shrink: 0;\n}\n\n.widget-inline-vbox .widget-label {\n /* Vertical Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: center;\n line-height: var(--jp-widgets-inline-height);\n}\n\n/* Widget Readout Styling */\n\n.widget-readout {\n color: var(--jp-widgets-readout-color);\n font-size: var(--jp-widgets-font-size);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n overflow: hidden;\n white-space: nowrap;\n text-align: center;\n}\n\n.widget-readout.overflow {\n /* Overflowing Readout */\n\n /* From Material Design Lite\n shadow-key-umbra-opacity: 0.2;\n shadow-key-penumbra-opacity: 0.14;\n shadow-ambient-shadow-opacity: 0.12;\n */\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n}\n\n.widget-inline-hbox .widget-readout {\n /* Horizontal Readout */\n text-align: center;\n max-width: var(--jp-widgets-inline-width-short);\n min-width: var(--jp-widgets-inline-width-tiny);\n margin-left: var(--jp-widgets-inline-margin);\n}\n\n.widget-inline-vbox .widget-readout {\n /* Vertical Readout */\n margin-top: var(--jp-widgets-inline-margin);\n /* as wide as the widget */\n width: inherit;\n}\n\n/* Widget Checkbox Styling */\n\n.widget-checkbox {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-checkbox input[type="checkbox"] {\n margin: 0px calc( var(--jp-widgets-inline-margin) * 2 ) 0px 0px;\n line-height: var(--jp-widgets-inline-height);\n font-size: large;\n flex-grow: 1;\n flex-shrink: 0;\n align-self: center;\n}\n\n/* Widget Valid Styling */\n\n.widget-valid {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width-short);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-valid i:before {\n line-height: var(--jp-widgets-inline-height);\n margin-right: var(--jp-widgets-inline-margin);\n margin-left: var(--jp-widgets-inline-margin);\n\n /* from the fa class in FontAwesome: https://github.com/FortAwesome/Font-Awesome/blob/49100c7c3a7b58d50baa71efef11af41a66b03d3/css/font-awesome.css#L14 */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.widget-valid.mod-valid i:before {\n content: "\\F00C";\n color: green;\n}\n\n.widget-valid.mod-invalid i:before {\n content: "\\F00D";\n color: red;\n}\n\n.widget-valid.mod-valid .widget-valid-readout {\n display: none;\n}\n\n/* Widget Text and TextArea Stying */\n\n.widget-textarea, .widget-text {\n width: var(--jp-widgets-inline-width);\n}\n\n.widget-text input[type="text"], .widget-text input[type="number"]{\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-text input[type="text"]:disabled, .widget-text input[type="number"]:disabled, .widget-textarea textarea:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n.widget-text input[type="text"], .widget-text input[type="number"], .widget-textarea textarea {\n box-sizing: border-box;\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n flex-grow: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n outline: none !important;\n}\n \n.widget-text input[type="text"], .widget-textarea textarea {\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2);\n}\n\n.widget-text input[type="number"] {\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding) calc(var(--jp-widgets-input-padding) * 2);\n}\n\n.widget-textarea textarea {\n height: inherit;\n width: inherit;\n}\n\n.widget-text input:focus, .widget-textarea textarea:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n/* Widget Slider */\n\n.widget-slider .ui-slider {\n /* Slider Track */\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\n background: var(--jp-layout-color3);\n box-sizing: border-box;\n position: relative;\n border-radius: 0px;\n}\n\n.widget-slider .ui-slider .ui-slider-handle {\n /* Slider Handle */\n outline: none !important; /* focused slider handles are colored - see below */\n position: absolute;\n background-color: var(--jp-widgets-slider-handle-background-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-handle-border-color);\n box-sizing: border-box;\n z-index: 1;\n background-image: none; /* Override jquery-ui */\n}\n\n/* Override jquery-ui */\n.widget-slider .ui-slider .ui-slider-handle:hover, .widget-slider .ui-slider .ui-slider-handle:focus {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\n}\n\n.widget-slider .ui-slider .ui-slider-handle:active {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border-color: var(--jp-widgets-slider-active-handle-color);\n z-index: 2;\n transform: scale(1.2);\n}\n\n.widget-slider .ui-slider .ui-slider-range {\n /* Interval between the two specified value of a double slider */\n position: absolute;\n background: var(--jp-widgets-slider-active-handle-color);\n z-index: 0;\n}\n\n/* Shapes of Slider Handles */\n\n.widget-hslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n margin-left: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n top: 0;\n}\n\n.widget-vslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n left: 0;\n}\n\n.widget-hslider .ui-slider .ui-slider-range {\n height: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n.widget-vslider .ui-slider .ui-slider-range {\n width: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n/* Horizontal Slider */\n\n.widget-hslider {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n\n /* Override the align-items baseline. This way, the description and readout\n still seem to align their baseline properly, and we don\'t have to have\n align-self: stretch in the .slider-container. */\n align-items: center;\n}\n\n.widgets-slider .slider-container {\n overflow: visible;\n}\n\n.widget-hslider .slider-container {\n height: var(--jp-widgets-inline-height);\n margin-left: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-right: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n flex: 1 1 var(--jp-widgets-inline-width-short);\n}\n\n.widget-hslider .ui-slider {\n /* Inner, invisible slide div */\n height: var(--jp-widgets-slider-track-thickness);\n margin-top: calc((var(--jp-widgets-inline-height) - var(--jp-widgets-slider-track-thickness)) / 2);\n width: 100%;\n}\n\n/* Vertical Slider */\n\n.widget-vbox .widget-label {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-vslider {\n /* Vertical Slider */\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vslider .slider-container {\n flex: 1 1 var(--jp-widgets-inline-width-short);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-top: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n display: flex;\n flex-direction: column;\n}\n\n.widget-vslider .ui-slider-vertical {\n /* Inner, invisible slide div */\n width: var(--jp-widgets-slider-track-thickness);\n flex-grow: 1;\n margin-left: auto;\n margin-right: auto;\n}\n\n/* Widget Progress Styling */\n\n.progress-bar {\n -webkit-transition: none;\n -moz-transition: none;\n -ms-transition: none;\n -o-transition: none;\n transition: none;\n}\n\n.progress-bar {\n height: var(--jp-widgets-inline-height);\n}\n\n.progress-bar {\n background-color: var(--jp-brand-color1);\n}\n\n.progress-bar-success {\n background-color: var(--jp-success-color1);\n}\n\n.progress-bar-info {\n background-color: var(--jp-info-color1);\n}\n\n.progress-bar-warning {\n background-color: var(--jp-warn-color1);\n}\n\n.progress-bar-danger {\n background-color: var(--jp-error-color1);\n}\n\n.progress {\n background-color: var(--jp-layout-color2);\n border: none;\n box-shadow: none;\n}\n\n/* Horisontal Progress */\n\n.widget-hprogress {\n /* Progress Bar */\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width);\n align-items: center;\n\n}\n\n.widget-hprogress .progress {\n flex-grow: 1;\n margin-top: var(--jp-widgets-input-padding);\n margin-bottom: var(--jp-widgets-input-padding);\n align-self: stretch;\n /* Override bootstrap style */\n height: initial;\n}\n\n/* Vertical Progress */\n\n.widget-vprogress {\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vprogress .progress {\n flex-grow: 1;\n width: var(--jp-widgets-progress-thickness);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 0;\n}\n\n/* Select Widget Styling */\n\n.widget-dropdown {\n height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-dropdown > select {\n padding-right: 20px;\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-radius: 0;\n height: inherit;\n flex: 1 1 var(--jp-widgets-inline-width-short);\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n box-sizing: border-box;\n outline: none !important;\n box-shadow: none;\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n vertical-align: top;\n padding-left: calc( var(--jp-widgets-input-padding) * 2);\n\tappearance: none;\n\t-webkit-appearance: none;\n\t-moz-appearance: none;\n background-repeat: no-repeat;\n\tbackground-size: 20px;\n\tbackground-position: right center;\n background-image: var(--jp-widgets-dropdown-arrow);\n}\n.widget-dropdown > select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-dropdown > select:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* To disable the dotted border in Firefox around select controls.\n See http://stackoverflow.com/a/18853002 */\n.widget-dropdown > select:-moz-focusring {\n color: transparent;\n text-shadow: 0 0 0 #000;\n}\n\n/* Select and SelectMultiple */\n\n.widget-select {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n\n /* Because Firefox defines the baseline of a select as the bottom of the\n control, we align the entire control to the top and add padding to the\n select to get an approximate first line baseline alignment. */\n align-items: flex-start;\n}\n\n.widget-select > select {\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n flex: 1 1 var(--jp-widgets-inline-width-short);\n outline: none !important;\n overflow: auto;\n height: inherit;\n\n /* Because Firefox defines the baseline of a select as the bottom of the\n control, we align the entire control to the top and add padding to the\n select to get an approximate first line baseline alignment. */\n padding-top: 5px;\n}\n\n.widget-select > select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.wiget-select > select > option {\n padding-left: var(--jp-widgets-input-padding);\n line-height: var(--jp-widgets-inline-height);\n /* line-height doesn\'t work on some browsers for select options */\n padding-top: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n padding-bottom: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n}\n\n\n\n/* Toggle Buttons Styling */\n\n.widget-toggle-buttons {\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-toggle-buttons .widget-toggle-button {\n margin-left: var(--jp-widgets-margin);\n margin-right: var(--jp-widgets-margin);\n}\n\n.widget-toggle-buttons .jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Radio Buttons Styling */\n\n.widget-radio {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-radio-box {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n box-sizing: border-box;\n flex-grow: 1;\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\n}\n\n.widget-radio-box label {\n height: var(--jp-widgets-radio-item-height);\n line-height: var(--jp-widgets-radio-item-height);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-radio-box input {\n height: var(--jp-widgets-radio-item-height);\n line-height: var(--jp-widgets-radio-item-height);\n margin: 0 calc( var(--jp-widgets-input-padding) * 2 ) 0 1px;\n float: left;\n}\n\n/* Color Picker Styling */\n\n.widget-colorpicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-colorpicker > .widget-colorpicker-input {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-colorpicker input[type="color"] {\n width: var(--jp-widgets-inline-height);\n height: var(--jp-widgets-inline-height);\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-left: none;\n flex-grow: 0;\n flex-shrink: 0;\n box-sizing: border-box;\n align-self: stretch;\n outline: none !important;\n}\n\n.widget-colorpicker.concise input[type="color"] {\n border-left: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n}\n\n.widget-colorpicker input[type="color"]:focus, .widget-colorpicker input[type="text"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-colorpicker input[type="text"] {\n flex-grow: 1;\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n box-sizing: border-box;\n}\n\n.widget-colorpicker input[type="text"]:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Date Picker Styling */\n\n.widget-datepicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-datepicker input[type="date"] {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n box-sizing: border-box;\n}\n\n.widget-datepicker input[type="date"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-datepicker input[type="date"]:invalid {\n border-color: var(--jp-warn-color1);\n}\n\n.widget-datepicker input[type="date"]:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Play Widget */\n\n.widget-play {\n width: var(--jp-widgets-inline-width-short);\n display: flex;\n align-items: stretch;\n}\n\n.widget-play .jupyter-button {\n flex-grow: 1;\n height: auto;\n}\n\n.widget-play .jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Tab Widget */\n\n.jupyter-widgets.widget-tab {\n display: flex;\n flex-direction: column;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\n overflow-x: visible;\n overflow-y: visible;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content {\n /* Make sure that the tab grows from bottom up */\n align-items: flex-end;\n min-width: 0;\n min-height: 0;\n}\n\n.jupyter-widgets.widget-tab > .widget-tab-contents {\n width: 100%;\n box-sizing: border-box;\n margin: 0;\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n padding: var(--jp-widgets-container-padding);\n flex-grow: 1;\n overflow: auto;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width));\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab {\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\n min-width: 35px;\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width));\n line-height: var(--jp-widgets-horizontal-tab-height);\n margin-left: calc(-1 * var(--jp-border-width));\n padding: 0px 10px;\n background: var(--jp-layout-color2);\n color: var(--jp-ui-font-color2);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n border-bottom: none;\n position: relative;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current {\n color: var(--jp-ui-font-color0);\n /* We want the background to match the tab content background */\n background: var(--jp-layout-color1);\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width));\n transform: translateY(var(--jp-border-width));\n overflow: visible;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before {\n position: absolute;\n top: calc(-1 * var(--jp-border-width));\n left: calc(-1 * var(--jp-border-width));\n content: \'\';\n height: var(--jp-widgets-horizontal-tab-top-border);\n width: calc(100% + 2 * var(--jp-border-width));\n background: var(--jp-brand-color1);\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child {\n margin-left: 0;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:hover:not(.p-mod-current) {\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-mod-closable > .p-TabBar-tabCloseIcon {\n margin-left: 4px;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-mod-closable > .p-TabBar-tabCloseIcon:before {\n font-family: FontAwesome;\n content: \'\\F00D\'; /* close */\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon {\n line-height: var(--jp-widgets-horizontal-tab-height);\n}\n\n/* Accordion Widget */\n\n.p-Collapse {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Collapse-header {\n padding: var(--jp-widgets-input-padding);\n cursor: pointer;\n color: var(--jp-ui-font-color2);\n background-color: var(--jp-layout-color2);\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3) var(--jp-widgets-container-padding);\n font-weight: bold;\n}\n\n.p-Collapse-header:hover {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.p-Collapse-open > .p-Collapse-header {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color0);\n cursor: default;\n border-bottom: none;\n}\n\n.p-Collapse .p-Collapse-header::before {\n content: \'\\F0DA\\A0\'; /* caret-right, non-breaking space */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.p-Collapse-open > .p-Collapse-header::before {\n content: \'\\F0D7\\A0\'; /* caret-down, non-breaking space */\n}\n\n.p-Collapse-contents {\n padding: var(--jp-widgets-container-padding);\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n overflow: auto;\n}\n\n.p-Accordion {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Accordion .p-Collapse {\n margin-bottom: 0;\n}\n\n.p-Accordion .p-Collapse + .p-Collapse {\n margin-top: 4px;\n}\n\n\n\n/* HTML widget */\n\n.widget-html, .widget-htmlmath {\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-html > .widget-html-content, .widget-htmlmath > .widget-html-content {\n /* Fill out the area in the HTML widget */\n align-self: stretch;\n flex-grow: 1;\n flex-shrink: 1;\n /* Makes sure the baseline is still aligned with other elements */\n line-height: var(--jp-widgets-inline-height);\n /* Make it possible to have absolutely-positioned elements in the html */\n position: relative;\n}\n\n\n/* Image widget */\n\n.widget-image {\n max-width: 100%;\n height: auto;\n}\n',""])},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/* This file has code derived from PhosphorJS CSS files, as noted below. The license for this PhosphorJS code is:\n\nCopyright (c) 2014-2017, PhosphorJS Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n*/\n\n/*\n * The following section is derived from https://github.com/phosphorjs/phosphor/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \n * We've scoped the rules so that they are consistent with exactly our code.\n */\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'] {\n flex-direction: row;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'] {\n flex-direction: column;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex: 1 1 auto;\n list-style-type: none;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'] > .p-TabBar-content {\n flex-direction: row;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'] > .p-TabBar-content {\n flex-direction: column;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon {\n flex: 0 0 auto;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel {\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden {\n display: none !important;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab {\n position: relative;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging[data-orientation='horizontal'] .p-TabBar-tab {\n left: 0;\n transition: left 150ms ease;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging[data-orientation='vertical'] .p-TabBar-tab {\n top: 0;\n transition: top 150ms ease;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab.p-mod-dragging {\n transition: none;\n}\n\n/* End tabbar.css */\n",""])},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"OutputModel",(function(){return T})),n.d(r,"OutputView",(function(){return P}));n(208),n(213),n(218),n(229),n(232);var i=n(204),o=n.n(i),s=n(14),a=n(205),l=n(108),c=n(5),u=n(9),h=n(206);const d=window.j1;var p,f,g,m={},_=!1;const v=e=>(e.includes("localhost")?"ws:":"wss:")+e.split(":").slice(1).join(":"),y=()=>document.querySelectorAll(".code_cell"),b=e=>e.querySelector(".input_area").textContent.trim(),w=e=>null!==e.querySelector(".output_widget_view"),x=(e=document)=>e.querySelectorAll(".js-nbinteract-widget"),k=(e,t=document)=>{x(t).forEach(t=>{t.innerHTML=e})},E=(e=document)=>{x(e).forEach(e=>e.remove())},S=async(e,t)=>{if(!s.KernelMessage.isDisplayDataMsg(e))return!1;const n=e.content.data["application/vnd.jupyter.widget-view+json"];if(void 0===n||2!==n.version_major)return!1;const r=async()=>{try{p=await t.get_model(n.model_id),f=JSON.stringify(p),document.querySelectorAll(".output_wrapper").length,g=document.querySelectorAll(".widget-vbox").length}finally{m.type="command",m.action="info",m.text="Displaying widget finished on id: "+f,d.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",m),_||g||(_=!0,console.error("nbinteract-core.util\n render the first widget failed"),m.type="command",m.action="error",m.text="Widget initialization failed.",d.sendMessage("nbinteract-core.util","j1.adapter.nbinteract",m)),!_&&g>=1&&(_=!0,m.type="command",m.action="info",m.text="First widget successfully rendered ...",d.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",m))}};window.setTimeout((function(){r()}),250);return await t.get_model(n.model_id)};var M=n(72),C=n(55),j=n(54);const A=new j.RenderMimeRegistry({initialFactories:j.standardRendererFactories});class T extends M.OutputModel{defaults(){const e=super.defaults();return e.msg_id="",e}initialize(e,t){super.initialize(e,t),this._outputs=new C.OutputAreaModel({trusted:!0}),this.listenTo(this,"change:msg_id",this.reset_msg_id),this.reset_msg_id()}reset_msg_id(){this._msgHook&&this._msgHook.dispose(),this._msgHook=null;let e=this.widget_manager.kernel;this.get("msg_id")&&e&&(this._msgHook=e.registerMessageHook(this.get("msg_id"),e=>(this.add(e),!1)))}add(e){let t=e.header.msg_type;switch(t){case"execute_result":case"display_data":case"stream":case"error":let n=e.content;n.output_type=t,this._outputs.add(n);break;case"clear_output":this.clear_output(e.content.wait)}}clear_output(e=!1){this._outputs.clear(e)}get outputs(){return this._outputs}}class P extends M.OutputView{_createElement(e){return this.pWidget=new c.Panel,this.pWidget.node}_setElement(e){if(this.el||e!==this.pWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.pWidget.node}render(){this._outputView=new C.OutputArea({rendermime:A,contentFactory:C.OutputArea.defaultContentFactory,model:this.model.outputs}),this.pWidget.insertWidget(0,this._outputView),this.pWidget.addClass("jupyter-widgets"),this.pWidget.addClass("widget-output"),this.update()}remove(){return this._outputView.dispose(),super.remove()}}n(553);class O extends a.HTMLManager{constructor(e){super(),this.generateWidgets=this.generateWidgets.bind(this),this._displayWidget=this._displayWidget.bind(this),this.setKernel(e)}setKernel(e){Object.values(this._models).forEach(async e=>{(await e).close(!0)}),this._models={},this.kernel&&this.kernel.dispose(),this.kernel=e,this._registerKernel(e)}generateWidgets(){y().forEach((e,t)=>{const n=b(e);this.kernel.requestExecute({code:n}).onIOPub=t=>this._displayWidget(e,t)})}async _displayWidget(e,t){if((e=>"error"===e.msg_type)(t)){const n=b(e),r=t.content.traceback.join("\n").replace(/\u001b\[.*?m/g,"");console.warn(`${n}\n${r}`.trim()),w(e)&&((e,t=document)=>{x(t).forEach(t=>{t.disabled=!0;const n=document.createElement("pre");n.innerText=e,n.style.cssText="text-align: left; font-size: 0.9em;",t.innerHTML="",t.appendChild(n)})})(r,e)}if(!w(e))return;const n=await S(t,this);if(n){E();const r=(e=>e.querySelector(".output_widget_view"))(e);this.display_model(t,n,{el:r})}}_registerKernel(e){this._commRegistration&&this._commRegistration.dispose(),e&&(this._commRegistration=e.registerCommTarget(this.comm_target_name,(e,t)=>{this.handle_comm_open(new u.shims.services.Comm(e),t)}))}display_view(e,t,{el:n}){return Promise.resolve(t).then(e=>(c.Widget.attach(e.pWidget,n),e.on("remove",()=>{console.log("View removed",e)}),e))}_create_comm(e,t,n,r){const i=this.kernel.connectToComm(e,t);return(n||r)&&i.open(n,r),Promise.resolve(new u.shims.services.Comm(i))}_get_comm_info(){return this.kernel.requestCommInfo({target:this.comm_target_name}).then(e=>e.content.comms)}loadClass(e,t,n){return"@jupyter-widgets/controls"===t?Promise.resolve(l[e]):"@jupyter-widgets/base"===t?Promise.resolve(u[e]):"@jupyter-widgets/output"===t?Promise.resolve(r[e]):"bqplot"===t?Promise.resolve(h[e]):new Promise((function(e,n){window.require([t],e,n)})).then((function(n){return n[e]?n[e]:Promise.reject("Class "+e+" not found in module "+t)}))}}const L=new Set(["*","failed","built","waiting","building","fetching","pushing","launching","ready"]);var I={};class D{constructor({spec:e,baseUrl:t,provider:n,callbacks:r={},nbUrl:i=!1,logger:o=!1,j1API:s=!1}={}){this.baseUrl=t,this.provider=n,this.spec=e,this.nbUrl=i,this.logger=o,this.j1=s,this.callbacks=r,this.state=null,this.registerCallback("*",(e,t,n)=>{void 0!==n.message?(n.message.includes("Insufficent nodes")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Insufficent nodes avaialble at BinderHub",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),n.message.includes("Too many users")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Too many users on this BinderHub",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),n.message.includes("ImagePullBackOff")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Error: ImagePullBackOff",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),this.logger.info("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="info",I.text=n.message.slice(0,-1),this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)):(this.logger.info("\nbinderhub.registerCallback: messages sent by Binder: "+n.slice(0,-1)),I.type="command",I.action="info",I.text=n.slice(0,-1),this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I))})}apiUrl(){return`${this.baseUrl}/build/${this.provider}/${this.spec}`}startServer(){return this.nbUrl?Promise.resolve({url:this.nbUrl}):new Promise((e,t)=>{const n=new EventSource(this.apiUrl());n.onerror=e=>{var r=JSON.stringify(e);this.logger.error("\nbinderhub.startServer: stopping nbinteract, failed to connect to Binder: "+r),I.type="command",I.action="error",I.text="failed to connect to Binder:\n"+r,this.j1.sendMessage("binderhub.startServer","j1.adapter.nbinteract",I),n.close(),t(new Error(e))},n.onmessage=e=>{const t=JSON.parse(e.data);t.phase&&this.changeState(t.phase.toLowerCase(),t)},this.registerCallback("failed",(e,r,i)=>{this.logger.error("\nbinderhub.startServer: Failed to build Binder image:\n"+i.message.slice(0,-1)),n.close(),t(new Error(i))}),this.registerCallback("ready",(t,r,i)=>{this.logger.info("\nbinderhub.startServer: Binder server is ready, continue ..."),n.close(),e(i)})})}registerCallback(e,t){L.has(e)?void 0===this.callbacks[e]?this.callbacks[e]=[t]:this.callbacks[e].push(t):this.logger.error("\nbinderhub.registerCallback: tried to register callback on invalid state: "+e)}changeState(e,t){[e,"*"].map(n=>{const r=this.callbacks[n];r&&r.forEach(n=>n(this.state,e,t))}),e&&(this.state=e)}}var R={};class B{constructor({spec:e="SamLau95/nbinteract-image/master",baseUrl:t="https://mybinder.org",provider:n="gh",nbUrl:r=!1,logger:i=!1,j1API:s=!1}={}){this.logger=i,this.j1=s,this.run=o()(this.run,500,{leading:!0,trailing:!1}),this._kernelHeartbeat=this._kernelHeartbeat.bind(this),this.binder=new D({spec:e,baseUrl:t,provider:n,nbUrl:r,logger:i,j1API:s}),this.kernel=null,this.manager=null}async prepare(){this.logger.info("\nnbinteract.prepare: nbinteract core is being initialized"),k("Show widgets"),this.binder.registerCallback("failed",(e,t,n)=>{R.type="command",R.action="error",R.text="Error, try refreshing the page:<br> "+n.message,this.j1.sendMessage("nbinteract-core.prepare","j1.adapter.nbinteract",R)}),this.runIfKernelExists()}async run(){k("Initializing widgets ..."),R.type="command",R.action="info",R.text="Initializing widgets ...",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),0===y().length&&E();const e=!this.kernel||!this.manager;try{this.kernel=await this._getOrStartKernel(),this.manager=this.manager||new O(this.kernel),this.manager.generateWidgets(),R.type="command",R.action="info",R.text="Widget initialization started ...",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),R.type="command",R.action="nbi_init_started",R.text="nbinteract initialization finished.",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),e&&this._kernelHeartbeat()}catch(e){this.logger.info("\nnbinteract-core.run: widget initialization failed"),R.type="command",R.action="error",R.text="Widget initialization failed.",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R)}}async runIfKernelExists(){try{await this._getKernelModel()}catch(e){return this.logger.info("\nnbinteract.runIfKernelExists: no kernel, stopping the runIfKernelExists() call.\nuse the run() method to automatically start a kernel if needed"),void this.run()}this.run()}async _kernelHeartbeat(e=5){try{await this._getKernelModel()}catch(e){this.logger.info("\nnbinteract.kernelHeartbeat: looks like the kernel has died"),this.logger.info("\nnbinteract.kernelHeartbeat: starting a new kernel ..."),R.type="command",R.action="info",R.text="Seems the kernel has died, starting a new kernel ...",this.j1.sendMessage("nbinteract-core.kernelHeartbeat","j1.adapter.nbinteract",R);const t=await this._startKernel();this.kernel=t,this.manager.setKernel(t),this.manager.generateWidgets()}finally{setTimeout(this._kernelHeartbeat,5e3*e)}}async _getOrStartKernel(){if(this.kernel)return this.kernel;try{const e=await this._getKernel(),t=e._id;return this.logger.info("\nnbinteract.getOrStartKernel: connected to cached kernel: "+t),R.type="command",R.action="info",R.text="Connected to cached kernel ...",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R),e}catch(e){e.toString();this.logger.info("\nnbinteract.getOrStartKernel: no cached kernel found."),this.logger.info("\nnbinteract.getOrStartKernel: starting new kernel on BinderHub ..."),R.type="command",R.action="info",R.text="No cached kernel found.",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R),R.type="command",R.action="info",R.text="Starting new kernel on BinderHub ...",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R);return await this._startKernel()}}async _getKernel(){const{serverSettings:e,kernelModel:t}=await this._getKernelModel();return await s.Kernel.connectTo(t,e)}async _getKernelModel(){const{serverParams:e,kernelId:t}=localStorage,{url:n,token:r}=JSON.parse(e),i=s.ServerConnection.makeSettings({baseUrl:n,wsUrl:v(n),token:r});return{serverSettings:i,kernelModel:await s.Kernel.findById(t,i)}}async _startKernel(){try{const{url:e,token:t}=await this.binder.startServer(),n=s.ServerConnection.makeSettings({baseUrl:e,wsUrl:v(e),token:t}),r=await s.Kernel.getSpecs(n),i=await s.Kernel.startNew({name:r.default,serverSettings:n});return localStorage.serverParams=JSON.stringify({url:e,token:t}),localStorage.kernelId=i.id,this.logger.info("\nnbinteract-core.startKernel: started kernel: "+i.id),R.type="command",R.action="info",R.text="Kernel successfully started.",this.j1.sendMessage("nbinteract-core.startKernel","j1.adapter.nbinteract",R),i}catch(e){this.logger.error("\nnbinteract-core: startKernel, initialization kernel failed"),R.type="command",R.action="error",R.text="Initialization of the kernel failed.",this.j1.sendMessage("nbinteract-core.startKernel","j1.adapter.nbinteract",R)}}async _killKernel(){return(await this._getKernel()).shutdown()}}"undefined"!=typeof window&&(window.NbInteract=B);t.default=B}]);
93
+ */!function(s){"use strict";i=[n(11),n(51)],void 0===(o="function"==typeof(r=function(e){return e.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}})?r.apply(t,i):r)||(e.exports=o)}()},function(e){e.exports=JSON.parse('{"name":"@jupyter-widgets/controls","version":"1.5.3","description":"Jupyter interactive widgets","repository":{"type":"git","url":"https://github.com/jupyter-widgets/ipywidgets.git"},"license":"BSD-3-Clause","author":"Project Jupyter","files":["lib/**/*.d.ts","lib/**/*.js","css/*.css","dist/"],"main":"lib/index.js","typings":"lib/index.d.ts","scripts":{"build":"npm run build:src && npm run build:css","build:css":"postcss --use postcss-import --use postcss-cssnext -o css/widgets.built.css css/widgets.css","build:src":"tsc","build:test":"tsc --project test && webpack --config test/webpack.conf.js","clean":"npm run clean:src","clean:src":"rimraf lib && rimraf tsconfig.tsbuildinfo","lint":"tslint --project tslint.json --format stylish","prepublish":"npm run clean && npm run build","test":"npm run test:unit","test:coverage":"npm run build:test && webpack --config test/webpack-cov.conf.js && karma start test/karma-cov.conf.js","test:unit":"npm run test:unit:firefox && npm run test:unit:chrome","test:unit:chrome":"npm run test:unit:default -- --browsers=Chrome","test:unit:default":"npm run build:test && karma start test/karma.conf.js --log-level debug","test:unit:firefox":"npm run test:unit:default -- --browsers=Firefox","test:unit:ie":"npm run test:unit:default -- --browsers=IE"},"dependencies":{"@jupyter-widgets/base":"^2.0.2","@phosphor/algorithm":"^1.1.0","@phosphor/domutils":"^1.1.0","@phosphor/messaging":"^1.2.1","@phosphor/signaling":"^1.2.0","@phosphor/widgets":"^1.3.0","d3-format":"^1.3.0","jquery":"^3.1.1","jquery-ui":"^1.12.1","underscore":"^1.8.3"},"devDependencies":{"@jupyterlab/services":"^2.0.0 || ^3.0.0 || ^4.0.0","@types/d3-format":"^1.3.1","@types/expect.js":"^0.3.29","@types/mathjax":"^0.0.35","@types/mocha":"^5.2.7","@types/node":"^12.0.10","chai":"^4.0.0","css-loader":"^3.0.0","expect.js":"^0.3.1","file-loader":"^4.0.0","istanbul-instrumenter-loader":"^3.0.1","json-loader":"^0.5.7","karma":"^4.1.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.2","karma-firefox-launcher":"^1.1.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","karma-webpack":"^4.0.2","mocha":"^6.1.4","npm-run-all":"^4.1.5","postcss-cli":"^6.1.2","postcss-cssnext":"^3.1.0","postcss-import":"^12.0.1","postcss-loader":"^3.0.0","rimraf":"^2.6.1","sinon":"^7.3.2","sinon-chai":"^3.3.0","style-loader":"^0.23.1","tslint":"^5.18.0","typescript":"~3.5.2","url-loader":"^2.0.0","webpack":"^4.35.0"},"gitHead":"92d7d42c00a1b0d9ce921533acb08beefdea3eb2"}')},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(37),a=n(99),l=a.PROTOCOL_VERSION.split(".",1)[0],c=function(){function e(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}return e.prototype.display_model=function(e,t,n){var r=this;return void 0===n&&(n={}),this.create_view(t,n).then((function(t){return r.display_view(e,t,n)})).catch(s.reject("Could not create view",!0))},e.prototype.setViewOptions=function(e){return void 0===e&&(e={}),e},e.prototype.create_view=function(e,t){var n=this;void 0===t&&(t={});var r=e.state_change=e.state_change.then((function(){return n.loadClass(e.get("_view_name"),e.get("_view_module"),e.get("_view_module_version")).then((function(r){var i=new r({model:e,options:n.setViewOptions(t)});return i.listenTo(e,"destroy",i.remove),Promise.resolve(i.render()).then((function(){return i}))})).catch(s.reject("Could not create a view for model id "+e.model_id,!0))})),i=s.uuid();return e.views[i]=r,r.then((function(e){e.once("remove",(function(){delete e.model.views[i]}),n)})),e.state_change},e.prototype.callbacks=function(e){return{}},e.prototype.get_model=function(e){return this._models[e]},e.prototype.handle_comm_open=function(e,t){var n=(t.metadata||{}).version||"";if(n.split(".",1)[0]!==l){var r="Wrong widget protocol version: received protocol version '"+n+"', but was expecting major version '"+l+"'";return console.error(r),Promise.reject(r)}var i=t.content.data,o=i.buffer_paths||[],a=(t.buffers||[]).map((function(e){return e instanceof DataView?e:new DataView(e instanceof ArrayBuffer?e:e.buffer)}));return s.put_buffers(i.state,o,a),this.new_model({model_name:i.state._model_name,model_module:i.state._model_module,model_module_version:i.state._model_module_version,comm:e},i.state).catch(s.reject("Could not create a model.",!0))},e.prototype.new_widget=function(e,t){var n,i=this;if(void 0===t&&(t={}),void 0===e.view_name||void 0===e.view_module||void 0===e.view_module_version)return Promise.reject("new_widget(...) must be given view information in the options.");n=e.comm?Promise.resolve(e.comm):this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:a.PROTOCOL_VERSION});var o=r({},e);return n.then((function(e){return o.comm=e,i.new_model(o,t).then((function(e){return e.sync("create",e),e}))}),(function(){return o.model_id||(o.model_id=s.uuid()),i.new_model(o,t)}))},e.prototype.register_model=function(e,t){var n=this;this._models[e]=t,t.then((function(t){t.once("comm:close",(function(){delete n._models[e]}))}))},e.prototype.new_model=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n,r;return o(this,(function(i){switch(i.label){case 0:if(e.model_id)n=e.model_id;else{if(!e.comm)throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");n=e.model_id=e.comm.comm_id}return r=this._make_model(e,t),this.register_model(n,r),[4,r];case 1:return[2,i.sent()]}}))}))},e.prototype._make_model=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n,r,i,s,a,l,c;return o(this,(function(o){switch(o.label){case 0:n=e.model_id,r=this.loadClass(e.model_name,e.model_module,e.model_module_version),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r];case 2:return i=o.sent(),[3,4];case 3:throw s=o.sent(),console.error("Could not instantiate widget"),s;case 4:if(!i)throw new Error("Cannot find model module "+e.model_module+"@"+e.model_module_version+", "+e.model_name);return[4,i._deserialize_state(t,this)];case 5:return a=o.sent(),l={widget_manager:this,model_id:n,comm:e.comm},(c=new i(a,l)).name=e.model_name,c.module=e.model_module,[2,c]}}))}))},e.prototype.clear_state=function(){var e=this;return s.resolvePromisesDict(this._models).then((function(t){Object.keys(t).forEach((function(e){return t[e].close()})),e._models=Object.create(null)}))},e.prototype.get_state=function(e){var t=this;void 0===e&&(e={});var n=Object.keys(this._models).map((function(e){return t._models[e]}));return Promise.all(n).then((function(t){return u(t,e)}))},e.prototype.set_state=function(e){var t=this;if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";var n=e.state;return this._get_comm_info().then((function(e){return Promise.all(Object.keys(n).map((function(r){var i={base64:s.base64ToBuffer,hex:s.hexToBuffer},o=n[r],a=o.state;if(o.buffers){var l=o.buffers.map((function(e){return e.path})),c=o.buffers.map((function(e){return new DataView(i[e.encoding](e.data))}));s.put_buffers(o.state,l,c)}if(t._models[r])return t._models[r].then((function(e){return e.constructor._deserialize_state(a||{},t).then((function(t){return e.set_state(t),e}))}));var u={model_id:r,model_name:o.model_name,model_module:o.model_module,model_module_version:o.model_module_version};return e.hasOwnProperty(r)?t._create_comm(t.comm_target_name,r).then((function(e){return u.comm=e,t.new_model(u)})):t.new_model(u,a)})))}))},e.prototype.disconnect=function(){var e=this;Object.keys(this._models).forEach((function(t){e._models[t].then((function(e){e.comm_live=!1}))}))},e.prototype.resolveUrl=function(e){return Promise.resolve(e)},e.prototype.filterExistingModelState=function(e){var t=this,n=e.state;return n=Object.keys(n).filter((function(e){return!t._models[e]})).reduce((function(e,t){return e[t]=n[t],e}),{}),r({},e,{state:n})},e}();function u(e,t){void 0===t&&(t={});var n={};return e.forEach((function(e){var r=e.model_id,i=s.remove_buffers(e.serialize(e.get_state(t.drop_defaults))),o=i.buffers.map((function(e,t){return{data:s.bufferToBase64(e),path:i.buffer_paths[t],encoding:"base64"}}));n[r]={model_name:e.name,model_module:e.module,model_module_version:e.get("_model_module_version"),state:i.state},o.length>0&&(n[r].buffers=o)})),{version_major:2,version_minor:0,state:n}}t.ManagerBase=c,t.serialize_state=u},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(37);t.set=function(e,t,n){if(null==e)return this;var o;if("object"==typeof e?(o=e,n=t):(o={})[e]=t,n||(n={}),!this._validate(o,n))return!1;var s=n.unset,a=n.silent,l=[],c=this._changing;this._changing=!0,c||(this._previousAttributes=r({},this.attributes),this.changed={});var u=this.attributes,h=this.changed,d=this._previousAttributes;for(var p in o)t=o[p],i.isEqual(u[p],t)||l.push(p),i.isEqual(d[p],t)?delete h[p]:h[p]=t,s?delete u[p]:u[p]=t;if(this.id=this.get(this.idAttribute),!a){l.length&&(this._pending=n);for(var f=0;f<l.length;f++)this.trigger("change:"+l[f],this,u[l[f]],n)}if(c)return this;if(!a)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(38),s=Element.prototype,a=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._removeElement=function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.prototype._setElement=function(e){this.el=e},t.prototype._setAttributes=function(e){for(var t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])},t.prototype.delegate=function(e,t,n){"string"!=typeof t&&(n=t,t=null),void 0===this._domEvents&&(this._domEvents=[]);var r=this.el,i=t?function(e){for(var i=e.target||e.srcElement;i&&i!==r;i=i.parentNode)if(a.call(i,t))return e.delegateTarget=i,n.handleEvent?n.handleEvent(e):n(e)}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({eventName:e,handler:i,listener:n,selector:t}),i},t.prototype.undelegate=function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el&&this._domEvents)for(var r=this._domEvents.slice(),i=r.length;i--;){var o=r[i];!(o.eventName!==e||n&&o.listener!==n||t&&o.selector!==t)&&(this.el.removeEventListener(o.eventName,o.handler,!1),this._domEvents.splice(i,1))}return this},t.prototype.undelegateEvents=function(){if(this.el&&this._domEvents){for(var e=this._domEvents.length,t=0;t<e;t++){var n=this._domEvents[t];this.el.removeEventListener(n.eventName,n.handler,!1)}this._domEvents.length=0}return this},t}(o.View);t.NativeView=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(100),a={align_content:null,align_items:null,align_self:null,border:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,overflow_x:null,overflow_y:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){return o.assign(e.prototype.defaults.call(this),{_model_name:"LayoutModel",_view_name:"LayoutView"},a)},t}(s.WidgetModel);t.LayoutModel=l;var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.initialize=function(t){this._traitNames=[],e.prototype.initialize.call(this,t);for(var n=0,r=Object.keys(a);n<r.length;n++){var i=r[n];this.registerTrait(i)}},t.prototype.registerTrait=function(e){var t=this;if(this._traitNames.push(e),"overflow_x"===e||"overflow_y"===e)return this.listenTo(this.model,"change:"+e,(function(n,r){t.handleOverflowChange(e,r)})),void this.handleOverflowChange(e,this.model.get(e));this.listenTo(this.model,"change:"+e,(function(n,r){t.handleChange(e,r)})),this.handleChange(e,this.model.get(e))},t.prototype.css_name=function(e){return e.replace(/_/g,"-")},t.prototype.handleChange=function(e,t){var n=this.options.parent;n?null===t?n.el.style.removeProperty(this.css_name(e)):n.el.style[this.css_name(e)]=t:console.warn("Style not applied because a parent view does not exist")},t.prototype.handleOverflowChange=function(e,t){var n=this.options.parent;n?null===t?null===this.model.get("overflow")&&n.el.style.removeProperty(this.css_name(e)):n.el.style[this.css_name(e)]=t:console.warn("Style not applied because a parent view does not exist")},t.prototype.unlayout=function(){var e=this,t=this.options.parent;this._traitNames.forEach((function(n){t?t.el.style.removeProperty(e.css_name(n)):console.warn("Style not removed because a parent view does not exist")}),this)},t}(s.WidgetView);t.LayoutView=c},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(100),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){var t=this.constructor;return o.assign(e.prototype.defaults.call(this),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(t.styleProperties).reduce((function(e,n){return e[n]=t.styleProperties[n].default,e}),{}))},t.styleProperties={},t}(s.WidgetModel);t.StyleModel=a;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.initialize=function(t){this._traitNames=[],e.prototype.initialize.call(this,t);for(var n=this.model.constructor,r=0,i=Object.keys(n.styleProperties);r<i.length;r++){var o=i[r];this.registerTrait(o)}this.style()},t.prototype.registerTrait=function(e){var t=this;this._traitNames.push(e),this.listenTo(this.model,"change:"+e,(function(n,r){t.handleChange(e,r)}))},t.prototype.handleChange=function(e,t){var n=this.options.parent;if(n){var r=this.model.constructor.styleProperties,i=r[e].attribute,o=r[e].selector,s=o?n.el.querySelectorAll(o):[n.el];if(null===t)for(var a=0;a!==s.length;++a)s[a].style.removeProperty(i);else for(a=0;a!==s.length;++a)s[a].style[i]=t}else console.warn("Style not applied because a parent view does not exist")},t.prototype.style=function(){for(var e=0,t=this._traitNames;e<t.length;e++){var n=t[e];this.handleChange(n,this.model.get(n))}},t.prototype.unstyle=function(){var e=this.options.parent,t=this.model.constructor.styleProperties;this._traitNames.forEach((function(n){if(e)for(var r=t[n].attribute,i=t[n].selector,o=i?e.el.querySelectorAll(i):[e.el],s=0;s!==o.length;++s)o[s].style.removeProperty(r);else console.warn("Style not removed because a parent view does not exist")}),this)},t}(s.WidgetView);t.StyleView=l},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),function(e){!function(e){var t=function(){function e(e){this.targets=Object.create(null),this.comms=Object.create(null),this.kernel=null,this.jsServicesKernel=null,this.init_kernel(e)}return e.prototype.init_kernel=function(e){this.kernel=e,this.jsServicesKernel=e},e.prototype.new_comm=function(e,t,o,s,a,l){return r(this,void 0,void 0,(function(){var r,c;return i(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve(this.jsServicesKernel.connectToComm(e,a))];case 1:return r=i.sent(),c=new n(r),this.register_comm(c),c.open(t,o,s,l),[2,c]}}))}))},e.prototype.register_target=function(e,t){var r=this,i=this.jsServicesKernel.registerCommTarget(e,(function(e,i){var o=new n(e);r.register_comm(o);try{return t(o,i)}catch(e){o.close(),console.error(e),console.error(new Error("Exception opening new comm"))}}));this.targets[e]=i},e.prototype.unregister_target=function(e,t){this.targets[e].dispose(),delete this.targets[e]},e.prototype.register_comm=function(e){return this.comms[e.comm_id]=Promise.resolve(e),e.kernel=this.kernel,e.comm_id},e}();e.CommManager=t;var n=function(){function e(e){this.jsServicesComm=null,this.kernel=null,this.jsServicesComm=e}return Object.defineProperty(e.prototype,"comm_id",{get:function(){return this.jsServicesComm.commId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target_name",{get:function(){return this.jsServicesComm.targetName},enumerable:!0,configurable:!0}),e.prototype.open=function(e,t,n,r){var i=this.jsServicesComm.open(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.send=function(e,t,n,r){var i=this.jsServicesComm.send(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.close=function(e,t,n,r){var i=this.jsServicesComm.close(e,n,r);return this._hookupCallbacks(i,t),i.msg.header.msg_id},e.prototype.on_msg=function(e){this.jsServicesComm.onMsg=e.bind(this)},e.prototype.on_close=function(e){this.jsServicesComm.onClose=e.bind(this)},e.prototype._hookupCallbacks=function(e,t){t&&(e.onReply=function(e){t.shell&&t.shell.reply&&t.shell.reply(e)},e.onStdin=function(e){t.input&&t.input(e)},e.onIOPub=function(e){if(t.iopub)if(t.iopub.status&&"status"===e.header.msg_type)t.iopub.status(e);else if(t.iopub.clear_output&&"clear_output"===e.header.msg_type)t.iopub.clear_output(e);else if(t.iopub.output)switch(e.header.msg_type){case"display_data":case"execute_result":t.iopub.output(e)}})},e}();e.Comm=n}(e.services||(e.services={}))}(t.shims||(t.shims={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n){this.initialize(e,t,n)}return e.prototype.initialize=function(e,t,n){this._handler_context=n||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=t||function(e){e.remove()}},e.prototype.update=function(e,t,n,r){var i=n||this._remove_view,o=t||this._create_view;r=r||this._handler_context;for(var s=0;s<e.length&&!(s>=this._models.length||e[s]!==this._models[s]);s++);for(var a=s,l=this.views.splice(a,this.views.length-a),c=0;c<l.length;c++)l[c].then((function(e){i.call(r,e)}));for(;s<e.length;s++)this.views.push(Promise.resolve(o.call(r,e[s],s)));return this._models=e.slice(),Promise.all(this.views)},e.prototype.remove=function(){var e=this;return Promise.all(this.views).then((function(t){t.forEach((function(t){return e._remove_view.call(e._handler_context,t)})),e.views=[],e._models=[]}))},e.prototype.dispose=function(){this.views=null,this._models=null},e}();t.ViewList=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12);t.IJupyterWidgetRegistry=new r.Token("jupyter.extensions.jupyterWidgetRegistry")},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(72),a=n(5),l=n(55),c=n(11);n(494);var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.defaults=function(){return o({},e.prototype.defaults.call(this),{msg_id:""})},t.prototype.initialize=function(t,n){e.prototype.initialize.call(this,t,n),this._outputs=new l.OutputAreaModel({values:t.outputs,trusted:!0})},Object.defineProperty(t.prototype,"outputs",{get:function(){return this._outputs},enumerable:!0,configurable:!0}),t}(s.OutputModel);t.OutputModel=u;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._createElement=function(e){return this.pWidget=new a.Panel,this.pWidget.node},t.prototype._setElement=function(e){if(this.el||e!==this.pWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.pWidget.node,this.$el=c(this.pWidget.node)},t.prototype.render=function(){var e=this.model.widget_manager.renderMime;this._outputView=new l.OutputArea({rendermime:e,model:this.model.outputs}),this.pWidget.insertWidget(0,this._outputView),this.pWidget.addClass("jupyter-widgets"),this.pWidget.addClass("widget-output"),this.update()},t}(s.OutputView);t.OutputView=h},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var s=n(9);t.OUTPUT_WIDGET_VERSION="1.0.0";var a=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.defaults=function(){return o({},e.prototype.defaults.call(this),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:t.OUTPUT_WIDGET_VERSION,_view_module_version:t.OUTPUT_WIDGET_VERSION})},n}(s.DOMWidgetModel);t.OutputModel=a;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(s.DOMWidgetView);t.OutputView=l},function(e,t,n){var r=n(483);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/*-----------------------------------------------------------------------------\n| Private CSS variables\n|----------------------------------------------------------------------------*/\n\n\n:root {\n}\n\n\n/*-----------------------------------------------------------------------------\n| Main OutputArea\n| OutputArea has a list of Outputs\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea {\n overflow-y: auto;\n}\n\n\n.jp-OutputArea-child {\n display: flex;\n flex-direction: row;\n}\n\n\n\n.jp-OutputPrompt {\n flex: 0 0 var(--jp-cell-prompt-width);\n color: var(--jp-cell-outprompt-font-color);\n font-family: var(--jp-cell-prompt-font-family);\n padding: var(--jp-code-padding);\n letter-spacing: var(--jp-cell-prompt-letter-spacing);\n line-height: var(--jp-code-line-height);\n font-size: var(--jp-code-font-size);\n border: var(--jp-border-width) solid transparent;\n opacity: var(--jp-cell-prompt-opacity);\n /* Right align prompt text, don't wrap to handle large prompt numbers */\n text-align: right;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n /* Disable text selection */\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.jp-OutputArea-output {\n flex-grow: 1;\n flex-shrink: 1;\n height: auto;\n overflow-x: auto;\n user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n -ms-user-select: text;\n}\n\n\n/**\n * Isolated output.\n */\n .jp-OutputArea-output.jp-mod-isolated {\n width: 100%;\n display: block;\n}\n\n\n/*\nWhen drag events occur, `p-mod-override-cursor` is added to the body.\nBecause iframes steal all cursor events, the following two rules are necessary\nto suppress pointer events while resize drags are occuring. There may be a\nbetter solution to this problem.\n*/\nbody.p-mod-override-cursor .jp-OutputArea-output.jp-mod-isolated {\n position: relative;\n}\n\nbody.p-mod-override-cursor .jp-OutputArea-output.jp-mod-isolated:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: transparent;\n}\n\n\n/* pre */\n\n.jp-OutputArea-output pre {\n border: none;\n margin: 0px;\n padding: 0px;\n overflow-x: auto;\n overflow-y: auto;\n word-break: break-all;\n word-wrap: break-word;\n white-space: pre-wrap;\n}\n\n\n/* tables */\n\n.jp-OutputArea-output.jp-RenderedHTMLCommon table {\n margin-left: 0;\n margin-right: 0;\n}\n\n\n/* Hide the gutter in case of\n * - nested output areas (e.g. in the case of output widgets)\n * - mirrored output areas\n */\n.jp-OutputArea .jp-OutputArea .jp-OutputArea-prompt {\n display: none;\n}\n\n/*-----------------------------------------------------------------------------\n| executeResult is added to any Output-result for the display of the object\n| returned by a cell\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea-output.jp-OutputArea-executeResult {\n margin-left: 0px;\n flex: 1 1 auto;\n}\n\n\n.jp-OutputArea-executeResult.jp-RenderedText {\n padding-top: var(--jp-code-padding);\n}\n\n\n\n/*-----------------------------------------------------------------------------\n| The Stdin output\n|----------------------------------------------------------------------------*/\n\n\n.jp-OutputArea-stdin {\n line-height: var(--jp-code-line-height);\n padding-top: var(--jp-code-padding);\n display: flex;\n}\n\n\n.jp-Stdin-prompt {\n padding-right: var(--jp-code-padding);\n vertical-align: baseline;\n flex: 0 0 auto;\n}\n\n\n.jp-Stdin-input {\n font-family: var(--jp-code-font-family);\n font-size: inherit;\n color: inherit;\n width: auto;\n /* make sure input baseline aligns with prompt */\n vertical-align: baseline;\n /* padding + margin = 0.5em between prompt and cursor */\n padding: 0em 0.25em;\n margin: 0em 0.25em;\n flex: 0 0 70%;\n}\n\n\n.jp-Stdin-input:focus {\n box-shadow: none;\n}\n",""])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(6),o=n(18),s=n(183),a=n(54),l=function(){function e(t){void 0===t&&(t={});var n=this;this.clearNext=!1,this.list=null,this._trusted=!1,this._isDisposed=!1,this._stateChanged=new i.Signal(this),this._changed=new i.Signal(this),this._modelDB=null,this._serialized=null,this._changeGuard=!1,this._trusted=!!t.trusted,this.contentFactory=t.contentFactory||e.defaultContentFactory,this.list=new s.ObservableList,t.values&&r.each(t.values,(function(e){n._add(e)})),this.list.changed.connect(this._onListChanged,this),t.modelDB&&(this._modelDB=t.modelDB,this._serialized=this._modelDB.createValue("outputs"),this._serialized.get()?this.fromJSON(this._serialized.get()):this._serialized.set(this.toJSON()),this._serialized.changed.connect(this._onSerializedChanged,this))}return Object.defineProperty(e.prototype,"stateChanged",{get:function(){return this._stateChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.list?this.list.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trusted",{get:function(){return this._trusted},set:function(e){if(e!==this._trusted)for(var t=this._trusted=e,n=0;n<this.list.length;n++){var r=this.list.get(n),i=r.toJSON();r.dispose(),r=this._createItem({value:i,trusted:t}),this.list.set(n,r)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(this._isDisposed=!0,this.list.dispose(),i.Signal.clearData(this))},e.prototype.get=function(e){return this.list.get(e)},e.prototype.set=function(e,t){this._normalize(t);var n=this._createItem({value:t,trusted:this._trusted});this.list.set(e,n)},e.prototype.add=function(e){return this.clearNext&&(this.clear(),this.clearNext=!1),this._add(e)},e.prototype.clear=function(e){void 0===e&&(e=!1),this._lastStream="",e?this.clearNext=!0:(r.each(this.list,(function(e){e.dispose()})),this.list.clear())},e.prototype.fromJSON=function(e){var t=this;this.clear(),r.each(e,(function(e){t._add(e)}))},e.prototype.toJSON=function(){return r.toArray(r.map(this.list,(function(e){return e.toJSON()})))},e.prototype._add=function(e){var t=this._trusted;if(this._normalize(e),o.nbformat.isStream(e)&&this._lastStream&&e.name===this._lastName){this._lastStream+=e.text,e.text=this._lastStream,this._removeOverwrittenChars(e);var n=this._createItem({value:e,trusted:t}),r=this.length-1;return this.list.get(r).dispose(),this.list.set(r,n),r}o.nbformat.isStream(e)&&this._removeOverwrittenChars(e);var i=this._createItem({value:e,trusted:t});return o.nbformat.isStream(e)?(this._lastStream=e.text,this._lastName=e.name):this._lastStream="",this.list.push(i)},e.prototype._normalize=function(e){o.nbformat.isStream(e)&&Array.isArray(e.text)&&(e.text=e.text.join("\n"))},e.prototype._fixBackspace=function(e){var t=e;do{t=(e=t).replace(/[^\n]\x08/gm,"")}while(t.length<e.length);return e},e.prototype._fixCarriageReturn=function(e){var t=e;t=t.replace(/\r\r+\n/gm,"\r\n");do{t=t.replace(/^[^\n]*(?:\r(?!\n))+/gm,"")}while(t.search(/\r(?!\n)/)>-1);do{t=t.replace(/\r\n/gm,"\n")}while(t.indexOf("\r\n")>-1);return t},e.prototype._removeOverwrittenChars=function(e){var t=e.text;e.text=this._fixCarriageReturn(this._fixBackspace(t))},e.prototype._createItem=function(e){var t=this.contentFactory.createOutputModel(e);return t.changed.connect(this._onGenericChange,this),t.changed.connect(this._onGenericChange,this),t},e.prototype._onListChanged=function(e,t){this._serialized&&!this._changeGuard&&(this._changeGuard=!0,this._serialized.set(this.toJSON()),this._changeGuard=!1),this._changed.emit(t),this._stateChanged.emit(void 0)},e.prototype._onSerializedChanged=function(e,t){this._changeGuard||(this._changeGuard=!0,this.fromJSON(t.newValue),this._changeGuard=!1)},e.prototype._onGenericChange=function(){this._stateChanged.emit(void 0)},e}();t.OutputAreaModel=l,function(e){var t=function(){function e(){}return e.prototype.createOutputModel=function(e){return new a.OutputModel(e)},e}();e.ContentFactory=t,e.defaultContentFactory=new t}(l=t.OutputAreaModel||(t.OutputAreaModel={})),t.OutputAreaModel=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45),i=n(6),o=n(12),s=n(101),a=n(184),l=n(185),c=n(186),u=function(){function e(e){void 0===e&&(e=null),this._value=null,this._changed=new i.Signal(this),this._isDisposed=!1,this._value=e}return Object.defineProperty(e.prototype,"type",{get:function(){return"Value"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),e.prototype.get=function(){return this._value},e.prototype.set=function(e){var t=this._value;o.JSONExt.deepEqual(t,e)||(this._value=e,this._changed.emit({oldValue:t,newValue:e}))},e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,i.Signal.clearData(this),this._value=null)},e}();t.ObservableValue=u,function(e){var t=function(){};e.IChangedArgs=t}(u=t.ObservableValue||(t.ObservableValue={})),t.ObservableValue=u;var h=function(){function e(e){void 0===e&&(e={}),this.isPrepopulated=!1,this.isCollaborative=!1,this.connected=Promise.resolve(void 0),this._toDispose=!1,this._isDisposed=!1,this._disposables=new r.DisposableSet,this._basePath=e.basePath||"",e.baseDB?this._db=e.baseDB:(this._db=new s.ObservableMap,this._toDispose=!0)}return Object.defineProperty(e.prototype,"basePath",{get:function(){return this._basePath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),e.prototype.get=function(e){return this._db.get(this._resolvePath(e))},e.prototype.has=function(e){return this._db.has(this._resolvePath(e))},e.prototype.createString=function(e){var t=new l.ObservableString;return this._disposables.add(t),this.set(e,t),t},e.prototype.createList=function(e){var t=new c.ObservableUndoableList(new c.ObservableUndoableList.IdentitySerializer);return this._disposables.add(t),this.set(e,t),t},e.prototype.createMap=function(e){var t=new a.ObservableJSON;return this._disposables.add(t),this.set(e,t),t},e.prototype.createValue=function(e){var t=new u;return this._disposables.add(t),this.set(e,t),t},e.prototype.getValue=function(e){var t=this.get(e);if(!t||"Value"!==t.type)throw Error("Can only call getValue for an ObservableValue");return t.get()},e.prototype.setValue=function(e,t){var n=this.get(e);if(!n||"Value"!==n.type)throw Error("Can only call setValue on an ObservableValue");n.set(t)},e.prototype.view=function(t){var n=new e({basePath:t,baseDB:this});return this._disposables.add(n),n},e.prototype.set=function(e,t){this._db.set(this._resolvePath(e),t)},e.prototype.dispose=function(){this.isDisposed||(this._isDisposed=!0,this._toDispose&&this._db.dispose(),this._disposables.dispose())},e.prototype._resolvePath=function(e){return this._basePath&&(e=this._basePath+"."+e),e},e}();t.ModelDB=h},function(e,t,n){var r=n(487);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,'/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n\n/*-----------------------------------------------------------------------------\n| RenderedText\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedText {\n text-align: left;\n padding-left: var(--jp-code-padding);\n font-size: var(--jp-code-font-size);\n line-height: var(--jp-code-line-height);\n font-family: var(--jp-code-font-family);\n}\n\n\n.jp-RenderedText pre,\n.jp-RenderedHTMLCommon pre {\n color: var(--jp-content-font-color1);\n border: none;\n margin: 0px;\n padding: 0px;\n}\n\n\n/* ansi_up creates classed spans for console foregrounds and backgrounds. */\n.jp-RenderedText pre .ansi-black-fg { color: #3E424D; }\n.jp-RenderedText pre .ansi-red-fg { color: #E75C58; }\n.jp-RenderedText pre .ansi-green-fg { color: #00A250; }\n.jp-RenderedText pre .ansi-yellow-fg { color: #DDB62B; }\n.jp-RenderedText pre .ansi-blue-fg { color: #208FFB; }\n.jp-RenderedText pre .ansi-magenta-fg { color: #D160C4; }\n.jp-RenderedText pre .ansi-cyan-fg { color: #60C6C8; }\n.jp-RenderedText pre .ansi-white-fg { color: #C5C1B4; }\n\n.jp-RenderedText pre .ansi-black-bg { background-color: #3E424D; }\n.jp-RenderedText pre .ansi-red-bg { background-color: #E75C58; }\n.jp-RenderedText pre .ansi-green-bg { background-color: #00A250; }\n.jp-RenderedText pre .ansi-yellow-bg { background-color: #DDB62B; }\n.jp-RenderedText pre .ansi-blue-bg { background-color: #208FFB; }\n.jp-RenderedText pre .ansi-magenta-bg { background-color: #D160C4; }\n.jp-RenderedText pre .ansi-cyan-bg { background-color: #60C6C8; }\n.jp-RenderedText pre .ansi-white-bg { background-color: #C5C1B4; }\n\n.jp-RenderedText pre .ansi-bright-black-fg { color: #282C36; }\n.jp-RenderedText pre .ansi-bright-red-fg { color: #B22B31; }\n.jp-RenderedText pre .ansi-bright-green-fg { color: #007427; }\n.jp-RenderedText pre .ansi-bright-yellow-fg { color: #B27D12; }\n.jp-RenderedText pre .ansi-bright-blue-fg { color: #0065CA; }\n.jp-RenderedText pre .ansi-bright-magenta-fg { color: #A03196; }\n.jp-RenderedText pre .ansi-bright-cyan-fg { color: #258F8F; }\n.jp-RenderedText pre .ansi-bright-white-fg { color: #A1A6B2; }\n\n.jp-RenderedText pre .ansi-bright-black-bg { background-color: #282C36; }\n.jp-RenderedText pre .ansi-bright-red-bg { background-color: #B22B31; }\n.jp-RenderedText pre .ansi-bright-green-bg { background-color: #007427; }\n.jp-RenderedText pre .ansi-bright-yellow-bg { background-color: #B27D12; }\n.jp-RenderedText pre .ansi-bright-blue-bg { background-color: #0065CA; }\n.jp-RenderedText pre .ansi-bright-magenta-bg { background-color: #A03196; }\n.jp-RenderedText pre .ansi-bright-cyan-bg { background-color: #258F8F; }\n.jp-RenderedText pre .ansi-bright-white-bg { background-color: #A1A6B2; }\n\n\n.jp-RenderedText[data-mime-type="application/vnd.jupyter.stderr"] {\n background: var(--jp-rendermime-error-background);\n}\n\n\n/*-----------------------------------------------------------------------------\n| RenderedLatex\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedLatex {\n color: var(--jp-content-font-color1);\n font-size: var(--jp-content-font-size1);\n line-height: var(--jp-content-line-height);\n}\n\n\n/*-----------------------------------------------------------------------------\n| RenderedHTML\n|----------------------------------------------------------------------------*/\n\n\n.jp-RenderedHTMLCommon {\n color: var(--jp-content-font-color1);\n font-size: var(--jp-content-font-size1);\n line-height: var(--jp-content-line-height);\n /* Give a bit more R padding on Markdown text to keep line lengths reasonable */\n padding-right: 20px;\n}\n\n\n.jp-RenderedHTMLCommon .MathJax_Display {\n margin: 0;\n}\n\n\n.jp-RenderedHTMLCommon em {\n font-style: italic;\n}\n\n\n.jp-RenderedHTMLCommon strong {\n font-weight: bold;\n}\n\n\n.jp-RenderedHTMLCommon u {\n text-decoration: underline;\n}\n\n\n.jp-RenderedHTMLCommon a:link {\n text-decoration: none;\n color: var(--jp-content-link-color);\n}\n\n\n.jp-RenderedHTMLCommon a:hover {\n text-decoration: underline;\n color: var(--jp-content-link-color);\n}\n\n\n.jp-RenderedHTMLCommon a:visited {\n text-decoration: none;\n color: var(--jp-content-link-color);\n}\n\n\n/* Headings */\n\n.jp-RenderedHTMLCommon h1,\n.jp-RenderedHTMLCommon h2,\n.jp-RenderedHTMLCommon h3,\n.jp-RenderedHTMLCommon h4,\n.jp-RenderedHTMLCommon h5,\n.jp-RenderedHTMLCommon h6 {\n line-height: var(--jp-content-heading-line-height);\n font-weight: var(--jp-content-heading-font-weight);\n font-style: normal;\n margin: var(--jp-content-heading-margin-top) 0 var(--jp-content-heading-margin-bottom) 0;\n}\n\n\n.jp-RenderedHTMLCommon h1:first-child,\n.jp-RenderedHTMLCommon h2:first-child,\n.jp-RenderedHTMLCommon h3:first-child,\n.jp-RenderedHTMLCommon h4:first-child,\n.jp-RenderedHTMLCommon h5:first-child,\n.jp-RenderedHTMLCommon h6:first-child {\n margin-top: calc( 0.5 * var(--jp-content-heading-margin-top) );\n}\n\n\n.jp-RenderedHTMLCommon h1:last-child,\n.jp-RenderedHTMLCommon h2:last-child,\n.jp-RenderedHTMLCommon h3:last-child,\n.jp-RenderedHTMLCommon h4:last-child,\n.jp-RenderedHTMLCommon h5:last-child,\n.jp-RenderedHTMLCommon h6:last-child {\n margin-bottom: calc( 0.5 * var(--jp-content-heading-margin-bottom) );\n}\n\n\n.jp-RenderedHTMLCommon h1 {\n font-size: var(--jp-content-font-size5);\n}\n\n\n.jp-RenderedHTMLCommon h2 {\n font-size: var(--jp-content-font-size4);\n}\n\n\n.jp-RenderedHTMLCommon h3 {\n font-size: var(--jp-content-font-size3);\n}\n\n\n.jp-RenderedHTMLCommon h4 {\n font-size: var(--jp-content-font-size2);\n}\n\n\n.jp-RenderedHTMLCommon h5 {\n font-size: var(--jp-content-font-size1);\n}\n\n\n.jp-RenderedHTMLCommon h6 {\n font-size: var(--jp-content-font-size0);\n}\n\n/* Lists */\n\n.jp-RenderedHTMLCommon ul:not(.list-inline),\n.jp-RenderedHTMLCommon ol:not(.list-inline) {\n padding-left: 2em;\n}\n\n\n.jp-RenderedHTMLCommon ul {\n list-style: disc;\n}\n\n\n.jp-RenderedHTMLCommon ul ul {\n list-style: square;\n}\n\n\n.jp-RenderedHTMLCommon ul ul ul {\n list-style: circle;\n}\n\n\n.jp-RenderedHTMLCommon ol {\n list-style: decimal;\n}\n\n\n.jp-RenderedHTMLCommon ol ol {\n list-style: upper-alpha;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol {\n list-style: lower-alpha;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol ol {\n list-style: lower-roman;\n}\n\n\n.jp-RenderedHTMLCommon ol ol ol ol ol {\n list-style: decimal;\n}\n\n\n.jp-RenderedHTMLCommon ol,\n.jp-RenderedHTMLCommon ul {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon ul ul,\n.jp-RenderedHTMLCommon ul ol,\n.jp-RenderedHTMLCommon ol ul,\n.jp-RenderedHTMLCommon ol ol {\n margin-bottom: 0em;\n}\n\n\n.jp-RenderedHTMLCommon hr {\n color: var(--jp-border-color2);\n background-color: var(--jp-border-color1);\n margin-top: 1em;\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon > pre {\n margin: 1.5em 2em;\n}\n\n\n.jp-RenderedHTMLCommon pre,\n.jp-RenderedHTMLCommon code {\n border: 0;\n background-color: var(--jp-layout-color0);\n color: var(--jp-content-font-color1);\n font-family: var(--jp-code-font-family);\n font-size: var(--jp-code-font-size);\n line-height: var(--jp-code-line-height);\n padding: 0px;\n}\n\n/* Tables */\n\n.jp-RenderedHTMLCommon table {\n border-collapse: collapse;\n border-spacing: 0;\n border: none;\n color: var(--jp-ui-font-color1);\n font-size: 12px;\n table-layout: fixed;\n margin-left: auto;\n margin-right: auto;\n}\n\n\n.jp-RenderedHTMLCommon thead {\n border-bottom: var(--jp-border-width) solid var(--jp-border-color1);\n vertical-align: bottom;\n}\n\n\n.jp-RenderedHTMLCommon td,\n.jp-RenderedHTMLCommon th,\n.jp-RenderedHTMLCommon tr {\n text-align: right;\n vertical-align: middle;\n padding: 0.5em 0.5em;\n line-height: normal;\n white-space: normal;\n max-width: none;\n border: none;\n}\n\n\n.jp-RenderedMarkdown.jp-RenderedHTMLCommon td,\n.jp-RenderedMarkdown.jp-RenderedHTMLCommon th {\n max-width: none;\n}\n\n\n.jp-RenderedHTMLCommon th {\n font-weight: bold;\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:nth-child(odd) {\n background: var(--jp-layout-color0);\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:nth-child(even) {\n background: var( --jp-rendermime-table-row-background);\n}\n\n\n.jp-RenderedHTMLCommon tbody tr:hover {\n background: var( --jp-rendermime-table-row-hover-background);\n}\n\n\n.jp-RenderedHTMLCommon table {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon p {\n text-align: left;\n margin: 0px;\n}\n\n\n.jp-RenderedHTMLCommon p {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon img {\n -moz-force-broken-image-icon: 1;\n}\n\n\n/* Restrict to direct children as other images could be nested in other content. */\n.jp-RenderedHTMLCommon > img {\n display: block;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon img,\n.jp-RenderedImage img,\n.jp-RenderedHTMLCommon svg,\n.jp-RenderedSVG svg {\n max-width: 100%;\n height: auto;\n}\n\n\n.jp-RenderedHTMLCommon img.jp-mod-unconfined,\n.jp-RenderedImage img.jp-mod-unconfined,\n.jp-RenderedHTMLCommon svg.jp-mod-unconfined,\n.jp-RenderedSVG svg.jp-mod-unconfined {\n max-width: none;\n}\n\n\n.jp-RenderedHTMLCommon .alert {\n margin-bottom: 1em;\n}\n\n\n.jp-RenderedHTMLCommon blockquote {\n margin: 1em 2em;\n padding: 0 1em;\n border-left: 5px solid var(--jp-border-color2);\n}\n\na.jp-InternalAnchorLink {\n visibility: hidden;\n margin-left: 8px;\n color: var(--md-blue-800);\n}\n\nh1:hover .jp-InternalAnchorLink,\nh2:hover .jp-InternalAnchorLink,\nh3:hover .jp-InternalAnchorLink,\nh4:hover .jp-InternalAnchorLink,\nh5:hover .jp-InternalAnchorLink,\nh6:hover .jp-InternalAnchorLink {\n visibility: visible;\n}\n\n\n/* Most direct children of .jp-RenderedHTMLCommon have a margin-bottom of 1.0.\n * At the bottom of cells this is a bit too much as there is also spacing\n * between cells. Going all the way to 0 gets too tight between markdown and\n * code cells.\n */\n.jp-RenderedHTMLCommon > *:last-child {\n margin-bottom: 0.5em;\n}\n\n\n\n/*-----------------------------------------------------------------------------\n| RenderedPDF\n|----------------------------------------------------------------------------*/\n\n.jp-RenderedPDF {\n font-size: var(--jp-ui-font-size1);\n}\n',""])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(188);t.htmlRendererFactory={safe:!0,mimeTypes:["text/html"],defaultRank:50,createRenderer:function(e){return new r.RenderedHTML(e)}},t.imageRendererFactory={safe:!0,mimeTypes:["image/bmp","image/png","image/jpeg","image/gif"],defaultRank:90,createRenderer:function(e){return new r.RenderedImage(e)}},t.latexRendererFactory={safe:!0,mimeTypes:["text/latex"],defaultRank:70,createRenderer:function(e){return new r.RenderedLatex(e)}},t.markdownRendererFactory={safe:!0,mimeTypes:["text/markdown"],defaultRank:60,createRenderer:function(e){return new r.RenderedMarkdown(e)}},t.svgRendererFactory={safe:!1,mimeTypes:["image/svg+xml"],defaultRank:80,createRenderer:function(e){return new r.RenderedSVG(e)}},t.textRendererFactory={safe:!0,mimeTypes:["text/plain","application/vnd.jupyter.stdout","application/vnd.jupyter.stderr"],defaultRank:120,createRenderer:function(e){return new r.RenderedText(e)}},t.javaScriptRendererFactory={safe:!1,mimeTypes:["text/javascript","application/javascript"],defaultRank:110,createRenderer:function(e){return new r.RenderedJavaScript(e)}},t.standardRendererFactories=[t.htmlRendererFactory,t.markdownRendererFactory,t.latexRendererFactory,t.svgRendererFactory,t.imageRendererFactory,t.javaScriptRendererFactory,t.textRendererFactory]},function(e,t,n){var r;!function(n,i){var o,s,a=void 0!==e,l=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]];function c(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0}c.prototype.setup_palette=function(){s=[],function(){var e,t;for(e=0;e<2;++e)for(t=0;t<8;++t)s.push(l[e][t].color)}(),function(){var e,t,n,r=[0,95,135,175,215,255],i=function(e,t,n){return r[e]+", "+r[t]+", "+r[n]};for(e=0;e<6;++e)for(t=0;t<6;++t)for(n=0;n<6;++n)s.push(i.call(this,e,t,n))}(),function(){var e,t=8,n=function(e){return e+", "+e+", "+e};for(e=0;e<24;++e,t+=10)s.push(n.call(this,t))}()},c.prototype.escape_for_html=function(e){return e.replace(/[&<>]/gm,(function(e){return"&"==e?"&amp;":"<"==e?"&lt;":">"==e?"&gt;":void 0}))},c.prototype.linkify=function(e){return e.replace(/(https?:\/\/[^\s]+)/gm,(function(e){return'<a href="'+e+'">'+e+"</a>"}))},c.prototype.ansi_to_html=function(e,t){return this.process(e,t,!0)},c.prototype.ansi_to_text=function(e){return this.process(e,{},!1)},c.prototype.process=function(e,t,n){var r=this,i=e.split(/\033\[/),o=i.shift(),s=i.map((function(e){return r.process_chunk(e,t,n)}));return s.unshift(o),s.join("")},c.prototype.process_chunk=function(e,t,n){var r=void 0!==(t=void 0===t?{}:t).use_classes&&t.use_classes,i=r?"class":"color",o=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!o)return e;var a=o[4],c=o[2].split(";");if(""!==o[1]||"m"!==o[3])return a;if(!n)return a;for(var u=this;c.length>0;){var h=c.shift(),d=parseInt(h);isNaN(d)||0===d?(u.fg=u.bg=null,u.bright=0):1===d?u.bright=1:39==d?u.fg=null:49==d?u.bg=null:d>=30&&d<38?u.fg=l[u.bright][d%10][i]:d>=90&&d<98?u.fg=l[1][d%10][i]:d>=40&&d<48?u.bg=l[0][d%10][i]:d>=100&&d<108?u.bg=l[1][d%10][i]:38!==d&&48!==d||function(){var e=38===d;if(c.length>=1){var t=c.shift();if("5"===t&&c.length>=1){var n=parseInt(c.shift());if(n>=0&&n<=255)if(r){var i=n>=16?"ansi-palette-"+n:l[n>7?1:0][n%8].class;e?u.fg=i:u.bg=i}else s||u.setup_palette.call(u),e?u.fg=s[n]:u.bg=s[n]}else if("2"===t&&c.length>=3){var o=parseInt(c.shift()),a=parseInt(c.shift()),h=parseInt(c.shift());if(o>=0&&o<=255&&a>=0&&a<=255&&h>=0&&h<=255){var p=o+", "+a+", "+h;r?e?(u.fg="ansi-truecolor",u.fg_truecolor=p):(u.bg="ansi-truecolor",u.bg_truecolor=p):e?u.fg=p:u.bg=p}}}}()}if(null===u.fg&&null===u.bg)return a;var p=[],f=[],g={},m=function(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push("data-"+t+'="'+this.escape_for_html(e[t])+'"');return n.length>0?" "+n.join(" "):""};return u.fg&&(r?(f.push(u.fg+"-fg"),null!==u.fg_truecolor&&(g["ansi-truecolor-fg"]=u.fg_truecolor,u.fg_truecolor=null)):p.push("color:rgb("+u.fg+")")),u.bg&&(r?(f.push(u.bg+"-bg"),null!==u.bg_truecolor&&(g["ansi-truecolor-bg"]=u.bg_truecolor,u.bg_truecolor=null)):p.push("background-color:rgb("+u.bg+")")),r?'<span class="'+f.join(" ")+'"'+m.call(u,g)+">"+a+"</span>":'<span style="'+p.join(";")+'"'+m.call(u,g)+">"+a+"</span>"},o={escape_for_html:function(e){return(new c).escape_for_html(e)},linkify:function(e){return(new c).linkify(e)},ansi_to_html:function(e,t){return(new c).ansi_to_html(e,t)},ansi_to_text:function(e){return(new c).ansi_to_text(e)},ansi_to_html_obj:function(){return new c}},a&&(e.exports=o),"undefined"!=typeof window&&"undefined"==typeof ender&&(window.ansi_up=o),void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}(Date)},function(e,t,n){(function(t){!function(t){"use strict";var n={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:g,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:g,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:g,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n?(?!hr|heading|lheading| {0,3}>|tag)[^\n]+)+)/,text:/^[^\n]+/};function r(e){this.tokens=[],this.tokens.links={},this.options=e||_.defaults,this.rules=n.normal,this.options.gfm&&(this.options.tables?this.rules=n.tables:this.rules=n.gfm)}n._label=/(?:\\[\[\]]|[^\[\]])+/,n._title=/(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/,n.def=h(n.def).replace("label",n._label).replace("title",n._title).getRegex(),n.bullet=/(?:[*+-]|\d+\.)/,n.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,n.item=h(n.item,"gm").replace(/bull/g,n.bullet).getRegex(),n.list=h(n.list).replace(/bull/g,n.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+n.def.source+")").getRegex(),n._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b",n.html=h(n.html).replace("comment",/<!--[\s\S]*?-->/).replace("closed",/<(tag)[\s\S]+?<\/\1>/).replace("closing",/<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>\s]*)*?\/?>/).replace(/tag/g,n._tag).getRegex(),n.paragraph=h(n.paragraph).replace("hr",n.hr).replace("heading",n.heading).replace("lheading",n.lheading).replace("tag","<"+n._tag).getRegex(),n.blockquote=h(n.blockquote).replace("paragraph",n.paragraph).getRegex(),n.normal=m({},n),n.gfm=m({},n.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),n.gfm.paragraph=h(n.paragraph).replace("(?!","(?!"+n.gfm.fences.source.replace("\\1","\\2")+"|"+n.list.source.replace("\\1","\\3")+"|").getRegex(),n.tables=m({},n.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),r.rules=n,r.lex=function(e,t){return new r(t).lex(e)},r.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},r.prototype.token=function(e,t){var r,i,o,s,a,l,c,u,h,d,p;for(e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].split(/ *\| */);this.tokens.push(l)}else if(o=this.rules.hr.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,t),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),p=(s=o[2]).length>1,this.tokens.push({type:"list_start",ordered:p,start:p?+s:""}),r=!1,d=(o=o[0].match(this.rules.item)).length,u=0;u<d;u++)c=(l=o[u]).length,~(l=l.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==d-1&&(s===(a=n.bullet.exec(o[u+1])[0])||s.length>1&&a.length>1||(e=o.slice(u+1).join("\n")+e,u=d-1)),i=r||/\n\n(?!\s*$)/.test(l),u!==d-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(l,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),o[3]&&(o[3]=o[3].substring(1,o[3].length-1)),h=o[1].toLowerCase(),this.tokens.links[h]||(this.tokens.links[h]={href:o[2],title:o[3]});else if(t&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(o=this.rules.lheading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"text",text:o[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var i={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:/^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:g,text:/^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function o(e,t){if(this.options=t||_.defaults,this.links=e,this.rules=i.normal,this.renderer=this.options.renderer||new s,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=i.breaks:this.rules=i.gfm:this.options.pedantic&&(this.rules=i.pedantic)}function s(e){this.options=e||{}}function a(){}function l(e){this.tokens=[],this.token=null,this.options=e||_.defaults,this.options.renderer=this.options.renderer||new s,this.renderer=this.options.renderer,this.renderer.options=this.options}function c(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function u(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}function h(e,t){return e=e.source,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function d(e,t){return p[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?p[" "+e]=e+"/":p[" "+e]=e.replace(/[^/]*$/,"")),e=p[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}i._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,i._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,i.autolink=h(i.autolink).replace("scheme",i._scheme).replace("email",i._email).getRegex(),i._inside=/(?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/,i._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,i.link=h(i.link).replace("inside",i._inside).replace("href",i._href).getRegex(),i.reflink=h(i.reflink).replace("inside",i._inside).getRegex(),i.normal=m({},i),i.pedantic=m({},i.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),i.gfm=m({},i.normal,{escape:h(i.escape).replace("])","~|])").getRegex(),url:h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",i._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:h(i.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),i.breaks=m({},i.gfm,{br:h(i.br).replace("{2,}","*").getRegex(),text:h(i.gfm.text).replace("{2,}","*").getRegex()}),o.rules=i,o.output=function(e,t,n){return new o(t,n).output(e)},o.prototype.output=function(e){for(var t,n,r,i,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=c(this.mangle(i[1]))):n=c(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):c(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,o+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(c(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),o+=this.renderer.text(c(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else i[0]=this.rules._backpedal.exec(i[0])[0],e=e.substring(i[0].length),"@"===i[2]?r="mailto:"+(n=c(i[0])):(n=c(i[0]),r="www."===i[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},o.prototype.outputLink=function(e,t){var n=c(t.href),r=t.title?c(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,c(e[1]))},o.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},o.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},s.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+c(t,!0)+'">'+(n?e:c(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"\n</code></pre>"},s.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},s.prototype.html=function(e){return e},s.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},s.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},s.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},s.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},s.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},s.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},s.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},s.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},s.prototype.strong=function(e){return"<strong>"+e+"</strong>"},s.prototype.em=function(e){return"<em>"+e+"</em>"},s.prototype.codespan=function(e){return"<code>"+e+"</code>"},s.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},s.prototype.del=function(e){return"<del>"+e+"</del>"},s.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(u(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!f.test(e)&&(e=d(this.options.baseUrl,e));var i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"},s.prototype.image=function(e,t,n){this.options.baseUrl&&!f.test(e)&&(e=d(this.options.baseUrl,e));var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},s.prototype.text=function(e){return e},a.prototype.strong=a.prototype.em=a.prototype.codespan=a.prototype.del=a.prototype.text=function(e){return e},a.prototype.link=a.prototype.image=function(e,t,n){return""+n},a.prototype.br=function(){return""},l.parse=function(e,t){return new l(t).parse(e)},l.prototype.parse=function(e){this.inline=new o(e.links,this.options),this.inlineText=new o(e.links,m({},this.options,{renderer:new a})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},l.prototype.next=function(){return this.token=this.tokens.pop()},l.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},l.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},l.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,u(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i="",o="";for(n="",e=0;e<this.token.header.length;e++)n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(i+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});o+=this.renderer.tablerow(n)}return this.renderer.table(i,o);case"blockquote_start":for(o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":o="";for(var s=this.token.ordered,a=this.token.start;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,s,a);case"list_item_start":for(o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}};var p={},f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(){}function m(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function _(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(n||"function"==typeof t){n||(n=t,t=null);var i,o,s=(t=m({},_.defaults,t||{})).highlight,a=0;try{i=r.lex(e,t)}catch(e){return n(e)}o=i.length;var u=function(e){if(e)return t.highlight=s,n(e);var r;try{r=l.parse(i,t)}catch(t){e=t}return t.highlight=s,e?n(e):n(null,r)};if(!s||s.length<3)return u();if(delete t.highlight,!o)return u();for(;a<i.length;a++)!function(e){"code"!==e.type?--o||u():s(e.text,e.lang,(function(t,n){return t?u(t):null==n||n===e.text?--o||u():(e.text=n,e.escaped=!0,void(--o||u()))}))}(i[a])}else try{return t&&(t=m({},_.defaults,t)),l.parse(r.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(t||_.defaults).silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}}g.exec=g,_.options=_.setOptions=function(e){return m(_.defaults,e),_},_.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new s,xhtml:!1,baseUrl:null},_.Parser=l,_.parser=l.parse,_.Renderer=s,_.TextRenderer=a,_.Lexer=r,_.lexer=r.lex,_.InlineLexer=o,_.inlineLexer=o.output,_.parse=_,e.exports=_}(this||"undefined"!=typeof window&&window)}).call(this,n(17))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(12),o=n(6),s=n(18),a=n(183),l=function(){function e(e){this._changed=new o.Signal(this),this._raw={};var t=r.getBundleOptions(e),n=t.data,i=t.metadata,l=t.trusted;this._data=new a.ObservableJSON({values:n}),this._rawData=n,this._metadata=new a.ObservableJSON({values:i}),this._rawMetadata=i,this.trusted=l;var c=e.value;for(var u in c)switch(u){case"data":case"metadata":break;default:this._raw[u]=r.extract(c,u)}this.type=c.output_type,s.nbformat.isExecuteResult(c)?this.executionCount=c.execution_count:this.executionCount=null}return Object.defineProperty(e.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._data.dispose(),this._metadata.dispose(),o.Signal.clearData(this)},Object.defineProperty(e.prototype,"data",{get:function(){return this._rawData},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return this._rawMetadata},enumerable:!0,configurable:!0}),e.prototype.setData=function(e){e.data&&(this._updateObservable(this._data,e.data),this._rawData=e.data),e.metadata&&(this._updateObservable(this._metadata,e.metadata),this._rawMetadata=e.metadata),this._changed.emit(void 0)},e.prototype.toJSON=function(){var e={};for(var t in this._raw)e[t]=r.extract(this._raw,t);switch(this.type){case"display_data":case"execute_result":case"update_display_data":e.data=this.data,e.metadata=this.metadata}return delete e.transient,e},e.prototype._updateObservable=function(e,t){for(var n=e.keys(),r=Object.keys(t),i=0,o=n;i<o.length;i++){var s=o[i];-1===r.indexOf(s)&&e.delete(s)}for(var a=0,l=r;a<l.length;a++){s=l[a];var c=e.get(s),u=t[s];c!==u&&e.set(s,u)}},e}();t.OutputModel=l,function(e){e.getData=function(e){return r.getData(e)},e.getMetadata=function(e){return r.getMetadata(e)}}(l=t.OutputModel||(t.OutputModel={})),t.OutputModel=l,function(e){function t(e){var t={};if(s.nbformat.isExecuteResult(e)||s.nbformat.isDisplayData(e)||s.nbformat.isDisplayUpdate(e))t=e.data;else if(s.nbformat.isStream(e))"stderr"===e.name?t["application/vnd.jupyter.stderr"]=e.text:t["application/vnd.jupyter.stdout"]=e.text;else if(s.nbformat.isError(e)){var n=e.traceback.join("\n");t["application/vnd.jupyter.stderr"]=n||e.ename+": "+e.evalue}return function(e){var t=Object.create(null);for(var n in e){var r=e[n];i.JSONExt.isArray(r)?r=r.join("\n"):i.JSONExt.isPrimitive(r)||(r=JSON.parse(JSON.stringify(r))),t[n]=r}return t}(t)}function n(e){var t=Object.create(null);if(s.nbformat.isExecuteResult(e)||s.nbformat.isDisplayData(e))for(var n in e.metadata)t[n]=r(e.metadata,n);return t}function r(e,t){var n=e[t];return i.JSONExt.isPrimitive(n)?n:JSON.parse(JSON.stringify(n))}e.getData=t,e.getMetadata=n,e.getBundleOptions=function(e){return{data:t(e.value),metadata:n(e.value),trusted:!!e.trusted}},e.extract=r}(r||(r={}))},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(18),o=n(7),s=n(12),a=n(191);t.IRenderMimeRegistry=new s.Token("@jupyterlab/rendermime:IRenderMimeRegistry"),t.ILatexTypesetter=new s.Token("@jupyterlab/rendermime:ILatexTypesetter");var l,c=function(){function e(e){if(void 0===e&&(e={}),this._id=0,this._ranks={},this._types=null,this._factories={},this.resolver=e.resolver||null,this.linkHandler=e.linkHandler||null,this.latexTypesetter=e.latexTypesetter||null,this.sanitizer=e.sanitizer||o.defaultSanitizer,e.initialFactories)for(var t=0,n=e.initialFactories;t<n.length;t++){var r=n[t];this.addFactory(r)}}return Object.defineProperty(e.prototype,"mimeTypes",{get:function(){return this._types||(this._types=l.sortedTypes(this._ranks))},enumerable:!0,configurable:!0}),e.prototype.preferredMimeType=function(e,t){if(t)for(var n=0,r=this.mimeTypes;n<r.length;n++){if((s=r[n])in e&&this._factories[s].safe)return s}for(var i=0,o=this.mimeTypes;i<o.length;i++){var s;if((s=o[i])in e)return s}},e.prototype.createRenderer=function(e){if(!(e in this._factories))throw new Error("No factory for mime type: '"+e+"'");return this._factories[e].createRenderer({mimeType:e,resolver:this.resolver,sanitizer:this.sanitizer,linkHandler:this.linkHandler,latexTypesetter:this.latexTypesetter})},e.prototype.createModel=function(e){return void 0===e&&(e={}),new a.MimeModel(e)},e.prototype.clone=function(t){void 0===t&&(t={});var n=new e({resolver:t.resolver||this.resolver||void 0,sanitizer:t.sanitizer||this.sanitizer||void 0,linkHandler:t.linkHandler||this.linkHandler||void 0,latexTypesetter:t.latexTypesetter||this.latexTypesetter});return n._factories=r({},this._factories),n._ranks=r({},this._ranks),n._id=this._id,n},e.prototype.getFactory=function(e){return this._factories[e]},e.prototype.addFactory=function(e,t){void 0===t&&void 0===(t=e.defaultRank)&&(t=100);for(var n=0,r=e.mimeTypes;n<r.length;n++){var i=r[n];this._factories[i]=e,this._ranks[i]={rank:t,id:this._id++}}this._types=null},e.prototype.removeMimeType=function(e){delete this._factories[e],delete this._ranks[e],this._types=null},e.prototype.getRank=function(e){var t=this._ranks[e];return t&&t.rank},e.prototype.setRank=function(e,t){if(this._ranks[e]){var n=this._id++;this._ranks[e]={rank:t,id:n},this._types=null}},e}();t.RenderMimeRegistry=c,function(e){var t=function(){function e(e){this._session=e.session,this._contents=e.contents}return e.prototype.resolveUrl=function(e){if(i.URLExt.isLocal(e)){var t=i.PathExt.dirname(this._session.path);e=i.PathExt.resolve(t,e)}return Promise.resolve(e)},e.prototype.getDownloadUrl=function(e){return i.URLExt.isLocal(e)?this._contents.getDownloadUrl(e):Promise.resolve(e)},e}();e.UrlResolver=t}(c=t.RenderMimeRegistry||(t.RenderMimeRegistry={})),t.RenderMimeRegistry=c,function(e){e.sortedTypes=function(e){return Object.keys(e).sort((function(t,n){var r=e[t],i=e[n];return r.rank!==i.rank?r.rank-i.rank:r.id-i.id}))}}(l||(l={}))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),s=n(5),a=n(5),l=n(14),c=function(e){function t(n){var r=e.call(this)||this;r.outputLengthChanged=new o.Signal(r),r._onIOPub=function(e){var t,n,i=r.model,o=e.header.msg_type,s=(e.content.transient||{}).display_id;switch(o){case"execute_result":case"display_data":case"stream":case"error":(t=e.content).output_type=o,i.add(t);break;case"clear_output":var a=e.content.wait;i.clear(a);break;case"update_display_data":if((t=e.content).output_type="display_data",n=r._displayIdMap.get(s))for(var l=0,c=n;l<c.length;l++){var u=c[l];i.set(u,t)}}s&&"display_data"===o&&((n=r._displayIdMap.get(s)||[]).push(i.length-1),r._displayIdMap.set(s,n))},r._onExecuteReply=function(e){var t=r.model,n=e.content,i=n&&n.payload;if(i&&i.length){var o=i.filter((function(e){return"page"===e.source}));if(o.length){var s={output_type:"display_data",data:JSON.parse(JSON.stringify(o[0])).data,metadata:{}};t.add(s)}}},r._minHeightTimeout=null,r._future=null,r._displayIdMap=new Map;var i=r.model=n.model;r.addClass("jp-OutputArea"),r.rendermime=n.rendermime,r.contentFactory=n.contentFactory||t.defaultContentFactory,r.layout=new s.PanelLayout;for(var a=0;a<i.length;a++){var l=i.get(a);r._insertOutput(a,l)}return i.changed.connect(r.onModelChanged,r),r}return i(t,e),Object.defineProperty(t.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"future",{get:function(){return this._future},set:function(e){var t=this;if(this.model.isDisposed)throw Error("Model is disposed");this._future!==e&&(this._future&&this._future.dispose(),this._future=e,this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(this.model.length)),e.onIOPub=this._onIOPub,e.onReply=this._onExecuteReply,e.onStdin=function(n){l.KernelMessage.isInputRequestMsg(n)&&t._onInputRequest(n,e)})},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._future&&this._future.dispose(),this._future=null,this._displayIdMap.clear(),e.prototype.dispose.call(this)},t.prototype.onModelChanged=function(e,t){var n;switch(t.type){case"add":n=this._modelToLayoutIndex(t.newIndex),this._insertOutput(n,t.newValues[0]),this.outputLengthChanged.emit(this.model.length);break;case"remove":this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(this.model.length));break;case"set":n=this._modelToLayoutIndex(t.newIndex),this._setOutput(n,t.newValues[0]),this.outputLengthChanged.emit(this.model.length)}},t.prototype._clear=function(){var e=this;if(this.widgets.length){for(var t=this.widgets.length,n=0;n<t;n++){var r=this.widgets[0];r.parent=null,r.dispose()}this._displayIdMap.clear();var i=this.node.getBoundingClientRect();this.node.style.minHeight=i.height+"px",this._minHeightTimeout&&clearTimeout(this._minHeightTimeout),this._minHeightTimeout=window.setTimeout((function(){e.isDisposed||(e.node.style.minHeight="")}),50)}},t.prototype._onInputRequest=function(e,t){var n=this.contentFactory,r=e.content.prompt,i=e.content.password,o=new s.Panel;o.addClass("jp-OutputArea-child"),o.addClass("jp-OutputArea-stdin-item");var a=n.createOutputPrompt();a.addClass("jp-OutputArea-prompt"),o.addWidget(a);var l=n.createStdin({prompt:r,password:i,future:t});l.addClass("jp-OutputArea-output"),o.addWidget(l),this.layout.addWidget(o)},t.prototype._setOutput=function(e,t){this.layout.widgets[e].dispose(),this._insertOutput(e,t)},t.prototype._insertOutput=function(e,t){var n=this._createOutputItem(t);n.toggleClass("jp-OutputArea-executeResult",null!==t.executionCount),this.layout.insertWidget(e,n)},t.prototype._modelToLayoutIndex=function(e){var t,n=this.widgets,r=-1;for(t=0;t<n.length&&(n[t].hasClass("jp-OutputArea-stdin-item")||++r!==e);t++);return t},t.prototype._createOutputItem=function(e){var t=new s.Panel;t.addClass("jp-OutputArea-child");var n=this.contentFactory.createOutputPrompt();n.executionCount=e.executionCount,n.addClass("jp-OutputArea-prompt"),t.addWidget(n);var r=this.rendermime.preferredMimeType(e.data,!e.trusted);if(r){var i=e.metadata,o=i[r],a=!1;a=o&&void 0!==o.isolated?o.isolated:i.isolated;var l=this.rendermime.createRenderer(r);!0===a&&(l=new h.IsolatedRenderer(l)),l.renderModel(e),l.addClass("jp-OutputArea-output"),t.addWidget(l)}return t},t}(a.Widget);t.OutputArea=c,function(e){e.execute=function(e,t,n){var r={code:e,stop_on_error:!0};if(!n.kernel)return Promise.reject("Session has no kernel.");var i=n.kernel.requestExecute(r,!1);return t.future=i,i.done};var t=function(){function e(){}return e.prototype.createOutputPrompt=function(){return new u},e.prototype.createStdin=function(e){return new d(e)},e}();e.ContentFactory=t,e.defaultContentFactory=new t}(c=t.OutputArea||(t.OutputArea={})),t.OutputArea=c;var u=function(e){function t(){var t=e.call(this)||this;return t._executionCount=null,t.addClass("jp-OutputPrompt"),t}return i(t,e),Object.defineProperty(t.prototype,"executionCount",{get:function(){return this._executionCount},set:function(e){this._executionCount=e,this.node.textContent=null===e?"":"Out["+e+"]:"},enumerable:!0,configurable:!0}),t}(a.Widget);t.OutputPrompt=u;var h,d=function(e){function t(t){var n=e.call(this,{node:h.createInputWidgetNode(t.prompt,t.password)})||this;return n._future=null,n._input=null,n.addClass("jp-Stdin"),n._input=n.node.getElementsByTagName("input")[0],n._input.focus(),n._future=t.future,n}return i(t,e),t.prototype.handleEvent=function(e){var t=this._input;if("keydown"===e.type&&13===e.keyCode){this._future.sendInputReply({value:t.value});var n=document.createElement("span");n.className="jp-Stdin-rendered","password"===t.type?n.textContent=Array(t.value.length+1).join("·"):n.textContent=t.value,t.parentElement.replaceChild(n,t)}},t.prototype.onAfterAttach=function(e){this._input.addEventListener("keydown",this),this.update()},t.prototype.onUpdateRequest=function(e){this._input.focus()},t.prototype.onBeforeDetach=function(e){this._input.removeEventListener("keydown",this)},t}(a.Widget);t.Stdin=d,function(e){e.createInputWidgetNode=function(e,t){var n=document.createElement("div"),r=document.createElement("pre");r.className="jp-Stdin-prompt",r.textContent=e;var i=document.createElement("input");return i.className="jp-Stdin-input",t&&(i.type="password"),n.appendChild(r),r.appendChild(i),n};var t=function(e){function t(t){var n=e.call(this,{node:document.createElement("iframe")})||this;n.addClass("jp-mod-isolated"),n._wrapped=t;var r=n.node;return r.frameBorder="0",r.scrolling="auto",r.addEventListener("load",(function(){r.contentDocument.open(),r.contentDocument.write(n._wrapped.node.innerHTML),r.contentDocument.close();var e=r.contentDocument.body;r.style.height=e.scrollHeight+"px"})),n}return i(t,e),t.prototype.renderModel=function(e){var t=this;return this._wrapped.renderModel(e).then((function(){var e=t.node.contentWindow;e&&e.location.reload()}))},t}(a.Widget);e.IsolatedRenderer=t}(h||(h={}))},function(e,t,n){var r=n(495);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n.jp-OutputArea-child {\n margin-top: 1em;\n margin-bottom: 1em;\n}\n\n.jp-RenderedText pre {\n padding-left: 1em;\n padding-top: 0.8em;\n padding-bottom: 0.8em;\n}\n",""])},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5);t.WIDGET_MIMETYPE="application/vnd.jupyter.widget-view+json";var l=function(e){function t(t,n){var r=e.call(this)||this;return r.mimeType=t.mimeType,r._manager=n,r}return i(t,e),t.prototype.renderModel=function(e){return o(this,void 0,void 0,(function(){var t,n,r,i;return s(this,(function(o){switch(o.label){case 0:if(t=e.data[this.mimeType],!(n=this._manager.get_model(t.model_id)))return[3,6];o.label=1;case 1:return o.trys.push([1,4,,5]),[4,n];case 2:return r=o.sent(),[4,this._manager.display_model(null,r,{el:this.node})];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),console.log("Error displaying widget"),console.log(i),this.node.textContent="Error displaying widget",[3,5];case 5:return[3,7];case 6:return this.node.textContent="Error creating widget: could not find model",[2,Promise.resolve()];case 7:return[2]}}))}))},t}(a.Widget);t.WidgetRenderer=l},function(e){e.exports=JSON.parse('{"name":"@jupyter-widgets/html-manager","version":"0.11.10","description":"Standalone package for rendering Jupyter widgets outside notebooks","main":"lib/index.js","typings":"lib/index.d.ts","repository":{"type":"git","url":"https://github.com/jupyter-widgets/ipywidgets.git"},"files":["lib/**/*.d.ts","lib/**/*.js","dist/","css/*.css"],"scripts":{"clean":"rimraf lib && rimraf dist","build:src":"tsc --project src","build:embed-amd":"node scripts/concat-amd-build.js && rimraf dist/amd","build:test":"tsc --project test/src && webpack --config test/webpack.conf.js","build":"npm run build:src && webpack && npm run build:embed-amd","lint":"tslint --project tslint.json --format stylish","test":"npm run test:unit","test:unit":"npm run test:unit:firefox && npm run test:unit:chrome","test:unit:default":"npm run build:test && karma start test/karma.conf.js --log-level debug --browsers=Firefox","test:unit:firefox":"npm run test:unit:default -- --browsers=Firefox","test:unit:chrome":"npm run test:unit:default -- --browsers=Chrome","prepublish":"npm run clean && npm run build"},"author":"Jupyter Project","license":"BSD-3-Clause","bugs":{"url":"https://github.com/jupyter-widgets/ipywidgets/issues"},"homepage":"https://github.com/jupyter-widgets/ipywidgets#readme","dependencies":{"@jupyter-widgets/base":"^1.1.8","@jupyter-widgets/controls":"^1.1.6","@jupyter-widgets/output":"^1.0.15","@jupyter-widgets/schema":"^0.3.2","@jupyterlab/outputarea":"^0.15.0","@jupyterlab/rendermime":"^0.15.0","@jupyterlab/rendermime-interfaces":"^1.0.1","@phosphor/widgets":"^1.3.0","ajv":"^5.2.2","font-awesome":"^4.7.0","jquery":"^3.1.1"},"devDependencies":{"@types/mocha":"^2.2.41","@types/requirejs":"^2.1.28","chai":"^4.0.0","css-loader":"^0.28.4","file-loader":"^0.11.2","json-loader":"^0.5.4","karma":"^1.6.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.3","mocha":"^3.3.0","postcss":"^6.0.2","postcss-cssnext":"^3.0.2","postcss-import":"^10.0.0","postcss-loader":"^2.0.6","rimraf":"^2.6.1","style-loader":"^0.18.1","tslint":"^5.8.0","typescript":"~2.6.2","url-loader":"^0.5.9","webpack":"^3.5.5"}}')},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:function(){return r.extend(i.MarkModel.prototype.defaults(),{_model_name:"GridHeatMapModel",_view_name:"GridHeatMap",row:[],column:[],color:null,scales_metadata:{row:{orientation:"vertical",dimension:"y"},column:{orientation:"horizontal",dimension:"x"},color:{dimension:"color"}},null_color:"black",row_align:"start",column_align:"start",stroke:"black",opacity:1,anchor_style:{fill:"white",stroke:"blue"}})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["row","column","color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this;this.colors=this.get_typed_field("color"),this.rows=this.get_typed_field("row"),this.columns=this.get_typed_field("column");this.colors.length;var t=this.colors[0].length,n=[];n=n.concat.apply(n,this.colors),this.mark_data=n.map((function(n,r){var i=Math.floor(r/t),o=r%t;return{row_num:i,row:e.rows[i],column:e.columns[o],column_num:o,color:n,_cell_num:r}})),this.identify_modes(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.row,n=e.column,r=e.color;this.get("preserve_domain").row?t.del_domain([],this.model_id+"_row"):t.compute_and_set_domain(this.rows,this.model_id+"_row"),this.get("preserve_domain").column?n.del_domain([],this.model_id+"_column"):n.compute_and_set_domain(this.columns,this.model_id+"_column"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.color})),this.model_id+"_color"))}},get_data_dict:function(e,t){return e},identify_modes:function(){var e={},t=this.get("scales"),n=t.row,r=t.column,i=this.colors.length,o=this.colors[0].length;"ordinal"===n.type?e.row="middle":i===this.rows.length-1?e.row="boundaries":i===this.rows.length?e.row="expand_one":i===this.rows.length+1&&(e.row="expand_two"),"ordinal"===r.type?e.column="middle":o===this.columns.length-1?e.column="boundaries":o===this.columns.length?e.column="expand_one":o===this.columns.length+1&&(e.column="expand_two"),this.modes=e}});e.exports={GridHeatMapModel:o}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(r.WidgetModel.prototype.defaults(),{_model_name:"AxisModel",_view_name:"Axis",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,orientation:"horizontal",side:null,label:"",grid_lines:"solid",tick_format:null,scale:void 0,num_ticks:null,tick_values:[],offset:{},label_location:"middle",label_color:null,grid_color:null,color:null,label_offset:null,visible:!0,tick_style:{},tick_rotate:0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("change:side",this.validate_orientation,this),this.on("change:orientation",this.validate_side,this),this.validate_orientation(),this.validate_side()},validate_side:function(){var e=this.get("orientation"),t=this.get("side");"vertical"===e?"left"!==t&&"right"!==t&&this.set("side","left"):"bottom"!==t&&"top"!==t&&this.set("side","bottom"),this.save_changes()},validate_orientation:function(){this.get("orientation");var e=this.get("side");e&&("left"===e||"right"===e?this.set("orientation","vertical"):this.set("orientation","horizontal"),this.save_changes())}},{serializers:i.extend({scale:{deserialize:r.unpack_models},offset:{deserialize:r.unpack_models}},r.WidgetModel.serializers)}),l=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"ColorAxisModel",_view_name:"ColorAxis"})}});e.exports={AxisModel:a,ColorAxisModel:l}},function(e,t,n){var r=n(1),i=n(13),o=n(68).Interaction.extend({render:function(){o.__super__.render.apply(this),this.d3el.style({cursor:"crosshair"}),this.active=!1;var e=this;this.set_lines_view().then((function(){e.d3el.on("mousedown",(function(){return e.mousedown()})),e.set_limits()})),this.update_line_index(),this.listenTo(this.model,"change:line_index",this.update_line_index,this),this.model.on_some_change(["min_x","max_x"],this.set_limits,this)},set_lines_view:function(){var e=this.parent,t=this.model.get("lines"),n=this;return Promise.all(e.mark_views.views).then((function(r){var i=e.mark_views._models.map((function(e){return e.model_id})).indexOf(t.model_id);n.lines_view=r[i]}))},mousedown:function(){this.active=!0,this.mouse_entry(!1);var e=this;this.d3el.on("mousemove",(function(){e.mousemove()})),this.d3el.on("mouseleave",(function(){e.mouseup()})),this.d3el.on("mouseup",(function(){e.mouseup()}))},mouseup:function(){if(this.active){this.mouse_entry(!0);var e=this.model.get("lines");e.set_typed_field("y",i.deepCopy(e.y_data)),this.lines_view.touch(),this.active=!1,this.d3el.on("mousemove",null),this.d3el.on("mouseleave",null),this.d3el.on("mouseup",null)}},mousemove:function(){this.mouse_entry(!0)},mouse_entry:function(e){if(this.active){var t=this.model.get("lines"),n=Math.min(this.line_index,t.x_data.length-1),i=r.mouse(this.el);e&&"previous_pos"in this||(this.previous_pos=i);for(var o=this.lines_view.scales.x.scale,s=this.lines_view.scales.y.scale,a=o.invert(i[0]),l=s.invert(i[1]),c=o.invert(this.previous_pos[0]),u=(s.invert(this.previous_pos[1]),this.nns(t.x_data[n],c)),h=this.nns(t.x_data[n],a),d=Math.min(u,h),p=Math.max(u,h),f=d;f<=p;++f)(!this.valid_min||t.x_data[n][f]>=this.min_x)&&(!this.valid_max||t.x_data[n][f]<=this.max_x)&&(t.y_data[this.line_index][f]=l);var g=this,m=t.x_data[n].map((function(e,n){return{x:e,y:t.y_data[g.line_index][n]}}));this.lines_view.d3el.select("#curve"+(g.line_index+1)).attr("d",(function(e){return g.lines_view.line(m)})),this.previous_pos=i}},capnfloor:function(e){return Math.max(Math.min(e,this.model.get("max_x")),this.model.get("min_x"))},set_limits:function(){"date"==this.lines_view.scales.x.model.type?(this.min_x=this.model.get_date_elem("min_x"),this.valid_min=!(null===this.min_x||void 0===this.min_x||isNaN(this.min_x.getTime())),this.max_x=this.model.get_date_elem("max_x"),this.valid_max=!(null===this.max_x||void 0===this.max_x||isNaN(this.max_x.getTime()))):(this.min_x=this.model.get("min_x"),this.max_x=this.model.get("max_x"),this.valid_min=!(null===this.min_x||void 0===this.min_x),this.valid_max=!(null===this.max_x||void 0===this.max_x))},nns:function(e,t){var n=this.lines_view.bisect(e,t);return t-e[n-1]>e[n]-t?n:n-1},update_line_index:function(){this.line_index=this.model.get("line_index")}});e.exports={HandDraw:o}},function(e,t,n){var r=n(1),i=n(0),o=n(19),s=n(13),a=o.Mark.extend({render:function(){this.padding=this.model.get("padding");var e=a.__super__.render.apply(this);this.set_internal_scales(),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["bar","legendtext"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_scale_orientation:function(){this.model.get("orientation");this.dom_scale=this.scales.x,this.range_scale=this.scales.y},set_ranges:function(){var e=this.model.get("orientation");this.set_scale_orientation();var t=this.dom_scale,n=this.range_scale,r="vertical"===e?"x":"y",i="vertical"===e?"y":"x";"ordinal"!==t.model.type?t.set_range(this.parent.padded_range(r,t.model)):t.set_range(this.parent.padded_range(r,t.model),this.padding),n.set_range(this.parent.padded_range(i,n.model)),this.dom_offset=0,this.range_offset="vertical"===e?n.offset:-n.offset},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},set_internal_scales:function(){this.x=r.scale.ordinal(),this.x1=r.scale.ordinal()},adjust_offset:function(){"ordinal"!==this.dom_scale.model.type?"center"===this.model.get("align")?this.dom_offset=-(this.x.rangeBand()/2).toFixed(2):"left"===this.model.get("align")?this.dom_offset=-this.x.rangeBand().toFixed(2):this.dom_offset=0:"center"===this.model.get("align")?this.dom_offset=0:"left"===this.model.get("align")?this.dom_offset=-this.x.rangeBand()/2:this.dom_offset=this.x.rangeBand()/2},create_listeners:function(){a.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"colors_updated",this.update_colors,this),this.listenTo(this.model,"change:type",this.update_type,this),this.listenTo(this.model,"change:align",this.realign,this),this.listenTo(this.model,"change:orientation",this.relayout,this),this.listenTo(this.model,"change:padding",this.relayout,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=i.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=i.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},realign:function(){this.relayout()},draw_zero_line:function(){this.set_scale_orientation();var e=this.range_scale;"vertical"===this.model.get("orientation")?this.d3el.select(".zeroLine").attr("x1",0).attr("x2",this.parent.plotarea_width).attr("y1",e.scale(this.model.base_value)).attr("y2",e.scale(this.model.base_value)):this.d3el.select(".zeroLine").attr("x1",e.scale(this.model.base_value)).attr("x2",e.scale(this.model.base_value)).attr("y1",0).attr("y2",this.parent.plotarea_height)},relayout:function(){this.set_ranges(),this.compute_view_padding();this.range_scale;this.draw_zero_line(),this.x.rangeRoundBands(this.set_x_range(),this.padding),this.adjust_offset(),this.x1.rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),this.draw_bars()},invert_point:function(e){if(void 0===e)return this.model.set("selected",null),void this.touch();var t=this.x_pixels.map((function(t){return Math.abs(t-e)}));this.model.set("selected",[t.indexOf(r.min(t))]),this.touch()},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=this.pixel_coords,r=i.range(n.length),o=i.filter(r,(function(e){for(var r=n[e],i=0;i<r.length;i++)if(t(r[i]))return!0;return!1}));this.model.set("selected",o),this.touch()},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},draw:function(e){this.set_ranges();this.model.get("colors");var t=this,n=this.d3el.selectAll(".bargroup").data(this.model.mark_data,(function(e){return e.key})),r=this.dom_scale;this.range_scale;if("ordinal"!==r.model.type){var o=this.model.mark_data.map((function(e){return e.key}));this.x.domain(o)}else this.x.domain(r.scale.domain());this.x.rangeRoundBands(this.set_x_range(),this.padding),this.adjust_offset(),this.x1.rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),this.model.mark_data.length>0&&this.x1.domain(i.range(this.model.mark_data[0].values.length)).rangeRoundBands([0,this.x.rangeBand().toFixed(2)]),n.enter().append("g").attr("class","bargroup"),n.order(),n.on("click",(function(e,n){return t.event_dispatcher("element_clicked",{data:e,index:n})})),n.exit().remove();var s=n.selectAll(".bar").data((function(e){return e.values}));s.enter().append("rect").attr("class","bar").attr("width",0).attr("height",0),s.exit().remove(),this.draw_bars(e),this.apply_styles(),this.d3el.selectAll(".zeroLine").remove(),this.d3el.append("g").append("line").attr("class","zeroLine"),this.draw_zero_line()},draw_bars:function(e){var t=this.d3el.selectAll(".bargroup"),n=t.selectAll(".bar"),i=!0===e?this.parent.model.get("animation_duration"):0,o=this,s=this.model.get("orientation"),a=this.dom_scale,l=this.range_scale,c="vertical"===s?"x":"y",u="vertical"===s?"y":"x",h="vertical"===s?"width":"height",d="vertical"===s?"height":"width";if("ordinal"===a.model.type){var p=r.max(this.parent.range(c));t.attr("transform",(function(e){return"vertical"===s?"translate("+((void 0!==a.scale(e.key)?a.scale(e.key):p)+o.dom_offset)+", 0)":"translate(0, "+((void 0!==a.scale(e.key)?a.scale(e.key):p)+o.dom_offset)+")"}))}else t.attr("transform",(function(e){return"vertical"===s?"translate("+(a.scale(e.key)+o.dom_offset)+", 0)":"translate(0, "+(a.scale(e.key)+o.dom_offset)+")"}));var f="stacked"===this.model.get("type");f?n.transition("draw_bars").duration(i).attr(c,0).attr(h,this.x.rangeBand().toFixed(2)).attr(u,(function(e){return"y"===u?l.scale(e.y1):l.scale(e.y0)})).attr(d,(function(e){return Math.abs(l.scale(e.y1+e.y_ref)-l.scale(e.y1))})):n.transition("draw_bars").duration(i).attr(c,(function(e,t){return o.x1(t)})).attr(h,this.x1.rangeBand().toFixed(2)).attr(u,(function(e){return r.min([l.scale(e.y),l.scale(o.model.base_value)])})).attr(d,(function(e){return Math.abs(l.scale(o.model.base_value)-l.scale(e.y_ref))})),this.pixel_coords=this.model.mark_data.map((function(e){var t=e.key,n=a.scale(t)+o.dom_offset;return e.values.map((function(e){var t={};return t[c]=f?n:n+o.x1(e.sub_index),t[u]=f?"y"===u?l.scale(e.y1):l.scale(e.y0):r.min([l.scale(e.y),l.scale(o.model.base_value)]),t[h]=f?o.x.rangeBand():o.x1.rangeBand(),t[d]=f?Math.abs(l.scale(e.y1+e.y_ref)-l.scale(e.y1)):Math.abs(l.scale(o.model.base_value)-l.scale(e.y_ref)),[[t.x,t.x+t.width],[t.y,t.y+t.height]]}))})),this.x_pixels=this.model.mark_data.map((function(e){return a.scale(e.key)+a.offset}))},update_type:function(e,t){this.model.update_domains(),this.draw()},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.d3el.selectAll(".bar").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},update_colors:function(){var e=this,t=this.scales.color;this.model.mark_data.length>0&&(this.model.is_y_2d?this.d3el.selectAll(".bargroup").selectAll(".bar").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)})):this.d3el.selectAll(".bar").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)}))),this.legend_el&&(this.legend_el.selectAll(".legendrect").style("fill",(function(n,r){return n.color&&t?t.scale(n.color):e.get_colors(n.color_index)})),this.legend_el.selectAll(".legendtext").style("fill",(function(n,r){return void 0!==n.color&&void 0!==t?t.scale(n.color):e.get_colors(n.color_index)})))},draw_legend:function(e,t,n,o,s){if(!this.model.is_y_2d&&1!==this.model.get("colors").length&&"element"!==this.model.get("color_mode"))return[0,0];var a=this.model.mark_data[0].values.map((function(e){return{index:e.sub_index,color:e.color,color_index:e.color_index}})),l=this.scales.color;this.legend_el=e.selectAll(".legend"+this.uuid).data(a);var c=this,u=.8*s;this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",i.bind((function(){this.event_dispatcher("legend_mouse_over")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("legend_mouse_out")}),this)).on("click",i.bind((function(){this.event_dispatcher("legend_clicked")}),this)).append("rect").classed("legendrect",!0).style("fill",(function(e,t){return void 0!==e.color&&void 0!==l?l.scale(e.color):c.get_colors(e.color_index)})).attr({x:0,y:0,width:u,height:u}),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*u).attr("y",u/2).attr("dy","0.35em").text((function(e,t){return c.model.get("labels")[t]})).style("fill",(function(e,t){return void 0!==e.color&&void 0!==l?l.scale(e.color):c.get_colors(e.color_index)}));var h=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[this.model.mark_data[0].values.length,h]},clear_style:function(e,t){var n=this.d3el.selectAll(".bargroup");void 0!==t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.selectAll(".bar").style(r)},set_style_on_elements:function(e,t){if(null!=t&&0!==t.length&&0!==Object.keys(e).length){var n=this.d3el.selectAll(".bargroup");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).selectAll(".bar").style(e)}},set_default_style:function(e){this.update_colors(),this.update_stroke_and_opacities()},set_x_range:function(){var e=this.dom_scale;return"ordinal"===e.model.type?e.scale.rangeExtent():[e.scale(r.min(this.x.domain())),e.scale(r.max(this.x.domain()))]},bar_click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),o=n?s.deepCopy(n):[],a=o.indexOf(t),l=r.event.ctrlKey||r.event.metaKey;if(a>-1&&l)o.splice(a,1);else if(r.event.shiftKey){if(a>-1)return;var c=0!==o.length?r.min(o):-1,u=0!==o.length?r.max(o):this.model.mark_data.length;t>u?i.range(u+1,t+1).forEach((function(e){o.push(e)})):t<c&&i.range(t,c).forEach((function(e){o.push(e)}))}else l?o.push(t):(o=[]).push(t);this.model.set("selected",0===o.length?null:o,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var h=r.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault()},reset_selection:function(){this.model.set("selected",null),this.selected_indices=null,this.touch()},compute_view_padding:function(){var e=this.dom_scale,t=this.model.get("orientation"),n=0,r="vertical"===t?this.parent.plotarea_width:this.parent.plotarea_height;e&&null!==this.x&&void 0!==this.x&&0!==this.x.domain().length&&("ordinal"!==e.model.type?"center"===this.model.get("align")?n=r/(2*this.x.domain().length)+1:"left"!==this.model.get("align")&&"right"!==this.model.get("align")||(n=r/this.x.domain().length+1):"left"!==this.model.get("align")&&"right"!==this.model.get("align")||(n=(this.x.rangeBand()/2).toFixed(2))),"vertical"===t?n!==this.x_padding&&(this.x_padding=n,this.trigger("mark_padding_updated")):n!==this.y_padding&&(this.y_padding=n,this.trigger("mark_padding_updated"))}});e.exports={Bars:a}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(r.WidgetModel.prototype.defaults(),{_model_name:"HandDrawModel",_view_name:"HandDraw",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,lines:null,line_index:0,min_x:null,max_x:null})}},{serializers:i.extend({lines:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={HandDrawModel:a}},function(e,t,n){var r=n(1),i=n(0),o=n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.create_listeners(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.y;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind(this.mouse_over,this)).on("mousemove",i.bind(this.mouse_move,this)).on("mouseout",i.bind(this.mouse_out,this)),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width,this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:opacities",this.update_opacities,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"format_updated",this.draw,this),this.listenTo(this.model,"data_updated",this.draw)},update_stroke:function(){var e=this.model.get("stroke");this.d3el.selectAll(".stick").style("stroke",e),this.legend_el&&(this.legend_el.selectAll("path").style("stroke",e),this.legend_el.selectAll("text").style("fill",e))},update_stroke_width:function(){var e=this.model.get("stroke_width");this.d3el.selectAll(".stick").attr("stroke-width",e)},update_colors:function(){var e=this,t=this.model.get("colors"),n=t[0]?t[0]:"none",r=t[1]?t[1]:"none";this.d3el.selectAll(".stick").style("fill",(function(t){return t.y[e.model.px.o]>t.y[e.model.px.c]?r:n})),this.legend_el&&this.legend_el.selectAll("path").style("fill",n)},update_opacities:function(){var e=this.model.get("opacities");this.d3el.selectAll(".stick").style("opacity",(function(t,n){return e[n]})),this.legend_el&&this.legend_el.selectAll("path").attr("opacity",(function(t,n){return e[n]}))},update_marker:function(){var e=this.model.get("marker");this.legend_el&&this.rect_dim&&this.draw_legend_icon(this.rect_dim,this.legend_el),this.draw_mark_paths(e,this.d3el,this.model.mark_data.map((function(e,t){return e[1]})))},update_selected_colors:function(e,t){this.d3el.selectAll(".stick");var n=i.range(e,t+1);n.length==this.model.mark_data.length&&(n=[]);var r=this,o=this.model.get("stroke"),s=this.model.get("colors"),a=s[0]?s[0]:o,l=s[1]?s[1]:o,c=this.model.px;i.range(0,this.model.mark_data.length).forEach((function(e){r.d3el.selectAll("#stick"+e).style("stroke",o)})),n.forEach((function(e){r.d3el.selectAll("#stick"+e).style("stroke",(function(e){return e[c.o]>e[c.c]?l:a}))}))},invert_range:function(e,t){if(void 0===e||void 0===t||0===this.model.mark_data.length)return this.update_selected_colors(-1,-1),o=[];var n=i.range(this.model.mark_data.length),r=this,o=i.filter(n,(function(n){var i=r.x_pixels[n];return i>=e&&i<=t})),s=this.scales.x,a=-1,l=-1;return o.length>0&&(e!==s.scale.range()[0]||t!==s.scale.range()[1])&&(a=o[0],l=o[o.length-1]),this.update_selected_colors(a,l),this.model.set("selected",o),this.touch(),o},invert_point:function(e){this.scales.x;var t=this.x_pixels.map((function(t){return Math.abs(t-e)})),n=t.indexOf(r.min(t));return this.update_selected_colors(n,n),this.model.set("selected",[n]),this.touch(),n},draw:function(){var e=this.scales.x,t=this.scales.y;this.set_ranges();var n=this.model.get("colors"),i=this.model.get("opacities"),o=n[0]?n[0]:"none",s=n[1]?n[1]:"none",a=this.model.px,l=this.d3el.selectAll(".stick").data(this.model.mark_data.map((function(e,t){return{x:e[0],y:e[1],index:t}}))),c=l.enter().append("g").attr("class","stick").attr("id",(function(e,t){return"stick"+t})).style("stroke",this.model.get("stroke")).style("opacity",(function(e,t){return i[t]}));c.append("path").attr("class","stick_head"),c.append("path").attr("class","stick_tail"),c.append("path").attr("class","stick_body"),l.exit().remove();var u=this,h=a.h;if(-1===a.h&&(h=a.o),this.d3el.selectAll(".stick").style("fill",(function(e,t){return e.y[a.o]>e.y[a.c]?s:o})).attr("stroke-width",this.model.get("stroke_width")),"ordinal"===e.model.type){var d=r.max(this.parent.range("x"));this.d3el.selectAll(".stick").attr("transform",(function(n,r){return"translate("+((void 0!==e.scale(u.model.mark_data[r][0])?e.scale(u.model.mark_data[r][0]):d)+e.scale.rangeBand()/2)+","+(t.scale(n.y[h])+t.offset)+")"}))}else this.d3el.selectAll(".stick").attr("transform",(function(n,r){return"translate("+(e.scale(u.model.mark_data[r][0])+e.offset)+","+(t.scale(n.y[h])+t.offset)+")"}));this.draw_mark_paths(this.model.get("marker"),this.d3el,this.model.mark_data.map((function(e){return e[1]}))),this.x_pixels=this.model.mark_data.map((function(t){return e.scale(t[0])+e.offset}))},draw_mark_paths:function(e,t,n){for(var r,i,o=this.model.px,s=this,a=[],l=[],c=[],u=[],h=[],d=[],p=[],f=[],g=this.calculate_mark_width(),m=this.scales.x,_=this.scales.y,v=0;v<n.length;v++)-1===o.o?a[v]=void 0:a[v]=_.scale(n[v][o.o]),-1===o.c?u[v]=void 0:u[v]=_.scale(n[v][o.c]),-1!==o.o&&-1!==o.c&&(h[v]=n[v][o.o]>n[v][o.c]?a[v]:u[v],d[v]=n[v][o.o]<n[v][o.c]?a[v]:u[v]),-1===o.h||-1===o.l?(l[v]=a[v],c[v]=u[v]):(l[v]=_.scale(n[v][o.h]),c[v]=_.scale(n[v][o.l])),i=s.model.mark_data[v][0],g instanceof Date&&(g=g.getTime()),i instanceof Date&&(i=i.getTime()),r=i+g,"ordinal"===m.model.type?f[v]=.75*m.scale.rangeBand():f[v]=.75*(m.scale(r)-m.scale(i)),p[v]=-1*f[v]/2;"candle"==e&&-1!==o.o&&-1!==o.c?(-1!==o.h||-1!==o.l?(t.selectAll(".stick_head").attr("d",(function(e,t){return s.head_path_candle(h[t]-l[t])})),t.selectAll(".stick_tail").attr("d",(function(e,t){return s.tail_path_candle(d[t]-l[t],c[t]-d[t])}))):(t.selectAll(".stick_head").attr("d",""),t.selectAll(".stick_tail").attr("d","")),t.selectAll(".stick_body").attr("d",(function(e,t){return s.body_path_candle(p[t],a[t]-l[t],f[t],u[t]-a[t])}))):(-1!==o.o?t.selectAll(".stick_head").attr("d",(function(e,t){return s.head_path_bar(p[t],a[t]-l[t],-1*p[t])})):t.selectAll(".stick_head").attr("d",""),-1!==o.c?t.selectAll(".stick_tail").attr("d",(function(e,t){return s.tail_path_bar(u[t]-l[t],-1*p[t])})):t.selectAll(".stick_tail").attr("d",""),t.selectAll(".stick_body").attr("d",(function(e,t){return s.body_path_bar(c[t]-l[t])})))},head_path_candle:function(e){return"m0,0 l0,"+e},tail_path_candle:function(e,t){return"m0,"+e+" l0,"+t},body_path_candle:function(e,t,n,r){return"m"+e+","+t+" l"+n+",0 l0,"+r+" l"+-1*n+",0 z"},head_path_bar:function(e,t,n){return"m"+e+","+t+" l"+n+",0"},tail_path_bar:function(e,t){return"m0,"+e+" l"+t+",0"},body_path_bar:function(e){return"m0,0 l0,"+e},calculate_mark_width:function(){for(var e=Number.POSITIVE_INFINITY,t=this.model.get("scales").x,n=1;n<this.model.mark_data.length;n++){var r=this.model.mark_data[n][0]-this.model.mark_data[n-1][0];r<e&&(e=r)}return e===Number.POSITIVE_INFINITY&&(e=(t.domain[1]-t.domain[0])/2),e<0&&(e*=-1),e},relayout:function(){o.__super__.relayout.apply(this),this.set_ranges(),this.d3el.select(".intselmouse").attr("width",this.width).attr("height",this.height),this.draw()},draw_legend:function(e,t,n,o,s){var a=this.model.get("stroke"),l=this.model.get("colors"),c=l[0]?l[0]:"none";l[1]&&l[1];this.rect_dim=.8*s;var u=this;this.legend_el=e.selectAll("#legend"+this.uuid).data([this.model.mark_data]);var h=this.legend_el.enter().append("g").attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).attr("class","legend").attr("id","legend"+this.uuid).style("fill",c).on("mouseover",i.bind(this.highlight_axes,this)).on("mouseout",i.bind(this.unhighlight_axes,this));h.append("path").attr("class","stick_head stick"),h.append("path").attr("class","stick_tail stick"),h.append("path").attr("class","stick_body stick").style("fill",c),h.selectAll("path").style("stroke",a).attr("transform","translate("+u.rect_dim/2+",0)"),this.draw_legend_icon(u.rect_dim,h),this.legend_el.append("text").attr("class","legendtext sticktext").attr("x",1.2*u.rect_dim).attr("y",u.rect_dim/2).attr("dy","0.35em").text((function(e,t){return u.model.get("labels")[t]})).style("fill",a);var d=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,d]},draw_legend_icon:function(e,t){var n=e,r=e/2,i=3*e/4,o=e/4;"candle"===this.model.get("marker")?(t.selectAll(".stick_head").attr("d",this.head_path_candle(r/2)),t.selectAll(".stick_tail").attr("d",this.tail_path_candle(i,r/2)),t.selectAll(".stick_body").attr("d",this.body_path_candle(-1*r/2,o,r,n/2))):(t.selectAll(".stick_head").attr("d",this.head_path_bar(-1*r/2,i,r/2)),t.selectAll(".stick_tail").attr("d",this.tail_path_bar(o,r/2)),t.selectAll(".stick_body").attr("d",this.body_path_bar(n)))}});e.exports={OHLC:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"BarsModel",_view_name:"Bars",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},color_mode:"auto",type:"stacked",colors:r.scale.category10().range(),padding:.05,stroke:null,base:0,opacities:[],orientation:"vertical",align:"center"})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.is_y_2d=!1,this.on_some_change(["x","y","base"],this.update_data,this),this.on("change:color",(function(){this.update_color(),this.trigger("colors_updated")}),this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_color(),this.update_domains()},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y"),n=this.get("scales");n.x,n.y;t=0===t.length||t[0]instanceof Array?t:[t];var i=this;this.base_value=this.get("base"),void 0!==this.base_value&&null!==this.base_value||(this.base_value=0),0===e.length||0===t.length?(this.mark_data=[],this.is_y_2d=!1):(e=e.slice(0,r.min(t.map((function(e){return e.length})))),this.mark_data=e.map((function(e,n){var r={},o=i.base_value,s=i.base_value,a=i.base_value;return r.key=e,r.values=t.map((function(t,r){var l=t[n]-i.base_value,c=l>=0;return{index:n,sub_index:r,x:e,y0:c?o:a+=l,y1:c?o+=l:(s+=l)-l,y_ref:l,y:t[n]}})),r.pos_max=o,r.neg_max=s,r})),this.is_y_2d=this.mark_data[0].values.length>1,this.update_color()),this.update_domains(),this.trigger("data_updated")},get_data_dict:function(e,t,n){return e},update_color:function(){if(this.mark_data){var e=this.get_typed_field("color"),t=this.get("scales").color,n=this.get("color_mode"),r="group"===n||"auto"===n&&!this.is_y_2d;this.mark_data.forEach((function(t,n){t.values.forEach((function(t,i){t.color_index=r?n:i,t.color=e[t.color_index]}))})),t&&e.length>0&&(this.get("preserve_domain").color?t.del_domain([],this.model_id+"_color"):t.compute_and_set_domain(e,this.model_id+"_color"))}},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=(this.get("orientation"),e.x),n=e.y;if(this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.map((function(e){return e.key})),this.model_id+"_x"),this.get("preserve_domain").y)n.del_domain([],this.model_id+"_y");else if("stacked"===this.get("type"))n.compute_and_set_domain([r.min(this.mark_data,(function(e){return e.neg_max})),r.max(this.mark_data,(function(e){return e.pos_max})),this.base_value],this.model_id+"_y");else{var i=r.min(this.mark_data,(function(e){return r.min(e.values,(function(e){return e.y_ref}))})),o=r.max(this.mark_data,(function(e){return r.max(e.values,(function(e){return e.y_ref}))}));n.compute_and_set_domain([i,o,this.base_value],this.model_id+"_y")}}}});e.exports={BarsModel:s}},function(e,t,n){var r=n(0),i=n(1),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this);this.bars_selected=[],this.display_el_classes=["rect","legendtext"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.draw(),t.update_selected(t.model,t.model.get("selected"))}))},set_ranges:function(){var e=this.scales.sample;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.count;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.sample,t=this.scales.count;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.model.update_data()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){s.__super__.create_listeners.apply(this),this.d3el.on("mouseover",r.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",r.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",r.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.listenTo(this.model,"change:selected",this.update_selected,this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");r.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=r.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=r.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},update_colors:function(e,t){this.d3el.selectAll(".bargroup").selectAll("rect").style("fill",this.get_colors(0)),e.get("labels")&&t.length>1&&this.d3el.selectAll(".bargroup").selectAll("text").style("fill",this.get_colors(1)),this.legend_el&&(this.legend_el.selectAll("rect").style("fill",this.get_colors(0)),this.legend_el.selectAll("text").style("fill",this.get_colors(0)))},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.d3el.selectAll(".rect").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},calculate_bar_width:function(){var e=this.scales.sample,t=(e.scale(this.model.max_x)-e.scale(this.model.min_x))/this.model.num_bins;return t>=10&&(t-=2),t},relayout:function(){this.set_ranges();var e=this.scales.sample,t=this.scales.count;this.d3el.selectAll(".bargroup").attr("transform",(function(n){return"translate("+e.scale(n.x)+","+t.scale(n.y)+")"}));var n=this.calculate_bar_width();this.d3el.selectAll(".bargroup").select("rect").transition("relayout").duration(this.parent.model.get("animation_duration")).attr("x",2).attr("width",n).attr("height",(function(e){return t.scale(0)-t.scale(e.y)}))},draw:function(){this.set_ranges();var e=this.model.get("colors"),t=e[0],n=(e.length>1&&e[1],[]);this.model.mark_data.forEach((function(e,t){n.push(t)}));var r=this.scales.sample,i=this.scales.count,o=this,s=this.calculate_bar_width(),a=this.d3el.selectAll(".bargroup").data(this.model.mark_data);a.enter().append("g").attr("class","bargroup").append("rect").attr("class","rect").attr("x",2).attr("width",0).attr("height",0),a.attr("transform",(function(e){return"translate("+r.scale(e.x)+","+i.scale(e.y)+")"})),a.select(".rect").style("fill",t).on("click",(function(e,t){return o.event_dispatcher("element_clicked",{data:e,index:t})})).attr("id",(function(e,t){return"rect"+t})).transition("draw").duration(this.parent.model.get("animation_duration")).attr("width",s).attr("height",(function(e){return i.scale(0)-i.scale(e.y)})),a.exit().remove(),this.bin_pixels=this.model.x_bins.map((function(e){return r.scale(e)+r.offset})),this.pixel_coords=this.model.mark_data.map((function(e){var t=r.scale(e.x);return[[t,t+s],[0,e.y].map(i.scale)]})),this.update_stroke_and_opacities()},bar_click_handler:function(e){e.data;var t=e.index,n=this.bars_selected,s=n?o.deepCopy(n):[],a=s.indexOf(t),l=i.event.ctrlKey||i.event.metaKey;if(a>-1&&l)s.splice(a,1);else if(i.event.shiftKey){if(a>-1)return;var c=0!==s.length?i.min(s):-1,u=0!==s.length?i.max(s):this.model.mark_data.length;t>u?r.range(u+1,t+1).forEach((function(e){s.push(e)})):t<c&&r.range(t,c).forEach((function(e){s.push(e)}))}else l?s.push(t):(s=[]).push(t);this.bars_selected=s,this.model.set("selected",0===s.length?null:this.calc_data_indices(s),{updated_view:this}),this.touch(),i.event||(i.event=window.event);var h=i.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault()},draw_legend:function(e,t,n,o,s){this.legend_el=e.selectAll(".legend"+this.uuid).data([this.model.mark_data[0]]);var a=this,l=.8*s;this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",r.bind((function(){this.event_dispatcher("legend_mouse_over")}),this)).on("mouseout",r.bind((function(){this.event_dispatcher("legend_mouse_out")}),this)).on("click",r.bind((function(){this.event_dispatcher("legend_clicked")}),this)).append("rect").style("fill",(function(e,t){return a.get_colors(t)})).attr({x:0,y:0,width:l,height:l}),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*l).attr("y",l/2).attr("dy","0.35em").text((function(e,t){return a.model.get("labels")[t]})).style("fill",(function(e,t){return a.get_colors(t)}));var c=i.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,c]},reset_colors:function(e,t){this.d3el.selectAll("#rect"+e).style("fill",t)},update_selected:function(e,t){if(null!=t&&0!==t.length){var n=this.calc_bar_indices_from_data_idx(t);this.update_selected_colors(n)}else this.update_selected_colors([])},update_selected_colors:function(e){var t=this.model.get("colors"),n=t.length>1?t[1]:"red",i=t[0],o=(this.d3el.selectAll(".bargroup"),this);r.difference(r.range(0,this.model.num_bins),e).forEach((function(e){o.d3el.selectAll("#rect"+e).style("fill",i)})),e.forEach((function(e){o.d3el.selectAll("#rect"+e).style("fill",n)}))},invert_point:function(e){if(void 0===e)return this.model.set("selected",null),void this.touch();var t=this.calculate_bar_width(),n=(this.scales.sample,this.bin_pixels.map((function(n){return Math.abs(n+t/2-e)}))),r=n.indexOf(i.min(n));this.model.set("selected",this.calc_data_indices([r])),this.touch()},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=this.pixel_coords,i=r.range(n.length),o=r.filter(i,(function(e){return t(n[e])}));this.model.set("selected",this.calc_data_indices(o)),this.touch()},calc_data_indices:function(e){var t=this.reduce_intervals(e);if(0===t.length)return[];var n=this.model.get_typed_field("sample"),i=t.length;return r.filter(r.range(n.length),(function(e){var r=n[e],o=0;for(o=0;o<i;o++)if(r<=t[o][1]&&r>=t[o][0])return!0;return!1}))},reduce_intervals:function(e){var t=[];if(0!==e.length){e.sort();for(var n=e[0],r=e[0],i=1;i<e.length;i++)e[i]===r+1?r++:(t.push([this.model.x_bins[n],this.model.x_bins[r+1]]),n=r=e[i]);t.push([this.model.x_bins[n],this.model.x_bins[r+1]])}return t},calc_data_indices_from_data_range:function(e,t){this.scales.sample;var n=i.max([0,i.bisectLeft(this.bin_pixels,e)-1]),o=i.min([this.model.num_bins,i.bisectRight(this.bin_pixels,t)]),s=this.model.get_typed_field("sample"),a=this;return r.filter(r.range(s.length),(function(e){return s[e]>=a.model.x_bins[n]&&s[e]<=a.model.x_bins[o]}))},calc_bar_indices_from_data_idx:function(e){for(var t=this.model.get_typed_field("sample"),n=e.map((function(e){return t[e]})),i=[],o=0;o<n.length;o++){var s=Math.min(r.indexOf(this.model.x_bins,n[o],!0),this.model.x_bins.length-2);-1===s&&(s=r.sortedIndex(this.model.x_bins,n[o])-1),i.push(s)}return i.sort(),i=r.uniq(i,!0)},reset_selection:function(){this.bars_selected=[],this.model.set("selected",null),this.touch()}});e.exports={Hist:s}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"OHLCModel",_view_name:"OHLC",x:[],y:[],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}},stroke:null,box_fill_color:"dodgerblue",outlier_fill_color:"gray",opacities:[]})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.on("change:format",this.update_format,this),this.px={o:-1,h:-1,l:-1,c:-1},this.mark_data=[],this.display_el_classes=["stick_body"],this.update_data(),this.update_domains(),this.update_format()},update_format:function(){this.update_data(),this.trigger("format_updated")},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y"),n=this.get("format");function o(e){console&&console.error("Invalid OHLC format: '"+e+"'")}if(this.px=n.toLowerCase().split("").reduce((function(r,i,s){return-1!==r[i]&&(o(n),e=[],t=[]),r[i]=s,r}),{o:-1,h:-1,l:-1,c:-1}),-1!==this.px.h&&-1===this.px.l||-1===this.px.h&&-1!==this.px.l||n.length<2||n.length>4)o(n),e=[],t=[];else{var s=this.px;(-1===this.px.h||t.every((function(e){return e[s.h]===r.max(e)&&e[s.l]===r.min(e)})))&&t.every((function(e){return e.length===n.length}))||(e=[],t=[],console&&console.error("Invalid OHLC data"))}e.length>t.length?e=e.slice(0,t.length):e.length<t.length&&(t=t.slice(0,e.length)),this.mark_data=i.zip(e,t),this.mark_data.forEach((function(e,t){e.index=t})),this.update_domains(),this.trigger("data_updated")},update_domains:function(){if(this.mark_data){for(var e,t,n=this.get("scales"),i=n.x,o=n.y,s=Number.POSITIVE_INFINITY,a=0,l=0,c=0,u=0;u<this.mark_data.length;u++)u>0&&(l=this.mark_data[u][0]-this.mark_data[u-1][0])<s&&(s=l),(c=this.mark_data[u][this.px.h]-this.mark_data[u][this.px.l])>a&&(a=c);if(this.mark_data.length<2&&(s=0),this.get("preserve_domain").x||0===this.mark_data.length?i.del_domain([],this.model_id+"_x"):"ordinal"===i.type?i.compute_and_set_domain(this.mark_data.map((function(e){return e[0]}))):(e=r.min(this.mark_data.map((function(e){return e[0]}))),(t=r.max(this.mark_data.map((function(e){return e[0]}))))instanceof Date&&(t=t.getTime()),i.set_domain([e-s/2,t+s/2],this.model_id+"_x")),this.get("preserve_domain").y||0===this.mark_data.length)o.del_domain([],this.model_id+"_y");else{var h=this.px.h,d=this.px.l;-1!==h&&-1!==d||(h=this.px.o,d=this.px.c),e=r.min(this.mark_data.map((function(e){return e[1][d]<e[1][h]?e[1][d]:e[1][h]}))),(t=r.max(this.mark_data.map((function(e){return e[1][h]>e[1][d]?e[1][h]:e[1][d]}))))instanceof Date&&(t=t.getTime()),o.set_domain([e-a,t+a],this.model_id+"_y")}}},get_data_dict:function(e,t){var n=this,r={};return r.index=t,r.x=e.x,["open","low","high","close"].forEach((function(t){r[t]=e.y[n.px[t.substr(0,1)]]})),r}});e.exports={OHLCModel:s}},function(e,t,n){var r=n(0),i=n(1),o=n(20),s=o.MarkModel.extend({defaults:function(){return r.extend(o.MarkModel.prototype.defaults(),{_model_name:"HistModel",_view_name:"Hist",sample:[],count:[],scales_metadata:{sample:{orientation:"horizontal",dimension:"x"},count:{orientation:"vertical",dimension:"y"}},bins:10,midpoints:[],colors:i.scale.category10().range(),stroke:null,opacities:[],normalized:!1})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.mark_data=[],this.on_some_change(["bins","sample","preserve_domain"],this.update_data,this),this.update_data(),this.on("change:normalized",(function(){this.normalize_data(!0)}),this),this.normalize_data(!0)},update_data:function(){var e=this.get_typed_field("sample"),t=this.get("scales").sample;if(this.num_bins=this.get("bins"),0==e.length)this.mark_data=[],this.x_mid=[],this.count=[],this.x_bins=[];else{this.get("preserve_domain").sample?t.del_domain([],this.model_id+"_sample"):t.compute_and_set_domain(e,this.model_id+"_sample"),this.min_x=t.domain[0],this.max_x=t.domain[1];var n=this,r=(e=e.filter((function(e){return e<=n.max_x&&e>=n.min_x}))).map((function(e,t){return{index:t,value:e}}));this.x_bins=this.create_uniform_bins(this.min_x,this.max_x,this.num_bins),this.x_mid=this.x_bins.map((function(e,t){return.5*(e+n.x_bins[t-1])})).slice(1),this.mark_data=i.layout.histogram().bins(this.x_bins).value((function(e){return e.value}))(r),this.mark_data.forEach((function(e,t){e.index=t}))}this.normalize_data(!1),this.set("midpoints",this.x_mid),this.set_typed_field("count",this.count),this.update_domains(),this.save_changes(),this.trigger("data_updated")},normalize_data:function(e){if(this.count=this.mark_data.map((function(e){return e.length})),this.get("normalized")){var t=1;this.mark_data.length>0&&(t=this.mark_data[0].dx);var n=this.count.reduce((function(e,t){return e+t}),0);0!=n&&(this.count=this.count.map((function(e){return e/(n*t)})))}var r=this;this.mark_data.forEach((function(e,t){e.y=r.count[t]})),e&&(this.set_typed_field("count",this.count),this.update_domains(),this.save_changes(),this.trigger("data_updated"))},get_data_dict:function(e,t){var n={};return n.midpoint=this.x_mid[t],n.bin_start=this.x_bins[t],n.bin_end=this.x_bins[t+1],n.index=t,n.count=this.count[t],n},update_domains:function(){if(this.mark_data){var e=this.get("scales").count;this.get("preserve_domain").count||e.set_domain([0,1.05*i.max(this.mark_data,(function(e){return e.y}))],this.model_id+"_count")}},create_uniform_bins:function(e,t,n){for(var r=(t-e)/n,i=[],o=0;o<n;o++)i[o]=e+o*r;return i[n]=t,i}});e.exports={HistModel:s}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"SelectorModel",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,marks:[]})}},{serializers:i.extend({marks:{deserialize:r.unpack_models}},o.BaseModel.serializers)}),l=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"OneDSelectorModel",scale:null})}},{serializers:i.extend({scale:{deserialize:r.unpack_models}},a.serializers)}),c=a.extend({defaults:function(){return i.extend(a.prototype.defaults(),{_model_name:"TwoDSelectorModel",x_scale:null,y_scale:null})}},{serializers:i.extend({x_scale:{deserialize:r.unpack_models},y_scale:{deserialize:r.unpack_models}},a.serializers)}),u=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"FastIntervalSelectorModel",_view_name:"FastIntervalSelector",selected:{},color:null,size:null})}}),h=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"IndexSelectorModel",_view_name:"IndexSelector",selected:{},line_width:2,color:null})}}),d=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"BrushIntervalSelectorModel",_view_name:"BrushIntervalSelector",brushing:!1,selected:{},color:null,orientation:"horizontal"})}}),p=c.extend({defaults:function(){return i.extend(c.prototype.defaults(),{_model_name:"BrushSelectorModel",_view_name:"BrushSelector",clear:!1,brushing:!1,selected_x:{},selected_y:{},color:null})}}),f=l.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"MultiSelectorModel",_view_name:"MultiSelector",names:[],brushing:!1,selected:{},_selected:{},show_names:!0})}}),g=c.extend({defaults:function(){return i.extend(l.prototype.defaults(),{_model_name:"LassoSelectorModel",_view_name:"LassoSelector",color:null})}});e.exports={SelectorModel:a,OneDSelectorModel:l,TwoDSelectorModel:c,FastIntervalSelectorModel:u,IndexSelectorModel:h,BrushIntervalSelectorModel:d,BrushSelectorModel:p,MultiSelectorModel:f,LassoSelectorModel:g}},function(e,t,n){var r=n(1),i=n(0),o=n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return e.then((function(){t.create_listeners(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&e.set_range(this.parent.padded_range("x",e.model));var t=this.scales.y;t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){var e=this.scales.x;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()}));var t=this.scales.y;this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:opacities",this.update_opacities,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"change:outlier_fill_color",this.update_outlier_fill_color,this),this.listenTo(this.model,"change:box_fill_color",this.update_box_fill_color,this),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:box_width",this.update_box_width,this)},update_stroke:function(){var e=this.model.get("stroke");this.d3el.selectAll(".boxplot").selectAll("path, rect").style("stroke",e),this.d3el.selectAll(".outlier").style("stroke",e),this.legend_el&&(this.legend_el.selectAll("path").attr("stroke",e),this.legend_el.selectAll("text").style("fill",e))},update_outlier_fill_color:function(){this.d3el.selectAll(".outlier").style("fill",this.model.get("outlier_fill_color"))},update_box_fill_color:function(){this.d3el.selectAll(".box").style("fill",this.model.get("box_fill_color"))},update_opacities:function(){var e=this.model.get("opacities");this.d3el.selectAll(".boxplot").style("opacity",(function(t,n){return e[n]})),this.legend_el&&this.legend_el.selectAll("path").attr("opacity",(function(t,n){return e[n]}))},update_marker:function(){var e=this.model.get("marker");if(this.legend_el&&this.rect_dim){var t=[1/4*this.rect_dim,0,this.rect_dim,3/4*this.rect_dim];this.draw_mark_paths(e,this.rect_dim/2,this.legend_el,[t])}this.draw_mark_paths(e,this.calculate_mark_max_width(),this.d3el,this.model.mark_data)},get_box_width:function(){var e=this.model.get("box_width");if(!e){var t=this.parent.plotarea_width,n=t/10;e=t/(this.model.mark_data.length+1)/1.5,e=Math.min(e,n)}return e},compute_view_padding:function(){var e=this.get_box_width()/2+1;e!==this.x_padding&&(this.x_padding=e,this.trigger("mark_padding_updated"))},update_box_width:function(){this.compute_view_padding(),this.draw()},update_idx_selected:function(e,t){this.selected_indices=t,this.apply_styles(t)},apply_styles:function(e){var t=i.range(this.model.mark_data.length);this.set_default_style(t),this.set_style_on_elements(this.selected_style,this.selected_indices);var n=void 0===e?[]:i.difference(t,e);this.set_style_on_elements(this.unselected_style,n)},set_style_on_elements:function(e,t){if(void 0!==t&&0!==t.length){var n=this.d3el.selectAll(".boxplot");(n=n.filter((function(e,n){return-1!=t.indexOf(n)}))).style(e)}},set_default_style:function(e){if(void 0!==e&&0!==e.length){var t=this.model.get("color"),n=this.model.get("stroke"),r=this.model.get("opacities"),i=this.d3el.selectAll(".boxplot").filter((function(t,n){return-1!=e.indexOf(n)}));i.style("fill",(function(e){return e[0]>e[3]?t:"none"})).style("opacity",(function(e,t){return r[t]})),i.selectAll("path, rect").style("stroke",n),i.selectAll(".outliers").style("stroke",n)}},clear_style:function(e,t){var n=this.d3el.selectAll(".boxplot");void 0!==t&&(n=n.filter((function(e,n){return-1!=t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},style_updated:function(e,t){this.set_default_style(t),this.set_style_on_elements(e,t)},selected_style_updated:function(e,t){this.selected_style=t,this.style_updated(t,this.selected_indices)},unselected_style_updated:function(e,t){this.unselected_style=t;var n=this.selected_indices,r=n?i.range(this.model.mark_data.length).filter((function(e){return-1==n.indexOf(e)})):[];this.style_updated(t,r)},update_selected_colors:function(e){var t=this.model.get("stroke"),n=t;this.d3el.selectAll(".boxplot").style("stroke",(function(r,i){return e.indexOf(i)>-1?n:t}))},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),this.update_selected_colors([]),[];var n=this.pixel_coords,r=i.range(n.length),o=i.filter(r,(function(e){return t(n[e])}));this.update_selected_colors(o),this.model.set("selected",o),this.touch()},invert_point:function(e){if(void 0===e)return this.update_selected_colors([]),this.model.set("selected",null),void this.touch();var t=this.x_pixels.map((function(t){return Math.abs(t-e)})),n=t.indexOf(r.min(t));return this.model.set("selected",[n]),this.update_selected_colors([n]),this.touch(),n},prepareBoxPlots:function(){var e=this.scales.x,t=this.scales.y;this.plotData=[];for(var n=0;n<this.model.mark_data.length;++n){var i=this.model.mark_data[n],o={};o.x=e.scale(i[0]),o.boxUpper=t.scale(r.quantile(i[1],.75)),o.boxLower=t.scale(r.quantile(i[1],.25)),o.boxMedian=t.scale(r.quantile(i[1],.5));var s=o.boxLower-o.boxUpper,a=o.boxLower+1.5*s,l=o.boxUpper-1.5*s;o.outliers=[],o.whiskerMax=Number.MAX_VALUE,o.whiskerMin=Number.MIN_VALUE;for(var c=0;c<i[1].length;++c){var u=t.scale(i[1][c]);u>a||u<l?o.outliers.push(u):(u>o.whiskerMin&&(o.whiskerMin=u),u<o.whiskerMax&&(o.whiskerMax=u))}this.plotData.push(o)}},draw:function(){this.set_ranges();var e=this.scales.x;this.prepareBoxPlots();var t=this.plotData;this.draw_mark_paths(".boxplot",this.d3el,t),this.x_pixels=this.model.mark_data.map((function(t){return e.scale(t[0])+e.offset}));var n=this.get_box_width()/2;this.pixel_coords=t.map((function(e){return[[e.x-n,e.x+n],[e.boxLower,e.boxUpper]]}))},draw_mark_paths:function(e,t,n){this.calculate_mark_max_width();var r=this.model.get("color"),i=this.d3el.selectAll(e).data(n),o=this.model.get("box_fill_color"),s=(this.model.get("start_time"),i.enter().append("g").attr("class","boxplot").attr("id",(function(e,t){return"boxplot"+t})));s.append("path").attr("class","whisker_max"),s.append("path").attr("class","whisker_max_end"),s.append("path").attr("class","whisker_min"),s.append("path").attr("class","whisker_min_end"),s.append("rect").attr("class","box"),s.append("path").attr("class","median_line"),s.append("g").attr("class","outliers");var a=0,l=this.scales.x;"ordinal"===l.model.type&&(a=l.scale.rangeBand()/2),t.selectAll(".boxplot").style("stroke",this.model.get("stroke")).style("opacity",r).attr("transform",(function(e,t){return"translate("+(e.x+a)+", 0)"}));var c=this.get_box_width();t.selectAll(".box").style("fill",o).attr("x",-c/2).attr("width",c).attr("y",(function(e,t){return e.boxUpper})).attr("height",(function(e,t){return e.boxLower-e.boxUpper})),t.selectAll(".median_line").style("stroke-width",2).attr("d",(function(e,t){var n=e.boxMedian;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n})),t.selectAll(".whisker_max").attr("d",(function(e,t){return"M0,"+e.whiskerMax+" L0,"+e.boxUpper})).attr("stroke-dasharray",(function(e,t){return"5,5"})),t.selectAll(".whisker_max_end").attr("d",(function(e,t){var n=e.whiskerMax;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n})),t.selectAll(".whisker_min").attr("d",(function(e,t){return"M0,"+e.whiskerMin+" L0,"+e.boxLower})).attr("stroke-dasharray",(function(e,t){return"5,5"})),t.selectAll(".whisker_min_end").attr("d",(function(e,t){var n=e.whiskerMin;return"M"+(0-c/2)+","+n+" L"+(0+c/2)+","+n}));var u=t.selectAll(".outliers").selectAll("circle").data((function(e){return e.outliers}));u.enter().append("circle").attr("class","outlier"),t.selectAll(".outlier").style("fill",this.model.get("outlier_fill_color")).attr("class","outlier").attr("cx",0).attr("r",3).attr("cy",(function(e){return e})),u.exit().remove(),i.exit().remove(),this.apply_styles(this.selected_indices)},calculate_mark_max_width:function(){for(var e=1/0,t=this.scales.x,n=1;n<this.model.mark_data.length;n++){var r=t.scale(this.model.mark_data[n][0])-t.scale(this.model.mark_data[n-1][0]);(r=r<0?-1*r:r)<e&&(e=r)}return e==1/0?(t.scale(this.model.max_x)-t.scale(this.model.min_x))/2:e},relayout:function(){o.__super__.relayout.apply(this),this.set_ranges(),this.compute_view_padding(),this.d3el.select(".intselmouse").attr("width",this.width).attr("height",this.height),this.draw()},draw_legend:function(e,t,n,o,s){var a=this.model.get("stroke");this.model.get("colors");this.rect_dim=.8*s;var l=this;this.legend_el=e.selectAll(".legend"+this.uuid).data([this.model.mark_data]),this.legend_el.enter().append("g").attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).attr("class","legend"+this.uuid).on("mouseover",i.bind(this.highlight_axes,this)).on("mouseout",i.bind(this.unhighlight_axes,this)).selectAll("path").attr("stroke",a).attr("transform","translate("+l.rect_dim/2+",0)"),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*l.rect_dim).attr("y",l.rect_dim/2).attr("dy","0.35em").text((function(e,t){return l.model.get("labels")[t]})).style("fill",a);var c=r.max(this.model.get("labels"),(function(e){return e.length}));return this.legend_el.exit().remove(),[1,c]}});e.exports={Boxplot:o}},function(e,t,n){var r=n(1),i=n(0),o=n(52).BaseXSelector.extend({render:function(){o.__super__.render.apply(this),this.active=!1,this.dirty=!1;var e=this,t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.line=e.d3el.append("line").attr("class","selector indsel").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke-width",e.model.get("line_width")).attr("pointer-events","none").attr("visibility","hidden"),e.color_change(),e.background=e.d3el.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("class","selector selectormouse").attr("pointer-events","all").attr("visibility","hidden"),e.background.on("mousemove",i.bind(e.mousemove,e)).on("click",i.bind(e.initial_click,e)),e.create_listeners(),e.selected_changed()}))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this)},color_change:function(){null!==this.model.get("color")&&this.line.style("stroke",this.model.get("color"))},initial_click:function(){this.line.attr("visibility","visible"),this.click(),this.background.on("click",i.bind(this.click,this))},click:function(){this.active=!this.active},mousemove:function(){if(this.active){this.dirty=!0;var e=r.mouse(this.background.node())[0];this.line.attr({x1:e,x2:e}),this.model.set_typed_field("selected",[this.invert_pixel(e)]),i.each(this.mark_views,(function(t){t.invert_point(e)})),this.touch(),this.dirty=!1}},invert_pixel:function(e){return this.scale.invert(e)},reset:function(){this.active=!1,void 0!==this.line&&null!==this.line&&this.line.attr({x1:0,x2:0,visibility:"hidden"}),void 0!==this.background&&null!==this.background&&this.background.on("click",i.bind(this.initial_click,this)),this.model.set_typed_field("selected",{}),i.each(this.mark_views,(function(e){e.invert_point()})),this.touch()},update_scale_domain:function(e){o.__super__.update_scale_domain.apply(this),!0!==e&&this.selected_changed()},selected_changed:function(e,t){if(!this.dirty){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(1!=n.length)return;var r=this.scale.scale(n[0]);void 0!==this.line&&null!==this.line&&this.line.attr({x1:r,x2:r,visibility:"visible"}),this.background.on("click",i.bind(this.click,this)),i.each(this.mark_views,(function(e){e.invert_point(r)}))}}},relayout:function(){o.__super__.relayout.apply(this),this.line.attr("y1",0).attr("y2",this.height),this.background.attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},scale_changed:function(){this.reset(),this.scale=this.parent.x_scale},set_range:function(e){for(var t=0;t<e.length;t++)e[t].set_range([0,this.width])}});e.exports={IndexSelector:o}},function(e,t,n){n(1);var r=n(193),i=n(102),o=r.OrdinalScale.extend({render:function(){o.__super__.render.apply(this),this.listenTo(this.model,"domain_changed",this.model_domain_changed,this),this.listenTo(this.model,"set_ticks",this.model_ticks_changed,this),this.model.on_some_change(["colors","scheme"],this.colors_changed,this),this.set_range()},set_range:function(){this.model.get("colors").length>0?this.scale.range(i.cycle_colors(this.model.get("colors"),this.scale.domain().length)):this.scale.range(i.get_ordinal_scale_range(this.model.get("scheme"),this.scale.domain().length)),this.trigger("color_scale_range_changed")},model_domain_changed:function(){o.__super__.model_domain_changed.apply(this),this.set_range()},colors_changed:function(){this.set_range()}});e.exports={OrdinalColorScale:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"BoxplotModel",_view_name:"Boxplot",x:[],y:[],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}},stroke:null,box_fill_color:"dodgerblue",outlier_fill_color:"gray",opacities:[],box_width:null})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){var e=this.get_typed_field("x"),t=this.get_typed_field("y");t.forEach((function(e){e.sort((function(e,t){return e-t}))})),e.length>t.length?e=e.slice(0,t.length):e.length<t.length&&(t=t.slice(0,e.length)),this.mark_data=i.zip(e,t),this.update_domains(),this.trigger("data_updated")},update_domains:function(){var e=this.get("scales"),t=e.x,n=e.y;e.size,e.opacity;if(!this.get("preserve_domain").x&&this.mark_data?t.compute_and_set_domain(this.mark_data.map((function(e){return e[0]})),this.model_id+"_x"):t.del_domain([],this.model_id+"_x"),!this.get("preserve_domain").y&&this.mark_data){var i=r.min(this.mark_data.map((function(e){return e[1][0]}))),o=r.max(this.mark_data.map((function(e){var t=e[1];return t[t.length-1]})));n.set_domain([i,o],this.model_id+"_y")}else n.del_domain([],this.model_id+"_y")}});e.exports={BoxplotModel:s}},function(e,t,n){var r=n(1),i=n(195).ScatterBase.extend({create_listeners:function(){i.__super__.create_listeners.apply(this),this.model.on_some_change(["font_weight","font_size","colors","align","font_unit"],this.update_style,this),this.model.on_some_change(["x","y","x_offset","y_offset","rotate_angle"],this.update_position,this)},update_default_opacities:function(e){if(!this.model.dirty){this.model.get("default_opacities").length;var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_opacities").duration(t).style("opacity",(function(e,t){return n.get_element_opacity(e,t)}))}},update_default_size:function(e){if(this.compute_view_padding(),!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_size").duration(t).style("font-size",(function(e,t){return n.get_element_size(e)}))}},create_listeners:function(){i.__super__.create_listeners.apply(this),this.model.on_some_change(["font_weight","default_size","colors","align","font_unit"],this.update_style,this),this.model.on_some_change(["x","y","x_offset","y_offset","rotate_angle"],this.update_position,this)},relayout:function(){this.set_ranges(),this.update_position()},draw_elements:function(e,t){t.append("text").classed("label element",!0),this.update_text(),this.update_style(),this.update_default_opacities(!0)},update_text:function(){this.d3el.selectAll(".object_grp").select(".label").text((function(e){return e.text}))},get_element_size:function(e){var t=this.scales.size,n=this.model.get("font_unit");return t&&void 0!==e.size?t.scale(e.size)+n:this.model.get("default_size")+n},get_element_rotation:function(e){var t=this.scales.rotation;return t&&e.rotation?"rotate("+t.scale(e.rotation)+")":"rotate("+this.model.get("rotate_angle")+")"},update_position:function(){var e=this,t=this.x_scale,n=this.y_scale,r=("date"===t.model.type?this.model.get_date_elem("x"):this.model.get("x"),"date"===n.model.type?this.model.get_date_elem("y"):this.model.get("y"),this.model.get("x_offset")),i=this.model.get("y_offset");this.d3el.selectAll(".object_grp").attr("transform",(function(o){return"translate("+(t.scale(o.x)+t.offset+r)+","+(n.scale(o.y)+n.offset+i)+")"+e.get_element_rotation(o)}))},update_style:function(){var e=this;this.d3el.selectAll(".object_grp").select("text").attr("dominant-baseline","central").style("font-size",(function(t,n){return e.get_element_size(t)})).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")),this.d3el.selectAll(".label").style("fill",(function(t,n){return e.get_element_color(t,n)}))},color_scale_updated:function(e){var t=this,n=!0===e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").transition("color_scale_updated").duration(n).style("fill",(function(e,n){return t.get_element_color(e,n)}))},set_default_style:function(e){if(e&&0!==e.length){var t=this.d3el.selectAll(".element").filter((function(t,n){return-1!==e.indexOf(n)})),n=this;t.style("font-size",(function(e,t){return n.get_element_size(e)})).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")).style("fill",(function(e,t){return n.get_element_color(e,t)}))}},set_drag_style:function(e,t,n){var i=this.model.get("drag_size")*this.model.get("default_size")+this.model.get("font_unit");r.select(n).select("text").classed("drag_label",!0).transition("set_drag_style").style("font-size",i)},reset_drag_style:function(e,t,n){r.select(n).select("text").classed("drag_label",!1).transition("reset_drag_style").style("font-size",this.get_element_size(e))}});e.exports={Label:i}},function(e,t,n){n(1);var r=n(0),i=n(196),o=i.ScatterBaseModel.extend({defaults:function(){return r.extend(i.ScatterBaseModel.prototype.defaults(),{_model_name:"LabelModel",_view_name:"Label",x_offset:0,y_offset:0,rotate_angle:0,text:[],font_size:16,font_unit:"px",drag_size:1,font_weight:"bold",align:"start"})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on("change:text",this.update_data,this)},update_mark_data:function(){o.__super__.update_mark_data.apply(this);var e=this.get_typed_field("text");this.mark_data.forEach((function(t,n){t.text=e[n]}))},update_unique_ids:function(){this.mark_data.forEach((function(e,t){e.unique_id="Label"+t}))}});e.exports={LabelModel:o}},function(e,t,n){var r=n(0),i=(n(1),n(70)),o=i.ScaleModel.extend({defaults:function(){return r.extend(i.ScaleModel.prototype.defaults(),{_model_name:"OrdinalScaleModel",_view_name:"OrdinalScale",min:null,max:null})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="ordinal",this.min_from_data=!0,this.max_from_data=!0},set_listeners:function(){this.on("change:domain",this.domain_changed,this),this.domain_changed(),this.on("change:reverse",this.reverse_changed,this),this.reverse_changed()},domain_changed:function(){this.ord_domain=this.get("domain"),null!==this.ord_domain&&0!==this.ord_domain.length?(this.max_from_data=!1,this.min_from_data=!1,this.domain=this.ord_domain.map((function(e){return e})),this.trigger("domain_changed")):(this.max_from_data=!0,this.min_from_data=!0,this.domain=[],this.update_domain())},reverse_changed:function(e,t,n){var r=void 0!==e&&e.previous("reverse");this.reverse=this.get("reverse");var i=(r+this.reverse)%2;this.domain.length>0&&1===i&&(this.domain.reverse(),this.trigger("domain_changed",this.domain))},update_domain:function(){var e=[];for(var t in this.domains)e=r.union(e,this.domains[t]);this.domain.length===e.length&&r.intersection(this.domain,e).length===e.length||(this.domain=e,this.trigger("domain_changed",e))},compute_and_set_domain:function(e,t){if(this.min_from_data||this.max_from_data)if(0!==e.length){var n=r.flatten(e);this.get("reverse")&&n.reverse(),this.set_domain(n,t)}else this.set_domain([],t)}});e.exports={OrdinalScaleModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(52),s=n(13),a=n(103),l={brush_render:function(){var e=this,t=this.create_scales();this.brushing=!1,Promise.all([this.mark_views_promise,t]).then((function(){e.brush=r.svg.brush().on("brushstart",i.bind(e.brush_start,e)).on("brush",i.bind(e.brush_move,e)).on("brushend",i.bind(e.brush_end,e)),e.set_brush_scale(),e.d3el.attr("class","selector brushintsel"),e.brushsel=e.d3el.call(e.brush),e.adjust_rectangle(),e.color_change(),e.create_listeners(),e.selected_changed()}))},color_change:function(){null!==this.model.get("color")&&this.brushsel.style("fill",this.model.get("color"))},brush_start:function(){this.model.set("brushing",!0),this.touch(),this.brushing=!0},brush_move:function(){var e=this.brush.empty()?[]:this.brush.extent();this.convert_and_save(e)},brush_end:function(){var e=this.brush.empty()?[]:this.brush.extent();this.model.set("brushing",!1),this.convert_and_save(e),this.brushing=!1},scale_changed:function(){this.brush.clear(),this.create_scales(),this.set_brush_scale()},adjust_rectangle:function(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)},_update_brush:function(){this.brushsel=this.d3el.call(this.brush),this.d3el.call(this.brush.event)},update_mark_selected:function(e,t){if(void 0!==e&&0!==e.length){if(void 0===t)var n=this.model.get("orientation"),r="vertical"==n?[]:e,o="vertical"==n?e:[];else r=e,o=t;var s=function(e){return a.point_in_rectangle(e,r,o)},l=function(e){return a.rect_inter_rect(e[0],e[1],r,o)};i.each(this.mark_views,(function(e){e.selector_changed(s,l)}),this)}else i.each(this.mark_views,(function(e){return e.selector_changed()}))}},c=o.BaseXYSelector.extend(l).extend({render:function(){c.__super__.render.apply(this),this.brush_render()},create_listeners:function(){c.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this),this.listenTo(this.model,"change:selected_x",this.selected_changed),this.listenTo(this.model,"change:selected_y",this.selected_changed)},reset:function(){this.brush.clear(),this._update_brush(),this.model.set("selected_x",{}),this.model.set("selected_y",{}),this.update_mark_selected(),this.touch()},convert_and_save:function(e){if(0!==e.length){var t=[e[0][0],e[1][0]],n=[e[0][1],e[1][1]],r="ordinal"===this.x_scale.model.type,i="ordinal"===this.y_scale.model.type,o=r?t:t.map(this.x_scale.scale),s=i?n:n.map(this.y_scale.scale);t=r?this.x_scale.invert_range(t):t,n=i?this.y_scale.invert_range(n):n,this.update_mark_selected(o,s),this.model.set_typed_field("selected_x",t),this.model.set_typed_field("selected_y",n),this.touch()}else this.update_mark_selected([])},selected_changed:function(e,t){if(!this.brushing){var n=this.model.get_typed_field("selected_x"),r=this.model.get_typed_field("selected_y");if(0===n.length||0===r.length)this.reset();else{if(2!=n.length||2!=r.length)return;var i=[[n[0],r[0]],[n[1],r[1]]];this.brush.extent(i),this._update_brush();var o=n.map(this.x_scale.scale).sort((function(e,t){return e-t})),s=r.map(this.y_scale.scale).sort((function(e,t){return e-t}));this.update_mark_selected(o,s)}}},relayout:function(){c.__super__.relayout.apply(this),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_x_range([this.x_scale]),this.set_y_range([this.y_scale])},adjust_rectangle:function(){},set_brush_scale:function(){this.brush.y(this.y_scale.scale).x(this.x_scale.scale)},update_xscale_domain:function(){c.__super__.update_xscale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.brush.x(this.x_scale.scale)},update_yscale_domain:function(){c.__super__.update_yscale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.brush.y(this.y_scale.scale)}}),u=o.BaseXSelector.extend(l).extend({render:function(){u.__super__.render.apply(this),this.brush_render()},create_listeners:function(){u.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.change_color,this)},reset:function(){this.brush.clear(),this._update_brush(),this.model.set("selected",{}),this.update_mark_selected(),this.touch()},convert_and_save:function(e){if(0!==e.length){var t="ordinal"===this.scale.model.type,n=t?e:e.map(this.scale.scale);e=t?this.scale.invert_range(e):e,this.update_mark_selected(n),this.model.set_typed_field("selected",e),this.touch()}else this.update_mark_selected([])},update_scale_domain:function(e){u.__super__.update_scale_domain.apply(this),void 0!==this.brush&&null!==this.brush&&this.set_brush_scale(),!0!==e&&this.selected_changed()},set_brush_scale:function(){"vertical"==this.model.get("orientation")?this.brush.y(this.scale.scale):this.brush.x(this.scale.scale)},selected_changed:function(e,t){if(!this.brushing){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(2!=n.length)return;var r=[n[0],n[1]];this.brush.extent(r),this._update_brush();var i=r.map(this.scale.scale).sort((function(e,t){return e-t}));this.update_mark_selected(i)}}},remove:function(){this.brush.clear(),u.__super__.remove.apply(this)},relayout:function(){u.__super__.relayout.apply(this),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale])}}),h=function(e,t,n){n&&n.forEach((function(t){e.classed(t,!1)})),t&&t.forEach((function(t){e.classed(t,!0)}))},d=o.BaseXSelector.extend(l).extend({render:function(){d.__super__.render.apply(this);var e=this;this.names=this.model.get("names"),this.curr_index=0;var t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.d3el.attr("class","multiselector"),e.create_brush(),e.selecting_brush=!1,e.create_listeners()}))},create_listeners:function(){d.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:names",this.labels_change,this),this.listenTo(this.model,"change:color",this.color_change,this)},labels_change:function(e,t){var n=e.previous("names");this.names=t;var r=i.range(this.curr_index+1),o=this,a=s.deepCopy(this.model.get("selected"));r.forEach((function(e){var t=o.get_label(e),r=o.get_label(e,n);r!==t&&(o.d3el.select(".brush_text_"+e).text(t),a[t]=a[r],delete a[r])})),this.model.set_typed_field("_selected",a),this.touch()},create_brush:function(e){var t=this,n=this.curr_index,i=r.svg.brush().on("brushstart",(function(){t.brush_start()})).on("brush",(function(){t.brush_move(n,this)})).on("brushend",(function(){t.brush_end(n,this)})),o=this.d3el.append("g").attr("class","selector brushintsel active");o.append("text").text(this.get_label(this.curr_index)).attr("class","brush_text_"+this.curr_index).style("text-anchor","middle").style("stroke","yellow").style("font-size","16px").style("display","none"),"vertical"==this.model.get("orientation")?(i.y(this.scale.scale),o.select("text").attr("x",30)):(i.x(this.scale.scale),o.select("text").attr("y",30)),o.call(i),this.color_change(),this.adjust_rectangle();var s=o.on("mousedown.brush");o.on("mousedown.brush",(function(){h(t.d3el.selectAll(".selector"),["inactive"],["visible"]),h(r.select(this),["active"],["inactive"]),s.call(this),r.select(this).on("mousedown.brush",(function(){var e=r.event.ctrlKey||r.event.metaKey;r.event.shiftKey&&e&&r.event.altKey?t.reset():e?(h(r.select(this),["inactive"],["active"]),t.create_brush(r.event)):r.event.shiftKey&&!1===t.selecting_brush?(h(t.d3el.selectAll(".selector"),["visible"],["active","inactive"]),t.selecting_brush=!0):(h(t.d3el.selectAll(".selector"),["inactive"],["visible"]),h(r.select(this),["active"],["inactive"]),s.call(this),t.selecting_brush=!1)}))})),this.curr_index=this.curr_index+1},get_label:function(e,t){return null==t&&(t=this.names),t.length>e?t[e]:e},brush_start:function(){this.model.set("brushing",!0),this.touch()},brush_move:function(e,t){var n=r.event.target,i=n.empty()?this.scale.scale.domain():n.extent(),o=!this.model.get("show_names");r.select(t).select("text").style("display",n.empty()||o?"none":"inline"),this.set_text_location(t,i),this.convert_and_save(i,e)},set_text_location:function(e,t){var n=(t[0]+t[1])/2;"date"===this.scale.model.type&&(n=new Date((t[0].getTime()+t[1].getTime())/2));var i="vertical"==this.model.get("orientation")?"y":"x";r.select(e).select("text").attr(i,this.scale.scale(n))},brush_end:function(e,t){var n=r.event.target,i=n.empty()?this.scale.scale.domain():n.extent();this.model.set("brushing",!1),this.convert_and_save(i,e)},reset:function(){this.d3el.selectAll(".selector").remove(),this.model.set("_selected",{}),this.curr_index=0,this.touch(),this.create_brush()},convert_and_save:function(e,t){var n=s.deepCopy(this.model.get("_selected"));n[this.get_label(t)]=e;var r=e.map(this.scale.scale);this.update_mark_selected(r),this.model.set("_selected",n),this.touch()},scale_changed:function(){this.d3el.selectAll(".selector").remove(),this.curr_index=0,this.create_scale(),this.create_brush()},color_change:function(){null!==this.model.get("color")&&this.d3el.selectAll(".selector").style("fill",this.model.get("color"))},relayout:function(){d.__super__.relayout.apply(this),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},remove:function(){this.model.off("change:names",null,this),d.__super__.remove.apply(this)}});e.exports={BrushSelector:c,BrushIntervalSelector:u,MultiSelector:d}},function(e,t,n){var r=n(1),i=n(0),o=(n(13),n(52)),s=n(103),a=o.BaseXYSelector.extend({render:function(){a.__super__.render.apply(this);var e=this.create_scales();this.line=r.svg.line(),this.all_vertices={},this.lasso_counter=0;var t=this;Promise.all([this.mark_views_promise,e]).then((function(){var e=r.behavior.drag().on("dragstart",i.bind(t.drag_start,t)).on("drag",i.bind(t.drag_move,t)).on("dragend",i.bind(t.drag_end,t));r.select(window).on("keydown",i.bind(t.keydown,t)),t.d3el.attr("class","lassoselector"),t.background=t.d3el.append("rect").attr("x",0).attr("y",0).attr("width",t.width).attr("height",t.height).attr("visibility","hidden").attr("pointer-events","all").style("cursor","crosshair").call(e),t.create_listeners()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.change_color,this)},change_color:function(e,t){t&&this.d3el.selectAll("path").style("stroke",t)},create_new_lasso:function(){var e=this.d3el.append("path").attr("id","l"+ ++this.lasso_counter).on("click",(function(){var e=r.select(this);e.classed("selected",!e.classed("selected"))})),t=this.model.get("color");t&&e.style("stroke",t)},drag_start:function(){this.current_vertices=[],this.create_new_lasso()},drag_move:function(){this.current_vertices.push(r.mouse(this.background.node())),this.d3el.select("#l"+this.lasso_counter).attr("d",this.line(this.current_vertices))},drag_end:function(){var e="l"+this.lasso_counter;this.d3el.select("#"+e).attr("d",this.line(this.current_vertices)+"Z"),this.all_vertices[e]=this.current_vertices,this.update_mark_selected(this.all_vertices)},update_mark_selected:function(e){void 0!==e&&0!==e.length||i.each(this.mark_views,(function(e){return e.selector_changed()}));var t=function(t){for(var n in e)if(s.point_in_lasso(t,e[n]))return!0;return!1},n=function(t){for(var n in e)if(s.lasso_inter_rect(t[0],t[1],e[n]))return!0;return!1};i.each(this.mark_views,(function(e){e.selector_changed(t,n)}),this)},relayout:function(){a.__super__.relayout.apply(this),this.background.attr("width",this.width).attr("height",this.height)},keydown:function(){if(46===r.event.keyCode){var e=this.d3el.selectAll(".selected"),t=this.all_vertices;e.each((function(){var e=r.select(this).attr("id");delete t[e]})),e.remove(),this.update_mark_selected(this.all_vertices)}},reset:function(){this.lasso_counter=0,this.all_vertices={},this.d3el.selectAll("path").remove(),this.update_mark_selected()}});e.exports={LassoSelector:a}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(68).Interaction.extend({render:function(){s.__super__.render.apply(this);var e=this;this.d3el.style({cursor:"move"}).on("mousedown",(function(){e.mousedown()})).on("mousemove",(function(){e.mousemove()})).on("mouseup",(function(){e.mouseup()})).on("mousewheel",(function(){e.mousewheel()})).on("DOMMouseScroll.zoom",(function(){e.mousewheel()})).on("mousewheel.zoom",null).on("wheel.zoom",null),this.active=!1,this.update_scales(),this.listenTo(this.model,"change:scales",this.update_scales,this),this.set_ranges(),this.listenTo(this.parent,"margin_updated",this.set_ranges,this)},update_scales:function(){var e=this.model.get("scales"),t=this;this.scale_promises=r.resolvePromisesDict({x:Promise.all((e.x||[]).map((function(e){return t.create_child_view(e)}))),y:Promise.all((e.y||[]).map((function(e){return t.create_child_view(e)})))}),r.resolvePromisesDict(this.scale_promises).then(i.bind(this.set_ranges,this))},set_ranges:function(){var e,t=this;this.scale_promises.then((function(n){var r=n.x;for(e=0;e<r.length;e++)r[e].set_range(t.parent.padded_range("x",r[e].model));var i=n.y;for(e=0;e<i.length;e++)i[e].set_range(t.parent.padded_range("y",i[e].model))}))},mousedown:function(){var e=this.model.get("scales");this.active=!0,this.d3el.style({cursor:"move"}),this.previous_pos=o.mouse(this.el),this.domains={x:(e.x||[]).map((function(e){return e.domain.slice(0)})),y:(e.y||[]).map((function(e){return e.domain.slice(0)}))}},mouseup:function(){this.active=!1},mousemove:function(){if(this.active&&this.model.get("allow_pan")){var e=o.mouse(this.el);"previous_pos"in this||(this.previous_pos=e);var t=this.model.get("scales"),n=this;this.scale_promises.then((function(r){var i,o,s,a,l=r.x,c=n.domains.x,u=l.map((function(t){if(t.scale.invert)return t.scale.invert(e[0])-t.scale.invert(n.previous_pos[0])}));for(i=0;i<l.length;i++)s=(o=c[i])[0]-u[i],a=o[1]-u[i],n.set_scale_attribute(t.x[i],"min",s),n.set_scale_attribute(t.x[i],"max",a),l[i].touch();var h=r.y,d=n.domains.y,p=h.map((function(t){if(t.scale.invert)return t.scale.invert(e[1])-t.scale.invert(n.previous_pos[1])}));for(i=0;i<h.length;i++)s=(o=d[i])[0]-p[i],a=o[1]-p[i],n.set_scale_attribute(t.y[i],"min",s),n.set_scale_attribute(t.y[i],"max",a),h[i].touch()}))}},mousewheel:function(){if(this.model.get("allow_zoom")){o.event.preventDefault();var e=o.event.wheelDelta||-40*o.event.detail,t=o.mouse(this.el);if(e){e>0?this.d3el.style({cursor:"zoom-in"}):this.d3el.style({cursor:"zoom-out"});var n=this.model.get("scales"),r=this;this.scale_promises.then((function(i){var o,s,a,l,c=i.x,u=c.map((function(e){return e.scale.invert(t[0])})),h=Math.exp(.001*-e);for(o=0;o<c.length;o++)a=(s=n.x[o].domain)[0],l=s[1],r.set_scale_attribute(n.x[o],"min",(1-h)*u[o]+h*a),r.set_scale_attribute(n.x[o],"max",(1-h)*u[o]+h*l),c[o].touch();var d=i.y,p=d.map((function(e){return e.scale.invert(t[1])}));for(o=0;o<d.length;o++)a=(s=n.y[o].domain)[0],l=s[1],r.set_scale_attribute(n.y[o],"min",(1-h)*p[o]+h*a),r.set_scale_attribute(n.y[o],"max",(1-h)*p[o]+h*l),d[o].touch()}))}}},set_scale_attribute:function(e,t,n){"date"==e.type?(n=n instanceof Date?n:new Date(n),e.set_date_elem(t,n)):e.set(t,n)}});e.exports={PanZoom:s}},function(e,t,n){var r=n(1),i=(n(0),n(13),n(192).Axis.extend({render:function(){this.parent=this.options.parent,this.margin=this.parent.margin,this.vertical="vertical"===this.model.get("orientation"),this.height=this.parent.height-(this.margin.top+this.margin.bottom),this.width=this.parent.width-(this.margin.left+this.margin.right);var e=this.set_scale(this.model.get("scale"));this.side=this.model.get("side"),this.x_offset=100,this.y_offset=40,this.bar_height=20,this.d3el.attr("class","ColorBar").attr("display",this.model.get("visible")?"inline":"none").attr("transform",this.get_topg_transform()),this.ordinal=!1,this.num_ticks=this.model.get("num_ticks");var t=this;e.then((function(){t.create_listeners(),t.tick_format=t.generate_tick_formatter(),t.set_scales_range(),t.append_axis()}))},create_listeners:function(){this.listenTo(this.model,"change:scale",(function(e,t){this.update_scale(e.previous("scale"),t),this.axis.scale(this.axis_scale.scale),this.rescale_axis()}),this),this.listenTo(this.model,"change:tick_format",this.tickformat_changed,this),this.axis_scale.on("domain_changed",this.redraw_axisline,this),this.axis_scale.on("color_scale_range_changed",this.redraw_axis,this),this.axis_scale.on("highlight_axis",this.highlight,this),this.axis_scale.on("unhighlight_axis",this.unhighlight,this),this.parent.on("margin_updated",this.parent_margin_updated,this),this.listenTo(this.model,"change:visible",this.update_visibility,this),this.listenTo(this.model,"change:label",this.update_label,this),this.model.on_some_change(["side","orientation"],this.update_display,this)},update_display:function(){this.side=this.model.get("side"),this.vertical="vertical"===this.model.get("orientation"),this.rescale_axis(),this.d3el.select("#colorBarG"+this.cid).attr("transform",this.get_colorbar_transform()),this.d3el.select("#colorBarG"+this.cid).select(".g-rect").attr("transform",this.vertical?"rotate(-90)":""),this.redraw_axisline()},set_scale:function(e){var t=this;return this.axis_scale&&this.axis_scale.remove(),this.create_child_view(e).then((function(e){t.displayed.then((function(){e.trigger("displayed")})),t.axis_scale=e,"date_color_linear"===t.axis_scale.model.type?t.axis_line_scale=r.time.scale().nice():"ordinal"===t.axis_scale.model.type?(t.axis_line_scale=r.scale.ordinal(),t.ordinal=!0):t.axis_line_scale=r.scale.linear()}))},append_axis:function(){void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.append("g").attr("transform",this.get_label_transform()).attr("class","axis label_g").append("text").append("tspan").attr("id","text_elem").attr("dy","0.5ex").text(this.model.get("label")).attr("class","axislabel").style("text-anchor",this.vertical?"middle":"end");var e=this.d3el.append("g").attr("id","colorBarG"+this.cid);this.draw_color_bar(),this.set_axisline_domain(),this.g_axisline=e.append("g").attr("class","axis"),this.axis=r.svg.axis().tickFormat(this.tick_format),this.redraw_axisline()},draw_color_bar:function(){var e=this.d3el.select("#colorBarG"+this.cid);e.attr("transform",this.get_colorbar_transform());var t=this;e.selectAll(".g-rect").remove(),e.selectAll(".g-defs").remove(),this.colors=this.axis_scale.scale.range();var n=100/(this.colors.length-1);if(this.ordinal){var r=this.get_color_bar_width()/this.colors.length,i=e.append("g").attr("class","g-rect axis").selectAll("rect").data(this.colors);i.enter().append("rect").attr("y",0).attr("height",this.bar_height).attr("width",r).style("fill",(function(e){return e})),this.vertical?i.attr("x",(function(e,n){return n*r-(t.height-2*t.x_offset)})):i.attr("x",(function(e,t){return t*r}))}else e.append("g").attr("class","g-defs").append("defs").append("linearGradient").attr({id:"colorBarGradient"+this.cid,x1:"0%",y1:"0%",x2:"100%",y2:"0%"}).selectAll("stop").data(this.colors).enter().append("stop").attr({offset:function(e,t){return n*t+"%"},"stop-color":function(e,n){return t.colors[n]},"stop-opacity":1}),e.append("g").attr("class","g-rect axis").append("rect").attr({width:this.get_color_bar_width(),height:this.bar_height,x:this.vertical?-(this.height-2*this.x_offset):0,y:0,"stroke-width":1}).style("fill","url(#colorBarGradient"+this.cid+")");this.vertical&&e.select(".g-rect").attr("transform","rotate(-90)")},get_topg_transform:function(){return this.vertical?"right"===this.side?"translate("+String(this.get_basic_transform()+this.margin.right/2-this.bar_height)+", 0)":"translate("+String(this.get_basic_transform()-this.margin.left/2+this.bar_height)+", 0)":"top"===this.side?"translate(0, "+String(this.get_basic_transform()-this.margin.top+this.bar_height+24)+")":"translate(0, "+String(this.get_basic_transform()+this.margin.bottom-this.bar_height-24)+")"},get_label_transform:function(){return this.vertical?"translate("+("right"===this.side?this.bar_height/2:-this.bar_height/2)+", "+(this.x_offset-15)+")":"translate("+(this.x_offset-5)+", "+this.bar_height/2+")"},get_colorbar_transform:function(){return this.vertical?"translate(0, "+String(this.x_offset)+")":"translate("+String(this.x_offset)+", 0)"},set_axisline_scale_range:function(){var e=this.vertical?[this.height-2*this.x_offset,0]:[0,this.width-2*this.x_offset];if(this.ordinal)this.axis_line_scale.rangeRoundBands(e,.05);else{var t=this.axis_scale.model.mid;null==t?this.axis_line_scale.range(e):this.axis_line_scale.range([e[0],.5*(e[0]+e[1]),e[1]])}},set_scales_range:function(){this.axis_scale.set_range(),this.set_axisline_scale_range()},get_color_bar_width:function(){return this.vertical?this.height-2*this.x_offset:this.width-2*this.x_offset},update_label:function(e,t){this.d3el.select("#text_elem").text(this.model.get("label"))},rescale_axis:function(){this.set_axisline_scale_range(),this.d3el.attr("transform",this.get_topg_transform());var e=this,t=this.get_color_bar_width()/this.colors.length;if(this.ordinal){var n=this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",t);this.vertical?n.attr("x",(function(n,r){return r*t-(e.height-2*e.x_offset)})):n.attr("x",(function(e,n){return n*t}))}else this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",this.get_color_bar_width()).attr("x",this.vertical?-(this.height-2*this.x_offset):0);void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.select(".label_g").attr("transform",this.get_label_transform()).select("#text_elem").style("text-anchor",this.vertical?"middle":"end"),this.g_axisline.call(this.axis)},redraw_axisline:function(){var e;this.axis&&(this.set_axisline_domain(),this.set_axisline_scale_range(),this.axis.orient(this.side).scale(this.axis_line_scale),this.set_tick_values(),e=this.vertical?"translate("+("right"===this.side?this.bar_height:0)+", 0)":"translate(0, "+("top"===this.side?0:this.bar_height)+")",this.g_axisline.attr("transform",e).call(this.axis))},set_axisline_domain:function(){var e=this.axis_scale.scale.domain(),t=this.axis_scale.model.mid;null==t?this.axis_line_scale.domain([e[0],e[e.length-1]]):this.axis_line_scale.domain([e[0],t,e[e.length-1]])},redraw_axis:function(){this.draw_color_bar(),this.redraw_axisline()}}));e.exports={ColorAxis:i}},function(e,t,n){var r=n(9),i=n(0),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"PanZoomModel",_view_name:"PanZoom",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,scales:{},allow_pan:!0,allow_zoom:!0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("change:scales",this.snapshot_scales,this),this.snapshot_scales()},reset_scales:function(){var e=this;r.resolvePromisesDict(this.get("scales")).then((function(t){i.each(Object.keys(t),(function(n){i.each(t[n],(function(t,r){t.set_state(e.scales_states[n][r])}),e)}),e)}))},snapshot_scales:function(){var e=this;r.resolvePromisesDict(this.get("scales")).then((function(t){e.scales_states=Object.keys(t).reduce((function(e,n){return e[n]=t[n].map((function(e){return e.get_state()})),e}),{})}))}},{serializers:i.extend({scales:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={PanZoomModel:a}},function(e,t,n){var r=n(1),i=n(19),o=n(13),s=n(0),a=i.Mark.extend({render:function(){var e=a.__super__.render.apply(this);this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["slice","text"];var t=this;this.pie_g=this.d3el.append("g").attr("class","pie"),this.pie_g.append("g").attr("class","slices"),this.pie_g.append("g").attr("class","labels"),this.pie_g.append("g").attr("class","lines");var n=this.model.get("radius"),i=this.model.get("inner_radius");return"outside"===this.model.get("display_labels")?(this.arc=r.svg.arc().outerRadius(.8*n).innerRadius(.8*i),this.outer_arc=r.svg.arc().innerRadius(.9*n).outerRadius(.9*n)):this.arc=r.svg.arc().outerRadius(n).innerRadius(i),this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.join_key=function(e){return e.data.label},e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}),null)},set_ranges:function(){var e=this.scales.x;e&&(e.set_range(this.parent.padded_range("x",e.model)),this.x_offset=e.offset);var t=this.scales.y;t&&(t.set_range(this.parent.padded_range("y",t.model)),this.y_offset=t.offset)},set_positional_scales:function(){var e=this.scales.x?this.scales.x:this.parent.scale_x,t=this.scales.y?this.scales.y:this.parent.scale_y,n=this;this.listenTo(e,"domain_changed",(function(){n.model.dirty||n.draw()})),this.listenTo(t,"domain_changed",(function(){n.model.dirty||n.draw()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.d3el.on("mouseover",s.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",s.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",s.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"colors_updated",this.update_colors,this),this.model.on_some_change(["inner_radius","radius"],(function(){this.compute_view_padding();this.update_radii(!0)}),this),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.model.on_some_change(["x","y"],this.position_center,this),this.model.on_some_change(["display_labels","label_color","font_size","font_weight"],this.update_labels,this),this.model.on_some_change(["start_angle","end_angle","sort"],(function(){this.draw(!0)}),this),this.model.on_some_change(["display_values","values_format"],this.update_values,this),this.listenTo(this.model,"labels_updated",this.update_values,this),this.listenTo(this.model,"change:selected",(function(){this.selected_indices=this.model.get("selected"),this.apply_styles()}),this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");s.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){},void 0!==e.legend_hover&&null!==e.legend_hover?"highlight_axes"===e.legend_hover&&(this.event_listeners.legend_mouse_over=s.bind(this.highlight_axes,this),this.event_listeners.legend_mouse_out=s.bind(this.unhighlight_axes,this)):this.reset_legend_hover())},relayout:function(){this.set_ranges(),this.position_center(),this.update_radii()},position_center:function(e){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this.scales.x?this.scales.x:this.parent.scale_x,r=this.scales.y?this.scales.y:this.parent.scale_y,i="date"===n.model.type?this.model.get_date_elem("x"):this.model.get("x"),o="date"===r.model.type?this.model.get_date_elem("y"):this.model.get("y"),s="translate("+(n.scale(i)+n.offset)+", "+(r.scale(o)+r.offset)+")";this.pie_g.transition("position_center").duration(t).attr("transform",s)},update_radii:function(e){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this.model.get("radius"),r=this.model.get("inner_radius"),i=this.model.get("display_labels");"inside"===i?this.arc.outerRadius(n).innerRadius(r):"outside"===i&&(this.arc.outerRadius(.8*n).innerRadius(.8*r),this.outer_arc.innerRadius(.9*n).outerRadius(.9*n));var o=this.pie_g.select(".slices"),s=this.pie_g.select(".labels"),a=this.pie_g.select(".lines"),l=this;o.selectAll("path.slice").transition("update_radii").duration(t).attr("d",this.arc),"inside"===i?s.selectAll("text").transition("update_radii").duration(t).attr("transform",(function(e){return"translate("+l.arc.centroid(e)+")"})):"outside"===i&&(s.selectAll("text").transition("update_radii").duration(t).attr("transform",(function(e){var t=l.outer_arc.centroid(e);return t[0]=n*(l.is_mid_angle_left(e)?-1:1),"translate("+t+")"})),a.selectAll("polyline").transition("update_radii").duration(t).attr("points",(function(e){var t=l.outer_arc.centroid(e);return t[0]=.95*n*(l.is_mid_angle_left(e)?-1:1),[l.arc.centroid(e),l.outer_arc.centroid(e),t]})))},outer_join:function(e,t){var n=r.set(e.concat(t).map((function(e){return e.label}))).values().sort(),i={};e.forEach((function(e){i[e.label]=e}));var s={};t.forEach((function(e){s[e.label]=e}));var a=[],l=[];return n.forEach((function(e){var t;e in i?a.push(i[e]):((t=o.deepCopy(s[e])).size=0,a.push(t));e in s?l.push(s[e]):((t=o.deepCopy(i[e])).size=0,l.push(t))})),{first:a,second:l}},is_mid_angle_left:function(e){var t=(e.startAngle+e.endAngle)/2;return t>Math.PI||t<0&&t>-Math.PI},draw:function(e){this.set_ranges(),this.position_center(e);var t=this.model.mark_data,n=this.pie_g.select(".slices").selectAll("path.slice").data().map((function(e){return e.data}));0===n.length&&(n=t);var i=this.outer_join(n,t),o=i.first,s=i.second,a=r.layout.pie().startAngle(2*this.model.get("start_angle")*Math.PI/360).endAngle(2*this.model.get("end_angle")*Math.PI/360).value((function(e){return e.size}));this.model.get("sort")||a.sort(null);var l=this,c=!0===e?this.parent.model.get("animation_duration"):0,u=this.pie_g.select(".slices").selectAll("path.slice").data(a(o),this.join_key);u.enter().insert("path").attr("class","slice").style("fill",(function(e,t){return l.get_colors(t)})).each((function(e){this._current=e})),(u=this.pie_g.select(".slices").selectAll("path.slice").data(a(s),this.join_key)).transition("draw").duration(c).attrTween("d",(function(e){var t=r.interpolate(this._current,e),n=this;return function(e){return n._current=t(e),l.arc(n._current)}})),(u=this.pie_g.select(".slices").selectAll("path.slice").data(a(t),this.join_key)).exit().transition("draw").delay(c).duration(0).remove();var h=this.pie_g.select(".labels").selectAll("text").data(a(o),this.join_key);h.enter().append("text").attr("dy",".35em").style("opacity",0).text((function(e){return e.data.label})).each((function(e){this._current=e}));var d=(h=this.pie_g.select(".labels").selectAll("text").data(a(s),this.join_key)).transition("draw").duration(c).style("opacity",(function(e){return 0===e.data.value?0:1})),p=this.model.get("display_labels");if("inside"===p?d.attr("transform",(function(e){return"translate("+l.arc.centroid(e)+")"})).style("text-anchor","middle"):"outside"===p&&d.attrTween("transform",(function(e){var t=r.interpolate(this._current,e),n=this;return function(e){var r=t(e);n._current=r;var i=l.outer_arc.centroid(r);return i[0]=l.model.get("radius")*(l.is_mid_angle_left(r)?-1:1),"translate("+i+")"}})).styleTween("text-anchor",(function(e){var t=r.interpolate(this._current,e);return function(e){var n=t(e);return l.is_mid_angle_left(n)?"end":"start"}})),(h=this.pie_g.select(".labels").selectAll("text").data(a(t),this.join_key)).exit().transition("draw").delay(c).remove(),"outside"===p){var f=this.pie_g.select(".lines").selectAll("polyline").data(a(o),this.join_key);f.enter().append("polyline").style("opacity",0).each((function(e){this._current=e})),(f=this.pie_g.select(".lines").selectAll("polyline").data(a(s),this.join_key)).transition("draw").duration(c).style("opacity",(function(e){return 0===e.data.value?0:.5})).attrTween("points",(function(e){this._current=this._current;var t=r.interpolate(this._current,e),n=this;return function(e){var r=t(e);n._current=r;var i=l.outer_arc.centroid(r);return i[0]=.95*l.model.get("radius")*(l.is_mid_angle_left(r)?-1:1),[l.arc.centroid(r),l.outer_arc.centroid(r),i]}})),(f=this.pie_g.select(".lines").selectAll("polyline").data(a(t),this.join_key)).exit().transition("draw").delay(c).remove()}u.order(),u.on("click",(function(e,t){return l.event_dispatcher("element_clicked",{data:e,index:t})})),this.update_labels(),this.update_values(),this.apply_styles()},update_stroke_and_opacities:function(){var e=this.model.get("stroke"),t=this.model.get("opacities");this.pie_g.selectAll("path.slice").style("stroke",e).style("opacity",(function(e,n){return t[n]}))},update_colors:function(){var e=this,t=this.scales.color;this.pie_g.select(".slices").selectAll("path.slice").style("fill",(function(n,r){return void 0!==n.data.color&&void 0!==t?t.scale(n.data.color):e.get_colors(n.data.index)}))},update_labels:function(){var e=this.model.get("display_labels"),t=this.pie_g.selectAll(".labels text").style("visibility","none"===e?"hidden":"visible").style("font-weight",this.model.get("font_weight")).style("font-size",this.model.get("font_size")),n=this.model.get("label_color");void 0!==n&&t.style("fill",n)},update_values:function(){var e=this.model.get("display_values"),t=r.format(this.model.get("values_format"));this.pie_g.selectAll(".labels text").text((function(n){return n.data.label+(e?": "+t(n.data.size):"")}))},clear_style:function(e,t){var n=this.pie_g.selectAll("path.slice");t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},set_style_on_elements:function(e,t){if(null!=t&&0!==t.length){var n=this.pie_g.selectAll(".slice");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).style(e)}},set_default_style:function(e){this.update_colors(),this.update_stroke_and_opacities()},click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),i=n?o.deepCopy(n):[],a=i.indexOf(t),l=r.event.ctrlKey||r.event.metaKey;if(a>-1&&l)i.splice(a,1);else{if(r.event.shiftKey){if(a>-1)return;var c=0!==i.length?r.min(i):-1,u=0!==i.length?r.max(i):this.model.mark_data.length;t>u?s.range(u+1,t).forEach((function(e){i.push(e)})):t<c&&s.range(t+1,c).forEach((function(e){i.push(e)}))}else l||(i=[]);i.push(t)}this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var h=r.event;void 0!==h.cancelBubble&&(h.cancelBubble=!0),h.stopPropagation&&h.stopPropagation(),h.preventDefault(),this.selected_indices=i,this.apply_styles()},reset_selection:function(){this.model.set("selected",null),this.touch(),this.selected_indices=null,this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.set_default_style()},compute_view_padding:function(){var e=this.model.get("scales"),t=r.max([this.model.get("radius"),this.model.get("inner_radius")]),n=e.x?t+1:0,i=e.y?t+1:0;n===this.x_padding&&i===this.y_padding||(this.x_padding=n,this.y_padding=i,this.trigger("mark_padding_updated"))}});e.exports={Pie:a}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"PieModel",_view_name:"Pie",sizes:[],color:null,x:.5,y:.5,scales_metadata:{color:{dimension:"color"}},sort:!1,colors:r.scale.category10().range(),stroke:null,opacities:[],radius:180,inner_radius:.1,start_angle:0,end_angle:360})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on("change:sizes",this.update_data,this),this.on("change:color",(function(){this.update_color(),this.trigger("colors_updated")}),this),this.on("change:labels",this.update_labels,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_color(),this.update_labels(),this.update_domains()},update_data:function(){var e=this.get_typed_field("sizes"),t=this.get_typed_field("color"),n=this.get("labels");this.mark_data=e.map((function(e,r){return{size:e,color:t[r],label:null==n[r]?"S"+(r+1):n[r],index:r}})),this.update_color(),this.update_domains(),this.trigger("data_updated")},update_labels:function(){if(this.mark_data){var e=this.get("labels");this.mark_data.forEach((function(t,n){t.label=null==e[n]?"S"+(n+1):e[n]})),this.trigger("labels_updated")}},update_color:function(){if(this.mark_data){var e=this.get_typed_field("color"),t=this.get("scales").color;t&&(this.get("preserve_domain").color?t.del_domain([],this.model_id+"_color"):t.compute_and_set_domain(e,this.model_id+"_color"))}},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y;if(t){var r="date"===t.type?this.get_date_elem("x"):this.get("x");this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain([r],this.model_id+"_x")}n&&(this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain([this.get("y")],this.model_id+"_y"))}},get_data_dict:function(e,t){return e.data}});e.exports={PieModel:s}},function(e,t,n){var r=n(1),i=n(198).ColorScale.extend({create_d3_scale:function(){this.scale=r.time.scale()}});e.exports={DateColorScale:i}},function(e,t,n){n(1);var r=n(0),i=n(199),o=i.ColorScaleModel.extend({defaults:function(){return r.extend(i.ColorScaleModel.prototype.defaults(),{_model_name:"DateColorScaleModel",_view_name:"DateColorScale"})},set_init_state:function(){this.type="date_color_linear",this.color_range=[],this.mid=null,this.global_min=(new Date).setTime(0),this.global_max=new Date},min_max_changed:function(){this.min=this.get_date_elem("min"),this.max=this.get_date_elem("max"),this.min_from_data=null===this.min,this.max_from_data=null===this.max,this.update_domain()}});e.exports={DateColorScaleModel:o}},function(e,t,n){var r=n(1),i=(n(0),n(104).LinearScale.extend({render:function(){this.scale=r.time.scale(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}}));e.exports={DateScale:i}},function(e,t,n){var r=n(195),i=n(105),o=n(1),s=i.symbol,a=r.ScatterBase.extend({render:function(){return this.dot=s().type(this.model.get("marker")).size(this.model.get("default_size")).skew(this.model.get("default_skew")),a.__super__.render.apply(this)},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width,this),this.listenTo(this.model,"change:default_opacities",this.update_default_opacities,this),this.listenTo(this.model,"change:default_skew",this.update_default_skew,this),this.listenTo(this.model,"change:default_rotation",this.update_xy_position,this),this.listenTo(this.model,"change:marker",this.update_marker,this),this.listenTo(this.model,"change:default_size",this.update_default_size,this),this.listenTo(this.model,"change:fill",this.update_fill,this),this.listenTo(this.model,"change:display_names",this.update_names,this)},update_colors:function(e,t){if(!this.model.dirty){var n=this,r=this.model.get("stroke"),i=t.length;this.d3el.selectAll(".dot").style("fill",this.model.get("fill")?function(e,t){return n.get_element_color(e,t)}:"none").style("stroke",r||function(e,t){return n.get_element_color(e,t)}),this.legend_el&&(this.legend_el.select("path").style("fill",(function(e,n){return t[n%i]})).style("stroke",r||function(e,n){return t[n%i]}),this.legend_el.select("text").style("fill",this.model.get("fill")?function(e,n){return t[n%i]}:"none"))}},update_fill:function(e,t){var n=this,r=this.model.get("colors"),i=r.length;this.d3el.selectAll(".dot").style("fill",t?function(e,t){return n.get_element_color(e,t)}:"none"),this.legend_el&&this.legend_el.selectAll("path").style("fill",t?function(e,t){return r[t%i]}:"none")},update_stroke_width:function(){var e=this.model.get("stroke_width");this.d3el.selectAll(".dot").style("stroke-width",e),this.legend_el&&this.legend_el.selectAll("path").style("stroke-width",e)},update_stroke:function(e,t){var n=this,r=this.model.get("stroke");this.d3el.selectAll(".dot").style("stroke",r||function(e,t){return n.get_element_color(e,t)}),this.legend_el&&this.legend_el.selectAll("path").style("stroke",r)},update_default_opacities:function(e){if(!this.model.dirty){var t=this.model.get("default_opacities"),n=this.model.get("colors"),r=n.length,i=t.length,o=!0===e?this.parent.model.get("animation_duration"):0,s=this;this.d3el.selectAll(".dot").transition("update_default_opacities").duration(o).style("opacity",(function(e,t){return s.get_element_opacity(e,t)})),this.legend_el&&this.legend_el.select("path").style("opacity",(function(e,n){return t[n%i]})).style("fill",(function(e,t){return n[t%r]}))}},update_marker:function(e,t){this.model.dirty||(this.d3el.selectAll(".dot").transition("update_marker").duration(this.parent.model.get("animation_duration")).attr("d",this.dot.type(t)),this.legend_el.select("path").attr("d",this.dot.type(t)))},update_default_skew:function(e){if(!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_skew").duration(t).attr("d",this.dot.skew((function(e){return n.get_element_skew(e)})))}},update_default_size:function(e){if(this.compute_view_padding(),!this.model.dirty){var t=!0===e?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_size").duration(t).attr("d",this.dot.size((function(e){return n.get_element_size(e)}))),this.update_names(e)}},update_names:function(e){var t=this,n=this.model.get_typed_field("names"),r=this.model.get("display_names")&&0!==n.length,i=e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").text((function(e){return e.name})).transition("update_names").duration(i).attr("transform",(function(e){var n=Math.sqrt(t.get_element_size(e))/2;return"translate("+n+","+-n+")"})).attr("display",(function(e){return r?"inline":"none"}))},color_scale_updated:function(e){var t=this,n=this.model.get("fill"),r=this.model.get("stroke"),i=!0===e?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("path").transition("color_scale_updated").duration(i).style("fill",n?function(e,n){return t.get_element_color(e,n)}:"none").style("stroke",r||function(e,n){return t.get_element_color(e,n)})},draw_elements:function(e,t){var n=this,r=!0===e?this.parent.model.get("animation_duration"):0,i=this.d3el.selectAll(".object_grp");t.append("path").attr("class","dot element"),t.append("text").attr("class","dot_text"),i.select("path").transition("draw_elements").duration(r).attr("d",this.dot.size((function(e){return n.get_element_size(e)})).skew((function(e){return n.get_element_skew(e)}))),this.update_names(e),this.apply_styles()},draw_legend_elements:function(e,t){var n=this.model.get("colors"),r=n.length,i=this.model.get("stroke");e.append("path").attr("transform",(function(e,n){return"translate( "+t/2+", "+t/2+")"})).attr("d",this.dot.size(64)).style("fill",this.model.get("fill")?function(e,t){return n[t%r]}:"none").style("stroke",i||function(e,t){return n[t%r]})},set_default_style:function(e){if(e&&0!==e.length){var t=this.d3el.selectAll(".element").filter((function(t,n){return-1!==e.indexOf(n)})),n=this.model.get("fill"),r=this.model.get("stroke"),i=this.model.get("stroke_width"),o=this;t.style("fill",n?function(e,t){return o.get_element_color(e,t)}:"none").style("stroke",r||function(e,t){return o.get_element_color(e,t)}).style("opacity",(function(e,t){return o.get_element_opacity(e,t)})).style("stroke-width",i)}},set_drag_style:function(e,t,n){o.select(n).select("path").classed("drag_scatter",!0).transition("set_drag_style").attr("d",this.dot.size(5*this.model.get("default_size")));var r=this.model.get("drag_color");r&&o.select(n).select("path").style("fill",r).style("stroke",r)},reset_drag_style:function(e,t,n){var r=this.model.get("stroke"),i=this.get_element_color(e,t);o.select(n).select("path").classed("drag_scatter",!1).transition("reset_drag_style").attr("d",this.dot.size(this.get_element_size(e))),this.model.get("drag_color")&&o.select(n).select("path").style("fill",i).style("stroke",r||i)}});e.exports={Scatter:a}},function(e,t,n){n(1);var r=n(0),i=n(71),o=i.LinearScaleModel.extend({defaults:function(){return r.extend(i.LinearScaleModel.prototype.defaults(),{_model_name:"DateScaleModel",_view_name:"DateScale"})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="date",this.global_min=(new Date).setTime(0),this.global_max=new Date},min_max_changed:function(){this.min=this.get_date_elem("min"),this.max=this.get_date_elem("max"),this.min_from_data=null===this.min,this.max_from_data=null===this.max,this.update_domain()}});e.exports={DateScaleModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"LinesModel",_view_name:"Lines",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:r.scale.category10().range(),fill_colors:r.scale.category10().range(),stroke_width:2,labels_visibility:"none",curves_subset:[],line_style:"solid",interpolation:"linear",close_path:!1,fill:"none",marker:null,marker_size:64,opacities:[],fill_opacities:[]})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color"],this.update_data,this),this.on("change:labels",this.update_labels,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this;this.x_data=this.get_typed_field("x"),this.y_data=this.get_typed_field("y"),this.color_data=this.get_typed_field("color");var t=this.get("scales"),n=(t.x,t.y,this.get("labels"));if(0===this.x_data.length||0===this.y_data.length)this.mark_data=[];else{this.x_data=this.x_data[0]instanceof Array?this.x_data:[this.x_data],this.y_data=this.y_data[0]instanceof Array?this.y_data:[this.y_data],n=this.get_labels();var i=this.y_data.length;1==this.x_data.length&&i>1?this.mark_data=n.map((function(t,n){return{name:t,values:e.y_data[n].map((function(t,r){return{x:e.x_data[0][r],y:t,y0:e.y_data[Math.min(n+1,i-1)][r],sub_index:r}})),color:e.color_data[n],index:n}})):this.mark_data=n.map((function(t,n){return{name:t,values:r.zip(e.x_data[n],e.y_data[n]).map((function(t,r){return{x:t[0],y:t[1],y0:e.y_data[Math.min(n+1,i-1)][r],sub_index:r}})),color:e.color_data[n],index:n}}))}this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_labels:function(){var e=this.get_labels();this.mark_data.forEach((function(t,n){t.name=e[n]})),this.trigger("labels_updated")},get_labels:function(){var e=this.get("labels"),t=1==this.x_data.length?this.y_data.length:Math.min(this.x_data.length,this.y_data.length);return e.length>t?e=e.slice(0,t):e.length<t&&i.range(e.length,t).forEach((function(t){e[t]="C"+(t+1)})),e},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color;this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.x}))})),this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.y}))})),this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.color})),this.model_id+"_color"))}},get_data_dict:function(e,t){return e}}),a=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"FlexLineModel",_view_name:"FlexLine",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:r.scale.category10().range(),fill_colors:r.scale.category10().range(),stroke_width:2,labels_visibility:"none",curves_subset:[],line_style:"solid",interpolation:"linear",close_path:!1,fill:"none",marker:null,marker_size:64,opacities:[],fill_opacities:[]})},update_data:function(){this.dirty=!0;var e=this;this.x_data=this.get_typed_field("x"),this.y_data=this.get_typed_field("y");var t=this.get("scales"),n=(t.x,t.y,this.get("labels"));if(0===this.x_data.length||0===this.y_data.length)this.mark_data=[],this.data_len=0;else{this.x_data=this.x_data[0]instanceof Array?this.x_data:[this.x_data],this.y_data=this.y_data[0]instanceof Array?this.y_data:[this.y_data],n=this.get_labels();var r=this.get_typed_field("color"),o=this.get_typed_field("width");this.data_len=Math.min(this.x_data[0].length,this.y_data[0].length),this.mark_data=[{name:n[0],values:i.range(this.data_len-1).map((function(t,n){return{x1:e.x_data[0][n],y1:e.y_data[0][n],x2:e.x_data[0][n+1],y2:e.y_data[0][n+1],color:r[n],size:o[n]}}))}]}this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color,i=e.width;this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.x_data[0].slice(0,this.data_len),this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.y_data[0].slice(0,this.data_len),this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.color}))})),this.model_id+"_color")),null!=i&&(this.get("preserve_domain").width?i.del_domain([],this.model_id+"_width"):i.compute_and_set_domain(this.mark_data.map((function(e){return e.values.map((function(e){return e.size}))})),this.model_id+"_width"))}}});e.exports={LinesModel:s,FlexLineModel:a}},function(e,t,n){n(1);var r=n(0),i=n(196),o=i.ScatterBaseModel.extend({defaults:function(){return r.extend(i.ScatterBaseModel.prototype.defaults(),{_model_name:"ScatterModel",_view_name:"Scatter",skew:null,marker:"circle",stroke:null,stroke_width:1.5,default_skew:.5,default_size:64,names:[],display_names:!0,fill:!0,drag_color:null,drag_size:5,names_unique:!0})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on("change:skew",this.update_data,this),this.on_some_change(["names","names_unique"],(function(){this.update_unique_ids(),this.trigger("data_updated")}),this)},update_mark_data:function(){o.__super__.update_mark_data.apply(this);var e=this.get_typed_field("skew");this.mark_data.forEach((function(t,n){t.skew=e[n]}))},update_unique_ids:function(){var e=this.get_typed_field("names"),t=0!==e.length;e=t?e:this.mark_data.map((function(e,t){return"Dot"+t}));var n=[];n=this.get("names_unique")?e.slice(0):r.range(this.mark_data.length),this.mark_data.forEach((function(t,r){t.name=e[r],t.unique_id=n[r]}))}});e.exports={ScatterModel:o}},function(e,t,n){var r=n(0),i=n(1),o=n(52),s=(n(19),n(103)),a=o.BaseXSelector.extend({render:function(){a.__super__.render.apply(this),this.freeze_but_move=!0,this.freeze_dont_move=!1,this.active=!1,this.dirty=!1,this.size=this.model.get("size"),this.width=this.parent.width-this.parent.margin.left-this.parent.margin.right,this.height=this.parent.height-this.parent.margin.top-this.parent.margin.bottom;var e=this,t=this.create_scales();Promise.all([this.mark_views_promise,t]).then((function(){e.background=e.d3el.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("class","selector selectormouse").attr("pointer-events","all").attr("visibility","hidden"),e.background.on("mousemove",r.bind(e.mousemove,e)).on("click",r.bind(e.click,e)).on("dblclick",r.bind(e.dblclick,e)),e.rect=e.d3el.append("rect").attr("class","selector intsel").attr("x",0).attr("y",0).attr("width",e.size).attr("height",e.height).attr("pointer-events","none").attr("display","none"),e.color_change(),e.selected_changed(),e.create_listeners()}))},create_listeners:function(){a.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:color",this.color_change,this)},color_change:function(){null!==this.model.get("color")&&this.rect.style("fill",this.model.get("color"))},click:function(){this.active=!0,this.rect.style("display","inline"),this.freeze_but_move=!!this.model.get("size")||!this.freeze_but_move},dblclick:function(){this.freeze_dont_move=!this.freeze_dont_move},mousemove:function(){if(!this.freeze_dont_move&&this.active){this.dirty=!0;var e,t=i.mouse(this.background.node()),n=this.size>0?this.size:parseInt(this.rect.attr("width")),r=(this.height-t[1])/this.height,o=this.freeze_but_move?n:Math.round(r*this.width);e=t[0]-o/2<0?0:t[0]+o/2>this.width?this.width-o:t[0]-o/2,this.rect.attr("x",e),this.rect.attr("width",o);var s=[e,e+o];this.model.set_typed_field("selected",this.scale.invert_range(s)),this.update_mark_selected(s),this.touch(),this.dirty=!1}},update_mark_selected:function(e,t){if(void 0!==e&&0!==e.length||r.each(this.mark_views,(function(e){return e.selector_changed()})),void 0===t)var n=this.model.get("orientation"),i="vertical"==n?[]:e,o="vertical"==n?e:[];else i=e,o=t;var a=function(e){return s.point_in_rectangle(e,i,o)},l=function(e){return s.rect_inter_rect(e[0],e[1],i,o)};r.each(this.mark_views,(function(e){e.selector_changed(a,l)}),this)},scale_changed:function(){this.reset(),this.create_scale()},relayout:function(){a.__super__.relayout.apply(this),this.adjust_rectangle(),this.background.attr("width",this.width).attr("height",this.height),this.set_range([this.scale])},reset:function(){this.rect.attr("x",0).attr("width",0),this.model.set_typed_field("selected",{}),this.update_mark_selected(),this.touch()},update_scale_domain:function(e){a.__super__.update_scale_domain.apply(this),!0!==e&&this.selected_changed()},selected_changed:function(e,t){if(!this.dirty){var n=this.model.get_typed_field("selected");if(0===n.length)this.reset();else{if(2!=n.length)return;var r=n.map(this.scale.scale);r=r.sort((function(e,t){return e-t})),this.rect.attr({x:r[0],width:r[1]-r[0]}).style("display","inline"),this.active=!0,this.update_mark_selected(r)}}},adjust_rectangle:function(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)}});e.exports={FastIntervalSelector:a}},function(e,t,n){var r=n(1),i=n(104).LinearScale.extend({render:function(){this.scale=r.scale.log(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}});e.exports={LogScale:i}},function(e,t,n){n(1);var r=n(0),i=n(71),o=i.LinearScaleModel.extend({defaults:function(){return r.extend(i.LinearScaleModel.prototype.defaults(),{_model_name:"LogScaleModel",_view_name:"LogScale",domain:[]})},initialize:function(){o.__super__.initialize.apply(this,arguments)},set_init_state:function(){this.type="log",this.global_min=Number.MIN_VALUE,this.global_max=Number.POSITIVE_INFINITY}});e.exports={LogScaleModel:o}},function(e,t,n){var r=n(9),i=(n(0),n(1)),o=r.DOMWidgetView.extend({render:function(){this.width=this.model.get("width"),this.height=this.model.get("height"),this.margin=this.model.get("margin"),this.el.style.width=this.width+this.margin.left+this.margin.right,this.el.style.height=this.height+this.margin.top+this.margin.bottom;var e=this.model.get("data");this.colors=this.model.get("colors"),this.mode=this.model.get("mode");var t=i.scale.category10();this.d3el.append("div").style("position","relative").style("width",this.width+this.margin.left+this.margin.right+"px").style("height",this.height+this.margin.top+this.margin.bottom+"px").style("left",this.margin.left+"px").style("top",this.margin.top+"px"),this.margin=this.model.get("margin"),this.tree_map=i.layout.treemap().size([this.width,this.height]).sticky(!0).padding(null).mode(this.mode).value((function(e){return e.size}));this.d3el.datum(e).selectAll(".node").data(this.tree_map.nodes).enter().append("div").attr("class","node").call(this.position).style({background:function(e,n){return e.children?t(e.name):null},border:"solid white"}).text((function(e){return e.children?null:e.name})).style({font:"11px sans-serif",position:"absolute","text-align":"center",overflow:"hidden",color:"white"})},position:function(){this.style("left",(function(e){return e.x+"px"})).style("top",(function(e){return e.y+"px"})).style("width",(function(e){return Math.max(0,e.dx-1)+"px"})).style("height",(function(e){return Math.max(0,e.dy-1)+"px"}))}});e.exports={SquareMarketMap:o}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(28),s="^"+n(21).version,a=o.BaseModel.extend({defaults:function(){return i.extend(o.BaseModel.prototype.defaults(),{_model_name:"FigureModel",_view_name:"Figure",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s,_view_module_version:s,title:"",axes:[],marks:[],interaction:null,scale_x:void 0,scale_y:void 0,fig_color:null,title_style:{},background_style:{},legend_style:{},legend_text:{},preserve_aspect:!1,min_aspect_ratio:0,max_aspect_ratio:100,fig_margin:{top:60,bottom:60,left:60,right:60},padding_x:0,padding_y:.025,legend_location:"top-right",animation_duration:0})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on("msg:custom",this.handle_custom_messages,this)},handle_custom_messages:function(e){"save_png"===e.type?this.trigger("save_png",e.filename):"save_svg"===e.type&&this.trigger("save_svg",e.filename)},save_png:function(){this.trigger("save_png")}},{serializers:i.extend({marks:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},interaction:{deserialize:r.unpack_models},scale_x:{deserialize:r.unpack_models},scale_y:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models}},o.BaseModel.serializers)});e.exports={FigureModel:a}},function(e,t,n){var r=n(9),i=n(1),o=n(0),s=n(19),a=n(13),l=s.Mark.extend({render:function(){var e=l.__super__.render.apply(this);this.map=this.d3el.append("svg").attr("viewBox","0 0 1200 980"),this.width=this.parent.plotarea_width,this.height=this.parent.plotarea_height,this.map_id=r.uuid(),this.enable_hover=this.model.get("enable_hover"),this.display_el_classes=["event_layer"];var t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.draw()}))},set_ranges:function(){},set_positional_scales:function(){var e=this.scales.projection;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.update_style()})),e.on("color_scale_range_changed",this.update_style,this))},remove_map:function(){i.selectAll(".world_map.map"+this.map_id).remove()},draw:function(){this.set_ranges();var e=this;this.remove_map(),this.transformed_g=this.map.append("g").attr("class","world_map map"+this.map_id),this.fill_g=this.transformed_g.append("g"),this.highlight_g=this.transformed_g.append("g"),this.stroke_g=this.transformed_g.append("g");var t=this.scales.projection;this.fill_g.selectAll("path").data(e.model.geodata).enter().append("path").attr("d",t.path).style("fill",(function(t,n){return e.fill_g_colorfill(t,n)})),this.stroke_g.selectAll("path").data(e.model.geodata).enter().append("path").attr("class","event_layer").attr("d",t.path).style("fill-opacity",0).on("click",(function(t,n){return e.event_dispatcher("element_clicked",{data:t,index:n})})),this.validate_color(this.model.get("stroke_color"))&&this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color")),this.zoom=i.behavior.zoom().scaleExtent([1,8]).on("zoom",(function(){e.zoomed(e,!1)})),this.parent.bg.call(this.zoom),this.parent.bg.on("dblclick.zoom",null),this.parent.bg.on("dblclick",(function(){e.zoomed(e,!0)}))},validate_color:function(e){return""!==e},mouseover_handler:function(){if(this.model.get("hover_highlight")){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=e.data()[0],n=this.model.get("selected"),r=n?a.deepCopy(n):[],o=this.highlight_g.append((function(){return e.node().cloneNode(!0)}));o.classed("hovered",!0),o.classed("event_layer",!1),this.validate_color(this.model.get("hovered_styles").hovered_stroke)&&-1===r.indexOf(t.id)&&o.style("stroke",this.model.get("hovered_styles").hovered_stroke).style("stroke-width",this.model.get("hovered_styles").hovered_stroke_width);var s=this;this.validate_color(this.model.get("hovered_styles").hovered_fill)&&-1===r.indexOf(t.id)&&o.style("fill-opacity",1).style("fill",(function(){return s.model.get("hovered_styles").hovered_fill}))}}},mouseout_handler:function(){if(this.model.get("hover_highlight")){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=this;e.transition("mouseout_handler").style("fill",(function(e,n){return t.fill_g_colorfill(e,n)})).style("stroke",(function(e,n){return t.hoverfill(e,n)})),t.highlight_g.selectAll(".hovered").remove()}}},click_handler:function(){var e=i.select(i.event.target);if(this.is_hover_element(e)){var t=e.data()[0],n=this.model.get("selected"),r=n?a.deepCopy(n):[],o=r.indexOf(t.id);if(o>-1){r.splice(o,1),e.transition("click_handler").style("fill-opacity",0),this.highlight_g.selectAll(".hovered").remove();var s="#c".concat(t.id.toString());i.select(s).remove()}else this.highlight_g.selectAll(".hovered").remove(),this.highlight_g.append((function(){return e.node().cloneNode(!0)})).attr("id","c"+t.id).classed("selected",!0).classed("event_layer",!1),this.validate_color(this.model.get("selected_styles").selected_fill)&&this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill),this.validate_color(this.model.get("selected_styles").selected_stroke)&&this.highlight_g.selectAll(".selected").style("stroke",this.model.get("selected_styles").selected_stroke).style("stroke-width",this.model.get("selected_styles").selected_stroke_width),r.push(t.id),this.model.set("selected",r),this.touch();this.model.set("selected",0===r.length?null:r,{updated_view:this}),this.touch()}},zoomed:function(e,t){var n=t?[0,0]:i.event.translate,r=t?1:i.event.scale,o=e.height/3,s=t?e.width:2*e.width;n[0]=Math.min(e.width/2*(r-1),Math.max(s/2*(1-r),n[0])),n[1]=Math.min(e.height/2*(r-1)+this.height*r,Math.max(o/2*(1-r)-e.width*r,n[1])),e.zoom.translate(n),t&&e.zoom.scale(r),e.transformed_g.style("stroke-width",1/r).attr("transform","translate("+n+")scale("+r+")")},create_listeners:function(){var e=this;this.d3el.on("mouseover",o.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",o.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",o.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:color",this.update_style,this),this.listenTo(this.model,"change:stroke_color",this.change_stroke_color,this),this.listenTo(this.model,"change:colors",this.change_map_color,this),this.listenTo(this.model,"change:selected",this.change_selected,this),this.listenTo(this.model,"change:selected_styles",(function(){e.change_selected_fill(),e.change_selected_stroke()})),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},process_interactions:function(){var e=this.model.get("interactions");o.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"===e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=function(){return this.mouseover_handler(),this.refresh_tooltip()},this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=function(){return this.mouseout_handler(),this.hide_tooltip()}):this.reset_hover(),void 0!==e.legend_click&&null!==e.legend_click?"tooltip"===e.legend_click&&(this.event_listeners.legend_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):this.event_listeners.legend_clicked=function(){})},change_selected_fill:function(){this.validate_color(this.model.get("selected_styles").selected_fill)?this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill):this.highlight_g.selectAll(".selected").style("fill-opacity",0)},change_selected_stroke:function(){this.validate_color(this.model.get("selected_styles").selected_stroke)?this.highlight_g.selectAll(".selected").style("stroke-width",this.model.get("selected_styles").selected_stroke_width).style("stroke",this.model.get("selected_styles").selected_stroke):this.highlight_g.selectAll(".selected").style("stroke-width",0)},change_selected:function(){this.highlight_g.selectAll("path").remove();var e=this,t=this.model.get("selected"),n=t||[],r=this.stroke_g.selectAll("path").data();this.stroke_g.selectAll("path").style("stroke",(function(t,n){return e.hoverfill(t,n)}));for(var i=this.stroke_g.selectAll("path"),o=0;o<r.length;o++)n.indexOf(r[o].id)>-1&&e.highlight_g.append((function(){return i[0][o].cloneNode(!0)})).attr("id",r[o].id).style("fill-opacity",(function(){return e.validate_color(e.model.get("selected_styles").selected_fill)?1:0})).style("fill",e.model.get("selected_styles").selected_fill).style("stroke-opacity",(function(){return e.validate_color(e.model.get("selected_styles").selected_stroke)?1:0})).style("stroke",e.model.get("selected_styles").selected_stroke).style("stroke-width",e.model.get("selected_styles").selected_stroke_width).classed("selected",!0)},reset_selection:function(){this.model.set("selected",[]),this.touch(),this.highlight_g.selectAll(".selected").remove(),i.select(this.d3el.parentNode).selectAll("path").classed("selected",!1),i.select(this.d3el.parentNode).selectAll("path").classed("hovered",!1);var e=this;this.stroke_g.selectAll("path").style("stroke",(function(t,n){return e.hoverfill(t,n)})),this.fill_g.selectAll("path").classed("selected",!1).style("fill",(function(t,n){return e.fill_g_colorfill(t,n)}))},change_stroke_color:function(){this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color"))},change_map_color:function(){var e=this;this.is_object_empty(this.model.get("color"))&&this.fill_g.selectAll("path").style("fill",(function(t,n){return e.fill_g_colorfill(t,n)}))},update_style:function(){var e=this.model.get("color"),t=this;this.is_object_empty(e)||this.fill_g.selectAll("path").style("fill",(function(e,n){return t.fill_g_colorfill(e,n)}))},is_object_empty:function(e){var t=!0;for(var n in e){t=!1;break}return t},hoverfill:function(e,t){var n=this.model.get("selected");return(n||[]).indexOf(e.id)>-1&&this.validate_color(this.model.get("selected_styles").selected_stroke)?this.model.get("selected_styles").selected_stroke:this.model.get("stroke_color")},fill_g_colorfill:function(e,t){var n=this.scales.color,r=this.model.get("selected"),i=r||[],o=this.model.get("color"),s=this.model.get("colors");return i.indexOf(e.id)>-1?this.model.get("selected_styles").selected_fill:this.is_object_empty(o)?s[e.id]||s.default_color:void 0===o[e.id]||null===o[e.id]||"nan"===o[e.id]||void 0===n?s.default_color:n.scale(o[e.id])}});e.exports={Map:l}},function(e,t,n){var r=n(9),i=n(1),o=n(13),s=n(0),a=r.DOMWidgetView.extend({initialize:function(){this.d3el=i.select(this.el),a.__super__.initialize.apply(this,arguments)},render:function(){this.parent=this.options.parent,this.update_formats(),this.create_listeners(),this.create_table()},create_listeners:function(){this.listenTo(this.parent,"update_tooltip",this.update_tooltip),this.model.on_some_change(["fields","show_labels","labels"],this.create_table,this),this.listenTo(this.model,"change:formats",this.update_formats)},update_formats:function(){var e=this.model.get("fields"),t=this.model.get("formats");this.tooltip_formats=e.map((function(e,n){var r=t[n];return void 0===r||""===r?function(e){return e}:o.is_valid_time_format(r)?i.time.format(r):i.format(r)}))},update_tooltip:function(e){var t=this;this.d3el.select("table").selectAll("tr").select(".datavalue").text((function(n,r){return t.tooltip_formats[r](e[n])}))},create_table:function(){for(var e=this.model.get("fields"),t=s.clone(this.model.get("labels")),n=t.length;n<e.length;n++)t[n]=e[n];this.d3el.select("table").remove();var r=this.d3el.append("table").selectAll("tr").data(e);r.exit().remove();var i=r.enter().append("tr").attr("class","datarow");this.model.get("show_labels")&&i.append("td").text((function(e,n){return t[n]})).attr("class","tooltiptext datafield"),i.append("td").attr("class","tooltiptext datavalue"),this.update_formats()}});e.exports={Tooltip:a}},function(e,t,n){var r=n(9),i=n(0),o="^"+n(21).version,s=r.DOMWidgetModel.extend({defaults:function(){return i.extend(r.DOMWidgetModel.prototype.defaults(),{_model_name:"TooltipModel",_view_name:"Tooltip",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o,_view_module_version:o,fields:[],formats:[],show_labels:!0,labels:[]})}});e.exports={TooltipModel:s}},function(e,t,n){var r=n(1),i=n(0),o=n(200),s=o.Lines.extend({render:function(){var e=o.Lines.__super__.render.apply(this),t=this;return e.then((function(){t.scales.x,t.scales.y;t.create_listeners(),t.draw()}))},set_ranges:function(){s.__super__.set_ranges.apply(this);var e=this.scales.width;e&&e.set_range([.5,this.model.get("stroke_width")])},create_listeners:function(){s.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:colors",this.update_colors,this),this.listenTo(this.model,"change:labels_visibility",this.update_legend_labels,this),this.listenTo(this.model,"change:color change:width",this.update_and_draw,this)},draw_legend:function(e,t,n,o,s){var a=e.selectAll(".legend"+this.uuid).data(this.model.mark_data,(function(e,t){return e.name})),l=this,c=.8*s;a.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(function(e,t){return"translate(0, "+(t*s+n)+")"})).on("mouseover",i.bind(this.make_axis_bold,this)).on("mouseout",i.bind(this.make_axis_non_bold,this)).append("line").style("stroke",(function(e,t){return l.get_colors(t)})).attr({x1:0,x2:c,y1:c/2,y2:c/2}),a.append("text").attr("class","legendtext").attr("x",1.2*c).attr("y",c/2).attr("dy","0.35em").text((function(e,t){return l.model.get("labels")[t]})).style("fill",(function(e,t){return l.get_colors(t)}));var u=r.max(this.model.get("labels"),(function(e){return e.length}));return a.exit().remove(),[this.model.mark_data.length,u]},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.draw()})),e.on("color_scale_range_changed",this.draw,this))},draw:function(){this.set_ranges();var e=this.d3el.selectAll(".curve").data(this.model.mark_data,(function(e,t){return e.name}));e.enter().append("g").attr("class","curve"),e.exit().transition("draw").duration(this.parent.model.get("animation_duration")).remove();var t=this.scales.x,n=this.scales.y,i=this;e[0].forEach((function(e,o){var s=r.select(e).selectAll("line").data(i.model.mark_data[o].values);s.enter().append("line"),s.attr("class","line-elem").attr({x1:function(e){return t.scale(e.x1)},x2:function(e){return t.scale(e.x2)},y1:function(e){return n.scale(e.y1)},y2:function(e){return n.scale(e.y2)}}).attr("stroke",(function(e){return i.get_element_color(e)})).attr("stroke-width",(function(e){return i.get_element_width(e)}))}))},get_element_color:function(e){var t=this.scales.color;return void 0!==t&&void 0!==e.color?t.scale(e.color):this.model.get("colors")[0]},get_element_width:function(e){var t=this.scales.width;return void 0!==t&&void 0!==e.size?t.scale(e.size):this.model.get("stroke_width")},relayout:function(){o.Lines.__super__.relayout.apply(this),this.set_ranges();var e=this.scales.x,t=this.scales.y;this.d3el.selectAll(".curve").selectAll(".line-elem").transition("relayout").duration(this.parent.model.get("animation_duration")).attr({x1:function(t){return e.scale(t.x1)},x2:function(t){return e.scale(t.x2)},y1:function(e){return t.scale(e.y1)},y2:function(e){return t.scale(e.y2)}})},create_labels:function(){}});e.exports={FlexLine:s}},function(e,t,n){var r=n(0),i=n(20),o=n(540),s=i.MarkModel.extend({defaults:function(){return r.extend(i.MarkModel.prototype.defaults(),{_model_name:"MapModel",_view_name:"Map",color:{},hover_highlight:!0,hovered_styles:{hovered_fill:"Orange",hovered_stroke:null,hovered_stroke_width:2},stroke_color:null,default_color:null,scales_metadata:{color:{dimension:"color"},projection:{dimension:"geo"}},selected:[],selected_styles:{selected_fill:"Red",selected_stroke:null,selected_stroke_width:2},map_data:void 0})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on("change:map_data",this.update_data,this),this.on("change:color",this.color_data_updated,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0;var e=this.get("map_data");"Topology"==e.type?this.geodata=o.feature(e,e.objects.subunits).features:this.geodata=e.features,this.color_data_updated(),this.dirty=!1,this.trigger("data_updated")},update_properties:function(e){e.properties?e.properties.color=this.color_data[e.id]:e.properties={color:this.color_data[e.id]}},color_data_updated:function(){var e=this;this.update_domains(),this.geodata.map((function(t){return e.update_properties(t)}))},update_domains:function(){var e=this.get("scales"),t=this,n=e.color;this.color_data=this.get("color"),null!=n&&(this.get("preserve_domain").color?n.del_domain([],this.model_id+"_color"):n.compute_and_set_domain(Object.keys(this.color_data).map((function(e){return t.color_data[e]})),this.model_id+"_color"))},get_data_dict:function(e,t){return r.extend(e.properties,{id:e.id})}});e.exports={MapModel:s}},function(e,t,n){!function(e){"use strict";function t(){}function n(e){if(!e)return t;var n,r,i=e.scale[0],o=e.scale[1],s=e.translate[0],a=e.translate[1];return function(e,t){t||(n=r=0),e[0]=(n+=e[0])*i+s,e[1]=(r+=e[1])*o+a}}function r(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function i(e,t){var n={type:"Feature",id:t.id,properties:t.properties||{},geometry:o(e,t)};return null==t.id&&delete n.id,n}function o(e,t){var r=n(e.transform),i=e.arcs;function o(e,t){t.length&&t.pop();for(var n,o=i[e<0?~e:e],s=0,a=o.length;s<a;++s)t.push(n=o[s].slice()),r(n,s);e<0&&function(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}(t,a)}function s(e){return e=e.slice(),r(e,0),e}function a(e){for(var t=[],n=0,r=e.length;n<r;++n)o(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function l(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function c(e){return e.map(l)}var u={Point:function(e){return s(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(s)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return c(e.arcs)},MultiPolygon:function(e){return e.arcs.map(c)}};return function e(t){var n=t.type;return"GeometryCollection"===n?{type:n,geometries:t.geometries.map(e)}:n in u?{type:n,coordinates:u[n](t)}:null}(t)}function s(e,t){var n={},r={},i={},o=[],s=-1;function a(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach((function(e){n[e<0?~e:e]=1})),o.push(i)}}return t.forEach((function(n,r){var i,o=e.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++s],t[s]=n,t[r]=i)})),t.forEach((function(t){var n,o,s=function(t){var n,r=e.arcs[t<0?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=r[r.length-1],t<0?[n,i]:[i,n]}(t),a=s[0],l=s[1];if(n=i[a])if(delete i[n.end],n.push(t),n.end=l,o=r[l]){delete r[o.start];var c=o===n?n:n.concat(o);r[c.start=n.start]=i[c.end=o.end]=c}else r[n.start]=i[n.end]=n;else if(n=r[l])if(delete r[n.start],n.unshift(t),n.start=a,o=i[a]){delete i[o.end];var u=o===n?n:o.concat(n);r[u.start=o.start]=i[u.end=n.end]=u}else r[n.start]=i[n.end]=n;else r[(n=[t]).start=a]=i[n.end=l]=n})),a(i,r),a(r,i),t.forEach((function(e){n[e<0?~e:e]||o.push([e])})),o}function a(e,t,n){var r=[];function i(e){var t=e<0?~e:e;(u[t]||(u[t]=[])).push({i:e,g:c})}function o(e){e.forEach(i)}function a(e){e.forEach(o)}function l(e){"GeometryCollection"===e.type?e.geometries.forEach(l):e.type in h&&(c=e,h[e.type](e.arcs))}if(arguments.length>1){var c,u=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};l(t),u.forEach(arguments.length<3?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)})}else for(var d=0,p=e.arcs.length;d<p;++d)r.push(d);return{type:"MultiLineString",arcs:s(e,r)}}function l(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function c(e,t){var n={},r=[],i=[];function a(e){e.forEach((function(t){t.forEach((function(t){(n[t=t<0?~t:t]||(n[t]=[])).push(e)}))})),r.push(e)}function l(t){return Math.abs(function(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++n<r;)t=i,i=e[n],o+=t[0]*i[1]-t[1]*i[0];return o/2}(o(e,{type:"Polygon",arcs:[t]}).coordinates[0]))}return t.forEach((function(e){"Polygon"===e.type?a(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(a)})),r.forEach((function(e){if(!e._){var t=[],r=[e];for(e._=1,i.push(t);e=r.pop();)t.push(e),e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].forEach((function(e){e._||(e._=1,r.push(e))}))}))}))}})),r.forEach((function(e){delete e._})),{type:"MultiPolygon",arcs:i.map((function(t){var r,i=[];if(t.forEach((function(e){e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].length<2&&i.push(e)}))}))})),(r=(i=s(e,i)).length)>1)for(var o,a,c=1,u=l(i[0]);c<r;++c)(o=l(i[c]))>u&&(a=i[0],i[0]=i[c],i[c]=a,u=o);return i}))}}function u(e,t){return e[1][2]-t[1][2]}e.version="1.6.27",e.mesh=function(e){return o(e,a.apply(this,arguments))},e.meshArcs=a,e.merge=function(e){return o(e,c.apply(this,arguments))},e.mergeArcs=c,e.feature=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return i(e,t)}))}:i(e,t)},e.neighbors=function(e){var t={},n=e.map((function(){return[]}));function i(e,n){e.forEach((function(e){e<0&&(e=~e);var r=t[e];r?r.push(n):t[e]=[n]}))}function o(e,t){e.forEach((function(e){i(e,t)}))}var s={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e,t){e.forEach((function(e){o(e,t)}))}};for(var a in e.forEach((function e(t,n){"GeometryCollection"===t.type?t.geometries.forEach((function(t){e(t,n)})):t.type in s&&s[t.type](t.arcs,n)})),t)for(var l=t[a],c=l.length,u=0;u<c;++u)for(var h=u+1;h<c;++h){var d,p=l[u],f=l[h];(d=n[p])[a=r(d,f)]!==f&&d.splice(a,0,f),(d=n[f])[a=r(d,p)]!==p&&d.splice(a,0,p)}return n},e.presimplify=function(e,r){var i=n(e.transform),o=function(e){if(!e)return t;var n,r,i=e.scale[0],o=e.scale[1],s=e.translate[0],a=e.translate[1];return function(e,t){t||(n=r=0);var l=Math.round((e[0]-s)/i),c=Math.round((e[1]-a)/o);e[0]=l-n,e[1]=c-r,n=l,r=c}}(e.transform),s=function(){var e={},t=[],n=0;function r(e,n){for(;n>0;){var r=(n+1>>1)-1,i=t[r];if(u(e,i)>=0)break;t[i._=n]=i,t[e._=n=r]=e}}function i(e,r){for(;;){var i=r+1<<1,o=i-1,s=r,a=t[s];if(o<n&&u(t[o],a)<0&&(a=t[s=o]),i<n&&u(t[i],a)<0&&(a=t[s=i]),s===r)break;t[a._=r]=a,t[e._=r=s]=e}}return e.push=function(e){return r(t[e._=n]=e,n++),n},e.pop=function(){if(!(n<=0)){var e,r=t[0];return--n>0&&(e=t[n],i(t[e._=0]=e,0)),r}},e.remove=function(e){var o,s=e._;if(t[s]===e)return s!==--n&&(u(o=t[n],e)<0?r:i)(t[o._=s]=o,s),s},e}();function a(e){s.remove(e),e[1][2]=r(e),s.push(e)}return r||(r=l),e.arcs.forEach((function(e){var t,n,l,c,u=[],h=0;for(n=0,l=e.length;n<l;++n)c=e[n],i(e[n]=[c[0],c[1],1/0],n);for(n=1,l=e.length-1;n<l;++n)(t=e.slice(n-1,n+2))[1][2]=r(t),u.push(t),s.push(t);for(n=0,l=u.length;n<l;++n)(t=u[n]).previous=u[n-1],t.next=u[n+1];for(;t=s.pop();){var d=t.previous,p=t.next;t[1][2]<h?t[1][2]=h:h=t[1][2],d&&(d.next=p,d[2]=t[2],a(d)),p&&(p.previous=d,p[0]=t[0],a(p))}e.forEach(o)})),e},Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){var r=n(1),i=n(9).WidgetView.extend({render:function(){this.set_projection(),this.listenTo(this.model,"attribute_changed",this.reset_scale)},set_projection:function(){this.path=r.geo.path().projection(this.model.projection),this.scale=this.model.projection},reset_scale:function(){this.set_projection(),this.trigger("domain_changed",null)}}),o=i.extend({}),s=i.extend({}),a=i.extend({}),l=i.extend({}),c=i.extend({}),u=i.extend({}),h=i.extend({});e.exports={GeoScale:i,Mercator:o,Albers:s,AlbersUSA:a,EquiRectangular:l,Orthographic:c,Gnomonic:u,Stereographic:h}},function(e,t,n){var r=n(1),i=n(0),o=n(70),s=o.ScaleModel.extend({defaults:function(){return i.extend(o.ScaleModel.prototype.defaults(),{_model_name:"GeoScaleModel",_view_name:"GeoScale"})}}),a=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"MercatorModel",_view_name:"Mercator",scale_factor:190,center:[0,60],rotate:[0,0]})},initialize:function(){a.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","rotate"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.mercator().center(this.get("center")).scale(this.get("scale_factor")).rotate(this.get("rotate")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),l=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"AlbersModel",_view_name:"Albers",scale_factor:250,center:[0,60],parallels:[29.5,45.5],precision:.1})},initialize:function(){l.__super__.initialize.apply(this,arguments),this.on_some_change(["rotate","center","parallels","scale_factor","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.albers().rotate(this.get("rotate")).center(this.get("center")).parallels(this.get("parallels")).scale(this.get("scale_factor")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),c=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"AlbersUSAModel",_view_name:"AlbersUSA",scale_factor:1200,translate:[600,490]})},initialize:function(){c.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","translate"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.albersUsa().scale(this.get("scale_factor")).translate(this.get("translate")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),u=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"EquiRectangularModel",_view_name:"EquiRectangular",scale_factor:145})},initialize:function(){u.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.equirectangular().center(this.get("center")).scale(this.get("scale_factor")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),h=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"OrthographicModel",_view_name:"Orthographic",scale_factor:145,center:[0,60],rotate:[0,0],clip_angle:90,precision:.1})},initialize:function(){h.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","clip_angle","rotate","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.orthographic().center(this.get("center")).scale(this.get("scale_factor")).clipAngle(this.get("clip_angle")).rotate(this.get("rotate")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),d=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"GnomonicModel",_view_name:"Gnomonic",scale_factor:145,center:[0,60],precision:.1,clip_angle:89.999})},initialize:function(){d.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","precision","clip_angle"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.gnomonic().clipAngle(this.get("clip_angle")).scale(this.get("scale_factor")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}}),p=s.extend({defaults:function(){return i.extend(s.prototype.defaults(),{_model_name:"StereographicModel",_view_name:"StereographicModel",scale_factor:245,center:[0,60],precision:.1,rotate:[96,0],clip_angle:179.9999})},initialize:function(){p.__super__.initialize.apply(this,arguments),this.on_some_change(["scale_factor","center","clip_angle","rotate","precision"],this.create_projection,this),this.create_projection()},create_projection:function(){this.projection=r.geo.stereographic().scale(this.get("scale_factor")).rotate(this.get("rotate")).clipAngle(this.get("clip_angle")).center(this.get("center")).precision(this.get("precision")),this.attribute_changed()},attribute_changed:function(){this.trigger("attribute_changed")}});e.exports={GeoScaleModel:s,MercatorModel:a,AlbersModel:l,AlbersUSAModel:c,EquiRectangularModel:u,OrthographicModel:h,GnomonicModel:d,StereographicModel:p}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(201),a=n(202),l=n(203);l.__esModule&&(l=l.default);var c=s.Figure.extend({render:function(e){this.id=r.uuid();var t=String(this.model.get("layout").get("min_width")),n=String(this.model.get("layout").get("min_height")),i=this._get_height_width(n.slice(0,-2),t.slice(0,-2));this.width=i.width,this.height=i.height,this.scales={},this.set_top_el_style();var s=this;this.margin=this.model.get("map_margin"),this.num_rows=this.model.get("rows"),this.num_cols=this.model.get("cols"),this.row_groups=this.model.get("row_groups"),this.enable_select=this.model.get("enable_select"),this.update_data(),this.set_area_dimensions(this.data.length),this.model.get("theme")&&this.svg.classed(this.model.get("theme"),!0),this.fig=this.svg.append("g").attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.fig_map=this.fig.append("g"),this.fig_axes=this.fig.append("g"),this.fig_click=this.fig.append("g"),this.fig_hover=this.fig.append("g"),this.fig_names=this.fig.append("g").style("display",this.model.get("show_groups")?"inline":"none"),this.fig_map.classed("g-map",!0),this.fig_axes.classed("g-axes",!0),this.fig_click.classed("g-click",!0),this.fig_hover.classed("g-hover",!0),this.fig_names.classed("g-names",!0),this.axis=[],this.tooltip_div=o.select(document.createElement("div")).attr("class","mark_tooltip").style("opacity",0).style("pointer-events","none"),this.popper_reference=new a.ElementReference(this.svg.node()),this.popper=new l(this.popper_reference,this.tooltip_div.node(),{placement:"auto"}),this.update_default_tooltip(),this.selected_stroke=this.model.get("selected_stroke"),this.hovered_stroke=this.model.get("hovered_stroke"),this.update_plotarea_dimensions(),this.title=this.fig.append("text").attr("class","mainheading").attr({x:.5*this.plotarea_width,y:-this.margin.top/2,dy:"1em"}).text(this.model.get("title")).style(this.model.get("title_style")),this.create_scale_views().then((function(){s.create_listeners(),s.axis_views=new r.ViewList(s.add_axis,null,s),s.axis_views.update(s.model.get("axes")),s.model.on("change:axes",(function(e,t,n){s.axis_views.update(t)}))})),this.displayed.then((function(){document.body.appendChild(s.tooltip_div.node()),s.relayout(),s.draw_group_names(),s.create_tooltip_widget()}))},set_top_el_style:function(){this.el.style["user-select"]="none",this.el.style["ms-user-select"]="none",this.el.style["moz-user-select"]="none",this.el.style["khtml-user-select"]="none",this.el.style["webkit-user-select"]="none"},update_plotarea_dimensions:function(){this.plotarea_width=this.width-this.margin.left-this.margin.right,this.plotarea_height=this.height-this.margin.top-this.margin.bottom,this.column_width=parseFloat((this.plotarea_width/this.num_cols).toFixed(2)),this.row_height=parseFloat((this.plotarea_height/this.num_rows).toFixed(2))},reset_drawing_controls:function(){this.prev_x=0,this.prev_y=-1,this.y_direction=1,this.x_direction=1,this.group_iter=1},create_listeners:function(){this.listenTo(this.model,"change:scales",this.create_scale_views,this),this.listenTo(this.model,"change:color",this.recolor_chart,this),this.listenTo(this.model,"change:colors",this.colors_updated,this),this.listenTo(this.model,"change:show_groups",this.show_groups,this),this.listenTo(this.model,"change:selected_stroke",this.update_selected_stroke,this),this.listenTo(this.model,"change:hovered_stroke",this.update_hovered_stroke,this),this.listenTo(this.model,"change:font_style",this.update_font_style,this),this.model.on_some_change(["title","title_style"],this.update_title,this),this.listenTo(this.model,"change:selected",(function(){this.clear_selected(),this.apply_selected()}),this),this.model.on_some_change(["names","groups","ref_data"],(function(){this.update_data(),this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:rows",(function(e,t){this.num_rows=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:cols",(function(e,t){this.num_cols=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:row_groups",(function(e,t){this.row_groups=t,this.compute_dimensions_and_draw()}),this),this.listenTo(this.model,"change:tooltip_widget",this.create_tooltip_widget,this),this.listenTo(this.model,"change:tooltip_fields",this.update_default_tooltip,this),this.listenTo(this.model,"change:tooltip_formats",this.update_default_tooltip,this)},update_title:function(e,t){this.title.text(this.model.get("title")).style(this.model.get("title_style"))},relayout:function(){var e=this,t=this._get_height_width(this.el.clientHeight,this.el.clientWidth);this.width=t.width,this.height=t.height,window.requestAnimationFrame((function(){e.margin=e.model.get("map_margin"),e.update_plotarea_dimensions(),e.fig.attr("transform","translate("+e.margin.left+","+e.margin.top+")"),e.title.attr({x:.5*e.plotarea_width,y:-e.margin.top/2,dy:"1em"}),e.draw_map(),e.clear_selected(),e.apply_selected(),e.fig_hover.selectAll("rect").remove(),e.hide_tooltip(),e.trigger("margin_updated")}))},update_data:function(){var e=this;this.data=this.model.get_typed_field("names"),this.ref_data=this.model.get("ref_data"),this.group_data=this.model.get_typed_field("groups"),this.groups=i.uniq(this.group_data,!0);var t=this.model.get_typed_field("display_text");t=void 0===t||0===t.length?this.data:t,this.colors=this.model.get("colors");var n=this.colors.length;this.colors_map=function(t){return e.get_color(t,n)};var r=this.model.get_typed_field("color"),o=this.data.map((function(n,i){return{display:t[i],name:n,color:r[i],group:e.group_data[i],ref_data:null===e.ref_data||void 0===e.ref_data?null:e.ref_data[i]}}));this.update_domains(),this.grouped_data=i.groupBy(o,(function(t,n){return e.group_data[n]})),this.groups=[],this.running_sums=[],this.running_sums[0]=0;var s=0;for(var a in this.grouped_data)this.groups.push(a),s+=this.grouped_data[a].length,this.running_sums.push(s);this.running_sums.pop()},update_domains:function(){var e=this.model.get("scales").color,t=this.model.get_typed_field("color");e&&t.length>0&&e.compute_and_set_domain(t,this.model.model_id)},set_area_dimensions:function(e){this.num_rows=this.model.get("rows"),this.num_cols=this.model.get("cols"),this.row_groups=this.model.get("row_groups"),void 0!==this.num_cols&&null!==this.num_cols&&0!==this.num_cols?(this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(e/this.num_cols),this.num_rows=e%this.num_cols==0?this.num_rows:this.num_rows+1):void 0!==this.num_rows&&null!==this.num_rows&&0!==this.num_rows?(this.num_cols=Math.floor(e/this.num_rows),this.num_cols=e%this.num_rows==0?this.num_cols:this.num_cols+1,this.row_groups>1&&this.num_cols%2==0&&this.num_cols++):(this.num_cols=Math.floor(Math.sqrt(e)),this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(e/this.num_cols),this.num_rows=e%this.num_cols==0?this.num_rows:this.num_rows+1),this.row_groups=Math.min(this.row_groups,this.num_rows),1==this.row_groups&&(this.num_cols=Math.floor(e/this.num_rows),this.num_cols=e%this.num_rows==0?this.num_cols:this.num_cols+1),this.set_row_limits()},compute_dimensions_and_draw:function(){this.set_area_dimensions(this.data.length),this.update_plotarea_dimensions(),this.draw_map(),this.clear_selected(),this.apply_selected(),this.fig_hover.selectAll("rect").remove(),this.hide_tooltip()},update_default_tooltip:function(){this.tooltip_fields=this.model.get("tooltip_fields");var e=this.model.get("tooltip_formats");this.tooltip_formats=this.tooltip_fields.map((function(t,n){var r=e[n];return void 0===r||""===r?function(e){return e}:o.format(r)}))},create_scale_views:function(){for(var e in this.scales)this.stopListening(this.scales[e]);var t=this.model.get("scales"),n=this,o={};return i.each(t,(function(e,t){o[t]=n.create_child_view(e)})),r.resolvePromisesDict(o).then((function(e){n.scales=e,n.set_scales()}))},set_scales:function(){var e=this,t=this.scales.color;t&&(t.set_range(),t.on("color_scale_range_changed",e.update_map_colors,e),this.update_domains(),this.listenTo(t,"domain_changed",(function(){e.update_map_colors()})),this.update_map_colors())},show_groups:function(e,t){this.fig_names.style("display",t?"inline":"none"),this.fig_map.selectAll(".market_map_text").style("opacity",t?.2:1),this.fig_map.selectAll(".market_map_rect").style("stroke-opacity",t?.2:1)},draw_map:function(){this.reset_drawing_controls(),this.fig_map.selectAll(".element_group").remove(),this.fig_names.selectAll(".names_object").remove(),this.rect_groups=this.fig_map.selectAll(".element_group").data(this.groups);var e=this.scales.color,t=this;this.rect_groups.enter().append("g").attr("class","element_group").attr("transform",(function(e,n){return t.get_group_transform(n)})),this.rect_groups.exit().remove(),this.end_points=[],this.rect_groups[0].forEach((function(n,r){var i=t.grouped_data[t.groups[r]],s=(t.colors_map(r),t.get_new_cords()),a=t.get_end_points(s[2],i.length,s[0],s[1],s[3],s[4]);a.forEach((function(e){t.end_points.push(e)}));var l=t.running_sums[r],c=o.select(n).selectAll(".rect_element").data(i),u=c.enter().append("g").classed("rect_element",!0);u.append("rect").attr("x",0).attr("y",0).classed("market_map_rect",!0),u.append("text").classed("market_map_text",!0).style({"text-anchor":"middle",fill:"black","pointer-events":"none"}).style(t.model.get("font_style")),c.attr("transform",(function(e,n){return t.get_cell_transform(n)})).on("click",(function(e,n){t.cell_click_handler(e,l+n,this)})).on("mouseover",(function(e,n){t.mouseover_handler(e,l+n,this)})).on("mousemove",(function(e){t.mousemove_handler(e)})).on("mouseout",(function(e,n){t.mouseout_handler(e,l+n,this)})).attr("class",(function(e,t){return o.select(this).attr("class")+" rect_"+(l+t)})).attr("id",(function(e){return"market_map_element_"+e.name})),c.selectAll(".market_map_rect").attr("width",t.column_width).attr("height",t.row_height).style("stroke-opacity",t.model.get("show_groups")?.2:1).style({stroke:t.model.get("stroke"),fill:function(n,i){return e&&void 0!==n.color&&null!==n.color?e.scale(n.color):t.colors_map(r)}}),c.selectAll(".market_map_text").attr("x",t.column_width/2).attr("y",t.row_height/2).text((function(e,t){return e.display})).style("opacity",t.model.get("show_groups")?.2:1),c.exit().remove();t.create_bounding_path(n,a);var h=o.min(a,(function(e){return e.x})),d=o.min(a,(function(e){return e.y}));t.fig_names.append("foreignObject").attr("class","names_object").attr("x",h).attr("y",d).append("xhtml:div").attr("class","names_div").style({display:"flex","flex-direction":"row","align-content":"center","align-items":"center",width:"100%",height:"100%","justify-content":"center","word-wrap":"break-word",font:"24px sans-serif",color:"black"}).text(t.groups[r])})),this.draw_group_names()},draw_group_names:function(){var e=this.svg.selectAll(".bounding_path")[0].map((function(e){return e.getBoundingClientRect()}));this.fig_names.selectAll(".names_object").data(e).attr("width",(function(e){return e.width})).attr("height",(function(e){return e.height}))},recolor_chart:function(){var e=this;this.update_data(),this.rect_groups=this.fig.selectAll(".element_group").data(this.groups);var t=this.scales.color;this.rect_groups[0].forEach((function(n,r){var i=e.grouped_data[e.groups[r]];e.colors_map(r),o.select(n).selectAll(".rect_element").data(i).select("rect").style({stroke:e.model.get("stroke"),fill:function(n,i){return t&&void 0!==n.color&&null!==n.color?t.scale(n.color):e.colors_map(r)}})}))},update_font_style:function(e,t){this.svg.selectAll(".market_map_text").style(t)},update_map_colors:function(){var e=this,t=this.scales.color;void 0!==this.rect_groups&&null!==this.rect_groups&&this.rect_groups[0].forEach((function(n,r){var i=e.grouped_data[e.groups[r]];e.colors_map(r),o.select(n).selectAll(".rect_element").data(i).select("rect").style({stroke:e.model.get("stroke"),fill:function(n,i){return t&&void 0!==n.color&&null!==n.color?t.scale(n.color):e.colors_map(r)}})}))},cell_click_handler:function(e,t,n){if(this.model.get("enable_select")){var r=this.model.get("selected").slice(),i=r.indexOf(e.name),s=o.select(n).attr("id");if(-1==i){r.push(e.name);var a=o.select(n).attr("transform");this.add_selected_cell(s,a)}else this.fig_click.select("#click_"+s).remove(),r.splice(i,1);this.model.set("selected",r),this.touch()}},apply_selected:function(){var e=this.model.get("selected"),t=this;null==e||0===e.length?this.clear_selected():e.forEach((function(e){var n="market_map_element_"+e;if(t.fig_click.select("#click_"+n).remove(),1==t.fig_map.selectAll("#"+n)[0].length){var r=t.fig_map.selectAll("#"+n).attr("transform");t.add_selected_cell(n,r)}}))},clear_selected:function(){this.fig_click.selectAll("rect").remove()},add_selected_cell:function(e,t){this.fig_click.append("rect").attr("id","click_"+e).attr("transform",t).attr("x",0).attr("y",0).attr("width",this.column_width).attr("height",this.row_height).style({stroke:this.selected_stroke,"stroke-width":"4px",fill:"none"})},mouseover_handler:function(e,t,n){var r=o.select(n).attr("transform");this.model.get("enable_hover")&&(this.fig_hover.append("rect").attr("class","hover_"+t).attr("transform",r).attr("x",0).attr("y",0).attr("width",this.column_width).attr("height",this.row_height).style({stroke:this.hovered_stroke,"stroke-width":"3px",fill:"none","pointer-events":"none"}),this.show_tooltip(o.event,e),this.send({event:"hover",data:e.name,ref_data:e.ref_data}))},update_selected_stroke:function(e,t){this.selected_stroke=t;this.fig_click.selectAll("rect").style({stroke:t})},update_hovered_stroke:function(e,t){this.hovered_stroke=t},mouseout_handler:function(e,t,n){this.fig_hover.select(".hover_"+t).remove(),this.hide_tooltip()},show_tooltip:function(e,t){o.mouse(this.el);var n=this;if(this.tooltip_view||this.tooltip_fields&&0!=this.tooltip_fields.length){var r=this.tooltip_div;r.transition().style("opacity",.9).style("display",null),this.move_tooltip(),r.select("table").remove();var i=t.ref_data;if(!this.tooltip_view){var s=r.append("table").selectAll("tr").data(this.tooltip_fields);s.exit().remove();var a=s.enter().append("tr");a.append("td").attr("class","tooltiptext").text((function(e){return e})),a.append("td").attr("class","tooltiptext").text((function(e,t){return null==i?null:n.tooltip_formats[t](i[e])}))}this.popper.enableEventListeners(),this.move_tooltip()}},mousemove_handler:function(e){this.move_tooltip(e)},move_tooltip:function(e){this.popper_reference.x=o.event.clientX,this.popper_reference.y=o.event.clientY,this.popper.scheduleUpdate()},hide_tooltip:function(){this.tooltip_div.style("pointer-events","none"),this.tooltip_div.transition().style("opacity",0).style("display","none"),this.popper.disableEventListeners()},create_tooltip_widget:function(){var e=this.model.get("tooltip_widget");null!==this.tooltip_view&&void 0!==this.tooltip_view&&(this.tooltip_view.remove(),this.tooltip_view=null);var t=this;e&&this.create_child_view(e).then((function(e){t.tooltip_view=e,t.tooltip_div.node().appendChild(e.el),e.trigger("displayed",{add_to_dom_only:!0})}))},get_group_transform:function(e){return"translate(0, 0)"},get_cell_transform:function(e){return this.past_border_y()?this.prev_y+=this.y_direction:this.past_border_x()?(this.y_direction=-1*this.y_direction,this.prev_x+=this.x_direction):(this.x_direction=-1*this.x_direction,this.prev_y+=this.y_direction,this.group_iter+=1),"translate("+this.prev_x*this.column_width+", "+this.prev_y*this.row_height+")"},get_new_cords:function(){var e=this.prev_x,t=this.prev_y,n=this.y_direction,r=this.x_direction,i=this.group_iter;return this.past_border_y()?t+=this.y_direction:this.past_border_x()?(n=-1*this.y_direction,e+=this.x_direction):(r=-1*this.x_direction,t+=this.y_direction,i+=1),[e,t,i,r,n,e*this.column_width,t*this.row_height]},past_border_y:function(){return 1==this.y_direction?this.prev_y+1<this.row_limits[this.group_iter]:this.prev_y-1>this.row_limits[this.group_iter-1]-1},past_border_x:function(){return 1==this.x_direction?this.prev_x+1<this.num_cols:this.prev_x-1>-1},colors_updated:function(){this.colors=this.model.get("colors"),this.recolor_chart()},get_color:function(e,t){return this.colors[e%t]},set_row_limits:function(){var e=Math.floor(this.num_rows/this.row_groups);this.row_limits=[];for(var t=this.row_groups-1;t>-1;t--)this.row_limits.unshift(t*e);this.row_limits[this.row_groups]=this.num_rows},get_end_points:function(e,t,n,r,i,o){var s,a=this.row_limits[e-1],l=this.row_limits[e],c=!1,u=i,h=o,d=[],p=1==h?l-r:r-a+1,f=1==u?this.num_cols-1-n:n,g=t,m=l-a;if(0!==g){this.calc_end_point_source(n,r,u,h).forEach((function(e){d.push(e)}));var _=Math.min(p,g);if(_===g)return this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),s=r+(g-1)*h,this.calc_end_point_dest(n,s,-1*u,h).forEach((function(e){d.push(e)})),this.calc_end_point_dest(n,s,u,h).forEach((function(e){d.push(e)})),d;if(g-=_,0===f?this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})):p!==l-a?(this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),g>m&&this.calc_end_point_dest(n+u,1==h?a:l-1,-1*u,-1*h).forEach((function(e){d.push(e)}))):g<m&&this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),r+=h*(_-1),this.calc_end_point_dest(n,r,-1*u,h).forEach((function(e){d.push(e)})),0===g)return this.calc_end_point_dest(n,r,u,h).forEach((function(e){d.push(e)})),d;0!==f&&g>m&&(n+=u)}for(;g>m;){var v;if(m*f<g){var y=g-(v=f)*m;v+=Math.floor(y/(this.row_limits[e+1]-this.row_limits[e]))}else v=Math.floor(g/m);v>f?(n=1===u?this.num_cols-1:0,0!==f&&this.calc_end_point_dest(n,a,u,-1).forEach((function(e){d.push(e)})),v=f,f=this.num_cols,e+=1,a=l,l=this.row_limits[e],r=a,u*=-1,h=Math.pow(-1,v)*h*-1,this.calc_end_point_dest(n,l-1,-1*u,1).forEach((function(e){d.push(e)}))):v===f?(n=1===u?this.num_cols-1:0,0!==f&&this.calc_end_point_dest(n,a,u,-1).forEach((function(e){d.push(e)})),v=f,f=this.num_cols,(e+=1)<this.row_limits.length?(a=l,l=this.row_limits[e],r=a,u*=-1,h=Math.pow(-1,v)*h*-1,c=!0):(h=1,u=1)):(r=1===(h=Math.pow(-1,v)*h)?a:l-1,n+=u*(v-1),this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)}))),g-=v*m,m=l-a}return 0===g?(r=1===h?l-1:a,u=c?-1*u:u,this.calc_end_point_dest(n,r,u,h).forEach((function(e){d.push(e)}))):(r=1===(h*=-1)?a:l-1,n=c?n:n+u,this.calc_end_point_source(n,r,-1*u,h).forEach((function(e){d.push(e)})),s=r+(g-1)*h,this.calc_end_point_dest(n,s,u,h).forEach((function(e){d.push(e)})),this.calc_end_point_dest(n,s,-1*u,h).forEach((function(e){d.push(e)}))),d},create_bounding_path:function(e,t){t[0].x,t[0].y;var n=[],r=t.slice();n.push(t[0]),r.splice(0,1);for(var i=["x","y"],s=0,a=i[s%2],l=i[(s+1)%2],c=n[0],u=c[a],h=c[l],d=2*r.length,p=0;r.length>1&&d>0;){var f=r.filter((function(e){return e[a]==u}));if(f.length>0){s++;var g=o.min(f,(function(e){return e[l]})),m=o.max(f,(function(e){return e[l]}));if(g<h&&m>h)if("y"==a)p=1==this.x_direction?m:g;else{var _=f.filter((function(e){return e[l]<h})),v=f.filter((function(e){return e[l]>h}));p=1==_.length?g:1==v.length?m:o.max(_,(function(e){return e[l]}))}else p=g>h?g:m;r.filter((function(e){return e[a]==u&&e[l]==p})).forEach((function(e){r.splice(r.indexOf(e),1)}));var y={};y[a]=u,y[l]=p,n.push(y)}else p=h;var b=a;a=l,l=b,h=u,u=p,d--}r.length>0&&n.push(r[0]),n.push(t[0]);var w=o.svg.line().interpolate("linear").x((function(e){return e.x})).y((function(e){return e.y}));return o.select(e).append("path").attr("class","bounding_path").attr("d",(function(){return w(n)})).attr("fill","none").style("stroke",this.model.get("group_stroke")).style("stroke-width",3)},calc_end_point_source:function(e,t,n,r){return t=1==r?t:t+1,[{x:(e=1==n?e:e+1)*this.column_width,y:t*this.row_height}]},calc_end_point_dest:function(e,t,n,r){return t=-1==r?t:t+1,[{x:(e=-1==n?e:e+1)*this.column_width,y:t*this.row_height}]}});e.exports={MarketMap:c}},function(e,t,n){var r=n(1),i=n(0),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.anchor_style=this.model.get("anchor_style"),this.display_el_classes=["heatmapcell"],e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.row;if(e){var t=this.parent.padded_range("y",e.model);e.set_range(t)}var n=this.scales.column;n&&n.set_range(this.parent.padded_range("x",n.model))},set_positional_scales:function(){var e=this.scales.column,t=this.scales.row;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},expand_scale_domain:function(e,t,n,i){var o,s;if("expand_one"===n){var a=(o=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return e-o[t]}));s=0,a[0]<0?(i=!i,s=r.max(a)):s=r.min(a);var l=0;return i?(l=o[o.length-1]+s,[t[0],e.invert(l)]):(l=o[0]-s,[e.invert(l),t[o.length-1]])}if("expand_two"===n){o=t.map((function(t){return e.scale(t)})),s=r.min(o.slice(1).map((function(e,t){return e-o[t]})));var c=o[o.length-1]+s,u=o[0]-s;return[e.invert(u),e.invert(c)]}},create_listeners:function(){s.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:stroke",this.update_stroke,this),this.listenTo(this.model,"change:opacity",this.update_opacity,this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")})),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions)},click_handler:function(e){e.data;var t=this.model.colors[0].length,n=e.row_num*t+e.column_num,s=e.row_num,a=e.column_num,l=this,c=this.model.get("selected")?o.deepCopy(this.model.get("selected")):[],u=o.deepCopy(this._cell_nums_from_indices(c)),h=u.indexOf(n),d=r.event.ctrlKey||r.event.metaKey;if(h>-1&&d)c.splice(h,1);else if(d||(u=[],c=[]),c.push([s,a]),u.push(l._cell_nums_from_indices([[s,a]])[0]),r.event.shiftKey){if(h>-1)return;var p=0!==u.length?l.anchor_cell_index[0]:s,f=0!==u.length?l.anchor_cell_index[1]:a;i.range(Math.min(s,p),Math.max(s,p)+1).forEach((function(e){i.range(Math.min(a,f),Math.max(a,f)+1).forEach((function(t){var n=l._cell_nums_from_indices([[e,t]])[0];-1===u.indexOf(n)&&(u.push(n),c.push([e,t]))}))}))}else this.anchor_cell_index=[s,a];this.model.set("selected",0===c.length?null:c,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var g=r.event;void 0!==g.cancelBubble&&(g.cancelBubble=!0),g.stopPropagation&&g.stopPropagation(),g.preventDefault(),this.selected_indices=c,this.apply_styles()},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},set_style_on_elements:function(e,t,n){t&&(0!==t.length||n&&0!==n.length)&&0!==Object.keys(e).length&&(n=n&&0!==n.length?n:this._filter_cells_by_index(t)).style(e)},set_default_style:function(e,t){if(e&&(0!==e.length||t&&0!==t.length)){t=t&&0!==t.length?t:this._filter_cells_by_index(e);var n=this.model.get("stroke"),r=this.model.get("opacity"),i=this;t.style("fill",(function(e){return i.get_element_fill(e)})).style("opacity",r).style("stroke",n)}},clear_style:function(e,t,n){if(0!==Object.keys(e).length){n&&0!==n.length||(n=t?this._filter_cells_by_index(t):this.display_cells);var r={};for(var i in e)r[i]=null;n.style(r)}},_filter_cells_by_cell_num:function(e){return null==e?[]:this.display_cells.filter((function(t){return-1!==e.indexOf(t._cell_num)}))},selected_style_updated:function(e,t){this.selected_style=t,this.clear_style(e.previous("selected_style"),this.selected_indices,this.selected_elements),this.style_updated(t,this.selected_indices,this.selected_elements)},unselected_style_updated:function(e,t){this.unselected_style=t,this.clear_style(e.previous("unselected_style"),[],this.unselected_elements),this.style_updated(t,[],this.unselected_elements)},apply_styles:function(){var e=this.model.colors.length,t=this.model.colors[0].length;this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells);var n=this._cell_nums_from_indices(this.selected_indices),r=null===n?[]:i.difference(i.range(e*t),n);if(this.selected_elements=this._filter_cells_by_cell_num(n),this.set_style_on_elements(this.selected_style,this.selected_indices,this.selected_elements),this.unselected_elements=this._filter_cells_by_cell_num(r),this.set_style_on_elements(this.unselected_style,[],this.unselected_elements),null!==this.anchor_cell_index&&void 0!==this.anchor_cell_index){var o=this._cell_nums_from_indices([this.anchor_cell_index]);this.anchor_element=this._filter_cells_by_cell_num(o),this.set_style_on_elements(this.anchor_style,[],this.anchor_element)}},style_updated:function(e,t,n){this.set_default_style(t,n),this.set_style_on_elements(e,t,n)},reset_selection:function(){this.model.set("selected",null),this.touch(),this.selected_indices=null,this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells)},relayout:function(){this.set_ranges(),this.compute_view_padding(),this.draw()},_cell_nums_from_indices:function(e){if(null==e)return null;var t=this.model.colors[0].length;return e.map((function(e){return e[0]*t+e[1]}))},invert_point:function(e){},selector_changed:function(e,t){if(void 0===e)return this.model.set("selected",null),this.touch(),[];var n=i.range(this.model.colors[0].length),r=i.range(this.model.colors.length),o=this,s=i.filter(n,(function(e){return t([o.column_pixels[e],[]])})),a=i.filter(r,(function(e){return t([[],o.row_pixels[e]])})),l=s.map((function(e){return a.map((function(t){return[t,e]}))}));l=i.flatten(l,!0),this.model.set("selected",l),this.touch()},draw:function(){this.set_ranges();var e,t=this,n=this.model.colors.length,o=this.model.colors[0].length,s=this.scales.row,a=this.scales.column,l="start"===this.model.get("row_align"),c="start"===this.model.get("column_align");"middle"!==this.model.modes.row&&"boundaries"!==this.model.modes.row&&(e=this.expand_scale_domain(s,this.model.rows,this.model.modes.row,l),(r.min(e)<r.min(s.model.domain)||r.max(e)>r.max(s.model.domain))&&s.model.compute_and_set_domain(e,s.model.model_id)),"middle"!==this.model.modes.column&&"boundaries"!==this.model.modes.column&&(e=this.expand_scale_domain(a,this.model.columns,this.model.modes.column,c),(r.min(e)<r.min(a.model.domain)||r.max(e)>r.max(a.model.domain))&&a.model.compute_and_set_domain(e,a.model.model_id));var u=this.get_tile_plotting_data(s,this.model.rows,this.model.modes.row,l),h=this.get_tile_plotting_data(a,this.model.columns,this.model.modes.column,c);this.row_pixels=u.start.map((function(e,t){return[e,e+u.widths[t]]})),this.column_pixels=h.start.map((function(e,t){return[e,e+h.widths[t]]})),this.display_rows=this.d3el.selectAll(".heatmaprow").data(i.range(n)),this.display_rows.enter().append("g").attr("class","heatmaprow"),this.display_rows.attr("transform",(function(e){return"translate(0, "+u.start[e]+")"}));var d=i.range(o),p=i.range(n).map((function(e){return d.map((function(n){return t.model.mark_data[e*o+n]}))}));this.display_cells=this.display_rows.selectAll(".heatmapcell").data((function(e,t){return p[t]})),this.display_cells.enter().append("rect").attr("class","heatmapcell").on("click",i.bind((function(){this.event_dispatcher("element_clicked")}),this));var f=this.model.get("stroke"),g=this.model.get("opacity");this.display_cells.attr({x:function(e,t){return h.start[t]},y:0}).attr("width",(function(e,t){return h.widths[t]})).attr("height",(function(e){return u.widths[e.row_num]})).style("fill",(function(e){return t.get_element_fill(e)})).style({stroke:f,opacity:g}),this.display_cells.on("click",(function(e,n){return t.event_dispatcher("element_clicked",{data:e.color,index:n,row_num:e.row_num,column_num:e.column_num})}))},update_stroke:function(e,t){this.display_cells.style("stroke",t)},update_opacity:function(e,t){this.display_cells.style("opacity",t)},get_tile_plotting_data:function(e,t,n,i){var o,s=[],a=[];if("middle"===n)return s=t.map((function(t){return e.scale(t)})),a=t.map((function(t){return e.scale.rangeBand()})),{start:s,widths:a};if("boundaries"===n){var l=t.map((function(t){return e.scale(t)}));a=[];for(var c=1;c<l.length;++c)a[c-1]=Math.abs(l[c]-l[c-1]);return{start:s=l[1]>l[0]?l.slice(0,-1):l.slice(1),widths:a}}if("expand_one"===n)return i?(a=(s=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return Math.abs(e-s[t])})),o=r.max(e.scale.range()),a=s[0]<s[1]?Array.prototype.concat(a,[Math.abs(o-r.max(s))]):Array.prototype.concat([Math.abs(o-r.max(s))],a)):(a=(s=t.map((function(t){return e.scale(t)}))).slice(1).map((function(e,t){return Math.abs(e-s[t])})),o=r.min(e.scale.range()),o=r.min(e.scale.range()),s[1]>s[0]?(s.splice(0,0,Math.abs(0,0,o)),a.splice(0,0,s[1]-s[0]),s.splice(-1,1)):(a=Array.prototype.concat(a,[Math.abs(o-s.slice(-1)[0])]),(s=Array.prototype.concat(s,o)).splice(0,1))),{widths:a,start:s};if("expand_two"===n){var u=(s=t.map((function(t){return e.scale(t)})))[1]-s[0]>0,h=u?r.min(e.scale.range()):r.max(e.scale.range());return s.splice(0,0,h),a=s.slice(1).map((function(e,t){return Math.abs(e-s[t])})),h=u?r.max(e.scale.range()):r.min(e.scale.range()),a[a.length]=Math.abs(h-s.slice(-1)[0]),{start:s,widths:a}}},get_element_fill:function(e){return null===e.color?this.model.get("null_color"):this.scales.color.scale(e.color)},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"==e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover())}});e.exports={GridHeatMap:s}},function(e,t,n){var r=n(9),i=n(0),o=n(1),s=n(28),a="^"+n(21).version,l=s.BaseModel.extend({defaults:function(){return i.extend(s.BaseModel.prototype.defaults(),{_model_name:"MarketMapModel",_view_name:"MarketMap",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:a,_view_module_version:a,map_width:1080,map_height:800,names:[],groups:[],display_text:[],ref_data:void 0,title:"",tooltip_fields:[],tooltip_formats:[],show_groups:!1,cols:0,rows:0,row_groups:1,colors:o.scale.category20().range(),scales:{},axes:[],color:[],map_margin:{top:50,right:50,left:50,bottom:50},preserve_aspect:!1,stroke:"white",group_stroke:"black",selected_stroke:"dodgerblue",hovered_stroke:"orangered",font_style:{},title_style:{},selected:[],enable_hover:!0,enable_select:!0,tooltip_widget:null})}},{serializers:i.extend({scales:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},tooltip_widget:{deserialize:r.unpack_models},style:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models}},s.BaseModel.serializers)});e.exports={MarketMapModel:l}},function(e,t,n){var r=n(1),i=n(0),o=(n(13),n(19).Mark.extend({render:function(){var e=o.__super__.render.apply(this),t=this;return this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.image=r.select(this.el).append("image").classed("heatmap",!0).attr("width",this.parent.width).attr("height",this.parent.height),this.canvas=document.createElement("canvas"),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.x;if(e){var t=this.parent.padded_range("x",e.model);e.set_range(t)}var n=this.scales.y;n&&n.set_range(this.parent.padded_range("y",n.model))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.draw()})),e.on("color_scale_range_changed",this.draw,this))},create_listeners:function(){o.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"data_updated",this.draw,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")})),this.listenTo(this.model,"change:interactions",this.process_interactions)},click_handler:function(e){},process_interactions:function(e){},relayout:function(){this.set_ranges(),this.compute_view_padding(),this.draw()},draw_canvas:function(){this.image.attr("href",this.canvas.toDataURL("image/png"))},draw:function(){this.set_ranges();var e=this,t=this.get_x_plotting_data(this.model.mark_data.x),n=this.get_y_plotting_data(this.model.mark_data.y);this.canvas.setAttribute("width",t.total_width),this.canvas.setAttribute("height",n.total_height);var r=this.canvas.getContext("2d");this.model.mark_data.color.forEach((function(i,o){var s=n.heights[o],a=n.start[o];i.forEach((function(n,i){var o=t.widths[i],l=t.start[i];r.fillStyle=e.get_element_fill(n),r.fillRect(l,a,o+.5,s+.5)}))})),this.image.attr("width",t.total_width).attr("height",n.total_height).attr("x",t.x0).attr("y",n.y0),this.draw_canvas()},get_x_plotting_data:function(e){var t=e.map(this.scales.x.scale),n=this.get_x_padding(t),r=e.length,i=t.map((function(e,i){return 0==i?.5*(t[1]-e)+n.left:i==r-1?.5*(e-t[i-1])+n.right:.5*(t[i+1]-t[i-1])})),o=t[0]-n.left,s=t.map((function(e,n){return 0==n?0:.5*(e+t[n-1])-o}));return{widths:i,total_width:t[r-1]-t[0]+n.left+n.right,start:s,x0:o}},get_x_padding:function(e){var t=e.length;return{left:.5*(e[1]-e[0]),right:.5*(e[t-1]-e[t-2])}},get_y_plotting_data:function(e){var t=e.map(this.scales.y.scale),n=this.get_y_padding(t),r=e.length,i=t.map((function(e,i){return 0==i?.5*-(t[1]-e)+n.bottom:i==r-1?.5*-(e-t[i-1])+n.top:.5*-(t[i+1]-t[i-1])})),o=t[r-1]-n.top,s=t.map((function(e,n){return n==r-1?0:.5*(e+t[n+1])-o}));return{heights:i,total_height:t[0]-t[r-1]+n.top+n.bottom,start:s,y0:o}},get_y_padding:function(e){var t=e.length;return{bottom:.5*-(e[1]-e[0]),top:.5*-(e[t-1]-e[t-2])}},get_element_fill:function(e){return null===e?this.model.get("null_color"):this.scales.color.scale(e)}}));e.exports={HeatMap:o}},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:r.extend({},i.MarkModel.prototype.defaults,{_model_name:"HeatMapModel",_view_name:"HeatMap",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},null_color:"black"}),initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()},update_data:function(){this.dirty=!0,this.mark_data={x:this.get_typed_field("x"),y:this.get_typed_field("y"),color:this.get_typed_field("color")},this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y,r=e.color,i=[].concat.apply([],this.mark_data.color);this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.x,this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"),null!=r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(i,this.model_id+"_color"))}},get_data_dict:function(e,t){return e}});e.exports={HeatMapModel:o}},function(e,t,n){var r=n(9),i=n(0),o="^"+n(21).version,s=r.DOMWidgetModel.extend({defaults:function(){return i.extend(r.DOMWidgetModel.prototype.defaults(),{_model_name:"ToolbarModel",_view_name:"Toolbar",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o,_view_module_version:o,figure:void 0,_panning:!1,_panzoom:null})},panzoom:function(){var e=this.get("figure");if(this.get("_panning"))e&&(e.set("interaction",this.cached_interaction),e.save_changes()),this.set("_panning",!1),this.save_changes();else{if(e){this.cached_interaction=e.get("interaction");var t=this,n=this.get("_panzoom");n?(e.set("interaction",n),e.save_changes()):this._create_panzoom_model(e).then((function(n){t.set("_panzoom",n),t.save_changes(),e.set("interaction",n),e.save_changes()}))}this.set("_panning",!0),this.save_changes()}},reset:function(){var e=this.get("figure");this.get("_panning");if(e){e.set("interaction",this.cached_interaction),e.save_changes();var t=this.get("_panzoom");t.reset_scales(),t.close(),this.set("_panzoom",null),this.set("_panning",!1),this.save_changes()}},save_png:function(){var e=this.get("figure");e&&e.save_png()},_create_panzoom_model:function(e){return this.widget_manager.new_widget({model_name:"PanZoomModel",model_module:"bqplot",model_module_version:e.get("_model_module_version"),view_name:"PanZoom",view_module:"bqplot",view_module_version:e.get("_view_module_version")}).then((function(t){return Promise.all(e.get("marks")).then((function(e){for(var n=[],r=[],o=0;o<e.length;++o){var s=e[o].get("preserve_domain"),a=e[o].get("scales");i.each(a,(function(t,i){var l=e[o].get("scales_metadata")[i].dimension;"x"!==l||s[i]||n.push(a[i]),"y"!==l||s[i]||r.push(a[i])}))}return t.set("scales",{x:n,y:r}),t.save_changes(),t}))}))}},{serializers:i.extend({figure:{deserialize:r.unpack_models},_panzoom:{deserialize:r.unpack_models}},r.DOMWidgetModel.serializers)}),a=r.DOMWidgetView.extend({render:function(){var e=this;this.el.classList.add("jupyter-widget"),this.el.classList.add("widget-hbox");var t=document.createElement("button");t.classList.add("jupyter-widgets"),t.classList.add("jupyter-button"),t.classList.add("widget-toggle-button"),t.setAttribute("data-toggle","tooltip"),t.setAttribute("title","PanZoom"),t.onclick=function(t){t.preventDefault(),e.model.panzoom()};var n=document.createElement("i");n.className="fa fa-arrows",t.appendChild(n);var r=document.createElement("button");r.classList.add("jupyter-widgets"),r.classList.add("jupyter-button"),r.classList.add("widget-button"),r.setAttribute("data-toggle","tooltip"),r.setAttribute("title","Reset"),r.onclick=function(t){t.preventDefault(),e.model.reset()};var i=document.createElement("i");i.className="fa fa-refresh",r.appendChild(i);var o=document.createElement("button");o.classList.add("jupyter-widgets"),o.classList.add("jupyter-button"),o.classList.add("widget-button"),o.setAttribute("data-toggle","tooltip"),o.setAttribute("title","Save"),o.onclick=function(t){t.preventDefault(),e.model.save_png()};var s=document.createElement("i");s.className="fa fa-save",o.appendChild(s),this.el.appendChild(t),this.el.appendChild(r),this.el.appendChild(o),this._panzoom=t,this.update()},update:function(){this.model.get("_panning")?this._panzoom.classList.add("mod-active"):this._panzoom.classList.remove("mod-active")}});e.exports={Toolbar:a,ToolbarModel:s}},function(e,t,n){n(1);var r=n(0),i=n(20),o=i.MarkModel.extend({defaults:function(){return r.extend({},i.MarkModel.prototype.defaults,{_model_name:"GraphModel",_view_name:"Graph",x:[],y:[],color:null,hovered_point:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:[]})},initialize:function(){o.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y","color","link_color","node_data","link_data","link_color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()},update_node_data:function(){var e=this.get("node_data"),t=this.get_typed_field("x"),n=this.get_typed_field("y"),r=this.get_typed_field("color"),i=this.get("scales"),o=(i.x,i.y,i.color);e.length>0&&"string"==typeof e[0]&&(e=e.map((function(e){return{label:e}}))),this.mark_data=[];var s=this;e.forEach((function(e,t){e.label=e.label||"N"+t,e.label_display=e.label_display||"center",e.shape=e.shape||"circle",e.shape_attrs=function(e,t){var n={};switch(e){case"circle":n.r=t.r||15;break;case"rect":n.width=t.width||25,n.height=t.height||.8*n.width,n.rx=t.rx||0,n.ry=t.ry||0;break;case"ellipse":n.rx=t.rx||20,n.ry=t.ry||.6*n.rx;break;default:console.log("Invalid shape passed - ",e)}return n}(e.shape,e.shape_attrs||{}),e.value=e.value||null,s.mark_data.push(e)})),0!==t.length&&0!==n.length&&(o&&(this.get("preserve_domain").color?o.del_domain([],this.model_id+"_color"):o.compute_and_set_domain(r,this.model_id+"_color")),this.mark_data.forEach((function(e,i){e.xval=t[i],e.yval=n[i],e.color=r[i]})))},update_link_data:function(){var e=this.get("scales").link_color;this.link_data=this.get("link_data");var t=this.get_typed_field("link_matrix"),n=this.get_typed_field("link_color"),r=this;void 0!==e&&n.length>0&&(t=n),0===this.link_data.length&&t.length>0&&t.forEach((function(e,t){e.forEach((function(e,n){null!==e&&r.link_data.push({source:t,target:n,value:e})}))}))},update_data:function(){this.dirty=!0,this.update_node_data(),this.update_link_data(),this.update_unique_ids(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")},update_unique_ids:function(){},get_data_dict:function(e,t){return e},update_domains:function(){var e={x:"xval",y:"yval"};if(this.mark_data){var t=this.get("scales");for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];this.get("preserve_domain")[n]?r.del_domain([],this.model_id+n):r.compute_and_set_domain(this.mark_data.map((function(t){return t[n]||t[e[n]]})),this.model_id+n)}}}});e.exports={GraphModel:o}},function(e,t,n){var r=n(1),i=n(0),o=n(13),s=n(19).Mark.extend({render:function(){var e=s.__super__.render.apply(this),t=this;return this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.selected_indices=this.model.get("selected"),this.hovered_style=this.model.get("hovered_style"),this.unhovered_style=this.model.get("unhovered_style"),this.hovered_index=this.model.get("hovered_point")?[this.model.get("hovered_point")]:null,this.display_el_classes=["element"],this.event_metadata={mouse_over:{msg_name:"hover",lookup_data:!1,hit_test:!0},element_clicked:{msg_name:"element_click",lookup_data:!1,hit_test:!0},parent_clicked:{msg_name:"background_click",hit_test:!1}},this.displayed.then((function(){t.parent.tooltip_div.node().appendChild(t.tooltip_div.node()),t.create_tooltip()})),this.d3el.attr("class","network"),this.arrow=this.parent.svg.append("defs").append("marker").attr("id","arrow").attr("refX",0).attr("refY",3).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("path").attr("class","linkarrow").attr("d","M0,0 L0,6 L9,3 z"),e.then((function(){t.event_listeners={},t.process_interactions(),t.create_listeners(),t.compute_view_padding(),t.draw()}))},set_ranges:function(){var e=this.scales.x,t=this.scales.y;e&&e.set_range(this.parent.padded_range("x",e.model)),t&&t.set_range(this.parent.padded_range("y",t.model))},set_positional_scales:function(){this.x_scale=this.scales.x,this.y_scale=this.scales.y,this.x_scale||(this.x_scale=this.parent.scale_x),this.y_scale||(this.y_scale=this.parent.scale_y),this.listenTo(this.x_scale,"domain_changed",(function(){this.model.dirty||this.update_position()})),this.listenTo(this.y_scale,"domain_changed",(function(){this.model.dirty||this.update_position()}))},relayout:function(){this.set_ranges(),this.update_position()},update_position:function(){var e=this.scales.x,t=this.scales.y;this.set_ranges();e&&t&&(this.model.mark_data.forEach((function(n){n.x=e.scale(n.xval)+e.offset,n.y=t.scale(n.yval)+t.offset})),this.force_layout&&(this.force_layout.nodes(this.model.mark_data).links(this.model.link_data).start(),this.links&&this.links.data(this.force_layout.links()),this.nodes&&this.nodes.data(this.force_layout.nodes()),this.nodes&&this.links&&this.tick()))},initialize_additional_scales:function(){var e=this.scales.color;e&&(this.listenTo(e,"domain_changed",(function(){this.color_scale_updated()})),e.on("color_scale_range_changed",this.color_scale_updated,this));var t=this.scales.link_color;t&&this.listenTo(t,"domain_changed",(function(){this.link_color_scale_updated()}))},create_listeners:function(){s.__super__.create_listeners.apply(this),this.d3el.on("mouseover",i.bind((function(){this.event_dispatcher("mouse_over")}),this)).on("mousemove",i.bind((function(){this.event_dispatcher("mouse_move")}),this)).on("mouseout",i.bind((function(){this.event_dispatcher("mouse_out")}),this)),this.listenTo(this.model,"change:charge",this.update_charge),this.listenTo(this.model,"change:link_distance",this.update_link_distance),this.listenTo(this.model,"data_updated",this.data_updated,this),this.listenTo(this.model,"change:tooltip",this.create_tooltip,this),this.listenTo(this.model,"change:enable_hover",(function(){this.hide_tooltip()}),this),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:hovered_point",this.update_hovered),this.listenTo(this.model,"change:hovered_style",this.hovered_style_updated,this),this.listenTo(this.model,"change:unhovered_style",this.unhovered_style_updated,this),this.listenTo(this.parent,"bg_clicked",(function(){this.event_dispatcher("parent_clicked")}))},data_updated:function(){this.draw(),this.relayout()},get_node_color:function(e,t){var n=this.scales.color,r=this.model.get("colors"),i=r.length;return n&&void 0!==e.color?n.scale(e.color):r[t%i]},draw:function(){this.set_ranges();var e=this.scales.x,t=this.scales.y,n=(this.scales.color,this.scales.link_color);this.d3el.selectAll(".node").remove(),this.d3el.selectAll(".link").remove(),this.force_layout=r.layout.force().size([this.parent.width,this.parent.height]).linkDistance(this.model.get("link_distance")),e&&t&&this.model.mark_data.forEach((function(n){n.x=e.scale(n.xval)+e.offset,n.y=t.scale(n.yval)+t.offset})),this.force_layout.nodes(this.model.mark_data).links(this.model.link_data),e||t||this.force_layout.charge(this.model.get("charge")).on("tick",i.bind(this.tick,this)).start();var o=this.model.get("directed");this.links=this.d3el.selectAll(".link").data(this.force_layout.links()).enter().append("path").attr("class","link").style("stroke",(function(e){return n?n.scale(e.value):null})).style("stroke-width",(function(e){return e.link_width})).attr("marker-mid",o?"url(#arrow)":null);var s=this;this.nodes=this.d3el.selectAll(".node").data(this.force_layout.nodes()).enter().append("g").attr("class","node").call(this.force_layout.drag),this.nodes.append((function(e){return document.createElementNS(r.ns.prefix.svg,e.shape)})).attr("class","element").each((function(e){var t=r.select(this);for(var n in e.shape_attrs)t.attr(n,e.shape_attrs[n])})).style("fill",(function(e,t){return s.get_node_color(e,t)})),this.nodes.append("text").attr("class","label").attr("text-anchor",(function(e){return"center"===e.label_display?"middle":"start"})).attr("x",(function(e){var t=0;if("outside"===e.label_display)switch(e.shape){case"rect":t=e.shape_attrs.width/2+5;break;case"circle":t=e.shape_attrs.r+5;break;case"ellipse":t=e.shape_attrs.rx+5;break;default:t=0}return t})).attr("y",".31em").text((function(e){return e.label})).style("display",(function(e){return"none"===e.label_display?"none":"inline"})),this.nodes.on("click",i.bind((function(e,t){this.event_dispatcher("element_clicked",{data:e,index:t})}),this)),this.nodes.on("mouseover",i.bind((function(e,t){this.hover_handler({data:e,index:t})}),this)),this.nodes.on("mouseout",i.bind((function(){this.reset_hover()}),this))},color_scale_updated:function(){var e=this;this.nodes.selectAll(".element").style("fill",(function(t,n){return e.get_node_color(t,n)}))},link_color_scale_updated:function(){var e=this.scales.link_color;this.links.style("stroke",(function(t){return e?e.scale(t.value):null}))},process_interactions:function(){var e=this.model.get("interactions");i.isEmpty(e)?this.reset_interactions():(void 0!==e.click&&null!==e.click?"tooltip"===e.click?(this.event_listeners.element_clicked=function(){return this.refresh_tooltip(!0)},this.event_listeners.parent_clicked=this.hide_tooltip):"select"==e.click&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler):this.reset_click(),void 0!==e.hover&&null!==e.hover?"tooltip"===e.hover&&(this.event_listeners.mouse_over=this.refresh_tooltip,this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=this.hide_tooltip):this.reset_hover())},reset_hover:function(){this.links.style("opacity",1),this.model.set("hovered_point",null),this.hovered_index=null,this.touch()},hover_handler:function(e){var t=e.data,n=e.index;this.model.get("highlight_links")?this.links.style("opacity",(function(e){return e.source.label===t.label||e.target.label===t.label?1:.1})):this.links.style("opacity",1),this.model.set("hovered_point",n,{updated_view:this}),this.touch()},reset_selection:function(){this.model.set("selected",null),this.selected_indices=null,this.touch()},click_handler:function(e){e.data;var t=e.index,n=this.model.get("selected"),i=n?o.deepCopy(n):[],s=i.indexOf(t),a=r.event.ctrlKey||r.event.metaKey;s>-1&&a?i.splice(s,1):a?i.push(t):(i=[]).push(t),this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch(),r.event||(r.event=window.event);var l=r.event;void 0!==l.cancelBubble&&(l.cancelBubble=!0),l.stopPropagation&&l.stopPropagation(),l.preventDefault()},hovered_style_updated:function(e,t){this.hovered_style=t,this.clear_style(e.previous("hovered_style"),this.hovered_index),this.style_updated(t,this.hovered_index)},unhovered_style_updated:function(e,t){this.unhovered_style=t;var n=this.hovered_index,r=n?i.range(this.model.mark_data.length).filter((function(e){return-1===n.indexOf(e)})):[];this.clear_style(e.previous("unhovered_style"),r),this.style_updated(t,r)},update_selected:function(e,t){this.selected_indices=t,this.apply_styles()},update_hovered:function(e,t){this.hovered_index=null===t?t:[t],this.apply_styles()},apply_styles:function(e){null==e&&(e=[this.selected_style,this.unselected_style,this.hovered_style,this.unhovered_style]),s.__super__.apply_styles.apply(this,[e]);var t=i.range(this.model.mark_data.length);this.set_style_on_elements(this.hovered_style,this.hovered_index);var n=this.hovered_index?i.difference(t,this.hovered_index):[];this.set_style_on_elements(this.unhovered_style,n)},clear_style:function(e,t){var n=this.d3el.selectAll(".element");t&&(n=n.filter((function(e,n){return-1!==t.indexOf(n)})));var r={};for(var i in e)r[i]=null;n.style(r)},set_style_on_elements:function(e,t){if(t&&0!==t.length&&(void 0===e||0!==Object.keys(e).length)){var n=this.d3el.selectAll(".element");(n=n.filter((function(e,n){return-1!==t.indexOf(n)}))).style(e)}},compute_view_padding:function(){var e=r.max(this.model.mark_data.map((function(e){return(e.shape_attrs.r||e.shape_attrs.width/2||e.shape_attrs.rx)+1}))),t=r.max(this.model.mark_data.map((function(e){return(e.shape_attrs.r||e.shape_attrs.height/2||e.shape_attrs.ry)+1})));e===this.x_padding&&t===this.y_padding||(this.x_padding=e,this.y_padding=e,this.trigger("mark_padding_updated"))},selected_deleter:function(){r.event.stopPropagation()},update_link_distance:function(){var e=this.scales.x,t=this.scales.y,n=this.model.get("link_distance");e||t||this.force_layout.linkDistance(n).start()},update_charge:function(){var e=this.scales.x,t=this.scales.y,n=this.model.get("charge");e||t||this.force_layout.charge(n).start()},link_arc:function(e){var t=e.target.x-e.source.x,n=e.target.y-e.source.y,r=Math.sqrt(t*t+n*n);return"M"+e.source.x+","+e.source.y+"A"+r+","+r+" 0 0,1 "+e.target.x+","+e.target.y},link_line:function(e){var t=(e.source.x+e.target.x)/2,n=(e.source.y+e.target.y)/2;return"M"+e.source.x+","+e.source.y+"L"+t+","+n+"L"+e.target.x+","+e.target.y},link_slant_line:function(e){var t=(e.source.x+e.target.x)/2;return"M"+e.source.x+","+e.source.y+"L"+t+","+e.target.y+"L"+e.target.x+","+e.target.y},tick:function(){var e=this.model.get("link_type");this.nodes.attr("transform",(function(e){return"translate("+e.x+","+e.y+")"})),this.nodes.select("rect").attr("transform",(function(e){return"translate("+-e.shape_attrs.width/2+","+-e.shape_attrs.height/2+")"}));var t=this.link_arc;switch(e){case"arc":t=this.link_arc;break;case"line":t=this.link_line;break;case"slant_line":t=this.link_slant_line;break;default:t=this.link_arc}this.links.attr("d",(function(e){return t(e)}))}});e.exports={Graph:s}},function(e,t,n){n(1);var r=n(19),i=(n(13),n(0),r.Mark.extend({render:function(){var e=i.__super__.render.apply(this),t=this.d3el||this.el;window.last_el=t,window.last_image=this,this.im=t.append("image").attr("x",0).attr("y",0).attr("width",1).attr("height",1).attr("preserveAspectRatio","none"),this.update_image();var n=this;return e.then((function(){n.create_listeners(),n.listenTo(n.parent,"margin_updated",(function(){n.draw()}))}))},set_positional_scales:function(){var e=this.scales.x,t=this.scales.y;this.listenTo(e,"domain_changed",(function(){this.model.dirty||this.draw()})),this.listenTo(t,"domain_changed",(function(){this.model.dirty||this.draw()}))},set_ranges:function(){var e=this.scales.x,t=this.scales.y;e&&e.set_range(this.parent.padded_range("x",e.model)),t&&t.set_range(this.parent.padded_range("y",t.model))},create_listeners:function(){i.__super__.create_listeners.apply(this),this.listenTo(this.model,"change:image",this.update_image,this),this.listenTo(this.model,"data_updated",(function(){this.draw(!0)}),this)},update_image:function(){this.im.attr("href")&&URL.revokeObjectURL(this.im.attr("href"));var e=this.model.get("image"),t=new Blob([e.get("value")],{type:"image/"+e.get("format")}),n=URL.createObjectURL(t);this.im.attr("href",n)},remove:function(){URL.revokeObjectURL(this.im.attr("href")),i.__super__.remove.apply(this)},relayout:function(){this.draw(!0)},draw:function(e){this.set_ranges();var t=this.scales.x?this.scales.x:this.parent.scale_x,n=this.scales.y?this.scales.y:this.parent.scale_y,r=e?this.parent.model.get("animation_duration"):0,i=this.d3el||this.el,o=this.model.mark_data.x.map(t.scale),s=this.model.mark_data.y.map(n.scale);i.selectAll("image").transition().duration(r).attr("transform",(function(e){return"translate("+(o[0]+t.offset)+","+(s[1]+n.offset)+") scale("+(o[1]-o[0])+", "+(s[0]-s[1])+")"}))}}));e.exports={Image:i}},function(e,t,n){var r=n(9),i=(n(1),n(0)),o=n(20),s=o.MarkModel.extend({defaults:function(){return i.extend(o.MarkModel.prototype.defaults(),{_model_name:"ImageModel",_view_name:"Image",x:1,y:1,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}}})},initialize:function(){s.__super__.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()},update_data:function(){this.mark_data={x:this.get_typed_field("x"),y:this.get_typed_field("y")},this.update_domains(),this.trigger("data_updated")},update_domains:function(){if(this.mark_data){var e=this.get("scales"),t=e.x,n=e.y;t&&(this.get("preserve_domain").x?t.del_domain([],this.model_id+"_x"):t.compute_and_set_domain(this.mark_data.x,this.model_id+"_x")),n&&(this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"))}}},{serializers:i.extend({image:{deserialize:r.unpack_models}},o.MarkModel.serializers)});e.exports={ImageModel:s}},function(e,t,n){var r=n(554);"string"==typeof r&&(r=[[e.i,r,""]]);var i={transform:void 0};n(40)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(555),""),t.i(n(557),""),t.push([e.i,"/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n",""])},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(556),""),t.push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/*\nThis file is copied from the JupyterLab project to define default styling for\nwhen the widget styling is compiled down to eliminate CSS variables. We make one\nchange - we comment out the font import below.\n*/\n\n/*\nThe following CSS variables define the main, public API for styling JupyterLab.\nThese variables should be used by all plugins wherever possible. In other\nwords, plugins should not define custom colors, sizes, etc unless absolutely\nnecessary. This enables users to change the visual theme of JupyterLab\nby changing these variables.\n\nMany variables appear in an ordered sequence (0,1,2,3). These sequences\nare designed to work well together, so for example, `--jp-border-color1` should\nbe used with `--jp-layout-color1`. The numbers have the following meanings:\n\n* 0: super-primary, reserved for special emphasis\n* 1: primary, most important under normal situations\n* 2: secondary, next most important under normal situations\n* 3: tertiary, next most important under normal situations\n\nThroughout JupyterLab, we are mostly following principles from Google's\nMaterial Design when selecting colors. We are not, however, following\nall of MD as it is not optimized for dense, information rich UIs.\n*/\n\n\n/*\n * Optional monospace font for input/output prompt.\n */\n /* Commented out in ipywidgets since we don't need it. */\n/* @import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); */\n\n/*\n * Added for compabitility with output area\n */\n:root {\n --jp-icon-search: none;\n --jp-ui-select-caret: none;\n}\n\n\n:root {\n\n /* Borders\n\n The following variables, specify the visual styling of borders in JupyterLab.\n */\n\n --jp-border-width: 1px;\n --jp-border-color0: var(--md-grey-700);\n --jp-border-color1: var(--md-grey-500);\n --jp-border-color2: var(--md-grey-300);\n --jp-border-color3: var(--md-grey-100);\n\n /* UI Fonts\n\n The UI font CSS variables are used for the typography all of the JupyterLab\n user interface elements that are not directly user generated content.\n */\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n --jp-ui-icon-font-size: 14px; /* Ensures px perfect FontAwesome icons */\n --jp-ui-font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n\n /* Use these font colors against the corresponding main layout colors.\n In a light theme, these go from dark to light.\n */\n\n --jp-ui-font-color0: rgba(0,0,0,1.0);\n --jp-ui-font-color1: rgba(0,0,0,0.8);\n --jp-ui-font-color2: rgba(0,0,0,0.5);\n --jp-ui-font-color3: rgba(0,0,0,0.3);\n\n /* Use these against the brand/accent/warn/error colors.\n These will typically go from light to darker, in both a dark and light theme\n */\n\n --jp-inverse-ui-font-color0: rgba(255,255,255,1);\n --jp-inverse-ui-font-color1: rgba(255,255,255,1.0);\n --jp-inverse-ui-font-color2: rgba(255,255,255,0.7);\n --jp-inverse-ui-font-color3: rgba(255,255,255,0.5);\n\n /* Content Fonts\n\n Content font variables are used for typography of user generated content.\n */\n\n --jp-content-font-size: 13px;\n --jp-content-line-height: 1.5;\n --jp-content-font-color0: black;\n --jp-content-font-color1: black;\n --jp-content-font-color2: var(--md-grey-700);\n --jp-content-font-color3: var(--md-grey-500);\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n\n --jp-code-font-size: 13px;\n --jp-code-line-height: 1.307;\n --jp-code-padding: 5px;\n --jp-code-font-family: monospace;\n\n\n /* Layout\n\n The following are the main layout colors use in JupyterLab. In a light\n theme these would go from light to dark.\n */\n\n --jp-layout-color0: white;\n --jp-layout-color1: white;\n --jp-layout-color2: var(--md-grey-200);\n --jp-layout-color3: var(--md-grey-400);\n\n /* Brand/accent */\n\n --jp-brand-color0: var(--md-blue-700);\n --jp-brand-color1: var(--md-blue-500);\n --jp-brand-color2: var(--md-blue-300);\n --jp-brand-color3: var(--md-blue-100);\n\n --jp-accent-color0: var(--md-green-700);\n --jp-accent-color1: var(--md-green-500);\n --jp-accent-color2: var(--md-green-300);\n --jp-accent-color3: var(--md-green-100);\n\n /* State colors (warn, error, success, info) */\n\n --jp-warn-color0: var(--md-orange-700);\n --jp-warn-color1: var(--md-orange-500);\n --jp-warn-color2: var(--md-orange-300);\n --jp-warn-color3: var(--md-orange-100);\n\n --jp-error-color0: var(--md-red-700);\n --jp-error-color1: var(--md-red-500);\n --jp-error-color2: var(--md-red-300);\n --jp-error-color3: var(--md-red-100);\n\n --jp-success-color0: var(--md-green-700);\n --jp-success-color1: var(--md-green-500);\n --jp-success-color2: var(--md-green-300);\n --jp-success-color3: var(--md-green-100);\n\n --jp-info-color0: var(--md-cyan-700);\n --jp-info-color1: var(--md-cyan-500);\n --jp-info-color2: var(--md-cyan-300);\n --jp-info-color3: var(--md-cyan-100);\n\n /* Cell specific styles */\n\n --jp-cell-padding: 5px;\n --jp-cell-editor-background: #f7f7f7;\n --jp-cell-editor-border-color: #cfcfcf;\n --jp-cell-editor-background-edit: var(--jp-ui-layout-color1);\n --jp-cell-editor-border-color-edit: var(--jp-brand-color1);\n --jp-cell-prompt-width: 100px;\n --jp-cell-prompt-font-family: 'Roboto Mono', monospace;\n --jp-cell-prompt-letter-spacing: 0px;\n --jp-cell-prompt-opacity: 1.0;\n --jp-cell-prompt-opacity-not-active: 0.4;\n --jp-cell-prompt-font-color-not-active: var(--md-grey-700);\n /* A custom blend of MD grey and blue 600\n * See https://meyerweb.com/eric/tools/color-blend/#546E7A:1E88E5:5:hex */\n --jp-cell-inprompt-font-color: #307FC1;\n /* A custom blend of MD grey and orange 600\n * https://meyerweb.com/eric/tools/color-blend/#546E7A:F4511E:5:hex */\n --jp-cell-outprompt-font-color: #BF5B3D;\n\n /* Notebook specific styles */\n\n --jp-notebook-padding: 10px;\n --jp-notebook-scroll-padding: 100px;\n\n /* Console specific styles */\n\n --jp-console-background: var(--md-grey-100);\n\n /* Toolbar specific styles */\n\n --jp-toolbar-border-color: var(--md-grey-400);\n --jp-toolbar-micro-height: 8px;\n --jp-toolbar-background: var(--jp-layout-color0);\n --jp-toolbar-box-shadow: 0px 0px 2px 0px rgba(0,0,0,0.24);\n --jp-toolbar-header-margin: 4px 4px 0px 4px;\n --jp-toolbar-active-background: var(--md-grey-300);\n}\n",""])},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,'/**\n * The material design colors are adapted from google-material-color v1.2.6\n * https://github.com/danlevan/google-material-color\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/dist/palette.var.css\n *\n * The license for the material design color CSS variables is as follows (see\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/LICENSE)\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 Dan Le Van\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the "Software"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n:root {\n --md-red-50: #FFEBEE;\n --md-red-100: #FFCDD2;\n --md-red-200: #EF9A9A;\n --md-red-300: #E57373;\n --md-red-400: #EF5350;\n --md-red-500: #F44336;\n --md-red-600: #E53935;\n --md-red-700: #D32F2F;\n --md-red-800: #C62828;\n --md-red-900: #B71C1C;\n --md-red-A100: #FF8A80;\n --md-red-A200: #FF5252;\n --md-red-A400: #FF1744;\n --md-red-A700: #D50000;\n\n --md-pink-50: #FCE4EC;\n --md-pink-100: #F8BBD0;\n --md-pink-200: #F48FB1;\n --md-pink-300: #F06292;\n --md-pink-400: #EC407A;\n --md-pink-500: #E91E63;\n --md-pink-600: #D81B60;\n --md-pink-700: #C2185B;\n --md-pink-800: #AD1457;\n --md-pink-900: #880E4F;\n --md-pink-A100: #FF80AB;\n --md-pink-A200: #FF4081;\n --md-pink-A400: #F50057;\n --md-pink-A700: #C51162;\n\n --md-purple-50: #F3E5F5;\n --md-purple-100: #E1BEE7;\n --md-purple-200: #CE93D8;\n --md-purple-300: #BA68C8;\n --md-purple-400: #AB47BC;\n --md-purple-500: #9C27B0;\n --md-purple-600: #8E24AA;\n --md-purple-700: #7B1FA2;\n --md-purple-800: #6A1B9A;\n --md-purple-900: #4A148C;\n --md-purple-A100: #EA80FC;\n --md-purple-A200: #E040FB;\n --md-purple-A400: #D500F9;\n --md-purple-A700: #AA00FF;\n\n --md-deep-purple-50: #EDE7F6;\n --md-deep-purple-100: #D1C4E9;\n --md-deep-purple-200: #B39DDB;\n --md-deep-purple-300: #9575CD;\n --md-deep-purple-400: #7E57C2;\n --md-deep-purple-500: #673AB7;\n --md-deep-purple-600: #5E35B1;\n --md-deep-purple-700: #512DA8;\n --md-deep-purple-800: #4527A0;\n --md-deep-purple-900: #311B92;\n --md-deep-purple-A100: #B388FF;\n --md-deep-purple-A200: #7C4DFF;\n --md-deep-purple-A400: #651FFF;\n --md-deep-purple-A700: #6200EA;\n\n --md-indigo-50: #E8EAF6;\n --md-indigo-100: #C5CAE9;\n --md-indigo-200: #9FA8DA;\n --md-indigo-300: #7986CB;\n --md-indigo-400: #5C6BC0;\n --md-indigo-500: #3F51B5;\n --md-indigo-600: #3949AB;\n --md-indigo-700: #303F9F;\n --md-indigo-800: #283593;\n --md-indigo-900: #1A237E;\n --md-indigo-A100: #8C9EFF;\n --md-indigo-A200: #536DFE;\n --md-indigo-A400: #3D5AFE;\n --md-indigo-A700: #304FFE;\n\n --md-blue-50: #E3F2FD;\n --md-blue-100: #BBDEFB;\n --md-blue-200: #90CAF9;\n --md-blue-300: #64B5F6;\n --md-blue-400: #42A5F5;\n --md-blue-500: #2196F3;\n --md-blue-600: #1E88E5;\n --md-blue-700: #1976D2;\n --md-blue-800: #1565C0;\n --md-blue-900: #0D47A1;\n --md-blue-A100: #82B1FF;\n --md-blue-A200: #448AFF;\n --md-blue-A400: #2979FF;\n --md-blue-A700: #2962FF;\n\n --md-light-blue-50: #E1F5FE;\n --md-light-blue-100: #B3E5FC;\n --md-light-blue-200: #81D4FA;\n --md-light-blue-300: #4FC3F7;\n --md-light-blue-400: #29B6F6;\n --md-light-blue-500: #03A9F4;\n --md-light-blue-600: #039BE5;\n --md-light-blue-700: #0288D1;\n --md-light-blue-800: #0277BD;\n --md-light-blue-900: #01579B;\n --md-light-blue-A100: #80D8FF;\n --md-light-blue-A200: #40C4FF;\n --md-light-blue-A400: #00B0FF;\n --md-light-blue-A700: #0091EA;\n\n --md-cyan-50: #E0F7FA;\n --md-cyan-100: #B2EBF2;\n --md-cyan-200: #80DEEA;\n --md-cyan-300: #4DD0E1;\n --md-cyan-400: #26C6DA;\n --md-cyan-500: #00BCD4;\n --md-cyan-600: #00ACC1;\n --md-cyan-700: #0097A7;\n --md-cyan-800: #00838F;\n --md-cyan-900: #006064;\n --md-cyan-A100: #84FFFF;\n --md-cyan-A200: #18FFFF;\n --md-cyan-A400: #00E5FF;\n --md-cyan-A700: #00B8D4;\n\n --md-teal-50: #E0F2F1;\n --md-teal-100: #B2DFDB;\n --md-teal-200: #80CBC4;\n --md-teal-300: #4DB6AC;\n --md-teal-400: #26A69A;\n --md-teal-500: #009688;\n --md-teal-600: #00897B;\n --md-teal-700: #00796B;\n --md-teal-800: #00695C;\n --md-teal-900: #004D40;\n --md-teal-A100: #A7FFEB;\n --md-teal-A200: #64FFDA;\n --md-teal-A400: #1DE9B6;\n --md-teal-A700: #00BFA5;\n\n --md-green-50: #E8F5E9;\n --md-green-100: #C8E6C9;\n --md-green-200: #A5D6A7;\n --md-green-300: #81C784;\n --md-green-400: #66BB6A;\n --md-green-500: #4CAF50;\n --md-green-600: #43A047;\n --md-green-700: #388E3C;\n --md-green-800: #2E7D32;\n --md-green-900: #1B5E20;\n --md-green-A100: #B9F6CA;\n --md-green-A200: #69F0AE;\n --md-green-A400: #00E676;\n --md-green-A700: #00C853;\n\n --md-light-green-50: #F1F8E9;\n --md-light-green-100: #DCEDC8;\n --md-light-green-200: #C5E1A5;\n --md-light-green-300: #AED581;\n --md-light-green-400: #9CCC65;\n --md-light-green-500: #8BC34A;\n --md-light-green-600: #7CB342;\n --md-light-green-700: #689F38;\n --md-light-green-800: #558B2F;\n --md-light-green-900: #33691E;\n --md-light-green-A100: #CCFF90;\n --md-light-green-A200: #B2FF59;\n --md-light-green-A400: #76FF03;\n --md-light-green-A700: #64DD17;\n\n --md-lime-50: #F9FBE7;\n --md-lime-100: #F0F4C3;\n --md-lime-200: #E6EE9C;\n --md-lime-300: #DCE775;\n --md-lime-400: #D4E157;\n --md-lime-500: #CDDC39;\n --md-lime-600: #C0CA33;\n --md-lime-700: #AFB42B;\n --md-lime-800: #9E9D24;\n --md-lime-900: #827717;\n --md-lime-A100: #F4FF81;\n --md-lime-A200: #EEFF41;\n --md-lime-A400: #C6FF00;\n --md-lime-A700: #AEEA00;\n\n --md-yellow-50: #FFFDE7;\n --md-yellow-100: #FFF9C4;\n --md-yellow-200: #FFF59D;\n --md-yellow-300: #FFF176;\n --md-yellow-400: #FFEE58;\n --md-yellow-500: #FFEB3B;\n --md-yellow-600: #FDD835;\n --md-yellow-700: #FBC02D;\n --md-yellow-800: #F9A825;\n --md-yellow-900: #F57F17;\n --md-yellow-A100: #FFFF8D;\n --md-yellow-A200: #FFFF00;\n --md-yellow-A400: #FFEA00;\n --md-yellow-A700: #FFD600;\n\n --md-amber-50: #FFF8E1;\n --md-amber-100: #FFECB3;\n --md-amber-200: #FFE082;\n --md-amber-300: #FFD54F;\n --md-amber-400: #FFCA28;\n --md-amber-500: #FFC107;\n --md-amber-600: #FFB300;\n --md-amber-700: #FFA000;\n --md-amber-800: #FF8F00;\n --md-amber-900: #FF6F00;\n --md-amber-A100: #FFE57F;\n --md-amber-A200: #FFD740;\n --md-amber-A400: #FFC400;\n --md-amber-A700: #FFAB00;\n\n --md-orange-50: #FFF3E0;\n --md-orange-100: #FFE0B2;\n --md-orange-200: #FFCC80;\n --md-orange-300: #FFB74D;\n --md-orange-400: #FFA726;\n --md-orange-500: #FF9800;\n --md-orange-600: #FB8C00;\n --md-orange-700: #F57C00;\n --md-orange-800: #EF6C00;\n --md-orange-900: #E65100;\n --md-orange-A100: #FFD180;\n --md-orange-A200: #FFAB40;\n --md-orange-A400: #FF9100;\n --md-orange-A700: #FF6D00;\n\n --md-deep-orange-50: #FBE9E7;\n --md-deep-orange-100: #FFCCBC;\n --md-deep-orange-200: #FFAB91;\n --md-deep-orange-300: #FF8A65;\n --md-deep-orange-400: #FF7043;\n --md-deep-orange-500: #FF5722;\n --md-deep-orange-600: #F4511E;\n --md-deep-orange-700: #E64A19;\n --md-deep-orange-800: #D84315;\n --md-deep-orange-900: #BF360C;\n --md-deep-orange-A100: #FF9E80;\n --md-deep-orange-A200: #FF6E40;\n --md-deep-orange-A400: #FF3D00;\n --md-deep-orange-A700: #DD2C00;\n\n --md-brown-50: #EFEBE9;\n --md-brown-100: #D7CCC8;\n --md-brown-200: #BCAAA4;\n --md-brown-300: #A1887F;\n --md-brown-400: #8D6E63;\n --md-brown-500: #795548;\n --md-brown-600: #6D4C41;\n --md-brown-700: #5D4037;\n --md-brown-800: #4E342E;\n --md-brown-900: #3E2723;\n\n --md-grey-50: #FAFAFA;\n --md-grey-100: #F5F5F5;\n --md-grey-200: #EEEEEE;\n --md-grey-300: #E0E0E0;\n --md-grey-400: #BDBDBD;\n --md-grey-500: #9E9E9E;\n --md-grey-600: #757575;\n --md-grey-700: #616161;\n --md-grey-800: #424242;\n --md-grey-900: #212121;\n\n --md-blue-grey-50: #ECEFF1;\n --md-blue-grey-100: #CFD8DC;\n --md-blue-grey-200: #B0BEC5;\n --md-blue-grey-300: #90A4AE;\n --md-blue-grey-400: #78909C;\n --md-blue-grey-500: #607D8B;\n --md-blue-grey-600: #546E7A;\n --md-blue-grey-700: #455A64;\n --md-blue-grey-800: #37474F;\n --md-blue-grey-900: #263238;\n}',""])},function(e,t,n){(t=e.exports=n(25)(!1)).i(n(558),""),t.push([e.i,'/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n/*\n * We assume that the CSS variables in\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\n * have been defined.\n */\n\n:root {\n --jp-widgets-color: var(--jp-content-font-color1);\n --jp-widgets-label-color: var(--jp-widgets-color);\n --jp-widgets-readout-color: var(--jp-widgets-color);\n --jp-widgets-font-size: var(--jp-ui-font-size1);\n --jp-widgets-margin: 2px;\n --jp-widgets-inline-height: 28px;\n --jp-widgets-inline-width: 300px;\n --jp-widgets-inline-width-short: calc(var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-width-tiny: calc(var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\n --jp-widgets-inline-label-width: 80px;\n --jp-widgets-border-width: var(--jp-border-width);\n --jp-widgets-vertical-height: 200px;\n --jp-widgets-horizontal-tab-height: 24px;\n --jp-widgets-horizontal-tab-width: 144px;\n --jp-widgets-horizontal-tab-top-border: 2px;\n --jp-widgets-progress-thickness: 20px;\n --jp-widgets-container-padding: 15px;\n --jp-widgets-input-padding: 4px;\n --jp-widgets-radio-item-height-adjustment: 8px;\n --jp-widgets-radio-item-height: calc(var(--jp-widgets-inline-height) - var(--jp-widgets-radio-item-height-adjustment));\n --jp-widgets-slider-track-thickness: 4px;\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\n --jp-widgets-slider-handle-size: 16px;\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\n --jp-widgets-menu-item-height: 24px;\n --jp-widgets-dropdown-arrow: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg");\n --jp-widgets-input-color: var(--jp-ui-font-color1);\n --jp-widgets-input-background-color: var(--jp-layout-color1);\n --jp-widgets-input-border-color: var(--jp-border-color1);\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\n --jp-widgets-disabled-opacity: 0.6;\n\n /* From Material Design Lite */\n --md-shadow-key-umbra-opacity: 0.2;\n --md-shadow-key-penumbra-opacity: 0.14;\n --md-shadow-ambient-shadow-opacity: 0.12;\n}\n\n.jupyter-widgets {\n margin: var(--jp-widgets-margin);\n box-sizing: border-box;\n color: var(--jp-widgets-color);\n overflow: visible;\n}\n\n.jupyter-widgets.jupyter-widgets-disconnected::before {\n line-height: var(--jp-widgets-inline-height);\n height: var(--jp-widgets-inline-height);\n}\n\n.jp-Output-result > .jupyter-widgets {\n margin-left: 0;\n margin-right: 0;\n}\n\n/* vbox and hbox */\n\n.widget-inline-hbox {\n /* Horizontal widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: row;\n align-items: baseline;\n}\n\n.widget-inline-vbox {\n /* Vertical Widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.widget-box {\n box-sizing: border-box;\n display: flex;\n margin: 0;\n overflow: auto;\n}\n\n.widget-gridbox {\n box-sizing: border-box;\n display: grid;\n margin: 0;\n overflow: auto;\n}\n\n.widget-hbox {\n flex-direction: row;\n}\n\n.widget-vbox {\n flex-direction: column;\n}\n\n/* General Button Styling */\n\n.jupyter-button {\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 0px;\n padding-bottom: 0px;\n display: inline-block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n font-size: var(--jp-widgets-font-size);\n cursor: pointer;\n\n height: var(--jp-widgets-inline-height);\n border: 0px solid;\n line-height: var(--jp-widgets-inline-height);\n box-shadow: none;\n\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color2);\n border-color: var(--jp-border-color2);\n border: none;\n user-select: none;\n}\n\n.jupyter-button i.fa {\n margin-right: var(--jp-widgets-inline-margin);\n pointer-events: none;\n}\n\n.jupyter-button:empty:before {\n content: "\\200B"; /* zero-width space */\n}\n\n.jupyter-widgets.jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n.jupyter-button i.fa.center {\n margin-right: 0;\n}\n\n.jupyter-button:hover:enabled, .jupyter-button:focus:enabled {\n /* MD Lite 2dp shadow */\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\n}\n\n.jupyter-button:active, .jupyter-button.mod-active {\n /* MD Lite 4dp shadow */\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color3);\n}\n\n.jupyter-button:focus:enabled {\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\n}\n\n/* Button "Primary" Styling */\n\n.jupyter-button.mod-primary {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-brand-color1);\n}\n\n.jupyter-button.mod-primary.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n.jupyter-button.mod-primary:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n/* Button "Success" Styling */\n\n.jupyter-button.mod-success {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-success-color1);\n}\n\n.jupyter-button.mod-success.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n.jupyter-button.mod-success:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n /* Button "Info" Styling */\n\n.jupyter-button.mod-info {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-info-color1);\n}\n\n.jupyter-button.mod-info.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n.jupyter-button.mod-info:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n/* Button "Warning" Styling */\n\n.jupyter-button.mod-warning {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-warn-color1);\n}\n\n.jupyter-button.mod-warning.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n.jupyter-button.mod-warning:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n/* Button "Danger" Styling */\n\n.jupyter-button.mod-danger {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-error-color1);\n}\n\n.jupyter-button.mod-danger.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n.jupyter-button.mod-danger:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n/* Widget Button, Widget Toggle Button, Widget Upload */\n\n.widget-button, .widget-toggle-button, .widget-upload {\n width: var(--jp-widgets-inline-width-short);\n}\n\n/* Widget Label Styling */\n\n/* Override Bootstrap label css */\n.jupyter-widgets label {\n margin-bottom: initial;\n}\n\n.widget-label-basic {\n /* Basic Label */\n color: var(--jp-widgets-label-color);\n font-size: var(--jp-widgets-font-size);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-label {\n /* Label */\n color: var(--jp-widgets-label-color);\n font-size: var(--jp-widgets-font-size);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-inline-hbox .widget-label {\n /* Horizontal Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: right;\n margin-right: calc( var(--jp-widgets-inline-margin) * 2 );\n width: var(--jp-widgets-inline-label-width);\n flex-shrink: 0;\n}\n\n.widget-inline-vbox .widget-label {\n /* Vertical Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: center;\n line-height: var(--jp-widgets-inline-height);\n}\n\n/* Widget Readout Styling */\n\n.widget-readout {\n color: var(--jp-widgets-readout-color);\n font-size: var(--jp-widgets-font-size);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n overflow: hidden;\n white-space: nowrap;\n text-align: center;\n}\n\n.widget-readout.overflow {\n /* Overflowing Readout */\n\n /* From Material Design Lite\n shadow-key-umbra-opacity: 0.2;\n shadow-key-penumbra-opacity: 0.14;\n shadow-ambient-shadow-opacity: 0.12;\n */\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n}\n\n.widget-inline-hbox .widget-readout {\n /* Horizontal Readout */\n text-align: center;\n max-width: var(--jp-widgets-inline-width-short);\n min-width: var(--jp-widgets-inline-width-tiny);\n margin-left: var(--jp-widgets-inline-margin);\n}\n\n.widget-inline-vbox .widget-readout {\n /* Vertical Readout */\n margin-top: var(--jp-widgets-inline-margin);\n /* as wide as the widget */\n width: inherit;\n}\n\n/* Widget Checkbox Styling */\n\n.widget-checkbox {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-checkbox input[type="checkbox"] {\n margin: 0px calc( var(--jp-widgets-inline-margin) * 2 ) 0px 0px;\n line-height: var(--jp-widgets-inline-height);\n font-size: large;\n flex-grow: 1;\n flex-shrink: 0;\n align-self: center;\n}\n\n/* Widget Valid Styling */\n\n.widget-valid {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width-short);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-valid i:before {\n line-height: var(--jp-widgets-inline-height);\n margin-right: var(--jp-widgets-inline-margin);\n margin-left: var(--jp-widgets-inline-margin);\n\n /* from the fa class in FontAwesome: https://github.com/FortAwesome/Font-Awesome/blob/49100c7c3a7b58d50baa71efef11af41a66b03d3/css/font-awesome.css#L14 */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.widget-valid.mod-valid i:before {\n content: "\\F00C";\n color: green;\n}\n\n.widget-valid.mod-invalid i:before {\n content: "\\F00D";\n color: red;\n}\n\n.widget-valid.mod-valid .widget-valid-readout {\n display: none;\n}\n\n/* Widget Text and TextArea Stying */\n\n.widget-textarea, .widget-text {\n width: var(--jp-widgets-inline-width);\n}\n\n.widget-text input[type="text"], .widget-text input[type="number"]{\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-text input[type="text"]:disabled, .widget-text input[type="number"]:disabled, .widget-textarea textarea:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n.widget-text input[type="text"], .widget-text input[type="number"], .widget-textarea textarea {\n box-sizing: border-box;\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n flex-grow: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n outline: none !important;\n}\n \n.widget-text input[type="text"], .widget-textarea textarea {\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2);\n}\n\n.widget-text input[type="number"] {\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding) calc(var(--jp-widgets-input-padding) * 2);\n}\n\n.widget-textarea textarea {\n height: inherit;\n width: inherit;\n}\n\n.widget-text input:focus, .widget-textarea textarea:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n/* Widget Slider */\n\n.widget-slider .ui-slider {\n /* Slider Track */\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\n background: var(--jp-layout-color3);\n box-sizing: border-box;\n position: relative;\n border-radius: 0px;\n}\n\n.widget-slider .ui-slider .ui-slider-handle {\n /* Slider Handle */\n outline: none !important; /* focused slider handles are colored - see below */\n position: absolute;\n background-color: var(--jp-widgets-slider-handle-background-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-handle-border-color);\n box-sizing: border-box;\n z-index: 1;\n background-image: none; /* Override jquery-ui */\n}\n\n/* Override jquery-ui */\n.widget-slider .ui-slider .ui-slider-handle:hover, .widget-slider .ui-slider .ui-slider-handle:focus {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\n}\n\n.widget-slider .ui-slider .ui-slider-handle:active {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border-color: var(--jp-widgets-slider-active-handle-color);\n z-index: 2;\n transform: scale(1.2);\n}\n\n.widget-slider .ui-slider .ui-slider-range {\n /* Interval between the two specified value of a double slider */\n position: absolute;\n background: var(--jp-widgets-slider-active-handle-color);\n z-index: 0;\n}\n\n/* Shapes of Slider Handles */\n\n.widget-hslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n margin-left: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n top: 0;\n}\n\n.widget-vslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n left: 0;\n}\n\n.widget-hslider .ui-slider .ui-slider-range {\n height: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n.widget-vslider .ui-slider .ui-slider-range {\n width: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n/* Horizontal Slider */\n\n.widget-hslider {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n\n /* Override the align-items baseline. This way, the description and readout\n still seem to align their baseline properly, and we don\'t have to have\n align-self: stretch in the .slider-container. */\n align-items: center;\n}\n\n.widgets-slider .slider-container {\n overflow: visible;\n}\n\n.widget-hslider .slider-container {\n height: var(--jp-widgets-inline-height);\n margin-left: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-right: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n flex: 1 1 var(--jp-widgets-inline-width-short);\n}\n\n.widget-hslider .ui-slider {\n /* Inner, invisible slide div */\n height: var(--jp-widgets-slider-track-thickness);\n margin-top: calc((var(--jp-widgets-inline-height) - var(--jp-widgets-slider-track-thickness)) / 2);\n width: 100%;\n}\n\n/* Vertical Slider */\n\n.widget-vbox .widget-label {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-vslider {\n /* Vertical Slider */\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vslider .slider-container {\n flex: 1 1 var(--jp-widgets-inline-width-short);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-top: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n display: flex;\n flex-direction: column;\n}\n\n.widget-vslider .ui-slider-vertical {\n /* Inner, invisible slide div */\n width: var(--jp-widgets-slider-track-thickness);\n flex-grow: 1;\n margin-left: auto;\n margin-right: auto;\n}\n\n/* Widget Progress Styling */\n\n.progress-bar {\n -webkit-transition: none;\n -moz-transition: none;\n -ms-transition: none;\n -o-transition: none;\n transition: none;\n}\n\n.progress-bar {\n height: var(--jp-widgets-inline-height);\n}\n\n.progress-bar {\n background-color: var(--jp-brand-color1);\n}\n\n.progress-bar-success {\n background-color: var(--jp-success-color1);\n}\n\n.progress-bar-info {\n background-color: var(--jp-info-color1);\n}\n\n.progress-bar-warning {\n background-color: var(--jp-warn-color1);\n}\n\n.progress-bar-danger {\n background-color: var(--jp-error-color1);\n}\n\n.progress {\n background-color: var(--jp-layout-color2);\n border: none;\n box-shadow: none;\n}\n\n/* Horisontal Progress */\n\n.widget-hprogress {\n /* Progress Bar */\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width);\n align-items: center;\n\n}\n\n.widget-hprogress .progress {\n flex-grow: 1;\n margin-top: var(--jp-widgets-input-padding);\n margin-bottom: var(--jp-widgets-input-padding);\n align-self: stretch;\n /* Override bootstrap style */\n height: initial;\n}\n\n/* Vertical Progress */\n\n.widget-vprogress {\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vprogress .progress {\n flex-grow: 1;\n width: var(--jp-widgets-progress-thickness);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 0;\n}\n\n/* Select Widget Styling */\n\n.widget-dropdown {\n height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-dropdown > select {\n padding-right: 20px;\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-radius: 0;\n height: inherit;\n flex: 1 1 var(--jp-widgets-inline-width-short);\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n box-sizing: border-box;\n outline: none !important;\n box-shadow: none;\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n vertical-align: top;\n padding-left: calc( var(--jp-widgets-input-padding) * 2);\n\tappearance: none;\n\t-webkit-appearance: none;\n\t-moz-appearance: none;\n background-repeat: no-repeat;\n\tbackground-size: 20px;\n\tbackground-position: right center;\n background-image: var(--jp-widgets-dropdown-arrow);\n}\n.widget-dropdown > select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-dropdown > select:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* To disable the dotted border in Firefox around select controls.\n See http://stackoverflow.com/a/18853002 */\n.widget-dropdown > select:-moz-focusring {\n color: transparent;\n text-shadow: 0 0 0 #000;\n}\n\n/* Select and SelectMultiple */\n\n.widget-select {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n\n /* Because Firefox defines the baseline of a select as the bottom of the\n control, we align the entire control to the top and add padding to the\n select to get an approximate first line baseline alignment. */\n align-items: flex-start;\n}\n\n.widget-select > select {\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n flex: 1 1 var(--jp-widgets-inline-width-short);\n outline: none !important;\n overflow: auto;\n height: inherit;\n\n /* Because Firefox defines the baseline of a select as the bottom of the\n control, we align the entire control to the top and add padding to the\n select to get an approximate first line baseline alignment. */\n padding-top: 5px;\n}\n\n.widget-select > select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.wiget-select > select > option {\n padding-left: var(--jp-widgets-input-padding);\n line-height: var(--jp-widgets-inline-height);\n /* line-height doesn\'t work on some browsers for select options */\n padding-top: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n padding-bottom: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n}\n\n\n\n/* Toggle Buttons Styling */\n\n.widget-toggle-buttons {\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-toggle-buttons .widget-toggle-button {\n margin-left: var(--jp-widgets-margin);\n margin-right: var(--jp-widgets-margin);\n}\n\n.widget-toggle-buttons .jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Radio Buttons Styling */\n\n.widget-radio {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-radio-box {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n box-sizing: border-box;\n flex-grow: 1;\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\n}\n\n.widget-radio-box label {\n height: var(--jp-widgets-radio-item-height);\n line-height: var(--jp-widgets-radio-item-height);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-radio-box input {\n height: var(--jp-widgets-radio-item-height);\n line-height: var(--jp-widgets-radio-item-height);\n margin: 0 calc( var(--jp-widgets-input-padding) * 2 ) 0 1px;\n float: left;\n}\n\n/* Color Picker Styling */\n\n.widget-colorpicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-colorpicker > .widget-colorpicker-input {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-colorpicker input[type="color"] {\n width: var(--jp-widgets-inline-height);\n height: var(--jp-widgets-inline-height);\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-left: none;\n flex-grow: 0;\n flex-shrink: 0;\n box-sizing: border-box;\n align-self: stretch;\n outline: none !important;\n}\n\n.widget-colorpicker.concise input[type="color"] {\n border-left: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n}\n\n.widget-colorpicker input[type="color"]:focus, .widget-colorpicker input[type="text"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-colorpicker input[type="text"] {\n flex-grow: 1;\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n box-sizing: border-box;\n}\n\n.widget-colorpicker input[type="text"]:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Date Picker Styling */\n\n.widget-datepicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-datepicker input[type="date"] {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n box-sizing: border-box;\n}\n\n.widget-datepicker input[type="date"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-datepicker input[type="date"]:invalid {\n border-color: var(--jp-warn-color1);\n}\n\n.widget-datepicker input[type="date"]:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Play Widget */\n\n.widget-play {\n width: var(--jp-widgets-inline-width-short);\n display: flex;\n align-items: stretch;\n}\n\n.widget-play .jupyter-button {\n flex-grow: 1;\n height: auto;\n}\n\n.widget-play .jupyter-button:disabled {\n opacity: var(--jp-widgets-disabled-opacity);\n}\n\n/* Tab Widget */\n\n.jupyter-widgets.widget-tab {\n display: flex;\n flex-direction: column;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\n overflow-x: visible;\n overflow-y: visible;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content {\n /* Make sure that the tab grows from bottom up */\n align-items: flex-end;\n min-width: 0;\n min-height: 0;\n}\n\n.jupyter-widgets.widget-tab > .widget-tab-contents {\n width: 100%;\n box-sizing: border-box;\n margin: 0;\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n padding: var(--jp-widgets-container-padding);\n flex-grow: 1;\n overflow: auto;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width));\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab {\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\n min-width: 35px;\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width));\n line-height: var(--jp-widgets-horizontal-tab-height);\n margin-left: calc(-1 * var(--jp-border-width));\n padding: 0px 10px;\n background: var(--jp-layout-color2);\n color: var(--jp-ui-font-color2);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n border-bottom: none;\n position: relative;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current {\n color: var(--jp-ui-font-color0);\n /* We want the background to match the tab content background */\n background: var(--jp-layout-color1);\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width));\n transform: translateY(var(--jp-border-width));\n overflow: visible;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before {\n position: absolute;\n top: calc(-1 * var(--jp-border-width));\n left: calc(-1 * var(--jp-border-width));\n content: \'\';\n height: var(--jp-widgets-horizontal-tab-top-border);\n width: calc(100% + 2 * var(--jp-border-width));\n background: var(--jp-brand-color1);\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child {\n margin-left: 0;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:hover:not(.p-mod-current) {\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-mod-closable > .p-TabBar-tabCloseIcon {\n margin-left: 4px;\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-mod-closable > .p-TabBar-tabCloseIcon:before {\n font-family: FontAwesome;\n content: \'\\F00D\'; /* close */\n}\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon {\n line-height: var(--jp-widgets-horizontal-tab-height);\n}\n\n/* Accordion Widget */\n\n.p-Collapse {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Collapse-header {\n padding: var(--jp-widgets-input-padding);\n cursor: pointer;\n color: var(--jp-ui-font-color2);\n background-color: var(--jp-layout-color2);\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3) var(--jp-widgets-container-padding);\n font-weight: bold;\n}\n\n.p-Collapse-header:hover {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.p-Collapse-open > .p-Collapse-header {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color0);\n cursor: default;\n border-bottom: none;\n}\n\n.p-Collapse .p-Collapse-header::before {\n content: \'\\F0DA\\A0\'; /* caret-right, non-breaking space */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.p-Collapse-open > .p-Collapse-header::before {\n content: \'\\F0D7\\A0\'; /* caret-down, non-breaking space */\n}\n\n.p-Collapse-contents {\n padding: var(--jp-widgets-container-padding);\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n overflow: auto;\n}\n\n.p-Accordion {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Accordion .p-Collapse {\n margin-bottom: 0;\n}\n\n.p-Accordion .p-Collapse + .p-Collapse {\n margin-top: 4px;\n}\n\n\n\n/* HTML widget */\n\n.widget-html, .widget-htmlmath {\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-html > .widget-html-content, .widget-htmlmath > .widget-html-content {\n /* Fill out the area in the HTML widget */\n align-self: stretch;\n flex-grow: 1;\n flex-shrink: 1;\n /* Makes sure the baseline is still aligned with other elements */\n line-height: var(--jp-widgets-inline-height);\n /* Make it possible to have absolutely-positioned elements in the html */\n position: relative;\n}\n\n\n/* Image widget */\n\n.widget-image {\n max-width: 100%;\n height: auto;\n}\n',""])},function(e,t,n){(e.exports=n(25)(!1)).push([e.i,"/* This file has code derived from PhosphorJS CSS files, as noted below. The license for this PhosphorJS code is:\n\nCopyright (c) 2014-2017, PhosphorJS Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n*/\n\n/*\n * The following section is derived from https://github.com/phosphorjs/phosphor/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \n * We've scoped the rules so that they are consistent with exactly our code.\n */\n\n.jupyter-widgets.widget-tab > .p-TabBar {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'] {\n flex-direction: row;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'] {\n flex-direction: column;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex: 1 1 auto;\n list-style-type: none;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'] > .p-TabBar-content {\n flex-direction: row;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'] > .p-TabBar-content {\n flex-direction: column;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon,\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon {\n flex: 0 0 auto;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel {\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden {\n display: none !important;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab {\n position: relative;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging[data-orientation='horizontal'] .p-TabBar-tab {\n left: 0;\n transition: left 150ms ease;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging[data-orientation='vertical'] .p-TabBar-tab {\n top: 0;\n transition: top 150ms ease;\n}\n\n\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab.p-mod-dragging {\n transition: none;\n}\n\n/* End tabbar.css */\n",""])},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"OutputModel",(function(){return T})),n.d(r,"OutputView",(function(){return P}));n(208),n(213),n(218),n(229),n(232);var i=n(204),o=n.n(i),s=n(14),a=n(205),l=n(108),c=n(5),u=n(9),h=n(206);const d=window.j1;var p,f,g,m={},_=!1;const v=e=>(e.includes("localhost")?"ws:":"wss:")+e.split(":").slice(1).join(":"),y=()=>document.querySelectorAll(".code_cell"),b=e=>e.querySelector(".input_area").textContent.trim(),w=e=>null!==e.querySelector(".output_widget_view"),x=(e=document)=>e.querySelectorAll(".js-nbinteract-widget"),k=(e,t=document)=>{x(t).forEach(t=>{t.innerHTML=e})},E=(e=document)=>{x(e).forEach(e=>e.remove())},S=async(e,t)=>{if(!s.KernelMessage.isDisplayDataMsg(e))return!1;const n=e.content.data["application/vnd.jupyter.widget-view+json"];if(void 0===n||2!==n.version_major)return!1;const r=async()=>{try{p=await t.get_model(n.model_id),f=JSON.stringify(p),document.querySelectorAll(".output_wrapper").length,g=document.querySelectorAll(".widget-vbox").length}finally{m.type="command",m.action="info",m.text="Displaying widget finished on id: "+f,d.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",m),_||g||(_=!0,console.error("nbinteract-core.util\n render the first widget failed"),m.type="command",m.action="error",m.text="Widget initialization failed.",d.sendMessage("nbinteract-core.util","j1.adapter.nbinteract",m)),!_&&g>=1&&(_=!0,m.type="command",m.action="info",m.text="First widget successfully rendered ...",d.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",m))}};window.setTimeout((function(){r()}),250);return await t.get_model(n.model_id)};var M=n(72),C=n(55),j=n(54);const A=new j.RenderMimeRegistry({initialFactories:j.standardRendererFactories});class T extends M.OutputModel{defaults(){const e=super.defaults();return e.msg_id="",e}initialize(e,t){super.initialize(e,t),this._outputs=new C.OutputAreaModel({trusted:!0}),this.listenTo(this,"change:msg_id",this.reset_msg_id),this.reset_msg_id()}reset_msg_id(){this._msgHook&&this._msgHook.dispose(),this._msgHook=null;let e=this.widget_manager.kernel;this.get("msg_id")&&e&&(this._msgHook=e.registerMessageHook(this.get("msg_id"),e=>(this.add(e),!1)))}add(e){let t=e.header.msg_type;switch(t){case"execute_result":case"display_data":case"stream":case"error":let n=e.content;n.output_type=t,this._outputs.add(n);break;case"clear_output":this.clear_output(e.content.wait)}}clear_output(e=!1){this._outputs.clear(e)}get outputs(){return this._outputs}}class P extends M.OutputView{_createElement(e){return this.pWidget=new c.Panel,this.pWidget.node}_setElement(e){if(this.el||e!==this.pWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.pWidget.node}render(){this._outputView=new C.OutputArea({rendermime:A,contentFactory:C.OutputArea.defaultContentFactory,model:this.model.outputs}),this.pWidget.insertWidget(0,this._outputView),this.pWidget.addClass("jupyter-widgets"),this.pWidget.addClass("widget-output"),this.update()}remove(){return this._outputView.dispose(),super.remove()}}n(553);class O extends a.HTMLManager{constructor(e){super(),this.generateWidgets=this.generateWidgets.bind(this),this._displayWidget=this._displayWidget.bind(this),this.setKernel(e)}setKernel(e){Object.values(this._models).forEach(async e=>{(await e).close(!0)}),this._models={},this.kernel&&this.kernel.dispose(),this.kernel=e,this._registerKernel(e)}generateWidgets(){y().forEach((e,t)=>{const n=b(e);this.kernel.requestExecute({code:n}).onIOPub=t=>this._displayWidget(e,t)})}async _displayWidget(e,t){if((e=>"error"===e.msg_type)(t)){const n=b(e),r=t.content.traceback.join("\n").replace(/\u001b\[.*?m/g,"");console.warn(`${n}\n${r}`.trim()),w(e)&&((e,t=document)=>{x(t).forEach(t=>{t.disabled=!0;const n=document.createElement("pre");n.innerText=e,n.style.cssText="text-align: left; font-size: 0.9em;",t.innerHTML="",t.appendChild(n)})})(r,e)}if(!w(e))return;const n=await S(t,this);if(n){E();const r=(e=>e.querySelector(".output_widget_view"))(e);this.display_model(t,n,{el:r})}}_registerKernel(e){this._commRegistration&&this._commRegistration.dispose(),e&&(this._commRegistration=e.registerCommTarget(this.comm_target_name,(e,t)=>{this.handle_comm_open(new u.shims.services.Comm(e),t)}))}display_view(e,t,{el:n}){return Promise.resolve(t).then(e=>(c.Widget.attach(e.pWidget,n),e.on("remove",()=>{console.log("View removed",e)}),e))}_create_comm(e,t,n,r){const i=this.kernel.connectToComm(e,t);return(n||r)&&i.open(n,r),Promise.resolve(new u.shims.services.Comm(i))}_get_comm_info(){return this.kernel.requestCommInfo({target:this.comm_target_name}).then(e=>e.content.comms)}loadClass(e,t,n){return"@jupyter-widgets/controls"===t?Promise.resolve(l[e]):"@jupyter-widgets/base"===t?Promise.resolve(u[e]):"@jupyter-widgets/output"===t?Promise.resolve(r[e]):"bqplot"===t?Promise.resolve(h[e]):new Promise((function(e,n){window.require([t],e,n)})).then((function(n){return n[e]?n[e]:Promise.reject("Class "+e+" not found in module "+t)}))}}const L=new Set(["*","failed","built","waiting","building","fetching","pushing","launching","ready"]);var I={};class D{constructor({spec:e,baseUrl:t,provider:n,callbacks:r={},nbUrl:i=!1,logger:o=!1,j1API:s=!1}={}){this.baseUrl=t,this.provider=n,this.spec=e,this.nbUrl=i,this.logger=o,this.j1=s,this.callbacks=r,this.state=null,this.registerCallback("*",(e,t,n)=>{void 0!==n.message?(n.message.includes("Insufficent nodes")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Insufficent nodes avaialble at BinderHub",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),n.message.includes("Too many users")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Too many users on this BinderHub",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),n.message.includes("ImagePullBackOff")&&(this.logger.error("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="error",I.text="Error: ImagePullBackOff",this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)),this.logger.info("\nbinderhub.registerCallback: messages sent by Binder: "+n.message.slice(0,-1)),I.type="command",I.action="info",I.text=n.message.slice(0,-1),this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I)):(this.logger.info("\nbinderhub.registerCallback: messages sent by Binder: "+n.slice(0,-1)),I.type="command",I.action="info",I.text=n.slice(0,-1),this.j1.sendMessage("binderhub.registerCallback","j1.adapter.nbinteract",I))})}apiUrl(){return`${this.baseUrl}/build/${this.provider}/${this.spec}`}startServer(){return this.nbUrl?Promise.resolve({url:this.nbUrl}):new Promise((e,t)=>{const n=new EventSource(this.apiUrl());n.onerror=e=>{var r=JSON.stringify(e);this.logger.error("\nbinderhub.startServer: stopping nbinteract, failed to connect to Binder: "+r),I.type="command",I.action="error",I.text="failed to connect to Binder:\n"+r,this.j1.sendMessage("binderhub.startServer","j1.adapter.nbinteract",I),n.close(),t(new Error(e))},n.onmessage=e=>{const t=JSON.parse(e.data);t.phase&&this.changeState(t.phase.toLowerCase(),t)},this.registerCallback("failed",(e,r,i)=>{this.logger.error("\nbinderhub.startServer: Failed to build Binder image:\n"+i.message.slice(0,-1)),n.close(),t(new Error(i))}),this.registerCallback("ready",(t,r,i)=>{this.logger.info("\nbinderhub.startServer: Binder server is ready, continue ..."),n.close(),e(i)})})}registerCallback(e,t){L.has(e)?void 0===this.callbacks[e]?this.callbacks[e]=[t]:this.callbacks[e].push(t):this.logger.error("\nbinderhub.registerCallback: tried to register callback on invalid state: "+e)}changeState(e,t){[e,"*"].map(n=>{const r=this.callbacks[n];r&&r.forEach(n=>n(this.state,e,t))}),e&&(this.state=e)}}var R={};class B{constructor({spec:e="SamLau95/nbinteract-image/master",baseUrl:t="https://mybinder.org",provider:n="gh",nbUrl:r=!1,logger:i=!1,j1API:s=!1,debug:a=!1}={}){this.logger=i,this.j1=s,this.run=o()(this.run,500,{leading:!0,trailing:!1}),this._kernelHeartbeat=this._kernelHeartbeat.bind(this),this.binder=new D({spec:e,baseUrl:t,provider:n,nbUrl:r,logger:i,j1API:s}),this.kernel=null,this.manager=null}async prepare(){this.logger.debug("\nnbinteract.prepare: nbinteract core is being initialized"),k("Show widgets"),this.binder.registerCallback("failed",(e,t,n)=>{R.type="command",R.action="error",R.text="Error, try refreshing the page:<br> "+n.message,this.j1.sendMessage("nbinteract-core.prepare","j1.adapter.nbinteract",R)}),this.runIfKernelExists()}async run(){k("Initializing widgets ..."),R.type="command",R.action="info",R.text="Initializing widgets ...",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),0===y().length&&E();const e=!this.kernel||!this.manager;try{this.kernel=await this._getOrStartKernel(),this.manager=this.manager||new O(this.kernel),this.manager.generateWidgets(),R.type="command",R.action="info",R.text="Widget initialization started ...",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),R.type="command",R.action="nbi_init_started",R.text="nbinteract initialization finished.",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R),e&&this._kernelHeartbeat()}catch(e){this.logger.info("\nnbinteract-core.run: widget initialization failed"),R.type="command",R.action="error",R.text="Widget initialization failed.",this.j1.sendMessage("nbinteract-core.run","j1.adapter.nbinteract",R)}}async runIfKernelExists(){try{await this._getKernelModel()}catch(e){return this.logger.info("\nnbinteract.runIfKernelExists: no kernel, stopping the runIfKernelExists() call.\nuse the run() method to automatically start a kernel if needed"),void this.run()}this.run()}async _kernelHeartbeat(e=5){try{await this._getKernelModel()}catch(e){this.logger.info("\nnbinteract.kernelHeartbeat: looks like the kernel has died"),this.logger.info("\nnbinteract.kernelHeartbeat: starting a new kernel ..."),R.type="command",R.action="info",R.text="Seems the kernel has died, starting a new kernel ...",this.j1.sendMessage("nbinteract-core.kernelHeartbeat","j1.adapter.nbinteract",R);const t=await this._startKernel();this.kernel=t,this.manager.setKernel(t),this.manager.generateWidgets()}finally{setTimeout(this._kernelHeartbeat,5e3*e)}}async _getOrStartKernel(){if(this.kernel)return this.kernel;try{const e=await this._getKernel(),t=e._id;return this.logger.info("\nnbinteract.getOrStartKernel: connected to cached kernel: "+t),R.type="command",R.action="info",R.text="Connected to cached kernel ...",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R),e}catch(e){e.toString();this.logger.info("\nnbinteract.getOrStartKernel: no cached kernel found."),this.logger.info("\nnbinteract.getOrStartKernel: starting new kernel on BinderHub ..."),R.type="command",R.action="info",R.text="No cached kernel found.",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R),R.type="command",R.action="info",R.text="Starting new kernel on BinderHub ...",this.j1.sendMessage("nbinteract-core.getOrStartKernel","j1.adapter.nbinteract",R);return await this._startKernel()}}async _getKernel(){const{serverSettings:e,kernelModel:t}=await this._getKernelModel();return await s.Kernel.connectTo(t,e)}async _getKernelModel(){const e=localStorage.getItem("serverParams"),t=localStorage.getItem("kernelId"),{url:n,token:r}=JSON.parse(e);const i=s.ServerConnection.makeSettings({baseUrl:n,wsUrl:v(n),token:r});return{serverSettings:i,kernelModel:await s.Kernel.findById(t,i)}}async _startKernel(){try{const{url:e,token:t}=await this.binder.startServer(),n=s.ServerConnection.makeSettings({baseUrl:e,wsUrl:v(e),token:t}),r=await s.Kernel.getSpecs(n),i=await s.Kernel.startNew({name:r.default,serverSettings:n});return localStorage.setItem("serverParams",JSON.stringify({url:e,token:t})),localStorage.setItem("kernelId",i.id),this.logger.info("\nnbinteract-core.startKernel: started kernel: "+i.id),R.type="command",R.action="info",R.text="Kernel successfully started.",this.j1.sendMessage("nbinteract-core.startKernel","j1.adapter.nbinteract",R),i}catch(e){this.logger.error("\nnbinteract-core: startKernel, initialization kernel failed"),R.type="command",R.action="error",R.text="Initialization of the kernel failed.",this.j1.sendMessage("nbinteract-core.startKernel","j1.adapter.nbinteract",R)}}async _killKernel(){return(await this._getKernel()).shutdown()}}"undefined"!=typeof window&&(window.NbInteract=B);t.default=B}]);
94
94
  //# sourceMappingURL=nbinteract-core.js.map