| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Index-2ec009e8.js |
import{g as nt,_ as ot}from"./App-45dbd9fa.js";import{r as b,S as Ge,m as te,o as l,c as o,a as e,d as A,t as m,b as f,h as ee,w as Ke,v as Xe,$ as it,n as E,F as z,x as ne,K as Ye,T as ae,f as Z,g as q,u as T,l as J,i as P,k as H,O as K,q as se,R as We,G as Y,e as F,D as Qe,a0 as et,V as Q,W as le,a1 as X,E as tt,J as rt,a2 as ct,a3 as dt}from"./app-f1493ab2.js";import{_ as ut}from"./CampaignForm-4ee3f3eb.js";import{_ as pt}from"./AlertModal-2bf70f0d.js";import{_ as ht}from"./Dropdown-c843374c.js";import{_ as mt,a as W}from"./DropdownItem-5a13c2ff.js";import{_ as vt}from"./FormSelectCombo-66d92913.js";import{_ as ft}from"./FormTextArea-95511fff.js";import{_ as gt}from"./Modal-a0814fa2.js";import{t as yt}from"./index-764662c4.js";import{d as wt}from"./debounce-7f7c0d78.js";import{P as xt}from"./Pagination-6973c28d.js";import{_ as bt}from"./ContactInfo-35f42384.js";import"./Sidebar-f2ddcf5a.js";import"./Menu-73c1148a.js";import"./ProfileModal-09ae28bb.js";import"./FormInput-b3450213.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";/* empty css */import"./pusher-a82d1614.js";import"./FormSelect-3a6ffebd.js";import"./use-text-value-ecd8c541.js";import"./WhatsappTemplate-2436fab9.js";import"./use-tree-walker-d52d0c0b.js";import"./_baseGetTag-f7f93ac1.js";import"./_plugin-vue_export-helper-c27b6911.js";const kt={key:0,class:"flex justify-center items-center w-full px-6 md:px-4"},Ct={class:"flex items-start space-x-4 bg-orange-100 rounded-lg p-2 mb-2 px-4"},$t={class:"text-sm"},_t={class:"text-sm"},Mt={key:1,class:"flex justify-center items-center w-full px-6 md:px-4"},St={class:"flex items-center justify-between space-x-4 bg-orange-100 rounded-lg p-2 mb-2 px-4"},Ot={class:"flex items-start justify-between space-x-4"},Tt={class:"text-sm"},Vt={class:"text-sm"},Lt=["onKeydown","placeholder","disabled"],Nt=["accept"],Zt=["disabled"],It={key:1,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Bt={__name:"ChatForm",props:["contact","chatLimitReached"],emits:["response","viewTemplate"],setup(t,{emit:a}){const s=t,d=b(null),n=b(null),c=b({uuid:s.contact.uuid,message:null,type:null,file:null});Ge(()=>{c.value.uuid=s.contact.uuid});const u=a,w=()=>{u("viewTemplate",!0)},$=async()=>{c.value.message=n.value;const h=new FormData;h.append("message",c.value.message),h.append("type",c.value.type),h.append("uuid",c.value.uuid),c.value.file&&h.append("file",c.value.file),d.value=!0;try{const r=await ne.post("/chats",h);c.value.message=null,n.value=null,c.value.file=null,d.value=!1}catch{}},C=b(null),g=()=>{const h=C.value;h.style.height="auto",h.style.height=h.scrollHeight+"px"},i=h=>{n.value!=null&&n.value.trim()!=""&&$()},y=te(()=>{if(s.contact.last_inbound_chat){const h=new Date(s.contact.last_inbound_chat.created_at);return new Date-h<24*60*60*1e3}return!1}),x=h=>{const r=h.target.files[0],p=new FileReader;p.onload=O=>{c.value.file=r,$()},p.readAsDataURL(r)},v=()=>{switch(c.value.type){case"image":return".jpg, .png";case"document":return".txt, .pdf, .ppt, .doc, .xls, .docx, .pptx, .xlsx";case"audio":return".mp3, .ogg";case"video":return".mp4";default:return""}};return(h,r)=>(l(),o(z,null,[s.chatLimitReached?(l(),o("div",kt,[e("div",Ct,[r[9]||(r[9]=A('<span class="text-red-700"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 36 36"><path fill="currentColor" d="M18 21.32a1.3 1.3 0 0 0 1.3-1.3V14a1.3 1.3 0 1 0-2.6 0v6a1.3 1.3 0 0 0 1.3 1.32Z" class="clr-i-outline clr-i-outline-path-1"></path><circle cx="17.95" cy="24.27" r="1.5" fill="currentColor" class="clr-i-outline clr-i-outline-path-2"></circle><path fill="currentColor" d="M30.33 25.54L20.59 7.6a3 3 0 0 0-5.27 0L5.57 25.54A3 3 0 0 0 8.21 30h19.48a3 3 0 0 0 2.64-4.43Zm-1.78 1.94a1 1 0 0 1-.86.49H8.21a1 1 0 0 1-.88-1.48l9.74-17.94a1 1 0 0 1 1.76 0l9.74 17.94a1 1 0 0 1-.02.99Z" class="clr-i-outline clr-i-outline-path-3"></path><path fill="none" d="M0 0h36v36H0z"></path></svg></span>',1)),e("div",null,[e("div",$t,m(h.$t("Maximum chat limit reached")),1),e("div",_t,m(h.$t("You have reached the maximum chat limit for your subscription! Please upgrade to send/receive more messages")),1)])])])):f("",!0),!y.value&&!s.chatLimitReached?(l(),o("div",Mt,[e("div",St,[e("div",Ot,[r[10]||(r[10]=A('<span class="text-red-700"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 36 36"><path fill="currentColor" d="M18 21.32a1.3 1.3 0 0 0 1.3-1.3V14a1.3 1.3 0 1 0-2.6 0v6a1.3 1.3 0 0 0 1.3 1.32Z" class="clr-i-outline clr-i-outline-path-1"></path><circle cx="17.95" cy="24.27" r="1.5" fill="currentColor" class="clr-i-outline clr-i-outline-path-2"></circle><path fill="currentColor" d="M30.33 25.54L20.59 7.6a3 3 0 0 0-5.27 0L5.57 25.54A3 3 0 0 0 8.21 30h19.48a3 3 0 0 0 2.64-4.43Zm-1.78 1.94a1 1 0 0 1-.86.49H8.21a1 1 0 0 1-.88-1.48l9.74-17.94a1 1 0 0 1 1.76 0l9.74 17.94a1 1 0 0 1-.02.99Z" class="clr-i-outline clr-i-outline-path-3"></path><path fill="none" d="M0 0h36v36H0z"></path></svg></span>',1)),e("div",null,[e("div",Tt,m(h.$t("24 hour limit")),1),e("div",Vt,m(h.$t("Whatsapp does not allow sending messages 24 hours after they last messaged you. However, you can send them a template message")),1)])]),e("button",{onClick:r[0]||(r[0]=p=>w()),class:"rounded-md bg-primary px-3 py-1 text-sm text-white shadow-sm w-[25%]"},"Send Template")])])):f("",!0),y.value&&!s.chatLimitReached?(l(),o("form",{key:2,onSubmit:r[8]||(r[8]=ee(p=>$(),["prevent"])),class:"flex items-center px-2 md:px-10 space-x-2"},[e("div",{class:E(["flex items-center w-full rounded-lg py-4 md:py-2 pl-2 pr-2",d.value?"bg-gray-200":"bg-white"])},[Ke(e("textarea",{ref_key:"textInputRef",ref:C,onFocus:r[1]||(r[1]=p=>c.value.type="text"),onKeydown:it(ee(i,["exact","prevent"]),["enter"]),class:E(["w-full ml-3 outline-none resize-none text-sm md:text-base",d.value?"bg-gray-200":"bg-white"]),"onUpdate:modelValue":r[2]||(r[2]=p=>n.value=p),onInput:g,type:"text",rows:"1",placeholder:h.$t("Type your message..."),disabled:d.value}," ",42,Lt),[[Xe,n.value]]),e("input",{type:"file",class:"sr-only",accept:v(),id:"file-upload",onChange:r[3]||(r[3]=p=>x(p))},null,40,Nt),e("label",{onClick:r[4]||(r[4]=p=>c.value.type="image"),for:"file-upload",class:"text-slate-500 mr-2 cursor-pointer"},r[11]||(r[11]=[A('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="M6.5 8a2 2 0 1 0 4 0a2 2 0 0 0-4 0Zm14.427 1.99c-6.61-.908-12.31 4-11.927 10.51"></path><path d="M3 13.066c2.78-.385 5.275.958 6.624 3.1"></path><path d="M3 12c0-4.243 0-6.364 1.318-7.682C5.636 3 7.758 3 12 3c4.243 0 6.364 0 7.682 1.318C21 5.636 21 7.758 21 12c0 4.243 0 6.364-1.318 7.682C18.364 21 16.242 21 12 21c-4.243 0-6.364 0-7.682-1.318C3 18.364 3 16.242 3 12Z"></path></g></svg>',1)])),e("label",{onClick:r[5]||(r[5]=p=>c.value.type="document"),for:"file-upload",class:"text-slate-500 mr-1 cursor-pointer"},r[12]||(r[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24"},[e("g",{fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M3 10c0-3.771 0-5.657 1.172-6.828C5.343 2 7.229 2 11 2h2c3.771 0 5.657 0 6.828 1.172C21 4.343 21 6.229 21 10v4c0 3.771 0 5.657-1.172 6.828C18.657 22 16.771 22 13 22h-2c-3.771 0-5.657 0-6.828-1.172C3 19.657 3 17.771 3 14v-4Z"}),e("path",{"stroke-linecap":"round",d:"M8 10h8m-8 4h5"})])],-1)])),e("label",{onClick:r[6]||(r[6]=p=>c.value.type="audio"),for:"file-upload",class:"text-slate-500 mr-1 cursor-pointer"},r[13]||(r[13]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 1024 1024"},[e("path",{fill:"currentColor",d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8c0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8c0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1M512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168m-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92z"})],-1)])),e("label",{onClick:r[7]||(r[7]=p=>c.value.type="video"),for:"file-upload",class:"text-slate-500 mr-4 cursor-pointer"},r[14]||(r[14]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 32 32"},[e("path",{fill:"currentColor",d:"M6.5 5.5A4.5 4.5 0 0 0 2 10v12a4.5 4.5 0 0 0 4.5 4.5h12A4.5 4.5 0 0 0 23 22v-1.5l4.2 3.15c1.153.865 2.8.042 2.8-1.4V9.75c0-1.442-1.647-2.265-2.8-1.4L23 11.5V10a4.5 4.5 0 0 0-4.5-4.5zM23 14l5-3.75v11.5L23 18zm-2-4v12a2.5 2.5 0 0 1-2.5 2.5h-12A2.5 2.5 0 0 1 4 22V10a2.5 2.5 0 0 1 2.5-2.5h12A2.5 2.5 0 0 1 21 10"})],-1)])),e("button",{class:"flex items-center",type:"submit",disabled:n.value===null||n.value.trim()===""||d.value},[d.value?(l(),o("svg",It,r[16]||(r[16]=[A('<circle cx="12" cy="2" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(45 12 12)"><animate attributeName="r" begin="0.125s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(90 12 12)"><animate attributeName="r" begin="0.25s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(135 12 12)"><animate attributeName="r" begin="0.375s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(180 12 12)"><animate attributeName="r" begin="0.5s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(225 12 12)"><animate attributeName="r" begin="0.625s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(270 12 12)"><animate attributeName="r" begin="0.75s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(315 12 12)"><animate attributeName="r" begin="0.875s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',8)]))):(l(),o("svg",{key:0,class:E(n.value===null||n.value.trim()===""?"text-slate-300":"text-black"),xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 16 16"},r[15]||(r[15]=[e("path",{fill:"currentColor",d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.69.953c.268.053.268.437 0 .49l-5.69.953a.5.5 0 0 0-.397.354l-1.403 4.85a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5Z"},null,-1)]),2))],8,Zt)],2)],32)):f("",!0)],64))}},qt={class:"h-20 bg-white border-b border-1 flex items-center justify-between px-4 md:px-4"},Et={class:"flex items-center gap-x-4 cursor-pointer w-3/4"},jt=["src"],Ht={key:1,class:"rounded-full w-10 h-10 flex items-center justify-center bg-slate-100"},Pt={class:"flex items-center w-full gap-x-8"},At={class:"w-full flex items-center text-xs"},zt={class:"flex items-center space-x-4"},Dt={key:0,class:"flex justify-between items-center bg-white border-b border-1 py-2 px-4 md:px-4"},Rt={class:"flex items-center gap-x-2"},Ut={class:"text-[13px]"},Jt={class:"mt-5 grid grid-cols-1 gap-x-6 gap-y-4"},Ft={class:"mt-4 flex"},Gt=["disabled"],Kt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},Xt={key:1},Yt={__name:"ChatHeader",props:["contact","displayContactInfo","ticketingIsEnabled","ticket","addon"],emits:["toggleView","deleteThread","closeThread"],setup(t,{emit:a}){var N,I,B,j,M,V,D;const s=t,d=te(()=>Ye().props.auth.user),n=b(!1),c=b(s.displayContactInfo),u=b(null),w=b(!1),$=b({label:(N=s.ticket)!=null&&N.user?(B=(I=s.ticket)==null?void 0:I.user)==null?void 0:B.full_name:yt("Unassigned"),value:(j=s.ticket)!=null&&j.user?(V=(M=s.ticket)==null?void 0:M.user)==null?void 0:V.id:0});Ge(()=>{var _;c.value=s.displayContactInfo,u.value=(_=s.ticket)==null?void 0:_.status});const C=a,g=()=>{c.value=!c.value,C("toggleView",c.value)},i=()=>{K.visit("/chats/"+s.contact.uuid,{method:"delete",onFinish:()=>{n.value=!1}})};ae({status:u});const y=ae({notes:null,contact:null}),x=ae({ai_assistant:(D=s.contact)==null?void 0:D.ai_assistance_enabled}),v=_=>{K.put("/tickets/"+s.contact.uuid+"/update",{status:_},{})},h=()=>{K.put("/tickets/"+s.contact.uuid+"/assign",{id:$.value.value},{})};function r(_,k){fetch("/team?search="+_,{headers:{Accept:"application/json"}}).then(S=>S.json()).then(S=>{k(S.rows)}).catch(S=>{console.error("Error fetching agents:",S)})}const p=()=>{y.contact=s.contact.uuid,y.post("/notes",{preserveState:!1,onSuccess:()=>{y.reset(),w.value=!1}})},O=()=>{x.ai_assistant=!x.ai_assistant,x.post("/automation/contact/"+s.contact.uuid,{preserveState:!0})};return(_,k)=>(l(),o(z,null,[e("div",qt,[e("div",Et,[Z(T(J),{href:"/chats",class:"sm:block md:hidden"},{default:q(()=>k[13]||(k[13]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2em",height:"2em",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M19 11H7.14l3.63-4.36a1 1 0 1 0-1.54-1.28l-5 6a1.19 1.19 0 0 0-.09.15c0 .05 0 .08-.07.13A1 1 0 0 0 4 12a1 1 0 0 0 .07.36c0 .05 0 .08.07.13a1.19 1.19 0 0 0 .09.15l5 6A1 1 0 0 0 10 19a1 1 0 0 0 .64-.23a1 1 0 0 0 .13-1.41L7.14 13H19a1 1 0 0 0 0-2"})],-1)])),_:1}),e("div",{onClick:g},[t.contact.avatar?(l(),o("img",{key:0,class:"rounded-full w-14 h-14",src:t.contact.avatar},null,8,jt)):(l(),o("div",Ht,m(t.contact.full_name.substring(0,1)),1))]),e("div",Pt,[e("div",null,[e("div",{class:"flex items-center",onClick:g},[e("span",null,m(t.contact.full_name),1)]),e("div",At,[e("span",{onClick:g},m(t.contact.formatted_phone_number),1)])]),t.ticketingIsEnabled&&d.value.teams[0].role!="agent"?(l(),P(vt,{key:0,modelValue:$.value,"onUpdate:modelValue":[k[0]||(k[0]=S=>$.value=S),k[1]||(k[1]=S=>h())],name:"",loadOptions:r,class:E("col-span-1 md:block hidden"),placeholder:"Select Agent"},null,8,["modelValue"])):f("",!0)])]),e("div",null,[e("div",zt,[u.value==="open"&&t.ticketingIsEnabled?(l(),o("button",{key:0,onClick:k[2]||(k[2]=S=>v("closed")),class:"text-sm md:inline-flex hidden justify-center rounded-md border border-transparent bg-red-800 px-4 py-1 text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},m(_.$t("Mark as closed")),1)):f("",!0),u.value==="closed"&&t.ticketingIsEnabled?(l(),o("button",{key:1,onClick:k[3]||(k[3]=S=>v("open")),class:"text-sm md:inline-flex hidden justify-center rounded-md border border-transparent bg-primary px-4 py-1 text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},m(_.$t("Mark as open")),1)):f("",!0),c.value?(l(),o("div",{key:3,onClick:g,class:"bg-slate-200 p-2 rounded-lg text-sm cursor-pointer"},[e("span",null,m(_.$t("Back")),1)])):(l(),P(ht,{key:2},{items:q(()=>[Z(mt,null,{default:q(()=>[Z(W,{onClick:k[4]||(k[4]=S=>{w.value=!0}),as:"button"},{default:q(()=>[H(m(_.$t("Add notes")),1)]),_:1}),u.value==="open"&&t.ticketingIsEnabled?(l(),P(W,{key:0,onClick:k[5]||(k[5]=S=>v("closed")),as:"button"},{default:q(()=>[H(m(_.$t("Mark as closed")),1)]),_:1})):f("",!0),u.value==="closed"&&t.ticketingIsEnabled?(l(),P(W,{key:1,onClick:k[6]||(k[6]=S=>v("open")),as:"button"},{default:q(()=>[H(m(_.$t("Mark as open")),1)]),_:1})):f("",!0),Z(W,{onClick:k[7]||(k[7]=S=>n.value=!0),as:"button"},{default:q(()=>[H(m(_.$t("Clear chat")),1)]),_:1})]),_:1})]),default:q(()=>[k[14]||(k[14]=e("button",{type:"button",class:"inline-flex w-full justify-center items-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"},[e("span",{class:"bg-slate-200 p-1 rounded-full cursor-pointer flex items-center justify-center"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M12 6.75a.75.75 0 1 1 0-1.5a.75.75 0 0 1 0 1.5Zm0 6a.75.75 0 1 1 0-1.5a.75.75 0 0 1 0 1.5Zm0 6a.75.75 0 1 1 0-1.5a.75.75 0 0 1 0 1.5Z"})])])],-1))]),_:1}))])])]),t.addon==1?(l(),o("div",Dt,[e("div",{class:E(["text-sm py-1 px-3 rounded-md flex items-center gap-x-2 w-[fit-content]",T(x).ai_assistant?"bg-green-50":"bg-red-50"])},[e("span",{class:E(T(x).ai_assistant?"text-green-500":"text-red-500")},k[15]||(k[15]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"})],-1)]),2),e("span",null,m(_.$t("AI Assistant")),1)],2),e("div",Rt,[e("span",Ut,m(_.$t("Enable/disable AI assistant")),1),e("div",{class:E(["w-12 h-6 flex items-center bg-gray-300 rounded-full p-1 cursor-pointer",{"bg-primary":T(x).ai_assistant}]),onClick:k[8]||(k[8]=S=>O())},[e("div",{class:E(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":T(x).ai_assistant}])},null,2)],2)])])):f("",!0),Z(gt,{label:"Add Note",isOpen:w.value},{default:q(()=>[e("div",Jt,[e("form",{onSubmit:k[11]||(k[11]=ee(S=>p(),["prevent"])),class:""},[Z(ft,{modelValue:T(y).notes,"onUpdate:modelValue":k[9]||(k[9]=S=>T(y).notes=S),error:T(y).errors.note,name:"",class:E("col-span-2")},null,8,["modelValue","error"]),e("div",Ft,[e("button",{type:"button",onClick:k[10]||(k[10]=ee(S=>w.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"},m(_.$t("Cancel")),1),e("button",{class:E(["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(y).processing}]),disabled:T(y).processing},[T(y).processing?(l(),o("svg",Kt,k[16]||(k[16]=[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)]))):(l(),o("span",Xt,m(_.$t("Save")),1))],10,Gt)])],32)])]),_:1},8,["isOpen"]),Z(pt,{modelValue:n.value,"onUpdate:modelValue":k[12]||(k[12]=S=>n.value=S),label:_.$t("Clear chat"),description:_.$t("Are you sure you want to delete this thread? You can't undo this action"),onConfirm:i},null,8,["modelValue","label","description"])],64))}},Wt={class:"relative text-sm"},Qt={class:"cursor-pointer flex items-center space-x-1 bg-slate-50 w-[fit-content] h-[fit-content] rounded-md p-1 px-2 text-sm"},es={class:"capitalize"},ts={class:"text-slate-500"},ss={key:0,class:"absolute bg-white z-10 px-1 py-2 mt-2 shadow w-full rounded-md text-black"},as={__name:"TicketStatusToggle",props:{languages:Object,currentLanguage:String,status:String,rowCount:Number},setup(t){const a=t,s=b(!1),d=()=>{s.value=!s.value},n=u=>{s.value&&!u.target.closest(".status-dd")&&(s.value=!1)},c=u=>u?u.charAt(0).toUpperCase()+u.slice(1):"";return se(()=>{document.body.addEventListener("click",n)}),We(()=>{document.body.removeEventListener("click",n)}),(u,w)=>(l(),o("div",Wt,[e("div",{onClick:w[0]||(w[0]=$=>d()),class:"status-dd"},[e("div",Qt,[e("span",es,m(u.$t(c(a.status))),1),e("span",ts,m(a.rowCount),1),w[1]||(w[1]=e("span",null,[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor","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"})])],-1))])]),s.value?(l(),o("div",ss,[e("div",null,[Z(T(J),{href:"/chats?status=unassigned",class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"},{default:q(()=>[H(m(u.$t("Unassigned")),1)]),_:1}),Z(T(J),{href:"/chats?status=open",class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"},{default:q(()=>[H(m(u.$t("Open")),1)]),_:1}),Z(T(J),{href:"/chats?status=closed",class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"},{default:q(()=>[H(m(u.$t("Closed")),1)]),_:1}),Z(T(J),{href:"/chats?status=all",class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"},{default:q(()=>[H(m(u.$t("All")),1)]),_:1})])])):f("",!0)]))}},ls={class:"text-sm"},ns={key:0,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 16 16"},os={key:1,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 16 16"},is={key:0,class:"absolute bg-white z-10 px-1 py-2 mt-2 shadow w-[7em] rounded-md text-black"},rs={__name:"SortDirectionToggle",props:{direction:String,url:String},setup(t){const a=t,s=b(!1),d=()=>{s.value=!s.value},n=u=>{s.value&&!u.target.closest(".sort-dd")&&(s.value=!1)};se(()=>{document.body.addEventListener("click",n)}),We(()=>{document.body.removeEventListener("click",n)});const c=u=>{K.post(a.url,{sort:u},{preserveState:!1})};return(u,w)=>(l(),o("div",ls,[e("span",{onClick:w[0]||(w[0]=$=>d()),class:"cursor-pointer hover:bg-slate-50 p-1 rounded-full sort-dd block"},[t.direction=="desc"?(l(),o("svg",ns,w[3]||(w[3]=[e("path",{fill:"currentColor",d:"M3.5 13.5a.5.5 0 0 1-1 0V4.707L1.354 5.854a.5.5 0 1 1-.708-.708l2-1.999l.007-.007a.5.5 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L3.5 4.707zm4-9.5a.5.5 0 0 1 0-1h1a.5.5 0 0 1 0 1zm0 3a.5.5 0 0 1 0-1h3a.5.5 0 0 1 0 1zm0 3a.5.5 0 0 1 0-1h5a.5.5 0 0 1 0 1zM7 12.5a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 0-1h-7a.5.5 0 0 0-.5.5"},null,-1)]))):(l(),o("svg",os,w[4]||(w[4]=[e("path",{fill:"currentColor",d:"M3.5 2.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999l.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 11.293zm3.5 1a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"},null,-1)])))]),s.value?(l(),o("div",is,[e("div",null,[e("div",{onClick:w[1]||(w[1]=$=>c("desc")),class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"}," Newest "),e("div",{onClick:w[2]||(w[2]=$=>c("asc")),class:"block px-2 py-1 cursor-pointer hover:bg-slate-100 rounded-md"}," Oldest ")])])):f("",!0)]))}},cs={class:"px-4 py-4 border-b"},ds={class:"flex items-center justify-between space-x-1 text-xl"},us={class:"flex space-x-1"},ps={class:"text-slate-500"},hs={class:"bg-slate-50 rounded-md mt-3 flex items-center py-[2px]"},ms=["placeholder"],vs={key:1,class:"pr-2"},fs={key:0,class:"grid grid-cols-2 mt-4 items-center w-full"},gs={class:"flex ml-auto gap-x-1"},ys={class:"flex-grow overflow-y-auto h-[65vh]",ref:"scrollContainer"},ws={class:"flex space-x-2 hover:bg-gray-50 cursor-pointer py-3 px-4"},xs={class:"w-[15%]"},bs=["src"],ks={key:1,class:"rounded-full w-10 h-10 flex items-center justify-center bg-slate-200 capitalize"},Cs={class:"w-[85%]"},$s={class:"flex justify-between"},_s={class:"truncate"},Ms={class:"self-center text-slate-500 text-xs"},Ss={key:0,class:"flex justify-between"},Os={key:0,class:"text-slate-500 text-xs truncate self-end"},Ts={key:1,class:"text-slate-500 text-xs truncate self-end"},Vs={key:2,class:"text-slate-500 text-xs truncate self-end"},Ls={key:3,class:"text-slate-500 text-xs truncate self-end"},Ns={class:"flex items-center"},Zs={class:"ml-2"},Is={key:4,class:"text-slate-500 text-xs truncate self-end"},Bs={class:"flex items-center"},qs={class:"ml-2"},Es={key:5,class:"text-slate-500 text-xs truncate self-end"},js={class:"flex items-center"},Hs={class:"ml-2"},Ps={key:6,class:"text-slate-500 text-xs truncate self-end"},As={class:"flex items-center"},zs={class:"ml-2"},Ds={key:7,class:"text-slate-500 text-xs truncate self-end"},Rs={class:"flex items-center"},Us={class:"ml-2"},Js={key:8,class:"text-slate-500 text-xs truncate self-end"},Fs={class:"flex items-center"},Gs={class:"ml-2"},Ks={key:9,class:"text-slate-500 text-xs truncate self-end"},Xs={class:"flex items-center"},Ys={class:"ml-2"},Ws={key:10,class:"bg-green-600 text-white rounded-md py-[1px] px-[8px] min-w-10 text-[10px] flex items-center justify-center"},Qs={class:"px-4 pb-4"},ea={__name:"ChatTable",props:{rows:{type:Object,required:!0},filters:{type:Object},rowCount:{type:Number,required:!0},ticketingIsEnabled:{type:Boolean},status:{type:String},chatSortDirection:{type:String}},emits:["view"],setup(t,{emit:a}){const s=t,d=b(!1);b(null);const n=h=>JSON.parse(h).type,c=h=>JSON.parse(h),u=h=>({"text/plain":"TXT","application/pdf":"PDF","application/vnd.ms-powerpoint":"PPT","application/msword":"DOC","application/vnd.ms-excel":"XLS","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.presentationml.presentation":"PPTX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"})[h]||"Unknown",w=h=>{const r=JSON.parse(h).contacts;if(r.length===1){const p=r[0];return p.name.formatted_name||`${p.name.first_name} ${p.name.last_name}`}else if(r.length>1){const p=r[0].name.first_name,O=r.length-1;return`${p} and ${O} other contacts`}else return"No contacts available"},$=h=>{const r=new Date,p=new Date(h);if(p.getDate()===r.getDate()&&p.getMonth()===r.getMonth()&&p.getFullYear()===r.getFullYear())return C(p,"h:mm a");const O=new Date;return O.setDate(r.getDate()-1),p.getDate()===O.getDate()&&p.getMonth()===O.getMonth()&&p.getFullYear()===O.getFullYear()?"Yesterday":C(p,"d/m/y")},C=(h,r)=>{let p=null;return r==="h:mm a"?p={hour12:!0,hour:"numeric",minute:"numeric"}:p={day:"numeric",month:"numeric",year:"numeric"},new Intl.DateTimeFormat("en-US",p).format(h)},g=window.location.search;Y(()=>g,(h,r)=>{console.log("Query parameters changed:",h)});const i=b({search:s.filters.search}),y=wt(()=>{d.value=!0,x()},1e3),x=()=>{const h=window.location.pathname;K.visit(h,{method:"get",data:i.value})},v=()=>{i.value.search=null,x()};return(h,r)=>(l(),o(z,null,[e("div",cs,[e("div",ds,[e("div",us,[e("h2",null,m(h.$t("Chats")),1),e("span",ps,m(t.rowCount),1)])]),e("div",hs,[r[4]||(r[4]=e("div",{class:"pl-3 py-2"},[e("svg",{class:"text-slate-600",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:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m18 11l-6-6"})])],-1)),Ke(e("input",{onInput:r[0]||(r[0]=(...p)=>T(y)&&T(y)(...p)),"onUpdate:modelValue":r[1]||(r[1]=p=>i.value.search=p),class:"w-full bg-slate-50 outline-none rounded-xl py-2 pl-2 mr-2 text-sm",type:"text",placeholder:h.$t("Search name or number...")},null,40,ms),[[Xe,i.value.search]]),d.value===!1&&i.value.search?(l(),o("button",{key:0,onClick:v,type:"button",class:"pr-2"},r[2]||(r[2]=[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)]))):f("",!0),d.value?(l(),o("span",vs,r[3]||(r[3]=[A('<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)]))):f("",!0)]),t.ticketingIsEnabled?(l(),o("div",fs,[Z(as,{status:t.status,rowCount:t.rowCount},null,8,["status","rowCount"]),e("div",gs,[Z(rs,{direction:s.chatSortDirection,url:"/chats/update-sort-direction"},null,8,["direction"])])])):f("",!0)]),e("div",ys,[(l(!0),o(z,null,F(t.rows.data,(p,O)=>(l(),P(T(J),{href:"/chats/"+p.uuid+"?page="+s.rows.meta.current_page,class:E(["block border-b group-hover:pr-0",p.unread_messages>0?"bg-green-50":""]),key:O},{default:q(()=>{var N,I,B,j;return[e("div",ws,[e("div",xs,[p.avatar?(l(),o("img",{key:0,class:"rounded-full w-10 h-10",src:p.avatar},null,8,bs)):(l(),o("div",ks,m(p.full_name.substring(0,1)),1))]),e("div",Cs,[e("div",$s,[e("h3",_s,m(p.full_name),1),e("span",Ms,m($(p.last_chat.created_at)),1)]),p.last_chat.deleted_at===null?(l(),o("div",Ss,[n(p.last_chat.metadata)==="text"?(l(),o("p",Os,m(c(p.last_chat.metadata).text.body),1)):f("",!0),n(p.last_chat.metadata)==="button"?(l(),o("p",Ts,m(c(p.last_chat.metadata).button.text),1)):f("",!0),n(p.last_chat.metadata)==="interactive"?(l(),o("p",Vs,m(((I=(N=c(p.last_chat.metadata).interactive)==null?void 0:N.button_reply)==null?void 0:I.title)||((j=(B=c(p.last_chat.metadata).interactive)==null?void 0:B.list_reply)==null?void 0:j.title)),1)):f("",!0),n(p.last_chat.metadata)==="image"?(l(),o("p",Ls,[e("div",Ns,[r[5]||(r[5]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.9 13.98l2.1 2.53l3.1-3.99c.2-.26.6-.26.8.01l3.51 4.68a.5.5 0 0 1-.4.8H6.02c-.42 0-.65-.48-.39-.81L8.12 14c.19-.26.57-.27.78-.02z"})],-1)),e("span",Zs,m(h.$t("Photo")),1)])])):f("",!0),n(p.last_chat.metadata)==="document"?(l(),o("p",Is,[e("div",Bs,[r[6]||(r[6]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M14.25 2.5a.25.25 0 0 0-.25-.25H7A2.75 2.75 0 0 0 4.25 5v14A2.75 2.75 0 0 0 7 21.75h10A2.75 2.75 0 0 0 19.75 19V9.147a.25.25 0 0 0-.25-.25H15a.75.75 0 0 1-.75-.75V2.5Zm.75 9.75a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1 0-1.5h6Zm0 4a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1 0-1.5h6Z","clip-rule":"evenodd"}),e("path",{fill:"currentColor",d:"M15.75 2.824c0-.184.193-.301.336-.186c.121.098.23.212.323.342l3.013 4.197c.068.096-.006.22-.124.22H16a.25.25 0 0 1-.25-.25V2.824Z"})],-1)),e("span",qs,m(u(p.last_chat.media.type))+" "+m(h.$t("File")),1)])])):f("",!0),n(p.last_chat.metadata)==="video"?(l(),o("p",Es,[e("div",js,[r[7]||(r[7]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor",d:"M3.5 2.5A2.5 2.5 0 0 0 1 5v6a2.5 2.5 0 0 0 2.5 2.5h5A2.5 2.5 0 0 0 11 11V5a2.5 2.5 0 0 0-2.5-2.5h-5Zm10.684 1.61L12 5.893v4.215l2.184 1.78a.5.5 0 0 0 .816-.389v-7a.5.5 0 0 0-.816-.387Z"})],-1)),e("span",Hs,m(h.$t("Video")),1)])])):f("",!0),n(p.last_chat.metadata)==="audio"?(l(),o("p",Ps,[e("div",As,[r[8]||(r[8]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 512 512"},[e("path",{fill:"currentColor",d:"M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"})],-1)),e("span",zs,m(h.$t("Audio")),1)])])):f("",!0),n(p.last_chat.metadata)==="sticker"?(l(),o("p",Ds,[e("div",Rs,[r[9]||(r[9]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256"},[e("path",{fill:"currentColor",d:"M168 32H88a56.06 56.06 0 0 0-56 56v80a56.06 56.06 0 0 0 56 56h48a8.07 8.07 0 0 0 2.53-.41c26.23-8.75 76.31-58.83 85.06-85.06A8.07 8.07 0 0 0 224 136V88a56.06 56.06 0 0 0-56-56Zm-32 175.42V176a40 40 0 0 1 40-40h31.42c-9.26 21.55-49.87 62.16-71.42 71.42Z"})],-1)),e("span",Us,m(h.$t("Sticker")),1)])])):f("",!0),n(p.last_chat.metadata)==="contacts"?(l(),o("p",Js,[e("div",Fs,[r[10]||(r[10]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor",d:"M3 14s-1 0-1-1s1-4 6-4s6 3 6 4s-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6a3 3 0 0 0 0 6Z"})],-1)),e("span",Gs,m(w(p.last_chat.metadata)),1)])])):f("",!0),n(p.last_chat.metadata)==="location"?(l(),o("p",Ks,[e("div",Xs,[r[11]||(r[11]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor",d:"M9.156 14.544C10.899 13.01 14 9.876 14 7A6 6 0 0 0 2 7c0 2.876 3.1 6.01 4.844 7.544a1.736 1.736 0 0 0 2.312 0ZM6 7a2 2 0 1 1 4 0a2 2 0 0 1-4 0Z"})],-1)),e("span",Ys,m(h.$t("Location")),1)])])):f("",!0),p.unread_messages>0?(l(),o("span",Ws,m(p.unread_messages),1)):f("",!0)])):f("",!0)])])]}),_:2},1032,["href","class"]))),128))],512),e("div",Qs,[Z(xt,{class:"mt-3",pagination:t.rows.meta},null,8,["pagination"])])],64))}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".mapdiv[data-v-174b771e]{width:100%;height:100%}.info-window-wrapper[data-v-90174664]{display:none}.mapdiv .info-window-wrapper[data-v-90174664]{display:inline-block}.custom-marker-wrapper[data-v-2d2d343a]{display:none}.mapdiv .custom-marker-wrapper[data-v-2d2d343a]{display:inline-block}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();var ta=Object.defineProperty,sa=(t,a,s)=>a in t?ta(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,De=(t,a,s)=>(sa(t,typeof a!="symbol"?a+"":a,s),s);const st=Symbol("map"),at=Symbol("api"),aa=Symbol("marker"),la=Symbol("markerCluster"),ie=Symbol("CustomMarker"),na=Symbol("mapTilesLoaded"),lt=["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"];/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function oa(t,a,s,d){function n(c){return c instanceof s?c:new s(function(u){u(c)})}return new(s||(s=Promise))(function(c,u){function w(g){try{C(d.next(g))}catch(i){u(i)}}function $(g){try{C(d.throw(g))}catch(i){u(i)}}function C(g){g.done?c(g.value):n(g.value).then(w,$)}C((d=d.apply(t,a||[])).next())})}var ia=function t(a,s){if(a===s)return!0;if(a&&s&&typeof a=="object"&&typeof s=="object"){if(a.constructor!==s.constructor)return!1;var d,n,c;if(Array.isArray(a)){if(d=a.length,d!=s.length)return!1;for(n=d;n--!==0;)if(!t(a[n],s[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===s.source&&a.flags===s.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===s.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===s.toString();if(c=Object.keys(a),d=c.length,d!==Object.keys(s).length)return!1;for(n=d;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,c[n]))return!1;for(n=d;n--!==0;){var u=c[n];if(!t(a[u],s[u]))return!1}return!0}return a!==a&&s!==s};const Re="__googleMapsScriptId";var G;(function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"})(G||(G={}));class U{constructor({apiKey:a,authReferrerPolicy:s,channel:d,client:n,id:c=Re,language:u,libraries:w=[],mapIds:$,nonce:C,region:g,retries:i=3,url:y="https://maps.googleapis.com/maps/api/js",version:x}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=a,this.authReferrerPolicy=s,this.channel=d,this.client=n,this.id=c||Re,this.language=u,this.libraries=w,this.mapIds=$,this.nonce=C,this.region=g,this.retries=i,this.url=y,this.version=x,U.instance){if(!ia(this.options,U.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(U.instance.options)}`);return U.instance}U.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?G.FAILURE:this.done?G.SUCCESS:this.loading?G.LOADING:G.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let a=this.url;return a+="?callback=__googleMapsCallback",this.apiKey&&(a+=`&key=${this.apiKey}`),this.channel&&(a+=`&channel=${this.channel}`),this.client&&(a+=`&client=${this.client}`),this.libraries.length>0&&(a+=`&libraries=${this.libraries.join(",")}`),this.language&&(a+=`&language=${this.language}`),this.region&&(a+=`®ion=${this.region}`),this.version&&(a+=`&v=${this.version}`),this.mapIds&&(a+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(a+=`&auth_referrer_policy=${this.authReferrerPolicy}`),a}deleteScript(){const a=document.getElementById(this.id);a&&a.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((a,s)=>{this.loadCallback(d=>{d?s(d.error):a(window.google)})})}importLibrary(a){return this.execute(),google.maps.importLibrary(a)}loadCallback(a){this.callbacks.push(a),this.execute()}setScript(){var a,s;if(document.getElementById(this.id)){this.callback();return}const d={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(d).forEach(c=>!d[c]&&delete d[c]),!((s=(a=window==null?void 0:window.google)===null||a===void 0?void 0:a.maps)===null||s===void 0)&&s.importLibrary||(c=>{let u,w,$,C="The Google Maps JavaScript API",g="google",i="importLibrary",y="__ib__",x=document,v=window;v=v[g]||(v[g]={});const h=v.maps||(v.maps={}),r=new Set,p=new URLSearchParams,O=()=>u||(u=new Promise((N,I)=>oa(this,void 0,void 0,function*(){var B;yield w=x.createElement("script"),w.id=this.id,p.set("libraries",[...r]+"");for($ in c)p.set($.replace(/[A-Z]/g,j=>"_"+j[0].toLowerCase()),c[$]);p.set("callback",g+".maps."+y),w.src=this.url+"?"+p,h[y]=N,w.onerror=()=>u=I(Error(C+" could not load.")),w.nonce=this.nonce||((B=x.querySelector("script[nonce]"))===null||B===void 0?void 0:B.nonce)||"",x.head.append(w)})));h[i]?console.warn(C+" only loads once. Ignoring:",c):h[i]=(N,...I)=>r.add(N)&&O().then(()=>h[i](N,...I))})(d);const n=this.libraries.map(c=>this.importLibrary(c));n.length||n.push(this.importLibrary("core")),Promise.all(n).then(()=>this.callback(),c=>{const u=new ErrorEvent("error",{error:c});this.loadErrorCallback(u)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(a){if(this.errors.push(a),this.errors.length<=this.retries){const s=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${s} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},s)}else this.onerrorEvent=a,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(a=>{a(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}function ra(t){return class extends t.OverlayView{constructor(a){super(),De(this,"element"),De(this,"opts");const{element:s,...d}=a;this.element=s,this.opts=d,this.opts.map&&this.setMap(this.opts.map)}getPosition(){return this.opts.position?this.opts.position instanceof t.LatLng?this.opts.position:new t.LatLng(this.opts.position):null}getVisible(){if(!this.element)return!1;const a=this.element;return a.style.display!=="none"&&a.style.visibility!=="hidden"&&(a.style.opacity===""||Number(a.style.opacity)>.01)}onAdd(){if(!this.element)return;const a=this.getPanes();a&&a.overlayMouseTarget.appendChild(this.element)}draw(){if(!this.element)return;const a=this.getProjection(),s=a==null?void 0:a.fromLatLngToDivPixel(this.getPosition());if(s){this.element.style.position="absolute";const d=this.element.offsetHeight,n=this.element.offsetWidth;let c,u;switch(this.opts.anchorPoint){case"TOP_CENTER":c=s.x-n/2,u=s.y;break;case"BOTTOM_CENTER":c=s.x-n/2,u=s.y-d;break;case"LEFT_CENTER":c=s.x,u=s.y-d/2;break;case"RIGHT_CENTER":c=s.x-n,u=s.y-d/2;break;case"TOP_LEFT":c=s.x,u=s.y;break;case"TOP_RIGHT":c=s.x-n,u=s.y;break;case"BOTTOM_LEFT":c=s.x,u=s.y-d;break;case"BOTTOM_RIGHT":c=s.x-n,u=s.y-d;break;default:c=s.x-n/2,u=s.y-d/2}this.element.style.left=c+"px",this.element.style.top=u+"px",this.element.style.transform=`translateX(${this.opts.offsetX||0}px) translateY(${this.opts.offsetY||0}px)`,this.opts.zIndex&&(this.element.style.zIndex=this.opts.zIndex.toString())}}onRemove(){this.element&&this.element.remove()}setOptions(a){const{element:s,...d}=a;this.element=s,this.opts=d,this.draw()}}}let Ue;const Je=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","heading_changed","idle","maptypeid_changed","mousemove","mouseout","mouseover","projection_changed","resize","rightclick","tilesloaded","tilt_changed","zoom_changed"],ca=Qe({props:{apiPromise:{type:Promise},apiKey:{type:String,default:""},version:{type:String,default:"weekly"},libraries:{type:Array,default:()=>["places"]},region:{type:String,required:!1},language:{type:String,required:!1},backgroundColor:{type:String,required:!1},center:{type:Object,default:()=>({lat:0,lng:0})},clickableIcons:{type:Boolean,required:!1,default:void 0},controlSize:{type:Number,required:!1},disableDefaultUi:{type:Boolean,required:!1,default:void 0},disableDoubleClickZoom:{type:Boolean,required:!1,default:void 0},draggable:{type:Boolean,required:!1,default:void 0},draggableCursor:{type:String,required:!1},draggingCursor:{type:String,required:!1},fullscreenControl:{type:Boolean,required:!1,default:void 0},fullscreenControlPosition:{type:String,required:!1},gestureHandling:{type:String,required:!1},heading:{type:Number,required:!1},keyboardShortcuts:{type:Boolean,required:!1,default:void 0},mapTypeControl:{type:Boolean,required:!1,default:void 0},mapTypeControlOptions:{type:Object,required:!1},mapTypeId:{type:[Number,String],required:!1},mapId:{type:String,required:!1},maxZoom:{type:Number,required:!1},minZoom:{type:Number,required:!1},noClear:{type:Boolean,required:!1,default:void 0},panControl:{type:Boolean,required:!1,default:void 0},panControlPosition:{type:String,required:!1},restriction:{type:Object,required:!1},rotateControl:{type:Boolean,required:!1,default:void 0},rotateControlPosition:{type:String,required:!1},scaleControl:{type:Boolean,required:!1,default:void 0},scaleControlStyle:{type:Number,required:!1},scrollwheel:{type:Boolean,required:!1,default:void 0},streetView:{type:Object,required:!1},streetViewControl:{type:Boolean,required:!1,default:void 0},streetViewControlPosition:{type:String,required:!1},styles:{type:Array,required:!1},tilt:{type:Number,required:!1},zoom:{type:Number,required:!1},zoomControl:{type:Boolean,required:!1,default:void 0},zoomControlPosition:{type:String,required:!1}},emits:Je,setup(t,{emit:a}){const s=b(),d=b(!1),n=b(),c=b(),u=b(!1);Q(st,n),Q(at,c),Q(na,u);const w=()=>{const i={...t};Object.keys(i).forEach(v=>{i[v]===void 0&&delete i[v]});const y=v=>{var h;return v?{position:(h=c.value)==null?void 0:h.ControlPosition[v]}:{}},x={scaleControlOptions:t.scaleControlStyle?{style:t.scaleControlStyle}:{},panControlOptions:y(t.panControlPosition),zoomControlOptions:y(t.zoomControlPosition),rotateControlOptions:y(t.rotateControlPosition),streetViewControlOptions:y(t.streetViewControlPosition),fullscreenControlOptions:y(t.fullscreenControlPosition),disableDefaultUI:t.disableDefaultUi};return{...i,...x}},$=Y([c,n],([i,y])=>{const x=i,v=y;x&&v&&(x.event.addListenerOnce(v,"tilesloaded",()=>{u.value=!0}),setTimeout($,0))},{immediate:!0}),C=()=>{try{const{apiKey:i,region:y,version:x,language:v,libraries:h}=t;Ue=new U({apiKey:i,region:y,version:x,language:v,libraries:h})}catch(i){console.error(i)}},g=i=>{c.value=X(i.maps),n.value=X(new i.maps.Map(s.value,w()));const y=ra(c.value);c.value[ie]=y,Je.forEach(v=>{var h;(h=n.value)==null||h.addListener(v,r=>a(v,r))}),d.value=!0;const x=Object.keys(t).filter(v=>!["apiPromise","apiKey","version","libraries","region","language","center","zoom"].includes(v)).map(v=>et(t,v));Y([()=>t.center,()=>t.zoom,...x],([v,h],[r,p])=>{var O,N,I;const{center:B,zoom:j,...M}=w();(O=n.value)==null||O.setOptions(M),h!==void 0&&h!==p&&((N=n.value)==null||N.setZoom(h));const V=!r||v.lng!==r.lng||v.lat!==r.lat;v&&V&&((I=n.value)==null||I.panTo(v))})};return se(()=>{t.apiPromise&&t.apiPromise instanceof Promise?t.apiPromise.then(g):(C(),Ue.load().then(g))}),tt(()=>{var i;u.value=!1,n.value&&((i=c.value)==null||i.event.clearInstanceListeners(n.value))}),{mapRef:s,ready:d,map:n,api:c,mapTilesLoaded:u}}}),da=(t,a)=>{const s=t.__vccOpts||t;for(const[d,n]of a)s[d]=n;return s},ua={ref:"mapRef",class:"mapdiv"};function pa(t,a,s,d,n,c){return l(),o("div",null,[e("div",ua,null,512),rt(t.$slots,"default",ct(dt({ready:t.ready,map:t.map,api:t.api,mapTilesLoaded:t.mapTilesLoaded})),void 0,!0)])}const ha=da(ca,[["render",pa],["__scopeId","data-v-174b771e"]]);function ma(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var va=function t(a,s){if(a===s)return!0;if(a&&s&&typeof a=="object"&&typeof s=="object"){if(a.constructor!==s.constructor)return!1;var d,n,c;if(Array.isArray(a)){if(d=a.length,d!=s.length)return!1;for(n=d;n--!==0;)if(!t(a[n],s[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===s.source&&a.flags===s.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===s.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===s.toString();if(c=Object.keys(a),d=c.length,d!==Object.keys(s).length)return!1;for(n=d;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,c[n]))return!1;for(n=d;n--!==0;){var u=c[n];if(!t(a[u],s[u]))return!1}return!0}return a!==a&&s!==s};const fa=ma(va),ga=t=>t==="Marker",ya=t=>t===ie,wa=(t,a,s,d)=>{const n=b(),c=le(st,b()),u=le(at,b()),w=le(la,b()),$=te(()=>!!(w.value&&u.value&&(n.value instanceof u.value.Marker||n.value instanceof u.value[ie])));return Y([c,s],(C,[g,i])=>{var y,x,v;const h=!fa(s.value,i)||c.value!==g;!c.value||!u.value||!h||(n.value?(n.value.setOptions(s.value),$.value&&((y=w.value)==null||y.removeMarker(n.value),(x=w.value)==null||x.addMarker(n.value))):(ga(t)?n.value=X(new u.value[t](s.value)):ya(t)?n.value=X(new u.value[t](s.value)):n.value=X(new u.value[t]({...s.value,map:c.value})),$.value?(v=w.value)==null||v.addMarker(n.value):n.value.setMap(c.value),a.forEach(r=>{var p;(p=n.value)==null||p.addListener(r,O=>d(r,O))})))},{immediate:!0}),tt(()=>{var C,g;n.value&&((C=u.value)==null||C.event.clearInstanceListeners(n.value),$.value?(g=w.value)==null||g.removeMarker(n.value):n.value.setMap(null))}),n},Fe=["animation_changed","click","dblclick","rightclick","dragstart","dragend","drag","mouseover","mousedown","mouseout","mouseup","draggable_changed","clickable_changed","contextmenu","cursor_changed","flat_changed","rightclick","zindex_changed","icon_changed","position_changed","shape_changed","title_changed","visible_changed"],xa=Qe({name:"Marker",props:{options:{type:Object,required:!0}},emits:Fe,setup(t,{emit:a,expose:s,slots:d}){const n=et(t,"options"),c=wa("Marker",Fe,n,a);return Q(aa,c),s({marker:c}),()=>{var u;return(u=d.default)==null?void 0:u.call(d)}}});lt.concat(["bounds_changed"]);lt.concat(["center_changed","radius_changed"]);var oe;(function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"})(oe||(oe={}));Object.values(oe);const ba={key:0,class:"max-w-[300px]"},ka={class:"normal-case whitespace-pre-wrap"},Ca={key:0,class:"mr-auto text-sm text-[#00a5f4] flex flex-col relative max-w-[25em]"},$a={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},_a={key:1,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},Ma={key:2,src:"/images/icons/link.png",class:"h-4"},Sa={key:3,src:"/images/icons/reply.png",class:"h-4"},Oa={key:1,class:"max-w-[300px]"},Ta={class:"normal-case whitespace-pre-wrap"},Va={key:2,class:"max-w-[300px]"},La={key:0},Na={class:"normal-case whitespace-pre-wrap"},Za={key:1,class:"normal-case whitespace-pre-wrap"},Ia={key:2,class:"normal-case whitespace-pre-wrap"},Ba={key:3},qa=["src"],Ea={key:1,class:"text-slate-500 flex justify-center items-center space-x-4"},ja={key:2,class:"max-w-[300px]"},Ha={key:3,class:"mr-auto text-sm text-[#00a5f4] flex flex-col relative max-w-[25em]"},Pa={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},Aa={key:1,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},za={key:2,src:"/images/icons/link.png",class:"h-4"},Da={key:3,src:"/images/icons/reply.png",class:"h-4"},Ra={key:4},Ua={class:"relative w-[300px]"},Ja={class:"flex space-x-2 w-full h-1/3 bg-white opacity-90 pt-2"},Fa={key:0,xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36",viewBox:"0 0 1024 1024"},Ga={key:1,xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36",viewBox:"0 0 32 32"},Ka={key:2,xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36",viewBox:"0 0 32 32"},Xa={key:3,xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36",viewBox:"0 0 32 32"},Ya={class:"overflow-ellipsis overflow-hidden line-clamp-2 w-[200px]"},Wa={class:"flex items-center text-slate-500 text-[11px]"},Qa=["href","download"],e1={key:0,xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 24 24"},t1={key:1,xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 24 24"},s1={key:0,class:"mr-auto text-sm text-[#00a5f4] flex flex-col relative max-w-[25em]"},a1={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},l1={key:1,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},n1={key:2,src:"/images/icons/link.png",class:"h-4"},o1={key:3,src:"/images/icons/reply.png",class:"h-4"},i1={key:5},r1={key:6},c1=["src"],d1={key:1,class:"text-slate-500 flex justify-center items-center space-x-4"},u1={key:7},p1={class:"flex space-x-3 w-[300px] items-center"},h1={key:8},m1={key:0,controls:""},v1=["src"],f1={key:1,class:"text-slate-500 flex justify-center items-center space-x-4"},g1={key:9},y1={key:0,controls:"",width:"300",class:"max-h-[350px]"},w1=["src"],x1={key:1,class:"text-slate-500 flex justify-center items-center space-x-4"},b1={key:2,class:"max-w-[300px]"},k1={key:3,class:"mr-auto text-sm text-[#00a5f4] flex flex-col relative max-w-[25em]"},C1={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},$1={key:1,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},_1={key:2,src:"/images/icons/link.png",class:"h-4"},M1={key:3,src:"/images/icons/reply.png",class:"h-4"},S1={class:"flex items-center justify-between mt-2 space-x-4"},O1={key:0,class:"text-gray-500 text-xs text-right leading-none"},T1={class:"text-gray-500 text-xs text-right leading-none"},V1={class:"absolute capitalize hidden group-hover:block bg-white text-gray-600 text-xs rounded-sm py-1 px-2 bottom-full mb-1 whitespace-no-wrap"},L1={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},N1={key:1,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 16 16"},Z1={key:2,class:"text-red-600",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},I1={key:10,class:"cursor-pointer text-center border-t mt-2 pt-2"},B1={__name:"ChatBubble",props:{content:Object,type:String},setup(t){const a=t,s=b(!1),d=()=>{s.value=!0,setTimeout(()=>{s.value=!1},2e3)},n=g=>({"text/plain":"TXT","application/pdf":"PDF","application/powerpoint":"PPT","application/vnd.ms-powerpoint":"PPT","application/msword":"DOC","application/vnd.ms-excel":"XLS","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.presentationml.presentation":"PPTX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"})[g]||"Unknown",c=g=>{if(g===0)return"0 Bytes";const i=1024,y=["Bytes","KB","MB","GB","TB"],x=parseInt(Math.floor(Math.log(g)/Math.log(i)));return Math.round(g/Math.pow(i,x)*100)/100+" "+y[x]},u=g=>{const i=JSON.parse(g).contacts;if(i.length===1){const y=i[0];return y.name.formatted_name||`${y.name.first_name} ${y.name.last_name}`}else if(i.length>1){const y=i[0].name.first_name,x=i.length-1;return`${y} and ${x} other contacts`}else return"No contacts available"},w=g=>{const i=JSON.parse(g);return{lat:i.location.latitude,lng:i.location.longitude}},$=g=>{const y=te(()=>Ye().props.config).value.find(x=>x.key===g);return y?y.value:""},C=g=>{let i="sent";return g.forEach(y=>{const v=JSON.parse(y.metadata).status;if(v==="failed"){i="failed";return}else v==="read"?i="read":v==="delivered"&&i!=="read"&&(i="delivered")}),i};return(g,i)=>{var y,x,v,h,r,p,O,N,I,B,j,M,V,D,_,k,S,re,ce,de,ue,pe,he,me,ve,fe,ge,ye,we,xe,be,ke,Ce,$e,_e,Me,Se,Oe,Te,Ve,Le,Ne,Ze,Ie,Be,qe,Ee,je,He,Pe,Ae,ze;return l(),o("div",{class:E(["rounded-lg my-1 p-2 text-sm flex flex-col relative",a.type==="outbound"?"ml-auto rounded-tr-none bg-[#d8fad4] speech-bubble-right":"mr-auto rounded-tl-none bg-white speech-bubble-left"])},[e("div",null,[JSON.parse(t.content.metadata).type==="text"?(l(),o("div",ba,[e("p",ka,m(JSON.parse(t.content.metadata).text.body),1),(y=JSON.parse(t.content.metadata))!=null&&y.buttons?(l(),o("div",Ca,[(l(!0),o(z,null,F((x=JSON.parse(t.content.metadata))==null?void 0:x.buttons,(L,R)=>(l(),o("div",{key:R,class:"flex justify-center items-center space-x-2 rounded-lg bg-white h-10 my-[0.1em]"},[e("span",null,[L.type==="COPY_CODE"?(l(),o("svg",$a,i[0]||(i[0]=[e("path",{fill:"currentColor",d:"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"},null,-1)]))):L.type==="PHONE_NUMBER"?(l(),o("svg",_a,i[1]||(i[1]=[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"M20 16v4c-2.758 0-5.07-.495-7-1.325c-3.841-1.652-6.176-4.63-7.5-7.675C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3c1.324 3.045 3.659 6.023 7.5 7.675L16 15l4 1z"}),e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 18.675c1.93.83 4.242 1.325 7 1.325v-4l-4-1l-3 3.675zm0 0C9.159 17.023 6.824 14.045 5.5 11m0 0C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3z"})],-1)]))):L.type==="URL"?(l(),o("img",Ma)):(l(),o("img",Sa))]),e("span",null,m(L.text),1)]))),128))])):f("",!0)])):f("",!0),JSON.parse(t.content.metadata).type==="button"?(l(),o("div",Oa,[e("p",Ta,m(JSON.parse(t.content.metadata).button.text),1)])):f("",!0),JSON.parse(t.content.metadata).type==="interactive"?(l(),o("div",Va,[JSON.parse(t.content.metadata).interactive.type=="button_reply"?(l(),o("div",La,[e("p",Na,m((h=(v=JSON.parse(t.content.metadata).interactive)==null?void 0:v.button_reply)==null?void 0:h.title),1)])):f("",!0),JSON.parse(t.content.metadata).interactive.type=="list_reply"?(l(),o("p",Za,m((p=(r=JSON.parse(t.content.metadata).interactive)==null?void 0:r.list_reply)==null?void 0:p.title),1)):f("",!0),JSON.parse(t.content.metadata).interactive.type=="list_reply"?(l(),o("p",Ia,m((N=(O=JSON.parse(t.content.metadata).interactive)==null?void 0:O.list_reply)==null?void 0:N.description),1)):f("",!0)])):JSON.parse(t.content.metadata).type==="image"?(l(),o("div",Ba,[t.content.media!=null?(l(),o("img",{key:0,src:(B=(I=t.content)==null?void 0:I.media)==null?void 0:B.path,alt:"Image",class:"mb-2 max-w-[300px]"},null,8,qa)):(l(),o("div",Ea,[i[2]||(i[2]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),e("path",{fill:"currentColor",d:"m13.299 3.148l8.634 14.954a1.5 1.5 0 0 1-1.299 2.25H3.366a1.5 1.5 0 0 1-1.299-2.25l8.634-14.954c.577-1 2.02-1 2.598 0ZM12 4.898L4.232 18.352h15.536L12 4.898ZM12 15a1 1 0 1 1 0 2a1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Z"})])],-1)),H(" "+m(g.$t("Content not available")),1)])),(j=JSON.parse(t.content.metadata).image)!=null&&j.caption?(l(),o("div",ja,m((M=JSON.parse(t.content.metadata).image)==null?void 0:M.caption),1)):f("",!0),(V=JSON.parse(t.content.metadata))!=null&&V.buttons?(l(),o("div",Ha,[(l(!0),o(z,null,F((D=JSON.parse(t.content.metadata))==null?void 0:D.buttons,(L,R)=>(l(),o("div",{key:R,class:"flex justify-center items-center space-x-2 rounded-lg bg-white h-10 my-[0.1em]"},[e("span",null,[L.type==="COPY_CODE"?(l(),o("svg",Pa,i[3]||(i[3]=[e("path",{fill:"currentColor",d:"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"},null,-1)]))):L.type==="PHONE_NUMBER"?(l(),o("svg",Aa,i[4]||(i[4]=[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"M20 16v4c-2.758 0-5.07-.495-7-1.325c-3.841-1.652-6.176-4.63-7.5-7.675C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3c1.324 3.045 3.659 6.023 7.5 7.675L16 15l4 1z"}),e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 18.675c1.93.83 4.242 1.325 7 1.325v-4l-4-1l-3 3.675zm0 0C9.159 17.023 6.824 14.045 5.5 11m0 0C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3z"})],-1)]))):L.type==="URL"?(l(),o("img",za)):(l(),o("img",Da))]),e("span",null,m(L.text),1)]))),128))])):f("",!0)])):JSON.parse(t.content.metadata).type==="document"?(l(),o("div",Ra,[e("div",Ua,[e("div",Ja,[e("div",null,[n((k=(_=t.content)==null?void 0:_.media)==null?void 0:k.type)==="PDF"?(l(),o("svg",Fa,i[5]||(i[5]=[e("path",{fill:"red",d:"m531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7c-3.8-21.3-19.5-29.6-32.9-30.2c-15.8-.7-29.9 8.3-33.4 21.4c-6.6 24-.7 56.8 10.1 98.6c-13.6 32.4-35.3 79.5-51.2 107.5c-29.6 15.3-69.3 38.9-75.2 68.7c-1.2 5.5.2 12.5 3.5 18.8c3.7 7 9.6 12.4 16.5 15c3 1.1 6.6 2 10.8 2c17.6 0 46.1-14.2 84.1-79.4c5.8-1.9 11.8-3.9 17.6-5.9c27.2-9.2 55.4-18.8 80.9-23.1c28.2 15.1 60.3 24.8 82.1 24.8c21.6 0 30.1-12.8 33.3-20.5c5.6-13.5 2.9-30.5-6.2-39.6c-13.2-13-45.3-16.4-95.3-10.2c-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7c6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4c-4.9-19.9-5.6-48.1-2.7-51.4c.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2c-21.6 4.9-41.3 13-58.9 20.2c-4.2 1.7-8.3 3.4-12.3 5c13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6c40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"},null,-1)]))):f("",!0),n((re=(S=t.content)==null?void 0:S.media)==null?void 0:re.type)==="XLSX"||n((de=(ce=t.content)==null?void 0:ce.media)==null?void 0:de.type)==="XLS"?(l(),o("svg",Ga,i[6]||(i[6]=[A('<defs><linearGradient id="vscodeIconsFileTypeExcel0" x1="4.494" x2="13.832" y1="-2092.086" y2="-2075.914" gradientTransform="translate(0 2100)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#18884f"></stop><stop offset=".5" stop-color="#117e43"></stop><stop offset="1" stop-color="#0b6631"></stop></linearGradient></defs><path fill="#185c37" d="M19.581 15.35L8.512 13.4v14.409A1.192 1.192 0 0 0 9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5Z"></path><path fill="#21a366" d="M19.581 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"></path><path fill="#107c41" d="M8.512 9.5h11.069V16H8.512Z"></path><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"></path><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path fill="url(#vscodeIconsFileTypeExcel0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"></path><path fill="#fff" d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017c.082-.188.169-.369.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.355 2.355 0 0 1 9.2 16.8h-.024a1.688 1.688 0 0 1-.168.351l-1.493 2.722Z"></path><path fill="#33c481" d="M28.806 3h-9.225v6.5H30V4.191A1.192 1.192 0 0 0 28.806 3Z"></path><path fill="#107c41" d="M19.581 16H30v6.5H19.581Z"></path>',12)]))):f("",!0),n((pe=(ue=t.content)==null?void 0:ue.media)==null?void 0:pe.type)==="DOC"||n((me=(he=t.content)==null?void 0:he.media)==null?void 0:me.type)==="DOCX"?(l(),o("svg",Ka,i[7]||(i[7]=[A('<defs><linearGradient id="vscodeIconsFileTypeWord0" x1="4.494" x2="13.832" y1="-1712.086" y2="-1695.914" gradientTransform="translate(0 1720)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2368c4"></stop><stop offset=".5" stop-color="#1a5dbe"></stop><stop offset="1" stop-color="#1146ac"></stop></linearGradient></defs><path fill="#41a5ee" d="M28.806 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5l11.069 3.25L30 9.5V4.191A1.192 1.192 0 0 0 28.806 3Z"></path><path fill="#2b7cd3" d="M30 9.5H8.512V16l11.069 1.95L30 16Z"></path><path fill="#185abd" d="M8.512 16v6.5l10.418 1.3L30 22.5V16Z"></path><path fill="#103f91" d="M9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5H8.512v5.309A1.192 1.192 0 0 0 9.705 29Z"></path><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"></path><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"></path><path fill="url(#vscodeIconsFileTypeWord0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"></path><path fill="#fff" d="M6.9 17.988c.023.184.039.344.046.481h.028c.01-.13.032-.287.065-.47s.062-.338.089-.465l1.255-5.407h1.624l1.3 5.326a7.761 7.761 0 0 1 .162 1h.022a7.6 7.6 0 0 1 .135-.975l1.039-5.358h1.477l-1.824 7.748h-1.727l-1.237-5.126q-.054-.222-.122-.578t-.084-.52h-.021q-.021.189-.084.561c-.042.249-.075.432-.1.552L7.78 19.871H6.024L4.19 12.127h1.5l1.131 5.418a4.469 4.469 0 0 1 .079.443Z"></path>',11)]))):f("",!0),n((fe=(ve=t.content)==null?void 0:ve.media)==null?void 0:fe.type)==="PPT"||n((ye=(ge=t.content)==null?void 0:ge.media)==null?void 0:ye.type)==="PPTX"?(l(),o("svg",Xa,i[8]||(i[8]=[A('<defs><linearGradient id="vscodeIconsFileTypePowerpoint0" x1="4.494" x2="13.832" y1="-1748.086" y2="-1731.914" gradientTransform="translate(0 1756)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ca4c28"></stop><stop offset=".5" stop-color="#c5401e"></stop><stop offset="1" stop-color="#b62f14"></stop></linearGradient></defs><path fill="#ed6c47" d="M18.93 17.3L16.977 3h-.146A12.9 12.9 0 0 0 3.953 15.854V16Z"></path><path fill="#ff8f6b" d="M17.123 3h-.146v13l6.511 2.6L30 16v-.146A12.9 12.9 0 0 0 17.123 3Z"></path><path fill="#d35230" d="M30 16v.143A12.905 12.905 0 0 1 17.12 29h-.287a12.907 12.907 0 0 1-12.88-12.857V16Z"></path><path d="M17.628 9.389V23.26a1.2 1.2 0 0 1-.742 1.1a1.16 1.16 0 0 1-.45.091H7.027a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85a8.82 8.82 0 0 1 .456-.65h9.93a1.2 1.2 0 0 1 1.192 1.189Z" opacity=".1"></path><path d="M16.977 10.04v13.871a1.15 1.15 0 0 1-.091.448a1.2 1.2 0 0 1-1.1.741H7.62q-.309-.314-.593-.65a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"></path><path d="M16.977 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"></path><path d="M16.326 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.084a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"></path><path fill="url(#vscodeIconsFileTypePowerpoint0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"></path><path fill="#fff" d="M9.293 12.028a3.287 3.287 0 0 1 2.174.636a2.27 2.27 0 0 1 .756 1.841a2.555 2.555 0 0 1-.373 1.376a2.49 2.49 0 0 1-1.059.935a3.607 3.607 0 0 1-1.591.334H7.687v2.8H6.141v-7.922ZM7.686 15.94h1.331a1.735 1.735 0 0 0 1.177-.351a1.3 1.3 0 0 0 .4-1.025q0-1.309-1.525-1.31H7.686v2.686Z"></path>',10)]))):f("",!0)]),e("div",null,[e("div",null,[e("p",Ya,m((xe=(we=t.content)==null?void 0:we.media)==null?void 0:xe.name),1)]),e("div",Wa,[e("span",null,m(n((ke=(be=t.content)==null?void 0:be.media)==null?void 0:ke.type)),1),i[9]||(i[9]=e("span",null,[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[e("circle",{cx:"12.1",cy:"12.1",r:"1",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("span",null,m(c(($e=(Ce=t.content)==null?void 0:Ce.media)==null?void 0:$e.size)),1)])]),e("a",{href:(Me=(_e=t.content)==null?void 0:_e.media)==null?void 0:Me.path,download:(Oe=(Se=t.content)==null?void 0:Se.media)==null?void 0:Oe.name,target:"_blank",onClick:d,class:"flex justify-end w-full"},[s.value?(l(),o("svg",t1,i[11]||(i[11]=[A('<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="2 4" stroke-dashoffset="6" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21"><animate attributeName="stroke-dashoffset" dur="0.6s" repeatCount="indefinite" values="6;0"></animate></path><path stroke-dasharray="30" stroke-dashoffset="30" d="M12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.1s" dur="0.3s" values="30;0"></animate></path><path stroke-dasharray="10" stroke-dashoffset="10" d="M12 8v7.5"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.5s" dur="0.2s" values="10;0"></animate></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 15.5l3.5 -3.5M12 15.5l-3.5 -3.5"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.7s" dur="0.2s" values="6;0"></animate></path></g>',1)]))):(l(),o("svg",e1,i[10]||(i[10]=[e("path",{fill:"currentColor",d:"M4.025 11.975q0 2.825 1.725 5t4.4 2.825q.375.1.6.425t.225.725q0 .4-.275.663t-.625.187q-3.5-.7-5.775-3.437t-2.275-6.388q0-3.65 2.288-6.387T10.1 2.15q.35-.075.625.188T11 3q0 .4-.225.725t-.6.425q-2.7.65-4.425 2.825t-1.725 5Zm8.95 1.15l1.85-1.85q.3-.3.725-.3t.725.3q.3.3.288.725t-.313.725L12.675 16.3q-.3.3-.7.3t-.7-.3L7.65 12.65q-.3-.3-.288-.713t.313-.712q.3-.3.713-.3t.712.3l1.875 1.9V8q0-.425.288-.713T11.975 7q.425 0 .713.288t.287.712v5.125Zm3.05 5.75q.375-.225.813-.2t.762.35q.3.3.25.713t-.4.637q-.8.5-1.675.863t-1.8.562q-.4.075-.7-.175t-.3-.675q0-.425.263-.75t.687-.45q.55-.15 1.075-.375t1.025-.5ZM13.975 4.2q-.425-.125-.7-.45T13 3q0-.425.288-.675t.687-.175q.95.2 1.838.562T17.5 3.6q.35.225.375.625t-.25.7q-.3.325-.738.35t-.812-.2q-.5-.275-1.025-.5T13.975 4.2Zm5.75 9.75q.125-.425.463-.7t.762-.275q.425 0 .688.325t.162.725q-.2.95-.575 1.812t-.9 1.663q-.225.35-.625.35t-.675-.275q-.3-.3-.337-.725t.187-.8q.275-.5.488-1.012t.362-1.088Zm-.85-6.075q-.225-.375-.188-.788t.338-.712q.275-.275.675-.263t.625.338q.55.8.925 1.688t.575 1.837q.075.4-.187.7t-.688.3q-.425 0-.762-.287t-.463-.713q-.15-.55-.363-1.075t-.487-1.025Z"},null,-1)])))],8,Qa)])]),(Te=JSON.parse(t.content.metadata))!=null&&Te.buttons?(l(),o("div",s1,[(l(!0),o(z,null,F((Ve=JSON.parse(t.content.metadata))==null?void 0:Ve.buttons,(L,R)=>(l(),o("div",{key:R,class:"flex justify-center items-center space-x-2 rounded-lg bg-white h-10 my-[0.1em]"},[e("span",null,[L.type==="COPY_CODE"?(l(),o("svg",a1,i[12]||(i[12]=[e("path",{fill:"currentColor",d:"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"},null,-1)]))):L.type==="PHONE_NUMBER"?(l(),o("svg",l1,i[13]||(i[13]=[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"M20 16v4c-2.758 0-5.07-.495-7-1.325c-3.841-1.652-6.176-4.63-7.5-7.675C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3c1.324 3.045 3.659 6.023 7.5 7.675L16 15l4 1z"}),e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 18.675c1.93.83 4.242 1.325 7 1.325v-4l-4-1l-3 3.675zm0 0C9.159 17.023 6.824 14.045 5.5 11m0 0C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3z"})],-1)]))):L.type==="URL"?(l(),o("img",n1)):(l(),o("img",o1))]),e("span",null,m(L.text),1)]))),128))])):f("",!0)])):JSON.parse(t.content.metadata).type==="location"?(l(),o("div",i1,[Z(T(ha),{"api-key":$("google_maps_api_key"),style:{width:"300px",height:"200px"},center:w(t.content.metadata),zoom:15},{default:q(()=>[Z(T(xa),{options:{position:w(t.content.metadata)}},null,8,["options"])]),_:1},8,["api-key","center"])])):JSON.parse(t.content.metadata).type==="sticker"?(l(),o("div",r1,[t.content.media!=null?(l(),o("img",{key:0,src:(Ne=(Le=t.content)==null?void 0:Le.media)==null?void 0:Ne.path,alt:"Image",class:"mb-2 max-w-[100px]"},null,8,c1)):(l(),o("div",d1,[i[14]||(i[14]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),e("path",{fill:"currentColor",d:"m13.299 3.148l8.634 14.954a1.5 1.5 0 0 1-1.299 2.25H3.366a1.5 1.5 0 0 1-1.299-2.25l8.634-14.954c.577-1 2.02-1 2.598 0ZM12 4.898L4.232 18.352h15.536L12 4.898ZM12 15a1 1 0 1 1 0 2a1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Z"})])],-1)),H(" "+m(g.$t("Content not available")),1)]))])):JSON.parse(t.content.metadata).type==="contacts"?(l(),o("div",u1,[e("div",p1,[i[15]||(i[15]=e("div",{class:"rounded-full p-3 bg-slate-200"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 512 512"},[e("path",{fill:"currentColor",d:"M332.64 64.58C313.18 43.57 286 32 256 32c-30.16 0-57.43 11.5-76.8 32.38c-19.58 21.11-29.12 49.8-26.88 80.78C156.76 206.28 203.27 256 256 256s99.16-49.71 103.67-110.82c2.27-30.7-7.33-59.33-27.03-80.6ZM432 480H80a31 31 0 0 1-24.2-11.13c-6.5-7.77-9.12-18.38-7.18-29.11C57.06 392.94 83.4 353.61 124.8 326c36.78-24.51 83.37-38 131.2-38s94.42 13.5 131.2 38c41.4 27.6 67.74 66.93 76.18 113.75c1.94 10.73-.68 21.34-7.18 29.11A31 31 0 0 1 432 480Z"})])],-1)),e("div",null,m(u(t.content.metadata)),1)])])):JSON.parse(t.content.metadata).type==="audio"?(l(),o("div",h1,[t.content.media!=null?(l(),o("audio",m1,[e("source",{src:(Ie=(Ze=t.content)==null?void 0:Ze.media)==null?void 0:Ie.path},null,8,v1),H(" "+m(g.$t("Your browser does not support the audio element")),1)])):(l(),o("div",f1,[i[16]||(i[16]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),e("path",{fill:"currentColor",d:"m13.299 3.148l8.634 14.954a1.5 1.5 0 0 1-1.299 2.25H3.366a1.5 1.5 0 0 1-1.299-2.25l8.634-14.954c.577-1 2.02-1 2.598 0ZM12 4.898L4.232 18.352h15.536L12 4.898ZM12 15a1 1 0 1 1 0 2a1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Z"})])],-1)),H(" "+m(g.$t("Content not available")),1)]))])):JSON.parse(t.content.metadata).type==="video"?(l(),o("div",g1,[t.content.media!=null?(l(),o("video",y1,[e("source",{src:(qe=(Be=t.content)==null?void 0:Be.media)==null?void 0:qe.path,type:"video/mp4"},null,8,w1),H(" "+m(g.$t("Your browser does not support the video element")),1)])):(l(),o("div",x1,[i[17]||(i[17]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),e("path",{fill:"currentColor",d:"m13.299 3.148l8.634 14.954a1.5 1.5 0 0 1-1.299 2.25H3.366a1.5 1.5 0 0 1-1.299-2.25l8.634-14.954c.577-1 2.02-1 2.598 0ZM12 4.898L4.232 18.352h15.536L12 4.898ZM12 15a1 1 0 1 1 0 2a1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Z"})])],-1)),H(" "+m(g.$t("Content not available")),1)])),(Ee=JSON.parse(t.content.metadata).video)!=null&&Ee.caption?(l(),o("div",b1,m((je=JSON.parse(t.content.metadata).video)==null?void 0:je.caption),1)):f("",!0),(He=JSON.parse(t.content.metadata))!=null&&He.buttons?(l(),o("div",k1,[(l(!0),o(z,null,F((Pe=JSON.parse(t.content.metadata))==null?void 0:Pe.buttons,(L,R)=>(l(),o("div",{key:R,class:"flex justify-center items-center space-x-2 rounded-lg bg-white h-10 my-[0.1em]"},[e("span",null,[L.type==="COPY_CODE"?(l(),o("svg",C1,i[18]||(i[18]=[e("path",{fill:"currentColor",d:"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"},null,-1)]))):L.type==="PHONE_NUMBER"?(l(),o("svg",$1,i[19]||(i[19]=[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"M20 16v4c-2.758 0-5.07-.495-7-1.325c-3.841-1.652-6.176-4.63-7.5-7.675C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3c1.324 3.045 3.659 6.023 7.5 7.675L16 15l4 1z"}),e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 18.675c1.93.83 4.242 1.325 7 1.325v-4l-4-1l-3 3.675zm0 0C9.159 17.023 6.824 14.045 5.5 11m0 0C4.4 8.472 4 5.898 4 4h4l1 4l-3.5 3z"})],-1)]))):L.type==="URL"?(l(),o("img",_1)):(l(),o("img",M1))]),e("span",null,m(L.text),1)]))),128))])):f("",!0)])):f("",!0),e("div",S1,[a.type==="outbound"&&t.content.user?(l(),o("span",O1,"Sent By: "+m(((Ae=t.content.user)==null?void 0:Ae.first_name)+" "+((ze=t.content.user)==null?void 0:ze.last_name)),1)):f("",!0),e("p",T1,m(t.content.created_at),1),e("span",{class:E(["relative group cursor-pointer",C(t.content.logs)==="read"?"text-blue-500":"text-gray-500"])},[e("div",V1,m(C(t.content.logs)),1),C(t.content.logs)==="sent"?(l(),o("svg",L1,i[20]||(i[20]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"m2.75 8.75l3.5 3.5l7-7.5"},null,-1)]))):f("",!0),C(t.content.logs)==="delivered"||C(t.content.logs)==="read"?(l(),o("svg",N1,i[21]||(i[21]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"m1.75 9.75l2.5 2.5m3.5-4l2.5-2.5m-4.5 4l2.5 2.5l6-6.5"},null,-1)]))):f("",!0),C(t.content.logs)==="failed"?(l(),o("svg",Z1,i[22]||(i[22]=[e("g",{fill:"currentColor"},[e("path",{d:"M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2zm3.708 6.208L1 11.105V5.383zM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2z"}),e("path",{d:"M12.5 16a3.5 3.5 0 1 0 0-7a3.5 3.5 0 0 0 0 7m.5-5v1.5a.5.5 0 0 1-1 0V11a.5.5 0 0 1 1 0m0 3a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0"})],-1)]))):f("",!0)],2)]),JSON.parse(t.content.metadata).type==="contacts"?(l(),o("div",I1,m(g.$t("View")),1)):f("",!0)])],2)}}},q1={key:0,class:"py-4 md:py-4 relative px-6 md:px-10"},E1={key:1,class:"py-2"},j1={class:"text-center font-light text-sm border-b border-t py-2 border-dashed border-black"},H1={class:"text-xs"},P1={key:2,class:"py-2 bg-orange-100 my-2 rounded-lg p-2 w-[fit-content] ml-auto"},A1={class:"text-right font-light text-sm"},z1={class:"flex items-center justify-between mt-2 space-x-4"},D1={class:"text-gray-500 text-xs text-right leading-none"},R1={__name:"ChatThread",props:{rows:{type:Object,required:!0}},setup(t){return(a,s)=>t.rows.length>0?(l(),o("div",q1,[(l(!0),o(z,null,F(t.rows,(d,n)=>(l(),o("div",{class:E(["flex flex-grow flex-col",d[0].type==="ticket"?"justify-center":"justify-end"])},[d[0].type==="chat"?(l(),P(B1,{key:n,content:d[0].value,type:d[0].value.type},null,8,["content","type"])):f("",!0),d[0].type==="ticket"?(l(),o("div",E1,[e("div",j1,[e("div",null,m(d[0].value.description),1),e("div",H1,m(d[0].value.created_at),1)])])):f("",!0),d[0].type==="notes"?(l(),o("div",P1,[e("div",A1,[e("div",null,m(d[0].value.content),1),e("div",z1,[e("p",D1,m(d[0].value.created_at),1)])])])):f("",!0)],2))),256))])):f("",!0)}},U1={class:"md:flex md:flex-grow md:overflow-hidden"},J1={key:2,class:"w-full py-4"},F1={key:3,class:"flex-1 overflow-y-hidden"},G1=["onClick"],Ol={__name:"Index",props:["rows","rowCount","pusherSettings","organizationId","isChatLimitReached","toggleNavBar","state","demoNumber","settings","status","chatThread","addon","contact","ticket","chat_sort_direction","filters","templates","fields","locationSettings"],setup(t){var B,j;const a=t,s=b(a.rows);b(a.rowCount),b(null);const d=b(null),n=b(!1),c=b(!1),u=b(!1),w=b(!1),$=b(a.isChatLimitReached),C=b(null);b(!1);const g=b(a.settings.metadata),i=b(g.value?JSON.parse(g.value):null),y=b(((j=(B=i.value)==null?void 0:B.tickets)==null?void 0:j.active)??!1),x=b(a.chatThread),v=b(a.contact);Y(()=>a.rows,M=>{s.value=M});function h(M){c.value=M}const r=()=>{const M=d.value;M&&M.scrollTo({top:M.scrollHeight,behavior:"smooth"})},p=()=>{C.value.click(),v.value=null},O=()=>{x.value=[],ne.delete("/chats/"+v.value.uuid)},N=M=>{const V=M[0].value.wam_id;!x.value.some(_=>_[0].value.wam_id===V)&&M[0].value.deleted_at==null&&(x.value.push(M),setTimeout(r,100))},I=async M=>{v.value&&v.value.id==M[0].value.contact_id&&N(M);const V=await ne.get("/chats");V&&(s.value=V.data.result)};return se(()=>{nt(a.pusherSettings.pusher_app_key,a.pusherSettings.pusher_app_cluster).channel("chats.ch"+a.organizationId).listen("NewChatEvent",V=>{I(V.chat)}),r()}),(M,V)=>(l(),P(ot,null,{default:q(D=>[e("div",U1,[e("div",{class:E(["md:w-[30%] md:flex flex-col h-full bg-white border-r border-l",v.value?"hidden":""])},[Z(ea,{rows:s.value,filters:a.filters,rowCount:a.rowCount,ticketingIsEnabled:y.value,status:a==null?void 0:a.status,chatSortDirection:a.chat_sort_direction},null,8,["rows","filters","rowCount","ticketingIsEnabled","status","chatSortDirection"])],2),e("div",{class:E(["min-w-0 bg-cover flex flex-col chat-bg",v.value?"h-screen md:w-[70%]":"md:h-screen md:w-[70%]"])},[v.value?(l(),P(Yt,{key:0,ticketingIsEnabled:y.value,contact:v.value,displayContactInfo:c.value,ticket:t.ticket,addon:t.addon,onToggleView:h,onDeleteThread:O,onCloseThread:p},null,8,["ticketingIsEnabled","contact","displayContactInfo","ticket","addon"])):f("",!0),v.value&&!u.value?(l(),o("div",{key:1,class:"flex-1 overflow-y-auto",ref_key:"scrollContainer2",ref:d},[!c.value&&!n.value&&!u.value?(l(),P(R1,{key:0,rows:x.value},null,8,["rows"])):f("",!0),c.value&&!u.value?(l(),P(bt,{key:1,class:"bg-white h-full",fields:a.fields,contact:v.value,locationSettings:a.locationSettings},null,8,["fields","contact","locationSettings"])):f("",!0)],512)):f("",!0),v.value&&!c.value&&!w.value&&!u.value?(l(),o("div",J1,[Z(Bt,{contact:v.value,chatLimitReached:$.value,onViewTemplate:V[0]||(V[0]=_=>{u.value=!0})},null,8,["contact","chatLimitReached"])])):f("",!0),u.value?(l(),o("div",F1,[u.value?(l(),P(ut,{key:0,class:"bg-white h-full",contact:v.value.uuid,templates:t.templates,contactGroups:[],settings:a.settings,displayCancelBtn:!1,displayTitle:!0,isCampaignFlow:!1,scheduleTemplate:!1,sendText:"Send Message",onViewTemplate:V[1]||(V[1]=_=>{u.value=!1})},null,8,["contact","templates","settings"])):f("",!0)])):f("",!0)],2)]),e("button",{class:"hidden",ref_key:"toggleNavbarBtn",ref:C,onClick:D.toggleNavBar},null,8,G1)]),_:1}))}};export{Ol as default};