define(["jquery","format_tiles/browser_storage_set_up"],function(a,b){"use strict";var c,d,e,f={prefix:"mdl-tiles-",course:"mdl-tiles-course-",lastSection:"-lastSecId",content:"-content",lastUpdated:"-lastUpdated",collapseSecZero:"-collapsesec0",user:"-user-",section:"-sec-",userChoicePrefix:"mdl-tiles-userPrefStorage-"},g=function(){return f.course+c+f.user+d+f.lastSection},h=function(a){return f.course+c+f.section+a.toString()+f.user+d+f.content},i=function(a){return f.course+c+f.section+a.toString()+f.user+d+f.lastUpdated},j=function(){return f.course+c+f.user+d+f.collapseSecZero},k=function(a){return 0===a.indexOf(f.prefix)&&a.substr(-f.lastUpdated.length)===f.lastUpdated},l=function(a,c,d){if(void 0===c||void 0===a)throw new Error("Missing section id");try{void 0!==d&&""!==d&&b.Enabled.session&&b.storageAllowed()===!0?(sessionStorage.setItem(h(c),d),sessionStorage.setItem(i(c),Math.round(Date.now()/1e3).toString())):(sessionStorage.removeItem(h(c)),sessionStorage.removeItem(i(c)))}catch(e){require(["core/log"],function(a){a.debug(e)})}},m=function(a){var b=a.split("-");if(k(a))return{courseId:parseInt(b[b.indexOf("course")+1]),sectionId:parseInt(b[b.indexOf("sec")+1]),userId:parseInt(b[b.indexOf("user")+1]),title:"lastUpdated"};throw new Error("Invalid lastUpdated key")},n=function(a,b,c){if(b)Object.keys(localStorage).filter(function(a){return 0===a.indexOf(f.prefix)&&0!==a.indexOf(f.userChoicePrefix)}).forEach(function(a){localStorage.removeItem(a)}),Object.keys(sessionStorage).filter(function(a){return 0===a.indexOf(f.prefix)}).forEach(function(a){if(k(a)){var b=m(a);l(b.courseId,b.sectionId,"")}});else{var d=Math.round(Date.now()/1e3)-60*a;Object.keys(sessionStorage).filter(function(a){return 0===a.indexOf(f.prefix)}).forEach(function(b){if(k(b)){var c=m(b);(sessionStorage.getItem(b)c){var g=e.map(function(a){return parseInt(sessionStorage[a])}).sort(),h=g[g.length-c];0===c&&(h=Date.now());var i;e.filter(function(a){return sessionStorage[a]