import{r as i,h as t,H as e}from"./p-ec7718e6.js";import"./p-2d511d0e.js";import"./p-3c3b4f3f.js";import"./p-d66fb38c.js";import"./p-d343a062.js";import{I as s}from"./p-4b573471.js";import"./p-f46dff5e.js";import{I as n}from"./p-db7d4eb0.js";const a=class{constructor(t){i(this,t),this.itemFetchState=s.init()}componentWillLoad(){const{apiData:i,params:t,view:e}=this,{query:s,table:a,ui:r}=e;this.itemDataProvider=new n(i,t,a,s,(null==s?void 0:s.fields)||r.fields||e.table.fields,(i=>{this.itemFetchState=i})),this.itemDataProvider.fetchData(this.itemFetchState)}componentDidUpdate(){const{itemFetchState:i}=this;i.data||i.isPending||i.error||this.itemDataProvider.fetchData(this.itemFetchState)}async invalidate(i){this.itemDataProvider.fetchData(this.itemFetchState)}render(){const{itemFetchState:i,view:s}=this,{ui:n}=s;return t(e,null,!i.isPending&&!i.error&&t("dvn-card-view",{config:n.cardConfig,fields:n.fields||s.table.fields,item:i.data,cornerRadius:0,leaned:!0,overrideStyle:{width:"100%"}}),i.isPending&&t("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center detail-view-progress-container"},t("dvn-progress",{indefinite:!0,tint:"primary"})),i.error&&t("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center flex-column detail-view-progress-container"},"Fetching data failed.",t("dvn-button",{onClick:()=>this.itemDataProvider.fetchData(this.itemFetchState)},"Retry")))}};a.style=".sc-dvn-app-view-detail-view-h{display:flex;flex:1;align-items:stretch;max-width:100%}.detail-view-progress-container.sc-dvn-app-view-detail-view{padding:calc(4 * var(--spacing-unit))}";export{a as dvn_app_view_detail_view}