(()=>{function n(t,e,i,a,o,n,c,r,l,p,s,u){var h,d=this,g="subscribedApplications";function f(n){return d.applications||(d.applications=[]),n.forEach(function(n){n.uiHide||d.applications.push(n)}),t.paging=n.paging,d.applications.length}function m(n){d.currentApp=n}function A(){d.applications=null,t.refreshLoading=!0,t.paging.refresh().then(f).then(P).finally(function(){t.refreshLoading=!1}),t.paging=null}function P(){var n,t;r.changeTitle((n=d.applications.length,t=b()?l("Subscribed applications"):l("Own applications"),n=_.isUndefined(n)?"":p.getPlural(n,"1 application","{{$count}} applications",{}),e.resolve({title:t,subtitle:n})))}function b(){return d.basePath===g}t.refresh=A,t.loadNext=function(){t.paging.loading=!0,t.paging.next().then(f).then(P).finally(function(){t.paging.loading=!1})},_.assign(d,{$onInit:function(){(n=>{delete d.applications,a.getCurrent().then(m),b()?u.current().then(function(e){var n={providedFor:e.name,pageSize:100,withTotalPages:!0},t=c.createListFilter(function(n){return t=e.name,(n=>_.get(n,"owner.tenant.id"))(n)!==t;var t});a.listApplications(n).then(t).then(f).then(P)}):a.listByOwner(n).then(f).then(P)})(),s.current().then(function(n){h=s.hasRole(n,"ROLE_APPLICATION_MANAGEMENT_ADMIN")})},getHref:a.getHref,detail:function(n){i.path("/".concat(d.basePath,"/").concat(n.id))},detailPlugins:function(n){i.path("/".concat(d.basePath,"/").concat(n.id,"/plugins"))},add:function(){i.path("/".concat(d.basePath,"/new"))},addWithWizard:function(){return n.open({templateUrl:":::PLUGIN_PATH:::/appWizard/wizard.html"}).result.then(A)},onClickDelete:function(n){o({title:l("Delete application"),body:p.getString('You are about to delete application "{{app | humanizeAppName}}". Do you want to proceed?',{app:n}),labels:{ok:l("Delete")},status:"danger",size:"sm"}).then(angular.bind(a,a.remove,n)).then(angular.bind(c,c.removeFromList,d.applications,n)).then(P)},isAdmin:function(){return h},path:function(n){return _.includes(["HOSTED","MICROSERVICE"],n.type)?n.contextPath:n.externalUrl},iconType:a.icon,isCurrentApp:function(n){return Boolean(d.currentApp&&d.currentApp.id===n.id)},canOpenInBrowser:_.memoize(function(n){var t={result:!1};return a.canOpenInBrowser(n).then(function(n){t.result=n}),t},function(n){return n.id}),isPlatformApplicationBasePath:b})}n.$inject=["$scope","$q","$location","c8yApplication","c8yModal","c8yWizardModal","c8yBase","c8yTitle","gettext","gettextCatalog","c8yUser","c8yTenant"],angular.module("c8y.parts.applications").component("c8yApplicationListView",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/application-list-view/application-list-view.html",controller:n,controllerAs:"vm"})})();