1import{c as u,o as n,b as h,d as oe,g as x,q as f,n as W,F as ae,r as le,u as d,p as ce,s as A,v as $,x as U,D as re,I as de,T as ue,J as me,aw as pe,z as S,m as Z,w as K,e as B,X as V,f as P,t as N,K as he,aj as te,B as ge,N as L,_ as fe}from"./CDqcnpQn.js";import{a as T,b as ve,g as Q,u as we,i as ye}from"./cEcEJuzu.js";import{d as se}from"./oVxhnyrt.js";import{u as be}from"./u7KI10RJ.js";import{r as xe}from"./B4RH1vLw.js";import{r as ke}from"./Bd_yly78.js";import{r as Ce}from"./CVNTsiI4.js";function Re(e,t){return n(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function _(e,t){return n(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function ie(e,t){return n(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25M9 16.5v.75m3-3v3M15 12v5.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}const Ie=["onMouseenter","onClick"],De=oe({__name:"StarRating",props:{modelValue:{default:0},interactive:{type:Boolean,default:!1},size:{default:"sm"}},emits:["update:modelValue"],setup(e,{emit:t}){const i=e,R=t,v=x(0),k=f(()=>v.value||Math.round(i.modelValue??0)),O=f(()=>i.size==="lg"?"w-6 h-6":i.size==="md"?"w-5 h-5":"w-3.5 h-3.5");return(j,w)=>(n(),u("div",{class:W(["flex items-center gap-0.5",e.interactive?"cursor-pointer":""]),onMouseleave:w[0]||(w[0]=g=>e.interactive&&(v.value=0))},[(n(),u(ae,null,le(5,g=>h("svg",{key:g,class:W([d(O),g<=d(k)?"text-amber-400":"text-slate-200",e.interactive?"transition-colors":""]),fill:"currentColor",viewBox:"0 0 20 20",onMouseenter:I=>e.interactive&&(v.value=g),onClick:I=>e.interactive&&R("update:modelValue",g)},[...w[1]||(w[1]=[h("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.286 3.97a1 1 0 00.95.69h4.178c.969 0 1.371 1.24.588 1.81l-3.39 2.465a1 1 0 00-.364 1.118l1.286 3.97c.3.921-.755 1.688-1.54 1.118l-3.39-2.465a1 1 0 00-1.175 0l-3.39 2.465c-.784.57-1.838-.197-1.54-1.118l1.286-3.97a1 1 0 00-.364-1.118L2.34 9.397c-.783-.57-.38-1.81.588-1.81h4.178a1 1 0 00.95-.69l1.286-3.97z"},null,-1)])],42,Ie)),64))],34))}}),ne=[{id:"sales-revenue",title:"Sales & Revenue"},{id:"finance-accounting",title:"Finance & Accounting"},{id:"marketing",title:"Marketing"},{id:"human-resources",title:"Human Resources"},{id:"supply-chain-logistics",title:"Supply Chain & Logistics"},{id:"retail-ecommerce",title:"Retail & E-commerce"},{id:"customer-service",title:"Customer Service"},{id:"operations-production",title:"Operations & Production"},{id:"project-management",title:"Project Management"},{id:"healthcare",title:"Healthcare"},{id:"real-estate",title:"Real Estate"},{id:"education",title:"Education"},{id:"executive-c-level",title:"Executive / C-Level"},{id:"other-general",title:"Other / General"}];ne.map(e=>e.id);const Ae=Object.freeze(ne.reduce((e,t)=>(e[t.id]=t,e),{}));class F{id;title;author;createdDate;htmlContent;imgUrl;shortDescription;url;slug;numberOfView;tagIds;industryIds;createdAt;pbixUrl;excelFile;downloadCount;price;interactiveDashboardUrl;screenshots;avgRating;reviewCount;constructor(t={}){this.id=t.id??"",this.title=t.title??"",this.author=t.author??"",this.createdDate=t.createdDate?se(new Date(t.createdDate),"mm.dd.yyyy"):t.createdAt?.toDate?se(t.createdAt.toDate(),"mm.dd.yyyy"):"",this.htmlContent=t.htmlContent??"",this.imgUrl=t.image??t.imgUrl??"",this.shortDescription=t.shortDe
1scription??"",this.slug=t.slug??"",this.url=`/Power-BI-dashboard-examples-PBIX/${this.slug}`,this.numberOfView=t.numberOfView??0,this.tagIds=t.tagIds??[],this.industryIds=t.industryIds??[],this.createdAt=t.createdAt?{seconds:t.createdAt.seconds??0,nanoseconds:t.createdAt.nanoseconds??0}:null,this.pbixUrl=t.pbixFile??t.pbixUrl??"",this.excelFile=t.excelFile??null,this.downloadCount=t.downloadCount??0,this.price=t.price&&t.price>0?Number(t.price):void 0,this.interactiveDashboardUrl=t.interactiveDashboardUrl??void 0,this.screenshots=Array.isArray(t.screenshots)?t.screenshots:[],this.avgRating=typeof t.avgRating=="number"?t.avgRating:void 0,this.reviewCount=typeof t.reviewCount=="number"?t.reviewCount:void 0}}const ee=()=>({id:"",title:"",author:"",createdDate:"",htmlContent:"",shortDescription:"",numberOfView:0,tagIds:[],industryIds:[],createdAt:null,url:"",imgUrl:"",pbixFile:"",downloadCount:0,pbixUrl:""}),$e=ce("report",()=>{const e=x(ee()),t=x([]),i=x([]),R=x(ee()),v=x(ee()),k=x([]),O=f(()=>e.value),j=f(()=>t.value),w=f(()=>i.value),g=f(()=>R.value),I=f(()=>v.value),X=f(()=>k.value);async function Y(s){try{const r=await T("report",[{prop:"slug",op:"==",val:s},{prop:"isDeleted",op:"==",val:!1}]);r?.length>0&&(e.value=new F(r[0]))}catch(r){A(new $({message:`[getReportBySlug] ${U(r).message}`,severity:"silent",cause:r}))}}async function D(s,r){try{if(i.value=[],r==="relate"){const o=[...s.tagIds??[]].map(c=>[c]).map(c=>T("report",[{prop:"tagIds",val:c,op:"array-contains-any"},{prop:"isDeleted",val:!1,op:"=="}])),M=(await Promise.all(o)).flat(),m=[...new Set(M.map(c=>c.id))].filter(c=>c!==s.id).map(c=>M.find(b=>b.id===c)).filter(c=>!!c);if(m.length>0){const c=m.sort((b,C)=>C.createdAt-b.createdAt).slice(0,3);i.value=c.map(b=>new F(b))}}else if(r==="other"){const l=m=>[...m].sort(()=>Math.random()-.5),a=s.industryIds??[];let o=[];if(s.id)try{const m=re(),c=await $fetch(`${m.public.apiBase}/api/templates/${s.id}/co-purchased`);o=(await Promise.all((c.templateIds??[]).slice(0,3).map(C=>ve("report",C)))).filter(C=>!!C&&!C.isDeleted)}catch{}const M=(a.length?await T("report",[{prop:"isDeleted",val:!1,op:"=="},{prop:"industryIds",val:a,op:"array-contains-any"}],40):[]).filter(m=>m.id!==s.id&&!o.some(c=>c.id===m.id));let y=[...o,...l(M)].slice(0,3);if(y.length<3){const c=(await T("report",[{prop:"isDeleted",val:!1,op:"=="}],40)).filter(b=>b.id!==s.id&&!y.some(C=>C.id===b.id));y=[...y,...l(c)].slice(0,3)}i.value=y.map(m=>new F(m))}}catch(l){A(new $({message:`[getRelatedReports] ${U(l).message}`,severity:"silent",cause:l}))}}async function q(s){try{R.value={id:"",title:"",author:"",createdDate:"",htmlContent:"",shortDescription:"",numberOfView:0,tagIds:[],industryIds:[],createdAt:null,url:"",imgUrl:"",downloadCount:0,pbixUrl:""};const l=(await Q({collectionName:"report",conditions:[{prop:"createdAt",op:">=",val:s.createdAt}],limit:2,fieldOrder:"createdAt",order:"asc"})).filter(a=>a.id!==s.id);l?.length>0&&(R.value=new F(l[0]))}catch(r){A(new $({message:`[getPreviousReport] ${U(r).message}`,severity:"silent",cause:r}))}}async function z(s){try{v.value={id:"",title:"",author:"",createdDate:"",htmlContent:"",shortDescription:"",numberOfView:0,tagIds:[],industryIds:[],createdAt:null,url:"",imgUrl:"",downloadCount:0,pbixUrl:""};const l=(await Q({collectionName:"report",conditions:[{prop:"createdAt",op:"<=",val:s.createdAt}],limit:2,fieldOrder:"createdAt",order:"desc"})).filter(a=>a.id!==s.id);l?.length>0&&(v.value=new F(l[0]))}catch(r){A(new $({message:`[getNextReport] ${U(r).message}`,severity:"silent",cause:r}))}}async function G(){try{k.value=[];const s=await Q({collectionName:"report",conditions:[],limit:5,fieldOrder:"createdAt",order:"desc"});s?.length>0&&(k.value=s.map(r=>new F(r)))}catch(s){A(new $({message:`[getLatestReports] ${U(s).message}`,severity:"silent",cause:s}))}}async function H(s,r){try{await we({collectionName:"report",id:s,document:r})}catch(l){A(new $({message:`[updateReport] ${U(l).message}`,severity:"silent",cause:l}))}}async function J(s){if(s)try{await ye("report",s,"downloadCount",1),e.value.id===s&&(e.value.downloadCount=(e.value.downloadCount??0)+1)}catch{}}async function E(){try{const s=await T("report",[{prop:"isDeleted",op:"==",val:!1}]),r={};for(const o of s)for(const p of o.industryIds??[])r[p]=(r[p]??0)+1;const l=new Map;for(const o of s){const p={...new F(o)};l.has(p.slug)||l.set(p.slug,p)}return{cards:[...l.values()].sort((o,p)=>(p.createdAt?.seconds??0)-(o.createdAt?.seconds??0)),industryCounts:r}}catch(s){return A(new $({message:`[fetchReportCards] ${U(s).message}`,severity:"silent",cause:s})),{cards:[],industryCounts:{}}}}return{report:O,topViewedReports:j,relatedReports:w,previousReport:g,nextReport:I,latestReports:X,getReportBySlug:Y,updateReport:H,getRelatedReports:D,getPreviousReport:q,getNextReport:z,getLatestReports:G,incrementDownloadCount:J,fetchReportCards:E}}),Ue=["role","tabindex","aria-label"],Se={class:"relative overflow-hidden"},Be=["src","alt"],Ve={key:1,class:"w-full aspect-[4/3] flex items-center justify-center bg-gradient-to-br from-indigo-50 via-white to-slate-100"},Pe={key:1,tabindex:"-1","aria-hidden":"true"},Ne=["src","alt"],Fe={key:1,class:"w-full aspect-[4/3] flex items-center justify-center bg-gradient-to-br from-indigo-50 via-white to-slate-100"},Me=["aria-label"],Le={key:2,class:"absolute top-2.5 right-2.5 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-500 text-white"},Oe={key:3,class:"absolute top-2.5 right-2.5 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold bg-indigo-600 text-white"},je={key:4,class:"absolute bottom-2.5 left-2.5 px-2 py-0.5 rounded-full text-xs font-semibold bg-slate-900/80 text-white backdrop-blur-sm"},ze={class:"p-4 flex flex-col flex-1"},Ee={class:"text-sm font-bold text-slate-900 line-clamp-2 min-h-[40px] mb-auto"},Te={key:1,class:"hover:text-indigo-600 transition-colors"},He={class:"flex justify-between items-center mt-3 pt-3 border-t border-slate-100"},Ke={class:"flex items-center gap-2 text-sm text-slate-500"},We={class:"flex items-center gap-1"},Xe=["title"],Ye={key:0,class:"inline-flex items-center gap-1 px-3 py-1.5 text-xs font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 rounded-full"},qe={key:2,class:"flex items-center gap-1.5"},Ge=["aria-label","disabled"],it=oe({__name:"Card",props:{item:{},hasPurchased:{type:Boolean},linkable:{type:Boolean,default:!0}},emits:["openSubscribePopup"],setup(e,{emit:t}){const i=e,R=t,v=de(),{dataUser:k}=ue(v),O=$e(),j=me(),w=pe(),g=x(!1),I=x(!1),X=re(),{downloadTemplate:Y}=be(),D=f(()=>j.hasItem(i.item.id)),q=()=>{D.value||(j.addItem({templateId:i.item.id,slug:i.item.slug??"",title:i.item.title,price:i.item.price??0,imgUrl:i.item.imgUrl}),L.success("Added to cart",{autoClose:1500}))},z=f(()=>w.hasItem(i.item.id)),G=()=>{w.toggle({templateId:i.item.id,slug:i.item.slug??"",title:i.item.title,price:i.item.price??0,imgUrl:i.item.imgUrl}),L.success(z.value?"Saved to wishlist":"Removed from wishlist",{autoClose:1500})},H=f(()=>{const a=i.item.industryIds?.[0];return a?Ae[a]?.title??null:null}),J=a=>a?a>=1e3?(a/1e3).toFixed(1).replace(/\.0$/,"")+"k":String(a):"0",E=a=>ge(a),s=()=>{i.item.url?R("openSubscribePopup",i.item):L.error("Unable to open subscription popup: Invalid URL.",{autoClose:2e3})},r=async()=>
1{if(!(!i.item.id||I.value)){I.value=!0;try{L.info("Preparing downloadâ¦",{autoClose:1500}),await Y(i.item.id,i.item.title),O.incrementDownloadCount(i.item.id)}catch{L.error("Failed to start download.",{autoClose:2e3})}finally{I.value=!1}}},l=async()=>{g.value=!0;try{const a=await $fetch(`${X.public.apiBase}/api/checkout`,{method:"POST",body:{templateId:i.item.id,templateSlug:i.item.slug??"",buyerEmail:k.value?.email??"",buyerUid:k.value?.uid??""}});a.url&&(window.location.href=a.url)}catch{L.error("Unable to start checkout. Please try again.",{autoClose:3e3})}finally{g.value=!1}};return(a,o)=>{const p=fe,M=De,y=he;return n(),u("div",{class:W(["group bg-white rounded-2xl border border-slate-200 shadow-sm hover:shadow-md hover:border-indigo-200 transition-all duration-200 overflow-hidden flex flex-col flex-1 basis-[280px] max-w-[340px]",e.linkable?"cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 focus-visible:outline-offset-2":""]),role:e.linkable?"link":void 0,tabindex:e.linkable?0:void 0,"aria-label":e.item.title,onClick:o[3]||(o[3]=m=>e.linkable&&E(e.item.url)),onKeydown:[o[4]||(o[4]=te(m=>e.linkable&&E(e.item.url),["enter"])),o[5]||(o[5]=te(V(m=>e.linkable&&E(e.item.url),["prevent"]),["space"]))]},[h("div",Se,[e.linkable?(n(),S(p,{key:0,to:e.item.url,tabindex:"-1","aria-hidden":"true",onClick:o[0]||(o[0]=V(()=>{},["stop"]))},{default:K(()=>[e.item.imgUrl?(n(),u("img",{key:0,src:e.item.imgUrl,alt:e.item.title,class:"w-full object-cover aspect-[4/3] group-hover:scale-[1.02] transition-transform duration-300"},null,8,Be)):(n(),u("div",Ve,[B(d(ie),{class:"w-10 h-10 text-indigo-300","aria-hidden":"true"})]))]),_:1},8,["to"])):(n(),u("div",Pe,[e.item.imgUrl?(n(),u("img",{key:0,src:e.item.imgUrl,alt:e.item.title,class:"w-full object-cover aspect-[4/3] group-hover:scale-[1.02] transition-transform duration-300"},null,8,Ne)):(n(),u("div",Fe,[B(d(ie),{class:"w-10 h-10 text-indigo-300","aria-hidden":"true"})]))])),h("button",{type:"button",class:"absolute top-2.5 left-2.5 p-1.5 rounded-full bg-white/90 backdrop-blur-sm shadow-sm hover:bg-white transition-colors","aria-label":d(z)?"Remove from wishlist":"Save to wishlist",onClick:V(G,["stop"])},[d(z)?(n(),S(d(xe),{key:0,class:"w-4 h-4 text-red-500"})):(n(),S(d(ke),{key:1,class:"w-4 h-4 text-slate-500"}))],8,Me),e.item.price?(n(),u("span",Oe," $"+N(e.item.price),1)):(n(),u("span",Le,[B(d(_),{class:"w-3 h-3"}),o[6]||(o[6]=P(" Free ",-1))])),d(H)?(n(),u("span",je,N(d(H)),1)):Z("",!0)]),h("div",ze,[h("h3",Ee,[e.linkable?(n(),S(p,{key:0,to:e.item.url,class:"hover:text-indigo-600 transition-colors",onClick:o[1]||(o[1]=V(()=>{},["stop"]))},{default:K(()=>[P(N(e.item.title),1)]),_:1},8,["to"])):(n(),u("span",Te,N(e.item.title),1))]),h("div",He,[h("div",Ke,[h("span",We,[B(d(Re),{class:"w-3.5 h-3.5 text-slate-400"}),P(" "+N(J(e.item.downloadCount)),1)]),e.item.reviewCount?(n(),u("span",{key:0,class:"flex items-center gap-1",title:`${e.item.reviewCount} review${e.item.reviewCount===1?"":"s"}`},[B(M,{"model-value":e.item.avgRating??0,size:"sm"},null,8,["model-value"]),P(" "+N(e.item.avgRating?.toFixed(1)),1)],8,Xe)):Z("",!0)]),e.item.price&&e.item.price>0&&e.hasPurchased?(n(),u("span",Ye,[B(d(_),{class:"w-3 h-3"}),o[7]||(o[7]=P(" Purchased ",-1))])):Z("",!0),!e.item.price||e.hasPurchased?(n(),S(y,{key:1,variant:"outline",size:"sm",onClick:o[2]||(o[2]=V(m=>e.hasPurchased?r():s(),["stop"]))},{default:K(()=>[...o[8]||(o[8]=[P(" Download now ",-1)])]),_:1})):(n(),u("div",qe,[h("button",{type:"button",class:W(["p-1.5 rounded-lg border transition-colors flex-shrink-0",d(D)?"border-emerald-200 bg-emerald-50 text-emerald-600":"border-slate-200 text-slate-500 hover:border-indigo-300 hover:text-indigo-600"]),"aria-label":d(D)?"Already in cart":"Add to cart",disabled:d(D),onClick:V(q,["stop"])},[d(D)?(n(),S(d(_),{key:0,class:"w-4 h-4"})):(n(),S(d(Ce),{key:1,class:"w-4 h-4"}))],10,Ge),B(y,{size:"sm",loading:g.value,onClick:V(l,["stop"])},{default:K(()=>[P(N(g.value?"Loadingâ¦":`Buy â $${e.item.price}`),1)]),_:1},8,["loading"])]))])])],42,Ue)}}});export{Ae as I,F as R,it as _,ne as a,De as b,_ as r,$e as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.