import{r as t,h as e,a as r}from"./p-a599f720.js";import{c as o,e as a,i}from"./p-9811c98c.js";import{S as n}from"./p-af705ed1.js";var s=function(t,e,r,o){var a,i=arguments.length,n=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(n=(i<3?a(n):i>3?a(e,r,n):a(e,r))||n);return i>3&&n&&Object.defineProperty(e,r,n),n};const c=class{constructor(e){t(this,e),this.config=o(),this.iconPack=a,this.t=i(),this.socketStateUpdate=({state:t})=>{var e;this.connectionState=t,"connected"===t&&((null===(e=this.states)||void 0===e?void 0:e.joinError)||(this.joinError=void 0,this.joinErrorCode=void 0))}}connectedCallback(){this.meetingChanged(this.meeting,void 0),this.statesChanged(this.states)}disconnectedCallback(){var t,e;null===(e=null===(t=this.meeting)||void 0===t?void 0:t.meta)||void 0===e||e.removeListener("socketConnectionUpdate",this.socketStateUpdate)}meetingChanged(t,e){var r,o,a,i;null===(r=null==e?void 0:e.meta)||void 0===r||r.removeListener("socketConnectionUpdate",this.socketStateUpdate),t&&(this.connectionState=null===(a=null===(o=t.meta)||void 0===o?void 0:o.socketState)||void 0===a?void 0:a.state,null===(i=t.meta)||void 0===i||i.addListener("socketConnectionUpdate",this.socketStateUpdate))}statesChanged(t){this.joinError=null==t?void 0:t.joinError,this.joinErrorCode=null==t?void 0:t.joinErrorCode}render(){const t=!!this.connectionState&&"connected"!==this.connectionState&&!this.joinError,o=this.joinError?this.joinError:this.t("failed"===this.connectionState?"network.lost_extended":"network.lost");return e(r,{key:"31ce933ba66fc5c52da8d66500484f7a2578a845"},e("slot",{key:"6716a6b7d8d1f43ff93b8f3d8255215b29e5f41c"},e("div",{key:"ca47792dfae8a018d42e0693d2ae28c2891c8120",class:"ctr",part:"container"},e("rtk-logo",{key:"ab77174bdd736b0b5829b84ea39da26e5e93fe99",meeting:this.meeting,config:this.config,t:this.t,part:"logo"}),this.joinError||t?e("div",{class:"error-state"},e("div",{class:"no-network-badge",part:"network-badge",role:"alert"},e("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected,part:"network-badge-icon"}),o),this.meeting&&this.joinError&&e("a",{class:"troubleshoot-link",href:`https://test.realtime.cloudflare.com?authToken=${this.meeting.__internals__.authToken}`,target:"_blank",rel:"noopener noreferrer"},this.t("network.troubleshoot")),this.joinErrorCode&&e("span",{class:"error-code",part:"error-code"},this.t("join.error_code"),": ",this.joinErrorCode)):e("rtk-spinner",{"aria-label":"Idle, waiting for meeting data",part:"spinner",iconPack:this.iconPack}))))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"]}}};s([n()],c.prototype,"meeting",void 0),s([n()],c.prototype,"states",void 0),s([n()],c.prototype,"config",void 0),s([n()],c.prototype,"iconPack",void 0),s([n()],c.prototype,"t",void 0),c.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)}:host{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}.error-state{display:flex;width:100%;flex-direction:column;align-items:center}.troubleshoot-link{margin-top:var(--rtk-space-1, 4px);font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:2px}.troubleshoot-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.error-code{margin-top:var(--rtk-space-1, 4px);font-size:10px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}rtk-spinner{height:var(--rtk-space-12, 48px);width:var(--rtk-space-12, 48px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";export{c as rtk_idle_screen}