import{r as i,h as e,H as o,c as l}from"./p-cb5076d4.js";import{a as t}from"./p-54805fa4.js";import{T as d,I as a}from"./p-5b69721c.js";import{f as r}from"./p-4b0effa0.js";import{a as s}from"./p-d50d0ec8.js";import"./p-0db2169b.js";import"./p-eebad85b.js";const c=class{constructor(e){i(this,e),this.fields=[],this.items=[]}render(){const{config:i,fields:l,items:t}=this;return e(o,{class:"row"},t.map((o=>e("div",{class:"col-sm-12 col-md-6 col-lg-6 col-xl-6"},e("dvn-card-view",{key:`card-view-${o._id}`,config:i.main.cardViewConfig,fields:l,item:o,overrideStyle:{margin:"0 0 30px 0"}})))))}};const n=class{constructor(e){i(this,e),this.action=l(this,"action",7),this.leaned=!1}render(){const{fields:i,item:l,config:c,overrideStyle:n}=this,v=function(i,e,o){var l,t,c,n,v,f,m,u,h,p,g,b,y,S,j,w;const P=(null===(l=i.header)||void 0===l?void 0:l.title)&&s(o,r(e,i.header.title.fieldId),i.header.title.fieldId),T=(null===(t=i.header)||void 0===t?void 0:t.title)?i.header.title.position:d.BelowCover,R=(null===(n=null===(c=i.header)||void 0===c?void 0:c.cover)||void 0===n?void 0:n.fieldId)&&o[r(e,i.header.cover.fieldId).id],_=(null===(v=i.header)||void 0===v?void 0:v.cover)&&i.header.cover.size,x=(null===(f=i.header)||void 0===f?void 0:f.cover)&&i.header.cover.aspectRatio,z=(null===(m=i.header)||void 0===m?void 0:m.cover)&&i.header.cover.placeholder,I=(null===(u=i.header)||void 0===u?void 0:u.image)&&s(o,r(e,i.header.image.fieldId),i.header.image.fieldId),O=(null===(h=i.header)||void 0===h?void 0:h.image)&&i.header.image.placeholderFieldId&&s(o,r(e,i.header.image.placeholderFieldId),i.header.image.placeholderFieldId),V=(null===(p=i.header)||void 0===p?void 0:p.image)?i.header.image.placeholderType:"text",A=(null===(g=i.header)||void 0===g?void 0:g.image)&&i.header.image.size,$=(null===(b=i.header)||void 0===b?void 0:b.image)?i.header.image.shape:"circle",D=(null===(y=i.header)||void 0===y?void 0:y.image)?i.header.image.position:a.Center,k=((null===(S=i.body)||void 0===S?void 0:S.fields)||[]).map((i=>{const{fieldId:l,fieldDisplay:t,customViewTag:d}=i,a=function(i,e){var o={};for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&e.indexOf(l)<0&&(o[l]=i[l]);if(null!=i&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(l=Object.getOwnPropertySymbols(i);t<l.length;t++)e.indexOf(l[t])<0&&Object.prototype.propertyIsEnumerable.call(i,l[t])&&(o[l[t]]=i[l[t]])}return o}(i,["fieldId","fieldDisplay","customViewTag"]);if(d)return{customViewTag:d,field:void 0,label:"",value:"",meta:a};const c=t||r(e,l);return c||console.error(`Field with id ${l} not found. Available fields are ${e.map((i=>i.id)).join(", ")}`),{field:c,label:c.title,value:s(o,c),meta:a}}));return{header:{title:P,titlePosition:T,coverSrc:R,coverPlaceholder:z,coverSize:_,coverAspectRatio:x,imageSrc:I,imagePlaceholderValue:O,imagePlaceholderType:V,imageSize:A,imageShape:$,imagePosition:D,actions:(null===(j=i.header)||void 0===j?void 0:j.actions)||[]},body:{fields:k},footer:{actions:(null===(w=i.footer)||void 0===w?void 0:w.actions)||[]}}}(c,i,l),f=!!c.header&&!!c.header.image;return e(o,{style:this.overrideStyle},e("dvn-card",{cornerRadius:this.cornerRadius,elevation:0,leaned:this.leaned,style:n},!!c.header&&(c.header.title||f)&&e("dvn-card-header",{title:v.header.title,titlePosition:v.header.titlePosition,slot:"header",showCover:!(!c.header||!c.header.image&&!c.header.cover),coverSrc:v.header.coverSrc,coverPlaceholder:v.header.coverPlaceholder,coverSize:v.header.coverSize,coverAspectRatio:v.header.coverAspectRatio,showImage:f,imageSrc:v.header.imageSrc,imageSize:v.header.imageSize,imageShape:v.header.imageShape,imagePlaceholder:v.header.imagePlaceholderValue,imagePlaceholderType:v.header.imagePlaceholderType,imagePosition:v.header.imagePosition,cornerRadius:this.cornerRadius},v.header.actions.length>0&&e("div",{class:"header-actions-container",slot:"action"},v.header.actions.map(((i,e)=>t(e,{},l,this.action,i))))),v.body.fields.map((i=>i.customViewTag?e(i.customViewTag,{item:l}):e("dvn-field-display",{infoTitle:i.label,field:i.field,value:i.value,meta:i.meta}))),v.footer.actions.length>0&&e("dvn-card-footer",{slot:"footer",alignRight:!0},v.footer.actions.map(((i,e)=>t(e,{},l,this.action,i))))))}};export{c as dvn_card_list_view,n as dvn_card_view}