import{r as t,h as i,a,g as r}from"./p-a599f720.js";import{e,i as s}from"./p-9811c98c.js";import{S as c}from"./p-af705ed1.js";import{R as o}from"./p-eccb6d78.js";var n=function(t,i,a,r){var e,s=arguments.length,c=s<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,i,a,r);else for(var o=t.length-1;o>=0;o--)(e=t[o])&&(c=(s<3?e(c):s>3?e(i,a,c):e(i,a))||c);return s>3&&c&&Object.defineProperty(i,a,c),c};const l=class{constructor(i){t(this,i),this.iconPack=e,this.t=s(),this.hideSelf=!1,this.activeParticipants=[],this.onStageParticipants=[],this.offStageParticipants=[],this.onParticipantListUpdate=()=>{if(!this.meeting)return;let t=this.meeting.participants.active.toArray();this.hideSelf||(t=[...t,this.meeting.self]);let i=this.meeting.participants.joined.toArray().filter((i=>!t.some((t=>t.id===i.id))));this.activeParticipants=t,this.onStageParticipants=i}}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(t){t&&"AUDIO_ROOM"===t.self.config.viewType&&(this.onParticipantListUpdate(),t.participants.active.addListener("participantJoined",this.onParticipantListUpdate),t.participants.active.addListener("participantLeft",this.onParticipantListUpdate),t.participants.joined.addListener("participantJoined",this.onParticipantListUpdate),t.participants.joined.addListener("participantLeft",this.onParticipantListUpdate))}disconnectedCallback(){this.resizeObserver.disconnect(),this.resizeObserver=void 0,this.meeting.participants.active.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.active.removeListener("participantLeft",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantLeft",this.onParticipantListUpdate)}renderGrid(t=[]){const a={meeting:this.meeting,size:this.size,config:this.config,t:this.t,iconPack:this.iconPack,states:this.states};return t.map((t=>i(o,{element:"rtk-audio-tile",defaults:a,props:{key:t.id,participant:t},childProps:{participant:t},deepProps:!0})))}render(){const t=this.activeParticipants.concat(this.onStageParticipants);return i(a,{key:"46eacac44f967fdac3ca9d1a62ffa08a9e2bec0e"},i("div",{key:"6121a8d6ec144197981ced909076345163f0fa69",class:"content scrollbar"},i("div",{key:"caeb7f4830e847e7dab63db199ec00cd12cb8ecc",class:"stage grid"},this.renderGrid(t)),this.offStageParticipants.length>0&&i("div",{key:"b5923cbb9be5992fdb007c3354e7792b19003d5b",class:"waitlist-area"},i("div",{key:"b93cefbe7de0eaf46c69f9d0dd6cf231ce683f27",class:"listening-title"},this.offStageParticipants.length," ",this.t("grid.listening")),i("div",{key:"f75c7cd4aa2422d3faed994ed24929e3c05fd097",class:"waitlist-grid grid"},this.renderGrid(this.offStageParticipants)))),i("slot",{key:"91240e462e7e510317b0ea6625ecba3aea94d5f3"}))}get host(){return r(this)}static get watchers(){return{meeting:["meetingChanged"]}}};n([c()],l.prototype,"meeting",void 0),n([c()],l.prototype,"config",void 0),n([c()],l.prototype,"states",void 0),n([c()],l.prototype,"iconPack",void 0),n([c()],l.prototype,"t",void 0),l.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;height:100%;width:100%;box-sizing:border-box}.content{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow-y:auto}.waitlist-area{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.listening-title{text-align:center;margin-top:var(--rtk-space-5, 20px);margin-bottom:var(--rtk-space-4, 16px)}.waitlist-grid{flex:1 1 0%}.grid{box-sizing:border-box;flex:1 1 0%;gap:var(--rtk-space-6, 24px);display:flex;align-content:center;justify-content:center;flex-wrap:wrap}:host([size='md']) .grid{gap:var(--rtk-space-4, 16px)}:host([size='sm']) .grid{gap:var(--rtk-space-3, 12px)}rtk-audio-tile{aspect-ratio:1 / 1;flex:none;width:calc(20%);max-width:var(--rtk-space-48, 192px);transition:all 0.3s}rtk-audio-tile[size='md']{width:100%;max-width:var(--rtk-space-36, 144px)}rtk-audio-tile[size='sm']{width:100%;max-width:var(--rtk-space-24, 96px)}";export{l as rtk_audio_grid}