1import{a as x,b as t,o as n,d as dt,r as d,e as L,w as z,p as A,k as B,q as F,h as U,n as k,E as O,H as W,t as $,C as R,v as j,A as H,F as Q,l as X,f as ut,s as ct}from"./vendor-C671BQZa.js";import{a as V,r as Z,b as xt,c as J,d as bt,e as yt,f as gt,g as ft}from"./index-B67ahr15.js";import{r as K}from"./ExclamationTriangleIcon-X-GqSGYd.js";import{r as pt}from"./ArrowLeftIcon-D59_kBR3.js";import{r as mt}from"./PlusIcon-CJYmMWPD.js";import{r as vt}from"./ChatBubbleLeftIcon-CEzB4k1b.js";function G(l,p){return n(),x("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})])}const Y="nircle_bots_v1";function N(l,p){for(const i of p){const b=l==null?void 0:l[i];if(b!=null&&String(b).trim()!=="")return String(b).trim()}return""}function tt(l){let p=l;return Array.isArray(p)&&(p=p[0]),!p||typeof p!="object"?"":N(p,["bot_api_key","bot_access_token","access_token","bot_token","token"])}const et=dt("bots",()=>{const l=d([]),p=d(!1),i=d(!1);function b(){try{const o=localStorage.getItem(Y);if(!o)return[];const s=JSON.parse(o);return Array.isArray(s)?s:[]}catch{return[]}}function y(o){try{localStorage.setItem(Y,JSON.stringify(o))}catch{}}function m(o){const s=b().filter(v=>v.botUserId!==o.botUserId);s.unshift(o),y(s)}function w(o){y(b().filter(s=>s.botUserId!==o)),l.value=l.value.filter(s=>s.botUserId!==o)}function h(o,s){const v=N(o,["webhook_url"]),_=o==null?void 0:o.has_webhook,I=N(o,["chats_total","chats_count"]);return{botUserId:N(o,["bot_user_id","user_id","id"])||(s==null?void 0:s.botUserId)||"",botCode:N(o,["bot_code","unique_code"])||(s==null?void 0:s.botCode)||"",botName:N(o,["bot_name","name","full_name"]),botToken:(s==null?void 0:s.botToken)??"",botDescription:N(o,["bot_description","description"]),botAvatarUrl:N(o,["bot_avatar_url","profile_photo","avatar_url"]),webhookUrl:v,createdAt:(s==null?void 0:s.createdAt)??new Date().toISOString(),chatsTotal:I===""?null:Number(I),hasWebhook:_==null?v!=="":_===!0||String(_)==="1"||String(_)==="true"}}async function g(){p.value=!0,i.value=!1;try{const o=b(),s=await V.fetchBots();if(!s.success){l.value=o,i.value=!0;return}const _=(Array.isArray(s.payload)?s.payload:[]).map(C=>{const u=N(C,["bot_user_id","user_id","id"]),e=N(C,["bot_code","unique_code"]),f=o.find(T=>u&&T.botUserId===u||e&&T.botCode===e);return h(C,f)}),I=new Map(o.map(C=>[C.botUserId,C]));for(const C of _){const u=I.get(C.botUserId);C.botToken===""&&(u!=null&&u.botToken)?m({...C,botToken:u.botToken}):m(C)}l.value=b()}catch{l.value=b(),i.value=!0}finally{p.value=!1}}return{bots:l,loading:p,stale:i,load:g,saveLocal:m,forget:w,readLocal:b}}),ht={class:"w-full sm:max-w-md rounded-t-3xl sm:rounded-2xl bg-white dark:bg-gray-900 p-5 shadow-2xl max-h-[90vh] overflow-y-auto"},kt={class:"flex items-center gap-2"},wt={class:"mt-4 space-y-3"},_t={class:"block"},$t={class:"block"},Ct={class:"block"},Bt={class:"block"},Tt={key:0,class:"mt-4 rounded-xl bg-red-500/10 px-3 py-2.5"},Ut={class:"text-sm text-gray-700 dark:text-gray-200"},It={key:1,class:"mt-2 max-h-40 overflow-auto rounded-lg bg-black/5 dark:bg-white/5 p-2 text-[10px] leading-relaxed whitespace-pre-wrap break-all"},At={class:"mt-5 flex justify-end gap-2"},St=["disabled"],Nt=L({__name:"BotFormModal",props:{open:{type:Boolean}},emits:["update:open","created"],setup(l,{emit:p}){const i=l,b=p,y=et(),m=d(""),w=d(""),h=d(""),g=d(""),o=d(!1),s=d(""),v=d(""),_=d(!1);z(()=>i.open,u=>{u&&(m.value="",w.value="",h.value="",g.value="",s.value="",v.value="",_.value=!1)});function I(){b("update:open",!1)}async function C(){if(!m.value.trim()){s.value="Give the bot a name.";return}o.value=!0,s.value="";try{const u=await V.createBot({botName:m.value.trim(),botDescription:w.value.trim(),botAvatarUrl:h.value.trim(),webhookUrl:g.value.trim()});if(v.value=JSON.stringify(u.data??{},null,2),!u.success){s.value=u.message||"The bot could not be created. Please try again.";return}const e=Array.isArray(u.payload)?u.payload[0]:u.payload,f=tt(u.payload),T=String((e==null?void 0:e.bot_user_id
1)??(e==null?void 0:e.user_id)??(e==null?void 0:e.id)??"");if(!T||!f){s.value="The bot was created but its key could not be read from the response.";return}const M={botUserId:T,botCode:String((e==null?void 0:e.bot_code)??(e==null?void 0:e.unique_code)??""),botName:String((e==null?void 0:e.bot_name)??m.value.trim()),botToken:f,botDescription:w.value.trim(),botAvatarUrl:h.value.trim(),webhookUrl:g.value.trim(),createdAt:new Date().toISOString(),chatsTotal:0,hasWebhook:g.value.trim()!==""};y.saveLocal(M),b("created",M)}catch(u){v.value=String((u==null?void 0:u.message)??u),s.value="The bot could not be created. Please try again."}finally{o.value=!1}}return(u,e)=>(n(),A(R,{to:"body"},[l.open?(n(),x("div",{key:0,class:"fixed inset-0 z-[10004] flex items-end sm:items-center justify-center bg-black/60",onClick:F(I,["self"])},[t("div",ht,[t("div",kt,[U(k(Z),{class:"w-5 h-5 text-[#026B63]"}),e[5]||(e[5]=t("h3",{class:"text-lg font-bold text-gray-900 dark:text-white"},"Create a bot",-1))]),t("div",wt,[t("label",_t,[e[6]||(e[6]=t("span",{class:"text-xs font-semibold text-gray-500"},"Name",-1)),O(t("input",{"onUpdate:modelValue":e[0]||(e[0]=f=>m.value=f),placeholder:"Order updates",class:"mt-1 w-full rounded-xl bg-gray-100 dark:bg-gray-800 px-3 py-2.5 text-sm text-gray-900 dark:text-white outline-none focus:ring-2 focus:ring-[#026B63]"},null,512),[[W,m.value]])]),t("label",$t,[e[7]||(e[7]=t("span",{class:"text-xs font-semibold text-gray-500"},"Description",-1)),O(t("input",{"onUpdate:modelValue":e[1]||(e[1]=f=>w.value=f),placeholder:"What this bot is for",class:"mt-1 w-full rounded-xl bg-gray-100 dark:bg-gray-800 px-3 py-2.5 text-sm text-gray-900 dark:text-white outline-none focus:ring-2 focus:ring-[#026B63]"},null,512),[[W,w.value]])]),t("label",Ct,[e[8]||(e[8]=t("span",{class:"text-xs font-semibold text-gray-500"},"Avatar URL",-1)),O(t("input",{"onUpdate:modelValue":e[2]||(e[2]=f=>h.value=f),type:"url",placeholder:"https://",class:"mt-1 w-full rounded-xl bg-gray-100 dark:bg-gray-800 px-3 py-2.5 text-sm text-gray-900 dark:text-white outline-none focus:ring-2 focus:ring-[#026B63]"},null,512),[[W,h.value]])]),t("label",Bt,[e[9]||(e[9]=t("span",{class:"text-xs font-semibold text-gray-500"},"Webhook URL",-1)),O(t("input",{"onUpdate:modelValue":e[3]||(e[3]=f=>g.value=f),type:"url",placeholder:"https://",class:"mt-1 w-full rounded-xl bg-gray-100 dark:bg-gray-800 px-3 py-2.5 text-sm text-gray-900 dark:text-white outline-none focus:ring-2 focus:ring-[#026B63]"},null,512),[[W,g.value]]),e[10]||(e[10]=t("span",{class:"mt-1 block text-[11px] text-gray-400"},"Where Nircle sends messages your bot receives",-1))])]),s.value?(n(),x("div",Tt,[t("p",Ut,$(s.value),1),v.value?(n(),x("button",{key:0,class:"mt-1 text-[11px] text-gray-500 underline",onClick:e[4]||(e[4]=f=>_.value=!_.value)},$(_.value?"Hide":"Show")+" the full response ",1)):B("",!0),_.value?(n(),x("pre",It,$(v.value),1)):B("",!0)])):B("",!0),t("div",At,[t("button",{class:"px-4 py-2 rounded-full text-sm text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:I},"Cancel"),t("button",{class:"px-5 py-2 rounded-full bg-[#026B63] text-white text-sm font-semibold disabled:opacity-60",disabled:o.value,onClick:C},$(o.value?"Creatingâ¦":"Create a bot"),9,St)])])])):B("",!0)]))}}),jt={key:0,class:"fixed inset-0 z-[10005] flex items-end sm:items-center justify-center bg-black/70"},Dt={class:"w-full sm:max-w-md rounded-t-3xl sm:rounded-2xl bg-white dark:bg-gray-900 p-5 shadow-2xl max-h-[90vh] overflow-y-auto"},Mt={class:"flex items-center gap-2"},Vt={class:"text-lg font-bold text-gray-900 dark:text-white"},Lt={class:"mt-4 space-y-2 text-sm"},Ot={class:"flex gap-3"},Wt={class:"text-gray-900 dark:text-white font-medium"},Rt={class:"flex gap-3"},zt={class:"text-gray-900 dark:text-white font-mono text-xs break-all"},Ft={key:0,class:"flex gap-3"},qt={class:"text-gray-900 dark:text-white font-mono text-xs break-all"},Et={class:"mt-1 rounded-xl bg-gray-100 dark:bg-gray-800 p-3 font-mono text-xs break-all text-gray-900 dark:text-white select-all"},Kt={class:"mt-2.5 flex items-start gap-2 text-xs leading-relaxed text-gray-500"},Ht={class:"mt-5 flex gap-2"},Jt=L({__name:"BotCredentialsModal",props:{open:{type:Boolean},bot:{},title:{}},emits:["update:open"],setup(l,{emit:p}){const i=l,b=p,y=d(!1);z(()=>i.open,h=>{h&&(y.value=!1)});async function m(){i.bot&&(await navigator.clipboard.writeText(i.bot.botToken),y.value=!0,setTimeout(()=>y.value=!1,3e3))}function w(){b("update:open",!1)}return(h,g)=>(n(),A(R,{to:"body"},[l.open&&l.bot?(n(),x("div",jt,[t("div",Dt,[t("div",Mt,[U(k(xt),{class:"w-5 h-5 text-[#02
16B63]"}),t("h3",Vt,$(l.title),1)]),t("dl",Lt,[t("div",Ot,[g[0]||(g[0]=t("dt",{class:"w-20 shrink-0 text-gray-400 text-xs"},"Name",-1)),t("dd",Wt,$(l.bot.botName),1)]),t("div",Rt,[g[1]||(g[1]=t("dt",{class:"w-20 shrink-0 text-gray-400 text-xs"},"Bot ID",-1)),t("dd",zt,$(l.bot.botUserId),1)]),l.bot.botCode?(n(),x("div",Ft,[g[2]||(g[2]=t("dt",{class:"w-20 shrink-0 text-gray-400 text-xs"},"Bot code",-1)),t("dd",qt,$(l.bot.botCode),1)])):B("",!0)]),g[4]||(g[4]=t("p",{class:"mt-4 text-xs font-semibold text-gray-500"},"Bot key",-1)),t("p",Et,$(l.bot.botToken),1),t("p",Kt,[U(k(K),{class:"w-4 h-4 shrink-0 text-amber-500"}),g[3]||(g[3]=j(" Copy this now. It is shown only once and cannot be retrieved later. ",-1))]),t("div",Ht,[t("button",{class:H(["flex-1 flex items-center justify-center gap-2 rounded-full border px-4 py-2.5 text-sm font-semibold transition-colors",y.value?"border-green-600 text-green-700":"border-[#026B63] text-[#026B63]"]),onClick:m},[y.value?(n(),A(k(J),{key:0,class:"w-4 h-4"})):(n(),A(k(G),{key:1,class:"w-4 h-4"})),j(" "+$(y.value?"Copied":"Copy key"),1)],2),t("button",{class:"flex-1 rounded-full bg-[#026B63] px-4 py-2.5 text-sm font-semibold text-white",onClick:w}," Done ")])])])):B("",!0)]))}}),Gt={class:"w-full sm:max-w-md rounded-t-3xl sm:rounded-2xl bg-white dark:bg-gray-900 p-5 shadow-2xl max-h-[80vh] overflow-y-auto"},Pt={class:"text-base font-bold text-gray-900 dark:text-white"},Yt={key:0,class:"py-10 flex justify-center"},Qt={key:1,class:"mt-3 text-sm leading-relaxed text-gray-500"},Xt={key:2,class:"mt-3 space-y-2"},Zt={class:"min-w-0 flex-1"},te={key:0,class:"text-sm font-semibold text-gray-900 dark:text-white truncate"},ee={class:"font-mono text-xs text-gray-500 break-all"},se=["onClick"],oe=L({__name:"BotChatsModal",props:{open:{type:Boolean},bot:{}},emits:["update:open"],setup(l,{emit:p}){const i=l,b=p,y=d([]),m=d(!1),w=d("");z(()=>i.open,async o=>{var s,v,_;if(!(!o||!i.bot)){m.value=!0,y.value=[];try{const I=await V.getMyChats(),C=Array.isArray(I.payload)?I.payload:[],u=i.bot.botUserId;for(const e of C){const f=e==null?void 0:e.chat_details,T=Array.isArray(f)&&f.length?String(((s=f[0])==null?void 0:s.id)??""):"";if(!T)continue;const M=e==null?void 0:e.participants;if(!Array.isArray(M)||!M.some(S=>[S==null?void 0:S.user_id,S==null?void 0:S.contacts_user_id,S==null?void 0:S.id].some(E=>String(E??"")===u)))continue;const q=Array.isArray(f)&&f.length?String(((v=f[0])==null?void 0:v.chat_title)??((_=f[0])==null?void 0:_.title)??""):"";y.value.push({id:T,title:q})}}finally{m.value=!1}}});async function h(o){await navigator.clipboard.writeText(o),w.value=o,setTimeout(()=>{w.value===o&&(w.value="")},2500)}function g(){b("update:open",!1)}return(o,s)=>(n(),A(R,{to:"body"},[l.open&&l.bot?(n(),x("div",{key:0,class:"fixed inset-0 z-[10004] flex items-end sm:items-center justify-center bg-black/60",onClick:F(g,["self"])},[t("div",Gt,[t("h3",Pt,$(l.bot.botName)+" · Conversations",1),m.value?(n(),x("div",Yt,[...s[0]||(s[0]=[t("span",{class:"w-6 h-6 border-2 border-gray-300 border-t-[#026B63] rounded-full animate-spin"},null,-1)])])):y.value.length===0?(n(),x("p",Qt," None of your conversations list this bot. It may still be in chats this session has not loaded. ")):(n(),x("ul",Xt,[(n(!0),x(Q,null,X(y.value,v=>(n(),x("li",{key:v.id,class:"rounded-xl bg-gray-50 dark:bg-gray-800 p-3 flex items-center gap-2"},[t("div",Zt,[v.title?(n(),x("p",te,$(v.title),1)):B("",!0),t("p",ee,"Chat ID: "+$(v.id),1)]),t("button",{class:"p-1.5 text-gray-400 hover:text-[#026B63]",onClick:_=>h(v.id)},[w.value===v.id?(n(),A(k(J),{key:0,class:"w-4 h-4 text-green-600"})):(n(),A(k(G),{key:1,class:"w-4 h-4"}))],8,se)]))),128))])),t("button",{class:"mt-5 w-full rounded-full bg-[#026B63] px-4 py-2.5 text-sm font-semibold text-white",onClick:g},"Close")])])):B("",!0)]))}}),ae={class:"w-full max-w-sm rounded-2xl bg-white dark:bg-gray-900 p-5 shadow-2xl"},ne={class:"text-base font-bold text-gray-900 dark:text-white"},le={class:"mt-2 text-sm leading-relaxed text-gray-600 dark:text-gray-300"},re={class:"mt-5 flex justify-end gap-2"},ie=L({__name:"ConfirmModal",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},destructive:{type:Boolean}},emits:["update:open","confirm"],setup(l,{emit:p}){const i=p;function b(){i("update:open",!1)}return(y,m)=>(n(),A(R,{to:"body"},[l.open?(n(),x("div",{key:0,class:"fixed inset-0 z-[10004] flex items-center justify-center bg-black/60 p-4",onClick:F(b,["self"])}
1,[t("div",ae,[t("h3",ne,$(l.title),1),t("p",le,$(l.message),1),t("div",re,[t("button",{class:"px-4 py-2 rounded-full text-sm text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:b}," Cancel "),t("button",{class:H(["px-4 py-2 rounded-full text-sm font-semibold",l.destructive?"text-red-600 hover:bg-red-50 dark:hover:bg-red-500/10":"text-[#026B63] hover:bg-[#026B63]/10"]),onClick:m[0]||(m[0]=w=>y.$emit("confirm"))},$(l.confirmLabel),3)])])])):B("",!0)]))}}),de={class:"w-full max-w-md rounded-2xl bg-white dark:bg-gray-900 p-5 shadow-2xl"},ue={class:"mt-5 flex justify-end gap-2"},ce=L({__name:"WebhookModal",props:{open:{type:Boolean},initial:{}},emits:["update:open","save"],setup(l,{emit:p}){const i=l,b=p,y=d(i.initial);z(()=>i.open,w=>{w&&(y.value=i.initial)});function m(){b("update:open",!1)}return(w,h)=>(n(),A(R,{to:"body"},[l.open?(n(),x("div",{key:0,class:"fixed inset-0 z-[10004] flex items-center justify-center bg-black/60 p-4",onClick:F(m,["self"])},[t("div",de,[h[2]||(h[2]=t("h3",{class:"text-base font-bold text-gray-900 dark:text-white"},"Webhook URL",-1)),h[3]||(h[3]=t("p",{class:"mt-1 text-xs text-gray-500"},"Where Nircle sends messages your bot receives",-1)),O(t("input",{"onUpdate:modelValue":h[0]||(h[0]=g=>y.value=g),type:"url",placeholder:"https://",class:"mt-3 w-full rounded-xl bg-gray-100 dark:bg-gray-800 px-3 py-2.5 text-sm text-gray-900 dark:text-white outline-none focus:ring-2 focus:ring-[#026B63]"},null,512),[[W,y.value]]),t("div",ue,[t("button",{class:"px-4 py-2 rounded-full text-sm text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:m},"Cancel"),t("button",{class:"px-5 py-2 rounded-full bg-[#026B63] text-white text-sm font-semibold",onClick:h[1]||(h[1]=g=>w.$emit("save",y.value.trim()))},"Save")])])])):B("",!0)]))}}),xe={class:"min-h-screen bg-white dark:bg-gray-950"},be={class:"sticky top-0 z-10 bg-white/95 dark:bg-gray-950/95 backdrop-blur border-b border-gray-200 dark:border-gray-800"},ye={class:"max-w-2xl mx-auto px-4 py-3 flex items-center gap-3"},ge={class:"max-w-2xl mx-auto px-4 py-4"},fe={key:0,class:"mb-3 rounded-xl bg-amber-500/10 px-3 py-2.5 text-xs text-gray-700 dark:text-gray-300"},pe={key:1,class:"py-16 flex justify-center"},me={key:2,class:"py-20 text-center"},ve={key:3,class:"space-y-3"},he={class:"flex items-center gap-3"},ke={class:"w-10 h-10 rounded-full bg-[#026B63]/15 flex items-center justify-center shrink-0 overflow-hidden"},we=["src"],_e={class:"min-w-0 flex-1"},$e={class:"font-bold text-gray-900 dark:text-white truncate"},Ce={key:0,class:"text-xs text-gray-500 truncate"},Be=["disabled","onClick"],Te={key:1,class:"mt-2 flex items-start gap-1.5 text-[11px] text-gray-500"},Ue={key:2,class:"mt-2 flex items-start gap-1.5 text-[11px] text-gray-500"},Ie={class:"mt-3 space-y-1 text-[11px] font-mono"},Ae={class:"flex gap-2"},Se={class:"text-gray-700 dark:text-gray-300 truncate"},Ne={key:0,class:"flex gap-2 items-center"},je={class:"text-gray-700 dark:text-gray-300 truncate flex-1"},De=["onClick"],Me={class:"mt-3 flex items-center gap-1 border-t border-gray-200 dark:border-gray-800 pt-2"},Ve=["onClick"],Le=["onClick"],Oe=["onClick"],We=["onClick"],He=L({__name:"BotsView",setup(l){const p=ct(),i=et(),b=d(!1),y=d(!1),m=d(null),w=d("Bot created"),h=d(!1),g=d(null),o=d(!1),s=d(""),v=d(""),_=d(!1),I=d(""),C=d(""),u=d(""),e=d(!1);let f=null,T=null;ut(()=>i.load());function M(c){return c.length<=10?"â¢â¢â¢â¢":`${c.slice(0,6)}â¢â¢â¢â¢${c.slice(-4)}`}async function P(c,a){await navigator.clipboard.writeText(c),v.value=a,setTimeout(()=>{v.value===a&&(v.value="")},2500)}function q(){b.value=!0}async function S(c){b.value=!1,m.value=c,w.value="Bot created",y.value=!0,await i.load()}function E(c){g.value=c,h.value=!0}async function st(c){(await V.addNewConversation({conversationTitle:c.botName,contactsUserId:[c.botUserId]})).success&&p.push("/messages")}function ot(c){T=c,s.value=c.webhookUrl,o.value=!0}async function at(c){if(o.value=!1,!(T!=null&&T.botCode))return;(await V.updateBot({botCode:T.botCode,webhookUrl:c})).success&&await i.load()}function nt(c){T=c,I.value=c.botName,C.value="This removes the key from this browser only. The bot keeps running.",u.value="Forget",e.value=!1,f=()=>i.forget(c.botUserId),_.value=!0}function lt(c){T=c,I.value="Rotate this bot's key?",C.value="The current key stops working immediately. Anything using it â servers, scripts, integrations â will fail until you update them with the new key.",u.value="Rotate key",e.value=!0,f=()=>it(c),_.value=!0}function rt(){_.value=!1,f==null||f(),f=null}async function it(c){if(!c.botCode)return;const a=await V.rotateBotKey(c.botCode),r=a.success?tt(a.payload):"";if(!r){i.stale=!0;return}const D={...c,botToken:r};i.saveLocal(D),m.value=D,w.value="New key issued",y.value=!0,await i.load()}return(c,a)=>(n(),x("div",xe,[t("div",be,[t("div",ye,[t("button",{class:"p-2 -ml-2 roun
1ded-full hover:bg-gray-100 dark:hover:bg-gray-800",onClick:a[0]||(a[0]=r=>k(p).back())},[U(k(pt),{class:"w-5 h-5 text-gray-700 dark:text-gray-300"})]),a[7]||(a[7]=t("h1",{class:"text-lg font-bold text-gray-900 dark:text-white flex-1"},"Bots",-1)),t("button",{class:"flex items-center gap-2 px-4 py-2 rounded-full bg-[#026B63] text-white text-sm font-semibold hover:bg-[#025850] transition-colors",onClick:q},[U(k(mt),{class:"w-4 h-4"}),a[6]||(a[6]=j(" Create a bot ",-1))])])]),t("div",ge,[k(i).stale?(n(),x("div",fe," Could not refresh your bots. Showing what is saved in this browser. ")):B("",!0),k(i).loading?(n(),x("div",pe,[...a[8]||(a[8]=[t("span",{class:"w-7 h-7 border-2 border-gray-300 border-t-[#026B63] rounded-full animate-spin"},null,-1)])])):k(i).bots.length===0?(n(),x("div",me,[...a[9]||(a[9]=[t("p",{class:"text-sm text-gray-500 dark:text-gray-400"},"You have not created a bot yet.",-1)])])):(n(),x("div",ve,[(n(!0),x(Q,null,X(k(i).bots,r=>(n(),x("div",{key:r.botUserId,class:"rounded-2xl bg-gray-50 dark:bg-gray-900 p-4"},[t("div",he,[t("span",ke,[r.botAvatarUrl?(n(),x("img",{key:0,src:r.botAvatarUrl,class:"w-full h-full object-cover",alt:""},null,8,we)):(n(),A(k(Z),{key:1,class:"w-5 h-5 text-[#026B63]"}))]),t("div",_e,[t("p",$e,$(r.botName),1),r.botDescription?(n(),x("p",Ce,$(r.botDescription),1)):B("",!0)])]),r.chatsTotal!==null?(n(),x("button",{key:0,class:H(["mt-3 flex items-center gap-1.5 text-xs font-semibold",r.chatsTotal===0?"text-amber-600":"text-[#026B63] hover:underline"]),disabled:r.chatsTotal===0,onClick:D=>E(r)},[U(k(bt),{class:"w-3.5 h-3.5"}),j(" "+$(r.chatsTotal===0?"Not in any chat yet â nobody has started it":`In ${r.chatsTotal} chats`)+" ",1),r.chatsTotal>0?(n(),A(k(yt),{key:0,class:"w-3 h-3"})):B("",!0)],10,Be)):B("",!0),r.hasWebhook===!1?(n(),x("p",Te,[U(k(K),{class:"w-3.5 h-3.5 shrink-0 text-amber-500"}),a[10]||(a[10]=j(" No webhook set, so this bot cannot receive anything ",-1))])):B("",!0),r.botToken?B("",!0):(n(),x("p",Ue,[U(k(K),{class:"w-3.5 h-3.5 shrink-0 text-amber-500"}),a[11]||(a[11]=j(" The key for this bot is not in this browser and cannot be recovered. ",-1))])),t("dl",Ie,[t("div",Ae,[a[12]||(a[12]=t("dt",{class:"text-gray-400 shrink-0"},"Bot ID",-1)),t("dd",Se,$(r.botUserId),1)]),r.botToken?(n(),x("div",Ne,[a[13]||(a[13]=t("dt",{class:"text-gray-400 shrink-0"},"Key",-1)),t("dd",je,$(M(r.botToken)),1),t("button",{class:"p-1 text-gray-400 hover:text-[#026B63]",onClick:D=>P(r.botToken,r.botUserId)},[v.value===r.botUserId?(n(),A(k(J),{key:0,class:"w-3.5 h-3.5 text-green-600"})):(n(),A(k(G),{key:1,class:"w-3.5 h-3.5"}))],8,De)])):B("",!0)]),t("div",Me,[t("button",{class:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs text-[#026B63] hover:bg-[#026B63]/10",onClick:D=>st(r)},[U(k(vt),{class:"w-3.5 h-3.5"}),a[14]||(a[14]=j(" Message ",-1))],8,Ve),t("button",{class:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:D=>ot(r)},[U(k(gt),{class:"w-3.5 h-3.5"}),a[15]||(a[15]=j(" Webhook ",-1))],8,Le),t("button",{class:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:D=>lt(r)},[U(k(ft),{class:"w-3.5 h-3.5"}),a[16]||(a[16]=j(" Rotate key ",-1))],8,Oe),t("button",{class:"ml-auto px-2 py-1.5 rounded-lg text-xs text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",onClick:D=>nt(r)}," Forget ",8,We)])]))),128))]))]),U(Nt,{open:b.value,"onUpdate:open":a[1]||(a[1]=r=>b.value=r),onCreated:S},null,8,["open"]),U(Jt,{open:y.value,"onUpdate:open":a[2]||(a[2]=r=>y.value=r),bot:m.value,title:w.value},null,8,["open","bot","title"]),U(ie,{open:_.value,"onUpdate:open":a[3]||(a[3]=r=>_.value=r),title:I.value,message:C.value,"confirm-label":u.value,destructive:e.value,onConfirm:rt},null,8,["open","title","message","confirm-label","destructive"]),U(ce,{open:o.value,"onUpdate:open":a[4]||(a[4]=r=>o.value=r),initial:s.value,onSave:at},null,8,["open","initial"]),U(oe,{open:h.value,"onUpdate:open":a[5]||(a[5]=r=>h.value=r),bot:g.value},null,8,["open","bot"])]))}});
1export{He as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.