define(["layout/module","lodash"],function(a,b){"use strict";a.registerFactory("SmartCss",["$rootScope","$timeout",function(a,c){var d=function(){var a=document.createElement("style");return a.appendChild(document.createTextNode("")),document.head.appendChild(a),a.sheet}(),e={},f={writeRule:function(a){if(f.deleteRuleFor(a),b.has(e,a)){var c=a+"{ "+b.map(e[a],function(a,b){return b+":"+a+";"}).join(" ")+"}";d.insertRule(c)}},add:function(a,d,g,h){b.has(e,a)||(e[a]={}),void 0==g||null==g||""==g?delete e[a][d]:e[a][d]=g,0==b.keys(e[a]).length&&delete e[a],h||(h=0),c(function(){f.writeRule(a)},h)},remove:function(a,b,c){f.add(a,b,null,c)},deleteRuleFor:function(a){b(d.rules).forEach(function(b,c){b.selectorText==a&&d.deleteRule(c)})},appViewSize:null};return a.$on("$smartContentResize",function(a,b){f.appViewSize=b}),f}])});