PageSourceSearch

https://dashboard.resimpli.com/chunk-L43WPELA.js

js resimpli.com collected 2026-09-24 18:24:14 UTC 886,294 bytes, 25 lines download raw bytes

1import{a as Ba,b as Mr}from"./chunk-BMBQXE6T.js";import{$ as fr,$e as Xt,$g as ka,Ac as Va,Bc as Na,Cb as Oa,Cc as Ir,Db as Er,Eb as Da,Fb as wr,H as _r,I as hr,J as _a,La as Pi,M as xa,Ma as wa,N as gr,Na as Me,Oa as at,Ra as Ia,Sa as vr,Wa as Li,Xa as Aa,Ze as Q,_ as ya,_e as Mt,ab as Ri,af as fo,ah as Ar,bb as Ma,w as Jt,y as mo,zc as go}from"./chunk-VYO4RDGN.js";import{l as Tt,m as vt,n as Et,o as wt,p as ri,s as It,t as li,u as ha,v as xr}from"./chunk-Z7G2JRTJ.js";import"./chunk-7CS2RLJB.js";import{$ as la,$a as ba,Aa as Pt,Ab as Ta,Bb as $t,C as Ko,Ca as Di,Cb as ho,E as rr,Hb as va,Ib as Tr,K as aa,Lb as At,M as pr,Mb as si,Ra as it,Sa as Lt,T as ra,V as zt,Va as Vi,W as vi,Wa as ga,X as Ei,Xa as Ni,Xb as Bi,Y as wi,Ya as fa,Yb as Ea,Z as Ii,Za as Ca,_a as yr,ab as Cr,ba as po,ca as Ai,da as Mi,fa as sa,hb as Qt,ib as uo,lb as Sa,ma as tt,mb as br,nb as _o,oa as Bt,ob as Sr,sa as ca,ta as pa,ua as ma,wa as mr,xa as ua,za as ur,zb as ki}from"./chunk-SAB3JYQF.js";import{$ as H,E as bi,Fa as na,Ga as cr,Ja as Ti,Ka as oa,La as Ue,Ma as St,Na as q,Qa as xe,Ta as De,Ua as lt,Za as Kt,_a as xo,b as Jo,c as ar,ca as Ce,d as Xo,e as lr,h as ea,i as sr,l as ta,m as dr,pa as Si,qa as ia}from"./chunk-RL7ZPIOE.js";import"./chunk-LWIBITZ2.js";import{Aa as Ve,R as fi,U as Qo,ta as Oi,va as da,wa as he,ya as He,za as Z}from"./chunk-4SLMYJ2W.js";import{Ba as Ci,Da as ut,Fa as co,Ga as Ft,S as zo,T as or,V as Ke,W as G,_ as F,ca as Xe,cc as qe,d as J,da as U,dc as Ge,f as Go,fa as oe,fc as ve,ga as Oe,gc as Ze,h as Ho,ha as yi,i as gi,ic as _t,k as Yt,kc as Zo,lc as fe,ma as $,mc as O,na as K,nc as Re,oa as X,oc as L,qa as re,qc as pe,ra as $o,rc as et,s as Yo,sc as kt,tc as Y,uc as Ee,v as be,ya as se}from"./chunk-ZDLU5LI5.js";import{$ as $e,$b as D,Bc as Te,Cb as B,Db as hi,Dc as de,Fc as ai,Ga as dt,Gc as p,H as Ro,Hc as ce,Hd as W,Ib as Ne,Ic as T,J as yt,Ja as z,Jc as je,M as Ct,N as Ye,Na as Uo,Nc as w,Oc as I,Pc as A,Tc as Vt,Uc as qo,Vb as ct,Wb as Ht,X as ue,Xb as x,Yb as g,Yc as pt,Zc as rt,_b as k,_c as Nt,ac as V,bc as m,bd as bt,cc as r,cd as ot,d as Be,dc as a,dd as mt,ec as h,ed as so,fa as _i,fb as le,hb as ge,hd as ze,ic as Wo,jc as jo,kc as Dt,lc as C,nb as s,o as Qe,pa as u,pc as y,qa as _,ra as Fo,rc as d,t as Lo,vc as We,wb as E,wc as ie,xa as R,xc as ne,xd as xi,z as ui}from"./chunk-MOBT6VNX.js";import"./chunk-2JDYGTA3.js";import"./chunk-5LQHPRAQ.js";import{a as M,b as P,f as ee,k as lo}from"./chunk-OLNG5T5J.js";function Dr(o,l){o&1&&(r(0,"div",10),p(1,"No campaigns to display"),a())}function Vr(o,l){if(o&1&&(r(0,"div",9)(1,"span"),p(2),a()(),x(3,Dr,2,0,"div",10)),o&2){let e=l.$implicit;s(2),ce(e.label),s(),g(!(e!=null&&e.items)||(e==null||e.items==null?null:e.items.length)===0?3:-1)}}var Ui,Wi=ee(()=>{Re();W();Ce();Ee();si();oa();xe();se();Bt();Ui=(()=>{class o{constructor(e,i,t,n,c){this._loaderService=e,this._toastrService=i,this._marketingCampaignsService=t,this._sharedService=n,this._utilities=c,this.data={},this.primaryConditionKey="lead",this.campaignList=[],this.fallbackCommunicationNumTypeIds=[1,2,4,5,6,7],this.defaultNumberList=[],this.numberId=[],this.defaultNumberId=""}ngOnInit(){this.getCampaignList("first-load"),this.loadDefaultCommunicationNumbersFromApi()}isLeadCampaignAutomation(){let e=this.data?.automationType;return e==="NEW_SOLD_PROPERTY"||e==="NEW_RENTAL_PROPERTY"||e==="NEW_INVENTORY_ADDED"}getCampaignList(e){let i={campaignType:1,moduleId:this.isLeadCampaignAutomation()?O.ModuleStatusId.LEAD:this.data?.moduleId};this._loaderService.start(),this._marketingCampaignsService.getCampaignList(i).subscribe(t=>{if(t?.statusCode==200&&(this._loaderService.stop(),this.setCampaignData(t?.data?.items||[]),e==="first-load")){let n=this.data?.primaryConditions?.[this.primaryConditionKey]?.leadCreatedCondtion?.campaignIds||[];this.numberId=[],n?.forEach(c=>{this.campaignList?.forEach(f=>{let S=f?.items?.findIndex(v=>v?.value===c?.marketingCampaignId);S!==-1&&(this.numberId=[...this.numberId,{value:f?.items?.[S]?.value,label:f?.items?.[S]?.label,numberList:f?.items?.[S]?.numberList}])})})}},t=>{t?.error&&this._toastrService.showError(t?.message),this._loaderService.stop()})}setCampaignData(e){if(this.campaignList=[],!e?.length)return;if([...new Set(e.map(t=>
1t?.crmQuestionId).filter(Boolean))].forEach(t=>{let n=e.filter(v=>v?.crmQuestionId===t),f=n[0]?.crmQuestionAnswer||"",S=n.map(v=>({value:v?._id,label:`${v?.name}`,numberList:v?.numbers||[]}));this.campaignList.push({value:t,label:f,items:S})}),this.numberId?.length>0){let t=new Set;this.campaignList.forEach(n=>{n.items?.forEach(c=>{t.add(c.value)})}),this.numberId=this.numberId.filter(n=>t.has(n.value))}}loadDefaultCommunicationNumbersFromApi(){this._sharedService?.dropDownNumberList({numTypeIdArray:this.fallbackCommunicationNumTypeIds})?.subscribe(e=>{if(e?.statusCode==200){let i=e?.data?.items||[];this.defaultNumberList=i.map(n=>({_id:n?._id,name:(n?.marketingTitle??"").toString().trim()||"Number",number:this._utilities.maskNumber(n?.number)}));let t=this.data?.primaryConditions?.[this.primaryConditionKey]?.leadCreatedCondtion;t?.defaultNumberId&&(this.defaultNumberId=String(t.defaultNumberId??""))}},()=>{})}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Y),E(At),E(Ti),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-new-leads-created"]],inputs:{data:"data",primaryConditionKey:"primaryConditionKey"},standalone:!1,decls:12,vars:5,consts:[["group",""],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[20px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[5px]"],[1,"text-h3/[normal]","text-transparency-100","font-semibold"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["optionLabel","label","appendTo","body","placeholder","Select campaigns","scrollHeight","250px",1,"w-full","text-h4","text-transparency-100","font-bold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","maxSelectedLabels","options","optionValue","group","ngModel"],[1,"flex","items-center"],[1,"text-h4"]],template:function(i,t){if(i&1){let n=C();r(0,"div",1)(1,"div",2)(2,"h3",3),p(3," Conditions "),a()(),r(4,"div",4)(5,"div",5)(6,"label",6),p(7,"Select campaigns "),h(8,"img",7),a(),r(9,"p-multiselect",8),A("ngModelChange",function(f){return u(n),I(t.numberId,f)||(t.numberId=f),_(f)}),Ne(10,Vr,4,2,"ng-template",null,0,ze),a()()()()}i&2&&(s(9),m("maxSelectedLabels",1e3)("options",t.campaignList)("optionValue",null)("group",!0),w("ngModel",t.numberId))},dependencies:[F,U,tt],encapsulation:2})}}return o})()});function kr(o,l){if(o&1){let e=C();r(0,"div",6)(1,"label",7),p(2,"Select pipeline "),h(3,"img",4),a(),r(4,"p-multiSelect",9),A("ngModelChange",function(t){u(e);let n=d();return I(n.pipelineIds,t)||(n.pipelineIds=t),_(t)}),y("onChange",function(t){u(e);let n=d();return _(n.onChangePipeline(t.value))}),a()()}if(o&2){let e=d();s(4),w("ngModel",e.pipelineIds),m("options",e.pipelineData)("maxSelectedLabels",1e3)}}function Br(o,l){if(o&1&&(r(0,"div",10)(1,"span",11),p(2),a()()),o&2){let e=l.$implicit;s(2),ce(e.label)}}var ji,qi=ee(()=>{Re();W();Lt();Ce();Ee();xe();se();Bt();ji=(()=>{class o{constructor(e,i,t,n){this._leadsService=e,this._loaderService=i,this._toastrService=t,this._commonFunctions=n,this.moduleId="",this.data={},this.primaryConditionKey="lead",this.pipelineIds=[],this.statusIds=[],this.pipelineData=[],this.statusData=[]}ngOnInit(){this.getPipelineList()}isBuyerOrAgentModule(){return this.moduleId===O.MainStatusId.BUYER||this.moduleId===O.MainStatusId.AGENT||this.moduleId===O.MainStatusId.VENDOR}isListStackingModule(){return this.moduleId===O.MainStatusId.LISTSTACKING||this.moduleId===O.ModuleStatusId.LISTSTACKING}isPipelineSelectionHidden(){return this.isBuyerOrAgentModule()||this.isListStackingModule()}organizePipelinesFromResponse(e){let i=e.filter(c=>c?.masterPipelineId).sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0)),t=e?.filter(c=>!c?.masterPipelineId),n=[...i,...t].sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0));return n=n?.map(c=>{if(c?.mainStatusList?.length){let f=c?.mainStatusList.filter(v=>v?.masterStatusId).sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0)),S=c?.mainStatusList?.filter(v=>!v?.masterStatusId)?.sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0));c.mainStatusList=[...f,...S].sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0))}return c}),n}getPipelineList(){let e={page:1,limit:100,moduleId:this.moduleId};this._loaderService.start(),this._leadsService.getPipelines(e).subscribe(i=>{if(i?.statusCode==200){let t=this.organizePipelinesFromResponse(i?.data?.items||[]);this.pipelineData=JSON.parse(JSON.stringify(t));let n=this.data?.primaryConditions?.[this.primaryConditionKey]?.pipelineStatusCondition;if(this.isPipelineSelectionHidden()){let c=this.pipelineData[0]?._id;if(c)if(this.pipelineIds=[c],this.onChangePipeline(this.pipelineIds),n?.pipelines?.length){let f=n.pipelines.find(b=>b?.pipelineId===c),S=f?.mainStatusIds?.length?f.mainStatusIds:n.pipelines[0]?.mainStatusIds||[],v=new Set(this.statusData?.flatMap(b=>b?.items?.map(N=>N?._id)||[])||[]);this.statusIds=[...S].filter(b=>v.has(b))}else this.statusIds=[]}else if(n){let c=[];n?.pipelines?.forEach(f=>{this.pipelineIds=[...this.pipelineIds,f?.pipelineId],c=[...c,...f?.mainStatusIds||[]]}),this.onChangePipeline(this.pipelineIds),this.statusIds=[...this.statusIds,...c]}}this._loaderService.stop()},i=>{this._loaderService.stop()})}
1isInLeadPipelineStatus(e){let i=(e?.originalTitle||e?.title||"").trim().toLowerCase();return i==="in lead"||i==="in leads"}onChangePipeline(e){this.statusData=[],this.pipelineData?.forEach(t=>{if(e?.includes(t?._id)){let n=[...t?.mainStatusList||[]].sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0));this.isListStackingModule()&&(n=n.filter(c=>!this.isInLeadPipelineStatus(c))),this.statusData=[...this.statusData,{value:t?._id,label:t?.title,items:n}]}});let i=new Set(this.statusData?.flatMap(t=>t?.items?.map(n=>n?._id)||[])||[]);this.statusIds=(this.statusIds||[]).filter(t=>i.has(t))}static{this.\u0275fac=function(i){return new(i||o)(E(it),E(H),E(Y),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-lead-status-change"]],inputs:{moduleId:"moduleId",data:"data",primaryConditionKey:"primaryConditionKey"},standalone:!1,decls:14,vars:5,consts:[["group",""],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[20px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[5px]"],[1,"flex","items-center","gap-[3px]","text-h3/[normal]","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["optionLabel","title","optionValue","_id","appendTo","body","placeholder","Select Status","scrollHeight","250px","panelStyleClass","bg-transparency-0 text-transparency-100 border-transparency-25",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","maxSelectedLabels","options","group","ngModel"],["placeholder","Select Pipeline","name","pipelineIds","appendTo","body","panelStyleClass","bg-transparency-0 text-transparency-100 border-transparency-25","optionLabel","title","optionValue","_id",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","onChange","ngModel","options","maxSelectedLabels"],[1,"flex","items-center"],[1,"text-primary-90"]],template:function(i,t){if(i&1){let n=C();r(0,"div",1)(1,"div",2)(2,"h3",3),p(3," Conditions "),h(4,"img",4),a()(),r(5,"div",5),x(6,kr,5,3,"div",6),r(7,"div",6)(8,"label",7),p(9,"Select status "),h(10,"img",4),a(),r(11,"p-multiselect",8),A("ngModelChange",function(f){return u(n),I(t.statusIds,f)||(t.statusIds=f),_(f)}),Ne(12,Br,3,1,"ng-template",null,0,ze),a()()()()}i&2&&(s(6),g(t.isPipelineSelectionHidden()?-1:6),s(5),m("maxSelectedLabels",1e3)("options",t.statusData)("group",!0),w("ngModel",t.statusIds))},dependencies:[F,U,tt],encapsulation:2})}}return o})()});function Rr(o,l){if(o&1){let e=C();r(0,"label",4)(1,"div",5)(2,"input",22),A("ngModelChange",function(t){u(e);let n=d();return I(n.triggerType,t)||(n.triggerType=t),_(t)}),y("change",function(){u(e);let t=d();return _(t.resetBranch())}),a(),h(3,"span",7),a(),r(4,"span",8),p(5,"Direct Mail"),a(),r(6,"div",9),h(7,"svg-icon",10),a()()}if(o&2){let e=d();s(2),w("ngModel",e.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation based on direct mail activity, such as Delivered or Not Delivered."),s(),m("src","assets/images/icons/info.svg")}}function Fr(o,l){if(o&1){let e=C();r(0,"label",4)(1,"div",5)(2,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.triggerType,t)||(n.triggerType=t),_(t)}),y("change",function(){u(e);let t=d();return _(t.resetBranch())}),a(),h(3,"span",7),a(),r(4,"span",8),p(5,"Appointment Outcome"),a(),r(6,"div",9),h(7,"svg-icon",10),a()()}if(o&2){let e=d();s(2),w("ngModel",e.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation based on whether an appointment was Kept or Not Kept."),s(),m("src","assets/images/icons/info.svg")}}function Ur(o,l){o&1&&(r(0,"div",14),p(1," Activity triggers will not run while Conversational AI is enabled. "),a())}function Wr(o,l){if(o&1){let e=C();r(0,"div",31),y("click",function(){u(e);let t=d().$index,n=d(2);return _(n.deleteBranch(t))}),h(1,"svg-icon",35),a()}}function jr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"h3",41),p(2," AI Intent "),h(3,"img",38),a(),r(4,"div",42)(5,"label",43)(6,"div",5)(7,"input",44),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(8,"span",7),a(),r(9,"h4",8),p(10," Interested "),a()(),r(11,"label",43)(12,"div",5)(13,"input",45),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(14,"span",7),a(),r(15,"h4",8),p(16," Not Interested "),a()(),r(17,"label",43)(18,"div",5)(19,"input",46),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(20,"span",7),a(),r(21,"h4",8),p(22," Spam "),a()(),r(23,"label",43)(24,"div",5)(25,"input",47),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(26,"span",7),a(),r(27,"h4",8),p(28," Others "),a()()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Interested"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Interested"))("opacity-50",n.isValueDisabledForBranch(t,"Interested")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Interested")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Not Interested"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Not Interested"))("opacity-50",n.isValueDisabledForBranch(t,"Not Interested")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Not Interested")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Spam"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Spam"))("opacity-50",n.isValueDisabledForBranch(t,"Spam")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Spam")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Others"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Others"))("opacity-50",n.isValueDisabledForBranch(t,"Others")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Others"))}}function qr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"h3",41),p(2," Direct Mail action "),h(3,"img",38),a(),r(4,"div",42)(5,"label",43)(6,"div",5)(7,"input",48),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(8,"span",7),a(),r(9,"h4",8),p(10," Delivered "),a()(),r(11,"label",43)(12,"div",5)(13,"input",49),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(14,"span",7),a(),r(15,"h4",8),p(16," Not Delivered "),a()()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Delivered")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Not Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Not Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Not Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Not Delivered"))}}function Gr(o,l){if(o&1&&(r(0,"div"),p(1),a()),o&2){let e=l.$implicit;de("opacity-50",e==null?null:e.disabled)("cursor-not-allowed",e==null?null:e.disabled),s(),T(" ",e==null?null:e.name," ")}}function Hr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"div",36)(2,"label",50),p(3," Select Outcomes "),h(4,"img",51),a(),r(5,"p-multiSelect",52),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcomeFilters.selectedOutcomes,t)||(n.outcomeFilters.selectedOutcomes=t),_(t)}),y("onChange",function(t){u(e);let n=d(2).$index,c=d(2);return _(c.onOutcomeMultiSelectChange(n,t.value))}),Ne(6,Gr,2,5,"ng-template",53),a()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),w("ngModel",i.outcomeFilters.selectedOutcomes),m("options",n.getOptionsForOutcomeMultiSelect(t))("optionDisabled",n.isOutcomeOptionDisabledForBranch(t))("maxSelectedLabels",1e3)}}function Yr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"h3",41),p(2," Email outcome "),h(3,"img",38),a(),r(4,"div",42)(5,"label",43)(6,"div",5)(7,"input",48),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(8,"span",7),a(),r(9,"h4",8),p(10," Delivered "),a()(),r(11,"label",43)(12,"div",5)(13,"input",54),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(14,"span",7),a(),r(15,"h4",8),p(16," Opened "),a()(),r(17,"label",43)(18,"div",5)(19,"input",55),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(20,"span",7),a(),r(21,"h4",8),p(22," Clicked "),a()(),r(23,"label",43)(24,"div",5)(25,"input",49),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(26,"span",7),a(),r(27,"h4",8),p(28," Not Delivered "),a()(),r(29,"label",43)(30,"div",5)(31,"input",56),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(32,"span",7),a(),r(33,"h4",8),p(34," Unsubscribed "),a()()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Delivered")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Opened"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Opened"))("opacity-50",n.isValueDisabledForBranch(t,"Opened")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Opened")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Clicked"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Clicked"))("opacity-50",n.isValueDisabledForBranch(t,"Clicked")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Clicked")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Not Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Not Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Not Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Not Delivered")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Unsubscribed"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Unsubscribed"))("opacity-50",n.isValueDisabledForBranch(t,"Unsubscribed")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Unsubscribed"))}}function zr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"h3",41),p(2," Outgoing SMS "),h(3,"img",38),a(),r(4,"div",42)(5,"label",43)(6,"div",5)(7,"input",48),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(8,"span",7),a(),r(9,"h4",8),p(10," Delivered "),a()(),r(11,"label",43)(12,"div",5)(13,"input",49),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(14,"span",7),a(),r(15,"h4",8),p(16," Not Delivered "),a()()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Delivered")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Not Delivered"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Not Delivered"))("opacity-50",n.isValueDisabledForBranch(t,"Not Delivered")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Not Delivered"))}}function Jr(o,l){if(o&1){let e=C();r(0,"div",40)(1,"h3",41),p(2," Appointment Outcome "),h(3,"img",38),a(),r(4,"div",42)(5,"label",43)(6,"div",5)(7,"input",57),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(8,"span",7),a(),r(9,"h4",8),p(10," Kept "),a()(),r(11,"label",43)(12,"div",5)(13,"input",58),A("ngModelChange",function(t){u(e);let n=d(2).$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),a(),h(14,"span",7),a(),r(15,"h4",8),p(16," Not Kept "),a()()()()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(2);s(5),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Kept"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Kept"))("opacity-50",n.isValueDisabledForBranch(t,"Kept")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Kept")),s(4),de("cursor-pointer",!n.isValueDisabledForBranch(t,"Not Kept"))("cursor-not-allowed",n.isValueDisabledForBranch(t,"Not Kept"))("opacity-50",n.isValueDisabledForBranch(t,"Not Kept")),s(2),m("name","aiintent_"+t),w("ngModel",i.outcome),m("disabled",n.isValueDisabledForBranch(t,"Not Kept"))}}function Qr(o,l){if(o&1){let e=C();r(0,"div",36)(1,"label",37),p(2,"Branch name "),h(3,"img",38),a(),r(4,"input",39),A("ngModelChange",function(t){u(e);let n=d().$implicit;return I(n.branchName,t)||(n.branchName=t),_(t)}),a()(),x(5,jr,29,36,"div",40),x(6,qr,17,18,"div",40),x(7,Hr,7,4,"div",40),x(8,Yr,35,45,"div",40),x(9,zr,17,18,"div",40),x(10,Jr,17,18,"div",40)}if(o&2){let e=d().$implicit,i=d(2);s(4),w("ngModel",e.branchName),s(),g(i.triggerType=="INCOMING_SMS"||i.triggerType=="INCOMING_CALL"?5:-1),s(),g(i.triggerType=="DIRECT_MAIL"?6:-1),s(),g(i.triggerType=="OUT_CALL_OUTCOME"?7:-1),s(),g(i.triggerType=="OUT_EMAIL_STATUS"?8:-1),s(),g(i.triggerType=="OUTGOING_SMS"?9:-1),s(),g(i.triggerType=="APPOINTMENT_OUTCOME"?10:-1)}}function $r(o,l){if(o&1){let e=C();r(0,"div",24)(1,"div",27)(2,"div",28)(3,"h3",2),p(4),a(),r(5,"div",29),p(6),a()(),r(7,"div",30),x(8,Wr,2,0,"div",33),r(9,"div",34),y("click",function(){let t=u(e).$index,n=d(2);return _(n.expandBranch(t))}),h(10,"img",20),a()()(),x(11,Qr,11,7),a()}if(o&2){let e=l.$implicit,i=l.$index,t=d(2);s(4),T(" Branch ",i+1," "),s(2),T(" ",e==null?null:e.branchName," "),s(2),g(t.canDeleteBranch()?8:-1),s(),m("ngClass",e!=null&&e.expanded?"rotate-180":""),s(2),g(e!=null&&e.expanded?11:-1)}}function Kr(o,l){o&1&&(r(0,"div",32),p(1," Anything Else "),a())}function Xr(o,l){if(o&1){let e=C();r(0,"div",21),D(1,$r,12,5,"div",24,k),r(3,"button",25),y("click",function(){u(e);let t=d();return _(t.addBranch())}),h(4,"img",26),p(5," Add Branch "),a(),r(6,"div",24)(7,"div",27)(8,"div",28)(9,"h3",2),p(10," Default Branch "),a(),r(11,"div",29),p(12," Default branch executed if no previous conditions matched. "),a()(),r(13,"div",30)(14,"div",31),y("click",function(){u(e);let t=d();return _(t.toggleDefaultBranch())}),h(15,"img",20),a()()(),x(16,Kr,2,0,"div",32),a()()}if(o&2){let e=d();s(),V(e.branches),s(13),de("rotate-180",e.isDefaultBranchExpanded),s(2),g(e.isDefaultBranchExpanded?16:-1)}}var Gi,Hi=ee(()=>{Re();W();St();be();se();pe();Qo();Bt();He();Gi=(()=>{class o{get isContactModuleActivityTrigger(){return this.primaryConditionKey==="abvCondition"}get showConversationalAiNotice(){let e=this.data?.moduleId;return e===O.MainStatusId.LEAD||e===O.MainStatusId.WHOLESALEPIPELINE}constructor(e){this._commonService=e,this.data={},this.primaryConditionKey="lead",this.outCallOutcomeOptions=[],this.triggerType="INCOMING_SMS",this.isBranchesExpanded=!0,this.isDefaultBranchExpanded=!0,this.branches=[{branchName:"",outcome:"",outcomeFilters:{conditionType:"Incoming SMS"},isDefaultBranch:!1,expanded:!0,workFlow:[]}]}getOutCallOutcomeOptionRows(){return this.outCallOutcomeOptions||[]}getCallOutcomeModuleId(){return this.data?.moduleId||O.MainStatusId.LEAD}loadCallOutcomeOptions(){let e=this.getCallOutcomeModuleId
1();if(!e){this.outCallOutcomeOptions=[];return}this._commonService?.getcallOutcomeList({moduleId:e,page:1,limit:1e3})?.subscribe(i=>{if(i?.statusCode===200){let t=i?.data?.items??(Array.isArray(i?.data)?i.data:[]);this.outCallOutcomeOptions=(Array.isArray(t)?t:[]).map(n=>({_id:n?._id||"",name:n?.name||""})).filter(n=>!!n._id&&!!n.name)}else this.outCallOutcomeOptions=[]},()=>{this.outCallOutcomeOptions=[]})}ngOnInit(){this.loadCallOutcomeOptions();let e=this.primaryConditionKey||"lead",i=this.data?.primaryConditions?.[e]?.activityTriggerCondition?.triggerType;this.triggerType=i||"INCOMING_SMS";let t=["INCOMING_SMS","INCOMING_CALL","OUT_CALL_OUTCOME","OUTGOING_SMS"],n=!1;if(this.isContactModuleActivityTrigger&&!t.includes(this.triggerType)&&(this.triggerType="INCOMING_SMS",n=!0),this.branches?.[0]&&(this.branches[0].outcomeFilters=P(M({},this.branches?.[0]?.outcomeFilters||{}),{conditionType:this.getTriggerTypeLabel(this.triggerType)}),this.triggerType==="OUT_CALL_OUTCOME"&&!Array.isArray(this.branches[0].outcomeFilters?.selectedOutcomes)&&(this.branches[0].outcomeFilters.selectedOutcomes=[])),this.data?.workflowSteps?.length){let c=JSON.parse(JSON.stringify(this.data?.workflowSteps?.[0]));c?.stepType=="ACTIVITY_TRIGGER"&&c?.payload?.branches?.length&&(this.branches=[],c?.payload?.branches?.forEach(f=>{if(!f?.isDefaultBranch){let S=P(M({},f?.outcomeFilters||{}),{conditionType:this.getTriggerTypeLabel(this.triggerType)}),v="";if(this.triggerType==="OUT_CALL_OUTCOME"){let b=Array.isArray(S.selectedOutcomes)?[...S.selectedOutcomes]:[],N=f?.outcome;if(Array.isArray(N)){let j=N.filter(Fe=>Fe&&typeof Fe=="string"&&!["Connected","Not Connected"].includes(Fe));j.length&&!b.length&&(b=j.map(String))}else N&&typeof N=="string"&&!["Connected","Not Connected"].includes(N)&&(b.length||(b=[N]));S.selectedOutcomes=b,v=""}else v=Array.isArray(f?.outcome)?f?.outcome?.[0]||"":f?.outcome||"";this.branches=[...this.branches,{branchName:f?.branchName,outcome:v,outcomeFilters:S,isDefaultBranch:!1,expanded:!0,workFlow:f?.workFlow||[]}]}}))}n&&this.resetBranch()}deleteBranch(e){!Array.isArray(this.branches)||this.branches.length<=1||e<0||e>=this.branches.length||this.branches.splice(e,1)}canDeleteBranch(){return(this.branches?.length||0)>1}addBranch(){this.branches.push({branchName:"",outcome:"",outcomeFilters:this.triggerType=="OUT_CALL_OUTCOME"?{selectedOutcomes:[],conditionType:this.getTriggerTypeLabel(this.triggerType)}:{conditionType:this.getTriggerTypeLabel(this.triggerType)},isDefaultBranch:!1,expanded:!0,workFlow:[]})}expandBranch(e){this.branches?.[e]&&(this.branches[e].expanded=!this.branches?.[e]?.expanded)}toggleBranchesSection(){this.isBranchesExpanded=!this.isBranchesExpanded}toggleDefaultBranch(){this.isDefaultBranchExpanded=!this.isDefaultBranchExpanded}resetBranch(){this.branches=[{branchName:"",outcome:"",outcomeFilters:this.triggerType=="OUT_CALL_OUTCOME"?{selectedOutcomes:[],conditionType:this.getTriggerTypeLabel(this.triggerType)}:{conditionType:this.getTriggerTypeLabel(this.triggerType)},isDefaultBranch:!1,expanded:!0,workFlow:[]}]}getFinalBranches(){this.updateOutcomeFiltersForAllBranches();let e=[];this.branches?.forEach(t=>{let n;if(this.triggerType==="OUT_CALL_OUTCOME"){let c=t?.outcomeFilters?.selectedOutcomes;n=Array.isArray(c)?[...c]:[]}else n=Array.isArray(t?.outcome)?t?.outcome:[t?.outcome];e.push({branchName:t?.branchName,outcome:n,outcomeFilters:P(M({},t?.outcomeFilters||{}),{conditionType:this.getTriggerTypeLabel(this.triggerType)}),isDefaultBranch:!!t?.isDefaultBranch,workFlow:t?.workFlow||[]})});let i=[];if(this.data?.workflowSteps?.length){let t=JSON.parse(JSON.stringify(this.data?.workflowSteps?.[0]));t?.stepType=="ACTIVITY_TRIGGER"&&t?.payload?.branches?.length&&t?.payload?.branches?.forEach(n=>{n?.isDefaultBranch&&(i=n?.workFlow||[])})}return e.push({isDefaultBranch:!0,branchName:"Anything Else",outcome:["Default branch executed if no previous conditions matched."],workFlow:i}),e}getTriggerTypeLabel(e){return{INCOMING_SMS:"Incoming SMS",INCOMING_CALL:"Incoming Call",DIRECT_MAIL:"Direct Mail",OUT_CALL_OUTCOME:"Out. Call Outcome",OUT_EMAIL_STATUS:"Out. Email Status",OUTGOING_SMS:"Outgoing SMS",APPOINTMENT_OUTCOME:"Appointment Outcome"}[e]||e}updateOutcomeFiltersForAllBranches(){Array.isArray(this.branches)&&this.branches.forEac
1h(e=>{e&&!e?.isDefaultBranch&&(e.outcomeFilters=P(M({},e?.outcomeFilters||{}),{conditionType:this.getTriggerTypeLabel(this.triggerType)}))})}getSelectedOutcomesFromOtherBranches(e){let i=new Set;return typeof e!="number"||e<0||!Array.isArray(this.branches)||this.branches?.forEach((t,n)=>{n!==e&&t&&!t?.isDefaultBranch&&t?.outcome&&typeof t?.outcome=="string"&&t?.outcome?.trim()!==""&&i.add(t?.outcome)}),i}isValueDisabledForBranch(e,i){return typeof e!="number"||e<0||!Array.isArray(this.branches)||!i||typeof i!="string"?!1:this.getSelectedOutcomesFromOtherBranches(e).has(i)}getSelectedOutcomeIdsFromOtherBranches(e){let i=new Set;return typeof e!="number"||e<0||!Array.isArray(this.branches)||!this.branches?.[e]||this.branches?.forEach((t,n)=>{n!==e&&t&&!t?.isDefaultBranch&&t?.outcomeFilters?.selectedOutcomes&&Array.isArray(t?.outcomeFilters?.selectedOutcomes)&&t?.outcomeFilters?.selectedOutcomes?.forEach(c=>{c&&typeof c=="string"&&i.add(c)})}),i}getOptionsForOutcomeMultiSelect(e){if(typeof e!="number"||e<0||!Array.isArray(this.branches)||!this.branches?.[e])return[];let i=this.branches?.[e],t=this.getOutCallOutcomeOptionRows();if(!Array.isArray(t))return[];let n=this.getSelectedOutcomeIdsFromOtherBranches(e),c=new Set(i?.outcomeFilters?.selectedOutcomes||[]);return t?.map(f=>P(M({},f),{disabled:n.has(f?._id)&&!c.has(f?._id)}))}isOutcomeOptionDisabledForBranch(e){return i=>{if(typeof e!="number"||e<0||!Array.isArray(this.branches)||!this.branches?.[e]||!i?._id)return!1;let t=this.getSelectedOutcomeIdsFromOtherBranches(e),n=new Set(this.branches[e]?.outcomeFilters?.selectedOutcomes||[]);return t.has(i?._id)&&!n.has(i?._id)}}onOutcomeMultiSelectChange(e,i){if(typeof e!="number"||e<0||!Array.isArray(this.branches)||!this.branches?.[e]||!Array.isArray(i))return;let t=this.getSelectedOutcomeIdsFromOtherBranches(e),n=i?.filter(c=>!t.has(c));this.branches?.[e]?.outcomeFilters&&(this.branches[e].outcomeFilters.selectedOutcomes=n)}static{this.\u0275fac=function(i){return new(i||o)(E(Ue))}}static{this.\u0275cmp=B({type:o,selectors:[["app-activity-trigger"]],inputs:{data:"data",primaryConditionKey:"primaryConditionKey"},standalone:!1,decls:48,vars:22,consts:[[1,"flex","flex-col","items-start","self-stretch","gap-[10px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[5px]"],[1,"text-h3/[normal]","text-transparency-100","font-semibold"],[1,"w-full","grid","grid-cols-2","gap-[5px]"],[1,"flex","items-center","gap-[10px]","py-[10px]","px-[5px]","cursor-pointer","select-none"],[1,"re-custom-radio-2"],["type","radio","name","communicationTrigger","value","INCOMING_SMS",3,"ngModelChange","change","ngModel"],[1,"check-mark"],[1,"text-h4","text-transparency-100","font-semibold"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","border-solid","rounded-[30px]","border-[1px]",3,"ngClass","pTooltip"],["svgClass","w-[18px] h-[18px] block",3,"src"],["type","radio","name","communicationTrigger","value","INCOMING_CALL",3,"ngModelChange","change","ngModel"],["type","radio","name","communicationTrigger","value","OUT_CALL_OUTCOME",3,"ngModelChange","change","ngModel"],["type","radio","name","communicationTrigger","value","OUTGOING_SMS",3,"ngModelChange","change","ngModel"],[1,"text-h4","text-transparency-90","font-semibold","mt-[10px]","text-center"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-20","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","overflow-hidden","mt-3"],[1,"flex","items-center","self-stretch","gap-[10px]","p-[20px]","bg-transparency-0"],[1,"flex-[1_0_0]","flex","flex-col","gap-[3px]"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"flex","items-center","justify-end","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","18","height","18",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","p-[10px]"],["type","radio","name","communicationTrigger","value","DIRECT_MAIL",3,"ngModelChange","change","ngModel"],["type","radio","name","communicationTrigger","value","APPOINTMENT_OUTCOME",3,"ngModelChange","change","ngModel"],[1,"flex","flex-col","self-stretch","gap-[15px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],["type","button",1,"flex","items-center","self-stretch","gap-[5px]","py-[16px]","px-[30px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","text-h3","text-primary-90","font-semibold",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],[1,"flex","justify-between","items-center","gap-[10px]"],[1,"flex","flex-col","gap-[3px]"],[1,"text-label/[normal]","text-transparency-100","font-medium","opacity-60"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],[1,"flex","justify-between","items-center","gap-[10px]","p-[10px]","text-h4","text-transparency-100","font-semibold","bg-transparency-25","rounded-[5px]"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"w-full"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid","inline-block"],["type","text","placeholder","Branch",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
1px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]"],[1,"text-h4/[20px]","text-transparency-100","font-semibold"],[1,"flex","flex-wrap","gap-[20px]"],[1,"flex","items-center","gap-[10px]","select-none"],["type","radio","value","Interested",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Not Interested",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Spam",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Others",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Delivered",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Not Delivered",3,"ngModelChange","name","ngModel","disabled"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["placeholder","Select Outcomes","appendTo","body","optionLabel","name","optionValue","_id",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","onChange","ngModel","options","optionDisabled","maxSelectedLabels"],["pTemplate","item"],["type","radio","value","Opened",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Clicked",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Unsubscribed",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Kept",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","Not Kept",3,"ngModelChange","name","ngModel","disabled"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h3",2),p(3," Activity Trigger "),a()(),r(4,"div",3)(5,"label",4)(6,"div",5)(7,"input",6),A("ngModelChange",function(c){return I(t.triggerType,c)||(t.triggerType=c),c}),y("change",function(){return t.resetBranch()}),a(),h(8,"span",7),a(),r(9,"span",8),p(10,"Incoming SMS"),a(),r(11,"div",9),h(12,"svg-icon",10),a()(),r(13,"label",4)(14,"div",5)(15,"input",11),A("ngModelChange",function(c){return I(t.triggerType,c)||(t.triggerType=c),c}),y("change",function(){return t.resetBranch()}),a(),h(16,"span",7),a(),r(17,"span",8),p(18,"Incoming Call"),a(),r(19,"div",9),h(20,"svg-icon",10),a()(),x(21,Rr,8,4,"label",4),r(22,"label",4)(23,"div",5)(24,"input",12),A("ngModelChange",function(c){return I(t.triggerType,c)||(t.triggerType=c),c}),y("change",function(){return t.resetBranch()}),a(),h(25,"span",7),a(),r(26,"span",8),p(27,"Out. Call Outcome"),a(),r(28,"div",9),h(29,"svg-icon",10),a()(),r(30,"label",4)(31,"div",5)(32,"input",13),A("ngModelChange",function(c){return I(t.triggerType,c)||(t.triggerType=c),c}),y("change",function(){return t.resetBranch()}),a(),h(33,"span",7),a(),r(34,"span",8),p(35,"Outgoing SMS"),a(),r(36,"div",9),h(37,"svg-icon",10),a()(),x(38,Fr,8,4,"label",4),a(),x(39,Ur,2,0,"div",14),a(),r(40,"div",15)(41,"div",16)(42,"div",17)(43,"h3",18),p(44," Branches "),a()(),r(45,"div",19),y("click",function(){return t.toggleBranchesSection()}),h(46,"img",20),a()(),x(47,Xr,17,3,"div",21),a()),i&2&&(s(7),w("ngModel",t.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation based on the AI-detected intent of an incoming SMS, such as Interested, Not Interested, Spam, or Other."),s(),m("src","assets/images/icons/info.svg"),s(3),w("ngModel",t.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation based on the AI-detected intent of an incoming call using the call transcript, such as Interested, Not Interested, Spam, or Other."),s(),m("src","assets/images/icons/info.svg"),s(),g(t.isContactModuleActivityTrigger?-1:21),s(3),w("ngModel",t.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation when a specific outgoing call outcome is selected. Available outcomes are based on your customized call outcomes."),s(),m("src","assets/images/icons/info.svg"),s(3),w("ngModel",t.triggerType),s(4),m("ngClass","border-transparency-25")("pTooltip","Trigger an automation based on the delivery status of an outgoing SMS, such as Delivered or Not Delivered."),s(),m("src","assets/images/icons/info.svg"),s(),g(t.isContactModuleActivityTrigger?-1:38),s(),g(t.showConversationalAiNotice?39:-1),s(6),de("rotate-180",t.isBranchesExpanded),s(2),g(t.isBranchesExpanded?47:-1))},dependencies:[J,G,Oe,F,U,L,fi,tt,he],encapsulation:2})}}return o}
1)()});function ol(o,l){if(o&1&&(r(0,"div",7),h(1,"svg-icon",20),a()),o&2){let e=d();m("pTooltip",e.otherTriggersTooltip)("escape",!1)}}function al(o,l){o&1&&(r(0,"p",8),p(1," Time since the last incoming call or text was received from the seller "),a())}function rl(o,l){if(o&1){let e=C();r(0,"h3",21),y("click",function(){u(e);let t=d();return _(t.addReason())}),p(1," + Add Reason "),a()}}function ll(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e.type),s(),T(" ",e==null?null:e.title," ")}}function sl(o,l){if(o&1&&(r(0,"option",17),p(1),ot(2,"titlecase"),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",mt(2,2,e==null?null:e.title)," ")}}function dl(o,l){if(o&1){let e=C();r(0,"div",28)(1,"label",24),p(2,"Select Pipeline "),h(3,"img",13),a(),r(4,"select",15),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.pipelineId,t)||(n.pipelineId=t),_(t)}),y("change",function(){u(e);let t=d(3);return _(t.onChangePipeline())}),r(5,"option",16),p(6,"--Select--"),a(),D(7,sl,3,4,"option",17,k),a()()}if(o&2){let e=d(3);s(4),w("ngModel",e.pipelineId),s(3),V(e.pipelineData)}}function cl(o,l){if(o&1){let e=C();r(0,"div",22),x(1,dl,9,1,"div",28),r(2,"div",29)(3,"label",24),p(4,"Select Status "),h(5,"img",13),a(),r(6,"div")(7,"p-multiselect",30),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.statusIds,t)||(n.statusIds=t),_(t)}),a()()()()}if(o&2){let e=d(2);s(),g(e.isAutoFirstPipelineDuration?-1:1),s(),de("w-full",e.isAutoFirstPipelineDuration),s(4),ai(e.isAutoFirstPipelineDuration?"w-full [&_.p-multiselect]:!flex [&_.p-multiselect]:!h-[42px] [&_.p-multiselect]:!w-full [&_.p-multiselect]:!max-w-none [&_.p-multiselect]:items-center":"w-full [&_.p-multiselect]:!flex [&_.p-multiselect]:!h-[42px] [&_.p-multiselect]:!max-w-[300px] [&_.p-multiselect]:items-center"),s(),m("maxSelectedLabels",1e3)("options",e.statusData),w("ngModel",e.statusIds)}}function pl(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),ce(e)}}function ml(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),ce(e)}}function ul(o,l){if(o&1){let e=C();r(0,"div",18),x(1,cl,8,8,"div",22),r(2,"div",23)(3,"label",24),p(4," Select Duration "),h(5,"img",13),a(),r(6,"div",25)(7,"select",26),A("ngModelChange",function(t){u(e);let n=d();return I(n.durationCondition.condition,t)||(n.durationCondition.condition=t),_(t)}),D(8,pl,2,2,"option",17,k),a(),r(10,"input",27),A("ngModelChange",function(t){u(e);let n=d();return I(n.durationCondition.durationValue,t)||(n.durationCondition.durationValue=t),_(t)}),a(),r(11,"select",26),A("ngModelChange",function(t){u(e);let n=d();return I(n.durationCondition.unit,t)||(n.durationCondition.unit=t),_(t)}),D(12,ml,2,2,"option",17,k),a()()()()}if(o&2){let e=d();s(),g(e.conditionType=="LEAD_DURATION_IN_CURRENT_STATUS"||e.conditionType=="TRANSACTION_DURATION_IN_CURRENT_STATUS"||e.conditionType=="PROPERTY_DURATION_IN_CURRENT_STATUS"||e.conditionType=="RENTAL_DURATION_IN_CURRENT_STATUS"||e.conditionType=="BUYER_DURATION_IN_CURRENT_STATUS"||e.conditionType=="AGENT_DURATION_IN_CURRENT_STATUS"||e.conditionType=="VENDOR_DURATION_IN_CURRENT_STATUS"||e.conditionType=="TIME_WITHOUT_SELLER_RESPONSE"?1:-1),s(6),w("ngModel",e.durationCondition.condition),s(),V(e.durationConditionTypeOptions),s(2),w("ngModel",e.durationCondition.durationValue),s(),w("ngModel",e.durationCondition.unit),s(),V(e.durationUnitOptions)}}function _l(o,l){if(o&1&&(r(0,"span"),p(1),a()),o&2){let e=d(2);s(),T(" Expected Profit is ",e.expectedVsActualOperatorPhrase," Actual Profit by ")}}function hl(o,l){o&1&&p(0," SOW difference ")}function xl(o,l){o&1&&p(0," Actual profit ")}function gl(o,l){o&1&&p(0," Sold price ")}function fl(o,l){o&1&&p(0," Last offer amount ")}function yl(o,l){o&1&&p(0," Sold date ")}function Cl(o,l){o&1&&p(0," Expected profit ")}function bl(o,l){o&1&&(r(0,"option",34),p(1,"More Than"),a(),r(2,"option",35),p(3,"Less Than"),a())}function Sl(o,l){o&1&&(r(0,"option",34),p(1,"More Than"),a(),r(2,"option",35),p(3,"Less Than"),a(),r(4,"option",36),p(5,"Is"),a())}function Tl(o,l){if(o&1){let e=C();r(0,"select",32),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.conditionScope,t)||(n.conditionScope=t),_(t)}),x(1,bl,4,0)(2,Sl,6,0),a(),r(3,"input",33),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.conditionValue[0],t)||(n.conditionValue[0]=t),_(t)}),a()}if(o&2){let e=d(2);w("ngModel",e.conditionScope),s(),g(e.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"?1:2),s(2),w("ngModel",e.conditionValue[0]),m("placeholder",e.conditionType=="SOW_DIFFERENCE"?"Difference":"Amount")}}function vl(o,l){if(o&1){let e=C();r(0,"select",32),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.conditionScope,t)||(n.conditionScope=t),_(t)}),r(1,"option",34),p(2,"More Than"),a(),r(3,"option",35),p(4,"Less Than"),a(),r(5,"option",36),p(6,"Is"),a()(),r(7,"mat-form-field",37)(8,"input",38),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.soldDatePickerValue,t)||(n.soldDatePickerValue=t),_(t)}),a(),h(9,"mat-datepicker-toggle",39)(10,"mat-datepicker",null,0),a()}if(o&2){let e=Te(11),i=d(2);w("ngModel",i.conditionScope),s(8),m("matDatepicker",e),w("ngModel",i.soldDatePickerValue),s(),m("for",e)}}function El(o,l){if(o&1&&(r(0,"div",18)(1,"label",31),x(2,_l,2,1,"span")(3,hl,1,0)(4,xl,1,0)(5,gl,1,0)(6,fl,1,0)(7,yl,1,0)(8,Cl,1,0),h(9,"img",13),a(),r(10,"div",25),x(11,Tl,4,4)(12,vl,12,4),a()()),o&2){let e=d();s(2),g(e.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"?2:e.conditionType=="SOW_DIFFERENCE"?3:e.conditionType=="ACTUAL_PROFIT"?4:e.conditionType=="SOLD_PRICE"?5:e.conditionType=="LAST_OFFER_AMOUNT"||e.conditionType=="BUYER_LAST_OFFER_AMOUNT"||e.conditionType=="AGENT_LAST_OFFER_AMOUNT"?6:e.conditionType=="SOLD_DATE"?7:8),s(9),g(e.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"||e.conditionType=="EXPECTED_PROFIT"||e.conditionType=="SOW_DIFFERENCE"||e.conditionType=="ACTUAL_PROFIT"||e.conditionType=="SOLD_PRICE"||e.conditionType=="LAST_OFFER_AMOUNT"||e.conditionType=="BUYER_LAST_OFFER_AMOUNT"||e.conditionType=="AGENT_LAST_OFFER_AMOUNT"?11:e.conditionType=="SOLD_DATE"?12:-1)}}function wl(o,l){if(o&1){let e=C();r(0,"div",18)(1,"p-multiselect",40),A("ngModelChange",function(t){u(e);let n=d();return I(n.conditionValue,t)||(n.conditionValue=t),_(t)}),a()()}if(o&2){let e=d();s(),m("maxSelectedLabels",1e3)("options",e.conditionValueOptions),w("ngModel",e.conditionValue),m("placeholder",e.conditionPlaceholder)("readonly",e.isConditionValueSingleOption)}}function Il(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit,i=d(2);m("value",e),s(),T(" ",i.formatOperator(e)," ")}}function Al(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",e==null?null:e.title," ")}}function Ml(o,l){if(o&1){let e=C();r(0,"select",46),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.conditionValue[0],t)||(n.conditionValue[0]=t),_(t)}),r(1,"option",16),p(2,"--Select--"),a(),D(3,Al,2,2,"option",17,k),a()}if(o&2){let e=d(2);w("ngModel",e.conditionValue[0]),m("disabled",e.isConditionValueSingleOption),s(3),V(e.conditionValueOptions)}}function Ol(o,l){if(o&1){let e=C();r(0,"p-multiselect",49),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.conditionValue,t)||(n.conditionValue=t),_(t)}),a()}if(o&2){let e=d(3);m("maxSelectedLabels",1e3)("options",e.conditionValueOptions),w("ngModel",e.conditionValue),m("placeholder",e.conditionPlaceholder)("readonly",e.isConditionValueSingleOption)("display","comma")}}function Dl(o,l){if(o&1){let e=C();r(0,"p-autocomplete",50,1),y("onFocus",function(t){u(e);let n=Te(1);return _(n.handleDropdownClick(t))})("onSelect",function(t){u(e);let n=Te(1),c=d(3);return _(c.onTagSelect(t,n))})("onUnselect",function(t){u(e);let n=Te(1),c=d(3);return _(c.onTagUnselect(t,n))})("onKeyUp",function(t){u(e);let n=Te(1),c=d(3);return _(c.onMultiAutocompleteKeyUp(t,n))})("onClear",function(){u(e);let t=Te(1),n=d(3);return _(n.clearItem(t))}),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.conditionValue,t)||(n.conditionValue=t),_(t)}),y("completeMethod",function(t){u(e);let n=d(3);return _(n.conditionType==="TAGS"?n.searchTags(t.query):n.searchBuyerTargetGeo(t.query))}),a()}if(o&2){let e=d(3);m("ngModelOptions",pt(9,il))("placeholder",!e.conditionValue||(e.conditionValue==null?null:e.conditionValue.length)===0?e.conditionType==="TAGS"?"Select Tags":e.buyerTargetGeoPlaceholder:""),w("ngModel",e.conditionValue),m("suggestions",e.filteredConditionValueOptions)("emptyMessage",null)("panelStyleClass",(e.filteredConditionValueOptions==null?null:e.filteredConditionValueOptions.length)===0?"hide-panel":"bg-transparency-0 text-transparency-100 border-transparency-25")("dropdown",!0)("autoOptionFocus",!0)("forceSelection",!0)}}function Vl(o,l){if(o&1&&(r(0,"div",45),x(1,Ol,1,6,"p-multiselect",47),x(2,Dl,2,10,"p-autocomplete",48),a()),o&2){let e=d(2);s(),g(e.conditionType!=="TAGS"&&!e.isBuyerTargetGeoCondition()?1:-1),s(),g(e.conditionType==="TAGS"||e.isBuyerTargetGeoCondition()?2:-1)}}function Nl(o,l){if(o&1){let e=C();r(0,"div",18)(1,"div",41)(2,"div",42)(3,"select",43),A("ngModelChange",function(t){u(e);let n=d();return I(n.conditionScope,t)||(n.conditionScope=t),_(t)}),D(4,Il,2,2,"option",17,k),a()(),r(6,"div",42),x(7,Ml,5,2,"select",44),x(8,Vl,3,2,"div",45),a()()()}if(o&2){let e=d();s(3),m("disabled",!(e.conditionType=="TAGS"||e.isBuyerTargetGeoCondition())),w("ngModel",e.conditionScope),s(),V(e.operatorOptions),s(3),g(e.isMultiple?-1:7),s(),g(e.isMultiple?8:-1)}}function kl(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e._id),s(),ce(e.label)}}function Bl(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e.value),s(),ce(e.label)}}function Pl(o,l){o&1&&(r(0,"span",58),p(1,"No value needed"),a())}function Ll(o,l){if(o&1){let e=C();r(0,"input",59),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqValueMain,t)||(n.cqValueMain=t),_(t)}),a()}if(o&2){let e=d(4);w("ngModel",e.cqValueMain)}}function Rl(o,l){if(o&1&&x(0,Pl,2,0,"span",58)(1,Ll,1,1,"input",57),o&2){let e=d(3);g(e.customQuestionOperatorSkipsValue()?0:1)}}function Fl(o,l){o&1&&(r(0,"span",58),p(1,"No value needed"),a())}function Ul(o,l){if(o&1&&(r(0,"option",17),p(1),a()),o&2){let e=l.$implicit;m("value",e.value),s(),ce(e.label)}}function Wl(o,l){if(o&1){let e=C();r(0,"select",52),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqValueMain,t)||(n.cqValueMain=t),_(t)}),r(1,"option",16),p(2,"--Select--"),a(),D(3,Ul,2,2,"option",17,La),a()}if(o&2){let e=d(4);w("ngModel",e.cqValueMain),s(3),V(e.selectedCustomQuestion.options)}}function jl(o,l){if(o&1&&x(0,Fl,2,0,"span",58)(1,Wl,5,1,"select",60),o&2){let e=d(3);g(e.customQuestionOperatorSkipsValue()?0:1)}}function ql(o,l){o&1&&(r(0,"span",58),p(1,"No value needed"),a())}function Gl(o,l){if(o&1){let e=C();r(0,"div",61)(1,"p-multiselect",62),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqMultiValue,t)||(n.cqMultiValue=t),_(t)}),a()()}if(o&2){let e=d(4);s(),m("options",e.selectedCustomQuestion.options),w("ngModel",e.cqMultiValue),m("display","comma")}}function Hl(o,l){if(o&1&&x(0,ql,2,0,"span",58)(1,Gl,2,3,"div",61),o&2){let e=d(3);g(e.customQuestionOperatorSkipsValue()?0:1)}}function Yl(o,l){o&1&&(r(0,"span",58),p(1,"No value needed"),a())}function zl(o,l){if(o&1){let e=C();r(0,"div",63)(1,"input",65),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqValueMain,t)||(n.cqValueMain=t),_(t)}),a(),r(2,"input",66),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqValueTo,t)||(n.cqValueTo=t),_(t)}),a()()}if(o&2){let e=d(4);s(),w("ngModel",e.cqValueMain),s(),w("ngModel",e.cqValueTo)}}function Jl(o,l){if(o&1){let e=C();r(0,"input",67),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqValueMain,t)||(n.cqValueMain=t),_(t)}),a()}if(o&2){let e=d(4);w("ngModel",e.cqValueMain)}}function Ql(o,l){if(o&1&&x(0,Yl,2,0,"span",58)(1,zl,3,2,"div",63)(2,Jl,1,1,"input",64),o&2){let e=d(3);g(e.customQuestionOperatorSkipsValue()?0:e.customQuestionOperator==="between"?1:2)}}function $l(o,l){o&1&&(r(0,"span",58),p(1,"No value needed"),a())}function Kl(o,l){if(o&1){let e=C();r(0,"div",68)(1,"mat-form-field",70)(2,"input",71),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqDateMain,t)||(n.cqDateMain=t),_(t)}),y("focus",function(){u(e);let t=Te(5);return _(t.open())}),a(),h(3,"mat-datepicker-toggle",39)(4,"mat-datepicker",null,2),a(),r(6,"mat-form-field",70)(7,"input",72),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqDateTo,t)||(n.cqDateTo=t),_(t)}),y("focus",function(){u(e);let t=Te(10);return _(t.open())}),a(),h(8,"mat-datepicker-toggle",39)(9,"mat-datepicker",null,3),a()()}if(o&2){let e=Te(5),i=Te(10),t=d(4);s(2),m("matDatepicker",e),w("ngModel",t.cqDateMain),s(),m("for",e),s(4),m("matDatepicker",i),w("ngModel",t.cqDateTo),m("min",t.cqDateMain),s(),m("for",i)}}function Xl(o,l){if(o&1){let e=C();r(0,"mat-form-field",69)(1,"input",71),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.cqDateMain,t)||(n.cqDateMain=t),_(t)}),y("focus",function(){u(e);let t=Te(4);return _(t.open())}),a(),h(2,"mat-datepicker-toggle",39)(3,"mat-datepicker",null,2),a()}if(o&2){let e=Te(4),i=d(4);s(),m("matDatepicker",e),w("ngModel",i.cqDateMain),s(),m("for",e)}}function Zl(o,l){if(o&1&&x(0,$l,2,0,"span",58)(1,Kl,11,7,"div",68)(2,Xl,5,3,"mat-form-field",69),o&2){let e=d(3);g(e.customQuestionOperatorSkipsValue()?0:e.customQuestionOperator==="between"?1:2)}}function es(o,l){if(o&1){let e=C();r(0,"input",59),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.cqValueMain,t)||(n.cqValueMain=t),_(t)}),a()}if(o&2){let e=d(3);w("ngModel",e.cqValueMain)}}function ts(o,l){if(o&1){let e=C();r(0,"div",53)(1,"div",54)(2,"div",55)(3,"label",56),p(4,"Operator"),a(),r(5,"select",52),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.customQuestionOperator,t)||(n.customQuestionOperator=t),_(t)}),D(6,Bl,2,2,"option",17,nl),a()(),r(8,"div",55)(9,"label",56),p(10,"Value"),a(),x(11,Rl,2,1)(12,jl,2,1)(13,Hl,2,1)(14,Ql,3,1)(15,Zl,3,1)(16,es,1,1,"input",57),a()()()}if(o&2){let e,i=d(2);s(5),w("ngModel",i.customQuestionOperator),s(),V(i.selectedCustomQuestion.operator),s(5),g((e=i.selectedCustomQuestion.optionsType)==="SELECT-INPUT"?11:e==="SELECT"?12:e==="MULTI-SELECT"?13:e==="RANGE"?14:e==="DATE-RANGE"?15:16)}}function is(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",51)(2,"label",12),p(3," Select question "),h(4,"img",13),a(),r(5,"select",52),A("ngModelChange",function(t){u(e);let n=d();return I(n.customQuestionId,t)||(n.customQuestionId=t),_(t)}),y("ngModelChange",function(){u(e);let t=d();return _(t.onCustomQuestionIdChange())}),r(6,"option",16),p(7,"--Select--"),a(),D(8,kl,2,2,"option",17,La),a()(),x(10,ts,17,2,"div",53),a()}if(o&2){let e=d();s(5),w("ngModel",e.customQuestionId),s(3),V(e.customQuestionOptionsList),s(2),g(e.selectedCustomQuestion?10:-1)}}function Rt(o){return`<div style="text-align:left;white-space:normal">${o.map(({title:l,body:e},i)=>`<div style="margin:0 0 ${i===o.length-1?0:16}px 0"><strong style="display:block;margin:0">${l}</strong><span style="display:block;margin:4px 0 0 0">${e}</span></div>`).join("")}</div>`}var tl,il,La,nl,Zt,Yi=ee(()=>{Aa();Mt();Re();Ir();W();Lt();Ce();Ee();xe();Ma();
1yr();Cr();fe();St();se();ur();po();mr();pe();Bt();rr();He();be();tl=["propertySearch"],il=()=>({standalone:!0}),La=(o,l)=>l._id,nl=(o,l)=>l.value;Zt=class o{static{this.CONDITION_TYPES_BY_MODULE=new Map([[O.ModuleStatusId.WHOLESALEPIPELINE,Q.wholesaleOtherTriggerConditionType||[]],[O.ModuleStatusId.INVENTORY,Q.inventoryOtherTriggerConditionType||[]],[O.ModuleStatusId.SOLD,Q.soldOtherTriggerConditionType||[]],[O.ModuleStatusId.RENTAL,Q.rentalOtherTriggerConditionType||[]],[O.ModuleStatusId.BUYER,Q.buyerOtherTriggerConditionType||[]],[O.ModuleStatusId.AGENT,Q.agentOtherTriggerConditionType||[]],[O.ModuleStatusId.VENDOR,Q.vendorOtherTriggerConditionType||[]]])}static{this.INVENTORY_FAMILY_TAG_MODULES=new Set([O.ModuleStatusId.INVENTORY,O.ModuleStatusId.SOLD,O.ModuleStatusId.RENTAL])}static{this.CURRENT_STATUS_DURATION_TYPES=new Set(["LEAD_DURATION_IN_CURRENT_STATUS","TRANSACTION_DURATION_IN_CURRENT_STATUS","PROPERTY_DURATION_IN_CURRENT_STATUS","RENTAL_DURATION_IN_CURRENT_STATUS","BUYER_DURATION_IN_CURRENT_STATUS","AGENT_DURATION_IN_CURRENT_STATUS","VENDOR_DURATION_IN_CURRENT_STATUS"])}static{this.PIPELINE_STATUS_DURATION_TYPES=new Set(["LEAD_DURATION_IN_CURRENT_STATUS","TRANSACTION_DURATION_IN_CURRENT_STATUS","PROPERTY_DURATION_IN_CURRENT_STATUS","RENTAL_DURATION_IN_CURRENT_STATUS","BUYER_DURATION_IN_CURRENT_STATUS","AGENT_DURATION_IN_CURRENT_STATUS","VENDOR_DURATION_IN_CURRENT_STATUS","TIME_WITHOUT_SELLER_RESPONSE"])}static{this.DURATION_ONLY_PAYLOAD_TYPES=new Set(["TIME_TO_FIRST_NON_DRIP_SMS","OPEN_LEAD_DURATION","TRANSACTION_WITHOUT_LISTING_CREATED","SCHEDULED_CLOSING_IN_NEXT_X_DAYS","X_DAYS_WITHOUT_OFFER","X_DAYS_WITHOUT_BUYER_OR_AGENT_ADDED","PROPERTY_WITHOUT_SOW_CREATED","PROPERTY_WITHOUT_LISTING_CREATED","OPEN_CONTACT_DURATION"])}static{this.DURATION_COND_IS_MORE_THAN_TYPES=new Set(["PROPERTY_WITHOUT_SOW_CREATED","PROPERTY_WITHOUT_LISTING_CREATED","OPEN_CONTACT_DURATION"])}static{this.DURATION_COND_IS_ONLY_TYPES=new Set(["SCHEDULED_CLOSING_IN_NEXT_X_DAYS","X_DAYS_WITHOUT_OFFER","X_DAYS_WITHOUT_BUYER_OR_AGENT_ADDED"])}static{this.DURATION_UNIT_DAYS_ONLY_TYPES=new Set(["PROPERTY_WITHOUT_SOW_CREATED","PROPERTY_WITHOUT_LISTING_CREATED","SCHEDULED_CLOSING_IN_NEXT_X_DAYS","OPEN_CONTACT_DURATION"])}static{this.DURATION_UNIT_DAYS_WEEKS_TYPES=new Set(["X_DAYS_WITHOUT_OFFER","X_DAYS_WITHOUT_BUYER_OR_AGENT_ADDED","TRANSACTION_WITHOUT_LISTING_CREATED"])}static{this.SCORE_RANGE_0_100=[{_id:"0-10",title:"0-10"},{_id:"11-20",title:"11-20"},{_id:"21-30",title:"21-30"},{_id:"31-40",title:"31-40"},{_id:"41-50",title:"41-50"},{_id:"51-60",title:"51-60"},{_id:"61-70",title:"61-70"},{_id:"71-80",title:"71-80"},{_id:"81-90",title:"81-90"},{_id:"91-100",title:"91-100"}]}static{this.PERCENT_OF_ESTIMATED_VALUE_OPTIONS=[{_id:"Less than 50% of estimated value",title:"Less than 50% of estimated value"},{_id:"51-60% of estimated value",title:"51-60% of estimated value"},{_id:"61-70% of estimated value",title:"61-70% of estimated value"},{_id:"71-80% of estimated value",title:"71-80% of estimated value"},{_id:"81-90% of estimated value",title:"81-90% of estimated value"},{_id:"91-100% of estimated value",title:"91-100% of estimated value"},{_id:"100%+ of estimated value",title:"100%+ of estimated value"},{_id:"Other",title:"Other"}]}constructor(l,e,i,t,n,c,f,S,v){this._leadsService=l,this._loaderService=e,this._toastrService=i,this._commonFunctions=t,this._taggingService=n,this._buyersService=c,this._agentsService=f,this._dialog=S,this._commonService=v,this.data={},this.moduleId="",this.primaryConditionKey="lead",this.conditionTypes=[],this.conditionType="",this.conditionValue=[],this.pipelineId="",this.statusIds=[],this.pipelineData=[],this.statusData=[],this.durationCondition={condition:"More Than",unit:"Minutes",durationValue:1},this.conditionValueOptions=[],this.filteredConditionValueOptions=[],this.operatorOptions=[],this.isMultiple=!1,this.conditionScope="",this.conditionPlaceholder="",this.soldDatePickerValue=null,this.customQuestionOptionsList=[],this.customQuestionId="",this.customQuestionOperator="",this.cqValueMain="",this.cqValueTo="",this.cqDateMain=null,this.cqDateTo=null,this.cqMultiValue=[],this.leadOtherTriggersTooltip=Rt([{title:"New Seller Appointment",body:"Triggers the automation when a new seller appointment is scheduled for a lead."},{title:"Last Offer Amount",body:"Triggers the automation when the lead\u2019s most recent offer amount is more than, less than, or equal to the amount you specify."},{title:"Under Contract Price",body:"Triggers the automation when the under-contract price falls within any of the selected percentage ranges based on the property\u2019s estimated value from REsimpli data."},{title:"Lead Closed Manually",body:"Triggers the automation when an open lead is manually closed by a user."},{title:"Tags",body:"Triggers the automation when any of the selected tags are added to the lead."},{title:"Dead Lead Reason",body:"Triggers the automation when a lead is marked as a Dead Lead with one of the selected reasons."},{title:"Lead Qualification Status",body:"Triggers the automation when the lead is marked as either qualified or unqualified."}]),this.transactionOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a property in the Transaction Management pipeline."},{title:"Buyer Added",body:"Triggers the automation when a buyer is added in the Dispo tab for a property in the Transaction Management pipeline."},{title:"Agent Added",body:"Triggers the automation when an agent is added in the Dispo tab for a property in the Transaction Management pipeline."},{title:"Multiple Dispo Offers Received",body:"Triggers the automation when multiple offers from buyers or agents are added in the Dispo tab for a property in the Transaction Management pipeline."},{title:"Expected Profit Changed",body:"Triggers the automation when the expected profit is changed for a property in the Transaction Management pipeline."},{title:"Scheduled Closing Date Changed",body:"Triggers the automation when the scheduled closing date is changed for a property in the Transaction Management pipeline."}]),this.inventoryOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a property in the Inventory pipeline."},{title:"Buyer Added",body:"Triggers the automation when a buyer is added in the Dispo tab for a property in the Inventory pipeline."},{title:"Agent Added",body:"Triggers the automation when an agent is added in the Dispo tab for a property in the Inventory pipeline."},{title:"Multiple Dispo Offers Received",body:"Triggers the automation when multiple offers from buyers or agents are added in the Dispo tab for a property in the Inventory pipeline."},{title:"Expected Profit Changed",body:"Triggers the automation when the expected profit is changed for a property in the Inventory pipeline."},{title:"Scheduled Closing Date Changed",body:"Triggers the automation when the scheduled closing date is changed for a property in the Inventory pipeline."}]),this.soldOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a property in Sold status."},{title:"Actual Profit",body:"Triggers the automation when the actual profit for a property in Sold status is more than, less than, or equal to the amount you specify."},{title:"Sold Price",body:"Triggers the automation when the sold price for a property in Sold status is more than, less than, or equal to the amount you specify."},{title:"Expected Profit vs. Actual Profit",body:"Triggers the automation when the difference between the expected profit and actual profit for a property in Sold status is more than or less than the amount you specify."}]),this.rentalOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a property in Rental status."}]),this.buyerOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a buyer contact."},{title:"Target County",body:"Triggers the automation when a buyer contact\u2019s target county matches any of the selected counties."},{title:"Target City",body:"Triggers the automation when a buyer contact\u2019s target city matches any of the selected cities."},{title:"Target State",body:"Triggers the automation when a buyer contact\u2019s target state matches any of the selected states."},{title:"Target ZIP",body:"Triggers the automation when a buyer contact\u2019s target ZIP code matches any of the selected ZIP codes."},{title:"New Buyer Appointment",body:"Triggers the automation when a new appointment is scheduled with a buyer contact."}]),this.agentOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to an agent contact."},{title:"Target County",body:"Triggers the automation when an agent contact\u2019s target county matches any of the selected counties."},{title:"Target City",body:"Triggers the automation when an agent contact\u2019s target city matches any of the selected cities."},{title:"Target State",body:"Triggers the automation when an agent contact\u2019s target state matches any of the selected states."},{title:"Target ZIP",body:"Triggers the automation when an agent contact\u2019s target ZIP code matches any of the selected ZIP codes."},{title:"New Agent Appointment",body:"Triggers the automation when a new appointment is scheduled with an agent contact."}]),this.vendorOtherTriggersTooltip=Rt([{title:"Tags",body:"Triggers the automation when any of the selected tags are added to a vendor contact."},{title:"Target County",body:"Triggers the automation when a vendor contact\u2019s target county matches any of the selected counties."},{title:"Target City",body:"Triggers the automation when a vendor contact\u2019s target city matches any of the selected cities."},{title:"Target State",body:"Triggers the automation when a vendor contact\u2019s target state matches any of the selected states."},{title:"Target ZIP",body:"Triggers the automation when a vendor contact\u2019s target ZIP code matches any of the selected ZIP codes."}]),this.buyerTargetGeoListLimit=100,this.durationUnitsAll=["Minutes","Hours","Days","Weeks"],this.durationUnitsDaysWeeksOnly=["Days","Weeks"],this.durationUnitsDaysOnly=["Days"],this.durationConditionTypesAll=["More Than","Less Than","Is"],this.durationConditionTypeIsOnly=["Is"],this.durationConditionTypeIsMoreThan=["More Than","Is"]}
1ngOnInit(){this.applyConditionTypesForModule(),this.conditionType=this.getSavedOtherCondition()?.conditionType||"",this.setConditions(!0)}ngOnChanges(l){l.moduleId&&!l.moduleId.firstChange&&this.applyConditionTypesForModule()}getSavedOtherCondition(){return this.data?.primaryConditions?.[this.primaryConditionKey]?.otherCondition}normalizeMoreThanLessThanIsConditionScope(l,e=!0){let i=l==null?"":String(l).trim();return i==="MORE_THAN"||i==="LESS_THAN"?i:e&&(i==="IS"||i==="Is")?"IS":i==="More Than"?"MORE_THAN":i==="Less Than"?"LESS_THAN":"MORE_THAN"}isLeadModule(){return this.moduleId===O.ModuleStatusId.LEAD}isTransactionModule(){return this.moduleId===O.ModuleStatusId.WHOLESALEPIPELINE}isInventoryModule(){return this.moduleId===O.ModuleStatusId.INVENTORY}isSoldModule(){return this.moduleId===O.ModuleStatusId.SOLD}isRentalModule(){return this.moduleId===O.ModuleStatusId.RENTAL}isBuyerModule(){return this.moduleId===O.ModuleStatusId.BUYER}isAgentModule(){return this.moduleId===O.ModuleStatusId.AGENT}isVendorModule(){return this.moduleId===O.ModuleStatusId.VENDOR}get otherTriggersTooltip(){return this.isLeadModule()?this.leadOtherTriggersTooltip:this.isTransactionModule()?this.transactionOtherTriggersTooltip:this.isInventoryModule()?this.inventoryOtherTriggersTooltip:this.isSoldModule()?this.soldOtherTriggersTooltip:this.isRentalModule()?this.rentalOtherTriggersTooltip:this.isBuyerModule()?this.buyerOtherTriggersTooltip:this.isAgentModule()?this.agentOtherTriggersTooltip:this.isVendorModule()?this.vendorOtherTriggersTooltip:""}applyConditionTypesForModule(){let e=o.CONDITION_TYPES_BY_MODULE.get(this.moduleId)??Q.otherTriggerConditionType??[];this.conditionTypes=[...e]}getTagTypeForOtherTriggers(){return this.moduleId===O.ModuleStatusId.BUYER?O.TagsType.BUYERS:this.moduleId===O.ModuleStatusId.AGENT?O.TagsType.AGENTS:this.moduleId===O.ModuleStatusId.VENDOR?O.TagsType.VENDORS:O.TagsType.LEADS}get durationConditionTypeOptions(){return o.CURRENT_STATUS_DURATION_TYPES.has(this.conditionType)?this.durationConditionTypeIsMoreThan:o.DURATION_COND_IS_MORE_THAN_TYPES.has(this.conditionType)?this.durationConditionTypeIsMoreThan:o.DURATION_COND_IS_ONLY_TYPES.has(this.conditionType)?this.durationConditionTypeIsOnly:this.durationConditionTypesAll}get durationUnitOptions(){return o.DURATION_UNIT_DAYS_ONLY_TYPES.has(this.conditionType)?this.durationUnitsDaysOnly:o.DURATION_UNIT_DAYS_WEEKS_TYPES.has(this.conditionType)?this.durationUnitsDaysWeeksOnly:this.durationUnitsAll}formatOperator(l){return l?l.replace(/_/g," ").toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()):""}get expectedVsActualOperatorPhrase(){return this.conditionScope==="LESS_THAN"?"less than":"more than"}get isAutoFirstPipelineDuration(){return this.conditionType==="AGENT_DURATION_IN_CURRENT_STATUS"||this.conditionType==="BUYER_DURATION_IN_CURRENT_STATUS"||this.conditionType==="VENDOR_DURATION_IN_CURRENT_STATUS"}get isConditionValueSingleOption(){return(this.conditionValueOptions?.length??0)===1}getSingleYesConditionValue(){return["Yes"]}setConditions(l){if(this.resetValues(),o.PIPELINE_STATUS_DURATION_TYPES.has(this.conditionType))this.getPipelineList(l);else if(this.conditionType=="BUYER_ADDED"||this.conditionType=="AGENT_ADDED"||this.conditionType=="MULTIPLE_OFFERS_RECEIVED"||this.conditionType=="OFFER_ACCEPTED"||this.conditionType=="BUYER_OFFER_ACCEPTED"||this.conditionType=="EXPECTED_PROFIT_CHANGED"||this.conditionType=="SCHEDULED_CLOSING_DATE_CHANGED"||this.conditionType=="NEW_OFFER_RECEIVED"||this.conditionType=="SOW_ADDED"||this.conditionType=="NEW_LISTING_CREATED"||this.conditionType=="OFFER_SUBMITTED"||this.conditionType=="BUYER_WITH_NEW_APPT"||this.conditionType=="AGENT_WITH_NEW_APPT")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Yes",title:"Yes"}],this.conditionValue=this.getSingleYesConditionValue(),this.conditionPlaceholder="Select",l&&(this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="ESIGN")this.isMultiple=!0,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"SHARED",title:"Sent"},{_id:"PARTIALLY SIGNED",title:"Partially Signed"}
1,{_id:"EXECUTED",title:"Completed"}],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="LEADS_WITH_NEW_SELLER_APPT")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Yes",title:"Yes"}],this.conditionValue=this.getSingleYesConditionValue(),this.conditionPlaceholder="Select",l&&(this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="YEARS_OF_OWNERSHIP")this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[{_id:"Less than 1 year",title:"Less than 1 year"},{_id:"1-2 years",title:"1-2 years"},{_id:"2-3 years",title:"2-3 years"},{_id:"4-5 years",title:"4-5 years"},{_id:"6-10 years",title:"6-10 years"},{_id:"10-15 years",title:"10-15 years"},{_id:"15+ years",title:"15+ years"},{_id:"Unknown",title:"Unknown"}],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"INCLUDES_ANY");else if(this.conditionType=="LAST_SALE_AMOUNT")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Available",title:"Available"},{_id:"Not Available",title:"Not Available"}],this.conditionValue=[""],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[""],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="UNDER_CONTRACT_PRICE")this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[...o.PERCENT_OF_ESTIMATED_VALUE_OPTIONS],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"INCLUDES_ANY");else if(this.conditionType=="OPEN_LEADS_CLOSED_MANUALLY")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Yes",title:"Yes"}],this.conditionValue=this.getSingleYesConditionValue(),this.conditionPlaceholder="Select",l&&(this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="TAGS"){if(this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[],this.getAllTags(l),l){let e=this.getSavedOtherCondition()?.conditionScope;this.conditionScope=e==="INCLUDES_ALL"?"INCLUDES_ALL":"INCLUDES_ANY"}}else if(this.conditionType=="CUSTOM_QUESTION")this.isMultiple=!1,this.operatorOptions=[],this.conditionScope="IS",this.conditionValueOptions=[],this.filteredConditionValueOptions=[],this.getCustomQuestionsForOtherTriggers(l);else if(this.isBuyerTargetGeoCondition())this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[],this.filteredConditionValueOptions=[],this.conditionPlaceholder="Select",this.loadBuyerTargetGeoOptions(l);else if(this.conditionType=="DEAD_LEAD_REASON")this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[],this.conditionPlaceholder="Select reason",this.getDeadList(l),l&&(this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"INCLUDES_ANY");else if(this.conditionType=="LEAD_QUALIFICATION_STATUS")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Marked as qualified",title:"Marked as qualified"},{_id:"Marked as unqualified",title:"Marked as unqualified"}],this.conditionValue=[""],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[""],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="MEET_GRADE_AI_SCORE")this.isMultiple=!0,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[...o.SCORE_RANGE_0_100],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="BUYER_AI_SCORE"||this.conditionType=="AGENT_AI_SCORE")this.isMultiple=!0,this.operatorOptions=["INCLUDES_ANY"],this.conditionScope="INCLUDES_ANY",this.conditionValueOptions=[...o.SCORE_RANGE_0_100],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"INCLUDES_ANY");else if(this.conditionType=="CONVERSATIONAL_AI")this.isMultiple=!1,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[{_id:"Enabled",title:"Enabled"},{_id:"Disabled",title:"Disabled"}],this.conditionValue=[""],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[""],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="CALL_GRADE_AI_SCORE")this.isMultiple=!0,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[...o.SCORE_RANGE_0_100],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="LEAD_SCORE"||this.conditionType=="CONTRACT_SCORE_CHANGE")this.isMultiple=!0,this.operatorOptions=["IS"],this.conditionScope="IS",this.conditionValueOptions=[...o.SCORE_RANGE_0_100],this.conditionValue=[],this.conditionPlaceholder="Select",l&&(this.conditionValue=this.getSavedOtherCondition()?.conditionValue||[],this.conditionScope=this.getSavedOtherCondition()?.conditionScope||"IS");else if(this.conditionType=="TIME_TO_FIRST_NON_DRIP_SMS"||this.conditionType=="OPEN_LEAD_DURATION"){if(this.durationCondition={condition:"More Than",unit:"Minutes",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;e&&typeof e=="object"&&(this.durationCondition={condition:e.condition||"More Than",unit:e.unit||"Minutes",durationValue:e.durationValue!=null?e.durationValue:1})}}else if(this.conditionType=="SCHEDULED_CLOSING_IN_NEXT_X_DAYS"){if(this.durationCondition={condition:"Is",unit:"Days",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;e&&typeof e=="object"&&(this.durationCondition={condition:"Is",unit:"Days",durationValue:e.durationValue!=null?e.durationValue:1})}}else if(this.conditionType=="X_DAYS_WITHOUT_OFFER"||this.conditionType=="X_DAYS_WITHOUT_BUYER_OR_AGENT_ADDED"){if(this.durationCondition={condition:"Is",unit:"Days",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;e&&typeof e=="object"&&(this.durationCondition={condition:"Is",unit:e.unit==="Days"||e.unit==="Weeks"?e.unit:"Days",durationValue:e.durationValue!=null?e.durationValue:1})}}else if(this.conditionType=="TRANSACTION_WITHOUT_LISTING_CREATED"){if(this.durationCondition={condition:"More Than",unit:"Days",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;e&&typeof e=="object"&&(this.durationCondition={condition:e.condition||"More Than",unit:e.unit==="Days"||e.unit==="Weeks"?e.unit:"Days",durationValue:e.durationValue!=null?e.durationValue:1})}}else if(this.conditionType=="PROPERTY_WITHOUT_SOW_CREATED"||this.conditionType=="PROPERTY_WITHOUT_LISTING_CREATED"){if(this.durationCondition={condition:"Is",unit:"Days",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;if(e&&typeof e=="object"){let i=e.condition;this.durationCondition={condition:i==="Is"||i==="More Than"?i:"Is",unit:"Days",durationValue:e.durationValue!=null?e.durationValue:1}}}}else if(this.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"||this.conditionType=="EXPECTED_PROFIT"||this.conditionType=="SOW_DIFFERENCE"||this.conditionType=="ACTUAL_PROFIT"||this.conditionType=="SOLD_PRICE"||this.conditionType=="LAST_OFFER_AMOUNT"||this.conditionType=="BUYER_LAST_OFFER_AMOUNT"||this.conditionType=="AGENT_LAST_OFFER_AMOUNT"){if(this.conditionScope="MORE_THAN",this.conditionValue=[0],l){let e=this.getSavedOtherCondition();if(e&&typeof e=="object"){e.conditionScope!=null&&e.conditionScope!==""&&(this.conditionScope=this.normalizeMoreThanLessThanIsConditionScope(e.conditionScope,this.conditionType!=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"));let i=e.conditionValue;if(Array.isArray(i)&&i.length>0&&i[0]!==""&&i[0]!=null){let t=Number(i[0]);
1Number.isFinite(t)&&(this.conditionValue=[t])}else if(i!==""&&i!=null&&!Array.isArray(i)){let t=Number(i);Number.isFinite(t)&&(this.conditionValue=[t])}else if(e.durationCondition&&typeof e.durationCondition=="object"){let t=e.durationCondition;if(this.conditionScope=this.normalizeMoreThanLessThanIsConditionScope(t.condition,this.conditionType!=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"),t.durationValue!=null&&t.durationValue!==""){let n=Number(t.durationValue);Number.isFinite(n)&&(this.conditionValue=[n])}}}}}else if(this.conditionType=="OPEN_CONTACT_DURATION"){if(this.durationCondition={condition:"More Than",unit:"Days",durationValue:1},l){let e=this.getSavedOtherCondition()?.durationCondition;if(e&&typeof e=="object"){let i=e.condition;this.durationCondition={condition:i==="More Than"||i==="Is"?i:"More Than",unit:"Days",durationValue:e.durationValue!=null?e.durationValue:1}}}}else if(this.conditionType=="SOLD_DATE"&&(this.soldDatePickerValue=null,this.conditionScope="MORE_THAN",this.conditionValue=[""],l)){let e=this.getSavedOtherCondition();if(e&&typeof e=="object"){e.conditionScope!=null&&e.conditionScope!==""&&(this.conditionScope=this.normalizeMoreThanLessThanIsConditionScope(e.conditionScope));let i=e.conditionValue,t=Array.isArray(i)?i[0]:i;if(t!==""&&t!=null&&String(t).trim()!=="")this.soldDatePickerValue=this.parseSoldDateFromPayload(t),this.conditionValue=[String(t).trim()];else if(e.durationCondition&&typeof e.durationCondition=="object"){let n=e.durationCondition;this.conditionScope=this.normalizeMoreThanLessThanIsConditionScope(n.condition);let c=n.durationValue;c!==""&&c!=null&&String(c).trim()!==""&&(this.soldDatePickerValue=this.parseSoldDateFromPayload(c),this.conditionValue=[String(c).trim()])}}}}resetValues(){this.conditionValue=[],this.pipelineId="",this.statusIds=[],this.pipelineData=[],this.statusData=[],this.durationCondition={condition:"More Than",unit:"Minutes",durationValue:1},this.conditionValueOptions=[],this.filteredConditionValueOptions=[],this.operatorOptions=[],this.isMultiple=!1,this.soldDatePickerValue=null,this.resetCustomQuestionState()}resetCustomQuestionState(){this.customQuestionOptionsList=[],this.customQuestionId="",this.customQuestionOperator="",this.cqValueMain="",this.cqValueTo="",this.cqDateMain=null,this.cqDateTo=null,this.cqMultiValue=[]}get selectedCustomQuestion(){return this.customQuestionId?this.customQuestionOptionsList.find(l=>l._id===this.customQuestionId)??null:null}onCustomQuestionIdChange(){let l=this.selectedCustomQuestion;if(!l){this.customQuestionOperator="",this.cqValueMain="",this.cqValueTo="",this.cqDateMain=null,this.cqDateTo=null,this.cqMultiValue=[];return}this.customQuestionOperator=l.operator[0]?.value??"",this.cqValueMain="",this.cqValueTo="",this.cqDateMain=null,this.cqDateTo=null,this.cqMultiValue=[]}customQuestionOperatorSkipsValue(){return this.customQuestionOperator==="notEmpty"}operatorsWithoutIsEmpty(l){return l.filter(e=>e.value!=="empty")}getCustomQuestionSaveValidationError(){if(this.conditionType!=="CUSTOM_QUESTION")return null;if(!this.customQuestionId?.trim())return"Please select a custom question";let l=this.selectedCustomQuestion;return l?this.customQuestionOperator?this.customQuestionOperatorSkipsValue()?null:l.optionsType==="MULTI-SELECT"?this.cqMultiValue?.length?null:"Please select at least one option":l.optionsType==="DATE-RANGE"?this.customQuestionOperator==="between"?!this.cqDateMain||!this.cqDateTo?"Please select both dates for between":null:this.cqDateMain?null:"Please select a date":l.optionsType==="RANGE"?this.customQuestionOperator==="between"?!String(this.cqValueMain??"").trim()||!String(this.cqValueTo??"").trim()?"Please enter both values for between":Number.isNaN(Number(this.cqValueMain))||Number.isNaN(Number(this.cqValueTo))?"Please enter valid numbers":null:String(this.cqValueMain??"").trim()?Number.isNaN(Number(this.cqValueMain))?"Please enter a valid number":null:"Please enter a value":l.optionsType==="SELECT"?this.cqValueMain===""||this.cqValueMain===null||this.cqValueMain===void 0?"Please select a value":null:String(this.cqValueMain??"").trim()?null:"Please enter a value":"Please select an operator":"Please select a valid custom question"}buildCustomQuestionPayload(){if(!this.customQuestionId||!this.selectedCustomQuestion)return null;let l=this.selectedCustomQuestion,e=this.customQuestionOperator,i=this.cqValueMain;return l.optionsType==="MULTI-SELECT"?i=(this.cqMultiValue||[]).map(t=>{let n=l.options.find(c=>c._id===String(t));return n!=null?n.value:String(t)}):l.optionsType==="DATE-RANGE"?e==="between"?i=[this.cqDateMain?this.formatSoldDateForPayload(this.cqDateMain):"",this.cqDateTo?this.formatSoldDateForPayload(this.cqDateTo):""]:i=this.cqDateMain?this.formatSoldDateForPayload(this.cqDateMain):"":l.optionsType==="RANGE"?e==="between"?i=[this.cqValueMain,this.cqValueTo]:i=this.cqValueMain:this.customQuestionOperatorSkipsValue()&&(i=""),{questionId:this.customQuestionId,questionType:l.questionType,operator:e,value:i}}mapRawMasterQuestionToDef(l){let e=l?._id!=null?String(l._id):"";if(!e)return null;let i=[];l?.options&&l?.options?.length>0&&(i=l.options.reduce((S,v,b)=>{if(!v?.key)return S;if(l?.questionType=="DROPDOWN")S.push({_id:`cq_${e}_${b}`,label:String(v.key),value:String(v.key)});
1else{let N=v?.value!=null&&String(v.value).trim()!==""?String(v.value):String(v.key);S.push({_id:`cq_${e}_${b}`,label:String(v.key),value:N})}return S},[]));let t=l?.questionTitle??l?.title??e,n=l?.questionType??"TEXT",c="",f=[];return n==="TEXT"||n==="MULTILINE_TEXT"?(c="SELECT-INPUT",f=this.operatorsWithoutIsEmpty([...go])):n==="CHECK_LIST"?(c="MULTI-SELECT",f=this.operatorsWithoutIsEmpty([...Na])):n==="RADIO_BUTTON"?(c="SELECT",f=this.operatorsWithoutIsEmpty([...Va])):n==="DROPDOWN"?(c="SELECT",f=[{label:"Equals",value:"is"}]):n==="NUMBER"||n==="CURRENCY"?(c="RANGE",f=[{label:"Equal",value:"is"},{label:"More than",value:"morethan"},{label:"Less than",value:"lessthan"},{label:"Between",value:"between"}]):n==="DATE"?(c="DATE-RANGE",f=[{label:"More than",value:"morethan"},{label:"Less than",value:"lessthan"},{label:"Between",value:"between"}]):(c="SELECT-INPUT",f=this.operatorsWithoutIsEmpty([...go])),{_id:e,label:t,questionType:n,optionsType:c,operator:f,options:i}}applySavedCustomQuestionPayload(l){if(!l||typeof l!="object")return;let e=l.questionId!=null?String(l.questionId):"";if(!e)return;this.customQuestionId=e;let i=this.selectedCustomQuestion;if(!i)return;let t=l.operator,n=t!=null?String(t):"",c=i.operator.some(v=>v.value===n);this.customQuestionOperator=c?n:i.operator[0]?.value??"";let f=this.customQuestionOperator,S=l.value;if(this.cqValueMain="",this.cqValueTo="",this.cqDateMain=null,this.cqDateTo=null,this.cqMultiValue=[],i.optionsType==="MULTI-SELECT"){let v=b=>{let N=String(b),j=i.options.find(xt=>xt.value===N);if(j)return[j._id];let Fe=i.options.find(xt=>xt._id===N);return Fe?[Fe._id]:[]};this.cqMultiValue=Array.isArray(S)?S.flatMap(b=>v(b)):S!=null&&S!==""?v(S):[];return}if(i.optionsType==="DATE-RANGE"){f==="between"?Array.isArray(S)&&S.length>=2?(this.cqDateMain=this.parseSoldDateFromPayload(S[0]),this.cqDateTo=this.parseSoldDateFromPayload(S[1])):l.valueTo!=null&&(this.cqDateMain=this.parseSoldDateFromPayload(S),this.cqDateTo=this.parseSoldDateFromPayload(l.valueTo)):this.cqDateMain=this.parseSoldDateFromPayload(S);return}if(i.optionsType==="RANGE"){f==="between"?Array.isArray(S)&&S.length>=2?(this.cqValueMain=S[0]!=null?String(S[0]):"",this.cqValueTo=S[1]!=null?String(S[1]):""):l.valueTo!=null&&(this.cqValueMain=S!=null?String(S):"",this.cqValueTo=String(l.valueTo)):this.cqValueMain=S!=null?String(S):"";return}this.cqValueMain=S!=null?String(S):""}getPipelineList(l){let e={page:1,limit:100,moduleId:this.moduleId};this._loaderService.start(),this._leadsService.getPipelines(e).subscribe(i=>{i?.statusCode==200&&(this.pipelineData=i?.data?.items||[],this.isAutoFirstPipelineDuration&&this.pipelineData?.length>0?(this.pipelineId=String(this.pipelineData[0]._id??""),l&&(this.durationCondition=this.getSavedOtherCondition()?.durationCondition||{condition:"More Than",unit:"Minutes",durationValue:1}),this.onChangePipeline(l)):l&&(this.pipelineId=this.getSavedOtherCondition()?.pipelineId||"",this.durationCondition=this.getSavedOtherCondition()?.durationCondition||{condition:"More Than",unit:"Minutes",durationValue:1},this.onChangePipeline(l))),this._loaderService.stop()},i=>{this._loaderService.stop()})}onChangePipeline(l){this.statusData=[],this.pipelineData?.forEach(e=>{this.pipelineId==e?._id&&(this.statusData=[...this.statusData,...e?.mainStatusList])}),this.statusData=this.statusData?.map(e=>(e.title=this._commonFunctions.titleCaseToWord(e?.title),e)),l&&(this.statusIds=this.getSavedOtherCondition()?.mainStatusId||[])}getDeadList(l){let e={page:1,limit:100};this._loaderService.start(),this._leadsService.getDeadLeadReasons(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items||[];if(this.conditionValueOptions=[...this.conditionValueOptions,...t.map(c=>({_id:c?._id,title:c?.name}))],l){let c=this.getSavedOtherCondition()?.conditionValue||[],f=Array.isArray(c)?c.map(S=>S==null||S===""?null:String(S)).filter(S=>S!=null):[];for(let S of f)this.conditionValueOptions?.some(v=>String(v?._id)===S)||this.conditionValueOptions.push({_id:S,title:S});this.conditionValue=f}let n=this.conditionValue?.map(c=>
1typeof c=="string"?c:c?._id)||[];this.filteredConditionValueOptions=this.conditionValueOptions?.filter(c=>!n.includes(c?._id))||[]}this._loaderService.stop()},i=>{this._loaderService.stop()})}clearItem(l){l.value="",l.handleDropdownClick()}onMultiAutocompleteKeyUp(l,e){if(l.key==="Backspace"){setTimeout(()=>e?.handleDropdownClick(l),0);return}l.key!=="Enter"&&l.key!=="NumpadEnter"||setTimeout(()=>{let i=(e?.multiInputEl?.nativeElement?.value||e?.inputEL?.nativeElement?.value||"").trim();if(!i)return;let t=this.filteredConditionValueOptions||[],n=t.find(f=>String(f?.title||"").toLowerCase()===i.toLowerCase())||t.find(f=>String(f?.title||"").toLowerCase().includes(i.toLowerCase()))||null;if(!n?._id)return;if((this.conditionValue||[]).some(f=>(typeof f=="string"?f:f?._id)===n._id)){this.clearAutocompleteInput(e);return}this.conditionValue=[...this.conditionValue||[],n],this.filteredConditionValueOptions=this.sortOptionsByTitle(t.filter(f=>f?._id!==n._id)),this.clearAutocompleteInput(e),e?.hide?.(!0)},0)}clearAutocompleteInput(l){l?.multiInputEl?.nativeElement&&(l.multiInputEl.nativeElement.value=""),l?.inputEL?.nativeElement&&(l.inputEL.nativeElement.value="")}removeTag(l,e,i){if(i&&(i.stopPropagation(),i.preventDefault()),this.conditionValue&&Array.isArray(this.conditionValue)){let t=this.conditionValue?.findIndex(n=>typeof n=="string"?n===l:n?._id===l);if(t>-1){this.conditionValue.splice(t,1),this.conditionValue=[...this.conditionValue];let n=this.conditionValueOptions?.find(c=>c?._id===l);n&&(this.filteredConditionValueOptions?.find(f=>f?._id===l)||(this.filteredConditionValueOptions=this.sortOptionsByTitle([...this.filteredConditionValueOptions,n])))}}}onTagSelect(l,e){if(l?.value){let i=l.value?._id||l.value;this.filteredConditionValueOptions=this.sortOptionsByTitle(this.filteredConditionValueOptions?.filter(t=>t?._id!==i)||[])}e&&setTimeout(()=>e.handleDropdownClick(l?.originalEvent),0)}onTagUnselect(l,e){if(l?.value){let i=l.value?._id||l.value,t=this.conditionValueOptions?.find(n=>n?._id===i);t&&(this.filteredConditionValueOptions?.find(c=>c?._id===i)||(this.filteredConditionValueOptions=this.sortOptionsByTitle([...this.filteredConditionValueOptions,t])))}e&&setTimeout(()=>e.handleDropdownClick(l?.originalEvent),0)}searchTags(l){setTimeout(()=>{let e=this.conditionValue?.map(i=>typeof i=="string"?i:i?._id)||[];!l||l.trim()===""?this.filteredConditionValueOptions=this.sortOptionsByTitle(this.conditionValueOptions?.filter(i=>!e.includes(i?._id))||[]):this.filteredConditionValueOptions=this.sortOptionsByTitle(this.conditionValueOptions?.filter(i=>!e.includes(i?._id)&&i?.title?.toLowerCase().includes(l?.toLowerCase()))||[])},100)}isBuyerTargetGeoCondition(){return this.getBuyerTargetListApiType()!==null}get buyerTargetGeoPlaceholder(){switch(this.conditionType){case"TARGET_COUNTY":return"Select county";case"TARGET_CITY":return"Select city";case"TARGET_STATE":return"Select state";case"TARGET_ZIP":return"Select zip";default:return"Select"}}getBuyerTargetListApiType(){switch(this.conditionType){case"TARGET_COUNTY":return 1;case"TARGET_CITY":return 2;case"TARGET_STATE":return 3;case"TARGET_ZIP":return 4;default:return null}}formatTargetGeoDisplayTitle(l){if(l==null||String(l)?.trim()==="")return String(l??"");let e=String(l)?.trim();return this.conditionType==="TARGET_STATE"&&e?.length===2&&/^[a-z]{2}$/i.test(e)?e?.toUpperCase():e?.split(/\s+/)?.map(i=>i?.charAt(0)?.toUpperCase()+i?.slice(1)?.toLowerCase())?.join(" ")}shouldFormatTargetGeoDisplayTitle(){return this.conditionType==="TARGET_COUNTY"||this.conditionType==="TARGET_CITY"||this.conditionType==="TARGET_STATE"}mapTargetGeoItemToOption(l){let e=l?.value!=null&&String(l.value)!==""?String(l.value):l?._id!=null?String(l._id):"";if(!e)return{_id:"",title:""};let i=l?.label!=null?String(l.label):l?.title!=null?String(l.title):l?.name!=null?String(l.name):e,t=this.shouldFormatTargetGeoDisplayTitle()?this.formatTargetGeoDisplayTitle(i):i;return{_id:e,title:t}}mergeUniqueTargetGeoOptions(l,e){let i=new Map;[...l,...e].forEach(n=>{n?._id&&i.set(n._id,n)});let t=Array.from(i.values());return this.shouldSortTargetGeoOptionsAlphabetically()?this.sortOptionsByTitle(t):t}shouldSortTargetGeoOptionsAlphabetically(){return this.conditionType==="TARGET_COUNTY"||this.conditionType==="TARGET_CITY"}refreshBuyerTargetGeoFiltered(l){let e=this.conditionValue?.map(n=>typeof n=="string"?n:n?._id)||[],t=(l??this.conditionValueOptions)?.filter(n=>n?._id&&!e.includes(n._id))||[];this.filteredConditionValueOptions=this.shouldSortTargetGeoOptionsAlphabetically()?this.sortOptionsByTitle(t):t}loadBuyerTargetGeoOptions(l,e){let i=this.getBuyerTargetListApiType();if(i===null)return;let t={page:1,limit:this.buyerTargetGeoListLimit,type:i};e?.trim()&&(t.searchString=e.trim());let n=this.moduleId===O.ModuleStatusId.AGENT?this._agentsService.getTargetList(t):this._buyersService.getTargetList(t);this._loaderService.start(),n.subscribe(c=>{if(this._loaderService.stop(),c?.statusCode===200){let f=(c?.data?.items||[]).map(S=>this.mapTargetGeoItemToOption(S)).filter(S=>S._id);if(this.conditionValueOptions=this.mergeUniqueTargetGeoOptions(this.conditionValueOptions,f),l){let S=this.getSavedOtherCondition()?.conditionValue||[];this.conditionValue=Array.isArray(S)?S.map(v=>{let b=this.conditionValueOptions.find(N=>N._id===String(v));return b?{_id:b._id,title:b.title}:{_id:String(v),title:this.shouldFormatTargetGeoDisplayTitle()?this.formatTargetGeoDisplayTitle(String(v)):String(v)}}).filter(v=>v._id):[]}this.refreshBuyerTargetGeoFiltered(e?.trim()?f:void 0)}},()=>{this._loaderService.stop()})}searchBuyerTargetGeo(l){setTimeout(()=>
1{if(this.isBuyerTargetGeoCondition()){if(!l||l.trim()===""){this.loadBuyerTargetGeoOptions(!1);return}this.loadBuyerTargetGeoOptions(!1,l)}},100)}getCustomQuestionsForOtherTriggers(l){this._loaderService.start(),this._commonService.getMasterGroups({page:1,limit:1e3,moduleId:this.moduleId}).subscribe(e=>{if(this._loaderService.stop(),e?.statusCode!==200)return;let i=e?.data?.items||[],t=[],n=new Set;for(let c of i){let f=c?.masterQuestions??c?.questions??[];for(let S of f){let v=this.mapRawMasterQuestionToDef(S);!v||n.has(v._id)||(n.add(v._id),t.push(v))}}if(this.customQuestionOptionsList=t,l){let c=this.getSavedOtherCondition()?.conditionValue;if(Array.isArray(c)&&c.length>0){let f=c[0];f!=null&&typeof f=="object"&&f.questionId?this.applySavedCustomQuestionPayload(f):typeof f=="string"&&f.trim()!==""&&(this.customQuestionId=f.trim(),this.onCustomQuestionIdChange())}}},()=>{this._loaderService.stop()})}getAllTags(l){this._loaderService.start(),this._taggingService.getTags(this.getTagTypeForOtherTriggers()).subscribe(e=>{if(this._loaderService.stop(),e&&e?.statusCode==200){let i=e?.data||[];if(this.conditionValueOptions=this.sortOptionsByTitle([...this.conditionValueOptions,...i.map(n=>({_id:n?._id,title:n?.label}))]),l){let n=this.getSavedOtherCondition()?.conditionValue||[];this.conditionValue=Array.isArray(n)?this.sortOptionsByTitle(n.map(c=>{let f=this.conditionValueOptions?.find(S=>S?._id===c);return f?{_id:f?._id,title:f?.title}:null}).filter(c=>c!==null)):[]}let t=this.conditionValue?.map(n=>typeof n=="string"?n:n?._id)||[];this.filteredConditionValueOptions=this.sortOptionsByTitle(this.conditionValueOptions?.filter(n=>!t.includes(n?._id))||[])}},e=>{this._loaderService.stop()})}addReason(){this.dialogRef=this._dialog.open(Li,{width:"400px",data:{}}),this.dialogRef.afterClosed().subscribe(l=>{l?.success&&this.conditionType==="DEAD_LEAD_REASON"&&(this.conditionValueOptions=[],this.filteredConditionValueOptions=[],this.getDeadList())})}getFinalData(){let l={otherCondition:{conditionType:this.conditionType}};if(o.PIPELINE_STATUS_DURATION_TYPES.has(this.conditionType))l.otherCondition.pipelineId=this.pipelineId,l.otherCondition.mainStatusId=this.statusIds,l.otherCondition.durationCondition=this.durationCondition;else if(o.DURATION_ONLY_PAYLOAD_TYPES.has(this.conditionType))l.otherCondition.durationCondition=this.durationCondition;else if(this.conditionType=="CUSTOM_QUESTION"){let e=this.buildCustomQuestionPayload();l.otherCondition.conditionValue=e?[e]:[],l.otherCondition.conditionScope="IS"}else if(this.conditionType=="TAGS"||this.conditionType=="DEAD_LEAD_REASON"||this.isBuyerTargetGeoCondition()){let e=Array.isArray(this.conditionValue)?[...new Set(this.conditionValue.map(i=>typeof i=="string"?i:i?._id).filter(i=>i!=null&&i!==""))]:this.conditionValue;l.otherCondition.conditionValue=e,l.otherCondition.conditionScope=this.conditionScope}else this.conditionType==="SOLD_DATE"?l.otherCondition.conditionValue=[this.soldDatePickerValue?this.formatSoldDateForPayload(this.soldDatePickerValue):""]:l.otherCondition.conditionValue=this.conditionValue,l.otherCondition.conditionScope=this.conditionScope;return l}parseSoldDateFromPayload(l){if(l==null||l==="")return null;let e=String(l).trim(),i=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(i){let n=Number(i[1]),c=Number(i[2])-1,f=Number(i[3]);return new Date(n,c,f)}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}formatSoldDateForPayload(l){let e=l.getFullYear(),i=String(l.getMonth()+1).padStart(2,"0"),t=String(l.getDate()).padStart(2,"0");return`${e}-${i}-${t}`}sortOptionsByTitle(l){return[...l||[]].sort((e,i)=>String(e?.title||"").localeCompare(String(i?.title||""),void 0,{sensitivity:"base"}))}static{this.\u0275fac=function(e){return new(e||o)(E(it),E(H),E(Y),E(q),E(Ri),E(Ca),E(ba),E(ve),E(Ue))}}static{this.\u0275cmp=B({type:o,selectors:[["app-other-triggers"]],viewQuery:function(e,i){if(e&1&&We(tl,5),e&2){let t;ie(t=ne())&&(i.autocomplete=t.first)}},inputs:{data:"data",moduleId:"moduleId",primaryConditionKey:"primaryConditionKey"},standalone:!1,features:[z],decls:23,vars:9,consts:[["soldDatePicker",""],["autocomplete",""],["cqDateMainPicker",""],["cqDateToPicker",""],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[20px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[5px]"],[1,"flex","items-center","gap-[5px]","text-h3/[normal]","text-transparency-100","font-semibold"],["tooltipPosition","top","tooltipStyleClass","!max-w-[360px] !whitespace-normal",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25","cursor-help",3,"pTooltip","escape"],[1,"text-label/[normal]","text-transparency-90","font-medium"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"w-full","mb-3"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
1px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","change","ngModel"],["value",""],[3,"value"],[1,"w-full"],[1,"w-full","flex","flex-col","gap-[15px]"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click"],[1,"flex","w-full","gap-[12px]"],[1,"w-full","mt-3"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"flex","gap-[20px]"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["type","number","value","1",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"flex-1"],[1,"min-w-0","flex-1"],["optionLabel","title","optionValue","_id","appendTo","body","placeholder","Select Status","scrollHeight","250px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","maxSelectedLabels","options","ngModel"],[1,"flex","flex-wrap","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["type","number",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","placeholder"],["value","MORE_THAN"],["value","LESS_THAN"],["value","IS"],["appearance","fill",1,"ngCalendarClass","w-[50%]","text-h4","text-transparency-100","font-semibold"],["matInput","","placeholder","Select date","autocomplete","off",3,"ngModelChange","matDatepicker","ngModel"],["matSuffix","",3,"for"],["optionLabel","title","optionValue","_id","appendTo","body","scrollHeight","250px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","maxSelectedLabels","options","ngModel","placeholder","readonly"],[1,"flex","items-center","gap-[12px]"],[1,"flex-1","min-w-0"],[1,"w-full","h-[42px]","box-border","text-h4","font-semibold","focus:outline-none","px-[10px]","py-0","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","disabled:opacity-50","disabled:cursor-not-allowed","select-none","bg-transparency-0","text-transparency-100",3,"ngModelChange","disabled","ngModel"],[1,"w-full","h-[42px]","box-border","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-0","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none","disabled:opacity-50","disabled:cursor-not-allowed",3,"ngModel","disabled"],[1,"min-h-[42px]","[&_.p-multiselect]:!flex","[&_.p-multiselect]:!h-[42px]","[&_.p-multiselect]:!max-w-full","[&_.p-multiselect]:items-center"],[1,"w-full","h-[42px]","box-border","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-0","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none","disabled:opacity-50","disabled:cursor-not-allowed",3,"ngModelChange","ngModel","disabled"],["optionLabel","title","optionValue","_id","appendTo","body","scrollHeight","250px","panelStyleClass","bg-transparency-0 text-transparency-100 border-transparency-25",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"maxSelectedLabels","options","ngModel","placeholder","readonly","display"],["optionLabel","title","name","tagsSelected","dataKey","_id","inputId","multiple-ac-1","multiple","","fluid","","appendTo","body","required","",1,"colored-tags","w-full","other-triggers-tags-ac",3,"ngModelOptions","placeholder","ngModel","suggestions","emptyMessage","panelStyleClass","dropdown","autoOptionFocus","forceSelection"],["optionLabel","title","optionValue","_id","appendTo","body","scrollHeight","250px","panelStyleClass","bg-transparency-0 text-transparency-100 border-transparency-25",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","maxSelectedLabels","options","ngModel","placeholder","readonly","display"],["optionLabel","title","name","tagsSelected","dataKey","_id","inputId","multiple-ac-1","multiple","","fluid","","appendTo","body","required","",1,"colored-tags","w-full","other-triggers-tags-ac",3,"onFocus","onSelect","onUnselect","onKeyUp","onClear","ngModelChange","completeMethod","ngModelOptions","placeholder","ngModel","suggestions","emptyMessage","panelStyleClass","dropdown","autoOptionFocus","forceSelection"],[1,"w-full","flex","flex-col","gap-[10px]"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
1px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","gap-[12px]","items-start","self-stretch"],[1,"flex-1","flex","flex-col","gap-[8px]","min-w-0"],[1,"text-h4","text-transparency-100","font-semibold"],["type","text","placeholder","Write a value...",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel"],[1,"text-label","text-transparency-70","py-[10px]","px-[10px]"],["type","text","placeholder","Write a value...",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel"],[1,"[&_.p-multiselect]:!flex","[&_.p-multiselect]:!min-h-[42px]","[&_.p-multiselect]:items-center"],["optionLabel","label","optionValue","_id","appendTo","body","placeholder","Select options","scrollHeight","220px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","options","ngModel","display"],[1,"flex","gap-[8px]","items-center"],["type","number","placeholder","Enter amount",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel"],["type","number","placeholder","From",1,"w-full","min-w-0","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["type","number","placeholder","To",1,"w-full","min-w-0","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["type","number","placeholder","Enter amount",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"flex","gap-[8px]","items-center","w-full"],["appearance","fill",1,"ngCalendarClass","w-full","text-h4","text-transparency-100","font-semibold"],["appearance","fill",1,"ngCalendarClass","flex-1","min-w-0","text-h4","text-transparency-100","font-semibold"],["matInput","","placeholder","Select date","autocomplete","off",3,"ngModelChange","focus","matDatepicker","ngModel"],["matInput","","placeholder","Select date","autocomplete","off",3,"ngModelChange","focus","matDatepicker","ngModel","min"]],template:function(e,i){e&1&&(r(0,"div",4)(1,"div",5)(2,"h3",6),p(3," Conditions "),x(4,ol,2,2,"div",7),a(),x(5,al,2,0,"p",8),a(),r(6,"div",9)(7,"div",10)(8,"div",11)(9,"label",12),p(10," Select Condition "),h(11,"img",13),a(),x(12,rl,2,0,"h3",14),a(),r(13,"select",15),A("ngModelChange",function(n){return I(i.conditionType,n)||(i.conditionType=n),n}),y("change",function(){return i.setConditions()}),r(14,"option",16),p(15,"--Select--"),a(),D(16,ll,2,2,"option",17,k),a()(),x(18,ul,14,4,"div",18),x(19,El,13,2,"div",18),x(20,wl,2,5,"div",18),x(21,Nl,9,4,"div",18),x(22,is,11,2,"div",19),a()()),e&2&&(s(4),g(i.otherTriggersTooltip?4:-1),s(),g(i.conditionType=="TIME_WITHOUT_SELLER_RESPONSE"?5:-1),s(7),g(i.conditionType=="DEAD_LEAD_REASON"?12:-1),s(),w("ngModel",i.conditionType),s(3),V(i.conditionTypes),s(2),g(i.conditionType=="LEAD_DURATION_IN_CURRENT_STATUS"||i.conditionType=="TRANSACTION_DURATION_IN_CURRENT_STATUS"||i.conditionType=="PROPERTY_DURATION_IN_CURRENT_STATUS"||i.conditionType=="RENTAL_DURATION_IN_CURRENT_STATUS"||i.conditionType=="BUYER_DURATION_IN_CURRENT_STATUS"||i.conditionType=="AGENT_DURATION_IN_CURRENT_STATUS"||i.conditionType=="VENDOR_DURATION_IN_CURRENT_STATUS"||i.conditionType=="TIME_TO_FIRST_NON_DRIP_SMS"||i.conditionType=="OPEN_LEAD_DURATION"||i.conditionType=="TIME_WITHOUT_SELLER_RESPONSE"||i.conditionType=="TRANSACTION_WITHOUT_LISTING_CREATED"||i.conditionType=="SCHEDULED_CLOSING_IN_NEXT_X_DAYS"||i.conditionType=="X_DAYS_WITHOUT_OFFER"||i.conditionType=="X_DAYS_WITHOUT_BUYER_OR_AGENT_ADDED"||i.conditionType=="PROPERTY_WITHOUT_SOW_CREATED"||i.conditionType=="PROPERTY_WITHOUT_LISTING_CREATED"||i.conditionType=="OPEN_CONTACT_DURATION"?18:-1),s(),g(i.conditionType=="EXPECTED_PROFIT"||i.conditionType=="SOW_DIFFERENCE"||i.conditionType=="ACTUAL_PROFIT"||i.conditionType=="SOLD_PRICE"||i.conditionType=="LAST_OFFER_AMOUNT"||i.conditionType=="BUYER_LAST_OFFER_AMOUNT"||i.conditionType=="AGENT_LAST_OFFER_AMOUNT"||i.conditionType=="SOLD_DATE"||i.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"?19:-1),s(),g(i.conditionType=="DEAD_LEAD_REASON"?20:-1),s(),g(i.conditionType=="LEADS_WITH_NEW_SELLER_APPT"||i.conditionType=="YEARS_OF_OWNERSHIP"||i.conditionType=="LAST_SALE_AMOUNT"||i.conditionType=="UNDER_CONTRACT_PRICE"||i.conditionType=="OPEN_LEADS_CLOSED_MANUALLY"||i.conditionType=="BUYER_ADDED"||i.conditionType=="AGENT_ADDED"||i.conditionType=="MULTIPLE_OF
1FERS_RECEIVED"||i.conditionType=="OFFER_ACCEPTED"||i.conditionType=="BUYER_OFFER_ACCEPTED"||i.conditionType=="EXPECTED_PROFIT_CHANGED"||i.conditionType=="SCHEDULED_CLOSING_DATE_CHANGED"||i.conditionType=="NEW_OFFER_RECEIVED"||i.conditionType=="SOW_ADDED"||i.conditionType=="NEW_LISTING_CREATED"||i.conditionType=="OFFER_SUBMITTED"||i.conditionType=="BUYER_WITH_NEW_APPT"||i.conditionType=="AGENT_WITH_NEW_APPT"||i.conditionType=="ESIGN"||i.conditionType=="TAGS"||i.conditionType=="TARGET_COUNTY"||i.conditionType=="TARGET_CITY"||i.conditionType=="TARGET_STATE"||i.conditionType=="TARGET_ZIP"||i.conditionType=="LEAD_QUALIFICATION_STATUS"||i.conditionType=="MEET_GRADE_AI_SCORE"||i.conditionType=="BUYER_AI_SCORE"||i.conditionType=="AGENT_AI_SCORE"||i.conditionType=="CONVERSATIONAL_AI"||i.conditionType=="CALL_GRADE_AI_SCORE"||i.conditionType=="LEAD_SCORE"||i.conditionType=="CONTRACT_SCORE_CHANGE"?21:-1),s(),g(i.conditionType==="CUSTOM_QUESTION"?22:-1))},dependencies:[K,X,G,oe,$,F,$o,U,ua,zt,ra,ca,pa,ma,L,tt,Ko,he,Yt],encapsulation:2})}}});var zi,Ji=ee(()=>{Re();W();si();Ce();Ee();oa();xe();se();Bt();zi=(()=>{class o{get moduleId(){return this.automationTypeToModuleId[this.data?.automationType]||""}get numberTypeId(){return this.automationTypeToNumberTypeId[this.data?.automationType]??O.NumberType.LEADS}get campaignLabel(){return this.data?.automationType==="NEW_AGENT_ADDED"?"Agent":this.data?.automationType==="NEW_VENDOR_ADDED"?"Vendor":this.data?.automationType==="NEW_BUYER_ADDED"?"Buyer":"Campaign"}constructor(e,i,t,n,c){this._marketingCampaignsService=e,this._loaderService=i,this._toastrService=t,this._sharedService=n,this._utilities=c,this.data={},this.primaryConditionKey="abvCondition",this.campaignList=[],this.selectedCampaignIds=[],this.fallbackCommunicationNumTypeIds=[1,2,4,5,6,7],this.defaultNumberList=[],this.defaultNumberId="",this.automationTypeToModuleId={NEW_AGENT_ADDED:O.ModuleStatusId.AGENT,NEW_VENDOR_ADDED:O.ModuleStatusId.VENDOR,NEW_BUYER_ADDED:O.ModuleStatusId.BUYER},this.automationTypeToNumberTypeId={NEW_AGENT_ADDED:O.NumberType.AGENT,NEW_VENDOR_ADDED:O.NumberType.VENDOR,NEW_BUYER_ADDED:O.NumberType.BUYER}}ngOnInit(){this.loadCampaigns(),this.restoreFromData(),this.loadDefaultCommunicationNumbersFromApi()}loadCampaigns(){if(!this.moduleId)return;let e={campaignType:1,moduleId:this.moduleId};this._loaderService.start(),this._marketingCampaignsService.getMarketingCampaignDropDownList(e).subscribe(i=>{if(this._loaderService.stop(),i?.statusCode===200){let t=i?.data?.items||[];this.campaignList=t.map(n=>({label:n?.name||n?.marketingTitle||n?._id,value:n?._id})),this.restoreFromData()}else this._toastrService.showError(i?.message||"Failed to load campaigns")},i=>{this._loaderService.stop(),this._toastrService.showError(i?.error?.message||"Failed to load campaigns")})}restoreFromData(){let e=this.data?.primaryConditions?.[this.primaryConditionKey]?.creationABVCondition,i=e?.marketingCampaignIds;if(i?.length&&Array.isArray(i)&&this.campaignList?.length){let t=i.map(n=>typeof n=="string"?n:n?.marketingCampaignId||n?.value);this.selectedCampaignIds=this.campaignList.filter(n=>t.includes(n?.value))}e?.defaultNumberId&&(this.defaultNumberId=e.defaultNumberId)}loadDefaultCommunicationNumbersFromApi(){this._sharedService?.dropDownNumberList({numTypeIdArray:[this.numberTypeId]})?.subscribe(e=>{if(e?.statusCode==200){let i=e?.data?.items||[];this.defaultNumberList=i.map(n=>({_id:n?._id,name:(n?.marketingTitle??"").toString().trim()||"Number",number:this._utilities.maskNumber(n?.number)}));let t=this.data?.primaryConditions?.[this.primaryConditionKey]?.creationABVCondition;t?.defaultNumberId&&(this.defaultNumberId=String(t.defaultNumberId??""))}},()=>{})}getSelectedCampaignIds(){return(this.selectedCampaignIds||[]).map(e=>e?.value).filter(Boolean)}getData(){return{campaignIds:this.getSelectedCampaignIds(),defaultNumberId:this.defaultNumberId||""}}static{this.\u0275fac=function(i){return new(i||o)(E(At),E(H),E(Y),E(Ti),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-new-abv-added"]],hostAttrs:[1,"block"],inputs:{data:"data",primaryConditionKey:"primaryConditionKey"},standalone:!1,decls:12,vars:7,consts:[[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[20px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[5px]"],[1,"text-h3/[normal]","text-transparency-100","font-semibold"],[1,"text-label/[normal]","text-transparency-90","font-medium"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["optionLabel","label","placeholder","Select campaigns","appendTo","body","scrollHeight","250px","filterBy","label",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","options","optionValue","maxSelectedLabels","filter"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h3",2),p(3," C
1onditions "),a(),r(4,"div",3),p(5),a()(),r(6,"div",4)(7,"div",5)(8,"label",6),p(9),h(10,"img",7),a(),r(11,"p-multiSelect",8),A("ngModelChange",function(c){return I(t.selectedCampaignIds,c)||(t.selectedCampaignIds=c),c}),a()()()()),i&2&&(s(5),T(" Select ",t.campaignLabel," campaign(s) for this automation. "),s(4),T(" Select ",t.campaignLabel," campaigns "),s(2),w("ngModel",t.selectedCampaignIds),m("options",t.campaignList)("optionValue",null)("maxSelectedLabels",1e3)("filter",!0))},dependencies:[F,U,tt],encapsulation:2})}}return o})()});function as(o,l){if(o&1&&(r(0,"div",13),h(1,"svg-icon",27),r(2,"div",28)(3,"h3",29),p(4),a(),r(5,"p",30),p(6),a()()()),o&2){let e=d();s(4),T(" ",e.duplicationMsg!=null&&e.duplicationMsg.includes("Adjust the conditions")?"Duplication Found":"Error"," "),s(2),T(" ",e.duplicationMsg," ")}}function rs(o,l){if(o&1&&h(0,"app-new-leads-created",20,0),o&2){let e=d();m("data",e.data)("primaryConditionKey",e.getPrimaryConditionKey())}}function ls(o,l){if(o&1&&h(0,"app-new-abv-added",20,1),o&2){let e=d();m("data",e.data)("primaryConditionKey",e.getPrimaryConditionKey())}}function ss(o,l){if(o&1&&h(0,"app-lead-status-change",21,2),o&2){let e=d();m("moduleId",e.moduleId)("data",e.data)("primaryConditionKey",e.getPrimaryConditionKey())}}function ds(o,l){if(o&1&&h(0,"app-activity-trigger",20,3),o&2){let e=d();m("data",e.data)("primaryConditionKey",e.getPrimaryConditionKey())}}function cs(o,l){if(o&1&&h(0,"app-other-triggers",21,4),o&2){let e=d();m("moduleId",e.moduleId)("data",e.data)("primaryConditionKey",e.getPrimaryConditionKey())}}var Qi,$i=ee(()=>{fe();Wi();qi();Hi();Yi();Ji();Mt();W();fe();Ft();Lt();Ce();Ee();xe();at();se();pe();kt();Wi();qi();Hi();Yi();Ji();Qi=(()=>{class o{get automationTypeIcon(){let e=this.data?.automationType,i=this.moduleId||this.data?.moduleId,t="assets/images/icons/selected-action.svg";if(!e)return t;for(let n of Q.AutomationType||[]){let c=(n?.children||[]).find(f=>f?.path===e&&(!i||f?.moduleId===i));if(c?.icon)return c.icon}for(let n of Q.AutomationType||[]){let c=(n?.children||[]).find(f=>f?.path===e);if(c?.icon)return c.icon}return t}constructor(e,i,t,n,c,f,S,v){this.data=e,this.dialog=i,this._router=t,this._leadsService=n,this._loaderService=c,this._toastrService=f,this._commonFunctions=S,this._automationService=v,this.automationName="",this.duplicationMsg="",this.automationConstant=Q,this.moduleId="",this.moduleName="",this.automationName=this.data?.name||"",this.moduleId=this.data?.moduleId||"",this.moduleName=this.data?.moduleName||""}ngOnInit(){}normalizeAutomationClosePayload(e){if(e==null||typeof e!="object")return e;let i;try{i=JSON.parse(JSON.stringify(e))}catch(n){i=M({},e)}let t=i.primaryConditions;if(t&&typeof t=="object")for(let n of Object.keys(t)){let c=t[n]?.otherCondition;c&&typeof c=="object"&&Array.isArray(c.conditionValue)&&c.conditionValue.length===0&&delete c.conditionValue}return i}onClose(){this.data?._id||this.navigateToAutomationListing(),this.dialog.close()}navigateToAutomationListing(){let e=this.data?.automationType,i=this.moduleId||this.data?.moduleId,t={};e&&(t.type=e),i&&(t.moduleId=i),this._router.navigate(["/automations"],{queryParams:t})}onSave(){if(!this.automationName)return this._toastrService.showError("Please fill automation name"),!1;let e={name:this.automationName,description:"Automated follow-up sequence for new leads",timezonename:this.data?.timezonename,moduleId:this.moduleId,automationType:this.data?.automationType,status:"active",primaryConditions:{},isCreateLog:!!this.data?.editMode,isConversationalAI:this.data?.isConversationalAI||!1,workflowSteps:[]};this.data?.delayPreference&&(e.delayPreference=this.data?.delayPreference);let i=this.getPrimaryConditionKey();if(this.data?.automationType=="LEAD_CREATED"||this.data?.automationType=="NEW_RENTAL_PROPERTY"||this.data?.automationType=="NEW_SOLD_PROPERTY"||this.data?.automationType=="NEW_INVENTORY_ADDED"){if(!this.newLeadCreated.numberId?.length)return this._toastrService.showError("Please select campaigns"),!1;let n={campaignIds:[]},c=-1;this.newLeadCreated?.defaultNumberId&&(n.defaultNumberId=this.newLeadCreated.defaultNumberId),this.newLeadCreated.campaignList?.forEach(f=>{f?.items?.forEach(S=>{if(c=this.newLeadCreated.numberId?.findIndex(v=>v?.value==S?.value),c>=0){let v={marketingCampaignId:S?.value};S?.numberList?.length&&(v.numberId=S?.numberList?.[0]?._id),n.campaignIds.push(v)}})}),e.primaryConditions={[`${i}`]:{leadCreatedCondtion:n}}}else if(this.data?.automationType=="NEW_AGENT_ADDED"||this.data?.automationType=="NEW_VENDOR_ADDED"||this.data?.automationType=="NEW_BUYER_ADDED"){if(!(this.newAbvAdded?.getSelectedCampaignIds()||[])?.length)return this._toastrService.showError("Please select at least one campaign"),!1;let c=this.newAbvAdded.getData(),f={marketingCampaignIds:c.campaignIds.map(S=>S)};c.defaultNumberId&&(f.defaultNumberId=c.defaultNumberId),e.primaryConditions={[`${i}`]:{creationABVCondition:f}}}else if(this.data?.automationType=="STATUS_CHANGE"){if(this.leadStatusChange.pipelineIds?.length){if(!this.leadStatusChange.statusIds?.length)return this._toastrService.showError("Please select status"),!1}else return this._toastrService.showError("Please select pipeline"),!1;let n=[];if(this.leadStatusChange.pipelineIds?.forEach(v=>{let b=this.leadStatusChange.statusData?.find(N=>N?.value===v);b&&(b.items?.some(j=>this.leadStatusChange.statusIds?.includes(j?._id))||n.push(b.label||v))}),n.length>0)return this._toastrService.showError(`Please select at least one status for each selected pipeline. Missing status for: ${n.join(", ")}`),!1;let c={pipelines:[]},f=-1,S={};this.leadStatusChange.statusData?.forEach(v=>{S={pipelineId:v?.value,mainStatusIds:[]},v?.items?.forEach(b=>{f=this.leadStatusChange.statusIds?.findIndex(N=>N==b?._id),f>=0&&S.mainStatusIds.push(b?._id)}),c.pipelines.push(S)}),e.primaryConditions={[`${i}`]:{pipelineStatusCondition:c}}}else if(this.data?.automationType=="ACTIVITY_TRIGGER"){let n=this.activityTrigger.getFinalBranches();if(!n?.length)return this._toastrService.showError("Please add at least one branch"),!1;for(let c of n){if(!c?.branchName||c?.branchName?.trim()==="")return this._toastrService.showError("Branch name is not allowed to be empty"),!1;if(!c?.isDefaultBranch&&!(Array.isArray(c?.outcome)&&c?.outcome?.length>0&&c?.outcome?.some(S=>S&&S?.toString()?.trim()!=="")))return this._toastrService.showError("Please select communication trigger"),!1}e.workflowSteps=[{stepType:"ACTIVITY_TRIGGER",stepOrder:1,isActive:!0,payload:{triggerType:this.activityTrigger.triggerType,automationName:this.automationName,branches:n},isExecuted:!1}],e.primaryConditions={[`${i}`]:{activityTriggerCondition:{triggerType:this.activityTrigger.triggerType}}}}else if(this.data?.automationType=="OTHER_CONDITION"){let n=this.otherTriggers.getFinalData();if(!n?.otherCondition?.conditionType)return this._toastrService.showError("Selecting a condition is required"),!1;if(n?.otherCondition?.conditionType=="LEAD_DURATION_IN_CURRENT_STATUS"||n?.otherCondition?.conditionType=="TRANSACTION_DURATION_IN_CURRENT_STATUS"||n?.otherCondition?.conditionType=="TIME_WITHOUT_SELLER_RESPONSE"||n?.otherCondition?.conditionType=="PROPERTY_DURATION_IN_CURRENT_STATUS"||n?.otherCondition?.conditionType=="RENTAL_DURATION_IN_CURRENT_STATUS"||n?.otherCondition?.conditionType=="BUYER_DURATION_IN_CURRENT_STATUS"||n?.otherCondition?.conditionType=="AGENT_DURATION_IN_CURRENT_STATUS"){if(!n?.otherCondition?.pipelineId)return this._toastrService.showError("Please select pipeline"),!1;if(!n?.otherCondition?.mainStatusId?.length)return this._toastrService.showError("Please select status"),!1}if(n?.otherCondition?.conditionType==="CUSTOM_QUESTION"){let c=this.otherTriggers.getCustomQuestionSaveValidationError();if(c)return this._toastrService.showError(c),!1}if(n?.otherCondition?.conditionType=="EXPECTED_PROFIT"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter expected profit amount"),!1}if(n?.otherCondition?.conditionType=="SOW_DIFFERENCE"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter SOW difference"),!1}if(n?.otherCondition?.conditionType=="ACTUAL_PROFIT"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter actual profit"),!1}if(n?.otherCondition?.conditionType=="SOLD_PRICE"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter sold price"),!1}if(n?.otherCondition?.conditionType=="LAST_OFFER_AMOUNT"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter last offer amount"),!1}if(n?.otherCondition?.conditionType=="EXPECTED_PROFIT_VS_ACTUAL_PROFIT"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter amount for expected vs actual profit"),!1}if(n?.otherCondition?.conditionType=="BUYER_LAST_OFFER_AMOUNT"||n?.otherCondition?.conditionType=="AGENT_LAST_OFFER_AMOUNT"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||Number.isNaN(Number(f)))return this._toastrService.showError("Please enter last offer amount"),!1}if(n?.otherCondition?.conditionType=="SOLD_DATE"){let c=n?.otherCondition?.conditionValue,f=Array.isArray(c)?c[0]:c;if(f===""||f===null||f===void 0||String(f).trim()==="")return this._toastrService.showError("Please select sold date"),!1}if(n?.otherCondition?.conditionType=="PROPERTY_WITHOUT_SOW_CREATED"||n?.otherCondition?.conditionType=="PROPERTY_WITHOUT_LISTING_CREATED"||n?.otherCondition?.conditionType=="OPEN_CONTACT_DURATION"){let c=n?.otherCondition?.durationCondition?.durationValue;if(c===""||c===null||c===void 0||Number.isNaN(Number(c))||Number(c)<1)return this._toastrService.showError("Please enter number of days (minimum 1)"),!1}e.primaryConditions={[`${i}`]:n}}let t=this._automationService.createAutomation;
1if(this.data?._id){let n=JSON.parse(JSON.stringify(this.data?.workflowSteps));n?.map(c=>{delete c._id}),e.automationId=this.data?._id,this.data?.automationType!="ACTIVITY_TRIGGER"&&(e.workflowSteps=n),t=this._automationService.updateAutomation}else if(this.data?.isCopy&&this.data?.workflowSteps?.length&&this.data?.automationType!=="ACTIVITY_TRIGGER"){let n=JSON.parse(JSON.stringify(this.data.workflowSteps));n?.forEach(c=>delete c._id),e.workflowSteps=n}this._loaderService.start(),t(e).subscribe(n=>{this._loaderService.stop(),n?.statusCode==200&&(this.data?._id&&this._toastrService.showSuccess("Changes saved successfully."),this.dialog.close(this.normalizeAutomationClosePayload(n?.data)))},n=>{this._loaderService.stop(),this.duplicationMsg=n?.error?.message||""})}getPrimaryConditionKey(){let e=Q.AutomationType?.findIndex(c=>c?.key=="buyers-automation"),i=Q.AutomationType?.findIndex(c=>c?.key=="agents-automation"),t=Q.AutomationType?.findIndex(c=>c?.key=="vendors-automation"),n=Q.AutomationType?.findIndex(c=>c?.key=="list-stacking-automation");return this.moduleId==Q.AutomationType?.[e]?.children[0]?.moduleId||this.moduleId==Q.AutomationType?.[i]?.children[0]?.moduleId||this.moduleId==Q.AutomationType?.[t]?.children[0]?.moduleId?"abvCondition":this.moduleId==Q.AutomationType?.[n]?.children[0]?.moduleId?"marketingCondition":"lead"}formatPhoneNumber(e){return e?this._commonFunctions.maskNumber(e):""}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(ut),E(it),E(H),E(Y),E(q),E(Me))}}static{this.\u0275cmp=B({type:o,selectors:[["app-new-lead"]],viewQuery:function(i,t){if(i&1&&We(Ui,5)(ji,5)(Gi,5)(Zt,5)(zi,5),i&2){let n;ie(n=ne())&&(t.newLeadCreated=n.first),ie(n=ne())&&(t.leadStatusChange=n.first),ie(n=ne())&&(t.activityTrigger=n.first),ie(n=ne())&&(t.otherTriggers=n.first),ie(n=ne())&&(t.newAbvAdded=n.first)}},standalone:!1,decls:27,vars:11,consts:[["newLeadCreated",""],["newAbvAdded",""],["leadStatusChange",""],["activityTrigger",""],["otherTriggers",""],[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15","h-full","overflow-hidden"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px] block",1,"text-transparency-100",3,"src"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],[1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer",3,"click"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","flex-1","overflow-auto"],[1,"flex","flex-col","items-start","self-stretch","bg-secondary-red-5","gap-[20px]","p-[20px]","border-[1px]","border-solid","border-secondary-red-5","rounded-[20px]"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[10px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]"],[1,"text-h2","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["type","text","placeholder","Type name",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"w-full"],[3,"data","primaryConditionKey"],[3,"moduleId","data","primaryConditionKey"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44",3,"click","leftIcon"],["customClass","min-w-[120px] justify-center","label","Save","variant","filled","type","default","size","44",3,"click","leftIcon"],["svgClass","w-[60px] h-[60px] block","src","assets/images/icons/warning.svg",1,"text-secondary-red"],[1,"flex","flex-col","items-start","self-stretch","gap-[5px]"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"text-p","text-transparency-100","font-medium"]],template:function(i,t){i&1&&(r(0,"div",5)(1,"div",6)(2,"div",7),h(3,"svg-icon",8),r(4,"div",9),p(5),a()(),r(6,"button",10),y("click",function(){return t.onClose()}),h(7,"svg-icon",11),a()(),r(8,"div",12),x(9,as,7,2,"div",13),r(10,"div",14)(11,"div",15)(12,"h2",16),p(13," Automation name "),h(14,"img",17),a(),r(15,"input",18),A("ngModelChange",function(c){return I(t.automationName,c)||(t.automationName=c),c}),a()()(),r(16,"div",19),x(17,rs,2,2,"app-new-leads-created",20),x(18,ls,2,2,"app-new-abv-ad
1ded",20),x(19,ss,2,3,"app-lead-status-change",21),x(20,ds,2,2,"app-activity-trigger",20),x(21,cs,2,3,"app-other-triggers",21),a()(),r(22,"div",22),h(23,"svg-icon",23),a(),r(24,"div",24)(25,"app-button",25),y("click",function(){return t.onClose()}),a(),r(26,"app-button",26),y("click",function(){return t.onSave()}),a()()()),i&2&&(s(3),m("src",t.automationTypeIcon),s(2),T(" ",t.moduleName," "),s(4),g(t.duplicationMsg?9:-1),s(6),w("ngModel",t.automationName),s(2),g((t.data==null?null:t.data.automationType)=="LEAD_CREATED"||(t.data==null?null:t.data.automationType)=="NEW_SOLD_PROPERTY"||(t.data==null?null:t.data.automationType)=="NEW_RENTAL_PROPERTY"||(t.data==null?null:t.data.automationType)=="NEW_INVENTORY_ADDED"?17:-1),s(),g((t.data==null?null:t.data.automationType)=="NEW_AGENT_ADDED"||(t.data==null?null:t.data.automationType)=="NEW_VENDOR_ADDED"||(t.data==null?null:t.data.automationType)=="NEW_BUYER_ADDED"?18:-1),s(),g((t.data==null?null:t.data.automationType)=="STATUS_CHANGE"?19:-1),s(),g((t.data==null?null:t.data.automationType)=="ACTIVITY_TRIGGER"?20:-1),s(),g((t.data==null?null:t.data.automationType)=="OTHER_CONDITION"?21:-1),s(4),m("leftIcon",!1),s(),m("leftIcon",!1))},dependencies:[G,F,U,L,et,Ui,ji,Gi,Zt,zi],encapsulation:2})}}return o})()});function us(o,l){if(o&1){let e=C();r(0,"button",16),y("click",function(){u(e);let t=d();return _(t.addAutomation())}),h(1,"img",17),r(2,"span",18),p(3,"Add Automation"),a()()}}function _s(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-ascending.svg")}function hs(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-descending.svg")}function xs(o,l){o&1&&(r(0,"th",13)(1,"div",9)(2,"span"),p(3,"Type "),a()()())}function gs(o,l){o&1&&(r(0,"th",13)(1,"div",9)(2,"span"),p(3,"Status Change to "),a()()())}function fs(o,l){o&1&&(r(0,"th",13)(1,"div",9)(2,"span"),p(3,"Campaign "),a()()())}function ys(o,l){o&1&&(r(0,"th",13)(1,"div",9)(2,"span"),p(3,"Type "),a()()())}function Cs(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-ascending.svg")}function bs(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-descending.svg")}function Ss(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-ascending.svg")}function Ts(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-descending.svg")}function vs(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-ascending.svg")}function Es(o,l){o&1&&h(0,"svg-icon",12),o&2&&m("src","assets/images/icons/sort-descending.svg")}function ws(o,l){if(o&1&&(r(0,"td",21)(1,"div",29),p(2),a()()),o&2){let e=d().$implicit,i=d();s(),m("pTooltip",i.getStatusChangeTo(e)),s(),T(" ",i.getStatusChangeTo(e)," ")}}function Is(o,l){if(o&1&&(r(0,"td",21),p(1),a()),o&2){let e=d().$implicit,i=d();s(),T(" ",i.getActivityTriggerType(e)," ")}}function As(o,l){if(o&1&&(r(0,"td",21)(1,"div",29),p(2),a()()),o&2){let e=d().$implicit;s(),m("pTooltip",e==null?null:e.campaigns),s(),T(" ",(e==null?null:e.campaigns)||"N/A"," ")}}function Ms(o,l){if(o&1&&(r(0,"td",21),p(1),a()),o&2){let e=d().$implicit,i=d();s(),T(" ",i.getOtherTriggerConditionType(e)," ")}}function Os(o,l){if(o&1&&p(0),o&2){let e=d().$implicit;T(" ",(e==null?null:e.subModuleCount)>1?"Agents":"Agent"," ")}}function Ds(o,l){if(o&1&&p(0),o&2){let e=d().$implicit;T(" ",(e==null?null:e.subModuleCount)>1?"Buyers":"Buyer"," ")}}function Vs(o,l){if(o&1&&p(0),o&2){let e=d().$implicit;T(" ",(e==null?null:e.subModuleCount)>1?"Vendors":"Vendor"," ")}}function Ns(o,l){if(o&1&&p(0),o&2){let e=d().$implicit;T(" ",(e==null?null:e.subModuleCount)>1?"Records":"Record"," ")}}function ks(o,l){if(o&1&&p(0),o&2){let e=d().$implicit;T(" ",(e==null?null:e.subModuleCount)>1?"Leads":"Lead"," ")}}function Bs(o,l){if(o&1){let e=C();r(0,"img",30),y("click",function(t){u(e);let n=d().$implicit,c=d();return t.stopPropagation(),_(c.stopAutomation(n))}),a()}}function Ps(o,l){if(o&1){let e=C();r(0,"tr",19),y("click",function(){let t=u(e).$implicit,n=d();return _(n.getDetail(t))}),r(1,"td",20),p(2),a(),x(3,ws,3,2,"td",21),x(4,Is,2,1,"td",21),x(5,As,3,2,"td",21),x(6,Ms,2,1,"td",21),r(7,"td",21),p(8),x(9,Os,1,1)(10,Ds,1,1)(11,Vs,1,1)(12,Ns,1,1)(13,ks,1,1),a(),r(14,"td",21),p(15),ot(16,"myTimezone"),a(),r(17,"td",21)(18,"div",22)(19,"span",23),p(20),ot(21,"myTimezone"),a(),r(22,"div",24)(23,"img",25),y("click",function(t){let n=u(e).$implicit,c=d();return t.stopPropagation(),_(c.getDetail(n))}),a(),r(24,"img",26),y("click",function(t){let n=u(e).$implicit,c=d();return t.stopPropagation(),_(c.deleteConfirmation(n))}),a(),r(25,"img",27),y("click",function(t){let n=u(e).$implicit,c=d();return t.stopPropagation(),_(c.copyAutomation(n))}),a(),x(26,Bs,1,0,"img",28),a()()()()}if(o&2){let e=l.$implicit,i=d();s(2),T(" ",e==null?null:e.name," "),s(),g((i.automationType==null?null:i.automationType.path)=="STATUS_CHANGE"?3:-1),s(),g((i.automationType==null?null:i.automationType.path)=="ACTIVITY_TRIGGER"?4:-1),s(),g((i.automationType==null?null:i.automationType.path)=="LEAD_CREATED"?5:-1),s(),g((i.automationType==null?null:i.automationType.path)=="OTHER_CONDITION"?6:-1),s(2),T(" ",e==null?null:e.subModuleCount," "),s(),g((i.automationType==null?null:i.automationType.moduleId)==i.StatusConstant.ModuleStatusId.AGENT?9:(i.automationType==null?null:i.automationType.moduleId)==i.StatusConstant.ModuleStatusId.BUYER?10:(i.automationType==null?null:i.automationType.moduleId)==i.StatusConstant.ModuleStatusId.VENDOR?11:(i.automationType==null?null:i.automationType.moduleId)==i.StatusConstant.ModuleStatusId.LISTSTACKING?12:13),s(6),T(" ",so(16,10,e==null?null:e.createdAt,"MMM DD, YYYY")," "),s(5),ce(so(21,13,e==null?null:e.updatedAt,"MMM DD, YYYY")),s(6),g((e==null?null:e.status)=="active"&&(e==null?null:e.subModuleCount)>0?26:-1)}}function Ls(o,l){o&1&&(r(0,"tr",7)(1,"td",31),p(2," No data found "),a()()),o&2&&m("hoverable",!1)}var ps,ms,Fa,yo=ee(()=>{se();$e();fr();wa();$i();Mt();Re();W();Ce();Ee();xe();
1at();fe();Ft();Lt();si();xo();be();pe();ri();li();He();gr();ps=()=>[10,25,50,100],ms=(o,l,e,i,t)=>({currentPage:o,totalPages:l,totalCount:e,pageSize:i,pageSizeOptions:t});Fa=(()=>{class o{constructor(e,i,t,n,c,f,S,v,b){this._loaderService=e,this._toasterService=i,this._commonFunctions=t,this._automationService=n,this._dialog=c,this.router=f,this._leadsService=S,this._marketingCampaignsService=v,this._permissionsHelper=b,this.automationType={},this.automationList=[],this.currentPage=1,this.totalAutomation=0,this.itemsPerPage=10,this.isLoading=!1,this.moduleId="",this.moduleName="",this.automationGroupLabel="",this.automationConstant=Q,this.StatusConstant=O,this.sortDirections={name:1,subModuleCount:1,updatedAt:1,createdAt:1},this.activeSortColumn="name",this.searchText="",this.searchControl=new Xe(""),this.campaignList=[],this.promises=[],this.canEditAutomation=!1,this.mainStatusId=O.MainStatusId,this.pipelineData=[]}ngOnInit(){this.refreshAutomationEditPermission(),this.searchControl.valueChanges.pipe(yt(500),Ct()).subscribe(e=>{this.searchText=e,this.currentPage=1,this.getAutomationList()})}ngOnChanges(e){e.automationType&&(this.refreshAutomationEditPermission(),this.searchText="",this.searchControl.setValue("",{emitEvent:!1}),this.currentPage=1,setTimeout(()=>{this._loaderService.start(),this.automationType?.path=="LEAD_CREATED"?(this.promises.push(this.getCampaignList()),this.promises.length>0&&Promise.all(this.promises).then(i=>{this.getAutomationList()}).catch(i=>{this._loaderService.stop()})):this.automationType?.path=="STATUS_CHANGE"?(this.promises.push(this.getPipelineList()),this.promises.length>0&&Promise.all(this.promises).then(i=>{this.getAutomationList()}).catch(i=>{this._loaderService.stop()})):this.getAutomationList()},300))}refreshAutomationEditPermission(){this.canEditAutomation=this._permissionsHelper.hasAutomationModuleEditAccess(this.automationType?.moduleId)}isLeadCampaignAutomation(){let e=this.automationType?.path;return e==="NEW_SOLD_PROPERTY"||e==="NEW_RENTAL_PROPERTY"||e==="NEW_INVENTORY_ADDED"}getCampaignList(){return new Promise((e,i)=>lo(this,null,function*(){let t={campaignType:1,moduleId:this.isLeadCampaignAutomation()?O.ModuleStatusId.LEAD:this.automationType?.moduleId};this._marketingCampaignsService.getCampaignList(t).subscribe(n=>(n?.statusCode==200&&(this.campaignList=n?.data?.items||[]),e(1)),n=>e(1))}))}getPipelineList(){return new Promise((e,i)=>lo(this,null,function*(){let t={page:1,limit:100,moduleId:this.automationType?.moduleId};this._leadsService.getPipelines(t).subscribe(n=>(n?.statusCode==200&&(this.pipelineData=n?.data?.items||[]),e(1)),n=>e(1))}))}get listTitle(){return this.moduleName?this.moduleName:""}getAutomationList(){let e=this.automationConstant?.AutomationType??[],i,t="";for(let f of e){let S=f?.children?.find(v=>v?.path===this.automationType?.path&&v?.moduleId===this.automationType?.moduleId);if(S){i=S,t=f?.label??"";break}}if(!i)return this.automationGroupLabel="",null;let n=JSON.parse(JSON.stringify(i));this.moduleId=n?.moduleId,this.moduleName=n?.label,this.automationGroupLabel=t;let c={page:this.currentPage,limit:this.itemsPerPage,moduleId:this.moduleId,automationType:this.automationType?.path};this.searchText&&(c.searchString=this.searchText),this.activeSortColumn&&(c.sort=this.activeSortColumn,c.holdingSort=this.sortDirections?.[this.activeSortColumn]==1),this._automationService.listAutomation(c).subscribe(f=>{f?.statusCode==200&&(this.automationList=f?.data?.items||[],this.automationType?.path=="LEAD_CREATED"&&this.automationList?.map(S=>{S.campaigns=this.getCampaigns(S?.primaryConditions?.lead?.leadCreatedCondtion?.campaignIds||[])}),this.totalAutomation=f?.data?.count||0,this._loaderService.stop())},f=>{this._loaderService.stop()})}getCampaigns(e){let i="",t;return this.campaignList?.forEach(n=>{t=e?.findIndex(c=>c?.marketingCampaignId==n?._id),t>=0&&(i+=(n?.name||"")+", ")}),i=i.trimEnd().replace(/,$/,""),i}getDetail(e){this.router.navigate(["/automations/edit-automation"],{queryParams:{id:e?._id,automationType:e?.automationType,moduleId:e?.moduleId}})}getDeleteAutomationEntityLabel(){let e=this.resolveAutomationModuleId();return e===this.mainStatusId.BUYER||e===this.mainStatusId.AGENT||e===this.mainStatusId.VENDOR?"contacts":e===this.mainStatusId.INVENTORY||e===this.mainStatusId.SOLD||e===this.mainStatusId.RENTAL||e===this.mainStatusId.LISTSTACKING?"properties":"leads"}buildDeleteAutomationMessage(e){return["Are you sure you want to delete this automation?",`Deleting this automation will remove it from all existing ${e}.`,"This action cannot be undone."].join(`
2`)}resolveAutomationModuleId(){let e=this.moduleId||this.automationType?.moduleId;return e&&typeof e=="object"&&e._id?String(e._id):e?String(e):""}deleteConfirmation(e){if(!this.canEditAutomation)return;let i=e?._id;i&&(this.dialogRef=this._dialog.open(ya,{width:"600px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{header:"Delete Automation",subHeader:e?.name||"Automation",message:this.buildDeleteAutomationMessage(this.getDeleteAutomationEntityLabel()),icon:"assets/images/icons/automation.svg",buttonLabel:"Delete Automation"}}),this.dialogRef.afterClosed().subscribe(t=>{t&&this.deleteAutomation(i)}))}deleteAutomation(e){let i={id:e};this._loaderService.start(),this._automationService.deleteAutomation(i).subscribe(t=>{t?.statusCode==200?this.getAutomationList():this._loaderService.stop()},t=>{this._loaderService.stop()})}goToPage(e){let i=Number(e);Number.isFinite(i)&&i>=1&&i<=this.totalPages&&i!==this.currentPage&&(this.currentPage=i,this._loaderService.start(),this.getAutomationList())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this._loaderService.start(),this.getAutomationList()}onSort(e){this.activeSortColumn===e?this.sortDirections[e]=this.sortDirections?.[e]===1?-1:1:(this.activeSortColumn&&this.sortDirections?.[this.activeSortColumn]!==void 0&&(this.sortDirections[this.activeSortColumn]=1),this.sortDirections[e]=this.sortDirections?.[e]===1?-1:1,this.activeSortColumn=e),this.currentPage=1,this._loaderService.start(),this.getAutomationList()}addAutomation(){this.canEditAutomation&&this.router.navigate(["/automations/add-automation"],{queryParams:{automationType:this.automationType?.path,moduleId:this.moduleId}})}copyAutomation(e){this.canEditAutomation&&(this._loaderService.start(),this._automationService.getAutomationDetail({id:e?._id}).subscribe({next:i=>{if(this._loaderService.stop(),i?.statusCode!==200)return;let t=i?.data||{},n=P(M({},t),{name:t?.name?`${t.name} Copy`:"Copy",automationType:t?.automationType||e?.automationType,moduleId:t?.moduleId?._id||t?.moduleId||this.moduleId,moduleName:this.moduleName,timezonename:t?.timezonename,delayPreference:t?.delayPreference,isConversationalAI:t?.isConversationalAI,editMode:!1,isCopy:!0});delete n._id,this.dialogRef=this._dialog.open(Qi,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",maxHeight:"92vh",data:n}),this.dialogRef.afterClosed().subscribe(c=>{c?._id&&this.router.navigate(["/automations/edit-automation"],{queryParams:{id:c._id,automationType:c?.automationType||e?.automationType,moduleId:c?.moduleId?._id||c?.moduleId||this.moduleId}})})},error:()=>{this._loaderService.stop()}}))}stopAutomation(e){this.canEditAutomation&&(this.dialogRef=this._dialog.open(Pi,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{moduleId:e?.moduleId?._id||e?.moduleId||this.moduleId,fromList:!0}}),this.dialogRef.afterClosed().subscribe(i=>{i&&this.callStopAutomation(e)}))}callStopAutomation(e){let i={automationId:e?._id};this._loaderService.start(),this._automationService.stopAutomation(i,!0).subscribe(t=>{this.getAutomationList(),this._loaderService.stop()},t=>{this._loaderService.stop()})}getActivityTriggerType(e){let i=e?.primaryConditions?.lead?.activityTriggerCondition||e?.primaryConditions?.marketingCondition?.activityTriggerCondition||e?.primaryConditions?.abvCondition?.activityTriggerCondition,t=this.automationConstant?.TriggerType?.findIndex(n=>n?.type==i?.triggerType);return t==-1?"N.A":this.automationConstant?.TriggerType?.[t]?.name}getOtherTriggerConditionType(e){let t=(e?.primaryConditions?.lead?.otherCondition??e?.primaryConditions?.abvCondition?.otherCondition)?.conditionType,n=this.getOtherTriggerConditionTypeListForModule(e?.moduleId),c=n?.findIndex(f=>f?.type==t);return c==-1?"N.A":n[c]?.title}getOtherTriggerConditionTypeListForModule(e){let i=O.ModuleStatusId;return e===i.WHOLESALEPIPELINE?Q.wholesaleOtherTriggerConditionType||[]:e===i.INVENTORY?Q.inventoryOtherTriggerConditionType||[]:e===i.SOLD?Q.soldOtherTriggerConditionType||[]:e===i.RENTAL?Q.rentalOtherTriggerConditionType||[]:e===i.BUYER?Q.buyerOtherTriggerConditionType||[]:e===i.AGENT?Q.agentOtherTriggerConditionType||[]:e===i.VENDOR?Q.vendorOtherTriggerConditionType||[]:Q.otherTriggerConditionType||[]}getStatusChangeTo(e){let i="";return(e?.primaryConditions?.abvCondition?.pipelineStatusCondition||e?.primaryConditions?.lead?.pipelineStatusCondition||e?.primaryConditions?.marketingCondition?.pipelineStatusCondition)?.pipelines?.forEach(n=>{this.pipelineData?.forEach(c=>{c?._id==n?.pipelineId&&c?.mainStatusList?.forEach(f=>{n?.mainStatusIds?.includes(f?._id)&&(i+=f?.title+", ")})})}),i=i.trimEnd().replace(/,$/,""),i}get totalPages(){return Math.ceil(this.totalAutomation/this.itemsPerPage)}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Y),E(q),E(Me),E(ve),E(ut),E(it),E(At),E(Kt))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation-list"]],inputs:{automationType:"automationType"},standalone:!1,features:[z],decls:46,vars:33,consts:[[1,"inline-flex","items-center","gap-[20px]","mb-[20px]"],[1,"text-h2","text-transparency-100","font-semibold"],["type","button","class","flex items-center text-h4 text-primary-90 font-semibold bg-transparency-0 rounded-[25px] pr-[10px] pl-[5px] py-[5px]",3,"click",4,"ngIf"],[1,"w-full","flex","flex-col","items-start","overflow-hidden","mb
2-[20px]"],[1,"w-full","overflow-auto"],[3,"searchChange","pageChange","pageSizeChange","showSearch","searchPlaceholder","searchTerm","showViewType","showPagination","pagination","loading"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","'180px'",3,"click"],[1,"flex","items-center","gap-[8px]"],[1,"cursor-pointer"],[1,"opacity-70"],[1,"w-[12px]","h-[12px]","inline-block",3,"src"],["appTh",""],["appTh","",3,"click"],["appTr","",1,"group/item","cursor-pointer"],["type","button",1,"flex","items-center","text-h4","text-primary-90","font-semibold","bg-transparency-0","rounded-[25px]","pr-[10px]","pl-[5px]","py-[5px]",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","24",1,"img-fluid"],[1,"px-[5px]"],["appTr","",1,"group/item","cursor-pointer",3,"click"],["appTd","",1,"text-p","cursor-pointer"],["appTd","",1,"text-p"],[1,"text-transparency-100"],[1,"group-hover/item:hidden"],[1,"hidden","items-center","gap-[10px]","group-hover/item:flex"],["src","assets/images/icons/edit-action-1.svg","alt","edit-action","width","28",1,"img-fluid","cursor-pointer",3,"click"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action","width","28",1,"img-fluid","cursor-pointer",3,"click"],["src","assets/images/icons/copy-action.svg","alt","copy-action","width","28",1,"img-fluid","cursor-pointer",3,"click"],["src","assets/images/icons/share-action.svg","alt","share-action","width","28",1,"img-fluid","cursor-pointer"],["tooltipPosition","top",1,"max-w-[150px]","truncate","cursor-pointer",3,"pTooltip"],["src","assets/images/icons/share-action.svg","alt","share-action","width","28",1,"img-fluid","cursor-pointer",3,"click"],["appTd","","colspan","4",1,"py-6","text-center","text-gray-500"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"h2",1),p(2),a(),Ne(3,us,4,0,"button",2),a(),r(4,"div",3)(5,"div",4)(6,"app-table-container",5),y("searchChange",function(c){return t.searchControl.setValue(c)})("pageChange",function(c){return t.goToPage(+c)})("pageSizeChange",function(c){return t.onItemsPerPageChange(+c)}),r(7,"table",6)(8,"thead")(9,"tr",7)(10,"th",8),y("click",function(){return t.onSort("name")}),r(11,"div",9)(12,"span",10),p(13," Automation Name "),r(14,"span",11),x(15,_s,1,1,"svg-icon",12),x(16,hs,1,1,"svg-icon",12),a()()()(),x(17,xs,4,0,"th",13),x(18,gs,4,0,"th",13),x(19,fs,4,0,"th",13),x(20,ys,4,0,"th",13),r(21,"th",14),y("click",function(){return t.onSort("subModuleCount")}),r(22,"div",9)(23,"span",10),p(24),r(25,"span",11),x(26,Cs,1,1,"svg-icon",12),x(27,bs,1,1,"svg-icon",12),a()()()(),r(28,"th",14),y("click",function(){return t.onSort("createdAt")}),r(29,"div",9)(30,"span",10),p(31,"Date Created "),r(32,"span",11),x(33,Ss,1,1,"svg-icon",12),x(34,Ts,1,1,"svg-icon",12),a()()()(),r(35,"th",14),y("click",function(){return t.onSort("updatedAt")}),r(36,"div",9)(37,"span",10),p(38,"Date Updated "),r(39,"span",11),x(40,vs,1,1,"svg-icon",12),x(41,Es,1,1,"svg-icon",12),a()()()()()(),r(42,"tbody"),D(43,Ps,27,16,"tr",15,k),x(45,Ls,3,1,"tr",7),a()()()()()),i&2&&(s(2),je(" ",t.listTitle," (",t.totalAutomation,") "),s(),m("ngIf",t.canEditAutomation),s(3),m("showSearch",!0)("searchPlaceholder","Search data")("searchTerm",t.searchText)("showViewType",!1)("showPagination",!0)("pagination",bt(27,ms,t.currentPage,t.totalPages,t.totalAutomation,t.itemsPerPage,pt(26,ps)))("loading",t.isLoading),s(),m("bordered",!0),s(2),m("hoverable",!1),s(6),g((t.sortDirections==null?null:t.sortDirections.name)===1?15:-1),s(),g((t.sortDirections==null?null:t.sortDirections.name)===-1?16:-1),s(),g((t.automationType==null?null:t.automationType.path)=="ACTIVITY_TRIGGER"?17:-1),s(),g((t.automationType==null?null:t.automationType.path)=="STATUS_CHANGE"?18:-1),s(),g((t.automationType==null?null:t.automationType.path)=="LEAD_CREATED"?19:-1),s(),g((t.automationType==null?null:t.automationType.path)=="OTHER_CONDITION"?20:-1),s(4),T("",(t.automationType==null?null:t.automationType.moduleId)==t.StatusConstant.ModuleStatusId.LISTSTACKING?"#Records":(t.automationType==null?null:t.automationType.moduleId)==t.StatusConstant.ModuleStatusId.AGENT?"#Agents":(t.automationType==null?null:t.automationType.moduleId)==t.StatusConstant.ModuleStatusId.BUYER?"#Buyers":(t.automationType==null?null:t.automationType.moduleId)==t.StatusConstant.ModuleStatusId.VENDOR?"#Vendors":"#Leads"," "),s(2),g((t.sortDirections==null?null:t.sortDirections.subModuleCount)===1?26:-1),s(),g((t.sortDirections==null?null:t.sortDirections.subModuleCount)===-1?27:-1),s(6),g((t.sortDirections==null?null:t.sortDirections.createdAt)===1?33:-1),s(),g((t.sortDirections==null?null:t.sortDirections.createdAt)===-1?34:-1),s(6),g((t.sortDirections==null?null:t.sortDirections.updatedAt)===1?40:-1),s(),g((t.sortDirections==null?null:t.sortDirections.updatedAt)===-1?41:-1),s(2),V(t.automationList),s(2),g(t.automationList!=null&&t.automationList.length?-1:45))},dependencies:[Go,L,Tt,vt,Et,wt,It,he,xa],encapsulation:2})}}return o}
2)()});function Fs(o,l){if(o&1){let e=C();r(0,"div",23),y("click",function(){let t=u(e).$implicit,n=d(3);return _(n.selectChild(t))}),h(1,"svg-icon",24),r(2,"span",25),p(3),a()()}if(o&2){let e=l.$implicit,i=d(3);m("ngClass",(i.selectedComponent==null?null:i.selectedComponent.path)===(e==null?null:e.path)&&(i.selectedComponent==null?null:i.selectedComponent.moduleId)===(e==null?null:e.moduleId)?"text-primary-90 bg-activity-outbound-hover-bg border-activity-outbound-hover-border":""),s(),m("src",e==null?null:e.icon),s(2),T(" ",e.label)}}function Us(o,l){if(o&1&&(r(0,"div",21),D(1,Fs,4,3,"div",22,Ht().trackByChildKey,!0),a()),o&2){let e=d().$implicit;s(),V(e.children)}}function Ws(o,l){if(o&1){let e=C();r(0,"div",10)(1,"div",11),y("click",function(){let t=u(e).$implicit,n=d();return _(n.toggleParent(t.key))}),r(2,"div",12),h(3,"svg-icon",13),r(4,"span",14),p(5),a()(),r(6,"div",15),Fo(),r(7,"svg",16)(8,"g",17),h(9,"path",18),a(),r(10,"defs")(11,"clipPath",19),h(12,"rect",20),a()()()()(),x(13,Us,3,0,"div",21),a()}if(o&2){let e=l.$implicit,i=d();de("text-primary-90",i.activeParent===e.key)("bg-activity-outbound-bg",i.activeParent===e.key)("border-activity-outbound-border",i.activeParent===e.key)("bg-transparency-0",i.activeParent!==e.key)("border-transparency-0",i.activeParent!==e.key),s(3),m("src",e==null?null:e.icon),s(2),ce(e.label),s(),de("rotate-180",i.activeParent===e.key)("bg-primary-90",i.activeParent===e.key)("stroke-transparency-white",i.activeParent===e.key)("bg-transparency-15",i.activeParent!=e.key)("stroke-transparency-100",i.activeParent!=e.key),s(7),g(i.activeParent===e.key?13:-1)}}var Ua,Co=ee(()=>{Mt();W();Ft();xo();xe();lt();be();pe();Ua=(()=>{class o{constructor(e,i,t,n,c){this.router=e,this._permissionsHelper=i,this._commonFunctions=t,this._userService=n,this._cdr=c,this.selectedComponent={},this.activeParent=null,this.visibleLinks=[],this.allLinks=Q.AutomationType}ngOnInit(){this.loadAutomationTab()}ngOnChanges(e){e.selectedComponent&&this.syncActiveParentFromSelection()}loadAutomationTab(){if(this._permissionsHelper.isMainUser()){this.visibleLinks=this.allLinks,this.syncActiveParentFromSelection(),this._cdr.markForCheck();return}this._userService.getUserAccessData({}).subscribe({next:e=>{e?.statusCode===200&&(this._commonFunctions.userAccessData=e?.data),this.filterNavByPermissions()},error:()=>{if(this._commonFunctions.userAccessData){this.filterNavByPermissions();return}this.visibleLinks=[],this._cdr.markForCheck()}})}filterNavByPermissions(){this.visibleLinks=this._permissionsHelper.filterAutomationNavParents(this.allLinks),this.syncActiveParentFromSelection(),this._cdr.markForCheck()}syncActiveParentFromSelection(){let e=this.selectedComponent;if(!(!e?.path||!e?.moduleId)){for(let i of this.visibleLinks)if(i?.children?.some(n=>n?.moduleId===e.moduleId&&n?.path===e.path)&&i.key){this.activeParent=i.key;break}}}toggleParent(e){this.activeParent=this.activeParent===e?null:e}selectChild(e){this.router.navigate(["/automations"],{queryParams:{type:e?.path,moduleId:e?.moduleId}})}trackByParentKey(e,i){return i.key}trackByChildKey(e,i){return`${i.moduleId}-${i.path}`}static{this.\u0275fac=function(i){return new(i||o)(E(ut),E(Kt),E(q),E(De),E(xi))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation-sidebar"]],inputs:{selectedComponent:"selectedComponent"},standalone:!1,features:[z],decls:13,vars:0,consts:[[1,"flex","items-start","flex-col","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden"],[1,"flex","items-center","flex-col","self-stretch","py-[20px]","gap-[10px]","bg-transparency-10","border-b-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","flex-col","self-stretch","justify-center","p-[15px]","pb-0","gap-[10px]"],[1,"w-[60px]","h-[60px]","flex","items-center","justify-center","p-[7px]","rounded-pill","bg-secondary-blue-5"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/automation.svg",1,"text-charts-brighter-blue"],[1,"flex","flex-col","items-center","self-stretch","gap-[2px]"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"text-h5/[15px]","text-transparency-100","font-semibold","text-center","opacity-40"],[1,"flex","items-start","flex-col","self-stretch","gap-[10px]","p-[10px]","bg-transparency-0"],[1,"group","flex","items-center","flex-col","self-stretch","border-[1px]","border-solid","rounded-[10px]","cursor-pointer","hover:text-primary-90","hover:bg-activity-outboun
2d-bg","hover:border-activity-outbound-border",3,"text-primary-90","bg-activity-outbound-bg","border-activity-outbound-border","bg-transparency-0","border-transparency-0"],[1,"group","flex","items-center","flex-col","self-stretch","border-[1px]","border-solid","rounded-[10px]","cursor-pointer","hover:text-primary-90","hover:bg-activity-outbound-bg","hover:border-activity-outbound-border"],[1,"w-full","flex","items-center","self-stretch","gap-[5px]","py-[11px]","pl-[10px]","pr-[5px]",3,"click"],[1,"flex-[1_0_0]","flex","items-center","gap-[10px]","overflow-hidden"],[1,"[&_svg]:w-[24px]","[&_svg]:h-[24px]","text-transparency-100",3,"src"],[1,"text-h4/[18px]","font-semibold","truncate"],[1,"flex","items-center","gap-[10px]","p-[3px]","rounded-[30px]","border-[1px]","border-solid","border-transparency-25","transition-transform","duration-300","group-hover:bg-primary-90","group-hover:stroke-transparency-white"],["width","14","height","14","viewBox","0 0 14 14","fill","none"],["clip-path","url(#clip0_888_651995)"],["d","M3.5 5.25L7 8.75L10.5 5.25","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["id","clip0_888_651995"],["width","14","height","14","fill","white"],[1,"flex","flex-col","items-start","self-stretch","gap-[12px]","p-[10px]","pl-[20px]"],[1,"flex","items-center","self-stretch","gap-[5px]","p-[10px]","rounded-[10px]","border-[1px]","border-solid","border-transparent","text-transparency-100","cursor-pointer","hover:text-primary-90","hover:bg-activity-outbound-hover-bg","hover:border-activity-outbound-hover-border",3,"ngClass"],[1,"flex","items-center","self-stretch","gap-[5px]","p-[10px]","rounded-[10px]","border-[1px]","border-solid","border-transparent","text-transparency-100","cursor-pointer","hover:text-primary-90","hover:bg-activity-outbound-hover-bg","hover:border-activity-outbound-hover-border",3,"click","ngClass"],[1,"[&_svg]:w-[20px]","[&_svg]:h-[20px]","text-transparency-100",3,"src"],[1,"text-h5/[15px]","font-semibold","truncate"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),h(4,"svg-icon",4),a(),r(5,"div",5)(6,"h3",6),p(7," Automations "),a(),r(8,"h5",7),p(9," Automate the repetitive work "),a()()()(),r(10,"div",8),D(11,Ws,14,23,"div",9,t.trackByParentKey,!0),a()()),i&2&&(s(11),V(t.visibleLinks))},dependencies:[J,L],encapsulation:2,changeDetection:0})}}return o})()});function qs(o,l){if(o&1&&h(0,"app-automation-list",10),o&2){let e=d();m("automationType",e.selectedComponent)}}function Gs(o,l){o&1&&(r(0,"div",11)(1,"div",12)(2,"div",13)(3,"div",14),h(4,"svg-icon",15),a(),r(5,"div",16)(6,"h2",17),p(7," Choose an automation category "),a(),r(8,"p",18),p(9," Select a category from the sidebar to view and manage its automations. Or jump directly into one of the most-used categories "),a()()()()())}var bo,So=ee(()=>{$e();Mt();W();Ft();xo();pe();yo();Co();bo=(()=>{class o{constructor(e,i,t){this.route=e,this.router=i,this._permissionsHelper=t,this.destroy$=new Be,this.selectedComponent={},this.automationConstant=Q}ngOnInit(){this.route.queryParams.pipe(ue(this.destroy$)).subscribe(e=>{let i=this.automationConstant.AutomationType.flatMap(t=>t.children).find(t=>t.path===e.type&&t.moduleId===e.moduleId);if(i){if(!this._permissionsHelper.hasAutomationModuleAccess(i.moduleId)){let t=this.getFirstAllowedAutomation();t?this.router.navigate(["/automations"],{queryParams:{type:t.path,moduleId:t.moduleId},replaceUrl:!0}):this.selectedComponent={};return}this.selectComponent(structuredClone(i))}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}selectComponent(e){this.selectedComponent=e}getFirstAllowedAutomation(){let i=this._permissionsHelper.filterAutomationNavParents(this.automationConstant.AutomationType)[0]?.children?.[0];return i?structuredClone(i):null}static{this.\u0275fac=function(i){return new(i||o)(E(Ci),E(ut),E(Kt))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation"]],standalone:!1,decls:13,vars:3,consts:[[1,"flex","items-center","self-stretch","justify-between","py-[12px]","px-[30px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","mb-[26px]"],[1,"flex","items-center","gap-[10px]","p-[5px]"],[1,"bg-charts-brighter-blue","rounded-md","p-[7px]","flex","items-center","justify-center"],["svgClass","w-[18px] h-[18px]","src","assets/images/icons/automation.svg",1,"text-transparency-white"],[1,"flex","items-center","gap-[5px]"],[1,"text-h1","font-semibold","text-transparency-100"],[1,"flex","gap-[25px]","w-full","overflow-hidden"],[1,"w-[245px]"],[3,"selectedComponent"],[1,"w-[calc(100%-270px)]"],[3,"automationType"],[1,"flex","items-center","justify-center","gap-[20px]"],[1,"flex","w-full","max-w-[600px]","flex-col","items-center","justify-center","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","bg-transparency-1
25","p-[20px]"],[1,"flex","w-full","flex-col","items-center","justify-center","gap-[60px]","rounded-[20px]","px-[20px]","py-[60px]"],[1,"flex","shrink-0","items-center","rounded-pill","bg-secondary-blue-5","p-[20px]"],["svgClass","block size-[100px]","src","assets/images/icons/automation.svg",1,"text-charts-brighter-blue"],[1,"flex","w-full","flex-col","items-center","gap-[10px]","max-w-[400px]"],[1,"w-full","text-center","text-h1","font-semibold","text-transparency-100"],[1,"w-full","text-center","text-p","font-medium","text-transparency-100"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),h(3,"svg-icon",3),a(),r(4,"div",4)(5,"h1",5),p(6,"Automations"),a()()()(),r(7,"div",6)(8,"div",7),h(9,"app-automation-sidebar",8),a(),r(10,"div",9),x(11,qs,1,1,"app-automation-list",10),x(12,Gs,10,0,"div",11),a()()),i&2&&(s(9),m("selectedComponent",t.selectedComponent),s(2),g(t.selectedComponent!=null&&t.selectedComponent.path?11:-1),s(),g(t.selectedComponent!=null&&t.selectedComponent.path?-1:12))},dependencies:[L,Fa,Ua],encapsulation:2})}}return o})()});function Hs(o,l){if(o&1){let e=C();r(0,"div",25),y("click",function(){u(e);let t=d().$implicit,n=d();return _(n.selectRole(t))}),r(1,"label")(2,"div",26)(3,"input",27),y("click",function(t){u(e);let n=d().$implicit,c=d();return _(c.toggleRoleSelection(n,t))}),a(),h(4,"span",28),a()(),r(5,"div",29)(6,"h4",30),p(7),a()()()}if(o&2){let e=d().$implicit,i=d();de("bg-activity-outbound-hover-bg",i.isRoleFocused(e==null?null:e._id))("border-activity-outbound-hover-border",i.isRoleFocused(e==null?null:e._id))("border-transparency-0",!i.isRoleFocused(e==null?null:e._id))("hover:bg-activity-outbound-hover-bg",!i.isRoleFocused(e==null?null:e._id))("hover:border-activity-outbound-hover-border",!i.isRoleFocused(e==null?null:e._id)),s(3),m("checked",e==null?null:e.selected),s(4),T(" ",e==null?null:e.name," ")}}function Ys(o,l){if(o&1&&x(0,Hs,8,12,"div",24),o&2){let e=l.$implicit;g(e!=null&&e.show?0:-1)}}function zs(o,l){if(o&1){let e=C();r(0,"label",32)(1,"div",26)(2,"input",33),y("change",function(){u(e);let t=d().$implicit,n=d(2);return _(n.toggleUserSelection(t,!0))}),a(),h(3,"span",28),a(),h(4,"img",34),r(5,"span",30),p(6),a()()}if(o&2){let e=d().$implicit;s(2),m("checked",e==null?null:e.selected),s(2),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge),s(2),ce(e==null?null:e.name)}}function Js(o,l){if(o&1&&x(0,zs,7,3,"label",32),o&2){let e=l.$implicit;g(e!=null&&e.show?0:-1)}}function Qs(o,l){if(o&1){let e=C();r(0,"label",32)(1,"div",26)(2,"input",33),y("change",function(){u(e);let t=d().$implicit,n=d(3);return _(n.toggleUserSelection(t,!1))}),a(),h(3,"span",28),a(),h(4,"img",34),r(5,"span",30),p(6),a()()}if(o&2){let e=d().$implicit;s(2),m("checked",e==null?null:e.selected),s(2),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge),s(2),ce(e==null?null:e.name)}}function $s(o,l){if(o&1&&x(0,Qs,7,3,"label",32),o&2){let e=l.$implicit;g(e!=null&&e.show?0:-1)}}function Ks(o,l){if(o&1&&(r(0,"div",31)(1,"div",31),D(2,$s,1,1,null,null,k),a()()),o&2){let e=d(2);s(2),V(e.filteredUsersNotInRole)}}function Xs(o,l){if(o&1&&(r(0,"div",17)(1,"div",31)(2,"div",31),D(3,Js,1,1,null,null,k),a()(),x(5,Ks,4,0,"div",31),a()),o&2){let e=d();s(3),V(e.filteredUsersInRole),s(2),g(e.hideNotInRole?-1:5)}}function Zs(o,l){o&1&&(r(0,"div",18)(1,"p",35),p(2," Select a role from the left to view and assign users "),a()())}var ei,ci=ee(()=>{fe();$e();dt();W();fe();Ce();Ee();lt();se();pe();kt();ei=(()=>{class o{constructor(e,i,t,n,c){this.data=e,this.dialog=i,this._loaderService=t,this._toastrService=n,this._userService=c,this.destroy$=new Be,this.loadPhasesCompleted=0,this.expectedLoadPhases=2,this.allRoles=[],this.allUsers=[],this.selectedRole=null,this.filteredUsersInRole=[],this.filteredUsersNotInRole=[],this.roleSelections=new Map,this.searchUserText="",this.searchRoleText="",this.dataInitialized=!1,this.hideNotInRole=!1,this.hideNotInRole=this.data?.hideNotInRole||!1,this._loaderService.start(),this.getRoleList(),this.get
2SubUserList()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}markInitialLoadPhaseComplete(){this.loadPhasesCompleted++,this.loadPhasesCompleted>=this.expectedLoadPhases&&this._loaderService.stop()}getRoleList(){let e={page:1,limit:1e3};this._userService.getRoles(e).pipe(ue(this.destroy$),Ye(()=>this.markInitialLoadPhaseComplete())).subscribe({next:i=>{i?.statusCode===200&&(this.allRoles=(i?.data?.items||[])?.map(t=>P(M({},t),{show:!0,selected:!1})),this.initializeDataFromInput())},error:()=>{this._toastrService.showError("Failed to load roles. Please try again.")}})}getSubUserList(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).pipe(ue(this.destroy$),Ye(()=>this.markInitialLoadPhaseComplete())).subscribe({next:i=>{i?.statusCode===200&&(this.allUsers=(i?.data?.items||[])?.map(t=>P(M({},t),{show:!0})),this.initializeDataFromInput())},error:()=>{this._toastrService.showError("Failed to load users. Please try again.")}})}initializeDataFromInput(){if(this.dataInitialized||this.allRoles.length===0||this.allUsers.length===0)return;this.dataInitialized=!0;let e=this.data?.addedRoleUserList||this.data;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.addedRoleUserList&&(e=e.addedRoleUserList),e&&Array.isArray(e)?e?.forEach(i=>{let t,n=[];if(i.roleId&&Array.isArray(i.teamMembers)?(t=i.roleId,n=i.teamMembers.map(c=>c.userId).filter(c=>c)):i?._id&&Array.isArray(i?.userData)&&(t=i?._id,n=i?.userData?.filter(c=>c?.selected)?.map(c=>c?._id)?.filter(c=>c)),t&&n.length>0){this.roleSelections.set(t,new Set(n));let c=this.allRoles?.find(f=>f?._id===t);c&&(c.selected=!0)}}):this.data?.roleSelections&&Object.keys(this.data?.roleSelections||{})?.forEach(i=>{let t=this.data?.roleSelections?.[i];if(Array.isArray(t)&&t?.length>0){this.roleSelections?.set(i,new Set(t));let n=this.allRoles?.find(c=>c?._id===i);n&&(n.selected=!0)}}),this.selectedRole)this.updateFilteredUsers();else{let i=this.allRoles?.find(t=>t?.selected&&this.roleSelections?.has(t?._id));i?this.selectRole(i):this.allRoles.length>0&&this.selectRole(this.allRoles[0])}}selectRole(e){this.selectedRole?._id&&this.selectedRole._id!==e._id&&this.clearRoleIfCheckedWithoutUsers(this.selectedRole._id),this.selectedRole=e,this.roleSelections.has(e._id)||this.roleSelections.set(e._id,new Set),this.updateFilteredUsers()}updateFilteredUsers(){if(!this.selectedRole){this.filteredUsersInRole=[],this.filteredUsersNotInRole=[];return}let e=this.selectedRole?._id;this.filteredUsersInRole=this.allUsers?.filter(i=>Array.isArray(i?.roleData)&&i?.roleData?.some(t=>t?._id===e))?.map(i=>P(M({},i),{selected:this.isUserSelected(e,i?._id),show:!0})),this.hideNotInRole?this.filteredUsersNotInRole=[]:this.filteredUsersNotInRole=this.allUsers?.filter(i=>!Array.isArray(i?.roleData)||!i?.roleData?.some(t=>t?._id===e))?.map(i=>P(M({},i),{selected:this.isUserSelected(e,i?._id),show:!0})),this.searchUserText.trim()&&this.searchUsers()}isRoleFocused(e){return this.selectedRole?._id===e}getSelectedUsersCountForRole(e){let i=this.roleSelections.get(e);return i?i.size:0}getTotalSelectedUsersCount(){let e=0;return this.roleSelections?.forEach(i=>{e+=i?.size||0}),e}getRoleSelectedCount(){return this.allRoles?.filter(e=>e?.selected)?.length||0}toggleRoleSelection(e,i){i&&i.stopPropagation(),e.selected=!e.selected,e.selected?(this.roleSelections.has(e._id)||this.roleSelections.set(e._id,new Set),this.allRoles?.forEach(t=>{t?._id!==e._id&&this.clearRoleIfCheckedWithoutUsers(t._id)}),this.selectRole(e)):(this.roleSelections.delete(e._id),this.selectedRole&&this.selectedRole._id===e._id&&this.updateFilteredUsers())}clearRoleIfCheckedWithoutUsers(e){if(!e)return;let i=this.allRoles?.find(t=>t?._id===e);i?.selected&&(this.getSelectedUsersCountForRole(e)>0||(i.selected=!1,this.roleSelections.delete(e)))}syncRoleSelectionState(e){let i=this.allRoles?.find(c=>c?._id===e);if(!i)return;let n=this.roleSelections.get(e)?.size??0;i.selected=n>0,n===0&&this.roleSelections.delete(e)}searchRole(){let e=this.searchRoleText?.trim()?.toLowerCase()||"";this.allRoles?.forEach(i=>{i.show=!e||i?.name?.toLowerCase()?.includes(e)})}searchUsers(){let e=this.searchUserText?.trim()?.toLowerCase()||"";if(!e){this.filteredUsersInRole=this.filteredUsersInRole?.map(i=>P(M({},i),{show:!0}))||[],this.hideNotInRole||(this.filteredUsersNotInRole=this.filteredUsersNotInRole?.map(i=>P(M({},i),{show:!0}))||[]);return}this.filteredUsersInRole=this.filteredUsersInRole?.map(i=>P(M({},i),{show:(i?.name||"")?.toLowerCase()?.includes(e)}))||[],this.hideNotInRole||(this.filteredUsersNotInRole=this.filteredUsersNotInRole?.map(i=>P(M({},i),{show:(i?.name||"")?.toLowerCase()?.includes(e)}))||[])}toggleUserSelection(e,i){if(!this.selectedRole)return;let t=this.selectedRole?._id,n=e?._id;this.roleSelections.has(t)||this.roleSelections.set(t,new Set);let c=this.roleSelections.get(t);if(c.has(n)?c.delete(n):c.add(n),i){let f=this.filteredUsersInRole?.findIndex(S=>S?._id===n);f!==-1&&(this.filteredUsersInRole[f].selected=c.has(n))}else{let f=this.filteredUsersNotInRole?.findIndex(S=>S?._id===n);f!==-1&&(this.filteredUsersNotInRole[f].selected=c.has(n))}this.syncRoleSelectionState(t)}isUserSelected(e,i){let t=this.roleSelections.get(e);return t?t.has(i):!1}isRoleSelected(e){let i=this.data?.addedRoleUserList||this.data;if(i&&Array.isArray(i)){let t=i?.find(n=>n?.roleId===e);return t&&Array.isArray(t.teamMembers)&&t.teamMembers.length>0}if(this.data?.roleSelections){let t=this.data?.roleSelections?.[e];return t&&Array.isArray(t)&&t.length>0}return!1}get rolesWithUsers(){return this.allRoles?.filter(e=>this.allUsers?.some(i=>Array.isArray(i?.roleData)&&i?.roleData?.some(t=>t?._id===e?._id)))||[]}isFormValid(){let e=this.allRoles?.filter(i=>i?.selected)||[];
2if(e.length===0)return!1;for(let i of e){let t=this.roleSelections.get(i._id);if(t&&t.size>0)return!0}return!1}confirmSelection(){let e=[];this.roleSelections?.forEach((t,n)=>{if(t?.size>0){let c=this.allRoles?.find(f=>f?._id===n);c&&c?.selected&&e.push({roleId:n,roleName:c?.name||c?.orignalName||"",teamMembers:Array.from(t)?.map(f=>({userId:f}))||[]})}});let i={addedRoleUserList:e};this.dialog.close(i)}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(H),E(Y),E(De))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-role-user-assignment"]],standalone:!1,decls:32,vars:9,consts:[[1,"flex","flex-col","items-center","gap-[10px]","p-[30px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px]","src","assets/images/icons/user-profile.svg",1,"text-transparency-100"],[1,"flex-1"],[1,"text-h1","text-transparency-100","font-semibold"],[1,"text-sub-heading/[normal]","text-transparency-90","font-medium"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","items-start","self-stretch","gap-[30px]"],[1,"flex-1","flex","flex-col","items-start","self-stretch","gap-[20px]","px-[20px]","py-[15px]","rounded-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","self-stretch","relative"],["src","assets/images/header/search.svg","alt","search","width","20",1,"img-fluid","absolute","left-[10px]","top-1/2","-translate-y-1/2"],["type","text","placeholder","Search Roles...",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","font-semibold","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","input","ngModel"],[1,"flex","flex-col","self-stretch","gap-[10px]"],["type","text","placeholder","Search team members...",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","font-semibold","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","input","ngModel"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"flex","flex-col","self-stretch","gap-[20px]","items-center","justify-center","py-[40px]"],[1,"inline-block","w-full","py-[10px]"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"block","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","label","Confirm Assignment","variant","filled","type","default","size","44",3,"clicked","leftIcon","disabled"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[8px]","cursor-pointer","select-none","rounded-[5px]","border-[1px]","border-solid",3,"bg-activity-outbound-hover-bg","border-activity-outbound-hover-border","border-transparency-0","hover:bg-activity-outbound-hover-bg","hover:border-activity-outbound-hover-border"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[8px]","cursor-pointer","select-none","rounded-[5px]","border-[1px]","border-solid",3,"click"],[1,"re-custom-checkbox"],["type","checkbox",3,"click","checked"],[1,"checkmark"],[1,"flex","flex-col","gap-[3px]","flex-1"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"flex","flex-col","self-stretch","gap-[5px]"],[1,"flex","items-center","px-[5px]","py-[10px]","gap-[10px]","select-none","cursor-pointer"],["type","checkbox",3,"change","checked"],["alt","demo-profile","width","34","height","34",1,"img-fluid","rounded-[17px]","border-[2px]","border-solid","border-transparency-0",3,"src"],[1,"text-h4","text-transparency-90","font-medium"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5)(7,"h1",6),p(8," Add Role - User Assignment "),a(),r(9,"p",7),p(10),a()()(),r(11,"button",8),h(12,"svg-icon",9),a()(),r(13,"div",10)(14,"div",11)(15,"div",12),h(16,"img",13),r(17,"input",14),A("ngModelChange",function(c){return I(t.searchRoleText,c)||(t.searchRoleText=c),c}),y("input",function(){return t.searchRole()}),a()(),r(18,"div",15),D(19,Ys,1,1,null,null,k),a()(),r(21,"div",11)(22,"div",12),h(23,"img",13),r(24,"input",16),A("ngModelChange",function(c){return I(t.searchUserText,c)||(t.searchUserText=c),c}),y("input",function(){return t.searchUsers()}),a()(),x(25,Xs,6,1,"div",17),x(26,Zs,3,0,"div",18),a()()(),r(27,"div",19),h(28,"svg-icon",20),a(),r(29,"div",21),h(30,"app-button",22),r(31,"app-button",23),y("clicked",function(){return t.confirmSelection()}),a()()()()),i&2&&(s(10),je(" ",t.getRoleSelectedCount()," Roles - ",t.getTotalSelectedUsersCount()," Users Configured "),s(7),w("ngModel",t.searchRoleText),s(2),V(t.rolesWithUsers
2),s(5),w("ngModel",t.searchUserText),s(),g(t.selectedRole?25:-1),s(),g(t.selectedRole?-1:26),s(4),m("leftIcon",!1),s(),m("leftIcon",!1)("disabled",!t.isFormValid()))},dependencies:[G,F,U,Ze,_t,L,et],encapsulation:2})}}return o})()});function td(o,l){if(o&1&&(r(0,"div",10),h(1,"img",11),r(2,"span",12),p(3),a()()),o&2){let e=d().$implicit;s(),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge)("alt",e!=null&&e.firstName||e!=null&&e.lastName?"Profile photo for "+((e==null?null:e.firstName)||"")+" "+((e==null?null:e.lastName)||""):"Assignee profile"),s(2),je("",e==null?null:e.firstName," ",e==null?null:e.lastName)}}function id(o,l){if(o&1&&x(0,td,4,4,"div",10),o&2){let e=l.$implicit;g(e!=null&&e.selected?0:-1)}}var ed,ti,pi=ee(()=>{fe();W();fe();pe();ed=(o,l)=>l._id??l.userId??o;ti=(()=>{class o{constructor(e,i){this.data=e,this.dialog=i}get assignees(){let e=this.data?.roleData;return Array.isArray(e)?e:[]}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe))}}static{this.\u0275cmp=B({type:o,selectors:[["app-all-assignees"]],standalone:!1,decls:14,vars:0,consts:[[1,"flex","flex-col","items-center","gap-[10px]","p-[20px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px]","src","assets/images/icons/selected-action.svg",1,"text-transparency-100"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","self-stretch","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","self-stretch","gap-[5px]"],[1,"flex","items-center","px-[5px]","py-[10px]","gap-[10px]","select-none"],["width","34","height","34",1,"img-fluid","rounded-[17px]","border-[2px]","border-solid","border-transparency-0",3,"src","alt"],[1,"text-h4","text-transparency-100","font-semibold"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5),p(7," All Assignees "),a()(),r(8,"button",6),h(9,"svg-icon",7),a()(),r(10,"div",8)(11,"div",9),D(12,id,1,1,null,null,ed),a()()()()()),i&2&&(s(12),V(t.assignees))},dependencies:[Ze,_t,L],encapsulation:2})}}return o})()});function od(o,l){if(o&1&&(r(0,"h4",8),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function ad(o,l){if(o&1){let e=C();r(0,"div",15),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",16),a()}}function rd(o,l){if(o&1){let e=C();r(0,"label",44)(1,"div",45)(2,"input",46),y("change",function(t){let n=u(e).$implicit,c=d(4);return _(c.onRoleChange(t,n==null?null:n._id))}),a(),h(3,"span",47),a(),r(4,"span",48),p(5),a()()}if(o&2){let e=l.$implicit,i=d(4);s(2),m("value",e==null?null:e._id)("checked",i.assignedByLeadRoles.includes(e==null?null:e._id))("disabled",i.isViewOnly),s(3),ce(e==null?null:e.name)}}function ld(o,l){if(o&1&&(r(0,"div",39)(1,"div",4)(2,"h3",41),p(3," Choose the roles from your team assignment that should receive calls. "),a(),r(4,"div",42),h(5,"svg-icon",7),a()(),r(6,"div",43),D(7,rd,6,4,"label",44,k),a()()),o&2){let e=d(3);s(7),V(e.allRoleList)}}function sd(o,l){if(o&1){let e=C();r(0,"button",58),y("click",function(){u(e);let t=d(4);return _(t.addRoleUserAssignment())}),h(1,"img",59),p(2," Add "),a()}}function dd(o,l){if(o&1){let e=C();r(0,"div",69),y("click",function(){u(e);let t=d(2).$implicit,n=d(4);return _(n.allAssignees(t==null?null:t.teamMembers))}),h(1,"img",70),a()}if(o&2){let e=l.$implicit;s(),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge)}}function cd(o,l){if(o&1){let e=C();r(0,"span",71),y("click",function(){u(e);let t=d(2).$implicit,n=d(4);return _(n.allAssignees(t==null?null:t.teamMembers))}),p(1),a()}if(o&2){let e=d(2).$implicit,i=d(4);s(),T(" +",i.getRemainingUserCount(e)," More ")}}function pd(o,l){if(o&1){let e=C();r(0,"img",72),y("click",function(){u(e);let t=d(2).$index,n=d(4);return _(n.deleteAddedUsed(t))}),a()}}function md(o,l){if(o&1&&(r(0,"div",60)(1,"div",61)(2,"div",62),p(3),a(),r(4,"div",63)(5,"div",64),D(6,dd,2,1,"div",65,nd),a(),x(8,cd,2,1,"span",66),a()(),r(9,"div",67),x(10,pd,1,0,"img",68),a()()),o&2){let e=d().$implicit,i=d(4);s(3),T(" ",i.getRoleName(e)," "),s(3),V(i.getDisplayUsers(e)),s(2),g(i.getRemainingUserCount(e)>
20?8:-1),s(2),g(i.isViewOnly?-1:10)}}function ud(o,l){if(o&1&&x(0,md,11,3,"div",60),o&2){let e=l.$implicit,i=d(4);g(i.isRoleSelected(e)?0:-1)}}function _d(o,l){o&1&&(r(0,"div",57),p(1," No records to show "),a())}function hd(o,l){if(o&1&&(r(0,"div",40)(1,"div",49)(2,"div",50)(3,"h2",51),p(4," Roles that receives the call "),a()(),x(5,sd,3,0,"button",52),a(),r(6,"div",53)(7,"div",54)(8,"h4",55),p(9," Role "),h(10,"img",56),a(),r(11,"h4",55),p(12," Assignee "),h(13,"img",56),a()(),r(14,"div",53),D(15,ud,1,1,null,null,k),x(17,_d,2,0,"div",57),a()()()),o&2){let e=d(3);s(5),g(e.isViewOnly?-1:5),s(10),V(e.addedRoleUserList),s(2),g(e.addedRoleUserList!=null&&e.addedRoleUserList.length?-1:17)}}function xd(o,l){if(o&1){let e=C();r(0,"div",30),h(1,"svg-icon",31),a(),r(2,"div",32)(3,"label",33),p(4," Select assignment method"),a(),r(5,"div",34)(6,"label",35)(7,"input",36),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.manualAssignmentMethod,t)||(n.manualAssignmentMethod=t),_(t)}),a(),h(8,"img",37),p(9," Assigned in Lead"),a(),r(10,"label",35)(11,"input",38),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.manualAssignmentMethod,t)||(n.manualAssignmentMethod=t),_(t)}),a(),h(12,"img",37),p(13," Manual Assignment"),a()()(),r(14,"div",30),h(15,"svg-icon",31),a(),x(16,ld,9,0,"div",39),x(17,hd,18,2,"div",40)}if(o&2){let e=d(2);s(7),m("name","smsfrom_"+e.actionId),w("ngModel",e.manualAssignmentMethod),m("disabled",e.isViewOnly),s(4),m("name","smsfrom_"+e.actionId),w("ngModel",e.manualAssignmentMethod),m("disabled",e.isViewOnly),s(5),g(e.manualAssignmentMethod=="ASSIGNED_IN_LEAD"?16:-1),s(),g(e.manualAssignmentMethod=="MANUAL_ASSIGNMENT"?17:-1)}}function gd(o,l){if(o&1&&(r(0,"option",78),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",e==null?null:e.assistantName," ")}}function fd(o,l){if(o&1){let e=C();r(0,"div",30),h(1,"svg-icon",31),a(),r(2,"div",73)(3,"div",32)(4,"label",74),p(5," Select AI Agent "),h(6,"img",56),a(),r(7,"div",75)(8,"select",76),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.aiAgentId,t)||(n.aiAgentId=t),_(t)}),r(9,"option",77),p(10,"--Select an agent--"),a(),D(11,gd,2,2,"option",78,k),a()()(),r(13,"div",79),p(14," Only calls leads created between 8 AM and 8 PM, based on the lead\u2019s phone number area code. "),a()()}if(o&2){let e=d(2);s(8),w("ngModel",e.aiAgentId),m("disabled",e.isViewOnly),s(3),V(e.agentList)}}function yd(o,l){if(o&1){let e=C();r(0,"div",14)(1,"div",17)(2,"div",18)(3,"div",19),h(4,"img",20),a(),r(5,"div",3)(6,"div",4)(7,"h2",21),p(8," Manual SpeedtoLead "),a()(),r(9,"h4",8),p(10," Roles to call outside of AI calling hours "),a()(),r(11,"label",22)(12,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.manualSpeedToLeadEnabled,t)||(n.manualSpeedToLeadEnabled=t),_(t)}),a(),h(13,"span",24),a()(),x(14,xd,18,8),a(),r(15,"div",25),p(16," If no one from selected assignees pick up the call, AI will answer it. Please read the "),r(17,"a",26),p(18," SpeedToLead calling rules. "),a()(),r(19,"div",27)(20,"div",18)(21,"div",19),h(22,"img",28),a(),r(23,"div",3)(24,"div",4)(25,"h2",21),p(26," Speed to Lead AI "),a()(),r(27,"h4",29),p(28," Would you like SpeedtoLead AI make call on your behalf? "),a()(),r(29,"label",22)(30,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.isAIEnabled,t)||(n.isAIEnabled=t),_(t)}),a(),h(31,"span",24),a()(),x(32,fd,15,2),a()()}if(o&2){let e=d();s(12),w("ngModel",e.manualSpeedToLeadEnabled),m("disabled",e.isViewOnly),s(2),g(e.manualSpeedToLeadEnabled?14:-1),s(3),m("pTooltip",e.speedToLeadCallingRulesTooltip),s(13),w("ngModel",e.isAIEnabled),m("disabled",e.isViewOnly),s(2),g(e.isAIEnabled?32:-1)}}var nd,Zi,en=ee(()=>{W();ci();pi();lr();W();fe();Ce();Ee();fo();lt();Mr();be();se();pe();Ve();He();nd=(o,l)=>l._id||l.userId;Zi=(()=>{class o{constructor(e,i,t,n,c,f){this._dialog=e,this._loaderService=i,this._toastr=t,this._vapiService=n,this._userService=c,this._outboundAgentService=f,this.previewText="Active on all channels. SpeedtoLead AI Enabled. Manual SpeedtoLead Enabled.",this.dayReminder="Day 1 - 9:40 AM",this.payload={}
2,this.stepIndex=-1,this.actionId=-1,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.isAIEnabled=!0,this.aiAgentId="",this.manualSpeedToLeadEnabled=!0,this.manualAssignmentMethod="ASSIGNED_IN_LEAD",this.agentList=[],this.addedRoleUserList=[],this.allUsers=[],this.messageConstant=Xo,this.speedToLeadCallingRulesTooltip=`SpeedToLead Calling Rules (AI & Manual)
31. If only SpeedToLead AI is enabled:
4SpeedToLead AI will call from 8 AM to 8 PM.
52. If only SpeedToLead Manual is enabled:
6SpeedToLead Manual will call 24/7 (all the time).
73. If SpeedToLead AI is enabled and Manual is disabled:
8SpeedToLead AI will call from 8 AM to 8 PM.
94. If both SpeedToLead AI and Manual are enabled:
10From 8 AM to 8 PM, SpeedToLead AI will be calling.
11From 8 PM to 8 AM, SpeedToLead Manual will be calling.`,this.allRoleList=[],this.assignedByLeadRoles=[],this.initialIsAIEnabled=!1,this.initialAiAgentId="",this.initialManualSpeedToLeadEnabled=!1,this.initialManualAssignmentMethod="",this.initialAssignedByLeadRoles=[],this.initialAddedRoleUserList=[],this.isInitialStateCaptured=!1}ngOnInit(){this.applyPayload(),this.getRetailAi(),this.getRoleList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getRetailAi(),this.getRoleList())}applyPayload(){typeof this.payload?.isAIEnabled=="boolean"&&(this.isAIEnabled=this.payload.isAIEnabled),this.payload?.aiAgentId&&(this.aiAgentId=this.payload.aiAgentId),typeof this.payload?.manualSpeedToLeadEnabled=="boolean"&&(this.manualSpeedToLeadEnabled=this.payload.manualSpeedToLeadEnabled),this.payload?.manualAssignmentMethod&&(this.manualAssignmentMethod=this.payload.manualAssignmentMethod),this.manualAssignmentMethod==="ASSIGNED_IN_LEAD"&&Array.isArray(this.payload?.selectedRoles)&&(this.assignedByLeadRoles=this.payload.selectedRoles.map(e=>e?.roleId).filter(e=>e!=null&&e!==""))}onToggleExpanded(){this.isExpanded=!this.isExpanded}onDeleteBox(){this.deleteBox.emit()}getRetailAi(){let e={page:1,limit:1e3,voiceAiType:2};this._loaderService.start(),this._outboundAgentService.list(e).subscribe(i=>{i?.statusCode==200&&(this.agentList=i?.data?.items||[],this.isAIEnabled=!!this.payload?.isAIEnabled,this.isAIEnabled&&(this.aiAgentId=this.payload?.aiAgentId||""),this.isInitialStateCaptured,this._loaderService.stop())},i=>{if(this._loaderService.stop(),i?.error){let t=i.error;this._toastr.showError(t?.message)}else this._toastr.showError(this.messageConstant?.unknownError)})}getRoleList(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).subscribe(i=>{if(i?.statusCode==200){this.allUsers=i?.data?.items||[];let t={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(t).subscribe(n=>{n?.statusCode==200&&(this.allRoleList=(n?.data?.items||[]).sort((c,f)=>(c?.name||"").localeCompare(f?.name||"",void 0,{sensitivity:"base"})),this.manualSpeedToLeadEnabled=!!this.payload?.manualSpeedToLeadEnabled,this.payload?.manualSpeedToLeadEnabled&&(this.manualAssignmentMethod=this.payload?.manualAssignmentMethod,this.manualAssignmentMethod=="ASSIGNED_IN_LEAD"?this.payload?.selectedRoles?.forEach(c=>{this.assignedByLeadRoles.push(c?.roleId)}):(this.addedRoleUserList=[],this.payload?.selectedRoles?.forEach(c=>{if(c?.roleId&&Array.isArray(c?.teamIds)&&c?.teamIds?.length>0){let f=this.allRoleList?.find(v=>v?._id===c?.roleId),S=[...new Set(c.teamIds.filter(v=>v!=null&&v!==""))];this.addedRoleUserList.push({roleId:c?.roleId,roleName:f?.name||f?.orignalName||"",teamMembers:S.map(v=>({userId:v}))})}}))),this.captureInitialState()),this._loaderService.stop()},n=>{this._loaderService.stop()})}},i=>{this._loaderService.stop()})}onRoleChange(e,i){e.target.checked?this.assignedByLeadRoles.push(i):this.assignedByLeadRoles=this.assignedByLeadRoles?.filter(t=>t!==i)||[]}addRoleUserAssignment(){this.dialogRef=this._dialog.open(ei,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{addedRoleUserList:this.addedRoleUserList,hideNotInRole:!0}}),this.dialogRef.afterClosed().subscribe(e=>{e&&(this.addedRoleUserList=e.addedRoleUserList||e||[])})}allAssignees(e){let i=[];e?.forEach(t=>{let n=this.allUsers?.find(c=>c?._id===t?.userId);i.push({_id:t?.userId,userId:t?.userId,email:n?.email||"",profileImage:n?.profileImage||"",firstName:n?.name?.split(" ")[0]||n?.firstName||"",lastName:n?.name?.split(" ").slice(1).join(" ")||n?.lastName||"",name:n?.name||"",show:!0,selected:!0})}),this.dialogRef=this._dialog.open(ti,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",data:{roleData:i}}),this.dialogRef.afterClosed().subscribe(t=>{})}deleteAddedUsed(e){this.addedRoleUserList.splice(e,1)}getRoleUserData(e){if(!e||!e.teamMembers||!Array.isArray(e.teamMembers))return[];let i=new Set,t=[];for(let n of e.teamMembers){let c=n?.userId??n?._id;if(c==null||c===""||i.has(String(c)))continue;i.add(String(c));let f=this.allUsers?.find(S=>S?._id===n?.userId||S?._id===n?._id);t.push({_id:c,userId:c,email:f?.email||"",profileImage:f?.profileImage||"",firstName:f?.name?.split(" ")[0]||f?.firstName||"",lastName:f?.name?.split(" ").slice(1).join(" ")||f?.lastName||"",name:f?.name||"",show:!0,selected:!0})}return t}getDisplayUsers(e){return this.getRoleUserData(e)?.slice(0,4)||[]}getRemainingUserCount(e){let t=(this.getRoleUserData(e)?.length||0)-4;return t>0?t:0}isRoleSelected(e){return e&&Array.isArray(e.teamMembers)&&e.teamMembers.length>0}getRoleName(e){return e?.roleName||e?.name||""}getPreview(){let e=this.manualSpeedToLeadEnabled?"Manual SpeedtoLead Enabled.":"Manual SpeedtoLead Disabled.",i=this.isAIEnabled?" SpeedtoLead AI Enabled.":" SpeedtoLead AI Disabled.";return e+i}captureInitialState(){this.isInitialStateCaptured||(this.initialIsAIEnabled=this.isAIEnabled,this.initialAiAgentId=this.aiAgentId||"",this.initialManualSpeedToLeadEnabled=this.manualSpeedToLeadEnabled,this.initialManualAssignmentMethod=this.manualAssignmentMethod||"",this.initialAssignedByLeadRoles=this.assignedByLeadRoles?[...this.assignedByLeadRoles]:[],this.initialAddedRoleUserList=this.addedRoleUserList?JSON.parse(JSON.stringify(this.addedRoleUserList)):[],this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.isAIEnabled!==this.initialIsAIEnabled||this.aiAgentId!==this.initialAiAgentId||this.manualSpeedToLeadEnabled!==this.initialManualSpeedToLeadEnabled||this.manualAssignmentMethod!==this.initialManualAssignmentMethod||this.assignedByLeadRoles?.length!==this.initialAssignedByLeadRoles?.length||!this.assignedByLeadRoles?.every(e=>this.initialAssignedByLeadRoles?.includes(e))||!this.initialAssignedByLeadRoles?.every(e=>this.assignedByLeadRoles?.includes(e))||JSON.stringify(this.addedRoleUserList)!==JSON.stringify(this.initialAddedRoleUserList):!1}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(H),E(Y),E(Xt),E(De),E(Ba))}}static{this.\u0275cmp=B({type:o,selectors:[["app-speed-to-lead-box"]],inputs:{previewText:"previewText",dayReminder:"dayReminder",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",isViewOnl
vendor: 5,090 bytes, line 11
11y:"isViewOnly"},outputs:{deleteBox:"deleteBox"},standalone:!1,features:[z],decls:17,vars:6,consts:[[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-pistachio","rounded-[20px]"],["src","assets/images/icons/speed-v2-white.svg","alt","speed-v2-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Speed to Lead",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[10px]","pr-[10px]"],[1,"flex-none","flex","items-center","p-[14px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/meet-grade.svg","alt","meet-grade","width","28","height","28",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"re-custom-switch"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"slider"],[1,"text-h4","font-semibold","text-transparency-100"],["href","javascript:void(0)","tooltipPosition","top","tooltipStyleClass","!whitespace-pre-line !max-w-[360px]",1,"text-primary-90","cursor-pointer","underline","hover:text-primary-100",3,"pTooltip"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/speed-to-lead-ai.svg","alt","speed-to-lead-ai","width","28","height","28",1,"img-fluid","dark:invert","dark:contrast-200"],["pTooltip","Would you like SpeedtoLead AI make call on your behalf?","tooltipPosition","top",1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"w-full"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"flex","items-center","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio","value","ASSIGNED_IN_LEAD",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],["type","radio","value","MANUAL_ASSIGNMENT",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"flex","flex-col","items-center","gap-[10px]"],[1,"w-full","flex","flex-col","gap-[10px]"],[1,"text-h3/[normal]","text-transparency-100","font-semibold"],["pTooltip","For Round Robin and Weighted Round-Robin, SpeedtoLead calls will be forwarded to the assigned team members in the selected roles. For First to Claim, Manual Assignment and All Selected Team Members, SpeedtoLead calls will be forwarded to everyone selected in that role.","tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full","grid","grid-cols-2","gap-[5px]"],[1,"flex","items-center","gap-[10px]","py-[10
11px]","px-[5px]","cursor-pointer","select-none"],[1,"re-custom-radio-2"],["type","checkbox",3,"change","value","checked","disabled"],[1,"check-mark"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"flex","items-center","justify-between","gap-[5px]"],[1,"flex","items-center","gap-[10px]"],[1,"text-h2","text-transparency-100","font-semibold"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","items-center","gap-[10px]","pr-[30px]"],[1,"flex-[1_0_0]","flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"group","flex","items-center","justify-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","p-[8px]"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],[1,"group","flex","items-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","hover:bg-transparency-10","hover:border-transparency-25"],[1,"flex-[1_0_0]","flex","items-center","gap-[10px]"],[1,"w-1/2","text-h4","text-transparency-100","font-semibold","p-[8px]","truncate"],[1,"w-1/2","flex","items-center","gap-[3px]","p-[7px]"],[1,"flex","items-center","-space-x-[10px]"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90"],[1,"flex-none","flex","items-center","mr-2","cursor-pointer","opacity-0","group-hover:opacity-100"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","30","height","30",1,"img-fluid"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer",3,"click"],["alt","demo-profile","width","34","height","34",1,"img-fluid",3,"src"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90",3,"click"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","30","height","30",1,"img-fluid",3,"click"],[1,"flex","flex-col","items-center","justify-center","gap-[15px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"relative"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],[1,"text-label","text-transparency-100","font-medium","opacity-40"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2),a(),r(3,"div",3)(4,"div",4)(5,"h2",5),p(6," Speed to Lead "),a(),r(7,"div",6),h(8,"svg-icon",7),a()(),x(9,od,2,1,"h4",8),a(),r(10,"div",9)(11,"div",10),p(12),a(),x(13,ad,2,0,"div",11),r(14,"div",12),y("click",function(){return t.onToggleExpanded()}),h(15,"img",13),a()()(),x(16,yd,33,7,"div",14)),i&2&&(s(7),m("pTooltip",`Speed to lead will help you connect with motivated sellers in
12        less than 60 seconds from the time lead is created.
13
14As soon as
15        a new lead is created (via REsimpli website, zapier, webforms
16        or carrot websites), we will call your team. Once someone from
17        your team answers the call, we will immediately call the
18        seller and connect your team member.
19
20 You will also receive a
21        text message right away with leads name, address and lead
22        source to have some background info.`),s(2),g(t.isExpanded?-1:9),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
22y?-1:13),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?16:-1))},dependencies:[J,K,X,G,Ke,$,Oe,F,U,L,Z,he],encapsulation:2})}}return o})()});function Sd(o,l){if(o&1&&(r(0,"div",0)(1,"div",14),h(2,"img",15)(3,"span",16),a()()),o&2){let e=d();s(3),m("innerHTML",e.getDelayData(),le)}}function Td(o,l){if(o&1&&(r(0,"h4",7),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function vd(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function Ed(o,l){if(o&1&&(r(0,"p",53),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function wd(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",48)(2,"label",49),p(3," Delay before executing this step "),h(4,"img",29),a(),r(5,"div",50)(6,"input",51),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",52),y("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Ed,2,1,"p",53),a()()}if(o&2){let e=d(3);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Id(o,l){if(o&1&&(r(0,"option",57),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Ad(o,l){if(o&1){let e=C();r(0,"select",54),y("ngModelChange",function(t){u(e);let n=d(4);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Id,2,2,"option",57,k),a()}if(o&2){let e=d(4);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Md(o,l){if(o&1&&(r(0,"p",53),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function Od(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",48)(2,"label",49),p(3," Execute on "),h(4,"img",29),a(),r(5,"div",50)(6,"select",54),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",55),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Ad,3,2,"select",56),a(),x(11,Md,2,1,"p",53),a()()}if(o&2){let e=d(3);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Dd(o,l){if(o&1&&(x(0,wd,17,5,"div",19),x(1,Od,12,6,"div",19)),o&2){let e=d(2);g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?0:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?1:-1)}}function Vd(o,l){if(o&1){let e=C();r(0,"button",58),y("click",function(){u(e);let t=d(2);return _(t.addRoleUserAssignment())}),h(1,"img",59),p(2," Add "),a()}}function Nd(o,l){if(o&1){let e=C();r(0,"div",69),y("click",function(){u(e);let t=d(2).$implicit,n=d(2);return _(n.allAssignees(t==null?null:t.teamMembers))}),h(1,"img",70),a()}if(o&2){let e=l.$implicit;s(),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge)}}function kd(o,l){if(o&1){let e=C();r(0,"span",71),y("click",function(){u(e);let t=d(2).$implicit,n=d(2);return _(n.allAssignees(t==null?null:t.teamMembers))}),p(1),a()}if(o&2){let e=d(2).$implicit,i=d(2);s(),T(" +",i.getRemainingUserCount(e)," More ")}}function Bd(o,l){if(o&1){let e=C();r(0,"img",72),y("click",function(){u(e);let t=d(2).$index,n=d(2);return _(n.deleteAddedUsed(t))}),a()}}function Pd(o,l){if(o&1&&(r(0,"div",60)(1,"div",61)(2,"div",62),p(3),a(),r(4,"div",63)(5,"div",64),D(6,Nd,2,1,"div",65,bd),a(),x(8,kd,2,1,"span",66),a()(),r(9,"div",67),x(10,Bd,1,0,"img",68),a()()),o&2){let e=d().$implicit,i=d(2);s(3),T(" ",i.getRoleName(e)," "),s(3),V(i.getDisplayUsers(e)),s(2),g(i.getRemainingUserCount(e)>
220?8:-1),s(2),g(i.isViewOnly?-1:10)}}function Ld(o,l){if(o&1&&x(0,Pd,11,3,"div",60),o&2){let e=l.$implicit,i=d(2);g(i.isRoleSelected(e)?0:-1)}}function Rd(o,l){o&1&&(r(0,"div",30),p(1," No records to show "),a())}function Fd(o,l){if(o&1){let e=C();r(0,"input",88),y("input",function(t){u(e);let n=d().$implicit,c=d(2).$index,f=d(3);return _(f.updateUserWeightedOnInput(c,n.userId,t.target.value))})("blur",function(t){u(e);let n=d().$implicit,c=d(2).$index,f=d(3);return _(f.validateUserWeighted(c,n.userId,t.target.value))}),a()}if(o&2){let e=d().$implicit,i=d(5);m("value",e.weighted)("disabled",i.isViewOnly)}}function Ud(o,l){o&1&&(r(0,"div",87),p(1," All "),a())}function Wd(o,l){if(o&1&&(r(0,"div",80)(1,"div",81)(2,"div",82),h(3,"img",83),a(),r(4,"div",84)(5,"p",37),p(6),a()()(),r(7,"div",85),x(8,Fd,1,2,"input",86)(9,Ud,2,0,"div",87),a()()),o&2){let e=l.$implicit,i=d(2).$index,t=d(3);s(3),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge),s(3),T(" ",(e==null?null:e.name)||(e==null?null:e.firstName)+" "+(e==null?null:e.lastName)," "),s(2),g(t.getUserSelectedCount(i)>1?8:9)}}function jd(o,l){if(o&1&&(r(0,"div",75)(1,"div",76)(2,"h2",22),p(3),a(),r(4,"div",77),h(5,"img",12),a()(),r(6,"div",78)(7,"div",21)(8,"h4",79),p(9," Team members "),a(),r(10,"h4",79),p(11," Leads assigned per turn "),a()(),r(12,"div",78),D(13,Wd,10,3,"div",80,Ht().trackByUserId,!0),a()()()),o&2){let e=d(),i=e.$implicit,t=e.$index,n=d(3);s(3),je(" ",n.getRoleName(i)," (",n.getUserSelectedCount(t),") "),s(10),V(n.getRoleUserData(i,t))}}function qd(o,l){if(o&1&&x(0,jd,15,2,"div",75),o&2){let e=l.$implicit,i=d(3);g(i.isRoleSelected(e)?0:-1)}}function Gd(o,l){if(o&1&&(r(0,"div",19)(1,"h2",73),p(2," Configure distribution "),a(),r(3,"div",74),D(4,qd,1,1,null,null,k),a()()),o&2){let e=d(2);s(4),V(e.addedRoleUserList)}}function Hd(o,l){if(o&1){let e=C();r(0,"div",13),x(1,Dd,2,2),r(2,"div",19)(3,"div",20)(4,"div",21)(5,"h2",22),p(6," Select roles and team members "),a(),r(7,"div",23),h(8,"svg-icon",24),a()(),x(9,Vd,3,0,"button",25),a(),r(10,"div",26)(11,"div",27)(12,"h4",28),p(13," Role "),h(14,"img",29),a(),r(15,"h4",28),p(16," Assignee "),h(17,"img",29),a()(),r(18,"div",26),D(19,Ld,1,1,null,null,k),x(21,Rd,2,0,"div",30),a()()(),r(22,"div",31)(23,"div",21)(24,"h2",32),p(25," How would you like leads to be assigned? "),a()(),r(26,"div",26)(27,"label",33)(28,"div",34)(29,"input",35),A("ngModelChange",function(t){u(e);let n=d();return I(n.assignedMethod,t)||(n.assignedMethod=t),_(t)}),a(),h(30,"span",36),a(),r(31,"div",21)(32,"h4",37),p(33," Round Robin (Equal Distribution) "),a(),r(34,"div",38),h(35,"svg-icon",39),a()()(),r(36,"label",33)(37,"div",34)(38,"input",40),A("ngModelChange",function(t){u(e);let n=d();return I(n.assignedMethod,t)||(n.assignedMethod=t),_(t)}),a(),h(39,"span",36),a(),r(40,"div",21)(41,"h4",37),p(42," First To Claim "),a(),r(43,"div",41),h(44,"svg-icon",39),a()()(),r(45,"label",33)(46,"div",34)(47,"input",42),A("ngModelChange",function(t){u(e);let n=d();return I(n.assignedMethod,t)||(n.assignedMethod=t),_(t)}),a(),h(48,"span",36),a(),r(49,"div",21)(50,"h4",37),p(51," Manual Assignment "),a(),r(52,"div",41),h(53,"svg-icon",39),a()()(),r(54,"label",33)(55,"div",34)(56,"input",43),A("ngModelChange",function(t){u(e);let n=d();return I(n.assignedMethod,t)||(n.assignedMethod=t),_(t)}),a(),h(57,"span",36),a(),r(58,"div",21)(59,"h4",37),p(60," All Selected Team Members "),a(),r(61,"div",44),h(62,"svg-icon",39),a()()(),r(63,"label",33)(64,"div",34)(65,"input",45),A("ngModelChange",function(t){u(e);let n=d();return I(n.assignedMethod,t)||(n.assignedMethod=t),_(t)}),a(),h(66,"span",36),a(),r(67,"div",21)(68,"h4",37),p(69," Weighted Round-Robin "),a(),r(70,"div",46),h(71,"svg-icon",39),a()()()()(),x(72,Gd,6,0,"div",19),r(73,"div",47),p(74," Modifying the team assignment will affect both current and future leads assigned to the new assignee. "),a()()}if(o&2){let e=d();s(),g(e.showDelayPreference?1:-1),s(8),g(e.isViewOnly?-1:9),s(10),V(e.addedRoleUserList),s(2),g(e.addedRoleUserList!=null&&e.addedRoleUserList.length?-1:21),s(6),m("ngClass",e.isViewOnl
22y?"":"cursor-pointer"),s(2),m("name","assignedMethod_"+e.stepIndex),w("ngModel",e.assignedMethod),m("disabled",e.isViewOnly),s(5),m("ngClass",e.assignedMethod=="ROUND_ROBIN"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"border-transparency-25"),s(),m("src",e.assignedMethod=="ROUND_ROBIN"?"assets/images/icons/info-teal.svg":"assets/images/icons/info.svg"),s(),de("opacity-50",e.isAssignmentMethodDisabled("FIRST_TO_CLAIM")&&!e.isViewOnly),m("ngClass",!e.isViewOnly&&!e.isAssignmentMethodDisabled("FIRST_TO_CLAIM")?"cursor-pointer":""),s(2),m("name","assignedMethod_"+e.stepIndex),w("ngModel",e.assignedMethod),m("disabled",e.isAssignmentMethodDisabled("FIRST_TO_CLAIM")),s(5),m("ngClass",e.assignedMethod=="FIRST_TO_CLAIM"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"border-transparency-25")("pTooltip",e.getAssignmentMethodUnavailableTooltip("FIRST_TO_CLAIM")||"A new lead becomes available to the entire team, and the first team member to click \u2018Claim\u2019 gets the lead."),s(),m("src",e.assignedMethod=="FIRST_TO_CLAIM"?"assets/images/icons/info-teal.svg":"assets/images/icons/info.svg"),s(),de("opacity-50",e.isAssignmentMethodDisabled("MANUAL_ASSIGNMENT")&&!e.isViewOnly),m("ngClass",!e.isViewOnly&&!e.isAssignmentMethodDisabled("MANUAL_ASSIGNMENT")?"cursor-pointer":""),s(2),m("name","assignedMethod_"+e.stepIndex),w("ngModel",e.assignedMethod),m("disabled",e.isAssignmentMethodDisabled("MANUAL_ASSIGNMENT")),s(5),m("ngClass",e.assignedMethod=="MANUAL_ASSIGNMENT"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"border-transparency-25")("pTooltip",e.getAssignmentMethodUnavailableTooltip("MANUAL_ASSIGNMENT")||"Leads are not assigned automatically. Users with permission to assign unassigned leads can manually choose the assignee for each lead."),s(),m("src",e.assignedMethod=="MANUAL_ASSIGNMENT"?"assets/images/icons/info-teal.svg":"assets/images/icons/info.svg"),s(),m("ngClass",e.isViewOnly?"":"cursor-pointer"),s(2),m("name","assignedMethod_"+e.stepIndex),w("ngModel",e.assignedMethod),m("disabled",e.isViewOnly),s(5),m("ngClass",e.assignedMethod=="ALL_SELECTED"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"border-transparency-25"),s(),m("src",e.assignedMethod=="ALL_SELECTED"?"assets/images/icons/info-teal.svg":"assets/images/icons/info.svg"),s(),m("ngClass",e.isViewOnly?"":"cursor-pointer"),s(2),m("name","assignedMethod_"+e.stepIndex),w("ngModel",e.assignedMethod),m("disabled",e.isViewOnly),s(5),m("ngClass",e.assignedMethod=="WEIGHTED_ROUND_ROBIN"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"border-transparency-25"),s(),m("src",e.assignedMethod=="WEIGHTED_ROUND_ROBIN"?"assets/images/icons/info-teal.svg":"assets/images/icons/info.svg"),s(),g(e.assignedMethod=="WEIGHTED_ROUND_ROBIN"?72:-1)}}var bd,tn,nn=ee(()=>{W();ci();pi();Re();W();fe();Ce();Ee();xe();at();lt();be();se();pe();Ve();He();bd=(o,l)=>l._id||l.userId;tn=(()=>{class o{constructor(e,i,t,n,c,f){this._dialog=e,this._loaderService=i,this._toastrService=t,this._commonFunctions=n,this._automationService=c,this._userService=f,this.previewText="4 Roles configured. Weighted Round Robbin",this.payload={},this.stepIndex=-1,this.actionId=-1,this.isViewOnly=!1,this.automationType="",this.moduleId="",this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.disableDelete=!1,this.showFirstToAnswerOption=!0,this.showDelayPreference=!0,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.assignedMethod="ROUND_ROBIN",this.addedRoleUserList=[],this.allUsers=[],this.roleUserDataCache=new Map,this.initialAssignedMethod="",this.initialAddedRoleUserList=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.restrictedAssignmentMethods=["FIRST_TO_ANSWER","MANUAL_ASSIGNMENT","FIRST_TO_CLAIM"],this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.coerceAssignedMethodIfUnavailable(),this.getRoleList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.coerceAssignedMethodIfUnavailable(),this.isInitialStateCaptured=!1,this.getRoleList()),(e.showFirstToAnswerOption||e.moduleId||e.disableDelete||e.automationType)&&this.coerceAssignedMethodIfUnavailable()}get isInventoryModule(){return(typeof this.moduleId=="object"&&this.moduleId!=null?this.moduleId?._id:this.moduleId)===O.MainStatusId.INVENTORY}get isLeadsModule(){return this.moduleId===O.MainStatusId.LEAD}get isTransactionModule(){return(typeof this.moduleId=="object"&&this.moduleId!=null?this.moduleId?._id:this.moduleId)===O.MainStatusId.WHOLESALEPIPELINE}get isSoldModule(){return(typeof this.moduleId=="object"&&this.moduleId!=null?this.moduleId?._id:this.moduleId)===O.MainStatusId.SOLD}get isRentalModule(){return(typeof this.moduleId=="object"&&this.moduleId!=null?this.moduleId?._id:this.moduleId)===O.MainStatusId.RENTAL}get isDefaultAssignTeamMembersStep(){return this.disableDelete}get showStepExecutionInfoTooltip(){return this.isDefaultAssignTeamMembersStep&&this.isLeadsModule}
22isAssignmentMethodDisabled(e){return this.isViewOnly?!0:this.isRestrictedAssignmentMethod(e)?this.isTransactionModule||this.isSoldModule||this.isRentalModule?!0:this.isLeadsModule?!(this.automationType==="LEAD_CREATED"&&this.isDefaultAssignTeamMembersStep):this.isInventoryModule?this.automationType==="NEW_INVENTORY_ADDED"&&this.isDefaultAssignTeamMembersStep?e==="FIRST_TO_ANSWER":!0:e==="FIRST_TO_ANSWER"&&!this.showFirstToAnswerOption:!1}getAssignmentMethodUnavailableTooltip(e){return!this.isRestrictedAssignmentMethod(e)||!this.isAssignmentMethodDisabled(e)||this.isViewOnly?"":this.isTransactionModule?"This option is not available in Transaction Management":this.isSoldModule?"This option is not available in Sold":this.isRentalModule?"This option is not available in Rental.":this.isInventoryModule?"This option is not available in inventory":"Not available"}isRestrictedAssignmentMethod(e){return this.restrictedAssignmentMethods.includes(e)}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),this.payload?.assignmentMethod&&(this.assignedMethod=this.payload?.assignmentMethod||"",this.addedRoleUserList=[])}coerceAssignedMethodIfUnavailable(){this.isAssignmentMethodDisabled(this.assignedMethod)&&(this.assignedMethod="ROUND_ROBIN")}getRoleList(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).subscribe(i=>{if(i?.statusCode==200){this.allUsers=i?.data?.items||[];let t={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(t).subscribe(n=>{n?.statusCode==200&&(this.addedRoleUserList=[],this.payload?.roles&&Array.isArray(this.payload?.roles)&&(this.roleUserDataCache.clear(),this.payload?.roles.forEach(c=>{c?.roleId&&Array.isArray(c?.teamMembers)&&c?.teamMembers?.length>0&&this.addedRoleUserList.push({roleId:c?.roleId,roleName:c?.roleName||"",teamMembers:c?.teamMembers?.map(f=>({userId:f?.userId,weighted:f?.weighted||1,remainingWeighted:f?.remainingWeighted||1}))})})),this.captureInitialState()),this._loaderService.stop()},n=>{this._loaderService.stop()})}},()=>{})}addRoleUserAssignment(){this.dialogRef=this._dialog.open(ei,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{addedRoleUserList:this.addedRoleUserList,hideNotInRole:!0}}),this.dialogRef.afterClosed().subscribe(e=>{if(e){let i=new Map;this.addedRoleUserList?.forEach((n,c)=>{let f=n?.roleId?`role-${n?.roleId}`:`index-${c}`,S=this.roleUserDataCache.get(f);S&&S?.forEach(v=>{if(v?.userId&&v?.weighted!==void 0){let b=`${f}-${v?.userId}`;i.set(b,v?.weighted)}}),n?.teamMembers&&n?.teamMembers?.forEach(v=>{if(v?.userId&&v?.weighted!==void 0){let b=`${f}-${v?.userId}`;i.set(b,v?.weighted)}})});let t=e?.addedRoleUserList||e||[];t?.forEach((n,c)=>{if(n?.teamMembers){let f=null;if(n?.roleId){let S=this.addedRoleUserList?.findIndex(v=>v?.roleId===n?.roleId);S!==-1&&S!==void 0?f=`role-${n?.roleId}`:f=`index-${c}`}else f=`index-${c}`;n?.teamMembers?.forEach(S=>{if(S?.userId){let v=`${f}-${S?.userId}`;i.has(v)?S.weighted=i.get(v):S?.weighted===void 0&&(S.weighted=1)}})}}),this.addedRoleUserList=t,this.roleUserDataCache.clear()}})}allAssignees(e){let i=[];e?.forEach(t=>{let n=this.allUsers?.find(c=>c?._id===t?.userId);i.push({_id:t?.userId,userId:t?.userId,email:n?.email||"",profileImage:n?.profileImage||"",firstName:n?.name?.split(" ")[0]||n?.firstName||"",lastName:n?.name?.split(" ").slice(1).join(" ")||n?.lastName||"",name:n?.name||"",weighted:t?.weighted||1,remainingWeighted:t?.remainingWeighted||1,show:!0,selected:!0})}),this.dialogRef=this._dialog.open(ti,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",data:{roleData:i}}),this.dialogRef.afterClosed().subscribe(t=>{})}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.showDelayPreference?this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:"":""}deleteAddedUsed(e){this.addedRoleUserList.splice(e,1)}getUserSelectedCount(e){let i=this.addedRoleUserList?.[e];return i&&i.teamMembers?.length||0}getRoleUserData(e,i){if(!e||!e?.teamMembers||!Array.isArray(e?.teamMembers))return[];let t=e?.roleId?`role-${e.roleId}`:i!==void 0?`index-${i}`:null;if(!t)return this.createUserDataFromRole(e);
22if(this.roleUserDataCache.has(t)){let n=this.roleUserDataCache.get(t);if(n&&e?.teamMembers){let c=new Set(n?.map(S=>S?.userId)),f=new Set(e?.teamMembers?.map(S=>S?.userId));return c.size!==f.size||![...c].every(S=>f.has(S))?this.rebuildCacheForRole(e,t):(n?.forEach(S=>{let v=e?.teamMembers?.find(b=>b?.userId===S?.userId);v&&(S.weighted=v?.weighted!==void 0?v?.weighted:S?.weighted||1,S.remainingWeighted=v?.remainingWeighted||1)}),n)}}return this.rebuildCacheForRole(e,t)}createUserDataFromRole(e){if(!e?.teamMembers||!Array.isArray(e.teamMembers))return[];let i=new Set,t=[];for(let n of e.teamMembers){let c=n?.userId??n?._id;if(c==null||c===""||i.has(String(c)))continue;i.add(String(c));let f=this.allUsers?.find(S=>S?._id===n?.userId||S?._id===n?._id);t.push({_id:c,userId:c,email:f?.email||"",profileImage:f?.profileImage||"",firstName:f?.name?.split(" ")[0]||f?.firstName||"",lastName:f?.name?.split(" ").slice(1).join(" ")||f?.lastName||"",name:f?.name||"",weighted:n?.weighted??1,remainingWeighted:n?.remainingWeighted??1,show:!0,selected:!0})}return t}rebuildCacheForRole(e,i){let t=this.createUserDataFromRole(e);return i&&this.roleUserDataCache.set(i,t),t}getDisplayUsers(e){return this.getRoleUserData(e)?.slice(0,4)||[]}getRemainingUserCount(e){let t=(this.getRoleUserData(e)?.length||0)-4;return t>0?t:0}isRoleSelected(e){return e&&Array.isArray(e?.teamMembers)&&e?.teamMembers?.length>0}getRoleName(e){return e?.roleName||e?.name||""}updateUserWeightedOnInput(e,i,t){let n=this.addedRoleUserList?.[e];if(n&&n?.teamMembers){let c=n?.teamMembers?.find(f=>f?.userId===i);if(c){let f=Number(t);if(!isNaN(f)){c.weighted=f;let S=n?.roleId?`role-${n.roleId}`:`index-${e}`,v=this.roleUserDataCache.get(S);if(v){let b=v?.find(N=>N?.userId===i);b&&(b.weighted=f)}}}}}validateUserWeighted(e,i,t){let n=this.addedRoleUserList?.[e];if(n&&n?.teamMembers){let c=n?.teamMembers?.find(f=>f?.userId===i);if(c){let f=t===""||t===null||t===void 0?1:Number(t),S=isNaN(f)||f<1?1:f;c.weighted=S;let v=n?.roleId?`role-${n.roleId}`:`index-${e}`,b=this.roleUserDataCache.get(v);if(b){let N=b.find(j=>j?.userId===i);N&&(N.weighted=S)}}}}updateUserWeighted(e,i,t){this.validateUserWeighted(e,i,t)}getUserWeighted(e,i){let t=this.addedRoleUserList?.[e];return t&&t?.teamMembers&&t?.teamMembers?.find(c=>c?.userId===i)?.weighted||1}trackByUserId(e,i){return i?.userId||e}getPreview(){let e="";return e=`${this.addedRoleUserList?.filter(t=>this.isRoleSelected(t)).length||0} Roles configured. `,e+=this.assignedMethod=="ROUND_ROBIN"?"Round Robin (Equal Distribution)":this.assignedMethod=="FIRST_TO_CLAIM"?"First To Claim":this.assignedMethod=="FIRST_TO_ANSWER"?"First To Answer":this.assignedMethod=="MANUAL_ASSIGNMENT"?"Manual Assignment":this.assignedMethod=="ALL_SELECTED"?"All Selected Team Members":"Weighted Round-Robin",e}captureInitialState(){this.isInitialStateCaptured||(this.initialAssignedMethod=this.assignedMethod||"",this.initialAddedRoleUserList=this.addedRoleUserList?JSON.parse(JSON.stringify(this.addedRoleUserList)):[],this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;if(this.assignedMethod!==this.initialAssignedMethod)return!0;let e=n=>!n||!Array.isArray(n)?[]:n.map(c=>{let f={roleId:c?.roleId||"",roleName:c?.roleName||"",teamMembers:[]};return c?.teamMembers&&Array.isArray(c.teamMembers)&&(f.teamMembers=c.teamMembers.map(S=>({userId:S?.userId||"",weighted:S?.weighted||1,remainingWeighted:S?.remainingWeighted||1})).sort((S,v)=>S.userId>v.userId?1:S.userId<v.userId?-1:0)),f}).sort((c,f)=>c.roleId>f.roleId?1:c.roleId<f.roleId?-1:0),i=e(this.addedRoleUserList),t=e(this.initialAddedRoleUserList);return!!(JSON.stringify(i)!==JSON.stringify(t)||this.showDelayPreference&&(JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)))}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(H),E(Y),E(q),E(Me),E(De))}}static{this.\u0275cmp=B({type:o,selectors:[["app-assign-team-members-box"]],inputs:{previewText:"previewText",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",isViewOnl
vendor: 5,854 bytes, line 22
22y:"isViewOnly",automationType:"automationType",moduleId:"moduleId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",disableDelete:"disableDelete",showFirstToAnswerOption:"showFirstToAnswerOption",showDelayPreference:"showDelayPreference"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:16,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-between","items-center","gap-[10px]"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-phlox","rounded-[20px]"],["src","assets/images/icons/team-white.svg","alt","team-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Assign Team Members",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[5px]"],[1,"flex","items-center","gap-[10px]"],[1,"text-h2","text-transparency-100","font-semibold"],["pTooltip","Select roles and team members you would like to be assigned","tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","items-center","gap-[10px]","pr-[30px]"],[1,"flex-[1_0_0]","flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"group","flex","items-center","justify-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","p-[8px]"],[1,"flex","flex-col","gap-[15px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[10px]","select-none",3,"ngClass"],[1,"re-custom-radio-2"],["type","radio","value","ROUND_ROBIN",3,"ngModelChange","name","ngModel","disabled"],[1,"check-mark"],[1,"text-h4","text-transparency-100","font-semibold"],["pTooltip","Automatically assigns each new lead to the next available team member in a rotating sequence so everyone receives an equal number of leads.","tooltipPosition","top",1,"flex","items-center","p-[2px]","border-solid","rounded-[30px]","border-[1px]",3,"ngClass"],["svgClass","w-[18px] h-[18px] block",3,"src"],["type","radio","value","FIRST_TO_CLAIM",3,"ngModelChange","name","ngModel","disabled"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","border-solid","rounded-[30px]","border-[1px]",3,"ngClass","pTooltip"],["type","radio","value","MANUAL_ASSIGNMENT",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","ALL_SELECTED",3,"ngModelChange","name","ngModel","disabled"],["pTooltip","Every new lead is assigned to all selected team members simultaneously \u2014 useful for teams where multiple people follow up or collaborate.","tooltipPosition","top",1,"flex","items-center","p-[2px]","border-solid","rounded-[30px]","border-[1px]",3,"ngClass"],["type","radio","value","WEIGHTED_ROUND_ROBIN",3,"ngModelChange","name","ngModel","disabled"],["pTooltip","Leads are distributed based on customizable weights. Team members with higher weights receive more leads than others.","tooltipPosition","top",1,"flex","items-center","p-[2px]","rounded-[30px]","border-[1px]","border-solid",3,"ngClass"],[1,"text-label","leading-[normal]","text-transparency-100","font-medium","opacity-60"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
22px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],[1,"group","flex","items-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","hover:bg-transparency-10","hover:border-transparency-25"],[1,"flex-[1_0_0]","flex","items-center","gap-[10px]"],[1,"w-1/2","text-h4","text-transparency-100","font-semibold","p-[8px]","truncate"],[1,"w-1/2","flex","items-center","gap-[3px]","p-[7px]"],[1,"flex","items-center","-space-x-[10px]"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90"],[1,"flex-none","flex","items-center","mr-2","cursor-pointer","opacity-0","group-hover:opacity-100"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","30","height","30",1,"img-fluid"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer",3,"click"],["alt","demo-profile","width","34","height","34",1,"img-fluid",3,"src"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90",3,"click"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","30","height","30",1,"img-fluid",3,"click"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"flex","flex-col","gap-[15px]","p-[20px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[10px]"],[1,"flex-none","flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer","rotate-180"],[1,"flex","flex-col","gap-[15px]"],[1,"flex-[1_0_0]","text-h4","text-transparency-100","font-semibold"],[1,"flex","items-center","self-stretch","gap-[10px]","px-[5px]","bg-transparency-10","rounded-[10px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex-[1_0_0]","flex","items-center","gap-[10px]","py-[9px]","px-[5px]"],[1,"flex-none","flex","items-center","relative"],["alt","demo-profile","width","34","height","34",1,"img-fluid","rounded-full","border-[2px]","border-solid","border-transparency-0",3,"src"],[1,"flex","flex-col","items-start","gap-[1px]"],[1,"flex-[1_0_0]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[11px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]"],["type","number","placeholder","Lead Assigned",1,"text-transparency-100","font-semibold","bg-transparency-0","focus:outline-none",3,"value","disabled"],[1,"flex-[1_0_0]","text-h4","text-transparency-100","font-semibold","bg-transparency-25","px-[10px]","py-[11px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]"],["type","number","placeholder","Lead Assigned",1,"text-transparency-100","font-semibold","bg-transparency-0","focus:outline-none",3,"input","blur","value","disabled"]],template:function(i,t){i&1&&(x(0,Sd,4,1,"div",0),r(1,"div",1)(2,"div",2),h(3,"img",3),a(),r(4,"div",4)(5,"div",5)(6,"h2",6),p(7," Assign Team Members "),a()(),x(8,Td,2,1,"h4",7),a(),r(9,"div",8)(10,"div",9),p(11),a(),x(12,vd,2,0,"div",10),r(13,"div",11),y("click",function(){return t.onToggleExpanded()}),h(14,"img",12),a()()(),x(15,Hd,75,40,"div",13)),i&2&&(g(t.showDelayPreference?0:-1),s(8),g(t.isExpanded?-1:8),s(3),T(" Step ",t.stepIndex+1," "),s(),g(!t.isViewOnl
22y&&!t.disableDelete?12:-1),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?15:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z,he],encapsulation:2})}}return o})()});function zd(o,l){if(o&1){let e=C();r(0,"label",23)(1,"div",24)(2,"input",25),A("ngModelChange",function(t){let n=u(e).$implicit;return I(n.selected,t)||(n.selected=t),_(t)}),a(),h(3,"span",26),a(),r(4,"div",27),h(5,"img",28),a(),r(6,"span",29),p(7),a()()}if(o&2){let e=l.$implicit;s(2),w("ngModel",e.selected),s(3),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge),s(2),je("",e==null?null:e.firstName," ",e==null?null:e.lastName)}}function Jd(o,l){if(o&1){let e=C();r(0,"div",11)(1,"div",17)(2,"label",18),p(3,"Select user"),a(),r(4,"div",19),h(5,"img",20),r(6,"input",21),A("ngModelChange",function(t){u(e);let n=d();return I(n.searchUser,t)||(n.searchUser=t),_(t)}),a()()(),r(7,"div",22),D(8,zd,8,4,"label",23,ja),a()()}if(o&2){let e=d();s(6),w("ngModel",e.searchUser),s(2),V(e.filteredUsers)}}function Qd(o,l){if(o&1){let e=C();r(0,"label",23)(1,"div",24)(2,"input",25),A("ngModelChange",function(t){let n=u(e).$implicit;return I(n.selected,t)||(n.selected=t),_(t)}),a(),h(3,"span",26),a(),r(4,"span",29),p(5),a()()}if(o&2){let e=l.$implicit;s(2),w("ngModel",e.selected),s(3),ce(e==null?null:e.name)}}function $d(o,l){if(o&1){let e=C();r(0,"div",11)(1,"div",17)(2,"label",18),p(3,"Select role"),a(),r(4,"div",19),h(5,"img",20),r(6,"input",30),A("ngModelChange",function(t){u(e);let n=d();return I(n.searchRole,t)||(n.searchRole=t),_(t)}),a()()(),r(7,"div",22),D(8,Qd,6,2,"label",23,ja),a()()}if(o&2){let e=d();s(6),w("ngModel",e.searchRole),s(2),V(e.filteredRoles)}}var ja,ii,mi=ee(()=>{fe();$e();dt();W();fe();Ce();Ee();lt();se();pe();kt();ja=(o,l)=>l._id??o;ii=(()=>{class o{constructor(e,i,t,n,c){this.data=e,this.dialog=i,this._loaderService=t,this._toastrService=n,this._userService=c,this.destroy$=new Be,this.allRoleList=[],this.userList=[],this.searchRole="",this.searchUser="",this.data?.notificationType==="BYMEMEBR"?this.getSubUserList():this.getRoleList()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getSubUserList(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._loaderService.start(),this._userService.getSubUserList(e).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:i=>{if(i?.statusCode!==200)return;let t=i?.data?.items||[],n=new Set((this.data?.teamMemberIds||[]).map(c=>String(c)));this.userList=t.map(c=>this.mapSubUserToListItem(c,n))},error:()=>{this._toastrService.showError("Failed to load users. Please try again.")}})}mapSubUserToListItem(e,i){let t=(e?.name||"").trim().split(/\s+/).filter(Boolean);return P(M({},e),{firstName:e?.firstName||t[0]||"",lastName:e?.lastName||t.slice(1).join(" ")||"",selected:i.has(String(e?._id))})}getRoleList(){let e={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(e).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:i=>{if(i?.statusCode===200){this.allRoleList=i?.data?.items||[],this.userList=[],this.allRoleList.forEach(n=>{n.selected=this.data?.roleIds?.includes(n?._id);let c=new Set(this.userList.map(S=>S?._id)),f=(n?.userData||[]).filter(S=>S?._id&&!c.has(S._id));this.userList=[...this.userList,...f]});let t=new Set((this.data?.teamMemberIds||[]).map(n=>String(n)));this.userList.forEach(n=>{n.selected=t.has(String(n?._id))})}},error:()=>{this._toastrService.showError("Failed to load roles. Please try again.")}})}saveData(){if(this.data?.notificationType==="BYROLE"){let i=[];this.allRoleList.forEach(t=>{t?.selected&&i.push(t?._id)}),this.dialog.close({roleIds:i,teamMemberIds:[]});return}let e=[];this.userList.forEach(i=>{i?.selected&&i?._id!=null&&e.push(String(i._id))}),this.dialog.close({roleIds:[],teamMemberIds:e})}get primaryButtonLabel(){return this.data?.confirmButtonLabel?this.data.confirmButtonLabel:this.data?.notificationType==="BYROLE"?"Confirm Assignee Role":"Confirm selection"}get filteredUsers(){let e=this.searchUser?.trim()?.toLowerCase()||"";return e?this.userList?.filter(i=>
22i?.firstName?.toLowerCase()?.includes(e)||i?.lastName?.toLowerCase()?.includes(e)||i?.name?.toLowerCase()?.includes(e)||i?.email?.toLowerCase()?.includes(e))||[]:this.userList}get filteredRoles(){let e=this.searchRole?.trim()?.toLowerCase()||"";return e?this.allRoleList?.filter(i=>i?.name?.toLowerCase()?.includes(e))||[]:this.allRoleList}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(H),E(Y),E(De))}}static{this.\u0275cmp=B({type:o,selectors:[["app-notification-assignee"]],standalone:!1,decls:20,vars:7,consts:[[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15","h-full","overflow-hidden"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px] block","src","assets/images/icons/user-profile.svg",1,"text-transparency-100"],[1,"flex-1"],[1,"text-h1","text-transparency-100","font-semibold"],[1,"text-sub-heading/[normal]","text-transparency-90","font-medium"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px] block","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","flex-1","overflow-auto"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","max-h-[400px]","overflow-y-auto","pr-[5px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","p-[20px]","rounded-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","variant","filled","type","default","size","44",3,"clicked","leftIcon","label"],[1,"w-full"],[1,"text-h2","text-transparency-100","font-semibold","mb-[20px]"],[1,"flex","items-center","self-stretch","relative"],["src","assets/images/header/search.svg","alt","search","width","20",1,"img-fluid","absolute","left-[10px]","top-1/2","-translate-y-1/2"],["type","text","placeholder","Search Users",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","font-semibold","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","ngModel"],[1,"flex","flex-col","self-stretch","gap-[5px]"],[1,"flex","items-center","px-[5px]","py-[10px]","gap-[10px]","cursor-pointer","select-none"],[1,"re-custom-checkbox"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"checkmark"],[1,"flex-none","size-[34px]","overflow-hidden","rounded-full","border-[2px]","border-solid","border-transparency-0"],["alt","demo-profile",1,"h-full","w-full","object-cover",3,"src"],[1,"text-h4","text-transparency-100","font-semibold"],["type","text","placeholder","Search Roles",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","font-semibold","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","ngModel"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),h(3,"svg-icon",3),r(4,"div",4)(5,"h1",5),p(6),a(),r(7,"p",6),p(8),a()()(),r(9,"button",7),h(10,"svg-icon",8),a()(),r(11,"div",9)(12,"div",10),x(13,Jd,10,1,"div",11),x(14,$d,10,1,"div",11),a()(),r(15,"div",12),h(16,"svg-icon",13),a(),r(17,"div",14),h(18,"app-button",15),r(19,"app-button",16),y("clicked",function(){return t.saveData()}),a()()()),i&2&&(s(6),T(" ",(t.data==null?null:t.data.dialogTitle)||"
22Notification Assignee: Select "+((t.data==null?null:t.data.notificationType)=="BYROLE"?"Role":"Member")," "),s(2),T(" ",(t.data==null?null:t.data.dialogSubtitle)||"Select "+((t.data==null?null:t.data.notificationType)=="BYROLE"?"role":"user")+" who should receive the notification"," "),s(5),g((t.data==null?null:t.data.notificationType)=="BYMEMEBR"?13:-1),s(),g((t.data==null?null:t.data.notificationType)=="BYROLE"?14:-1),s(4),m("leftIcon",!1),s(),m("leftIcon",!1)("label",t.primaryButtonLabel))},dependencies:[G,Ke,F,U,Ze,L,et],encapsulation:2})}}return o})()});function Kd(o,l){if(o&1&&(r(0,"div",6),h(1,"svg-icon",14),a()),o&2){let e=d();m("pTooltip",e.stepExecutionInfoTooltip)}}function Xd(o,l){if(o&1&&(r(0,"h4",7),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Zd(o,l){if(o&1){let e=C();r(0,"div",15),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",16),a()}}function ec(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function tc(o,l){if(o&1){let e=C();r(0,"div",17)(1,"div",26)(2,"label",27),p(3," Delay before executing this step "),h(4,"img",28),a(),r(5,"div",29)(6,"input",30),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",31),y("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,ec,2,1,"p",32),a()()}if(o&2){let e=d(3);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function ic(o,l){if(o&1&&(r(0,"option",36),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function nc(o,l){if(o&1){let e=C();r(0,"select",33),y("ngModelChange",function(t){u(e);let n=d(4);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,ic,2,2,"option",36,k),a()}if(o&2){let e=d(4);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function oc(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function ac(o,l){if(o&1){let e=C();r(0,"div",17)(1,"div",26)(2,"label",27),p(3," Execute on "),h(4,"img",28),a(),r(5,"div",29)(6,"select",33),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,nc,3,2,"select",35),a(),x(11,oc,2,1,"p",32),a()()}if(o&2){let e=d(3);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function rc(o,l){if(o&1&&(x(0,tc,17,5,"div",17),x(1,ac,12,6,"div",17)),o&2){let e=d(2);g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?0:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?1:-1)}}function lc(o,l){if(o&1){let e=C();r(0,"button",37),y("click",function(){u(e);let t=d(2);return _(t.openAddUsers())}),h(1,"img",38),p(2," Add "),a()}}function sc(o,l){o&1&&(r(0,"p",25),p(1,"Loading users..."),a())}function dc(o,l){if(o&1&&h(0,"img",42),o&2){let e=d().$implicit;m("src",e.profileImage,ge)}}function cc(o,l){if(o&1&&(r(0,"span",43),p(1),a()),o&2){let e=d().$implicit,i=d(3);s(),ce(i.getInitials(e.name))}}function pc(o,l){if(o&1){let e=C();r(0,"button",46),y("click",function(){u(e);let t=d().$index,n=d(3);return _(n.removeUser(t))}),h(1,"svg-icon",47),a()}}function mc(o,l){if(o&1&&(r(0,"div",39)(1,"div",40)(2,"div",41),x(3,dc,1,1,"img",42)(4,cc,2,1,"span",43),a(),r(5,"span",44),p(6),a()(),x(7,pc,2,0,"button",45),a()),o&2){let e=l.$implicit,i=d(3);
22s(3),g(e.profileImage?3:4),s(3),ce(e.name),s(),g(i.isViewOnly?-1:7)}}function uc(o,l){o&1&&(r(0,"p",25),p(1," No users added yet. Use Add to select team members. "),a())}function _c(o,l){if(o&1&&(D(0,mc,8,3,"div",39,Ht().trackByUserId,!0),x(2,uc,2,0,"p",25)),o&2){let e=d(2);V(e.ownerUsers),s(2),g(e.ownerUsers.length===0?2:-1)}}function hc(o,l){if(o&1&&(r(0,"div",13),x(1,rc,2,2),r(2,"div",17)(3,"div",18)(4,"div",19)(5,"h2",20),p(6),a(),r(7,"div",21),h(8,"svg-icon",22),a()(),x(9,lc,3,0,"button",23),a(),r(10,"div",24),x(11,sc,2,0,"p",25)(12,_c,3,1),a()()()),o&2){let e=d();s(),g(e.showDelayPreference?1:-1),s(4),m("pTooltip",e.subheaderLabel),s(),T(" ",e.subheaderLabel," "),s(3),g(e.isViewOnly?-1:9),s(2),g(e.ownersListReady?12:11)}}var on,an=ee(()=>{W();mi();Re();W();fe();lt();xe();be();se();pe();Ve();He();on=(()=>{class o{constructor(e,i,t){this._dialog=e,this._userService=i,this._commonFunctions=t,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.isViewOnly=!1,this.automationType="",this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.disableDelete=!1,this.showDelayPreference=!0,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.ownersListReady=!1,this.ownerUsers=[],this.allUsers=[],this.initialOwnerUserIds=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.ownersListReady=!1,this.applyDelayFromPayload(),this.applyOwnersFromPayload(),this.loadUsersAndEnrich()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyDelayFromPayload(),this.applyOwnersFromPayload(),this.enrichOwnerNamesFromAllUsers(),this.isInitialStateCaptured=!1,this.captureInitialState())}get isDefaultWhoOwnsThisContactStep(){return this.disableDelete}get cardTitle(){return this.moduleId===O.MainStatusId.BUYER?"Who Owns this Buyer Contact":this.moduleId===O.MainStatusId.AGENT?"Who Owns this Agent Contact":this.moduleId===O.MainStatusId.VENDOR?"Who Owns this Vendor Contact":this.moduleId===O.MainStatusId.LISTSTACKING?"Who owns this list stacking property":"Who Owns this Contact"}getOwnerContactTypeNoun(){return this.moduleId===O.MainStatusId.BUYER?"buyer":this.moduleId===O.MainStatusId.AGENT?"agent":this.moduleId===O.MainStatusId.VENDOR?"vendor":this.moduleId===O.MainStatusId.LISTSTACKING?"list stacking property":"contact"}get subheaderLabel(){return this.moduleId===O.MainStatusId.BUYER?"Users who own this buyer contact":this.moduleId===O.MainStatusId.AGENT?"Users who own this agent contact":this.moduleId===O.MainStatusId.VENDOR?"Users who own this vendor contact":this.moduleId===O.MainStatusId.LISTSTACKING?"Users who own this list stacking property":"Users who own this contact"}get stepExecutionInfoTooltip(){return`This step executes only when the ${this.getOwnerContactTypeNoun()} is created via Call or SMS, and is skipped for manual or web form creations.`}get ownerIdsForSave(){return(this.ownerUsers||[]).map(e=>e.userId)}onToggleExpanded(){this.isExpanded=!this.isExpanded}getPreview(){let e=this.ownerUsers?.length||0;return e===0?"No users selected":e===1?"1 user":`${e} users`}openAddUsers(){let e=this.getOwnerContactTypeNoun();this.dialogRef=this._dialog.open(ii,{disableClose:!0,width:"800px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{roleIds:[],teamMemberIds:this.ownerUsers.map(i=>i.userId),notificationType:"BYMEMEBR",dialogTitle:"Select User",dialogSubtitle:`Select user who owns this ${e}`,confirmButtonLabel:"Save selection"}}),this.dialogRef.afterClosed().subscribe(i=>{if(!i?.teamMemberIds)return;let t=i.teamMemberIds,n=[],c=new Set;for(let f of t){let S=String(f);if(!S||c.has(S))continue;c.add(S);let v=this.allUsers.find(b=>String(b?._id)===S);n.push({userId:S,name:v?.name||this.formatName(v)||"User",profileImage:v?.profileImage})}this.ownerUsers=n})}removeUser(e){this.isViewOnly||(this.ownerUsers=this.ownerUsers.filter((i,t)=>t!==e))}hasChanges(){if(!this.isInitialStateCaptured)return!1;let e=[...this.ownerUsers.map(t=>t.userId)].sort().join(","),i=[...this.initialOwnerUserIds].sort().join(",");return!!(e!==i||this.showDelayPreference&&(JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)))}trackByUserId(e,i){return i.userId}
22getInitials(e){let i=(e||"").trim().split(/\s+/).filter(Boolean);return i.length>=2?(i[0][0]+i[i.length-1][0]).toUpperCase():(e||"?").slice(0,2).toUpperCase()}applyDelayFromPayload(){this.payload?.delayBeforeExecuting&&(this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.executeOn=M({},this.payload.executeOn))}applyOwnersFromPayload(){let e=[],i=new Set,t=n=>{!n||i.has(n)||(i.add(n),e.push({userId:n,name:"",profileImage:void 0}))};if(Array.isArray(this.payload?.ownerIds))for(let n of this.payload.ownerIds){let c=typeof n=="string"?n:n?.userId??n?._id;t(c)}else if(Array.isArray(this.payload?.roles))for(let n of this.payload.roles)for(let c of n?.teamMembers||[])t(c?.userId);this.ownerUsers=e}loadUsersAndEnrich(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).subscribe(i=>{i?.statusCode==200&&(this.allUsers=i?.data?.items||[],this.enrichOwnerNamesFromAllUsers()),this.captureInitialState(),this.ownersListReady=!0},()=>{this.captureInitialState(),this.ownersListReady=!0})}enrichOwnerNamesFromAllUsers(){this.ownerUsers=this.ownerUsers.map(e=>{let i=this.allUsers.find(t=>t?._id===e.userId);return{userId:e.userId,name:i?.name||this.formatName(i)||e.name||"User",profileImage:i?.profileImage}})}formatName(e){if(!e)return"";let i=e?.firstName||e?.name?.split(" ")?.[0]||"",t=e?.lastName||e?.name?.split(" ")?.slice(1).join(" ")||"";return`${i} ${t}`.trim()}captureInitialState(){this.isInitialStateCaptured||(this.initialOwnerUserIds=this.ownerUsers.map(e=>e.userId),this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(De),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-who-owns-this-contact"]],inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",isViewOnly:"isViewOnly",automationType:"automationType",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",disableDelete:"disableDelete",showDelayPreference:"showDelayPreference"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:16,vars:8,consts:[[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-phlox","rounded-[20px]"],["src","assets/images/icons/team-white.svg","alt","team","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate",3,"appTooltip"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[10px]"],[1,"flex","items-center","gap-[10px]","min-w-0"],["tooltipPosition","top",1,"text-h2","text-transparency-100","font-semibold","truncate",3,"pTooltip"],["pTooltip","Select team members you would like to be assigned","tooltipPosition","top",1,"flex-none","flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg"],["type","button",1,"flex-none","flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outboun
22d-hover-border","bg-activity-outbound-hover-bg"],[1,"flex","flex-col","gap-[6px]"],[1,"text-h4","text-transparency-90","py-2"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],["type","button",1,"flex-none","flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","add","width","22","height","22",1,"img-fluid"],[1,"flex","items-center","justify-between","gap-[12px]","rounded-[12px]","px-[12px]","py-[5px]","transition-colors","duration-150","ease-out","hover:bg-activity-outbound-hover-bg"],[1,"flex","items-center","gap-[12px]","min-w-0","flex-1"],[1,"flex-none","flex","h-[40px]","w-[40px]","items-center","justify-center","overflow-hidden","rounded-full","border-[2px]","border-solid","border-transparency-0","bg-primary-5","text-h5","font-semibold","text-primary-90"],["alt","",1,"h-full","w-full","object-cover",3,"src"],[1,"uppercase"],[1,"text-h4","text-transparency-100","font-semibold","truncate"],["type","button","aria-label","Remove user",1,"flex","h-[40px]","w-[40px]","shrink-0","items-center","justify-center","rounded-full","text-secondary-red","transition-colors","hover:bg-secondary-red-5"],["type","button","aria-label","Remove user",1,"flex","h-[40px]","w-[40px]","shrink-0","items-center","justify-center","rounded-full","text-secondary-red","transition-colors","hover:bg-secondary-red-5",3,"click"],["src","assets/images/icons/delete-action-1.svg","svgClass","h-[32px] w-[32px] block text-secondary-red",1,"block","[&_svg]:h-[32px]","[&_svg]:w-[32px]"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2),a(),r(3,"div",3)(4,"div",4)(5,"h2",5),p(6),a(),x(7,Kd,2,1,"div",6),a(),x(8,Xd,2,1,"h4",7),a(),r(9,"div",8)(10,"div",9),p(11),a(),x(12,Zd,2,0,"div",10),r(13,"div",11),y("click",function(){return t.onToggleExpanded()}),h(14,"img",12),a()()(),x(15,hc,13,5,"div",13)),i&2&&(s(5),m("appTooltip",t.cardTitle),s(),T(" ",t.cardTitle," "),s(),g(t.isDefaultWhoOwnsThisContactStep?7:-1),s(),g(t.isExpanded?-1:8),s(3),T(" Step ",t.stepIndex+1," "),s(),g(!t.isViewOnly&&!t.disableDelete?12:-1),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?15:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z,he],encapsulation:2})}}return o})()});function gc(o,l){if(o&1&&(r(0,"div",0)(1,"div",16),h(2,"img",17)(3,"span",18),a()()),o&2){let e=d();s(3),m("innerHTML",e.getDelayData(),le)}}function fc(o,l){if(o&1&&(r(0,"h4",9),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function yc(o,l){if(o&1){let e=C();r(0,"div",19),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",20),a()}}function Cc(o,l){if(o&1&&(r(0,"p",28),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function bc(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",22)(2,"label",23),p(3," Delay before executing this step "),h(4,"img",24),a(),r(5,"div",25)(6,"input",26),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",27),y("ngModelChange",function(t){u(e);let n=d(3);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Cc,2,1,"p",28),a()()}if(o&2){let e=d(3);
22s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Sc(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Tc(o,l){if(o&1){let e=C();r(0,"select",29),y("ngModelChange",function(t){u(e);let n=d(4);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Sc,2,2,"option",32,k),a()}if(o&2){let e=d(4);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function vc(o,l){if(o&1&&(r(0,"p",28),p(1),a()),o&2){let e=d(4);s(),T(" ",e.timingSequenceError," ")}}function Ec(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",22)(2,"label",23),p(3," Execute on "),h(4,"img",24),a(),r(5,"div",25)(6,"select",29),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",30),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Tc,3,2,"select",31),a(),x(11,vc,2,1,"p",28),a()()}if(o&2){let e=d(3);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function wc(o,l){if(o&1&&(x(0,bc,17,5,"div",21),x(1,Ec,12,6,"div",21)),o&2){let e=d(2);g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?0:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?1:-1)}}function Ic(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit,i=d(3);m("value",e==null?null:e._id),s(),T(" ",i.formatStatusTitle(e==null?null:e.title)," ")}}function Ac(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",22)(2,"label",23),p(3),h(4,"img",24),a(),r(5,"select",33),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.statusId,t)||(n.statusId=t),_(t)}),r(6,"option",34),p(7,"--Select status--"),a(),D(8,Ic,2,2,"option",32,k),a()()()}if(o&2){let e=d(2);s(3),T("",e.statusSelectLabel," "),s(2),w("ngModel",e.statusId),m("disabled",e.isViewOnly),s(3),V(e.statusData)}}function Mc(o,l){if(o&1&&(r(0,"option",32),p(1),ot(2,"titlecase"),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",mt(2,2,e==null?null:e.title)," ")}}function Oc(o,l){if(o&1){let e=C();r(0,"h3",44),y("click",function(){u(e);let t=d(4);return _(t.addReason())}),p(1," + Add Reason "),a()}}function Dc(o,l){if(o&1){let e=C();r(0,"div",22),h(1,"img",39),r(2,"div",40)(3,"label",41),p(4,"Select Reasons "),h(5,"img",24),a(),x(6,Oc,2,0,"h3",42),a(),r(7,"p-multiSelect",43),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.deadLeadReasonIds,t)||(n.deadLeadReasonIds=t),_(t)}),a()()}if(o&2){let e=d(3);s(6),g(e.isViewOnly?-1:6),s(),w("ngModel",e.deadLeadReasonIds),m("options",e.deadLeadReasons)("name","deadLeadReasons_"+e.stepIndex)("maxSelectedLabels",1e3)}}function Vc(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit,i=d(3);m("value",e==null?null:e._id),s(),T(" ",i.formatStatusTitle(e==null?null:e.title)," ")}}function Nc(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",35)(2,"div",22)(3,"label",23),p(4,"Select pipeline"),h(5,"img",24),a(),r(6,"select",36),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.pipelineId,t)||(n.pipelineId=t),_(t)}),y("change",function(){u(e);let t=d(2);return _(t.setStatus())}
22),r(7,"option",34),p(8,"--Select pipeline--"),a(),D(9,Mc,3,4,"option",32,k),a()(),x(11,Dc,8,5,"div",22),r(12,"div",37),h(13,"svg-icon",38),a(),r(14,"div",22)(15,"label",23),p(16,"Select status to move to "),h(17,"img",24),a(),r(18,"select",33),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.statusId,t)||(n.statusId=t),_(t)}),r(19,"option",34),p(20,"--Select status--"),a(),D(21,Vc,2,2,"option",32,k),a()()()()}if(o&2){let e=d(2);s(6),w("ngModel",e.pipelineId),m("disabled",e.isViewOnly),s(3),V(e.pipelineData),s(2),g(e.isDeadLead()?11:-1),s(7),w("ngModel",e.statusId),m("disabled",e.isViewOnly),s(3),V(e.statusData)}}function kc(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e.value),s(),T(" ",e==null?null:e.label," ")}}function Bc(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",35)(2,"div",22)(3,"label",23),p(4,"What should happen to pending task in the old status "),h(5,"img",24),a(),r(6,"select",33),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.pendingAction,t)||(n.pendingAction=t),_(t)}),r(7,"option",34),p(8,"--Select--"),a(),D(9,kc,2,2,"option",32,k),a()()()()}if(o&2){let e=d(2);s(6),w("ngModel",e.pendingAction),m("disabled",e.isViewOnly),s(3),V(e.pendingActionList)}}function Pc(o,l){if(o&1&&(r(0,"div",15),x(1,wc,2,2),x(2,Ac,10,3,"div",21)(3,Nc,23,5,"div",21),x(4,Bc,11,2,"div",21),a()),o&2){let e=d();s(),g(e.isDefaultSelectStatusStep?-1:1),s(),g(e.isSinglePipelineStatusUi?2:3),s(2),g(e.showPendingTaskAction?4:-1)}}var rn,ln=ee(()=>{W();Re();Aa();W();Lt();Ce();Ee();fe();xe();be();se();pe();Ve();Bt();He();rn=(()=>{class o{constructor(e,i,t,n,c){this._leadsService=e,this._loaderService=i,this._toastrService=t,this._dialog=n,this._utilities=c,this.previewText="Changed to Pipeline Name",this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.disableDelete=!1,this.deleteBox=new R,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.pipelineId="",this.statusId="",this.isExpanded=!0,this.pipelineData=[],this.statusData=[],this.pendingAction="",this.pendingActionList=[{value:"mark_complete_all",label:"Mark everyone\u2019s pending task as complete"},{value:"leave_at",label:"Leave all pending tasks as pending"}],this.deadLeadReasons=[],this.deadLeadReasonIds=[],this.initialPipelineId="",this.initialStatusId="",this.initialPendingAction="",this.initialDeadLeadReasonIds=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.getPipelineList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getPipelineList())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),typeof this.payload?.pipelineId<"u"&&(this.pipelineId=this.payload.pipelineId),typeof this.payload?.mainStatusId<"u"&&(this.statusId=this.payload.mainStatusId),typeof this.payload?.pendingAction<"u"&&(this.pendingAction=this.payload.pendingAction),this.payload?.deadLeadReasonIds?.length&&(this.deadLeadReasonIds=[...this.payload.deadLeadReasonIds])}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}resolveModuleId(){let e=this.moduleId;return e!=null&&typeof e=="object"&&typeof e._id=="string"?e._id:String(e??"")}get isContactModuleChangeStatus(){let e=this.resolveModuleId();return e===O.MainStatusId.BUYER||e===O.MainStatusId.AGENT||e===O.MainStatusId.VENDOR}get isSinglePipelineStatusUi(){let e=this.resolveModuleId();return this.isContactModuleChangeStatus||e===O.MainStatusId.INVENTORY||e===O.MainStatusId.RENTAL||e===O.MainStatusId.LISTSTACKING}get showPendingTaskAction(){return this.isDefaultSelectStatusStep?!1:this.resolveModuleId()!==O.MainStatusId.SOLD}get pipelineChangeInfoTooltip(){if(this.isDefaultSelectStatusStep){if(this.isContactModuleChangeStatus)return`This step executes only when the ${this.getContactModuleTypeNoun()} is created via Call or SMS, and is skipped for manual or web form creations.`;let i=this.resolveModuleId();if(i===O.MainStatusId.INVENTORY)return"Select the status where new inventory from this automation will be created.";if(i===O.MainStatusId.RENTAL)return"Select the status where new rental from this automation will be created."}if(this.isContactModuleChangeStatus)return`Select the status to move this ${this.getContactModuleTypeNoun()} to.`;let e=this.resolveModuleId();return e===O.MainStatusId.INVENTORY?"Select the status to move this inventory to.":e===O.MainStatusId.RENTAL?"Select the status to move this rental to.":"Select the pipeline/status to move this lead to."}get cardTitle(){return this.isDefaultSelectStatusStep?"Select Status":this.isSinglePipelineStatusUi?"Change Status":"Change Pipeline/Status"}get statusSelectLabel(){return this.isDefaultSelectStatusStep?"Select status":"Select status to move to"}get isDefaultSelectStatusStep(){return this.isSinglePipelineStatusUi&&this.actionId===1&&this.disableDelete}getContactModuleTypeNoun(){let e=this.resolveModuleId();return e===O.MainStatusId.BUYER?"buyer":e===O.MainStatusId.AGENT?"agent":e===O.MainStatusId.VENDOR?"vendor":"contact"}applyContactModulePipelineDefaults(){this.pipelineId=this.pipelineData[0]?._id||"",this.statusData=this.filterStatusOptionsForModule(this.pipelineData?.[0]?.mainStatusList||[]),this.pendingAction||(this.pendingAction="leave_at"),this.dropUnderContractStatusSelection(),this.dropInLeadStatusSelection()}shouldExcludeUnderContractStatus(){let e=this.resolveModuleId();return e===O.MainStatusId.LEAD||e===O.MainStatusId.INVENTORY}
22isListStackingModule(){let e=this.resolveModuleId();return e===O.MainStatusId.LISTSTACKING||e===O.ModuleStatusId.LISTSTACKING}isUnderContractStatus(e){return(e?.title??"").toString().trim().toLowerCase()==="under contract"}isInLeadPipelineStatus(e){let i=(e?.originalTitle||e?.title||"").trim().toLowerCase();return i==="in lead"||i==="in leads"}filterStatusOptionsForModule(e){let i=e||[];return this.shouldExcludeUnderContractStatus()&&(i=i.filter(t=>!this.isUnderContractStatus(t))),this.isListStackingModule()&&(i=i.filter(t=>!this.isInLeadPipelineStatus(t))),i}dropUnderContractStatusSelection(){if(!this.shouldExcludeUnderContractStatus()||!this.statusId)return;let e=this.statusData?.find(i=>i?._id===this.statusId);(!e||this.isUnderContractStatus(e))&&(this.statusId="")}dropInLeadStatusSelection(){if(!this.isListStackingModule()||!this.statusId)return;let e=this.statusData?.find(i=>i?._id===this.statusId);(!e||this.isInLeadPipelineStatus(e))&&(this.statusId="")}organizePipelinesFromResponse(e){let i=e.filter(c=>c?.masterPipelineId).sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0)),t=e?.filter(c=>!c?.masterPipelineId),n=[...i,...t].sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0));return n=n?.map(c=>{if(c?.mainStatusList?.length){let f=c?.mainStatusList.filter(v=>v?.masterStatusId).sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0)),S=c?.mainStatusList?.filter(v=>!v?.masterStatusId);c.mainStatusList=[...f,...S].sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0))}return c}),n}getPipelineList(){let e={page:1,limit:100,moduleId:this.resolveModuleId()};this._loaderService.start(),this._leadsService.getPipelines(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items||[];this.pipelineData=this.organizePipelinesFromResponse(t),this.isSinglePipelineStatusUi?(this.applyContactModulePipelineDefaults(),this.captureInitialState()):(typeof this.payload?.pipelineId<"u"&&(this.pipelineId=this.payload.pipelineId,this.setStatus(),this.statusId=this.payload?.mainStatusId??"",this.pendingAction=this.payload?.pendingAction??"",this.dropUnderContractStatusSelection(),this.dropInLeadStatusSelection()),this.getDeadList())}this._loaderService.stop()},i=>{this._loaderService.stop()})}setStatus(){this.statusId="";let e=this.pipelineData?.findIndex(i=>i?._id==this.pipelineId);e>=0&&(this.statusData=this.filterStatusOptionsForModule(this.pipelineData?.[e]?.mainStatusList||[]),this.pipelineData?.[e]?.originalTitle!="deadleads"&&(this.deadLeadReasonIds=[])),this.dropUnderContractStatusSelection(),this.dropInLeadStatusSelection()}formatStatusTitle(e){if(e==null||String(e).trim()==="")return"";let i=String(e).trim(),t=i.replace(/[^a-zA-Z]/g,"");return t.length>0&&t===t.toUpperCase()?i:i.toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")||""}getPreview(){if(this.isSinglePipelineStatusUi){let n=this.statusData?.findIndex(c=>c?._id==this.statusId);return n>=0?`Status: ${this.formatStatusTitle(this.statusData?.[n]?.title)}.`:""}let e="",i=this.pipelineData?.findIndex(n=>n?._id==this.pipelineId);i>=0&&(e=`Pipeline: ${this.pipelineData?.[i]?.title}.`);let t=this.statusData?.findIndex(n=>n?._id==this.statusId);return t>=0&&(e+=` Status: ${this.formatStatusTitle(this.statusData?.[t]?.title)}.`),e}getDeadList(){let e={page:1,limit:100};this._loaderService.start(),this._leadsService.getDeadLeadReasons(e).subscribe(i=>{i?.statusCode==200&&(this.deadLeadReasons=i?.data?.items||[],this.payload?.deadLeadReasonIds?.length&&(this.deadLeadReasonIds=[...this.payload.deadLeadReasonIds]),this.captureInitialState()),this._loaderService.stop()},i=>{this._loaderService.stop()})}isDeadLead(){if(this.isSinglePipelineStatusUi)return!1;let e=this.pipelineData?.findIndex(i=>i?._id==this.pipelineId);return e>=0?this.pipelineData?.[e]?.originalTitle==="deadleads":!1}addReason(){this.dialogRef=this._dialog.open(Li,{disableClose:!0,width:"400px",panelClass:"re-new-custom-dialog",data:{}}),this.dialogRef.afterClosed().subscribe(e=>{e?.success&&(this.deadLeadReasons=[],this.getDeadList())})}captureInitialState(){this.isInitialStateCaptured||(this.initialPipelineId=this.pipelineId||"",this.initialStatusId=this.statusId||"",this.initialPendingAction=this.pendingAction||"",this.initialDeadLeadReasonIds=this.deadLeadReasonIds?[...this.deadLeadReasonIds]:[],this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.pipelineId!==this.initialPipelineId||this.statusId!==this.initialStatusId||this.pendingAction!==this.initialPendingAction||this.deadLeadReasonIds?.length!==this.initialDeadLeadReasonIds?.length||!this.deadLeadReasonIds?.every(e=>this.initialDeadLeadReasonIds?.includes(e))||!this.initialDeadLeadReasonIds?.every(e=>this.deadLeadReasonIds?.includes(e))||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(it),E(H),E(Y),E(ve),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-pipeline-change-box"]],inputs:{previewText:"previewText",moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
22y:"isViewOnly",disableDelete:"disableDelete"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:18,vars:9,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-tags-brighter-teal","rounded-[20px]"],["src","assets/images/icons/status-change-white.svg","alt","status-change-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate",3,"appTooltip"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
22px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],[1,"flex","flex-col","gap-[20px]"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","change","ngModel","disabled"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],["src","assets/images/icons/line-2.png","alt","line-2",1,"img-fluid"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer"],["placeholder","Select Reasons","appendTo","body","optionLabel","name","optionValue","_id",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","options","name","maxSelectedLabels"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click"]],template:function(i,t){i&1&&(x(0,gc,4,1,"div",0),r(1,"div",1)(2,"div",2),h(3,"img",3),a(),r(4,"div",4)(5,"div",5)(6,"h2",6),p(7),a(),r(8,"div",7),h(9,"svg-icon",8),a()(),x(10,fc,2,1,"h4",9),a(),r(11,"div",10)(12,"div",11),p(13),a(),x(14,yc,2,0,"div",12),r(15,"div",13),y("click",function(){return t.onToggleExpanded()}),h(16,"img",14),a()()(),x(17,Pc,5,3,"div",15)),i&2&&(g(t.isDefaultSelectStatusStep?-1:0),s(6),m("appTooltip",t.cardTitle),s(),T(" ",t.cardTitle," "),s(),m("pTooltip",t.pipelineChangeInfoTooltip),s(2),g(t.isExpanded?-1:10),s(3),T(" Step ",t.stepIndex+1," "),s(),g(!t.isViewOnly&&!t.disableDelete?14:-1),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?17:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z,tt,he,Yt],encapsulation:2})}}return o})()});function Rc(o,l){if(o&1&&(r(0,"h4",12),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Fc(o,l){if(o&1){let e=C();r(0,"div",19),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",20),a()}}function Uc(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Wc(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",30)(2,"label",31),p(3," Delay before executing this step "),h(4,"img",32),a(),r(5,"div",33)(6,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",35),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Uc,2,1,"p",36),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function jc(o,l){if(o&1&&(r(0,"option",40),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function qc(o,l){if(o&1){let e=C();r(0,"select",37),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,jc,2,2,"option",40,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Gc(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Hc(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",30)(2,"label",31),p(3," Execute on "),h(4,"img",32),a(),r(5,"div",33)(6,"select",37),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",38),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,qc,3,2,"select",39),a(),x(11,Gc,2,1,"p",36),a()()}if(o&2){let e=d(2);
22s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Yc(o,l){if(o&1){let e=C();r(0,"div",18),x(1,Wc,17,5,"div",21),x(2,Hc,12,6,"div",21),r(3,"div",22),y("click",function(){u(e);let t=d();return _(t.selectSenderProfile())}),r(4,"div",23)(5,"h2",24),p(6," Sender details "),a(),r(7,"h4",25),p(8),a()(),r(9,"div",26),h(10,"img",17),a()(),r(11,"div",22),y("click",function(){u(e);let t=d();return _(t.selectMailerType())}),r(12,"div",23)(13,"h2",24),p(14," Mailer details "),a(),r(15,"h4",25),p(16),a()(),r(17,"div",27),h(18,"img",28),a(),r(19,"div",26),h(20,"img",17),a()(),r(21,"div",29),p(22," Note: Postcard sent via First Class Postage (3-5 days delivery time) "),a()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(6),T(" ",e.senderDetails!=null&&e.senderDetails.senderName?"Selected: "+(e.senderDetails==null?null:e.senderDetails.senderName)+"\u2019s Sender Profile":"Select Sender Profile"," "),s(8),T(" ",e.mailerDetails!=null&&e.mailerDetails.mailType?"Selected: "+(e.mailerDetails==null?null:e.mailerDetails.mailType):"Select Mailer Details"," "),s(2),m("src",(e.mailerDesignPreview==null?null:e.mailerDesignPreview.thumbnail)||"assets/images/default.png",ge)}}var sn,dn=ee(()=>{W();Er();wr();W();fe();xe();St();Ce();be();se();pe();Ve();He();sn=(()=>{class o{static{this.defaultSenderDetails={senderId:"",firstName:"",lastName:"",streetAddress:"",streetAddress2:"",city:"",state:"",zip:"",campaignId:"",senderName:"",website:""}}static{this.defaultMailerDetails={mailType:"Postcard",isTrack:!1,mailerDesignId:"",notes:""}}constructor(e,i,t,n){this._dialog=e,this._utilities=i,this._commonService=t,this._loaderService=n,this.previewText="Calling seller to fix appointment",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.moduleId="",this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.senderDetails=M({},o.defaultSenderDetails),this.maxMailsInOneBatch=1,this.batchDelay={duration:1,unit:"Minutes"},this.sendType="allAtOnce",this.initialSenderDetails={},this.initialMailerDetails={},this.initialSendType="",this.initialMaxMailsInOneBatch=1,this.initialBatchDelay={},this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.mailerDesignPreview={mailerDesignName:"",thumbnail:"",front:"",back:"",designId:"",templateId:""},this.mailerDetails=M({},o.defaultMailerDetails),this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),this.payload?.senderDetails&&(this.senderDetails=M(M({},o.defaultSenderDetails),this.payload.senderDetails)),this.payload?.mailerDetails&&(this.mailerDetails=P(M({},o.defaultMailerDetails),{mailType:this.payload.mailerDetails.mailType,isTrack:!!this.payload.mailerDetails.isTrack,mailerDesignId:this.payload.mailerDetails.mailerDesignId||"",notes:this.payload.mailerDetails.notes||""}),this.clearMailerDesignPreview(),this.resolveMailerDesignPreviewFromApi()),this.payload?.batchMailing?(this.sendType=this.payload.batchMailing.sendAllAtOnce?"allAtOnce":"inBatch",this.sendType==="inBatch"&&(this.maxMailsInOneBatch=this.payload.batchMailing.maxMailsInOneBatch??1,this.batchDelay=this.payload.batchMailing.batchDelay?M({},this.payload.batchMailing.batchDelay):{duration:1,unit:"Minutes"})):(this.sendType="allAtOnce",this.maxMailsInOneBatch=1,this.batchDelay={duration:1,unit:"Minutes"})}onToggleExpanded(){this.isExpanded=!this.isExpanded}selectSenderProfile(){this.dialogRef=this._dialog.open(Oa,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"800px",maxHeight:"92vh",data:this.mapAutomationSenderToCommonDialogData(this.senderDetails,{isViewOnl
22y:this.isViewOnly,moduleId:this.moduleId})}),this.dialogRef.afterClosed().subscribe(e=>{let i=this.mapCommonSenderResultToAutomationFlat(e);i&&(this.senderDetails=i)})}mapAutomationSenderToCommonDialogData(e,i){let t={moduleId:i.moduleId,isViewOnly:i.isViewOnly};if(!e?.senderId)return t;if(e?.contactDetail||e?.returnDetail)return M(M({},e),t);let n=String(e?.senderName||"").trim().split(/\s+/),c=n[0]||"",f=n.slice(1).join(" ");return P(M({},t),{senderId:e.senderId,contactDetail:{firstName:c,lastName:f,websiteUrl:e.website||""},returnDetail:{firstName:e.firstName||"",lastName:e.lastName||"",streetAddress:e.streetAddress||"",streetAddress2:e.streetAddress2||"",streetAddressSecondLine:e.streetAddress2||"",city:e.city||"",state:e.state||"",zip:e.zip||""},numberId:e.campaignId||"",campaignId:e.campaignId||""})}mapCommonSenderResultToAutomationFlat(e){if(!e)return null;if(e.senderName!==void 0&&!e.contactDetail&&!e.returnDetail)return M(M({},o.defaultSenderDetails),e);let i=e.contactDetail||{},t=e.returnDetail||{},n=[i.firstName,i.lastName].filter(c=>c!=null&&String(c).trim()!=="").join(" ").trim();return P(M({},o.defaultSenderDetails),{senderId:e.senderId||e._id||"",senderName:n,website:i.websiteUrl||i.website||"",firstName:t.firstName||"",lastName:t.lastName||"",streetAddress:t.streetAddress||"",streetAddress2:t.streetAddressSecondLine||t.streetAddress2||"",city:t.city||"",state:t.state||"",zip:t.zip||"",campaignId:e.numberId||e.campaignId||""})}selectMailerType(){this.dialogRef=this._dialog.open(Da,{disableClose:!0,width:"1040px",panelClass:"re-new-custom-dialog",data:this.mapAutomationMailerToCommonDialogData(this.mailerDetails,{isViewOnly:this.isViewOnly})}),this.dialogRef.afterClosed().subscribe(e=>{let i=this.mapCommonMailerResultToAutomationFlat(e);i&&(this.mailerDetails=i)})}mapAutomationMailTypeToCommon(e){return e==="Post Card"?"Postcard":e||"Postcard"}mapCommonMailTypeToAutomation(e){return e==="Post Card"?"Postcard":e||"Postcard"}mapAutomationMailerToCommonDialogData(e,i){return{moduleId:this.moduleId,isViewOnly:i.isViewOnly,mailerDetails:{mailType:this.mapAutomationMailTypeToCommon(e?.mailType),isTrack:!!e?.isTrack,mailerDesignId:e?.mailerDesignId||"",notes:e?.notes||"",mailerDesignName:this.mailerDesignPreview?.mailerDesignName||"",thumbnail:this.mailerDesignPreview?.thumbnail||"",front:this.mailerDesignPreview?.front||"",back:this.mailerDesignPreview?.back||"",designId:this.mailerDesignPreview?.designId||"",templateId:this.mailerDesignPreview?.templateId||""}}}mapCommonMailerResultToAutomationFlat(e){if(!e)return null;let i=e?.mailerDetails&&typeof e.mailerDetails=="object"?e.mailerDetails:e;return this.mailerDesignPreview={mailerDesignName:i?.mailerDesignName||"",thumbnail:i?.thumbnail||"",front:i?.front||"",back:i?.back||"",designId:i?.designId||"",templateId:i?.templateId||""},P(M({},o.defaultMailerDetails),{mailType:this.mapCommonMailTypeToAutomation(i?.mailType),isTrack:i?.isTrack??this.mailerDetails?.isTrack??o.defaultMailerDetails.isTrack,mailerDesignId:i?.mailerDesignId||i?.templateId||"",notes:i?.notes||""})}getMailerDetailsForPayload(){let e={mailType:this.mailerDetails?.mailType||"Postcard",isTrack:!!this.mailerDetails?.isTrack,mailerDesignId:this.mailerDetails?.mailerDesignId||""};return this.mailerDetails?.notes?.length&&(e.notes=this.mailerDetails.notes),e}clearMailerDesignPreview(){this.mailerDesignPreview={mailerDesignName:"",thumbnail:"",front:"",back:"",designId:"",templateId:""}}getMailTemplateTypeFromMailType(e){switch(e){case"Post Card":case"Postcard":return"postcard";case"Yellow Letters":return"yellowLetter";case"Business Letters":return"businessLetter";default:return"postcard"}}resolveMailerDesignPreviewFromApi(){let e=this.mailerDetails?.mailerDesignId;if(!e)return;let i={mailTemplateType:this.getMailTemplateTypeFromMailType(this.mailerDetails?.mailType)};this._loaderService?.start(),this._commonService?.getDirectMailDesigns(i)?.subscribe(t=>{if(this._loaderService?.stop(),t?.statusCode!==200)return;let c=(t?.data?.items||[]).find(f=>f?._id==e||f?.designID==e);c&&(this.mailerDesignPreview={mailerDesignName:c?.title?`Design ${c.title}`:"",thumbnail:c?.thumbnail||"",front:c?.front??c?.previewFront??c?.designID??"",back:c?.back??c?.previewBack??c?.designID??"",designId:c?.designID||"",templateId:c?._id||""})},()=>{this._loaderService?.stop()})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return`Mailer: ${this.mailerDetails?.mailType}. Sender: ${this.senderDetails?.senderName}`}captureInitialState(){this.isInitialStateCaptured||(this.initialSenderDetails=this.senderDetails?JSON.parse(JSON.stringify(this.senderDetails)):{},this.initialMailerDetails=this.mailerDetails?JSON.parse(JSON.stringify(this.mailerDetails)):{},this.initialSendType=this.sendType||"",this.initialMaxMailsInOneBatch=this.maxMailsInOneBatch||1,this.initialBatchDelay=this.batchDelay?JSON.parse(JSON.stringify(this.batchDelay)):{},this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?JSON.stringify(this.senderDetails)!==JSON.stringify(this.initialSenderDetails)||JSON.stringify(this.mailerDetails)!==JSON.stringify(this.initialMailerDetails)||this.sendType!==this.initialSendType||this.maxMailsInOneBatch!==this.initialMaxMailsInOneBatch||JSON.stringify(this.batchDelay)!==JSON.stringify(this.initialBatchDelay)||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(q),E(Ue),E(H))}}static{this.\u0275cmp=B({type:o,selectors:[["app-direct-mail-box"]],inputs:{previewText:"previewText",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
22y:"isViewOnly",moduleId:"moduleId"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:21,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-tags-brighter-blue","rounded-[20px]"],["src","assets/images/icons/direct-mail-2-white.svg","alt","direct-mail-2-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Direct Mail",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],["pTooltip","Your direct mail order will be sent to our mailing house on selected day and our typical turnaround time depending on the mail type is 3-5 business days","tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],[1,"flex-[1_0_0]","flex","flex-col","gap-[6px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"text-h4","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","-rotate-90"],[1,"w-[80px]","h-[60px]","rounded-[10px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden"],["alt","rectangle",1,"w-full","h-full","object-cover","object-center",3,"src"],[1,"text-label","text-transparency-100","font-medium","opacity-40","text-center"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
22px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number","value","1",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Direct Mail "),a(),r(11,"div",10),h(12,"svg-icon",11),a()(),x(13,Rc,2,1,"h4",12),a(),r(14,"div",13)(15,"div",14),p(16),a(),x(17,Fc,2,0,"div",15),r(18,"div",16),y("click",function(){return t.onToggleExpanded()}),h(19,"img",17),a()()(),x(20,Yc,23,5,"div",18)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(10),g(t.isExpanded?-1:13),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:17),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?20:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z,he],encapsulation:2})}}return o})()});var To=ee(()=>{_r();hr()});function Qc(o,l){if(o&1&&(r(0,"p"),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e," ")}}function $c(o,l){if(o&1&&(r(0,"div",10)(1,"div",12),p(2),a(),r(3,"div",13),D(4,Qc,2,1,"p",null,k),a()()),o&2){let e=d();s(2),T(" ",e.notifyCategory.category," "),s(2),V(e.notifyCategory.annotations)}}function Kc(o,l){if(o&1&&(r(0,"p"),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e," ")}}function Xc(o,l){if(o&1&&(r(0,"div",10),Wo(1),r(2,"div",12),p(3),a(),r(4,"div",13),D(5,Kc,2,1,"p",null,k),a(),jo(),a()),o&2){let e=l.$implicit;s(3),T(" ",e.category," "),s(2),V(e.annotations)}}function Zc(o,l){if(o&1&&(r(0,"div",11),D(1,Xc,7,1,"div",10,Jc),a()),o&2){let e=d();s(),V(e.sendEmailCategories)}}var Jc,cn,pn=ee(()=>{fe();Re();W();fe();uo();pe();Jc=(o,l)=>l.category;cn=(()=>{class o{constructor(e,i,t){this.data=e,this.dialog=i,this._annotationListService=t,this.source="",this.recipientModuleId="",this.moduleId="",this.mainStatusId=O.MainStatusId,this.isNotifyMode=!1,this.isSendEmailMode=!1,this.sendEmailCategories=[],this.notifyCategory=null,this.sellerAnnotations=[],this.buyerAnnotations=[],this.agentAnnotations=[],this.vendorAnnotations=[],this.listStackingAnnotations=[]}ngOnInit(){this.source=this.data?.source||"",this.recipientModuleId=this.data?.recipientModuleId||"",this.moduleId=this.data?.moduleId||"",this.sellerAnnotations=this.toMentionItems(this._annotationListService?.getLeadMentionItems()),this.buyerAnnotations=this.toMentionItems(this._annotationListService?.buyerBaseAnnotations),this.agentAnnotations=this.toMentionItems(this._annotationListService?.agentBaseAnnotations),this.vendorAnnotations=this.toMentionItems(this._annotationListService?.vendorBaseAnnotations),this.listStackingAnnotations=this.toMentionItems(this._annotationListService?.listStackingBaseAnnotations),this.isNotifyMode=this.source==="notify-team-members"||this.source==="",this.isSendEmailMode=this.source==="send-email-box",this.isNotifyMode&&(this.notifyCategory=this.buildNotifyCategory()),this.isSendEmailMode&&(this.sendEmailCategories=this.buildSendEmailCategories())}toMentionItems(e){return(e||[]).map(i=>`@${String(i||"").replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().trim()}`)}get isListStackingModule(){return this.moduleId===this.mainStatusId.LISTSTACKING}buildNotifyCategory(){let e=this.moduleId||this.recipientModuleId,i=this.data?.annotations?.length?this.data.annotations:this.getNotifyAnnotationKeysForModule(e);return{category:this.getNotifyCategoryLabel(e),annotations:this.toMentionItems(i),isRelevant:!0}}getNotifyAnnotationKeysForModule(e){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(e)?["firstName","lastName","email","phoneNumber"]:["firstName","lastName","propertyStreetAddress","propertyCity","propertyState","propertyZipCode","email","phoneNumber"]}
22getNotifyCategoryLabel(e){return e===this.mainStatusId.BUYER?"Buyer merge fields":e===this.mainStatusId.AGENT?"Agent merge fields":e===this.mainStatusId.VENDOR?"Vendor merge fields":e===this.mainStatusId.LISTSTACKING?"List Stacking merge fields":e===this.mainStatusId.WHOLESALEPIPELINE?"Transaction merge fields":e===this.mainStatusId.INVENTORY?"Inventory merge fields":e===this.mainStatusId.SOLD?"Sold merge fields":e===this.mainStatusId.RENTAL?"Rental merge fields":"Lead merge fields"}buildSendEmailCategories(){return this.isListStackingModule?[{category:"List Stacking merge fields",annotations:this.listStackingAnnotations,isRelevant:!0}]:[{category:"Seller annotations",annotations:this.sellerAnnotations,isRelevant:this.recipientModuleId===this.mainStatusId.LEAD},{category:"Buyer annotations",annotations:this.buyerAnnotations,isRelevant:this.recipientModuleId===this.mainStatusId.BUYER},{category:"Agent annotations",annotations:this.agentAnnotations,isRelevant:this.recipientModuleId===this.mainStatusId.AGENT},{category:"Vendor annotations",annotations:this.vendorAnnotations,isRelevant:this.recipientModuleId===this.mainStatusId.VENDOR}]}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(Qt))}}static{this.\u0275cmp=B({type:o,selectors:[["app-annotation-list"]],standalone:!1,decls:15,vars:2,consts:[[1,"flex","flex-col","items-center","gap-[10px]","p-[30px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px]","src","assets/images/icons/user-profile.svg",1,"text-transparency-100"],[1,"flex-1"],[1,"text-h1","text-transparency-100","font-semibold"],[1,"text-sub-heading/[normal]","text-transparency-90","font-medium"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[10px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"text-p","text-transparency-100","font-medium"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5)(7,"h1",6),p(8," Merge Fields "),a(),r(9,"p",7),p(10," Annotation to personalize the message "),a()()(),r(11,"button",8),h(12,"svg-icon",9),a()(),x(13,$c,6,1,"div",10),x(14,Zc,3,0,"div",11),a()()()),i&2&&(s(13),g(t.isNotifyMode&&t.notifyCategory?13:-1),s(),g(t.isSendEmailMode?14:-1))},dependencies:[Ze,_t,L],encapsulation:2})}}return o})()});function np(o,l){if(o&1&&(r(0,"h4",14),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function op(o,l){if(o&1){let e=C();r(0,"div",21),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",22),a()}}function ap(o,l){if(o&1&&(r(0,"p",74),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function rp(o,l){if(o&1){let e=C();r(0,"div",23)(1,"div",41)(2,"label",30),p(3," Delay before executing this step "),h(4,"img",31),a(),r(5,"div",71)(6,"input",72),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",73),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,ap,2,1,"p",74),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnl
22y),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function lp(o,l){if(o&1&&(r(0,"option",78),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function sp(o,l){if(o&1){let e=C();r(0,"select",75),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,lp,2,2,"option",78,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time),s(),V(e.timeOption)}}function dp(o,l){if(o&1&&(r(0,"p",74),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function cp(o,l){if(o&1){let e=C();r(0,"div",23)(1,"div",41)(2,"label",30),p(3," Execute on "),h(4,"img",31),a(),r(5,"div",71)(6,"select",75),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",76),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,sp,3,1,"select",77),a(),x(11,dp,2,1,"p",74),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType),s(3),m("ngModel",e.executeOn.dayValue),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function pp(o,l){if(o&1){let e=C();r(0,"h3",79),y("click",function(){u(e);let t=d(2);return _(t.onVerifyEmailTextClick())}),p(1," Verify Email "),a()}}function mp(o,l){if(o&1&&(r(0,"p",37),p(1),a()),o&2){let e=d(2);s(),T(" ",e.emailInvalidMessage," ")}}function up(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",83),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Seller"))}),a(),h(2,"img",84),p(3," Seller"),a()}if(o&2){let e=d(3);s(),m("name","whomesend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.LEAD)("disabled",e.isViewOnly)}}function _p(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",83),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Buyer"))}),a(),h(2,"img",84),p(3," Buyer"),a()}if(o&2){let e=d(3);s(),m("name","whomesend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.BUYER)("disabled",e.isViewOnly)}}function hp(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",83),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Agent"))}),a(),h(2,"img",84),p(3," Agent"),a()}if(o&2){let e=d(3);s(),m("name","whomesend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.AGENT)("disabled",e.isViewOnly)}}function xp(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",83),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Vendor"))}),a(),h(2,"img",84),p(3," Vendor"),a()}if(o&2){let e=d(3);s(),m("name","whomesend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.VENDOR)("disabled",e.isViewOnly)}}function gp(o,l){if(o&1&&(r(0,"h3",80),p(1," Select recipient "),a(),r(2,"div",81),x(3,up,4,4,"label",82),x(4,_p,4,4,"label",82),x(5,hp,4,4,"label",82),x(6,xp,4,4,"label",82),a(),r(7,"div",42),h(8,"svg-icon",43),a()),o&2){let e=d(2);s(3),g(e.shouldShowRecipientOption("LEAD")?3:-1),s(),g(e.shouldShowRecipientOption("BUYER")?4:-1),s(),g(e.shouldShowRecipientOption("AGENT")?5:-1),s(),g(e.shouldShowRecipientOption("VENDOR")?6:-1)}}function fp(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",86),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.receiverContactType,t)||(n.receiverContactType=t),_(t)}),a(),h(2,"img",84),p(3),a()}if(o&2){let e=d(3);s(),m("name","receiverContact_"+e.actionId),w("ngModel",e.receiverContactType),m("disabled",e.isViewOnl
22y),s(2),T(" ",e.recipientModuleId==e.mainStatusId.LEAD?"Primary Contact":e.recipientModuleId==e.mainStatusId.BUYER?"Primary Buyer":e.recipientModuleId==e.mainStatusId.AGENT?"Primary Agent":e.recipientModuleId==e.mainStatusId.VENDOR?"Primary Vendor":""," ")}}function yp(o,l){if(o&1){let e=C();r(0,"label",82)(1,"input",87),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.receiverContactType,t)||(n.receiverContactType=t),_(t)}),a(),h(2,"img",84),p(3),a()}if(o&2){let e=d(3);s(),m("name","receiverContact_"+e.actionId),w("ngModel",e.receiverContactType),m("disabled",e.isViewOnly),s(2),T(" Other ",e.recipientModuleId==e.mainStatusId.BUYER?"Buyer":e.recipientModuleId==e.mainStatusId.AGENT?"Agent":e.recipientModuleId==e.mainStatusId.VENDOR?"Vendor":"")}}function Cp(o,l){if(o&1&&(r(0,"div",41)(1,"label",85),p(2),a(),r(3,"div",81),x(4,fp,4,4,"label",82),x(5,yp,4,4,"label",82),a()()),o&2){let e=d(2);s(2),T(" ",e.recipientModuleId==e.mainStatusId.LEAD?"Seller":e.recipientModuleId==e.mainStatusId.BUYER?"Buyer":e.recipientModuleId==e.mainStatusId.AGENT?"Agent":"Vendor"," to contact"),s(2),g(e.hidePrimaryRecipientOption?-1:4),s(),g(e.recipientModuleId!=e.mainStatusId.LEAD?5:-1)}}function bp(o,l){if(o&1&&(r(0,"div",89),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e==null?null:e.label," ")}}function Sp(o,l){if(o&1&&(r(0,"div",90),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e==null?null:e.label," ")}}function Tp(o,l){if(o&1){let e=C();r(0,"div",41)(1,"label",30),p(2),h(3,"img",31),a(),r(4,"p-select",88),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.recipientId,t)||(n.recipientId=t),_(t)}),Ne(5,bp,2,1,"ng-template",null,1,ze)(7,Sp,2,1,"ng-template",null,2,ze),a()()}if(o&2){let e=d(2);s(2),T(" Select ",e.recipientModuleId==e.mainStatusId.BUYER?"buyer":e.recipientModuleId==e.mainStatusId.AGENT?"agent":e.recipientModuleId==e.mainStatusId.VENDOR?"vendor":""," contact "),s(2),w("ngModel",e.recipientId),m("options",e.recipientList)("filter",!0)("showClear",!0)("disabled",e.isViewOnly)}}function vp(o,l){if(o&1){let e=C();r(0,"img",95),y("click",function(){u(e);let t=d(3);return t.isCC=!1,_(t.ccString="")}),a()}}function Ep(o,l){if(o&1){let e=C();r(0,"div",41)(1,"label",30),p(2," CC Emails: "),r(3,"span",91),p(4,"(Separated by , )"),a(),h(5,"img",31),a(),r(6,"div",92)(7,"input",93),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.ccString,t)||(n.ccString=t),_(t)}),a(),x(8,vp,1,0,"img",94),a()()}if(o&2){let e=d(2);s(7),w("ngModel",e.ccString),m("disabled",e.isViewOnly),s(),g(e.isViewOnly?-1:8)}}function wp(o,l){if(o&1){let e=C();r(0,"img",95),y("click",function(){u(e);let t=d(3);return t.isBCC=!1,_(t.bccString="")}),a()}}function Ip(o,l){if(o&1){let e=C();r(0,"div",41)(1,"label",30),p(2," BCC Emails: "),r(3,"span",91),p(4,"(Separated by , )"),a(),h(5,"img",31),a(),r(6,"div",92)(7,"input",93),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.bccString,t)||(n.bccString=t),_(t)}),a(),x(8,wp,1,0,"img",94),a()()}if(o&2){let e=d(2);s(7),w("ngModel",e.bccString),m("disabled",e.isViewOnly),s(),g(e.isViewOnly?-1:8)}}function Ap(o,l){if(o&1&&(r(0,"span",49),p(1),a()),o&2){let e=d(2);m("pTooltip",e.emailTemplateName),s(),T(" \u2014 ",e.emailTemplateName," ")}}function Mp(o,l){if(o&1){let e=C();r(0,"button",96),y("click",function(){u(e);let t=d(2);return _(t.openEmailPreviewDialog())}),p(1," Preview "),a()}if(o&2){let e=d(2);m("disabled",e.isViewOnly)}}function Op(o,l){if(o&1){let e=C();r(0,"h3",97),y("click",function(){u(e);let t=d(2);return _(t.openEmailEditorDialog())}),p(1," Edit Email "),a()}}function Dp(o,l){if(o&1&&h(0,"div",60),o&2){let e=d(2);m("innerHTML",e.emailPreviewHtml,le)}}function Vp(o,l){o&1&&(r(0,"div",61)(1,"p",98),p(2,' Click "Edit Email" to create your email content '),a()())}function Np(o,l){if(o&1){let e=C();r(0,"div",62)(1,"quill-editor",99,3),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.body,t)||(n.body=t),_(t)}),a()()}if(o&2){let e=d(2);s(),m("name","body_"+e.actionId),w("ngModel",e.body),m("styles",e.editorStyle)("modules",rt(6,ip,e.editorOptions==null?null:e.editorOptions.mention))("placeholder",e.editorOptions==null?null:e.editorOptions.placeholder)("disabled",e.isViewOnl
22y)}}function kp(o,l){if(o&1){let e=C();r(0,"img",105),y("click",function(){u(e);let t=d().$index,n=d(2);return _(n.deleteAttachment(t))}),a()}}function Bp(o,l){if(o&1){let e=C();r(0,"div",70)(1,"div",100),y("click",function(){let t=u(e).$implicit,n=d(2);return _(n.previewAttachment(t==null?null:t.url))}),r(2,"div",101),h(3,"img",102),a(),r(4,"div",103),p(5),a()(),x(6,kp,1,0,"img",104),a()}if(o&2){let e=l.$implicit,i=d(2);s(3),m("src",qo("/assets/images/",i.getAttachmentIconKey(e==null?null:e.fileType),"_icon.png"),ge),s(2),T(" ",e==null?null:e.fileName," "),s(),g(i.isViewOnly?-1:6)}}function Pp(o,l){if(o&1){let e=C();r(0,"div",20),x(1,rp,17,5,"div",23),x(2,cp,12,4,"div",23),r(3,"div",24)(4,"div",25)(5,"h2",26),p(6," Sender details "),a(),r(7,"h3",27),y("click",function(){u(e);let t=d();return _(t.emailTemplateSelection())}),p(8," Select Template "),a()(),r(9,"div",28)(10,"div",29)(11,"label",30),p(12," From name "),h(13,"img",31),a(),r(14,"input",32),A("ngModelChange",function(t){u(e);let n=d();return I(n.senderDetails.name,t)||(n.senderDetails.name=t),_(t)}),a()(),r(15,"div",29)(16,"div",33)(17,"label",30),p(18," From email "),h(19,"img",31),a(),x(20,pp,2,0,"h3",34),a(),r(21,"div",35)(22,"input",36),A("ngModelChange",function(t){u(e);let n=d();return I(n.senderDetails.email,t)||(n.senderDetails.email=t),_(t)}),y("ngModelChange",function(){u(e);let t=d();return _(t.onEmailInputChange())})("blur",function(t){u(e);let n=d();return _(n.verifyEmail(t==null||t.target==null?null:t.target.value))}),a()(),x(23,mp,2,1,"p",37),a()()(),r(24,"div",23)(25,"div",25)(26,"h2",26),p(27," Receiver details "),a(),r(28,"div",38)(29,"button",39),y("click",function(){u(e);let t=d();return _(t.isCC=!0)}),p(30," Add CC "),a(),r(31,"button",39),y("click",function(){u(e);let t=d();return _(t.isBCC=!0)}),p(32," Add BCC "),a()()(),r(33,"div",40),x(34,gp,9,4),x(35,Cp,6,3,"div",41),x(36,Tp,9,6,"div",41),a(),r(37,"div",42),h(38,"svg-icon",43),a(),r(39,"div",44),x(40,Ep,9,3,"div",41),x(41,Ip,9,3,"div",41),r(42,"div",45),p(43," Emails in CC and BCC should be unique "),a()()(),r(44,"div",24)(45,"div",46)(46,"h2",47)(47,"span",48),p(48,"Email content"),a(),x(49,Ap,2,2,"span",49),a(),r(50,"div",50),x(51,Mp,2,1,"button",51),a()(),r(52,"div",52)(53,"div",41)(54,"label",30),p(55," Subject "),h(56,"img",31),a(),r(57,"input",53),A("ngModelChange",function(t){u(e);let n=d();return I(n.subject,t)||(n.subject=t),_(t)}),a()(),r(58,"div",41)(59,"div",54)(60,"label",55),p(61," Email text "),h(62,"img",31),a(),r(63,"div",56),x(64,Op,2,0,"h3",57),r(65,"div",58)(66,"button",59),y("click",function(){u(e);let t=d();return _(t.toggleEditorMode(!0))}),p(67," Rich Format "),a(),r(68,"button",59),y("click",function(){u(e);let t=d();return _(t.toggleEditorMode(!1))}),p(69," Plain Text "),a()()()(),r(70,"div",35),x(71,Dp,1,1,"div",60),x(72,Vp,3,0,"div",61),x(73,Np,3,8,"div",62),a(),r(74,"div",63),p(75," You can use @merge fields to personalize message. "),r(76,"a",64),y("click",function(){u(e);let t=d();return _(t.annotationList())}),p(77,"Click to see"),a(),p(78," full list. "),a()()()(),r(79,"div",24)(80,"div",65)(81,"h2",66),p(82),a(),r(83,"button",67),y("click",function(){u(e);let t=d();return _(t.triggerUpload())}),h(84,"img",68),p(85," Add "),a(),r(86,"input",69,0),y("uploadOutput",function(t){u(e);let n=d();return _(n.onUploadLogo(t))}),a()(),r(88,"div",41),D(89,Bp,7,4,"div",70,k),a()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(12),w("ngModel",e.senderDetails.name),m("disabled",e.isViewOnly),s(6),g(!e.isViewOnly&&e.showVerifyEmailLink&&e.emailChecked&&e.isEmailExist===!1&&e.isFromEmailValid()?20:-1),s(2),w("ngModel",e.senderDetails.email),m("disabled",e.isViewOnly),s(),g(e.emailChecked&&e.isEmailExist===!1&&e.isFromEmailValid()&&e.emailInvalidMessage?23:-1),s(6),m("ngClass",e.isCC?"opacity-60 grayscale pointer-events-none":"")("disabled",e.isViewOnly),s(2),m("ngClass",e.isBCC?"opacity-60 grayscale pointer-events-none":"")("disabled",e.isViewOnl
22y),s(3),g(e.isListStackingModule?-1:34),s(),g(e.recipientModuleId!=""&&!e.isListStackingModule?35:-1),s(),g(e.receiverContactType=="other"&&e.recipientModuleId!=e.mainStatusId.LEAD?36:-1),s(4),g(e.isCC?40:-1),s(),g(e.isBCC?41:-1),s(8),g(e.emailTemplateName?49:-1),s(2),g(e.isTextEditor?51:-1),s(6),w("ngModel",e.subject),m("disabled",e.isViewOnly),s(7),g(e.isTextEditor?64:-1),s(2),m("ngClass",e.isTextEditor?"text-primary-90 bg-activity-outbound-hover-bg border-activity-outbound-hover-border":"text-transparency-100 border-transparent"),s(2),m("ngClass",e.isTextEditor?"text-transparency-100 border-transparent":"text-primary-90 bg-activity-outbound-hover-bg border-activity-outbound-hover-border"),s(3),g(e.isTextEditor&&e.emailPreviewHtml?71:-1),s(),g(e.isTextEditor&&!e.emailPreviewHtml?72:-1),s(),g(e.isTextEditor?-1:73),s(9),T(" Attachments (",e.attachments==null?null:e.attachments.length,") "),s(),m("disabled",e.isViewOnly),s(3),m("uploadInput",e.uploadInput)("disabled",e.isViewOnly),s(3),V(e.attachments)}}var ep,tp,ip,mn,un=ee(()=>{W();To();_a();$e();dt();pn();Sr();br();ho();ar();sr();Re();cr();W();fe();St();Ce();Ee();at();xe();or();uo();be();se();pr();pe();Ve();He();Di();mo();
22ep=["emailEditor"],tp=["uploader"],ip=o=>({toolbar:!1,mention:o});mn=(()=>{class o{get items(){return this._annotationListService?.getEmailModuleMentionItems({moduleId:this.isListStackingModule?this.moduleId:this.recipientModuleId})||[]}constructor(e,i,t,n,c,f,S,v){this._dialog=e,this._commonService=i,this._loaderService=t,this._toastrService=n,this._automationService=c,this._utilities=f,this._sanitizer=S,this._annotationListService=v,this.previewText="Email asking followup question to seller about property conditions",this.payload={},this.moduleId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.skipNextAttachmentUpload=!1,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.recipientModuleId=O.MainStatusId.LEAD,this.receiverContactType="primary",this.senderDetails={name:"",email:""},this.isEmailExist=void 0,this.emailChecked=!1,this.showVerifyEmailLink=!1,this.emailInvalidMessage="",this.ccString="",this.bccString="",this.isCC=!1,this.isBCC=!1,this.emailTemplateList=[],this.templateId="",this.emailTemplateName="",this.subject="",this.body="",this.attachments=[],this.recipientList=[],this.recipientId="",this.mainStatusId=O.MainStatusId,this.initialSenderDetails={},this.initialRecipientModuleId="",this.initialReceiverContactType="",this.initialRecipientId="",this.initialTemplateId="",this.initialSubject="",this.initialBody="",this.initialAttachments=[],this.initialIsCC=!1,this.initialCcString="",this.initialIsBCC=!1,this.initialBccString="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.editorConfig={},this.editorOptions={},this.emailDesignObject=null,this.isTextEditor=!1,this.emailPreviewHtml=null,this.timeOption=this._utilities?.timeList12HourFormat,this.editorOptions={placeholder:this._utilities.commonEditor().placeholder,toolbar:this._utilities.commonEditor().toolbar,mention:this.mentionEditor()}}ngOnInit(){this.uploadInput=new R,this.applyPayload(),this.syncRecipientModuleByAutomationModule(),this.ensureReceiverContactTypeForHiddenPrimary(),this.initializeEmailTemplate(),this.loadRecipientListIfOther()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.syncRecipientModuleByAutomationModule(),this.ensureReceiverContactTypeForHiddenPrimary(),this.isInitialStateCaptured=!1,this.initializeEmailTemplate(),this.loadRecipientListIfOther()),e.moduleId&&!e.moduleId.firstChange&&(this.syncRecipientModuleByAutomationModule(),this.ensureReceiverContactTypeForHiddenPrimary(),this.loadRecipientListIfOther())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),this.payload?.senderDetails&&(this.senderDetails=M(M({},this.senderDetails),this.payload.senderDetails),this.senderDetails?.email&&(this.isEmailExist=!0,this.emailChecked=!0)),this.payload?.receiverDetails&&(this.recipientModuleId=this.payload.receiverDetails?.moduleId??this.recipientModuleId,this.receiverContactType=this.payload.receiverDetails?.receiverContactType??this.receiverContactType,this.payload.receiverDetails?.ccEmails?.length&&(this.isCC=!0,this.ccString=this.payload.receiverDetails.ccEmails.join(",")),this.payload.receiverDetails?.bccEmail?.length&&(this.bccString=this.payload.receiverDetails.bccEmail.join(","),this.isBCC=!0))}loadRecipientListIfOther(){this.recipientModuleId===this.mainStatusId.BUYER&&(this.receiverContactType==="other"||this.moduleId===this.mainStatusId.BUYER)?this.getBuyer("Buyer",!0):this.recipientModuleId===this.mainStatusId.AGENT&&(this.receiverContactType==="other"||this.moduleId===this.mainStatusId.AGENT)?this.getBuyer("Agent",!0):this.recipientModuleId===this.mainStatusId.VENDOR&&(this.receiverContactType==="other"||this.moduleId===this.mainStatusId.VENDOR)&&this.getVendor(!0)}syncRecipientModuleByAutomationModule(){if(this.moduleId===this.mainStatusId.LISTSTACKING){this.recipientModuleId=this.mainStatusId.LEAD,this.receiverContactType="primary";return}(this.moduleId===this.mainStatusId.BUYER||this.moduleId===this.mainStatusId.AGENT||this.moduleId===this.mainStatusId.VENDOR)&&(this.recipientModuleId=this.moduleId)}
22get isListStackingModule(){return this.moduleId===this.mainStatusId.LISTSTACKING}isBuyerAgentVendorModule(e){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(e)}isLeadOrPropertyPipelineModule(){return[this.mainStatusId.LEAD,this.mainStatusId.WHOLESALEPIPELINE,this.mainStatusId.INVENTORY,this.mainStatusId.SOLD,this.mainStatusId.RENTAL].includes(this.moduleId)}get hidePrimaryRecipientOption(){return this.isLeadOrPropertyPipelineModule()&&this.isBuyerAgentVendorModule(this.recipientModuleId)}ensureReceiverContactTypeForHiddenPrimary(){this.hidePrimaryRecipientOption&&this.receiverContactType==="primary"&&(this.receiverContactType="other")}shouldShowRecipientOption(e){return this.isListStackingModule?!1:[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)?this.moduleId===this.mainStatusId[e]:!0}mentionEditor(){return{mentionListClass:"ql-mention-list mat-elevation-z8",allowedChars:/^[A-Za-z0-9\sÅÄÖåäö_]*$/,showDenotationChar:!0,spaceAfterInsert:!0,positioningStrategy:"fixed",defaultMenuOrientation:"bottom",onSelect:(e,i)=>{let t=this.editor?.quillEditor;i(e),t?.insertText(t?.getLength()-1,"","user")},source:(e,i)=>{let t=this.items.map((n,c)=>({id:c,value:n}));if(e?.length===0)i(t,e);else{let n=[];t.forEach(c=>{c?.value?.toLowerCase().indexOf(e?.toLowerCase())!==-1&&n.push(c)}),i(n,e)}}}}onToggleExpanded(){this.isExpanded=!this.isExpanded}initializeEmailTemplate(){if(this.payload?.emailContent){let e=this.payload?.emailContent?.isPlainText;this.templateId=this.payload?.emailContent?.templateId||"",this.subject=this.payload?.emailContent?.subject||"",this.isTextEditor=!this.payload?.emailContent?.isPlainText,this.body=this.isTextEditor?this.payload?.emailContent?.body||"":this.formatPlainTextForQuill(this.payload?.emailContent?.body||""),this.emailDesignObject=this.payload?.emailContent?.isPlainText?null:this.payload?.emailContent?.emailDesignObject,this.emailPreviewHtml=this.getSanitizedHtml(this.body),this.resolveEmailTemplateName()}this.attachments=this.payload?.attachments||[],setTimeout(()=>{this.captureInitialState()},500)}resolveEmailTemplateName(){if(!this.templateId){this.emailTemplateName="";return}let i={page:1,limit:1e3,moduleTypeId:[this.getEmailTemplateModuleId()]};this._commonService.getEmailList(i).subscribe(t=>{if(t?.statusCode!==200)return;let c=(t?.data?.items||(t?.data?.folders||[]).flatMap(f=>f?.templates||[])||[]).find(f=>f?._id==this.templateId);c&&(this.emailTemplateName=c?.templateName||"")},()=>{})}applyEmailTemplate(e){e&&(this.templateId=e?._id||this.templateId||"",this.emailTemplateName=e?.templateName||"",this.isTextEditor=e?.isTextEditor===!0,this.senderDetails.name=e?.fromName||"",this.senderDetails.email=e?.fromEmail||"",e?.fromEmail?(this.isEmailExist=!0,this.emailChecked=!0,this.showVerifyEmailLink=!1,this.emailInvalidMessage=""):this.onEmailInputChange(),this.subject=e?.subject||"",this.attachments=[],e?.attachmentArray?.forEach(i=>{let t=i?.name||"",n=this.getFileTypeFromName(t);this.attachments.push({fileName:t,fileType:n,url:i?.url||""})}),this.isTextEditor=e?.isTextEditor===!0,this.body=this.isTextEditor?e?.message||"":this.formatPlainTextForQuill(e?.message||""),this.isTextEditor?(this.emailPreviewHtml=this.getSanitizedHtml(this.body),this.emailDesignObject=e?.templateDesign??null):(this.emailPreviewHtml=null,this.emailDesignObject=null))}previewAttachment(e){window?.open(e,"_blank")}triggerUpload(){this.fileInput?.nativeElement?.click()}static{this.SUPPORTED_EMAIL_ATTACHMENT_EXTS=["pdf","doc","docx","xls","xlsx","jpg","jpeg","png","gif"]}isSupportedEmailAttachment(e){if(!e)return!1;let i=e.lastIndexOf(".");if(i===-1||i===e.length-1)return!1;let t=e.substring(i+1).toLowerCase();return o.SUPPORTED_EMAIL_ATTACHMENT_EXTS.includes(t)}hasUnsupportedAttachments(){return(this.attachments||[]).some(e=>!this.isSupportedEmailAttachment(e?.fileName||""))}getUnsupportedAttachmentMessage(){return`Step ${this.stepIndex+1}: Please upload a file in one of the following supported formats: PDF, DOC, DOCX, XLS, XLSX, JPG, PNG, or GIF.`}onUploadLogo(e){if(e.type==="addedToQueue"&&typeof e.file<"u"){let i=e.file?.name||e.nativeFile?.name||"";if(!this.isSupportedEmailAttachment(i)){this.skipNextAttachmentUpload=!0,this._toastrService.showError(this.getUnsupportedAttachmentMessage()),this.uploadInput.emit({type:"cancel",id:e.file.id}),this.uploadInput.emit({type:"remove",id:e.file.id}),this.fileInput?.nativeElement&&(this.fileInput.nativeElement.value=""),this._loaderService.stop();return}this.skipNextAttachmentUpload=!1}if(e.type==="allAddedToQueue"&&this.skipNextAttachmentUpload){this.skipNextAttachmentUpload=!1,this._loaderService.stop();return}if(this.fileInput.nativeElement.value="",this._loaderService.start(),e.type==="allAddedToQueue"){let i=localStorage.getItem("token"),t=Jo.baseUrl+ea.sharedUrl+"fileUpload";t+=`?moduleId=${this.moduleId}&isPublic=1`;let n={type:"uploadAll",url:t,method:"POST",headers:{Authorization:i}};this.uploadInput.emit(n)}else if(!(e.type==="addedToQueue"&&typeof e.file<"u"))if(e.type==="done"&&typeof e.file<"u"){if(this._loaderService.stop(),e?.file?.response?.statusCode==200&&e?.file?.response?.data){let i=e?.file?.response?.data?.[0]||{};this.attachments.push({url:i?.url,fileName:i?.name,fileType:this.getFileTypeFromName(i?.name)})}}else e.type==="dragOut"||e.type}getBuyer(e,i){let t={page:1,limit:1e3};this.recipientId="",this._loaderService.start(),(e==="Agent"?this._automationService.getDropDownAgentList(t):this._automationService.getDropDowBuyerList(t)).subscribe(c=>{c?.statusCode==200&&(this.recipientList=c?.data?.items||[],this.recipientId="",this.recipientList?.map(f=>{let S=this.normalizeNamePart(f?.firstName),v=this.normalizeNamePart(f?.lastName),b=[S,v].filter(
22Boolean).join(" ").trim();return f.contactName=b||"N/A",f.label=`${f?.contactName} (${f?.email||"N/A"})`,f}),i&&this.payload?.receiverDetails?.receiverId?.length&&(this.recipientId=this.payload?.receiverDetails?.receiverId?.[0]||""),this._loaderService.stop())},c=>{this._loaderService.stop()})}getVendor(e){let i={page:1,limit:1e3};this._loaderService.start(),this.recipientId="",this._automationService.getDropDowVendorList(i).subscribe(t=>{t?.statusCode==200&&(this.recipientList=t?.data?.items||[],this.recipientList?.map(n=>{let c=this.normalizeNamePart(n?.firstName),f=this.normalizeNamePart(n?.lastName),S=[c,f].filter(Boolean).join(" ").trim();return n.contactName=S||"N/A",n.label=`${n?.contactName} (${n?.email||"N/A"})`,n}),e&&this.payload?.receiverDetails?.receiverId&&(this.recipientId=this.payload?.receiverDetails?.receiverId?.[0]||"")),this._loaderService.stop()},t=>{this._loaderService.stop()})}deleteAttachment(e){this.attachments.splice(e,1)}normalizeNamePart(e){if(e==null||e==="null")return"";let i=String(e).trim();return i&&i!=="null"?i:""}formatPhoneNumber(e){return e?this._utilities.maskNumber(e):""}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getFileTypeFromName(e){if(!e)return"";let i=e.lastIndexOf(".");if(i===-1||i===e.length-1)return"";let t=e.substring(i+1).toLowerCase();return t==="doc"||t==="docx"||t==="xls"||t==="xlsx"?"DOC":t==="pdf"?"PDF":t==="mp3"?"MP3":t==="gif"?"GIF":t==="png"?"PNG":t==="jpeg"||t==="jpg"?"JPG":t==="mp4"?"MP4":t==="ico"?"ICO":t==="svg"?"SVG":t==="zip"?"ZIP":t==="txt"?"TXT":t==="rar"?"RAR":t==="json"?"JSON":t==="html"?"HTML":t==="dwg"?"DWG":t==="ai"?"AI":t==="csv"?"CSV":t==="webp"?"WEBP":t.toUpperCase()}getAttachmentIconKey(e){let i=(e||"").toLowerCase();return i==="jpg"?"jpeg":i}isFromEmailValid(){let e=this.senderDetails?.email?.toLowerCase()?.trim();return!!e&&na.emailPattern.test(e)}onEmailInputChange(){this.emailChecked=!1,this.isEmailExist=void 0,this.emailInvalidMessage="",this.showVerifyEmailLink=!1}verifyEmail(e){if(this.isViewOnly||!this.isFromEmailValid())return;let i=e||this.senderDetails?.email;i&&this.checkEmailForDisplay(i)}onVerifyEmailClick(){let e=this.senderDetails?.email;if(!e||!this.isFromEmailValid()){this._toastrService.showError("Please enter a valid email address first");return}this.openVerifyEmailDialog(e)}openVerifyEmailDialog(e){this.dialogRef=this._dialog.open(Sa,{width:"600px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",disableClose:!0,data:{email:e}}),this.dialogRef?.afterClosed()?.subscribe(()=>{e&&this.checkEmailForDisplay(e)})}onVerifyEmailTextClick(){this.senderDetails?.email&&this.isFromEmailValid()&&this.onVerifyEmailClick()}checkEmail(e){let i={email:e?.toLowerCase()?.trim()};return this.emailInvalidMessage="",this.emailChecked=!1,this.showVerifyEmailLink=!1,this._commonService.checkEmail(i).pipe(Lo(t=>t?.statusCode==200?(this.isEmailExist=t?.type=="SUCCESS",this.emailChecked=!0,this.isEmailExist?this.showVerifyEmailLink=!1:(this.emailInvalidMessage="Please verify email address.",this.showVerifyEmailLink=!0),this.isEmailExist):(this.isEmailExist=!1,this.emailChecked=!0,!1)),Ro(t=>(this.emailChecked=!0,this.isEmailExist=!1,t?.error&&t?.error?.message&&(this.emailInvalidMessage=t?.error?.message||"Please verify email address.",this.showVerifyEmailLink=!0),Qe(!1))))}checkEmailForDisplay(e){this._loaderService.start(),this.checkEmail(e).subscribe({next:()=>{this._loaderService.stop()},error:()=>{this._loaderService.stop()}})}annotationList(){this.dialogRef=this._dialog.open(cn,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{source:"send-email-box",recipientModuleId:this.recipientModuleId,moduleId:this.moduleId}}),this.dialogRef.afterClosed().subscribe(e=>{})}getPreview(){return this.subject||""}selectedRecipient(e){this.recipientId="",this.recipientList=[],e=="Seller"&&(this.recipientModuleId=this.mainStatusId.LEAD,this.receiverContactType="primary"),e=="Buyer"&&(this.recipientModuleId=this.mainStatusId.BUYER,this.receiverContactType=this.hidePrimaryRecipientOption?"other":"primary",this.getBuyer("Buyer",!0)),e=="Agent"&&(this.recipientModuleId=this.mainStatusId.AGENT,this.receiverContactType=this.hidePrimaryRecipientOption?"other":"primary",this.getBuyer("Agent",!0)),e=="Vendor"&&(this.recipientModuleId=this.mainStatusId.VENDOR,this.receiverContactType=this.hidePrimaryRecipientOption?"other":"primary",this.getVendor(!0))}captureInitialState(){this.isInitialStateCaptured||(this.initialSenderDetails=this.senderDetails?JSON.parse(JSON.stringify(this.senderDetails)):{},this.initialRecipientModuleId=this.recipientModuleId||"",this.initialReceiverContactType=this.receiverContactType||"",this.initialRecipientId=this.recipientId||"",this.initialTemplateId=this.templateId||"",this.initialSubject=this.subject||"",this.initialBody=this.body||"",this.initialAttachments=this.attachments?JSON.parse(JSON.stringify(this.attachments)):[],this.initialIsCC=this.isCC,this.initialCcString=this.ccString||"",this.initialIsBCC=this.isBCC,this.initialBccString=this.bccString||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}openEmailEditorDialog(){let e=this.body||"";this.dialogRef=this._dialog.open(_o,{width:"1800px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{message:e,design:this.emailDesignObject,isTextEditor:this.isTextEditor}}),this.dialogRef?.afterClosed()?.subscribe(i=>{i&&i?.html&&(this.body=i?.html||"",this.emailDesignObject=i?.design||null,this.emailPreviewHtml=this.getSanitizedHtml(i?.html))})}openEmailPreviewDialog(){let e=this.body||"";this.dialogRef=this._dialog.open(_o,{width:"1800px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{message:e,design:this.emailDesignObject,isTextEditor:this.isTextEditor,isPreviewMode:!0}}),this.dialogRef?.afterClosed()?.subscribe(()=>{})}toggleEditorMode(e){this.clearAllTemplateData(!1),this.clearTemplateFormFields(),this.resetCcBccFields(),e?(this.isTextEditor=e,this.emailPreviewHtml=null,this.openEmailEditorDialog()):(this.isTextEditor=!1,this.emailPreviewHtml=null)}clearAllTemplateData(e=!1){this.clearTemplateData(),this.clearTemplateFormFields(),e&&(this.isTextEditor=!1),this.resetCcBccFields()}clearTemplateData(){this.templateId=null,this.emailTemplateName="",this.emailPreviewHtml=null,this.emailDesignObject=null,this.attachments=[]}clearTemplateFormFields(){this.attachments=[],this.subject="",this.body="",this.templateId="",this.emailTemplateName=""}resetCcBccFields(){this.isCC=!1,this.isBCC=!1,this.ccString="",this.bccString=""}getSanitizedHtml(e){return e?this._sanitizer.bypassSecurityTrustHtml(e):null}formatPlainTextForQuill(e){return String(e||"").replace(/\r\n|\r|\n/g,"<br>")}hasChanges(){if(!this.isInitialStateCaptured)return!1;if(JSON.stringify(this.senderDetails)!==JSON.stringify(this.initialSenderDetails)||this.recipientModuleId!==this.initialRecipientModuleId||this.receiverContactType!==this.initialReceiverContactType||this.recipientId!==this.initialRecipientId||this.templateId!==this.initialTemplateId||this.subject!==this.initialSubject||this.body!==this.initialBody||this.isCC!==this.initialIsCC||this.ccString!==this.initialCcString||this.isBCC!==this.initialIsBCC||this.bccString!==this.initialBccString)return!0;let e=i=>!i||!Array.isArray(i)?[]:i.map(t=>({fileName:t?.fileName||"",fileType:t?.fileType||"",url:t?.url||""})).sort((t,n)=>t.fileName>n.fileName?1:t.fileName<n.fileName?-1:0);return JSON.stringify(e(this.attachments))!==JSON.stringify(e(this.initialAttachments))||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emailTemplateSelection(){let e=this.getEmailTemplateModuleId();this.dialogRef=this._dialog.open($t,{disableClose:!0,width:"600px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{moduleId:e,moduleTypeId:[e],templateType:"email",openedFromEmailSendDialog:!0}}),this.dialogRef.afterClosed().subscribe(i=>{i&&this.applyEmailTemplate(i)})}getEmailTemplateModuleId(){return[this.mainStatusId.LEAD,this.mainStatusId.INVENTORY,this.mainStatusId.SOLD,this.mainStatusId.RENTAL].includes(this.moduleId)?this.mainStatusId.LEAD:this.moduleId}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(Ue),E(H),E(Y),E(Me),E(q),E(zo),E(Qt))}}static{this.\u0275cmp=B({type:o,selectors:[["app-send-email-box"]],viewQuery:function(i,t){if(i&1&&We(ep,5)(tp,5),i&2){let n;ie(n=ne())&&(t.editor=n.first),ie(n=ne())&&(t.fileInput=n.first)}},inputs:{previewText:"previewText",payload:"payload",moduleId:"moduleId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
vendor: 4,735 bytes, line 22
22y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["uploader",""],["selectedItem",""],["item",""],["emailEditor",""],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-kanban-pink","rounded-[20px]"],["src","assets/images/icons/email-white.svg","alt","email-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Send Email",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[10px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click"],[1,"flex","gap-[12px]"],[1,"flex-1"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["type","text","placeholder","John Smith",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","justify-between"],[1,"flex","gap-[3px]","text-h3","text-primary-90","font-semibold","mb-[10px]","cursor-pointer","hover:opacity-80","transition-opacity"],[1,"relative"],["type","email","placeholder","[email protected]",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","blur","ngModel","disabled"],[1,"text-danger","text-[12px]","mt-[5px]"],[1,"flex","gap-[10px]"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[15px]","py-[10px]","text-h4","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click","ngClass","disabled"],[1,"flex","flex-col","self-stretch","gap-[20px]"],[1,"w-full"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","flex-col","gap-[20px]"],[1,"text-sub-heading","text-transparency-90","font-medium"],[1,"flex","items-center","justify-between","gap-[10px]","min-w-0"],[1,"flex","items-center","gap-[6px]","min-w-0","flex-1","text-h2/[22px]","text-transparency-100","font-semibold"],[1,"shrink-0"],["tooltipPosition","top",1,"min-w-0","truncate","text-h4","text-transparency-90","font-medium",3,"pTooltip"],[1,"flex","gap-[10px]","shrink-0"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[15px]","py-[10
22px]","text-h4","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"disabled"],[1,"flex","flex-col","gap-[20px]","mt-[10px]"],["placeholder","Type...",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],[1,"flex","items-center","gap-[10px]"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer","hover:opacity-80","transition-opacity"],[1,"inline-flex","items-center","gap-[3px]","p-[3px]","bg-transparency-15","rounded-[40px]","border-[1px]","border-solid","border-transparency-25"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[8px]","py-[5px]","text-h4","font-semibold","rounded-[30px]","border-[1px]","border-solid","transition-all","duration-200",3,"click","ngClass"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","px-[10px]","py-[12px]","min-h-[200px]","max-h-[400px]","overflow-y-auto","leading-normal","font-normal","[&_p]:mt-0","[&_p]:mb-0","[&_img]:max-w-full","[&_img]:h-auto","[&_a]:text-inherit","[&_a]:underline",3,"innerHTML"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","px-[10px]","py-[12px]","min-h-[200px]","flex","items-center","justify-center","text-transparency-60"],[1,"w-full","h-[120px]","min-h-[120px]","resize-y","overflow-hidden","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","bg-transparency-0"],[1,"text-h4","font-semibold","text-transparency-90"],[1,"text-primary-90","cursor-pointer","hover:text-primary-100",3,"click"],[1,"flex","items-center","justify-between","gap-[5px]"],[1,"text-h2","text-transparency-100","font-semibold"],["type","button",1,"flex-none","flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click","disabled"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],["type","file","ngFileSelect","","accept",".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",1,"d-none",3,"uploadOutput","uploadInput","disabled"],[1,"group","flex","items-center","justify-between","gap-[10px]","p-[5px]","rounded-[10px]","border-[1px]","border-solid","border-transparency-0","cursor-pointer","hover:border-activity-outbound-hover-border","hover:bg-activity-outbound-hover-bg"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel"],[3,"value"],[1,"flex","gap-[3px]","text-h3","text-primary-90","font-semibold","mb-[10px]","cursor-pointer","hover:opacity-80","transition-opacity",3,"click"],[1,"text-h3","text-transparency-100","font-semibold","mr-3"],[1,"flex","items-center","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-1
225","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio",1,"peer","opacity-0","absolute",3,"ngModelChange","click","name","ngModel","value","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],["type","radio","value","primary",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","other",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["optionLabel","label","optionValue","_id","filterBy","label","appendTo","body","placeholder","--Select--","scrollHeight","250px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","options","filter","showClear","disabled"],[1,"flex","items-center","gap-2","truncate"],[1,"flex","items-center","gap-2"],[1,"text-transparency-90"],[1,"flex","items-center","gap-[20px]"],["type","email","placeholder","[email protected], [email protected]",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","42","height","42",1,"img-fluid","cursor-pointer","flex-none"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","42","height","42",1,"img-fluid","cursor-pointer","flex-none",3,"click"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[15px]","py-[10px]","text-h4","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click","disabled"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer","hover:opacity-80","transition-opacity",3,"click"],[1,"text-h4"],[1,"block","!h-full","!w-full","text-p","text-transparency-100","font-semibold","focus:outline-none","[&_.ql-toolbar]:hidden","[&_.ql-container]:!h-full","[&_.ql-container]:!border-0","[&_.ql-editor]:!h-full","[&_.ql-editor]:!min-h-full","[&_.ql-editor]:box-border","[&_.ql-editor]:overflow-y-auto",3,"ngModelChange","name","ngModel","styles","modules","placeholder","disabled"],[1,"flex","items-center","gap-[10px]","overflow-hidden","cursor-pointer",3,"click"],[1,"flex-none","flex","p-[7px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25","opacity-60","group-hover:opacity-100"],["alt","file-jpg","width","20","height","20",1,"img-fluid",3,"src"],[1,"text-h4","text-primary-90","font-semibold","truncate"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1",1,"img-fluid","cursor-pointer","grayscale","group-hover:grayscale-0"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1",1,"img-fluid","cursor-pointer","grayscale","group-hover:grayscale-0",3,"click"]],template:function(i,t){i&1&&(r(0,"div",4)(1,"div",5),h(2,"img",6)(3,"span",7),a()(),r(4,"div",8)(5,"div",9),h(6,"img",10),a(),r(7,"div",11)(8,"div",12)(9,"h2",13),p(10," Send Email "),a()(),x(11,np,2,1,"h4",14),a(),r(12,"div",15)(13,"div",16),p(14),a(),x(15,op,2,0,"div",17),r(16,"div",18),y("click",function(){return t.onToggleExpanded()}),h(17,"img",19),a()()(),x(18,Pp,91,31,"div",20)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,aa,L,Z,he,Pt,Jt],encapsulation:2})}}return o}
22)()});function Up(o,l){if(o&1&&(r(0,"h4",13),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Wp(o,l){if(o&1){let e=C();r(0,"div",20),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",21),a()}}function jp(o,l){if(o&1&&(r(0,"p",39),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function qp(o,l){if(o&1){let e=C();r(0,"div",22)(1,"div",25)(2,"label",34),p(3," Delay before executing this step "),h(4,"img",35),a(),r(5,"div",36)(6,"input",37),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",38),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,jp,2,1,"p",39),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Gp(o,l){if(o&1&&(r(0,"option",43),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Hp(o,l){if(o&1){let e=C();r(0,"select",40),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Gp,2,2,"option",43,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Yp(o,l){if(o&1&&(r(0,"p",39),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function zp(o,l){if(o&1){let e=C();r(0,"div",22)(1,"div",25)(2,"label",34),p(3," Execute on "),h(4,"img",35),a(),r(5,"div",36)(6,"select",40),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",41),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Hp,3,2,"select",42),a(),x(11,Yp,2,1,"p",39),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Jp(o,l){if(o&1){let e=C();r(0,"div",23)(1,"div",44)(2,"h3",45),p(3," AI SMS Assist "),a(),r(4,"p",46),p(5," SMS Assist crafts tailored messages for each contact automatically. "),a()(),r(6,"label",47)(7,"input",48),y("ngModelChange",function(t){u(e);let n=d(2);return _(n.onAiSmsAssistChange(t))}),a(),h(8,"span",49),a()()}if(o&2){let e=d(2);s(7),m("name","aiSmsAssist_"+e.actionId)("ngModel",e.aiSmsAssistEnabled)("disabled",e.isViewOnly)}}function Qp(o,l){o&1&&(r(0,"div",24),p(1," AI will create a personalized message based on the previous conversation with contact. "),a())}function $p(o,l){if(o&1&&p(0),o&2){let e=d(3);T(" Template Selected: \u201C",e.smsTemplateName,"\u201D ")}}function Kp(o,l){if(o&1){let e=C();r(0,"div",25)(1,"div",50)(2,"label",51),p(3," Message text "),h(4,"img",35),a(),r(5,"h3",52),y("click",function(){u(e);let t=d(2);return _(t.smsTemplateSelection())}),p(6," Select Template "),a()(),r(7,"div",53)(8,"quill-editor",54,0),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.messageText,t)||(n.messageText=t),_(t)}),a()(),r(10,"div",55)(11,"p",56),x(12,$p,1,1),a()()()}if(o&2){let e=d(2);s(8),m("name","messageText_"+e.actionId),w("ngModel",e.messageText),m("styles",e.editorStyle)("modules",rt(7,Fp,e.editorOptions==null?null:e.editorOptions.mention))("placeholder",e.editorOptions==null?null:e.editorOptions.placeholder)("disabled",e.isViewOnly),s(4),g(e.smsTemplateName?12:-1)}}function Xp(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",62),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Seller"))}),a(),h(2,"img",63),p(3," Seller"),a()}if(o&2){let e=d(3);
22s(),m("name","whomsend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.LEAD)("disabled",e.isViewOnly)}}function Zp(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",62),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Buyer"))}),a(),h(2,"img",63),p(3," Buyer"),a()}if(o&2){let e=d(3);s(),m("name","whomsend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.BUYER)("disabled",e.isViewOnly)}}function em(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",62),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Agent"))}),a(),h(2,"img",63),p(3," Agent"),a()}if(o&2){let e=d(3);s(),m("name","whomesend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.AGENT)("disabled",e.isViewOnly)}}function tm(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",62),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientModuleId,t)||(n.recipientModuleId=t),_(t)}),y("click",function(){u(e);let t=d(3);return _(t.selectedRecipient("Vendor"))}),a(),h(2,"img",63),p(3," Vendor"),a()}if(o&2){let e=d(3);s(),m("name","whomsend_"+e.actionId),w("ngModel",e.recipientModuleId),m("value",e.mainStatusId.VENDOR)("disabled",e.isViewOnly)}}function im(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",65),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.recipientType,t)||(n.recipientType=t),_(t)}),a(),h(2,"img",63),p(3),a()}if(o&2){let e=d(4);s(),m("name","buyerContact_"+e.actionId),w("ngModel",e.recipientType),m("disabled",e.isViewOnly),s(2),T(" ",e.recipientModuleId==e.mainStatusId.LEAD?"Primary Contact":e.recipientModuleId==e.mainStatusId.BUYER?"Primary Buyer":e.recipientModuleId==e.mainStatusId.AGENT?"Primary Agent":e.recipientModuleId==e.mainStatusId.VENDOR?"Primary Vendor":""," ")}}function nm(o,l){if(o&1){let e=C();r(0,"label",59)(1,"input",66),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.recipientType,t)||(n.recipientType=t),_(t)}),a(),h(2,"img",63),p(3),a()}if(o&2){let e=d(4);s(),m("name","buyerContact_"+e.actionId),w("ngModel",e.recipientType),m("disabled",e.isViewOnly),s(2),T(" Other ",e.recipientModuleId==e.mainStatusId.BUYER?"Buyer":e.recipientModuleId==e.mainStatusId.AGENT?"Agent":e.recipientModuleId==e.mainStatusId.VENDOR?"Vendor":"")}}function om(o,l){if(o&1&&(r(0,"div",25)(1,"label",64),p(2),a(),r(3,"div",58),x(4,im,4,4,"label",59),x(5,nm,4,4,"label",59),a()()),o&2){let e=d(3);s(2),T(" Select ",e.recipientModuleId==e.mainStatusId.LEAD?"seller":e.recipientModuleId==e.mainStatusId.BUYER?"buyer":e.recipientModuleId==e.mainStatusId.AGENT?"agent":"vendor"," contact(s) to send SMS to"),s(2),g(e.hidePrimaryRecipientOption?-1:4),s(),g(e.recipientModuleId!=e.mainStatusId.LEAD?5:-1)}}function am(o,l){if(o&1&&(r(0,"div",68),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e==null?null:e.label," ")}}function rm(o,l){if(o&1&&(r(0,"div",69),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e==null?null:e.label," ")}}function lm(o,l){if(o&1){let e=C();r(0,"div",25)(1,"label",34),p(2),h(3,"img",35),a(),r(4,"p-select",67),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.recipientId,t)||(n.recipientId=t),_(t)}),Ne(5,am,2,1,"ng-template",null,1,ze)(7,rm,2,1,"ng-template",null,2,ze),a()()}if(o&2){let e=d(3);s(2),T(" Select ",e.recipientModuleId==e.mainStatusId.BUYER?"buyer":e.recipientModuleId==e.mainStatusId.AGENT?"agent":e.recipientModuleId==e.mainStatusId.VENDOR?"vendor":""," contact "),s(2),w("ngModel",e.recipientId),m("options",e.recipientList)("filter",!0)("showClear",!0)("disabled",e.isViewOnly)}}function sm(o,l){if(o&1&&(r(0,"div",33)(1,"h3",57),p(2," Select recipient "),a(),r(3,"div",58),x(4,Xp,4,4,"label",59),x(5,Zp,4,4,"label",59),x(6,em,4,4,"label",59),x(7,tm,4,4,"label",59),a(),r(8,"div",60),h(9,"svg-icon",61),a(),x(10,om,6,3,"div",25),x(11,lm,9,6,"div",25),a()),o&2){let e=d(2);s(4),g(e.shouldShowRecipientOption("LEAD")?4:-1),s(),g(e.shouldShowRecipientOption("BUYER")?5:-1),s(),g(e.shouldShowRecipientOption("AGENT")?6:-1),s(),g(e.shouldShowRecipientOption("VENDOR")?7:-1),s(3),g(e.recipientModuleId!=""?10:-1),s(),g(e.recipientType=="other"&&e.recipientModuleId!=e.mainStatusId.LEAD?11:-1)}}function dm(o,l){if(o&1){let e=C();r(0,"div",25)(1,"label",64),p(2," Select the phone number to send SMS from"),a(),r(3,"div",58)(4,"label",59)(5,"input",70),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.selectionType,t)||(n.selectionType=t),_(t)}),a(),h(6,"img",63),p(7," Marketing tracking number"),a(),r(8,"label",59)(9,"input",71),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.selectionType,t)||(n.selectionType=t),_(t)}),a(),h(10,"img",63),p(11," Other Number"),a()()()}if(o&2){let e=d(2);s(5),m("name","phonenumber_"+e.actionId),w("ngModel",e.selectionType),m("disabled",e.isViewOnl
22y),s(4),m("name","phonenumber_"+e.actionId),w("ngModel",e.selectionType),m("disabled",e.isViewOnly)}}function cm(o,l){if(o&1&&(r(0,"option",43),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e.value),s(),T(" ",e==null?null:e.name," ")}}function pm(o,l){if(o&1){let e=C();r(0,"select",75),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.selectedPhoneNumber,t)||(n.selectedPhoneNumber=t),_(t)}),r(1,"option",76),p(2,"--Select campaign--"),a(),D(3,cm,2,2,"option",43,k),a()}if(o&2){let e=d(3);w("ngModel",e.selectedPhoneNumber),m("disabled",e.isViewOnly),s(3),V(e.numberList)}}function mm(o,l){if(o&1){let e=C();r(0,"button",77),y("click",function(){u(e);let t=d(3);return _(!t.isViewOnly&&t.openChangeNumberDialog())}),r(1,"span",78),p(2),a(),h(3,"svg-icon",79),a()}if(o&2){let e=d(3);m("disabled",e.isViewOnly),s(2),ce(e.getSelectedPhoneNumberLabel())}}function um(o,l){o&1&&(r(0,"div",74),p(1," If Marketing tracking number is not available then \u201CFallback communication number\u201D will be used "),a())}function _m(o,l){if(o&1&&(r(0,"div",60),h(1,"svg-icon",61),a(),r(2,"div",25)(3,"label",34),p(4),h(5,"img",35),a(),x(6,pm,5,2,"select",72)(7,mm,4,2,"button",73),x(8,um,2,0,"div",74),a()),o&2){let e=d(2);s(4),T(" ",e.selectionType=="OTHER_NUMBER"?"Select the phone number":"Fallback communication number"," "),s(2),g(e.isListStackingModule?6:7),s(2),g(e.selectionType!="OTHER_NUMBER"?8:-1)}}function hm(o,l){if(o&1){let e=C();r(0,"div",19),x(1,qp,17,5,"div",22),x(2,zp,12,6,"div",22),r(3,"div",22),x(4,Jp,9,3,"div",23),x(5,Qp,2,0,"div",24)(6,Kp,13,9,"div",25),r(7,"div",25)(8,"label",26)(9,"div",27)(10,"input",28),A("ngModelChange",function(t){u(e);let n=d();return I(n.skipHolidayOnWeekendAndPublicHolidays,t)||(n.skipHolidayOnWeekendAndPublicHolidays=t),_(t)}),a(),h(11,"span",29),a(),r(12,"span",30),p(13,"Skip this step on weekends and public holidays "),r(14,"div",31),h(15,"svg-icon",32),a()()()()(),x(16,sm,12,6,"div",33),r(17,"div",22),x(18,dm,12,6,"div",25),x(19,_m,9,3),a()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(2),g(e.aiSmsAssistAvailable?4:-1),s(),g(e.aiSmsAssistActive?5:6),s(5),w("ngModel",e.skipHolidayOnWeekendAndPublicHolidays),m("disabled",e.isViewOnly),s(4),m("pTooltip",e.skipHolidayTooltip)("escape",!1),s(2),g(e.isListStackingModule?-1:16),s(2),g(e.isListStackingModule?-1:18),s(),g(e.selectionType=="OTHER_NUMBER"||e.selectionType=="DEFAULT_CAMPAIGN_NUMBER"?19:-1)}}var Rp,Fp,_n,hn=ee(()=>{W();To();_a();ho();fa();Re();W();fe();Ce();Ee();xe();Lt();St();at();uo();be();se();pe();Ve();He();Di();mo();Rp=["editor"],Fp=o=>({toolbar:!1,mention:o});_n=(()=>{class o{get items(){return this._annotationListService?.getSmsModuleMentionItems({moduleId:this.isListStackingModule?this.moduleId:this.recipientModuleId})||[]}get skipHolidayTooltip(){return this.delayPreferenceData?.delayPreference==="Day Based"?"If this step falls on a weekend or public holiday, it will be moved to the next business day. Other day-based steps will keep their scheduled dates unless this option is also enabled for those steps.":"If this step falls on a weekend or public holiday, it will be moved to the next business day. All subsequent delay-based steps will be adjusted accordingly to preserve the configured delays."}constructor(e,i,t,n,c,f,S,v){this._dialog=e,this._loaderService=i,this._toastrService=t,this._utilities=n,this._leadsService=c,this._commonService=f,this._automationService=S,this._annotationListService=v,this.previewText=`Hi {{ "Firstname" }}, hope you're doing well`,this.payload={},this.moduleId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"08:00 AM"},this.delayOrDayBased="",this.messageText="",this.aiSmsAssistEnabled=!1,this.smsFilterBody="",this.isExpanded=!0,this.editorConfig={},this.editorOptions={},this.skipHolidayOnWeekendAndPublicHolidays=!1,this.selectionType="DEFAULT_CAMPAIGN_NUMBER",this.selectedPhoneNumber="",this.numberList=[],this.accountCommunicationNumTypeIds=[1,2,4,5,6,7],this.recipientModuleId=O.MainStatusId.LEAD,this.recipientType="primary",this.smsTemplateId="",this.smsTemplateName="",this.recipientList=[],this.recipientId="",this.mainStatusId=O.MainStatusId,this.initialMessageText="",this.initialAiSm
22sAssistEnabled=!1,this.initialSkipHolidayOnWeekendAndPublicHolidays=!1,this.initialSelectionType="",this.initialSelectedPhoneNumber="",this.initialRecipientModuleId="",this.initialRecipientType="",this.initialRecipientId="",this.initialSmsTemplateId="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this.getDayBasedTimeOptions(this._utilities?.timeList12HourFormat),this.editorOptions={placeholder:this._utilities.commonEditor().placeholder,toolbar:this._utilities.commonEditor().toolbar,mention:this.mentionEditor()}}getDayBasedTimeOptions(e){let i=this.parseTimeToMinutes("08:00 AM"),t=this.parseTimeToMinutes("08:00 PM");return(e||[]).filter(n=>{let c=this.parseTimeToMinutes(n);return c>=i&&c<=t})}parseTimeToMinutes(e){let i=(e||"").trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!i)return-1;let t=parseInt(i[1],10),n=parseInt(i[2],10);return i[3].toUpperCase()==="AM"?t===12&&(t=0):t!==12&&(t+=12),t*60+n}clampExecuteOnTimeToOptions(){!this.executeOn?.time||!this.timeOption?.length||this.timeOption.includes(this.executeOn.time)||(this.executeOn.time=this.timeOption[0])}ngOnInit(){this.applyPayload(),this.syncRecipientModuleByAutomationModule(),this.ensureRecipientTypeForHiddenPrimary(),this.getNumberList(),this.loadRecipientListIfOther()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.syncRecipientModuleByAutomationModule(),this.ensureRecipientTypeForHiddenPrimary(),this.isInitialStateCaptured=!1,this.getNumberList(),this.loadRecipientListIfOther()),e.moduleId&&!e.moduleId.firstChange&&(this.syncRecipientModuleByAutomationModule(),this.ensureRecipientTypeForHiddenPrimary(),this.loadRecipientListIfOther())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn),this.clampExecuteOnTimeToOptions()),typeof this.payload?.skipHolidayOnWeekendAndPublicHolidays=="boolean"&&(this.skipHolidayOnWeekendAndPublicHolidays=this.payload.skipHolidayOnWeekendAndPublicHolidays),this.payload?.phoneNumberSelection?.selectionType&&(this.selectionType=this.payload.phoneNumberSelection.selectionType),this.payload?.phoneNumberSelection?.selectedPhoneNumber&&(this.selectedPhoneNumber=this.payload.phoneNumberSelection.selectedPhoneNumber),this.payload?.smsTemplateId&&(this.smsTemplateId=this.payload.smsTemplateId),typeof this.payload?.messageText<"u"&&(this.messageText=this.formatMessageTextForQuill(this.payload.messageText)),(typeof this.payload?.isAISMSAssist=="boolean"||typeof this.payload?.isAIEnabled=="boolean")&&(this.aiSmsAssistEnabled=!!(this.payload?.isAISMSAssist??this.payload?.isAIEnabled)),this.payload?.recipientDetails?.recipientType&&(this.recipientType=this.payload.recipientDetails.recipientType),this.payload?.recipientDetails?.moduleId&&(this.recipientModuleId=this.payload.recipientDetails.moduleId)}loadRecipientListIfOther(){this.recipientModuleId===this.mainStatusId.BUYER&&(this.recipientType==="other"||this.moduleId===this.mainStatusId.BUYER)?this.getBuyer("Buyer",!0):this.recipientModuleId===this.mainStatusId.AGENT&&(this.recipientType==="other"||this.moduleId===this.mainStatusId.AGENT)?this.getBuyer("Agent",!0):this.recipientModuleId===this.mainStatusId.VENDOR&&(this.recipientType==="other"||this.moduleId===this.mainStatusId.VENDOR)&&this.getVendor(!0)}syncRecipientModuleByAutomationModule(){if(this.moduleId===this.mainStatusId.LISTSTACKING){this.recipientModuleId=this.mainStatusId.LEAD,this.recipientType="primary",this.selectionType="OTHER_NUMBER";return}(this.moduleId===this.mainStatusId.BUYER||this.moduleId===this.mainStatusId.AGENT||this.moduleId===this.mainStatusId.VENDOR)&&(this.aiSmsAssistEnabled=!1,this.recipientModuleId=this.moduleId)}get isListStackingModule(){return this.moduleId===this.mainStatusId.LISTSTACKING}isBuyerAgentVendorModule(e){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(e)}isLeadOrPropertyPipelineModule(){return[this.mainStatusId.LEAD,this.mainStatusId.WHOLESALEPIPELINE,this.mainStatusId.INVENTORY,this.mainStatusId.SOLD,this.mainStatusId.RENTAL].includes(this.moduleId)}get hidePrimaryRecipientOption(){return this.isLeadOrPropertyPipelineModule()&&this.isBuyerAgentVendorModule(this.recipientModuleId)}ensureRecipientTypeForHiddenPrimary(){this.hidePrimaryRecipientOption&&this.recipientType==="primary"&&(this.recipientType="other")}get aiSmsAssistAvailable(){return!this.isListStackingModule&&!this.isBuyerAgentVendorModule(this.moduleId)&&!this.isBuyerAgentVendorModule(this.recipientModuleId)}get aiSmsAssistActive(){return this.aiSmsAssistAvailable&&this.aiSmsAssistEnabled}onAiSmsAssistChange(e){this.aiSmsAssistEnabled=e,this.aiSmsAssistActive&&[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.recipientModuleId)&&(this.selectedRecipient("Seller"),this.recipientModuleId=this.mainStatusId.LEAD)}shouldShowRecipientOption(e){return this.isListStackingModule||this.aiSmsAssistActive&&["BUYER","AGENT","VENDOR"].includes(e)?!1:[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)?this.moduleId===this.mainStatusId[e]:!0}onToggleExpanded(){this.isExpanded=!this.isExpanded}getSmsTemplateModuleId(){return[this.mainStatusId.LEAD,this.mainStatusId.WHOLESALEPIPELINE,this.mainStatusId.INVENTORY,this.mainStatusId.SOLD,this.mainStatusId.RENTAL].includes(this.moduleId)?this.mainStatusId.LEAD:this.moduleId}smsTemplateSelection(){let e=this.getSmsTemplateModuleId();this.dialogRef=this._dialog.open($t,{disableClose:!0,width:"600px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{moduleId:e,moduleTypeId:[e],templateType:"sms"}}),this.dialogRef.afterClosed().subscribe(i=>{i&&(this.messageText=this.formatMessageTextForQuill(i.message),this.smsTemplateId=i?._id,this.smsTemplateName=i?.templateName||"")})}formatMessageTextForQuill(e){let i=String(e||"").replace(/\r\n|\r/g,`
23`);return this._utilities?.populateEditorDataWithBR?.(this.items,i)||i.replace(/\n/g,"<br>")}mentionEditor(){return{mentionListClass:"ql-mention-list mat-elevation-z8",allowedChars:/^[A-Za-z0-9\sÅÄÖåäö_]*$/,showDenotationChar:!0,spaceAfterInsert:!0,positioningStrategy:"fixed",defaultMenuOrientation:"bottom",onSelect:(e,i)=>{let t=this.editor?.quillEditor;i(e),t?.insertText(t?.getLength()-1,"","user")},source:(e,i)=>{let t=this.items.map((n,c)=>({id:c,value:n}));if(e?.length===0)i(t,e);else{let n=[];t.forEach(c=>{c?.value?.toLowerCase().indexOf(e?.toLowerCase())!==-1&&n.push(c)}),i(n,e)}}}}getNumberList(){if(this.isListStackingModule){this.loadListStackingNumbers();return}this.loadAccountCommunicationNumbers()}loadAccountCommunicationNumbers(){this._commonService.dropDownNumberList({numTypeIdArray:this.accountCommunicationNumTypeIds}).subscribe(e=>{if(e?.statusCode==200){let i=e?.data?.items??[];this.numberList=i.map(t=>({_id:t?._id,number:t?.number,numTypeId:t?.numTypeId,name:`${t?.marketingTitle||"Number"} | ${this._utilities.maskNumber(t?.number)}`,value:t?._id,callFlow:t?.callFlow})),this.restoreSelectedPhoneNumber(),setTimeout(()=>{this.captureInitialState()},500)}},()=>{})}loadListStackingNumbers(){let e={page:1,limit:100,numTypeIdArray:[O.NumberType.LISTSTACKING]};this._commonService.getNumberList(e).subscribe(i=>{i&&i?.statusCode==200&&(this.numberList=i?.data?.items?.map(t=>({_id:t?._id,number:t?.number,name:`${t?.marketingTitle||"Number"} - ${this._utilities.maskNumber(t?.number)}`,value:t?._id,callFlow:t?.callFlow}))||[],this.restoreSelectedPhoneNumber(),setTimeout(()=>{this.captureInitialState()},500))},()=>{})}restoreSelectedPhoneNumber(){let e=this.payload?.phoneNumberSelection?.selectedPhoneNumber;if(!e)return;let i=this.numberList?.find(t=>t?._id==e||t?.value==e||t?.number==e);this.selectedPhoneNumber=i?._id!=null?String(i._id):String(e)}
23openChangeNumberDialog(){if(this.isViewOnly||this.isListStackingModule)return;let e=this.numberList?.find(t=>t?._id==this.selectedPhoneNumber||t?.value==this.selectedPhoneNumber||t?.number==this.selectedPhoneNumber);this._dialog.open(Ni,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",maxHeight:"92vh",data:{numberId:e?._id||this.selectedPhoneNumber||"",initialSelectedNumberId:e?._id||this.selectedPhoneNumber||"",moduleId:this.moduleId,fromAutomations:!0}})?.afterClosed()?.subscribe(t=>{if(!t?.number)return;let n=t?.defaultNumberId??t?.numberId??"";if(!n)return;if(!this.numberList?.find(f=>f?._id==n||f?.number===t?.number)){let f=t?.marketingTitle||"Number";this.numberList=[...this.numberList,{_id:n,number:t?.number,numTypeId:t?.numTypeId,name:`${f} | ${this._utilities?.maskNumber?.(t?.number)||t?.number}`,value:n}]}this.selectedPhoneNumber=String(n)})}getSelectedPhoneNumberLabel(){if(!this.selectedPhoneNumber?.trim())return"Select number";let e=this.numberList?.find(i=>i?._id==this.selectedPhoneNumber||i?.value==this.selectedPhoneNumber||i?.number==this.selectedPhoneNumber);return e?.name?e.name:"Select number"}getBuyer(e,i){let t={page:1,limit:1e3};this.recipientId="",this._loaderService.start(),(e==="Agent"?this._automationService.getDropDownAgentList(t):this._automationService.getDropDowBuyerList(t)).subscribe(c=>{c?.statusCode==200&&(this.recipientList=c?.data?.items||[],this.recipientId="",this.recipientList?.map(f=>{let S=this.normalizeNamePart(f?.firstName),v=this.normalizeNamePart(f?.lastName),b=[S,v].filter(Boolean).join(" ").trim();return f.contactName=b||"N/A",f.label=`${f?.contactName}-${this.formatPhoneNumber(f?.contactNumber)}`,f}),i&&this.payload?.recipientDetails?.recipientId?.length&&(this.recipientId=this.payload?.recipientDetails?.recipientId?.[0]||""),this._loaderService.stop())},c=>{this._loaderService.stop()})}getVendor(e){let i={page:1,limit:1e3};this.recipientId="",this._loaderService.start(),this._automationService.getDropDowVendorList(i).subscribe(t=>{t?.statusCode==200&&(this.recipientList=t?.data?.items||[],this.recipientList?.map(n=>{let c=this.normalizeNamePart(n?.firstName),f=this.normalizeNamePart(n?.lastName),S=[c,f].filter(Boolean).join(" ").trim();return n.contactName=S||"N/A",n.label=`${n?.contactName}-${this.formatPhoneNumber(n?.contactNumber)}`,n}),e&&this.payload?.recipientDetails?.recipientId&&(this.recipientId=this.payload?.recipientDetails?.recipientId?.[0]||"")),this._loaderService.stop()},t=>{this._loaderService.stop()})}normalizeNamePart(e){if(e==null||e==="null")return"";let i=String(e).trim();return i&&i!=="null"?i:""}formatPhoneNumber(e){return e?this._utilities.maskNumber(e):""}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.aiSmsAssistActive?"AI SMS Assist enabled":this.messageText?this.messageText.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim():""}selectedRecipient(e){this.recipientId="",this.recipientList=[],e=="Seller"&&(this.recipientModuleId=this.mainStatusId.LEAD,this.recipientType="primary"),e=="Buyer"&&(this.recipientModuleId=this.mainStatusId.BUYER,this.recipientType=this.hidePrimaryRecipientOption?"other":"primary",this.aiSmsAssistEnabled=!1,this.getBuyer("Buyer",!0)),e=="Agent"&&(this.recipientModuleId=this.mainStatusId.AGENT,this.recipientType=this.hidePrimaryRecipientOption?"other":"primary",this.aiSmsAssistEnabled=!1,this.getBuyer("Agent",!0)),e=="Vendor"&&(this.recipientModuleId=this.mainStatusId.VENDOR,this.recipientType=this.hidePrimaryRecipientOption?"other":"primary",this.aiSmsAssistEnabled=!1,this.getVendor(!0))}captureInitialState(){this.isInitialStateCaptured||(this.initialMessageText=this.messageText||"",this.initialAiSm
23sAssistEnabled=this.aiSmsAssistEnabled,this.initialSkipHolidayOnWeekendAndPublicHolidays=this.skipHolidayOnWeekendAndPublicHolidays,this.initialSelectionType=this.selectionType||"",this.initialSelectedPhoneNumber=this.selectedPhoneNumber||"",this.initialRecipientModuleId=this.recipientModuleId||"",this.initialRecipientType=this.recipientType||"",this.initialRecipientId=this.recipientId||"",this.initialSmsTemplateId=this.smsTemplateId||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.messageText!==this.initialMessageText||this.aiSmsAssistEnabled!==this.initialAiSmsAssistEnabled||this.skipHolidayOnWeekendAndPublicHolidays!==this.initialSkipHolidayOnWeekendAndPublicHolidays||this.selectionType!==this.initialSelectionType||this.selectedPhoneNumber!==this.initialSelectedPhoneNumber||this.recipientModuleId!==this.initialRecipientModuleId||this.recipientType!==this.initialRecipientType||this.recipientId!==this.initialRecipientId||this.smsTemplateId!==this.initialSmsTemplateId||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}getPayloadMessageText(){let e=this._utilities.getTextWithMentions(String(this.messageText||""));return this._utilities.cleanHtmlEntities(e).replace(/\n$/,"")}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(H),E(Y),E(q),E(it),E(Ue),E(Me),E(Qt))}}static{this.\u0275cmp=B({type:o,selectors:[["app-send-sms-box"]],viewQuery:function(i,t){if(i&1&&We(Rp,5),i&2){let n;ie(n=ne())&&(t.editor=n.first)}},inputs:{previewText:"previewText",payload:"payload",moduleId:"moduleId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["editor",""],["selectedItem",""],["item",""],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-kanban-lightblue","rounded-[20px]"],["svgClass","w-[28px] h-[28px] block","src","assets/images/icons/sms-2.svg",1,"text-transparency-white"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Send SMS",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[15px]"],[1,"text-h4/[28px]","text-transparency-100","font-semibold","p-[15px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[10px]"],[1,"w-full"],[1,"flex","items-center","gap-[10px]","cursor-pointer","select-none"],[1,"re-custom-c
23heckbox"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"checkmark"],[1,"text-h4","text-transparency-100","font-semibold"],["tooltipPosition","top",1,"inline-flex","items-center","p-[2px]","align-middle","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip","escape"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"flex","flex-col","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[1,"flex","flex-col","gap-[3px]"],[1,"text-h3","text-transparency-100","font-semibold"],[1,"text-label","text-transparency-100","font-medium","opacity-40"],[1,"re-custom-switch"],["type","checkbox",3,"ngModelChange","name","ngModel","disabled"],[1,"slider"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click"],[1,"w-full","h-[120px]","min-h-[120px]","resize-y","overflow-hidden","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","bg-transparency-0"],[1,"block","!h-full","!w-full","text-p","text-transparency-100","font-semibold","focus:outline-none","[&_.ql-toolbar]:hidden","[&_.ql-container]:!h-full","[&_.ql-container]:!border-0","[&_.ql-editor]:!h-full","[&_.ql-editor]:!min-h-full","[&_.ql-editor]:box-border","[&_.ql-editor]:overflow-y-auto",3,"ngModelChange","name","ngModel","styles","modules","placeholder","disabled"],[1,"flex","items-center","justify-between","gap-[5px]","mt-[8px]"],[1,"text-p","text-transparency-100","font-medium","opacity-40"],[1,"text-h3","text-transparency-100","font-semibold","mr-3"],[1,"flex","items-center","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],["type","radio",1,"peer","opacity-0","absolute",3,"ngModelChange","click","name","ngModel","value","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],["type","radio","value","primary",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","other",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["optionLabel","label","optionValue","_id","filterBy","label","appendTo","body","placeholder","--Select--","scrollHeight","250px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[6px]","py-[6px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","options","filter","showClear","disabled"],[1,"flex","items-center","gap-2","truncate"],[1,"flex","items-center","gap-2"],["type","radio","value","DEFAULT_CAMPAIGN_NUMBER",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","OTHER_NUMBER",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],["type","button",1,"flex","w-full","items-center","justify-between","gap-[8px]","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","bg-transparency-0","px-[10px]","py-[11px]","text-left","text-h4/[18px]","font-semibold","text-transparency-100","focus:outline-none",3,"disabled"],[1,"text-h4","text-transparency-90","font-semibold","mt-[10px]","text-center"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],["type","button",1,"flex","w-full","items-center","justify-between","gap-[8px]","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","bg-transparency-0","px-[10px]","py-[11px]","text-left","text-h4/[18px]","font-semibold","text-transparency-100","focus:outline-none",3,"click","disabled"],[1,"min-w-0","truncate"],["svgClass","block h-[20px] w-[20px]","src","assets/images/icons/phone-numbers.svg",1,"shrink-0","text-transparency-90"]],template:function(i,t){i&1&&(r(0,"div",3)(1,"div",4),h(2,"img",5)(3,"span",6),a()(),r(4,"div",7)(5,"div",8),h(6,"svg-icon",9),a(),r(7,"div",10)(8,"div",11)(9,"h2",12),p(10," Send SMS "),a()(),x(11,Up,2,1,"h4",13),a(),r(12,"div",14)(13,"div",15),p(14),a(),x(15,Wp,2,0,"div",16),r(16,"div",17),y("click",function(){return t.onToggleExpanded()}),h(17,"img",18),a()()(),x(18,hm,20,11,"div",19)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,Ke,$,Oe,F,re,U,L,Z,he,Pt,Jt],encapsulation:2})}}return o})()});function ym(o,l){if(o&1&&(r(0,"h4",11),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Cm(o,l){if(o&1){let e=C();r(0,"div",18),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",19),a()}}function bm(o,l){if(o&1&&(r(0,"p",29),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Sm(o,l){if(o&1){let e=C();r(0,"div",20)(1,"div",21)(2,"label",22),p(3," Delay before executing this step "),h(4,"img",23),a(),r(5,"div",26)(6,"input",27),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",28),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,bm,2,1,"p",29),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Tm(o,l){if(o&1&&(r(0,"option",33),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function vm(o,l){if(o&1){let e=C();r(0,"select",30),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Tm,2,2,"option",33,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Em(o,l){if(o&1&&(r(0,"p",29),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function wm(o,l){if(o&1){let e=C();r(0,"div",20)(1,"div",21)(2,"label",22),p(3," Execute on "),h(4,"img",23),a(),r(5,"div",26)(6,"select",30),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",31),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,vm,3,2,"select",32),a(),x(11,Em,2,1,"p",29),a()()}if(o&2){let e=d(2);
23s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Im(o,l){if(o&1){let e=C();r(0,"div",17),x(1,Sm,17,5,"div",20),x(2,wm,12,6,"div",20),r(3,"div",20)(4,"div",21)(5,"label",22),p(6,"Note text "),h(7,"img",23),a(),r(8,"div",24)(9,"quill-editor",25,0),A("ngModelChange",function(t){u(e);let n=d();return I(n.noteText,t)||(n.noteText=t),_(t)}),a()()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(7),m("name","noteText"+e.actionId),w("ngModel",e.noteText),m("styles",e.editorStyle)("modules",rt(8,fm,e.editorOptions==null?null:e.editorOptions.mention))("placeholder",e.editorOptions==null?null:e.editorOptions.placeholder)("disabled",e.isViewOnly)}}var gm,fm,xn,gn=ee(()=>{W();W();xe();lt();be();se();pe();Ve();Di();gm=["noteEditor"],fm=o=>({toolbar:!1,mention:o});xn=(()=>{class o{constructor(e,i){this._utilities=e,this._userService=i,this.previewText="Hi Brij, when you set an appointment please ask for the complete property walkthough and take Kartik our fixes vendor with you to get the estimation.",this.payload={},this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.stepIndex=-1,this.actionId=-1,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.noteText="",this.userListing=[],this.initialNoteText="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.editorConfig={},this.editorOptions={},this.delayOrDayBased="",this.timeOption=this._utilities?.timeList12HourFormat,this.editorOptions={placeholder:this._utilities.commonEditor().placeholder,toolbar:this._utilities.commonEditor().toolbar,mention:this.mentionEditor()}}ngOnInit(){this.loadUsers(),this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.captureInitialState())}loadUsers(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).subscribe({next:i=>{i?.statusCode===200&&(this.userListing=i?.data?.items||[])},error:()=>{this.userListing=[]}})}applyPayload(){typeof this.payload?.noteText<"u"&&(this.noteText=this.payload.noteText),this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return!this.noteText||typeof this.noteText!="string"?"":this.noteText.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim()}mentionEditor(){return{mentionListClass:"ql-mention-list mat-elevation-z8",allowedChars:/^[A-Za-z0-9\sÅÄÖåäö_]*$/,showDenotationChar:!0,spaceAfterInsert:!0,positioningStrategy:"fixed",defaultMenuOrientation:"bottom",onSelect:(e,i)=>{let t=this.editor?.quillEditor;i(e),t?.insertText(t?.getLength()-1,"","user")},source:(e,i)=>{let t=this.userListing?.map(n=>({id:n?._id,value:n?.name}))||[];if(e?.length===0)i(t,e);else{let n=t.filter(c=>c?.value?.toLowerCase()?.indexOf(e?.toLowerCase())!==-1);i(n,e)}}}}captureInitialState(){this.isInitialStateCaptured||(this.initialNoteText=this.noteText||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.noteText!==this.initialNoteText||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q),E(De))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-notes-box"]],viewQuery:function(i,t){if(i&1&&We(gm,5),i&2){let n;ie(n=ne())&&(t.editor=n.first)}},inputs:{previewText:"previewText",payload:"payload",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",stepIndex:"stepIndex",actionId:"actionId",isViewOnl
vendor: 4,292 bytes, line 23
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["noteEditor",""],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-tags-brighter-green","rounded-[20px]"],["src","assets/images/icons/comment-v2-white.svg","alt","comment-v2-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Add Notes",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"w-full","h-[120px]","min-h-[120px]","resize-y","overflow-hidden","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","bg-transparency-0"],[1,"block","!h-full","!w-full","text-p","text-transparency-100","font-semibold","focus:outline-none","[&_.ql-toolbar]:hidden","[&_.ql-container]:!h-full","[&_.ql-container]:!border-0","[&_.ql-editor]:!h-full","[&_.ql-editor]:!min-h-full","[&_.ql-editor]:box-border","[&_.ql-editor]:overflow-y-auto",3,"ngModelChange","name","ngModel","styles","modules","placeholder","disabled"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",1)(1,"div",2),h(2,"img",3)(3,"span",4),a()(),r(4,"div",5)(5,"div",6),h(6,"img",7),a(),r(7,"div",8)(8,"div",9)(9,"h2",10),p(10," Add Notes "),a()(),x(11,ym,2,1,"h4",11),a(),r(12,"div",12)(13,"div",13),p(14),a(),x(15,Cm,2,0,"div",14),r(16,"div",15),y("click",function(){return t.onToggleExpanded()}),h(17,"img",16),a()()(),x(18,Im,11,10,"div",17)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z,Pt],encapsulation:2})}}return o})()});function Mm(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Om(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function Dm(o,l){if(o&1&&(r(0,"p",27),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Vm(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",21),p(3," Delay before executing this step "),h(4,"img",22),a(),r(5,"div",24)(6,"input",25),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",26),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Dm,2,1,"p",27),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Nm(o,l){if(o&1&&(r(0,"option",31),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),ce(e)}}function km(o,l){if(o&1){let e=C();r(0,"select",28),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Nm,2,2,"option",31,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Bm(o,l){if(o&1&&(r(0,"p",27),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Pm(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",21),p(3," Execute on "),h(4,"img",22),a(),r(5,"div",24)(6,"select",28),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",29),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,km,3,2,"select",30),a(),x(11,Bm,2,1,"p",27),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Lm(o,l){if(o&1){let e=C();r(0,"div",16),x(1,Vm,17,5,"div",19),x(2,Pm,12,6,"div",19),r(3,"div",19)(4,"div",20)(5,"label",21),p(6," Folder name "),h(7,"img",22),a(),r(8,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.folderName,t)||(n.folderName=t),_(t)}),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(6),w("ngModel",e.folderName),m("disabled",e.isViewOnly)}}var fn,yn=ee(()=>{W();W();xe();be();se();pe();Ve();fn=(()=>{class o{constructor(e){this._utilities=e,this.previewText="",this.payload={},this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.stepIndex=-1,this.actionId=-1,this.isViewOnl
23y=!1,this.deleteBox=new R,this.isExpanded=!0,this.folderName="",this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.initialFolderName="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.captureInitialState())}applyPayload(){typeof this.payload?.folderName<"u"&&(this.folderName=this.payload.folderName),this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.folderName||""}captureInitialState(){this.isInitialStateCaptured||(this.initialFolderName=this.folderName||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.folderName!==this.initialFolderName||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-folder-box"]],inputs:{previewText:"previewText",payload:"payload",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",stepIndex:"stepIndex",actionId:"actionId",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-crayolaorange","rounded-[20px]"],["svgClass","w-[28px] h-[28px] text-transparency-white","src","assets/images/icons/folder.svg"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Add Folder",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dar
23k:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["type","text","placeholder","Enter folder name",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"svg-icon",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Add Folder "),a()(),x(11,Mm,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,Om,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,Lm,9,4,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z],encapsulation:2})}}return o})()});function Fm(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Um(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function Wm(o,l){if(o&1&&(r(0,"p",43),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function jm(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",23)(2,"label",24),p(3," Delay before executing this step "),h(4,"img",25),a(),r(5,"div",40)(6,"input",41),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",42),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Wm,2,1,"p",43),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnl
23y),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function qm(o,l){if(o&1&&(r(0,"option",28),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Gm(o,l){if(o&1){let e=C();r(0,"select",44),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,qm,2,2,"option",28,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Hm(o,l){if(o&1&&(r(0,"p",43),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Ym(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",23)(2,"label",24),p(3," Execute on "),h(4,"img",25),a(),r(5,"div",40)(6,"select",44),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",45),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Gm,3,2,"select",46),a(),x(11,Hm,2,1,"p",43),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function zm(o,l){if(o&1&&(r(0,"option",28),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",e==null?null:e.assistantName," ")}}function Jm(o,l){o&1&&(r(0,"div",52),p(1," If Marketing tracking number is not available then \u201CFallback communication number\u201D will be used "),a())}function Qm(o,l){if(o&1){let e=C();r(0,"div",47),h(1,"svg-icon",48),a(),r(2,"div",23)(3,"label",24),p(4),h(5,"img",25),a(),r(6,"button",49),y("click",function(){u(e);let t=d(2);return _(!t.isViewOnly&&t.openChangeNumberDialog())}),r(7,"span",50),p(8),a(),h(9,"svg-icon",51),a(),x(10,Jm,2,0,"div",52),a()}if(o&2){let e=d(2);s(4),T(" ",e.selectionType=="OTHER_NUMBER"?"Select the phone number":"Fallback communication number"," "),s(2),m("disabled",e.isViewOnly),s(2),ce(e.getSelectedPhoneNumberLabel()),s(2),g(e.selectionType!="OTHER_NUMBER"?10:-1)}}function $m(o,l){o&1&&(r(0,"div",39),p(1," This step will trigger call to All contacts simultaneously. "),a())}function Km(o,l){if(o&1){let e=C();r(0,"div",16),x(1,jm,17,5,"div",19),x(2,Ym,12,6,"div",19),r(3,"div",20)(4,"h2",21),p(5," Select calling agent "),a(),r(6,"div",22)(7,"div",23)(8,"label",24),p(9," AI agent to use "),h(10,"img",25),a(),r(11,"select",26),A("ngModelChange",function(t){u(e);let n=d();return I(n.aiAgentToUse,t)||(n.aiAgentToUse=t),_(t)}),r(12,"option",27),p(13,"--Select an agent--"),a(),D(14,zm,2,2,"option",28,k),a()(),r(16,"div",29),p(17," AI will call the primary contact on the lead between 8 AM and 8 PM. "),a()()(),r(18,"div",30)(19,"div",23)(20,"label",31),p(21," Select the phone number to make AI call from "),h(22,"img",25),a(),r(23,"div",32)(24,"label",33)(25,"input",34),A("ngModelChange",function(t){u(e);let n=d();return I(n.selectionType,t)||(n.selectionType=t),_(t)}),a(),h(26,"img",35),p(27," Marketing tracking number"),a(),r(28,"label",33)(29,"input",36),A("ngModelChange",function(t){u(e);let n=d();return I(n.selectionType,t)||(n.selectionType=t),_(t)}),a(),h(30,"img",35),p(31," Other Number"),a()()(),x(32,Qm,11,4),a(),r(33,"div",30)(34,"label",37),p(35," What seller contact to call "),h(36,"img",25),a(),r(37,"div",32)(38,"label",33)(39,"input",38),A("ngModelChange",function(t){u(e);let n=d();return I(n.contactType,t)||(n.contactType=t),_(t)}),a(),h(40,"img",35),p(41," Primary Contact"),a()(),x(42,$m,2,0,"div",39),a()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(9),w("ngModel",e.aiAgentToUse),m("disabled",e.isViewOnly),s(3),V(e.agentList),s(11),m("name","smsfrom4_"+e.actionId),w("ngModel",e.selectionType),m("disabled",e.isViewOnl
23y),s(4),m("name","smsfrom4_"+e.actionId),w("ngModel",e.selectionType),m("disabled",e.isViewOnly),s(3),g(e.selectionType=="OTHER_NUMBER"||e.selectionType=="DEFAULT_CAMPAIGN_NUMBER"?32:-1),s(7),m("name","WhatSeller_"+e.actionId),w("ngModel",e.contactType),m("disabled",e.isViewOnly),s(3),g(e.contactType=="ALL_CONTACTS"?42:-1)}}var Cn,bn=ee(()=>{W();fa();W();fe();Ce();Ee();fo();St();xe();be();se();pe();Ve();Cn=(()=>{class o{constructor(e,i,t,n,c,f){this._dialog=e,this._loaderService=i,this._toastr=t,this._vapiService=n,this._commonService=c,this._commonFunctions=f,this.previewText="Hi Brij, when you set an appointment please ask for the complete property walkthough and take Kartik our fixes vendor with you to get the estimation.",this.payload={},this.moduleId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"08:00 AM"},this.delayOrDayBased="",this.agentList=[],this.aiAgentToUse="",this.selectionType="DEFAULT_CAMPAIGN_NUMBER",this.selectedPhoneNumber="",this.contactType="PRIMARY_CONTACT",this.numberList=[],this.accountCommunicationNumTypeIds=[1,2,4,5,6,7],this.initialAiAgentToUse="",this.initialSelectionType="",this.initialSelectedPhoneNumber="",this.initialContactType="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this.getDayBasedTimeOptions(this._commonFunctions?.timeList12HourFormat)}getDayBasedTimeOptions(e){let i=this.parseTimeToMinutes("08:00 AM"),t=this.parseTimeToMinutes("08:00 PM");return(e||[]).filter(n=>{let c=this.parseTimeToMinutes(n);return c>=i&&c<=t})}parseTimeToMinutes(e){let i=(e||"").trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!i)return-1;let t=parseInt(i[1],10),n=parseInt(i[2],10);return i[3].toUpperCase()==="AM"?t===12&&(t=0):t!==12&&(t+=12),t*60+n}clampExecuteOnTimeToOptions(){!this.executeOn?.time||!this.timeOption?.length||this.timeOption.includes(this.executeOn.time)||(this.executeOn.time=this.timeOption[0])}ngOnInit(){this.applyPayload(),this.captureInitialState(),this.getRetailAi(),this.getNumbers()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState(),this.getNumbers())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn),this.clampExecuteOnTimeToOptions()),this.payload?.phoneNumberSelection?.selectionType&&(this.selectionType=this.payload.phoneNumberSelection.selectionType),this.payload?.sellerContactSelection?.contactType&&(this.contactType=this.payload.sellerContactSelection.contactType),this.payload?.callingAgent?.aiAgentToUse&&(this.aiAgentToUse=this.payload.callingAgent.aiAgentToUse),this.payload?.phoneNumberSelection?.selectedPhoneNumber!=null&&(this.selectedPhoneNumber=this.payload.phoneNumberSelection.selectedPhoneNumber)}onToggleExpanded(){this.isExpanded=!this.isExpanded}getRetailAi(){let e={page:1,limit:1e3,voiceAiType:1};this._loaderService.start(),this._vapiService.listRetellAiOutbound(e).subscribe(i=>{i?.statusCode==200&&(this.agentList=i?.data?.items||[],this._loaderService.stop())},i=>{if(this._loaderService.stop(),i?.error){let t=i.error;this._toastr.showError(t?.message)}})}getNumbers(){this._commonService.dropDownNumberList({numTypeIdArray:this.accountCommunicationNumTypeIds}).subscribe(e=>{if(e?.statusCode==200){let i=e?.data?.items??[];this.numberList=i.map(t=>({_id:t?._id,number:t?.number,numTypeId:t?.numTypeId,name:`${t?.marketingTitle||"Number"} | ${this._commonFunctions.maskNumber(t?.number)}`,value:t?._id,callFlow:t?.callFlow})),this.restoreSelectedPhoneNumber(),setTimeout(()=>{this.isInitialStateCaptured=!1,this.captureInitialState()},500)}},()=>{})}restoreSelectedPhoneNumber(){let e=this.payload?.phoneNumberSelection?.selectedPhoneNumber;if(!e)return;let i=this.numberList?.find(t=>t?._id==e||t?.value==e||t?.number==e);this.selectedPhoneNumber=i?._id!=null?String(i._id):String(e)}
23openChangeNumberDialog(){if(this.isViewOnly)return;let e=this.numberList?.find(t=>t?._id==this.selectedPhoneNumber||t?.value==this.selectedPhoneNumber||t?.number==this.selectedPhoneNumber);this._dialog.open(Ni,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",maxHeight:"92vh",data:{numberId:e?._id||this.selectedPhoneNumber||"",initialSelectedNumberId:e?._id||this.selectedPhoneNumber||"",moduleId:this.moduleId,fromAutomations:!0}})?.afterClosed()?.subscribe(t=>{if(!t?.number)return;let n=t?.defaultNumberId??t?.numberId??"";if(!n)return;if(!this.numberList?.find(f=>f?._id==n||f?.number===t?.number)){let f=t?.marketingTitle||"Number";this.numberList=[...this.numberList,{_id:n,number:t?.number,numTypeId:t?.numTypeId,name:`${f} | ${this._commonFunctions?.maskNumber?.(t?.number)||t?.number}`,value:n}]}this.selectedPhoneNumber=String(n)})}getSelectedPhoneNumberLabel(){if(!this.selectedPhoneNumber?.trim())return"Select number";let e=this.numberList?.find(i=>i?._id==this.selectedPhoneNumber||i?.value==this.selectedPhoneNumber||i?.number==this.selectedPhoneNumber);return e?.name?e.name:"Select number"}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){let e="",i=this.agentList?.findIndex(t=>t?._id==this.aiAgentToUse);return i>=0&&(e=`${this.agentList?.[i]?.assistantName} will call ${this.contactType=="PRIMARY_CONTACT"?"primary contact":"all contacts"}`),e}captureInitialState(){this.isInitialStateCaptured||(this.initialAiAgentToUse=this.aiAgentToUse||"",this.initialSelectionType=this.selectionType||"",this.initialSelectedPhoneNumber=this.selectedPhoneNumber||"",this.initialContactType=this.contactType||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.aiAgentToUse!==this.initialAiAgentToUse||this.selectionType!==this.initialSelectionType||this.selectedPhoneNumber!==this.initialSelectedPhoneNumber||this.contactType!==this.initialContactType||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(H),E(Y),E(Xt),E(Ue),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-ai-calls-box"]],inputs:{previewText:"previewText",payload:"payload",moduleId:"moduleId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-grape","rounded-[20px]"],["src","assets/images/icons/outgoing-call-ai-white.svg","alt","outgoing-call-ai-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","AI Calls",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],[1,"text-h4","text-transparency-90","font-semibold"],[1,"flex","flex-col","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h3","text-transparency-100","font-semibold","mb-[10px]"],[1,"flex","items-center","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio","value","DEFAULT_CAMPAIGN_NUMBER",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],["type","radio","value","OTHER_NUMBER",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"text-h3","text-transparency-100","font-semibold"],["type","radio","value","PRIMARY_CONTACT",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"text-h4","leading-[normal]","text-transparency-90","font-medium"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number","value","1",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],["type","button",1,"flex","w-full","items-center","justify-between","gap-[8px]","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","bg-transparency-0","px-[10px]","py-[11px]","text-left","text-h4/[18px]","font-semibold","text-transparency-100","focus:outline-none",3,"click","disabled"],[1,"min-w-0","truncate"],["svgClass","block h-[20px] w-[20px]","src","assets/images/icons/phone-numbers.svg",1,"shrink-0","text-transparency-90"],[1,"text-h4","text-transparency-90","font-semibold","mt-[10px]","text-center"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," AI Calls "),a()(),x(11,Fm,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,Um,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,Km,43,15,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z],encapsulation:2})}}return o})()});var Ha,Eo=ee(()=>{fe();$e();dt();W();fe();Ta();Ce();Ee();se();pe();kt();Ha=(()=>{class o{constructor(e,i,t,n,c){this.data=e,this.dialog=i,this.taskService=t,this._loader=n,this._toastrService=c,this.destroy$=new Be,this.taskType="",this.taskType=this.data?.taskType||""}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}saveTask(){let e=(this.taskType||"").trim();if(this.taskType=e,!e){this._toastrService.showError("Please fill task type");return}let i={taskType:e};this._loader.start(),this.taskService.createTaskType(i).pipe(ue(this.destroy$),Ye(()=>this._loader.stop())).subscribe({next:t=>{if(t?.statusCode===200){this._toastrService.showSuccess("Task type created successfully"),this.dialog.close(!0);return}let n=t?.message||"Could not create task type. Please try again.";this._toastrService.showError(n)},error:t=>{let n=t,c=n?.error?.message||n?.message||"Task type may already exist or the request failed. Please try again.";this._toastrService.showError(c)}})}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(ki),E(H),E(Y))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-task-type"]],standalone:!1,decls:21,vars:4,consts:[[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px] block","src","assets/images/icons/task.svg",1,"text-transparency-100"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px] block","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[10px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["type","text","placeholder","type...",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[1,"inline-flex","w-full","py-[10px]"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","label","Add Task Type","variant","filled","type","default","size","44",3,"click","leftIcon","disabled"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5),p(7," Add Task Type "),a()(),r(8,"button",6),h(9,"svg-icon",7),a()(),r(10,"div",8)(11,"div",9)(12,"label",10),p(13,"Task type "),h(14,"img",11),a(),r(15,"input",12),A("ngModelChange",function(c){return I(t.taskType,c)||(t.taskType=c),c}),a()()()(),r(16,"div",13),h(17,"svg-icon",14),a(),r(18,"div",15),h(19,"app-button",16),r(20,"app-button",17),y("click",function(){return t.saveTask()}),a()()()()),i&2&&(s(15),w("ngModel",t.taskType),s(4),m("leftIcon",!1),s(),m("leftIcon",!1)("disabled",!(t.taskType!=null&&t.taskType.trim())))},dependencies:[G,F,U,Ze,_t,L,et],encapsulation:2})}}return o})()});function eu(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function tu(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function iu(o,l){if(o&1&&(r(0,"p",58),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function nu(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",23)(2,"label",41),p(3," Delay before executing this step "),h(4,"img",26),a(),r(5,"div",55)(6,"input",56),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",57),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,iu,2,1,"p",58),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function ou(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function au(o,l){if(o&1){let e=C();r(0,"select",59),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,ou,2,2,"option",32,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function ru(o,l){if(o&1&&(r(0,"p",58),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function lu(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",23)(2,"label",41),p(3," Execute on "),h(4,"img",26),a(),r(5,"div",55)(6,"select",59),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",60),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,au,3,2,"select",61),a(),x(11,ru,2,1,"p",58),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function su(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit;m("value",Vt(e==null?null:e._id)),s(),T(" ",e==null?null:e.taskType," ")}}function du(o,l){if(o&1){let e=C();r(0,"div",16),x(1,nu,17,5,"div",19),x(2,lu,12,6,"div",19),r(3,"div",20)(4,"h2",21),p(5," Basic setup "),a(),r(6,"div",22)(7,"div",23)(8,"div",24)(9,"label",25),p(10," Task name "),h(11,"img",26),a(),r(12,"h3",27),y("click",function(){u(e);let t=d();return _(t.taskTemplateSelection())}),p(13," Select Template "),a()(),r(14,"input",28),A("ngModelChange",function(t){u(e);let n=d();return I(n.taskName,t)||(n.taskName=t),_(t)}),a()(),r(15,"div",23)(16,"div",24)(17,"label",25),p(18," Task type "),h(19,"img",26),a(),r(20,"button",29),y("click",function(){u(e);let t=d();return _(t.addTaskType())}),p(21," +Add Type "),a()(),r(22,"select",30),A("ngModelChange",function(t){u(e);let n=d();return I(n.taskType,t)||(n.taskType=t),_(t)}),r(23,"option",31),p(24,"--Select--"),a(),D(25,su,2,3,"option",32,k),a()(),r(27,"div",23)(28,"div",24)(29,"label",25),p(30," Details"),a()(),r(31,"textarea",33),A("ngModelChange",function(t){u(e);let n=d();return I(n.details,t)||(n.details=t),_(t)}),a()()(),r(32,"label",34)(33,"div",35)(34,"input",36),A("ngModelChange",function(t){u(e);let n=d();return I(n.skipHolidayOnWeekendAndPublicHolidays,t)||(n.skipHolidayOnWeekendAndPublicHolidays=t),_(t)}
23),a(),h(35,"span",37),a(),r(36,"span",38),p(37,"Skip this step on weekends and public holidays"),a()()(),r(38,"div",20)(39,"div",39)(40,"h2",40),p(41," Assignee "),a()(),r(42,"div",39)(43,"div",23)(44,"label",41),p(45),h(46,"img",26),a(),r(47,"p-multiSelect",42),A("ngModelChange",function(t){u(e);let n=d();return I(n.roleToAssign,t)||(n.roleToAssign=t),_(t)}),a()(),r(48,"div",23)(49,"div",43)(50,"label",44),p(51," Priority "),h(52,"img",26),a(),r(53,"button",45),y("click",function(){u(e);let t=d();return _(t.priority="Urgent")}),h(54,"img",46),a(),r(55,"button",47),y("click",function(){u(e);let t=d();return _(t.priority="High")}),h(56,"img",48),a(),r(57,"button",49),y("click",function(){u(e);let t=d();return _(t.priority="Medium")}),h(58,"img",50),a(),r(59,"button",51),y("click",function(){u(e);let t=d();return _(t.priority="Low")}),h(60,"img",52),a(),r(61,"button",53),y("click",function(){u(e);let t=d();return _(t.priority="None")}),h(62,"img",54),a()()()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(12),w("ngModel",e.taskName),m("disabled",e.isViewOnly),s(6),m("disabled",e.isViewOnly),s(2),w("ngModel",e.taskType),m("disabled",e.isViewOnly),s(3),V(e.taskTypeOption),s(6),w("ngModel",e.details),m("disabled",e.isViewOnly),s(3),w("ngModel",e.skipHolidayOnWeekendAndPublicHolidays),m("disabled",e.isViewOnly),s(11),T(" ",e.isDirectUserAssignmentModule?"Select Users":"Select roles"," "),s(2),w("ngModel",e.roleToAssign),m("placeholder",e.isDirectUserAssignmentModule?"Select users to assign":"Select roles to assign")("options",e.allRoleList)("maxSelectedLabels",1e3)("disabled",e.isViewOnly),s(6),de("bg-primary-5",e.priority==="Urgent")("bg-transparency-0",e.priority!=="Urgent")("border-secondary-red",e.priority==="Urgent")("border-transparency-25",e.priority!=="Urgent"),m("disabled",e.isViewOnly),ct("aria-label","Urgent priority"),s(2),de("bg-primary-5",e.priority==="High")("border-secondary-orange",e.priority==="High")("border-transparency-25",e.priority!=="High"),m("disabled",e.isViewOnly),ct("aria-label","High priority"),s(2),de("bg-primary-5",e.priority==="Medium")("border-[#669fd4]",e.priority==="Medium")("border-transparency-25",e.priority!=="Medium"),m("disabled",e.isViewOnly),ct("aria-label","Medium priority"),s(2),de("bg-primary-5",e.priority==="Low")("border-secondary-green",e.priority==="Low")("border-transparency-25",e.priority!=="Low"),m("disabled",e.isViewOnly),ct("aria-label","Low priority"),s(2),de("bg-primary-5",e.priority==="None")("border-secondary-purple",e.priority==="None")("border-transparency-25",e.priority!=="None"),m("disabled",e.isViewOnly),ct("aria-label","None priority")}}var Sn,Tn=ee(()=>{W();Eo();ho();Re();W();fe();xe();Ee();Ce();Ta();lt();St();be();se();pe();Ve();Bt();He();Sn=(()=>{class o{constructor(e,i,t,n,c,f,S){this._dialog=e,this._utilities=i,this.toastr=t,this._loaderService=n,this.taskService=c,this._userService=f,this._commonService=S,this.previewText="Calling seller to fix appointment",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.moduleId="",this.isViewOnly=!1,this.deleteBox=new R,this.mainStatusId=O.MainStatusId,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.assignmentType="BASED_ON_ROLE",this.skipHolidayOnWeekendAndPublicHolidays=!1,this.taskTypeOption=[],this.taskName="",this.taskType="",this.details="",this.taskId=null,this.roleToAssign=[],this.allRoleList=[],this.priority="Urgent",this.enableReminder=!0,this.taskReminder=[{enableReminder:!0,remindVia:"SMS",remindBefore:1,timeDuration:"Days"}],this.userId="",this.initialTaskName="",this.initialTaskType="",this.initialDetails="",this.initialSkipHolidayOnWeekendAndPublicHolidays=!1,this.initialPriority="",this.initialEnableReminder=!1,this.initialTaskReminder=[],this.initialRoleToAssign=[],this.initialAssignmentType="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.syncAssignmentTypeForModule(
23),this.getAssigneeList(),this.getUser()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState()),e.moduleId&&!e.moduleId.firstChange&&(this.syncAssignmentTypeForModule(),this.getAssigneeList())}get isDirectUserAssignmentModule(){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR,this.mainStatusId.LISTSTACKING].includes(this.moduleId)}syncAssignmentTypeForModule(){this.assignmentType=this.isDirectUserAssignmentModule?"SELECTED_MEMBERS":"BASED_ON_ROLE"}applyPayload(){typeof this.payload?.basicSetup?.taskName<"u"&&(this.taskName=this.payload.basicSetup.taskName||""),typeof this.payload?.basicSetup?.details<"u"&&(this.details=this.payload.basicSetup.details||""),typeof this.payload?.basicSetup?.taskId<"u"?this.taskId=this.payload.basicSetup.taskId||null:this.taskId=null,typeof this.payload?.basicSetup?.skipHolidayOnWeekendAndPublicHolidays<"u"&&(this.skipHolidayOnWeekendAndPublicHolidays=this.payload.basicSetup.skipHolidayOnWeekendAndPublicHolidays??!1),typeof this.payload?.basicSetup?.taskType<"u"&&(this.taskType=this.payload.basicSetup.taskType||""),typeof this.payload?.assignment?.roleToAssign<"u"&&(this.roleToAssign=Array.isArray(this.payload.assignment.roleToAssign)?[...this.payload.assignment.roleToAssign]:[]),typeof this.payload?.assignment?.assignmentType<"u"?this.assignmentType=this.payload.assignment.assignmentType:this.syncAssignmentTypeForModule(),typeof this.payload?.priority<"u"&&(this.priority=this.payload.priority||"Urgent"),typeof this.payload?.taskReminder<"u"?(this.taskReminder=Array.isArray(this.payload.taskReminder)?this.payload.taskReminder.map(e=>M({},e)):[],this.enableReminder=this.taskReminder?.length>0):this.enableReminder=!1,this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}addTaskType(){this.dialogRef=this._dialog.open(Ha,{disableClose:!0,width:"500px",panelClass:"re-new-custom-dialog",data:{}}),this.dialogRef.afterClosed().subscribe(e=>{e&&this.getTaskList()})}getAssigneeList(){if(this.isDirectUserAssignmentModule){this.getSubUserList();return}this.getRoleList()}getRoleList(){let e={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(e).subscribe(i=>{i.statusCode==200&&(this.allRoleList=(i?.data?.items||[]).sort((t,n)=>(t?.name||"").localeCompare(n?.name||"",void 0,{sensitivity:"base"})),typeof this.payload?.assignment?.roleToAssign<"u"&&(this.roleToAssign=this.payload?.assignment?.roleToAssign||[])),this._loaderService.stop()},i=>{this._loaderService.stop()})}getSubUserList(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._loaderService.start(),this._userService.getSubUserList(e).subscribe(i=>{if(i?.statusCode===200){let t=i?.data?.items||[];this.allRoleList=t.map(n=>
23{let c=(n?.name||"").trim().split(/\s+/).filter(Boolean),f=n?.firstName||c[0]||"",S=n?.lastName||c.slice(1).join(" ")||"",v=`${f} ${S}`.trim()||n?.email||"Unknown User";return{_id:n?._id,name:v}}),typeof this.payload?.assignment?.roleToAssign<"u"&&(this.roleToAssign=this.payload?.assignment?.roleToAssign||[])}this._loaderService.stop()},()=>{this._loaderService.stop()})}getUser(){this._commonService.getUser().subscribe(e=>{e.code==200&&(this.userId=e.data?.userId,this.getTaskList())},e=>{})}getTaskList(){let e={user:this.userId};this.taskService.getAllTaskType(e).subscribe(i=>{if(i.statusCode==200){if(this.taskTypeOption=i?.data||[],typeof this.payload?.basicSetup?.taskType<"u"){let t=this.taskTypeOption?.findIndex(n=>n._id==this.payload?.basicSetup?.taskType);this.taskType=this.taskTypeOption?.[t]?._id||""}this.captureInitialState()}},i=>{})}addReminder(){this.taskReminder.push({enableReminder:!0,remindVia:"SMS",remindBefore:1,timeDuration:"Days"})}removeReminder(e){e>0&&this.taskReminder.splice(e,1)}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){let e="";return e+=this.taskName,e}getTaskTemplateModuleId(){return[this.mainStatusId.WHOLESALEPIPELINE,this.mainStatusId.INVENTORY,this.mainStatusId.SOLD,this.mainStatusId.RENTAL].includes(this.moduleId)?this.mainStatusId.LEAD:this.moduleId}taskTemplateSelection(){this.dialogRef=this._dialog.open($t,{disableClose:!0,width:"600px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{templateType:"task",moduleTypeId:[this.getTaskTemplateModuleId()]}}),this.dialogRef.afterClosed().subscribe(e=>{e&&(this.taskName=e?.templateName||"",this.taskType=e?.taskTypeId||"",this.details=e?.taskDetail||"",this.taskId=e?._id||null,this.roleToAssign=this.isDirectUserAssignmentModule?e?.assignUserId?[e.assignUserId]:[]:e?.assignRoleId?[e.assignRoleId]:[])})}captureInitialState(){this.isInitialStateCaptured||(this.initialTaskName=this.taskName||"",this.initialTaskType=this.taskType||"",this.initialDetails=this.details||"",this.initialSkipHolidayOnWeekendAndPublicHolidays=this.skipHolidayOnWeekendAndPublicHolidays,this.initialPriority=this.priority||"",this.initialEnableReminder=this.enableReminder,this.initialTaskReminder=this.taskReminder?JSON.parse(JSON.stringify(this.taskReminder)):[],this.initialRoleToAssign=this.roleToAssign?[...this.roleToAssign]:[],this.initialAssignmentType=this.assignmentType||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.taskName!==this.initialTaskName||this.taskType!==this.initialTaskType||this.details!==this.initialDetails||this.skipHolidayOnWeekendAndPublicHolidays!==this.initialSkipHolidayOnWeekendAndPublicHolidays||this.priority!==this.initialPriority||this.enableReminder!==this.initialEnableReminder||this.assignmentType!==this.initialAssignmentType||JSON.stringify(this.taskReminder)!==JSON.stringify(this.initialTaskReminder)||this.roleToAssign?.length!==this.initialRoleToAssign?.length||!this.roleToAssign?.every(e=>this.initialRoleToAssign?.includes(e))||!this.initialRoleToAssign?.every(e=>this.roleToAssign?.includes(e))||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(q),E(Y),E(H),E(ki),E(De),E(Ue))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-task-box"]],inputs:{previewText:"previewText",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",moduleId:"moduleId",isViewOnl
vendor: 6,509 bytes, line 23
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-cerulean","rounded-[20px]"],["src","assets/images/icons/task-white.svg","alt","task-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Add Task",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]","mt-[10px]"],[1,"w-full"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click"],["placeholder","Enter short task name (i.e Get HVAC quote)",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"text-h3","text-primary-90","font-semibold","cursor-pointer",3,"click","disabled"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],["placeholder","Provide task a detailed descrption","rows","3",1,"w-full","text-p","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","items-center","gap-[10px]","cursor-pointer","select-none"],[1,"re-custom-checkbox"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"checkmark"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","mb-[20px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["appendTo","body","optionLabel","name","optionValue","_id",1,"px-[5px]","py-[5px]","focus:outline-none",3,"ngModelChange","ngModel","placeholder","options","maxSelectedLabels","disabled"],[1,"flex","flex-wrap","gap-[10px]"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]","pt-[10px]"],["type","button","pTooltip","Urgent","tooltipPosition","top",1,"flex","items-center","justify-center","w-[70px]","h-[40px]","rounded-[20px]","border-[1px]","border-solid","transition-all","hover:opacity-80","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["src","assets/images/icons/urgent-task.svg","alt","Urgent",1,"w-[24px]","h-[24px]"],["type","button","pTooltip","High","tooltipPosition","top",1,"flex","items-center","justify-center","w-[70px]","h-[40px]","rounded-[20px]","border-[1px]","border-solid","transition-all","hover:opacity-80","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["src","assets/images/icons/high-task.svg","alt","High",1,"w-[24px]","h-[24px]"],["type","button","pTooltip","Medium","tooltipPosition","top",1,"flex","items-center","justify-center","w-[70px]","h-[40px]","rounded-[20px]","border-[1px]","border-solid","transition-all","hover:opacity-80","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["src","assets/images/icons/medium-task.svg","alt","Medium",1,"w-[24px]","h-[24px]"],["type","button","pTooltip","Low","tooltipPosition","top",1,"flex","items-center","justify-center","w-[70px]","h-[40px]","rounded-[20px]","border-[1px]","border-solid","transition-all","hover:opacity-80","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["src","assets/images/icons/low-task.svg","alt","Low",1,"w-[24px]","h-[24px]"],["type","button","pTooltip","None","tooltipPosition","top",1,"flex","items-center","justify-center","w-[70px]","h-[40px]","rounded-[20px]","border-[1px]","border-solid","transition-all","hover:opacity-80","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["src","assets/images/icons/none-task.svg","alt","None",1,"w-[24px]","h-[24px]"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number","value","1",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Add Task "),a()(),x(11,eu,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,tu,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,du,63,59,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,Ke,$,F,re,U,L,Z,tt,he],encapsulation:2})}}return o})()});function yu(o,l){if(o&1&&(r(0,"h4",16),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Cu(o,l){if(o&1){let e=C();r(0,"div",23),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",24),a()}}function bu(o,l){if(o&1&&(r(0,"p",40),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Su(o,l){if(o&1){let e=C();r(0,"div",25)(1,"div",28)(2,"label",29),p(3," Delay before executing this step "),h(4,"img",36),a(),r(5,"div",37)(6,"input",38),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",39),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,bu,2,1,"p",40),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Tu(o,l){if(o&1&&(r(0,"option",44),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function vu(o,l){if(o&1){let e=C();r(0,"select",41),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Tu,2,2,"option",44,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Eu(o,l){if(o&1&&(r(0,"p",40),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function wu(o,l){if(o&1){let e=C();r(0,"div",25)(1,"div",28)(2,"label",29),p(3," Execute on "),h(4,"img",36),a(),r(5,"div",37)(6,"select",41),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",42),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,vu,3,2,"select",43),a(),x(11,Eu,2,1,"p",40),a()()}if(o&2){let e=d(2);
23s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Iu(o,l){o&1&&(r(0,"mat-icon",46),p(1,"cancel"),a())}function Au(o,l){if(o&1){let e=C();r(0,"mat-chip-row",45),y("removed",function(){let t=u(e).$index,n=d(2);return _(n.remove(t,"add"))}),p(1),x(2,Iu,2,0,"mat-icon",46),a()}if(o&2){let e=l.$implicit,i=d(2);m("removable",i.removable),s(),T(" ",e==null?null:e.label," "),s(),g(i.removable?2:-1)}}function Mu(o,l){if(o&1&&(r(0,"mat-option",44),p(1),a()),o&2){let e=d().$implicit;m("value",e),s(),T(" ",e==null?null:e.label," ")}}function Ou(o,l){if(o&1&&x(0,Mu,2,2,"mat-option",44),o&2){let e=l.$implicit,i=d(2);g(i.isVisible(e,"add")?0:-1)}}function Du(o,l){o&1&&(r(0,"mat-icon",46),p(1,"cancel"),a())}function Vu(o,l){if(o&1){let e=C();r(0,"mat-chip-row",45),y("removed",function(){let t=u(e).$index,n=d(2);return _(n.remove(t,"remove"))}),p(1),x(2,Du,2,0,"mat-icon",46),a()}if(o&2){let e=l.$implicit,i=d(2);m("removable",i.removable),s(),T(" ",e==null?null:e.label," "),s(),g(i.removable?2:-1)}}function Nu(o,l){if(o&1&&(r(0,"mat-option",44),p(1),a()),o&2){let e=d().$implicit;m("value",e),s(),T(" ",e==null?null:e.label," ")}}function ku(o,l){if(o&1&&x(0,Nu,2,2,"mat-option",44),o&2){let e=l.$implicit,i=d(2);g(i.isVisible(e,"remove")?0:-1)}}function Bu(o,l){if(o&1){let e=C();r(0,"div",22),x(1,Su,17,5,"div",25),x(2,wu,12,6,"div",25),r(3,"div",25)(4,"h2",26),p(5," Manage tags "),a(),r(6,"div",27)(7,"div",28)(8,"label",29),p(9,"Add to tags"),a(),r(10,"mat-form-field",30)(11,"mat-chip-grid",31,0),D(13,Au,3,3,"mat-chip-row",32,k),r(15,"input",33,1),y("matChipInputTokenEnd",function(t){u(e);let n=d();return _(n.add(t))})("input",function(t){u(e);let n=d();return _(n.onSearchChange(t.target.value,"add"))})("focus",function(){u(e);let t=d();return _(t.isInputFocused=!0)})("blur",function(t){u(e);let n=d();return n.saveCustomTag(t.target.value,"add"),_(n.isInputFocused=!1)}),a()(),r(17,"mat-autocomplete",34,2),y("optionSelected",function(t){u(e);let n=d();return _(n.selected(t,"add"))}),D(19,Ou,1,1,null,null,Ya),ot(21,"async"),a()()(),r(22,"div",28)(23,"label",29),p(24,"Remove from tags"),a(),r(25,"mat-form-field",30)(26,"mat-chip-grid",31,3),D(28,Vu,3,3,"mat-chip-row",32,k),r(30,"input",35,4),y("input",function(t){u(e);let n=d();return _(n.onSearchChange(t.target.value,"remove"))})("focus",function(){u(e);let t=d();return _(t.isInputFocused=!0)})("blur",function(){u(e);let t=d();return _(t.isInputFocused=!1)}),a()(),r(32,"mat-autocomplete",34,5),y("optionSelected",function(t){u(e);let n=d();return _(n.selected(t,"remove"))}),D(34,ku,1,1,null,null,Ya),ot(36,"async"),a()()()()()()}if(o&2){let e=Te(12),i=Te(18),t=Te(27),n=Te(33),c=d();s(),g((c.delayPreferenceData==null?null:c.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((c.delayPreferenceData==null?null:c.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(11),V(c.tagsAdded),s(2),m("formControl",c.tagCtrl)("matAutocomplete",i)("matChipInputFor",e)("matChipInputSeparatorKeyCodes",c.separatorKeysCodes)("placeholder",c.tagsAdded!=null&&c.tagsAdded.length?"":"Add tags")("disabled",c.isViewOnly),s(4),V(mt(21,13,c.filteredTagsAdd)),s(9),V(c.tagsRemoved),s(2),m("formControl",c.tagRemoveCtrl)("matAutocomplete",n)("matChipInputFor",t)("placeholder",c.tagsRemoved!=null&&c.tagsRemoved.length?"":"Remove tags")("disabled",c.isViewOnly),s(4),V(mt(36,15,c.filteredTagsRemove))}}var gu,fu,Ya,vn,En=ee(()=>{W();$e();se();Re();W();Ma();ga();Ce();Ee();xe();be();se();po();la();da();sa();pe();Ve();gu=["tagInput"],fu=["tagRemoveInput"],Ya=(o,l)=>l._id||l.label;vn=(()=>{class o{constructor(e,i,t,n,c){this._taggingService=e,this._listStackingService=i,this._loaderService=t,this._toastrService=n,this._utilities=c,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.isExpanded=!0,this.allTagList=[],this.filteredTagsAdd=Qe([]),this.filteredTagsRemove=Qe([]),this.tagCtrl=ne
23w Xe,this.tagRemoveCtrl=new Xe,this.separatorKeysCodes=[13,188],this.isInputFocused=!1,this.removable=!0,this.selectable=!0,this.tagsAdded=[],this.tagsRemoved=[],this.tagType=O.TagsType.LEADS,this.unavailableColorIndex=[],this.unavailableColorIndexResponse=[],this.initialTagsAdded=[],this.initialTagsRemoved=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyDelayFromPayload(),this.syncTagTypeFromModuleId(),this.getAllTags(),this.getUsedColorIndex()}ngOnChanges(e){let i=e.payload&&!e.payload.firstChange,t=e.moduleId&&!e.moduleId.firstChange;i&&this.applyDelayFromPayload(),(i||t)&&(this.isInitialStateCaptured=!1,t&&(this.syncTagTypeFromModuleId(),this.getUsedColorIndex()),this.getAllTags())}applyDelayFromPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}syncTagTypeFromModuleId(){this.moduleId==O.ModuleStatusId.LEAD||this.moduleId==O.ModuleStatusId.WHOLESALEPIPELINE||this.moduleId==O.ModuleStatusId.INVENTORY||this.moduleId==O.ModuleStatusId.SOLD||this.moduleId==O.ModuleStatusId.RENTAL?this.tagType=O.TagsType.LEADS:this.moduleId==O.ModuleStatusId.BUYER?this.tagType=O.TagsType.BUYERS:this.moduleId==O.ModuleStatusId.VENDOR?this.tagType=O.TagsType.VENDORS:this.moduleId==O.ModuleStatusId.AGENT&&(this.tagType=O.TagsType.AGENTS)}onToggleExpanded(){this.isExpanded=!this.isExpanded}isListStackingModule(){return this.moduleId===O.MainStatusId.LISTSTACKING||this.moduleId===O.ModuleStatusId.LISTSTACKING}resetFilteredTagLists(){let e=this.allTagList?.slice()||[];this.filteredTagsAdd=Qe(e),this.filteredTagsRemove=Qe(e)}getAllTags(){if(this._loaderService.start(),this.isListStackingModule()){this._listStackingService.getListsTags({}).subscribe(e=>{if(this._loaderService.stop(),e?.code===200||e?.statusCode===200){let t=Array.isArray(e?.data)?e.data:[];this.applyLoadedTagList(t)}},e=>{this._loaderService.stop()});return}this._taggingService.getTags(this.tagType).subscribe(e=>{this._loaderService.stop(),e&&e?.statusCode==200&&this.applyLoadedTagList(e?.data||[])},e=>{this._loaderService.stop()})}applyLoadedTagList(e){let i=(e||[]).reduce((t,n)=>{let c=this.mapTagListItem(n);return c&&t.push(c),t},[]);this.allTagList=i,this.payload?.addTags?.length&&(this.tagsAdded=this.allTagList?.filter(t=>this.payload?.addTags?.includes(t?._id))?.map(t=>P(M({},t),{label:(t?.label||"").toLowerCase()}))),this.payload?.removeTags?.length&&(this.tagsRemoved=this.allTagList?.filter(t=>this.payload?.removeTags?.includes(t?._id))?.map(t=>P(M({},t),{label:(t?.label||"").toLowerCase()}))),this.resetFilteredTagLists(),this.captureInitialState()}mapTagListItem(e){let i=e?.label!=null&&String(e.label).trim()!==""?e.label:e?.name!=null&&String(e.name).trim()!==""?e.name:e?.tagName,t=e?._id??e?.id??e?.tagId;return i==null||String(i).trim()===""||t==null||t===""?null:{_id:t,label:String(i)}}getUsedColorIndex(){this._loaderService.start(),this._taggingService.getUsedTagsColor(this.tagType).subscribe(e=>{if(e?.statusCode==200){this._loaderService.stop(),this.unavailableColorIndex=e?.data||[],this.unavailableColorIndexResponse=[];let i,t;for(i=0;i<this._utilities.getTagColorCount();i++)for(this.unavailableColorIndexResponse.push({_id:i,count:0}),t=0;t<this.unavailableColorIndex?.length;t++)if(this.unavailableColorIndex?.[t]?._id==i){this.unavailableColorIndexResponse[i].count=this.unavailableColorIndex?.[t]?.count;break}this.unavailableColorIndexResponse.sort((n,c)=>parseFloat(n?.count)-parseFloat(c?.count))}},e=>{this._loaderService.stop()})}saveCustomTag(e,i){if(i=="add"){let t=this.tagsAdded?.filter(c=>c?._id==="custom")?.reduce((c,f)=>(c.push((f?.label||"").toLowerCase()),c),[]),n=this.getTagsToSave(t);if(n.length){let c={tagsArr:n,tagType:this.tagType};this.saveTags(c);return}}this.onSearchChange(e,i)}getTagsToSave(e){if(e.length){let i=[],t=0;for(let n=0;n<e?.length;n++){this.unavailableColorIndexResponse?.length==t&&(t=0);let c=(e?.[n]||"").toLowerCase();i.push({tag:c,colorIndex:this.unavailableColorIndexResponse?.[t]?._id}),t++}return i}else return[]}
23saveTags(e){if(this.isListStackingModule()){this.saveListStackingTags(e?.tagsArr||[]);return}this._loaderService.start(),this._taggingService.addTags(e).subscribe(i=>{if(i){let t=-1,n=i?.data?.reduce((c,f)=>{if(f?.label){let S={_id:f?._id,label:(f?.label||"").toLowerCase()};c.push(S),t=this.tagsAdded?.findIndex(v=>(v?.label||"").toLowerCase()==(f?.label||"").toLowerCase()),t!=-1&&(this.tagsAdded[t]._id=f?._id,this.tagsAdded[t].label=(f?.label||"").toLowerCase())}return c},[]);this.allTagList=[...this.allTagList,...n||[]],this._loaderService.stop()}},i=>{this._loaderService.stop()})}saveListStackingTags(e){if(!e?.length)return;this._loaderService.start();let i=e.map(t=>this._listStackingService.addListsTags({label:(t?.tag||"").toLowerCase()}));ui(i).subscribe({next:t=>{let n=[];t.forEach((c,f)=>{let S=c?.result??c?.data,v=(e[f]?.tag||"").toLowerCase();if((c?.code===200||c?.statusCode===200)&&S?._id){let b={_id:S._id,label:(S?.label||v).toLowerCase()};n.push(b);let N=this.tagsAdded?.findIndex(j=>(j?.label||"").toLowerCase()===v);N!==-1&&(this.tagsAdded[N]._id=b._id,this.tagsAdded[N].label=b.label);return}c?.code===202&&this._toastrService.showError("Tag Name Already Exists!")}),n.length&&(this.allTagList=[...this.allTagList,...n],this.resetFilteredTagLists()),this._loaderService.stop()},error:()=>{this._loaderService.stop()}})}remove(e,i){let t=i=="add"?this.tagsAdded||[]:this.tagsRemoved||[];e>=0&&t.splice(e,1);let n=[];t?.filter(c=>{n.push(c?._id)})}selected(e,i){let t=e.option.value,n=t?.label?.toLowerCase()||"";this.checkForUnique(n,i)&&(i=="add"?(this.tagsAdded?.length||(this.tagsAdded=[]),this.tagsAdded.push(P(M({},t),{label:n})),this.tagInput.nativeElement.value="",this.tagCtrl?.setValue(null),this.tagInput?.nativeElement.blur(),this.resetFilteredTagLists()):(this.tagsRemoved?.length||(this.tagsRemoved=[]),this.tagsRemoved.push(P(M({},t),{label:n})),this.tagRemoveInput.nativeElement.value="",this.tagRemoveCtrl?.setValue(null),this.tagRemoveInput?.nativeElement.blur(),this.resetFilteredTagLists()))}add(e){let i=e.input,n=(e.value||"").trim().toLowerCase();if(this.checkForUnique(n,"add")){let c=-1;for(let f=0;f<this.allTagList?.length;f++)if(this.allTagList?.[f]?.label?.toLowerCase()==n){c=f;break}c>=0?(this.tagsAdded?.length||(this.tagsAdded=[]),this.tagsAdded.push(P(M({},this.allTagList?.[c]),{label:this.allTagList?.[c]?.label?.toLowerCase()||""}))):n&&(this.tagsAdded?.length||(this.tagsAdded=[]),this.tagsAdded.push({_id:"custom",label:n}))}i&&(i.value=""),this.tagCtrl?.setValue(null),this.resetFilteredTagLists()}onSearchChange(e,i){let t=(e||"").toLowerCase(),n=this.allTagList?.filter(c=>c?.label?.toLowerCase().includes(t))||[];i==="add"?this.filteredTagsAdd=Qe(n):this.filteredTagsRemove=Qe(n)}isVisible(e,i){let t=i==="add"?this.tagsAdded||[]:this.tagsRemoved||[],n=i==="add"?this.tagsRemoved||[]:this.tagsAdded||[],c=t?.findIndex(S=>S?.label===e?.label),f=n?.some(S=>S?._id===e?._id);return!(c>-1||f)}checkForUnique(e,i){let t=i=="add"?this.tagsAdded||[]:this.tagsRemoved||[],n=!0;for(let c=0;c<t?.length;c++)if(t?.[c]?.label?.toLowerCase()==e?.toLowerCase()){n=!1;break}return n}_filter(e){let i;return e?._id?i=e?.label?.toLowerCase():i=e?.toLowerCase(),this.allTagList?.filter(t=>t?.label?.toLowerCase().indexOf(i)===0)||[]}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return`${this.tagsAdded?.length} Tags added. ${this.tagsRemoved?.length} Tags removed.`}captureInitialState(){this.isInitialStateCaptured||(this.initialTagsAdded=this.tagsAdded?JSON.parse(JSON.stringify(this.tagsAdded)):[],this.initialTagsRemoved=this.tagsRemoved?JSON.parse(JSON.stringify(this.tagsRemoved)):[],this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;let e=f=>!f||!Array.isArray(f)?[]:f.map(S=>S?._id||S?.label||"").filter(S=>S).sort(),i=e(this.tagsAdded),t=e(this.initialTagsAdded);
23if(JSON.stringify(i)!==JSON.stringify(t))return!0;let n=e(this.tagsRemoved),c=e(this.initialTagsRemoved);return JSON.stringify(n)!==JSON.stringify(c)||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(Ri),E(Vi),E(H),E(Y),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-manage-tags-box"]],viewQuery:function(i,t){if(i&1&&We(gu,5)(fu,5),i&2){let n;ie(n=ne())&&(t.tagInput=n.first),ie(n=ne())&&(t.tagRemoveInput=n.first)}},inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["chipList",""],["tagInput",""],["auto","matAutocomplete"],["chipRemoveList",""],["tagRemoveInput",""],["autoRemove","matAutocomplete"],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-crayolaorange","rounded-[20px]"],["src","assets/images/icons/tags-white.svg","alt","tags-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Manage Tags",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"automation-chip-input-field","w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none","[&_.mdc-line-ripple]:!hidden"],["aria-label","Tag selection"],[3,"removable"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","focus:outline-none","font-semibold","placeholder:text-transparency-90","px-[10px]","py-[12px]","rounded-[5px]","text-h4","text-transparency-100","w-full",3,"matChipInputTokenEnd","input","focus","blur","formControl","matAutocomplete","matChipInputFor","matChipInputSeparatorKeyCodes","placeholder","disabled"],[3,"optionSelected"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","focus:outline-none","font-semibold","placeholder:text-transparency-90","px-[10px]","py-[12px]","rounded-[5px]","text-h4","text-transparency-100","w-full",3,"input","focus","blur","formControl","matAutocomplete","matChipInputFor","placeholder","disabled"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number","value","1",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[3,"removed","removable"],["matChipRemove",""]],template:function(i,t){i&1&&(r(0,"div",6)(1,"div",7),h(2,"img",8)(3,"span",9),a()(),r(4,"div",10)(5,"div",11),h(6,"img",12),a(),r(7,"div",13)(8,"div",14)(9,"h2",15),p(10," Manage Tags "),a()(),x(11,yu,2,1,"h4",16),a(),r(12,"div",17)(13,"div",18),p(14),a(),x(15,Cu,2,0,"div",19),r(16,"div",20),y("click",function(){return t.onToggleExpanded()}),h(17,"img",21),a()()(),x(18,Bu,37,17,"div",22)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,yi,zt,wi,Ii,vi,Ei,Oi,Ai,bi,Mi,L,Z,gi],styles:["[_nghost-%COMP%]     .automation-chip-input-field input{color:var(--colors-transparency-100-black)!important}[_nghost-%COMP%]     .automation-chip-input-field input::placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}[_nghost-%COMP%]     .automation-chip-input-field input::-webkit-input-placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}[_nghost-%COMP%]     .automation-chip-input-field input::-moz-placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}"]})}}return o})()});function Fu(o,l){if(o&1&&(r(0,"h4",16),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Uu(o,l){if(o&1){let e=C();r(0,"div",23),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",24),a()}}function Wu(o,l){if(o&1&&(r(0,"p",41),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function ju(o,l){if(o&1){let e=C();r(0,"div",25)(1,"div",28)(2,"label",29),p(3," Delay before executing this step "),h(4,"img",37),a(),r(5,"div",38)(6,"input",39),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",40),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Wu,2,1,"p",41),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function qu(o,l){if(o&1&&(r(0,"option",45),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Gu(o,l){if(o&1){let e=C();r(0,"select",42),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,qu,2,2,"option",45,k),a()}if(o&2){let e=d(3);
23m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Hu(o,l){if(o&1&&(r(0,"p",41),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Yu(o,l){if(o&1){let e=C();r(0,"div",25)(1,"div",28)(2,"label",29),p(3," Execute on "),h(4,"img",37),a(),r(5,"div",38)(6,"select",42),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",43),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Gu,3,2,"select",44),a(),x(11,Hu,2,1,"p",41),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function zu(o,l){o&1&&(r(0,"mat-icon",47),p(1,"cancel"),a())}function Ju(o,l){if(o&1){let e=C();r(0,"mat-chip-row",46),y("removed",function(){let t=u(e).$index,n=d(2);return _(n.remove(t,"add"))}),p(1),x(2,zu,2,0,"mat-icon",47),a()}if(o&2){let e=l.$implicit,i=d(2);m("removable",i.removable),s(),T(" ",e==null?null:e.name," "),s(),g(i.removable?2:-1)}}function Qu(o,l){if(o&1&&(r(0,"mat-option",45),p(1),a()),o&2){let e=d().$implicit;m("value",e),s(),T(" ",e==null?null:e.name," ")}}function $u(o,l){if(o&1&&x(0,Qu,2,2,"mat-option",45),o&2){let e=l.$implicit,i=d(2);g(i.isVisible(e,"add")?0:-1)}}function Ku(o,l){o&1&&(r(0,"mat-icon",47),p(1,"cancel"),a())}function Xu(o,l){if(o&1){let e=C();r(0,"mat-chip-row",46),y("removed",function(){let t=u(e).$index,n=d(2);return _(n.remove(t,"remove"))}),p(1),x(2,Ku,2,0,"mat-icon",47),a()}if(o&2){let e=l.$implicit,i=d(2);m("removable",i.removable),s(),T(" ",e==null?null:e.name," "),s(),g(i.removable?2:-1)}}function Zu(o,l){if(o&1&&(r(0,"mat-option",45),p(1),a()),o&2){let e=d().$implicit;m("value",e),s(),T(" ",e==null?null:e.name," ")}}function e0(o,l){if(o&1&&x(0,Zu,2,2,"mat-option",45),o&2){let e=l.$implicit,i=d(2);g(i.isVisible(e,"remove")?0:-1)}}function t0(o,l){o&1&&(r(0,"p",36),p(1," Please select at least one list to add or remove "),a())}function i0(o,l){if(o&1){let e=C();r(0,"div",22),x(1,ju,17,5,"div",25),x(2,Yu,12,6,"div",25),r(3,"div",25)(4,"h2",26),p(5," Manage lists "),a(),r(6,"div",27)(7,"div",28)(8,"label",29),p(9,"Add to lists"),a(),r(10,"mat-form-field",30)(11,"mat-chip-grid",31,0),D(13,Ju,3,3,"mat-chip-row",32,wn),r(15,"input",33,1),y("matChipInputTokenEnd",function(t){u(e);let n=d();return _(n.add(t))})("input",function(t){u(e);let n=d();return _(n.onSearchChange(t.target.value,"add"))})("blur",function(t){u(e);let n=d();return _(n.saveCustomList(t.target.value,"add"))}),a()(),r(17,"mat-autocomplete",34,2),y("optionSelected",function(t){u(e);let n=d();return _(n.selected(t,"add"))}),D(19,$u,1,1,null,null,wn),ot(21,"async"),a()()(),r(22,"div",28)(23,"label",29),p(24,"Remove from lists"),a(),r(25,"mat-form-field",30)(26,"mat-chip-grid",31,3),D(28,Xu,3,3,"mat-chip-row",32,wn),r(30,"input",35,4),y("input",function(t){u(e);let n=d();return _(n.onSearchChange(t.target.value,"remove"))}),a()(),r(32,"mat-autocomplete",34,5),y("optionSelected",function(t){u(e);let n=d();return _(n.selected(t,"remove"))}),D(34,e0,1,1,null,null,wn),ot(36,"async"),a()()(),x(37,t0,2,0,"p",36),a()()()}if(o&2){let e=Te(12),i=Te(18),t=Te(27),n=Te(33),c=d();s(),g((c.delayPreferenceData==null?null:c.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((c.delayPreferenceData==null?null:c.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(11),V(c.listsAdded),s(2),m("formControl",c.listCtrl)("matAutocomplete",i)("matChipInputFor",e)("matChipInputSeparatorKeyCodes",c.separatorKeysCodes)("placeholder",c.listsAdded!=null&&c.listsAdded.length?"":"Add lists")("disabled",c.isViewOnly),s(4),V(mt(21,14,c.filteredListsAdd)),s(9),V(c.listsRemoved),s(2),m("formControl",c.listRemoveCtrl)("matAutocomplete",n)("matChipInputFor",t)("placeholder",c.listsRemoved!=null&&c.listsRemoved.length?"":"Remove lists")("disabled",c.isViewOnl
23y),s(4),V(mt(36,16,c.filteredListsRemove)),s(3),g(c.listsSelectionError?37:-1)}}var Lu,Ru,wn,In,An=ee(()=>{W();$e();se();W();ga();Ce();xe();Ee();be();se();po();la();da();sa();pe();Ve();Lu=["listInput"],Ru=["listRemoveInput"],wn=(o,l)=>l._id;In=(()=>{class o{constructor(e,i,t,n){this._listStackingService=e,this._loaderService=i,this._utilities=t,this._toasterService=n,this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.isExpanded=!0,this.allListOptions=[],this.filteredListsAdd=Qe([]),this.filteredListsRemove=Qe([]),this.listCtrl=new Xe,this.listRemoveCtrl=new Xe,this.separatorKeysCodes=[13,188],this.removable=!0,this.listsAdded=[],this.listsRemoved=[],this.listsSelectionError=!1,this.initialListsAdded=[],this.initialListsRemoved=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyDelayFromPayload(),this.getAllLists()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyDelayFromPayload(),this.isInitialStateCaptured=!1,this.getAllLists())}applyDelayFromPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}resetFilteredListOptions(){let e=this.allListOptions?.slice()||[];this.filteredListsAdd=Qe(e),this.filteredListsRemove=Qe(e)}getAllLists(){this._loaderService.start(),this._listStackingService.getLists({}).subscribe(e=>{if(this._loaderService.stop(),e?.code===200||e?.statusCode===200){let t=Array.isArray(e?.data)?e.data:[];this.applyLoadedListOptions(t)}},e=>{this._loaderService.stop()})}applyLoadedListOptions(e){this.allListOptions=(e||[]).map(i=>this.mapListItem(i)).filter(Boolean),this.listsAdded=[],this.listsRemoved=[],this.payload?.addLists?.length&&(this.listsAdded=this.allListOptions.filter(i=>this.payload.addLists.includes(i._id)).map(i=>P(M({},i),{name:(i.name||"").toLowerCase()}))),this.payload?.removeLists?.length&&(this.listsRemoved=this.allListOptions.filter(i=>this.payload.removeLists.includes(i._id)).map(i=>P(M({},i),{name:(i.name||"").toLowerCase()}))),this.resetFilteredListOptions(),this.captureInitialState()}mapListItem(e){let i=e?.name!=null&&String(e.name).trim()!==""?e.name:e?.label,t=e?._id??e?.id??e?.listId;return i==null||String(i).trim()===""||t==null||t===""?null:{_id:String(t),name:String(i)}}remove(e,i){let t=i==="add"?this.listsAdded:this.listsRemoved;e>=0&&t.splice(e,1),this.clearListsSelectionErrorIfValid()}selected(e,i){let t=e.option.value,n=(t?.name||"").toLowerCase();this.checkForUnique(n,i)&&(i==="add"?(this.listsAdded.push(P(M({},t),{name:n})),this.listInput.nativeElement.value="",this.listCtrl.setValue(null),this.listInput.nativeElement.blur()):(this.listsRemoved.push(P(M({},t),{name:n})),this.listRemoveInput.nativeElement.value="",this.listRemoveCtrl.setValue(null),this.listRemoveInput.nativeElement.blur()),this.clearListsSelectionErrorIfValid(),this.resetFilteredListOptions())}add(e){let i=e.input,n=(e.value||"").trim().toLowerCase();if(n&&this.checkForUnique(n,"add")){let c=this.allListOptions.findIndex(f=>f.name?.toLowerCase()===n);c>=0?this.listsAdded.push(P(M({},this.allListOptions[c]),{name:(this.allListOptions[c].name||"").toLowerCase()})):this.listsAdded.push({_id:"custom",name:n}),this.clearListsSelectionErrorIfValid()}i&&(i.value=""),this.listCtrl.setValue(null),this.resetFilteredListOptions()}saveCustomList(e,i){if(i==="add"){let t=this.listsAdded?.filter(n=>n?._id==="custom")?.map(n=>(n?.name||"").toLowerCase())?.filter(Boolean)||[];if(t.length){this.saveLists(t);return}}this.onSearchChange(e,i)}saveLists(e){if(!e.length)return;this._loaderService.start();let i=e.map(t=>this._listStackingService.addLists({name:t}));ui(i).subscribe({next:t=>{let n=[];t.forEach((c,f)=>{let S=c?.result??c?.data,v=e[f];if((c?.code===200||c?.statusCode===200)&&S?._id){let b={_id:S._id,name:(S?.name||v).toLowerCase()};n.push(b);let N=this.listsAdded.findIndex(j=>(j?.name||"").toLowerCase()===v.toLowerCase());N!==-1&&(this.listsAdded[N]._id=b._id,this.listsAdded[N].name=b.name);return}c?.code===202&&this._toasterService.showError("List Name Already Exists!")}),n.length&&(this.allListOptions=[...this.allListOptions,...n],this.resetFilteredListOptions()),this._loaderService.stop()},error:()=>{this._loaderService.stop()}})}onSearchChange(e,i){let t=(e||"").toLowerCase(),n=this.allListOptions?.filter(c=>c?.name?.toLowerCase().includes(t))||[];
23i==="add"?this.filteredListsAdd=Qe(n):this.filteredListsRemove=Qe(n)}isVisible(e,i){let t=i==="add"?this.listsAdded:this.listsRemoved,n=i==="add"?this.listsRemoved:this.listsAdded,c=t.findIndex(S=>S.name===e.name||S._id===e._id),f=n.some(S=>S._id===e._id);return c<=-1&&!f}checkForUnique(e,i){return!(i==="add"?this.listsAdded:this.listsRemoved).some(n=>n.name?.toLowerCase()===e?.toLowerCase())}hasListSelection(){return!!(this.listsAdded?.length||this.listsRemoved?.length)}markListsSelectionError(){this.listsSelectionError=!this.hasListSelection()}clearListsSelectionErrorIfValid(){this.hasListSelection()&&(this.listsSelectionError=!1)}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return`${this.listsAdded?.length} Lists added. ${this.listsRemoved?.length} Lists removed.`}captureInitialState(){this.isInitialStateCaptured||(this.initialListsAdded=this.listsAdded?JSON.parse(JSON.stringify(this.listsAdded)):[],this.initialListsRemoved=this.listsRemoved?JSON.parse(JSON.stringify(this.listsRemoved)):[],this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;let e=i=>!i||!Array.isArray(i)?[]:i.map(t=>t?._id||t?.name||"").filter(t=>t).sort();return JSON.stringify(e(this.listsAdded))!==JSON.stringify(e(this.initialListsAdded))||JSON.stringify(e(this.listsRemoved))!==JSON.stringify(e(this.initialListsRemoved))||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(Vi),E(H),E(q),E(Y))}}static{this.\u0275cmp=B({type:o,selectors:[["app-manage-lists-box"]],viewQuery:function(i,t){if(i&1&&We(Lu,5)(Ru,5),i&2){let n;ie(n=ne())&&(t.listInput=n.first),ie(n=ne())&&(t.listRemoveInput=n.first)}},inputs:{payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["chipList",""],["listInput",""],["auto","matAutocomplete"],["chipRemoveList",""],["listRemoveInput",""],["autoRemove","matAutocomplete"],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-charts-brighter-yellow","rounded-[20px]"],["src","assets/images/icons/list-ul-white.svg","alt","list-ul-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Manage Lists",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],[1,"automation-chip-input-field","w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none","[&_.mdc-line-ripple]:!hidden"],["aria-label","List selection"],[3,"removable"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","focus:outline-none","font-semibold","placeholder:text-transparency-90","px-[10px]","py-[12px]","rounded-[5px]","text-h4","text-transparency-100","w-full",3,"matChipInputTokenEnd","input","blur","formControl","matAutocomplete","matChipInputFor","matChipInputSeparatorKeyCodes","placeholder","disabled"],[3,"optionSelected"],[1,"bg-transparency-0","border-[1px]","border-solid","border-transparency-25","focus:outline-none","font-semibold","placeholder:text-transparency-90","px-[10px]","py-[12px]","rounded-[5px]","text-h4","text-transparency-100","w-full",3,"input","formControl","matAutocomplete","matChipInputFor","placeholder","disabled"],[1,"text-charts-brighter-red","text-label","font-medium"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[3,"removed","removable"],["matChipRemove",""]],template:function(i,t){i&1&&(r(0,"div",6)(1,"div",7),h(2,"img",8)(3,"span",9),a()(),r(4,"div",10)(5,"div",11),h(6,"img",12),a(),r(7,"div",13)(8,"div",14)(9,"h2",15),p(10," Manage Lists "),a()(),x(11,Fu,2,1,"h4",16),a(),r(12,"div",17)(13,"div",18),p(14),a(),x(15,Uu,2,0,"div",19),r(16,"div",20),y("click",function(){return t.onToggleExpanded()}),h(17,"img",21),a()()(),x(18,i0,38,18,"div",22)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
23y?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,yi,zt,wi,Ii,vi,Ei,Oi,Ai,bi,Mi,L,Z,gi],styles:["[_nghost-%COMP%]     .automation-chip-input-field input{color:var(--colors-transparency-100-black)!important}[_nghost-%COMP%]     .automation-chip-input-field input::placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}[_nghost-%COMP%]     .automation-chip-input-field input::-webkit-input-placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}[_nghost-%COMP%]     .automation-chip-input-field input::-moz-placeholder{color:var(--colors-transparency-90)!important;opacity:1!important}"]})}}return o})()});function o0(o,l){if(o&1&&(r(0,"h4",8),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function a0(o,l){if(o&1){let e=C();r(0,"div",15),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",16),a()}}function r0(o,l){if(o&1&&(r(0,"option",24),p(1),ot(2,"titlecase"),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",mt(2,2,e==null?null:e.title)," ")}}function l0(o,l){if(o&1&&(r(0,"option",24),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",e==null?null:e.title," ")}}function s0(o,l){if(o&1){let e=C();r(0,"div",14)(1,"div",17)(2,"div",18)(3,"div",19)(4,"label",20),p(5,"Select pipeline "),h(6,"img",21),a(),r(7,"select",22),A("ngModelChange",function(t){u(e);let n=d();return I(n.pipelineId,t)||(n.pipelineId=t),_(t)}),y("change",function(){u(e);let t=d();return _(t.setStatus())}),r(8,"option",23),p(9,"--Select pipeline--"),a(),D(10,r0,3,4,"option",24,k),a()(),r(12,"div",25),h(13,"svg-icon",26),a(),r(14,"div",19)(15,"label",20),p(16,"Select status "),h(17,"img",21),a(),r(18,"select",27),A("ngModelChange",function(t){u(e);let n=d();return I(n.statusId,t)||(n.statusId=t),_(t)}),r(19,"option",23),p(20,"--Select status--"),a(),D(21,l0,2,2,"option",24,k),a()()()()()}if(o&2){let e=d();s(7),w("ngModel",e.pipelineId),m("disabled",e.isViewOnly),s(3),V(e.pipelineData),s(8),w("ngModel",e.statusId),m("disabled",e.isViewOnly),s(3),V(e.statusData)}}var Mn,On=ee(()=>{W();Re();W();Lt();Ce();Ee();be();se();pe();Ve();He();Mn=(()=>{class o{constructor(e,i,t){this._leadsService=e,this._loaderService=i,this._toastrService=t,this.previewText="Changed to Pipeline Name",this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.isViewOnly=!1,this.automationType="",this.disableDelete=!1,this.deleteBox=new R,this.pipelineId="",this.statusId=[],this.isExpanded=!0,this.pipelineData=[],this.statusData=[],this.initialPipelineId="",this.initialStatusId=[],this.isInitialStateCaptured=!1}ngOnInit(){this.applyPayload(),this.getPipelineList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getPipelineList())}applyPayload(){if(typeof this.payload?.pipelineId<"u"&&(this.pipelineId=this.payload.pipelineId),typeof this.payload?.mainStatusId<"u"){let e=this.payload.mainStatusId;this.statusId=Array.isArray(e)?[...e]:e!=null?[e]:[]}}organizePipelinesFromResponse(e){let i=e.filter(c=>c?.masterPipelineId).sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0)),t=e?.filter(c=>!c?.masterPipelineId),n=[...i,...t].sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0));return n=n?.map(c=>{if(c?.mainStatusList?.length){let f=c?.mainStatusList.filter(v=>v?.masterStatusId).sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0)),S=c?.mainStatusList?.filter(v=>!v?.masterStatusId);c.mainStatusList=[...f,...S].sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0))}return c}),n}getPipelineList(){let e={page:1,limit:100,moduleId:this.moduleId};this._loaderService.start(),this._leadsService.getPipelines(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items||[];if(this.pipelineData=this.organizePipelinesFromResponse(t),typeof this.payload?.pipelineId<"u"){this.pipelineId=this.payload.pipelineId,this.setStatus();let n=this.payload?.mainStatusId;this.statusId=Array.isArray(n)?[...n]:n!=null?[n]:[],this.dropUnderContractStatusSelection()}this.captureInitialState()}this._loaderService.stop()},i=>{this._loaderService.stop()})}onToggleExpanded(){this.isExpanded=!this.isExpanded}onDeleteBox(){this.deleteBox.emit()}setStatus(){this.statusId=[];
23let e=this.pipelineData?.findIndex(i=>i?._id==this.pipelineId);e>=0&&(this.statusData=this.filterStatusOptionsForModule(this.pipelineData?.[e]?.mainStatusList||[])),this.dropUnderContractStatusSelection()}resolveModuleId(){let e=this.moduleId;return e!=null&&typeof e=="object"&&typeof e._id=="string"?e._id:String(e??"")}shouldExcludeUnderContractStatus(){let e=this.resolveModuleId();return e===O.MainStatusId.LEAD||e===O.MainStatusId.INVENTORY}isUnderContractStatus(e){return(e?.title??"").toString().trim().toLowerCase()==="under contract"}filterStatusOptionsForModule(e){return this.shouldExcludeUnderContractStatus()?(e||[]).filter(i=>!this.isUnderContractStatus(i)):e||[]}dropUnderContractStatusSelection(){this.shouldExcludeUnderContractStatus()&&(this.statusId=(this.statusId||[]).filter(e=>{let i=this.statusData?.find(t=>t?._id===e);return i&&!this.isUnderContractStatus(i)}))}getPreview(){let e="",i=this.pipelineData?.findIndex(c=>c?._id==this.pipelineId);i>=0&&(e=`Pipeline: ${this.pipelineData?.[i]?.title}.`);let n=(Array.isArray(this.statusId)?this.statusId:this.statusId!=null?[this.statusId]:[]).map(c=>{let f=this.statusData?.findIndex(S=>S?._id===c);return f>=0?this.statusData?.[f]?.title:null}).filter(Boolean);return n.length&&(e+=` Status: ${n.join(", ")}.`),e}captureInitialState(){this.isInitialStateCaptured||(this.initialPipelineId=this.pipelineId||"",this.initialStatusId=this.statusId?[...this.statusId]:[],this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.pipelineId!==this.initialPipelineId||this.statusId?.length!==this.initialStatusId?.length||!this.statusId?.every(e=>this.initialStatusId?.includes(e))||!this.initialStatusId?.every(e=>this.statusId?.includes(e)):!1}static{this.\u0275fac=function(i){return new(i||o)(E(it),E(H),E(Y))}}static{this.\u0275cmp=B({type:o,selectors:[["app-pipeline-select-box"]],inputs:{previewText:"previewText",moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",isViewOnly:"isViewOnly",automationType:"automationType",disableDelete:"disableDelete"},outputs:{deleteBox:"deleteBox"},standalone:!1,features:[z],decls:17,vars:5,consts:[[1,"flex","justify-between","items-center","gap-[10px]"],[1,"flex-none","flex","items-center","p-[14px]","bg-tags-brighter-teal","rounded-[20px]"],["src","assets/images/icons/status-change-white.svg","alt","status-change-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Select pipeline/status",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],["pTooltip","This step executes only when the lead is created via Seller Website or Call or SMS, and is skipped for manual or web form creations.","tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","change","ngModel","disabled"],["value",""],[3,"value"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2),a(),r(3,"div",3)(4,"div",4)(5,"h2",5),p(6," Select pipeline/status "),a(),r(7,"div",6),h(8,"svg-icon",7),a()(),x(9,o0,2,1,"h4",8),a(),r(10,"div",9)(11,"div",10),p(12),a(),x(13,a0,2,0,"div",11),r(14,"div",12),y("click",function(){return t.onToggleExpanded()}),h(15,"img",13),a()()(),x(16,s0,23,4,"div",14)),i&2&&(s(9),g(t.isExpanded?-1:9),s(3),T(" Step ",t.stepIndex+1," "),s(),g(!t.isViewOnly&&!t.disableDelete?13:-1),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?16:-1))},dependencies:[J,K,X,$,F,U,L,Z,he,Yt],encapsulation:2})}}return o})()});function c0(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function p0(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function m0(o,l){if(o&1&&(r(0,"p",30),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function u0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",22)(2,"label",23),p(3," Delay before executing this step "),h(4,"img",24),a(),r(5,"div",27)(6,"input",28),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",29),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,m0,2,1,"p",30),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function _0(o,l){if(o&1&&(r(0,"option",34),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function h0(o,l){if(o&1){let e=C();r(0,"select",31),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,_0,2,2,"option",34,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function x0(o,l){if(o&1&&(r(0,"p",30),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function g0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",22)(2,"label",23),p(3," Execute on "),h(4,"img",24),a(),r(5,"div",27)(6,"select",31),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",32),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,h0,3,2,"select",33),a(),x(11,x0,2,1,"p",30),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function f0(o,l){if(o&1){let e=C();r(0,"div",16),x(1,u0,17,5,"div",19),x(2,g0,12,6,"div",19),r(3,"div",19)(4,"h2",20),p(5," Webhook details "),a(),r(6,"div",21)(7,"div",22)(8,"label",23),p(9,"Webhook URL "),h(10,"img",24),a(),r(11,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.webhookUrl,t)||(n.webhookUrl=t),_(t)}),a()(),r(12,"div",22)(13,"label",23),p(14,"API key "),a(),r(15,"input",26),A("ngModelChange",function(t){u(e);let n=d();return I(n.apiKey,t)||(n.apiKey=t),_(t)}),a()()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(9),w("ngModel",e.webhookUrl),m("disabled",e.isViewOnl
23y),s(4),w("ngModel",e.apiKey),m("disabled",e.isViewOnly)}}var Dn,Vn=ee(()=>{W();W();xe();be();se();pe();Ve();Dn=(()=>{class o{constructor(e){this._utilities=e,this.previewText="Active. Posting current lead data to provided address and api key.",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.dataToPost="POST_CURRENT_LEAD_DATA",this.apiKey="",this.webhookUrl="",this.initialDataToPost="",this.initialApiKey="",this.initialWebhookUrl="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.dataToPostOptions=[{id:"POST_CURRENT_LEAD_DATA",label:"Post Current Lead Data"}],this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),this.dataToPost=this.payload?.dataToPost??"POST_CURRENT_LEAD_DATA",this.apiKey=this.payload?.apiKey??"",this.webhookUrl=this.payload?.webhookUrl??""}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){let e=this.dataToPostOptions?.find(i=>i?.id===this.dataToPost);return e?` ${e.label}.`:""}captureInitialState(){this.isInitialStateCaptured||(this.initialDataToPost=this.dataToPost||"",this.initialApiKey=this.apiKey||"",this.initialWebhookUrl=this.webhookUrl||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.dataToPost!==this.initialDataToPost||this.apiKey!==this.initialApiKey||this.webhookUrl!==this.initialWebhookUrl||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-webhook-box"]],inputs:{previewText:"previewText",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-vividskyblue","rounded-[20px]"],["src","assets/images/icons/webhook-white.svg","alt","webhook-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Webhook",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],["type","text","placeholder","https://www.your-web-hook-address.com",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["type","text","placeholder","Optional, if your server requires API key to successfully post the data.",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Webhook "),a()(),x(11,c0,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,p0,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,f0,16,6,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z],encapsulation:2})}}return o})()});function C0(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function b0(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function S0(o,l){if(o&1&&(r(0,"p",33),p(1),a()),o&2){let e=d(3);
23s(),T(" ",e.timingSequenceError," ")}}function T0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",27)(2,"label",28),p(3," Delay before executing this step "),h(4,"img",29),a(),r(5,"div",30)(6,"input",31),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",32),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,S0,2,1,"p",33),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function v0(o,l){if(o&1&&(r(0,"option",37),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function E0(o,l){if(o&1){let e=C();r(0,"select",34),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,v0,2,2,"option",37,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function w0(o,l){if(o&1&&(r(0,"p",33),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function I0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",27)(2,"label",28),p(3," Execute on "),h(4,"img",29),a(),r(5,"div",30)(6,"select",34),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",35),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,E0,3,2,"select",36),a(),x(11,w0,2,1,"p",33),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function A0(o,l){if(o&1){let e=C();r(0,"div",16),x(1,T0,17,5,"div",19),x(2,I0,12,6,"div",19),r(3,"div",20)(4,"div",21)(5,"h3",22),p(6," Block Incoming Communication "),a(),r(7,"div",23),p(8," This will block all incoming calls and SMS from this contact. "),a()(),r(9,"label",24)(10,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.isBlockIncomingCommunication,t)||(n.isBlockIncomingCommunication=t),_(t)}),a(),h(11,"span",26),a()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(8),w("ngModel",e.isBlockIncomingCommunication),m("disabled",e.isViewOnly)}}var Nn,kn=ee(()=>{W();W();xe();be();se();pe();Ve();Nn=(()=>{class o{constructor(e){this._utilities=e,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.isBlockIncomingCommunication=!0,this.initialIsBlockIncomingCommunication=!0,this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){typeof this.payload?.isBlockIncomingCommunication<"u"&&(this.isBlockIncomingCommunication=this.payload.isBlockIncomingCommunication),this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.isBlockIncomingCommunication?"Enabled":"Disabled"}captureInitialState(){this.isInitialStateCaptured||(this.initialIsBlockIncomingCommunication=this.isBlockIncomingCommunication,this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.isBlockIncomingCommunication!==this.initialIsBlockIncomingCommunication||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-block-incoming-communication"]],inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-fandango","rounded-[20px]"],["src","assets/images/icons/close-circle-outline-white.svg","alt","close-circle-outline-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Block Incoming Communication",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex-1","flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"text-label","leading-[normal]","text-transparency-100","font-medium","opacity-60"],[1,"re-custom-switch"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"slider"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Block Incoming Communication "),a()(),x(11,C0,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,b0,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,A0,12,4,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,Ke,$,F,re,U,L,Z],encapsulation:2})}}return o})()});function O0(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function D0(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function V0(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function N0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",26)(2,"label",27),p(3," Delay before executing this step "),h(4,"img",28),a(),r(5,"div",29)(6,"input",30),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",31),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,V0,2,1,"p",32),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function k0(o,l){if(o&1&&(r(0,"option",36),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function B0(o,l){if(o&1){let e=C();r(0,"select",33),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,k0,2,2,"option",36,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function P0(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function L0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",26)(2,"label",27),p(3," Execute on "),h(4,"img",28),a(),r(5,"div",29)(6,"select",33),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,B0,3,2,"select",35),a(),x(11,P0,2,1,"p",32),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function R0(o,l){if(o&1){let e=C();r(0,"div",16),x(1,N0,17,5,"div",19),x(2,L0,12,6,"div",19),r(3,"div",20)(4,"div",21)(5,"label",22)(6,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.action,t)||(n.action=t),_(t)}),a(),h(7,"img",24),p(8,"Mark as Returned Mail"),a(),r(9,"label",22)(10,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.action,t)||(n.action=t),_(t)}),a(),h(11,"img",24),p(12,"Unmark as Returned Mail"),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(4),m("name","mailStatus_"+e.actionId),w("ngModel",e.action),m("disabled",e.isViewOnl
23y),s(4),m("name","mailStatus_"+e.actionId),w("ngModel",e.action),m("disabled",e.isViewOnly)}}var Bn,Pn=ee(()=>{W();W();xe();be();se();pe();Ve();Bn=(()=>{class o{constructor(e){this._utilities=e,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.action="MARK_AS_RETURNED_MAIL",this.initialAction="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){typeof this.payload?.action<"u"&&(this.action=this.payload.action),this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.action==="MARK_AS_RETURNED_MAIL"?"Mark as Returned Mail":"Unmark as Returned Mail"}captureInitialState(){this.isInitialStateCaptured||(this.initialAction=this.action||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.action!==this.initialAction||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-mark-returned-mail"]],inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-vividskyblue","rounded-[20px]"],["src","assets/images/icons/email-incoming-white.svg","alt","email-incoming-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Mark as Returned Mail",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","flex-wrap","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio","value","MARK_AS_RETURNED_MAIL",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],["type","radio","value","UNMARK_AS_RETURNED_MAIL",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Mark as Returned Mail "),a()(),x(11,O0,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,D0,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,R0,13,8,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
23y?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z],encapsulation:2})}}return o})()});function U0(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function W0(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function j0(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function q0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",26)(2,"label",27),p(3," Delay before executing this step "),h(4,"img",28),a(),r(5,"div",29)(6,"input",30),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",31),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,j0,2,1,"p",32),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function G0(o,l){if(o&1&&(r(0,"option",36),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function H0(o,l){if(o&1){let e=C();r(0,"select",33),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,G0,2,2,"option",36,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function Y0(o,l){if(o&1&&(r(0,"p",32),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function z0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",26)(2,"label",27),p(3," Execute on "),h(4,"img",28),a(),r(5,"div",29)(6,"select",33),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,H0,3,2,"select",35),a(),x(11,Y0,2,1,"p",32),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function J0(o,l){if(o&1){let e=C();r(0,"div",16),x(1,q0,17,5,"div",19),x(2,z0,12,6,"div",19),r(3,"div",20)(4,"div",21)(5,"label",22)(6,"input",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.action,t)||(n.action=t),_(t)}),a(),h(7,"img",24),p(8,"Mark Lead Qualified"),a(),r(9,"label",22)(10,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.action,t)||(n.action=t),_(t)}),a(),h(11,"img",24),p(12,"Mark Lead Not-Qualified"),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(4),m("name","leadQualified_"+e.actionId),w("ngModel",e.action),m("disabled",e.isViewOnly),s(4),m("name","leadQualified_"+e.actionId),w("ngModel",e.action),m("disabled",e.isViewOnly)}}var Ln,Rn=ee(()=>{W();W();xe();be();se();pe();Ve();Ln=(()=>{class o{constructor(e){this._utilities=e,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.action="MARK_LEAD_QUALIFIED",this.initialAction="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){typeof this.payload?.isQualified<"u"&&(this.action=this.payload.isQualified?"MARK_LEAD_QUALIFIED":"MARK_LEAD_NOT_QUALIFIED"),this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.action==="MARK_LEAD_QUALIFIED"?"Mark Lead Qualified":"Mark Lead Not-Qualified"}captureInitialState(){this.isInitialStateCaptured||(this.initialAction=this.action||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.action!==this.initialAction||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-mark-lead-qualified-box"]],inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[20px] h-[20px] block","src","assets/images/icons/time.svg",1,"text-transparency-100"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-pistachio","rounded-[20px]"],["svgClass","w-[28px] h-[28px] block","src","assets/images/icons/verified-qualified.svg",1,"text-transparency-white"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Mark Lead Qualified",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","flex-wrap","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio","value","MARK_LEAD_QUALIFIED",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],["type","radio","value","MARK_LEAD_NOT_QUALIFIED",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"svg-icon",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"svg-icon",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Mark Lead Qualified "),a()(),x(11,U0,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,W0,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,J0,13,8,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z],encapsulation:2})}}return o})()});function $0(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function K0(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function X0(o,l){if(o&1&&(r(0,"p",28),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Z0(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",22)(2,"label",23),p(3," Delay before executing this step "),h(4,"img",24),a(),r(5,"div",25)(6,"input",26),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",27),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,X0,2,1,"p",28),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function e_(o,l){if(o&1&&(r(0,"option",32),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function t_(o,l){if(o&1){let e=C();r(0,"select",29),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,e_,2,2,"option",32,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function i_(o,l){if(o&1&&(r(0,"p",28),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function n_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",22)(2,"label",23),p(3," Execute on "),h(4,"img",24),a(),r(5,"div",25)(6,"select",29),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",30),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,t_,3,2,"select",31),a(),x(11,i_,2,1,"p",28),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function o_(o,l){if(o&1){let e=C();r(0,"label",33)(1,"input",34),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.markAsVip,t)||(n.markAsVip=t),_(t)}),a(),h(2,"img",35),r(3,"span"),p(4,"Mark as VIP"),a()(),r(5,"label",33)(6,"input",34),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.markAsVip,t)||(n.markAsVip=t),_(t)}),a(),h(7,"img",35),r(8,"span"),p(9,"Unmark as VIP"),a()()}if(o&2){let e=d(2);s(),m("name",e.radioGroupName),w("ngModel",e.markAsVip),m("value",!0)("disabled",e.isViewOnl
23y),s(5),m("name",e.radioGroupName),w("ngModel",e.markAsVip),m("value",!1)("disabled",e.isViewOnly)}}function a_(o,l){if(o&1){let e=C();r(0,"label",33)(1,"input",34),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.action,t)||(n.action=t),_(t)}),a(),h(2,"img",35),r(3,"span"),p(4,"Mark as Hot Lead"),a()(),r(5,"label",33)(6,"input",34),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.action,t)||(n.action=t),_(t)}),a(),h(7,"img",35),r(8,"span"),p(9,"Unmark as Hot Lead"),a()()}if(o&2){let e=d(2);s(),m("name",e.radioGroupName),w("ngModel",e.action),m("value",e.markAsValue)("disabled",e.isViewOnly),s(5),m("name",e.radioGroupName),w("ngModel",e.action),m("value",e.unmarkValue)("disabled",e.isViewOnly)}}function r_(o,l){if(o&1&&(r(0,"div",16),x(1,Z0,17,5,"div",19),x(2,n_,12,6,"div",19),r(3,"div",20)(4,"div",21),x(5,o_,10,8)(6,a_,10,8),a()()()),o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(3),g(e.isVipVariant?5:6)}}var Fn,Un=ee(()=>{W();W();xe();be();se();pe();Ve();Fn=(()=>{class o{constructor(e){this._utilities=e,this.markVariant="hot",this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.action="MARK_AS_HOT_LEAD",this.markAsVip=!0,this.initialAction="",this.initialMarkAsVip=!0,this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState()),e.markVariant&&!e.markVariant.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}get isVipVariant(){return this.markVariant==="vip"}get markAsValue(){return this.isVipVariant?"MARK_AS_VIP":"MARK_AS_HOT_LEAD"}get unmarkValue(){return this.isVipVariant?"UNMARK_AS_VIP":"UNMARK_AS_HOT_LEAD"}get headerTitle(){return this.isVipVariant?"Mark/Unmark as VIP":"Mark/Unmark as Hot"}get headerIcon(){return this.isVipVariant?"assets/images/icons/vip.svg":"assets/images/icons/hot-filled-white.svg"}get radioGroupName(){return`markState_${this.actionId}_${this.markVariant}`}applyPayload(){this.isVipVariant?typeof this.payload?.isVip=="boolean"?this.markAsVip=this.payload.isVip:this.payload?.action==="UNMARK_AS_VIP"?this.markAsVip=!1:this.payload?.action==="MARK_AS_VIP"?this.markAsVip=!0:this.markAsVip=!0:typeof this.payload?.action<"u"?this.action=this.payload.action:this.action="MARK_AS_HOT_LEAD",this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){return this.isVipVariant?this.markAsVip?"Mark as VIP":"Unmark as VIP":this.action==="MARK_AS_HOT_LEAD"?"Mark as Hot Lead":"Unmark as Hot Lead"}captureInitialState(){this.isInitialStateCaptured||(this.initialAction=this.action||"",this.initialMarkAsVip=this.markAsVip,this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;if(this.isVipVariant){if(this.markAsVip!==this.initialMarkAsVip)return!0}else if(this.action!==this.initialAction)return!0;return JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-mark-hot"]],inputs:{markVariant:"markVariant",moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:10,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-secondary-red","rounded-[20px]"],["width","28","height","28",1,"img-fluid",3,"src","alt"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate",3,"appTooltip"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","flex-wrap","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","gap-[10px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outboun
23d-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","value","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10),a()(),x(11,$0,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,K0,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,r_,7,3,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(3),m("src",t.headerIcon,ge)("alt",t.isVipVariant?"vip":"hot-filled-white"),s(3),m("appTooltip",t.headerTitle),s(),T(" ",t.headerTitle," "),s(),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z],encapsulation:2})}}return o})()});function d_(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function c_(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function p_(o,l){if(o&1&&(r(0,"p",31),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function m_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",26),p(3," Delay before executing this step "),h(4,"img",27),a(),r(5,"div",28)(6,"input",29),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",30),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,p_,2,1,"p",31),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function u_(o,l){if(o&1&&(r(0,"option",25),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function __(o,l){if(o&1){let e=C();r(0,"select",32),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,u_,2,2,"option",25,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function h_(o,l){if(o&1&&(r(0,"p",31),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function x_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",26),p(3," Execute on "),h(4,"img",27),a(),r(5,"div",28)(6,"select",32),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",33),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,__,3,2,"select",34),a(),x(11,h_,2,1,"p",31),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function g_(o,l){if(o&1&&(r(0,"option",25),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e._id),s(),T(" ",e==null?null:e.name," ")}}function f_(o,l){if(o&1){let e=C();r(0,"div",16),x(1,m_,17,5,"div",19),x(2,x_,12,6,"div",19),r(3,"div",19)(4,"div",20)(5,"label",21),p(6," Select Call Flow to move to "),h(7,"img",22),a(),r(8,"select",23),A("ngModelChange",function(t){u(e);let n=d();return I(n.selectedCallFlow,t)||(n.selectedCallFlow=t),_(t)}),r(9,"option",24),p(10,"--Select a Call Flow--"),a(),D(11,g_,2,2,"option",25,s_),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(6),w("ngModel",e.selectedCallFlow),m("disabled",e.isViewOnl
23y),s(3),V(e.flowList)}}var s_,Wn,jn=ee(()=>{W();W();Ce();Ee();St();xe();be();se();pe();Ve();s_=(o,l)=>l==null?null:l._id;Wn=(()=>{class o{constructor(e,i,t,n){this._loaderService=e,this._toastr=i,this._commonService=t,this._commonFunctions=n,this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.flowList=[],this.selectedCallFlow="",this.initialSelectedCallFlow="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.getFlowList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getFlowList())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),typeof this.payload?.selectedCallFlow<"u"&&(this.selectedCallFlow=this.payload.selectedCallFlow)}onToggleExpanded(){this.isExpanded=!this.isExpanded}getFlowList(){let e={page:1,limit:30,numTypeId:1};this._loaderService.start(),this._commonService.getManageFlow(e).subscribe(i=>{i?.statusCode==200&&(this.flowList=i?.data?.items||[],typeof this.payload?.selectedCallFlow<"u"&&(this.selectedCallFlow=this.payload.selectedCallFlow),this.captureInitialState(),this._loaderService.stop())},i=>{if(this._loaderService.stop(),i?.error){let t=i.error;this._toastr.showError(t?.message??"")}})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){let e=this.flowList?.findIndex(i=>i?._id===this.selectedCallFlow);return e>=0?`Changed to ${this.flowList?.[e]?.name}.`:""}captureInitialState(){this.isInitialStateCaptured||(this.initialSelectedCallFlow=this.selectedCallFlow||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.selectedCallFlow!==this.initialSelectedCallFlow||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Y),E(Ue),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-move-to-call-flow"]],inputs:{payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-emerald","rounded-[20px]"],["src","assets/images/icons/call-2-white.svg","alt","call-2-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Move to Different Call Flow",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-2"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"flex","items-center","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid","inline-block"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Move to Different Call Flow "),a()(),x(11,d_,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,c_,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,f_,13,4,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z],encapsulation:2})}}return o})()});function C_(o,l){if(o&1&&(r(0,"h4",12),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function b_(o,l){if(o&1){let e=C();r(0,"div",19),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",20),a()}}function S_(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);
23s(),T(" ",e.timingSequenceError," ")}}function T_(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",30)(2,"label",31),p(3," Delay before executing this step "),h(4,"img",32),a(),r(5,"div",33)(6,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",35),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,S_,2,1,"p",36),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function v_(o,l){if(o&1&&(r(0,"option",40),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function E_(o,l){if(o&1){let e=C();r(0,"select",37),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,v_,2,2,"option",40,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function w_(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function I_(o,l){if(o&1){let e=C();r(0,"div",21)(1,"div",30)(2,"label",31),p(3," Execute on "),h(4,"img",32),a(),r(5,"div",33)(6,"select",37),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",38),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,E_,3,2,"select",39),a(),x(11,w_,2,1,"p",36),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function A_(o,l){if(o&1){let e=C();r(0,"label",42)(1,"div",43)(2,"input",44),A("ngModelChange",function(t){u(e);let n=d(3);return I(n.moveToAutomationId,t)||(n.moveToAutomationId=t),_(t)}),a(),h(3,"span",45),a(),r(4,"div",46)(5,"h4",47),p(6),a()()()}if(o&2){let e=l.$implicit,i=d(3);s(2),m("name","moveToAutomation"+i.actionId),w("ngModel",i.moveToAutomationId),m("value",e==null?null:e._id)("disabled",i.isViewOnly),s(4),T(" ",e==null?null:e.name," ")}}function M_(o,l){if(o&1&&(r(0,"div",29)(1,"h4",41),p(2),a(),r(3,"div",29),D(4,A_,7,5,"label",42,k),a()()),o&2){let e=l.$implicit;s(2),T(" ",e.name," "),s(2),V(e.items)}}function O_(o,l){if(o&1){let e=C();r(0,"div",18),x(1,T_,17,5,"div",21),x(2,I_,12,6,"div",21),r(3,"div",22)(4,"h2",23),p(5," Select automation "),a(),r(6,"div",24)(7,"div",25),h(8,"img",26),r(9,"input",27),A("ngModelChange",function(t){u(e);let n=d();return I(n.searchTerm,t)||(n.searchTerm=t),_(t)}),a()(),r(10,"div",28),D(11,M_,6,1,"div",29,k),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(7),w("ngModel",e.searchTerm),m("disabled",e.isViewOnly),s(2),V(e.filteredAutomations)}}var qn,Gn=ee(()=>{W();Mt();W();Ce();Ee();at();xe();be();se();pe();Ve();He();qn=(()=>{class o{get searchTerm(){return this._searchTerm}set searchTerm(e){this._searchTerm=e,this.updateFilteredAutomations()}constructor(e,i,t,n){this._loaderService=e,this._toastr=i,this._automationService=t,this._commonFunctions=n,this.payload={},this.moduleId="",this.automationId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.automationList=[],this.filteredAutomations=[],this.moveToAutomationId="",this._searchTerm="",this.automationTypeOrder=["LEAD_CREATED","STATUS_CHANGE","ACTIVITY_TRIGGER","OTHER_CONDITION","MANUAL_ASSIGNMENT"],this.initialMoveToAutomationId="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.getAutomationList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getAutomationList())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),typeof this.payload?.moveToAutomationId<"u"&&(this.moveToAutomationId=this.payload.moveToAutomationId)}onToggleExpanded(){this.isExpanded=!this.isExpanded}getAutomationList(){let e={moduleId:this.moduleId,page:1,limit:100,automationType:"MANUA
23L_ASSIGNMENT"};this._loaderService.start(),this._automationService.listAutomation(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items?.filter(n=>n?._id!=this.automationId)||[];this.automationList=this.groupAutomationsByType(t),this.updateFilteredAutomations(),typeof this.payload?.moveToAutomationId<"u"&&(this.moveToAutomationId=this.payload.moveToAutomationId),this.captureInitialState()}this._loaderService.stop()},i=>{this._loaderService.stop()})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){for(let e of this.automationList||[]){let i=e.items?.find(t=>t?._id===this.moveToAutomationId);if(i)return`${i?.name} selected`}return""}captureInitialState(){this.isInitialStateCaptured||(this.initialMoveToAutomationId=this.moveToAutomationId||"",this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.moveToAutomationId!==this.initialMoveToAutomationId||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}updateFilteredAutomations(){if(!this.searchTerm||!this.searchTerm.trim()){this.filteredAutomations=this.automationList;return}let e=this.searchTerm.toLowerCase().trim();this.filteredAutomations=this.automationList.map(i=>{let t=i.items.filter(n=>n.name?.toLowerCase().includes(e));return P(M({},i),{items:t})}).filter(i=>i.items.length>0)}getAutomationTypeName(e){for(let i of Q.AutomationType){let t=i.children?.find(n=>n.path===e);if(t)return t.label}return e}groupAutomationsByType(e){let i=new Map;e.forEach(n=>{let c=n?.automationType||"UNKNOWN";i.has(c)||i.set(c,[]),i.get(c)?.push(n)});let t=[];return i.forEach((n,c)=>{t.push({automationType:c,name:this.getAutomationTypeName(c),items:n})}),t.sort((n,c)=>{let f=this.automationTypeOrder.indexOf(n.automationType),S=this.automationTypeOrder.indexOf(c.automationType);return f!==-1&&S!==-1?f-S:f!==-1?-1:S!==-1?1:n.name.localeCompare(c.name)})}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Y),E(Me),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-move-to-other-automation"]],inputs:{payload:"payload",moduleId:"moduleId",automationId:"automationId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:21,vars:7,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-darkblue","rounded-[20px]"],["src","assets/images/icons/change-white.svg","alt","change-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Move to other Automation",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-1
235","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[15px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","items-center","self-stretch","relative"],["src","assets/images/header/search.svg","alt","search","width","20",1,"img-fluid","absolute","left-[10px]","top-1/2","-translate-y-1/2"],["type","text","placeholder","Search Automations",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","flex-col","gap-[10px]","max-h-[300px]","overflow-y-auto","pr-[5px]"],[1,"flex","flex-col","gap-[5px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[1,"text-h4","text-transparency-100","font-semibold","p-[5px]"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[4px]","cursor-pointer","select-none"],[1,"re-custom-radio-2"],["type","radio",3,"ngModelChange","name","ngModel","value","disabled"],[1,"check-mark"],[1,"flex","flex-col","gap-[3px]"],[1,"text-h4","text-transparency-100","font-semibold"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Move to other Automation "),a(),r(11,"div",10),h(12,"svg-icon",11),a()(),x(13,C_,2,1,"h4",12),a(),r(14,"div",13)(15,"div",14),p(16),a(),x(17,b_,2,0,"div",15),r(18,"div",16),y("click",function(){return t.onToggleExpanded()}),h(19,"img",17),a()()(),x(20,O_,13,4,"div",18)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),m("pTooltip","Only manual automations are available for selection."),s(2),g(t.isExpanded?-1:13),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
23y?-1:17),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?20:-1))},dependencies:[J,K,X,G,oe,$,Oe,F,re,U,L,Z,he],encapsulation:2})}}return o})()});function V_(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function N_(o,l){if(o&1&&(r(0,"p",26),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function k_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",21),p(3," Delay before executing this step "),h(4,"img",22),a(),r(5,"div",23)(6,"input",24),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",25),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,N_,2,1,"p",26),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function B_(o,l){if(o&1&&(r(0,"option",30),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function P_(o,l){if(o&1){let e=C();r(0,"select",27),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,B_,2,2,"option",30,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function L_(o,l){if(o&1&&(r(0,"p",26),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function R_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",20)(2,"label",21),p(3," Execute on "),h(4,"img",22),a(),r(5,"div",23)(6,"select",27),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",28),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,P_,3,2,"select",29),a(),x(11,L_,2,1,"p",26),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function F_(o,l){if(o&1&&(r(0,"div",16),x(1,k_,17,5,"div",19),x(2,R_,12,6,"div",19),a()),o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1)}}var Hn,Yn=ee(()=>{W();W();xe();be();se();pe();Ve();Hn=(()=>{class o{constructor(e){this._utilities=e,this.moduleId="",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._utilities?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}captureInitialState(){this.isInitialStateCaptured||(this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-skip-trace-record"]],inputs:{moduleId:"moduleId",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnl
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:5,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-cerulean","rounded-[20px]"],["src","assets/images/icons/skip-trace-white.svg","alt","hot-filled-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Skip Trace Record",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Skip Trace Record "),a()(),h(11,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,V_,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,F_,3,2,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(11),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
23y?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z],encapsulation:2})}}return o})()});function q_(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function G_(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function H_(o,l){if(o&1&&(r(0,"p",35),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Y_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",29)(2,"label",30),p(3," Delay before executing this step "),h(4,"img",31),a(),r(5,"div",32)(6,"input",33),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",34),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,H_,2,1,"p",35),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function z_(o,l){if(o&1&&(r(0,"option",40),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function J_(o,l){if(o&1){let e=C();r(0,"select",39),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,z_,2,2,"option",40,k),a()}if(o&2){let e=d(3);m("ngModel",e.executeOn.time),s(),V(e.timeOption)}}function Q_(o,l){if(o&1&&(r(0,"p",35),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function $_(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",29)(2,"label",30),p(3," Execute on "),h(4,"img",31),a(),r(5,"div",32)(6,"select",36),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",37),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,J_,3,1,"select",38),a(),x(11,Q_,2,1,"p",35),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function K_(o,l){if(o&1){let e=C();r(0,"button",41),y("click",function(){u(e);let t=d(2);return _(t.addRoleUserAssignment())}),h(1,"img",42),p(2," Add "),a()}}function X_(o,l){if(o&1&&h(0,"img",47),o&2){let e=d().$implicit;m("src",e.profileImage,ge)}}function Z_(o,l){if(o&1&&(r(0,"span",48),p(1),a()),o&2){let e=d().$implicit,i=d(3);s(),ce(i.getInitials(e.name))}}function eh(o,l){if(o&1){let e=C();r(0,"button",51),y("click",function(){u(e);let t=d().$index,n=d(3);return _(n.removeTeamMember(t))}),h(1,"svg-icon",52),a()}}function th(o,l){if(o&1&&(r(0,"div",43)(1,"div",45)(2,"div",46),x(3,X_,1,1,"img",47)(4,Z_,2,1,"span",48),a(),r(5,"span",49),p(6),a()(),x(7,eh,2,0,"button",50),a()),o&2){let e=l.$implicit,i=d(3);
23s(3),g(e.profileImage?3:4),s(3),ce(e.name),s(),g(i.isViewOnly?-1:7)}}function ih(o,l){o&1&&(r(0,"div",44)(1,"p"),p(2,"No records to show"),a()())}function nh(o,l){if(o&1&&(r(0,"div",26),D(1,th,8,3,"div",43,W_),x(3,ih,3,0,"div",44),a()),o&2){let e=d(2);s(),V(e.getSelectedUserRows()),s(2),g(e.selectedTeamMemberIds!=null&&e.selectedTeamMemberIds.length?-1:3)}}function oh(o,l){if(o&1){let e=C();r(0,"div",63),y("click",function(){u(e);let t=d(2).$implicit,n=d(3);return _(n.allAssignees(t==null?null:t.teamMembers))}),h(1,"img",64),a()}if(o&2){let e=l.$implicit;s(),m("src",e!=null&&e.profileImage?e==null?null:e.profileImage:"assets/images/demo-profile.png",ge)}}function ah(o,l){if(o&1){let e=C();r(0,"span",65),y("click",function(){u(e);let t=d(2).$implicit,n=d(3);return _(n.allAssignees(t==null?null:t.teamMembers))}),p(1),a()}if(o&2){let e=d(2).$implicit,i=d(3);s(),T(" +",i.getRemainingUserCount(e)," More ")}}function rh(o,l){if(o&1){let e=C();r(0,"div",62)(1,"img",66),y("click",function(){u(e);let t=d(2).$index,n=d(3);return _(n.deleteAddedUsed(t))}),a()()}}function lh(o,l){if(o&1&&(r(0,"div",44)(1,"div",56)(2,"div",57),p(3),a(),r(4,"div",58)(5,"div",59),D(6,oh,2,1,"div",60,j_),a(),x(8,ah,2,1,"span",61),a()(),x(9,rh,2,0,"div",62),a()),o&2){let e=d().$implicit,i=d(3);s(3),T(" ",i.getRoleName(e)," "),s(3),V(i.getDisplayUsers(e)),s(2),g(i.getRemainingUserCount(e)>
230?8:-1),s(),g(i.isViewOnly?-1:9)}}function sh(o,l){if(o&1&&x(0,lh,10,3,"div",44),o&2){let e=l.$implicit,i=d(3);g(i.isRoleSelected(e)?0:-1)}}function dh(o,l){o&1&&(r(0,"div",55),p(1," No records to show "),a())}function ch(o,l){if(o&1&&(r(0,"div",27)(1,"div",53)(2,"h4",54),p(3," Role "),h(4,"img",31),a(),r(5,"h4",54),p(6," Assignee "),h(7,"img",31),a()(),r(8,"div",27),D(9,sh,1,1,null,null,k),x(11,dh,2,0,"div",55),a()()),o&2){let e=d(2);s(9),V(e.addedRoleUserList),s(2),g(e.addedRoleUserList!=null&&e.addedRoleUserList.length?-1:11)}}function ph(o,l){o&1&&(r(0,"p",28),p(1," Unassigning this team member will delete all tasks assigned to them for this contact. "),a())}function mh(o,l){if(o&1&&(r(0,"div",16),x(1,Y_,17,5,"div",19),x(2,$_,12,6,"div",19),r(3,"div",19)(4,"div",20)(5,"div",21)(6,"h2",22),p(7),a(),r(8,"div",23),h(9,"svg-icon",24),a()(),x(10,K_,3,0,"button",25),a(),x(11,nh,4,1,"div",26)(12,ch,12,1,"div",27),x(13,ph,2,0,"p",28),a()()),o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(5),T(" ",e.isDirectUserAssignmentModule?"Select team members":"Select roles and team members"," "),s(),m("pTooltip",e.isDirectUserAssignmentModule?"Select team members you would like to unassign":"Select roles and team members you would like to be assigned"),s(2),g(e.isViewOnly?-1:10),s(),g(e.isDirectUserAssignmentModule?11:12),s(2),g(e.hasSelectedAssignees?13:-1)}}var W_,j_,zn,Jn=ee(()=>{W();ci();pi();mi();Re();W();fe();Ce();Ee();xe();lt();be();se();pe();Ve();He();W_=(o,l)=>l.userId,j_=(o,l)=>l._id||l.userId;zn=(()=>{class o{constructor(e,i,t,n,c){this._dialog=e,this._loaderService=i,this._toastrService=t,this._commonFunctions=n,this._userService=c,this.previewText="4 Roles configured. Weighted Round Robbin",this.payload={},this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.moduleId="",this.isViewOnly=!1,this.deleteBox=new R,this.mainStatusId=O.MainStatusId,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.isExpanded=!0,this.addedRoleUserList=[],this.selectedTeamMemberIds=[],this.allUsers=[],this.initialAddedRoleUserList=[],this.initialSelectedTeamMemberIds=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.applyPayloadDelay(),this.loadAssigneeData()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayloadDelay(),this.isInitialStateCaptured=!1,this.loadAssigneeData()),e.moduleId&&!e.moduleId.firstChange&&(this.isInitialStateCaptured=!1,this.loadAssigneeData())}get isDirectUserAssignmentModule(){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR,this.mainStatusId.LISTSTACKING].includes(this.moduleId)}applyPayloadDelay(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}addRoleUserAssignment(){if(this.isDirectUserAssignmentModule){this.dialogRef=this._dialog.open(ii,{disableClose:!0,width:"800px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{roleIds:[],teamMemberIds:this.selectedTeamMemberIds,notificationType:"BYMEMEBR",dialogTitle:"Select Team Members",dialogSubtitle:"Select team members you would like to unassign",confirmButtonLabel:"Save selection"}}),this.dialogRef.afterClosed().subscribe(e=>{e?.teamMemberIds&&(this.selectedTeamMemberIds=e.teamMemberIds)});return}this.dialogRef=this._dialog.open(ei,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{addedRoleUserList:this.addedRoleUserList,hideNotInRole:!0}}),this.dialogRef.afterClosed().subscribe(e=>{e&&(this.addedRoleUserList=e.addedRoleUserList||e||[])})}allAssignees(e){let i=[];e?.forEach(t=>{let n=this.allUsers?.find(c=>c?._id===t?.userId);i.push({_id:t?.userId,userId:t?.userId,email:n?.email||"",profileImage:n?.profileImage||"",firstName:n?.name?.split(" ")[0]||n?.firstName||"",lastName:n?.name?.split(" ").slice(1).join(" ")||n?.lastName||"",name:n?.name||"",show:!0,selected:!0})}),this.dialogRef=this._dialog.open(ti,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",data:{roleData:i}}),this.dialogRef.afterClosed().subscribe(t=>{})}onToggleExpanded(){this.isExpanded=!this.isExpanded}deleteAddedUsed(e){this.addedRoleUserList.splice(e,1)}
23removeTeamMember(e){this.isViewOnly||(this.selectedTeamMemberIds=this.selectedTeamMemberIds.filter((i,t)=>t!==e))}getSelectedUserRows(){return(this.selectedTeamMemberIds||[]).map(e=>{let i=this.allUsers?.find(t=>String(t?._id)===String(e));return{userId:e,name:this.formatUserDisplayName(i),profileImage:i?.profileImage||""}})}getInitials(e){let i=(e||"").trim().split(/\s+/).filter(Boolean);return i.length>=2?(i[0][0]+i[i.length-1][0]).toUpperCase():(e||"?").slice(0,2).toUpperCase()}formatUserDisplayName(e){if(!e)return"User";let i=(e?.name||"").trim().split(/\s+/).filter(Boolean),t=e?.firstName||i[0]||"",n=e?.lastName||i.slice(1).join(" ")||"";return`${t} ${n}`.trim()||e?.email||e?.name||"User"}getUserSelectedCount(e){let i=this.addedRoleUserList?.[e];return i&&i.teamMembers?.length||0}getRoleUserData(e){if(!e||!e.teamMembers||!Array.isArray(e.teamMembers))return[];let i=new Set,t=[];for(let n of e.teamMembers){let c=n?.userId??n?._id;if(c==null||c===""||i.has(String(c)))continue;i.add(String(c));let f=this.allUsers?.find(S=>S?._id===n?.userId||S?._id===n?._id);t.push({_id:c,userId:c,email:f?.email||"",profileImage:f?.profileImage||"",firstName:f?.name?.split(" ")[0]||f?.firstName||"",lastName:f?.name?.split(" ").slice(1).join(" ")||f?.lastName||"",name:f?.name||"",show:!0,selected:!0})}return t}getDisplayUsers(e){return this.getRoleUserData(e)?.slice(0,4)||[]}getRemainingUserCount(e){let t=(this.getRoleUserData(e)?.length||0)-4;return t>0?t:0}isRoleSelected(e){return e&&Array.isArray(e.teamMembers)&&e.teamMembers.length>0}getRoleName(e){return e?.roleName||e?.name||""}get hasSelectedAssignees(){return this.isDirectUserAssignmentModule?(this.selectedTeamMemberIds?.length||0)>0:this.addedRoleUserList?.some(e=>this.isRoleSelected(e))??!1}loadAssigneeData(){let e={page:1,limit:100,status:"active",sortBy:"_id"};this._userService.getSubUserList(e).subscribe(i=>{if(i?.statusCode==200){if(this.allUsers=i?.data?.items||[],this.isDirectUserAssignmentModule){this.loadSelectedTeamMembersFromPayload(),this.addedRoleUserList=[],this.captureInitialState();return}this.loadRoleUserListFromPayload()}},()=>{this._toastrService.showError("Unable to load team members.")})}loadSelectedTeamMembersFromPayload(){if(Array.isArray(this.payload?.teamMemberIds)&&this.payload.teamMemberIds.length){this.selectedTeamMemberIds=[...this.payload.teamMemberIds];return}let e=new Set;this.payload?.roles?.forEach(i=>{(i?.teamMemberIds||[]).forEach(t=>{t!=null&&t!==""&&e.add(String(t))})}),this.selectedTeamMemberIds=[...e]}loadRoleUserListFromPayload(){let e={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items||[];this.addedRoleUserList=[],this.payload?.roles?.forEach(n=>{if(n?.roleId&&Array.isArray(n?.teamMemberIds)&&n?.teamMemberIds?.length>0){let c=t?.find(S=>S?._id===n?.roleId),f=[...new Set(n.teamMemberIds.filter(S=>S!=null&&S!==""))];this.addedRoleUserList.push({roleId:n?.roleId,roleName:c?.name||c?.orignalName||"",teamMembers:f.map(S=>({userId:S}))})}}),this.captureInitialState()}this._loaderService.stop()},()=>{this._loaderService.stop()})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){if(this.isDirectUserAssignmentModule){let i=this.selectedTeamMemberIds?.length||0;return i===1?"1 team member configured.":`${i} team members configured.`}return`${this.addedRoleUserList?.filter(i=>this.isRoleSelected(i)).length||0} Roles configured. `}captureInitialState(){this.isInitialStateCaptured||(this.initialAddedRoleUserList=this.addedRoleUserList?JSON.parse(JSON.stringify(this.addedRoleUserList)):[],this.initialSelectedTeamMemberIds=this.selectedTeamMemberIds?[...this.selectedTeamMemberIds]:[],this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;let e=c=>!c||!Array.isArray(c)?[]:c.map(f=>{let S={roleId:f?.roleId||"",roleName:f?.roleName||"",teamMembers:[]};return f?.teamMembers&&Array.isArray(f.teamMembers)&&(S.teamMembers=f.teamMembers.map(v=>({userId:v?.userId||""})).sort((v,b)=>v.userId>b.userId?1:v.userId<b.userId?-1:0)),S}).sort((f,S)=>f.roleId>S.roleId?1:f.roleId<S.roleId?-1:0),i=e(this.addedRoleUserList),t=e(this.initialAddedRoleUserList);if(JSON.stringify(i)!==JSON.stringify(t))return!0;let n=c=>[...c||[]].map(String).sort().join(",");return n(this.selectedTeamMemberIds)!==n(this.initialSelectedTeamMemberIds)||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(H),E(Y),E(q),E(De))}}static{this.\u0275cmp=B({type:o,selectors:[["app-unassign-team-members"]],inputs:{previewText:"previewText",payload:"payload",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",moduleId:"moduleId",isViewOnl
23y:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-secondary-red","rounded-[20px]"],["src","assets/images/icons/team-white.svg","alt","team-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Unassign Team Members",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[5px]"],[1,"flex","items-center","gap-[10px]"],[1,"text-h2","text-transparency-100","font-semibold"],["tooltipPosition","top",1,"flex","items-center","p-[2px]","bg-transparency-0","rounded-[30px]","border-[1px]","border-solid","border-transparency-25",3,"pTooltip"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/info.svg",1,"text-transparency-90"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg"],[1,"flex","flex-col","gap-[6px]"],[1,"flex","flex-col","gap-[10px]"],[1,"text-h4","text-transparency-90","font-medium","mt-[10px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],[3,"value"],["type","button",1,"flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[6px]","text-h3","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],[1,"flex","items-center","justify-between","gap-[12px]","rounded-[12px]","px-[12px]","py-[5px]","transition-colors","duration-150","ease-out","hover:bg-activity-outbound-hover-bg"],[1,"group","flex","items-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","hover:bg-transparency-10","hover:border-transparency-25"],[1,"flex","items-center","gap-[12px]","min-w-0","flex-1"],[1,"flex-none","flex","h-[40px]","w-[40px]","items-center","justify-center","overflow-hidden","rounded-full","border-[2px]","border-solid","border-transparency-0","bg-primary-5","text-h5","font-semibold","text-primary-90"],["alt","",1,"h-full","w-full","object-cover",3,"src"],[1,"uppercase"],[1,"text-h4","text-transparency-100","font-semibold","truncate"],["type","button","aria-label","Remove user",1,"flex","h-[40px]","w-[40px]","shrink-0","items-center","justify-center","rounded-full","text-secondary-red","transition-colors","hover:bg-secondary-red-5"],["type","button","aria-label","Remove user",1,"flex","h-[40px]","w-[40px]","shrink-0","items-center","justify-center","rounded-full","text-secondary-red","transition-colors","hover:bg-secondary-red-5",3,"click"],["src","assets/images/icons/delete-action-1.svg","svgClass","h-[32px] w-[32px] block text-secondary-red",1,"block","[&_svg]:h-[32px]","[&_svg]:w-[32px]"],[1,"flex","items-center","gap-[10px]","pr-[30px]"],[1,"flex-[1_0_0]","flex","gap-[3px]","text-h4","text-transparency-100","font-semibold"],[1,"group","flex","items-center","justify-center","gap-[10px]","border-[1px]","border-solid","border-transparency-0","rounded-[10px]","p-[8px]"],[1,"flex-[1_0_0]","flex","items-center","gap-[10px]"],[1,"w-1/2","text-h4","text-transparency-100","font-semibold","p-[8px]","truncate"],[1,"w-1/2","flex","items-center","gap-[3px]","p-[7px]"],[1,"flex","items-center","-space-x-[10px]"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90"],[1,"flex-none","flex","items-center","mr-2","cursor-pointer","opacity-0","group-hover:opacity-100"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]","cursor-pointer",3,"click"],["alt","demo-profile","width","34","height","34",1,"img-fluid",3,"src"],[1,"text-h4","font-semibold","ml-[5px]","cursor-pointer","text-primary-90",3,"click"],["src","assets/images/icons/delete-action-1.svg","alt","delete-action-1","width","30","height","30",1,"img-fluid",3,"click"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Unassign Team Members "),a()(),x(11,q_,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,G_,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,mh,14,7,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnl
23y?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,$,F,re,U,L,Z,he],encapsulation:2})}}return o})()});function hh(o,l){o&1&&(r(0,"div",16),p(1," Previous Selection "),a())}function xh(o,l){o&1&&(r(0,"div",16),p(1," Previous Selection "),a())}function gh(o,l){if(o&1&&(r(0,"option",25),p(1),a()),o&2){let e=l.$implicit;m("value",e==null?null:e.timezonename),s(),T(" ",e==null?null:e.name," ")}}var _h,za,wo=ee(()=>{fe();$e();dt();ia();W();fe();Ce();Ee();lt();at();se();pe();kt();_h=(o,l)=>(l==null?null:l.timezonename)??o;za=(()=>{class o{constructor(e,i,t,n,c,f){this.data=e,this.dialog=i,this._loaderService=t,this._toastrService=n,this._userService=c,this._automationService=f,this.destroy$=new Be,this.timezoneList=[],this.delayPreference="Delay Based",this.selectedTimezone="",this.firstLoad=!0}ngOnInit(){this.delayPreference=this.data?.delayPreference&&this.data?.delayPreference!="No Data"?this.data?.delayPreference:"Delay Based",this.timezoneList=Si.timezoneArray,this.data?.timezonename?this.selectedTimezone=this.data?.timezonename:this.getUserDetails()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getUserDetails(){this._loaderService.start(),this._userService.getUserDetails({}).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:e=>{e?.statusCode===200&&e?.data&&(this.selectedTimezone=this.timezoneList?.find(i=>i?.timezonename===e?.data?.timezoneOffset)?.timezonename||"")},error:()=>{this._toastrService.showError("Could not load your timezone. Please pick one from the list.")}})}buildAutomationUpdatePayload(){let e=this.data,i=e?.moduleId?._id||e?.moduleId,t={name:e?.name,description:e?.description||"Automated follow-up sequence for new leads",timezonename:this.selectedTimezone,moduleId:i,automationType:e?.automationType,status:e?.status||"active",primaryConditions:e?.primaryConditions||{},isCreateLog:!!e?.editMode,delayPreference:this.delayPreference,automationId:e?._id,isConversationalAI:e?.isConversationalAI||!1};if(e?.workflowSteps?.length>0){let n=JSON.parse(JSON.stringify(e?.workflowSteps||[]));n?.forEach(c=>delete c._id),t.workflowSteps=n}else t.workflowSteps=[];return t}savePreference(){if(!this.selectedTimezone){this._toastrService.showError("Please select timezone");return}let e={delayPreference:this.delayPreference,timezone:this.selectedTimezone};if(this.data?._id){this._loaderService.start();let i=this.buildAutomationUpdatePayload();this._automationService.updateAutomation(i).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:t=>{t?.statusCode===200&&this.dialog.close(P(M({},e),{delayPreferenceAppliedOnServer:!0,serverPayload:t?.data}))},error:t=>{}});return}this.dialog.close(e)}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(H),E(Y),E(De),E(Me))}}static{this.\u0275cmp=B({type:o,selectors:[["app-delay-preference"]],standalone:!1,decls:49,vars:7,consts:[[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px]","src","assets/images/icons/time.svg",1,"text-transparency-100"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","gap-[10px]","p-[10px]","cursor-pointer","select-none"],[1,"re-custom-radio-2"],["type","radio","name","enrollment","value","Delay Based",3,"ngModelChange","change","ngModel"],[1,"check-mark"],[1,"flex","flex-col","gap-[3px]"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"inline-block","items-center","text-sub-heading","leading-[normal]","text-tags-orange","font-medium","px-[8px]","py-[3px]","bg-tags-brighter-orange-bg","rounded-[20px]"],[1,"text-label/[normal]","text-transparency-100","font-medium","opacity-60"],["type","radio","name","enrollment","value","Day Based",3,"ngModelChange","change","ngModel"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[10px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","label","Save","variant","filled","type","default","size","44",3,"clicked","leftIcon"],[1,"text-sub-heading","text-transparency-90","font-medium","text-center"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5),p(7," Delay Preference "),a()(),r(8,"button",6),h(9,"svg-icon",7),a()(),r(10,"div",8)(11,"div",9)(12,"label",10)(13,"div",11)(14,"input",12),A("ngModelChange",function(c){return I(t.delayPreference,c)||(t.delayPreference=c),c}),y("change",function(){return t.firstLoad=!1}),a(),h(15,"span",13),a(),r(16,"div",14)(17,"h4",15),p(18," Delay Based "),x(19,hh,2,0,"div",16),a(),r(20,"p",17),p(21," You can choose the delay duration i.e 1 Hour before executing each step. "),a()()(),r(22,"label",10)(23,"div",11)(24,"input",18),A("ngModelChange",function(c){return I(t.delayPreference,c)||(t.delayPreference=c),c}),y("change",function(){return t.firstLoad=!1}),a(),h(25,"span",13),a(),r(26,"div",14)(27,"h4",15),p(28," Day Based "),x(29,xh,2,0,"div",16),a(),r(30,"p",17),p(31," Execute steps on Day 1, Day 2, etc. at a specific time "),a()()()()(),r(32,"div",19)(33,"div",20)(34,"label",21),p(35,"Default Timezone "),h(36,"img",22),a(),r(37,"select",23),A("ngModelChange",function(c){return I(t.selectedTimezone,c)||(t.selectedTimezone=c),c}),r(38,"option",24),p(39,"Select Timezone"),a(),D(40,gh,2,2,"option",25,_h),a()()()(),r(42,"div",26),h(43,"svg-icon",27),a(),r(44,"div",28),h(45,"app-button",29),r(46,"app-button",30),y("clicked",function(){return t.savePreference()}),a()(),r(47,"div",31),p(48," Delay cannot be modified while automation is in use. "),a()()()),i&2&&(s(14),w("ngModel",t.delayPreference),s(5),g(t.data!=null&&t.data.delayPreference&&(t.data==null?null:t.data.delayPreference)==="Delay Based"?19:-1),s(5),w("ngModel",t.delayPreference),s(5),g(t.data!=null&&t.data.delayPreference&&(t.data==null?null:t.data.delayPreference)==="Day Based"?29:-1),s(8),w("ngModel",t.selectedTimezone),s(3),V(t.timezoneList),s(5),m("leftIcon",!1),s(),m("leftIcon",!1))},dependencies:[K,X,G,$,Oe,F,U,Ze,_t,L,et],encapsulation:2})}}return o})()});function Ch(o,l){if(o&1&&(r(0,"h4",11),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function bh(o,l){if(o&1){let e=C();r(0,"div",18),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",19),a()}}function Sh(o,l){if(o&1&&(r(0,"p",47),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Th(o,l){if(o&1){let e=C();r(0,"div",20)(1,"div",21)(2,"label",30),p(3," Delay before executing this step "),h(4,"img",31),a(),r(5,"div",44)(6,"input",45),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",46),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Sh,2,1,"p",47),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function vh(o,l){if(o&1&&(r(0,"option",51),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Eh(o,l){if(o&1){let e=C();r(0,"select",48),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,vh,2,2,"option",51,k),a()}if(o&2){let e=d(3);
23m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function wh(o,l){if(o&1&&(r(0,"p",47),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Ih(o,l){if(o&1){let e=C();r(0,"div",20)(1,"div",21)(2,"label",30),p(3," Execute on "),h(4,"img",31),a(),r(5,"div",44)(6,"select",48),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",49),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Eh,3,2,"select",50),a(),x(11,wh,2,1,"p",47),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Ah(o,l){if(o&1){let e=C();r(0,"label",24)(1,"input",52),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.notificationType,t)||(n.notificationType=t),_(t)}),a(),h(2,"img",26),p(3," By Role"),a()}if(o&2){let e=d(2);s(),m("name","notifyingMembers_"+e.actionId),w("ngModel",e.notificationType),m("disabled",e.isViewOnly)}}function Mh(o,l){if(o&1){let e=C();r(0,"label",24)(1,"input",53),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.notificationType,t)||(n.notificationType=t),_(t)}),a(),h(2,"img",26),p(3," All Assigned"),a()}if(o&2){let e=d(2);s(),m("name","notifyingMembers_"+e.actionId),w("ngModel",e.notificationType),m("disabled",e.isViewOnly)}}function Oh(o,l){if(o&1&&(r(0,"div",54)(1,"h2",56),p(2),h(3,"img",57),a(),r(4,"h4",58),p(5),a()()),o&2){let e=d(3);s(2),T(" Select ",e.notificationType=="BYROLE"?"role":"member","(s) to notify "),s(3),T(" ",e.notificationType=="BYROLE"?"Users assigned to role will be notified ":"Members selected will be notified"," ")}}function Dh(o,l){if(o&1&&(r(0,"div",54)(1,"h2",56),p(2),a()()),o&2){let e=d(3);s(2),je(" ",e.notificationType=="BYROLE"?e.roleIds==null?null:e.roleIds.length:e.teamMemberIds==null?null:e.teamMemberIds.length," ",e.notificationType=="BYROLE"?"role":"member","(s) selected ")}}function Vh(o,l){if(o&1){let e=C();r(0,"button",59),y("click",function(){u(e);let t=d(3);return _(t.notificationAssignee())}),p(1),a()}if(o&2){let e=d(3);s(),T(" Select ",e.notificationType=="BYROLE"?"Role":"Member","(s) ")}}function Nh(o,l){if(o&1&&(r(0,"div",27),x(1,Oh,6,2,"div",54),x(2,Dh,3,2,"div",54),x(3,Vh,2,1,"button",55),a()),o&2){let e=d(2);s(),g(!(e.roleIds!=null&&e.roleIds.length)&&e.notificationType=="BYROLE"||e.notificationType=="BYMEMEBR"&&!(e.teamMemberIds!=null&&e.teamMemberIds.length)?1:-1),s(),g(e.roleIds!=null&&e.roleIds.length&&e.notificationType=="BYROLE"||e.notificationType=="BYMEMEBR"&&(e.teamMemberIds!=null&&e.teamMemberIds.length)?2:-1),s(),g(e.isViewOnly?-1:3)}}function kh(o,l){if(o&1){let e=C();r(0,"div",17),x(1,Th,17,5,"div",20),x(2,Ih,12,6,"div",20),r(3,"div",20)(4,"div",21)(5,"h3",22),p(6," Notify members: "),a(),r(7,"div",23),x(8,Ah,4,3,"label",24),r(9,"label",24)(10,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationType,t)||(n.notificationType=t),_(t)}),a(),h(11,"img",26),p(12," By Members"),a(),x(13,Mh,4,3,"label",24),a()(),x(14,Nh,4,3,"div",27),r(15,"div",28),h(16,"svg-icon",29),a(),r(17,"div",21)(18,"label",30),p(19," Select notification channel "),h(20,"img",31),a(),r(21,"div",32)(22,"label",33)(23,"div",34)(24,"input",35),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationChannelSchema.sms,t)||(n.notificationChannelSchema.sms=t),_(t)}),a(),h(25,"span",36),a(),r(26,"span",37),p(27,"Via SMS"),a()(),r(28,"label",33)(29,"div",34)(30,"input",35),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationChannelSchema.email,t)||(n.notificationChannelSchema.email=t),_(t)}),a(),h(31,"span",36),a(),r(32,"span",37),p(33,"Via Email"),a()(),r(34,"label",33)(35,"div",34)(36,"input",35),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationChannelSchema.web,t)||(n.notificationChannelSchema.web=t),_(t)}),a(),h(37,"span",36),a(),r(38,"span",37),p(39,"Web"),a()(),r(40,"label",33)(41,"div",34)(42,"input",35),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationChannelSchema.inApp,t)||(n.notificationChannelSchema.inApp=t),_(t)}
23),a(),h(43,"span",36),a(),r(44,"span",37),p(45,"In-App"),a()()()()(),r(46,"div",38)(47,"div",21)(48,"div",39)(49,"label",37),p(50,"Notification text"),h(51,"img",31),a()(),r(52,"div",40)(53,"quill-editor",41,0),A("ngModelChange",function(t){u(e);let n=d();return I(n.notificationText,t)||(n.notificationText=t),_(t)}),a()(),r(55,"div",42),p(56," You can use @merge fields to personalize message. "),r(57,"a",43),y("click",function(){u(e);let t=d();return _(t.annotationList())}),p(58,"Click to see"),a(),p(59," full list. "),a()()()()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(6),g(e.showByRoleNotificationOption?8:-1),s(2),m("name","notifyingMembers_"+e.actionId),w("ngModel",e.notificationType),m("disabled",e.isViewOnly),s(3),g(e.showAllAssignedNotificationOption?13:-1),s(),g(e.notificationType=="BYROLE"||e.notificationType=="BYMEMEBR"?14:-1),s(10),w("ngModel",e.notificationChannelSchema.sms),m("disabled",e.isViewOnly),s(6),w("ngModel",e.notificationChannelSchema.email),m("disabled",e.isViewOnly),s(6),w("ngModel",e.notificationChannelSchema.web),m("disabled",e.isViewOnly),s(6),w("ngModel",e.notificationChannelSchema.inApp),m("disabled",e.isViewOnly),s(11),m("name","notificationText"+e.actionId),w("ngModel",e.notificationText),m("styles",e.editorStyle)("modules",rt(22,yh,e.editorOptions.mention))("placeholder",e.editorOptions.placeholder)("disabled",e.isViewOnly)}}var fh,yh,Qn,$n=ee(()=>{W();mi();pn();Re();W();Ce();Ee();xe();fe();be();se();pe();Ve();Di();fh=["notifyEditor"],yh=o=>({toolbar:!1,mention:o});Qn=(()=>{class o{get items(){return this.isBuyerAgentOrVendorModule()?["First_Name","Last_Name","Email","Phone_Number"]:["First_Name","Last_Name","Property_Street_Address","Property_City","Property_State","Property_Zip_Code","Email","Phone_Number"]}isBuyerAgentOrVendorModule(){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)}constructor(e,i,t,n){this._loaderService=e,this._toastr=i,this._commonFunctions=t,this._dialog=n,this.previewText="Hi Brij, when you set an appointment please ask for the complete property walkthough and take Kartik our fixes vendor with you to get the estimation.",this.payload={},this.moduleId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.mainStatusId=O.MainStatusId,this.notificationType="BYROLE",this.roleIds=[],this.teamMemberIds=[],this.notificationText="",this.notificationChannelSchema={sms:!1,email:!1,web:!1,inApp:!1},this.initialNotificationType="",this.initialRoleIds=[],this.initialTeamMemberIds=[],this.initialNotificationText="",this.initialNotificationChannelSchema={},this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.editorConfig={},this.editorOptions={},this.timeOption=this._commonFunctions?.timeList12HourFormat,this.editorOptions={placeholder:this._commonFunctions.commonEditor().placeholder,toolbar:this._commonFunctions.commonEditor().toolbar,mention:this.mentionEditor()}}ngOnInit(){this.applyPayload(),this.captureInitialState()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.captureInitialState()),e.moduleId&&!e.moduleId.firstChange&&this.syncNotificationTypeForModule()}get showByRoleNotificationOption(){return![this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR,this.mainStatusId.LISTSTACKING].includes(this.moduleId)}get isListStackingModule(){return this.moduleId===this.mainStatusId.LISTSTACKING}get showAllAssignedNotificationOption(){return!this.isListStackingModule}syncNotificationTypeForModule(){!this.showByRoleNotificationOption&&this.notificationType==="BYROLE"&&(this.notificationType="BYMEMEBR",this.roleIds=[]),this.isListStackingModule&&this.notificationType==="ALL"&&(this.notificationType="BYMEMEBR")}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn)),this.payload?.notificationChannelSchema&&(this.notificationChannelSchema=M(M({},this.notificationChannelSchema),this.payload.notificationChannelSchema)),this.payload?.notificationType&&(this.notificationType=this.payload.notificationType),typeof this.payload?.notificationText<"u"&&(this.notificationText=this.payload.notificationText),this.payload?.notificationType==="BYROLE"?this.roleIds=this.payload?.roleIds?[...this.payload.roleIds]:[]:this.payload?.notificationType==="BYMEMEBR"&&(this.teamMemberIds=this.payload?.teamMemberIds?[...this.payload.teamMemberIds]:[]),this.syncNotificationTypeForModule(
23)}onToggleExpanded(){this.isExpanded=!this.isExpanded}notificationAssignee(){this.dialogRef=this._dialog.open(ii,{disableClose:!0,width:"800px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{roleIds:this.roleIds,teamMemberIds:this.teamMemberIds,notificationType:this.notificationType}}),this.dialogRef.afterClosed().subscribe(e=>{e&&(this.roleIds=e?.roleIds||[],this.teamMemberIds=e?.teamMemberIds||[])})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}annotationList(){this.dialogRef=this._dialog.open(cn,{disableClose:!0,width:"800px",panelClass:"re-new-custom-dialog",data:{source:"notify-team-members",recipientModuleId:this.moduleId,moduleId:this.moduleId,annotations:this.items}}),this.dialogRef.afterClosed().subscribe(e=>{})}getPreview(){let e=[];this.notificationChannelSchema?.sms&&e.push("SMS"),this.notificationChannelSchema?.email&&e.push("Email"),this.notificationChannelSchema?.web&&e.push("Web"),this.notificationChannelSchema?.inApp&&e.push("inApp");let i=e.join(", ");return i?`Notifying Member via ${i} Channels`:""}mentionEditor(){return{mentionListClass:"ql-mention-list mat-elevation-z8",allowedChars:/^[A-Za-z0-9\sÅÄÖåäö_]*$/,showDenotationChar:!0,spaceAfterInsert:!0,positioningStrategy:"fixed",defaultMenuOrientation:"bottom",onSelect:(e,i)=>{let t=this.editor?.quillEditor;t&&(i(e),t.insertText(t.getLength()-1,"","user"))},source:(e,i)=>{let t=this.items.map((n,c)=>({id:c,value:n}));if(e?.length===0)i(t,e);else{let n=[];t.forEach(c=>{c?.value?.toLowerCase()?.indexOf(e?.toLowerCase()||"")!==-1&&n.push(c)}),i(n,e)}}}}captureInitialState(){this.isInitialStateCaptured||(this.initialNotificationType=this.notificationType||"",this.initialRoleIds=this.roleIds?[...this.roleIds]:[],this.initialTeamMemberIds=this.teamMemberIds?[...this.teamMemberIds]:[],this.initialNotificationText=this.notificationText||"",this.initialNotificationChannelSchema=this.notificationChannelSchema?JSON.parse(JSON.stringify(this.notificationChannelSchema)):{},this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){return this.isInitialStateCaptured?this.notificationType!==this.initialNotificationType||this.notificationText!==this.initialNotificationText||this.roleIds?.length!==this.initialRoleIds?.length||!this.roleIds?.every(e=>this.initialRoleIds?.includes(e))||!this.initialRoleIds?.every(e=>this.roleIds?.includes(e))||this.teamMemberIds?.length!==this.initialTeamMemberIds?.length||!this.teamMemberIds?.every(e=>this.initialTeamMemberIds?.includes(e))||!this.initialTeamMemberIds?.every(e=>this.teamMemberIds?.includes(e))||JSON.stringify(this.notificationChannelSchema)!==JSON.stringify(this.initialNotificationChannelSchema)||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn):!1}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Y),E(q),E(ve))}}static{this.\u0275cmp=B({type:o,selectors:[["app-notify-team-members"]],viewQuery:function(i,t){if(i&1&&We(fh,5),i&2){let n;ie(n=ne())&&(t.editor=n.first)}},inputs:{previewText:"previewText",payload:"payload",moduleId:"moduleId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[["notifyEditor",""],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dar
23k:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-added-cerulean","rounded-[20px]"],["src","assets/images/icons/notification-default-white.svg","alt","notification-default-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Notify Team Member",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-full"],[1,"text-h3","text-transparency-100","font-semibold","mb-[10px]"],[1,"flex","items-center","gap-[10px]"],[1,"flex","items-center","gap-[5px]","px-[10px]","py-[7px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","text-h4","text-transparency-100","font-semibold","cursor-pointer","relative","[&:has(input:checked)]:text-primary-90","[&:has(input:checked)]:bg-activity-outbound-hover-bg","[&:has(input:checked)]:border-activity-outbound-hover-border"],["type","radio","value","BYMEMEBR",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["src","assets/images/icons/check-mark-teal.svg","alt","check-mark-teal","width","18","height","18",1,"img-fluid","opacity-0","absolute","peer-checked:opacity-100","peer-checked:relative"],[1,"flex","items-center","gap-[10px]","p-[5px]"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[10px]","py-[10px]","px-[5px]","cursor-pointer","select-none"],[1,"re-custom-checkbox"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"checkmark"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"flex","flex-col","gap-[10px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","gap-[5px]","mb-[10px]"],[1,"w-full","h-[120px]","min-h-[120px]","resize-y","overflow-hidden","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","bg-transparency-0"],[1,"block","!h-full","!w-full","text-p","text-transparency-100","font-semibold","focus:outline-none","[&_.ql-toolbar]:hidden","[&_.ql-container]:!h-full","[&_.ql-container]:!border-0","[&_.ql-editor]:!h-full","[&_.ql-editor]:!min-h-full","[&_.ql-editor]:box-border","[&_.ql-editor]:overflow-y-auto",3,"ngModelChange","name","ngModel","styles","modules","placeholder","disabled"],[1,"text-h4","font-semibold","text-transparency-90"],[1,"text-primary-90","cursor-pointer","hover:text-primary-100",3,"click"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10
23px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],["type","radio","value","BYROLE",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],["type","radio","value","ALL",1,"peer","opacity-0","absolute",3,"ngModelChange","name","ngModel","disabled"],[1,"flex-1","flex","flex-col","gap-[5px]","overflow-hidden"],["type","button",1,"px-[15px]","py-[8px]","text-h4","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid","inline-block"],[1,"text-sub-heading","leading-[normal]","text-transparency-100","font-medium","truncate","opacity-60"],["type","button",1,"px-[15px]","py-[8px]","text-h4","text-primary-90","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-activity-outbound-hover-border","bg-activity-outbound-hover-bg",3,"click"]],template:function(i,t){i&1&&(r(0,"div",1)(1,"div",2),h(2,"img",3)(3,"span",4),a()(),r(4,"div",5)(5,"div",6),h(6,"img",7),a(),r(7,"div",8)(8,"div",9)(9,"h2",10),p(10," Notify Team Member "),a()(),x(11,Ch,2,1,"h4",11),a(),r(12,"div",12)(13,"div",13),p(14),a(),x(15,bh,2,0,"div",14),r(16,"div",15),y("click",function(){return t.onToggleExpanded()}),h(17,"img",16),a()()(),x(18,kh,60,24,"div",17)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,Ke,$,Oe,F,re,U,L,Z,Pt],encapsulation:2})}}return o})()});function Ph(o,l){if(o&1&&(r(0,"h4",10),p(1),a()),o&2){let e=d();s(),T(" Preview: ",e.getPreview()," ")}}function Lh(o,l){if(o&1){let e=C();r(0,"div",17),y("click",function(){u(e);let t=d();return _(t.deleteBox.emit(t.actionId))}),h(1,"svg-icon",18),a()}}function Rh(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function Fh(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",30)(2,"label",31),p(3," Delay before executing this step "),h(4,"img",32),a(),r(5,"div",33)(6,"input",34),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.duration=+t>0?+t:1,_(n.emitTimingChange())}),a(),r(7,"select",35),y("ngModelChange",function(t){u(e);let n=d(2);return n.delayBeforeExecuting.unit=t,_(n.emitTimingChange())}),r(8,"option"),p(9,"Minutes"),a(),r(10,"option"),p(11,"Hours"),a(),r(12,"option"),p(13,"Days"),a(),r(14,"option"),p(15,"Weeks"),a()()(),x(16,Rh,2,1,"p",36),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.delayBeforeExecuting.duration)("disabled",e.isViewOnly),s(),m("ngModel",e.delayBeforeExecuting.unit)("disabled",e.isViewOnly),s(9),g(e.timingSequenceError?16:-1)}}function Uh(o,l){if(o&1&&(r(0,"option",40),p(1),a()),o&2){let e=l.$implicit;m("value",e),s(),T(" ",e," ")}}function Wh(o,l){if(o&1){let e=C();r(0,"select",37),y("ngModelChange",function(t){u(e);let n=d(3);return n.executeOn.time=t,_(n.emitTimingChange())}),D(1,Uh,2,2,"option",40,k),a()}if(o&2){let e=d(3);
23m("ngModel",e.executeOn.time)("disabled",e.isViewOnly),s(),V(e.timeOption)}}function jh(o,l){if(o&1&&(r(0,"p",36),p(1),a()),o&2){let e=d(3);s(),T(" ",e.timingSequenceError," ")}}function qh(o,l){if(o&1){let e=C();r(0,"div",19)(1,"div",30)(2,"label",31),p(3," Execute on "),h(4,"img",32),a(),r(5,"div",33)(6,"select",37),y("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayType=t,_(n.emitTimingChange())}),r(7,"option"),p(8,"Day"),a()(),r(9,"input",38),y("keydown",function(t){return t.key==="-"||t.key==="+"||t.key==="e"||t.key==="E"?t.preventDefault():null})("ngModelChange",function(t){u(e);let n=d(2);return n.executeOn.dayValue=+t>=0?+t:0,n.executeOn.time=n.executeOn.dayValue==0?"":n.timeOption[0],_(n.emitTimingChange())}),a(),x(10,Wh,3,2,"select",39),a(),x(11,jh,2,1,"p",36),a()()}if(o&2){let e=d(2);s(6),m("ngModel",e.executeOn.dayType)("disabled",e.isViewOnly),s(3),m("ngModel",e.executeOn.dayValue)("disabled",e.isViewOnly),s(),g(e.executeOn.dayValue!=0?10:-1),s(),g(e.timingSequenceError?11:-1)}}function Gh(o,l){if(o&1){let e=C();r(0,"label",47)(1,"div",48)(2,"input",49),A("ngModelChange",function(t){let n=u(e).$implicit;return I(n.selected,t)||(n.selected=t),_(t)}),a(),h(3,"span",50),a(),r(4,"div",27)(5,"h4",28),p(6),a()()()}if(o&2){let e=l.$implicit,i=d(4);s(2),w("ngModel",e.selected),m("disabled",i.isViewOnly),s(4),T(" ",e==null?null:e.name," ")}}function Hh(o,l){if(o&1&&(r(0,"div",45)(1,"h4",46),p(2),a(),r(3,"div",45),D(4,Gh,7,3,"label",47,k),a()()),o&2){let e=l.$implicit;s(2),T(" ",e.name," "),s(2),V(e.items)}}function Yh(o,l){if(o&1){let e=C();r(0,"div",20)(1,"h2",21),p(2," Select automations to stop "),a(),r(3,"div",22)(4,"div",41),h(5,"img",42),r(6,"input",43),A("ngModelChange",function(t){u(e);let n=d(2);return I(n.searchTerm,t)||(n.searchTerm=t),_(t)}),a()(),r(7,"div",44),D(8,Hh,6,1,"div",45,k),a()()()}if(o&2){let e=d(2);s(6),w("ngModel",e.searchTerm),m("disabled",e.isViewOnly),s(2),V(e.filteredAutomations)}}function zh(o,l){if(o&1){let e=C();r(0,"div",16),x(1,Fh,17,5,"div",19),x(2,qh,12,6,"div",19),r(3,"div",20)(4,"h2",21),p(5," Stop automation preference "),a(),r(6,"div",22)(7,"label",23)(8,"div",24)(9,"input",25),A("ngModelChange",function(t){u(e);let n=d();return I(n.stopType,t)||(n.stopType=t),_(t)}),a(),h(10,"span",26),a(),r(11,"div",27)(12,"h4",28),p(13," Stop all other automations "),a()()(),r(14,"label",23)(15,"div",24)(16,"input",29),A("ngModelChange",function(t){u(e);let n=d();return I(n.stopType,t)||(n.stopType=t),_(t)}),a(),h(17,"span",26),a(),r(18,"div",27)(19,"h4",28),p(20," Stop selected automations "),a()()()()(),x(21,Yh,10,2,"div",20),a()}if(o&2){let e=d();s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Delay Based"?1:-1),s(),g((e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)=="Day Based"?2:-1),s(7),m("name","automations"+e.actionId),w("ngModel",e.stopType),m("disabled",e.isViewOnly),s(7),m("name","automations"+e.actionId),w("ngModel",e.stopType),m("disabled",e.isViewOnly),s(5),g(e.stopType=="STOP_SELECTED"?21:-1)}}var Kn,Xn=ee(()=>{W();Mt();W();Ce();at();xe();be();se();pe();Ve();Kn=(()=>{class o{get searchTerm(){return this._searchTerm}set searchTerm(e){this._searchTerm=e,this.updateFilteredAutomations()}constructor(e,i,t){this._loaderService=e,this._automationService=i,this._commonFunctions=t,this.payload={},this.moduleId="",this.automationId="",this.stepIndex=-1,this.actionId=-1,this.delayPreferenceData={},this.timingSequenceError=null,this.timingChange=new R,this.isViewOnly=!1,this.deleteBox=new R,this.isExpanded=!0,this.delayBeforeExecuting={duration:1,unit:"Minutes"},this.executeOn={dayType:"Day",dayValue:1,time:"12:00 AM"},this.delayOrDayBased="",this.automationList=[],this.filteredAutomations=[],this.stopType="STOP_ALL",this._searchTerm="",this.initialStopType="",this.initialSelectedAutomationIds=[],this.initialDelayBeforeExecuting={},this.initialExecuteOn={},this.isInitialStateCaptured=!1,this.automationTypeOrder=["STATUS_CHANGE","ACTIVITY_TRIGGER","OTHER_CONDITION","MANUAL_ASSIGNMENT"],this.excludedAutomationTypes=["LEAD_CREATED","NEW_BUYER_ADDED","NEW_AGENT_ADDED","NEW_VENDOR_ADDED"],this.timeOption=this._commonFunctions?.timeList12HourFormat}ngOnInit(){this.applyPayload(),this.getAutomationList()}ngOnChanges(e){e.payload&&!e.payload.firstChange&&(this.applyPayload(),this.isInitialStateCaptured=!1,this.getAutomationList())}applyPayload(){this.payload?.delayBeforeExecuting&&(this.delayOrDayBased="delay",this.delayBeforeExecuting=M({},this.payload.delayBeforeExecuting)),this.payload?.executeOn&&(this.delayOrDayBased="day",this.executeOn=M({},this.payload.executeOn))}onToggleExpanded(){this.isExpanded=!this.isExpanded}getAutomationList(){let e={moduleId:this.moduleId,page:1,limit:100};this._loaderService.start(),this._automationService.listAutomation(e).subscribe(i=>{if(i?.statusCode==200){let t=i?.data?.items?.filter(n=>n?._id!=this.automationId)||[];t?.forEach(n=>
23{n.selected=!1}),this.payload?.automationIds?.length&&!this.payload?.isStopAllAutomation&&(t?.forEach(n=>{n.selected=this.payload?.automationIds?.includes(n?._id)}),this.stopType="STOP_SELECTED"),typeof this.payload?.isStopAllAutomation<"u"&&this.payload?.isStopAllAutomation&&(this.stopType="STOP_ALL"),this.automationList=this.groupAutomationsByType(t),this.updateFilteredAutomations(),this.captureInitialState()}this._loaderService.stop()},i=>{this._loaderService.stop()})}updateFilteredAutomations(){if(!this.searchTerm||!this.searchTerm.trim()){this.filteredAutomations=this.automationList;return}let e=this.searchTerm.toLowerCase().trim();this.filteredAutomations=this.automationList.map(i=>{let t=i.items.filter(n=>n.name?.toLowerCase().includes(e));return P(M({},i),{items:t})}).filter(i=>i.items.length>0)}getAutomationTypeName(e){for(let i of Q.AutomationType){let t=i.children?.find(n=>n.path===e);if(t)return t.label}return e}groupAutomationsByType(e){let i=new Map;e.forEach(n=>{let c=n?.automationType||"UNKNOWN";this.excludedAutomationTypes.includes(c)||(i.has(c)||i.set(c,[]),i.get(c)?.push(n))});let t=[];return i.forEach((n,c)=>{t.push({automationType:c,name:this.getAutomationTypeName(c),items:n})}),t.sort((n,c)=>{let f=this.automationTypeOrder.indexOf(n.automationType),S=this.automationTypeOrder.indexOf(c.automationType);return f!==-1&&S!==-1?f-S:f!==-1?-1:S!==-1?1:n.name.localeCompare(c.name)})}getDelayData(){return this.delayPreferenceData?.delayPreference=="Delay Based"&&this.delayBeforeExecuting?.duration!=null&&this.delayBeforeExecuting?.unit?`Delay (${this.delayBeforeExecuting.duration} ${this.delayBeforeExecuting.unit}) : <span class="text-transparency-90">Before executing this step</span>`:this.delayPreferenceData?.delayPreference=="Day Based"&&this.executeOn?.dayValue!=null&&this.executeOn?.dayType&&(this.executeOn?.time||Number(this.executeOn?.dayValue)===0)?`${this.executeOn.dayType} ${this.executeOn.dayValue}${Number(this.executeOn.dayValue)!==0&&this.executeOn.time?" - "+this.executeOn.time:""}`:""}getPreview(){if(this.stopType==="STOP_ALL")return"All Automations Selected";let e=0;return this.filteredAutomations?.forEach(i=>{i.items?.forEach(t=>{t?.selected&&e++})}),`${e} Automations Selected`}captureInitialState(){this.isInitialStateCaptured||(this.initialStopType=this.stopType||"",this.initialSelectedAutomationIds=[],this.filteredAutomations?.forEach(e=>{e.items?.forEach(i=>{i?.selected&&i?._id&&this.initialSelectedAutomationIds.push(i._id)})}),this.initialDelayBeforeExecuting=this.delayBeforeExecuting?JSON.parse(JSON.stringify(this.delayBeforeExecuting)):{},this.initialExecuteOn=this.executeOn?JSON.parse(JSON.stringify(this.executeOn)):{},this.isInitialStateCaptured=!0)}hasChanges(){if(!this.isInitialStateCaptured)return!1;if(this.stopType!==this.initialStopType)return!0;let e=[];return this.filteredAutomations?.forEach(i=>{i.items?.forEach(t=>{t?.selected&&t?._id&&e.push(t._id)})}),e.length!==this.initialSelectedAutomationIds.length||!e.every(i=>this.initialSelectedAutomationIds.includes(i))||!this.initialSelectedAutomationIds.every(i=>e.includes(i))||JSON.stringify(this.delayBeforeExecuting)!==JSON.stringify(this.initialDelayBeforeExecuting)||JSON.stringify(this.executeOn)!==JSON.stringify(this.initialExecuteOn)}emitTimingChange(){this.timingChange.emit()}static{this.\u0275fac=function(i){return new(i||o)(E(H),E(Me),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-stop-other-automation"]],inputs:{payload:"payload",moduleId:"moduleId",automationId:"automationId",stepIndex:"stepIndex",actionId:"actionId",delayPreferenceData:"delayPreferenceData",timingSequenceError:"timingSequenceError",isViewOnly:"isViewOnly"},outputs:{timingChange:"timingChange",deleteBox:"deleteBox"},standalone:!1,features:[z],decls:19,vars:6,consts:[[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","gap-[5px]","py-[5px]","px-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/time-black.svg","alt","time-black","width","20","height","20",1,"img-fluid","dark:invert","dar
23k:contrast-200"],[1,"text-h4","text-transparency-100","font-semibold",3,"innerHTML"],[1,"flex","justify-between","items-center","gap-[10px]","mt-3"],[1,"flex-none","flex","items-center","p-[14px]","bg-secondary-red","rounded-[20px]"],["src","assets/images/icons/check-white.svg","alt","check-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],[1,"flex","items-center","gap-[5px]"],["appTooltip","Stop Other Automations",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down.svg","alt","chevron-down","width","20","height","20",1,"img-fluid","dark:invert"],[1,"flex","flex-col","gap-[20px]","mt-3"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","flex-col","gap-[15px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate"],[1,"flex","flex-col","gap-[10px]"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[10px]","cursor-pointer","select-none"],[1,"re-custom-radio-2"],["type","radio","value","STOP_ALL",3,"ngModelChange","name","ngModel","disabled"],[1,"check-mark"],[1,"flex","flex-col","gap-[3px]"],[1,"text-h4","text-transparency-100","font-semibold"],["type","radio","value","STOP_SELECTED",3,"ngModelChange","name","ngModel","disabled"],[1,"w-full"],[1,"flex","gap-[3px]","text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid"],[1,"flex","gap-[20px]"],["min","1","type","number","placeholder","Duration",1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[50%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"mt-[10px]","text-label-sm","font-semibold","text-charts-brighter-red"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel","disabled"],["min","0","type","number",1,"w-[34%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"keydown","ngModelChange","ngModel","disabled"],[1,"w-[33%]","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModel","disabled"],[3,"value"],[1,"flex","items-center","self-stretch","relative"],["src","assets/images/header/search.svg","alt","search","width","20",1,"img-fluid","absolute","left-[10px]","top-1/2","-translate-y-1/2"],["type","text","placeholder","Search Automations",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","ngModel","disabled"],[1,"flex","flex-col","gap-[10px]","max-h-[300px]","overflow-y-auto","pr-[5px]"],[1,"flex","flex-col","gap-[5px]"],[1,"text-h4","text-transparency-100","font-semibold","p-[5px]"],[1,"flex","items-center","gap-[10px]","px-[5px]","py-[4px]","cursor-pointer","select-none"],[1,"re-custom-c
23heckbox"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"checkmark"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),h(2,"img",2)(3,"span",3),a()(),r(4,"div",4)(5,"div",5),h(6,"img",6),a(),r(7,"div",7)(8,"div",8)(9,"h2",9),p(10," Stop Other Automations "),a()(),x(11,Ph,2,1,"h4",10),a(),r(12,"div",11)(13,"div",12),p(14),a(),x(15,Lh,2,0,"div",13),r(16,"div",14),y("click",function(){return t.onToggleExpanded()}),h(17,"img",15),a()()(),x(18,zh,22,9,"div",16)),i&2&&(s(3),m("innerHTML",t.getDelayData(),le),s(8),g(t.isExpanded?-1:11),s(3),T(" Step ",t.stepIndex+1," "),s(),g(t.isViewOnly?-1:15),s(),m("ngClass",t.isExpanded?"rotate-180":""),s(2),g(t.isExpanded?18:-1))},dependencies:[J,K,X,G,oe,Ke,$,Oe,F,re,U,L,Z],encapsulation:2})}}return o})()});function $h(o,l){if(o&1&&(r(0,"div",27),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e.name," ")}}function Kh(o,l){if(o&1&&(r(0,"div",27),p(1),a()),o&2){let e=l.$implicit;s(),T(" ",e.name," ")}}function Xh(o,l){if(o&1){let e=C();r(0,"div",37),y("click",function(){u(e);let t=d().$index,n=d(2);return _(n.deleteBranch(t))}),h(1,"svg-icon",41),a()}}function Zh(o,l){if(o&1&&(r(0,"div"),p(1),a()),o&2){let e=l.$implicit;de("opacity-50",e==null?null:e.disabled)("cursor-not-allowed",e==null?null:e.disabled),s(),T(" ",e==null?null:e.title," ")}}function ex(o,l){if(o&1){let e=C();r(0,"div",40)(1,"div",11)(2,"label",42),p(3,"Branch name "),h(4,"img",43),a(),r(5,"input",44),A("ngModelChange",function(t){u(e);let n=d().$implicit;return I(n.branchName,t)||(n.branchName=t),_(t)}),a()(),r(6,"div",11)(7,"label",42),p(8),h(9,"img",43),a(),r(10,"p-multiSelect",45),A("ngModelChange",function(t){u(e);let n=d().$implicit;return I(n.outcome,t)||(n.outcome=t),_(t)}),y("onChange",function(t){u(e);let n=d().$index,c=d(2);return _(c.onOutcomeChange(n,t.value))}),Ne(11,Zh,2,5,"ng-template",46),a()()()}if(o&2){let e=d(),i=e.$implicit,t=e.$index,n=d(2);s(5),w("ngModel",i.branchName),s(3),T("",n.conditionBranchOutcomeLabel," "),s(2),w("ngModel",i.outcome),m("options",n.getOptionsForBranch(t))("name","triggerTypeField_"+t)("maxSelectedLabels",1e3)("appendTo",n.dropdownAppendTo)("overlayOptions",n.dropdownOverlayOptions)("optionDisabled",n.isOptionDisabledForBranch(t))}}function tx(o,l){if(o&1){let e=C();r(0,"div",28)(1,"div",32)(2,"div",33)(3,"h3",34),p(4),a()(),r(5,"div",36),x(6,Xh,2,0,"div",39),r(7,"div",37),y("click",function(){let t=u(e).$index,n=d(2);return _(n.toggleBranchExpand(t))}),h(8,"img",20),a()()(),x(9,ex,12,9,"div",40),a()}if(o&2){let e=l.$implicit,i=l.$index,t=d(2);s(4),T(" Branch ",i+1," "),s(2),g(t.canDeleteBranch()?6:-1),s(),de("rotate-180",e==null?null:e.isExpanded),s(2),g(e!=null&&e.isExpanded?9:-1)}}function ix(o,l){o&1&&(r(0,"div",38),p(1," Anything Else "),a())}function nx(o,l){if(o&1){let e=C();r(0,"div",21),D(1,tx,10,5,"div",28,k),r(3,"button",29),y("click",function(){u(e);let t=d();return _(t.addBranch())}),h(4,"img",30),p(5," Add Branch "),a(),r(6,"div",31)(7,"div",32)(8,"div",33)(9,"h3",34),p(10," Default Branch "),a(),r(11,"div",35),p(12," Default branch executed if no previous conditions matched. "),a()(),r(13,"div",36)(14,"div",37),y("click",function(){u(e);let t=d();return _(t.toggleDefaultBranch())}),h(15,"img",20),a()()(),x(16,ix,2,0,"div",38),a()()}if(o&2){let e=d();s(),V(e.branches),s(13),de("rotate-180",e.isDefaultBranchExpanded),s(2),g(e.isDefaultBranchExpanded?16:-1)}}var Ja,Io=ee(()=>{fe();$e();dt();dr();Re();W();fe();Ce();lt();Ee();si();Ea();se();pe();kt();Qo();Bt();mo();Ja=(()=>{class o{constructor(e,i,t,n,c,f,S,v){this.data=e,this.dialog=i,this.hostEl=t,this._loaderService=n,this._userService=c,this._toastrService=f,this._marketingCampaignService=S,this._accountingService=v,this.destroy$=new Be,this.contactModuleMode=!1,this.inventoryModuleMode=!1,this.rentalModuleMode=!1,this.soldModuleMode=!1,this.listStackingModuleMode=!1,this.moduleIdForCampaigns="",this.marketingCampaignOptions=[],this.vendorCategoryOptions=[],this.triggerType="Lead created via",this.selectedTriggerType={name:"Lead created via",value:"Lead created via"},this.triggerTypeOption=[{name:"Lead created via",value:"Lead created via"},{name:"Owner type",value:"Owner type"},{name:"Ownership type",value:"Ownership type"},{name:"Vacancy status",value:"Vacancy status"},{name:"Number of properties owned",value:"Number of properties owned"},{name:"Property type",value:"Property type"},{name:"Phone type",value:"Phone type"},{name:"Exit type",value:"Exit type"},{name:"Team assignment by role",value:"Team assignment by role"},{name:"Team assignment by member",value:"Team assignment by member"}],this.outcomeData=[],this.branches=[{branchName:"",outcome:[],isDefaultBranch:!1,isExpanded:!0,outcomeFilters:{conditionType:this.triggerType}}],this.allRoleList=[],this.userList=[],this.isBranchesExpanded=!0,this.isDefaultBranchExpanded=!0,this.dropdownOverlayOptions={mode:"overlay",autoZIndex:!0,baseZIndex:2e3}}get dropdownAppendTo(){return this.hostEl?.nativeElement?.closest(".cdk-overlay-pane")||"self"}ngOnInit(){let e=this.data?.moduleId,i=typeof e=="object"&&e?._id?e._id:e||"";this.moduleIdForCampaigns=i,this.contactModuleMode=!!this.data?.contactModuleMode,this.inventoryModuleMode=!this.contactModuleMode&&i===O.MainStatusId.INVENTORY,this.rentalModuleMode=!this.contactModuleMode&&i===O.MainStatusId.RENTAL,this.soldModuleMode=!this.contactModuleMode&&i===O.MainStatusId.SOLD,this.listStackingModuleMode=!this.contactModuleMode&&(i===O.MainStatusId.LISTSTACKING||i===O.ModuleStatusId.LISTSTACKING),this.contactModuleMode?this.applyContactModuleTriggerOptions():this.inventoryModuleMode?this.applyInventoryModuleTriggerOptions():this.rentalModuleMode?this.applyRentalModuleTriggerOptions():this.soldModuleMode?this.applySoldModuleTriggerOptions():this.listStackingModuleMode&&this.applyListStackingModuleTriggerOptions(),this.getRoleList()}get conditionBranchOutcomeLabel(){return this.selectedTriggerType?.name||this.triggerType||"Outcomes"}applyContactModuleTriggerOptions(){let e=this.resolveContactOwnerConditionLabel();this.triggerTypeOption=[{name:e,value:e},{name:"Campaign",value:"Campaign"},{name:"Phone type",value:"Phone type"}],this.moduleIdForCampaigns===O.MainStatusId.VENDOR&&this.triggerTypeOption.push({name:"Vendor type",value:"Vendor type"}),this.resetBranchesForTriggerType()}applyInventoryModuleTriggerOptions(){this.triggerTypeOption=[{name:"Property type",value:"Property type"},{name:"Team assignment by role",value:"Team assignment by role"},{name:"Team assignment by member",value:"Team assignment by member"},{name:"Exit type",value:"Exit type"}],this.resetBranchesForTriggerType()}applyRentalModuleTriggerOptions(){this.triggerTypeOption=[{name:"Property type",value:"Property type"},{name:"Team assignment by role",value:"Team assignment by role"},{name:"Team assignment by member",value:"Team assignment by member"}],this.resetBranchesForTriggerType()}applySoldModuleTriggerOptions(){this.triggerTypeOption=[{name:"Property type",value:"Property type"},{name:"Team assignment by role",value:"Team assignment by role"},{name:"Team assignment by member",value:"Team assignment by member"},{name:"Exit type",value:"Exit type"}],this.resetBranchesForTriggerType()}applyListStackingModuleTriggerOptions(){this.triggerTypeOption=[{name:"Owner type",value:"Owner type"},{name:"Ownership type",value:"Ownership type"},{name:"Vacancy status",value:"Vacancy status"},{name:"Number of properties owned",value:"Number of properties owned"},{name:"Property type",value:"Property type"},{name:"Phone type",value:"Phone type"},{name:"Team assignment by member",value:"Team assignment by member"}],this.resetBranchesForTriggerType()}resetBranchesForTriggerType(){this.selectedTriggerType=this.triggerTypeOption[0],this.triggerType=this.selectedTriggerType.value,this.branches=[{branchName:"",outcome:[],isDefaultBranch:!1,isExpanded:!0,outcomeFilters:{conditionType:this.triggerType}}]}resolveContactOwnerConditionLabel(){let e=this.moduleIdForCampaigns,i=O.MainStatusId;return e===i.BUYER?"Who owns this Buyer":e===i.AGENT?"Who owns this Agent":e===i.VENDOR?"Who owns this Vendor":"Who owns this contact"}
23loadMarketingCampaignsForContact(e){if(!this.moduleIdForCampaigns){this.marketingCampaignOptions=[],e();return}this._marketingCampaignService.getMarketingCampaignDropDownList({campaignType:1,moduleId:this.moduleIdForCampaigns}).pipe(ue(this.destroy$),Ye(()=>e())).subscribe({next:i=>{if(i?.statusCode===200){let t=i?.data?.items||[];this.marketingCampaignOptions=t.map(n=>({id:n._id,title:(n.name||"Untitled").trim()}))}else this.marketingCampaignOptions=[]},error:()=>{this.marketingCampaignOptions=[],this._toastrService.showError("Failed to load campaigns. Campaign branches may be unavailable.")}})}loadVendorCategoriesForVendorModule(e){this._accountingService.getVendorCategory({}).pipe(ue(this.destroy$),Ye(()=>e())).subscribe({next:i=>{if(i?.statusCode===200){let t=i?.data??[];this.vendorCategoryOptions=t.map(n=>({id:n?._id,title:String(n?.name??"Untitled").trim()||"Untitled"}))}else this.vendorCategoryOptions=[]},error:()=>{this.vendorCategoryOptions=[],this._toastrService.showError("Failed to load vendor types. Vendor type branches may be unavailable.")}})}isVendorContactModule(){return this.contactModuleMode&&this.moduleIdForCampaigns===O.MainStatusId.VENDOR}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}fetchOutcomeOption(){switch(this.triggerType=JSON.parse(JSON.stringify(this.selectedTriggerType?.value)),this.branches=[{branchName:"",outcome:[],isDefaultBranch:!1,isExpanded:!0,outcomeFilters:{conditionType:this.triggerType}}],this.updateOutcomeFiltersForAllBranches(),this.triggerType){case"Lead created via":this.outcomeData=[{id:"Manually",title:"Manually"},{id:"Incoming Answered Calls",title:"Incoming Answered Calls"},{id:"Missed Calls",title:"Missed Calls"},{id:"Incoming SMS",title:"Incoming SMS"},{id:"Integration Zapier etc.",title:"Integration Zapier etc."},{id:"Web Forms",title:"Web Forms"},{id:"REsimpli Website",title:"REsimpli Website"}];break;case"Owner type":this.outcomeData=[{id:"Absentee",title:"Absentee"},{id:"Homeowner",title:"Homeowner"},{id:"Unknown",title:"Unknown"}];break;case"Ownership type":this.outcomeData=[{id:"Individual",title:"Individual"},{id:"Trust",title:"Trust"},{id:"Company",title:"Company"}];break;case"Vacancy status":this.outcomeData=[{id:"Occupied",title:"Occupied"},{id:"Not Occupied",title:"Not Occupied"}];break;case"Number of properties owned":this.outcomeData=[{id:"1 - 2 Properties",title:"1 - 2 Properties"},{id:"3 - 4 Properties",title:"3 - 4 Properties"},{id:"5 - 10 Properties",title:"5 - 10 Properties"},{id:"11 - 20 Properties",title:"11 - 20 Properties"},{id:"20+ Properties",title:"20+ Properties"}];break;case"Property type":this.outcomeData=Object.values(ta?.luCode).map(e=>({id:e,title:e})).sort((e,i)=>e.title.localeCompare(i.title));break;case"Phone type":this.outcomeData=[{id:"Landline",title:"Landline"},{id:"Mobile",title:"Mobile"},{id:"VoIP",title:"VoIP"},{id:"Other",title:"Other"}];break;case"Exit type":this.outcomeData=[{id:"Fix and Flip",title:"Fix and Flip"},{id:"Installment Sale",title:"Installment Sale"},{id:"Joint Venture",title:"Joint Venture"},{id:"New Construction",title:"New Construction"},{id:"Novation",title:"Novation"},{id:"Partnership",title:"Partnership"},{id:"Project Management",title:"Project Management"},{id:"Rental",title:"Rental"},{id:"Retail Listing",title:"Retail Listing"},{id:"Sale Leaseback",title:"Sale Leaseback"},{id:"Seller Financed Sale",title:"Seller Financed Sale"},{id:"Turnkey",title:"Turnkey"},{id:"Wholesale - Assignment Contract",title:"Wholesale - Assignment Contract"},{id:"Wholesale - Double Close",title:"Wholesale - Double Close"},{id:"Wholetail",title:"Wholetail"}];break;case"Team assignment by role":this.outcomeData=[],this.allRoleList?.forEach(e=>{this.outcomeData.push({id:e?._id,title:e?.name||"N/A"})});break;case"Team assignment by member":this.outcomeData=[],this.userList?.forEach(e=>{this.outcomeData.push({id:e?._id,title:`${e?.firstName} ${e?.lastName}`})});break;case"Who owns this Buyer":case"Who owns this Agent":case"Who owns this Vendor":case"Who owns this contact":this.outcomeData=[],this.userList?.forEach(e=>{let i=`${e?.firstName||""} ${e?.lastName||""}`.trim();
23this.outcomeData.push({id:e?._id,title:i||"N/A"})});break;case"Campaign":this.outcomeData=[...this.marketingCampaignOptions||[]];break;case"Vendor type":this.outcomeData=[...this.vendorCategoryOptions||[]];break}}deleteBranch(e){!Array.isArray(this.branches)||this.branches.length<=1||e<0||e>=this.branches.length||this.branches.splice(e,1)}canDeleteBranch(){return(this.branches?.length||0)>1}toggleBranchExpand(e){this.branches?.[e]&&(this.branches[e].isExpanded=!this.branches[e].isExpanded)}toggleBranchesSection(){this.isBranchesExpanded=!this.isBranchesExpanded}toggleDefaultBranch(){this.isDefaultBranchExpanded=!this.isDefaultBranchExpanded}getSelectedOutcomesFromOtherBranches(e){let i=new Set;return!Array.isArray(this.branches)||typeof e!="number"||e<0||this.branches?.forEach((t,n)=>{n!==e&&t?.outcome&&Array.isArray(t?.outcome)&&t?.outcome?.forEach(c=>{c&&i.add(c)})}),i}getOptionsForBranch(e){if(typeof e!="number"||e<0||!Array.isArray(this.branches)||e>=this.branches.length)return this.outcomeData||[];let i=this.getSelectedOutcomesFromOtherBranches(e);return this.outcomeData?.map(t=>P(M({},t),{disabled:i.has(t?.id)}))||[]}isOptionDisabled(e,i){return!e||typeof i!="number"||i<0?!1:this.getSelectedOutcomesFromOtherBranches(i).has(e)}onOutcomeChange(e,i){if(typeof e!="number"||e<0||!Array.isArray(this.branches)||e>=this.branches.length||!this.branches?.[e])return;let t=this.getSelectedOutcomesFromOtherBranches(e),n=Array.isArray(i)?i.filter(c=>c&&!t.has(c)):[];JSON.stringify(n)!==JSON.stringify(this.branches?.[e]?.outcome||[])&&this.branches?.[e]&&(this.branches[e].outcome=n)}isOptionDisabledForBranch(e){return typeof e!="number"||e<0?()=>!1:i=>i?.id?this.getSelectedOutcomesFromOtherBranches(e).has(i.id):!1}addBranch(){this.branches.push({branchName:"",outcome:[],isDefaultBranch:!1,isExpanded:!0,outcomeFilters:{conditionType:this.triggerType}})}isFormValid(){if(!this.triggerType||this.triggerType?.trim()===""||!this.outcomeData||this.outcomeData?.length===0)return!1;for(let e of this.branches||[])if(!e?.branchName||e?.branchName?.trim()===""||!e?.outcome||!Array.isArray(e?.outcome)||e?.outcome?.length===0)return!1;return!0}saveCondition(){this.updateOutcomeFiltersForAllBranches(),this.branches.push({isDefaultBranch:!0,branchName:"Anything Else",outcome:["Default branch executed if no previous conditions matched."],isExpanded:!0,outcomeFilters:{conditionType:this.triggerType}}),this.dialog.close({branches:this.branches,triggerType:this.triggerType})}updateOutcomeFiltersForAllBranches(){Array.isArray(this.branches)&&this.branches.forEach(e=>{e&&(e.outcomeFilters={conditionType:this.triggerType})})}getRoleList(){console.log("getRoleList calleddddd",this.rentalModuleMode);let e={page:1,limit:1e3};this._loaderService.start(),this._userService.getRoles(e).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:i=>{i?.statusCode===200&&(this.allRoleList=i?.data?.items||[],this.allRoleList?.forEach(t=>{let n=new Set(this.userList.map(f=>f?._id)),c=(t?.userData||[]).filter(f=>f?._id&&!n.has(f?._id));this.userList=[...this.userList,...c]})),this.contactModuleMode?this.loadMarketingCampaignsForContact(()=>{this.isVendorContactModule()?this.loadVendorCategoriesForVendorModule(()=>this.fetchOutcomeOption()):this.fetchOutcomeOption()}):this.fetchOutcomeOption()},error:()=>{this._toastrService.showError("Failed to load roles. Condition options may be incomplete."),this.contactModuleMode?this.loadMarketingCampaignsForContact(()=>{this.isVendorContactModule()?this.loadVendorCategoriesForVendorModule(()=>this.fetchOutcomeOption()):this.fetchOutcomeOption()}):this.fetchOutcomeOption()}})}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(Uo),E(H),E(De),E(Y),E(At),E(Bi))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-conditions"]],standalone:!1,decls:33,vars:13,consts:[["selectedItem",""],["item",""],[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15","h-full","overflow-hidden"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px] block","src","assets/images/icons/selected-action.svg",1,"text-transparency-100"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px] block","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","flex-1","overflow-auto"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-0","gap-[10px]","p-[20px]","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"w-full"],[1,"text-h3/[normal]","text-transparency-100","font-semibold","mb-[10px]"],["optionLabel","name","filterBy","name","placeholder","Select Condition Type",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[5px]","py-[5px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","onChange","options","ngModel","filter","showClear","appendTo","overlayOptions"],[1,"flex","flex-col","items-start","self-stretch","bg-transparency-20","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","overflow-visible"],[1,"flex","items-center","self-stretch","gap-[10px]","p-[20px]","bg-transparency-0"],[1,"flex-[1_0_0]","flex","flex-col","gap-[3px]"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"text-label","text-transparency-90","font-medium","truncate"],[1,"flex","items-center","justify-end","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","18","height","18",1,"img-fluid","dark:invert","dar
23k:contrast-200"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","p-[10px]"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","label","Save","variant","filled","type","default","size","44",3,"click","leftIcon","disabled"],[1,"flex","items-center","gap-2"],[1,"relative","z-[1]","flex","flex-col","self-stretch","gap-[15px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","overflow-visible"],["type","button",1,"flex","items-center","self-stretch","gap-[5px]","py-[16px]","px-[30px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","text-h3","text-primary-90","font-semibold",3,"click"],["src","assets/images/icons/plus-teal.svg","alt","plus-teal","width","22","height","22",1,"img-fluid"],[1,"flex","flex-col","self-stretch","gap-[15px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex","justify-between","items-center","gap-[10px]"],[1,"flex","flex-col","gap-[3px]"],[1,"text-h3/[normal]","text-transparency-100","font-semibold"],[1,"text-label/[normal]","text-transparency-90","font-medium"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],[1,"flex","justify-between","items-center","gap-[10px]","p-[10px]","text-h4","text-transparency-100","font-semibold","bg-transparency-25","rounded-[5px]"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"text-h4","text-transparency-100","font-semibold","mb-[10px]"],["src","assets/images/icons/astrisk.svg","alt","astrisk","width","8","height","8",1,"img-fluid","inline-block"],["type","text","placeholder","Branch",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[10px]","py-[10px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","ngModel"],["placeholder","Select","optionLabel","title","optionValue","id","scrollHeight","220px",1,"w-full","text-h4","text-transparency-100","font-semibold","bg-transparency-0","px-[5px]","py-[5px]","border-[1px]","border-solid","border-transparency-25","rounded-[5px]","focus:outline-none",3,"ngModelChange","onChange","ngModel","options","name","maxSelectedLabels","appendTo","overlayOptions","optionDisabled"],["pTemplate","item"]],template:function(i,t){if(i&1){let n=C();r(0,"div",2)(1,"div",3)(2,"div",4),h(3,"svg-icon",5),r(4,"div",6),p(5," Conditions "),a()(),r(6,"button",7),h(7,"svg-icon",8),a()(),r(8,"div",9)(9,"div",10)(10,"div",11)(11,"h3",12),p(12," Condition type "),a(),r(13,"p-select",13),A("ngModelChange",function(f){return u(n),I(t.selectedTriggerType,f)||(t.selectedTriggerType=f),_(f)}),y("onChange",function(){return t.fetchOutcomeOption()}),Ne(14,$h,2,1,"ng-template",null,0,ze)(16,Kh,2,1,"ng-template",null,1,ze),a()()(),r(18,"div",14)(19,"div",15)(20,"div",16)(21,"h3",17),p(22," Branches "),a(),r(23,"div",18),p(24),a()(),r(25,"div",19),y("click",function(){return t.toggleBranchesSection()}),h(26,"img",20),a()(),x(27,nx,17,3,"div",21),a()(),r(28,"div",22),h(29,"svg-icon",23),a(),r(30,"div",24),h(31,"app-button",25),r(32,"app-button",26),y("click",function(){return t.saveCondition()}),a()()()}i&2&&(s(13),m("options",t.triggerTypeOption),w("ngModel",t.selectedTriggerType),m("filter",!0)("showClear",!0)("appendTo",t.dropdownAppendTo)("overlayOptions",t.dropdownOverlayOptions),s(11),T(" ",t.branches==null?null:t.branches.length," Branches defined "),s(),de("rotate-180",t.isBranchesExpanded),s(2),g(t.isBranchesExpanded?27:-1),s(4),m("leftIcon",!1),s(),m("leftIcon",!1)("disabled",!t.is
23FormValid()))},dependencies:[G,F,U,Ze,L,et,fi,tt,Jt],encapsulation:2})}}return o})()});var Qa,Ao=ee(()=>{fe();$e();dt();W();fe();Ce();at();se();pe();kt();Qa=(()=>{class o{constructor(e,i,t,n){this.data=e,this.dialog=i,this._loaderService=t,this._automationService=n,this.destroy$=new Be,this.enableConversationalAi=!1;let c=this.data?.enabled??this.data?.conversationalAiEnabled??this.data?.isConversationalAI;c!=null&&(this.enableConversationalAi=!!c)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}buildAutomationUpdatePayload(){let e=this.data,i=e?.moduleId?._id||e?.moduleId,t={name:e?.name,description:e?.description||"Automated follow-up sequence for new leads",timezonename:e?.timezonename,moduleId:i,automationType:e?.automationType,status:e?.status||"active",primaryConditions:e?.primaryConditions||{},isCreateLog:!!e?.editMode,delayPreference:e?.delayPreference,automationId:e?._id};if(t.isConversationalAI=this.enableConversationalAi,e?.automationType!=="ACTIVITY_TRIGGER"){let n=JSON.parse(JSON.stringify(e?.workflowSteps||[]));n?.forEach(c=>delete c._id),t.workflowSteps=n}else t.workflowSteps=[];return t}save(){let e={enabled:this.enableConversationalAi};if(this.data?._id){this._loaderService.start();let i=this.buildAutomationUpdatePayload();this._automationService.updateAutomation(i).pipe(ue(this.destroy$),Ye(()=>this._loaderService.stop())).subscribe({next:t=>{t?.statusCode===200&&this.dialog.close(P(M({},e),{conversationalAiPreferenceAppliedOnServer:!0,serverPayload:t?.data}))},error:()=>{}});return}this.dialog.close(e)}static{this.\u0275fac=function(i){return new(i||o)(E(Ge),E(qe),E(H),E(Me))}}static{this.\u0275cmp=B({type:o,selectors:[["app-conversational-ai-preference"]],standalone:!1,decls:26,vars:4,consts:[[1,"flex","flex-col","items-center","gap-[20px]","p-[30px]","bg-transparency-15"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","items-center","self-stretch","gap-[30px]"],[1,"flex-1","flex","items-center","self-stretch","gap-[10px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[40px]","px-[20px]","py-[15px]"],["svgClass","w-[30px] h-[30px]","src","assets/images/icons/conversational-ai.svg",1,"text-transparency-100"],[1,"flex-1","text-h1","text-transparency-100","font-semibold"],["matDialogClose","",1,"text-transparency-100","flex","items-center","p-[5px]","bg-transparency-10","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["svgClass","w-[24px] h-[24px]","src","assets/images/icons/close-circle-outline.svg"],[1,"flex","self-stretch","gap-[10px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex-1","flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"text-label","leading-[normal]","text-transparency-100","font-medium","opacity-60"],[1,"re-custom-switch"],["type","checkbox","name","enableConversationalAi",3,"ngModelChange","ngModel"],[1,"slider"],[1,"flex","self-stretch","text-h4/[normal]","text-transparency-90","font-semibold","pb-[10px]","text-center"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","items-center","self-stretch","justify-center","gap-[20px]"],["customClass","min-w-[120px] justify-center","label","Cancel","variant","filled","type","blackwhite","size","44","matDialogClose","",3,"leftIcon"],["customClass","min-w-[120px] justify-center","label","Save Conversational AI Preference","variant","filled","type","default","size","44",3,"clicked","leftIcon"]],template:function(i,t){i&1&&(r(0,"mat-dialog-content")(1,"div",0)(2,"div",1)(3,"div",2)(4,"div",3),h(5,"svg-icon",4),r(6,"div",5),p(7," Conversational AI Preference "),a()(),r(8,"button",6),h(9,"svg-icon",7),a()(),r(10,"div",8)(11,"div",9)(12,"h3",10),p(13," Enable Conversational AI "),a(),r(14,"div",11),p(15," Instantly respond to incoming SMS with our AI-powered SMS assistant. "),a()(),r(16,"label",12)(17,"input",13),A("ngModelChange",function(c){return I(t.enableConversationalAi,c
23)||(t.enableConversationalAi=c),c}),a(),h(18,"span",14),a()(),r(19,"div",15),p(20," Once Conversational AI responds to the seller, all active automations on this lead will stop to prevent duplicate communications. "),a()(),r(21,"div",16),h(22,"svg-icon",17),a(),r(23,"div",18),h(24,"app-button",19),r(25,"app-button",20),y("clicked",function(){return t.save()}),a()()()()),i&2&&(s(17),w("ngModel",t.enableConversationalAi),ct("aria-label","Enable conversational AI to reply to incoming SMS messages"),s(7),m("leftIcon",!1),s(),m("leftIcon",!1))},dependencies:[Ke,F,U,Ze,_t,L,et],encapsulation:2})}}return o})()});function lx(o,l){if(o&1&&(r(0,"tr",10)(1,"td",11),p(2,"0"),a(),r(3,"td",11)(4,"div",12)(5,"div",13)(6,"h4",14),p(7," Lead Added to Automation "),a()()()(),r(8,"td",11)(9,"div",15),p(10," Added to Automation "),a()(),r(11,"td",11)(12,"div",16),p(13),a()()()),o&2){let e=d();s(13),T(" ",e.formatDateInTimezone(e.detailList[0]==null?null:e.detailList[0].createdAt,e.delayPreferenceData==null?null:e.delayPreferenceData.timezone,"dateTime")," ")}}function sx(o,l){if(o&1&&(r(0,"tr",10)(1,"td",17),p(2),a(),r(3,"td",17)(4,"div",12)(5,"div",18),h(6,"img",19),a(),r(7,"div",13)(8,"h4",14),p(9),a(),r(10,"h5",20),p(11),a()()()(),r(12,"td",17)(13,"div",21),p(14),a()(),r(15,"td",17)(16,"div",16),p(17),a()()()),o&2){let e=l.$implicit,i=d();s(2),T(" ",e==null||e.workflowStep==null?null:e.workflowStep.stepOrder," "),s(4),m("src",Vt(e==null||e.workflowStep==null?null:e.workflowStep.icon),ge),s(3),T(" ",e==null||e.workflowStep==null?null:e.workflowStep.stepName," "),s(),m("pTooltip",i.getStepPreview(e)),s(),T(" Preview: ",i.getStepPreview(e)||"\u2014"," "),s(2),m("ngClass",(e==null?null:e.status)=="PENDING"?"text-tags-blue bg-tags-blue-bg":"text-tags-brighter-green bg-tags-brighter-green-bg"),s(),T(" ",(e==null?null:e.status)=="PENDING"?"Pending":"Executed"," "),s(3),je(" ",(e==null?null:e.status)=="PENDING"?"Scheduled for: ":""," ",i.formatDateInTimezone(e==null?null:e.workflowSnapshotAt,i.delayPreferenceData==null?null:i.delayPreferenceData.timezone,"dateTime")," ")}}function dx(o,l){o&1&&(r(0,"tr",7)(1,"td",22),p(2," No data found "),a()()),o&2&&m("hoverable",!1)}var ox,ax,rx,Zn,eo=ee(()=>{W();se();$e();dt();Mt();Re();W();at();St();Ce();Ee();xe();fo();Lt();be();ri();li();He();ox=()=>[10,25,50,100],ax=(o,l,e,i,t)=>({currentPage:o,totalPages:l,totalCount:e,pageSize:i,pageSizeOptions:t}),rx=(o,l)=>(l==null?null:l._id)??o;Zn=(()=>{class o{get isBuyerAgentVendorModule(){return[this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)}getSubmoduleDisplayName(e){return[e?.firstName,e?.lastName].filter(t=>t!=null&&t!="null"&&String(t).trim()!=="").join(" ").trim()||"N/A"}getDetailHeading(){return this.isBuyerAgentVendorModule?this.getSubmoduleDisplayName(this.detailData?.submoduleData):this.detailData?.submoduleData?.propertyType==="land"?this.detailData?.submoduleData?.apn||"N/A":this.detailData?.submoduleData?.address||"N/A"}constructor(e,i,t,n,c,f,S){this._automationService=e,this._commonService=i,this._loaderService=t,this._toastrService=n,this._utilities=c,this._vapiService=f,this._leadsService=S,this.automationId="",this.moduleId="",this.detailData={},this.enrollmentData={},this.calledFrom="",this.actionGroups=[],this.delayPreferenceData={},this.moveBackEmitter=new R,this.currentPage=1,this.totalDetails=0,this.itemsPerPage=10,this.isLoading=!1,this.showSearch=!0,this.searchText="",this.searchControl=new Xe(""),this.detailList=[],this.flowList=[],this.automationList=[],this.agentList=[],this.pipelineData=[],this.destroy$=new Be,this.mainStatusId=O.MainStatusId}ngOnInit(){this.loadPreviewLookups(),this.searchControl.valueChanges.pipe(yt(500),Ct(),ue(this.destroy$)).subscribe(e=>{this.searchText=e??"",this.currentPage=1,this.getEnrollmentDetail()}),this.getEnrollmentDetail()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getEnrollmentDetail(){let e={automationId:this.automationId,moduleId:this.moduleId,submoduleId:this.detailData?.subModuleId,page:this.currentPage,limit:this.itemsPerPage,automationStartTime:this.detailData?.automationStartTime||this.detailData?.automationId?.automationStartTime};this.searchText&&(e.searchString=this.searchText),this.isLoading=!0,this._loaderService.start(),this._automationService.j
23obList(e).subscribe({next:i=>{let t=i?.data?.data||[];this.detailList=t.map(n=>{if(n?.workflowStep?.stepType){let c=this.getActionByType(n.workflowStep.stepType);return P(M({},n),{workflowStep:P(M({},n.workflowStep),{stepName:c?.name??"N/A",icon:c?.icon??""})})}return n}),this.totalDetails=i?.data?.count??0,this.isLoading=!1,this._loaderService.stop()},error:i=>{this.isLoading=!1,this._loaderService.stop(),this._toastrService.showError(i?.error?.message??"Failed to load enrollment details.")}})}goToPage(e){e>=1&&e<=this.totalPages&&e!==this.currentPage&&(this.currentPage=e,this.getEnrollmentDetail())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.getEnrollmentDetail()}getActionByType(e){let i=n=>{for(let c of this.actionGroups){let f=c?.actions?.find(S=>S?.type===n);if(f)return f}return null},t=i(e);if(t)return t;if(e==="MARK_VIP"){let n=i("MARK_HOT");if(n)return P(M({},n),{name:"Mark/Unmark as VIP",type:"MARK_VIP"})}return e==="WHO_OWNS_THIS_CONTACT"?M({},Q.whoOwnsThisContactAction):null}get totalPages(){return Math.ceil(this.totalDetails/this.itemsPerPage)}loadPreviewLookups(){this._commonService.getManageFlow({page:1,limit:30,numTypeId:1}).pipe(ue(this.destroy$)).subscribe(e=>{e?.statusCode==200&&(this.flowList=e?.data?.items||[])}),this._vapiService.listRetellAiOutbound({page:1,limit:1e3,voiceAiType:1}).pipe(ue(this.destroy$)).subscribe(e=>{e?.statusCode==200&&(this.agentList=e?.data?.items||[])}),this.moduleId&&(this._automationService.listAutomation({moduleId:this.moduleId,page:1,limit:100}).pipe(ue(this.destroy$)).subscribe(e=>{e?.statusCode==200&&(this.automationList=[{items:e?.data?.items||[]}])}),this._leadsService.getPipelines({page:1,limit:100,moduleId:this.moduleId}).pipe(ue(this.destroy$)).subscribe(e=>{e?.statusCode==200&&(this.pipelineData=this.organizePipelinesFromResponse(e?.data?.items||[]))}))}organizePipelinesFromResponse(e){let i=e.filter(c=>c?.masterPipelineId).sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0)),t=e?.filter(c=>!c?.masterPipelineId),n=[...i,...t].sort((c,f)=>(c?.orderIndex??0)-(f?.orderIndex??0));return n=n?.map(c=>{if(c?.mainStatusList?.length){let f=c?.mainStatusList.filter(v=>v?.masterStatusId).sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0)),S=c?.mainStatusList?.filter(v=>!v?.masterStatusId);c.mainStatusList=[...f,...S].sort((v,b)=>(v?.orderIndex??0)-(b?.orderIndex??0))}return c}),n}getSelectPipelineStatusPreview(e){let i=this.pipelineData?.find(v=>v?._id===e?.pipelineId),t=e?.mainStatusId,n=Array.isArray(t)?t:t!=null?[t]:[],c=i?.mainStatusList||[],f="";i?.title&&(f=`Pipeline: ${i.title}.`);let S=n.map(v=>c.find(b=>b?._id===v)?.title).filter(Boolean);return S.length&&(f+=` Status: ${S.join(", ")}.`),f}getCallFlowPreview(e){let i=this.flowList?.findIndex(t=>t?._id===e);return i>=0?`Changed to ${this.flowList?.[i]?.name}.`:""}getMoveToAutomationPreview(e){let i=this.getAutomationNameById(e);return i?`${i} selected`:""}getAutomationNameById(e){for(let i of this.automationList||[]){let t=i?.items?.find(n=>n?._id===e);if(t?.name)return t.name}return""}getStopOtherAutomationsPreview(e){if(e?.isStopAllAutomation===!0)return"Stop all Automations";let t=(Array.isArray(e?.automationIds)?e.automationIds:[]).map(n=>this.getAutomationNameById(String(n))).filter(Boolean);return t.length?`Stop ${t.join(", ")}`:""}getStepPreview(e){let i=e?.workflowStep?.payload||{},t=e?.workflowStep?.stepType,n=v=>!v||typeof v!="string"?"":v.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim(),c=v=>{if(!v||typeof v!="string")return"";let b=v.replace(/\r\n/g,`
24`).replace(/&nbsp;/g," "),N=b.match(/<[^>]*>/),j=b.indexOf(`
25`),Fe=b.length;N?.index!=null&&(Fe=Math.min(Fe,N.index)),j>=0&&(Fe=Math.min(Fe,j));let xt=b.slice(0,Fe).trim();return Fe>=b.length?xt:xt?`${xt}...`:"..."},f=v=>{if(!v||typeof v!="string")return"";try{let b=new DOMParser().parseFromString(v,"text/html");return b.querySelectorAll("span.mention").forEach(N=>{let j=(N.getAttribute("data-value")||"").trim();N.replaceWith(document.createTextNode(j?`@${j}`:""))}),(b.body?.textContent||"").replace(/\uFEFF/g,"").replace(/&nbsp;/g," ").replace(/\s+/g," ").trim()}catch(b){return n(v)}},S=v=>({ROUND_ROBIN:"Round Robin (Equal Distribution)",FIRST_TO_CLAIM:"First To Claim",FIRST_TO_ANSWER:"First To Answer",MANUAL_ASSIGNMENT:"Manual Assignment",ALL_SELECTED:"All Selected Team Members",WEIGHTED_ROUND_ROBIN:"Weighted Round-Robin"})[v]||v||"";switch(t){case"SPEED_TO_LEAD":{let v=i.manualSpeedToLeadEnabled?"Manual SpeedtoLead Enabled.":"Manual SpeedtoLead Disabled.",b=i.isAIEnabled?" SpeedtoLead AI Enabled.":" SpeedtoLead AI Disabled.";return v+b}case"ADD_NOTES":return f(i.noteText||"");case"ADD_TASK":return i.basicSetup?.taskName||"";case"SKIP_TRACE_RECORD":return"Skip trace record";case"ASSIGN_TEAM_MEMBERS":{let v=i.roles?.filter?.(N=>N?.isActive!==!1)?.length??i.roles?.length??0,b=S(i.assignmentMethod||"");return`${v} Roles configured. ${b}`.trim()}case"UNASSIGN_TEAM_MEMBERS":{if(Array.isArray(i.teamMemberIds)&&i.teamMemberIds.length){let b=i.teamMemberIds.length;return b===1?"1 team member configured.":`${b} team members configured.`}return`${i.roles?.filter(b=>Array.isArray(b?.teamMemberIds)&&b.teamMemberIds.length>0)?.length??0} Roles configured.`}case"NOTIFY_TEAM_MEMBER":{let v=[],b=i.notificationChannelSchema||{};return b.sms&&v.push("SMS"),b.email&&v.push("Email"),b.web&&v.push("Web"),b.inApp&&v.push("In-App"),v.length?`Notifying Member via ${v.join(", ")} Channels`:""}case"MOVE_TO_CALL_FLOW":return this.getCallFlowPreview(i.selectedCallFlow);case"MOVE_TO_AUTOMATION":return this.getMoveToAutomationPreview(i.moveToAutomationId);
25case"STOP_OTHER_AUTOMATIONS":return this.getStopOtherAutomationsPreview(i);case"DIRECT_MAIL":{let v=i.mailerDetails?.mailType||"",b=i.senderDetails?.senderName||"";return!v&&!b?"":`Mailer: ${v}. Sender: ${b}`}case"WHO_OWNS_THIS_CONTACT":{let v=Array.isArray(i.ownerIds)?i.ownerIds.length:0;return!v&&Array.isArray(i.roles)&&(i.roles||[]).forEach(b=>{v+=b?.teamMembers?.length||0}),`${v} user(s) own this contact`}case"SEND_SMS":return i?.isAISMSAssist&&!i?.messageText?"AI SMS assist enabled":c(i.messageText||"");case"SEND_EMAIL":return c(i?.emailContent?.body||"");case"SELECT_PIPELINE_STATUS":return this.getSelectPipelineStatusPreview(i);case"CHANGE_PIPELINE_STATUS":return"Pipeline and status updated";case"ADD_FOLDER":return i.folderName||"";case"BLOCK_INCOMING_COMMUNICATION":return i.isBlockIncomingCommunication?"Enabled":"Disabled";case"MANAGE_TAGS":{let v=i.addTags?.length??0,b=i.removeTags?.length??0;return`${v} Tags added. ${b} Tags removed.`}case"MANAGE_LIST":{let v=i.addLists?.length??0,b=i.removeLists?.length??0;return`${v} Lists added. ${b} Lists removed.`}case"MARK_HOT":return i.action==="MARK_AS_HOT_LEAD"?"Mark as Hot Lead":"Unmark as Hot Lead";case"MARK_VIP":return typeof i.isVip=="boolean"?i.isVip?"Mark as VIP":"Unmark as VIP":i.action==="MARK_AS_VIP"?"Mark as VIP":"Unmark as VIP";case"MARK_LEAD_QUALIFIED":return typeof i.isQualified=="boolean"?i.isQualified?"Mark Lead Qualified":"Mark Lead Not-Qualified":i.action==="MARK_LEAD_QUALIFIED"?"Mark Lead Qualified":"Mark Lead Not-Qualified";case"MARK_RETURNED_MAIL":return i.action==="MARK_AS_RETURNED_MAIL"?"Mark as Returned Mail":"Unmark as Returned Mail";case"WEBHOOK":{let v=(i.webhookUrl||"").trim();return v||""}case"AI_CALLS":{let v=i.callingAgent?.aiAgentToUse,b=this.agentList?.find(j=>j?._id==v);if(!b?.assistantName)return"";let N=i.sellerContactSelection?.contactType=="PRIMARY_CONTACT"?"primary contact":"all contacts";return`${b.assistantName} will call ${N}`}default:return""}}formatDateInTimezone(e,i,t="dateTime"){if(e==null||e==="")return"";let n=i?.trim()||void 0,c;if(typeof e=="number")c=new Date(e);else{let S=String(e).trim(),v=Number(S);!isNaN(v)&&S.length>0&&S.length<=15&&/^\d+$/.test(S)?c=new Date(v):c=new Date(S)}if(isNaN(c.getTime()))return"";let f=t==="dateOnly"?{timeZone:n,month:"short",day:"2-digit",year:"numeric"}:{timeZone:n,month:"short",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return c.toLocaleString("en-US",f).replace(/, (?=\d{1,2}:\d{2}\s?[AP]M$)/," ")}static{this.\u0275fac=function(i){return new(i||o)(E(Me),E(Ue),E(H),E(Y),E(q),E(Xt),E(it))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation-activity-and-enrollment-detail"]],inputs:{automationId:"automationId",moduleId:"moduleId",detailData:"detailData",enrollmentData:"enrollmentData",calledFrom:"calledFrom",actionGroups:"actionGroups",delayPreferenceData:"delayPreferenceData"},outputs:{moveBackEmitter:"moveBackEmitter"},standalone:!1,decls:24,vars:20,consts:[[1,"inline-flex","items-center","gap-[20px]","mb-[20px]"],[1,"text-h2","text-transparency-100","font-semibold"],[1,"text-primary-90","cursor-pointer",3,"click"],[1,"flex","flex-col","items-start","overflow-hidden","mb-[20px]"],[1,"w-full","overflow-auto"],[3,"searchChange","pageChange","pageSizeChange","showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","'180px'"],["appTh",""],["appTr","",1,"group/item"],["appTd","",1,"px-3","py-3","text-p"],[1,"flex","items-center","gap-[8px]"],[1,"flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-h4","font-medium","truncate"],[1,"inline-block","items-center","text-sub-heading","leading-[normal]","font-medium","px-[8px]","py-[5px]","rounded-[20px]","text-transparency-100","bg-transparency-20"],[1,"text-transparency-100"],["appTd","",1,"text-p"],[1,"flex-none","bg-added-cerulean","rounded-pill","p-[5px]","flex","items-center","justify-center"],["alt","task-white","width","16","height","16",1,"img-fluid",3,"src"],["tooltipPosition","top",1,"text-label","text-transparency-90","font-medium","truncate","group-hover/item:text-transparency-100",3,"pTooltip"],[1,"inline-block","items-center","text-sub-heading","leading-[normal]","font-medium","px-[8px]","py-[5px]","rounded-[20px]",3,"ngClass"],["appTd","","colspan","4",1,"py-6","text-center","text-gray-500"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"h2",1)(2,"span",2),y("click",function(){return t.moveBackEmitter.emit()}),p(3),a(),p(4),a()(),r(5,"div",3)(6,"div",4)(7,"app-table-container",5),y("searchChange",function(c){return t.searchControl.setValue(c)})("pageChange",function(c){return t.goToPage(c)})("pageSizeChange",function(c){return t.onItemsPerPageChange(c)}),r(8,"table",6)(9,"thead")(10,"tr",7)(11,"th",8),p(12,"Step"),a(),r(13,"th",9),p(14,"Action"),a(),r(15,"th",9),p(16,"Status"),a(),r(17,"th",9),p(18,"Executed On"),a()()(),r(19,"tbody"),x(20,lx,14,1,"tr",10),D(21,sx,18,10,"tr",10,rx),x(23,dx,3,1,"tr",7),a()()()()()),i&2&&(s(3),T("All Automation ",t.calledFrom," /"),s(),T(" ",t.getDetailHeading()," "),s(3),m("showViewType",!1)("showPagination",!0)("pagination",bt(14,ax,t.currentPage,t.totalPages,t.totalDetails,t.itemsPerPage,pt(13,ox)))("showSearch",t.showSearch)("searchPlaceholder","Search data")("searchTerm",t.searchText)("loading",t.isLoading),s(),m("bordered",!0),s(2),m("hoverable",!1),s(10),g(t.detailList!=null&&t.detailList.length&&t.currentPage===1?20:-1),s(),V(t.detailList),s(2),g(t.detailList!=null&&t.detailList.length?-1:23))},dependencies:[J,Tt,vt,Et,wt,It,he],encapsulation:2})}}return o}
25)()});function ux(o,l){o&1&&(r(0,"h2",1),p(1," Automation Enrollment "),a())}function _x(o,l){o&1&&(r(0,"th",10),p(1,"Property Address/APN"),a())}function hx(o,l){o&1&&(r(0,"th",10),p(1,"Campaign"),a())}function xx(o,l){o&1&&(r(0,"div",14),p(1," Automation Completed "),a())}function gx(o,l){if(o&1&&(r(0,"td",15),p(1),a()),o&2){let e=d().$implicit;s(),T(" ",(e==null||e.submoduleData==null?null:e.submoduleData.propertyType)==="land"?(e==null||e.submoduleData==null?null:e.submoduleData.apn)||"N/A":(e==null||e.submoduleData==null?null:e.submoduleData.address)||"N/A"," ")}}function fx(o,l){if(o&1&&(r(0,"td",15),p(1),a()),o&2){let e=d().$implicit;s(),T(" ",(e==null||e.submoduleData==null||e.submoduleData.campaignData==null?null:e.submoduleData.campaignData.name)||"N/A"," ")}}function yx(o,l){if(o&1){let e=C();r(0,"img",21),y("click",function(t){u(e);let n=d().$implicit;return d(2).stopAutomation(n),_(t.stopPropagation())}),a()}}function Cx(o,l){if(o&1){let e=C();r(0,"tr",12),y("click",function(){let t=u(e).$implicit,n=d(2);
25return _(n.showDetails(t))}),r(1,"td",13),p(2),x(3,xx,2,0,"div",14),a(),x(4,gx,2,1,"td",15),x(5,fx,2,1,"td",15),r(6,"td",15)(7,"div",16)(8,"span",17),p(9),a(),r(10,"div",18)(11,"img",19),y("click",function(t){let n=u(e).$implicit;return d(2).showDetails(n),_(t.stopPropagation())}),a(),x(12,yx,1,0,"img",20),a()()()()}if(o&2){let e=l.$implicit,i=d(2);s(2),T(" ",i.getSubmoduleDisplayName(e==null?null:e.submoduleData)," "),s(),g((e==null?null:e.status)!="PENDING"?3:-1),s(),g(i.showPropertyAddressColumn?4:-1),s(),g(i.showCampaignColumn?5:-1),s(4),ce(i.formatDateInTimezone(e==null?null:e.createdAt,i.delayPreferenceData==null?null:i.delayPreferenceData.timezone,"dateTime")),s(3),g((e==null?null:e.status)!="COMPLETED"?12:-1)}}function bx(o,l){if(o&1&&(r(0,"tr",8)(1,"td",22),p(2," No data found "),a()()),o&2){let e=d(2);m("hoverable",!1),s(),ct("colspan",e.enrollmentTableColumnCount)}}function Sx(o,l){if(o&1){let e=C();r(0,"app-table-container",6),y("searchChange",function(t){u(e);let n=d();return _(n.searchControl.setValue(t))})("pageChange",function(t){u(e);let n=d();return _(n.goToPage(t))})("pageSizeChange",function(t){u(e);let n=d();return _(n.onItemsPerPageChange(t))}),r(1,"table",7)(2,"thead")(3,"tr",8)(4,"th",9),p(5),a(),x(6,_x,2,0,"th",10),x(7,hx,2,0,"th",10),r(8,"th",10),p(9,"Enrolled Date"),a()()(),r(10,"tbody"),D(11,Cx,13,6,"tr",11,mx),x(13,bx,3,2,"tr",8),a()()()}if(o&2){let e=d();m("showViewType",!1)("showPagination",!0)("pagination",bt(14,px,e.currentPage,e.totalPages,e.totalEnrollment,e.itemsPerPage,pt(13,cx)))("showSearch",e.showSearch)("searchPlaceholder","Search data")("searchTerm",e.searchText)("loading",e.isLoading),s(),m("bordered",!0),s(2),m("hoverable",!1),s(2),ce(e.enrollmentNameColumnLabel),s(),g(e.showPropertyAddressColumn?6:-1),s(),g(e.showCampaignColumn?7:-1),s(4),V(e.enrollmentList),s(2),g(e.enrollmentList!=null&&e.enrollmentList.length?-1:13)}}function Tx(o,l){if(o&1){let e=C();r(0,"app-automation-activity-and-enrollment-detail",23),y("moveBackEmitter",function(){u(e);let t=d();return _(t.moveBack())}),a()}if(o&2){let e=d();m("detailData",e.editData)("calledFrom","Enrollment")("automationId",e.automationId)("actionGroups",e.actionGroups)("moduleId",e.moduleId)("delayPreferenceData",e.delayPreferenceData)}}var cx,px,mx,Ka,Mo=ee(()=>{se();$e();dt();wa();Re();W();fe();at();Ce();Ee();xe();ri();li();He();eo();cx=()=>[10,25,50,100],px=(o,l,e,i,t)=>({currentPage:o,totalPages:l,totalCount:e,pageSize:i,pageSizeOptions:t}),mx=(o,l)=>(l==null?null:l._id)??o;Ka=(()=>{class o{get showPropertyAddressColumn(){return![this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)}get showCampaignColumn(){return this.moduleId!==this.mainStatusId.LISTSTACKING}get enrollmentNameColumnLabel(){return this.moduleId===this.mainStatusId.BUYER?"Buyer Name":this.moduleId===this.mainStatusId.AGENT?"Agent Name":this.moduleId===this.mainStatusId.VENDOR?"Vendor Name":"Lead Name"}get enrollmentTableColumnCount(){let e=2;return this.showPropertyAddressColumn&&(e+=1),this.showCampaignColumn&&(e+=1),e}getSubmoduleDisplayName(e){return[e?.firstName,e?.lastName].filter(t=>t!=null&&t!="null"&&String(t).trim()!=="").join(" ").trim()||"N/A"}constructor(e,i,t,n,c){this._dialog=e,this._automationService=i,this._loaderService=t,this._toasterService=n,this._utilities=c,this.automationId="",this.moduleId="",this.actionGroups=[],this.delayPreferenceData={},this.enrollmentList=[],this.currentPage=1,this.totalEnrollment=0,this.itemsPerPage=10,this.isLoading=!1,this.showSearch=!0,this.searchText="",this.searchControl=new Xe(""),this.editData={},this.mainStatusId=O.MainStatusId,this.destroy$=new Be}ngOnInit(){this.searchControl.valueChanges.pipe(yt(500),Ct(),ue(this.destroy$)).subscribe(e=>{this.searchText=e??"",this.currentPage=1,this.getEnrollment()}),this.automationId&&this.getEnrollment()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getEnrollment(){let e={automationId:this.automationId,page:this.currentPage,limit:this.itemsPerPage};this.searchText&&(e.searchString=this.searchText),this.isLoading=!0,this._loaderService.start(),this._automationService.listEnrollment(e).subscribe({next:i=>{this.enrollmentList=i?.data?.data||[],this.totalEnrollment=i?.data?.count??0,this.isLoading=!1,this._loaderService.stop()},error:i=>{this.isLoading=!1,this._loaderService.stop(),this._toasterService.showError(i?.error?.message??"Failed to load enrollment list.")}})}goToPage(e){e>=1&&e<=this.totalPages&&e!==this.currentPage&&(this.currentPage=e,this.getEnrollment())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.getEnrollment()}
25showDetails(e){this.editData=JSON.parse(JSON.stringify(e))}moveBack(){this.editData={}}stopAutomation(e){this.dialogRef=this._dialog.open(Pi,{disableClose:!0,width:"500px",panelClass:"re-new-custom-dialog",data:{moduleId:this.moduleId}}),this.dialogRef.afterClosed().pipe(ue(this.destroy$)).subscribe(i=>{i&&this.callStopAutomation(e)})}callStopAutomation(e){let i={automationId:this.automationId,subModuleId:e?.subModuleId};this._loaderService.start(),this._automationService.stopAutomation(i).subscribe({next:()=>{this.getEnrollment(),this._loaderService.stop()},error:t=>{this._loaderService.stop()}})}get totalPages(){return Math.ceil(this.totalEnrollment/this.itemsPerPage)}formatDateInTimezone(e,i,t="dateTime"){if(e==null||e==="")return"";let n=i?.trim()||void 0,c;if(typeof e=="number")c=new Date(e);else{let S=String(e).trim(),v=Number(S);!isNaN(v)&&S.length>0&&S.length<=15&&/^\d+$/.test(S)?c=new Date(v):c=new Date(S)}if(isNaN(c.getTime()))return"";let f=t==="dateOnly"?{timeZone:n,month:"short",day:"2-digit",year:"numeric"}:{timeZone:n,month:"short",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return c.toLocaleString("en-US",f).replace(/, (?=\d{1,2}:\d{2}\s?[AP]M$)/," ")}static{this.\u0275fac=function(i){return new(i||o)(E(ve),E(Me),E(H),E(Y),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation-enrollment"]],inputs:{automationId:"automationId",moduleId:"moduleId",actionGroups:"actionGroups",delayPreferenceData:"delayPreferenceData"},standalone:!1,decls:6,vars:3,consts:[[1,"inline-flex","items-center","gap-[20px]","mb-[20px]"],[1,"text-h2","text-transparency-100","font-semibold"],[1,"flex","flex-col","items-start","overflow-hidden","mb-[20px]"],[1,"w-full","overflow-auto"],[3,"showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],[3,"detailData","calledFrom","automationId","actionGroups","moduleId","delayPreferenceData"],[3,"searchChange","pageChange","pageSizeChange","showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","'180px'"],["appTh",""],["appTr","",1,"group/item","cursor-pointer"],["appTr","",1,"group/item","cursor-pointer",3,"click"],["appTd","",1,"text-p","break-all"],[1,"inline-block","items-center","text-sub-heading","leading-[normal]","font-medium","px-[8px]","py-[5px]","rounded-[20px]","text-tags-brighter-red","bg-tags-brighter-red-bg","shrink-0"],["appTd","",1,"text-p"],[1,"text-transparency-100"],[1,"group-hover/item:hidden"],[1,"hidden","items-center","justify-center","gap-[10px]","group-hover/item:flex"],["src","assets/images/icons/show-action-btn.svg","alt","show-action-btn","width","28","pTooltip","Show","tooltipPosition","top",1,"img-fluid","cursor-pointer",3,"click"],["src","assets/images/icons/share-action-btn.svg","alt","share-action-btn","width","28","pTooltip","Stop Automation","tooltipPosition","top",1,"img-fluid","cursor-pointer"],["src","assets/images/icons/share-action-btn.svg","alt","share-action-btn","width","28","pTooltip","Stop Automation","tooltipPosition","top",1,"img-fluid","cursor-pointer",3,"click"],["appTd","",1,"py-6","text-center","text-gray-500"],[3,"moveBackEmitter","detailData","calledFrom","automationId","actionGroups","moduleId","delayPreferenceData"]],template:function(i,t){i&1&&(r(0,"div",0),x(1,ux,2,0,"h2",1),a(),r(2,"div",2)(3,"div",3),x(4,Sx,14,20,"app-table-container",4),x(5,Tx,1,6,"app-automation-activity-and-enrollment-detail",5),a()()),i&2&&(s(),g(t.editData!=null&&t.editData._id?-1:1),s(3),g(t.editData!=null&&t.editData._id?-1:4),s(),g(t.editData!=null&&t.editData._id?5:-1))},dependencies:[Tt,vt,Et,wt,It,he,Zn],encapsulation:2})}}return o})()});function Ax(o,l){o&1&&(r(0,"th",8),p(1,"Campaign"),a())}function Mx(o,l){if(o&1&&(r(0,"h4",23),p(1),a(),r(2,"h5",24),p(3),a()),o&2){let e=d().$implicit,i=d(2);m("appTooltip",(e==null||e.submoduleData==null?null:e.submoduleData.propertyType)==="land"?(e==null||e.submoduleData==null?null:e.submoduleData.apn)||"N/A":(e==null||e.submoduleData==null?null:e.submoduleData.address)||"N/A"),s(),T(" ",(e==null||e.submoduleData==null?null:e.submoduleData.propertyType)==="land"?(e==null||e.submoduleData==null?null:e.submoduleData.apn)||"N/A":(e==null||e.submoduleData==null?null:e.submoduleData.address)||"N/A"," "),s(2),T(" ",i.getSubmoduleDisplayName(e==null?null:e.submoduleData)," ")}}function Ox(o,l){if(o&1&&(r(0,"h4",14),p(1),a()),o&2){let e=d().$implicit,i=d(2);s(),T(" ",i.getSubmoduleDisplayName(e==null?null:e.submoduleData)," ")}}function Dx(o,l){o&1&&(r(0,"div",15),p(1," Automation Finished "),a())}function Vx(o,l){if(o&1&&(r(0,"td",11),p(1),a()),o&2){let e=d().$implicit;s(),T(" ",(e==null||e.submoduleData==null||e.submoduleData.campaignData==null?null:e.submoduleData.campaignData.name)||"N/A"," ")}}function Nx(o,l){if(o&1){let e=C();r(0,"tr",10),y("click",function(){let t=u(e).$implicit,n=d(2);
25return _(n.showDetails(t))}),r(1,"td",11)(2,"div",12)(3,"div",13),x(4,Mx,4,3)(5,Ox,2,1,"h4",14),a(),x(6,Dx,2,0,"div",15),a()(),x(7,Vx,2,1,"td",11),r(8,"td",11)(9,"div",16)(10,"div",17),h(11,"img",18),a(),r(12,"div",13)(13,"div",19)(14,"h4",20),p(15),r(16,"span",21),p(17),a()()()()()(),r(18,"td",11)(19,"div",22)(20,"span"),p(21),a()()()()}if(o&2){let e=l.$implicit,i=d(2);s(4),g(i.showPropertyAddressColumn?4:5),s(2),g(i.isAutomationFinished(e)?6:-1),s(),g(i.showCampaignColumn?7:-1),s(4),m("src",Vt(e==null||e.workflowStep==null?null:e.workflowStep.icon),ge),s(4),T(" ",e==null||e.workflowStep==null?null:e.workflowStep.stepName," "),s(2),je("(Step: ",e==null||e.workflowStep==null?null:e.workflowStep.stepOrder,"/",e==null?null:e.totalAutomationJobs,")"),s(4),ce(i.formatDateInTimezone(e==null?null:e.workflowSnapshotAt,i.delayPreferenceData==null?null:i.delayPreferenceData.timezone,"dateTime"))}}function kx(o,l){if(o&1&&(r(0,"tr",6)(1,"td",25),p(2," No data found "),a()()),o&2){let e=d(2);m("hoverable",!1),s(),ct("colspan",e.activityTableColumnCount)}}function Bx(o,l){if(o&1){let e=C();r(0,"app-table-container",4),y("searchChange",function(t){u(e);let n=d();return _(n.searchControl.setValue(t))})("pageChange",function(t){u(e);let n=d();return _(n.goToPage(t))})("pageSizeChange",function(t){u(e);let n=d();return _(n.onItemsPerPageChange(t))}),r(1,"table",5)(2,"thead")(3,"tr",6)(4,"th",7),p(5),a(),x(6,Ax,2,0,"th",8),r(7,"th",8),p(8,"Last Action"),a(),r(9,"th",8),p(10,"Last Execution On"),a()()(),r(11,"tbody"),D(12,Nx,22,9,"tr",9,Ix),x(14,kx,3,2,"tr",6),a()()()}if(o&2){let e=d();m("showViewType",!1)("showPagination",!0)("pagination",bt(13,wx,e.currentPage,e.totalPages,e.totalActivity,e.itemsPerPage,pt(12,Ex)))("showSearch",e.showSearch)("searchPlaceholder","Search data")("searchTerm",e.searchText)("loading",e.isLoading),s(),m("bordered",!0),s(2),m("hoverable",!1),s(2),ce(e.activityPrimaryColumnLabel),s(),g(e.showCampaignColumn?6:-1),s(6),V(e.activityList),s(2),g(e.activityList!=null&&e.activityList.length?-1:14)}}function Px(o,l){if(o&1){let e=C();r(0,"app-automation-activity-and-enrollment-detail",26),y("moveBackEmitter",function(){u(e);let t=d();return _(t.moveBack())}),a()}if(o&2){let e=d();m("detailData",e.editData)("calledFrom","Activity")("automationId",e.automationId)("actionGroups",e.actionGroups)("moduleId",e.moduleId)("delayPreferenceData",e.delayPreferenceData)}}var Ex,wx,Ix,Xa,Oo=ee(()=>{se();$e();dt();Mt();Re();W();at();Ce();Ee();xe();Ve();ri();li();eo();Ex=()=>[10,25,50,100],wx=(o,l,e,i,t)=>({currentPage:o,totalPages:l,totalCount:e,pageSize:i,pageSizeOptions:t}),Ix=(o,l)=>(l==null?null:l._id)??o;Xa=(()=>{class o{get showPropertyAddressColumn(){return![this.mainStatusId.BUYER,this.mainStatusId.AGENT,this.mainStatusId.VENDOR].includes(this.moduleId)}get showCampaignColumn(){return this.moduleId!==this.mainStatusId.LISTSTACKING}get activityTableColumnCount(){return this.showCampaignColumn?4:3}get activityPrimaryColumnLabel(){return this.moduleId===this.mainStatusId.BUYER?"Buyer Name":this.moduleId===this.mainStatusId.AGENT?"Agent Name":this.moduleId===this.mainStatusId.VENDOR?"Vendor Name":"Property Address/APN"}getSubmoduleDisplayName(e){return[e?.firstName,e?.lastName].filter(t=>t!=null&&String(t).trim()!=="").join(" ").trim()||"N/A"}constructor(e,i,t,n){this._automationService=e,this._loaderService=i,this._toastrService=t,this._utilities=n,this.automationId="",this.moduleId="",this.actionGroups=[],this.delayPreferenceData={},this.activityList=[],this.currentPage=1,this.totalActivity=0,this.itemsPerPage=10,this.isLoading=!1,this.showSearch=!0,this.searchText="",this.searchControl=new Xe(""),this.editData={},this.mainStatusId=O.MainStatusId,this.destroy$=new Be}ngOnInit(){this.searchControl.valueChanges.pipe(yt(500),Ct(),ue(this.destroy$)).subscribe(e=>{this.searchText=e??"",this.currentPage=1,this.getActivity()}),this.automationId&&this.getActivity()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getActivity(){let e={automationId:this.automationId,moduleId:this.moduleId,page:this.currentPage,limit:this.itemsPerPage,isHistory:!0,sortBy:"workflowSnapshotAt"};this.searchText&&(e.searchString=this.searchText),this.isLoading=!0,this._loaderService.start(),this._automationService.j
25obList(e).subscribe({next:i=>{let t=i?.data?.data||[];this.activityList=t.map(n=>{if(n?.workflowStep?.stepType){let c=this.getActionByType(n.workflowStep.stepType);return P(M({},n),{workflowStep:P(M({},n.workflowStep),{stepName:c?.name??"N/A",icon:c?.icon??""})})}return n}),console.log("activityList---------------",this.activityList),this.totalActivity=i?.data?.count??0,this.isLoading=!1,this._loaderService.stop()},error:i=>{this.isLoading=!1,this._loaderService.stop(),this._toastrService.showError(i?.error?.message??"Failed to load activity.")}})}goToPage(e){e>=1&&e<=this.totalPages&&e!==this.currentPage&&(this.currentPage=e,this.getActivity())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.getActivity()}getActionByType(e){let i=(n,c)=>{for(let f of c||[]){let S=f?.actions?.find(v=>v?.type===n);if(S)return S}return null},t=i(e,this.actionGroups)||i(e,Q.actionGroups);if(t)return t;if(e==="MARK_VIP"){let n=i("MARK_HOT",this.actionGroups)||i("MARK_HOT",Q.actionGroups);if(n)return P(M({},n),{name:"Mark/Unmark as VIP",type:"MARK_VIP"})}return e==="WHO_OWNS_THIS_CONTACT"?M({},Q.whoOwnsThisContactAction):null}showDetails(e){this.editData=JSON.parse(JSON.stringify(e))}moveBack(){this.editData={}}isAutomationFinished(e){let i=e?.workflowStep?.stepOrder,t=e?.totalAutomationJobs;return i!=null&&t!=null&&i===t&&(e?.status==="COMPLETED"||e?.status==="FAILED")}get totalPages(){return Math.ceil(this.totalActivity/this.itemsPerPage)}formatDateInTimezone(e,i,t="dateTime"){if(e==null||e==="")return"";let n=i?.trim()||void 0,c;if(typeof e=="number")c=new Date(e);else{let S=String(e).trim(),v=Number(S);!isNaN(v)&&S.length>0&&S.length<=15&&/^\d+$/.test(S)?c=new Date(v):c=new Date(S)}if(isNaN(c.getTime()))return"";let f=t==="dateOnly"?{timeZone:n,month:"short",day:"2-digit",year:"numeric"}:{timeZone:n,month:"short",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return c.toLocaleString("en-US",f).replace(/, (?=\d{1,2}:\d{2}\s?[AP]M$)/," ")}static{this.\u0275fac=function(i){return new(i||o)(E(Me),E(H),E(Y),E(q))}}static{this.\u0275cmp=B({type:o,selectors:[["app-automation-activity"]],inputs:{automationId:"automationId",moduleId:"moduleId",actionGroups:"actionGroups",delayPreferenceData:"delayPreferenceData"},standalone:!1,decls:4,vars:2,consts:[[1,"flex","flex-col","items-start","overflow-hidden","mb-[20px]"],[1,"w-full","overflow-auto"],[3,"showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],[3,"detailData","calledFrom","automationId","actionGroups","moduleId","delayPreferenceData"],[3,"searchChange","pageChange","pageSizeChange","showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","'180px'"],["appTh",""],["appTr","",1,"group/item","cursor-pointer"],["appTr","",1,"group/item","cursor-pointer",3,"click"],["appTd","",1,"text-p"],[1,"flex","items-center"],[1,"flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-p","text-primary-90","font-medium","truncate"],[1,"inline-block","items-center","text-sub-heading","leading-[normal]","font-medium","px-[8px]","py-[5px]","rounded-[20px]","text-tags-brighter-red","bg-tags-brighter-red-bg","shrink-0"],[1,"flex","items-center","gap-[8px]"],[1,"flex-none","bg-kanban-lightblue","rounded-pill","p-[5px]","flex","items-center","justify-center"],["alt","direct-mail-2-white","width","16","height","16",1,"img-fluid",3,"src"],[1,"flex","items-center","gap-[8px]","flex-wrap"],[1,"text-h4","font-medium","truncate"],[1,"text-transparency-90"],[1,"text-transparency-100"],["toolTipPosition","top",1,"text-p","text-primary-90","font-medium","truncate",3,"appTooltip"],[1,"text-label","text-transparency-90","font-medium","truncate","group-hover/item:text-transparency-100"],["appTd","",1,"py-6","text-center","text-gray-500"],[3,"moveBackEmitter","detailData","calledFrom","automationId","actionGroups","moduleId","delayPreferenceData"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1),x(2,Bx,15,19,"app-table-container",2),x(3,Px,1,6,"app-automation-activity-and-enrollment-detail",3),a()()),i&2&&(s(2),g(t.editData!=null&&t.editData._id?-1:2),s(),g(t.editData!=null&&t.editData._id?3:-1))},dependencies:[Z,Tt,vt,Et,wt,It,Zn],encapsulation:2})}}return o}
25)()});function Wx(o,l){if(o&1){let e=C();r(0,"tr",9)(1,"td",10)(2,"div",11)(3,"div",12)(4,"h4",13),p(5),a()()()(),r(6,"td",10),p(7),a(),r(8,"td",10)(9,"div",14)(10,"span",15),p(11),a(),r(12,"div",16)(13,"img",17),y("click",function(){let t=u(e).$implicit,n=d();return _(n.showLogFlow(t))}),a()()()()()}if(o&2){let e=l.$implicit,i=d();s(5),je(" ",(e==null?null:e.entityName)||"N/A"," ",i.formatDateInTimezone(e==null?null:e.createdAt,i.timezone,"dateOnly")," "),s(2),T(" ",e==null||e.userDetail==null?null:e.userDetail.name," "),s(4),ce(i.formatDateInTimezone(e==null?null:e.createdAt,i.timezone,"dateTime"))}}function jx(o,l){o&1&&(r(0,"tr",6)(1,"td",18),p(2," No data found "),a()()),o&2&&m("hoverable",!1)}var Rx,Fx,Ux,Za,Do=ee(()=>{se();$e();dt();W();at();Ce();Ee();xe();lt();Ft();ri();li();He();Rx=()=>[10,25,50,100],Fx=(o,l,e,i,t)=>({currentPage:o,totalPages:l,totalCount:e,pageSize:i,pageSizeOptions:t}),Ux=(o,l)=>(l==null?null:l._id)??o;Za=(()=>{class o{constructor(e,i,t,n,c,f){this._automationService=e,this._loaderService=i,this._toastrService=t,this._utilities=n,this._userService=c,this.router=f,this.automationId="",this.automationType="",this.moduleId="",this.actionGroups=[],this.delayPreferenceData={},this.logList=[],this.users=[],this.timezone="",this.currentPage=1,this.totalLog=0,this.itemsPerPage=10,this.isLoading=!1,this.showSearch=!1,this.searchText="",this.searchControl=new Xe(""),this.destroy$=new Be}ngOnInit(){this.searchControl.valueChanges.pipe(yt(500),Ct(),ue(this.destroy$)).subscribe(e=>{this.searchText=e??"",this.currentPage=1,this.getUpdateLog()}),this.automationId&&this.loadUsers(),this.applyTimezoneFromInput()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngOnChanges(e){e.delayPreferenceData&&this.applyTimezoneFromInput()}applyTimezoneFromInput(){this.delayPreferenceData?.timezone&&(this.timezone=this.delayPreferenceData.timezone)}formatDateInTimezone(e,i,t="dateTime"){if(e==null)return"";let n=i?.trim()||void 0,c=new Date(typeof e=="number"?e:Number(e));if(isNaN(c.getTime()))return"";let f=t==="dateOnly"?{timeZone:n,month:"short",day:"2-digit",year:"numeric"}:{timeZone:n,month:"short",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return c.toLocaleString("en-US",f).replace(/, (?=\d{1,2}:\d{2}\s?[AP]M$)/," ")}getUpdateLog(){let e={automationId:this.automationId,page:this.currentPage,limit:this.itemsPerPage};this.searchText&&(e.searchString=this.searchText),this.isLoading=!0,this._loaderService.start(),this._automationService.getSystemLogs(e).subscribe({next:i=>{let t=i?.data?.data||[];this.logList=t.filter(n=>n?.action!=="CREATE").map(n=>{let c=this.users?.findIndex(f=>f?._id===n?.mainUserId);return c>=0?P(M({},n),{userDetail:this.users[c]}):n}),this.totalLog=i?.data?.count??0,this.isLoading=!1,this._loaderService.stop()},error:i=>{this.isLoading=!1,this._loaderService.stop(),this._toastrService.showError(i?.error?.message??"Failed to load update log.")}})}goToPage(e){e>=1&&e<=this.totalPages&&e!==this.currentPage&&(this.currentPage=e,this.getUpdateLog())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.getUpdateLog()}loadUsers(){this._loaderService.start();let e={page:this.currentPage,limit:this.itemsPerPage,status:"active"};this._userService.getSubUserList(e).subscribe({next:i=>{i?.statusCode===200?(this.users=i?.data?.items||[],this._loaderService.stop(),this.getUpdateLog()):this._loaderService.stop()},error:()=>{this._loaderService.stop(),this._toastrService.showError("Unable to load users for update log.")}})}showLogFlow(e){let i=this.router.createUrlTree(["/automations/automation-logs"],{queryParams:{logId:e?._id,automationType:this.automationType,moduleId:this.moduleId}}).toString();window.open(i,"_blank")}get totalPages(){return Math.ceil(this.totalLog/this.itemsPerPage)}static{this.\u0275fac=function(i){return new(i||o)(E(Me),E(H),E(Y),E(q),E(De),E(ut))}}static{this.\u0275cmp=B({type:o,selectors:[["app-update-log"]],inputs:{automationId:"automationId",automationType:"automationType",moduleId:"moduleId",actionGroups:"actionGroups",delayPreferenceData:"delayPreferenceData"},standalone:!1,features:[z],decls:19,vars:17,consts:[[1,"flex","flex-col","items-start","overflow-hidden","mb
25-[20px]"],[1,"inline-flex","items-center","gap-[20px]","mb-[20px]"],[1,"text-h2","text-transparency-100","font-semibold"],[1,"w-full","overflow-auto"],[3,"searchChange","pageChange","pageSizeChange","showViewType","showPagination","pagination","showSearch","searchPlaceholder","searchTerm","loading"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","'180px'"],["appTh",""],["appTr",""],["appTd","",1,"text-p"],[1,"flex","items-center"],[1,"flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-p","text-primary-90","font-medium","truncate"],[1,"group/item","text-transparency-100"],[1,"group-hover/item:hidden"],[1,"hidden","items-center","justify-center","gap-[10px]","group-hover/item:flex"],["src","assets/images/icons/show-action-btn.svg","alt","show-action-btn","width","28","pTooltip","Show","tooltipPosition","top",1,"img-fluid","cursor-pointer",3,"click"],["appTd","","colspan","4",1,"py-6","text-center","text-gray-500"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h2",2),p(3,"Update Log"),a()(),r(4,"div",3)(5,"app-table-container",4),y("searchChange",function(c){return t.searchControl.setValue(c)})("pageChange",function(c){return t.goToPage(c)})("pageSizeChange",function(c){return t.onItemsPerPageChange(c)}),r(6,"table",5)(7,"thead")(8,"tr",6)(9,"th",7),p(10,"Name"),a(),r(11,"th",8),p(12,"Action by"),a(),r(13,"th",8),p(14,"Performed on"),a()()(),r(15,"tbody"),D(16,Wx,14,4,"tr",9,Ux),x(18,jx,3,1,"tr",6),a()()()()()),i&2&&(s(5),m("showViewType",!1)("showPagination",!0)("pagination",bt(11,Fx,t.currentPage,t.totalPages,t.totalLog,t.itemsPerPage,pt(10,Rx)))("showSearch",t.showSearch)("searchPlaceholder","Search data")("searchTerm",t.searchText)("loading",t.isLoading),s(),m("bordered",!0),s(2),m("hoverable",!1),s(8),V(t.logList),s(2),g(t.logList!=null&&t.logList.length?-1:18))},dependencies:[Tt,vt,Et,wt,It,he],encapsulation:2})}}return o})()});function Hx(o,l){o&1&&(r(0,"div",28)(1,"div",44),h(2,"div",45),r(3,"p",46),p(4," Loading automation components... "),a()()())}function Yx(o,l){if(o&1){let e=C();r(0,"app-button",47),y("click",function(){u(e);let t=d();return _(t.stopAutomation())}),a()}if(o&2){let e=d();m("leftIcon",!1)("disabled",e.editMode&&!e.hasChanges())}}function zx(o,l){if(o&1&&(r(0,"button",39),p(1),a()),o&2){let e=d();s(),T(" ",e.formatDateInTimezone(e.logData==null?null:e.logData.createdAt,e.delayPreferenceData==null?null:e.delayPreferenceData.timezone,"dateTime")," ")}}function Jx(o,l){if(o&1){let e=C();r(0,"div",40)(1,"div",48)(2,"button",49),y("click",function(){u(e);let t=d();return _(t.setTab("Builder"))}),h(3,"svg-icon",50),r(4,"span"),p(5,"Builder"),a()(),r(6,"button",49),y("click",function(){u(e);let t=d();return _(t.setTab("Automation Enrollment"))}),h(7,"svg-icon",51),r(8,"span"),p(9,"Automation Enrollment"),a()(),r(10,"button",49),y("click",function(){u(e);let t=d();return _(t.setTab("Automation Activity"))}),h(11,"svg-icon",52),r(12,"span"),p(13,"Automation Activity"),a()(),r(14,"button",49),y("click",function(){u(e);let t=d();return _(t.setTab("Update Log"))}),h(15,"svg-icon",53),r(16,"span"),p(17,"Update Log"),a()()(),r(18,"div",54),h(19,"svg-icon",55),r(20,"span"),p(21),a()()()}if(o&2){let e=d();s(2),m("ngClass",e.selectedTab=="Builder"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border text-primary-90":"border-transparent text-transparency-100"),s(),m("ngClass",Nt(9,to,e.selectedTab=="Builder",e.selectedTab!=="Builder")),s(3),m("ngClass",e.selectedTab=="Automation Enrollment"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border text-primary-90":"border-transparent text-transparency-100"),s(),m("ngClass",Nt(12,to,e.selectedTab=="Automation Enrollment",e.selectedTab!=="Automation Enrollment")),s(3),m("ngClass",e.selectedTab=="Automation Activity"?"bg-activity-outbound-hover-bg border-activity-outbound-hover-border text-primary-90":"border-transparent text-transparency-100"),s(),m("ngClass",Nt(15,to,e.selectedTab=="Automation Activity",e.selectedTab!=="Automation Activity")),s(3),m("ngClass",e.selectedTab=="Update Log"?"bg-activity-outboun
25d-hover-bg border-activity-outbound-hover-border text-primary-90":"border-transparent text-transparency-100"),s(),m("ngClass",Nt(18,to,e.selectedTab=="Update Log",e.selectedTab!=="Update Log")),s(6),T("Time Zone: ",e.timezoneDisplay)}}function Qx(o,l){if(o&1){let e=C();r(0,"div",78),y("click",function(){u(e);let t=d(3);return _(t.automationType!=="ACTIVITY_TRIGGER"&&!t.isViewOnly&&t.conversationalAiPreference())}),r(1,"div",70),h(2,"svg-icon",79),r(3,"div",80)(4,"h4",73),p(5," Conversational AI "),a(),r(6,"h5",74),p(7),a()()(),r(8,"div",75),h(9,"svg-icon",76),a()()}if(o&2){let e=d(3);de("cursor-pointer",e.automationType!=="ACTIVITY_TRIGGER"&&!e.isViewOnly)("cursor-not-allowed",e.automationType==="ACTIVITY_TRIGGER"||e.isViewOnly)("hover:bg-transparency-15",e.automationType!=="ACTIVITY_TRIGGER"&&!e.isViewOnly)("opacity-50",e.automationType==="ACTIVITY_TRIGGER"||e.isViewOnly),m("pTooltip",e.automationType==="ACTIVITY_TRIGGER"?"Not available for this automation":"Conversational AI"),s(7),T(" Default: ",e.newLeadPayload!=null&&e.newLeadPayload.isConversationalAI?"Enabled":"Disabled"," ")}}function $x(o,l){if(o&1){let e=C();r(0,"div",56)(1,"div",60)(2,"button",61),y("click",function(){u(e);let t=d(2);return _(t.onToggleSettings())}
25),h(3,"svg-icon",62),r(4,"span"),p(5,"Hide"),a()(),r(6,"div",63)(7,"div",64),h(8,"svg-icon",65),a(),r(9,"div",66)(10,"h3",67),p(11," Settings "),a()()()(),r(12,"div",68)(13,"div",69),y("click",function(){u(e);let t=d(2);return _(t.isDelayPreferenceRowDisabled?null:t.delayPreference())}),r(14,"div",70),h(15,"svg-icon",71),r(16,"div",72)(17,"h4",73),p(18," Delay Preference "),a(),r(19,"h5",74),p(20),a()()(),r(21,"div",75),h(22,"svg-icon",76),a()(),x(23,Qx,10,10,"div",77),a()()}if(o&2){let e=d(2);s(13),de("cursor-pointer",!e.isDelayPreferenceRowDisabled)("cursor-not-allowed",e.isDelayPreferenceRowDisabled)("hover:bg-transparency-15",!e.isDelayPreferenceRowDisabled)("opacity-50",e.isDelayPreferenceRowDisabled),s(7),T(" ",e.delayPreferenceData!=null&&e.delayPreferenceData.delayPreference&&(e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference)!="No Data"?e.delayPreferenceData==null?null:e.delayPreferenceData.delayPreference:""," "),s(3),g(e.isConversationalAiModule()?23:-1)}}function Kx(o,l){if(o&1){let e=C();r(0,"button",81),y("click",function(){u(e);let t=d(2);return _(t.onToggleSettings())}),h(1,"svg-icon",82),r(2,"h4",83),p(3,"Settings"),a(),r(4,"div",75),h(5,"svg-icon",84),a()()}}function Xx(o,l){if(o&1){let e=C();r(0,"img",96),y("click",function(t){u(e);let n=d(3);return t.stopPropagation(),_(n.addEditAutomation())}),a()}}function Zx(o,l){o&1&&h(0,"img",99)}function eg(o,l){if(o&1){let e=C();r(0,"img",101),y("click",function(){u(e);let t=d(5);return _(t.showActionList({},null,"root"))}),a()}if(o&2){let e=d(5);m("ngClass",rt(2,io,!e.isViewOnly))("src",e.isViewOnly?"assets/images/icons/plus-grey-circle-bg.svg":"assets/images/icons/add-teal.svg",ge)}}function tg(o,l){if(o&1&&(r(0,"div",97),x(1,Zx,1,0,"img",99),x(2,eg,1,4,"img",100),a()),o&2){let e=d(4);s(),g(e.hasFixedDefaultRootSteps()?1:-1),s(),g(e.hasFixedDefaultRootSteps()?-1:2)}}function ig(o,l){o&1&&Dt(0)}function ng(o,l){if(o&1&&Ne(0,ig,1,0,"ng-container",102),o&2){d();let e=Te(10);m("ngTemplateOutlet",e)}}function og(o,l){if(o&1){let e=C();r(0,"app-pipeline-select-box",119,3),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)("automationType",n.automationType)("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))}}function ag(o,l){if(o&1){let e=C();r(0,"app-speed-to-lead-box",120,4),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)}}function rg(o,l){if(o&1){let e=C();r(0,"app-assign-team-members-box",121,5),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)("automationType",n.automationType)("moduleId",n.moduleId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))("showFirstToAnswerOption",n.isFirstAssignTeamMembersInSequence(n.actionsAdded,t))("showDelayPreference",n.shouldShowAssignTeamMembersDelayPreference(n.actionsAdded,t))}}function lg(o,l){if(o&1){let e=C();r(0,"app-who-owns-this-contact",122,6),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)("automationType",n.automationType)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))("showDelayPreference",n.shouldShowWhoOwnsThisContactDelayPreference(n.actionsAdded,t))}}function sg(o,l){if(o&1){let e=C();r(0,"app-pipeline-change-box",123,7),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnl
25y",n.isViewOnly)("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))}}function dg(o,l){if(o&1){let e=C();r(0,"app-send-sms-box",124,8),y("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function cg(o,l){if(o&1){let e=C();r(0,"app-send-email-box",125,9),y("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("moduleId",n.moduleId)("isViewOnly",n.isViewOnly)}}function pg(o,l){if(o&1){let e=C();r(0,"app-add-notes-box",126,10),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function mg(o,l){if(o&1){let e=C();r(0,"app-add-folder-box",126,11),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function ug(o,l){if(o&1){let e=C();r(0,"app-add-task-box",127,12),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function _g(o,l){if(o&1){let e=C();r(0,"app-direct-mail-box",128,13),y("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("moduleId",n.moduleId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function hg(o,l){if(o&1){let e=C();r(0,"app-ai-calls-box",129,14),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function xg(o,l){if(o&1){let e=C();r(0,"app-webhook-box",126,15),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnl
25y",n.isViewOnly)}}function gg(o,l){if(o&1){let e=C();r(0,"app-block-incoming-communication",126,16),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function fg(o,l){if(o&1){let e=C();r(0,"app-mark-hot",130,17),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("markVariant",(i==null?null:i.type)==="MARK_VIP"?"vip":"hot")("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function yg(o,l){if(o&1){let e=C();r(0,"app-mark-returned-mail",126,18),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Cg(o,l){if(o&1){let e=C();r(0,"app-mark-lead-qualified-box",126,19),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function bg(o,l){if(o&1){let e=C();r(0,"app-move-to-call-flow",126,20),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Sg(o,l){if(o&1){let e=C();r(0,"app-move-to-other-automation",131,21),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("moduleId",n.moduleId)("automationId",n.editId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Tg(o,l){if(o&1){let e=C();r(0,"app-skip-trace-record",126,22),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function vg(o,l){if(o&1){let e=C();r(0,"app-manage-tags-box",132,23),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnl
25y",n.isViewOnly)("moduleId",n.moduleId)}}function Eg(o,l){if(o&1){let e=C();r(0,"app-manage-lists-box",126,24),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function wg(o,l){if(o&1){let e=C();r(0,"app-unassign-team-members",127,25),y("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Ig(o,l){if(o&1){let e=C();r(0,"app-notify-team-members",133,26),y("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Ag(o,l){if(o&1){let e=C();r(0,"app-stop-other-automation",134,27),y("timingChange",function(){u(e);let t=d(6);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(6);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(4);m("moduleId",n.moduleId)("automationId",n.editId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Mg(o,l){if(o&1&&h(0,"img",118),o&2){let e=d(6);m("src",(e.isViewOnly,"assets/images/icons/plus-grey-circle-bg.svg"),ge)}}function Og(o,l){if(o&1){let e=C();r(0,"img",101),y("click",function(){u(e);let t=d(2).$implicit,n=d(4);return _(n.showActionList(t,null,"root"))}),a()}if(o&2){let e=d(6);m("ngClass",rt(2,io,!e.isViewOnly))("src",e.isViewOnly?"assets/images/icons/plus-grey-circle-bg.svg":"assets/images/icons/add-teal.svg",ge)}}function Dg(o,l){o&1&&Dt(0)}function Vg(o,l){if(o&1&&Ne(0,Dg,1,0,"ng-container",102),o&2){d(3);let e=Te(10);m("ngTemplateOutlet",e)}}function Ng(o,l){if(o&1&&(r(0,"div",103),x(1,og,2,7,"app-pipeline-select-box",104)(2,ag,2,4,"app-speed-to-lead-box",105)(3,rg,2,11,"app-assign-team-members-box",106)(4,lg,2,10,"app-who-owns-this-contact",107)(5,sg,2,8,"app-pipeline-change-box",108)(6,dg,2,7,"app-send-sms-box",109)(7,cg,2,7,"app-send-email-box",110)(8,pg,2,6,"app-add-notes-box",111)(9,mg,2,6,"app-add-folder-box",111)(10,ug,2,7,"app-add-task-box",112)(11,_g,2,7,"app-direct-mail-box",113)(12,hg,2,7,"app-ai-calls-box",109)(13,xg,2,6,"app-webhook-box",111)(14,gg,2,6,"app-block-incoming-communication",111)(15,fg,2,7,"app-mark-hot",114)(16,yg,2,6,"app-mark-returned-mail",111)(17,Cg,2,6,"app-mark-lead-qualified-box",111)(18,bg,2,6,"app-move-to-call-flow",111)(19,Sg,2,8,"app-move-to-other-automation",115)(20,Tg,2,6,"app-skip-trace-record",111)(21,vg,2,7,"app-manage-tags-box",116)(22,Eg,2,6,"app-manage-lists-box",111)(23,wg,2,7,"app-unassign-team-members",112)(24,Ig,2,7,"app-notify-team-members",112)(25,Ag,2,8,"app-stop-other-automation",117),a(),r(26,"div",97),x(27,Mg,1,1,"img",118),x(28,Og,1,4,"img",100),a(),x(29,Vg,1,1,"ng-container")),o&2){let e,i=d(),t=i.$implicit,n=i.$index,c=d(4);s(),g((e=t==null?null:t.component)==="app-pipeline-select-box"?1:e==="app-speed-to-lead-box"?2:e==="app-assign-team-members-box"?3:e==="app-who-owns-this-contact"?4:e==="app-pipeline-change-box"?5:e==="app-send-sms-box"?6:e==="app-send-email-box"?7:e==="app-add-notes-box"?8:e==="app-add-folder-box"?9:e==="app-add-task-box"?10:e
25==="app-direct-mail-box"?11:e==="app-ai-calls-box"?12:e==="app-webhook-box"?13:e==="app-block-incoming-communication"?14:e==="app-mark-hot"?15:e==="app-mark-returned-mail"?16:e==="app-mark-lead-qualified-box"?17:e==="app-move-to-call-flow"?18:e==="app-move-to-other-automation"?19:e==="app-skip-trace-record"?20:e==="app-manage-tags-box"?21:e==="app-manage-lists-box"?22:e==="app-unassign-team-members"?23:e==="app-notify-team-members"?24:e==="app-stop-other-automation"?25:-1),s(26),g(n==0&&c.hasFixedDefaultRootStepPair()?27:-1),s(),g((n!=0||!c.hasFixedDefaultRootStepPair())&&(t==null?null:t.component)!=="app-move-to-other-automation"?28:-1),s(),g(c.actionListFor==="root"&&c.actionInsertAfterId===(t==null?null:t.actionId)?29:-1)}}function kg(o,l){o&1&&Dt(0)}function Bg(o,l){if(o&1&&Ne(0,kg,1,0,"ng-container",135),o&2){let e=d(),i=e.$implicit,t=e.$index;d();let n=Te(5);m("ngTemplateOutlet",n)("ngTemplateOutletContext",Nt(2,er,i,t))}}function Pg(o,l){if(o&1&&(x(0,Ng,30,4),x(1,Bg,1,5,"ng-container")),o&2){let e=l.$implicit;g((e==null?null:e.type)!=="ACTIVITY_TRIGGER"?0:-1),s(),g((e==null?null:e.type)==="ACTIVITY_TRIGGER"?1:-1)}}function Lg(o,l){if(o&1&&(r(0,"h4",142),p(1),a()),o&2){let e=d(2).eachAction;s(),T(" Preview: ",e==null||e.conditionData==null||e.conditionData.branches==null?null:e.conditionData.branches.length," Branches Added ")}}function Rg(o,l){if(o&1){let e=C();r(0,"div",103)(1,"div",137)(2,"div",138),h(3,"img",139),a(),r(4,"div",140)(5,"div",35)(6,"h2",141),p(7),a()(),x(8,Lg,2,1,"h4",142),a(),r(9,"div",143)(10,"div",144),p(11),a(),r(12,"div",145),y("click",function(){u(e);let t=d().eachAction,n=d(4);return _(n.deleteSteps(t==null?null:t.actionId))}),h(13,"svg-icon",146),a(),r(14,"div",147),y("click",function(){u(e);let t=d().eachAction;return _(t&&(t.expanded=!(t!=null&&t.expanded)))}),h(15,"img",148),a()()()()}if(o&2){let e=d(),i=e.eachAction,t=e.index;s(6),m("pTooltip",i==null||i.conditionData==null?null:i.conditionData.triggerType),s(),T(" Condition: ",i==null||i.conditionData==null?null:i.conditionData.triggerType," "),s(),g(i!=null&&i.expanded?-1:8),s(3),T(" Step ",t+1," "),s(3),m("ngClass",i!=null&&i.expanded?"rotate-180":"")}}function Fg(o,l){o&1&&Dt(0)}function Ug(o,l){if(o&1&&(r(0,"div",136),Ne(1,Fg,1,0,"ng-container",135),a()),o&2){let e=d().eachAction;d();let i=Te(7);s(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",Nt(2,Gx,e==null||e.conditionData==null?null:e.conditionData.branches,e==null||e.conditionData==null?null:e.conditionData.triggerType))}}function Wg(o,l){if(o&1&&(x(0,Rg,16,5,"div",103),x(1,Ug,2,5,"div",136)),o&2){let e=l.eachAction,i=d(4);g(i.automationType!="ACTIVITY_TRIGGER"?0:-1),s(),g(e!=null&&e.expanded?1:-1)}}function jg(o,l){o&1&&Dt(0)}function qg(o,l){if(o&1&&Ne(0,jg,1,0,"ng-container",102),o&2){d(3);let e=Te(10);m("ngTemplateOutlet",e)}}function Gg(o,l){if(o&1){let e=C();r(0,"app-pipeline-select-box",119,3),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)("automationType",n.automationType)("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))}}function Hg(o,l){if(o&1){let e=C();r(0,"app-speed-to-lead-box",120,4),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",n.isViewOnly)}}function Yg(o,l){if(o&1){let e=C();r(0,"app-assign-team-members-box",121,5),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d().$implicit,c=d(5);m("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnly",c.isViewOnly)("automationType",c.automationType)("moduleId",c.moduleId)("delayPreferenceData",c.delayPreferenceData)("timingSequenceError",c.getTimingSequenceError(i==null?null:i.actionId))("disableDelete",c.isLockedDefaultRootActionById(i==null?null:i.actionId))("showFirstToAnswerOption",c.isFirstAssignTeamMembersInSequence(n==null?null:n.actions,t))("showDelayPreference","true")}}function zg(o,l){if(o&1){let e=C();r(0,"app-who-owns-this-contact",122,6),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("payload",i==null?null:i.payload)("stepIndex",t)("actionId",i==null?null:i.actionId)("isViewOnl
25y",n.isViewOnly)("automationType",n.automationType)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))("showDelayPreference","true")}}function Jg(o,l){if(o&1){let e=C();r(0,"app-pipeline-change-box",123,7),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)("disableDelete",n.isLockedDefaultRootActionById(i==null?null:i.actionId))}}function Qg(o,l){if(o&1){let e=C();r(0,"app-send-sms-box",124,8),y("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function $g(o,l){if(o&1){let e=C();r(0,"app-send-email-box",125,9),y("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("moduleId",n.moduleId)("isViewOnly",n.isViewOnly)}}function Kg(o,l){if(o&1){let e=C();r(0,"app-add-notes-box",126,10),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Xg(o,l){if(o&1){let e=C();r(0,"app-add-folder-box",126,11),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function Zg(o,l){if(o&1){let e=C();r(0,"app-add-task-box",127,12),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function e1(o,l){if(o&1){let e=C();r(0,"app-direct-mail-box",125,13),y("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("moduleId",n.moduleId)("isViewOnly",n.isViewOnly)}}function t1(o,l){if(o&1){let e=C();r(0,"app-ai-calls-box",129,14),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnl
25y",n.isViewOnly)}}function i1(o,l){if(o&1){let e=C();r(0,"app-webhook-box",126,15),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function n1(o,l){if(o&1){let e=C();r(0,"app-block-incoming-communication",126,16),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function o1(o,l){if(o&1){let e=C();r(0,"app-mark-hot",130,17),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("markVariant",(i==null?null:i.type)==="MARK_VIP"?"vip":"hot")("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function a1(o,l){if(o&1){let e=C();r(0,"app-mark-returned-mail",126,18),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function r1(o,l){if(o&1){let e=C();r(0,"app-mark-lead-qualified-box",126,19),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function l1(o,l){if(o&1){let e=C();r(0,"app-move-to-call-flow",126,20),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function s1(o,l){if(o&1){let e=C();r(0,"app-move-to-other-automation",131,21),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("moduleId",n.moduleId)("automationId",n.editId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function d1(o,l){if(o&1){let e=C();r(0,"app-skip-trace-record",126,22),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnl
25y",n.isViewOnly)}}function c1(o,l){if(o&1){let e=C();r(0,"app-manage-tags-box",132,23),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)("moduleId",n.moduleId)}}function p1(o,l){if(o&1){let e=C();r(0,"app-manage-lists-box",126,24),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function m1(o,l){if(o&1){let e=C();r(0,"app-unassign-team-members",127,25),y("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))})("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function u1(o,l){if(o&1){let e=C();r(0,"app-notify-team-members",133,26),y("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("moduleId",n.moduleId)("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function _1(o,l){if(o&1){let e=C();r(0,"app-stop-other-automation",134,27),y("timingChange",function(){u(e);let t=d(8);return _(t.refreshTimingSequenceErrors())})("deleteBox",function(t){u(e);let n=d(8);return _(n.deleteSteps(t))}),a()}if(o&2){let e=d(2),i=e.$implicit,t=e.$index,n=d(6);m("moduleId",n.moduleId)("automationId",n.editId)("stepIndex",t)("actionId",i==null?null:i.actionId)("delayPreferenceData",n.delayPreferenceData)("timingSequenceError",n.getTimingSequenceError(i==null?null:i.actionId))("payload",i==null?null:i.payload)("isViewOnly",n.isViewOnly)}}function h1(o,l){if(o&1){let e=C();r(0,"img",101),y("click",function(){u(e);let t=d(2).$implicit,n=d().$implicit,c=d(5);return _(c.showActionList(t,n,"branch"))}),a()}if(o&2){let e=d(8);m("ngClass",rt(2,io,!e.isViewOnly))("src",e.isViewOnly?"assets/images/icons/plus-grey-circle-bg.svg":"assets/images/icons/add-teal.svg",ge)}}function x1(o,l){o&1&&Dt(0)}function g1(o,l){if(o&1&&Ne(0,x1,1,0,"ng-container",102),o&2){d(5);let e=Te(10);m("ngTemplateOutlet",e)}}function f1(o,l){o&1&&(r(0,"button",98),p(1," Stop "),a())}function y1(o,l){if(o&1&&(r(0,"div",103),x(1,Gg,2,7,"app-pipeline-select-box",104),x(2,Hg,2,4,"app-speed-to-lead-box",105),x(3,Yg,2,11,"app-assign-team-members-box",106),x(4,zg,2,10,"app-who-owns-this-contact",107),x(5,Jg,2,8,"app-pipeline-change-box",108),x(6,Qg,2,7,"app-send-sms-box",109),x(7,$g,2,7,"app-send-email-box",110),x(8,Kg,2,6,"app-add-notes-box",111),x(9,Xg,2,6,"app-add-folder-box",111),x(10,Zg,2,7,"app-add-task-box",112),x(11,e1,2,7,"app-direct-mail-box",110),x(12,t1,2,7,"app-ai-calls-box",109),x(13,i1,2,6,"app-webhook-box",111),x(14,n1,2,6,"app-block-incoming-communication",111),x(15,o1,2,7,"app-mark-hot",114),x(16,a1,2,6,"app-mark-returned-mail",111),x(17,r1,2,6,"app-mark-lead-qualified-box",111),x(18,l1,2,6,"app-move-to-call-flow",111),x(19,s1,2,8,"app-move-to-other-automation",115),x(20,d1,2,6,"app-skip-trace-record",111),x(21,c1,2,7,"app-manage-tags-box",116),x(22,p1,2,6,"app-manage-lists-box",111),x(23,m1,2,7,"app-unassign-team-members",112),x(24,u1,2,7,"app-notify-team-members",112),x(25,_1,2,8,"app-stop-other-automation",117),a(),r(26,"div",97),x(27,h1,1,4,"img",100),a(),x(28,g1,1,1,"ng-container"),r(29,"div",156),x(30,f1,2,0,"button",98),a()),o&2){let e=d(),i=e.$implicit,t=e.$index,n=d().$implicit,c=d(5);s(),g((i==null?null:i.component)==="app-pipeline-select-box"?1:-1),s(),g((i==null?null:i.component)==="app-speed-to-lead-box"?2:-1),s(),g((i==null?null:i.component)==="app-assign-team-members-box"?3:-1),s(),g((i==null?null:i.component)==="app-who-owns-this-contact"?4:-1),s(),g((i==null?null:i.component)==="app-pipeline-change-box"?5:-1),s(),g((i==null?null:i.component)==="app-send-sms-box"?6:-1),s(),g((i==null?null:i.component)==="app-send-email-box"?7:-1),s(),g((i==null?null:i.component)==="app-add-notes-box"?8:-1),s(),g((i==null?null:i.component)==="app-add-folder-box"?9:-1),s(),g((i==null?null:i.component)==="app-add-task-box"?10:-1),s(),g((i==null?null:i.component)==="app-direct-mail-box"?11:-1),s(),g((i==null?null:i.component)==="app-ai-calls-box"?12:-1),s(),g((i==null?null:i.component)==="app-webhook-box"?13:-1),s(),g((i==null?null:i.component)==="app-block-incoming-communication"?14:-1),s(),g((i==null?null:i.component)==="app-mark-hot"?15:-1),s(),g((i==null?null:i.component)==="app-mark-returned-mail"?16:-1),s(),g((i==null?null:i.component)==="app-mark-lead-qualified-box"?17:-1),s(),g((i==null?null:i.component)==="app-move-to-call-flow"?18:-1),s(),g((i==null?null:i.component)==="app-move-to-other-automation"?19:-1),s(),g((i==null?null:i.component)==="app-skip-trace-record"?20:-1),s(),g((i==null?null:i.component)==="app-manage-tags-box"?21:-1),s(),g((i==null?null:i.component)==="app-manage-lists-box"?22:-1),s(),g((i==null?null:i.component)==="app-unassign-team-members"?23:-1),s(),g((i==null?null:i.component)==="app-notify-team-members"?24:-1),s(),g((i==null?null:i.component)==="app-stop-other-automation"?25:-1),s(2),g((i==null?null:i.component)!=="app-move-to-other-automation"?27:-1),s(),g(c.actionListFor==="branch-"+((n==null?null:n.branchId)||"")&&c.actionInsertAfterId===(i==null?null:i.actionId)?28:-1),s(2),g((n==null||n.actions==null?null:n.actions.length)===t+1||(i==null?null:i.component)==="app-move-to-other-automation"?30:-1)}}function C1(o,l){o&1&&Dt(0)}function b1(o,l){if(o&1&&Ne(0,C1,1,0,"ng-container",135),o&2){let e=d(),i=e.$implicit,t=e.$index;d(3);let n=Te(5);m("ngTemplateOutlet",n)("ngTemplateOutletContext",Nt(2,er,i,t))}}function S1(o,l){if(o&1&&(x(0,y1,31,28),x(1,b1,1,5,"ng-container")),o&2){let e=l.$implicit;g((e==null?null:e.type)!=="ACTIVITY_TRIGGER"?0:-1),s(),g((e==null?null:e.type)==="ACTIVITY_TRIGGER"?1:-1)}}function T1(o,l){if(o&1){let e=C();r(0,"div",149)(1,"div",150)(2,"div",151),h(3,"img",152),a(),r(4,"div",153)(5,"h2",154),p(6),a(),r(7,"h4",155),p(8),a()()(),r(9,"div",97)(10,"img",101),y("click",function(){let t=u(e).$implicit,n=d(5);return _(n.showActionList(null,t,"branch"))}),a()(),x(11,qg,1,1,"ng-container"),D(12,S1,2,2,null,null,k),a()}if(o&2){let e=l.$implicit,i=d().conditionTriggerType,t=d(4);s(6),T(" ",e==null?null:e.branchName," "),s(),m("pTooltip",t.conditionBranchOutcomeSubtitle(e,i)),s(),T(" ",t.conditionBranchOutcomeSubtitle(e,i)," "),s(2),m("ngClass",rt(6,io,!t.isViewOnl
25y))("src",t.isViewOnly?"assets/images/icons/plus-grey-circle-bg.svg":"assets/images/icons/add-teal.svg",ge),s(),g(t.actionListFor==="branch-"+((e==null?null:e.branchId)||"")&&t.actionInsertAfterId===null?11:-1),s(),V(e==null?null:e.actions)}}function v1(o,l){if(o&1&&D(0,T1,14,8,"div",149,k),o&2){let e=l.branches;V(e)}}function E1(o,l){o&1&&(r(0,"button",98),p(1," Stop "),a())}function w1(o,l){if(o&1&&(r(0,"span",175),p(1),a()),o&2){let e=d(2).$implicit;s(),T(" ",e==null?null:e.description," ")}}function I1(o,l){if(o&1){let e=C();r(0,"div",170),y("click",function(){u(e);let t=d().$index,n=d().$index,c=d(5);return _(c.selectAction(n,t))}),r(1,"div",171),h(2,"svg-icon",172),a(),r(3,"div",173)(4,"h4",174),p(5),a(),x(6,w1,2,1,"span",175),a()()}if(o&2){let e=d().$implicit;ai("cursor-pointer hover:bg-transparency-15"),s(),ai(e==null?null:e.bgColor),s(),m("src",(e==null?null:e.type)==="MARK_VIP"?"assets/images/icons/vip.svg":e==null?null:e.icon),s(2),m("pTooltip",Vt(e==null?null:e.name)),s(),T(" ",e==null?null:e.name," "),s(),g(e!=null&&e.description?6:-1)}}function A1(o,l){if(o&1&&x(0,I1,7,9,"div",169),o&2){let e=l.$implicit;g(e!=null&&e.hide?-1:0)}}function M1(o,l){o&1&&h(0,"img",168)}function O1(o,l){if(o&1&&(r(0,"div",165)(1,"div",166)(2,"h3",46),p(3),a()(),r(4,"div",167),D(5,A1,1,1,null,null,k),a()(),x(7,M1,1,0,"img",168)),o&2){let e=l.$implicit,i=l.$index,t=d(5);s(3),T(" ",e==null?null:e.name," "),s(2),V(e==null?null:e.actions),s(2),g(i<t.filteredActionGroups.length-1?7:-1)}}function D1(o,l){if(o&1){let e=C();r(0,"div",157)(1,"div",158)(2,"div",159),h(3,"img",160),r(4,"input",161),A("ngModelChange",function(t){u(e);let n=d(4);return I(n.searchTerm,t)||(n.searchTerm=t),_(t)}),y("input",function(t){u(e);let n=d(4);return _(n.onSearchChange(t.target.value))}),a()(),r(5,"div",162)(6,"svg-icon",163),y("click",function(){u(e);let t=d(4);return _(t.actionListFor="")}),a()()(),r(7,"div",164),D(8,O1,8,2,null,null,k),a()()}if(o&2){let e=d(4);s(4),w("ngModel",e.searchTerm),s(4),V(e.filteredActionGroups)}}function V1(o,l){if(o&1&&(x(0,tg,3,2,"div",97),x(1,ng,1,1,"ng-container"),D(2,Pg,2,2,null,null,k),Ne(4,Wg,2,2,"ng-template",null,0,ze)(6,v1,2,0,"ng-template",null,1,ze),x(8,E1,2,0,"button",98),Ne(9,D1,10,1,"ng-template",null,2,ze)),o&2){let e=d(3);g(e.automationType!="ACTIVITY_TRIGGER"?0:-1),s(),g(e.automationType!="ACTIVITY_TRIGGER"&&!e.hasFixedDefaultRootSteps()&&e.actionListFor==="root"&&!e.actionInsertAfterId?1:-1),s(),V(e.actionsAdded),s(6),g(e.shouldShowStopButton()?8:-1)}}function N1(o,l){if(o&1){let e=C();r(0,"div",59)(1,"div",85)(2,"div",86)(3,"div",87),h(4,"img",88),a(),r(5,"div",89)(6,"div",90)(7,"h2",91),p(8),a(),x(9,Xx,1,0,"img",92),a(),r(10,"h4",93),p(11),a()()(),r(12,"div",94),y("click",function(){u(e);let t=d(2);return _(!t.isViewOnly&&t.onToggleExpanded())}),h(13,"img",95),a()(),x(14,V1,11,3),a()}if(o&2){let e=d(2);s(),m("ngClass",e.isViewOnly?"bg-transparency-90 cursor-not-allowed":"bg-primary-90 cursor-pointer"),s(3),m("src",e.isViewOnly?"assets/images/icons/selected-action.svg":"assets/images/icons/selected-action-black-bg.svg",ge),s(3),m("ngClass",e.isViewOnly?"text-transparency-black":"text-transparency-white"),s(),T(" ",e.moduleName," "),s(),g(e.isViewOnly?-1:9),s(),m("ngClass",e.isViewOnly?"text-transparency-black":"text-transparency-white"),s(),T(" ",e.automationName," "),s(),m("ngClass",e.isExpanded?"rotate-180":""),s(2),g(e.isExpanded?14:-1)}}function k1(o,l){if(o&1&&(r(0,"div",41),x(1,$x,24,10,"div",56),x(2,Kx,6,0,"button",57),r(3,"div",58),x(4,N1,15,9,"div",59),a()()),o&2){let e=d();s(),g(e.isSettingsCollapsed?-1:1),s(),g(e.isSettingsCollapsed?2:-1),s(2),g(e.editId?4:-1)}}function B1(o,l){if(o&1&&h(0,"app-automation-enrollment",42),o&2){let e=d();m("automationId",e.editId)("moduleId",e.moduleId)("actionGroups",e.actionGroups)("delayPreferenceData",e.delayPreferenceData)}}function P1(o,l){if(o&1&&h(0,"app-automation-activity",42),o&2){let e=d();m("automationId",e.editId)("moduleId",e.moduleId)("actionGroups",e.actionGroups)("delayPreferenceData",e.delayPreferenceData)}}function L1(o,l){if(o&1&&h(0,"app-update-log",43),o&2){let e=d();m("automationId",e.editId)("moduleId",e.moduleId)("automationType",e.automationType)("actionGroups",e.actionGroups)("delayPreferenceData",e.delayPreferenceData)}}var to,io,er,Gx,ni,Vo=ee(()=>{$e();dt();en();nn();an();ln();dn();un();hn();gn();yn();bn();Tn();En();An();$i();On();Vn();kn();Pn();Rn();Un();jn();Gn();Yn();Jn();wo();$n();Xn();Io();Ao();vr();Mt();ia();Re();W();fe();at();Ea();si();lt();St();Ft();Ce();Ee();xe();Tr();be();se();pe();kt();He();ln();nn();an();en();hn();un();gn();yn();Tn();bn();dn();En();An();Vn();On();kn();Pn();Rn();Un();jn();Gn();Yn();Jn();$n();Xn();Mo();Oo();Do();to=(o,l)=>({"text-primary-90":o,"text-transparency-90":l}),io=o=>({"cursor-pointer":o}),er=(o,l)=>({eachAction:o,index:l}),Gx=(o,l)=>({branches:o,conditionTriggerType:l});ni=class o{static{this.USER_ID_OUTCOME_TRIGGER_TYPES=new Set(["Who owns this Buyer","Who owns this Agent","Who owns this Vendor","Who owns this contact","Team assignment by member"])}static{this.ROLE_ID_OUTCOME_TRIGGER_TYPES=new Set(["Team assignment by role"])}get allBoxQueryLists(){return[this.pipelineSelectBoxComponent,this.pipelineChangeBoxComponent,this.assignTeamMembersBoxComponent,this.whoOwnsThisContactComponent,this.speedToLeadBoxComponent,this.sendSmsBoxComponent,this.sendEmailBoxComponent,this.addNotesBoxComponent,this.addFolderBoxComponent,this.addTaskBoxComponent,this.directMailBoxComponent,this.aiCallsBoxComponent,this.manageTagsBoxComponent,this.manageListsBoxComponent,this.webhookBoxComponent,this.blockIncomingCommunicationComponent,this.markReturnedMailComponent,this.markLeadQualifiedBoxComponent,this.markHotComponent,this.moveToCallFlowComponent,this.moveToOtherAutomationComponent,this.skipTraceRecordComponent,this.unassignTeamMembersComponent,this.notifyTeamMembersComponent,this.stopOtherAutomationComponent].filter(l=>l!=null)}get isDelayPreferenceRowDisabled(){let l=(this.delayPreferenceData?.timezone??"").toString().trim();
25return this.isViewOnly||this.editMode&&l}hasChanges(){if(!this.editMode||this.hasStepChanges())return!0;let l=e=>e?.length>0?e.some(i=>i.hasChanges&&i.hasChanges()):!1;for(let e of this.allBoxQueryLists)if(l(e))return!0;return!1}formatDateInTimezone(l,e,i="dateTime"){if(l==null||l===void 0)return"";let t=e?.trim()||void 0,n=new Date(typeof l=="number"?l:Number(l));if(isNaN(n.getTime()))return"";let c=i==="dateOnly"?{timeZone:t,month:"short",day:"2-digit",year:"numeric"}:{timeZone:t,month:"short",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return n.toLocaleString("en-US",c)}captureInitialActionIds(){this.initialActionIds=this.getAllActionIds(this.actionsAdded)}getAllActionIds(l){let e=new Set,i=t=>{for(let n of t||[])if(n?.actionId&&e.add(n.actionId),n?.type==="ACTIVITY_TRIGGER"&&n?.conditionData?.branches)for(let c of n.conditionData.branches||[])i(c?.actions||[])};return i(l),e}hasStepChanges(){if(this.initialActionIds.size===0&&this.actionsAdded.length===0)return!1;let l=this.getAllActionIds(this.actionsAdded);for(let e of this.initialActionIds)if(!l.has(e))return!0;for(let e of l)if(!this.initialActionIds.has(e))return!0;return!1}constructor(l,e,i,t,n,c,f,S,v,b,N,j,Fe){this._dialog=l,this._automationService=e,this._accountingService=i,this._marketingCampaignService=t,this._userService=n,this._commonService=c,this.route=f,this._router=S,this._loaderService=v,this._toastrService=b,this._utilities=N,this._commonAiAgentsService=j,this._cdr=Fe,this.destroy$=new Be,this.selectedTab="Builder",this.actionsAdded=[],this.searchTerm="",this.initialActionIds=new Set,this.actionGroups=Q.actionGroups,this.filteredActionGroups=[],this.actionIndex=-1,this.actionListFor="",this.automationName="",this.editId="",this.moduleId="",this.moduleName="",this.campaignTitleById={},this.vendorCategoryTitleById={},this.userDisplayNameById={},this.roleDisplayNameById={},this.callOutcomeTitleById={},this.newLeadPayload={},this.delayPreferenceData={},this.timingSequenceErrors={},this.selectedBranchId=null,this.actionInsertAfterId=null,this.automationType="",this.automationConstant=Q,this.automationGroupName="",this.timezoneDisplay="N/A",this.isExpanded=!0,this.isViewOnly=!1,this.logData={},this.editMode=!1,this.isSettingsCollapsed=!1,this.mainStatusId=O.MainStatusId,this.isLoadingChildComponents=!1,this.viewCheckedCount=0,this.maxViewChecks=100,this.minWaitTime=30}ngOnInit(){this.updateFilteredActionGroups(),this.route.queryParams.pipe(ue(this.destroy$)).subscribe(l=>{this.automationType=l.automationType||"",this.moduleId=l.moduleId||"",this.applyActionGroupsForModule(),this.getAutomationGroupName(),this.updateFilteredActionGroups(),l.id?(this.editId=l.id,this.editMode=!0,this.isSettingsCollapsed=!0,this.getDetail()):l.logId?(this.isViewOnly=!0,this.isSettingsCollapsed=!0,this.getLogDetail(l.logId)):(this.initialize(),this.addIds(this.actionsAdded),this.addEditAutomation(!0)),this.loadConditionOutcomeLookups()})}ngAfterViewInit(){this.actionsAdded?.length>0&&this.isLoadingChildComponents}ngAfterViewChecked(){this.isLoadingChildComponents&&(this.viewCheckedCount++,this.viewCheckedCount>this.maxViewChecks&&this.stopChildComponentsLoading())}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.childComponentsCheckInterval&&clearInterval(this.childComponentsCheckInterval)}initialize(){let l=this.automationConstant.AutomationType.flatMap(i=>i?.children||[]).find(i=>i?.path===this.automationType&&i?.moduleId===this.moduleId);if(!l)return null;let e=JSON.parse(JSON.stringify(l));this.moduleId=e?.moduleId,this.moduleName=e?.label}getAutomationGroupName(){let l="";return this.automationConstant.AutomationType.forEach(e=>{e?.children?.forEach(i=>{i?.path===this.automationType&&i?.moduleId===this.moduleId&&(l=e?.label||"")})}),this.automationGroupName=l,l}onToggleExpanded(){this.isExpanded=!this.isExpanded}onToggleSettings(){this.isSettingsCollapsed=!this.isSettingsCollapsed}isFirstAssignTeamMembersInSequence(l,e){if(!l?.length||e<0||e>=l.length||l[e]?.type!=="ASSIGN_TEAM_MEMBERS")return!1;for(let i=0;i<e;i++)if(l[i]?.type==="ASSIGN_TEAM_MEMBERS")return!1;return!0}shouldShowAssignTeamMembersDelayPreference(l,e){return this.automationType!=="LEAD_CREATED"?!0:!this.isFirstAssignTeamMembersInSequence(l,e)}isFirstWhoOwnsThisContactInSequence(l,e){if(!l?.length||e<0||e>=l.length||l[e]?.type!=="WHO_OWNS_THIS_CONTACT")return!1;for(let i=0;i<e;i++)if(l[i]?.type==="WHO_OWNS_THIS_CONTACT")return!1;return!0}shouldShowWhoOwnsThisContactDelayPreference(l,e){return this.automationType!=="NEW_BUYER_ADDED"&&this.automationType!=="NEW_AGENT_ADDED"&&this.automationType!=="NEW_VENDOR_ADDED"?!0:!this.isFirstWhoOwnsThisContactInSequence(l,e)}getDetail(){let l={id:this.editId};this._loaderService.start(),this._automationService.getAutomationDetail(l).subscribe(e=>{e?.statusCode===200&&(this.newLeadPayload=e?.data||{},this.setActionTree()),this._loaderService.stop()},e=>this._loaderService.stop())}getLogDetail(l){let e={logId:l};this._loaderService.start(),this._automationService.getLogDetail(e).subscribe(i=>{i?.statusCode===200&&(this.logData=i?.data?.items||{},this.newLeadPayload=i?.data?.items?.wholeObject||{},this.setActionTree()),this._loaderService.stop()},i=>this._loaderService.stop())}setActionTree(){this.automationType=this.newLeadPayload?.automationType||"",this.moduleId=this.newLeadPayload?.moduleId||"",this.normalizeModuleId(),this.initialize(),this.applyActionGroupsForModule(
25),this.updateFilteredActionGroups(),this.automationName=this.newLeadPayload?.name||"",this.editId=this.newLeadPayload?._id||"",this.delayPreferenceData.timezone=this.newLeadPayload?.timezonename||"",this.delayPreferenceData.delayPreference=this.newLeadPayload?.delayPreference||"";let l=this.newLeadPayload?.workflowSteps||[];this.actionsAdded=[],l.forEach(e=>{let i=this.mapWorkflowStepToAction(e);i&&this.actionsAdded.push(i)}),this.actionsAdded?.length>0&&setTimeout(()=>{this.startChildComponentsLoading()},100),this.actionsAdded?.length===0&&this.automationType=="LEAD_CREATED"&&!(this.isViewOnly&&l.length===0)&&(this.actionsAdded=[{name:"Select Pipeline",icon:"assets/images/icons/status-change-white.svg",selected:!0,bgColor:"bg-tags-brighter-purple",component:"app-pipeline-select-box",type:"SELECT_PIPELINE_STATUS"},{name:"Assign Team Members",icon:"assets/images/icons/team-white.svg",selected:!0,bgColor:"bg-added-phlox",component:"app-assign-team-members-box",type:"ASSIGN_TEAM_MEMBERS"}]),this.actionsAdded?.length===0&&this.isNewContactAddedAutomationType()&&!(this.isViewOnly&&l.length===0)&&(this.actionsAdded=this.getDefaultActionsForNewContactAdded()),this.addIds(this.actionsAdded),this.captureInitialActionIds(),this.getAutomationGroupName(),this.getTimezone(),this.loadConditionOutcomeLookups()}mapWorkflowStepToAction(l){let e=this.findActionTemplateByStepType(l?.stepType);if(!e)return null;let i=JSON.parse(JSON.stringify(e));return i.payload=l?.payload||{},l?.stepType==="ACTIVITY_TRIGGER"&&(i.conditionData={triggerType:l?.payload?.triggerType,branches:(l?.payload?.branches||[]).map(t=>({branchName:t?.branchName,outcome:t?.outcome,outcomeFilters:t?.outcomeFilters||{},isDefaultBranch:t?.isDefaultBranch,actions:(t?.workFlow||[]).map(n=>this.mapWorkflowStepToAction(n)).filter(n=>n)}))},i.expanded=!0),i?.type==="ASSIGN_TEAM_MEMBERS"&&(this.isContactModuleAutomation()||this.isListStackingModuleAutomation())&&(i.type="WHO_OWNS_THIS_CONTACT",i.component="app-who-owns-this-contact",i.name=this.ownsContactAssignLabel()),i}setTab(l){if(this.selectedTab=="Builder"&&l!="Builder"&&this.hasChanges()){this.dialogRef=this._dialog.open(Ia,{width:"530px",panelClass:"re-new-custom-dialog",data:{yesTitle:"Yes",noTitle:"Cancel",header:"Change Tab to "+l,text:"All unsaved changes will be lost. Are you sure you want to switch to "+l+"?"}}),this.dialogRef.afterClosed().subscribe(e=>{e&&(this.selectedTab=l)});return}this.selectedTab=l,this.selectedTab=="Builder"&&this.editId&&this.getDetail()}addEditAutomation(l=!1){let e=l?[]:this.getWorkSteps(),i=P(M({},this.newLeadPayload),{automationType:this.automationType,moduleId:this.moduleId,moduleName:this.moduleName,timezonename:this.delayPreferenceData?.timezone,delayPreference:this.delayPreferenceData?.delayPreference,editMode:this.editMode});e.length>0&&(i.workflowSteps=e),this.dialogRef=this._dialog.open(Qi,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",maxHeight:"90vh",data:i}),this.dialogRef.afterClosed().subscribe(t=>{t&&(this.actionsAdded?.length==0&&(this.automationType=="LEAD_CREATED"?this.actionsAdded=[{name:"Select Pipeline",icon:"assets/images/icons/pipeline-white.svg",selected:!0,bgColor:"bg-tags-brighter-purple",component:"app-pipeline-select-box",type:"SELECT_PIPELINE_STATUS"},{name:"Assign Team Members",icon:"assets/images/icons/team-white.svg",selected:!0,bgColor:"bg-added-phlox",component:"app-assign-team-members-box",type:"ASSIGN_TEAM_MEMBERS"}]:this.isNewContactAddedAutomationType()&&(this.actionsAdded=this.getDefaultActionsForNewContactAdded())),this.newLeadPayload=P(M({},t),{moduleId:t?.moduleId?._id||t?.moduleId}),this.isSettingsCollapsed=!0,this.setActionTree(),this.maybeOpenDelayPreferenceAfterNewLeadDialog())})}maybeOpenDelayPreferenceAfterNewLeadDialog(){if(this.isViewOnly)return;let l=!this.delayPreferenceData?.timezone,e=!this.delayPreferenceData?.delayPreference;this.newLeadPayload?._id&&(l||e)&&this.delayPreference({persistPreferenceToAutomation:!0})}onSearchChange(l){this.searchTerm=l,this.updateFilteredActionGroups()}normalizeModuleId(){let l=this.moduleId;l!=null&&typeof l=="object"&&typeof l._id=="string"&&(this.moduleId=l._id)}loadConditionOutcomeLookups(){this.loadMarketingCampaignDisplayNames(),this.loadVendorCategoryDisplayNames(),this.loadUserDisplayNamesForConditions(),this.loadCallOutcomeDisplayNames()}loadMarketingCampaignDisplayNames(){if(!this.moduleId){this.campaignTitleById={};return}this._marketingCampaignService.getMarketingCampaignDropDownList({campaignType:1,moduleId:this.moduleId}).pipe(ue(this.destroy$)).subscribe({next:l=>{if(l?.statusCode===200){let e=l?.data?.items||[],i={};for(let t of e)t?._id&&(i[t._id]=(t.name||"Untitled").trim());this.campaignTitleById=i}else this.campaignTitleById={}},error:()=>{this.campaignTitleById={}}})}
25loadVendorCategoryDisplayNames(){if(this.moduleId!==O.MainStatusId.VENDOR){this.vendorCategoryTitleById={};return}this._accountingService.getVendorCategory({}).pipe(ue(this.destroy$)).subscribe({next:l=>{if(l?.statusCode===200){let e=l?.data??[],i={};for(let t of e)t?._id&&(i[t._id]=String(t?.name??"Untitled").trim());this.vendorCategoryTitleById=i}else this.vendorCategoryTitleById={}},error:()=>{this.vendorCategoryTitleById={}}})}loadUserDisplayNamesForConditions(){let l={page:1,limit:1e3};this._userService.getRoles(l).pipe(ue(this.destroy$)).subscribe({next:e=>{if(e?.statusCode!==200){this.userDisplayNameById={},this.roleDisplayNameById={};return}let i=e?.data?.items||[],t=[],n={};i.forEach(f=>{f?._id&&(n[String(f._id)]=String(f?.name||"N/A").trim());let S=new Set(t.map(b=>b?._id)),v=(f?.userData||[]).filter(b=>b?._id&&!S.has(b._id));t.push(...v)});let c={};for(let f of t)if(f?._id){let S=`${f?.firstName||""} ${f?.lastName||""}`.trim();c[String(f._id)]=S||"N/A"}this.userDisplayNameById=c,this.roleDisplayNameById=n},error:()=>{this.userDisplayNameById={},this.roleDisplayNameById={}}})}loadCallOutcomeDisplayNames(){if(!this.moduleId){this.callOutcomeTitleById={};return}this._commonService.getcallOutcomeList({moduleId:this.moduleId,page:1,limit:1e3}).pipe(ue(this.destroy$)).subscribe({next:l=>{if(l?.statusCode===200){let e=l?.data?.items??(Array.isArray(l?.data)?l.data:[]),i={};for(let t of Array.isArray(e)?e:[]){let n=t?._id;n&&(i[String(n)]=String(t?.name||t?.title||n).trim())}this.callOutcomeTitleById=i}else this.callOutcomeTitleById={}},error:()=>{this.callOutcomeTitleById={}}})}conditionBranchOutcomeSubtitle(l,e){if(!l)return"";let i=this.resolveConditionBranchOutcomePart(l,e);if(l.isDefaultBranch)return i;let t=l?.outcomeFilters?.conditionType??"";return t?`${t} : ${i}`:i}resolveConditionBranchOutcomePart(l,e){let i=e??"";if(!l.isDefaultBranch&&i==="Campaign"){let n=l.outcome,c=Array.isArray(n)?n:n!=null?[n]:[];return c.length===0?"":c.map(f=>{let S=String(f);return this.campaignTitleById[S]||S}).join(", ")}if(!l.isDefaultBranch&&i==="Vendor type"){let n=l.outcome,c=Array.isArray(n)?n:n!=null?[n]:[];return c.length===0?"":c.map(f=>{let S=String(f);return this.vendorCategoryTitleById[S]||S}).join(", ")}if(!l.isDefaultBranch&&o.ROLE_ID_OUTCOME_TRIGGER_TYPES.has(i)){let n=l.outcome,c=Array.isArray(n)?n:n!=null?[n]:[];return c.length===0?"":c.map(f=>{let S=String(f);return this.roleDisplayNameById[S]||S}).join(", ")}if(!l.isDefaultBranch&&o.USER_ID_OUTCOME_TRIGGER_TYPES.has(i)){let n=l.outcome,c=Array.isArray(n)?n:n!=null?[n]:[];return c.length===0?"":c.map(f=>{let S=String(f);return this.userDisplayNameById[S]||S}).join(", ")}if(!l.isDefaultBranch&&i==="OUT_CALL_OUTCOME"){let n=l.outcome,c=Array.isArray(n)?n:n!=null?[n]:[];return c.length===0?"":c.map(f=>{let S=String(f);return this.callOutcomeTitleById[S]||S}).join(", ")}let t=l.outcome;return Array.isArray(t)?t.map(n=>String(n)).join(", "):t!=null?String(t):""}isContactModuleAutomation(){let l=this.moduleId;return l===this.mainStatusId.BUYER||l===this.mainStatusId.AGENT||l===this.mainStatusId.VENDOR}isPropertyPipelineModuleAutomation(){let l=this.moduleId;return l===this.mainStatusId.SOLD||l===this.mainStatusId.RENTAL||l===this.mainStatusId.INVENTORY||l===this.mainStatusId.WHOLESALEPIPELINE}isListStackingModuleAutomation(){return this.moduleId===this.mainStatusId.LISTSTACKING}isSpeedToLeadAvailable(){return this.moduleId===this.mainStatusId.LEAD&&this.automationType==="LEAD_CREATED"}isAiCallsAvailable(){return this.moduleId===this.mainStatusId.LEAD||this.moduleId===this.mainStatusId.WHOLESALEPIPELINE}isDirectMailAvailable(){return this.moduleId===this.mainStatusId.LEAD||this.moduleId===this.mainStatusId.LISTSTACKING}isMoveToCallFlowAvailable(){let l=this.moduleId;return l===this.mainStatusId.LEAD||l===this.mainStatusId.WHOLESALEPIPELINE||l===this.mainStatusId.BUYER||l===this.mainStatusId.AGENT||l===this.mainStatusId.VENDOR}isConversationalAiModule(){return this.moduleId===this.mainStatusId.LEAD||this.moduleId===this.mainStatusId.WHOLESALEPIPELINE}isNewContactAddedAutomationType(){return this.automationType==="NEW_BUYER_ADDED"||this.automationType==="NEW_AGENT_ADDED"||this.automationType==="NEW_VENDOR_ADDED"}isNewInventoryAddedAutomationType(){return this.automationType==="NEW_INVENTORY_ADDED"}isNewRentalPropertyAutomationType(){return this.automationType==="NEW_RENTAL_PROPERTY"}
25hasFixedDefaultRootStepPair(){return this.automationType==="LEAD_CREATED"||this.isNewContactAddedAutomationType()}hasFixedDefaultRootSteps(){return this.hasFixedDefaultRootStepPair()}isLockedDefaultRootActionById(l){return l==null||l<0?!1:this.hasFixedDefaultRootStepPair()&&(l===1||l===2)}getDefaultActionsForNewContactAdded(){let l=this.cloneActionFromDefaultGroups("CHANGE_PIPELINE_STATUS");l&&(l.name="Select Status",l.selected=!0);let e=JSON.parse(JSON.stringify(Q.whoOwnsThisContactAction));return e.name=this.ownsContactAssignLabel(),e.selected=!0,[l,e].filter(Boolean)}getDefaultActionsForNewInventoryAdded(){return[{name:"Assign Team Members",icon:"assets/images/icons/team-white.svg",selected:!0,bgColor:"bg-added-phlox",component:"app-assign-team-members-box",type:"ASSIGN_TEAM_MEMBERS"}]}getDefaultActionsForNewRentalProperty(){return[{name:"Select Status",icon:"assets/images/icons/status-change-white.svg",selected:!0,bgColor:"bg-tags-brighter-teal",component:"app-pipeline-change-box",type:"CHANGE_PIPELINE_STATUS"}]}applyActionGroupsForModule(){if(this.normalizeModuleId(),this.isContactModuleAutomation())this.actionGroups=this.buildContactModuleActionGroups();else if(this.isPropertyPipelineModuleAutomation())this.actionGroups=this.buildPropertyPipelineModuleActionGroups();else if(this.isListStackingModuleAutomation())this.actionGroups=this.buildListStackingModuleActionGroups();else{let l=JSON.parse(JSON.stringify(Q.actionGroups));this.isSpeedToLeadAvailable()?this.actionGroups=l:this.actionGroups=l.map(e=>P(M({},e),{actions:(e?.actions||[]).filter(i=>i?.type!=="SPEED_TO_LEAD")})).filter(e=>e?.actions?.length>0)}}cloneActionFromDefaultGroups(l){let e=Q.actionGroups.flatMap(i=>i.actions).find(i=>i.type===l);return e?JSON.parse(JSON.stringify(e)):null}ownsContactAssignLabel(){return this.moduleId===this.mainStatusId.BUYER?"Who Owns this Buyer Contact":this.moduleId===this.mainStatusId.AGENT?"Who Owns this Agent Contact":this.moduleId===this.mainStatusId.VENDOR?"Who Owns this Vendor Contact":this.moduleId===this.mainStatusId.LISTSTACKING?"Who owns this list stacking property":"Who Owns this Contact"}buildContactModuleActionGroups(){let l=S=>this.cloneActionFromDefaultGroups(S),e=l("MARK_HOT");e&&(e.type="MARK_VIP",e.name="Mark/Unmark as VIP",e.icon="assets/images/icons/vip.svg");let i=JSON.parse(JSON.stringify(Q.whoOwnsThisContactAction));i.name=this.ownsContactAssignLabel();let t=l("CHANGE_PIPELINE_STATUS");t&&(t.name="Change Status");let n=l("ACTIVITY_TRIGGER");n&&(n.name="If/ Else Conditions");let c=l("UNASSIGN_TEAM_MEMBERS");c&&(c.name="Unassign Team Member");let f=l("STOP_OTHER_AUTOMATIONS");return f&&(f.name="Stop Other Automation"),[{name:"Communication",actions:[l("SEND_EMAIL"),l("SEND_SMS")].filter(Boolean)},{name:"General Actions",actions:[l("ADD_FOLDER"),l("ADD_NOTES"),l("ADD_TASK"),n,l("MANAGE_TAGS"),e].filter(Boolean)},{name:"Data & Workflow Actions",actions:[l("MOVE_TO_CALL_FLOW"),l("WEBHOOK")].filter(Boolean)},{name:"Team Utility Actions",actions:[i,t,l("MOVE_TO_AUTOMATION"),l("NOTIFY_TEAM_MEMBER"),c,f].filter(Boolean)}]}buildPropertyPipelineModuleActionGroups(){let l=n=>this.cloneActionFromDefaultGroups(n),e=null;this.moduleId!==this.mainStatusId.SOLD&&(e=l("CHANGE_PIPELINE_STATUS"),e&&(e.name="Change Status"));let i=l("UNASSIGN_TEAM_MEMBERS");i&&(i.name="Unassign Team Member");let t=l("STOP_OTHER_AUTOMATIONS");return t&&(t.name="Stop Other Automation"),[{name:"Communication",actions:[...this.isAiCallsAvailable()?[l("AI_CALLS")]:[],l("SEND_EMAIL"),l("SEND_SMS")].filter(Boolean)},{name:"General Action",actions:[l("ADD_FOLDER"),l("ADD_NOTES"),l("ADD_TASK"),l("ACTIVITY_TRIGGER"),l("MANAGE_TAGS")].filter(Boolean)},{name:"Data & Workflow Actions",actions:[...this.isMoveToCallFlowAvailable()?[l("MOVE_TO_CALL_FLOW")]:[],l("WEBHOOK")].filter(Boolean)},{name:"Team & Utility Actions",actions:[l("ASSIGN_TEAM_MEMBERS"),e,l("MOVE_TO_AUTOMATION"),l("NOTIFY_TEAM_MEMBER"),i,t].filter(Boolean)}]}buildListStackingModuleActionGroups(){let l=f=>this.cloneActionFromDefaultGroups(f),e=JSON.parse(JSON.stringify(Q.whoOwnsThisContactAction));e.name=this.ownsContactAssignLabel();let i=l("CHANGE_PIPELINE_STATUS");i&&(i.name="Change Status");let t=l("UNASSIGN_TEAM_MEMBERS");t&&(t.name="Unassign Team Member");let n=l("STOP_OTHER_AUTOMATIONS");n&&(n.name="Stop Other Automation");let c=JSON.parse(JSON.stringify(Q.manageListsAction));return[{name:"Communication",actions:[l("DIRECT_MAIL"),l("SEND_EMAIL"),l("SEND_SMS")].filter(
25Boolean)},{name:"General Actions",actions:[l("ADD_FOLDER"),l("ADD_NOTES"),l("ADD_TASK"),l("ACTIVITY_TRIGGER"),l("MANAGE_TAGS"),c].filter(Boolean)},{name:"Data & Workflow Actions",actions:[l("SKIP_TRACE_RECORD"),l("WEBHOOK")].filter(Boolean)},{name:"Team & Utility Actions",actions:[e,i,l("MOVE_TO_AUTOMATION"),l("NOTIFY_TEAM_MEMBER"),t,n].filter(Boolean)}]}findActionTemplateByStepType(l){if(!l)return null;if(l==="MARK_VIP"){let i=Q.actionGroups.flatMap(n=>n.actions).find(n=>n.type==="MARK_HOT");if(!i)return null;let t=JSON.parse(JSON.stringify(i));return t.type="MARK_VIP",t.name="Mark/Unmark as VIP",t.icon="assets/images/icons/vip.svg",t}if(l==="WHO_OWNS_THIS_CONTACT"){let i=JSON.parse(JSON.stringify(Q.whoOwnsThisContactAction));return i.name=this.ownsContactAssignLabel(),i}if(l==="MANAGE_LIST")return JSON.parse(JSON.stringify(Q.manageListsAction));let e=Q.actionGroups.flatMap(i=>i.actions).find(i=>i.type===l);return e?JSON.parse(JSON.stringify(e)):null}updateFilteredActionGroups(){if(!this.searchTerm.trim()){this.automationType=="LEAD_CREATED"?this.filteredActionGroups=this.actionGroups.map((e,i)=>P(M({},e),{originalGroupIndex:i,actions:e?.actions?.map((t,n)=>P(M({},t),{originalActionIndex:n,selected:t?.type=="ASSIGN_TEAM_MEMBERS"?!0:t?.selected}))||[]})):this.filteredActionGroups=this.actionGroups.map((e,i)=>P(M({},e),{originalGroupIndex:i,actions:e?.actions?.map((t,n)=>P(M({},t),{originalActionIndex:n}))||[]}));return}let l=this.actionGroups.map((e,i)=>P(M({},e),{originalGroupIndex:i,actions:e?.actions?.map((t,n)=>P(M({},t),{originalActionIndex:n}))?.filter(t=>t?.name?.toLowerCase()?.includes(this.searchTerm?.toLowerCase()))||[]})).filter(e=>e?.actions?.length>0);this.automationType=="LEAD_CREATED"?this.filteredActionGroups=l.map(e=>P(M({},e),{actions:e?.actions?.map(i=>P(M({},i),{selected:i?.type=="ASSIGN_TEAM_MEMBERS"?!0:i?.selected}))||[]})):this.filteredActionGroups=l}getFilteredActionGroups(){if(!this.searchTerm.trim())return this.automationType=="LEAD_CREATED"?this.actionGroups.map(e=>P(M({},e),{actions:e?.actions?.map(i=>P(M({},i),{selected:i?.type=="ASSIGN_TEAM_MEMBERS"?!0:i?.selected}))||[]})):this.actionGroups;let l=this.actionGroups.map(e=>P(M({},e),{actions:e?.actions?.filter(i=>i?.name?.toLowerCase()?.includes(this.searchTerm?.toLowerCase()))||[]})).filter(e=>e?.actions?.length>0);return this.automationType=="LEAD_CREATED"?l.map(e=>P(M({},e),{actions:e?.actions?.map(i=>P(M({},i),{selected:i?.type=="ASSIGN_TEAM_MEMBERS"?!0:i?.selected}))||[]})):l}selectAction(l,e){if(!this.delayPreferenceData?.delayPreference){this._toastrService.showError("Please Select Delay Preference");return}let i=this.filteredActionGroups?.[l],t=i?.actions?.[e],n=i?.originalGroupIndex??l,c=t?.originalActionIndex??e,f=JSON.parse(JSON.stringify(this.actionGroups?.[n]?.actions?.[c]));if(f?.type==="AI_CALLS"&&!this.isAiCallsAvailable()){this._toastrService.showError("Make AI Calls is only available for Lead and Transaction");return}if(f?.type==="DIRECT_MAIL"&&!this.isDirectMailAvailable()){this._toastrService.showError("Send Direct Mail is only available for Lead and List Stacking");return}if(f?.type==="MOVE_TO_CALL_FLOW"&&!this.isMoveToCallFlowAvailable()){this._toastrService.showError("Move to Call Flow is only available for Lead, Transaction, Buyer, Agent, and Vendor");return}if(f?.type==="SPEED_TO_LEAD"){if(!this.isSpeedToLeadAvailable()){this._toastrService.showError("Speed to Lead is only available for Lead Created automations");return}if(this.selectedBranchId){if(this.automationType!=="ACTIVITY_TRIGGER"){this._toastrService.showError("Speed to Lead is only available as the first step");return}let S=this.findBranchById(this.actionsAdded,this.selectedBranchId);if(S){if(S?.actions&&S?.actions?.length>0&&S?.actions?.[0]?.type==="SPEED_TO_LEAD"){this._toastrService.showError("Speed to Lead is only available as the first step");return}if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){this._toastrService.showError("Speed to Lead is only available as the first step");return}}}else if(this.hasFixedDefaultRootStepPair()){if(this.actionInsertAfterId!=2){this._toastrService.showError("Speed to Lead is only available as the first step");return}let S=this.actionsAdded.findIndex(v=>v?.actionId===2);if(S!==-1){let v=S+1;if(v<this.actionsAdded.length&&this.actionsAdded[v]?.type==="SPEED_TO_LEAD"){this._toastrService.showError("Speed to Lead is only available as the first step");return}}}else{if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0&&this.actionInsertAfterId>=1){this._toastrService.showError("Speed to Lead is only available as the first step");return}if(this.actionsAdded&&this.actionsAdded.length>0&&this.actionsAdded[0]?.type==="SPEED_TO_LEAD"){this._toastrService.showError("Speed to Lead is only available as the first step");return}}}if(f?.type==="ACTIVITY_TRIGGER"){if(this.selectedBranchId){let S=this.findBranchById(this.actionsAdded,this.selectedBranchId);if(S){let v=S?.actions||[];if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){let b=v.findIndex(N=>N?.actionId===this.actionInsertAfterId);if(b!==-1&&b<v.length-1){this._toastrService.showError("If/else conditions cannot be directly added between two steps");return}}else if(v.length>0){this._toastrService.showError("If/else conditions cannot be directly added between two steps");return}}}else if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){let S=this.actionsAdded.findIndex(v=>v?.actionId===this.actionInsertAfterId);if(S!==-1&&S<this.actionsAdded.length-1){this._toastrService.showError("If/else conditions cannot be directly added between two steps");return}}else if(this.actionsAdded.length>0){this._toastrService.showError("If/else conditions cannot be directly added between two steps");return}this.addConditions(f);return}if(f?.type==="MOVE_TO_AUTOMATION"){if(this.selectedBranchId){let S=this.findBranchById(this.actionsAdded,this.selectedBranchId);if(S){let v=S?.actions||[];if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){let b=v.findIndex(N=>N?.actionId===this.actionInsertAfterId);if(b!==-1&&b<v.length-1){this._toastrService.showError("Move to other automation can only be added as the last step");return}}else if(v.length>0){this._toastrService.showError("Move to other automation can only be added as the last step");return}}}else if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){let S=this.actionsAdded.findIndex(v=>v?.actionId===this.actionInsertAfterId);if(S!==-1&&S<this.actionsAdded.length-1){this._toastrService.showError("Move to other automation can only be added as the last step");return}}else if(this.actionsAdded.length>0){this._toastrService.showError("Move to other automation can only be added as the last step");return}}if(f?.type!=="SPEED_TO_LEAD")if(this.selectedBranchId){let S=this.findBranchById(this.actionsAdded,this.selectedBranchId);if(S){let v=this.actionInsertAfterId===null||this.actionInsertAfterId===void 0,b=S?.actions&&S?.actions?.length>0&&S?.actions?.[0]?.type==="SPEED_TO_LEAD";if(v&&b){this._toastrService.showError("Speed to Lead should be the first step of each branch");return}}}else{let S=!1,v=!1;if(this.hasFixedDefaultRootStepPair()){let b=this.actionsAdded.findIndex(N=>N?.actionId===2);if(b!==-1){let N=b+1;N<this.actionsAdded.length&&this.actionsAdded[N]?.type==="SPEED_TO_LEAD"&&this.actionInsertAfterId===2&&(S=!0,v=!0)}else(this.actionInsertAfterId===null||this.actionInsertAfterId===void 0)&&this.actionsAdded&&this.actionsAdded.length>0&&this.actionsAdded[0]?.type==="SPEED_TO_LEAD"&&(S=!0,v=!0)}else S=this.actionInsertAfterId===null||this.actionInsertAfterId===void 0,v=this.actionsAdded&&this.actionsAdded.length>0&&this.actionsAdded[0]?.type==="SPEED_TO_LEAD";if(S&&v){this._toastrService.showError("Speed to Lead is only available as the first step");return}}if(!this.selectedBranchId&&this.hasFixedDefaultRootSteps()&&f?.type!=="SPEED_TO_LEAD"){let S=this.actionInsertAfterId;if(S==null){this._toastrService.showError("You can't add a step above the required first steps.");return}if(this.hasFixedDefaultRootStepPair()&&S===1){this._toastrService.showError("You can't add a step between the required first steps.");return}}if(this.applyPreviousStepTimingToNewAction(f),this.applyPreviousPhoneNumberToNewAction(f),this.selectedBranchId){let S=this.findBranchById(this.actionsAdded,this.selectedBranchId);S&&this.insertAction(S?.actions,f,this.actionInsertAfterId)}else this.insertAction(this.actionsAdded,f,this.actionInsertAfterId);this.addIds(this.actionsAdded),this.resetActionSelection(),setTimeout(()=>this.refreshTimingSequenceErrors(),0)}applyPreviousPhoneNumberToNewAction(l){if(l?.type!=="SEND_SMS"&&l?.type!=="AI_CALLS")return;let e=this.resolvePreviousPhoneNumberSelection();e?.selectedPhoneNumber&&(l.payload=P(M({},l.payload||{}),{phoneNumberSelection:{selectionType:e.selectionType||"DEFAULT_CAMPAIGN_NUMBER",selectedPhoneNumber:e.selectedPhoneNumber}}))}resolvePreviousPhoneNumberSelection(){let l=null,e=i=>{for(let t of i||[]){if(t?.type==="ACTIVITY_TRIGGER"){for(let f of t?.conditionData?.branches||[])e(f?.actions||[]);continue}if(t?.type!=="SEND_SMS"&&t?.type!=="AI_CALLS")continue;let n=this.getLivePhoneNumberSelectionForAction(t);
25if(n?.selectedPhoneNumber){l=n;continue}let c=t?.payload?.phoneNumberSelection;c?.selectedPhoneNumber&&(l={selectionType:c.selectionType,selectedPhoneNumber:String(c.selectedPhoneNumber)})}};return e(this.actionsAdded),l}getLivePhoneNumberSelectionForAction(l){if(!l?.actionId)return null;let e=this.findComponentInstanceByActionId(l.actionId),i=e?.selectedPhoneNumber;return i?{selectionType:e?.selectionType,selectedPhoneNumber:String(i)}:null}applyPreviousStepTimingToNewAction(l){let e=new Set(["SELECT_PIPELINE_STATUS","SPEED_TO_LEAD","ACTIVITY_TRIGGER"]);if(!l?.type||e.has(l.type))return;let i=this.resolvePreviousTimingForNewStep();if(!i){this.delayPreferenceData?.delayPreference==="Day Based"&&(l.payload=P(M({},l.payload||{}),{executeOn:{dayType:"Day",dayValue:0,time:""}}));return}l.payload=M(M({},l.payload||{}),this.normalizeTimingAfterZeroDayPrevious(i))}normalizeTimingAfterZeroDayPrevious(l){return this.delayPreferenceData?.delayPreference!=="Day Based"||!l?.executeOn||Number(l.executeOn.dayValue)!==0?l:{executeOn:P(M({},l.executeOn),{dayValue:1,time:"12:00 AM"})}}resolvePreviousTimingForNewStep(){if(this.selectedBranchId){let e=this.findBranchContext(this.actionsAdded,this.selectedBranchId);if(!e)return null;let i=e.branch?.actions||[];if(this.actionInsertAfterId!==null&&this.actionInsertAfterId!==void 0){let t=i.findIndex(n=>n?.actionId===this.actionInsertAfterId);if(t!==-1)for(let n=t;n>=0;n--){let c=this.getLiveTimingForAction(i[n]);if(c)return c}}return this.getLastTimingBeforeAction(e.parentActions,e.triggerAction?.actionId)}if(this.actionInsertAfterId===null||this.actionInsertAfterId===void 0)return null;let l=this.actionsAdded.findIndex(e=>e?.actionId===this.actionInsertAfterId);if(l===-1)return null;for(let e=l;e>=0;e--){let i=this.actionsAdded[e];if(i?.type==="ACTIVITY_TRIGGER")continue;let t=this.getLiveTimingForAction(i);if(t)return t}return null}getLastTimingBeforeAction(l,e){if(e==null)return null;let i=(l||[]).findIndex(t=>t?.actionId===e);if(i===-1)return null;for(let t=i-1;t>=0;t--){let n=l[t];if(n?.type==="ACTIVITY_TRIGGER")continue;let c=this.getLiveTimingForAction(n);if(c)return c}return null}findBranchContext(l,e){for(let i of l||[])if(i?.type==="ACTIVITY_TRIGGER"&&i?.conditionData?.branches)for(let t of i.conditionData.branches||[]){if(t?.branchId===e)return{parentActions:l,triggerAction:i,branch:t};let n=this.findBranchContext(t?.actions||[],e);if(n)return n}return null}getLiveTimingForAction(l){if(!l?.actionId)return null;let e=this.findComponentInstanceByActionId(l.actionId);return this.extractTimingFromComponent(e)}extractTimingFromComponent(l){if(!l||l.showDelayPreference===!1||l.isDefaultSelectStatusStep===!0)return null;if(this.delayPreferenceData?.delayPreference==="Day Based"){let i=l.executeOn;return i&&typeof i=="object"&&Object.keys(i).length>0&&i.dayType&&i.dayValue!=null&&(i.time||Number(i.dayValue)===0)?{executeOn:M({},i)}:null}let e=l.delayBeforeExecuting;return e&&typeof e=="object"&&Object.keys(e).length>0&&e.unit!=null&&e.duration!=null?{delayBeforeExecuting:M({},e)}:null}findComponentInstanceByActionId(l){let e={SELECT_PIPELINE_STATUS:this.pipelineSelectBoxComponent?.toArray()||[],CHANGE_PIPELINE_STATUS:this.pipelineChangeBoxComponent?.toArray()||[],ASSIGN_TEAM_MEMBERS:this.assignTeamMembersBoxComponent?.toArray()||[],WHO_OWNS_THIS_CONTACT:this.whoOwnsThisContactComponent?.toArray()||[],SPEED_TO_LEAD:this.speedToLeadBoxComponent?.toArray()||[],SEND_SMS:this.sendSmsBoxComponent?.toArray()||[],SEND_EMAIL:this.sendEmailBoxComponent?.toArray()||[],ADD_NOTES:this.addNotesBoxComponent?.toArray()||[],ADD_FOLDER:this.addFolderBoxComponent?.toArray()||[],ADD_TASK:this.addTaskBoxComponent?.toArray()||[],DIRECT_MAIL:this.directMailBoxComponent?.toArray()||[],AI_CALLS:this.aiCallsBoxComponent?.toArray()||[],MANAGE_TAGS:this.manageTagsBoxComponent?.toArray()||[],MANAGE_LIST:this.manageListsBoxComponent?.toArray()||[],WEBHOOK:this.webhookBoxComponent?.toArray()||[],BLOCK_INCOMING_COMMUNICATION:this.blockIncomingCommunicationComponent?.toArray()||[],MARK_RETURNED_MAIL:this.markReturnedMailComponent?.toArray()||[],MARK_LEAD_QUALIFIED:this.markLeadQualifiedBoxComponent?.toArray()||[],MARK_HOT:this.markHotComponent?.toArray()||[],MOVE_TO_CALL_FLOW:this.moveToCallFlowComponent?.toArray()||[],MOVE_TO_AUTOMATION:this.moveToOtherAutomationComponent?.toArray()||[],SKIP_TRACE_RECORD:this.skipTraceRecordComponent?.toArray()||[],UNASSIGN_TEAM_MEMBERS:this.unassignTeamMembersComponent?.toArray()||[],STOP_OTHER_AUTOMATIONS:this.stopOtherAutomationComponent?.toArray()||[],NOTIFY_TEAM_MEMBER:this.notifyTeamMembersComponent?.toArray()||[]},i={},t=n=>{for(let c of n||[]){let f=c?.type;if(f==="ACTIVITY_TRIGGER"){for(let v of c?.conditionData?.branches||[]){let b=t(v?.actions||[]);if(b)return b}continue}let S;if(f==="MARK_HOT"||f==="MARK_VIP"){i.__markHotFamily=i.__markHotFamily??0;let v=i.__markHotFamily++;S=e.MARK_HOT?.[v]}else if(f){i[f]=i[f]||0;let v=i[f]++;S=e[f]?.[v]}if(c?.actionId===l)return S||null}return null};return t(this.actionsAdded)}findParentArrayAndIndex(l,e){for(let i=0;i<l.length;i++){let t=l[i];if(t?.actionId===e)return{arrRef:l,index:i};if(t?.type==="ACTIVITY_TRIGGER"&&t?.conditionData?.branches)for(let n of t?.conditionData?.branches||[]){let c=this.findParentArrayAndIndex(n?.actions||[],e);if(c)return c}}return null}insertAction(l,e,i){if(!i){l.unshift(e);return}let t=l.findIndex(n=>n?.actionId===i);t!==-1?l.splice(t+1,0,e):l.push(e)}findBranchById(l,e){for(let i of l)if(i?.type==="ACTIVITY_TRIGGER"&&i?.conditionData?.branches)for(let t of i?.conditionData?.branches||[]){if(t?.branchId===e)return t;let n=this.findBranchById(t?.actions||[],e);if(n)return n}return null}
25showActionList(l=null,e=null,i="root"){this.isViewOnly||(i==="root"?(this.actionListFor="root",this.selectedBranchId=null,this.actionInsertAfterId=l?l?.actionId:null):i==="branch"&&e&&(this.actionListFor="branch-"+(e?.branchId||""),this.selectedBranchId=e?.branchId||null,this.actionInsertAfterId=l?l?.actionId:null))}deleteSteps(l){if(this.isLockedDefaultRootActionById(l)){this._toastrService.showError("You can't delete this step.");return}this.deleteActionById(this.actionsAdded,l)?(this.addIds(this.actionsAdded),setTimeout(()=>this.refreshTimingSequenceErrors(),0)):this._toastrService.showError("Action not found")}deleteActionById(l,e){for(let i=0;i<l.length;i++){let t=l[i];if(t?.actionId===e)return l.splice(i,1),!0;if(t?.type==="ACTIVITY_TRIGGER"&&t?.conditionData?.branches){for(let n of t?.conditionData?.branches||[])if(this.deleteActionById(n?.actions||[],e))return!0}}return!1}addIds(l,e={action:1,branch:1}){for(let i of l)if(i&&(i.actionId=e.action++),i?.type==="ACTIVITY_TRIGGER"&&i?.conditionData?.branches)for(let t of i?.conditionData?.branches||[])t&&(t.branchId=e.branch++),Array.isArray(t?.actions)||t&&(t.actions=[]),e=this.addIds(t?.actions||[],e);return e}resetActionSelection(){this.actionListFor="",this.selectedBranchId=null,this.actionInsertAfterId=null}isNonConditional(){return!(this.actionsAdded?.findIndex(e=>e?.type=="ACTIVITY_TRIGGER")>=0)}shouldShowStopButton(){return!!(this.isNonConditional()||this.actionsAdded&&this.actionsAdded.length>0&&this.actionsAdded.some(e=>e?.component==="app-move-to-other-automation"))}delayPreference(l){let e=!!l?.persistPreferenceToAutomation&&!!this.newLeadPayload?._id,i=P(M({},this.newLeadPayload),{delayPreference:this.delayPreferenceData?.delayPreference,timezonename:this.delayPreferenceData?.timezone||this.newLeadPayload?.timezonename,persistPreferenceToAutomation:e});this.dialogRef=this._dialog.open(za,{disableClose:!0,width:"600px",panelClass:"re-new-custom-dialog",data:i}),this.dialogRef.afterClosed().subscribe(t=>{t&&(this.newLeadPayload=P(M({},this.newLeadPayload),{timezonename:t.timezone}),this.delayPreferenceData={delayPreference:t.delayPreference,timezone:t.timezone},this.refreshTimingSequenceErrors(),this.getTimezone(),this.newLeadPayload?._id||this.addEditAutomation())})}getTimezone(){if(!this.delayPreferenceData?.timezone)return this.timezoneDisplay="N/A",this.timezoneDisplay;let l=Si.timezoneArray,e="N/A";return l.forEach(i=>{i?.timezonename===this.delayPreferenceData?.timezone&&(e=i?.abbreviation||"N/A")}),this.timezoneDisplay=e,e}addConditions(l){this.dialogRef=this._dialog.open(Ja,{disableClose:!0,width:"600px",maxHeight:"92vh",panelClass:"re-new-custom-dialog",data:{contactModuleMode:this.isContactModuleAutomation(),moduleId:this.moduleId}}),this.dialogRef.afterClosed().subscribe(e=>{if(e){if(e?.branches?.forEach(i=>{i&&(i.actions=[],i.type="BRANCH")}),l&&(l.conditionData=e,l.expanded=!0),this.selectedBranchId){let i=this.findBranchById(this.actionsAdded,this.selectedBranchId);i&&this.insertAction(i?.actions,l,this.actionInsertAfterId)}else this.insertAction(this.actionsAdded,l,this.actionInsertAfterId);this.addIds(this.actionsAdded),this.resetActionSelection(),setTimeout(()=>this.refreshTimingSequenceErrors(),0)}})}conversationalAiPreference(){this.isConversationalAiModule()&&this._commonAiAgentsService?.fetchActiveAiAgentPlans(()=>{if(!this._commonAiAgentsService?.isSubscribeTypeActive("conversation")){this.openActivateConversationPlan();return}this.openConversationalAiPreferenceDialog()})}openActivateConversationPlan(){this._utilities?.openActiveAiAgentsDialog(this.getConversationAgentDialogData())?.then(l=>{l&&l.afterClosed().subscribe(e=>{e&&this._commonAiAgentsService?.activate("conversation",()=>{this.openConversationalAiPreferenceDialog()},e)})})}getConversationAgentDialogData(){return{agentName:"SMS Conversation Specialist",agentImage:"assets/images/icons/conversational-ai.svg",avatarBgClass:"bg-added-fandango",subscribeType:"conversation",addonType:"gen2AgentsAiSMSConversation",mode:"activate"}}openConversationalAiPreferenceDialog(){this.dialogRef=this._dialog.open(Qa,{disableClose:!0,width:"500px",panelClass:"re-new-custom-dialog",data:P(M({},this.newLeadPayload),{enabled:this.newLeadPayload?.isConversationalAI,automationType:this.automationType,moduleId:this.moduleId,moduleName:this.moduleName,timezonename:this.delayPreferenceData?.timezone,delayPreference:this.delayPreferenceData?.delayPreference,editMode:this.editMode})}),this.dialogRef.afterClosed().subscribe(l=>{l&&(this.newLeadPayload=P(M({},this.newLeadPayload),{isConversationalAI:l.enabled}))})}getWorkSteps(){let l={SELECT_PIPELINE_STATUS:this.pipelineSelectBoxComponent.toArray(),CHANGE_PIPELINE_STATUS:this.pipelineChangeBoxComponent.toArray(),ASSIGN_TEAM_MEMBERS:this.assignTeamMembersBoxComponent.toArray(),WHO_OWNS_THIS_CONTACT:this.whoOwnsThisContactComponent.toArray(),SPEED_TO_LEAD:this.speedToLeadBoxComponent.toArray(),SEND_SMS:this.sendSmsBoxComponent.toArray(),SEND_EMAIL:this.sendEmailBoxComponent.toArray(),ADD_NOTES:this.addNotesBoxComponent.toArray(),ADD_FOLDER:this.addFolderBoxComponent.toArray(),ADD_TASK:this.addTaskBoxComponent.toArray(),DIRECT_MAIL:this.directMailBoxComponent.toArray(),AI_CALLS:this.aiCallsBoxComponent.toArray(),MANAGE_TAGS:this.manageTagsBoxComponent.toArray(),MANAGE_LIST:this.manageListsBoxComponent.toArray(),WEBHOOK:this.webhookBoxComponent.toArray(),BLOCK_INCOMING_COMMUNICATION:this.blockIncomingCommunicationComponent.toArray(),MARK_RETURNED_MAIL:this.markReturnedMailComponent.toArray(),MARK_LEAD_QUALIFIED:this.markLeadQualifiedBoxComponent.toArray(),MARK_HOT:this.markHotComponent.toArray(),MOVE_TO_CALL_FLOW:this.moveToCallFlowComponent.toArray(),MOVE_TO_AUTOMATION:this.moveToOtherAutomationComponent.toArray(),SKIP_TRACE_RECORD:this.skipTraceRecordComponent.toArray(),UNASSIGN_TEAM_MEMBERS:this.unassignTeamMembersComponent.toArray(),STOP_OTHER_AUTOMATIONS:this.stopOtherAutomationComponent.toArray(),NOTIFY_TEAM_MEMBER:this.notifyTeamMembersComponent.toArray()},e={},i=(t,n=!1)=>{let c=[];for(let f=0;f<t.length;f++){let S=t[f],v=S?.type;if(v==="ACTIVITY_TRIGGER"){let gt=[];for(let ft of S?.conditionData?.branches||[]){let oi=i(ft?.actions||[],!0);if(oi===null)return null;gt.push({branchName:ft?.branchName,outcome:ft?.outcome||[],outcomeFilters:ft?.outcomeFilters||{},isDefaultBranch:!!ft?.isDefaultBranch,workFlow:oi})}c.push({stepType:"ACTIVITY_TRIGGER",stepOrder:c.length+1,isActive:!0,payload:{triggerType:S?.conditionData?.triggerType,automationName:this.automationName,branches:gt},isExecuted:!1});continue}let b;if(v==="MARK_HOT"||v==="MARK_VIP"){e.__markHotFamily=e.__markHotFamily??0;let gt=e.__markHotFamily++;b=l.MARK_HOT?.[gt]}else{e[v]=e[v]||0;let gt=e[v]++;b=l[v]?.[gt]}if(!b)continue;let N=gt=>
25{let ft=n?`Branch -> Step ${f+1}`:`Step ${f+1}`;this._toastrService.showError(`${ft}: ${gt}`)},j={};switch(v){case"SELECT_PIPELINE_STATUS":if(b?.pipelineId){if(!b?.statusId?.length)return N("Select pipeline/Status: Please select status"),null}else return N("Select pipeline/Status: Please select pipeline"),null;j={pipelineId:b?.pipelineId,mainStatusId:Array.isArray(b?.statusId)?b?.statusId:[b?.statusId]};break;case"WHO_OWNS_THIS_CONTACT":{let te=b?.ownerIdsForSave;if(!te?.length)return N("Please add at least one user who owns this contact"),null;j={ownerIds:te};break}case"ASSIGN_TEAM_MEMBERS":let gt=b?.addedRoleUserList;if(!gt?.length)return N("Assign Team Members: Please assign team members"),null;j={assignmentMethod:b?.assignedMethod,roles:gt,manualAssigneeId:null};break;case"SPEED_TO_LEAD":if(b?.isAIEnabled&&!b?.aiAgentId)return N("Speed to Lead: Please select an AI agent"),null;if(j={isAIEnabled:b?.isAIEnabled,manualSpeedToLeadEnabled:b?.manualSpeedToLeadEnabled},b?.isAIEnabled&&(j.aiAgentId=b?.aiAgentId),b?.manualSpeedToLeadEnabled)if(j.manualAssignmentMethod=b?.manualAssignmentMethod,b?.manualAssignmentMethod=="ASSIGNED_IN_LEAD"){let te=b?.assignedByLeadRoles,Ae=[];te?.forEach(nt=>{Ae.push({roleId:nt})}),j.selectedRoles=Ae}else{let te=b?.addedRoleUserList;if(!te?.length)return N("Speed to Lead: Please select roles and assignees"),null;let Ae=[],nt=[];te?.forEach(Le=>{nt=[],Le?.teamMembers?.forEach(ro=>{nt.push(ro?.userId)}),Ae.push({roleId:Le?.roleId,teamIds:nt})}),j.selectedRoles=Ae}break;case"SEND_SMS":let ft=b?.getPayloadMessageText?b.getPayloadMessageText():b?.messageText||"";if(!b?.aiSmsAssistActive&&!ft?.trim()?.length)return N("Send SMS: Please enter message text"),null;if(b?.recipientModuleId!=this.mainStatusId.LEAD&&b?.recipientType=="other"&&!b?.recipientId?.length)return N(`Send SMS: Please select ${b?.recipientModuleId==this.mainStatusId.BUYER?"buyer":b?.recipientModuleId==this.mainStatusId.AGENT?"agent":b?.recipientModuleId==this.mainStatusId.VENDOR?"vendor":""}  contact`),null;if(j={isAISMSAssist:b?.aiSmsAssistActive,skipHolidayOnWeekendAndPublicHolidays:b?.skipHolidayOnWeekendAndPublicHolidays,phoneNumberSelection:{selectionType:b?.selectionType},recipientDetails:{moduleId:b?.recipientModuleId,recipientType:b?.recipientType,recipientId:b?.recipientId?[b?.recipientId]:[]}},b?.aiSmsAssistActive||(j.messageText=ft),!b?.aiSmsAssistActive&&b?.smsTemplateId&&(j.smsTemplateId=b?.smsTemplateId),b?.selectionType=="OTHER_NUMBER"||b?.selectionType=="DEFAULT_CAMPAIGN_NUMBER"){if(!b?.selectedPhoneNumber?.length)return N(b?.selectionType=="OTHER_NUMBER"?"Send SMS: Please select phone number":"Send SMS: Please select fallback communication number"),null;j.phoneNumberSelection.selectedPhoneNumber=b?.selectedPhoneNumber}break;case"WEBHOOK":if(!b?.webhookUrl?.length)return N("Webhook: Please enter webhook URL"),null;let oi=b.webhookUrl.trim();try{let te=new URL(oi);if(!["http:","https:"].includes(te.protocol))return N("Webhook: URL must use http or https protocol"),null;let Ae=(te.hostname||"").toLowerCase(),nt=Ae.split(".").filter(ro=>ro.length>0),Le=Ae==="localhost"||nt.length>=2;if(!Ae||!Le)return N("Webhook: Please enter a valid URL with a proper host (e.g. https://example.com/webhook)"),null}catch(te){return N("Webhook: Please enter a valid URL (e.g. https://example.com/webhook)"),null}j={webhookUrl:oi,apiKey:b?.apiKey,dataToPost:b?.dataToPost};break;case"CHANGE_PIPELINE_STATUS":{let te=b?.isSinglePipelineStatusUi===!0;if(!b?.pipelineId)return N(te?"Change status: Pipeline data is not loaded":"Change pipeline/status: Please select pipeline"),null;if(!te){let nt=b?.pipelineData?.findIndex(Le=>Le?._id==b?.pipelineId);if(nt>=0&&b?.pipelineData[nt]?.originalTitle=="deadleads"&&!b?.deadLeadReasonIds?.length)return N("Change pipeline/status: Please select reasons"),null}if(!b?.statusId?.length)return N(te?"Change status: Please select status":"Change pipeline/status: Please select status"),null;if(b?.showPendingTaskAction!==!1&&!b?.pendingAction?.length)return N(te?"Change status: Please select pending action":"Change pipeline/status: Please select pending action"),null;let Ae=b?.showPendingTaskAction===!1?"leave_at":b?.pendingAction||"leave_at";j={pipelineId:b?.pipelineId,mainStatusId:b?.statusId,deadLeadReasonIds:te?[]:b?.deadLeadReasonIds,pendingAction:Ae};break}case"BLOCK_INCOMING_COMMUNICATION":j={isBlockIncomingCommunication:b?.isBlockIncomingCommunication};break;case"MARK_HOT":j={action:b?.action};break;case"MARK_VIP":j={isVip:!!b?.markAsVip};break;case"MARK_RETURNED_MAIL":j={action:b?.action};break;
25case"MARK_LEAD_QUALIFIED":j={isQualified:b?.action=="MARK_LEAD_QUALIFIED"};break;case"ADD_NOTES":if(!b?.noteText?.length)return N("Add Notes: Note text is not allowed to be empty"),null;j={noteText:b?.noteText};break;case"ADD_FOLDER":if(!b?.folderName?.trim?.()?.length)return N("Add Folder: Folder name is not allowed to be empty"),null;j={folderName:b?.folderName?.trim?.()};break;case"AI_CALLS":if(!b?.aiAgentToUse?.length)return N("AI Calls: Please select an agent"),null;if(j={callingAgent:{aiAgentToUse:b?.aiAgentToUse},phoneNumberSelection:{selectionType:b?.selectionType},sellerContactSelection:{contactType:b?.contactType}},j?.phoneNumberSelection?.selectionType=="OTHER_NUMBER"||j?.phoneNumberSelection?.selectionType=="DEFAULT_CAMPAIGN_NUMBER"){if(!b?.selectedPhoneNumber?.length)return N(j?.phoneNumberSelection?.selectionType=="OTHER_NUMBER"?"AI Calls: Please select phone number":"AI Calls: Please select fallback communication number"),null;j.phoneNumberSelection.selectedPhoneNumber=b?.selectedPhoneNumber}break;case"MOVE_TO_CALL_FLOW":if(!b?.selectedCallFlow?.length)return N("Move to Different Call Flow: Please select call flow"),null;j={selectedCallFlow:b?.selectedCallFlow};break;case"MOVE_TO_AUTOMATION":if(!b?.moveToAutomationId?.length)return N("Move to other Automation: Please select automation"),null;j={moveToAutomationId:b?.moveToAutomationId};break;case"SKIP_TRACE_RECORD":j={};break;case"MANAGE_TAGS":let No=b?.tagsAdded?.map(te=>te?._id)||[],ko=b?.tagsRemoved?.map(te=>te?._id)||[];if(!No?.length&&!ko?.length)return N("Manage Tags: Please select tags to add or remove"),null;j={addTags:No,removeTags:ko};break;case"MANAGE_LIST":let Bo=b?.listsAdded?.map(te=>te?._id)||[],Po=b?.listsRemoved?.map(te=>te?._id)||[];if(!Bo?.length&&!Po?.length)return b?.markListsSelectionError?.(),N("Manage Lists: Please select at least one list to add or remove"),null;b&&(b.listsSelectionError=!1),j={addLists:Bo,removeLists:Po};break;case"ADD_TASK":if(!b?.taskName?.length)return N("Add Task: Task name is not allowed to be empty"),null;if(!b?.taskType?.length)return N("Add Task: Task type is not allowed to be empty"),null;if(!b?.roleToAssign?.length)return N(b?.isDirectUserAssignmentModule?"Add Task: Please select user(s) to assign":"Add Task: Please select role to assign"),null;if(!b?.priority?.length)return N("Add Task: Please select priority"),null;j={basicSetup:{taskName:b?.taskName,taskType:b?.taskType,details:b?.details,skipHolidayOnWeekendAndPublicHolidays:b?.skipHolidayOnWeekendAndPublicHolidays,taskId:b?.taskId||null},assignment:{assignmentType:b?.assignmentType||"BASED_ON_ROLE",roleToAssign:b?.roleToAssign},priority:b?.priority},b?.enableReminder&&(j.taskReminder=b?.taskReminder);break;case"UNASSIGN_TEAM_MEMBERS":if(b?.isDirectUserAssignmentModule){let te=b?.selectedTeamMemberIds||[];if(!te?.length)return N("Unassign Team Members: Please select team members"),null;j={teamMemberIds:te};break}let nr=b?.addedRoleUserList,no=[],oo=[];if(nr?.forEach(te=>{oo=[],te?.teamMembers?.forEach(Ae=>{oo.push(Ae?.userId)}),no.push({roleId:te?.roleId,teamMemberIds:oo})}),!no?.length)return N("Unassign Team Members: Please select roles & assignees"),null;j={roles:no};break;case"STOP_OTHER_AUTOMATIONS":let ao=[];if(b?.stopType!="STOP_ALL"&&(b?.automationList?.forEach(te=>{te?.items?.forEach(Ae=>{Ae?.selected&&ao.push(Ae?._id)})}),!ao?.length))return N("Stop Other Automations: Please select automations"),null;j={isStopAllAutomation:b?.stopType=="STOP_ALL",automationIds:ao};break;case"NOTIFY_TEAM_MEMBER":if(b?.notificationType=="BYROLE"&&!b?.roleIds?.length)return N("Notify Team Members: Please select roles"),null;if(b?.notificationType=="BYMEMEBR"&&!b?.teamMemberIds?.length)return N("Notify Team Members: Please select team members"),null;if(!b?.notificationChannelSchema?.sms&&!b?.notificationChannelSchema?.email&&!b?.notificationChannelSchema?.web&&!b?.notificationChannelSchema?.inApp)return N("Notify Team Members: Please select notification channel"),null;if(!b?.notificationText?.length)return N("Notify Team Members: Notification text is not allowed to be empty"),null;j={notificationType:b?.notificationType,roleIds:b?.notificationType=="BYROLE"?b?.roleIds:[],teamMemberIds:b?.notificationType=="BYMEMEBR"?b?.teamMemberIds:[],notificationText:b?.notificationText,notificationChannelSchema:b?.notificationChannelSchema};break;case"SEND_EMAIL":if(!b?.senderDetails?.name?.length)return N("Send Email: Sender details name is not allowed to be empty"),null;if(!b?.senderDetails?.email?.length)return N("Send Email: Sender details email is not allowed to be empty"),null;if(b?.emailChecked&&b?.isEmailExist===!1)return N("Send Email: Email address is not verified. Please verify your email address."),b?.openVerifyEmailDialog?.(b?.senderDetails?.email),null;if(b?.recipientModuleId!=this.mainStatusId.LEAD&&b?.receiverContactType=="other"&&!b?.recipientId?.length)return N(`Send Email: Please select ${b?.re
25cipientModuleId==this.mainStatusId.BUYER?"buyer":b?.recipientModuleId==this.mainStatusId.AGENT?"agent":b?.recipientModuleId==this.mainStatusId.VENDOR?"vendor":""}  contact`),null;let qt=b?.isCC?b?.ccString?.split(",").map(te=>te?.trim()).filter(te=>te?.length>0):[],Gt=b?.isBCC?b?.bccString?.split(",").map(te=>te?.trim()).filter(te=>te?.length>0):[];if(b?.isCC&&(!b?.ccString||!b?.ccString?.trim()||qt?.length===0))return N("Send Email: CC Emails cannot be blank when CC is enabled"),null;if(b?.isBCC&&(!b?.bccString||!b?.bccString?.trim()||Gt?.length===0))return N("Send Email: BCC Emails cannot be blank when BCC is enabled"),null;if(qt?.length>0){let te=new Set,Ae=[];if(qt.forEach(nt=>{let Le=nt?.toLowerCase();te.has(Le)?Ae.includes(Le)||Ae.push(Le):te.add(Le)}),Ae.length>0)return N(`Send Email: Duplicate emails found in CC: ${Ae.join(", ")}`),null}if(Gt?.length>0){let te=new Set,Ae=[];if(Gt.forEach(nt=>{let Le=nt?.toLowerCase();te.has(Le)?Ae.includes(Le)||Ae.push(Le):te.add(Le)}),Ae.length>0)return N(`Send Email: Duplicate emails found in BCC: ${Ae.join(", ")}`),null}if(qt?.length>0&&Gt?.length>0){let te=qt.map(Le=>Le?.toLowerCase()),Ae=Gt.map(Le=>Le?.toLowerCase());if(te.filter(Le=>Ae.includes(Le)).length>0)return N("Send Email: Emails in CC and BCC should be unique"),null}if(b?.hasUnsupportedAttachments?.())return N("Please upload a file in one of the following supported formats: PDF, DOC, DOCX, XLS, XLSX, JPG, PNG, or GIF."),null;j={senderDetails:b?.senderDetails,receiverDetails:{moduleId:b?.recipientModuleId,receiverContactType:b?.receiverContactType,ccEmails:qt,bccEmail:Gt,receiverId:b?.recipientId?[b?.recipientId]:[]},emailContent:{subject:b?.subject,body:b?.body,isPlainText:!b?.isTextEditor,emailDesignObject:b?.isTextEditor?b?.emailDesignObject:{}},attachments:b?.attachments},b?.templateId&&(j.emailContent.templateId=b?.templateId);break;case"DIRECT_MAIL":if(!b?.senderDetails?.senderId?.length)return N("Direct Mail: Please select sender profile"),null;if(!b?.mailerDetails?.mailerDesignId?.length)return N("Direct Mail: Please select mailer type & design"),null;j={senderDetails:b?.senderDetails,mailerDetails:b?.getMailerDetailsForPayload?b.getMailerDetailsForPayload():M({mailType:b?.mailerDetails?.mailType,isTrack:!!b?.mailerDetails?.isTrack,mailerDesignId:b?.mailerDetails?.mailerDesignId},b?.mailerDetails?.notes?.length?{notes:b.mailerDetails.notes}:{}),batchMailing:{sendAllAtOnce:b?.sendType=="allAtOnce",sendInBatches:b?.sendType=="inBatch"}},b?.sendType=="inBatch"&&(j.batchMailing.maxMailsInOneBatch=b?.maxMailsInOneBatch,j.batchMailing.batchDelay=b?.batchDelay);break}let Fe=this.isLockedDefaultRootActionById(S?.actionId);if(!Fe){if(v!=="SELECT_PIPELINE_STATUS"&&v!=="ASSIGN_TEAM_MEMBERS"&&v!=="WHO_OWNS_THIS_CONTACT"&&v!=="SPEED_TO_LEAD"){if(!this.validateTimingWholeNumbers(b,N))return null;this.delayPreferenceData?.delayPreference==="Day Based"?j.executeOn=this.buildExecuteOnPayload(b?.executeOn):j.delayBeforeExecuting=b?.delayBeforeExecuting}else if(v=="ASSIGN_TEAM_MEMBERS"){if(b?.showDelayPreference===!0){if(!this.validateTimingWholeNumbers(b,N))return null;this.delayPreferenceData?.delayPreference==="Day Based"?j.executeOn=this.buildExecuteOnPayload(b?.executeOn):j.delayBeforeExecuting=b?.delayBeforeExecuting}}else if(v=="WHO_OWNS_THIS_CONTACT"&&b?.showDelayPreference===!0){if(!this.validateTimingWholeNumbers(b,N))return null;this.delayPreferenceData?.delayPreference==="Day Based"?j.executeOn=this.buildExecuteOnPayload(b?.executeOn):j.delayBeforeExecuting=b?.delayBeforeExecuting}}let xt={stepType:v,stepOrder:c.length+1,isActive:!0,payload:j,isExecuted:!(v==="SELECT_PIPELINE_STATUS"||v==="WHO_OWNS_THIS_CONTACT"&&Fe||v==="ASSIGN_TEAM_MEMBERS"&&Fe)};xt.isDefaultFlow=!!Fe,xt.isZeroWorkflowStep=!!this.isZeroDayExecuteOn(j?.executeOn),c.push(xt)}return c};return i(this.actionsAdded)}buildExecuteOnPayload(l){if(!l||typeof l!="object")return l;let e=M({},l);return Number(e.dayValue)===0&&delete e.time,e}validateTimingWholeNumbers(l,e){return this.delayPreferenceData?.delayPreference==="Day Based"?this.hasDecimalValue(l?.executeOn?.dayValue)?(e("Decimal values are not allowed. Please enter a whole number for Execute on day."),!1):!0:this.delayPreferenceData?.delayPreference==="Delay Based"&&this.hasDecimalValue(l?.delayBeforeExecuting?.duration)?(e("Decimal values are not allowed. Please enter a whole number for Delay duration."),!1):!0}hasDecimalValue(l){if(l==null||l==="")return!1;let e=Number(l);return Number.isFinite(e)?!Number.isInteger(e):!0}isZeroDayExecuteOn(l){return this.delayPreferenceData?.delayPreference==="Day Based"&&l!=null&&Number(l?.dayValue)===0}getDelayBasedMinutes(l){if(!l||typeof l!="object"||Object.keys(l).length===0||l.duration==null||l.duration===""||!l.unit)return null;let e=Number(l.duration);if(Number.isNaN(e)||e<0)return null;let t={Minutes:1,Hours:60,Days:1440,Weeks:10080}[l.unit];return t?e*t:null}getDayBasedMinutes(l){if(!l||typeof l!="object"||Object.keys(l).length===0||l.dayValue==null||l.dayValue===""||!l.dayType||!l.time&&Number(l.dayValue)!==0)return null;let e=Number(l.dayValue);if(Number.isNaN(e)||e<0)return null;let t={Day:1440,Week:10080,Month:720*60}[l.dayType];return t?e*t+this.parseClockTimeToMinutes(l.time):null}parseClockTimeToMinutes(l){if(!l||typeof l!="string")return 0;let e=l.trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!e)return 0;let i=parseInt(e[1],10),t=parseInt(e[2],10);return e[3].toUpperCase()==="AM"?i===12&&(i=0):i!==12&&(i+=12),i*60+t}getLiveTimingMinutesForAction(l){let e=this.getLiveTimingForAction(l);return e?this.delayPreferenceData?.delayPreference==="Day Based"?this.getDayBasedMinutes(e.executeOn):this.getDelayBasedMinutes(e.delayBeforeExecuting):null}getLiveDayValueForAction(l){if(this.delayPreferenceData?.delayPreference!=="Day Based")return null;let i=this.getLiveTimingForAction(l)?.executeOn?.dayValue;if(i==null||i==="")return null;let t=Number(i);return Number.isNaN(t)?null:t}static{this.TIMING_BEFORE_PREV_MSG="The scheduled date and time for this step must be the same as or later than the previous automation step."}static{this.TIMING_AFTER_NEXT_MSG="The scheduled date and time for this step must be the same as or before the next automation step."}static{this.TIMING_ZERO_DAY_ONCE_MSG="Day 0 can only be used once on the same path. After a Day 0 step, the next step must use a day value greater than 0."}refreshTimingSequenceErrors(){if(this.delayPreferenceData?.delayPreference!=="Day Based"){this.timingSequenceErrors={},this._cdr.markForCheck();return}let l={},e=t=>{let n=!1;for(let c of t)c.dayValue!=null&&Number(c.dayValue)===0&&(n&&(l[c.actionId]=o.TIMING_ZERO_DAY_ONCE_MSG),n=!0);for(let c=0;c<t.length;c++){let f=t[c];l[f.actionId]||(c>0&&f.minutes<t[c-1].minutes?l[f.actionId]=o.TIMING_BEFORE_PREV_MSG:c<t.length-1&&f.minutes>t[c+1].minutes&&(l[f.actionId]=o.TIMING_AFTER_NEXT_MSG))}},i=(t,n)=>{let c=[...n];for(let f of t||[]){if(f?.type==="ACTIVITY_TRIGGER"){let v=f?.conditionData?.branches||[];if(!v.length)e(c);else for(let b of v)i(b?.actions||[],c);return}let S=this.getLiveTimingMinutesForAction(f);S==null||f?.actionId==null||c.push({actionId:f.actionId,minutes:S,dayValue:this.getLiveDayValueForAction(f)})}e(c)};i(this.actionsAdded,[]),this.timingSequenceErrors=l,this._cdr.markForCheck()}hasTimingSequenceErrors(){return Object.keys(this.timingSequenceErrors||{}).length>0}getTimingSequenceError(l){return l==null?null:this.timingSequenceErrors[l]||null}
25stopAutomation(){if(this.isViewOnly)return;if(!(this.delayPreferenceData?.timezone??"").toString().trim()){this._toastrService.showError("Please set a timezone in delay preference");return}if(this.refreshTimingSequenceErrors(),this.hasTimingSequenceErrors()){this._toastrService.showError("Please fix the scheduled date and time errors on the steps before saving.");return}let e=this.getWorkSteps();if(e===null)return;if(e?.length===0){this._toastrService.showError("Workflow steps must contain at least one item");return}let i={automationId:this.editId,isCreateLog:this.editMode,workflowSteps:e};this._loaderService.start(),this._automationService.addUpdateWorkflow(i).subscribe(t=>{this.newLeadPayload=t?.data,this._loaderService.stop(),this.normalizeModuleId(),this._router.navigate(["/automations"],{queryParams:{type:this.automationType,moduleId:this.moduleId}})},t=>{this._loaderService.stop(),this._toastrService.showError(t?.error?.message)})}startChildComponentsLoading(){if(this.isLoadingChildComponents)return;this.isLoadingChildComponents=!0,this.viewCheckedCount=0,this.childComponentsCheckInterval&&clearInterval(this.childComponentsCheckInterval);let l=0,e=150;this.childComponentsCheckInterval=setInterval(()=>{l++,this.checkAllChildComponentsReady()&&l>=this.minWaitTime?this.stopChildComponentsLoading():l>=e&&this.stopChildComponentsLoading()},100)}checkAllChildComponentsReady(){let l=0,e=t=>{!t||!Array.isArray(t)||t.forEach(n=>{n?.type!=="ACTIVITY_TRIGGER"&&n?.component&&l++,n?.type==="ACTIVITY_TRIGGER"&&n?.conditionData?.branches&&n?.conditionData?.branches?.forEach(c=>{c?.actions&&Array.isArray(c.actions)&&e(c.actions)})})};e(this.actionsAdded);let i=0;for(let t of this.allBoxQueryLists)i+=t?.length||0;return l===0||i>=l}stopChildComponentsLoading(){this.isLoadingChildComponents=!1,this.viewCheckedCount=0,this.childComponentsCheckInterval&&(clearInterval(this.childComponentsCheckInterval),this.childComponentsCheckInterval=null),this._cdr.detectChanges(),this.refreshTimingSequenceErrors()}static{this.\u0275fac=function(e){return new(e||o)(E(ve),E(Me),E(Bi),E(At),E(De),E(Ue),E(Ci),E(ut),E(H),E(Y),E(q),E(va),E(xi))}}static{this.\u0275cmp=B({type:o,selectors:[["app-add-edit-automation-dynamic"]],viewQuery:function(e,i){if(e&1&&We(rn,5)(tn,5)(on,5)(Zi,5)(_n,5)(mn,5)(xn,5)(fn,5)(Sn,5)(sn,5)(Cn,5)(vn,5)(In,5)(Mn,5)(Dn,5)(Nn,5)(Bn,5)(Ln,5)(Fn,5)(Wn,5)(qn,5)(Hn,5)(zn,5)(Qn,5)(Kn,5),e&2){let t;ie(t=ne())&&(i.pipelineChangeBoxComponent=t),ie(t=ne())&&(i.assignTeamMembersBoxComponent=t),ie(t=ne())&&(i.whoOwnsThisContactComponent=t),ie(t=ne())&&(i.speedToLeadBoxComponent=t),ie(t=ne())&&(i.sendSmsBoxComponent=t),ie(t=ne())&&(i.sendEmailBoxComponent=t),ie(t=ne())&&(i.addNotesBoxComponent=t),ie(t=ne())&&(i.addFolderBoxComponent=t),ie(t=ne())&&(i.addTaskBoxComponent=t),ie(t=ne())&&(i.directMailBoxComponent=t),ie(t=ne())&&(i.aiCallsBoxComponent=t),ie(t=ne())&&(i.manageTagsBoxComponent=t),ie(t=ne())&&(i.manageListsBoxComponent=t),ie(t=ne())&&(i.pipelineSelectBoxComponent=t),ie(t=ne())&&(i.webhookBoxComponent=t),ie(t=ne())&&(i.blockIncomingCommunicationComponent=t),ie(t=ne())&&(i.markReturnedMailComponent=t),ie(t=ne())&&(i.markLeadQualifiedBoxComponent=t),ie(t=ne())&&(i.markHotComponent=t),ie(t=ne())&&(i.moveToCallFlowComponent=t),ie(t=ne())&&(i.moveToOtherAutomationComponent=t),ie(t=ne())&&(i.skipTraceRecordComponent=t),ie(t=ne())&&(i.unassignTeamMembersComponent=t),ie(t=ne())&&(i.notifyTeamMembersComponent=t),ie(t=ne())&&(i.stopOtherAutomationComponent=t)}},hostAttrs:[1,"block"],standalone:!1,decls:20,vars:11,consts:[["conditionalBlock",""],["renderBranches",""],["actionListBox",""],["pipelineSelectBoxComponent",""],["speedToLeadBoxComponent",""],["assignTeamMembersBoxComponent",""],["whoOwnsThisContactComponent",""],["pipelineChangeBoxComponent",""],["sendSmsBoxComponent",""],["sendEmailBoxComponent",""],["addNotesBoxComponent",""],["addFolderBoxComponent",""],["addTaskBoxComponent",""],["directMailBoxComponent",""],["aiCallsBoxComponent",""],["webhookBoxComponent",""],["blockIncomingCommunicationComponent",""],["markHotComponent",""],["markReturnedMailComponent",""],["markLeadQualifiedBoxComponent",""],["moveToCallFlowComponent",""],["moveToOtherAutomationComponent",""],["skipTraceRecordComponent",""],["manageTagsBoxComponent",""],["manageListsBoxComponent",""],["unassignTeamMembersComponent",""],["notifyTeamMembersComponent",""],["stopOtherAutomationComponent",""],[1,"fixed","inset-0","bg-opacity-50","z-[9999]","flex","items-center","justify-center",2,"backdrop-filter","blur(2px)"],[1,"sticky","top-[60
25px]","z-[100]","flex","flex-col","items-center","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","mb-[26px]","shadow-[0_4px_24px_rgba(0,0,0,0.06)]"],[1,"flex","flex-wrap","items-center","self-stretch","justify-between","py-[12px]","px-[30px]","border-b-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","p-[5px]"],[1,"flex","items-center","gap-[10px]"],[1,"bg-charts-brighter-blue","rounded-md","p-[7px]","flex","items-center","justify-center"],["svgClass","w-[24px] h-[24px] block","src","assets/images/icons/automation.svg",1,"text-transparency-white"],[1,"flex","items-center","gap-[5px]"],[1,"text-h1","font-semibold","text-transparency-100"],["tooltipPosition","top",1,"text-h3/[20px]","font-semibold","p-[8px]","max-w-[180px]","truncate",3,"pTooltip"],["customClass","bg-secondary-teal border-secondary-teal-5 hover:bg-secondary-teal ml-2","label","Save","variant","filled","type","default","size","44",3,"leftIcon","disabled"],["type","button",1,"px-[15px]","py-[8px]","text-h4","font-semibold","border-[1px]","border-solid","rounded-[30px]","border-transparency-25"],[1,"flex","flex-wrap","items-center","self-stretch","justify-between","px-[30px]","py-[10px]"],[1,"flex","flex-col","w-full","mb-5","gap-[10px]","xl:flex-row","xl:items-start"],[3,"automationId","moduleId","actionGroups","delayPreferenceData"],[3,"automationId","moduleId","automationType","actionGroups","delayPreferenceData"],[1,"flex","flex-col","items-center","gap-[20px]"],[1,"animate-spin","rounded-full","h-16","w-16","border-t-4","border-b-4","border-primary-90"],[1,"text-h3","text-transparency-100","font-semibold"],["customClass","bg-secondary-teal border-secondary-teal-5 hover:bg-secondary-teal ml-2","label","Save","variant","filled","type","default","size","44",3,"click","leftIcon","disabled"],[1,"flex","items-center","gap-[25px]"],[1,"group","flex","items-center","justify-center","gap-[5px]","px-[10px]","py-[7px]","text-h4","font-semibold","border-[1px]","border-solid","rounded-[30px]",3,"click","ngClass"],["src","assets/images/icons/add.svg","svgClass","w-[18px] h-[18px] block",3,"ngClass"],["src","assets/images/icons/assigned.svg","svgClass","w-[18px] h-[18px] block",3,"ngClass"],["src","assets/images/icons/activity-1.svg","svgClass","w-[18px] h-[18px] block",3,"ngClass"],["src","assets/images/icons/time.svg","svgClass","w-[18px] h-[18px] block",3,"ngClass"],[1,"flex","items-center","gap-[5px]","py-[7px]","px-[10px]","text-h4","text-transparency-100","font-semibold"],["svgClass","w-[18px] h-[18px] block","src","assets/images/icons/time.svg"],[1,"w-full","xl:w-[245px]","xl:shrink-0","flex","items-start","flex-col","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden","mb-3","bg-transparency-0","xl:sticky","xl:top-[calc(55px+8.75rem)]","xl:z-[50]","xl:self-start","xl:max-h-[calc(100vh-12rem)]","xl:overflow-y-auto"],["type","button",1,"mb-3","flex","items-center","gap-[10px]","px-[15px]","py-[12px]","bg-transparency-0","rounded-[60px]","border-[1px]","border-solid","border-transparency-25","cursor-pointer","hover:bg-transparency-10","xl:sticky","xl:top-[calc(55px+8.75rem)]","xl:z-[50]","xl:self-start"],[1,"flex","flex-col","flex-1","min-w-0","w-full"],[1,"flex","flex-col","items-center","overflow-auto","flex-wrap"],[1,"flex","items-center","flex-col","self-stretch","py-[20px]","gap-[10px]","bg-transparency-10","border-b-[1px]","border-solid","border-transparency-25","relative"],["type","button",1,"absolute","top-[15px]","right-[15px]","flex","items-center","gap-[5px]","p-[3px]","rounded-[30px]","text-h4/[normal]","text-primary-90","font-semibold","cursor-pointer","bg-activity-outbound-hover-bg","border-activity-outbound-hover-border",3,"click"],["src","assets/images/icons/chevron-left.svg","svgClass","w-[14px] h-[14px] block"],[1,"flex","items-center","flex-col","self-stretch","justify-center","p-[15px]","pb-0","gap-[10px]"],[1,"w-[60px]","h-[60px]","flex","items-center","justify-center","p-[7px]","rounded-pill","bg-secondary-blue-5"],["src","assets/images/icons/settings.svg","svgClass","text-transparency-100 w-[24px] h-[24px] block"],[1,"flex","flex-col","items-center","self-stretch","gap-[2px]"],[1,"text-h3/[20px]","text-transparency-100","font-semibold"],[1,"flex","items-start","flex-col","self-stretch","gap-[10px]","p-[10px]","bg-transparency-0"],[1,"flex","items-center","self-stretch","gap-[5px]","p-[5px]","pl-[10px]","rounded-lg",3,"click"],[1,"flex-[1_0_0]","flex","items-start","gap-[10px]"],["src","assets/images/icons/time.svg","width","20","height","20",1,"img-fluid"],[1,"flex","flex-col","items-start","gap-[3px]"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","max-w-[150px]"],[1,"text-h5/[15px]","text-transparency-100","font-semibold","truncate","max-w-[150px]","opacity-40"],[1,"flex","items-center","gap-[10px]","p-[3px]","bg-transparency-1
255","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["src","assets/images/icons/chevron-right.svg","svgClass","text-transparency-100 w-[14px] h-[14px] block",1,"img-fluid"],["tooltipPosition","top",1,"flex","items-center","self-stretch","gap-[5px]","p-[5px]","pl-[10px]","rounded-lg",3,"cursor-pointer","cursor-not-allowed","hover:bg-transparency-15","opacity-50","pTooltip"],["tooltipPosition","top",1,"flex","items-center","self-stretch","gap-[5px]","p-[5px]","pl-[10px]","rounded-lg",3,"click","pTooltip"],["src","assets/images/icons/conversational-ai.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex-[1_0_0]","flex","flex-col","items-start","gap-[3px]"],["type","button",1,"mb-3","flex","items-center","gap-[10px]","px-[15px]","py-[12px]","bg-transparency-0","rounded-[60px]","border-[1px]","border-solid","border-transparency-25","cursor-pointer","hover:bg-transparency-10","xl:sticky","xl:top-[calc(55px+8.75rem)]","xl:z-[50]","xl:self-start",3,"click"],["src","assets/images/icons/settings.svg","svgClass","text-transparency-100 w-[20px] h-[20px] block"],[1,"text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/chevron-right.svg","svgClass","text-transparency-100 w-[20px] h-[20px] block"],[1,"w-full","max-w-[340px]","inline-flex","items-center","justify-between","gap-[10px]","p-[20px]","rounded-[20px]",3,"ngClass"],[1,"flex","items-center","gap-[12px]"],[1,"flex","items-center","p-[11px]","bg-transparency-white","rounded-[20px]"],["alt","selected-action-black-bg","width","34","height","34",1,"img-fluid",3,"src"],[1,"flex","flex-col","gap-[6px]"],[1,"flex","items-center","gap-[8px]","w-[190p
25x]"],[1,"text-h2/[22px]","font-semibold","flex-1","min-w-0","truncate",3,"ngClass"],["src","assets/images/icons/edit-white.svg","alt","edit","width","16","height","16",1,"img-fluid","flex-shrink-0","cursor-pointer"],[1,"text-h4/[18px]","font-semibold","w-[190px]","truncate","opacity-40",3,"ngClass"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-white","rounded-pill","border-[1px]","border-solid","border-transparency-25",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid"],["src","assets/images/icons/edit-white.svg","alt","edit","width","16","height","16",1,"img-fluid","flex-shrink-0","cursor-pointer",3,"click"],[1,"flex","justify-center","relative","py-[7px]","before:absolute","before:top-0","before:bottom-0","before:block","before:w-[2px]","before:bg-transparency-60"],[1,"p-[10px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[15px]"],["src","assets/images/icons/plus-grey-circle-bg.svg","alt","add-teal.svg","width","26","height","26",1,"img-fluid","relative"],["width","26","height","26",1,"img-fluid","relative","automation-add-action-icon",3,"ngClass","src"],["width","26","height","26",1,"img-fluid","relative","automation-add-action-icon",3,"click","ngClass","src"],[4,"ngTemplateOutlet"],[1,"w-full","max-w-[560px]","min-w-[400px]","flex","flex-col","gap-[20px]","m-auto","p-[20px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[3,"moduleId","payload","stepIndex","actionId","isViewOnly","automationType","disableDelete"],[3,"payload","stepIndex","actionId","isViewOnly"],[3,"payload","stepIndex","actionId","isViewOnly","automationType","moduleId","delayPreferenceData","timingSequenceError","disableDelete","showFirstToAnswerOption","showDelayPreference"],[3,"moduleId","payload","stepIndex","actionId","isViewOnly","automationType","delayPreferenceData","timingSequenceError","disableDelete","showDelayPreference"],[3,"moduleId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly","disableDelete"],[3,"moduleId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","moduleId","isViewOnly"],[3,"stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"stepIndex","actionId","delayPreferenceData","timingSequenceError","moduleId","payload","isViewOnly"],[3,"stepIndex","actionId","moduleId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"markVariant","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"stepIndex","actionId","moduleId","automationId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly","moduleId"],[3,"moduleId","automationId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],["alt","add-teal.svg","width","26","height","26",1,"img-fluid","relative",3,"src"],[3,"deleteBox","moduleId","payload","stepIndex","actionId","isViewOnly","automationType","disableDelete"],[3,"deleteBox","payload","stepIndex","actionId","isViewOnly"],[3,"deleteBox","timingChange","payload","stepIndex","actionId","isViewOnly","automationType","moduleId","delayPreferenceData","timingSequenceError","disableDelete","showFirstToAnswerOption","showDelayPreference"],[3,"deleteBox","timingChange","moduleId","payload","stepIndex","actionId","isViewOnly","automationType","delayPreferenceData","timingSequenceError","disableDelete","showDelayPreference"],[3,"deleteBox","timingChange","moduleId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly","disableDelete"],[3,"timingChange","deleteBox","moduleId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"timingChange","deleteBox","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","moduleId","isViewOnl
25y"],[3,"deleteBox","timingChange","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"deleteBox","timingChange","stepIndex","actionId","delayPreferenceData","timingSequenceError","moduleId","payload","isViewOnly"],[3,"timingChange","deleteBox","stepIndex","actionId","moduleId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"deleteBox","timingChange","moduleId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"deleteBox","timingChange","markVariant","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"deleteBox","timingChange","stepIndex","actionId","moduleId","automationId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[3,"deleteBox","timingChange","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly","moduleId"],[3,"timingChange","deleteBox","stepIndex","actionId","delayPreferenceData","timingSequenceError","moduleId","payload","isViewOnly"],[3,"timingChange","deleteBox","moduleId","automationId","stepIndex","actionId","delayPreferenceData","timingSequenceError","payload","isViewOnly"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"relative","flex","items-start","py-[30px]","before:absolute","before:left-1/2","before:top-0","before:h-[30px]","before:w-0","before:border-l-2","before:border-solid","before:border-[#ddd]","before:content-['']"],[1,"flex","justify-between","items-center","gap-[10px]"],[1,"flex-none","flex","items-center","p-[14px]","bg-transparency-black","rounded-[20px]"],["src","assets/images/icons/branches-white.svg","alt","branches-white","width","28","height","28",1,"img-fluid"],[1,"flex-1","flex","flex-col","gap-[6px]","overflow-hidden"],["tooltipPosition","top",1,"text-h2/[22px]","text-transparency-100","font-semibold","truncate",3,"pTooltip"],[1,"text-h4/[18px]","text-transparency-100","font-semibold","truncate","opacity-40"],[1,"flex-none","flex","items-center","justify-end","gap-[10px]"],[1,"flex","items-center","justify-center","px-[5px]","py-[2px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","text-h5/[15px]","text-transparency-90","font-semibold"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click"],["src","assets/images/icons/delete.svg",1,"text-transparency-100","[&_svg]:w-[20px]","[&_svg]:h-[20px]"],[1,"flex","items-center","gap-[10px]","p-[5px]","bg-transparency-0","rounded-pill","border-[1px]","border-solid","border-transparency-25","cursor-pointer",3,"click","ngClass"],["src","assets/images/icons/chevron-down-black.svg","alt","chevron-down-black","width","20","height","20",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"relative","inline-block","align-top","px-[10px]","pb-0","pt-[30px]","only:pt-0","before:absolute","before:right-1/2","before:top-0","before:h-[30px]","before:w-1/2","before:border-t-2","before:border-solid","before:border-[#ddd]","before:content-['']","after:absolute","after:left-1/2","after:right-auto","after:top-0","after:h-[30px]","after:w-1/2","after:border-l-2","after:border-t-2","after:border-solid","after:border-[#ddd]","after:content-['']","first:before:border-0","last:after:border-0","last:before:border-r-2","last:before:border-r-solid","last:before:border-r-[#ddd]","only:before:hidden","only:after:hidden"],[1,"w-[300px]","flex","items-center","gap-[12px]","p-[15px]","m-auto","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[20px]"],[1,"flex-none","flex","items-center","p-[7px]","bg-transparency-20","border-[1px]","border-solid","border-transparency-25","rounded-[40px]"],["src","assets/images/icons/branches.svg","alt","branches","width","28","height","28",1,"img-fluid","dark:invert","dark:contrast-200"],[1,"flex-1","flex","flex-col","gap-[3px]","overflow-hidden"],[1,"text-h2/[22px]","text-transparency-100","font-semibold"],["tooltipPosition","top",1,"text-h4/[18px]","text-transparency-100","font-semibold","opacity-40","truncate",3,"pTooltip"],[1,"flex","justify-center","relative"],[1,"w-full","xl:w-[1150px]","flex","flex-col","gap-[20px]","p-[20px]","bg-transparency-0","border-[1px]","border-solid","border-transparency-25","rounded-[20px]","relative","z-[2]"],[1,"flex","items-center","gap-[20px]"],[1,"flex-[1_0_0]","flex","items-center","self-stretch","relative"],["src","assets/images/header/search.svg","alt","search","width","18",1,"img-fluid","absolute","left-[10px]","top-1/2","-translate-y-1/2"],["type","text","placeholder","Search actions",1,"w-full","pl-[33px]","pr-[10px]","py-[11px]","bg-transparency-0","text-h4/[18px]","text-transparency-90","rounded-[5px]","border-[1px]","border-solid","border-transparency-25","focus:outline-none",3,"ngModelChange","input","ngModel"],[1,"flex","items-center","p-[5px]","bg-transparency-1
255","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer"],["src","assets/images/icons/close-circle-outline.svg",1,"text-transparency-100","[&_svg]:w-[24px]","[&_svg]:h-[24px]",3,"click"],[1,"flex","flex-wrap","xl:flex-nowrap","items-start","gap-[10px]","xl:gap-[15px]"],[1,"w-[235px]","xl:w-[245px]","flex","flex-col","px-[10px]","py-[10px]"],[1,"flex","px-[15px]","py-[10px]"],[1,"flex","flex-col","gap-[15px]","py-[10px]"],["src","assets/images/icons/separator-vertical.svg","alt","separator-vertical",1,"img-fluid"],[1,"flex","items-center","gap-[10px]","p-[5px]","rounded-xl",3,"class"],[1,"flex","items-center","gap-[10px]","p-[5px]","rounded-xl",3,"click"],[1,"flex-none","rounded-[20px]","p-[10px]","flex","items-center","justify-center"],[1,"text-white","[&_svg]:w-[24px]","[&_svg]:h-[24px]","[&_svg]:stroke-white","[&_svg]:fill-none",3,"src"],[1,"flex","flex-col","gap-[3px]","overflow-hidden"],["tooltipPosition","top",1,"text-h4","font-semibold","text-transparency-100","truncate","w-full",3,"pTooltip"],[1,"text-label-sm","font-semibold","text-transparency-100","opacity-40"]],template:function(e,i){e&1&&(x(0,Hx,5,0,"div",28),r(1,"div",29)(2,"div",30)(3,"div",31)(4,"div",32)(5,"div",33),h(6,"svg-icon",34),a(),r(7,"div",35)(8,"h1",36),p(9),a()()()(),r(10,"div",37),p(11),a(),r(12,"div"),x(13,Yx,1,2,"app-button",38),x(14,zx,2,1,"button",39),a()(),x(15,Jx,22,21,"div",40),a(),x(16,k1,5,3,"div",41),x(17,B1,1,4,"app-automation-enrollment",42),x(18,P1,1,4,"app-automation-activity",42),x(19,L1,1,5,"app-update-log",43)),e&2&&(g(i.isLoadingChildComponents?0:-1),s(9),T(" ",i.automationGroupName," "),s(),m("pTooltip",i.automationName?i.automationName:i.moduleName||""),s(),T("",i.automationName?i.automationName:i.moduleName||""," "),s(2),g(!i.isViewOnly&&i.selectedTab=="Builder"?13:-1),s(),g(i.isViewOnl
25y?14:-1),s(),g(i.isViewOnly?-1:15),s(),g(i.selectedTab=="Builder"?16:-1),s(),g(i.selectedTab=="Automation Enrollment"?17:-1),s(),g(i.selectedTab=="Automation Activity"?18:-1),s(),g(i.selectedTab=="Update Log"?19:-1))},dependencies:[J,Ho,G,F,U,L,et,he,rn,tn,on,Zi,_n,mn,xn,fn,Sn,Cn,sn,vn,In,Dn,Mn,Nn,Bn,Ln,Fn,Wn,qn,Hn,zn,Qn,Kn,Ka,Xa,Za],encapsulation:2})}}});var R1,tr,ir=ee(()=>{Ft();So();Vo();W();R1=[{path:"",component:bo},{path:"automation",component:bo},{path:"add-automation",component:ni},{path:"edit-automation",component:ni},{path:"automation-logs",component:ni}],tr=(()=>{class o{static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275mod=hi({type:o})}static{this.\u0275inj=_i({imports:[co.forChild(R1),co]})}}return o})()});var Bv,F1=ee(()=>{be();fe();ir();xr();So();yo();Vo();Co();ln();nn();an();en();hn();un();gn();yn();Tn();bn();dn();En();An();Vn();On();kn();Pn();Rn();Un();jn();Gn();Yn();Jn();$n();Xn();Mo();Oo();eo();Do();$i();Ar();Wi();wo();Ao();ci();pi();Eo();pn();mi();Io();qi();Hi();Yi();Ji();W();Bv=(()=>{class o{static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275mod=hi({type:o})}static{this.\u0275inj=_i({imports:[Yo,tr,ka,Zo,ha]})}}return o})()});F1();export{Bv as AutomationsModule};

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.