PageSourceSearch

https://app.lobsterland.ing/assets/MessagingTab.08ad7f7f.js

js lobsterland.ing collected 2026-10-09 21:46:52 UTC 48,614 bytes, 1 lines download raw bytes

1import{d as ct,c as o,a as t,t as i,I as W,J as ye,g as _,v as D,f as r,a6 as Xe,h as u,z as h,y as x,i as g,r as n,p as a,s as $,D as It,o as Wt,n as et,e as rt,ac as Ne,am as Ut,A as f,aj as H,ak as J,ar as V,k as Et,u as Ft,ah as Lt}from"./index.b2e088d7.js";import{u as zt}from"./useToast.042a6fce.js";import{a as Rt}from"./useConfirm.9b89cac8.js";import{L as w}from"./loader-circle.0aae17ab.js";import{T as ut}from"./trash-2.ebae2b95.js";import{T as Bt}from"./triangle-alert.c1fc9ad6.js";import{C as Vt}from"./chevron-down.cfbc0dd8.js";import{E as jt}from"./external-link.2edb854e.js";import{C as Oe}from"./copy.ca32cfbe.js";const qt={class:"flex flex-col gap-4"},Pt={class:"card"},Mt={class:"flex items-center justify-between mb-3"},Gt={class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},Nt={class:"text-sm text-[var(--text-2)]"},Ot={key:0,class:"flex flex-col gap-1 mb-4"},Qt={class:"min-w-0"},Xt={class:"text-sm text-[var(--text-0)] truncate"},Ht={class:"text-xs text-[var(--text-3)]"},Jt={key:0,class:"ml-1 text-[var(--text-3)]"},Kt=["disabled","onClick"],Yt={key:1,class:"text-sm text-[var(--text-3)] mb-4"},Zt={class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},es={class:"flex flex-col gap-2"},ts={class:"grid gap-2 sm:grid-cols-2"},ss=["disabled","placeholder"],as=["disabled"],ls={key:0,class:"text-xs text-[var(--text-3)]"},ns={key:1,class:"text-xs text-[var(--text-3)]"},os={class:"flex items-center gap-2 text-sm text-[var(--text-2)] cursor-pointer"},is=["disabled"],rs={class:"flex items-center gap-2"},us=["disabled"],ds={key:0,class:"text-xs text-danger-500"},cs={class:"card"},ps={class:"flex items-center justify-between mb-3"},vs={class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},ms={class:"text-sm text-[var(--text-2)]"},xs={key:0,class:"flex flex-col gap-1 mb-4"},fs={class:"min-w-0"},bs={class:"text-sm text-[var(--text-0)] truncate"},gs={class:"text-xs text-[var(--text-3)]"},ys={key:0,class:"ml-1"},ks=["disabled","onClick"],hs={key:1,class:"text-sm text-[var(--text-3)] mb-4"},ws={class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},_s={class:"flex flex-col gap-2"},As={class:"grid gap-2 sm:grid-cols-2"},Cs=["disabled","placeholder"],Ss=["disabled"],Ts={key:0,class:"text-xs text-[var(--text-3)]"},$s={key:1,class:"text-xs text-[var(--text-3)]"},Ds=["disabled"],Is={class:"flex items-center gap-2 text-sm text-[var(--text-2)] cursor-pointer"},Ws=["disabled"],Us={class:"flex items-center gap-2"},Es=["disabled"],Fs={key:0,class:"text-xs text-danger-500"},Ls={key:0,class:"text-xs text-danger-500"},Qe=ct({__name:"AllowlistManager",props:{platform:{},entries:{},disabled:{type:Boolean}},emits:["add","delete"],setup(tt,{emit:He}){const{confirm:Ce}=Rt(),c=tt,A=He,Se=g(()=>(c.platform==="telegram","User")),m=g(()=>c.platform==="telegram"?"Group":c.platform==="slack"?"Channel":"Group"),ke=g(()=>c.platform==="telegram"?"Telegram user ID (numeric)":c.platform==="slack"?"Slack user ID (U0XXXXXXX)":"WhatsApp number (+15551234567)"),Je=g(()=>c.platform==="telegram"?"Telegram group ID (-100...)":c.platform==="slack"?"Slack channel ID (C0XXXXXXX)":"WhatsApp group JID ([email protected])"),d=g(()=>c.platform==="telegram"?"Need your Telegram user ID? Message @openclaw_setup_helper_bot and it will reply with your ID.":null),Te=g(()=>c.platform==="telegram"?"Need a Telegram group ID? Add @openclaw_setup_helper_bot to the group and the bot will send the group ID.":null),le=g(()=>c.platform==="whatsapp"?"Use E.164 format for direct-message senders, for example +15551234567.":null),he=g(()=>c.platform==="whatsapp"?"Use the WhatsApp group JID exactly as reported by the runtime, for example [email protected].":null),K=g(()=>c.entries.filter(b=>b.entry_type==="user")),ne=g(()=>c.entries.filter(b=>b.entry_type==="group")),y=g(()=>c.disabled??!1),j=n(""),U=n(""),Y=n(!1),q=n(null),oe=n(!1),ie=n(""),k=n(""),T=n(""),E=n(!0),F=n(null),re=n(!1),P=n(null);function ue(b){return!b||b.length===0?"all members":b.length<=2?b.join(", "):`${b.slice(0,2).join(", ")} +${b.length-2}`}async function Z(){if(y.value)return;q.value=null;const b=j.value.trim();if(!b){q.value="ID is required.";return}if(c.platform==="telegram"&&!/^\d+$/.test(b)){q.value="User ID must be numeric.";return}
1if(c.platform==="whatsapp"&&!/^\+[1-9]\d{7,14}$/.test(b)){q.value="WhatsApp numbers must be in E.164 format.";return}oe.value=!0;try{A("add",{platform:c.platform,entry_type:"user",platform_id:b,display_name:U.value.trim()||null,require_mention:Y.value}),j.value="",U.value="",Y.value=!1}finally{oe.value=!1}}async function z(){if(y.value)return;F.value=null;const b=ie.value.trim();if(!b){F.value="ID is required.";return}re.value=!0;try{const v=T.value.split(",").map(p=>p.trim()).filter(p=>p.length>0);A("add",{platform:c.platform,entry_type:"group",platform_id:b,display_name:k.value.trim()||null,group_allowed_members:v.length?v:null,require_mention:E.value}),ie.value="",k.value="",T.value="",E.value=!0}finally{re.value=!1}}async function ee(b){y.value||!await Ce({title:"Remove from allowlist",message:"This removes the entry. They lose access to the agent until you add them again.",confirmText:"Remove",danger:!0})||(P.value=null,A("delete",b))}return(b,v)=>(a(),o("div",qt,[t("div",Pt,[t("div",Mt,[t("div",null,[t("p",Gt,i(Se.value)+" allowlist",1),t("p",Nt,i(K.value.length)+" approved user"+i(K.value.length===1?"":"s"),1)])]),K.value.length>0?(a(),o("div",Ot,[(a(!0),o(W,null,ye(K.value,p=>(a(),o("div",{key:p.id,class:"flex items-center justify-between gap-3 px-3 py-2 rounded-md bg-paper-1"},[t("div",Qt,[t("p",Xt,i(p.platform_id),1),t("p",Ht,[u(i(p.display_name||"No name")+" ",1),p.require_mention?(a(),o("span",Jt,"· mention required")):r("",!0)])]),t("button",{class:"btn-ghost btn-sm text-danger-500 disabled:cursor-not-allowed disabled:opacity-50",disabled:y.value,onClick:M=>ee(p.id)},[$(x(ut),{size:14})],8,Kt)]))),128))])):(a(),o("p",Yt,"No users added yet.")),v[9]||(v[9]=t("div",{class:"divider"},null,-1)),t("p",Zt,"Add a "+i(Se.value.toLowerCase()),1),t("div",es,[t("div",ts,[_(t("input",{"onUpdate:modelValue":v[0]||(v[0]=p=>j.value=p),class:"input",disabled:y.value,placeholder:ke.value},null,8,ss),[[D,j.value]]),_(t("input",{"onUpdate:modelValue":v[1]||(v[1]=p=>U.value=p),class:"input",disabled:y.value,placeholder:"Display name (optional)"},null,8,as),[[D,U.value]])]),d.value?(a(),o("p",ls,i(d.value),1)):r("",!0),le.value?(a(),o("p",ns,i(le.value),1)):r("",!0),t("label",os,[_(t("input",{type:"checkbox","onUpdate:modelValue":v[2]||(v[2]=p=>Y.value=p),class:"rounded",disabled:y.value},null,8,is),[[Xe,Y.value]]),v[7]||(v[7]=u(" Require @mention ",-1))]),t("div",rs,[t("button",{class:"btn-secondary btn-sm",disabled:y.value||oe.value,onClick:Z},[oe.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),v[8]||(v[8]=u(" Add user ",-1))],8,us),q.value?(a(),o("span",ds,i(q.value),1)):r("",!0)])])]),t("div",cs,[t("div",ps,[t("div",null,[t("p",vs,i(m.value)+" allowlist",1),t("p",ms,i(ne.value.length)+" approved "+i(m.value.toLowerCase())+i(ne.value.length===1?"":"s"),1)])]),ne.value.length>0?(a(),o("div",xs,[(a(!0),o(W,null,ye(ne.value,p=>(a(),o("div",{key:p.id,class:"flex items-center justify-between gap-3 px-3 py-2 rounded-md bg-paper-1"},[t("div",fs,[t("p",bs,i(p.platform_id),1),t("p",gs,[u(i(p.display_name||"No name")+" · "+i(ue(p.group_allowed_members))+" ",1),p.require_mention?(a(),o("span",ys,"· mention required")):r("",!0)])]),t("button",{class:"btn-ghost btn-sm text-danger-500 disabled:cursor-not-allowed disabled:opacity-50",disabled:y.value,onClick:M=>ee(p.id)},[$(x(ut),{size:14})],8,ks)]))),128))])):(a(),o("p",hs,"No "+i(m.value.toLowerCase())+"s added yet.",1)),v[11]||(v[11]=t("div",{class:"divider"},null,-1)),t("p",ws,"Add a "+i(m.value.toLowerCase()),1),t("div",_s,[t("div",As,[_(t("input",{"onUpdate:modelValue":v[3]||(v[3]=p=>ie.value=p),class:"input",disabled:y.value,placeholder:Je.value},null,8,Cs),[[D,ie.value]]),_(t("input",{"onUpdate:modelValue":v[4]||(v[4]=p=>k.value=p),class:"input",disabled:y.value,placeholder:"Display name (optional)"},null,8,Ss),[[D,k.value]])]),Te.value?(a(),o("p",Ts,i(Te.value),1)):r("",!0),he.value?(a(),o("p",$s,i(he.value),1)):r("",!0),_(t("input",{"onUpdate:modelValue":v[5]||(v[5]=p=>T.value=p),class:"input",disabled:y.value,placeholder:"Allowed member IDs (comma-separated, optional)"},null,8,Ds),[[D,T.value]]),t("label",Is,[_(t("input",{type:"checkbox","onUpdate:modelValue":v[6]||(v[6]=p=>E.value=p),class:"rounded",disabled:y.value},null,8,Ws),[[Xe,E.value]]),v[10]||(v[10]=u(" Require @mention ",-1))]),t("div",Us,[t("button",{class:"btn-secondary btn-sm",disabled:y.value||re.value,onClick:z},[re.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),u(" Add "+i(m.value.toLowerCase()),1)],8,Es),F.value?(a(),o("span",Fs,i(F.value),1)):r("",!0)])])]),P.value?(a(),o("p",Ls,i(P.value),1)):r("",!0)]))}}),zs={class:"mb-6"},Rs={class:"section-subtitle"},Bs={key:0,class:"mb-4 rounded-2xl border border-amber-300/50 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-400/30 dark:bg-amber-500/10 dark:text-amber-100"},Vs={class:"flex gap-1 mb-4"},js=["onClick"],qs={key:1,class:"flex items-center justify-center py-16"},Ps={key:2},Ms={key:0,class:"card"},Gs={class:"text-sm text-danger-500"},Ns={key:1,class:"card"},Os={class:"flex flex-col gap-2 max-w-md"},Qs=["disabled"],Xs={class:"flex items-center gap-2"},Hs=["disabled"],Js={key:0,class:"text-xs text-danger-500"},Ks={key:0,class:"card mb-4 border-[var(--warn-20)] bg-[var(--warn-10)]",role:"alert"},Ys={class:"flex items-start gap-2"},Zs={class:"min-w-0"},ea={class:"text-xs text-[var(--text-2)] mt-1"},ta={class:"card mb-4"},sa={class:"flex items-center justify-between flex-wrap gap-3"},aa={class:"text-sm text-[var(--text-0)] mt-0.5"},la={class:"text-xs text-[var(--text-2)]"},na={class:"text-xs text-[var(--text-2)] mt-1"},oa={class:"flex items-center gap-2"},ia=["disabled"],ra=["disabled"],ua=["disabled"],da={key:0,class:"mt-3 flex flex-col gap-2 max-w-md"},ca=["disabled"],pa={class:"flex items-center gap-2"},va=["disabled"],ma={key:0,class:"text-xs text-danger-500"},xa={key:1,class:"card"},fa={key:3,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},ba={class:"card max-w-md w-full"},ga={class:"flex items-center justify-end gap-2"},ya=["disabled"],ka={key:4},ha={key:0,class:"card"},wa={class:"text-sm text-danger-500"},_a={key:1,class:"card"},Aa={key:0,class:"text-sm text-[var(--text-2)] space-y-3 mb-4"},Ca={class:"flex gap-2"},Sa={class:"mt-1 flex flex-wrap gap-1"},Ta=["title","aria-label","onClick"],$a={class:"mt-2"},Da={class:"mt-1 flex flex-wrap gap-1"},Ia=["title","aria-label","onClick"],Wa={class:"flex gap-2"},Ua={class:"flex gap-2"},Ea={class:"mt-1 flex flex-wrap gap-1"},Fa=["title","aria-label","onClick"],La={class:"flex flex-col gap-2 max-w-md"},za=["disabled"],Ra=["disabled"],Ba={class:"flex items-center gap-2"},Va=["disabled"],ja={key:0,class:"text-xs text-danger-500"},qa={class:"card mb-4"},Pa={class:"flex items-center justify-between flex-wrap gap-3"},Ma={class:"text-sm text-[var(--text-0)] mt-0.5"},Ga={class:"text-xs text-[var(--text-2)]"},Na={class:"text-xs text-[var(--text-2)] mt-1"},Oa={class:"flex items-center gap-2"},Qa=["disabled"],Xa=["disabled"],Ha=["disabled"],Ja={key:0,class:"mt-3 flex flex-col gap-2 max-w-md"},Ka=["disabled"],Ya=["disabled"],Za={class:"flex items-center gap-2"},el=["disabled"],tl={key:0,class:"text-xs text-danger-500"},sl={key:0,class:"card"},al={key:5,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},ll={class:"card max-w-md w-full"},nl={class:"flex items-center justify-end gap-2"},ol=["disabled"],il={key:6},rl={key:0,class:"card"},ul={class:"text-sm text-danger-500"},dl={key:1,class:"grid gap-4"},cl={class:"card"},pl={class:"grid gap-2 max-w-xl"},vl=["disabled"],ml=["disabled"],xl=["disabled"],fl={class:"flex items-center gap-2 text-sm text-[var(--text-2)]"},bl=["disabled"],gl={key:0,class:"text-sm text-warn-500"},yl={class:"flex items-center gap-2"},kl=["disabled"],hl={key:0,class:"text-xs text-danger-500"},wl={class:"card mb-4"},_l={class:"flex items-center justify-between flex-wrap gap-3"},Al={class:"text-sm text-[var(--text-0)] mt-0.5"},Cl=["disabled"],Sl={key:1,class:"text-xs text-[var(--text-2)]"},Tl={key:2,class:"text-xs text-[var(--text-2)]"},$l={class:"flex items-center gap-2"},Dl=["disabled"],Il=["disabled"],Wl=["disabled"],Ul={key:0,class:"text-xs text-[var(--text-2)] mt-3"},El={key:1,class:"text-xs text-danger-500 mt-3"},Fl={key:0,class:"card mb-4"},Ll={class:"grid gap-4 md:grid-cols-[minmax(0,240px)_minmax(0,1fr)] md:items-start"},zl=["src"],Rl={class:"rounded-xl border border-[var(--border-1)] bg-[var(--surface-2)]/60 p-4"},Bl={class:"text-sm text-[var(--text-2)] mt-3"},Vl=["disabled"],jl={class:"mt-3 flex items-center gap-2"},ql=["disabled"],Pl={class:"card mb-4"},Ml={class:"grid gap-2 max-w-xl"},Gl=["disabled"],Nl=["disabled"],Ol=["disabled"],Ql={class:"flex items-center gap-2 text-sm text-[var(--text-2)]"},Xl=["disabled"],Hl={key:0,class:"text-sm text-warn-500"},Jl={class:"flex items-center gap-2"},Kl=["disabled"],Yl={key:0,class:"text-xs text-danger-500"},Zl={key:7,class:"grid gap-4"},en={class:"card"},tn={class:"flex items-start justify-between gap-3 mb-3"},sn={href:"https://docs.openclaw.ai/platforms/android",target:"_blank",rel:"noopener",class:"text-xs text-brand hover:underline inline-flex items-center gap-1"},an={class:"mt-4"},ln=["disabled"],nn={key:0,class:"card"},on={class:"space-y-4"},rn={class:"space-y-2"},un={class:"flex items-center gap-2"},dn=["value"],cn={class:"flex items-center gap-2"},pn=["value"],vn={class:"flex items-center gap-2"},mn={class:"text-sm text-[var(--text-1)]"},xn={class:"flex items-center gap-2"},fn=["value"],bn={class:"mt-4 pt-3 border-t border-[var(--border-1)] space-y-3"},gn={class:"text-xs text-[var(--text-2)]"},yn={class:"mt-2 flex gap-2 flex-wrap"},kn={key:8,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},hn={class:"card max-w-md w-full"},wn={class:"flex items-center justify-end gap-2"},_n=["disabled"],dt="connections:write",En=ct({__name:"MessagingTab",setup(tt){const He=Et(),Ce=Ft(),{success:c,error:A,warning:Se}=zt(),m=g(()=>He.params.id),ke=g(()=>Ce.getters["instances/status"]),Je=g(()=>ke.value?.status==="running"&&ke.value?.pod_ready),d=g(()=>!Je.value),Te=g(()=>!!ke.value&&d.value),le=g(()=>Ce.getters["instances/current"]),he=g(()=>le.value?.runtime_type==="hermes"),K=g(()=>
1!!le.value&&Lt(le.value??void 0,"mobileApp")),ne=g(()=>K.value?"Connect Telegram, Slack, WhatsApp, or the OpenClaw mobile app.":he.value?"Connect Telegram or Slack.":"Connect Telegram, Slack, or WhatsApp."),y=n("telegram"),j=n(!0),U=n(!1),Y=g(()=>{const s=[{id:"telegram",label:"Telegram"},{id:"slack",label:"Slack"}];return he.value||s.push({id:"whatsapp",label:"WhatsApp"}),K.value&&s.push({id:"mobile-app",label:"Mobile app"}),s});It(Y,s=>{s.some(e=>e.id===y.value)||(y.value="telegram")});const q=["app_mentions:read","chat:write","channels:history","channels:read","groups:history","groups:read","im:history","im:read","mpim:history"],oe=["emoji:read","files:read","files:write","reactions:read","reactions:write"],ie=["app_mention","message.im","message.channels","message.groups"],k=n(null),T=n([]),E=n(!1),F=n(null),re=g(()=>k.value?.health_status==="conflict"),P=n(""),ue=n(!1),Z=n(null),z=n(!1),ee=n(""),b=n(!1),v=n(null),p=n(!1),M=n(!1),$e=n(!1),C=n(null),G=n([]),we=n(!1),_e=n(null),De=n(""),Ie=n(""),We=n(!1),N=n(null),te=n(!1),Ue=n(""),Ee=n(""),Fe=n(!1),de=n(null),Le=n(!1),ce=n(!1),ze=n(!1),S=n(null),I=n([]),pe=n(!1),ve=n(null),me=n(!1),O=n(null),xe=n(""),fe=n("personal"),Q=n("pairing"),be=n(!0),X=n(!1),R=n(!1),B=n(null),se=n(null),ae=n(null),Re=n(!1),Be=n(!1),Ae=n(!1),Ve=n(!1),st=g(()=>Ae.value),je=g(()=>Q.value==="allowlist"),qe=g(()=>je.value&&I.value.length===0),pt=g(()=>"Use the button in step 2 right after the QR is scanned."),Pe=n(!1),L=n(null);async function Me(s,e){try{await navigator.clipboard.writeText(s),c(e)}catch{A("Failed to copy to clipboard.")}}async function vt(){Pe.value=!0;try{L.value=await Ut.createMobileAppConnection(m.value),c("Mobile app connection ready")}catch(s){A(s instanceof f?s.message:"Failed to generate mobile app connection.")}finally{Pe.value=!1}}async function at(){F.value=null;try{const[s,e]=await Promise.all([H.getConfig(m.value),H.getAllowlist(m.value)]);k.value=s,T.value=Array.isArray(e)?e:[],E.value=!1}catch(s){if(s instanceof f&&s.statusCode===404){E.value=!0,k.value=null,T.value=[];return}E.value=!1,k.value=null,T.value=[],F.value=s instanceof f?s.message:"Failed to load Telegram configuration."}}async function mt(){Z.value=null;const s=P.value.trim();if(!s){Z.value="Token is required.";return}ue.value=!0;try{k.value=await H.updateBotToken(m.value,{bot_token:s}),E.value=!1,F.value=null,P.value="",c("Telegram connected")}catch(e){Z.value=e instanceof f?e.message:"Failed to connect."}finally{ue.value=!1}}async function xt(){v.value=null;const s=ee.value.trim();if(!s){v.value="Token is required.";return}b.value=!0;try{k.value=await H.updateBotToken(m.value,{bot_token:s}),z.value=!1,ee.value="",c("Token updated")}catch(e){v.value=e instanceof f?e.message:"Failed to update."}finally{b.value=!1}}async function ft(s){try{const e=await H.addAllowlistEntry(m.value,s);T.value=[...T.value,e],c("Entry added")}catch(e){A(e instanceof f?e.message:"Failed to add entry.")}}async function bt(s){try{await H.deleteAllowlistEntry(m.value,s),T.value=T.value.filter(e=>e.id!==s),c("Entry removed")}catch(e){A(e instanceof f?e.message:"Failed to remove entry.")}}async function gt(){if(k.value){p.value=!0;try{k.value=await H.updateAccess(m.value,{allow_anyone:!k.value.allow_anyone}),c(k.value.allow_anyone?"Allow anyone enabled":"Allow anyone disabled")}catch(s){A(s instanceof f?s.message:"Failed to update Telegram access.")}finally{p.value=!1}}}async function yt(){$e.value=!1,M.value=!0;try{await H.deleteConfig(m.value),z.value=!1,await at(),c("Telegram disconnected")}catch(s){A(s instanceof f?s.message:"Failed to disconnect Telegram.")}finally{M.value=!1}}async function lt(){_e.value=null;try{const[s,e]=await Promise.all([J.getConfig(m.value),J.getAllowlist(m.value)]);C.value=s,G.value=Array.isArray(e)?e:[],we.value=!1}catch(s){if(s instanceof f&&s.statusCode===404){we.value=!0,C.value=null,G.value=[];return}we.value=!1,C.value=null,G.value=[],_e.value=s instanceof f?s.message:"Failed to load Slack configuration."}}async function kt(){N.value=null;const s=De.value.trim(),e=Ie.value.trim();if(!s){N.value="Bot token is required.";return}if(!e){N.value="App token is required.";return}if(!s.startsWith("xoxb-")){N.value="Bot token must start with xoxb-";return}if(!e.startsWith("xapp-")){N.value="App token must start with xapp-";return}We.value=!0;try{C.value=await J.updateTokens(m.value,{bot_token:s,app_token:e}),we.value=!1,_e.value=null,De.value="",Ie.value="",c("Slack connected")}catch(l){N.value=l instanceof f?l.message:"Failed to connect."}finally{We.value=!1}}async function Ge(s){try{await navigator.clipboard.writeText(s),c(`${s} copied`)}catch{A("Failed to copy to clipboard.")}}async function ht(){de.value=null;const s=Ue.value.trim(),e=Ee.value.trim();if(!s){de.value="Bot token is required.";return}if(!e){de.value="App token is required.";return}Fe.value=!0;try{C.value=await J.updateTokens(m.value,{bot_token:s,app_token:e}),te.value=!1,Ue.value="",Ee.value="",c("Tokens updated")}catch(l){de.value=l instanceof f?l.message:"Failed to update."}finally{Fe.value=!1}}async function wt(s){try{const e=await J.addAllowlistEntry(m.value,s);G.value=[...G.value,e],c("Entry added")}catch(e){A(e instanceof f?e.message:"Failed to add entry.")}}async function _t(s){try{await J.deleteAllowlistEntry(m.value,s),G.value=G.value.filter(e=>e.id!==s),c("Entry removed")}catch(e){A(e instanceof f?e.message:"Failed to remove entry.")}}
1async function At(){if(C.value){Le.value=!0;try{C.value=await J.updateAccess(m.value,{allow_anyone:!C.value.allow_anyone}),c(C.value.allow_anyone?"Allow anyone enabled":"Allow anyone disabled")}catch(s){A(s instanceof f?s.message:"Failed to update Slack access.")}finally{Le.value=!1}}}async function Ct(){ze.value=!1,ce.value=!0;try{await J.deleteConfig(m.value),te.value=!1,await lt(),c("Slack disconnected")}catch(s){A(s instanceof f?s.message:"Failed to disconnect Slack.")}finally{ce.value=!1}}function Ke(s){xe.value=s?.owner_e164??"",fe.value=s?.phone_mode??"personal",Q.value=s?.dm_policy??"allowlist",be.value=s?.self_chat_mode??!0}async function ge(){ve.value=null;const[s,e]=await Promise.allSettled([V.getConfig(m.value),V.getAllowlist(m.value)]);if(e.status==="fulfilled")I.value=Array.isArray(e.value)?e.value:[];else if(e.reason instanceof f&&e.reason.statusCode===404)I.value=[];else{S.value=null,I.value=[],pe.value=!1,ve.value=e.reason instanceof f?e.reason.message:"Failed to load WhatsApp configuration.";return}if(s.status==="fulfilled"){S.value=s.value,pe.value=!1,Ke(s.value);return}if(s.reason instanceof f&&s.reason.statusCode===404){S.value=null,pe.value=!0,Ke(null);return}S.value=null,I.value=[],pe.value=!1,ve.value=s.reason instanceof f?s.reason.message:"Failed to load WhatsApp configuration."}async function nt(){if(O.value=null,je.value&&I.value.length===0){O.value="Add at least one allowlist entry before saving WhatsApp settings.";return}me.value=!0;try{S.value=await V.updateConfig(m.value,{owner_e164:xe.value.trim()||null,phone_mode:fe.value,dm_policy:Q.value,allow_anyone:Q.value==="open",self_chat_mode:be.value}),pe.value=!1,ve.value=null,Ke(S.value),c("WhatsApp configuration saved")}catch(s){O.value=s instanceof f?s.message:"Failed to save WhatsApp settings."}finally{me.value=!1}}async function St(){R.value=!0;try{const s=await V.waitForLogin(m.value,{timeout_ms:12e4});se.value=s.message??null,Re.value=!!s.restart_required,s.connected?(await ge(),B.value=null,c("WhatsApp linked"),se.value=null,Re.value=!1):s.restart_required?(B.value=null,await ge(),s.message&&c(s.message)):ae.value=null}catch(s){ae.value=s instanceof f?s.message:"Failed to wait for WhatsApp login."}finally{R.value=!1}}async function Ye(s){se.value=null,ae.value=null,Re.value=!1,X.value=!0;try{const e=await V.startLogin(m.value,{force:s,timeout_ms:3e4});if(B.value=e.qr_data_url??null,se.value=e.message??null,e.already_linked){Se("WhatsApp is already linked. Log out the current session first if you want to relink it."),await ge();return}B.value&&(se.value="Scan the QR in WhatsApp, then continue with step 2 below.")}catch(e){ae.value=e instanceof f?e.message:"Failed to start WhatsApp login."}finally{X.value=!1}}async function Tt(){ae.value=null,Re.value=!1,!(!B.value||R.value)&&await St()}async function $t(){Be.value=!0;try{await V.logout(m.value),B.value=null,await ge(),c("WhatsApp session cleared")}catch(s){A(s instanceof f?s.message:"Failed to clear WhatsApp session.")}finally{Be.value=!1}}async function ot(s){try{const e=await V.addAllowlistEntry(m.value,s);I.value=[...I.value,e],je.value&&(O.value=null),c("Entry added")}catch(e){A(e instanceof f?e.message:"Failed to add entry.")}}async function it(s){try{await V.deleteAllowlistEntry(m.value,s),I.value=I.value.filter(e=>e.id!==s),c("Entry removed")}catch(e){A(e instanceof f?e.message:"Failed to remove entry.")}}async function Dt(){Ve.value=!1,Ae.value=!0;try{await V.deleteConfig(m.value),B.value=null,await ge(),c("WhatsApp disconnected")}catch(s){A(s instanceof f?s.message:"Failed to disconnect WhatsApp.")}finally{Ae.value=!1}}return Wt(async()=>{j.value=!0,await Promise.all([at(),lt(),ge()]),j.value=!1}),(s,e)=>(a(),o("div",null,[t("div",zs,[e[31]||(e[31]=t("h1",{class:"section-title"},"Channels",-1)),t("p",Rs,i(ne.value),1)]),Te.value?(a(),o("div",Bs," Start the instance to connect messaging platforms, change channel settings, or edit allowlists. ")):r("",!0),t("div",Vs,[(a(!0),o(W,null,ye(Y.value,l=>(a(),o("button",{key:l.id,onClick:Ze=>y.value=l.id,class:et(["px-3 py-1.5 rounded-full text-xs font-medium transition-colors",y.value===l.id?"bg-[var(--brand-10)] text-brand":"text-[var(--text-2)] hover:bg-[var(--surface-1)]"])},i(l.label),11,js))),128))]),j.value?(a(),o("div",qs,[$(x(w),{size:24,class:"animate-spin text-[var(--text-3)]"})])):y.value==="telegram"?(a(),o("div",Ps,[F.value?(a(),o("div",Ms,[t("p",Gs,i(F.value),1)])):E.value?(a(),o("div",Ns,[e[33]||(e[33]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"}
1,"Connect Telegram",-1)),e[34]||(e[34]=t("p",{class:"text-sm text-[var(--text-2)] mb-4"},[u(" Add your bot token to enable Telegram. Need a bot? Talk to "),t("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noopener"},"@BotFather"),u(". ")],-1)),t("div",Os,[_(t("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>P.value=l),class:"input",disabled:d.value,placeholder:"123456:ABCDEF..."},null,8,Qs),[[D,P.value]]),t("div",Xs,[t("button",{class:"btn-primary btn-sm",disabled:d.value||ue.value,onClick:mt},[ue.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[32]||(e[32]=u(" Connect Telegram ",-1))],8,Hs),Z.value?(a(),o("span",Js,i(Z.value),1)):r("",!0)])])])):(a(),o(W,{key:2},[re.value?(a(),o("div",Ks,[t("div",Ys,[$(x(Bt),{size:16,class:"mt-0.5 shrink-0 text-warn-500"}),t("div",Zs,[e[35]||(e[35]=t("p",{class:"text-sm font-semibold text-[var(--text-0)]"}," Telegram messages are going to another bot using this token ",-1)),t("p",ea,i(k.value?.health_detail),1),e[36]||(e[36]=t("p",{class:"text-xs text-[var(--text-2)] mt-2"},[u(" Stop the other program, or revoke the token in "),t("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noopener"},"@BotFather"),u(" ("),t("code",null,"/revoke"),u(") and paste the new token below with "),t("span",{class:"font-medium text-[var(--text-0)]"},"Update token"),u(". ")],-1))])])])):r("",!0),t("div",ta,[t("div",sa,[t("div",null,[e[37]||(e[37]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},"Bot token",-1)),t("p",aa,i(k.value?.has_token?"••••••••••••":"Not set"),1),t("p",la,"Bot: "+i(k.value?.bot_username?`@${k.value.bot_username}`:"Not connected"),1),t("p",na," Access: "+i(k.value?.allow_anyone?"Anyone can message the bot":"Allowlist / pairing only"),1)]),t("div",oa,[t("button",{class:"btn-secondary btn-sm",disabled:d.value||p.value,onClick:gt},[p.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),u(" "+i(k.value?.allow_anyone?"Disable allow anyone":"Enable allow anyone"),1)],8,ia),t("button",{class:"btn-ghost btn-sm",disabled:d.value&&!z.value,onClick:e[1]||(e[1]=l=>z.value=!z.value)},i(z.value?"Cancel":"Update token"),9,ra),t("button",{class:"btn-danger btn-sm",disabled:d.value||M.value,onClick:e[2]||(e[2]=l=>$e.value=!0)},[M.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[38]||(e[38]=u(" Disconnect ",-1))],8,ua)])]),z.value?(a(),o("div",da,[_(t("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>ee.value=l),class:"input",disabled:d.value,placeholder:"New bot token..."},null,8,ca),[[D,ee.value]]),t("div",pa,[t("button",{class:"btn-primary btn-sm",disabled:d.value||b.value,onClick:xt},[b.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[39]||(e[39]=u(" Save token ",-1))],8,va),v.value?(a(),o("span",ma,i(v.value),1)):r("",!0)])])):r("",!0)]),k.value?.allow_anyone?(a(),o("div",xa,[...e[40]||(e[40]=[t("p",{class:"text-sm text-[var(--text-2)]"},[u(" Allowlist is bypassed because "),t("span",{class:"font-medium text-[var(--text-0)]"},"Allow anyone"),u(" is enabled. ")],-1)])])):(a(),o(W,{key:2},[e[41]||(e[41]=t("div",{class:"card mb-4"},[t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},"Find Telegram IDs"),t("p",{class:"text-sm text-[var(--text-2)]"},[u(" Message "),t("a",{href:"https://t.me/openclaw_setup_helper_bot",target:"_blank",rel:"noopener"},"@openclaw_setup_helper_bot"),u(" to get your user ID. For a group ID, add the bot to your Telegram group and it will send the group ID there. ")])],-1)),$(Qe,{platform:"telegram",disabled:d.value,entries:T.value,onAdd:ft,onDelete:bt},null,8,["disabled","entries"])],64))],64))])):r("",!0),$e.value?(a(),o("div",fa,[t("div",ba,[e[43]||(e[43]=t("h3",{class:"text-lg font-medium text-[var(--text-0)] mb-2"},"Disconnect Telegram",-1)),e[44]||(e[44]=t("p",{class:"text-sm text-[var(--text-2)] mb-4"}," This will remove Telegram configuration from OpenClaw and clear all associated data including bot token and allowlist entries. ",-1)),t("div",ga,[t("button",{class:"btn-secondary btn-sm",onClick:e[4]||(e[4]=l=>$e.value=!1)},"Cancel"),t("button",{class:"btn-danger btn-sm",disabled:d.value||M.value,onClick:yt},[M.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[42]||(e[42]=u(" Disconnect ",-1))],8,ya)])])])):y.value==="slack"?(a(),o("div",ka,[_e.value?(a(),o("div",ha,[t("p",wa,i(_e.value),1)])):we.value?(a(),o("div",_a,[e[58]||(e[58]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},"Connect Slack",-1)),e[59]||(e[59]=t("p",{class:"text-sm text-[var(--text-2)] mb-3"}," Paste your Slack app's bot and app tokens below to connect. New to Slack? Expand the step-by-step guide for creating the app. ",-1)),t("button",{type:"button",class:"mb-3 flex items-center gap-1.5 text-xs font-medium text-[var(--text-2)] hover:text-[var(--text-0)]",onClick:e[5]||(e[5]=l=>U.value=!U.value)},[$(x(Vt),{size:14,class:et(["transition-transform",U.value&&"rotate-180"])},null,8,["class"]),u(" "+i(U.value?"Hide":"Show")+" step-by-step setup ",1)]),U.value?(a(),o("ol",Aa,[e[55]||(e[55]=t("li",{class:"flex gap-2"},[t("span",{class:"flex-shrink-0 w-5 h-5 rounded-full bg-[var(--brand-10)] text-brand text-xs font-medium flex items-center justify-center"},"1"),t("div",null,[t("a",{href:"https://api.slack.com/apps?new_app=1",target:"_blank",rel:"noopener",class:"font-medium text-brand hover:underline"},"Create a Slack app"),t("span",{class:"text-[var(--text-2)]"},' — choose "From scratch", name it, and select your workspace.')])],-1)),t("li",Ca,[e[47]||(e[47]=t("span",{class:"flex-shrink-0 w-5 h-5 rounded-full bg-[var(--brand-10)] text-brand text-xs font-medium flex items-center justify-center"},"2",-1)),t("div",null,[e[46]||(e[46]=t("span",{class:"font-medium text-[var(--text-0)]"},"Add bot scopes:",-1)),t("div",Sa,[(a(),o(W,null,ye(q,l=>t("button",{key:l,type:"button",class:"text-xs font-mono bg-[var(--surface-1)] hover:bg-[var(--surface-2)] text-[var(--text-0)] px-1.5 py-0.5 rounded cursor-pointer transition-colors",title:`Copy ${l}`,"aria-label":`Copy Slack scope ${l}`,onClick:Ze=>Ge(l)},i(l),9,Ta)),64))]),t("div",$a,[e[45]||(e[45]=t("span",{class:"text-sm text-[var(--text-2)]"},"Optional (for file upload, emoji, and reaction features):",-1)),t("div",Da,[(a(),o(W,null,ye(oe,l=>t("button",{key:l,type:"button",class:"text-xs font-mono bg-[var(--surface-1)] hover:bg-[var(--surface-2)] text-[var(--text-0)] px-1.5 py-0.5 rounded cursor-pointer transition-colors",title:`Copy ${l}`,"aria-label":`Copy Slack scope ${l}`,onClick:Ze=>Ge(l)}
1,i(l),9,Ia)),64))])])])]),e[56]||(e[56]=rt('<li class="flex gap-2"><span class="flex-shrink-0 w-5 h-5 rounded-full bg-[var(--brand-10)] text-brand text-xs font-medium flex items-center justify-center">3</span><div><span class="font-medium text-[var(--text-0)]">Install &amp; copy Bot Token</span><span class="text-[var(--text-2)]"> — install to workspace, copy the <code class="text-xs bg-[var(--surface-1)] px-1 rounded">xoxb-...</code> token.</span></div></li>',1)),t("li",Wa,[e[51]||(e[51]=t("span",{class:"flex-shrink-0 w-5 h-5 rounded-full bg-[var(--brand-10)] text-brand text-xs font-medium flex items-center justify-center"},"4",-1)),t("div",null,[e[48]||(e[48]=t("span",{class:"font-medium text-[var(--text-0)]"},"Enable Socket Mode",-1)),e[49]||(e[49]=t("span",{class:"text-[var(--text-2)]"}," — create an App-Level Token with ",-1)),t("button",{type:"button",class:"text-xs font-mono bg-[var(--surface-1)] hover:bg-[var(--surface-2)] text-[var(--text-0)] px-1 py-0.5 rounded cursor-pointer transition-colors",title:"Copy connections:write","aria-label":"Copy Slack scope connections:write",onClick:e[6]||(e[6]=l=>Ge(dt))},i(dt)),e[50]||(e[50]=t("span",{class:"text-[var(--text-2)]"},[u(" scope, copy the "),t("code",{class:"text-xs bg-[var(--surface-1)] px-1 rounded"},"xapp-..."),u(" token.")],-1))])]),t("li",Ua,[e[54]||(e[54]=t("span",{class:"flex-shrink-0 w-5 h-5 rounded-full bg-[var(--brand-10)] text-brand text-xs font-medium flex items-center justify-center"},"5",-1)),t("div",null,[e[53]||(e[53]=t("span",{class:"font-medium text-[var(--text-0)]"},"Subscribe to events:",-1)),t("div",Ea,[(a(),o(W,null,ye(ie,l=>t("button",{key:l,type:"button",class:"text-xs font-mono bg-[var(--surface-1)] hover:bg-[var(--surface-2)] text-[var(--text-0)] px-1.5 py-0.5 rounded cursor-pointer transition-colors",title:`Copy ${l}`,"aria-label":`Copy Slack event ${l}`,onClick:Ze=>Ge(l)},i(l),9,Fa)),64)),e[52]||(e[52]=t("span",{class:"text-xs text-[var(--text-2)]"},"(optional)",-1))])])])])):r("",!0),t("div",La,[_(t("input",{"onUpdate:modelValue":e[7]||(e[7]=l=>De.value=l),class:"input",disabled:d.value,placeholder:"Bot Token (xoxb-...)"},null,8,za),[[D,De.value]]),_(t("input",{"onUpdate:modelValue":e[8]||(e[8]=l=>Ie.value=l),class:"input",disabled:d.value,placeholder:"App Token (xapp-...)"},null,8,Ra),[[D,Ie.value]]),t("div",Ba,[t("button",{class:"btn-primary btn-sm",disabled:d.value||We.value,onClick:kt},[We.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[57]||(e[57]=u(" Connect Slack ",-1))],8,Va),N.value?(a(),o("span",ja,i(N.value),1)):r("",!0)])]),e[60]||(e[60]=t("p",{class:"text-xs text-[var(--text-2)] mt-3"},[u(" Need help? See the "),t("a",{href:"/blog/tutorials/slack/",target:"_blank",rel:"noopener",class:"help-link"},"full Slack setup guide"),u(". ")],-1))])):(a(),o(W,{key:2},[t("div",qa,[t("div",Pa,[t("div",null,[e[61]||(e[61]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},"Tokens",-1)),t("p",Ma,i(C.value?.has_tokens?"••••••••••••":"Not set"),1),t("p",Ga,"Bot: "+i(C.value?.bot_name??"Unknown")+" · Team: "+i(C.value?.team_name??"Unknown"),1),t("p",Na," Access: "+i(C.value?.allow_anyone?"Anyone can message the bot":"Allowlist / pairing only"),1)]),t("div",Oa,[t("button",{class:"btn-secondary btn-sm",disabled:d.value||Le.value,onClick:At},[Le.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),u(" "+i(C.value?.allow_anyone?"Disable allow anyone":"Enable allow anyone"),1)],8,Qa),t("button",{class:"btn-ghost btn-sm",disabled:d.value&&!te.value,onClick:e[9]||(e[9]=l=>te.value=!te.value)},i(te.value?"Cancel":"Update tokens"),9,Xa),t("button",{class:"btn-danger btn-sm",disabled:d.value||ce.value,onClick:e[10]||(e[10]=l=>ze.value=!0)},[ce.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[62]||(e[62]=u(" Disconnect ",-1))],8,Ha)])]),te.value?(a(),o("div",Ja,[_(t("input",{"onUpdate:modelValue":e[11]||(e[11]=l=>Ue.value=l),class:"input",disabled:d.value,placeholder:"xoxb-..."},null,8,Ka),[[D,Ue.value]]),_(t("input",{"onUpdate:modelValue":e[12]||(e[12]=l=>Ee.value=l),class:"input",disabled:d.value,placeholder:"xapp-..."},null,8,Ya),[[D,Ee.value]]),t("div",Za,[t("button",{class:"btn-primary btn-sm",disabled:d.value||Fe.value,onClick:ht},[Fe.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[63]||(e[63]=u(" Save tokens ",-1))],8,el),de.value?(a(),o("span",tl,i(de.value),1)):r("",!0)])])):r("",!0)]),C.value?.allow_anyone?(a(),o("div",sl,[...e[64]||(e[64]=[t("p",{class:"text-sm text-[var(--text-2)]"},[u(" Allowlist is bypassed because "),t("span",{class:"font-medium text-[var(--text-0)]"},"Allow anyone"),u(" is enabled. ")],-1)])])):(a(),o(W,{key:1},[e[65]||(e[65]=rt('<div class="card mb-4"><p class="text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2">Find Slack IDs</p><div class="text-sm text-[var(--text-2)] space-y-2"><p><strong>User ID:</strong> In Slack, click your profile → <strong>...</strong> → <strong>Copy member ID</strong>.</p><p><strong>Channel ID:</strong> Right-click a channel → <strong>View channel details</strong> → scroll to find the ID at the bottom.</p></div></div>',1)),$(Qe,{platform:"slack",disabled:d.value,entries:G.value,onAdd:wt,onDelete:_t},null,8,["disabled","entries"])],64))],64))])):r("",!0),ze.value?(a(),o("div",al,[t("div",ll,[e[67]||(e[67]=t("h3",{class:"text-lg font-medium text-[var(--text-0)] mb-2"},"Disconnect Slack",-1)),e[68]||(e[68]=t("p",{class:"text-sm text-[var(--text-2)] mb-4"}," This will remove Slack configuration from OpenClaw and clear all associated data including tokens and allowlist entr
1ies. ",-1)),t("div",nl,[t("button",{class:"btn-secondary btn-sm",onClick:e[13]||(e[13]=l=>ze.value=!1)},"Cancel"),t("button",{class:"btn-danger btn-sm",disabled:d.value||ce.value,onClick:Ct},[ce.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[66]||(e[66]=u(" Disconnect ",-1))],8,ol)])])])):y.value==="whatsapp"?(a(),o("div",il,[ve.value?(a(),o("div",rl,[t("p",ul,i(ve.value),1)])):pe.value?(a(),o("div",dl,[t("div",cl,[e[73]||(e[73]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},"Configure WhatsApp",-1)),e[74]||(e[74]=t("p",{class:"text-sm text-[var(--text-2)] mb-4"}," WhatsApp uses QR linking, not bot tokens. Save access settings first, then link the account after launch by scanning a QR code from the dashboard. ",-1)),t("div",pl,[_(t("input",{"onUpdate:modelValue":e[14]||(e[14]=l=>xe.value=l),class:"input",disabled:d.value,placeholder:"+15551234567"},null,8,vl),[[D,xe.value]]),_(t("select",{"onUpdate:modelValue":e[15]||(e[15]=l=>fe.value=l),class:"input",disabled:d.value},[...e[69]||(e[69]=[t("option",{value:"personal"},"Personal number",-1),t("option",{value:"dedicated"},"Dedicated number",-1)])],8,ml),[[Ne,fe.value]]),_(t("select",{"onUpdate:modelValue":e[16]||(e[16]=l=>Q.value=l),class:"input",disabled:d.value},[...e[70]||(e[70]=[t("option",{value:"pairing"},"Pairing",-1),t("option",{value:"allowlist"},"Allowlist",-1),t("option",{value:"open"},"Open",-1),t("option",{value:"disabled"},"Disabled",-1)])],8,xl),[[Ne,Q.value]]),t("label",fl,[_(t("input",{"onUpdate:modelValue":e[17]||(e[17]=l=>be.value=l),type:"checkbox",class:"rounded",disabled:d.value}
1,null,8,bl),[[Xe,be.value]]),e[71]||(e[71]=u(" Enable self-chat mode ",-1))]),qe.value?(a(),o("p",gl," Add at least one WhatsApp user or group to the allowlist before saving this configuration. ")):r("",!0),t("div",yl,[t("button",{class:"btn-primary btn-sm",disabled:d.value||me.value||qe.value,onClick:nt},[me.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[72]||(e[72]=u(" Save WhatsApp config ",-1))],8,kl),O.value?(a(),o("span",hl,i(O.value),1)):r("",!0)])])]),je.value?(a(),h(Qe,{key:0,platform:"whatsapp",disabled:d.value,entries:I.value,onAdd:ot,onDelete:it},null,8,["disabled","entries"])):r("",!0)])):(a(),o(W,{key:2},[t("div",wl,[t("div",_l,[t("div",null,[e[76]||(e[76]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},"Connection status",-1)),t("p",Al,i(S.value?.is_linked?"Linked":"Configured, not linked"),1),e[77]||(e[77]=t("p",{class:"text-xs text-[var(--text-2)] mt-1"},"Scan the QR in WhatsApp → Linked Devices.",-1)),S.value?.is_linked?r("",!0):(a(),o("button",{key:0,class:"btn-primary btn-sm mt-2",disabled:d.value||X.value||R.value,onClick:e[18]||(e[18]=l=>Ye(!1))},[X.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[75]||(e[75]=u(" Generate QR ",-1))],8,Cl)),S.value?.linked_e164?(a(),o("p",Sl," Linked number: "+i(S.value.linked_e164),1)):S.value?.owner_e164?(a(),o("p",Tl," Owner number: "+i(S.value.owner_e164),1)):r("",!0)]),t("div",$l,[t("button",{class:et(["btn-sm",S.value?.is_linked?"btn-secondary":"btn-primary"]),disabled:d.value||X.value||R.value,onClick:e[19]||(e[19]=l=>Ye(!!S.value?.is_linked))},[X.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),u(" "+i(S.value?.is_linked?"Relink via QR":"Generate QR"),1)],10,Dl),t("button",{class:"btn-secondary btn-sm",disabled:d.value||Be.value,onClick:$t},[Be.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[78]||(e[78]=u(" Logout ",-1))],8,Il),t("button",{class:"btn-danger btn-sm",disabled:st.value,onClick:e[20]||(e[20]=l=>Ve.value=!0)},[Ae.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[79]||(e[79]=u(" Disconnect ",-1))],8,Wl)])]),se.value?(a(),o("p",Ul,i(se.value),1)):r("",!0),ae.value?(a(),o("p",El,i(ae.value),1)):r("",!0)]),B.value?(a(),o("div",Fl,[e[86]||(e[86]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},"QR login",-1)),t("div",Ll,[t("div",null,[e[80]||(e[80]=t("p",{class:"text-sm font-medium text-[var(--text-0)] mb-2"},"1. Scan this QR code",-1)),t("img",{src:B.value,alt:"WhatsApp QR code",class:"w-56 max-w-full rounded-md border border-[var(--border-1)] bg-white p-2"},null,8,zl),e[81]||(e[81]=t("p",{class:"text-xs text-[var(--text-2)] mt-3"}," Open WhatsApp on your phone and scan this code from Linked Devices. ",-1))]),t("div",Rl,[e[83]||(e[83]=t("p",{class:"text-sm font-medium text-[var(--text-0)]"},"2. Confirm after the scan",-1)),e[84]||(e[84]=t("p",{class:"text-sm text-[var(--text-2)] mt-2"}," After your phone starts linking, press the confirmation button so the dashboard can finish the connection check. ",-1)),t("p",Bl,i(R.value?"Checking the WhatsApp link result…":pt.value),1),t("button",{class:"btn-primary btn-sm mt-4",disabled:d.value||X.value||R.value,onClick:Tt},[R.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[82]||(e[82]=u(" I scanned the QR ",-1))],8,Vl)])]),t("div",jl,[t("button",{class:"btn-secondary btn-sm",disabled:d.value||X.value||R.value,onClick:e[21]||(e[21]=l=>Ye(!0))}," Regenerate QR ",8,ql),e[85]||(e[85]=t("span",{class:"text-xs text-[var(--text-2)]"}," If the code expires or you scanned the wrong one, generate a fresh QR. ",-1))])])):r("",!0),t("div",Pl,[e[91]||(e[91]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-2"},"Access settings",-1)),t("div",Ml,[_(t("input",{"onUpdate:modelValue":e[22]||(e[22]=l=>xe.value=l),class:"input",disabled:d.value,placeholder:"+15551234567"},null,8,Gl),[[D,xe.value]]),_(t("select",{"onUpdate:modelValue":e[23]||(e[23]=l=>fe.value=l),class:"input",disabled:d.value},[...e[87]||(e[87]=[t("option",{value:"personal"},"Personal number",-1),t("option",{value:"dedicated"},"Dedicated number",-1)])],8,Nl),[[Ne,fe.value]]),_(t("select",{"onUpdate:modelValue":e[24]||(e[24]=l=>Q.value=l),class:"input",disabled:d.value},[...e[88]||(e[88]=[t("option",{value:"pairing"},"Pairing",-1),t("option",{value:"allowlist"},"Allowlist",-1),t("option",{value:"open"},"Open",-1),t("option",{value:"disabled"},"Disabled",-1)])],8,Ol),[[Ne,Q.value]]),t("label",Ql,[_(t("input",{"onUpdate:modelValue":e[25]||(e[25]=l=>be.value=l),type:"checkbox",class:"rounded",disabled:d.value}
1,null,8,Xl),[[Xe,be.value]]),e[89]||(e[89]=u(" Enable self-chat mode ",-1))]),qe.value?(a(),o("p",Hl," Add at least one WhatsApp user or group to the allowlist before saving this configuration. ")):r("",!0),t("div",Jl,[t("button",{class:"btn-primary btn-sm",disabled:d.value||me.value||qe.value,onClick:nt},[me.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[90]||(e[90]=u(" Save settings ",-1))],8,Kl),O.value?(a(),o("span",Yl,i(O.value),1)):r("",!0)])])]),$(Qe,{platform:"whatsapp",disabled:d.value,entries:I.value,onAdd:ot,onDelete:it},null,8,["disabled","entries"])],64))])):y.value==="mobile-app"?(a(),o("div",Zl,[t("div",en,[t("div",tn,[e[93]||(e[93]=t("div",null,[t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider"},"Paired device"),t("p",{class:"text-base font-semibold text-[var(--text-0)] mt-1"},"Official OpenClaw app (iOS & Android)")],-1)),t("a",sn,[e[92]||(e[92]=u(" Documentation ",-1)),$(x(jt),{size:12})])]),e[95]||(e[95]=t("p",{class:"text-sm text-[var(--text-2)]"},[u(" Unlike Telegram or Slack, the app isn't a bot — it's a companion that pairs directly to this instance's gateway over a secure "),t("span",{class:"font-mono"},"wss://"),u(" connection. No allowlist or bot token: generate the connection details, enter them once in the app, and it pairs automatically. ")],-1)),t("div",an,[t("button",{class:"btn-primary btn-sm",disabled:d.value||Pe.value,onClick:vt},[Pe.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[94]||(e[94]=u(" Generate connection details ",-1))],8,ln)])]),L.value?(a(),o("div",nn,[e[107]||(e[107]=t("p",{class:"text-xs font-medium text-[var(--text-3)] uppercase tracking-wider mb-3"},"Setup steps",-1)),t("ol",on,[e[102]||(e[102]=t("li",null,[t("p",{class:"text-sm font-medium text-[var(--text-0)] mb-1"},"1. Install the OpenClaw app"),t("p",{class:"text-xs text-[var(--text-2)]"},[u(" Get it from the App Store (search “OpenClaw”) or "),t("a",{href:"https://play.google.com/store/search?q=openclaw&c=apps",target:"_blank",rel:"noopener noreferrer"},"Google Play"),u(". On Android you can also install the signed APK from "),t("a",{href:"https://github.com/openclaw/openclaw/releases",target:"_blank",rel:"noopener noreferrer"},"GitHub Releases"),u(". ")])],-1)),t("li",null,[e[100]||(e[100]=t("p",{class:"text-sm font-medium text-[var(--text-0)] mb-1"},"2. Add a gateway manually",-1)),e[101]||(e[101]=t("p",{class:"text-xs text-[var(--text-2)] mb-2"},[u(" In the app's Gateway settings, turn on "),t("span",{class:"font-medium text-[var(--text-0)]"},"Use Manual Gateway"),u(" and enter these values: ")],-1)),t("div",rn,[t("div",un,[e[96]||(e[96]=t("span",{class:"text-xs text-[var(--text-2)] w-16 shrink-0"},"Host",-1)),t("input",{value:L.value.gateway_host,readonly:"",class:"input font-mono text-xs w-full"},null,8,dn),t("button",{class:"btn-secondary btn-sm h-fit",onClick:e[26]||(e[26]=l=>Me(L.value.gateway_host,"Gateway host copied"))},[$(x(Oe),{size:14})])]),t("div",cn,[e[97]||(e[97]=t("span",{class:"text-xs text-[var(--text-2)] w-16 shrink-0"},"Port",-1)),t("input",{value:String(L.value.gateway_port),readonly:"",class:"input font-mono text-xs w-full"},null,8,pn),t("button",{class:"btn-secondary btn-sm h-fit",onClick:e[27]||(e[27]=l=>Me(String(L.value.gateway_port),"Gateway port copied"))},[$(x(Oe),{size:14})])]),t("div",vn,[e[98]||(e[98]=t("span",{class:"text-xs text-[var(--text-2)] w-16 shrink-0"},"TLS",-1)),t("span",mn,i(L.value.gateway_tls?"Enabled (wss://)":"Disabled"),1)]),t("div",xn,[e[99]||(e[99]=t("span",{class:"text-xs text-[var(--text-2)] w-16 shrink-0"},"Token",-1)),t("input",{value:L.value.gateway_token,readonly:"",type:"password",class:"input font-mono text-xs w-full"},null,8,fn),t("button",{class:"btn-secondary btn-sm h-fit",onClick:e[28]||(e[28]=l=>Me(L.value.gateway_token,"Gateway token copied"))},[$(x(Oe),{size:14})])])])]),e[103]||(e[103]=t("li",null,[t("p",{class:"text-sm font-medium text-[var(--text-0)] mb-1"},"3. Connect"),t("p",{class:"text-xs text-[var(--text-2)]"}," Tap connect. Pairing is approved automatically, so the phone attaches within a few seconds and reconnects on its own after that. ")],-1))]),t("div",bn,[e[106]||(e[106]=t("p",{class:"text-xs text-[var(--text-2)]"}," The token is this instance's gateway token — treat it like a password. Anyone with it can control this instance. Rotate it by restarting the instance if a device is lost. ",-1)),t("details",gn,[e[105]||(e[105]=t("summary",{class:"cursor-pointer select-none"},"Advanced (WebSocket URL)",-1)),t("div",yn,[t("button",{class:"btn-secondary btn-sm",onClick:e[29]||(e[29]=l=>Me(L.value.websocket_url,"WebSocket URL copied"))},[$(x(Oe),{size:14}
1),e[104]||(e[104]=u(" Copy WS URL ",-1))])])])])])):r("",!0)])):r("",!0),Ve.value?(a(),o("div",kn,[t("div",hn,[e[109]||(e[109]=t("h3",{class:"text-lg font-medium text-[var(--text-0)] mb-2"},"Disconnect WhatsApp",-1)),e[110]||(e[110]=t("p",{class:"text-sm text-[var(--text-2)] mb-4"}," This will remove WhatsApp configuration from OpenClaw and clear the saved allowlist. If the instance is running, the linked WhatsApp session is cleared from the runtime too. ",-1)),t("div",wn,[t("button",{class:"btn-secondary btn-sm",onClick:e[30]||(e[30]=l=>Ve.value=!1)},"Cancel"),t("button",{class:"btn-danger btn-sm",disabled:st.value,onClick:Dt},[Ae.value?(a(),h(x(w),{key:0,size:14,class:"animate-spin"})):r("",!0),e[108]||(e[108]=u(" Disconnect ",-1))],8,_n)])])])):r("",!0)]))}});export{En 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.