function RecorderProxy(){this.active=null}RecorderProxy.prototype.start=function(a){chrome.tabs.getSelected(null,function(b){chrome.runtime.sendMessage({action:"start",recorded_tab:b.id,start_url:a})})};RecorderProxy.prototype.stop=function(){chrome.runtime.sendMessage({action:"stop"})};RecorderProxy.prototype.open=function(a,b){chrome.tabs.getSelected(null,function(c){chrome.tabs.sendMessage(c.id,{action:"open",url:a},b)})};
function RecorderUI(){this.recorder=new RecorderProxy;chrome.runtime.sendMessage({action:"get_status"},function(a){a.active?ui.set_started():(a.empty||ui.set_stopped(),chrome.tabs.getSelected(null,function(a){document.forms[0].elements.url.value=a.url}))})}RecorderUI.prototype.start=function(){var a=document.forms[0].elements.url.value;if(""==a)return!1;-1==a.indexOf("http://")&&a.indexOf("https://")&&(a="http://"+a);ui.set_started();ui.recorder.start(a);return!1};
RecorderUI.prototype.set_started=function(){var a=document.getElementById("bstop");a.style.display="";a.onclick=ui.stop;a=document.getElementById("bgo");a.style.display="none";a=document.getElementById("bexport");a.style.display="none"};RecorderUI.prototype.stop=function(){ui.set_stopped();ui.recorder.stop();return!1};
RecorderUI.prototype.set_stopped=function(){var a=document.getElementById("bstop");a.style.display="none";a=document.getElementById("bgo");a.style.display="";a=document.getElementById("bexport");a.style.display=""};RecorderUI.prototype.export=function(a){chrome.tabs.create({url:"./uiflow.html"})};var ui;
window.onload=function(){document.querySelector("input#bgo").onclick=function(){ui.start();return!1};document.querySelector("input#bstop").onclick=function(){ui.stop();return!1};document.querySelector("input#bexport").onclick=function(){ui.export();return!1};ui=new RecorderUI};
