(()=>{function t(t){var n="registrationDataHistory",r=500,e=1,o="month",i={history:[]},c={};function s(){t.get(n).then(function(t){i=t||i})}return s(),c.commit=function(){var r;r=moment().local().subtract(e,o),_.remove(i.history,function(t){return moment(t.timestamp).isBefore(r)}),t.set(n,i)},c.pull=s,c.clearHistory=function(){i={history:[]}},c.add=function(t){_.merge(t,{timestamp:moment().local().format()}),i.history.push((t=t,delete(t=_.cloneDeep(t)).trackerPassword,t)),t=i.history.length,r<t&&(i.history=_.drop(i.history,t-r))},c.list=function(){return i.history},c.find=function(r){return _.findLast(i.history,function(t){return t.trackerIMEI===r})},c.cleanByIMEI=function(r){_.remove(i.history,function(t){return t.trackerIMEI===r})},c}t.$inject=["c8yUserPreferences"],angular.module("c8y.tracking.trackerRegistration").factory("trackerRegistrationHistorySvc",t)})();