import{P as t,aB as e,bi as s,bh as i,aJ as n,aQ as a,aO as o}from"../../../../vendor-element-plus.js?ver=3.1.0";import{bR as l,r,c,o as d,d as u,w as f,b as _,L as p,P as h,Q as m,as as b,a as y,n as g,O as v}from"../../../../vendor.js?ver=3.1.0";import{_ as $}from"../../../../fc-bits-ui.js?ver=3.1.0";const k={key:0,class:"fc_loading"},w={key:1,style:{padding:"10px 15px"},class:"fc_individual_progress"},L={style:{"margin-bottom":"15px"}},z={class:"fluentcrm_clickable"};const I=$({name:"LazyIndividualProgress",props:["subscriber_id","funnel"],data:()=>({funnel_subscriber:{},sequences:[],loading:!0,isLoaded:!1,MoreFilledIcon:t}),computed:{keyedMetrics(){return this.isLoaded?l(this.funnel_subscriber.metrics,"sequence_id"):{}},timelines(){if(!this.isLoaded)return[];let t=this.$t("Entrance (%s)",this.funnel.title);"pending"===this.funnel_subscriber.status?t+=this.$t("_In_Wfdoc"):"waiting"===this.funnel_subscriber.status&&(t+=this.$t("_In_Wfna"));const e=[{content:t,timestamp:this.nsHumanDiffTime(this.funnel_subscriber.created_at),size:"large",type:"primary",icon:this.MoreFilledIcon}];let s=!1;return this.each(this.sequences,(t,i)=>{const n=this.keyedMetrics[t.id]||{};let a=t.title;"pending"===a?a+=this.$t("_In_Wfdc"):"waiting"===a&&(a+=this.$t("_In_Wfna")),"conditional"==t.type&&(s=t);let o="";if(t.condition_type){o="fc_path_"+t.condition_type,s&&(o="fc_"+s.action_name+" "+o);let e=this.$t("Condition:")+" "+t.condition_type;if("funnel_ab_testing"==s.action_name){const s="yes"==t.condition_type?this.$t("B"):this.$t("A");e=this.$t("Path: ")+s,o+="_"+s}a+=" ( "+e+" )"}n.status||(o+=" fc_timeline_empty"),e.push({content:a,status:n.status,notes:n.notes,timestamp:this.nsHumanDiffTime(n.created_at),color:this.getTimelineColor(n),wrapper_class:o})}),e}},methods:{getTimelineColor:t=>t.status&&"completed"===t.status?"#0bbd87":"",fetchData(){this.loading=!0,this.$get(`funnels/${this.funnel.id}/subscribers/${this.subscriber_id}`).then(t=>{this.funnel_subscriber=t.funnel_subscriber,this.sequences=t.sequences}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1,this.isLoaded=!0})},maybeFetchData(){this.isLoaded||this.fetchData()}}},[["render",function(t,l,$,I,D,q){const x=e,C=a,F=n,M=i,P=s,T=r("router-link"),W=o;return d(),c("div",null,[u(W,{placement:"right",onShow:l[0]||(l[0]=t=>q.maybeFetchData()),width:"400","popper-class":"fc_individual_progress_popover",trigger:"click"},{reference:f(()=>[_("span",z,h($.funnel.title),1)]),default:f(()=>[_("div",null,[D.loading?(d(),c("div",k,[u(x,{loading:!0,rows:3})])):D.isLoaded?(d(),c("div",w,[_("div",L,h(t.$t("Current Status:"))+" "+h(D.funnel_subscriber.status),1),u(P,null,{default:f(()=>[(d(!0),c(m,null,b(q.timelines,(t,e)=>(d(),y(M,{key:e,class:g(t.wrapper_class),icon:t.icon,type:t.type,color:t.color,size:t.size,timestamp:t.timestamp},{default:f(()=>[v(h(t.content)+" ",1),_("template",null,[t.notes?(d(),y(F,{key:0,class:"item",effect:"dark",content:t.notes,placement:"top-start"},{default:f(()=>[u(C,{size:"small",type:"info"},{default:f(()=>[v(h(t.status),1)],void 0,!0),_:2},1024)],void 0,!0),_:2},1032,["content"])):t.status?(d(),y(C,{key:1,size:"small",type:"info"},{default:f(()=>[v(h(t.status),1)],void 0,!0),_:2},1024)):p("",!0)])],void 0,!0),_:2},1032,["class","icon","type","color","size","timestamp"]))),128))],void 0,!0),_:1}),u(T,{to:{name:"edit_funnel",params:{funnel_id:this.funnel.id}}},{default:f(()=>[v(h(t.$t("View Automation Steps")),1)],void 0,!0),_:1},8,["to"])])):p("",!0)])],void 0),_:1})])}]]);export{I as default};
