PageSourceSearch

https://ai.bixjet.com/static/js/9726.fb9886d5.chunk.js

js bixjet.com collected 2026-09-24 13:26:51 UTC 56,667 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkbixjet_ai=globalThis.webpackChunkbixjet_ai||[]).push([[9726],{21821(e,t,o){o.d(t,{Br:()=>c,F6:()=>m,QM:()=>h,SM:()=>x,Tm:()=>p,U9:()=>g,Z7:()=>A,bB:()=>k,bT:()=>y,br:()=>f,jm:()=>j,kw:()=>u,oi:()=>v,sW:()=>d,ug:()=>b,v7:()=>S,vl:()=>w});var r=o(97913),l=o(9950),n=o(10300),i=o(97497);const s="#f59e0b",a="#d97706";function d(){const e=(0,n.d4)(e=>null===e||void 0===e?void 0:e.theme)||{};return(0,l.useMemo)(()=>{const t=e.primaryColor||s,o=e.accentColor||a,r=e.buttonColor||t,l=e.buttonFontColor||"#ffffff",n="number"===typeof e.borderRadius?e.borderRadius:2,d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12;const o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e||"");if(!o)return e;const r=e=>Math.max(0,Math.min(255,Math.round(parseInt(e,16)*(1-t))));return`#${[r(o[1]),r(o[2]),r(o[3])].map(e=>e.toString(16).padStart(2,"0")).join("")}`},c=d(t),u=d(r),x=(0,i.X4)(t,.1);return{primary:t,primaryDark:c,accent:o,buttonColor:r,buttonFontColor:l,btnBgHover:u,primaryBg:x,primaryBg2:(0,i.X4)(t,.18),radius:n,primaryBtnSx:{textTransform:"none",fontWeight:700,bgcolor:r,color:l,boxShadow:"none",borderRadius:n,"&:hover":{bgcolor:u,boxShadow:"none"},"&.Mui-disabled":{bgcolor:(0,i.X4)(r,.5),color:l}},outlinedBtnSx:{textTransform:"none",fontWeight:600,borderRadius:n,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:t,color:t,bgcolor:x}},iconBtnSx:{color:t,"&:hover":{bgcolor:x}}}},[e])}const c=Object.freeze({Active:1,Inactive:2}),u=Object.freeze({MainStep:1,ChildStep:2}),x=Object.freeze({email:1,Sms:2,CallTask:3,Task:4,Deal:5,Document:6,Property:7}),p=(Object.freeze({BixpandEmailService:0,GmailService:1,OutlookEmailService:2,SMTPService:3}),Object.freeze({Bixpand:0,Google:1,Outlook:2,SMTP:3})),h=Object.freeze({no:0,custom:1,default:2});function m(){try{return JSON.parse(localStorage.getItem("userid"))}catch{return null}}function b(){try{return JSON.parse(localStorage.getItem("user"))}catch{return null}}function f(){try{return JSON.parse(localStorage.getItem("location_Id"))}catch{return null}}function g(){try{return JSON.parse(localStorage.getItem("business_Id"))}catch{return null}}function v(e){if(!e)return null;if("string"!==typeof e)return e;try{return JSON.parse(e)}catch{return null}}function A(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e&&!t&&!o)return"Immediately";const r=[];return e&&r.push(`${e}d`),t&&r.push(`${t}h`),o&&r.push(`${o}m`),r.join(" ")}function j(e){let{workflowId:t,workFlowStepId:o,sequence:r,days:l=0,hours:n=0,minutes:i=0,steptype:s=u.MainStep,actiontype:a,title:d,body:x=null,additionaldata:p=null,extra:h={},forEdit:b=!1}=e;const v={workflowid:t,sequence:r,days:parseInt(l,10)||0,hours:parseInt(n,10)||0,minutes:parseInt(i,10)||0,status:c.Active,steptype:s,actiontype:a,title:d,body:x,additionaldata:"string"===typeof p?p:p?JSON.stringify(p):null,locationid:f(),businessid:g(),...h};return b?(v.workflowstepid=o,v.updatedby=m(),delete v.steptype):v.createdby=m(),v}function y(e,t){return t?t+1:((null===e||void 0===e?void 0:e.length)||0)+1}function w(e){if(!e)return"\u2014";const t=parseInt(e,10);return Number.isNaN(t)?"\u2014":(0,r.A)(t).format("YYYY-MM-DD HH:mm")}function S(e){if(null==e||""===e)return"\u2014";let t;t="number"===typeof e?e:"string"===typeof e&&/^\d+$/.test(e)?parseInt(e,10):e,"number"===typeof t&&t<1e10&&(t*=1e3);const o=(0,r.A)(t);return o&&o.isValid()?o.format("MMM DD, YYYY h:mm A"):"\u2014"}function k(e){return(e||"").split(/\s+/).filter(Boolean).slice(0,2).map(e=>{var t;return null===(t=e[0])||void 0===t?void 0:t.toUpperCase()}).join("")}},69726(e,t,o){o.r(t),o.d(t,{default:()=>Ve});var r=o(9950),l=o(10300),n=o(16491),i=o(48089),s=o(93230),a=o(83274),d=o(82053),c=o(25333),u=o(60899),x=o(25277),p=o(8145),h=o(2046),m=o(10226),b=o(1320),f=o(2235),g=o(15769),v=o(69780),A=o(9213),j=o(21671),y=o(34075),w=o(46639),S=o(41413),k=o(25979),C=o(70006),z=o(23266),I=o(4753),W=o(63464),R=o(88060),$=o(83239),B=o(11966),O=o(84142),T=o(93038),N=o(40033),M=o(28170),P=o(93125),D=o(39919),E=o(20544),L=o(79739),U=o(4862),q=o(65429),X=o(14857),K=o(97497),H=o(27835),F=o(41328),J=o(4804),Y=o(19223),_=o(96319),V=o(93153),Q=o(20888),G=o(57855),Z=o(58699),ee=o(87962),te=o(12406),oe=o(69755),re=o(42706),le=o(18727),ne=o(77536),ie=o(71201),se=o(55858),ae=o(50521),de=o(47728),ce=o(2442),ue=o(79693),xe=o(51487),pe=o(55683),he=o(2473),me=o(88482),be=o(84038),fe=o(95122),ge=o(8808),ve=o(53777),Ae=o(65586),je=o(92613),ye=o(3148),we=o(65187),Se=o(16528),ke=o(16243),Ce=o(24921),ze=o(1050),Ie=o(75668),We=o(20045),Re=o(21821),$e=o(36669),Be=o(44414);const Oe=ze.G1,Te=ze.RH,Ne=e=>e?String(e).replace(/^Step-(\d+)/i,"Step $1"):"-",Me=(0,r.lazy)(()=>Promise.all([o.e(673),o.e(3377)]).then(o.bind(o,60673))),Pe={1:oe.A,2:re.A,3:te.A,4:le.A,5:ne.A,6:ie.A,7:se.A,8:ae.A,9:je.A,10:ye.A},De={1:"Email",2:"SMS",3:"Task",4:"Call Task",5:"Deal",6:"Document",7:"Property",8:"LinkedIn",9:"WhatsApp",10:"Assign Workflow"},Ee={Y:"Yes",N:"No"},Le=[{key:"completed",label:"Completed",selected:1,countKey:"completedcount",palette:"success",Icon:V.A},{key:"inprogress",label:"In Progress",selected:2,countKey:"inprogresscount",palette:"info",Icon:Q.A},{key:"paused",label:"Paused",selected:3,countKey:"pausedcontactcount",palette:"warning",Icon:G.A},{key:"failed",label:"Failed",selected:4,countKey:"failedcontactcount",palette:"error",Icon:Z.A}],Ue={1:"https://storage.googleapis.com/bixpand-staging/WebsiteImages/bix-favicon.png",2:"https://storage.googleapis.com/bixpand-staging/WebsiteImages/gmail.svg",3:"https://storage.googleapis.com/bixpand-staging/WebsiteImages/outlook%201.svg",4:"https://storage.googleapis.com/bixpand-staging/WebsiteImages/SMTP.svg"},qe=[{key:"totalsent",filterKey:"issent",label:"Sent",tone:"#3b82f6",tooltip:"Total emails sent"},{key:"totaldelivered",filterKey:"isdelivered",label:"Delivered",tone:"#0ea5e9",tooltip:"Total delivered emails"},{key:"totalundelivered",filterKey:"isundelivered",label:"Undelivered",tone:"#94a3b8",tooltip:"Total undelivered emails"},{key:"totalopened",filterKey:"isopened",label:"Opened",tone:"#22c55e",tooltip:"Total opened emails"},{key:"totalclicked",filterKey:"isclicked",label:"Clicked",tone:"#8b5cf6",tooltip:"Total clicked emails"},{key:"totalbounced",filterKey:"isbounced",label:"Bounced",tone:"#ef4444",tooltip:"Total bounced emails"},{key:"totalunsubscribed",filterKey:"isunsubscribed",label:"Unsubscribed",tone:"#64748b",tooltip:"Total unsubscribed contacts"}],Xe=["Recipient","Sent","Delivered","Opens","Clicks","Bounced","Unsubscribed","Error"],Ke=[220,160,160,70,70,160,
1160,220],He=[120,90,90,50,50,90,90,100];function Fe(e){const t=Number(e||0);return Math.abs(t)>999?`${(t/1e3).toFixed(1)}k`:String(t)}const Je=["unsubscribe","optout","opt-out","list-unsubscribe"],Ye=e=>{const t=String(e||"").toLowerCase();return Je.some(e=>t.includes(e))||/\/unsub(\b|\/|\?|$)/i.test(t)},_e={fontWeight:700,fontSize:11.5,color:"text.secondary",textTransform:"uppercase",letterSpacing:"0.06em",whiteSpace:"nowrap",borderBottom:"1px solid",borderColor:"divider",position:"sticky",top:0,zIndex:2,bgcolor:e=>"dark"===e.palette.mode?"#1a1a22":"#F8FAFC"};function Ve(e){var t,o,re,le,ne,ie;let{workflowId:se,onBack:ae}=e;const ue=(0,X.A)(),xe=((0,l.d4)(e=>e.theme)||{}).primaryColor||ue.palette.primary.main,[pe,he]=(0,r.useState)(null),[me,be]=(0,r.useState)(""),[je,ye]=(0,r.useState)([]),[Je,Ve]=(0,r.useState)([]),[Ze,et]=(0,r.useState)({total:0}),[tt,ot]=(0,r.useState)(null),[rt,lt]=(0,r.useState)(1),[nt,it]=(0,r.useState)(10),st=(0,r.useRef)(null);if(null===st.current)try{st.current=sessionStorage.getItem("wf_report_presearch")||"",st.current&&sessionStorage.removeItem("wf_report_presearch")}catch{st.current=""}const at=st.current,[dt,ct]=(0,r.useState)(at),[ut,xt]=(0,r.useState)(at),[pt,ht]=(0,r.useState)(0),[mt,bt]=(0,r.useState)(null),[ft,gt]=(0,r.useState)(null),[vt,At]=(0,r.useState)(!1),[jt,yt]=(0,r.useState)(null),[wt,St]=(0,r.useState)({open:!1,message:"",severity:"success"}),kt=function(e){return St({open:!0,message:e,severity:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success"})},[Ct,zt]=(0,r.useState)(null),[It,Wt]=(0,r.useState)(!1),[Rt,$t]=(0,r.useState)(""),[Bt,Ot]=(0,r.useState)(null),[Tt,Nt]=(0,r.useState)(!1),[Mt,Pt]=(0,r.useState)(!1),[Dt,Et]=(0,r.useState)([]),[Lt,Ut]=(0,r.useState)(null),[qt,Xt]=(0,r.useState)(null),[Kt,Ht]=(0,r.useState)(null),[Ft,Jt]=(0,r.useState)(1),[Yt,_t]=(0,r.useState)(10),[Vt,Qt]=(0,r.useState)(0),[Gt,Zt]=(0,r.useState)(""),[eo,to]=(0,r.useState)(0),[oo,ro]=(0,r.useState)(Ke),lo=(0,r.useRef)({active:!1,colIdx:-1,startX:0,startW:0}),[no,io]=(0,r.useState)([]),[so,ao]=(0,r.useState)(""),[co,uo]=(0,r.useState)(null),[xo,po]=(0,r.useState)([]),[ho,mo]=(0,r.useState)(null),[bo,fo]=(0,r.useState)(null),[go,vo]=(0,r.useState)(null),[Ao,jo]=(0,r.useState)(null),[yo,wo]=(0,r.useState)(!1),[So,ko]=(0,r.useState)([]),[Co,zo]=(0,r.useState)(!1),[Io,Wo]=(0,r.useState)([]),Ro=(0,r.useCallback)((e,t)=>{e.preventDefault(),lo.current={active:!0,colIdx:t,startX:e.clientX,startW:oo[t]},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[oo]);(0,r.useEffect)(()=>{const e=e=>{const t=lo.current;if(!t.active)return;const o=Math.max(He[t.colIdx],t.startW+(e.clientX-t.startX));ro(e=>{const r=[...e];return r[t.colIdx]=o,r})},t=()=>{lo.current.active=!1,document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[]),(0,r.useEffect)(()=>{if(!Ao)return;const e=window.location.href,t=new URL(e);return t.searchParams.set("id",Ao),window.history.replaceState({},"",t.toString()),()=>{window.history.replaceState({},"",e)}},[Ao]);const $o=(0,r.useCallback)(async()=>{if(!(So.length>0)){zo(!0);try{var e;const o=JSON.parse(localStorage.getItem("business_Id"));if(!o)return;const r=await(0,Ce.e6)(ke.A.baseURLApi,{query:We.Ze,variables:{businessid:o}}),l=null===r||void 0===r||null===(e=r.data)||void 0===e?void 0:e.contactsTags;if(l)try{let e;if(Array.isArray(l))e=l;else try{e=JSON.parse(l)}catch{e=JSON.parse(l.replace(/\\"/g,'"').replace(/\\'/g,"'"))}Array.isArray(e)&&ko(Array.from(new Set(e.map(String))).filter(Boolean))}catch(t){console.warn("contactsTags parse error",t)}}catch{}finally{zo(!1)}}},[So.length]);(0,r.useEffect)(()=>{if(!se)return;let e=!1;return Promise.allSettled([(async()=>{try{var t;const i=await(0,Ce.e6)(ke.A.baseURLApi,{query:Oe,variables:{workflowid:se}});if(e)return;const s=null===i||void 0===i||null===(t=i.data)||void 0===t?void 0:t.workflowAutomationWithSteps;var o,r;if(!s)return void kt((null===i||void 0===i||null===(o=i.errors)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.message)||"Workflow not found","error");he(s);const a=[...s.workflowsteps||[]].sort((e,t)=>
1(e.sequence||0)-(t.sequence||0)).map(e=>({...e,depth:Number(e.depth)||0,pathlabel:e.pathlabel||null,branchside:e.branchside||null,parentstepid:e.parentstepid||null}));if(ye(a),s.createdby){const t=await(0,Ce.e6)(ke.A.baseURLApi,{query:Ie.Xr,variables:{userid:s.createdby}});if(!e){var l,n;const e=(null===t||void 0===t||null===(l=t.data)||void 0===l?void 0:l.userprofilebyuser)||(null===t||void 0===t||null===(n=t.data)||void 0===n?void 0:n.Userprofilebyuser);e&&be(`${e.firstname||""} ${e.lastname||""}`.trim())}}}catch(i){e||kt((null===i||void 0===i?void 0:i.message)||"Failed to load workflow","error")}})()]),()=>{e=!0}},[se]);const Bo=(0,r.useMemo)(()=>je.find(e=>e.workflowstepid===mt)||null,[je,mt]),[Oo,To]=(0,r.useState)(null),No=(0,r.useRef)({}),Mo=(0,r.useCallback)(async function(){if(!se)return;const e={stepid:mt,page:rt,pageSize:nt,search:ut,tab:pt,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}};No.current=e,At(!0);try{var t,o;const n=await(0,Ce.e6)(ke.A.baseURLApi,{query:Te,variables:{workflowid:se,stepid:e.stepid||null,pagenumber:e.page,pagesize:e.pageSize,search:e.search||null,sortBy:null,sortOrder:"ASC",status:1===e.tab?"Completed":2===e.tab?"In-Progress":3===e.tab?"Paused":4===e.tab?"Failed":null}}),i=null===n||void 0===n||null===(t=n.data)||void 0===t?void 0:t.newWorkflowReportByWorkflowid;var r,l;if(!i)return Ve([]),ot(null),To(null),void(null!==n&&void 0!==n&&null!==(r=n.errors)&&void 0!==r&&null!==(l=r[0])&&void 0!==l&&l.message&&kt(n.errors[0].message,"error"));const s=i.contactlist||[],a=Boolean(e.stepid);Ve(s.map(e=>{var t,o;const r=e.steps||[],l=null!=e.laststepsequence?`Step ${e.laststepsequence}`:Ne(r[r.length-1]);return{contactid:e.contactid,workflowcontactid:e.workflowcontactid,name:`${e.firstname||""} ${e.lastname||""}`.trim()||"-",email:e.primaryemail||"-",phone:e.phonenumber||"-",reportstatus:e.reportstatus||"Pending",status:e.status,additionaldata:e.additionaldata,emailid:e.emailid||null,objectid:e.objectid||null,error:e.error||null,workflowstartdate:e.workflowstartdate||null,lastStep:l,stepLabels:r.map(Ne),stepLabel:a?Ne(r[0]):null,stepcompletedate:e.stepcompletedate||e.completedate||null,stepstartdate:e.stepstartdate||null,stepstatus:null!==(t=e.stepstatus)&&void 0!==t?t:null,stepduration:e.stepduration||null,stepdurationms:null!==(o=e.stepdurationms)&&void 0!==o?o:null,completedate:e.completedate||null}})),To(a&&i.stepexecution||null),et({total:(null===(o=i.pagination)||void 0===o?void 0:o.total)||0}),e.search||0!==e.tab||ot({totalcontact:i.totalcontact||0,completedcount:i.completedcount||0,inprogresscount:i.inprogresscount||0,pausedcontactcount:i.pausedcontactcount||0,failedcontactcount:i.failedcontactcount||0})}finally{At(!1)}},[se,mt,rt,nt,ut,pt]);(0,r.useEffect)(()=>{Mo()},[Mo]);const Po=(0,r.useRef)({selectedStep:mt,selectedTab:pt,appliedSearch:ut});(0,r.useEffect)(()=>{const e=Po.current,t=e.selectedStep!==mt||e.selectedTab!==pt||e.appliedSearch!==ut;Po.current={selectedStep:mt,selectedTab:pt,appliedSearch:ut},t&&1!==rt&&lt(1)},[mt,pt,ut]);const Do=e=>{if(bt(e?e.workflowstepid:null),gt(e?e.actiontype:null),ht(0),e)try{const t=JSON.parse(e.additionaldata||"{}");ao(t.fromemail||""),uo(t.servicesprovider||null)}catch{ao(""),uo(null)}},Eo=async(e,t)=>{yt(e.workflowcontactid);try{var o,r;const l=await(0,Ce.e6)(ke.A.baseURLApi,{query:ze.CQ,variables:{workflowcontactid:e.workflowcontactid,status:t,isresume:2===t,contactid:e.contactid,workflowid:se,updatedby:(()=>{try{return JSON.parse(localStorage.getItem("userid"))}catch{return null}})()}});return null===l||void 0===l||null===(o=l.errors)||void 0===o||null===(r=o[0])||void 0===r||!r.message||(kt(l.errors[0].message,"error"),!1)}finally{yt(null)}},Lo=()=>{zt(null),Ot(null),$t("")},Uo=e=>{if(!e)return{};const t={issent:"senttime",isdelivered:"delivereddate",isundelivered:"undelivereddate",isopened:"openeddate",isclicked:"clickeddate",isbounced:"bounceddate",isunsubscribed:"unsubscribeddate"}[e];return t?{senttime:!1,delivereddate:!1,undelivereddate:!1,openeddate:!1,clickeddate:!1,bounceddate:!1,unsubscribeddate:!1,[t]:!0}:{}},qo=(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(mt){Pt(!0);try{var t,o,r,l;const s=await(0,Ce.e6)(ke.A.baseURLApi,{query:ze.dJ,variables:{workflowid:se,stepid:mt,page:null!==(t=e.page)&&void 0!==t?t:Ft,limit:null!==(o=e.pageSize)&&void 0!==o?o:Yt,search:(void 0!==e.search?e.search:Gt)||null,sortBy:null,sortOrder:"ASC",filters:Uo(void 0!==e.filterKey?e.filterKey:Kt)}}),a=(null===s||void 0===s||null===(r=s.data)||void 0===r?void 0:r.WorkflowEmailReportWithPagination)||(null===s||void 0===s||null===(l=s.data)||void 0===l?void 0:l.workflowEmailReportWithPagination);if(a){var n,i;const t={totalsent:a.totalsent||0,totaldelivered:a.totaldelivered||0,totalundelivered:a.totalundelivered||0,totalopened:a.totalopened||0,totalclicked:a.totalclicked||0,totalbounced:a.totalbounced||0,totalunsubscribed:a.totalunsubscribed||0};Ut(t),null!==e.filterKey&&void 0!==e.filterKey||Xt(t),Qt((null===(n=a.pagination)||void 0===n?void 0:n.totalRecords)||(null===(i=a.pagination)||void 0===i?void 0:i.total)||0),Et
1((a.emailreports||[]).map(e=>({contactid:e.contactid,name:`${e.firstname||""} ${e.lastname||""}`.trim()||"-",email:e.primaryemail||"-",phone:e.phonenumber||"-",senttime:e.senttime,delivereddate:e.delivereddate,openeddate:e.openeddate,opencount:(()=>{try{const t=JSON.parse(e.openeddata||"[]");return Array.isArray(t)?t.length:0}catch{return 0}})(),openeddata:e.openeddata,clickeddate:e.clickeddate,clickcount:(()=>{try{const t=JSON.parse(e.clickeddata||"[]");return Array.isArray(t)?t.length:0}catch{return 0}})(),clickeddata:e.clickeddata,bounceddate:e.bounceddate,unsubscribeddate:e.unsubscribeddate,errormessage:e.errormessage||""})))}}finally{Pt(!1)}}},[mt,se,Ft,Yt,Gt,Kt]),Xo=(0,r.useCallback)(async()=>{if(mt)try{var e;const t=await(0,Ce.e6)(ke.A.baseURLApi,{query:"query WorkflowEmailClickReport($workflowid: ID!, $stepid: ID!) { workflowEmailClickReport(workflowid: $workflowid, stepid: $stepid) { url totalcount uniquecount } }",variables:{workflowid:se,stepid:mt}});po((null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.workflowEmailClickReport)||[])}catch{po([])}},[mt,se]),Ko=()=>{Nt(!1),Et([]),Ut(null),Xt(null),Ht(null),po([]),io([])},Ho=e=>{const t=Kt===e?null:e;Ht(t),Jt(1),io([]),qo({filterKey:t,page:1})},Fo=()=>{Jt(1),qo({page:1,search:Gt})},Jo=async(e,t)=>{mo({url:e,mode:t,rows:[],loading:!0});try{var o,r;const l="unique"===t?ze.R5:ze.A$,n=await(0,Ce.e6)(ke.A.baseURLApi,{query:l,variables:{workflowid:se,stepid:mt,url:e}}),i="unique"===t?(null===n||void 0===n||null===(o=n.data)||void 0===o?void 0:o.workflowEmailUniqueClickReportbyUrl)||[]:(null===n||void 0===n||null===(r=n.data)||void 0===r?void 0:r.workflowEmailClickReportByUrl)||[];mo({url:e,mode:t,rows:i,loading:!1})}catch{mo({url:e,mode:t,rows:[],loading:!1})}},Yo=()=>{const e=Dt.map(e=>({Name:e.name,Email:e.email,Phone:e.phone,SentTime:(0,Re.v7)(e.senttime),DeliveredDate:(0,Re.v7)(e.delivereddate),OpenCount:e.opencount,ClickCount:e.clickcount,BouncedDate:(0,Re.v7)(e.bounceddate),UnsubscribedDate:(0,Re.v7)(e.unsubscribeddate),ErrorMessage:e.errormessage}));!function(e,t,o){const r=e=>`"${String(null!==e&&void 0!==e?e:"").replace(/"/g,'""')}"`,l=[t.map(r).join(",")].concat(o.map(e=>t.map(t=>r(e[t])).join(","))),n=new Blob([l.join("\n")],{type:"text/csv;charset=utf-8"}),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}(`workflow-${se}-step-${mt}-email.csv`,["Name","Email","Phone","SentTime","DeliveredDate","OpenCount","ClickCount","BouncedDate","UnsubscribedDate","ErrorMessage"],e)},_o=Dt.length>0&&Dt.every(e=>no.includes(e.contactid)),Vo=Dt.some(e=>no.includes(e.contactid)),Qo=Math.max(1,Math.ceil(Ze.total/nt)),Go={Completed:{color:(Zo=ue.palette).success.main,Icon:V.A,label:"Completed"},"In-Progress":{color:Zo.info.main,Icon:Q.A,label:"In Progress"},"In Progress":{color:Zo.info.main,Icon:Q.A,label:"In Progress"},Pending:{color:Zo.warning.main,Icon:ee.A,label:"Pending"},"Not Started":{color:Zo.warning.main,Icon:ee.A,label:"Not Started"},Paused:{color:Zo.text.secondary,Icon:G.A,label:"Paused"},Failed:{color:Zo.error.main,Icon:Z.A,label:"Failed"},Stopped:{color:Zo.error.main,Icon:Z.A,label:"Stopped"}};var Zo;const er=Math.max(1,Math.ceil(Vt/Yt)),tr=(0,r.useMemo)(()=>{const e=[],t=[];for(const o of xo)Ye(null===o||void 0===o?void 0:o.url)?t.push(o):e.push(o);return[...e,...t]},[xo]),or=e=>(null===tt||void 0===tt?void 0:tt[e])||0;return(0,Be.jsxs)(n.A,{sx:{p:3,minHeight:"100vh",bgcolor:"background.default"},children:[(0,Be.jsx)(i.A,{sx:{p:2.5,mb:2},children:(0,Be.jsxs)(s.A,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{md:"center"},justifyContent:"space-between",children:[(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1.5,children:[ae&&(0,Be.jsx)(a.A,{title:"Back",children:(0,Be.jsx)($e.A,{label:"Back",onClick:ae})}),(0,Be.jsx)(n.A,{sx:{width:44,height:44,borderRadius:1.5,bgcolor:(0,K.X4)(xe,.12),color:xe,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Be.jsx)(te.A,{})}),(0,Be.jsxs)(n.A,{children:[(0,Be.jsx)(d.A,{variant:"h6",sx:{fontWeight:700,lineHeight:1.2},children:(null===pe||void 0===pe?void 0:pe.name)||"Workflow Report"}),(0,Be.jsxs)(d.A,{variant:"body2",color:"text.secondary",sx:{mt:.25},children:[me?`Created by ${me}`:"",null!==pe&&void 0!==pe&&pe.starttime?`${me?" \xb7 ":""}Started ${(0,Re.v7)(pe.starttime)}`:""]})]})]}),(0,Be.jsx)(a.A,{title:"Refresh",children:(0,Be.jsx)(c.A,{onClick:()=>Mo(),sx:{border:"1px solid",borderColor:"divider"},children:(0,Be.jsx)(J.A,{fontSize:"small"})})})]})}),tt&&(0,Be.jsx)(u.Ay,{container:!0,spacing:2,sx:{mb:2},children:Le.map(e=>{var t;const o=e.Icon,r=or(e.countKey),l=(e=>{const t=(null===tt||void 0===tt?void 0:tt.totalcontact)||0;if(!t)return null;const o=or(e);return o>0?(100*o/t).toFixed(1):"0"})(e.countKey),a=pt===e.selected,c=(null===(t=ue.palette[e.palette])||void 0===t?void 0:t.main)||xe;return(0,Be.jsx)(u.Ay,{item:!0,xs:6,sm:6,md:3,children:(0,Be.jsx)(i.A,{onClick:()=>
1ht(a?0:e.selected),sx:{p:2,cursor:"pointer",border:"2px solid",borderColor:a?c:"transparent",transition:"all .15s","&:hover":{borderColor:(0,K.X4)(c,.5)}},children:(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Be.jsx)(n.A,{sx:{width:42,height:42,borderRadius:1.5,bgcolor:(0,K.X4)(c,.12),color:c,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Be.jsx)(o,{})}),(0,Be.jsxs)(n.A,{children:[(0,Be.jsxs)(s.A,{direction:"row",spacing:.75,alignItems:"baseline",children:[(0,Be.jsx)(d.A,{sx:{fontWeight:800,fontSize:22,lineHeight:1.1},children:r}),null!==l&&(0,Be.jsxs)(d.A,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,fontSize:12},children:[l,"%"]})]}),(0,Be.jsx)(d.A,{variant:"caption",color:"text.secondary",sx:{display:"block",fontWeight:600,fontSize:11.5,textTransform:"uppercase",letterSpacing:"0.04em"},children:e.label})]})]})})},e.key)})}),(0,Be.jsxs)(u.Ay,{container:!0,spacing:2,children:[(0,Be.jsx)(u.Ay,{item:!0,xs:12,md:3,lg:2.75,children:(0,Be.jsxs)(i.A,{sx:{p:0,overflow:"hidden"},children:[(0,Be.jsx)(n.A,{sx:{px:2,py:1.25,borderBottom:"1px solid",borderColor:"divider"},children:(0,Be.jsx)(d.A,{variant:"caption",color:"text.secondary",sx:{fontWeight:700,fontSize:11,textTransform:"uppercase",letterSpacing:"0.06em"},children:"Sequence"})}),(0,Be.jsxs)(n.A,{sx:{p:1.5,maxHeight:600,overflowY:"auto",overflowX:"hidden","&::-webkit-scrollbar":{width:3},"&::-webkit-scrollbar-thumb":{bgcolor:"divider",borderRadius:2}},children:[(0,Be.jsx)(Qe,{index:"\u2022",title:"Overview",subtitle:"All recipients",Icon:te.A,tone:xe,active:null===mt,onClick:()=>Do(null),isLast:0===je.length}),je.map((e,t)=>{const o=Pe[e.actiontype]||te.A,r=t===je.length-1,l=e.sequence||t+1,n=[De[e.actiontype]||"Step"];return e.condition&&n.push("branches"),(0,Be.jsx)(Qe,{index:l,title:`Step ${l}`,subtitle:n.join(" \xb7 "),tooltip:e.title||"",Icon:o,tone:xe,active:mt===e.workflowstepid,onClick:()=>Do(e),isLast:r,depth:e.depth,pathlabel:e.pathlabel,branchside:e.branchside,hasBranch:Boolean(e.condition)},e.workflowstepid)})]})]})}),(0,Be.jsx)(u.Ay,{item:!0,xs:12,md:9,lg:9.25,children:(0,Be.jsxs)(i.A,{sx:{overflow:"visible"},children:[(0,Be.jsxs)(n.A,{sx:{px:2,py:1.25,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,flexWrap:"wrap"},children:[(0,Be.jsxs)(n.A,{sx:{minWidth:0},children:[(0,Be.jsxs)(s.A,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",children:[(0,Be.jsx)(d.A,{variant:"subtitle2",sx:{fontWeight:700},children:null===mt?"Recipients (Overview)":`Recipients \u2014 Step ${null!==(t=null===Bo||void 0===Bo?void 0:Bo.sequence)&&void 0!==t?t:""}`}),(null===Bo||void 0===Bo?void 0:Bo.pathlabel)&&(0,Be.jsx)(x.A,{size:"small",icon:(0,Be.jsx)(we.A,{sx:{fontSize:13}}),label:`${Bo.branchside?`${Ee[Bo.branchside]} path`:"Branch"} \xb7 ${Bo.pathlabel}`,sx:{height:20,fontSize:10.5,fontWeight:700,bgcolor:(0,K.X4)(xe,.08),color:xe,"& .MuiChip-icon":{color:xe}}})]}),null!==mt&&Oo&&(0,Be.jsxs)(d.A,{variant:"caption",color:"text.secondary",sx:{display:"flex",alignItems:"center",gap:.5,mt:.25},children:[(0,Be.jsx)(Se.A,{sx:{fontSize:13}}),null!==(o=Oo.runs)&&void 0!==o?o:0," run",1===(null!==(re=Oo.runs)&&void 0!==re?re:0)?"":"s"," \xb7 ",null!==(le=Oo.completedruns)&&void 0!==le?le:0," completed",Number(Oo.avgdurationms)>0&&Oo.avgduration?` \xb7 avg queue\u2192send ${Oo.avgduration}`:""]})]}),(0,Be.jsxs)(s.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,Be.jsx)(p.A,{size:"small",placeholder:"Search by name or email\u2026",value:dt,onChange:e=>ct(e.target.value),onKeyDown:e=>{"Enter"===e.key&&xt(dt)},onBlur:()=>xt(dt),InputProps:{startAdornment:(0,Be.jsx)(h.A,{position:"start",children:(0,Be.jsx)(Y.A,{sx:{fontSize:16,color:"text.secondary"}})})},sx:{width:240}}),1===ft&&mt&&(0,Be.jsx)(m.A,{size:"small",variant:"outlined",color:"primary",startIcon:(0,Be.jsx)(ce.A,{}),onClick:async()=>{mt?(Nt(!0),Ht(null),Jt(1),Zt(""),to(0),io([]),po([]),Et([]),Ut(null),Xt(null),await Promise.allSettled([qo({filterKey:null,page:1,search:""}),Xo()])):kt("Pick an email step first","info")},children:"Email Report"}),(0,Be.jsx)(m.A,{size:"small",variant:"outlined",color:"primary",startIcon:(0,Be.jsx)(de.A,{}),onClick:()=>{Wo([]),wo(!0),$o()},children:"Add Tag"})]})]}),(0,Be.jsx)(n.A,{sx:{height:600,overflow:"hidden"},children:(0,Be.jsx)(b.A,{component:f.A,elevation:0,sx:{bgcolor:"transparent",height:"100%",overflowY:"auto","&::-webkit-scrollbar":{width:5},"&::-webkit-scrollbar-thumb":{bgcolor:"divider",borderRadius:2}},children:(0,Be.jsxs)(g.A,{size:"small",stickyHeader:!0,children:[(0,Be.jsx)(v.A,{children:(0,Be.jsx)(A.A,{children:["Name","Email","Phone","Insights",null===mt?"Start Date":"Execution Date",null===mt?"Last Step":"Step","Status",...null!==mt?["Error"]:[],"Action"].map((e,t)=>(0,Be.jsx)(j.A,{sx:_e,children:e},`${e}-${t}`))})}),(0,Be.jsx)(y.A,{children:vt?(0,Be.jsx)(A.A,{sx:{height:156},children:(0,Be.jsx)(j.A,{colSpan:null===mt?8:9,align:"center",sx:{py:6},children:(0,Be.jsx)(w.A,{color:"primary"})})}):0===Je.length?(0,Be.jsx)(A.A,{sx:{height:156},children:(0,Be.jsx)(j.A,{colSpan:null===mt?8:9,align:"center",children:(0,Be.jsx)(d.A,{variant:"body2",color:"text.secondary",children:"No recipients match the current filter."})})}):Je.map(e=>{var t,o;const r="Pending"===e.reportstatus&&3===e.status?"Stopped":e.reportstatus,l=Go[r]||Go.Pending,i=l.Icon,u=2===e.status,p="Completed"===e.reportstatus;return(0,Be.jsxs)(A.A,{hover:!0,sx:{height:52,"& td":{py:0}},children:[(0,Be.jsx)(j.A,{children:(0,Be.jsxs)(s.A,{direction:"row",spacing:1.25,alignItems:"center",children:[(0,Be.jsx)(S.A,{s
1x:{width:28,height:28,fontSize:11,bgcolor:(0,K.X4)(xe,.12),color:xe,fontWeight:700},children:(0,Re.bB)(e.name)}),(0,Be.jsx)(d.A,{sx:{fontWeight:600,fontSize:13},children:e.name})]})}),(0,Be.jsx)(j.A,{sx:{fontSize:12.5,color:"text.secondary"},children:e.email}),(0,Be.jsx)(j.A,{sx:{fontSize:12.5,color:"text.secondary"},children:e.phone}),(0,Be.jsx)(j.A,{children:(0,Be.jsx)(a.A,{title:e.emailid?"View email timeline":e.additionaldata?"View report timeline":"No report yet",children:(0,Be.jsx)("span",{children:(0,Be.jsx)(c.A,{size:"small",disabled:!e.emailid&&!e.additionaldata,onClick:()=>(async e=>{zt(e),Ot(null),$t("");let t={};try{t=JSON.parse(e.additionaldata||"{}")}catch{}const o=e.emailid||t.emailid||null;if(o||t.statusid){Wt(!0);try{if(o){var r;const e=await(0,Ce.e6)(ke.A.baseURLApi,{query:"query emailreportbyemail($emailid:ID!){emailreportbyemail(emailid:$emailid){emailreportid,messageid,senttime,delivereddate,openeddate,clickeddate,bounceddate,unsubscribeddate,contactid,locationid,emailid,status}}",variables:{emailid:o}});$t("email"),Ot((null===e||void 0===e||null===(r=e.data)||void 0===r?void 0:r.emailreportbyemail)||null)}else if(t.statusid){var l;const e=await(0,Ce.e6)(ke.A.baseURLApi,{query:"query Smsstatus($statusid: ID!){smsstatus(statusid:$statusid){statusid,from,to,smstext,status,openeddate,delivereddate,clickeddate,bounceddate,unsubscribeddate,sendtime,errormessage}}",variables:{statusid:t.statusid}});$t("sms"),Ot((null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.smsstatus)||null)}}finally{Wt(!1)}}else kt("Report not found","error")})(e),sx:{color:xe,bgcolor:(0,K.X4)(xe,.08),"&:hover":{bgcolor:(0,K.X4)(xe,.18)}},children:(0,Be.jsx)(oe.A,{sx:{fontSize:16}})})})})}),(0,Be.jsx)(j.A,{sx:{fontSize:12.5,color:"text.secondary",whiteSpace:"nowrap"},children:null===mt?e.workflowstartdate?(0,Re.v7)(e.workflowstartdate):"-":e.stepcompletedate?(0,Be.jsx)(a.A,{title:Number(e.stepdurationms)>0&&e.stepduration?`Queued ${(0,Re.v7)(e.stepstartdate)} \xb7 ran after ${e.stepduration}`:"",children:(0,Be.jsx)("span",{children:(0,Re.v7)(e.stepcompletedate)})}):e.stepstartdate?(0,Be.jsx)(a.A,{title:`Queued ${(0,Re.v7)(e.stepstartdate)}`,children:(0,Be.jsx)("span",{style:{fontStyle:"italic"},children:"pending"})}):"-"}),(0,Be.jsx)(j.A,{sx:{fontSize:12.5,color:"text.secondary",whiteSpace:"nowrap"},children:null===mt?null!==(t=e.stepLabels)&&void 0!==t&&t.length?(0,Be.jsx)(a.A,{title:`Executed: ${e.stepLabels.join(", ")}`,children:(0,Be.jsx)("span",{children:e.lastStep})}):e.lastStep:e.stepLabel||`Step ${null!==(o=null===Bo||void 0===Bo?void 0:Bo.sequence)&&void 0!==o?o:""}`}),(0,Be.jsx)(j.A,{children:(0,Be.jsx)(a.A,{title:null===mt&&e.error?e.error:"",children:(0,Be.jsx)(x.A,{size:"small",icon:(0,Be.jsx)(i,{sx:{fontSize:13}}),label:l.label,sx:{fontSize:11.5,fontWeight:600,color:l.color,bgcolor:(0,K.X4)(l.color,.12),border:"1px solid",borderColor:(0,K.X4)(l.color,.3),"& .MuiChip-icon":{color:l.color},height:22}})})}),null!==mt&&(0,Be.jsx)(j.A,{sx:{fontSize:12,color:"error.main",maxWidth:260,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.error?(0,Be.jsx)(a.A,{title:e.error,children:(0,Be.jsx)(n.A,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error})}):"-"}),(0,Be.jsx)(j.A,{children:u?(0,Be.jsx)(a.A,{title:"Stop",children:(0,Be.jsx)("span",{children:(0,Be.jsx)(c.A,{size:"small",color:"error",disabled:p||jt===e.workflowcontactid,onClick:()=>(async e=>{await Eo(e,3)&&(kt("Stopped"),Mo())})(e),children:jt===e.workflowcontactid?(0,Be.jsx)(w.A,{size:14}):(0,Be.jsx)(H.A,{sx:{fontSize:18}})})})}):(0,Be.jsx)(a.A,{title:"Resume",children:(0,Be.jsx)("span",{children:(0,Be.jsx)(c.A,{size:"small",color:"success",disabled:p||jt===e.workflowcontactid,onClick:()=>(async e=>{await Eo(e,2)&&(kt("Resumed"),Mo())})(e),children:jt===e.workflowcontactid?(0,Be.jsx)(w.A,{size:14}):(0,Be.jsx)(F.A,{sx:{fontSize:18}})})})})})]},e.contactid)})})]})})}),(0,Be.jsxs)(n.A,{sx:{px:2,py:1.25,display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid",borderColor:"divider",bgcolor:e=>(0,K.X4)(e.palette.text.primary,.02),flexWrap:"wrap",gap:1},children:[(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Be.jsx)(d.A,{variant:"caption",color:"text.secondary",children:"Rows per page"}),(0,Be.jsx)(k.A,{size:"small",children:(0,Be.jsx)(C.A,{value:nt,onChange:e=>
1it(Number(e.target.value)),sx:{height:30,fontSize:13},children:[10,25,50,100].map(e=>(0,Be.jsx)(z.A,{value:e,children:e},e))})}),(0,Be.jsxs)(d.A,{variant:"caption",color:"text.secondary",children:["Page ",rt," of ",Qo]})]}),(0,Be.jsx)(I.A,{count:Qo,page:rt,onChange:(e,t)=>lt(t),siblingCount:1,size:"small",color:"primary",shape:"rounded"})]})]})})]}),(0,Be.jsxs)(W.A,{open:Tt,onClose:Ko,fullScreen:!0,children:[(0,Be.jsx)(R.A,{position:"sticky",elevation:0,sx:{bgcolor:"background.paper",color:"text.primary",borderBottom:"1px solid",borderColor:"divider"},children:(0,Be.jsxs)($.A,{children:[(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1.5,sx:{flex:1},children:[(0,Be.jsx)(d.A,{variant:"h6",sx:{fontWeight:700},children:"Email Report"}),co&&(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1,children:[(0,Be.jsx)(n.A,{component:"img",src:Ue[co],alt:"provider",sx:{width:22,height:22}}),(0,Be.jsx)(d.A,{variant:"body2",color:"text.secondary",children:so})]}),Kt&&(0,Be.jsx)(x.A,{size:"small",onDelete:()=>Ho(Kt),label:`Filtered: ${null===(ne=qe.find(e=>e.filterKey===Kt))||void 0===ne?void 0:ne.label}`,sx:{bgcolor:"#3b82f620",color:"#3b82f6",fontWeight:700,height:24}})]}),(0,Be.jsx)(a.A,{title:"Export CSV",children:(0,Be.jsx)(c.A,{onClick:Yo,sx:{mr:1},children:(0,Be.jsx)(fe.A,{})})}),(0,Be.jsx)(c.A,{onClick:Ko,children:(0,Be.jsx)(_.A,{})})]})}),(0,Be.jsxs)(n.A,{sx:{p:3},children:[(qt||Lt)&&(0,Be.jsxs)(n.A,{sx:{mb:2.5},children:[(0,Be.jsx)(s.A,{direction:"row",sx:{alignItems:"baseline",justifyContent:"space-between",mb:1.5},children:(0,Be.jsxs)(d.A,{sx:{fontWeight:800,fontSize:14,color:"text.primary",textTransform:"uppercase",letterSpacing:"0.04em"},children:["Performance \xb7 ",Fe(null===(ie=qt||Lt)||void 0===ie?void 0:ie.totalsent)," recipients"]})}),(0,Be.jsx)(u.Ay,{container:!0,spacing:1.25,children:qe.map(e=>{var t;const o=(e=>{var t;return Number((null===(t=qt||Lt)||void 0===t?void 0:t[e.key])||0)})(e),r=Kt===e.filterKey,l=Number((null===(t=qt||Lt)||void 0===t?void 0:t.totalsent)||0),i="totalsent"===e.key?o>0?100:0:l?100*o/l:0;return(0,Be.jsx)(u.Ay,{item:!0,xs:6,sm:4,md:12/7,children:(0,Be.jsxs)(n.A,{onClick:()=>Ho(e.filterKey),role:"button",sx:{position:"relative",cursor:"pointer",borderRadius:2,p:1.5,pl:2,height:"100%",border:"1px solid",borderColor:r?e.tone:"divider",bgcolor:r?e.tone+"0E":"background.paper",transition:"all 0.18s",overflow:"hidden","&:hover":{borderColor:e.tone+"80",transform:"translateY(-1px)",boxShadow:`0 4px 12px ${e.tone}18`}},children:[(0,Be.jsx)(n.A,{sx:{position:"absolute",left:0,top:8,bottom:8,width:3,borderRadius:"0 2px 2px 0",bgcolor:r?e.tone:e.tone+"55"}}),(0,Be.jsxs)(n.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:.5},children:[(0,Be.jsx)(d.A,{sx:{color:"text.secondary",fontWeight:700,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em"},children:e.label}),(0,Be.jsx)(a.A,{title:e.tooltip,children:(0,Be.jsx)(ve.A,{sx:{fontSize:12,color:"text.disabled"}})})]}),(0,Be.jsxs)(s.A,{direction:"row",alignItems:"baseline",spacing:.75,sx:{mt:.75},children:[(0,Be.jsx)(d.A,{sx:{fontWeight:800,fontSize:24,color:e.tone,lineHeight:1,letterSpacing:"-0.01em"},children:Fe(o)}),(0,Be.jsxs)(d.A,{sx:{fontSize:11.5,fontWeight:700,color:e.tone+"AA"},children:[i.toFixed(1),"%"]})]}),(0,Be.jsx)(n.A,{sx:{mt:1,height:4,bgcolor:e.tone+"1F",borderRadius:2,overflow:"hidden"},children:(0,Be.jsx)(n.A,{sx:{height:"100%",width:`${Math.min(100,i)}%`,bgcolor:e.tone,transition:"width 0.35s ease"}})})]})},e.key)})})]}),(0,Be.jsxs)(i.A,{sx:{borderRadius:2.5,border:"1px solid",borderColor:"divider",boxShadow:"none",overflow:"hidden"},children:[(0,Be.jsxs)(n.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",px:2,borderBottom:"1px solid",borderColor:"divider",gap:1},children:[(0,Be.jsxs)(B.A,{value:eo,onChange:(e,t)=>
1{to(t),1===t&&0===xo.length&&Xo()},sx:{minHeight:48,"& .MuiTab-root":{textTransform:"none",fontWeight:700,fontSize:13,minHeight:48},"& .Mui-selected":{color:"#3b82f6"},"& .MuiTabs-indicator":{bgcolor:"#3b82f6",height:3,borderRadius:"3px 3px 0 0"}},children:[(0,Be.jsx)(O.A,{label:"Contacts"+(Vt?` \xb7 ${Vt}`:"")}),(0,Be.jsx)(O.A,{label:"Click Performance"+(xo.length?` \xb7 ${xo.length}`:"")})]}),0===eo&&(0,Be.jsxs)(s.A,{direction:"row",spacing:1,alignItems:"center",children:[no.length>0&&(0,Be.jsxs)(d.A,{variant:"caption",sx:{color:"text.secondary"},children:[no.length," selected"]}),(0,Be.jsx)(p.A,{size:"small",placeholder:"Search\u2026",value:Gt,onChange:e=>Zt(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Fo()},onBlur:Fo,InputProps:{startAdornment:(0,Be.jsx)(h.A,{position:"start",children:(0,Be.jsx)(Y.A,{sx:{fontSize:16,color:"text.secondary"}})})},sx:{width:220}}),(0,Be.jsx)(a.A,{title:"Export CSV",children:(0,Be.jsx)(c.A,{size:"small",onClick:Yo,sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5},children:(0,Be.jsx)(fe.A,{fontSize:"small"})})})]})]}),0===eo&&(0,Be.jsxs)(n.A,{children:[Mt?(0,Be.jsx)(n.A,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,Be.jsx)(w.A,{size:24,sx:{color:"#3b82f6"}})}):0===Dt.length?(0,Be.jsxs)(n.A,{sx:{p:6,textAlign:"center"},children:[(0,Be.jsx)(S.A,{sx:{width:48,height:48,bgcolor:"action.hover",mx:"auto",mb:1.5},children:(0,Be.jsx)(Ae.A,{sx:{color:"text.disabled"}})}),(0,Be.jsx)(d.A,{sx:{fontWeight:600,fontSize:14},children:"No recipients match this filter"})]}):(0,Be.jsx)(b.A,{sx:{maxHeight:"calc(100vh - 480px)",minHeight:320,overflow:"auto"},children:(0,Be.jsxs)(g.A,{size:"small",stickyHeader:!0,sx:{tableLayout:"fixed"},children:[(0,Be.jsxs)("colgroup",{children:[(0,Be.jsx)("col",{style:{width:40,minWidth:40}}),oo.map((e,t)=>(0,Be.jsx)("col",{style:{width:e,minWidth:e}},t))]}),(0,Be.jsx)(v.A,{children:(0,Be.jsxs)(A.A,{children:[(0,Be.jsx)(j.A,{padding:"checkbox",sx:{..._e,width:40},children:(0,Be.jsx)(T.A,{size:"small",checked:_o,indeterminate:!_o&&Vo,onChange:()=>{const e=Dt.map(e=>e.contactid);io(_o?t=>t.filter(t=>!e.includes(t)):t=>Array.from(new Set([...t,...e])))},sx:{color:"text.secondary","&.Mui-checked":{color:"#3b82f6"},"&.MuiCheckbox-indeterminate":{color:"#3b82f6"}}})}),Xe.map((e,t)=>(0,Be.jsxs)(j.A,{sx:{..._e,position:"relative",overflow:"hidden",userSelect:"none",pr:"18px"},children:[e,(0,Be.jsx)(n.A,{onMouseDown:e=>Ro(e,t),sx:{position:"absolute",right:0,top:0,bottom:0,width:8,cursor:"col-resize",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center","&:hover .resize-line, &:active .resize-line":{bgcolor:"#3b82f6",opacity:1}},children:(0,Be.jsx)(n.A,{className:"resize-line",sx:{width:2,height:"60%",borderRadius:1,bgcolor:"divider",opacity:.5,transition:"opacity 0.15s"}})})]},e))]})}),(0,Be.jsx)(y.A,{children:Dt.map((e,t)=>{const o=no.includes(e.contactid),r=Boolean(e.contactid),l=t=>{r&&(t.stopPropagation(),jo(e.contactid))};return(0,Be.jsxs)(A.A,{hover:!0,selected:o,sx:{"&.Mui-selected":{bgcolor:"#3b82f608"},"&.Mui-selected:hover":{bgcolor:"#3b82f612"},"&:nth-of-type(even):not(.Mui-selected)":{bgcolor:"action.hover"},"& td":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,Be.jsx)(j.A,{padding:"checkbox",children:(0,Be.jsx)(T.A,{size:"small",checked:o,onChange:()=>{return t=e.contactid,io(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]);var t},sx:{color:"text.secondary","&.Mui-checked":{color:"#3b82f6"}}})}),(0,Be.jsx)(j.A,{sx:{py:1.25,overflow:"hidden"},children:(0,Be.jsxs)(s.A,{direction:"row",spacing:1.25,alignItems:"center",onClick:l,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:r?e=>{"Enter"===e.key&&l(e)}:void 0,sx:{minWidth:0,cursor:r?"pointer":"default",borderRadius:1,px:r?.5:0,mx:r?-.5:0,transition:"background-color .12s",...r?{"&:hover":{bgcolor:"#3b82f610"}}:{}},children:[(0,Be.jsx)(S.A,{sx:{width:30,height:30,fontSize:11,bgcolor:"#3b82f620",color:"#3b82f6",fontWeight:800,flexShrink:0},children:(0,Re.bB)(e.name)||(e.email||"?").substring(0,1).toUpperCase()}),(0,Be.jsxs)(n.A,{sx:{minWidth:0},children:[(0,Be.jsx)(d.A,{noWrap:!0,sx:{fontSize:13,fontWeight:600,lineHeight:1.2,color:r?"#3b82f6":"text.primary",textDecoration:r?"underline":"none",textDecorationStyle:"dotted",textUnderlineOffset:"3px"},children:"-"!==e.name?e.name:"\u2014"}),(0,Be.jsx)(d.A,{variant:"caption",sx:{color:"text.secondary",fontSize:11.5,display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},noWrap:!0,children:e.email})]})]})}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis"},children:(0,Re.v7)(e.senttime)}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis"},children:(0,Re.v7)(e.delivereddate)}),(0,Be.jsx)(j.A,{sx:{fontSize:12,overflow:"hidden"},children:e.opencount>0?(0,Be.jsx)(m.A,{size:"small",onClick:()=>(e=>{let t=[];try{t=JSON.parse(e.openeddata||"[]")}catch{}fo(t)})(e),sx:{minWidth:0,p:.5,fontWeight:700,color:"#22c55e",borderRadius:1,"&:hover":{bgcolor:"#22c55e15"}},children:e.opencount}):(0,Be.jsx)(d.A,{sx:{fontSize:12,color:"text.disabled"},children:"0"})}),(0,Be.jsx)(j.A,{sx:{fontSize:12,overflow:"hidden"},children:e.clickcount>0?(0,Be.jsx)(m.A,{size:"small",onClick:()=>(e=>{let t=[];try{t=JSON.parse(e.clickeddata||"[]")}catch{}vo(t)})(e),sx:{minWidth:0,p:.5,fontWeight:700,color:"#8b5cf6",borderRadius:1,"&:hover":{bgcolor:"#8b5cf615"}},children:e.clickcount}):(0,Be.jsx)(d.A,{sx:{fontSize:12,color:"text.disabled"},children:"0"})}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis"},children:(0,Re.v7)(e.bounceddate)}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis"},children:(0,Re.v7)(e.unsubscribeddate)}),(0,Be.jsx)(j.A,{sx:{fontSize:12,color:"#ef4444",overflow:"hidden"},children:(0,Be.jsx)(a.A,{title:e.errormessage||"",arrow:!0,placement:"top-start",children:(0,Be.jsx)(d.A,{variant:"caption",sx:{dis
1play:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#ef4444"},children:e.errormessage||""})})})]},e.contactid||t)})})]})}),(0,Be.jsxs)(s.A,{direction:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:"center",sx:{p:1.5,gap:1.5,borderTop:"1px solid",borderColor:"divider",bgcolor:"background.default"},children:[(0,Be.jsxs)(s.A,{direction:"row",spacing:1.5,alignItems:"center",children:[(0,Be.jsx)(k.A,{size:"small",sx:{minWidth:130},children:(0,Be.jsx)(C.A,{value:Yt,onChange:e=>{return t=Number(e.target.value),_t(t),Jt(1),void qo({page:1,pageSize:t});var t},sx:{borderRadius:1.5,fontSize:12,"& .MuiSelect-select":{py:.75}},children:[10,20,50,100].map(e=>(0,Be.jsxs)(z.A,{value:e,sx:{fontSize:13},children:[e," per page"]},e))})}),(0,Be.jsx)(d.A,{variant:"caption",sx:{color:"text.secondary"},children:Vt>0?`${(Ft-1)*Yt+1}\u2013${Math.min(Ft*Yt,Vt)} of ${Vt}`:"0 of 0"})]}),er>1&&(0,Be.jsx)(I.A,{count:er,page:Ft,onChange:(e,t)=>{Jt(t),io([]),qo({page:t})},color:"primary",size:"small",shape:"rounded"})]})]}),1===eo&&(0,Be.jsx)(n.A,{sx:{p:2},children:0===tr.length?(0,Be.jsxs)(n.A,{sx:{p:4,textAlign:"center"},children:[(0,Be.jsx)(S.A,{sx:{width:48,height:48,bgcolor:"action.hover",mx:"auto",mb:1.5},children:(0,Be.jsx)(ge.A,{sx:{color:"text.disabled"}})}),(0,Be.jsx)(d.A,{sx:{fontWeight:600,fontSize:14},children:"No click data yet"})]}):(0,Be.jsx)(s.A,{spacing:1,children:tr.map((e,t)=>{const o=Number(e.totalcount||0),r=Number(e.uniquecount||0),l=Ye(null===e||void 0===e?void 0:e.url);return(0,Be.jsx)(n.A,{sx:{p:1.5,borderRadius:2,border:"1px solid",borderColor:"divider",...l?{bgcolor:"action.hover",borderStyle:"dashed",opacity:.92}:{},transition:"all 0.15s","&:hover":{borderColor:"#3b82f655",bgcolor:"#3b82f606"}},children:(0,Be.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,Be.jsx)(ge.A,{sx:{fontSize:14,color:l?"text.disabled":"#3b82f6",flexShrink:0}}),(0,Be.jsx)(a.A,{title:e.url,children:(0,Be.jsx)(d.A,{component:"a",href:e.url,target:"_blank",rel:"noreferrer",sx:{fontSize:12.5,color:l?"text.secondary":"#2563eb",textDecoration:"none",wordBreak:"break-all","&:hover":{textDecoration:"underline"},flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.url})}),l&&(0,Be.jsx)(x.A,{size:"small",label:"Unsubscribe",sx:{height:18,fontWeight:700,fontSize:9.5,bgcolor:"transparent",color:"text.secondary",border:"1px solid",borderColor:"divider"}}),(0,Be.jsxs)(s.A,{direction:"row",spacing:.5,alignItems:"center",sx:{flexShrink:0},children:[(0,Be.jsxs)(m.A,{size:"small",onClick:()=>Jo(e.url,"total"),sx:{minWidth:0,p:"2px 8px",fontWeight:700,fontSize:12,color:"#8b5cf6",borderRadius:1,bgcolor:"#8b5cf615","&:hover":{bgcolor:"#8b5cf625"}},children:[o," total"]}),(0,Be.jsxs)(m.A,{size:"small",onClick:()=>Jo(e.url,"unique"),sx:{minWidth:0,p:"2px 8px",fontWeight:700,fontSize:12,color:"#0ea5e9",borderRadius:1,bgcolor:"#0ea5e915","&:hover":{bgcolor:"#0ea5e925"}},children:[r," unique"]})]})]})},`${e.url}-${t}`)})})})]})]}),(0,Be.jsxs)(W.A,{open:null!==bo,onClose:()=>fo(null),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,Be.jsxs)(N.A,{sx:{fontWeight:700,display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid",borderColor:"divider"},children:["Open History ",(0,Be.jsx)(c.A,{onClick:()=>fo(null),children:(0,Be.jsx)(_.A,{})})]}),(0,Be.jsx)(M.A,{sx:{p:0},children:0===(bo||[]).length?(0,Be.jsx)(n.A,{sx:{p:4,textAlign:"center"},children:(0,Be.jsx)(d.A,{sx:{color:"text.secondary"},children:"No opens recorded."})}):(0,Be.jsx)(g.A,{size:"small",children:(0,Be.jsx)(y.A,{children:(bo||[]).map((e,t)=>{var o,r,l,n;const i="object"===typeof e&&null!==e?null!==(o=null!==(r=null!==(l=null!==(n=e.dateTimestamp)&&void 0!==n?n:e.openeddate)&&void 0!==l?l:e.date)&&void 0!==r?r:e.timestamp)&&void 0!==o?o:e.time:e;return(0,Be.jsx)(A.A,{hover:!0,children:(0,Be.jsx)(j.A,{sx:{fontSize:13},children:(0,Be.jsxs)(s.A,{direction:"row",spacing:1.25,alignItems:"center",children:[(0,Be.jsx)(S.A,{sx:{width:24,height:24,bgcolor:"#22c55e15",color:"#16a34a",fontSize:11},children:t+1}),(0,Be.jsxs)(d.A,{sx:{fontSize:13},children:["Opened on ",(0,Re.v7)(i)]})]})})},t)})})})})]}),(0,Be.jsxs)(W.A,{open:null!==go,onClose:()=>vo(null),maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:3}}
1,children:[(0,Be.jsxs)(N.A,{sx:{fontWeight:700,display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid",borderColor:"divider"},children:["Click History ",(0,Be.jsx)(c.A,{onClick:()=>vo(null),children:(0,Be.jsx)(_.A,{})})]}),(0,Be.jsx)(M.A,{sx:{p:0},children:0===(go||[]).length?(0,Be.jsx)(n.A,{sx:{p:4,textAlign:"center"},children:(0,Be.jsx)(d.A,{sx:{color:"text.secondary"},children:"No clicks recorded."})}):(0,Be.jsxs)(g.A,{size:"small",children:[(0,Be.jsx)(v.A,{children:(0,Be.jsx)(A.A,{children:["URL","Clicked At"].map(e=>(0,Be.jsx)(j.A,{sx:{fontWeight:700,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"text.secondary",bgcolor:"background.default"},children:e},e))})}),(0,Be.jsx)(y.A,{children:(go||[]).map((e,t)=>{var o,r,l,n;const i=(null===e||void 0===e?void 0:e.url)||(null===e||void 0===e?void 0:e.link)||"",s=null!==(o=null!==(r=null!==(l=null!==(n=null===e||void 0===e?void 0:e.dateTimestamp)&&void 0!==n?n:null===e||void 0===e?void 0:e.clickeddate)&&void 0!==l?l:null===e||void 0===e?void 0:e.date)&&void 0!==r?r:null===e||void 0===e?void 0:e.timestamp)&&void 0!==o?o:null===e||void 0===e?void 0:e.time;return(0,Be.jsxs)(A.A,{hover:!0,children:[(0,Be.jsx)(j.A,{sx:{fontSize:12,wordBreak:"break-all"},children:i?(0,Be.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",style:{color:"#2563eb"},children:i}):"\u2014"}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap"},children:(0,Re.v7)(s)})]},t)})})]})})]}),(0,Be.jsxs)(W.A,{open:Boolean(ho),onClose:()=>mo(null),maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,Be.jsxs)(N.A,{sx:{fontWeight:700,display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid",borderColor:"divider"},children:["URL Report ",(0,Be.jsx)(c.A,{onClick:()=>mo(null),children:(0,Be.jsx)(_.A,{})})]}),(0,Be.jsx)(M.A,{sx:{p:0},children:ho&&(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsxs)(n.A,{sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,borderBottom:"1px solid",borderColor:"divider",bgcolor:"background.default"},children:[(0,Be.jsx)(d.A,{variant:"caption",sx:{color:"text.secondary",wordBreak:"break-all",flex:1,minWidth:0},children:ho.url}),(0,Be.jsxs)(P.A,{value:ho.mode,exclusive:!0,size:"small",onChange:(e,t)=>
1t&&Jo(ho.url,t),children:[(0,Be.jsx)(D.A,{value:"total",sx:{textTransform:"none",fontSize:12,px:1.5},children:"Total"}),(0,Be.jsx)(D.A,{value:"unique",sx:{textTransform:"none",fontSize:12,px:1.5},children:"Unique"})]})]}),ho.loading?(0,Be.jsx)(n.A,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,Be.jsx)(w.A,{size:24})}):0===(ho.rows||[]).length?(0,Be.jsx)(n.A,{sx:{p:4,textAlign:"center"},children:(0,Be.jsx)(d.A,{sx:{color:"text.secondary"},children:"No clicks on this URL yet."})}):(0,Be.jsxs)(g.A,{size:"small",children:[(0,Be.jsx)(v.A,{children:(0,Be.jsx)(A.A,{children:["Recipient","Clicked At"].map(e=>(0,Be.jsx)(j.A,{sx:{fontWeight:700,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"text.secondary",bgcolor:"background.default"},children:e},e))})}),(0,Be.jsx)(y.A,{children:ho.rows.map((e,t)=>{const o=[e.firstname,e.lastname].filter(Boolean).join(" ").trim()||"\u2014";return(0,Be.jsxs)(A.A,{hover:!0,children:[(0,Be.jsx)(j.A,{sx:{py:1.25},children:(0,Be.jsxs)(s.A,{direction:"row",spacing:1.25,alignItems:"center",children:[(0,Be.jsx)(S.A,{sx:{width:28,height:28,fontSize:11,bgcolor:"#3b82f620",color:"#3b82f6",fontWeight:800},children:(0,Re.bB)(o)||"?"}),(0,Be.jsx)(d.A,{noWrap:!0,sx:{fontSize:13,fontWeight:600},children:o})]})}),(0,Be.jsx)(j.A,{sx:{fontSize:12,whiteSpace:"nowrap"},children:(0,Re.v7)(e.datetime)})]},t)})})]})]})})]})]}),(0,Be.jsxs)(W.A,{open:Boolean(Ao),onClose:()=>jo(null),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.default"}},children:[(0,Be.jsx)(R.A,{position:"sticky",color:"default",elevation:0,sx:{borderBottom:1,borderColor:"divider",bgcolor:"background.paper"},children:(0,Be.jsxs)($.A,{sx:{minHeight:56,gap:1},children:[(0,Be.jsx)(c.A,{edge:"start",onClick:()=>jo(null),children:(0,Be.jsx)(_.A,{})}),(0,Be.jsx)(d.A,{sx:{fontSize:15,fontWeight:700,flex:1},children:"Contact"})]})}),(0,Be.jsx)(n.A,{sx:{overflowY:"auto",flex:1},children:(0,Be.jsx)(r.Suspense,{fallback:(0,Be.jsx)(n.A,{sx:{textAlign:"center",py:8},children:(0,Be.jsx)(w.A,{color:"primary"})}),children:Ao&&(0,Be.jsx)(Me,{embedded:!0,contactIds:Ao,onClose:()=>jo(null)})})})]}),(0,Be.jsxs)(W.A,{open:Boolean(Ct),onClose:Lo,maxWidth:"sm",fullWidth:!0,children:[(0,Be.jsxs)(N.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:700},children:["sms"===Rt?"SMS Report":"Email Report",(0,Be.jsx)(c.A,{size:"small",onClick:Lo,children:(0,Be.jsx)(_.A,{fontSize:"small"})})]}),(0,Be.jsx)(M.A,{dividers:!0,children:It?(0,Be.jsx)(n.A,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,Be.jsx)(w.A,{})}):Bt?(0,Be.jsx)(Ge,{data:Bt,kind:Rt,primary:xe}):(0,Be.jsx)(d.A,{color:"text.secondary",children:"No report data available."})})]}),(0,Be.jsxs)(W.A,{open:yo,onClose:()=>wo(!1),maxWidth:"xs",fullWidth:!0,children:[(0,Be.jsxs)(N.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:700},children:["Add Tag to Contacts ",(0,Be.jsx)(c.A,{size:"small",onClick:()=>wo(!1),children:(0,Be.jsx)(_.A,{fontSize:"small"})})]}),(0,Be.jsx)(M.A,{dividers:!0,children:Co?(0,Be.jsxs)(n.A,{sx:{display:"flex",alignItems:"center",justifyContent:"center",py:3,gap:1.5},children:[(0,Be.jsx)(w.A,{size:20,color:"primary"}),(0,Be.jsx)(d.A,{variant:"body2",color:"text.secondary",children:"Loading tags\u2026"})]}):(0,Be.jsx)(E.A,{multiple:!0,freeSolo:!0,size:"small",value:Io,onChange:(e,t)=>
1Wo(t),options:So,renderTags:(e,t)=>e.map((e,o)=>(0,r.createElement)(x.A,{size:"small",variant:"outlined",label:e,...t({index:o}),key:o})),renderInput:e=>(0,Be.jsx)(p.A,{...e,size:"small",label:"Select Tags",placeholder:"Type or pick\u2026"})})}),(0,Be.jsxs)(L.A,{children:[(0,Be.jsx)(m.A,{onClick:()=>wo(!1),children:"Cancel"}),(0,Be.jsx)(m.A,{variant:"contained",onClick:async()=>{if(0===Io.length)return void kt("Please Select Atleast One Tag","error");const e=Tt?Dt.map(e=>e.contactid):Je.map(e=>e.contactid);if(0!==e.length)try{var t;const l=await(0,Ce.e6)(ke.A.baseURLApi,{query:ze.m9,variables:{contactids:e,tags:Io,locationid:JSON.parse(localStorage.getItem("location_Id")),workflowid:se}});var o,r;if(null!==l&&void 0!==l&&null!==(t=l.data)&&void 0!==t&&t.updatecontacts)kt("Tags added"),wo(!1),Wo([]);else kt((null===l||void 0===l||null===(o=l.errors)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.message)||"Failed","error")}catch(l){kt((null===l||void 0===l?void 0:l.message)||"Failed","error")}else kt("No contacts selected","error")},disabled:Co,children:"Save"})]})]}),(0,Be.jsx)(U.A,{open:wt.open,autoHideDuration:4e3,onClose:()=>St({...wt,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,Be.jsx)(q.A,{severity:wt.severity,onClose:()=>St({...wt,open:!1}),children:wt.message})})]})}function Qe(e){let{index:t,title:o,subtitle:r,Icon:i,tone:s,active:c,onClick:u,isLast:p,depth:h=0,pathlabel:m=null,branchside:b=null,hasBranch:f=!1,tooltip:g=""}=e;const v=(0,X.A)(),A=((0,l.d4)(e=>e.theme)||{}).primaryColor||v.palette.primary.main,j="Y"===b?v.palette.success.main:"N"===b?v.palette.error.main:v.palette.text.secondary,y=14*Math.min(h,4);return(0,Be.jsxs)(n.A,{sx:{display:"flex",alignItems:"stretch",gap:0,pl:`${y}px`},children:[(0,Be.jsxs)(n.A,{sx:{width:32,display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[(0,Be.jsx)(n.A,{sx:{width:26,height:26,borderRadius:"50%",flexShrink:0,border:"1.5px solid",borderColor:c?A:"divider",bgcolor:c?A:"background.paper",color:c?"#fff":"text.secondary",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"\u2022"===t?0:10.5,fontWeight:700,zIndex:1,transition:"all .15s"},children:"\u2022"===t?(0,Be.jsx)(i,{sx:{fontSize:13,color:c?"#fff":"text.secondary"}}):t}),!p&&(0,Be.jsx)(n.A,{sx:{flex:1,width:"1.5px",bgcolor:"divider",my:"3px"}})]}),(0,Be.jsxs)(n.A,{onClick:u,title:g||void 0,sx:{flex:1,minWidth:0,mb:p?0:"6px",p:"8px 10px",borderRadius:1.5,border:"1px solid",borderColor:c?(0,K.X4)(A,.4):"divider",bgcolor:c?(0,K.X4)(A,.07):"transparent",cursor:"pointer",display:"flex",alignItems:"center",gap:1,transition:"all .12s","&:hover":{bgcolor:c?(0,K.X4)(A,.09):(0,K.X4)(A,.04),borderColor:(0,K.X4)(A,.3)}},children:[(0,Be.jsx)(n.A,{sx:{width:28,height:28,borderRadius:1,flexShrink:0,bgcolor:c?(0,K.X4)(A,.15):(0,K.X4)(s,.1),color:c?A:s,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Be.jsx)(i,{sx:{fontSize:15}})}),(0,Be.jsxs)(n.A,{sx:{minWidth:0,flex:1},children:[(0,Be.jsx)(d.A,{sx:{fontSize:12.5,fontWeight:c?700:500,color:c?A:"text.primary",lineHeight:1.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),r&&(0,Be.jsx)(d.A,{sx:{fontSize:10.5,color:c?(0,K.X4)(A,.7):"text.disabled",mt:"1px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r})]}),m&&(0,Be.jsx)(a.A,{title:`${b?`${Ee[b]} path`:"Branch path"}: ${m}`,children:(0,Be.jsx)(x.A,{size:"small",label:m,sx:{height:18,fontSize:9.5,fontWeight:800,letterSpacing:"0.04em",flexShrink:0,color:j,bgcolor:(0,K.X4)(j,.1),border:"1px solid",borderColor:(0,K.X4)(j,.35)}})}),f&&(0,Be.jsx)(a.A,{title:"This step branches on a condition",children:(0,Be.jsx)(we.A,{sx:{fontSize:14,color:c?A:"text.disabled",flexShrink:0}})})]})]})}function Ge(e){let{data:t,kind:o,primary:r}=e;const l=("sms"===o?[{key:"sendtime",label:"Sent",Icon:ue.A},{key:"delivereddate",label:"Delivered",Icon:xe.A},{key:"openeddate",label:"Last Open",Icon:pe.A},{key:"clickeddate",label:"Last Click",Icon:he.A},{key:"unsubscribeddate",label:"Unsubscribed",Icon:me.A},{key:"bounceddate",label:"Bounced",Icon:be.A}]:[{key:"senttime",label:"Sent",Icon:ue.A},{key:"delivereddate",label:"Delivered",Icon:xe.A},{key:"openeddate",label:"Last Open",Icon:pe.A},{key:"clickeddate",label:"Last Click",Icon:he.A},{key:"unsubscribeddate",label:"Unsubscribed",Icon:me.A},{key:"bounceddate",label:"Bounced",Icon:be.A}]).filter(e=>null!=t[e.key]);return 0===l.length?(0,Be.jsx)(d.A,{color:"text.secondary",children:"No events recorded yet."}):(0,Be.jsx)(n.A,{sx:{position:"relative",pl:1},children:l.map((e,o)=>{const i=e.Icon,s=o===l.length-1;return(0,Be.jsxs)(n.A,{sx:{display:"flex",gap:2,position:"relative"},children:[(0,Be.jsxs)(n.A,{sx:{width:32,display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,Be.jsx)(n.A,{sx:{width:30,height:30,borderRadius:"50%",bgcolor:(0,K.X4)(r,.12),color:r,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1},children:(0,Be.jsx)(i,{sx:{fontSize:16}})}),!s&&(0,Be.jsx)(n.A,{sx:{flex:1,width:2,bgcolor:(0,K.X4)(r,.2),my:.25}})]}),(0,Be.jsxs)(n.A,{sx:{pb:s?0:2.5,pt:.5,flex:1},children:[(0,Be.jsx)(d.A,{sx:{fontWeight:700,fontSize:13.5},children:e.label}),(0,Be.jsx)(d.A,{variant:"caption",color:"text.secondary",children:(0,Re.v7)(t[e.key])})]})]},e.key)})})}}}]);

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.