RdmApp.factory("ApiServer",["$http","$rootScope","$timeout",function(e,n,t){var r={get:function(e,r){n.cekLogin(),$.post(e).done((function(e,n,a){"application/json"==(a.getResponseHeader("content-type")||"")?t((function(){r(e)}),1e3):r({success:!1,message:"Terdapat kesalahan pada server."})})).fail((function(e,n,t,a){Swal.fire({type:"error",title:"Gagal menyimpan",text:"Koneksi keserver gagal",showConfirmButton:!1,timer:1500}),r({success:!1,message:"Gagal menghubungi server."})}))},post:function(e,r,a){n.cekLogin(),$.post(e,r).done((function(e,n,r){"application/json"==(r.getResponseHeader("content-type")||"")?t((function(){a(e)}),1e3):a({success:!1,message:"Terdapat kesalahan pada server."})})).fail((function(e,n,t,r){Swal.fire({type:"error",title:"Gagal menyimpan",text:"Koneksi keserver gagal",showConfirmButton:!1,timer:1500}),a({success:!1,message:"Gagal menghubungi server."})}))}};return r}]),RdmApp.factory("common",["$http","$rootScope","$timeout",function(e,n,t){var r={get:function(e,r){n.cekLogin(),$.post(e).success((function(e,n,a){"application/json"==(a.getResponseHeader("content-type")||"")?t((function(){r(e)}),1e3):r({success:!1,message:"Terdapat kesalahan pada server."})})).error((function(e,n,t,a){Swal.fire({type:"error",title:"Gagal menyimpan",text:"Koneksi keserver gagal",showConfirmButton:!1,timer:1500}),r({success:!1,message:"Gagal menghubungi server."})}))},post:function(e,r,a){n.cekLogin(),$.post(e,r).success((function(e,n,r){"application/json"==(r.getResponseHeader("content-type")||"")?t((function(){a(e)}),1e3):a({success:!1,message:"Terdapat kesalahan pada server."})})).error((function(e,n,t,r){Swal.fire({type:"error",title:"Gagal menyimpan",text:"Koneksi keserver gagal",showConfirmButton:!1,timer:1500}),a({success:!1,message:"Gagal menghubungi server."})}))}};return r}]),RdmApp.factory("nowTime",["$timeout",function(e){var n=Date.now()-6e4*TimeZoneDiv,t=function(){e((function(){n=Date.now()-6e4*TimeZoneDiv,t()}),1e3)};return t(),function(){return n}}]),RdmApp.factory("timeAgo",["$timeout",function(e){var n={settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"lalu",suffixFromNow:"dari sekarang",seconds:"baru saja",minute:"semenit",minutes:"%d menit",hour:"Sejam",hours:"%d jam",day:"sehari",days:"%d hari",month:"sebulan",months:"%d bulan",year:"setahun",years:"%d tahun",numbers:[]}},inWords:function(e){var t=n.settings.strings,r=t.prefixAgo,a=t.suffixAgo;n.settings.allowFuture&&e<0&&(r=t.prefixFromNow,a=t.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,i=s/60,u=i/24,c=u/365;function p(n,r){var a=$.isFunction(n)?n(r,e):n,o=t.numbers&&t.numbers[r]||r;return a.replace(/%d/i,o)}var m=o<45&&p(t.seconds,Math.round(o))||o<90&&p(t.minute,1)||s<45&&p(t.minutes,Math.round(s))||s<90&&p(t.hour,1)||i<24&&p(t.hours,Math.round(i))||i<42&&p(t.day,1)||u<30&&p(t.days,Math.round(u))||u<45&&p(t.month,1)||u<365&&p(t.months,Math.round(u/30))||c<1.5&&p(t.year,1)||p(t.years,Math.round(c)),f=void 0===t.wordSeparator?" ":t.wordSeparator;return o<45?$.trim([r,m,""].join(f)):$.trim([r,m,a].join(f))},parse:function(e){if(angular.isNumber(e))return parseInt(e,10);var n=$.trim(e);return n=(n=(n=(n=n.replace(/\.\d+/,"")).replace(/-/,"/").replace(/-/,"/")).replace(/T/," ").replace(/Z/," UTC")).replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(n)}};return n}]);