import{ay as e,aL as t,aK as l,k as a,aT as s,aD as o,aA as i,aw as n,e as r,aY as d,az as c,ax as m,aC as u,aB as p,i as h,aG as _,E as f,aQ as b,B as y,at as g,aE as v,aF as w,ar as k,aO as C,U as x,aj as $,av as V,g as S,aI as A,aH as F,b1 as P,b2 as T,a4 as R,a6 as D,L as O,ac as B,aJ as M}from"./vendor-element-plus.js?ver=3.1.8";import{W as j,X as L,aa as I,a8 as z,aQ as U,Z as q,a6 as Y,Y as E,a5 as W,J as N,az as H,ab as J,a0 as G,bX as K,bY as Z,bZ as Q,ac as X,bW as ee,a9 as te,_ as le,b_ as ae,ay as se,b2 as oe,ax as ie}from"./vendor.js?ver=3.1.8";import{C as ne,T as re,E as de,u as ce}from"./Tagger.js?ver=3.1.8";import{F as me}from"./Filterer.js?ver=3.1.8";import{_ as ue,I as pe,a as he,T as _e}from"./fc-bits-ui.js?ver=3.1.8";import{F as fe}from"./Filterer2.js?ver=3.1.8";import{s as be}from"./data_config.js?ver=3.1.8";import{S as ye}from"./Searcher.js?ver=3.1.8";import{P as ge}from"./PaginationBar.js?ver=3.1.8";import{D as ve}from"./DataTable.js?ver=3.1.8";import{F as we}from"./FloatingBulkActionShell.js?ver=3.1.8";import{C as ke}from"./Confirm.js?ver=3.1.8";import{O as Ce}from"./_OptionSelector.js?ver=3.1.8";import xe from"./v3app/src/Modules/Contacts/Filter/FilterPopover.js?ver=3.1.8";import $e from"./v3app/src/Modules/Contacts/Filter/ActiveFiltersBar.js?ver=3.1.8";import{_ as Ve,E as Se}from"./fc-bits.js?ver=3.1.8";import{I as Ae}from"./_IntlTelInput.js?ver=3.1.8";import{B as Fe}from"./Badge.js?ver=3.1.8";import{g as Pe,a as Te}from"./relations.js?ver=3.1.8";import{c as Re}from"./clipboard.js?ver=3.1.8";const De={key:0,class:"el-form-item__error"};const Oe=ue({name:"Error",props:["error"]},[["render",function(e,t,l,a,s,o){return l.error?(j(),L("span",De,I(l.error),1)):z("",!0)}]]),Be={class:"w-full"},Me={class:"icon"},je={key:0,class:"fcrm_company_drawer_content"};const Le=ue({name:"CompanySelector",components:{Icons:pe,CompanyInfoSideContact:ne},props:["modelValue","field"],emits:["update:modelValue"],data(){return{model:this.modelValue,results:[],loading:!1,doing_ajax:!1,companyCreateDrawer:!1,new_company:{},direction:"rtl"}},computed:{canCreateCompany(){return!(!this.field.creatable||this.field.disabled||!this.hasPermission("fcrm_manage_contact_cats"))}},watch:{model(e){this.$emit("update:modelValue",e)},modelValue(e){this.model=e}},mounted(){this.fetchOptions(""),window.fcAdmin&&window.fcAdmin.is_rtl&&(this.direction="ltr")},methods:{fetchOptions(e){if(this.hasPermission("fcrm_manage_contact_cats"))return!this.doing_ajax&&void(window.fc_all_company_cache?this.results=window.fc_all_company_cache:(this.loading=!0,this.doing_ajax=!0,this.$get("companies/search",{search:e,values:this.model}).then(e=>{this.results=e.results,e.has_more||(window.fc_all_company_cache=e.results,this.field.cacheable=!0)}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1,this.doing_ajax=!1})))},addCreatedCompany(e){if(!e||!e.id)return;this.results.some(t=>Number(t.id)===Number(e.id))||(this.results=[{id:e.id,name:e.name,email:e.email,logo:e.logo,phone:e.phone,website:e.website},...this.results]),this.model=e.id},showCompanyCreateDrawer(){this.canCreateCompany&&(this.new_company={},this.companyCreateDrawer=!0)},closeCompanyCreateDrawer(){this.companyCreateDrawer=!1,this.new_company={}},handleCompanyCreated(e){this.companyCreateDrawer=!1,this.new_company={},e&&e.id&&(window.fc_all_company_cache&&(window.fc_all_company_cache=null),this.addCreatedCompany(e))}}},[["render",function(o,i,n,r,d,c){const m=t,u=l,p=U("Icons"),h=a,_=U("company-info-side-contact"),f=s,b=e;return j(),L("div",Be,[q("div",{class:G(["fcrm_options_selector",n.field.creatable?"fcrm_option_creatable":""])},[Y((j(),E(u,{modelValue:d.model,"onUpdate:modelValue":i[0]||(i[0]=e=>d.model=e),class:"fcrm_options",multiple:n.field.is_multiple,filterable:"",remote:!n.field.cacheable,clearable:n.field.clearable,disabled:n.field.disabled,"reserve-keyword":"",size:n.field.size,placeholder:n.field.placeholder||o.$t("Please enter a keyword"),"remote-method":c.fetchOptions},{default:W(()=>[(j(!0),L(N,null,H(d.results,e=>(j(),E(m,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","multiple","remote","clearable","disabled","size","placeholder","remote-method"])),[[b,d.loading]]),c.canCreateCompany?(j(),E(h,{key:0,class:"fcrm_with_select",type:"info","aria-label":o.$t("Create Company"),title:o.$t("Create Company"),onClick:c.showCompanyCreateDrawer},{default:W(()=>[q("span",Me,[J(p,{"icon-name":"plus"})])],void 0),_:1},8,["aria-label","title","onClick"])):z("",!0)],2),c.canCreateCompany?(j(),E(f,{key:0,class:"fcrm_company_info_drawer",direction:d.direction,"with-header":!0,size:o.globalDrawerSize,"append-to-body":!0,title:o.$t("Create Company"),modelValue:d.companyCreateDrawer,"onUpdate:modelValue":i[1]||(i[1]=e=>d.companyCreateDrawer=e)},{default:W(()=>[d.companyCreateDrawer?(j(),L("div",je,[J(_,{company:d.new_company,onCompanyCreated:c.handleCompanyCreated,onCancel:c.closeCompanyCreateDrawer},null,8,["company","onCompanyCreated","onCancel"])])):z("",!0)],void 0),_:1},8,["direction","size","title","modelValue"])):z("",!0)])}]]),Ie={key:0,class:"fcrm_date_parts_picker"},ze={class:"fcrm_date_picker_month"};const Ue=ue({name:"DateDropDownPicker",props:["modelValue"],emits:["update:modelValue"],data(){return{appReady:!1,dateParts:{day:"",month:"",year:""},months:[{label:this.$t("January"),value:"01"},{label:this.$t("February"),value:"02"},{label:this.$t("March"),value:"03"},{label:this.$t("April"),value:"04"},{label:this.$t("May"),value:"05"},{label:this.$t("June"),value:"06"},{label:this.$t("July"),value:"07"},{label:this.$t("August"),value:"08"},{label:this.$t("September"),value:"09"},{label:this.$t("October"),value:"10"},{label:this.$t("November"),value:"11"},{label:this.$t("December"),value:"12"}],days:[],years:[]}},watch:{dateParts:{handler(){this.appReady&&this.pushDate()},deep:!0}},methods:{initDateParts(){if(this.modelValue){const e=window.dayjs?window.dayjs(this.modelValue):this.$dayjs(this.modelValue);this.dateParts.day=e.format("DD"),this.dateParts.month=e.format("MM"),this.dateParts.year=e.format("YYYY")}this.$nextTick(()=>{this.appReady=!0})},range:K,pushDate(){const{day:e,month:t,year:l}=this.dateParts;if(e&&t&&l){const a=(window.dayjs||this.$dayjs)(`${l}-${t}-${e}`);if(!a.isValid())return void this.$emit("update:modelValue","");this.$emit("update:modelValue",a.format("YYYY-MM-DD"))}else this.$emit("update:modelValue","")}},mounted(){this.days=Z(K(1,32),e=>Q(e,2,"0")),this.years=K((new Date).getFullYear(),1899),this.initDateParts()}},[["render",function(e,a,s,o,i,n){const r=t,d=l;return i.appReady?(j(),L("div",Ie,[q("div",null,[J(d,{clearable:"",modelValue:i.dateParts.day,"onUpdate:modelValue":a[0]||(a[0]=e=>i.dateParts.day=e),placeholder:e.$t("Day")},{default:W(()=>[(j(!0),L(N,null,H(i.days,e=>(j(),E(r,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),Y(q("p",null,I(e.$t("Day")),513),[[X,i.dateParts.day]])]),q("div",ze,[J(d,{clearable:"",modelValue:i.dateParts.month,"onUpdate:modelValue":a[1]||(a[1]=e=>i.dateParts.month=e),placeholder:e.$t("Month")},{default:W(()=>[(j(!0),L(N,null,H(i.months,e=>(j(),E(r,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),Y(q("p",null,I(e.$t("Month")),513),[[X,i.dateParts.month]])]),q("div",null,[J(d,{clearable:"",filterable:"",modelValue:i.dateParts.year,"onUpdate:modelValue":a[2]||(a[2]=e=>i.dateParts.year=e),placeholder:e.$t("Year")},{default:W(()=>[(j(!0),L(N,null,H(i.years,e=>(j(),E(r,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),Y(q("p",null,I(e.$t("Year")),513),[[X,i.dateParts.year]])])])):z("",!0)}]]),qe=ee(()=>Ve(()=>import("./v3app/src/Modules/Profile/Parts/_CustomFields.js?ver=3.1.8"),[],import.meta.url)),Ye={key:0,class:"fcrm_address_block"},Ee=["innerHTML"],We=["innerHTML"],Ne={class:"fcrm_identifier_section"},He={class:"fcrm_section_heading"},Je={class:"fcrm_identifier_content"},Ge={class:"fcrm_identifier_row"},Ke={key:0,class:"fcrm_identifier_field"},Ze={key:1,class:"fcrm_identifier_field"},Qe={class:"fcrm_identifier_field_full"};const Xe=ue({name:"Form",components:{Error:Oe,CustomFields:qe,CompanySelector:Le,OptionSelector:Ce,DateDropDownPicker:Ue,IntlTelInput:Ae},props:{subscriber:{required:!0,type:Object},errors:{required:!0,type:Object},listId:{default:null},tagId:{default:null},company_id:{default:null}},data(){return{show_address:!1,show_custom_data:!1,countries:window.fcAdmin.countries,name_prefixes:window.fcAdmin.contact_prefixes,phoneValue:"",phoneIsValid:!0,options:{statuses:this.appVars.available_contact_statuses,contact_types:this.appVars.available_contact_types,custom_fields:this.appVars.available_custom_fields}}},watch:{"subscriber.phone":{handler(e){this.phoneValue=e||""},immediate:!0},phoneValue(e){this.subscriber.phone=e||""}},methods:{disabledDate:e=>e.getTime()>=Date.now(),onPhoneValidate(e){this.phoneIsValid=!e||!!e.valid,e&&e.number?this.subscriber.phone=e.number:this.subscriber.phone=this.phoneValue||""},onPhoneBlur(){this.subscriber.phone||(this.subscriber.phone=this.phoneValue||"")}}},[["render",function(e,a,s,u,p,h){const _=t,f=l,b=n,y=i,g=o,v=r,w=U("error"),k=U("IntlTelInput"),C=d,x=U("company-selector"),$=c,V=U("custom-fields"),S=U("option-selector"),A=m;return j(),E(A,{class:"fcrm_add_contact_form","label-position":"top","label-width":"100px"},{default:W(()=>[J(g,{gutter:20},{default:W(()=>[J(y,{md:8,sm:24,xs:24},{default:W(()=>[J(b,{class:"fcrm_prefix_select",label:e.$t("Prefix")},{default:W(()=>[J(f,{modelValue:s.subscriber.prefix,"onUpdate:modelValue":a[0]||(a[0]=e=>s.subscriber.prefix=e),placeholder:e.$t("Select Prefix"),clearable:""},{default:W(()=>[(j(!0),L(N,null,H(p.name_prefixes,e=>(j(),E(_,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),J(g,{gutter:20},{default:W(()=>[J(y,{md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("First Name")},{default:W(()=>[J(v,{modelValue:s.subscriber.first_name,"onUpdate:modelValue":a[1]||(a[1]=e=>s.subscriber.first_name=e),placeholder:e.$t("e.g. John"),clearable:"",autocomplete:"off"},null,8,["modelValue","placeholder"]),J(w,{error:s.errors.get("first_name")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("Last Name")},{default:W(()=>[J(v,{modelValue:s.subscriber.last_name,"onUpdate:modelValue":a[2]||(a[2]=e=>s.subscriber.last_name=e),placeholder:e.$t("e.g. Doe"),clearable:"",autocomplete:"off"},null,8,["modelValue","placeholder"]),J(w,{error:s.errors.get("last_name")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),J(g,{gutter:20},{default:W(()=>[J(y,{md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("Email"),class:"fcrm_is-required"},{default:W(()=>[J(v,{modelValue:s.subscriber.email,"onUpdate:modelValue":a[3]||(a[3]=e=>s.subscriber.email=e),placeholder:e.$t("you@example.com"),clearable:"",autocomplete:"off",type:"email"},null,8,["modelValue","placeholder"]),J(w,{error:s.errors.get("email")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("Phone")},{default:W(()=>[J(k,{modelValue:p.phoneValue,"onUpdate:modelValue":a[4]||(a[4]=e=>p.phoneValue=e),placeholder:e.$t("+155555555"),onValidate:h.onPhoneValidate,onBlur:h.onPhoneBlur,class:"fcrm_phone_input"},null,8,["modelValue","placeholder","onValidate","onBlur"]),p.phoneIsValid?z("",!0):(j(),E(w,{key:0,error:e.$t("Invalid phone number")},null,8,["error"]))],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),J(g,{gutter:20},{default:W(()=>[J(y,{md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("Date of Birth")},{default:W(()=>[J(C,{type:"date",format:"DD/MM/YYYY","value-format":"YYYY-MM-DD","disabled-date":h.disabledDate,placeholder:e.$t("DD/MM/YYYY"),editable:!1,modelValue:s.subscriber.date_of_birth,"onUpdate:modelValue":a[5]||(a[5]=e=>s.subscriber.date_of_birth=e),style:{width:"100%"}},null,8,["disabled-date","placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),e.has_company_module&&!s.company_id?(j(),E(y,{key:0,md:12,sm:24,xs:24},{default:W(()=>[J(b,{label:e.$t("Company / Business")},{default:W(()=>[J(x,{field:{is_multiple:!1,creatable:!0},modelValue:s.subscriber.company_id,"onUpdate:modelValue":a[6]||(a[6]=e=>s.subscriber.company_id=e)},null,8,["modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})):z("",!0)],void 0,!0),_:1}),J(b,null,{default:W(()=>[J($,{modelValue:p.show_address,"onUpdate:modelValue":a[7]||(a[7]=e=>p.show_address=e)},{default:W(()=>[te(I(e.$t("Add Address Info")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1}),p.show_address?(j(),L("div",Ye,[J(g,{gutter:20},{default:W(()=>[J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("Address Line 1")},{default:W(()=>[J(v,{placeholder:e.$t("Enter street address"),autocomplete:"new-password",modelValue:s.subscriber.address_line_1,"onUpdate:modelValue":a[8]||(a[8]=e=>s.subscriber.address_line_1=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("Address Line 2 (Optional)")},{default:W(()=>[J(v,{placeholder:e.$t("Enter apartment, suite, unit"),autocomplete:"new-password",modelValue:s.subscriber.address_line_2,"onUpdate:modelValue":a[9]||(a[9]=e=>s.subscriber.address_line_2=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("City")},{default:W(()=>[J(v,{placeholder:e.$t("Enter city"),autocomplete:"new-password",modelValue:s.subscriber.city,"onUpdate:modelValue":a[10]||(a[10]=e=>s.subscriber.city=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("State")},{default:W(()=>[J(v,{placeholder:e.$t("Enter state / province"),autocomplete:"new-password",modelValue:s.subscriber.state,"onUpdate:modelValue":a[11]||(a[11]=e=>s.subscriber.state=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("Postal Code")},{default:W(()=>[J(v,{placeholder:e.$t("Enter postal code"),autocomplete:"new-password",modelValue:s.subscriber.postal_code,"onUpdate:modelValue":a[12]||(a[12]=e=>s.subscriber.postal_code=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),J(y,{md:12},{default:W(()=>[J(b,{label:e.$t("Country")},{default:W(()=>[J(f,{modelValue:s.subscriber.country,"onUpdate:modelValue":a[13]||(a[13]=e=>s.subscriber.country=e),clearable:"",filterable:"",autocomplete:"off",placeholder:e.$t("Select Country"),class:"fcrm_el-select-multiple"},{label:W(({label:e})=>[q("span",{innerHTML:e},null,8,Ee)]),default:W(()=>[(j(!0),L(N,null,H(p.countries,e=>(j(),E(_,{key:e.code,value:e.code,label:e.title},{default:W(()=>[q("span",{innerHTML:e.title},null,8,We)],void 0,!0),_:2},1032,["value","label"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1})])):z("",!0),p.options.custom_fields.length?(j(),E(b,{key:1},{default:W(()=>[J($,{modelValue:p.show_custom_data,"onUpdate:modelValue":a[14]||(a[14]=e=>p.show_custom_data=e)},{default:W(()=>[te(I(e.$t("Add Custom Data")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1})):z("",!0),p.show_custom_data?(j(),E(V,{key:2,subscriber:s.subscriber,custom_fields:p.options.custom_fields},null,8,["subscriber","custom_fields"])):z("",!0),q("section",Ne,[q("div",He,I(e.$t("Identifiers")),1),q("div",Je,[q("div",Ge,[s.listId?z("",!0):(j(),L("div",Ke,[J(b,{label:e.$t("Lists")},{default:W(()=>[J(S,{modelValue:s.subscriber.lists,"onUpdate:modelValue":a[15]||(a[15]=e=>s.subscriber.lists=e),field:{placeholder:e.$t("Select Lists"),is_multiple:!0,creatable:!0,option_key:"lists"}},null,8,["modelValue","field"])],void 0,!0),_:1},8,["label"])])),s.tagId?z("",!0):(j(),L("div",Ze,[J(b,{label:e.$t("Tags")},{default:W(()=>[J(S,{modelValue:s.subscriber.tags,"onUpdate:modelValue":a[16]||(a[16]=e=>s.subscriber.tags=e),field:{placeholder:e.$t("Select Tags"),is_multiple:!0,creatable:!0,option_key:"tags"}},null,8,["modelValue","field"])],void 0,!0),_:1},8,["label"])]))]),q("div",Qe,[J(b,{label:e.$t("Customer Status"),class:"fcrm_is-required"},{default:W(()=>[J(f,{modelValue:s.subscriber.status,"onUpdate:modelValue":a[17]||(a[17]=e=>s.subscriber.status=e),placeholder:e.$t("Select Status")},{default:W(()=>[(j(!0),L(N,null,H(p.options.statuses,t=>(j(),E(_,{key:t.id,label:e.ucFirst(t.title),value:t.id},null,8,["label","value"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"]),J(w,{error:s.errors.get("status")},null,8,["error"])],void 0,!0),_:1},8,["label"])])])]),"pending"===s.subscriber.status?(j(),E(g,{key:3},{default:W(()=>[J(y,null,{default:W(()=>[J($,{modelValue:s.subscriber.double_optin,"onUpdate:modelValue":a[18]||(a[18]=e=>s.subscriber.double_optin=e)},{default:W(()=>[te(I(e.$t("Enable Double-Optin Email Confirmation")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1})],void 0,!0),_:1})):z("",!0)],void 0),_:1})}]]),et={style:{margin:"0 -10px",display:"block"}};const tt={class:"fcrm_contact_form_handler"},lt={class:"fcrm_add_contact_footer"},at={class:"fcrm_add_contact_footer_link"},st={class:"fcrm_add_contact_footer_actions"};const ot=ue({name:"ContactFormHandler",props:["listId","tagId","company_id","form_class"],emits:["cancel","created"],components:{SkeletonLoading:ue({name:"SkeletonLoading"},[["render",function(e,t,l,a,s,o){const n=u,r=i,d=p;return j(),E(d,{animated:"",style:{"margin-top":"50px"}},{template:W(()=>[q("div",et,[J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:24},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:24},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),J(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:W(()=>[J(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1})])]),_:1})}]]),Forma:Xe},data(){return{exist:!1,errors:new Se,subscriber:this.fresh(),creating:!1}},methods:{fresh:()=>({first_name:null,last_name:null,email:null,phone:"",date_of_birth:"",status:"subscribed",address_line_1:"",address_line_2:"",city:"",state:"",postal_code:"",country:"",tags:[],lists:[],custom_values:{},double_optin:!1}),save(e=!1){if(this.errors.clear(),!this.subscriber.email)return void this.$notify.error({message:this.$t("Email field is required"),offset:19});const t={...this.subscriber};this.listId&&(t.lists=[this.listId]),this.tagId&&(t.tags=[this.tagId]),this.company_id&&(t.company_id=this.company_id),this.creating=!0,this.$post("subscribers",t).then(t=>{this.$notify.success({title:this.$t("Great!"),message:t.message,offset:19}),this.$emit("created",t.contact,e),this.subscriber=this.fresh()}).catch(e=>{this.errors.record(e),e.subscriber&&(this.exist=e.subscriber)}).finally(()=>{this.creating=!1})},cancel(){this.$emit("cancel")}}},[["render",function(e,t,l,s,o,i){const n=U("SkeletonLoading"),r=U("forma"),d=a;return j(),L("div",tt,[o.creating?(j(),E(n,{key:0,class:"fcrm_p_20"})):(j(),E(r,{key:1,"list-id":l.listId,"tag-id":l.tagId,errors:o.errors,subscriber:o.subscriber,company_id:l.company_id,class:G(l.form_class)},null,8,["list-id","tag-id","errors","subscriber","company_id","class"])),q("div",lt,[q("div",at,[J(d,{link:"",onClick:t[0]||(t[0]=e=>i.save(!0))},{default:W(()=>[te(I(e.$t("Create & Add Another")),1)],void 0),_:1})]),q("div",st,[J(d,{onClick:t[1]||(t[1]=e=>i.cancel())},{default:W(()=>[te(I(e.$t("Cancel")),1)],void 0),_:1}),J(d,{type:"primary",onClick:t[2]||(t[2]=e=>i.save())},{default:W(()=>[te(I(e.$t("Create Contact")),1)],void 0),_:1})])])])}]]),it={name:"Adder",components:{FormHandler:ot},props:{visible:Boolean,listId:[String,Number],tagId:[String,Number],options:{type:Object,default:null}},emits:["close","fetch"],data(){return{showing:this.visible,direction:"rtl"}},watch:{visible(e){this.showing=e}},methods:{handleCreated(e,t){!0===t?(this.showing=!0,this.$emit("fetch")):(this.showing=!1,this.$router.push({name:"subscriber",params:{id:e.id}}),this.$emit("close"))},handleCancel(){this.showing=!1,this.$emit("close")}},mounted(){window.fcAdmin&&window.fcAdmin.is_rtl&&(this.direction="ltr")}},nt={key:0,class:"fcrm_company_drawer_content"};const rt=ue(it,[["render",function(e,t,l,a,o,i){const n=U("form-handler"),r=s;return j(),E(r,{class:"fcrm_company_info_drawer",size:"820","append-to-body":!0,modelValue:o.showing,"onUpdate:modelValue":t[0]||(t[0]=e=>o.showing=e),"with-header":!0,direction:o.direction,title:e.$t("Add New Contact")},{default:W(()=>[o.showing?(j(),L("div",nt,[J(n,{onCreated:i.handleCreated,onCancel:i.handleCancel,listId:l.listId,tagId:l.tagId,form_class:"fcrm_p_20"},null,8,["onCreated","onCancel","listId","tagId"])])):z("",!0)],void 0),_:1},8,["modelValue","direction","title"])}]]),dt={name:"Filters",components:{Filterer:me},emits:["filter","search"],props:{type:{required:!0},options:{required:!0,type:Array},selected:{required:!0},count:{required:!0,type:Number},noMatch:{required:!0,type:Boolean}},data:()=>({query:null,placement:"bottom-start"}),computed:{selection:{get(){return this.selected},set(e){this.$emit("filter",e)}},parsedOptions(){let e=[];return"statuses"!=this.type?this.each(this.options,t=>{e.push({id:parseInt(t.id),title:t.title,slug:t.slug})}):e=this.options,e}},methods:{search(){this.$emit("search",this.query&&this.query.toLowerCase())},deselect(e){const t=this.selection.indexOf(e.slug);this.selection.splice(t,1),this.$emit("filter",this.selection)}},mounted(){this.appVars.is_rtl&&(this.placement="bottom-end")}},ct={class:"fcrm_fluentcrm-filterer"},mt={key:0,class:"fcrm_fluentcrm-meta"};const ut=ue(dt,[["render",function(e,t,l,s,o,i){const n=U("ArrowDown"),d=f,m=a,u=r,p=h,y=c,g=_,v=U("filterer"),w=b;return j(),L("div",ct,[J(v,{placement:o.placement,filter_type:l.type,class:G({"fcrm_fluentcrm-filtered":i.selection.length})},{header:W(()=>[J(m,{plain:"",size:"small"},{default:W(()=>[te(I(e.$t("Filtered by"))+" "+I(e.ucFirst(e.trans(l.type)))+" ",1),J(d,{class:"el-icon--right"},{default:W(()=>[J(n)],void 0,!0),_:1})],void 0,!0),_:1})]),items:W(()=>[J(p,{class:"fcrm_fluentcrm-filter-option fcrm_dropdown-search-item fcrm_no-hover"},{default:W(()=>[J(u,{size:"small",modelValue:o.query,"onUpdate:modelValue":t[0]||(t[0]=e=>o.query=e),placeholder:e.$t("Search..."),onInput:i.search,class:"fcrm_input"},null,8,["modelValue","placeholder","onInput"])],void 0,!0),_:1}),J(p,{class:"fcrm_fluentcrm-filter-option fcrm_dropdown-items-label"},{default:W(()=>[te(I(e.$t("Choose an option:")),1)],void 0,!0),_:1}),J(g,{modelValue:i.selection,"onUpdate:modelValue":t[1]||(t[1]=e=>i.selection=e),class:"fcrm_fluentcrm-filter-options fcrm_checkbox_group"},{default:W(()=>[(j(!0),L(N,null,H(i.parsedOptions,e=>(j(),E(y,{key:e.id,value:e.id,class:"el-dropdown-menu__item fcrm_checkbox"},{default:W(()=>[te(I(e.title),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"]),l.noMatch?(j(),E(p,{key:0,class:"fcrm_fluentcrm-filter-option"},{default:W(()=>[q("p",null,I(e.$t("No items found")),1)],void 0,!0),_:1})):z("",!0)]),_:1},8,["placement","filter_type","class"]),i.selection.length?(j(),L("div",mt,[(j(!0),L(N,null,H(i.parsedOptions,e=>(j(),L(N,{key:e.id},[-1!=l.selected.indexOf(e.id)?(j(),E(w,{key:0,closable:"",onClose:t=>i.deselect(e)},{default:W(()=>[te(I(e.title),1)],void 0),_:2},1032,["onClose"])):z("",!0)],64))),128))])):z("",!0)])}]]),pt={class:"fcrm_filter-manager"},ht={style:{padding:"10px","text-align":"center"}};const _t=ue({name:"Manager",props:["type","matched","options","selected","selection","subscribers","selectionCount","total_match"],emits:["filter"],data(){return{placement:"bottom-start",new_payload:!1,filterLabel:this.$t("Filters.instruction")}},components:{Editor:de,Filters:ut},mixins:[re],methods:{filter(e){this.$emit("filter",this.payload(e))},updatePayLoad(e){this.new_payload=e},pushPayload(){this.new_payload?(this.subscribe(this.new_payload),setTimeout(()=>{this.new_payload=!1},500)):this.$notify.error(this.$t("No changes found"))}},mounted(){this.appVars.is_rtl&&(this.placement="bottom-end")}},[["render",function(e,t,l,s,o,i){const n=a,r=U("editor"),d=U("filters");return j(),L("div",pt,[l.selection?(j(),E(r,{key:0,type:l.type,options:e.choices,noMatch:e.noMatch,matched:l.matched,selectionCount:l.selectionCount,onSearch:e.search,onSubscribe:i.updatePayLoad,placement:o.placement},{footer:W(()=>[q("div",ht,[J(n,{disabled:!o.new_payload,onClick:t[0]||(t[0]=e=>i.pushPayload()),style:{width:"100%"},type:"success",size:"small"},{default:W(()=>[te(I(e.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])])]),_:1},8,["type","options","noMatch","matched","selectionCount","onSearch","onSubscribe","placement"])):(j(),E(d,{key:1,type:l.type,options:e.choices,noMatch:e.noMatch,selected:l.selected,count:l.total_match,onSearch:e.search,onFilter:i.filter,add_label:o.filterLabel},null,8,["type","options","noMatch","selected","count","onSearch","onFilter","add_label"]))])}]]),ft={class:"icon"},bt={class:"fcrm_checkbox_group_label"};const yt=ue({name:"ColumnToggler",components:{Icons:pe,Filterer:fe,Setting:y},props:{placement:{type:String,default:"bottom-start"}},emits:["input","update:modelValue","dataChanged"],data:()=>({selection:[],subscriberColumns:be}),computed:{columnGroups(){this.has_company_module&&(window.fc_primary_company_pushed||(be.push({label:this.$t("Primary Company"),value:"primary_company",position:4}),window.fc_primary_company_pushed=!0),window.fc_companies_pushed||(be.push({label:this.$t("Companies"),value:"companies",position:4}),window.fc_companies_pushed=!0));let e=be;"yes"!==this.appVars.sms_enabled&&(e=be.filter(e=>"sms_status"!==e.value));const t=[{slug:"subscriber",label:this.$t("Primary Fields"),fields:e}];this.appVars.commerce_provider&&t.push({slug:"commerce",label:this.$t("Commerce Fields"),fields:[{label:this.$t("Lifetime Value"),value:"commerce.total_order_value",position:1},{label:this.$t("Purchase Count"),value:"commerce.total_order_count",position:2},{label:this.$t("Customer Since"),value:"commerce.first_order_date",position:3},{label:this.$t("Last Purchase Date"),value:"commerce.last_order_date",position:3}]});const l=[];return this.each(this.appVars.contact_custom_fields,(e,t)=>{l.push({label:e.label,value:e.slug,position:t+10})}),l.length&&t.push({slug:"custom_fields",label:this.$t("Custom Fields"),fields:l}),t}},methods:{init(){const e=this.storage.get("columns");e?(this.selection=e,this.fire()):(this.selection=["tags","lists","status"],this.save())},save(){var e;this.storage.set("columns",this.selection),null==(e=this.$refs.filterer)||e.hide(),this.fire()},fire(){this.$emit("input",this.selection),this.$emit("update:modelValue",this.selection),setTimeout(()=>{this.$emit("dataChanged",this.selection)},400)}},mounted(){this.init()}},[["render",function(e,t,l,s,o,i){const n=U("Icons"),r=a,d=c,m=_,u=h,p=U("filterer");return j(),E(p,{ref:"filterer",placement:l.placement},{header:W(()=>[J(r,{size:"small",class:"small only-icon-btn"},{default:W(()=>[q("span",ft,[J(n,{"icon-name":"column"})])],void 0,!0),_:1})]),items:W(()=>[J(m,{modelValue:o.selection,"onUpdate:modelValue":t[0]||(t[0]=e=>o.selection=e),class:"fcrm_filter-options fcrm_checkbox_group fcrm_column_toggler_checks"},{default:W(()=>[(j(!0),L(N,null,H(i.columnGroups,(e,t)=>(j(),L(N,{key:t},[q("div",bt,I(e.label),1),(j(!0),L(N,null,H(e.fields,(e,l)=>(j(),L("div",{key:t+" "+l,class:"el-dropdown-menu__item"},[J(d,{value:e.value,class:"fcrm_checkbox"},{default:W(()=>[te(I(e.label),1)],void 0,!0),_:2},1032,["value"])]))),128))],64))),128))],void 0,!0),_:1},8,["modelValue"])]),footer:W(()=>[J(u,{class:"fcrm_no-hover"},{default:W(()=>[J(r,{type:"primary",size:"small",style:{width:"100%"},onClick:i.save},{default:W(()=>[le(e.$slots,"btn-label",{},()=>[te(I(e.$t("Save")),1)])],void 0,!0),_:3},8,["onClick"])],void 0,!0),_:3})]),_:3},8,["placement"])}]]);const gt=ue({name:"PropertyChanger",components:{Filterer:me,ArrowDown:g},props:["options","label","prop_key","selectedSubscribers"],emits:["fetch"],data:()=>({selected_item:""}),methods:{save(){this.changeSubscribersProperty({type:this.prop_key,value:this.selected_item})},changeSubscribersProperty(e){const{type:t,value:l}=e;l?(this.loading=!0,this.$put("subscribers/subscribers-property",{property:t,value:l,subscribers:this.selectedSubscribers.map(e=>e.id)}).then(e=>{this.$notify.success(e.message),this.$emit("fetch")}).catch(e=>{console.log(e)}).finally(()=>{this.loading=!1})):this.$notify.error(this.$t("Pro_Please_saof"))}}},[["render",function(e,t,l,s,o,i){const n=U("ArrowDown"),r=f,d=a,c=h,m=w,u=v,p=U("filterer");return j(),E(p,{placement:"bottom-start"},{header:W(()=>[J(d,{plain:"",size:"small"},{default:W(()=>[te(I(e.$t("Change"))+" "+I(l.label)+" ",1),le(e.$slots,"icon",{},()=>[J(r,null,{default:W(()=>[J(n)],void 0,!0),_:1})])],void 0,!0),_:3})]),items:W(()=>[J(c,{class:"fcrm_filter-option fcrm_no-hover"},{default:W(()=>[te(I(e.$t("Choose New"))+" "+I(l.label)+": ",1)],void 0,!0),_:1}),J(u,{class:"fcrm_checkable_block",modelValue:o.selected_item,"onUpdate:modelValue":t[0]||(t[0]=e=>o.selected_item=e)},{default:W(()=>[(j(!0),L(N,null,H(l.options,e=>(j(),E(m,{key:e.id,value:e.id},{default:W(()=>[te(I(e.title),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"])]),footer:W(()=>[J(c,{class:"fcrm_no-hover"},{default:W(()=>[J(d,{type:"primary",size:"small",style:{width:"100%"},onClick:i.save},{default:W(()=>[le(e.$slots,"btn-label",{},()=>[te(I(e.$t("Change"))+" "+I(l.label),1)])],void 0,!0),_:3},8,["onClick"])],void 0,!0),_:3})]),_:3})}]]),vt={class:"fcrm_bulk_contact_custom_fields"},wt={key:0,class:"fcrm_contact_popover_header fcrm_custom_field_form"},kt={class:"fcrm_popover_header"},Ct={class:"fcrm_field_label"},xt={key:1,class:"fcrm_contact_popover_body fcrm_popover_body_flex_direction_column"},$t={class:"fcrm_popover_actions"};const Vt={class:"fcrm_bulk_action_inline"},St={class:"fcrm_bulk_wrap"},At={class:"fcrm_bulk_item"},Ft={class:"icon"},Pt={class:"icon"},Tt={key:0,style:{padding:"10px"}},Rt={class:"icon"},Dt={class:"icon"},Ot={class:"icon"},Bt={key:0,style:{padding:"10px"}},Mt={class:"icon"},jt={class:"icon"},Lt={key:0,class:"fcrm_bulk_navs"},It={key:0},zt={key:1},Ut={key:0,class:"fcrm_bulk_processing_wrap"},qt={class:"fcrm_bulk_processing--title"},Yt={class:"fcrm_secondary_text font-regular fcrm_mb_16 fcrm_bulk_processing--description"},Et={class:"fcrm_bulk_processing--bar d-flex items-center gap-4 fcrm_mb_6"},Wt={class:"fcrm_secondary_text small fcrm_bulk_processing--count"};const Nt=ue({name:"BulkContactActions",props:["selectedSubscribers","options","pagination","theme_mode"],emits:["refetch"],components:{BulkContactCustomField:ue({name:"BulkContactCustomField",components:{ArrowLeft:k},props:["options","showPopover","theme_mode"],emits:["closePopover","openPopover","updateCustomField"],data:()=>({customFieldType:"",formattedCustomFields:{},updating:!1,localShowPopover:!1}),watch:{showPopover(e){this.localShowPopover=e},localShowPopover(e){e?this.$emit("openPopover"):this.$emit("closePopover")},customFieldType(e){e&&(this.localShowPopover=!0)}},methods:{formatFields(){this.customFieldsList.forEach(e=>{"select-multi"===e.type||"checkbox"==e.type?this.formattedCustomFields[e.slug]=[]:this.formattedCustomFields[e.slug]=""})},handleCustomFieldBulk(){const e=this.selectedField,t=this.formattedCustomFields[e.slug];this.updating=!0,this.$emit("updateCustomField",{key:e.slug,type:e.type,value:t})},handleBack(){this.localShowPopover=!1,this.customFieldType=""}},computed:{contactPopoverClass(){return`fcrm_contact_popover ${"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"}`},bulkSelectPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"},bulkSelectWordbreakPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":""},customFieldsList(){return this.options.custom_fields||[]},selectedField(){return this.customFieldsList.find(e=>e.slug===this.customFieldType)}},mounted(){this.formatFields()}},[["render",function(s,o,i,n,m,u){const p=U("ArrowLeft"),h=f,b=a,y=t,g=l,k=r,x=w,$=v,V=c,S=_,A=d,F=C,P=e;return j(),L("div",vt,[J(F,{visible:m.localShowPopover,"onUpdate:visible":o[7]||(o[7]=e=>m.localShowPopover=e),placement:"bottom",width:300,trigger:"manual","popper-class":u.contactPopoverClass,effect:"dark"},{reference:W(()=>[J(g,{filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select Field"),effect:"dark","popper-class":u.bulkSelectPopperClass,modelValue:m.customFieldType,"onUpdate:modelValue":o[6]||(o[6]=e=>m.customFieldType=e),ref:"customFieldSelect"},{default:W(()=>[(j(!0),L(N,null,H(u.customFieldsList,(e,t)=>(j(),E(y,{key:t,value:e.slug,label:e.label},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["placeholder","popper-class","modelValue"])]),default:W(()=>[u.selectedField?(j(),L("div",wt,[q("div",kt,[J(b,{size:"small",text:"",onClick:u.handleBack,class:"fcrm_back_button"},{default:W(()=>[J(h,null,{default:W(()=>[J(p)],void 0,!0),_:1})],void 0,!0),_:1},8,["onClick"]),q("span",Ct,I(u.selectedField.label),1)])])):z("",!0),u.selectedField?(j(),L("div",xt,["select-one"===u.selectedField.type||"select-multi"==u.selectedField.type?(j(),E(g,{key:0,placeholder:s.$t("Select")+" "+u.selectedField.label,clearable:"",filterable:"",effect:"dark","popper-class":u.bulkSelectWordbreakPopperClass,modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[0]||(o[0]=e=>m.formattedCustomFields[u.selectedField.slug]=e),multiple:"select-multi"==u.selectedField.type,class:"fcrm_full_width",size:"small",teleported:!1},{default:W(()=>[(j(!0),L(N,null,H(u.selectedField.options,e=>(j(),E(y,{key:e,value:e,label:e},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["placeholder","popper-class","modelValue","multiple"])):"text"==u.selectedField.type||"number"==u.selectedField.type||"textarea"==u.selectedField.type?(j(),E(k,{key:1,placeholder:u.selectedField.label,size:"small",type:u.selectedField.type,modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[1]||(o[1]=e=>m.formattedCustomFields[u.selectedField.slug]=e),class:"fcrm_full_width"},null,8,["placeholder","type","modelValue"])):"radio"==u.selectedField.type?(j(),E($,{key:2,modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[2]||(o[2]=e=>m.formattedCustomFields[u.selectedField.slug]=e),size:"small"},{default:W(()=>[(j(!0),L(N,null,H(u.selectedField.options,e=>(j(),E(x,{key:e,value:e,label:e,size:"large",class:"fcrm-radio"},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["modelValue"])):"checkbox"==u.selectedField.type?(j(),E(S,{key:3,modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[3]||(o[3]=e=>m.formattedCustomFields[u.selectedField.slug]=e),class:"fcrm_checkbox_group",size:"small"},{default:W(()=>[(j(!0),L(N,null,H(u.selectedField.options,e=>(j(),E(V,{key:e,size:"large",value:e,class:"fcrm_checkbox"},{default:W(()=>[te(I(e),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"])):"date"==u.selectedField.type?(j(),E(A,{key:4,"value-format":"YYYY-MM-DD",modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[4]||(o[4]=e=>m.formattedCustomFields[u.selectedField.slug]=e),type:"date",size:"large",class:"fcrm_full_width",teleported:!1,placeholder:s.$t("Pick a date")},null,8,["modelValue","placeholder"])):"date_time"==u.selectedField.type?(j(),E(A,{key:5,"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:m.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":o[5]||(o[5]=e=>m.formattedCustomFields[u.selectedField.slug]=e),type:"datetime",size:"large",style:{width:"100%"},teleported:!1,class:"fcrm_full_width",placeholder:s.$t("Pick a date and time")},null,8,["modelValue","placeholder"])):(j(),L(N,{key:6},[te(I(u.selectedField),1)],64)),q("div",$t,[Y((j(),E(b,{disabled:m.updating,onClick:u.handleCustomFieldBulk},{default:W(()=>[q("span",null,I(s.$t("Update")),1)],void 0,!0),_:1},8,["disabled","onClick"])),[[P,m.updating]])])])):z("",!0)],void 0),_:1},8,["visible","popper-class"])])}]]),Confirm:ke,OptionSelector:Ce,Check:$,Loading:x},data(){return{delete_confirm_message:""+this.$t("Are you sure to delete?")+"
"+this.$t("delete_all_contacts_notice"),double_optin_confirm_message:""+this.$t("Are you sure to send double optin?")+"
"+this.$t("send_double_optin_contacts_notice"),actions:{},select_job:{action_name:"",selected_options:[]},doing_action:!1,select_status:"",allSelected:!1,processCount:0,processingAllBulk:!1,currentAllActionLastContactId:0,custom_field:{},showCustomFieldPopover:!1}},watch:{"select_job.action_name":{handler(){this.select_job.selected_options=[],this.select_status=""},deep:!0}},computed:{bulkSelectPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"},bulkSelectWordbreakPopperClass(){return"dark"===this.theme_mode?"fcrm_select_options_wordbreak fcrm-force-light":"fcrm_select_options_wordbreak fcrm-dark"},currentAction(){return!!this.select_job.action_name&&this.actions[this.select_job.action_name]},canSelectAll(){return this.pagination&&this.selectedSubscribers.length{this.resetAllBulkProgressState(),this.processingAllBulk=!0,this.processAllBulk()}).catch(()=>{this.allSelected=!1})},async doBulkAction(){const e=[];if(this.each(this.selectedSubscribers,t=>{e.push(t.id)}),!e.length)return this.$notify.error(this.$t("Please select subscribers first")),!1;this.doing_action=!0;const t=ae(e,100),l={action_name:this.select_job.action_name,action_options:this.select_job.selected_options,new_status:this.select_status,custom_field:this.custom_field};for(let a=0;a{a===t.length-1&&(this.$emit("refetch"),this.$notify.success(e.message))}).catch(e=>{this.handleError(e)});this.doing_action=!1},repeatBulkAction(e,t){return t.subscriber_ids=e,this.processCount+=e.length,this.$post("subscribers/do-bulk-action",t)},processAllBulk(e){const t={is_all:"yes",action_name:this.select_job.action_name,action_options:this.select_job.selected_options,new_status:this.select_status,last_id:this.currentAllActionLastContactId,per_page:400,contact_query:window.fcrm_sub_params};this.$post("subscribers/do-bulk-action",t).then(t=>{this.processCount+=parseInt(t.completed_contacts),t.is_completed?(this.processingAllBulk=!1,this.resetAllBulkProgressState(),this.$emit("refetch"),this.$notify.success(t.message),e&&e()):(this.currentAllActionLastContactId=t.last_contact_id,this.$nextTick(()=>{this.processAllBulk(e)}))}).catch(e=>{this.processingAllBulk=!1,this.resetAllBulkProgressState(),this.handleError(e)})},resetAllBulkProgressState(){this.processCount=0,this.currentAllActionLastContactId=0},updateCustomFieldValue(e){this.custom_field=e,this.showCustomFieldPopover=!1,this.handleBulkActionRoute()}},mounted(){this.actions={add_to_tags:{label:this.$t("Add To Tags"),options:this.options.tags},add_to_lists:{label:this.$t("Add To Lists"),options:this.options.lists},remove_from_tags:{label:this.$t("Remove From Tags"),options:this.options.tags},remove_from_lists:{label:this.$t("Remove From Lists"),options:this.options.lists},change_contact_status:{label:this.$t("Change Contact Status"),statuses:this.options.statuses},change_contact_type:{label:this.$t("Change Contact Type"),custom_options:this.appVars.contact_types,btn_text:this.$t("Change Contact Type"),is_multiple:!1},add_to_email_sequence:{label:this.$t("Add To Email Sequence")},add_to_automation:{label:this.$t("Add To Automation Funnel")}},this.appVars.custom_contact_bulk_actions&&this.appVars.custom_contact_bulk_actions.length&&this.each(this.appVars.custom_contact_bulk_actions,e=>{this.actions[e.action_name]||(this.actions[e.action_name]=e)}),this.has_company_module&&(this.actions.add_to_company={label:this.$t("Add To Company")},this.actions.remove_from_company={label:this.$t("Remove From Company")}),this.actions.send_double_optin={label:this.$t("Send Double Optin To Pending Contacts")},this.actions.update_custom_fields={label:this.$t("Update Custom Fields")},this.actions.delete_contacts={label:this.$t("Delete Contacts")}}},[["render",function(s,o,i,n,r,d){const c=t,m=l,u=U("Check"),p=f,h=a,_=U("Delete"),b=U("confirm"),y=U("option-selector"),g=U("BulkContactCustomField"),v=U("Loading"),w=V,k=S,C=e;return j(),L("div",Vt,[q("div",St,[q("div",At,[q("label",null,I(s.$t("Select Action")),1),J(m,{clearable:"",filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select Action"),"popper-class":d.bulkSelectPopperClass,effect:"dark",modelValue:r.select_job.action_name,"onUpdate:modelValue":o[0]||(o[0]=e=>r.select_job.action_name=e)},{default:W(()=>[(j(!0),L(N,null,H(r.actions,(e,t)=>(j(),E(c,{key:t,value:t,label:e.label},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"])]),d.currentAction&&d.currentAction.options?(j(),L(N,{key:0},[J(m,{filterable:"",clearable:"",multiple:"","collapse-tags":"","max-collapse-tags":2,size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":d.bulkSelectWordbreakPopperClass,effect:"dark",modelValue:r.select_job.selected_options,"onUpdate:modelValue":o[1]||(o[1]=e=>r.select_job.selected_options=e)},{default:W(()=>[(j(!0),L(N,null,H(d.currentAction.options,e=>(j(),E(c,{key:e.id,value:e.id,label:e.title},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"]),Y((j(),E(h,{disabled:r.doing_action||!r.select_job.selected_options.length,onClick:o[2]||(o[2]=e=>d.handleBulkActionRoute()),type:"primary",size:"small"},{default:W(()=>[q("span",Ft,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[C,r.doing_action]])],64)):"change_contact_status"==r.select_job.action_name?(j(),L(N,{key:1},[J(m,{filterable:"",clearable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":d.bulkSelectPopperClass,effect:"dark",modelValue:r.select_status,"onUpdate:modelValue":o[3]||(o[3]=e=>r.select_status=e)},{default:W(()=>[(j(!0),L(N,null,H(d.currentAction.statuses,e=>(j(),E(c,{key:e.id,value:e.id,label:e.title},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"]),Y((j(),E(h,{disabled:r.doing_action||!r.select_status,onClick:o[4]||(o[4]=e=>d.handleBulkActionRoute()),type:"primary",size:"small"},{default:W(()=>[q("span",Pt,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[C,r.doing_action]])],64)):"delete_contacts"==r.select_job.action_name?(j(),E(b,{key:2,placement:"top-start",message:r.delete_confirm_message,onYes:o[5]||(o[5]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action,size:"small",type:"danger",plain:""},{default:W(()=>[J(p,null,{default:W(()=>[J(_)],void 0,!0),_:1}),te(" "+I(s.$t("Delete Selected")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])):"send_double_optin"==r.select_job.action_name?(j(),E(b,{key:3,placement:"top-start",message:r.double_optin_confirm_message,onYes:o[6]||(o[6]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action,size:"small"},{default:W(()=>[J(p,{class:"fcrm_bulk_confirm_icon"},{default:W(()=>[J(u)],void 0,!0),_:1}),te(" "+I(s.$t("Send Double Opt-In")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])):"add_to_email_sequence"==r.select_job.action_name?(j(),L(N,{key:4},[s.has_campaign_pro?(j(),L(N,{key:1},[J(y,{modelValue:r.select_status,"onUpdate:modelValue":o[7]||(o[7]=e=>r.select_status=e),field:{option_key:"email_sequences",clearable:!0,size:"small"},effect:"dark",popper_class:d.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),J(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Email_Sequence_Confirm_Message"),onYes:o[8]||(o[8]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action||!r.select_status,type:"primary",size:"small"},{default:W(()=>[q("span",Rt,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])],64)):(j(),L("span",Tt,I(s.$t("Require FluentCRM Pro")),1))],64)):"add_to_company"==r.select_job.action_name?(j(),L(N,{key:5},[J(y,{modelValue:r.select_status,"onUpdate:modelValue":o[9]||(o[9]=e=>r.select_status=e),field:{option_key:"companies",clearable:!0,size:"small"},effect:"dark",popper_class:d.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),J(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Company_Confirm_Message"),onYes:o[10]||(o[10]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action||!r.select_status,size:"small",type:"primary"},{default:W(()=>[q("span",Dt,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])],64)):"remove_from_company"==r.select_job.action_name?(j(),L(N,{key:6},[J(y,{modelValue:r.select_status,"onUpdate:modelValue":o[11]||(o[11]=e=>r.select_status=e),field:{option_key:"companies",clearable:!0,size:"small"},effect:"dark",popper_class:d.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),J(b,{placement:"top-start",width:230,message:s.$t("Remove_Contacts_From_Company_Confirm_Message"),onYes:o[12]||(o[12]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action||!r.select_status,type:"primary",size:"small"},{default:W(()=>[q("span",Ot,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])],64)):"add_to_automation"==r.select_job.action_name?(j(),L(N,{key:7},[s.has_campaign_pro?(j(),L(N,{key:1},[J(y,{modelValue:r.select_status,"onUpdate:modelValue":o[13]||(o[13]=e=>r.select_status=e),field:{option_key:"automation_funnels",clearable:!0,size:"small"},effect:"dark",popper_class:d.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),J(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Automation_Confirm_Message"),onYes:o[14]||(o[14]=e=>d.handleBulkActionRoute())},{reference:W(()=>[Y((j(),E(h,{disabled:r.doing_action||!r.select_status,type:"primary",size:"small"},{default:W(()=>[q("span",Mt,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[C,r.doing_action]])]),_:1},8,["message"])],64)):(j(),L("span",Bt,I(s.$t("Require FluentCRM Pro")),1))],64)):"update_custom_fields"==r.select_job.action_name?(j(),E(g,{key:8,options:i.options,theme_mode:i.theme_mode,showPopover:r.showCustomFieldPopover,onUpdateCustomField:d.updateCustomFieldValue,onOpenPopover:o[15]||(o[15]=e=>r.showCustomFieldPopover=!0),onClosePopover:o[16]||(o[16]=e=>r.showCustomFieldPopover=!1)},null,8,["options","theme_mode","showPopover","onUpdateCustomField"])):d.currentAction&&d.currentAction.custom_options?(j(),L(N,{key:9},[J(m,{filterable:"",clearable:"",size:"small",multiple:d.currentAction.is_multiple,"collapse-tags":d.currentAction.is_multiple,"max-collapse-tags":d.currentAction.is_multiple?2:void 0,class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":d.bulkSelectPopperClass,effect:"dark",modelValue:r.select_status,"onUpdate:modelValue":o[17]||(o[17]=e=>r.select_status=e)},{default:W(()=>[(j(!0),L(N,null,H(d.currentAction.custom_options,(e,t)=>(j(),E(c,{key:t,value:t,label:e},null,8,["value","label"]))),128))],void 0),_:1},8,["multiple","collapse-tags","max-collapse-tags","placeholder","popper-class","modelValue"]),Y((j(),E(h,{disabled:r.doing_action||!r.select_status,onClick:o[18]||(o[18]=e=>d.handleBulkActionRoute()),type:"primary",size:"small"},{default:W(()=>[q("span",jt,[J(p,null,{default:W(()=>[J(u)],void 0,!0),_:1})]),te(" "+I(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[C,r.doing_action]])],64)):z("",!0)]),d.canSelectAll?(j(),L("div",Lt,[r.allSelected?(j(),L("p",It,[te(I(s.$t("All %s contacts selected.",s.formatMoney(i.pagination.total)))+" ",1),J(h,{size:"small",text:"",onClick:o[19]||(o[19]=e=>r.allSelected=!1)},{default:W(()=>[te(I(s.$t("Select only this page")),1)],void 0),_:1})])):(j(),L("p",zt,[te(I(s.$t("%s contacts selected.",s.formatMoney(this.selectedSubscribers.length)))+" ",1),J(h,{size:"small",text:"",onClick:o[20]||(o[20]=e=>r.allSelected=!0)},{default:W(()=>[te(I(s.$t("Select all %s contacts",s.formatMoney(i.pagination.total))),1)],void 0),_:1})]))])):z("",!0),J(k,{modelValue:r.processingAllBulk,"onUpdate:modelValue":o[21]||(o[21]=e=>r.processingAllBulk=e),width:"450px","append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fcrm_bulk_processing_dialog"},{default:W(()=>[r.processingAllBulk?(j(),L("div",Ut,[q("h3",qt,[te(I(s.$t("Action:"))+" "+I(d.currentAction.label)+" ",1),J(p,{class:"spin"},{default:W(()=>[J(v)],void 0,!0),_:1})]),q("div",Yt,I(s.$t("Please do not close this window while processing this bulk action")),1),q("div",Et,[J(w,{striped:"","striped-flow":"","text-inside":!1,"stroke-width":8,percentage:parseInt(r.processCount/i.pagination.total*100)},null,8,["percentage"])]),q("div",Wt,I(s.$t("Processing %s of %s contacts",s.formatMoney(r.processCount),s.formatMoney(i.pagination.total))),1)])):z("",!0)],void 0),_:1},8,["modelValue"])])}]]),Ht={name:"ContactsLoader",props:{columns:{type:Array,default:()=>[]},hasCompanyModule:{type:Boolean,default:!1},hasCommerceFields:{type:Boolean,default:!1},custom_fields:{type:Array,default:()=>[]},showSelection:{type:Boolean,default:!0},segmentColumnWidths:{type:Object,default:()=>({})},segmentColumnMinWidth:{type:Number,default:300},compactView:{type:Boolean,default:!1}},data:()=>({skeletonRows:[{id:1},{id:2},{id:3},{id:4},{id:5},{id:6},{id:7},{id:8},{id:9},{id:10}]})},Jt={class:"fcrm_contact_cell fcrm_contact_cell--skeleton"},Gt={style:{flex:"1",display:"flex","flex-direction":"column",gap:"0"}},Kt={class:"fcrm_pills fcrm_pills--skeleton"},Zt={class:"fcrm_pills fcrm_pills--skeleton"},Qt={class:"fcrm_company_cell fcrm_company_cell--skeleton"},Xt={class:"fcrm_datetime_cell--skeleton"},el={class:"fcrm_datetime_cell--skeleton"},tl={class:"fcrm_datetime_cell--skeleton"};function ll(e){if(null==e)return"";try{return(new Intl.NumberFormat).format(Number(e))}catch(t){return String(e)}}const al={class:"fcrm_horizontal_filter_actions"},sl={class:"fcrm_empty_state"},ol={class:"fcrm_empty_state_text"},il=["title","src","alt"],nl={class:"fcrm_contact_info"},rl={class:"fcrm_contact_name"},dl={class:"fcrm_contact_email"},cl={class:"d-flex gap-4 flex-wrap"},ml=["title"],ul={class:"fcrm_badge fcrm_segment_more_badge"},pl={key:1},hl={class:"d-flex gap-4 flex-wrap"},_l={class:"fcrm_badge fcrm_segment_more_badge"},fl={key:1},bl={key:0,class:"fcrm_company_photo"},yl=["src"],gl={style:{flex:"1"}},vl={key:1},wl={key:0},kl={key:1},Cl={key:0},xl={key:1},$l={key:0},Vl={key:1},Sl=["title"],Al={key:1},Fl={key:0},Pl=["title"],Tl=["title"],Rl=["title"],Dl={class:"icon"},Ol={key:0,class:"fcrm_selection_count_text"},Bl={class:"fcrm_selection_count_number"},Ml={class:"fcrm_selection_count_text"};const jl=ue({name:"ContactsTable",components:{Badge:Fe,ContactsLoader:ue(Ht,[["render",function(e,t,l,a,s,o){const i=u,n=p,r=A,d=F;return j(),E(d,{class:G(["fcrm_contacts_table fcrm_contacts_table--skeleton",{"fcrm_contacts_table--compact":l.compactView}]),data:s.skeletonRows,style:{width:"100%"},stripe:""},{default:W(()=>[l.showSelection?(j(),E(r,{key:0,width:"40"},{default:W(()=>[J(n,{animated:!0,style:{width:"16px"}},{template:W(()=>[J(i,{variant:"rect",style:{width:"16px",height:"16px","border-radius":"2px"}})]),_:1})]),_:1})):z("",!0),J(r,{label:e.$t("Contact"),"min-width":"300"},{default:W(()=>[q("div",Jt,[J(n,{animated:!0,style:{width:"36px",display:"flex",gap:"12px","flex-direction":"unset"}},{template:W(()=>[J(i,{variant:"circle",style:{width:"36px",height:"36px",flex:"none"}}),q("div",Gt,[J(i,{variant:"text",style:{flex:"1",height:"14px"}}),J(i,{variant:"text",style:{width:"50%",height:"14px"}})])]),_:1})])]),_:1},8,["label"]),-1!=l.columns.indexOf("prefix")?(j(),E(r,{key:1,label:e.$t("Prefix"),"min-width":"70"},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"40px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("first_name")?(j(),E(r,{key:2,label:e.$t("First Name"),"min-width":"140"},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("last_name")?(j(),E(r,{key:3,label:e.$t("Last Name"),"min-width":"140"},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("lists")?(j(),E(r,{key:4,label:e.$t("Lists"),width:l.segmentColumnWidths.lists,"min-width":l.segmentColumnMinWidth},{default:W(()=>[q("div",Kt,[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"button",style:{width:"50px",height:"22px","border-radius":"11px"}}),J(i,{variant:"button",style:{width:"60px",height:"22px","border-radius":"11px"}})]),_:1})])]),_:1},8,["label","width","min-width"])):z("",!0),-1!=l.columns.indexOf("tags")?(j(),E(r,{key:5,label:e.$t("Tags"),width:l.segmentColumnWidths.tags,"min-width":l.segmentColumnMinWidth},{default:W(()=>[q("div",Zt,[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"button",style:{width:"55px",height:"22px","border-radius":"11px"}}),J(i,{variant:"button",style:{width:"65px",height:"22px","border-radius":"11px"}})]),_:1})])]),_:1},8,["label","width","min-width"])):z("",!0),l.hasCompanyModule&&-1!=l.columns.indexOf("companies")?(j(),E(r,{key:6,"min-width":"230",label:e.$t("Companies")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),l.hasCompanyModule&&-1!=l.columns.indexOf("primary_company")?(j(),E(r,{key:7,"min-width":"220",label:e.$t("Primary Company")},{default:W(()=>[q("div",Qt,[J(n,{animated:!0,style:{width:"28px"}},{template:W(()=>[J(i,{variant:"circle",style:{width:"28px",height:"28px"}})]),_:1}),J(n,{animated:!0,style:{"margin-left":"8px"}},{template:W(()=>[J(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):z("",!0),l.hasCommerceFields?(j(),L(N,{key:8},[-1!=l.columns.indexOf("commerce.total_order_value")?(j(),E(r,{key:0,"min-width":"120",label:e.$t("Lifetime Value")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("commerce.total_order_count")?(j(),E(r,{key:1,"min-width":"120",label:e.$t("Order Count")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"40px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("commerce.first_order_date")?(j(),E(r,{key:2,"min-width":"180",label:e.$t("Customer Since")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("commerce.last_order_date")?(j(),E(r,{key:3,"min-width":"180",label:e.$t("Last order")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0)],64)):z("",!0),-1!=l.columns.indexOf("phone")?(j(),E(r,{key:9,"min-width":"120",label:e.$t("Phone")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"90px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("date_of_birth")?(j(),E(r,{key:10,"min-width":"120",label:e.$t("Date of Birth")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("address_line_1")?(j(),E(r,{key:11,"min-width":"160",label:e.$t("Address Line 1")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("address_line_2")?(j(),E(r,{key:12,"min-width":"160",label:e.$t("Address Line 2")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("city")?(j(),E(r,{key:13,"min-width":"120",label:e.$t("City")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"70px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("state")?(j(),E(r,{key:14,"min-width":"120",label:e.$t("State")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("postal_code")?(j(),E(r,{key:15,"min-width":"120",label:e.$t("Zip Code")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"50px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("country")?(j(),E(r,{key:16,"min-width":"120",label:e.$t("Country")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("contact_type")?(j(),E(r,{key:17,width:"150",label:e.$t("Type")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("status")?(j(),E(r,{key:18,width:"150",label:e.$t("Status")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"button",style:{width:"70px",height:"24px","border-radius":"4px"}})]),_:1})]),_:1},8,["label"])):z("",!0),(j(!0),L(N,null,H(l.custom_fields,e=>(j(),E(r,{width:"200",key:e.slug,label:e.label},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})]),_:1},8,["label"]))),128)),-1!=l.columns.indexOf("source")?(j(),E(r,{key:19,"min-width":"150",label:e.$t("Source")},{default:W(()=>[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"70px",height:"14px"}})]),_:1})]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("last_activity")?(j(),E(r,{key:20,"min-width":"190",label:e.$t("Last Activity")},{default:W(()=>[q("div",Xt,[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("created_at")?(j(),E(r,{key:21,"min-width":"190",label:e.$t("Date Added")},{default:W(()=>[q("div",el,[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):z("",!0),-1!=l.columns.indexOf("updated_at")?(j(),E(r,{key:22,"min-width":"190",label:e.$t("Last Changed")},{default:W(()=>[q("div",tl,[J(n,{animated:!0},{template:W(()=>[J(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):z("",!0)],void 0),_:1},8,["class","data"])}]]),Toggler:yt,Manager:_t,Searcher:ye,PropertyChanger:gt,PaginationBar:ge,DataTable:ve,FloatingBulkActionShell:we,BulkContactActions:Nt,FilterPopover:xe,ActiveFiltersBar:$e,Adder:rt,CopyDocument:B,Plus:O,ArrowDown:g,Delete:D,Download:R,Fold:T,Expand:P,Icons:pe},props:["subscribers","always_searchbar","show_skeleton","is_loading","query_data","pagination","options","ui_config","fire_ready_fetch","filter_type"],emits:["export-selected","fetch"],data:()=>({selection:!1,selectedSubscribers:[],selectionCount:0,matched_tags:[],matched_lists:[],matched_statuses:[],columns:[],hasCustomFields:!1,hasCommerceFields:!1,countries:window.fcAdmin.countries,copiedText:{id:"",title:""},pageSizes:[10,20,50,80,100,120,150],localPerPage:10,segmentColumnMinWidth:300,segmentColumnWidths:{lists:void 0,tags:void 0},compactView:!1,compactRelationLimit:2,showSearcher:!1,showAdder:!1,selectedBulkAction:null,allSelected:!1,current_mode:"system"===_e.getCurrentTheme()?_e.getSystemTheme():_e.getCurrentTheme()}),computed:{totalPages(){const e=Number(this.pagination&&this.pagination.per_page)||Number(this.localPerPage)||10,t=Number(this.pagination&&this.pagination.total)||0;return Math.max(1,Math.ceil(t/e))},custom_fields(){const e=this.appVars.contact_custom_fields;return e?e.filter(e=>-1!==this.columns.indexOf(e.slug)):[]},paginationPageSizes(){var e;return"subscribers"===(null==(e=this.$route)?void 0:e.name)?[10,20,50,100,150,300,600]:[]},canSelectAll(){if(!this.pagination||!this.pagination.per_page||!this.pagination.total)return!1;const e="subscribers"===this.$route.name,t=this.selectedSubscribers.length===this.pagination.per_page,l=this.selectedSubscribers.length0&&e.length!==this.pagination.per_page&&(this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1));const t={},l={};e.forEach(e=>{e.tags.forEach(e=>this.match(e,t)),e.lists.forEach(e=>this.match(e,l))}),this.selectionCount=e.length,this.matched_tags=t,this.matched_lists=l},match(e,t){t[e.slug]?t[e.slug]++:t[e.slug]=1},handleSortable(e){"descending"===e.order?(this.query_data.sort_by=e.prop,this.query_data.sort_type="DESC"):(this.query_data.sort_by=e.prop,this.query_data.sort_type="ASC"),this.fetch()},statusClass(e){switch((e||"").toString().toLowerCase()){case"subscribed":return"fcrm_badge--success";case"unsubscribed":default:return"fcrm_badge--neutral";case"pending":return"fcrm_badge--away";case"transactional":return"fcrm_badge--feature";case"bounced":return"fcrm_badge--info";case"complained":return"fcrm_badge--warning";case"spammed":return"fcrm_badge--error"}},subscribe({type:e,payload:t}){const{attach:l,detach:a}=t;this.loading=!0;const s={type:e,attach:l,detach:a,subscribers:this.selectedSubscribers.map(e=>e.id)};this.$post("subscribers/sync-segments",s).then(t=>{t.subscribers.forEach(e=>{const t=this.subscribers.findIndex(t=>t.id===e.id);-1!==t&&this.subscribers.splice(t,1,e),this.$refs.subscribersTable.toggleRowSelection(this.subscribers[t])});const l=`selected_${e}`;if(this[l]&&this[l].length&&a&&a.length){const t=this[l].filter(e=>a.includes(e));t.length&&this.filter({type:e,payload:t})}this.loading=!1,this.$notify.success({title:this.$t("Great!"),message:t.message,offset:19})})},maybeReFetch(){let e=!1;if(!this.hasCommerceFields&&this.appVars.commerce_provider){this.columns.filter(e=>0===e.indexOf("commerce.")).length&&(e=!0,this.hasCommerceFields=!0,this.query_data.has_commerce=!0)}-1!==this.columns.indexOf("primary_company")&&(this.query_data.primary_company=!0,e=!0),!this.hasCustomFields&&this.custom_fields.length&&(this.query_data.custom_fields=!0,this.hasCustomFields=!0,e=!0),e&&this.fetch()},filter({type:e,payload:t}){return this.query_data[e]=t,this.pagination.current_page=1,this.fetch()},search(e,t){this.options[e]=t},listeners(){this.addAction("search-subscribers","fluentcrm",e=>{this.query_data.search=e,this.pagination.current_page=1,this.fetch()}),this.addAction("loading","fluentcrm",e=>{this.loading=e})},countryName(e){return function(e,t=[]){const l=t.find(t=>t.code===e);return l?l.title:""}(e,this.countries)},copyText(e,t){if(this.copiedText.id=t,!e)return void(this.copiedText.title=this.$t("Nothing to copy"));const l=Re(e);this.copiedText.title=l?this.$t("Copied"):this.$t("Failed to copy")},handleFilterApply(e){this.query_data.lists=e.lists||[],this.query_data.tags=e.tags||[],this.query_data.statuses=e.statuses||[],this.query_data.sms_statuses=e.sms_statuses||[],this.pagination.current_page=1,this.fetch()},handleFilterBarChange(e){this.query_data.lists=e.lists||[],this.query_data.tags=e.tags||[],this.query_data.statuses=e.statuses||[],this.query_data.sms_statuses=e.sms_statuses||[],void 0!==e.search&&(this.query_data.search=e.search),this.pagination.current_page=1,this.fetch()},handleOpenFilter(e){this.$nextTick(()=>{var t,l;null==(l=null==(t=this.$refs.filterPopoverRef)?void 0:t.openFilterCategory)||l.call(t,e)})},handleAdderFetch(){this.showAdder=!1,this.fetch()},handleDeleteSelected(){this.selectedBulkAction="delete_contacts",this.$nextTick(()=>{this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.select_job.action_name="delete_contacts",this.$refs.bulkActionsRef.handleBulkActionRoute())})},handleExportSelected(){this.$emit("export-selected",{subscribers:this.selectedSubscribers,allSelected:this.allSelected,query_data:this.query_data})},handleSelectAll(){this.canSelectAll&&(this.$refs.subscribersTable&&this.subscribers&&this.subscribers.length>0&&this.subscribers.forEach(e=>{this.$refs.subscribersTable.toggleRowSelection(e,!0)}),this.allSelected=!0,this.$nextTick(()=>{this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!0,this.$refs.bulkActionsRef.$forceUpdate())}))},handleSelectOnlyThisPage(){this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1,this.$refs.bulkActionsRef.$forceUpdate())},handleDeselectAll(){this.$refs.subscribersTable&&this.$refs.subscribersTable.clearSelection(),this.selection=!1,this.selectedSubscribers=[],this.selectedBulkAction=null,this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1,this.$refs.bulkActionsRef.select_job.action_name="",this.$refs.bulkActionsRef.select_job.selected_options=[],this.$refs.bulkActionsRef.select_status="")},handleBulkActionRefetch(){ce().invalidateCache(),this.selectedBulkAction=null,this.fetch()},formatMoney:ll,getStoredSegmentColumnWidths(){const e=this.storage.get("contact_segment_column_widths",{}),t={};return["lists","tags"].forEach(l=>{const a=parseInt(e[l],10);a&&(t[l]=Math.max(a,this.segmentColumnMinWidth))}),t},initializeSegmentColumnWidths(){const e=this.getStoredSegmentColumnWidths();this.segmentColumnWidths={lists:e.lists,tags:e.tags}},initializeCompactView(){this.compactView="yes"===this.storage.get("contact_compact_table_view","no")},setCompactView(e){this.compactView=!!e,this.storage.set("contact_compact_table_view",this.compactView?"yes":"no"),this.$nextTick(()=>{var e;null==(e=this.$refs.subscribersTable)||e.doLayout()})},toggleCompactView(){this.setCompactView(!this.compactView)},handleColumnResize(e,t,l){if(!l||-1===["lists","tags"].indexOf(l.property))return;const a=Math.max(parseInt(e,10)||this.segmentColumnMinWidth,this.segmentColumnMinWidth);this.segmentColumnWidths={...this.segmentColumnWidths,[l.property]:a},this.storage.set("contact_segment_column_widths",this.segmentColumnWidths)},resetTablePreferences(){this.storage.remove("contact_segment_column_widths"),this.storage.remove("contact_compact_table_view"),this.segmentColumnWidths={lists:void 0,tags:void 0},this.compactView=!1,this.$nextTick(()=>{var e;null==(e=this.$refs.subscribersTable)||e.doLayout()}),this.$notify.success({title:this.$t("Done"),message:this.$t("Table preferences have been reset"),offset:19})},initializePerPage(){const e=parseInt(this.storage.get("contact_perpage",10))||10;this.pagination&&this.pagination.per_page?this.localPerPage=this.pagination.per_page:(this.localPerPage=e,this.pagination&&(this.pagination.per_page=e))}},watch:{"pagination.per_page":{handler(e){e&&e!==this.localPerPage&&(this.localPerPage=e)},immediate:!0},pagination:{handler(e){e&&e.per_page&&e.per_page!==this.localPerPage&&(this.localPerPage=e.per_page)},deep:!0,immediate:!0}},created(){this.initializePerPage(),this.initializeSegmentColumnWidths(),this.initializeCompactView()},mounted(){this.initializePerPage(),this.listeners(),this.onThemeChanged=e=>{var t;this.current_mode=(null==(t=e.detail)?void 0:t.effective)||_e.getCurrentTheme()},window.addEventListener(he,this.onThemeChanged),this.syncAllSelectedInterval=setInterval(()=>{this.$refs.bulkActionsRef&&this.$refs.bulkActionsRef.allSelected!==this.allSelected&&(this.allSelected=this.$refs.bulkActionsRef.allSelected)},100)},beforeUnmount(){this.syncAllSelectedInterval&&clearInterval(this.syncAllSelectedInterval),this.onThemeChanged&&window.removeEventListener(he,this.onThemeChanged)}},[["render",function(e,t,l,s,o,i){const n=U("searcher"),r=U("filter-popover"),d=U("toggler"),c=U("Expand"),m=U("Fold"),u=f,p=a,h=M,_=U("active-filters-bar"),b=U("ContactsLoader"),y=U("icons"),g=A,v=U("CopyDocument"),w=U("router-link"),k=U("Badge"),C=F,x=U("pagination-bar"),$=U("data-table"),V=U("bulk-contact-actions"),S=U("Icons"),P=U("floating-bulk-action-shell");return j(),L("div",{class:G([{fcrm_has_selections:o.selectedSubscribers.length},"fcrm_company_contacts_wrap"]),style:{position:"relative"}},[J($,{"has-selection":!1},se({"header-left":W(()=>[J(n,{disabled:"advanced"==l.filter_type,modelValue:l.query_data.search,"onUpdate:modelValue":t[0]||(t[0]=e=>l.query_data.search=e)},null,8,["disabled","modelValue"])]),"header-actions":W(()=>[le(e.$slots,"before_search_box"),J(r,{ref:"filterPopoverRef",disabled:"advanced"===l.filter_type,options:{lists:l.ui_config.show_list?l.options.lists:[],tags:l.ui_config.show_tag?l.options.tags:[],statuses:l.options.statuses,sms_statuses:l.options.sms_statuses},"selected-filters":l.query_data,onApply:i.handleFilterApply},null,8,["disabled","options","selected-filters","onApply"]),q("div",al,[J(d,{onDataChanged:t[1]||(t[1]=e=>i.maybeReFetch()),modelValue:o.columns,"onUpdate:modelValue":t[2]||(t[2]=e=>o.columns=e)},null,8,["modelValue"]),J(h,{placement:"bottom",content:o.compactView?e.$t("Default View"):e.$t("Compact View")},{default:W(()=>[J(p,{size:"small",class:G(["small only-icon-btn fcrm_compact_view_toggle",{"is-active":o.compactView}]),"aria-label":o.compactView?e.$t("Default View"):e.$t("Compact Compact View"),onClick:i.toggleCompactView},{default:W(()=>[J(u,null,{default:W(()=>[o.compactView?(j(),E(c,{key:0})):(j(),E(m,{key:1}))],void 0,!0),_:1})],void 0,!0),_:1},8,["class","aria-label","onClick"])],void 0,!0),_:1},8,["content"])]),le(e.$slots,"after_search_box")]),"active-filters":W(()=>["advanced"!==l.filter_type?(j(),E(_,{key:0,"selected-filters":l.query_data,options:{lists:l.ui_config.show_list?l.options.lists:[],tags:l.ui_config.show_tag?l.options.tags:[],statuses:l.options.statuses,sms_statuses:l.options.sms_statuses},onFilterChange:i.handleFilterBarChange,onOpenFilter:i.handleOpenFilter,plus_filter_icon:!0},null,8,["selected-filters","options","onFilterChange","onOpenFilter"])):z("",!0)]),table:W(()=>[le(e.$slots,"before_contacts_table"),l.show_skeleton?(j(),E(b,{key:0,columns:o.columns,"has-company-module":e.has_company_module,hasCommerceFields:o.hasCommerceFields,custom_fields:i.custom_fields,showSelection:e.hasPermission("fcrm_manage_contacts"),segmentColumnWidths:o.segmentColumnWidths,segmentColumnMinWidth:o.segmentColumnMinWidth,compactView:o.compactView},null,8,["columns","has-company-module","hasCommerceFields","custom_fields","showSelection","segmentColumnWidths","segmentColumnMinWidth","compactView"])):(j(),E(C,{key:1,class:G(["fcrm_contacts_table",{"fcrm_contacts_table--compact":o.compactView}]),"default-sort":{prop:l.query_data.sort_by,order:"DESC"==l.query_data.sort_type?"descending":"ascending"},data:l.subscribers,border:"",id:"fluentcrm-subscribers-table",onSelectionChange:i.onSelection,style:{width:"100%"},stripe:"",onSortChange:i.handleSortable,onHeaderDragend:i.handleColumnResize,ref:"subscribersTable"},{empty:W(()=>[q("div",sl,[J(y,{"icon-name":"common-empty-state"}),q("div",ol,[q("span",null,I(e.$t("Please create a contact to view")),1)])])]),default:W(()=>[e.hasPermission("fcrm_manage_contacts")?(j(),E(g,{key:0,type:"selection",width:"50"})):z("",!0),J(g,{label:e.$t("Contact"),"min-width":"300",property:"first_name",sortable:"custom"},{default:W(t=>[J(w,{class:"fcrm_contact_cell",to:{name:"subscriber",params:{id:t.row.id}}},{default:W(()=>[q("img",{title:e.$t("Contact ID:")+" "+t.row.id,class:"fcrm_contact_photo",src:t.row.photo,alt:t.row.full_name},null,8,il),q("div",nl,[q("div",rl,I(t.row.full_name),1),q("div",dl,[te(I(t.row.email)+" ",1),J(h,{placement:"top",content:o.copiedText.id==t.row.id?o.copiedText.title:e.$t("Copy Email")},{default:W(()=>[J(u,{class:"fcrm_copy-text",role:"button",tabindex:"0","aria-label":e.$t("Copy Email"),onClick:ie(e=>i.copyText(t.row.email,t.row.id),["stop","prevent"]),onKeydown:[oe(ie(e=>i.copyText(t.row.email,t.row.id),["prevent","stop"]),["enter"]),oe(ie(e=>i.copyText(t.row.email,t.row.id),["prevent","stop"]),["space"])]},{default:W(()=>[J(v)],void 0,!0),_:1},8,["aria-label","onClick","onKeydown"])],void 0,!0),_:2},1032,["content"])])])],void 0,!0),_:2},1032,["to"])]),_:1},8,["label"]),-1!=o.columns.indexOf("prefix")?(j(),E(g,{key:1,label:e.$t("Prefix"),"min-width":"70",property:"prefix"},{default:W(e=>[te(I(e.row.prefix),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("first_name")?(j(),E(g,{key:2,label:e.$t("First Name"),"min-width":"140",property:"first_name",sortable:"custom"},{default:W(e=>[te(I(e.row.first_name),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("last_name")?(j(),E(g,{key:3,label:e.$t("Last Name"),"min-width":"140",property:"last_name",sortable:"custom"},{default:W(e=>[te(I(e.row.last_name),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("lists")?(j(),E(g,{key:4,label:e.$t("Lists"),property:"lists",width:o.segmentColumnWidths.lists,"min-width":o.segmentColumnMinWidth,sortable:!1},{default:W(e=>[q("div",cl,[i.getRelationsArray(e.row,"lists").length?(j(),L(N,{key:0},[(j(!0),L(N,null,H(i.visibleRelations(e.row,"lists"),e=>(j(),L("span",{key:e,class:"fcrm_badge"},[q("span",{title:e},I(e),9,ml)]))),128)),i.hiddenRelations(e.row,"lists").length?(j(),E(h,{key:0,placement:"top",content:i.hiddenRelationsTooltip(e.row,"lists")},{default:W(()=>[q("span",ul,I(i.moreRelationsLabel(e.row,"lists")),1)],void 0,!0),_:2},1032,["content"])):z("",!0)],64)):(j(),L("span",pl,"--"))])]),_:1},8,["label","width","min-width"])):z("",!0),-1!=o.columns.indexOf("tags")?(j(),E(g,{key:5,label:e.$t("Tags"),property:"tags",width:o.segmentColumnWidths.tags,"min-width":o.segmentColumnMinWidth},{default:W(e=>[q("div",hl,[i.getRelationsArray(e.row,"tags").length?(j(),L(N,{key:0},[(j(!0),L(N,null,H(i.visibleRelations(e.row,"tags"),e=>(j(),L("span",{key:e,class:"fcrm_badge"},I(e),1))),128)),i.hiddenRelations(e.row,"tags").length?(j(),E(h,{key:0,placement:"top",content:i.hiddenRelationsTooltip(e.row,"tags")},{default:W(()=>[q("span",_l,I(i.moreRelationsLabel(e.row,"tags")),1)],void 0,!0),_:2},1032,["content"])):z("",!0)],64)):(j(),L("span",fl,"--"))])]),_:1},8,["label","width","min-width"])):z("",!0),-1!=o.columns.indexOf("status")?(j(),E(g,{key:6,label:e.$t("Status"),width:"150",property:"status",sortable:"custom"},{default:W(e=>[J(k,{type:e.row.status},null,8,["type"])]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("sms_status")&&"yes"===e.appVars.sms_enabled?(j(),E(g,{key:7,label:e.$t("SMS Status"),width:"150",property:"sms_status",sortable:"custom"},{default:W(e=>[J(k,{type:e.row.sms_status},null,8,["type"])]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("phone")?(j(),E(g,{key:8,"min-width":"120",label:e.$t("Phone"),property:"phone"},{default:W(t=>[te(I(t.row.phone)+" ",1),t.row.phone?(j(),E(h,{key:0,class:"fcrm_item",effect:"dark",placement:"top",content:o.copiedText.id==t.row.id?o.copiedText.title:e.$t("Copy Phone Number")},{default:W(()=>[J(u,{class:"fcrm_copy-text",role:"button",tabindex:"0","aria-label":e.$t("Copy Phone Number"),onClick:ie(e=>i.copyText(t.row.phone,t.row.id),["stop"]),onKeydown:[oe(ie(e=>i.copyText(t.row.phone,t.row.id),["stop"]),["enter"]),oe(ie(e=>i.copyText(t.row.phone,t.row.id),["prevent","stop"]),["space"])]},{default:W(()=>[J(v)],void 0,!0),_:1},8,["aria-label","onClick","onKeydown"])],void 0,!0),_:2},1032,["content"])):z("",!0)]),_:1},8,["label"])):z("",!0),e.has_company_module&&-1!=o.columns.indexOf("companies")?(j(),E(g,{key:9,"min-width":"230",label:e.$t("Companies"),property:"companies"},{default:W(e=>[q("span",null,I(i.getRelations(e.row,"companies")),1)]),_:1},8,["label"])):z("",!0),e.has_company_module&&-1!=o.columns.indexOf("primary_company")?(j(),E(g,{key:10,"min-width":"220",label:e.$t("Primary Company")},{default:W(e=>[e.row.company?(j(),E(w,{key:0,to:{name:"view_company",params:{company_id:e.row.company_id}},class:"fcrm_company_cell fcrm_photo_text"},{default:W(()=>[e.row.company.logo?(j(),L("span",bl,[q("img",{src:e.row.company.logo},null,8,yl)])):z("",!0),q("span",gl,I(e.row.company.name),1)],void 0,!0),_:2},1032,["to"])):(j(),L("span",vl,"--"))]),_:1},8,["label"])):z("",!0),o.hasCommerceFields?(j(),L(N,{key:11},[-1!=o.columns.indexOf("commerce.total_order_value")?(j(),E(g,{key:0,"min-width":"120",label:e.$t("Lifetime Value"),property:"commerce_by_provider.total_order_value"},{default:W(t=>[t.row.commerce_by_provider?(j(),L("span",wl,I(e.appVars.commerce_currency_sign)+I(t.row.commerce_by_provider.total_order_value||"-"),1)):(j(),L("span",kl,"-"))]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("commerce.total_order_count")?(j(),E(g,{key:1,"min-width":"120",label:e.$t("Order Count"),property:"commerce_by_provider.total_order_count"},{default:W(e=>[e.row.commerce_by_provider?(j(),L("span",Cl,I(e.row.commerce_by_provider.total_order_count||"-"),1)):(j(),L("span",xl,"-"))]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("commerce.first_order_date")?(j(),E(g,{key:2,"min-width":"180",label:e.$t("Customer Since"),property:"commerce_by_provider.first_order_date"},{default:W(t=>[t.row.commerce_by_provider&&t.row.commerce_by_provider.first_order_date?(j(),L("span",$l,I(e.nsDateFormat(t.row.commerce_by_provider.first_order_date)),1)):(j(),L("span",Vl,"-"))]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("commerce.last_order_date")?(j(),E(g,{key:3,"min-width":"180",label:e.$t("Last order"),property:"commerce_by_provider.last_order_date"},{default:W(t=>[t.row.commerce_by_provider&&t.row.commerce_by_provider.last_order_date?(j(),L("span",{key:0,title:t.row.commerce_by_provider.last_order_date},I(e.nsHumanDiffTime(t.row.commerce_by_provider.last_order_date)),9,Sl)):(j(),L("span",Al,"-"))]),_:1},8,["label"])):z("",!0)],64)):z("",!0),-1!=o.columns.indexOf("date_of_birth")?(j(),E(g,{key:12,"min-width":"120",label:e.$t("Date of Birth"),property:"date_of_birth"},{default:W(e=>[te(I("0000-00-00"!==e.row.date_of_birth?e.row.date_of_birth:"-"),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("address_line_1")?(j(),E(g,{key:13,"min-width":"160",label:e.$t("Address Line 1"),property:"address_line_1",sortable:"custom"},{default:W(e=>[te(I(e.row.address_line_1),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("address_line_2")?(j(),E(g,{key:14,"min-width":"160",label:e.$t("Address Line 2"),property:"address_line_2",sortable:"custom"},{default:W(e=>[te(I(e.row.address_line_2),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("city")?(j(),E(g,{key:15,"min-width":"120",label:e.$t("City"),property:"city",sortable:"custom"},{default:W(e=>[te(I(e.row.city),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("state")?(j(),E(g,{key:16,"min-width":"120",label:e.$t("State"),property:"state",sortable:"custom"},{default:W(e=>[te(I(e.row.state),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("postal_code")?(j(),E(g,{key:17,"min-width":"120",label:e.$t("Zip Code"),property:"postal_code",sortable:"custom"},{default:W(e=>[te(I(e.row.postal_code),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("country")?(j(),E(g,{key:18,"min-width":"120",label:e.$t("Country"),property:"country",sortable:"custom"},{default:W(e=>[te(I(i.countryName(e.row.country)),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("contact_type")?(j(),E(g,{key:19,label:e.$t("Type"),width:"150",property:"contact_type",sortable:"custom"},{default:W(t=>[te(I(e.ucWords(e.trans(t.row.contact_type))),1)]),_:1},8,["label"])):z("",!0),(j(!0),L(N,null,H(i.custom_fields,e=>(j(),E(g,{width:"200",key:e.slug,label:e.label},{default:W(t=>[te(I(i.formatCellValue(t.row.custom_fields,e.slug)),1)]),_:2},1032,["label"]))),128)),-1!=o.columns.indexOf("source")?(j(),E(g,{key:20,"min-width":"150",label:e.$t("Source"),property:"source"},{default:W(e=>[te(I(e.row.source),1)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("last_activity")?(j(),E(g,{key:21,prop:"last_activity",label:e.$t("Last Activity"),"min-width":"190",property:"last_activity",sortable:"custom"},{default:W(t=>[t.row.last_activity?(j(),L("span",Fl,[q("span",{title:t.row.last_activity},I(e.nsHumanDiffTime(t.row.last_activity)),9,Pl)])):z("",!0)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("created_at")?(j(),E(g,{key:22,label:e.$t("Date Added"),"min-width":"190",property:"created_at",sortable:"custom"},{default:W(t=>[t.row.created_at?(j(),L("span",{key:0,class:"fcrm_secondary_text",title:t.row.created_at},I(e.nsHumanDiffTime(t.row.created_at)),9,Tl)):z("",!0)]),_:1},8,["label"])):z("",!0),-1!=o.columns.indexOf("updated_at")?(j(),E(g,{key:23,label:e.$t("Last Changed"),"min-width":"190",property:"updated_at",sortable:"custom"},{default:W(t=>[t.row.updated_at?(j(),L("span",{key:0,class:"fcrm_secondary_text",title:t.row.updated_at},I(e.nsHumanDiffTime(t.row.updated_at)),9,Rl)):z("",!0)]),_:1},8,["label"])):z("",!0)],void 0,!0),_:1},8,["class","default-sort","data","onSelectionChange","onSortChange","onHeaderDragend"]))]),_:2},[l.show_skeleton?void 0:{name:"pagination",fn:W(()=>[J(x,{pagination:l.pagination,hide_on_single:!1,page_sizes:i.paginationPageSizes,"wrapper-class":["fcrm-contacts-pagination","fcrm-contacts-pagination-bar"],onFetch:i.fetch},null,8,["pagination","page_sizes","onFetch"])]),key:"0"}]),1024),J(P,{visible:o.selection,"theme-mode":o.current_mode,"selected-count":o.selectedSubscribers.length,"selected-label":e.$t("selected"),"show-select-all":i.canSelectAll&&!i.isAllSelected,"show-select-only-page":i.canSelectAll&&i.isAllSelected,"select-all-label":e.$t("Select All %s",i.formatMoney(l.pagination.total)),"select-only-page-label":e.$t("Select only this page"),"deselect-label":e.$t("Deselect"),onSelectAll:i.handleSelectAll,onSelectOnlyPage:i.handleSelectOnlyThisPage,onDeselect:i.handleDeselectAll},{actions:W(()=>[J(V,{ref:"bulkActionsRef",onRefetch:i.handleBulkActionRefetch,pagination:l.pagination,selectedSubscribers:o.selectedSubscribers,options:l.options,theme_mode:o.current_mode},null,8,["onRefetch","pagination","selectedSubscribers","options","theme_mode"]),J(p,{size:"small",onClick:i.handleExportSelected},{default:W(()=>[q("span",Dl,[J(S,{"icon-name":"export"})]),te(" "+I(e.$t("Export")),1)],void 0,!0),_:1},8,["onClick"])]),count:W(()=>[i.isAllSelected?(j(),L("span",Ol,I(e.$t("All %s selected",i.formatMoney(l.pagination.total))),1)):(j(),L(N,{key:1},[q("span",Bl,I(o.selectedSubscribers.length),1),q("span",Ml,I(e.$t("selected")),1)],64))]),_:1},8,["visible","theme-mode","selected-count","selected-label","show-select-all","show-select-only-page","select-all-label","select-only-page-label","deselect-label","onSelectAll","onSelectOnlyPage","onDeselect"])],2)}]]);export{rt as A,jl as C,ot as F,ll as f};