var _extends=Object.assign||function(a){for(var b,c=1;c{console.log('CHANGE',this.RoutingSystem.getRoute()),this.refresh(!0,!1),this._onUpdate&&this._onUpdate()}),this.inputs={},this.outputs={},this.inrefs={},this.outrefs={}}import(a){let{services:b,modules:c,links:d,routes:e,outputs:f,inputs:g,root:h}=a;for(var j in this.root=h||this.root,this.ServiceSystem.clean(),this.ModuleSystem.clean(),this.LinkManager.clean(),this.RoutingSystem.clean(),g)this.addInput(g[j]);for(var j in f)this.addOutput(f[j]);for(var j in b)this.ServiceSystem.loadService(b[j]);for(var j in c)this.ModuleSystem.loadModule(c[j]);for(var j in d)this.LinkManager.addLink(d[j]);this.RoutingSystem.import(e),this.refresh(!0)}export(){let a=this.ServiceSystem.export(),b=this.ModuleSystem.export(),c=this.LinkManager.export(),d=this.RoutingSystem.export(),e=this.outputs,f=this.inputs;return{services:a,modules:b,links:c,routes:d,outputs:e,inputs:f,root:this.root}}addInput(a){a.pid='core',this.inputs[a.name]=a,this.inrefs[a.name]=this.LinkManager.addInputRef(a),this.refresh()}addOutput(a){a.pid='core',this.outputs[a.name]=a,this.outrefs[a.name]=this.LinkManager.addOutputRef(a),this.refresh()}updateInput(a){a.pid='core',this.inputs[a.name]=a,this.refresh()}updateOutput(a){a.pid='core',this.outputs[a.name]=a,this.refresh()}removeInput(a){delete this.inputs[a],this.refresh(!0)}removeOutput(a){delete this.outputs[a],this.refresh(!0)}getInput(a){return this.inrefs[a]}getOutput(a){return this.outrefs[a]}getLoadedModules(){return _extends({},this.ModuleSystem.availableModules)}loadModule(a){this.ModuleSystem.loadModule(a),this.refresh()}loadService(a){this.ServiceSystem.loadService(a),this.refresh()}refresh(a=!1,b=!1){this.ModuleSystem.refresh(a,!0),this.ServiceSystem.refresh(a,!0),this.LinkManager.clearLinks(_extends({},this.ModuleSystem.modules,this.ServiceSystem.modules)),this._onUpdate&&!b&&this._onUpdate()}onUpdate(a){this.ServiceSystem.onUpdate(a),this.ModuleSystem.onUpdate(a),this._onUpdate=a}clean(){this.ModuleSystem.clean(),this.ServiceSystem.clean(),this.LinkManager.clean(),this.RoutingSystem.clean()}getRandom(){let a=parseInt(1234567890*Math.random())%7654321;// check modules // check services return a}go(a,b,c=!1){this.RoutingSystem.goName(a)||(this.RoutingSystem.go(a,b,c),c&&this.refresh()),this._routerState=b}render(){return this.RoutingSystem.resolve(),this.root=this.RoutingSystem.getCurrentView(),[this.ServiceSystem.render(),this.ModuleSystem.render(this.root)]}renderModules(){// maybe i should take Routing System out of here beacause of subSystems return this.RoutingSystem.resolve(),this.root=this.RoutingSystem.getCurrentView(),this.ModuleSystem.render(this.root)}renderServices(){return this.ServiceSystem.render()}}export default CoreSystem;