"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[48683],{48683:(e,t,a)=>{a.r(t),a.d(t,{default:()=>C});var r=a(10467),o=a(41094),n=a(88452),i=a(79555),d=a(15324),l=a(25572),c=a(86654),g=a(54438),m=a(21182),s=a(2910),u=a(68162),p=a(66198),I=a(64422),h=a(88246),f=a(73955);const _c0=(e,t)=>({tagarea:e,tag:t}),_c1=e=>({$a:e}),_c2=e=>({items:e});let C=(()=>{var e;class CoreTagIndexAreaPage{constructor(e){this.route=e,this.tagId=0,this.tagName="",this.collectionId=0,this.areaId=0,this.fromContextId=0,this.contextId=0,this.recursive=!0,this.areaNameKey="",this.loaded=!1,this.items=[],this.nextPage=0,this.canLoadMore=!1,this.loadMoreError=!1}ngOnInit(){var e=this;return(0,r.A)((function*(){e.route.queryParams.subscribe((0,r.A)((function*(){var t;e.loaded=!1,e.areaComponent=void 0,e.tagId=d.CoreNavigator.getRouteNumberParam("tagId")||e.tagId,e.tagName=d.CoreNavigator.getRouteParam("tagName")||e.tagName,e.collectionId=d.CoreNavigator.getRouteNumberParam("collectionId")||e.collectionId,e.areaId=d.CoreNavigator.getRouteNumberParam("areaId")||e.areaId,e.fromContextId=d.CoreNavigator.getRouteNumberParam("fromContextId")||e.fromContextId,e.contextId=d.CoreNavigator.getRouteNumberParam("contextId")||e.contextId,e.recursive=null===(t=d.CoreNavigator.getRouteBooleanParam("recursive"))||void 0===t||t,e.areaNameKey=d.CoreNavigator.getRouteParam("areaNameKey")||"",e.componentName=d.CoreNavigator.getRouteParam("componentName"),e.itemType=d.CoreNavigator.getRouteParam("itemType"),e.items=d.CoreNavigator.getRouteParam("items")||[],e.nextPage=d.CoreNavigator.getRouteNumberParam("nextPage")||0,e.canLoadMore=d.CoreNavigator.getRouteBooleanParam("canLoadMore")||!1;try{e.componentName&&e.itemType&&e.items.length&&0!=e.nextPage||(yield e.fetchData(!0)),e.componentName&&e.itemType&&(e.areaComponent=yield n.CoreTagAreaDelegate.getComponent(e.componentName,e.itemType))}finally{e.loaded=!0}})))}))()}fetchData(e=!1){var t=this;return(0,r.A)((function*(){t.loadMoreError=!1;const a=e?0:t.nextPage;try{const e=(yield o.CoreTag.getTagIndexPerArea(t.tagId,t.tagName,t.collectionId,t.areaId,t.fromContextId,t.contextId,t.recursive,a))[0],r=yield n.CoreTagAreaDelegate.parseContent(e.component,e.itemtype,e.content);if(!r||!r.length)throw i.HT.instant("core.tag.errorareanotsupported");0==a?t.items=r:t.items.push(...r),t.componentName=e.component,t.itemType=e.itemtype,t.areaNameKey=n.CoreTagAreaDelegate.getDisplayNameKey(e.component,e.itemtype),t.canLoadMore=!!e.nextpageurl,t.nextPage=a+1}catch(e){t.loadMoreError=!0,l.CoreAlerts.showError(e,{default:"Error loading tag index"})}}))()}loadMore(e){var t=this;return(0,r.A)((function*(){try{yield t.fetchData()}finally{null==e||e()}}))()}refreshData(e){var t=this;return(0,r.A)((function*(){try{yield o.CoreTag.invalidateTagIndexPerArea(t.tagId,t.tagName,t.collectionId,t.areaId,t.fromContextId,t.contextId,t.recursive)}finally{try{yield t.fetchData(!0)}finally{null==e||e.complete()}}}))()}}return(e=CoreTagIndexAreaPage).ɵfac=function CoreTagIndexAreaPage_Factory(t){return new(t||e)(g.rXU(m.nX))},e.ɵcmp=g.VBU({type:e,selectors:[["page-core-tag-index-area"]],standalone:!0,features:[g.aNF],decls:17,vars:25,consts:[["slot","start"],[3,"text"],[1,"limited-width"],["slot","fixed",3,"ionRefresh","disabled"],[3,"pullingText"],[3,"hideUntil"],[3,"component","data"],[3,"action","enabled","error"]],template:function CoreTagIndexAreaPage_Template(e,t){1&e&&(g.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",0),g.nrm(3,"ion-back-button",1),g.nI1(4,"translate"),g.k0s(),g.j41(5,"ion-title")(6,"h1"),g.EFF(7),g.nI1(8,"translate"),g.nI1(9,"translate"),g.k0s()()()(),g.j41(10,"ion-content",2)(11,"ion-refresher",3),g.bIt("ionRefresh",(function CoreTagIndexAreaPage_Template_ion_refresher_ionRefresh_11_listener(e){return t.refreshData(e.target)})),g.nrm(12,"ion-refresher-content",4),g.nI1(13,"translate"),g.k0s(),g.j41(14,"core-loading",5),g.nrm(15,"core-dynamic-component",6),g.j41(16,"core-infinite-loading",7),g.bIt("action",(function CoreTagIndexAreaPage_Template_core_infinite_loading_action_16_listener(e){return t.loadMore(e)})),g.k0s()()()),2&e&&(g.R7$(3),g.Y8G("text",g.bMT(4,9,"core.back")),g.R7$(4),g.SpI(" ",g.i5U(9,13,"core.tag.itemstaggedwith",g.eq3(21,_c1,g.l_i(18,_c0,g.bMT(8,11,t.areaNameKey),t.tagName)))," "),g.R7$(4),g.Y8G("disabled",!t.loaded),g.R7$(),g.FS9("pullingText",g.bMT(13,16,"core.pulltorefresh")),g.R7$(2),g.Y8G("hideUntil",t.loaded),g.R7$(),g.Y8G("component",t.areaComponent)("data",g.eq3(23,_c2,t.items)),g.R7$(),g.Y8G("enabled",t.canLoadMore)("error",t.loadMoreError))},dependencies:[c.n,s.QW,s.W9,s.eU,s.To,s.Ki,s.BC,s.ai,s.el,u.m,p.b,I.R,h.i,f.D9],encapsulation:2}),CoreTagIndexAreaPage})()}}]);