import{r as o,h as i}from"./p-03169580.js";import{F as l}from"./p-4d314fbd.js";import{s as n}from"./p-5fc6058c.js";import"./p-59c95c5f.js";const d="";let v=class{constructor(i){o(this,i)}async search(o){var i,d;const v=(i=o===null||o===void 0?void 0:o.target)===null||i===void 0?void 0:i.value;if(!((d=n===null||n===void 0?void 0:n.templates)===null||d===void 0?void 0:d.length)||!(v===null||v===void 0?void 0:v.length)){this.searchResults=null;return}const r=new l((n===null||n===void 0?void 0:n.templates)||[],{keys:["subject","description"],sortFn:(o,i)=>{var l,n,d,v;return((l=o===null||o===void 0?void 0:o.item)===null||l===void 0?void 0:l.type)>((n=i===null||i===void 0?void 0:i.item)===null||n===void 0?void 0:n.type)?1:((d=i===null||i===void 0?void 0:i.item)===null||d===void 0?void 0:d.type)>((v=o===null||o===void 0?void 0:o.item)===null||v===void 0?void 0:v.type)?-1:0}});this.searchResults=await r.search(v).map((o=>o===null||o===void 0?void 0:o.item))}async cancel(){this.searchResults=null}render(){const o=this.searchResults||(n===null||n===void 0?void 0:n.templates)||[];return[i("ion-content",{class:"ion-padding"},i("ion-grid",null,i("ion-row",null,i("ion-col",{size:"8"},i("ion-searchbar",null)),i("ion-col",{size:"4"},i("ion-button",{expand:"block",class:"ion-float-right",href:"/templates/new"},"Add Template")))),i("ion-card",null,i("ion-list",{class:"ion-no-padding"},o.map(((l,n)=>{var d;return[((d=o===null||o===void 0?void 0:o[n-1])===null||d===void 0?void 0:d.type)!==(l===null||l===void 0?void 0:l.type)&&i("ion-item-divider",{color:"primary"},l.type),i("ion-item",{href:`/templates/${l===null||l===void 0?void 0:l.id}`,detail:true},i("ion-label",null,i("h2",null,(l===null||l===void 0?void 0:l.subject)||""),i("p",null,(l===null||l===void 0?void 0:l.description)||"No Description on File...")))]}))))),i("app-footer",null)]}};v.style=d;export{v as fireenjin_mx_page_home};
//# sourceMappingURL=p-d597f587.entry.js.map