PageSourceSearch

https://socialselling.ai/_next/static/chunks/16750-2e4376aaa2795e5f.js

js socialselling.ai collected 2026-10-05 14:50:21 UTC 67,012 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16750],{24524:function(e,a,s){s.d(a,{p:function(){return U}});var t=s(57437),l=s(2265),r=s(74291),n=s(12381),i=s(40279),d=s(75060),o=s(68245),c=s(94589),m=s(23675),x=s(69174),u=s(15291),h=s(17168),p=s(13041),g=s(15863),v=s(48662),b=s(53417),j=s(11239),f=s(98420),_=s(92369),N=s(29202),w=s(48736),k=s(70112),y=s(42820),C=s(77945),D=s(99397),S=s(18930),A=s(82718),I=s(66901),Z=s(32489),L=s(37806),F=s(95805),T=s(30401),E=s(82431),P=s(33276),z=s(71837),Q=s(14438),V=s(93448);let q=["sia_female","sia","dhruv_male","viraj_male","monika_female","sruthi_female"],R=[{value:"en",label:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},{value:"hi",label:"Hindi",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"ta",label:"Tamil",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"te",label:"Telugu",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"ml",label:"Malayalam",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"kn",label:"Kannada",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"bn",label:"Bengali",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"mr",label:"Marathi",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"gu",label:"Gujarati",flag:"\uD83C\uDDEE\uD83C\uDDF3"},{value:"pa",label:"Punjabi",flag:"\uD83C\uDDEE\uD83C\uDDF3"}],U=(0,l.forwardRef)(function(e,a){var s,U;let{open:H,onOpenChange:B,pipelineId:G,workspaceId:W,onSave:M,draftMode:O,hideSaveButton:Y,initialSettings:K,embedded:J}=e,[X,$]=(0,l.useState)(!0),[ee,ea]=(0,l.useState)(!1),[es,et]=(0,l.useState)(!1),[el,er]=(0,l.useState)([]),[en,ei]=(0,l.useState)([]),[ed,eo]=(0,l.useState)(""),[ec,em]=(0,l.useState)(null),[ex,eu]=(0,l.useState)(!1),[eh,ep]=(0,l.useState)(!1),[eg,ev]=(0,l.useState)(""),[eb,ej]=(0,l.useState)("AI Assistant"),[ef,e_]=(0,l.useState)(""),[eN,ew]=(0,l.useState)([]),[ek,ey]=(0,l.useState)("en"),[eC,eD]=(0,l.useState)("sia_female"),[eS,eA]=(0,l.useState)("elevenlabs"),[eI,eZ]=(0,l.useState)({}),[eL,eF]=(0,l.useState)(""),[eT,eE]=(0,l.useState)(""),[eP,ez]=(0,l.useState)(!1),[eQ,eV]=(0,l.useState)(""),[eq,eR]=(0,l.useState)(!1),[eU,eH]=(0,l.useState)(""),[eB,eG]=(0,l.useState)([]),[eW,eM]=(0,l.useState)(!1),[eO,eY]=(0,l.useState)(!0),[eK,eJ]=(0,l.useState)(""),eX=async()=>{var e,a,s,t,l;if(W){eM(!0),eJ("");try{let t=await z.api.get("/lead-pipelines/whatsapp/templates?workspace_id=".concat(W));eG((null===(e=t.data)||void 0===e?void 0:e.templates)||[]),eY((null===(a=t.data)||void 0===a?void 0:a.configured)!==!1),eJ((null===(s=t.data)||void 0===s?void 0:s.error)||"")}catch(e){eY(!0),eJ((null==e?void 0:null===(l=e.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||"request failed")}finally{eM(!1)}}};(0,l.useEffect)(()=>{eX()},[W]);let[e$,e0]=(0,l.useState)(""),[e5,e2]=(0,l.useState)([""]),[e3,e1]=(0,l.useState)(""),[e4,e8]=(0,l.useState)(null),[e7,e6]=(0,l.useState)(!1),[e9,ae]=(0,l.useState)("none"),[aa,as]=(0,l.useState)("none"),[at,al]=(0,l.useState)("none"),[ar,an]=(0,l.useState)("round_robin"),[ai,ad]=(0,l.useState)("round_robin"),[ao,ac]=(0,l.useState)("manual_assignment"),[am,ax]=(0,l.useState)(""),[au,ah]=(0,l.useState)(""),[ap,ag]=(0,l.useState)(""),[av,ab]=(0,l.useState)(!1),[aj,af]=(0,l.useState)("round_robin"),[a_,aN]=(0,l.useState)([]),[aw,ak]=(0,l.useState)([]),[ay,aC]=(0,l.useState)(0),[aD,aS]=(0,l.useState)([]),[aA,aI]=(0,l.useState)(!1),[aZ,aL]=(0,l.useState)(!1),[aF,aT]=(0,l.useState)(!1),[aE,aP]=(0,l.useState)(!1),[az,aQ]=(0,l.useState)("sia_female");(0,l.useEffect)(()=>{z.api.get("/ai-calls/settings/caller-numbers").then(e=>{var a;return ew((null===(a=e.data)||void 0===a?void 0:a.numbers)||[])}).catch(()=>ew([]))},[]),(0,l.useEffect)(()=>{if(H){if(O){if($(!1),K){var e,a,s,t;ep(null!==(a=K.is_enabled)&&void 0!==a&&a),ev(K.company_name||""),e_(K.caller_ids||""),ej(K.agent_name||"AI Assistant"),ey(K.language||"en");let l=(K.voice_provider||"elevenlabs").toLowerCase();eA(l);let r=K.voice_type||("pipecat_sip"===l?"en-IN-Chirp3-HD-Aoede":"sia_female");"pipecat_sip"===l&&r&&!r.includes("Chirp3-HD")&&(r=({aoede_ml:"ml-IN-Chirp3-HD-Aoede",kore_ml:"ml-IN-Chirp3-HD-Kore",puck_ml:"ml-IN-Chirp3-HD-Puck"})[r.toLowerCase()]||r),eD(r),eF(K.product_context||""),eE(K.greeting_template||""),ez(null!==(s=K.first_touch_text_enabled)&&void 0!==s&&s),eV(K.first_touch_text_template||""),eR(null!==(t=K.first_touch_voice_enabled)&&void 0!==t&&t),eH(K.first_touch_voice_language||""),e0(K.engagement_hook||""),e2((null===(e=K.qualification_questions)||void 0===e?void 0:e.length)?K.qualification_questions:[""]),e1(K.closing_message||""),an(K.hot_lead_action||"round_robin"),ad(K.warm_lead_action||"round_robin"),ac(K.cold_lead_action||"manual_assignment"),ax(K.hot_single_user_id||""),ah(K.warm_single_user_id||""),ag(K.cold_single_user_id||""),ab(K.assignment_enabled||!1),af(K.assignment_strategy||"round_robin"),aN(K.assignment_agent_ids||[]),K.advanced_voice_settings&&eZ(K.advanced_voice_settings)}aq((null==K?void 0:K.voice_provider)||"elevenlabs")}else G&&(aV(),aR(),aU(),aH())}},[H,G,O]),(0,l.useImperativeHandle)(a,()=>({getSettings:()=>{var e,a,s,t,l,r;return{is_enabled:eh,company_name:eg,agent_name:eb,voice_type:eC,language:ek,caller_ids:ef,greeting_template:eT.trim()||void 0,engagement_hook:e$.trim()||void 0,product_context:eL.trim()||void 0,qualification_questions:e5.filter(e=>e.trim()),closing_message:e3.trim()||void 0,ai_instructions:void 0,trigger_on_new_lead:!0,max_attempts:3,hot_threshold:70,warm_threshold:40,hot_stage_slug:"none"!==e9?null===(a=en.find(e=>e.id===e9))||void 0===a?void 0:null===(e=a.name)||void 0===e?void 0:e.toLowerCase().replace(/\s+/g,"_"):void 0,warm_stage_slug:"none"!==aa?null===(t=en.find(e=>e.id===aa))||void 0===t?void 0:null===(s=t.name)||void 0===s?void 0:s.toLowerCase().replace(/\s+/g,"_"):void 0,cold_stage_slug:"none"!==at?null===(r=en.find(e=>e.id===at))||void 0===r?void 0:null===(l=r.name)||void 0===l?void 0:l.toLowerCase().replace(/\s+/g,"_"):void 0,hot_lead_action:ar,warm_lead_action:ai,cold_lead_action:ao,hot_single_user_id:am||void 0,warm_single_user_id:au||void 0,cold_single_user_id:ap||void 0,assignment_enabled:av,assignment_strategy:aj,assignment_agent_ids:a_.length>0?a_:void 0,voice_provider:eS,advanced_voice_settings:{...eI,voice_provider:eS},first_touch_text_enabled:eP,first_touch_text_template:eQ.trim()||null}}}),[eh,eg,eb,eC,ek,eL,eT,e$,e5,e3,e9,aa,at,en,ar,ai,ao,am,au,ap,av,aj,a_,eS,eI,eP,eQ]),(0,l.useEffect)(()=>{H&&aq(eS)},[H,eS]);let aV=async()=>{$(!0);try{var e,a,s,t;let l=await z.api.get("/lead-pipelines/".concat(G,"/ai-calling-settings?workspace_id=").concat(W)),r=null===(e=l.data)||void 0===e?void 0:e.settings;if(r){ep(r.is_enabled||!1),ev(r.company_name||""),e_(r.caller_ids||""),ej(r.agent_name||"AI Assistant"),ey(r.language||"en");let e=r.advanced_voice_settings||{};eZ(e);let l=(e.voice_provider||"elevenlabs").toLowerCase();eA(l);let n=r.voice_type||("pipecat_sip"===l?"en-IN-Chirp3-HD-Aoede":"sia_female");"pipecat_sip"===l&&n&&!n.includes("Chirp3-HD")&&(n=({aoede_ml:"ml-IN-Chirp3-HD-Aoede",kore_ml:"ml-IN-Chirp3-HD-Kore",puck_ml:"ml-IN-Chirp3-HD-Puck"})[n.toLowerCase()]||n),eD(n),eF(r.product_context||""),eE(r.greeting_template||""),ez(null!==(s=r.first_touch_text_enabled)&&void 0!==s&&s),eV(r.first_touch_text_template||""),eR(null!==(t=r.first_touch_voice_enabled)&&void 0!==t&&t),eH(r.first_touch_voice_language||""),e0(r.engagement_hook||""),e2((null===(a=r.qualification_questions)||void 0===a?void 0:a.length)>0?r.qualification_questions:[""]),e1(r.closing_message||""),ae(r.hot_stage_id||"none"),as(r.warm_stage_id||"none"),al(r.cold_stage_id||"none"),an(r.hot_lead_action||"round_robin"),ad(r.warm_lead_action||"round_robin"),ac(r.cold_lead_action||"manual_assignment"),ax(r.hot_single_user_id||""),ah(r.warm_single_user_id||""),ag(r.cold_single_user_id||""),ab(r.assignment_enabled||!1),af(r.assignment_strategy||"round_robin"),aN(r.assignment_agent_ids||[])}}catch(e){console.error("Failed to load AI settings:",e)}finally{$(!1)}},aq=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"elevenlabs";aP(!0);try{var a;let s=await z.api.get("/ai-calls/settings/voices?engine=".concat(e));(null===(a=s.data)||void 0===a?void 0:a.voices)&&(er(s.data.voices),s.data.default_voice&&aQ(s.data.default_voice))}catch(e){console.error("Failed to load voices:",e)}finally{aP(!1)}},aR=async()=>{try{var e;let a=await z.api.get("/lead-pipelines/".concat(G,"/stages?workspace_id=").concat(W));(null===(e=a.data)||void 0===e?void 0:e.stages)?ei(a.data.stages):Array.isArray(a.data)&&ei(a.data)}catch(e){console.error("Failed to load stages:",e)}},aU=async()=>{try{var e,a,s,t;let l=await z.api.get("/lead-pipelines/".concat(G,"?workspace_id=").concat(W)),r=(null===(a=l.data)||void 0===a?void 0:null===(e=a.pipeline)||void 0===e?void 0:e.agent_group_ids)||(null===(s=l.data)||void 0===s?void 0:s.agent_group_ids)||[];
1if(0===r.length){ak([]);return}let n=[],i=new Set;for(let e of r)try{let[a,s]=await Promise.all([z.api.get("/agent-groups/".concat(e)),z.api.get("/agent-groups/".concat(e,"/members"))]),l=(null===(t=a.data)||void 0===t?void 0:t.name)||"Unknown Group";for(let e of s.data||[])i.has(e.user_id)||(i.add(e.user_id),n.push({user_id:e.user_id,user_email:e.user_email,user_name:e.user_name,group_name:l}))}catch(a){console.error("Failed to load group ".concat(e,":"),a)}ak(n)}catch(e){console.error("Failed to load pipeline groups:",e)}},aH=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];aI(!0);try{var a;let s=e?aD.length:0,t=await z.api.get("/ai-calls/pipeline/".concat(G,"/uncalled-leads?limit=50&offset=").concat(s));(null===(a=t.data)||void 0===a?void 0:a.success)&&(aC(t.data.total_count||0),aL(t.data.has_more||!1),e?aS(e=>[...e,...t.data.leads||[]]):aS(t.data.leads||[]))}catch(e){console.error("Failed to load uncalled leads:",e)}finally{aI(!1)}},aB=async e=>{var a,s,t,l;if(!eh){Q.A.error("Enable AI calling first before triggering calls");return}let r="/ai-calls/pipeline/".concat(G,"/trigger-calls");console.log("[TRIGGER-CALLS] Starting request to:",r,"pipelineId:",G),aT(!0);try{let t=await z.api.post(r,{limit:e||null});if(console.log("[TRIGGER-CALLS] Response:",t.data),null===(a=t.data)||void 0===a?void 0:a.success){let{queued_count:e,skipped_no_phone:a,batch_id:s}=t.data;e>0?(Q.A.success("Queued ".concat(e," leads for AI calling")),aH()):Q.A.info(t.data.message||"No leads to queue"),a>0&&(0,Q.A)("".concat(a," leads skipped (no phone number)"),{icon:"⚠️"})}else Q.A.error((null===(s=t.data)||void 0===s?void 0:s.message)||"Failed to trigger calls")}catch(e){console.error("Failed to trigger calls:",e),Q.A.error((null===(l=e.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||"Failed to trigger calls")}finally{aT(!1)}},aG=e=>{aN(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},aW=async()=>{if(!eg.trim()){Q.A.error("Company name is required");return}ea(!0);try{let e=e5.filter(e=>""!==e.trim());await z.api.put("/lead-pipelines/".concat(G,"/ai-calling-settings?workspace_id=").concat(W),{is_enabled:eh,trigger_on_new_lead:eh,company_name:eg.trim(),agent_name:eb.trim()||"AI Assistant",language:ek,caller_ids:ef.trim(),voice_type:eC,voice_provider:eS,advanced_voice_settings:{...eI,voice_provider:eS},product_context:eL.trim()||null,greeting_template:eT.trim(),first_touch_text_enabled:eP,first_touch_text_template:eQ.trim()||null,first_touch_voice_enabled:eq,first_touch_voice_language:eU.trim()||null,engagement_hook:e$.trim()||null,qualification_questions:e,closing_message:e3.trim()||null,hot_stage_id:e9&&"none"!==e9?e9:null,warm_stage_id:aa&&"none"!==aa?aa:null,cold_stage_id:at&&"none"!==at?at:null,hot_lead_action:ar,warm_lead_action:ai,cold_lead_action:ao,hot_single_user_id:am||null,warm_single_user_id:au||null,cold_single_user_id:ap||null,assignment_enabled:av,assignment_strategy:aj,assignment_agent_ids:a_}),Q.A.success("AI settings saved successfully"),null==M||M()}catch(s){var e,a;Q.A.error((null==s?void 0:null===(a=s.response)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.detail)||"Failed to save settings")}finally{ea(!1)}},aM=async()=>{var e,a,s,t,l,r;let n=e5.filter(e=>e.trim());if(0===n.length){Q.A.error("No questions to translate");return}if("en"===ek){Q.A.info("Questions are already in English");return}e6(!0);try{let l=await z.api.post("/ai-calls/settings/translate-questions",{questions:n,target_language:ek,source_language:"en"});if((null===(e=l.data)||void 0===e?void 0:e.success)&&(null===(a=l.data)||void 0===a?void 0:a.translated_questions)){let e=l.data.translated_questions,a=e5.map((a,s)=>{if(!a.trim())return a;let t=n.indexOf(a);return t>=0&&e[t]?e[t]:a});e2(a),Q.A.success("Translated ".concat(e.length," questions to ").concat((null===(s=R.find(e=>e.value===ek))||void 0===s?void 0:s.label)||ek))}else Q.A.error((null===(t=l.data)||void 0===t?void 0:t.error)||"Translation failed")}catch(e){Q.A.error((null==e?void 0:null===(r=e.response)||void 0===r?void 0:null===(l=r.data)||void 0===l?void 0:l.detail)||"Failed to translate questions")}finally{e6(!1)}},aO=async()=>{var e,a,s;if(!ed.trim()){Q.A.error("Please enter a phone number");return}let t=ed.replace(/\D/g,""),l=t.startsWith("91")||10===t.length&&/^[6-9]/.test(t);if("pipecat_sip"===eS&&!l){Q.A.error("Studio SIP only supports Indian phone numbers (+91). Use Premium for international.");return}et(!0);try{let a=await z.api.post("/ai-calls/test-call",{phone_number:ed.trim(),pipeline_id:G,language:ek,voice_id:eC,provider:eS,telephony:"pipecat_sip"===eS?"india":l?"india":"international"});Q.A.success("Test call initiated! You will receive a call shortly.");let s=null==a?void 0:null===(e=a.data)||void 0===e?void 0:e.conversation_id;s&&aY(s)}catch(e){Q.A.error((null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to initiate test call")}finally{et(!1)}},aY=async e=>{eu(!0),em({conversation_id:e,status:"in_progress",classification:null,score:null,summary:null,transcript:"",duration_seconds:0});let a=0,s=async()=>{try{let t=await z.api.get("/ai-calls/test-call-status/".concat(e));if(em(t.data),"completed"===t.data.status||"done"===t.data.status){eu(!1);return}++a<60?setTimeout(s,5e3):(eu(!1),Q.A.error("Test call polling timed out"))}catch(e){++a<60?setTimeout(s,5e3):eu(!1)}};setTimeout(s,1e4)},aK=e=>{e5.length>1&&e2(e5.filter((a,s)=>s!==e))},aJ=(e,a)=>{let s=[...e5];s[e]=a,e2(s)},aX="pipecat_sip"===eS,a$=el.filter(e=>{var a,s,t;return aX?(null===(a=e.accent)||void 0===a?void 0:a.toLowerCase())==="indian":q.includes(e.ke
1y)||(null===(s=e.accent)||void 0===s?void 0:s.toLowerCase())==="indian"||(null===(t=e.accent)||void 0===t?void 0:t.toLowerCase())==="standard"}),a0=el.filter(e=>{var a,s,t;let l=aX?(null===(a=e.accent)||void 0===a?void 0:a.toLowerCase())==="indian":q.includes(e.key)||(null===(s=e.accent)||void 0===s?void 0:s.toLowerCase())==="indian"||(null===(t=e.accent)||void 0===t?void 0:t.toLowerCase())==="standard";return"female"===e.gender&&!l}),a5=el.filter(e=>{var a,s,t;let l=aX?(null===(a=e.accent)||void 0===a?void 0:a.toLowerCase())==="indian":q.includes(e.key)||(null===(s=e.accent)||void 0===s?void 0:s.toLowerCase())==="indian"||(null===(t=e.accent)||void 0===t?void 0:t.toLowerCase())==="standard";return"male"===e.gender&&!l}),a2=eg.trim()&&eb.trim()&&ek&&eC,a3=(0,t.jsxs)("div",{className:J?"":"max-w-2xl p-0 gap-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"relative bg-gradient-to-r from-violet-600 via-purple-600 to-indigo-600 px-4 py-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"h-10 w-10 rounded-xl bg-white/20 backdrop-blur-sm flex items-center justify-center",children:(0,t.jsx)(p.Z,{className:"h-5 w-5 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"AI Call Settings"}),(0,t.jsx)("p",{className:"text-sm text-white/70",children:"Configure your AI calling agent"})]})]}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{className:(0,V.cn)("flex items-center gap-2 px-3 py-1.5 rounded-full transition-all",eh?"bg-emerald-500/20 border border-emerald-400/30":"bg-white/10 border border-white/20"),children:[(0,t.jsx)("div",{className:(0,V.cn)("h-2 w-2 rounded-full",eh?"bg-emerald-400 animate-pulse":"bg-white/40")}),(0,t.jsx)("span",{className:"text-sm font-medium text-white",children:eh?"Active":"Inactive"}),(0,t.jsx)(c.r,{checked:eh,onCheckedChange:ep,className:"data-[state=checked]:bg-emerald-500"})]})})]}),(0,t.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-white/5 rounded-full -translate-y-1/2 translate-x-1/2"}),(0,t.jsx)("div",{className:"absolute bottom-0 left-20 w-20 h-20 bg-white/5 rounded-full translate-y-1/2"})]}),(0,t.jsx)("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-minimal",children:X?(0,t.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(g.Z,{className:"h-8 w-8 animate-spin text-violet-500 mx-auto mb-3"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading settings..."})]})}):(0,t.jsxs)(h.Tabs,{defaultValue:"script",className:"w-full",children:[(0,t.jsx)("div",{className:"pt-4 border-b border-slate-200 dark:border-slate-700",children:(0,t.jsxs)(h.TabsList,{className:"grid w-full grid-cols-4 h-10",children:[(0,t.jsxs)(h.TabsTrigger,{value:"script",className:"gap-1.5 px-2",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4"}),"Voice Call"]}),(0,t.jsxs)(h.TabsTrigger,{value:"wavoice",className:"gap-1.5 px-2",children:[(0,t.jsx)(v.Z,{className:"h-4 w-4"}),"WA Voice"]}),(0,t.jsxs)(h.TabsTrigger,{value:"text",className:"gap-1.5 px-2",children:[(0,t.jsx)(b.Z,{className:"h-4 w-4"}),"Text"]}),(0,t.jsxs)(h.TabsTrigger,{value:"actions",className:"gap-1.5 px-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4"}),"Actions"]})]})}),(0,t.jsxs)(h.TabsContent,{value:"script",className:"mt-0",children:[(0,t.jsx)("div",{className:"py-4 space-y-5",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(d._,{htmlFor:"company-name",className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:["Company Name ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(f.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),(0,t.jsx)(i.I,{id:"company-name",placeholder:"Acme Inc.",value:eg,onChange:e=>ev(e.target.value),className:"pl-10 h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20"})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d._,{htmlFor:"agent-name",className:"text-xs font-medium text-slate-600 dar
1k:text-slate-400",children:"Agent Name"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(_.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),(0,t.jsx)(i.I,{id:"agent-name",placeholder:"AI Assistant",value:eb,onChange:e=>ej(e.target.value),className:"pl-10 h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20"})]})]}),(0,t.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,t.jsx)(d._,{className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:"Outbound Caller IDs"}),0===eN.length?(0,t.jsx)(i.I,{id:"caller-ids",placeholder:"917965080559, 917965080560 (comma-separated DIDs)",value:ef,onChange:e=>e_(e.target.value),className:"h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eN.map(e=>{let a=ef.split(",").map(e=>e.trim()).includes(e);return(0,t.jsxs)("label",{className:(0,V.cn)("flex items-center gap-2 px-3 h-10 rounded-md border cursor-pointer text-sm",a?"border-violet-500 bg-violet-50 dark:bg-violet-950/30":"border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-900"),children:[(0,t.jsx)(o.X,{checked:a,onCheckedChange:()=>{let a=new Set(ef.split(",").map(e=>e.trim()).filter(Boolean));a.has(e)?a.delete(e):a.add(e),e_(Array.from(a).join(","))}}),e]},e)})}),(0,t.jsx)("p",{className:"text-[11px] text-slate-400",children:"Tick the numbers to rotate as caller-ID across calls. None ticked = account default DID."})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d._,{htmlFor:"language",className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:"Language"}),(0,t.jsxs)(u.Ph,{value:ek,onValueChange:ey,children:[(0,t.jsx)(u.i4,{className:"h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.Z,{className:"h-4 w-4 text-slate-400"}),(0,t.jsx)(u.ki,{placeholder:"Select language"})]})}),(0,t.jsx)(u.Bw,{children:R.map(e=>(0,t.jsx)(u.Ql,{value:e.value,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:e.flag}),(0,t.jsx)("span",{children:e.label})]})},e.value))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(d._,{htmlFor:"voice",className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:["Voice ",aE&&(0,t.jsx)(g.Z,{className:"inline h-3 w-3 ml-1 animate-spin"})]}),(0,t.jsxs)(u.Ph,{value:eC,onValueChange:eD,disabled:aE,children:[(0,t.jsx)(u.i4,{className:"h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.Z,{className:"h-4 w-4 text-slate-400"}),(0,t.jsx)(u.ki,{placeholder:aE?"Loading voices...":"Select voice"})]})}),(0,t.jsxs)(u.Bw,{children:[a$.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"px-2 py-2 text-xs font-semibold text-violet-600 dark:text-violet-400 bg-violet-50 dark:bg-violet-900/20 flex items-center gap-1.5 sticky top-0",children:[(0,t.jsx)("span",{children:aX?"\uD83D\uDEF0️":"\uD83C\uDDEE\uD83C\uDDF3"}),aX?"Recommended Gemini Voices":"Recommended for Indian Languages"]}),a$.map(e=>{var a;return(0,t.jsx)(u.Ql,{value:aX?e.voice_id:e.key,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-base",children:"female"===e.gender?"\uD83D\uDC69":"\uD83D\uDC68"}),(0,t.jsx)("span",{className:"font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:["\xb7 ",(null===(a=e.description)||void 0===a?void 0:a.split(" ")[0])||e.accent]})]})},e.key)})]}),a0.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-slate-500 mt-1",children:aX?"Female Voices":"Other Female Voices"}),a0.map(e=>{var a;return(0,t.jsx)(u.Ql,{value:aX?e.voice_id:e.key,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"\uD83D\uDC69"}),(0,t.jsx)("span",{children:e.name}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:["\xb7 ",(null===(a=e.description)||void 0===a?void 0:a.split(" ")[0])||e.accent]})]})},e.key)})]}),a5.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-slate-500 mt-1",children:aX?"Male Voices":"Other Male Voices"}),a5.map(e=>{var a;return(0,t.jsx)(u.Ql,{value:aX?e.voice_id:e.key,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"\uD83D\uDC68"}),(0,t.jsx)("span",{children:e.name}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:["\xb7 ",(null===(a=e.description)||void 0===a?void 0:a.split(" ")[0])||e.accent]})]})},e.key)})]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d._,{htmlFor:"engine",className:"text-xs font-medium text-slate-600 dar
1k:text-slate-400",children:"Voice Engine"}),(0,t.jsxs)(u.Ph,{value:eS,onValueChange:e=>{if(eA(e),eS!==e){if("pipecat_sip"===e){let e={ml:"ml-IN",hi:"hi-IN",ta:"ta-IN",te:"te-IN",kn:"kn-IN",bn:"bn-IN",mr:"mr-IN",gu:"gu-IN",pa:"pa-IN",en:"en-IN"}[ek]||"en-IN";eD("".concat(e,"-Chirp3-HD-Aoede"))}else eD("sia_female")}},children:[(0,t.jsx)(u.i4,{className:"h-11 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700",children:(0,t.jsx)(u.ki,{placeholder:"Select engine"})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"elevenlabs",children:"⚡ Premium"}),(0,t.jsx)(u.Ql,{value:"pipecat_sip",children:"\uD83D\uDEF0️ Studio SIP"})]})]})]})]})}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(w.Z,{className:"h-4 w-4 text-violet-500"}),"Product Context"]}),(0,t.jsx)(m.g,{placeholder:"Add business details the AI should know: class timings, fees, location, FAQs...",value:eL,onChange:e=>eF(e.target.value),rows:4,className:"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20 resize-none text-sm"}),(0,t.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(k.Z,{className:"h-3 w-3"}),"AI uses this to answer customer questions about your product/service"]})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(b.Z,{className:"h-4 w-4 text-violet-500"}),"Opening Greeting"]}),(0,t.jsxs)(n.z,{type:"button",variant:"outline",size:"sm",disabled:!a2,onClick:()=>{let e=eb.trim()||"AI Assistant",a=eg.trim(),s={hi:"नमस्ते {{lead_name}}! मैं ".concat(e,", ").concat(a," से बोल रही हूँ।"),ta:"வணக்கம் {{lead_name}}! நான் ".concat(a," இல் இருந்து ").concat(e,"."),te:"నమస్కారం {{lead_name}}! నేను ".concat(a," నుండి ").concat(e,"."),ml:"നമസ്കാരം {{lead_name}}! ഞാൻ ".concat(a," ൽ നിന്നുള്ള ").concat(e," ആണ്."),kn:"ನಮಸ್ಕಾರ {{lead_name}}! ನಾನು ".concat(a," ಇಂದ ").concat(e,"."),bn:"নমস্কার {{lead_name}}! আমি ".concat(a," থেকে ").concat(e,"।"),mr:"नमस्कार {{lead_name}}! मी ".concat(a," मधून ").concat(e," बोलत आहे."),gu:"નમસ્તે {{lead_name}}! હું ".concat(a," માંથી ").concat(e," બોલું છું."),pa:"ਸਤ ਸ੍ਰੀ ਅਕਾਲ {{lead_name}}! ਮੈਂ ".concat(a," ਤੋਂ ").concat(e," ਬੋਲ ਰਹੀ ਹਾਂ।"),en:"Hi {{lead_name}}! This is ".concat(e," from ").concat(a,".")};eE(s[ek]||s.en)},className:(0,V.cn)("h-8 text-xs gap-1.5 transition-all",a2?"border-violet-200 text-violet-600 hover:bg-violet-50 hover:border-violet-300 dark:border-violet-800 dark:text-violet-400 dark:hover:bg-violet-900/20":"opacity-50"),children:[(0,t.jsx)(y.Z,{className:"h-3.5 w-3.5"}),"Auto Generate"]})]}),(0,t.jsx)(m.g,{placeholder:"Hi! This is {{agent_name}} from {{company_name}}. Am I speaking with {{lead_name}}?",value:eT,onChange:e=>eE(e.target.value),rows:3,className:"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20 resize-none"}),(0,t.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(k.Z,{className:"h-3 w-3"}),"Use ",(0,t.jsx)("code",{className:"px-1 py-0.5 bg-slate-100 dark:bg-slate-800 rounded text-[10px]",children:"{{lead_name}}"})," as placeholder for the lead's name"]})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(k.Z,{className:"h-4 w-4 text-violet-500"}),"Qualification Questions",(0,t.jsx)(x.C,{variant:"secondary",className:"text-[10px] h-5 px-1.5 bg-slate-100 dar
1k:bg-slate-800",children:e5.filter(e=>e.trim()).length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:["en"!==ek&&(0,t.jsxs)(n.z,{type:"button",variant:"outline",size:"sm",onClick:aM,disabled:e7||0===e5.filter(e=>e.trim()).length,className:"h-8 text-xs gap-1.5 border-violet-200 text-violet-600 hover:bg-violet-50 hover:border-violet-300 dark:border-violet-800 dark:text-violet-400 dark:hover:bg-violet-900/20",children:[e7?(0,t.jsx)(g.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(C.Z,{className:"h-3.5 w-3.5"}),"Translate to ",null===(s=R.find(e=>e.value===ek))||void 0===s?void 0:s.label]}),(0,t.jsxs)(n.z,{type:"button",variant:"outline",size:"sm",onClick:()=>e2([...e5,""]),className:"h-8 text-xs gap-1.5 border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800",children:[(0,t.jsx)(D.Z,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:e5.map((e,a)=>(0,t.jsxs)("div",{className:"flex gap-2 items-center group",children:[(0,t.jsx)("div",{className:"flex items-center justify-center h-8 w-8 rounded-lg bg-slate-100 dark:bg-slate-800 text-xs font-medium text-slate-500 shrink-0",children:a+1}),(0,t.jsx)(i.I,{placeholder:"e.g., What's your budget for this project?",value:e,onChange:e=>aJ(a,e.target.value),className:"h-10 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20"}),e5.length>1&&(0,t.jsx)(n.z,{type:"button",variant:"ghost",size:"icon",onClick:()=>aK(a),className:"h-10 w-10 shrink-0 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(S.Z,{className:"h-4 w-4"})})]},a))})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(A.Z,{className:"h-4 w-4 text-violet-500"}),"Closing Message"]}),(0,t.jsxs)(n.z,{type:"button",variant:"outline",size:"sm",disabled:!a2,onClick:()=>{let e={hi:"धन्यवाद {{lead_name}}, आपके समय के लिए। हम जल्द ही संपर्क करेंगे! नमस्ते।",ta:"நன்றி {{lead_name}}, உங்கள் நேரத்திற்கு। நாங்கள் விரைவில் தொடர்பு கொள்வோம்! வணக்கம்.",te:"ధన్యవాదాలు {{lead_name}}, మీ సమయానికి। మేము త్వరలో సంప్రదిస్తాము! నమస్కారం.",ml:"നന്ദി {{lead_name}}, നിങ്ങളുടെ സമയത്തിന്. ഞങ്ങൾ ഉടൻ ബന്ധപ്പെടും! നമസ്കാരം.",kn:"ಧನ್ಯವಾದಗಳು {{lead_name}}, ನಿಮ್ಮ ಸಮಯಕ್ಕಾಗಿ। ನಾವು ಶೀಘ್ರದಲ್ಲೇ ಸಂಪರ್ಕಿಸುತ್ತೇವೆ! ನಮಸ್ಕಾರ.",bn:"ধন্যবাদ {{lead_name}}, আপনার সময়ের জন্য। আমরা শীঘ্রই যোগাযোগ করব! নমস্কার.",mr:"धन्यवाद {{lead_name}}, तुमच्या वेळेसाठी। आम्ही लवकरच संपर्क साधू! नमस्कार.",gu:"આભાર {{lead_name}}, તમારા સમય માટે। અમે ટૂંક સમયમાં સંપર્ક કરીશું! નમસ્તે.",pa:"ਧੰਨਵਾਦ {{lead_name}}, ਤੁਹਾਡੇ ਸਮੇਂ ਲਈ। ਅਸੀਂ ਜਲਦੀ ਸੰਪਰਕ ਕਰਾਂਗੇ! ਸਤ ਸ੍ਰੀ ਅਕਾਲ.",en:"Thank you {{lead_name}} for your time! We'll be in touch soon. Goodbye!"};e1(e[ek]||e.en)},className:(0,V.cn)("h-8 text-xs gap-1.5 transition-all",a2?"border-violet-200 text-violet-600 hover:bg-violet-50 hover:border-violet-300 dark:border-violet-800 dark:text-violet-400 dark:hover:bg-violet-900/20":"opacity-50"),children:[(0,t.jsx)(y.Z,{className:"h-3.5 w-3.5"}),"Auto Generate"]})]}
1),(0,t.jsx)(m.g,{placeholder:"Thank you {{lead_name}} for your time! We'll be in touch soon. Goodbye!",value:e3,onChange:e=>e1(e.target.value),rows:2,className:"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 focus:border-violet-500 focus:ring-violet-500/20 resize-none"}),(0,t.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(k.Z,{className:"h-3 w-3"}),"Spoken at the end of the call. Use ",(0,t.jsx)("code",{className:"px-1 py-0.5 bg-slate-100 dark:bg-slate-800 rounded text-[10px]",children:"{{lead_name}}"})," for personalization."]})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-violet-500 mt-0.5"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Cache script audio"}),(0,t.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Reuse synthesised greeting / closing / question audio across calls. Faster connect, lower TTS cost. Turn off while iterating on the script."})]})]}),(0,t.jsx)(c.r,{checked:(null==eI?void 0:eI.cache_script_audio)!==!1,onCheckedChange:e=>eZ({...eI,cache_script_audio:e})})]})}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)(n.z,{type:"button",variant:"outline",onClick:()=>{var e;let a=eb.trim()||"AI Assistant",s=eg.trim()||"Your Company",t=e5.filter(e=>""!==e.trim()),l={hi:"नमस्ते {{lead_name}}! मैं ".concat(a,", ").concat(s," से बोल रही हूँ।"),ta:"வணக்கம் {{lead_name}}! நான் ".concat(s," இல் இருந்து ").concat(a,"."),te:"నమస్కారం {{lead_name}}! నేను ".concat(s," నుండి ").concat(a,"."),ml:"നമസ്കാരം {{lead_name}}! ഞാൻ ".concat(s," ൽ നിന്നുള്ള ").concat(a," ആണ്."),kn:"ನಮಸ್ಕಾರ {{lead_name}}! ನಾನು ".concat(s," ಇಂದ ").concat(a,"."),bn:"নমস্কার {{lead_name}}! আমি ".concat(s," থেকে ").concat(a,"।"),mr:"नमस्कार {{lead_name}}! मी ".concat(s," मधून ").concat(a," बोलत आहे."),gu:"નમસ્તે {{lead_name}}! હું ".concat(s," માંથી ").concat(a," બોલું છું."),pa:"ਸਤ ਸ੍ਰੀ ਅਕਾਲ {{lead_name}}! ਮੈਂ ".concat(s," ਤੋਂ ").concat(a," ਬੋਲ ਰਹੀ ਹਾਂ।"),en:"Hi {{lead_name}}! This is ".concat(a," from ").concat(s,".")},r={hi:"धन्यवाद, आपके समय के लिए। हम जल्द ही संपर्क करेंगे!",ta:"நன்றி, உங்கள் நேரத்திற்கு. நாங்கள் விரைவில் தொடர்பு கொள்வோம்!",te:"ధన్యవాదాలు, మీ సమయానికి. మేము త్వరలో సంప్రదిస్తాము!",ml:"നന്ദി, നിങ്ങളുടെ സമയത്തിന്. ഞങ്ങൾ ഉടൻ ബന്ധപ്പെടും!",kn:"ಧನ್ಯವಾದಗಳು, ನಿಮ್ಮ ಸಮಯಕ್ಕಾಗಿ. ನಾವು ಶೀಘ್ರದಲ್ಲೇ ಸಂಪರ್ಕಿಸುತ್ತೇವೆ!",bn:"ধন্যবাদ, আপনার সময়ের জন্য। আমরা শীঘ্রই যোগাযোগ করব!",mr:"धन्यवाद, तुमच्या वेळेसाठी. आम्ही लवकरच संपर्क साधू!",gu:"આભાર, તમારા સમય માટે. અમે ટૂંક સમયમાં સંપર્ક કરીશું!",pa:"ਧੰਨਵਾਦ, ਤੁਹਾਡੇ ਸਮੇਂ ਲਈ। ਅਸੀਂ ਜਲਦੀ ਸੰਪਰਕ ਕਰਾਂਗੇ!",en:"Thank y
1ou for your time. We'll be in touch soon!"},n=(null===(e=R.find(e=>e.value===ek))||void 0===e?void 0:e.label)||"English",i=eT.trim()||l[ek]||l.en,d=e$.trim(),o=e3.trim()||r[ek]||r.en,c="GREETING:\n".concat(i,"\n");c+="\n[User confirms identity]\n",d&&(c+="\nTRANSITION:\n".concat(d,"\n")),t.length>0&&(c+="\nQUESTIONS (in ".concat(n,"):\n"),t.forEach((e,a)=>{c+="".concat(a+1,". ").concat(e,"\n")})),e8(c+="\nCLOSING:\n".concat(o))},className:"w-full h-11 gap-2 border-dashed border-slate-300 dark:border-slate-600 hover:border-violet-400 hover:bg-violet-50/50 dark:hover:bg-violet-900/10 transition-all",children:[(0,t.jsx)(w.Z,{className:"h-4 w-4"}),"Preview Call Script"]}),e4&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"rounded-xl border border-slate-200 dark:border-slate-700 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-slate-50 dark:bg-slate-800/50 border-b border-slate-200 dark:border-slate-700",children:[(0,t.jsxs)("span",{className:"text-xs font-medium text-slate-600 dark:text-slate-400 flex items-center gap-1.5",children:[(0,t.jsx)(I.Z,{className:"h-3.5 w-3.5 text-emerald-500"}),"Generated Call Script"]}),(0,t.jsx)(n.z,{type:"button",variant:"ghost",size:"sm",onClick:()=>e8(null),className:"h-6 w-6 p-0 text-slate-400 hover:text-slate-600",children:(0,t.jsx)(Z.Z,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(m.g,{value:e4,readOnly:!0,className:"min-h-[180px] text-xs font-mono border-0 rounded-none bg-slate-900 text-slate-300 resize-none focus:ring-0"})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-emerald-200 dark:border-emerald-800 bg-emerald-50/50 dark:bg-emerald-900/20 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),(0,t.jsx)("span",{className:"text-sm font-medium text-emerald-700 dark:text-emerald-300",children:"Test Call"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.I,{placeholder:"+91 98765 43210",value:ed,onChange:e=>eo(e.target.value),className:"flex-1 h-10 bg-white dark:bg-slate-900 border-emerald-200 dark:border-emerald-700 focus:border-emerald-500 focus:ring-emerald-500/20"}),(0,t.jsx)(n.z,{type:"button",onClick:aO,disabled:es||!ed.trim(),className:"h-10 px-4 bg-emerald-600 hover:bg-emerald-700 text-white",children:es?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Calling..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-2"}),"Call Now"]})})]}),(0,t.jsx)("p",{className:"text-xs text-emerald-600/70 dark:text-emerald-400/70 mt-2",children:"Enter phone number with country code to test the AI call"}),ec&&(0,t.jsx)("div",{className:"mt-4 rounded-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-4 space-y-3",children:ex?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-600",children:[(0,t.jsxs)("span",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 bg-emerald-500 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,t.jsx)("span",{className:"w-2 h-2 bg-emerald-500 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,t.jsx)("span",{className:"w-2 h-2 bg-emerald-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),"Call in progress — AI is talking. Results appear when it ends."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsxs)(x.C,{variant:"outline",className:"border-slate-300 text-slate-600",children:[(0,t.jsx)(I.Z,{className:"h-3 w-3 mr-1"})," Call ended"]}),ec.classification&&(0,t.jsxs)(x.C,{variant:"outline",className:(0,V.cn)("text-xs px-3 py-0.5 font-semibold","hot"===ec.classification&&"border-red-500 text-red-700 bg-red-50 dark:bg-red-900/20","warm"===ec.classification&&"border-yellow-500 text-yellow-700 bg-yellow-50 dark:bg-yellow-900/20","cold"===ec.classification&&"border-blue-500 text-blue-700 bg-blue-50 dark:bg-blue-900/20"),children:[ec.classification.toUpperCase()," LEAD"]}),null!==ec.score&&(0,t.jsxs)("span",{className:"text-xs text-slate-500",children:["Score: ",(0,t.jsx)("b",{children:ec.score})]}),ec.duration_seconds>0&&(0,t.jsxs)("span",{className:"text-xs text-slate-500",children:["Duration: ",Math.floor(ec.duration_seconds/60),":",String(ec.duration_seconds%60).padStart(2,"0")]})]}),ec.summary&&(0,t.jsxs)("div",{className:"text-xs bg-slate-50 dark:bg-slate-800 rounded-lg p-2.5 text-slate-700 dark:text-slate-300",children:[(0,t.jsx)("span",{className:"font-medium",children:"Summary: "}),ec.summary]}),(()=>{let e=ec.transcript,a=[];return(Array.isArray(e)?a=e.map(e=>({isAI:["agent","ai","assistant"].includes(String((null==e?void 0:e.role)||"").toLowerCase()),message:String((null==e?void 0:e.text)||(null==e?void 0:e.message)||(null==e?void 0:e.content)||"").trim()})).filter(e=>
1e.message):"string"==typeof e&&e&&(a=e.split("\n").filter(Boolean).map(e=>({isAI:/^(AI|agent|assistant)\s*:/i.test(e),message:e.replace(/^(AI|agent|assistant|User|lead|user)\s*:\s*/i,"").trim()})).filter(e=>e.message)),0===a.length)?null:(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-slate-500",children:[(0,t.jsx)(b.Z,{className:"h-3.5 w-3.5"})," Conversation"]}),(0,t.jsx)("div",{className:"bg-slate-50 dark:bg-slate-800 rounded-lg p-3 max-h-56 overflow-y-auto space-y-2",children:a.map((e,a)=>{let{isAI:s,message:l}=e;return(0,t.jsxs)("div",{className:(0,V.cn)("flex gap-2",s?"justify-start":"justify-end"),children:[s&&(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-purple-100 dark:bg-purple-900 flex items-center justify-center flex-shrink-0",children:(0,t.jsx)(v.Z,{className:"h-3 w-3 text-purple-600"})}),(0,t.jsx)("div",{className:(0,V.cn)("max-w-[78%] px-2.5 py-1.5 rounded-2xl text-xs",s?"bg-white dark:bg-slate-700 text-slate-800 dark:text-slate-200 rounded-tl-none border border-slate-200 dark:border-slate-600":"bg-emerald-500 text-white rounded-tr-none"),children:l}),!s&&(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-emerald-500 flex items-center justify-center flex-shrink-0",children:(0,t.jsx)(_.Z,{className:"h-3 w-3 text-white"})})]},a)})})]})})(),!(ec.transcript&&(!Array.isArray(ec.transcript)||ec.transcript.length>0))&&!ec.summary&&(0,t.jsx)("p",{className:"text-xs text-slate-400 italic",children:"Call ended — no transcript captured (call may not have connected)."})]})})]})]})]})]}),(0,t.jsx)(h.TabsContent,{value:"wavoice",className:"mt-0",children:(0,t.jsx)("div",{className:"py-4 space-y-5",children:(0,t.jsxs)("div",{className:"rounded-xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"AI Voice on WhatsApp"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sends an AI-generated voice note (no phone ring) the moment a lead arrives — using the same agent voice, via ElevenLabs v3."})]}),(0,t.jsx)(c.r,{checked:eq,onCheckedChange:eR,className:"data-[state=checked]:bg-emerald-500"})]}),eq&&(0,t.jsxs)("div",{className:"space-y-3 border-t border-slate-100 dark:border-slate-800 pt-3",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-slate-50 dark:bg-slate-800/50 px-3 py-2.5 text-xs text-muted-foreground",children:["The voice note is spoken by the agent voice set in the ",(0,t.jsx)("strong",{children:"Voice Call"})," tab (",eC||"default",") and reads the ",(0,t.jsx)("strong",{children:"opening greeting"}),". It requires WhatsApp Business connected for this workspace."]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(d._,{htmlFor:"ftv-lang",className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:"Spoken language"}),(0,t.jsxs)("select",{id:"ftv-lang",value:eU,onChange:e=>eH(e.target.value),className:"w-full rounded-md border border-slate-300 dark:border-slate-600 bg-transparent px-3 py-2 text-sm",children:[(0,t.jsxs)("option",{value:"",children:["Same as agent language (",(null===(U=R.find(e=>e.value===ek))||void 0===U?void 0:U.label)||"English",")"]}),R.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Write the greeting in this language on the Voice Call tab — the voice reads it as-is."})]})]})]})})}),(0,t.jsx)(h.TabsContent,{value:"text",className:"mt-0",children:(0,t.jsx)("div",{className:"py-4 space-y-5",children:(0,t.jsxs)("div",{className:"rounded-xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"First-touch Text (WhatsApp)"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sends an approved WhatsApp template the moment a lead arrives (24h-window safe)."})]}),(0,t.jsx)(c.r,{checked:eP,onCheckedChange:ez,className:"data-[state=checked]:bg-emerald-500"})]}),eP&&(0,t.jsxs)("div",{className:"space-y-2 border-t border-slate-100 dar
1k:border-slate-800 pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(d._,{className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:"Approved WhatsApp template"}),(0,t.jsx)("button",{type:"button",onClick:eX,className:"text-[11px] text-violet-600 hover:underline disabled:opacity-50",disabled:eW,children:eW?"Loading…":"Reload"})]}),eO&&eB.length>0?(0,t.jsxs)("select",{value:eQ,onChange:e=>eV(e.target.value),className:"w-full rounded-md border border-slate-300 dark:border-slate-600 bg-transparent px-3 py-2 text-sm",children:[(0,t.jsx)("option",{value:"",children:"— select a template —"}),eB.map(e=>(0,t.jsxs)("option",{value:e.name,children:[e.name,e.language?" (".concat(e.language,")"):"",e.category?" \xb7 ".concat(e.category):""]},e.name))]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{value:eQ,onChange:e=>eV(e.target.value),placeholder:"e.g. lead_welcome_v1",className:"w-full rounded-md border border-slate-300 dark:border-slate-600 bg-transparent px-3 py-2 text-sm"}),eO?(0,t.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[eK?"Couldn't load templates: ".concat(eK,". "):"No approved templates found yet. ","Type the exact Meta-approved template name (free-form text is blocked outside the 24h window)."]}):(0,t.jsx)("p",{className:"text-[11px] text-amber-600 dark:text-amber-500",children:"WhatsApp Business isn't connected for this workspace (Settings → Integrations) — connect it to pick from your approved templates, or type the exact name."})]})]})]})})}),(0,t.jsx)(h.TabsContent,{value:"actions",className:"mt-0",children:(0,t.jsxs)("div",{className:"py-4 space-y-5",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 text-violet-500"}
1),"Stage Mapping"]}),(0,t.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Automatically move leads to specific stages based on AI call classification"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-[100px]",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full bg-red-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:"Hot"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,t.jsx)("span",{className:"text-xs text-slate-500",children:"→"}),(0,t.jsxs)(u.Ph,{value:e9,onValueChange:ae,children:[(0,t.jsx)(u.i4,{className:"h-9 bg-white dark:bg-slate-900 border-red-200 dark:border-red-700",children:(0,t.jsx)(u.ki,{placeholder:"Select stage..."})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"none",children:"No action"}),en.map(e=>(0,t.jsx)(u.Ql,{value:e.id,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[e.color&&(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:e.color}}),e.name]})},e.id))]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-[100px]",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full bg-amber-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-amber-700 dark:text-amber-300",children:"Warm"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,t.jsx)("span",{className:"text-xs text-slate-500",children:"→"}),(0,t.jsxs)(u.Ph,{value:aa,onValueChange:as,children:[(0,t.jsx)(u.i4,{className:"h-9 bg-white dark:bg-slate-900 border-amber-200 dark:border-amber-700",children:(0,t.jsx)(u.ki,{placeholder:"Select stage..."})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"none",children:"No action"}),en.map(e=>(0,t.jsx)(u.Ql,{value:e.id,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[e.color&&(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:e.color}}),e.name]})},e.id))]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-[100px]",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full bg-blue-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Cold"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,t.jsx)("span",{className:"text-xs text-slate-500",children:"→"}),(0,t.jsxs)(u.Ph,{value:at,onValueChange:al,children:[(0,t.jsx)(u.i4,{className:"h-9 bg-white dark:bg-slate-900 border-blue-200 dark:border-blue-700",children:(0,t.jsx)(u.ki,{placeholder:"Select stage..."})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"none",children:"No action"}),en.map(e=>(0,t.jsx)(u.Ql,{value:e.id,children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[e.color&&(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:e.color}}),e.name]})},e.id))]})]})]})]})]}),(0,t.jsxs)("p",{className:"text-xs text-slate-400 dark:text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(k.Z,{className:"h-3 w-3"}),"Leads will be moved to the selected stage after the AI call ends"]})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700 my-4"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(L.Z,{className:"h-4 w-4 text-violet-500"}),"Lead Routing"]}),(0,t.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Route leads to agents based on their classification after the AI call"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-100 dark:border-red-900/30 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-base",children:"\uD83D\uDD25"}),(0,t.jsx)("span",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Hot Leads"}),(0,t.jsx)("span",{className:"text-xs text-slate-400",children:"(70-100)"})]}),(0,t.jsxs)(u.Ph,{value:ar,onValueChange:e=>{an(e),"single_user"!==e&&ax("")},children:[(0,t.jsx)(u.i4,{className:"h-8 w-[160px] text-xs",children:(0,t.jsx)(u.ki,{})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"round_robin",children:"Round Robin"}),(0,t.jsx)(u.Ql,{value:"least_loaded",children:"Least Loaded"}),(0,t.jsx)(u.Ql,{value:"single_user",children:"Single User"}),(0,t.jsx)(u.Ql,{value:"manual_assignment",children:"Manual Assignment"})]})]})]}),"single_user"===ar&&(0,t.jsx)("div",{className:"px-3 pb-2.5 pt-0",children:(0,t.jsxs)(u.Ph,{value:am,onValueChange:ax,children:[(0,t.jsx)(u.i4,{className:"h-8 text-xs bg-white dark:bg-slate-800",children:(0,t.jsx)(u.ki,{placeholder:"Select user..."})}),(0,t.jsx)(u.Bw,{children:aw.map(e=>(0,t.jsx)(u.Ql,{value:e.user_id,children:e.user_name||e.user_email||"Unknown User"},e.user_id))})]})})]}),(0,t.jsxs)("div",{className:"rounded-lg bg-amber-50 dark:bg-amber-950/20 border border-amber-100 dar
1k:border-amber-900/30 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-base",children:"\uD83C\uDF21️"}),(0,t.jsx)("span",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Warm Leads"}),(0,t.jsx)("span",{className:"text-xs text-slate-400",children:"(40-69)"})]}),(0,t.jsxs)(u.Ph,{value:ai,onValueChange:e=>{ad(e),"single_user"!==e&&ah("")},children:[(0,t.jsx)(u.i4,{className:"h-8 w-[160px] text-xs",children:(0,t.jsx)(u.ki,{})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"round_robin",children:"Round Robin"}),(0,t.jsx)(u.Ql,{value:"least_loaded",children:"Least Loaded"}),(0,t.jsx)(u.Ql,{value:"single_user",children:"Single User"}),(0,t.jsx)(u.Ql,{value:"manual_assignment",children:"Manual Assignment"})]})]})]}),"single_user"===ai&&(0,t.jsx)("div",{className:"px-3 pb-2.5 pt-0",children:(0,t.jsxs)(u.Ph,{value:au,onValueChange:ah,children:[(0,t.jsx)(u.i4,{className:"h-8 text-xs bg-white dark:bg-slate-800",children:(0,t.jsx)(u.ki,{placeholder:"Select user..."})}),(0,t.jsx)(u.Bw,{children:aw.map(e=>(0,t.jsx)(u.Ql,{value:e.user_id,children:e.user_name||e.user_email||"Unknown User"},e.user_id))})]})})]}),(0,t.jsxs)("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-100 dark:border-blue-900/30 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-base",children:"❄️"}),(0,t.jsx)("span",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Cold Leads"}),(0,t.jsx)("span",{className:"text-xs text-slate-400",children:"(0-39)"})]}),(0,t.jsxs)(u.Ph,{value:ao,onValueChange:e=>{ac(e),"single_user"!==e&&ag("")},children:[(0,t.jsx)(u.i4,{className:"h-8 w-[160px] text-xs",children:(0,t.jsx)(u.ki,{})}),(0,t.jsxs)(u.Bw,{children:[(0,t.jsx)(u.Ql,{value:"round_robin",children:"Round Robin"}),(0,t.jsx)(u.Ql,{value:"least_loaded",children:"Least Loaded"}),(0,t.jsx)(u.Ql,{value:"single_user",children:"Single User"}),(0,t.jsx)(u.Ql,{value:"manual_assignment",children:"Manual Assignment"})]})]})]}),"single_user"===ao&&(0,t.jsx)("div",{className:"px-3 pb-2.5 pt-0",children:(0,t.jsxs)(u.Ph,{value:ap,onValueChange:ag,children:[(0,t.jsx)(u.i4,{className:"h-8 text-xs bg-white dark:bg-slate-800",children:(0,t.jsx)(u.ki,{placeholder:"Select user..."})}),(0,t.jsx)(u.Bw,{children:aw.map(e=>(0,t.jsx)(u.Ql,{value:e.user_id,children:e.user_name||e.user_email||"Unknown User"},e.user_id))})]})})]})]}),("round_robin"===ar||"least_loaded"===ar||"round_robin"===ai||"least_loaded"===ai||"round_robin"===ao||"least_loaded"===ao)&&(0,t.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-600 dark:text-slate-400",children:[(0,t.jsx)(F.Z,{className:"h-3.5 w-3.5"}),"Agent Pool (for Round Robin / Least Loaded)"]}),0===aw.length?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-slate-300 dark:border-slate-600 p-4 text-center",children:[(0,t.jsx)(F.Z,{className:"h-8 w-8 text-slate-300 dark:text-slate-600 mx-auto mb-2"}),(0,t.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"No users available"}),(0,t.jsx)("p",{className:"text-xs text-slate-400 dark:text-slate-500 mt-1",children:"Assign agent groups to this pipeline first"})]}):(0,t.jsx)("div",{className:"rounded-lg border border-slate-200 dark:border-slate-700 divide-y divide-slate-100 dark:divide-slate-700 max-h-[200px] overflow-y-auto",children:aw.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-3 px-3 py-2.5 hover:bg-slate-50 dark:hover:bg-slate-800/50 cursor-pointer",children:[(0,t.jsx)("div",{onClick:()=>aG(e.user_id),className:(0,V.cn)("h-5 w-5 rounded border flex items-center justify-center transition-colors cursor-pointer",a_.includes(e.user_id)?"bg-violet-500 border-violet-500":"border-slate-300 dark:border-slate-600"),children:a_.includes(e.user_id)&&(0,t.jsx)(T.Z,{className:"h-3 w-3 text-white"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm text-slate-700 dark:text-slate-300 truncate",children:e.user_name||e.user_email||"Unknown User"}),(0,t.jsx)("p",{className:"text-xs text-slate-400 truncate",children:e.group_name})]})]},e.user_id))}),a_.length>0&&(0,t.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(T.Z,{className:"h-3 w-3 text-emerald-500"}),a_.length," agent",1!==a_.length?"s":""," in pool"]})]}),(0,t.jsxs)("p",{className:"text-xs text-slate-400 dark:text-slate-500 flex items-center gap-1.5",children:[(0,t.jsx)(k.Z,{className:"h-3 w-3"}),"Leads are routed after the AI classifies them based on call outcome"]})]}),(0,t.jsx)("div",{className:"border-t border-slate-200 dark:border-slate-700 my-4"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 text-violet-500"}),"Pending Calls",(0,t.jsx)("button",{type:"button",onClick:()=>
1aH(),disabled:aA,className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",title:"Refresh pending calls",children:(0,t.jsx)(E.Z,{className:(0,V.cn)("h-3.5 w-3.5 text-slate-400",aA&&"animate-spin")})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[aA&&(0,t.jsx)(g.Z,{className:"h-4 w-4 animate-spin text-slate-400"}),(0,t.jsxs)("span",{className:"text-sm font-semibold text-violet-600 dark:text-violet-400",children:[ay.toLocaleString()," leads"]}),ay>0&&(0,t.jsxs)(n.z,{type:"button",size:"sm",onClick:()=>aB(),disabled:aF||!eh,className:"h-8 gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",children:[aF?(0,t.jsx)(g.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(P.Z,{className:"h-3.5 w-3.5"}),"Trigger All"]})]})]}),(0,t.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Leads in this pipeline that haven't been called by AI yet"}),0===ay?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-slate-300 dark:border-slate-600 p-4 text-center",children:[(0,t.jsx)(I.Z,{className:"h-8 w-8 text-emerald-400 mx-auto mb-2"}),(0,t.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"All leads have been called"})]}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"rounded-lg border border-slate-200 dark:border-slate-700 max-h-[250px] overflow-y-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"bg-slate-50 dark:bg-slate-800/50 sticky top-0",children:(0,t.jsxs)("tr",{className:"text-left text-xs text-slate-500 dark:text-slate-400",children:[(0,t.jsx)("th",{className:"px-3 py-2 font-medium",children:"Name"}),(0,t.jsx)("th",{className:"px-3 py-2 font-medium",children:"Phone"}),(0,t.jsx)("th",{className:"px-3 py-2 font-medium hidden sm:table-cell",children:"Added"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-slate-100 dark:divide-slate-700",children:aD.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50",children:[(0,t.jsxs)("td",{className:"px-3 py-2",children:[(0,t.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-300 truncate max-w-[150px]",children:e.name}),e.company&&(0,t.jsx)("div",{className:"text-xs text-slate-400 truncate max-w-[150px]",children:e.company})]}),(0,t.jsx)("td",{className:"px-3 py-2 text-slate-600 dark:text-slate-400",children:e.phone||"-"}),(0,t.jsx)("td",{className:"px-3 py-2 text-slate-400 text-xs hidden sm:table-cell",children:e.pipeline_added_at?new Date(e.pipeline_added_at).toLocaleDateString():"-"})]},e.id))})]})}),aZ&&(0,t.jsx)("button",{type:"button",onClick:()=>aH(!0),disabled:aA,className:"w-full py-2 text-xs text-violet-600 dark:text-violet-400 hover:text-violet-700 dark:hover:text-violet-300 disabled:opacity-50",children:aA?"Loading...":"Load more (".concat(ay-aD.length," remaining)")})]})]})]})})]})}),(0,t.jsx)("div",{className:"bg-slate-50 dark:bg-slate-800/50 border-t border-slate-200 dark:border-slate-700",children:(0,t.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,t.jsx)("p",{className:"text-xs text-slate-500",children:eh?(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"AI calls will trigger for new leads"]}):"Enable to start AI calling for new leads"}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(n.z,{type:"button",variant:"ghost",onClick:()=>B(!1),className:"h-10 px-4",children:"Cancel"}),!O&&!Y&&(0,t.jsx)(n.z,{type:"button",onClick:aW,disabled:ee||!eg.trim(),className:"h-10 px-6 bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700 hover:to-purple-700 text-white shadow-lg shadow-violet-500/25 disabled:opacity-50 disabled:shadow-none",children:ee?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save Settings"})]})]})})]});return J?a3:(0,t.jsx)(r.Vq,{open:H,onOpenChange:B,children:(0,t.jsx)(r.cZ,{className:"max-w-2xl p-0 gap-0 overflow-hidden",children:a3})})})},60183:function(e,a,s){s.d(a,{s:function(){return o}});var t=s(57437),l=s(29),r=s.n(l),n=s(2265),i=s(73892);s(28356);var d=s(93448);let o=n.forwardRef((e,a)=>{let{value:s,onChange:l,placeholder:n="Enter phone number",className:o,defaultCountry:c="IN",disabled:m,id:x}=e;return(0,t.jsxs)("div",{ref:a,className:"jsx-978175d6c61f5131 "+((0,d.cn)("phone-input-wrapper",o)||""),children:[(0,t.jsx)(i.ZP,{international:!0,defaultCountry:c,value:s||"",onChange:e=>null==l?void 0:l(e),placeholder:n,disabled:m,id:x,className:(0,d.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-within:outline-none focus-within:ring-1 focus-within:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm")}),(0,t.jsx)(r(),{id:"978175d6c61f5131",children:".phone-input-wrapper .PhoneInput{gap:8px}.phone-input-wrapper .PhoneInputCountry{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.phone-input-wrapper .PhoneInputCountrySelect{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1;border:0;opacity:0;cursor:pointer}.phone-input-wrapper .PhoneInputCountryIcon{width:24px;height:16px}.phone-input-wrapper .PhoneInputCountryIconImg{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.phone-input-wrapper .PhoneInputInput{-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;background:transparent;border:none;outline:none;font-size:inherit;color:inherit;padding:0}.phone-input-wrapper .PhoneInputInput::-webkit-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput:-moz-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::-moz-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput:-ms-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::-ms-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputCountrySelectArrow{display:block;width:6px;height:6px;margin-left:4px;border-style:solid;border-color:hsl(var(--foreground));border-top-width:0;border-bottom-width:1px;border-left-width:0;border-right-width:1px;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg);opacity:.5}"})]})});o.displayName="PhoneInput"},12749:function(e,a,s){s.d(a,{J2:function(){return i},xo:function(){return d},yk:function(){return o}});
1var t=s(57437),l=s(2265),r=s(27312),n=s(93448);let i=r.fC,d=r.xz,o=l.forwardRef((e,a)=>{let{className:s,align:l="center",sideOffset:i=4,...d}=e;return(0,t.jsx)(r.h_,{children:(0,t.jsx)(r.VY,{ref:a,align:l,sideOffset:i,className:(0,n.cn)("z-50 w-72 rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 p-4 text-gray-950 dark:text-gray-100 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...d})})});o.displayName=r.VY.displayName}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.