import{r as t,h as e,H as i}from"./p-d2af20eb.js";import{a as n}from"./p-25a090c9.js";var s;!function(t){t.REQUESTED="REQUESTED",t.COLLECTING="COLLECTING",t.COLLECTED="COLLECTED",t.GENERATING="GENERATING",t.GENERATED="GENERATED",t.UPLOADED="UPLOADED",t.SENT="SENT",t.DELIVERED="DELIVERED",t.FAILED="FAILED"}(s||(s={}));let a=class{constructor(e){t(this,e),this.baseClass="ux-iws-e-catalog",this.url="",this.tableSelector="",this.totalNumberSelector="",this.buttonContainerSelector="",this.scrollSensorSelector="",this.table=null,this.tableBody=null,this.totalNumberElements=null,this.nextPage="",this.scrollSensor=null,this.buttonContainer=null,this.isLoading=!0,this.hasData=!1,this.noDataHeadline="",this.noDataText="",this.appendCallToActionToPage=t=>{this.hasData?this.buttonContainer.innerHTML=t:(this.noResultsButtonContainer.innerHTML=t,this.buttonContainer.remove())}}componentWillLoad(){this.setTable(),this.setScrollSensor(),this.setButtonContainer(),this.setTotalNumberElements(),this.requestData(this.url)}setTotalNumberElements(){""!==this.totalNumberSelector&&(this.totalNumberElements=document.querySelectorAll(this.totalNumberSelector))}updateNumbers(t){var e,i;e=this.totalNumberElements,i=t.toString(),null!==e&&[].forEach.call(e,(t=>t.textContent=i))}setTable(){var t;""!==this.tableSelector&&(this.table=document.querySelector(this.tableSelector),this.tableBody=null===(t=this.table)||void 0===t?void 0:t.querySelector("tbody"))}setButtonContainer(){""!==this.buttonContainerSelector&&(this.buttonContainer=document.querySelector(this.buttonContainerSelector))}setScrollSensor(){""!==this.scrollSensorSelector&&(this.scrollSensor=document.querySelector(this.scrollSensorSelector),null!==this.scrollSensor&&this.scrollSensor.addEventListener("uxInfiniteScrollSensorScrolledIntoView",(()=>{this.requestData(this.nextPage)})))}initialRequest(){this.requestData(this.url)}async requestData(t){var e,i;if(""===t)return;const s=o(t)?{}:{method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}},a=await n(t,s);this.url===t&&this.clearExistingData(),o(t)&&await new Promise((t=>setTimeout(t,2e3))),a.items.length>0?(this.hasData=!0,this.isLoading=!1):(this.hasData=!1,this.isLoading=!1,this.noDataHeadline=null===(e=null==a?void 0:a.messages)||void 0===e?void 0:e.noDataHeadline,this.noDataText=null===(i=null==a?void 0:a.messages)||void 0===i?void 0:i.noDataText),this.dateFormat=a.timeFormat,a.buttonHTML&&this.appendCallToActionToPage(a.buttonHTML),this.appendItemsToTable(a.items),a.totalCount&&this.updateNumbers(a.totalCount),this.nextPage=a.nextPage||"",""!==this.nextPage&&null!==this.scrollSensor&&(this.scrollSensor.hasFired=!1)}clearExistingData(){null!==this.tableBody&&(this.tableBody.textContent="")}appendItemsToTable(t){var e;null!==this.tableBody&&this.tableBody.insertAdjacentHTML("beforeend",t.map((e=this.dateFormat,({fileName:t,status:i,dateOfRequest:n,availability:a,downloadLink:o})=>`\n