(()=>{function t(t,e,n,i,o,l,a,c){var d=this,p=t.find("head title"),u=p.text();function r(){var t=a.get(n.path())||{},t=t.data?i.invoke(t.data):{};t.title||t.subtitle||t.templateUrl||t.then?((t=l.when(t))._path=n.path(),s(0,t)):h()}function s(t,e){e.then(function(t){!_.isUndefined(e._path)&&e._path!==n.path()||(d.title=(_.isUndefined(t.title)?d:t).title,d.subtitle=t.subtitle,d.templateUrl=t.templateUrl,"component"!==d.displayMode&&(d.displayMode=d.templateUrl?"template":void 0),h(d.title))})}function m(){return o.find(".transclude-main-container")}function f(){d.displayMode=void 0,d.title="",d.subtitle=""}function h(t){var e=u;t&&(e="".concat(c.getString(t)," / ").concat(e)),p.text(e)}_.assign(d,{$onInit:function(){a.setMainComponent(d),e.$on("$routeChangeStart",f),e.$on("$routeChangeSuccess",_.debounce(r,10)),a.$on("title",s),r()},$onDestroy:function(){a.clearMainComponent()},setTitleElement:function(t){var e=m();e.empty(),e.append(t.show()),d.displayMode="component"},clearTitleElement:function(){m().empty(),d.displayMode=void 0},isTitleVisible:function(){return d.title||d.subtitle||"template"===d.displayMode&&d.templateUrl}})}t.$inject=["$document","$scope","$location","$injector","$element","$q","c8yTitle","gettextCatalog"],angular.module("c8y.ui").controller("TitleCtrl",t)})();