import{r as e,c as i,h as l,H as o}from"./p-c1e62c18.js";import"./p-eb6e2a8b.js";import{a as d}from"./p-3c3b4f3f.js";import"./p-d66fb38c.js";import{N as a}from"./p-0fb5fd0d.js";import{f as t}from"./p-a2679866.js";import{g as n}from"./p-6d8dc5ec.js";const r=class{constructor(l){e(this,l),this.action=i(this,"action",7),this.leaned=!1}render(){const{fields:e,item:i,config:a,overrideStyle:r}=this,s=function(e,i,l){var o,a,n,r,s,c,v,f,p,m,h,u,g,y;const b=(null===(o=e.header)||void 0===o?void 0:o.title)&&d(l,t(i,e.header.title.fieldId),e.header.title.fieldId),j=(null===(n=null===(a=e.header)||void 0===a?void 0:a.cover)||void 0===n?void 0:n.fieldId)&&l[t(i,e.header.cover.fieldId).id],S=(null===(r=e.header)||void 0===r?void 0:r.cover)&&e.header.cover.size,x=(null===(s=e.header)||void 0===s?void 0:s.cover)&&e.header.cover.aspectRatio,P=(null===(c=e.header)||void 0===c?void 0:c.cover)&&e.header.cover.placeholder,w=(null===(v=e.header)||void 0===v?void 0:v.image)&&d(l,t(i,e.header.image.fieldId),e.header.image.fieldId),z=(null===(f=e.header)||void 0===f?void 0:f.image)&&e.header.image.placeholderFieldId&&l[t(i,e.header.image.placeholderFieldId).id],R=(null===(p=e.header)||void 0===p?void 0:p.image)?e.header.image.placeholderType:"text",T=(null===(m=e.header)||void 0===m?void 0:m.image)&&e.header.image.size,O=(null===(h=e.header)||void 0===h?void 0:h.image)?e.header.image.shape:"circle",_=(null===(u=e.header)||void 0===u?void 0:u.image)?e.header.image.position:"center",A=(e.body.fields||[]).map((e=>{const{fieldId:o}=e,a=function(e,i){var l={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.indexOf(o)<0&&(l[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var d=0;for(o=Object.getOwnPropertySymbols(e);d<o.length;d++)i.indexOf(o[d])<0&&Object.prototype.propertyIsEnumerable.call(e,o[d])&&(l[o[d]]=e[o[d]])}return l}(e,["fieldId"]),n=e.fieldDisplay||t(i,o);return n||console.error(`Field with id ${o} not found. Available fields are ${i.map((e=>e.id)).join(", ")}`),{field:n,label:n.title,value:d(l,n),meta:a}}));return{header:{title:b,coverSrc:j,coverPlaceholder:P,coverSize:S,coverAspectRatio:x,imageSrc:w,imagePlaceholderValue:z,imagePlaceholderType:R,imageSize:T,imageShape:O,imagePosition:_,actions:(null===(g=e.header)||void 0===g?void 0:g.actions)||[]},body:{fields:A},footer:{actions:(null===(y=e.footer)||void 0===y?void 0:y.actions)||[]}}}(a,e,i),c=!!a.header&&!!a.header.image;return l(o,{style:this.overrideStyle},l("dvn-card",{cornerRadius:this.cornerRadius,elevation:0,leaned:this.leaned,style:r},!!a.header&&(a.header.title||c)&&l("dvn-card-header",{title:s.header.title,slot:"header",showCover:!(!a.header||!a.header.image&&!a.header.cover),coverSrc:s.header.coverSrc,coverPlaceholder:s.header.coverPlaceholder,coverSize:s.header.coverSize,coverAspectRatio:s.header.coverAspectRatio,showImage:c,imageSrc:s.header.imageSrc,imageSize:s.header.imageSize,imageShape:s.header.imageShape,imagePlaceholder:s.header.imagePlaceholderValue,imagePlaceholderType:s.header.imagePlaceholderType,cornerRadius:this.cornerRadius,imagePosition:s.header.imagePosition},s.header.actions.length>0&&l("div",{class:"header-actions-container",slot:"action"},s.header.actions.map(((e,l)=>n(l,{},i,this.action,e))))),s.body.fields.map((e=>l("dvn-field-display",{infoTitle:e.label,field:e.field,value:e.value,meta:e.meta}))),s.footer.actions.length>0&&l("dvn-card-footer",{slot:"footer",alignRight:!0},s.footer.actions.map(((e,l)=>n(l,{},i,this.action,e))))))}},s={number:"dvn-field-display-number",multipleChoice:"dvn-field-display-multiple-choice","single-choice":"dvn-field-display-single-choice",text:"dvn-field-display-text",date:"dvn-field-display-date",attachment:"dvn-field-display-attachment",rawData:"dvn-field-display-raw-data",range:"dvn-field-display-range",reference:"dvn-field-display-reference"},c=class{constructor(i){e(this,i),this.showTitle=!0}render(){const{field:e,infoTitle:i,meta:d,showTitle:t,value:n}=this;let r=e,c=s[e.type];return e.type===a.type&&(c=s[e.nestedField.type],r=e.nestedField),l(o,null,t&&l("div",{class:"title"},(i||"").toUpperCase()),c?l(c,{field:r,value:n,meta:d,fixHeight:!1}):l("span",null,n))}};c.style=".sc-dvn-field-display-h{font-size:0.9em;margin:0px 0px calc(4 * var(--spacing-unit)) 0px;display:block}.sc-dvn-field-display-h:last-child{margin-bottom:0}.title.sc-dvn-field-display{font-size:0.8em;margin-bottom:calc(2 * var(--spacing-unit));color:var(--color-text-secondary)}";export{r as dvn_card_view,c as dvn_field_display}