import{F as e}from"./_FormBuilder2.js?ver=3.1.0";import{r as t,c as r,o as i,b as l,d as a,L as n,P as o,O as s,Q as m,as as p,a as d,w as c,K as _}from"./vendor.js?ver=3.1.0";import{_ as u}from"./fc-bits-ui.js?ver=3.1.0";import{aL as h,aK as f,aP as g,ay as v,av as y}from"./vendor-element-plus.js?ver=3.1.0";import{O as b}from"./_OptionSelector.js?ver=3.1.0";const k={class:"fc_credential"},$={class:"fc_step_header"},V={key:0,class:"fcrm_import_others_doc_link"},w=["href"];const C=u({name:"CredentialVerify",components:{FormBuilder:e},props:["driver","cred","current_driver"],emits:["verified","back"],expose:["verifyConnection","verifying"],data:()=>({verifying:!1}),methods:{verifyConnection(){this.verifying=!0,this.$emit("verifying-change",!0),this.$post("migrators/verify-cred",{driver:this.driver,credential:this.cred}).then(e=>{this.$notify.success(e.message),this.$emit("verified")}).catch(e=>{this.handleError(e)}).finally(()=>{this.verifying=!1,this.$emit("verifying-change",!1)})},back(){this.$emit("back")}}},[["render",function(e,m,p,d,c,_){const u=t("form-builder");return i(),r("div",k,[l("div",$,[l("h3",null,o(e.$t("Connect with"))+" "+o(p.driver),1),l("p",null,o(e.$t("Please configure"))+" "+o(p.driver)+" "+o(e.$t("with API key")),1)]),a(u,{class:"fcrm_mb_12",formData:p.cred,fields:p.current_driver.credential_fields},null,8,["formData","fields"]),p.current_driver.doc_url?(i(),r("p",V,[l("a",{style:{"text-decoration":"underline"},target:"_blank",rel:"noopener",href:p.current_driver.doc_url},[m[0]||(m[0]=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"11",height:"11",viewBox:"0 0 11 11",fill:"none"},[l("path",{d:"M4.2 1.8V3H1.2V9.6H7.8V6.6H9V10.2C9 10.3591 8.93679 10.5117 8.82426 10.6243C8.71174 10.7368 8.55913 10.8 8.4 10.8H0.6C0.44087 10.8 0.288258 10.7368 0.175736 10.6243C0.0632141 10.5117 0 10.3591 0 10.2V2.4C0 2.24087 0.0632141 2.08826 0.175736 1.97574C0.288258 1.86321 0.44087 1.8 0.6 1.8H4.2ZM10.8 0V4.8H9.6V2.0478L4.9242 6.7242L4.0758 5.8758L8.751 1.2H6V0H10.8Z",fill:"var(--fc-deep-bg)"})],-1)),s(" "+o(e.$t("Check the documentation")),1)],8,w),s(" "+o(e.$t("for migrating from"))+" ",1),l("b",null,o(p.current_driver.title),1)])):n("",!0)])}]]),H={class:"fcrm_import_contact_field_mapper fcrm_import_tag_mapper"},M={class:"fcrm_import_tag_mapper_table"},F={key:0};const U=u({name:"ContactFieldMapper",props:["contact_fields","contact_fillables","driver"],data:()=>({}),methods:{ucFirst:e=>e?e.charAt(0).toUpperCase()+e.slice(1):""}},[["render",function(e,t,n,s,_,u){const v=h,y=f,b=g;return i(),r("div",H,[l("table",M,[l("thead",null,[l("tr",null,[l("th",null,o(u.ucFirst(n.driver))+" "+o(e.$t("Field")),1),l("th",null,o(e.$t("FluentCRM Field")),1),l("th",null,o(e.$t("Skip")),1)])]),l("tbody",null,[(i(!0),r(m,null,p(n.contact_fields,(t,s)=>(i(),r("tr",{key:s},[l("td",null,o(t.remote_label),1),l("td",null,["yes"==t.will_skip?(i(),r("span",F,o(e.$t("this value will be skipped")),1)):(i(),d(y,{key:1,modelValue:t.fluentcrm_field,"onUpdate:modelValue":e=>t.fluentcrm_field=e,filterable:"",clearable:""},{default:c(()=>[t.options?(i(!0),r(m,{key:0},p(t.options,(e,t)=>(i(),d(v,{key:t,value:t,label:e},null,8,["value","label"]))),128)):(i(!0),r(m,{key:1},p(n.contact_fillables,(e,t)=>(i(),d(v,{key:t,value:t,label:e},null,8,["value","label"]))),128))],void 0),_:2},1032,["modelValue","onUpdate:modelValue"]))]),l("td",null,[a(b,{"active-value":"yes","inactive-value":"no",modelValue:t.will_skip,"onUpdate:modelValue":e=>t.will_skip=e},null,8,["modelValue","onUpdate:modelValue"])])]))),128))])])])}]]),L={class:"fcrm_import_tag_mapper"},x={class:"fcrm_import_tag_mapper_hidden_selector"},I={key:0,class:"fcrm_import_tag_mapper_table"},A={class:"fcrm_import_tag_mapper_auto_th"},T={class:"fcrm_import_tag_mapper_auto_header"},E={class:"fcrm_import_tag_mapper_auto_label"},S={class:"fcrm_import_tag_mapper_auto_all"},O={class:"fcrm_import_tag_mapper_select_all"},j={class:"fcrm_import_tag_mapper_remote_label"},P={key:0,class:"fcrm_import_tag_mapper_auto_created"},R={key:2},B=["innerHTML"];const D=u({name:"TagMapper",components:{OptionSelector:b},props:["tag_options","driver","current_driver","item_label","option_key"],data:()=>({app_ready:!1,simulated_tag_id:"",element_ready:!1,autoCreateAll:"no"}),watch:{autoCreateAll(e){"yes"==e?this.tag_options.forEach(e=>{e.will_create="yes"}):this.tag_options.forEach(e=>{e.will_create="no"})}},methods:{initOptions(){this.element_ready=!0},ucFirst:e=>e?e.charAt(0).toUpperCase()+e.slice(1):""},mounted(){this.app_ready=!0}},[["render",function(e,s,c,_,u,h){const f=t("option-selector"),v=g;return i(),r("div",L,[l("span",x,[a(f,{onElement_ready:s[0]||(s[0]=e=>h.initOptions()),modelValue:u.simulated_tag_id,"onUpdate:modelValue":s[1]||(s[1]=e=>u.simulated_tag_id=e),field:{is_multiple:!1,creatable:!0,option_key:"tags"}},null,8,["modelValue"])]),u.app_ready?(i(),r("table",I,[l("thead",null,[l("tr",null,[l("th",null,o(h.ucFirst(c.driver))+" "+o(c.item_label),1),l("th",null,"FluentCRM "+o(c.item_label),1),l("th",A,[l("div",T,[l("span",E,o(e.$t("Auto Create"))+" "+o(c.item_label)+"? ",1),l("div",S,[a(v,{"active-value":"yes","inactive-value":"no",modelValue:u.autoCreateAll,"onUpdate:modelValue":s[2]||(s[2]=e=>u.autoCreateAll=e)},null,8,["modelValue"]),l("span",O,o(e.$t("Select All")),1)])])])])]),l("tbody",null,[(i(!0),r(m,null,p(c.tag_options,t=>(i(),r("tr",{key:t.remote_id},[l("td",null,[l("span",j,o(t.remote_name),1)]),l("td",null,["yes"==t.will_create?(i(),r("span",P,o(c.item_label)+" "+o(e.$t("will be created automatically in FluentCRM")),1)):u.element_ready?(i(),d(f,{key:1,modelValue:t.fluentcrm_id,"onUpdate:modelValue":e=>t.fluentcrm_id=e,field:{is_multiple:!1,creatable:!0,option_key:c.option_key}},null,8,["modelValue","onUpdate:modelValue","field"])):(i(),r("span",R,o(e.$t("Loading...")),1))]),l("td",null,[a(v,{"active-value":"yes","inactive-value":"no",modelValue:t.will_create,"onUpdate:modelValue":e=>t.will_create=e},null,8,["modelValue","onUpdate:modelValue"])])]))),128))])])):n("",!0),l("p",{innerHTML:c.current_driver[c.option_key+"_map_info"]},null,8,B)])}]]),K={class:"fc_step_header"},Z={key:0,class:"text-align-center fcrm_import_runner"},Q={key:1,class:"text-align-center fcrm_import_runner"},q=["innerHTML"],z={key:1,class:"text-align-left"},G={key:2,class:"text-align-center fcrm_import_runner"},J=["innerHTML"];const N=u({name:"ImportRunner",props:["driver","credential","map_settings","segment_options"],emits:["hide","import-done","importing-change","prev"],data:()=>({loading:!1,import_summary:{},importing:!1,import_completed:!1,import_info:{completed:0,total:0,import_tracker:{}},errors:!1}),methods:{fetchImportSummary(){this.loading=!0,this.$post("migrators/summary",{driver:this.driver,credential:this.credential,map_settings:this.map_settings,...this.segment_options}).then(e=>{this.import_summary=e.import_summary}).catch(e=>{this.handleError(e),this.$emit("prev")}).finally(()=>{this.loading=!1})},startImport(){this.importing=!0,this.$emit("importing-change",!0),this.$post("migrators/import",{driver:this.driver,credential:this.credential,map_settings:this.map_settings,completed:this.import_info.completed,import_tracker:this.import_info.import_tracker,...this.segment_options}).then(e=>{this.import_info=e.import_info,e.import_info.has_more?this.$nextTick(()=>{this.startImport()}):(this.import_completed=!0,this.$emit("importing-change",!1),this.$emit("import-done"))}).catch(e=>{this.importing=!1,this.$emit("importing-change",!1),this.handleError(e),this.errors=e}).finally(()=>{})},viewSubscriber(){this.$router.push({name:"subscribers"}),this.$emit("hide")}},mounted(){this.fetchImportSummary()}},[["render",function(e,t,a,m,p,c){const u=y,h=v;return _((i(),r("div",null,[l("div",K,[l("h3",null,o(e.$t("Review & Import")),1),t[0]||(t[0]=l("p",null,null,-1))]),p.import_completed?(i(),r("div",Z,[l("h3",null,o(e.$t("All contacts from"))+" "+o(a.driver)+" "+o(e.$t("has been completed.")),1)])):p.importing?(i(),r("div",Q,[l("h3",null,o(e.$t("Importing now...")),1),l("h4",null,o(e.$t("Use_Please_dnctm")),1),l("template",null,[p.import_info.total&&!p.import_info.hide_progress?(i(),d(u,{key:0,"text-inside":!0,"stroke-width":24,percentage:parseInt(p.import_info.completed/p.import_info.total*100),status:"success"},null,8,["percentage"])):n("",!0),_((i(),r("p",null,[s(o(e.$t("Migrating")),1)])),[[h,p.importing]]),l("p",{innerHTML:p.import_info.message},null,8,q),p.errors?(i(),r("div",z,[l("h4",null,o(e.$t("Importing_Error_message")),1),l("pre",null,o(p.errors),1)])):n("",!0)])])):(i(),r("div",G,[l("h2",{innerHTML:p.import_summary.message},null,8,J)]))])),[[h,p.loading]])}]]);export{C,N as I,D as T,U as a};