import{c as m,p as h,g as w,h as u,a as f,b as v,q as S,D as g,r as p}from"./index-iCRehgtD.js";const q=m({name:"QBanner",props:{...h,inlineActions:Boolean,dense:Boolean,rounded:Boolean},setup(e,{slots:n}){const{proxy:{$q:o}}=w(),a=S(e,o),c=v(()=>"q-banner row items-center"+(e.dense===!0?" q-banner--dense":"")+(a.value===!0?" q-banner--dark q-dark":"")+(e.rounded===!0?" rounded-borders":"")),d=v(()=>`q-banner__actions row items-center justify-end col-${e.inlineActions===!0?"auto":"all"}`);return()=>{const l=[u("div",{class:"q-banner__avatar col-auto row items-center self-start"},f(n.avatar)),u("div",{class:"q-banner__content col text-body2"},f(n.default))],t=f(n.action);return t!==void 0&&l.push(u("div",{class:d.value},t)),u("div",{class:c.value+(e.inlineActions===!1&&t!==void 0?" q-banner--top-padding":""),role:"alert"},l)}}});let s=null,r=[];function b(){if(s&&s.readyState<=WebSocket.OPEN)return s;const e=location.protocol==="https:"?"wss":"ws";return s=new WebSocket(`${e}://${location.host}/ws`),s.onmessage=n=>{let o;try{o=JSON.parse(n.data)}catch{return}r.forEach(a=>a(o))},s.onclose=()=>{s=null,r.forEach(n=>n({type:"ws_closed"}))},s}function y(){const e=p(!1),n=p([]);function o(t){t.type==="ws_closed"?e.value=!1:(e.value=!0,n.value.push(t))}r.push(o);const a=b(),c=()=>{e.value=!0};a.addEventListener("open",c),g(()=>{r=r.filter(t=>t!==o),a.removeEventListener("open",c)});function d(t){const i=b();i.readyState===WebSocket.OPEN?i.send(JSON.stringify(t)):i.addEventListener("open",()=>i.send(JSON.stringify(t)),{once:!0})}function l(){n.value=[]}return{connected:e,messages:n,send:d,clearMessages:l}}export{q as Q,y as u};
