var __extends=(this&&this.__extends)||(function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||({__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b;})||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p];};return extendStatics(d,b);};return function(d,b){extendStatics(d,b);function __(){this.constructor=d;} d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __());};})();var __decorate=(this&&this.__decorate)||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r;};define(["require","exports","react","@core/material-ui-components","typestyle","@core/style_constants","dojo/on","@core/with-state-manager"],function(require,exports,React,material_ui_components_1,typestyle_1,style_constants,on,with_state_manager_1){Object.defineProperty(exports,"__esModule",{value:true});exports.loader_style=typestyle_1.stylesheet({container:{position:'fixed',top:0,bottom:0,left:0,width:'100%',backgroundColor:'rgba(0,0,0,.7)',zIndex:10000,},loader:{position:'absolute',top:'50%',textAlign:'center',boxSizing:'border-box',marginTop:'-40px',height:'80px',width:'100%'}});var Loader_Events;(function(Loader_Events){Loader_Events["DISPATCH_EVENT_HIDE_LOADER"]="DISPATCH_EVENT:HIDE_LOADER";Loader_Events["DISPATCH_EVENT_SHOW_LOADER"]="DISPATCH_EVENT:SHOW_LOADER";})(Loader_Events=exports.Loader_Events||(exports.Loader_Events={}));var Loader=(function(_super){__extends(Loader,_super);function Loader(props){var _this=_super.call(this,props)||this;_this.open=0;_this.text="";_this.hide_progress=false;_this.on_click=null;return _this;} Loader.prototype.render=function(){return(React.createElement(material_ui_components_1.MuiThemeProvider,{theme:style_constants.theme},React.createElement("div",{className:typestyle_1.classes(this.open>0?'fadeIn':'',exports.loader_style.container),style:{display:this.open>0?'':'none',willChange:'opacity',userSelect:this.on_click?'all':null,pointerEvents:this.on_click?'all':null},onClick:this.on_click||null},this.hide_progress?null:React.createElement("div",{className:exports.loader_style.loader},React.createElement(material_ui_components_1.CircularProgress,{style:{color:'rgb(99, 163, 226)'}}),React.createElement(material_ui_components_1.Typography,{variant:"h6",style:{color:'rgb(99, 163, 226)',marginTop:12}},this.text)))));};Loader.prototype.componentDidMount=function(){var _this=this;on(this.props.state_manager,this.props.state_manager.UPDATE_RUN_STATE,function(data){if(data.property===Loader_Events.DISPATCH_EVENT_SHOW_LOADER){_this.open++;if(typeof data.value==="object"&&data.value.text){_this.text=data.value.text;} else{_this.text="";} if(typeof data.value==="object"&&data.value.hide_progress){_this.hide_progress=data.value.hide_progress;} else{_this.hide_progress=false;} if(typeof data.value==="object"&&data.value.on_click){_this.on_click=data.value.on_click;} else{_this.on_click=null;} _this.forceUpdate();} if(data.property===Loader_Events.DISPATCH_EVENT_HIDE_LOADER){_this.open--;_this.open=Math.max(_this.open,0);_this.forceUpdate();}});};Loader=__decorate([with_state_manager_1.default],Loader);return Loader;}(React.Component));exports.default=Loader;});