Your IP : 216.73.217.77


Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/
Upload File :
Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Index-a464a872.js

import{T as j,r as k,O as E,o as d,c,a as e,w as $e,v as Ce,u as t,b as w,d as Me,f as u,g,k as M,t as i,F as H,e as Ve,i as _e,n as v,j as Ze,m as Ae,G as xe,h as U,K as Te}from"./app-f1493ab2.js";import Se from"./Layout-018ec37d.js";import{t as we}from"./index-764662c4.js";import{d as Be}from"./debounce-7f7c0d78.js";import{_ as Fe}from"./AlertModal-2bf70f0d.js";import{u as De}from"./useAlertModal-3aa166da.js";/* empty css              */import{a as Ne,_ as N,T as Ie}from"./TableHeaderRowItem-6e9202af.js";import{a as Ue,_ as I,T as je}from"./TableBodyRowItem-551209f9.js";import{_ as Oe}from"./Dropdown-c843374c.js";import{_ as K}from"./FormInput-b3450213.js";import{_ as ke}from"./Modal-a0814fa2.js";import{_ as ye}from"./FormSelect-3a6ffebd.js";import{_ as ze}from"./FormTextArea-95511fff.js";import{_ as Le}from"./FormToggleSwitch-9b3ff72b.js";import"./App-45dbd9fa.js";import"./Sidebar-f2ddcf5a.js";import"./Menu-73c1148a.js";import"./ProfileModal-09ae28bb.js";import"./tabs-80627b62.js";import"./hidden-f79cef22.js";import"./micro-task-89dcd6af.js";import"./transition-f32a8133.js";import"./use-outside-click-92c6377f.js";import"./LangToggle-d2b58a25.js";import"./index-114bea05.js";import"./MobileSidebar-e6661e49.js";import"./pusher-a82d1614.js";import"./_baseGetTag-f7f93ac1.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./use-text-value-ecd8c541.js";import"./use-tree-walker-d52d0c0b.js";const Ee={class:"bg-slate-100 md:bg-slate-50 flex items-center border border-primary md:border-none md:shadow-sm h-10 w-full md:w-80 rounded-[0.5rem] mb-6 text-sm"},He=["placeholder"],Ke={key:1,class:"pr-2"},Pe={class:"bg-slate-100 md:bg-slate-50 rounded-[0.5rem]"},Re={class:"w-full"},Xe=["onClick"],qe={__name:"DocumentTable",props:{rows:{type:Object,required:!0},filters:{type:Object}},emits:["delete"],setup($,{emit:S}){const V=$,{isOpenAlert:m,openAlert:A,confirmAlert:y}=De(),_=j({test:null}),x=f=>{_.delete("/automation/upload/document/"+f)},r=f=>f===V.rows.data.length-1,o=k({search:V.filters.search}),Z=k(!1),F=()=>{o.value.search=null,B()},T=Be(()=>{Z.value=!0,B()},1e3),B=()=>{E.visit("/automation/ai",{method:"get",data:o.value})},D=f=>f?f.charAt(0).toUpperCase()+f.slice(1):"";return(f,p)=>(d(),c(H,null,[e("div",Ee,[p[6]||(p[6]=e("span",{class:"pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 15l6 6m-11-4a7 7 0 1 1 0-14a7 7 0 0 1 0 14Z"})])],-1)),$e(e("input",{onInput:p[0]||(p[0]=(...l)=>t(T)&&t(T)(...l)),"onUpdate:modelValue":p[1]||(p[1]=l=>o.value.search=l),type:"text",class:"outline-none px-4 w-full bg-slate-100 md:bg-slate-50",placeholder:f.$t("Search by title")},null,40,He),[[Ce,o.value.search]]),Z.value===!1&&o.value.search?(d(),c("button",{key:0,onClick:F,type:"button",class:"pr-2"},p[4]||(p[4]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2zm3.7 12.3c.4.4.4 1 0 1.4c-.4.4-1 .4-1.4 0L12 13.4l-2.3 2.3c-.4.4-1 .4-1.4 0c-.4-.4-.4-1 0-1.4l2.3-2.3l-2.3-2.3c-.4-.4-.4-1 0-1.4c.4-.4 1-.4 1.4 0l2.3 2.3l2.3-2.3c.4-.4 1-.4 1.4 0c.4.4.4 1 0 1.4L13.4 12l2.3 2.3z"})],-1)]))):w("",!0),Z.value?(d(),c("span",Ke,p[5]||(p[5]=[Me('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="0 12 12;90 12 12;180 12 12;270 12 12"></animateTransform><animate attributeName="opacity" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.2s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="30 12 12;120 12 12;210 12 12;300 12 12"></animateTransform><animate attributeName="opacity" begin="0.2s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.4s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="60 12 12;150 12 12;240 12 12;330 12 12"></animateTransform><animate attributeName="opacity" begin="0.4s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle></svg>',1)]))):w("",!0)]),e("div",Pe,[e("table",Re,[u(Ie,null,{default:g(()=>[u(Ne,null,{default:g(()=>[u(N,{position:"first"},{default:g(()=>[M(i(f.$t("Title")),1)]),_:1}),u(N,null,{default:g(()=>[M(i(f.$t("Source")),1)]),_:1}),u(N,null,{default:g(()=>[M(i(f.$t("Status")),1)]),_:1}),u(N,null,{default:g(()=>[M(i(f.$t("Last updated")),1)]),_:1}),u(N,{position:"last"})]),_:1})]),_:1}),u(je,null,{default:g(()=>[(d(!0),c(H,null,Ve($.rows.data,(l,a)=>(d(),_e(Ue,{key:a,class:v(r(a)?"":"border-b")},{default:g(()=>[u(I,{position:"first",class:"capitalize"},{default:g(()=>[M(i(l.title),1)]),_:2},1024),u(I,{class:"hidden sm:table-cell"},{default:g(()=>[M(i(l.source),1)]),_:2},1024),u(I,{class:"hidden sm:table-cell"},{default:g(()=>[M(i(f.$t(D(l.status))),1)]),_:2},1024),u(I,{class:"hidden sm:table-cell"},{default:g(()=>[M(i(l.updated_at),1)]),_:2},1024),u(I,{position:"last"},{default:g(()=>[u(Oe,{align:"right",class:"mt-2"},{default:g(()=>[e("button",{onClick:h=>t(A)(l.uuid),class:"inline-flex w-full justify-center rounded-md text-sm font-medium text-black hover:bg-opacity-30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"},p[7]||(p[7]=[e("span",{class:"hover:bg-[#F6F7F9] hover:rounded-full w-[fit-content] p-2"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"})])],-1)]),8,Xe)]),_:2},1024)]),_:2},1024)]),_:2},1032,["class"]))),128))]),_:1})])]),u(Fe,{modelValue:t(m),"onUpdate:modelValue":p[2]||(p[2]=l=>Ze(m)?m.value=l:null),onConfirm:p[3]||(p[3]=()=>t(y)(x)),label:f.$t("Delete row"),description:f.$t("Are you sure you want to delete this row? This action can not be undone")},null,8,["modelValue","label","description"])],64))}},We={class:"block text-sm leading-6 text-gray-900 mt-4 mb-1"},Ge={class:"max-w-md w-full gap-y-8"},Je={class:"space-y-6"},Qe={for:"file-upload",class:"text-center cursor-pointer"},Ye={class:"flex text-sm text-gray-600"},et={class:"relative bg-white rounded-md"},tt={class:"pl-1"},st={class:"text-xs text-gray-500"},lt={class:"text-xs text-gray-500"},ot={class:"rounded-md p-1 bg-slate-50 text-center text-sm flex items-center gap-x-1"},at={key:0,class:"form-error text-[#b91c1c] text-xs"},it={class:"mt-5"},rt={class:"flex justify-center mt-2 w-full"},nt={key:0,class:"w-full inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white hover:bg-green-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},dt={__name:"DocumentUploadModal",props:["type","modelValue"],emits:["update:modelValue"],setup($,{emit:S}){const V=$,m=S;Ae(()=>Te().props.flash.status);const A=we("Upload Document"),y=k(V.modelValue),_=k(null),x=k(_.value),r=k(null),o=j({title:null,file:null});xe(()=>V.modelValue,l=>{y.value=l});const Z=l=>{l.preventDefault();const a=l.target.files[0];T(a)},F=l=>{l.preventDefault();const a=l.dataTransfer.files[0];T(a)};function T(l){if(!["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain"].includes(l.type)){alert(we("please select a PDF, Word, or TXT file"));return}_.value=l.name,x.value=B(_.value,28),o.file=l}const B=(l,a)=>{if(l.length<=a)return l;const h=Math.floor(a/2),O=l.slice(0,h),z=l.slice(-h);return`${O}...${z}`};function D(){o.file=null}function f(){const l=new FormData;l.append("title",o.title),l.append("file",o.file),o.post("/automation/upload/document",{preserveScroll:!0,onProgress:a=>{r.value="pending"},onSuccess:()=>{o.reset(),r.value="complete",p()},onError:a=>{r.value=null}})}function p(){y.value=!1,m("update:modelValue",!1),setTimeout(()=>{r.value=null,o.reset(),o.clearErrors()},500)}return(l,a)=>(d(),_e(ke,{label:t(A),isOpen:y.value,closeBtn:!0,onClose:a[5]||(a[5]=h=>p())},{default:g(()=>[u(K,{modelValue:t(o).title,"onUpdate:modelValue":a[0]||(a[0]=h=>t(o).title=h),error:t(o).errors.title,name:"Title",type:"text",class:v("mt-4")},null,8,["modelValue","error"]),e("div",We,i(l.$t("Document (PDF, word or TXT file)")),1),e("div",Ge,[e("div",Je,[t(o).file==null?(d(),c("div",{key:0,onDragover:a[2]||(a[2]=U(()=>{},["prevent"])),onDrop:F,class:v(["flex justify-center px-6 pt-5 pb-6 shadow-sm outline-none ring-1 ring-inset rounded-md",t(o).errors.file?"ring-[#b91c1c]":"ring-gray-300"])},[e("input",{type:"file",class:"sr-only",accept:".pdf,.txt,.doc,.docx",ref:"fileInput",id:"file-upload",onChange:a[1]||(a[1]=h=>Z(h))},null,544),e("label",Qe,[e("div",null,[a[7]||(a[7]=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"m15.393 4.054l-.502.557l.502-.557Zm3.959 3.563l-.502.557l.502-.557Zm2.302 2.537l-.685.305l.685-.305ZM3.172 20.828l.53-.53l-.53.53Zm17.656 0l-.53-.53l.53.53ZM14 21.25h-4v1.5h4v-1.5ZM2.75 14v-4h-1.5v4h2.5Zm18.5-.437V14h2.5v-.437h-1.5ZM14.891 4.61l3.959 3.563l1.003-1.115l-3.958-3.563l-1.004 1.115Zm7.859 8.952c0-1.689.015-2.758-.41-3.714l-1.371.61c.266.598.281 1.283.281 3.104h2.5Zm-3.9-5.389c1.353 1.218 1.853 1.688 2.119 2.285l1.37-.61c-.426-.957-1.23-1.66-2.486-2.79L18.85 8.174ZM10.03 2.75c1.582 0 2.179.012 2.71.216l.538-1.4c-.852-.328-1.78-.316-3.248-.316v1.5Zm5.865.746c-1.086-.977-1.765-1.604-2.617-1.93l-.537 1.4c.532.204.98.592 2.15 1.645l1.004-1.115ZM10 21.25c-1.907 0-3.261-.002-4.29-.14c-1.005-.135-1.585-.389-2.008-.812l-1.06 1.06c.748.75 1.697 1.081 2.869 1.239c1.15.155 2.625.153 4.489.153v-1.5ZM1.25 14c0 1.864-.002 3.338.153 4.489c.158 1.172.49 2.121 1.238 2.87l1.06-1.06c-.422-.424-.676-1.004-.811-2.01c-.138-1.027-.14-2.382-.14-4.289h-1.5ZM14 22.75c1.864 0 3.338.002 4.489-.153c1.172-.158 2.121-.49 2.87-1.238l-1.06-1.06c-.424.422-1.004.676-2.01.811c-1.027.138-2.382.14-4.289.14v1.5ZM21.25 14c0 1.907-.002 3.262-.14 4.29c-.135 1.005-.389 1.585-.812 2.008l1.06 1.06c.75-.748 1.081-1.697 1.239-2.869c.155-1.15.153-2.625.153-4.489h-1.5Zm-18.5-4c0-1.907.002-3.261.14-4.29c.135-1.005.389-1.585.812-2.008l-1.06-1.06c-.75.748-1.081 1.697-1.239 2.869C1.248 6.661 1.25 8.136 1.25 10h2.5Zm7.28-8.75c-1.875 0-3.356-.002-4.511.153c-1.177.158-2.129.49-2.878 1.238l1.06 1.06c.424-.422 1.005-.676 2.017-.811c1.033-.138 2.395-.14 4.312-.14v-1.5Z"}),e("path",{stroke:"currentColor","stroke-width":"1.5",d:"M13 2.5V5c0 2.357 0 3.536.732 4.268C14.464 10 15.643 10 18 10h4"})])],-1)),e("div",Ye,[e("div",et,[e("span",null,i(l.$t("Click to upload a file")),1)]),e("p",tt,i(l.$t("Or drag and drop")),1)]),e("p",st,i(l.$t("PDF, Word or TXT files only")),1),e("p",lt,[M(i(l.$t("Maximum size"))+" ",1),a[6]||(a[6]=e("b",null,"20MB",-1))])])])],34)):(d(),c("div",{key:1,class:v(["flex justify-center px-6 pt-5 pb-6 shadow-sm outline-none ring-1 ring-inset rounded-md",t(o).errors.file?"ring-[#b91c1c]":"ring-gray-300"])},[e("div",null,[a[9]||(a[9]=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"m15.393 4.054l-.502.557l.502-.557Zm3.959 3.563l-.502.557l.502-.557Zm2.302 2.537l-.685.305l.685-.305ZM3.172 20.828l.53-.53l-.53.53Zm17.656 0l-.53-.53l.53.53ZM14 21.25h-4v1.5h4v-1.5ZM2.75 14v-4h-1.5v4h2.5Zm18.5-.437V14h2.5v-.437h-1.5ZM14.891 4.61l3.959 3.563l1.003-1.115l-3.958-3.563l-1.004 1.115Zm7.859 8.952c0-1.689.015-2.758-.41-3.714l-1.371.61c.266.598.281 1.283.281 3.104h2.5Zm-3.9-5.389c1.353 1.218 1.853 1.688 2.119 2.285l1.37-.61c-.426-.957-1.23-1.66-2.486-2.79L18.85 8.174ZM10.03 2.75c1.582 0 2.179.012 2.71.216l.538-1.4c-.852-.328-1.78-.316-3.248-.316v1.5Zm5.865.746c-1.086-.977-1.765-1.604-2.617-1.93l-.537 1.4c.532.204.98.592 2.15 1.645l1.004-1.115ZM10 21.25c-1.907 0-3.261-.002-4.29-.14c-1.005-.135-1.585-.389-2.008-.812l-1.06 1.06c.748.75 1.697 1.081 2.869 1.239c1.15.155 2.625.153 4.489.153v-1.5ZM1.25 14c0 1.864-.002 3.338.153 4.489c.158 1.172.49 2.121 1.238 2.87l1.06-1.06c-.422-.424-.676-1.004-.811-2.01c-.138-1.027-.14-2.382-.14-4.289h-1.5ZM14 22.75c1.864 0 3.338.002 4.489-.153c1.172-.158 2.121-.49 2.87-1.238l-1.06-1.06c-.424.422-1.004.676-2.01.811c-1.027.138-2.382.14-4.289.14v1.5ZM21.25 14c0 1.907-.002 3.262-.14 4.29c-.135 1.005-.389 1.585-.812 2.008l1.06 1.06c.75-.748 1.081-1.697 1.239-2.869c.155-1.15.153-2.625.153-4.489h-1.5Zm-18.5-4c0-1.907.002-3.261.14-4.29c.135-1.005.389-1.585.812-2.008l-1.06-1.06c-.75.748-1.081 1.697-1.239 2.869C1.248 6.661 1.25 8.136 1.25 10h2.5Zm7.28-8.75c-1.875 0-3.356-.002-4.511.153c-1.177.158-2.129.49-2.878 1.238l1.06 1.06c.424-.422 1.005-.676 2.017-.811c1.033-.138 2.395-.14 4.312-.14v-1.5Z"}),e("path",{stroke:"currentColor","stroke-width":"1.5",d:"M13 2.5V5c0 2.357 0 3.536.732 4.268C14.464 10 15.643 10 18 10h4"})])],-1)),e("div",ot,[e("span",null,i(x.value),1),e("span",{onClick:a[3]||(a[3]=h=>D()),class:"bg-slate-200 rounded-full cursor-pointer"},a[8]||(a[8]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 20 20"},[e("g",{fill:"black"},[e("path",{d:"M6.854 13.854a.5.5 0 0 1-.708-.708l7-7a.5.5 0 0 1 .708.708z"}),e("path",{d:"M6.146 6.854a.5.5 0 1 1 .708-.708l7 7a.5.5 0 0 1-.708.708z"})])],-1)]))])])],2))]),t(o).errors.file?(d(),c("span",at,i(t(o).errors.file),1)):w("",!0)]),e("div",it,[e("div",rt,[t(o).processing?(d(),c("div",nt,a[10]||(a[10]=[e("svg",{class:"mx-auto text-white",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"white","stroke-dasharray":"15","stroke-dashoffset":"15","stroke-linecap":"round","stroke-width":"2",d:"M12 3C16.9706 3 21 7.02944 21 12"},[e("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),e("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})])],-1)]))):(d(),c("button",{key:1,type:"button",onClick:a[4]||(a[4]=h=>f()),class:"w-full inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white hover:bg-green-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},i(l.$t("Upload")),1))])])]),_:1},8,["label","isOpen"]))}},ut={class:"md:h-[90vh]"},ct={class:"flex justify-center items-center"},mt={class:"md:w-[60em]"},pt={class:"bg-white border border-slate-200 rounded-lg pt-2 text-sm mb-4 px-4 mb-20"},ft={class:"w-full py-2 mb-4 mt-2"},vt={class:"flex w-full"},gt={class:"text-md"},bt={class:"text-[16px]"},ht={class:"mb-1 text-slate-500"},wt={class:"ml-auto"},yt={class:"flex items-center gap-x-3"},_t={key:2},xt={class:"flex items-center justify-between px-4 pt-2 pb-4"},kt={class:"text-[16px]"},$t={class:"text-slate-500"},Ct={class:"w-[10%]"},Mt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Vt={key:1,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Zt={key:0},At={class:"flex space-x-10 border-b w-full px-4 py-6"},Tt={class:"w-[70%]"},St={class:"text-slate-600"},Bt={class:"text-xs text-slate-700 flex items-center"},Ft={class:"w-[30%]"},Dt={class:"flex space-x-10 border-b w-full px-4 py-6"},Nt={class:"w-[40%]"},It={class:"text-slate-600"},Ut={class:"text-xs text-slate-700 flex items-center"},jt={class:"w-[60%]"},Ot={class:"flex space-x-10 border-b w-full px-4 py-6"},zt={class:"w-[40%]"},Lt={class:"text-slate-600"},Et={class:"text-xs text-slate-700 flex items-center"},Ht={class:"w-[60%]"},Kt={class:"flex px-4 pt-1"},Pt={class:"ml-auto mt-2"},Rt=["disabled"],Xt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},qt={key:1},Wt={key:1,class:"bg-white border border-slate-200 rounded-lg py-2 text-sm mb-20 pb-4 px-4"},Gt={class:"w-full py-2 mb-4 mt-2"},Jt={class:"flex w-full mb-4"},Qt={class:"text-md w-[70%]"},Yt={class:"text-[16px]"},es={class:"flex items-center mt-1 text-slate-500"},ts={class:"ml-auto w-[40%]"},ss={class:"float-right flex items-center gap-x-2"},ls={class:"w-5/5"},os={class:"mt-5 grid grid-cols-1 gap-x-6 gap-y-4"},as={class:"sm:col-span-6 border rounded-md p-2"},is={class:"flex sm:col-span-6 grid grid-cols-6"},rs={class:v("sm:col-span-3")},ns={class:"block text-sm leading-6 text-gray-900 mb-1"},ds={class:"sm:col-span-6 bg-[#ffe5b4] rounded-md px-3 py-1 mt-2"},us={class:"block text-xs leading-6 text-gray-900"},cs={class:"mt-4 flex"},ms=["disabled"],ps={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},fs={key:1},Xs={__name:"Index",props:["rows","filters","settings","aimodule","fbmodule","models","voices"],setup($){var p,l,a,h,O,z,P,R,X,q,W,G,J,Q,Y,ee,te,se,le,oe,ae,ie;const S=$,V=k(S.settings.metadata),m=k(V.value?JSON.parse(V.value):null),A=k(!1),y=k(!1),_=k(!1),x=j({active:((l=(p=m.value)==null?void 0:p.ai)==null?void 0:l.active)??!1}),r=j({active:((h=(a=m.value)==null?void 0:a.ai)==null?void 0:h.active)??!1,api_key:((z=(O=m.value)==null?void 0:O.ai)==null?void 0:z.api_key)??null,model:((R=(P=m.value)==null?void 0:P.ai)==null?void 0:R.model)??null,voice:((q=(X=m.value)==null?void 0:X.ai)==null?void 0:q.voice)??null,allow_audio_response:((G=(W=m.value)==null?void 0:W.ai)==null?void 0:G.allow_audio_response)??null,max_tokens:((Q=(J=m.value)==null?void 0:J.ai)==null?void 0:Q.max_tokens)??null,temperature:((ee=(Y=m.value)==null?void 0:Y.ai)==null?void 0:ee.temperature)??null}),o=j({enable_automatic_responses:((se=(te=m.value)==null?void 0:te.ai)==null?void 0:se.enable_automatic_responses)??!1,start_keywords:((oe=(le=m.value)==null?void 0:le.ai)==null?void 0:oe.start_keywords)??null,stop_keywords:((ie=(ae=m.value)==null?void 0:ae.ai)==null?void 0:ie.stop_keywords)??null}),Z=()=>{_.value=!_.value},F=()=>{x.active=!x.active,B()},T=()=>{o.enable_automatic_responses=!o.enable_automatic_responses},B=async()=>{x.post("/automation/ai/activate",{preserveScroll:!0})},D=()=>{r.post("/automation/ai/setup",{preserveScroll:!0,onSuccess:()=>{E.visit("/automation/ai",{preserveState:!1})}})},f=()=>{o.post("/automation/ai/assistant-setup",{preserveScroll:!0,onSuccess:()=>{E.visit("/automation/ai",{preserveState:!1})}})};return xe(()=>r.model,n=>{n!=="gpt-4o-audio-preview"&&(r.allow_audio_response=!1)}),(n,s)=>(d(),c(H,null,[u(Se,{aimodule:$.aimodule,fbmodule:$.fbmodule},{default:g(()=>{var L,re,ne,de,ue,ce,me,pe,fe,ve,ge,be;return[e("div",ut,[e("div",ct,[e("div",mt,[e("div",pt,[e("div",ft,[e("div",vt,[e("div",gt,[e("h4",bt,i(n.$t("Enable AI Assistant")),1),e("div",ht,i(n.$t("Activate AI-generated responses in your conversations")),1)]),e("div",wt,[e("div",yt,[((re=(L=m.value)==null?void 0:L.ai)==null?void 0:re.api_key)!=null?(d(),c("div",{key:0,class:v(["w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(x).active}]),onClick:s[0]||(s[0]=b=>F(n.active))},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(x).active}])},null,2)],2)):w("",!0),((de=(ne=m.value)==null?void 0:ne.ai)==null?void 0:de.api_key)==null?(d(),c("div",{key:1,class:v(["w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(r).active}]),onClick:s[1]||(s[1]=b=>{t(r).active=!0,y.value=!0})},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(r).active}])},null,2)],2)):w("",!0),((ce=(ue=m.value)==null?void 0:ue.ai)==null?void 0:ce.api_key)!=null?(d(),c("div",_t," | ")):w("",!0),((pe=(me=m.value)==null?void 0:me.ai)==null?void 0:pe.api_key)!=null?(d(),c("button",{key:3,onClick:s[2]||(s[2]=b=>y.value=!0),class:"bg-primary text-white h-8 rounded-lg text-[13px] px-3 w-fit"},i(n.$t("Update")),1)):w("",!0)])])])])]),((ve=(fe=m.value)==null?void 0:fe.ai)==null?void 0:ve.api_key)!=null?(d(),c("form",{key:0,onSubmit:s[8]||(s[8]=U(b=>f(),["prevent"])),class:"bg-white border border-slate-200 rounded-lg py-2 text-sm mb-4 pb-4"},[e("div",xt,[e("div",{onClick:s[3]||(s[3]=b=>Z()),class:"w-[90%] cursor-pointer"},[e("h4",kt,i(n.$t("AI Assistant Setup")),1),e("div",$t,i(n.$t("Setup keywords for AI assistance")),1)]),e("div",Ct,[e("button",{type:"button",onClick:s[4]||(s[4]=b=>Z()),class:"hover:bg-slate-50 rounded-full p-1 float-right"},[_.value?(d(),c("svg",Mt,s[18]||(s[18]=[e("path",{fill:"black","fill-rule":"evenodd",d:"M16.53 14.03a.75.75 0 0 1-1.06 0L12 10.56l-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06","clip-rule":"evenodd"},null,-1)]))):w("",!0),_.value?w("",!0):(d(),c("svg",Vt,s[19]||(s[19]=[e("path",{fill:"black","fill-rule":"evenodd",d:"M16.53 8.97a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L12 12.44l3.47-3.47a.75.75 0 0 1 1.06 0","clip-rule":"evenodd"},null,-1)])))])])]),_.value?(d(),c("div",Zt,[e("div",At,[e("div",Tt,[e("span",St,i(n.$t("Enable automatic AI assistance for new conversations")),1),e("div",Bt,[e("span",null,i(n.$t("Turn on this option to let users automatically get help from the AI whenever they start a new conversation or ticket. If enabled, this will override the keywords set for initiating AI chat.")),1)])]),e("div",Ft,[e("div",{class:v(["ml-auto w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(o).enable_automatic_responses}]),onClick:s[5]||(s[5]=b=>T())},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(o).enable_automatic_responses}])},null,2)],2)])]),e("div",Dt,[e("div",Nt,[e("span",It,i(n.$t("Keyword(s) to start the AI agent")),1),e("div",Ut,[e("span",null,i(n.$t("Set word or phrase")),1)])]),e("div",jt,[u(K,{modelValue:t(o).start_keywords,"onUpdate:modelValue":s[6]||(s[6]=b=>t(o).start_keywords=b),error:t(o).errors.start_keywords,name:"",type:"text",class:v("col-span-4")},null,8,["modelValue","error"])])]),e("div",Ot,[e("div",zt,[e("span",Lt,i(n.$t("Keyword(s) to stop the AI agent")),1),e("div",Et,[e("span",null,i(n.$t("Set word or phrase")),1)])]),e("div",Ht,[u(ze,{modelValue:t(o).stop_keywords,"onUpdate:modelValue":s[7]||(s[7]=b=>t(o).stop_keywords=b),error:t(o).errors.stop_keywords,name:"",type:"text",class:v("col-span-4")},null,8,["modelValue","error"])])]),e("div",Kt,[e("div",Pt,[e("button",{type:"submit",class:"float-right bg-primary text-white h-8 rounded-lg text-[13px] px-3 w-fit",disabled:t(o).processing},[t(o).processing?(d(),c("svg",Xt,s[20]||(s[20]=[e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"},null,-1),e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1)]))):(d(),c("span",qt,i(n.$t("Save")),1))],8,Rt)])])])):w("",!0)],32)):w("",!0),((be=(ge=m.value)==null?void 0:ge.ai)==null?void 0:be.api_key)!=null?(d(),c("div",Wt,[e("div",Gt,[e("div",Jt,[e("div",Qt,[e("h4",Yt,i(n.$t("Knowledge Base")),1),e("span",es,i(n.$t("Enhance your AI assistant by uploading information to improve client interactions.")),1)]),e("div",ts,[e("div",ss,[e("button",{onClick:s[9]||(s[9]=b=>A.value=!0),class:"rounded-md bg-primary px-3 h-8 text-[13px] text-white shadow-sm hover:bg-black focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},i(n.$t("Upload Documents")),1)])])]),e("div",ls,[u(qe,{rows:S.rows,filters:S.filters},null,8,["rows","filters"])])])])):w("",!0)])])]),u(ke,{label:n.$t("AI Assistant Setup"),isOpen:y.value},{default:g(()=>{var b,he;return[e("div",os,[e("form",{onSubmit:s[16]||(s[16]=U(C=>D(),["prevent"])),class:"grid gap-x-6 gap-y-4 sm:grid-cols-6"},[u(K,{modelValue:t(r).api_key,"onUpdate:modelValue":s[10]||(s[10]=C=>t(r).api_key=C),error:t(r).errors.api_key,name:n.$t("OpenAI API Key"),type:"password",class:v("sm:col-span-6")},null,8,["modelValue","error","name"]),u(ye,{modelValue:t(r).model,"onUpdate:modelValue":s[11]||(s[11]=C=>t(r).model=C),error:t(r).errors.model,name:n.$t("Model"),type:"text",options:$.models,class:v("sm:col-span-6")},null,8,["modelValue","error","name","options"]),e("div",as,[e("div",is,[e("div",rs,[e("label",ns,i(n.$t("Activate audio responses")),1),u(Le,{modelValue:t(r).allow_audio_response,"onUpdate:modelValue":s[12]||(s[12]=C=>t(r).allow_audio_response=C),error:t(r).errors.allow_audio_response,class:v("sm:col-span-6"),disabled:t(r).model!="gpt-4o-audio-preview"},null,8,["modelValue","error","disabled"])]),u(ye,{modelValue:t(r).voice,"onUpdate:modelValue":s[13]||(s[13]=C=>t(r).voice=C),error:t(r).errors.voice,name:n.$t("Audio voice"),type:"text",options:$.voices,class:v("sm:col-span-3")},null,8,["modelValue","error","name","options"])]),e("div",ds,[e("span",us,i(n.$t("Audio responses require the gpt-4o-audio-preview model.")),1)])]),e("div",cs,[((he=(b=m.value)==null?void 0:b.ai)==null?void 0:he.api_key)==null?(d(),c("button",{key:0,type:"button",onClick:s[14]||(s[14]=U(C=>{y.value=!1,t(r).active=!1},["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},i(n.$t("Cancel")),1)):(d(),c("button",{key:1,type:"button",onClick:s[15]||(s[15]=U(C=>y.value=!1,["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},i(n.$t("Cancel")),1)),e("button",{class:v(["inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",{"opacity-50":t(x).processing}]),disabled:t(r).processing},[t(r).processing?(d(),c("svg",ps,s[21]||(s[21]=[e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"},null,-1),e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1)]))):(d(),c("span",fs,i(n.$t("Save")),1))],10,ms)])],32)])]}),_:1},8,["label","isOpen"])]}),_:1},8,["aimodule","fbmodule"]),u(dt,{type:"contact",modelValue:A.value,"onUpdate:modelValue":s[17]||(s[17]=L=>A.value=L)},null,8,["modelValue"])],64))}};export{Xs as default};