angular.module("widgetkit").controller("twitterCtrl",["$scope","$element","Application","$http",function(t,n,e,i){var o,c=this;c.connected=n[0].getAttribute("data-status"),c.loading=!1,c.openPopup=function(t){o=window.open(t,"","width=800,height=500")},t.$watch("twitter.pin",function(t){var n;!t||t.length<7||(c.loading=!0,(n=i.post(e.url("twitter_auth"),{pin:t})).success(function(){c.connected=!0,c.loading=!1,c.pin="",o&&o.close()}),n.error(function(){c.loading=!1}))}),c.disconnect=function(){c.loading=!0;var t=i.delete(e.url("twitter_auth"));t.success(function(){c.connected=!1,c.loading=!1}),t.error(function(){c.loading=!1})}}]);