SaulLu's picture
add static component
42be5b8
raw
history blame
17 kB
/*! For license information please see main.29a7bf42.chunk.js.LICENSE.txt */
(this.webpackJsonpstreamlit_component_template=this.webpackJsonpstreamlit_component_template||[]).push([[0],{18:function(e,_,t){"use strict";t.d(_,"b",(function(){return v})),t.d(_,"c",(function(){return E})),t.d(_,"a",(function(){return g}));var a,r=t(0),n=t(4),o=t(2),s=t(3),i=t(36),l=t.n(i),u=t(12),m=t.n(u),b=t(10),c=t(37),d=t(24),p=function(){function e(_,t,a,n){var o=this;Object(r.a)(this,e),this.dataTable=void 0,this.indexTable=void 0,this.columnsTable=void 0,this.styler=void 0,this.getCell=function(e,_){var t=e<o.headerRows&&_<o.headerColumns,a=e>=o.headerRows&&_<o.headerColumns,r=e<o.headerRows&&_>=o.headerColumns;if(t){var n=["blank"];return _>0&&n.push("level"+e),{type:"blank",classNames:n.join(" "),content:""}}if(r){var s=_-o.headerColumns;return{type:"columns",classNames:["col_heading","level"+e,"col"+s].join(" "),content:o.getContent(o.columnsTable,s,e)}}if(a){var i=e-o.headerRows,l=["row_heading","level"+_,"row"+i];return{type:"index",id:"T_".concat(o.uuid,"level").concat(_,"_row").concat(i),classNames:l.join(" "),content:o.getContent(o.indexTable,i,_)}}var u=e-o.headerRows,m=_-o.headerColumns,b=["data","row"+u,"col"+m],c=o.styler?o.getContent(o.styler.displayValuesTable,u,m):o.getContent(o.dataTable,u,m);return{type:"data",id:"T_".concat(o.uuid,"row").concat(u,"_col").concat(m),classNames:b.join(" "),content:c}},this.getContent=function(e,_,t){var a=e.getColumnAt(t);if(null===a)return"";switch(o.getColumnTypeId(e,t)){case d.b.Timestamp:return o.nanosToDate(a.get(_));default:return a.get(_)}},this.dataTable=d.a.from(_),this.indexTable=d.a.from(t),this.columnsTable=d.a.from(a),this.styler=n?{caption:n.get("caption"),displayValuesTable:d.a.from(n.get("displayValues")),styles:n.get("styles"),uuid:n.get("uuid")}:void 0}return Object(n.a)(e,[{key:"rows",get:function(){return this.indexTable.length+this.columnsTable.numCols}},{key:"columns",get:function(){return this.indexTable.numCols+this.columnsTable.length}},{key:"headerRows",get:function(){return this.rows-this.dataRows}},{key:"headerColumns",get:function(){return this.columns-this.dataColumns}},{key:"dataRows",get:function(){return this.dataTable.length}},{key:"dataColumns",get:function(){return this.dataTable.numCols}},{key:"uuid",get:function(){return this.styler&&this.styler.uuid}},{key:"caption",get:function(){return this.styler&&this.styler.caption}},{key:"styles",get:function(){return this.styler&&this.styler.styles}},{key:"table",get:function(){return this.dataTable}},{key:"index",get:function(){return this.indexTable}},{key:"columnTable",get:function(){return this.columnsTable}},{key:"getColumnTypeId",value:function(e,_){return e.schema.fields[_].type.typeId}},{key:"nanosToDate",value:function(e){return new Date(e/1e6)}}]),e}();!function(e){e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight"}(a||(a={}));var g=function e(){Object(r.a)(this,e)};g.API_VERSION=1,g.RENDER_EVENT="streamlit:render",g.events=new c.a,g.registeredMessageListener=!1,g.lastFrameHeight=void 0,g.setComponentReady=function(){g.registeredMessageListener||(window.addEventListener("message",g.onMessageEvent),g.registeredMessageListener=!0),g.sendBackMsg(a.COMPONENT_READY,{apiVersion:g.API_VERSION})},g.setFrameHeight=function(e){void 0===e&&(e=document.body.scrollHeight+10),e!==g.lastFrameHeight&&(g.lastFrameHeight=e,g.sendBackMsg(a.SET_FRAME_HEIGHT,{height:e}))},g.setComponentValue=function(e){g.sendBackMsg(a.SET_COMPONENT_VALUE,{value:e})},g.onMessageEvent=function(e){switch(e.data.type){case g.RENDER_EVENT:g.onRenderMessage(e.data)}},g.onRenderMessage=function(e){var _=e.args;null==_&&(console.error("Got null args in onRenderMessage. This should never happen"),_={});var t=e.dfs&&e.dfs.length>0?g.argsDataframeToObject(e.dfs):{};_=Object(b.a)(Object(b.a)({},_),t);var a={disabled:Boolean(e.disabled),args:_},r=new CustomEvent(g.RENDER_EVENT,{detail:a});g.events.dispatchEvent(r)},g.argsDataframeToObject=function(e){var _=e.map((function(e){var _=e.key,t=e.value;return[_,g.toArrowTable(t)]}));return Object.fromEntries(_)},g.toArrowTable=function(e){var _=e.data,t=_.data,a=_.index,r=_.columns;return new p(t,a,r)},g.sendBackMsg=function(e,_){window.parent.postMessage(Object(b.a)({isStreamlitMessage:!0,type:e},_),"*")};var v=function(e){Object(o.a)(t,e);var _=Object(s.a)(t);function t(){return Object(r.a)(this,t),_.apply(this,arguments)}return Object(n.a)(t,[{key:"componentDidMount",value:function(){g.setFrameHeight()}},{key:"componentDidUpdate",value:function(){g.setFrameHeight()}}]),t}(m.a.PureComponent);function E(e){var _=function(_){Object(o.a)(a,_);var t=Object(s.a)(a);function a(_){var n;return Object(r.a)(this,a),(n=t.call(this,_)).componentDidMount=function(){g.events.addEventListener(g.RENDER_EVENT,n.onRenderEvent),g.setComponentReady()},n.componentDidUpdate=function(e){null!=n.state.componentError&&g.setFrameHeight()},n.componentWillUnmount=function(){g.events.removeEventListener(g.RENDER_EVENT,n.onRenderEvent)},n.onRenderEvent=function(e){var _=e;n.setState({renderData:_.detail})},n.render=function(){return null!=n.state.componentError?m.a.createElement("div",null,m.a.createElement("h1",null,"Component Error"),m.a.createElement("span",null,n.state.componentError.message)):null==n.state.renderData?null:m.a.createElement(e,{width:window.innerWidth,disabled:n.state.renderData.disabled,args:n.state.renderData.args})},n.state={renderData:void 0,componentError:void 0},n}return a}(m.a.PureComponent);return _.getDerivedStateFromError=function(e){return{componentError:e}},l()(_,e)}},35:function(module,__webpack_exports__,__webpack_require__){"use strict";var _mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(8),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(5),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(0),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(2),_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(3),react__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(12),react__WEBPACK_IMPORTED_MODULE_8___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_8__),_streamlit__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(18),_observablehq_runtime__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(30),Observable=function(_StreamlitComponentBa){Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_6__.a)(Observable,_StreamlitComponentBa);var _super=Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_7__.a)(Observable);function Observable(){var e;Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_4__.a)(this,Observable);for(var _=arguments.length,t=new Array(_),a=0;a<_;a++)t[a]=arguments[a];return(e=_super.call.apply(_super,[this].concat(t))).observeValue={},e.notebookRef=react__WEBPACK_IMPORTED_MODULE_8___default.a.createRef(),e.runtime=null,e.main=null,e.render=function(){return react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{border:"1px solid gray",borderRadius:"4px"}},react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{padding:"9px 12px"}},react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{ref:e.notebookRef})),react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{marginTop:"4px"}},react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{backgroundColor:"#ddd",fontWeight:700,padding:".25rem .5rem",borderRadius:"0 0 4px 4px",gridTemplateColumns:"auto auto",display:"grid"}},react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{textAlign:"left"}},e.props.args.name),react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("div",{style:{textAlign:"right"}},react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement("a",{href:"https://observablehq.com/".concat(e.props.args.notebook),style:{color:"#666"}},e.props.args.notebook)))))},e}return Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_5__.a)(Observable,[{key:"componentWillUnmount",value:function(){var e;null===(e=this.runtime)||void 0===e||e.dispose()}},{key:"componentDidUpdate",value:function(e){e.args.notebook,this.props.args.notebook,this.redefineCells(this.main,this.props.args.redefine)}},{key:"embedNotebook",value:function(){var _embedNotebook=Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__.a)(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark((function _callee2(notebook,targets,observe,hide){var _this2=this,targetSet,observeSet,hideSet,_yield$eval,define;return _mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return this.runtime&&this.runtime.dispose(),targetSet=new Set(targets),observeSet=new Set(observe),hideSet=new Set(hide),this.runtime=new _observablehq_runtime__WEBPACK_IMPORTED_MODULE_10__.b,_context2.next=7,eval('import("https://api.observablehq.com/'.concat(notebook,'.js?v=3")'));case 7:_yield$eval=_context2.sent,define=_yield$eval.default,this.main=this.runtime.module(define,(function(e){var _;if(observeSet.has(e)&&!targetSet.has(e)){var t=_this2.observeValue;return{fulfilled:function(_){t[e]=_,_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setComponentValue(t)}}}if(!(targetSet.size>0)||targetSet.has(e)){if(hideSet.has(e))return!0;var a=document.createElement("div");null===(_=_this2.notebookRef.current)||void 0===_||_.appendChild(a);var r=new _observablehq_runtime__WEBPACK_IMPORTED_MODULE_10__.a(a);return a.addEventListener("input",(function(e){_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setFrameHeight()})),{pending:function(){r.pending(),_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setFrameHeight()},fulfilled:function(e){r.fulfilled(e),_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setFrameHeight()},rejected:function(e){r.rejected(e),_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setFrameHeight()}}}})),observeSet.size>0&&Promise.all(Array.from(observeSet).map(function(){var e=Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__.a)(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark((function e(_){return _mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=_,e.next=3,_this2.main.value(_);case 3:return e.t1=e.sent,e.abrupt("return",[e.t0,e.t1]);case 5:case"end":return e.stop()}}),e)})));return function(_){return e.apply(this,arguments)}}())).then((function(e){var _,t=Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper__WEBPACK_IMPORTED_MODULE_1__.a)(e);try{for(t.s();!(_=t.n()).done;){var a=Object(_mnt_storage_Documents_hugging_face_colaborative_hub_training_demo_neurips_visualization_streamlit_streamlit_observable_streamlit_observable_frontend_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__.a)(_.value,2),r=a[0],n=a[1];_this2.observeValue[r]=n}}catch(o){t.e(o)}finally{t.f()}_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setComponentValue(_this2.observeValue)}));case 11:case"end":return _context2.stop()}}),_callee2,this)})));function embedNotebook(e,_,t,a){return _embedNotebook.apply(this,arguments)}return embedNotebook}()},{key:"redefineCells",value:function(e){var _=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var t in _)e.redefine(t,_[t])}},{key:"componentDidMount",value:function(){var e=this,_=this.props.args,t=_.notebook,a=_.targets,r=void 0===a?[]:a,n=_.observe,o=void 0===n?[]:n,s=_.redefine,i=void 0===s?{}:s,l=_.hide,u=void 0===l?[]:l;_streamlit__WEBPACK_IMPORTED_MODULE_9__.a.setComponentValue(this.observeValue),this.embedNotebook(t,r,o,u).then((function(){e.redefineCells(e.main,i)}))}}]),Observable}(_streamlit__WEBPACK_IMPORTED_MODULE_9__.b);__webpack_exports__.a=Object(_streamlit__WEBPACK_IMPORTED_MODULE_9__.c)(Observable)},40:function(e,_,t){e.exports=t(41)},41:function(e,_,t){"use strict";t.r(_);var a=t(12),r=t.n(a),n=t(34),o=t.n(n),s=t(35);o.a.render(r.a.createElement(r.a.StrictMode,null,r.a.createElement(s.a,null)),document.getElementById("root"))}},[[40,1,2]]]);
//# sourceMappingURL=main.29a7bf42.chunk.js.map