1var Wt=Object.defineProperty;var Zt=(c,t,s)=>t in c?Wt(c,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[t]=s;var mt=(c,t,s)=>(Zt(c,typeof t!="symbol"?t+"":t,s),s),Tt=(c,t,s)=>{if(!t.has(c))throw TypeError("Cannot "+s)};var e=(c,t,s)=>(Tt(c,t,"read from private field"),s?s.call(c):t.get(c)),r=(c,t,s)=>{if(t.has(c))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(c):t.set(c,s)},u=(c,t,s,i)=>(Tt(c,t,"write to private field"),i?i.call(c,s):t.set(c,s),s);var a=(c,t,s)=>(Tt(c,t,"access private method"),s);import{y as te,K as L,U as wt,x as ee,D as Mt,d as ft,l as Dt,e as se,V as ie,L as ae}from"./app-45cdc9b8.js";import{R as re}from"./vidstack-DqAw8m9J-5210ce9d.js";import{g as ne,a as oe,b as Pt,h as Nt,l as he,c as ce}from"./vidstack-D2pY00kU-52d2edf9.js";var T,j,_t;class de{constructor(t){r(this,j);r(this,T,void 0);u(this,T,new chrome.cast.media.MediaInfo(t.src,t.type))}build(){return e(this,T)}setStreamType(t){return t.includes("live")?e(this,T).streamType=chrome.cast.media.StreamType.LIVE:e(this,T).streamType=chrome.cast.media.StreamType.BUFFERED,this}setTracks(t){return e(this,T).tracks=t.map(a(this,j,_t)),this}setMetadata(t,s){return e(this,T).metadata=new chrome.cast.media.GenericMediaMetadata,e(this,T).metadata.title=t,e(this,T).metadata.images=[{url:s}],this}}T=new WeakMap,j=new WeakSet,_t=function(t,s){const i=new chrome.cast.media.Track(s,chrome.cast.media.TrackType.TEXT);return i.name=t.label,i.trackContentId=t.src,i.trackContentType="text/vtt",i.language=t.language,i.subtype=t.kind.toUpperCase(),i};var y,g,D,N,gt,p,A,z,xt,J,Gt,Q,Ot,P,kt,I,Y,_,yt;class ue{constructor(t,s,i){r(this,N);r(this,p);r(this,z);r(this,J);r(this,Q);r(this,P);r(this,I);r(this,_);r(this,y,void 0);r(this,g,void 0);r(this,D,void 0);u(this,y,t),u(this,g,s),u(this,D,i)}setup(){const t=this.syncRemoteActiveIds.bind(this);Dt(e(this,g).audioTracks,"change",t),Dt(e(this,g).textTracks,"mode-change",t),se(a(this,J,Gt).bind(this))}getLocalTextTracks(){return e(this,g).$state.textTracks().filter(t=>t.src&&t.type==="vtt")}syncRemoteTracks(t){if(!e(this,y).isMediaLoaded)return;const s=a(this,N,gt).call(this),i=this.getLocalTextTracks(),n=a(this,p,A).call(this,chrome.cast.media.TrackType.AUDIO),l=a(this,p,A).call(this,chrome.cast.media.TrackType.TEXT);for(const d of n){if(a(this,P,kt).call(this,s,d))continue;const M={id:d.trackId.toString(),label:d.name,language:d.language,kind:d.subtype??"main",selected:!1};e(this,g).audioTracks[ae.add](M,t)}for(const d of l){if(a(this,P,kt).call(this,i,d))continue;const M={id:d.trackId.toString(),src:d.trackContentId,label:d.name,language:d.language,kind:d.subtype.toLowerCase()};e(this,g).textTracks.add(M,t)}}syncRemoteActiveIds(t){if(!e(this,y).isMediaLoaded)return;const s=a(this,z,xt).call(this),i=new chrome.cast.media.EditTracksInfoRequest(s);a(this,Q,Ot).call(this,i).catch(n=>{})}}y=new WeakMap,g=new WeakMap,D=new WeakMap,N=new WeakSet,gt=function(){return e(this,g).$state.audioTracks()},p=new WeakSet,A=function(t){var i;const s=((i=e(this,y).mediaInfo)==null?void 0:i.tracks)??[];return t?s.filter(n=>n.type===t):s},z=new WeakSet,xt=function(){const t=[],s=a(this,N,gt).call(this).find(n=>n.selected),i=this.getLocalTextTracks().filter(n=>n.mode==="showing");if(s){const n=a(this,p,A).call(this,chrome.cast.media.TrackType.AUDIO),l=a(this,I,Y).call(this,n,s);l&&t.push(l.trackId)}if(i!=null&&i.length){const n=a(this,p,A).call(this,chrome.cast.media.TrackType.TEXT);if(n.length)for(const l of i){const d=a(this,I,Y).call(this,n,l);d&&t.push(d.trackId)}}return t},J=new WeakSet,Gt=function(){const t=this.getLocalTextTracks();if(!e(this,y).isMediaLoaded)return;const s=a(this,p,A).call(this,chrome.cast.media.TrackType.TEXT);for(const i of t)if(!a(this,I,Y).call(this,s,i)){ie(()=>{var l;return(l=e(this,D))==null?void 0:l.call(this)});break}},Q=new WeakSet,Ot=function(t){const s=Pt();return new Promise((i,n)=>s==null?void 0:s.editTracksInfo(t,i,n))},P=new WeakSet,kt=function(t,s){return t.find(i=>a(this,_,yt).call(this,i,s))},I=new WeakSet,Y=function(t,s){return t.find(i=>a(this,_,yt).call(this,s,i))},_=new WeakSet,yt=function(t,s){return s.name===t.label&&s.language===t.language&&s.subtype.toLowerCase()===t.kind.toLowerCase()};var o,h,C,E,x,b,v,S,R,G,m,w,W,Vt,Z,$t,O,pt,tt,Ut,V,Ct,et,Ht,st,Ft,it,qt,$,Et,U,Lt,H,vt,F,St,at,Bt,rt,Xt,nt,Kt,q,At,ot,Yt,B,It,ht,jt,X,bt,f,k,ct,zt,dt,Jt,K,Rt,ut,Qt;class ge{constructor(t,s){r(this,W);r(this,Z);r(this,O);r(this,tt);r(this,V);r(this,et);r(this,st);r(this,it);r(this,$);r(this,U);r(this,H);r(this,F);r(this,at);r(this,rt);r(this,nt);r(this,q);r(this,ot);r(this,B);r(this,ht);r(this,X);r(this,f);r(this,ct);r(this,dt);r(this,K);r(this,ut);mt(this,"$$PROVIDER_TYPE","GOOGLE_CAST");mt(this,"scope",te());r(this,o,void 0);r(this,h,void 0);r(this,C,void 0);r(this,E,null);r(this,x,"disconnected");r(this,b,0);r(this,v,0);r(this,S,new L(0,0));r(this,R,new re(a(this,st,Ft).bind(this)));r(this,G,void 0);r(this,m,null);r(this,w,!1);u(this,o,t),u(this,h,s),u(this,C,new ue(t,s,a(this,ut,Qt).bind(this)))}get type(){return"google-cast"}get currentSrc(){return e(this,E)}get player(){return e(this,o)}get cast(){return ne()}get session(){return oe()}get media(){return Pt()}get hasActiveSession(){return Nt(e(this,E))}setup(){a(this,W,Vt).call(this),a(this,Z,$t).call(this),e(this,C).setup(),e(this,h).notify("provider-setup",this)}async play(){var t;if(!(!e(this,o).isPaused&&!e(this,w))){if(e(this,w)){await a(this,K,Rt).call(this,!1,0);return}(t=e(this,o).controller)==null||t.playOrPause()}}async pause(){var t;e(this,o).isPaused||(t=e(this,o).controller)==null||t.playOrPause()}getMediaStatus(t){return new Promise((s,i)=>{var n;(n=this.media)==null||n.getStatus(t,s,i)})}setMuted(t){var i;(t&&!e(this,o).isMuted||!t&&e(this,o).isMuted)&&((i=e(this,o).controller)==null||i.muteOrUnmute())}setCurrentTime(t){var s;e(this,o).currentTime=t,e(this,h).notify("seeking",t),(s=e(this,o).controller)==null||s.seek()}setVolume(t){var s;e(this,o).volumeLevel=t,(s=e(this,o).controller)==null||s.setVolumeLevel()}async loadSource(t){var n;if(((n=e(this,m))==null?void 0:n.src)!==t&&u(this,m,null),Nt(t)){a(this,tt,Ut).call(this),u(this,E,t);return}e(this,h).notify("load-start");const s=a(this,dt,Jt).call(this,t),i=await this.session.loadMedia(s);if(i){u(this,E,null),e(this,h).notify("error",Error(ce(i)));return}u(this,E,t)}destroy(){a(this,O,pt).call(this),a(this,V,Ct).call(this)}}o=new WeakMap,h=new WeakMap,C=new WeakMap,E=new WeakMap,x=new WeakMap,b=new WeakMap,v=new WeakMap,S=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,w=new WeakMap,W=new WeakSet,Vt=function(){he(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a(this,$,Et).bind(this))},Z=new WeakSet,$t=function(){const t=cast.framework.RemotePlayerEventType,s={[t.IS_CONNECTED_CHANGED]:a(this,$,Et),[t.IS_MEDIA_LOADED_CHANGED]:a(this,U,Lt),[t.CAN_CONTROL_VOLUME_CHANGED]:a(this,H,vt),[t.CAN_SEEK_CHANGED]:a(this,F,St),[t.DURATION_CHANGED]:a(this,nt,Kt),[t.IS_MUTED_CHANGED]:a(this,q,At),[t.VOLUME_LEVEL_CHANGED]:a(this,q,At),[t.IS_PAUSED_CHANGED]:a(this,ot,Yt),[t.LIVE_SEEKABLE_RANGE_CHANGED]:a(this,B,It),[t.PLAYER_STATE_CHANGED]:a(this,ht,jt)};u(this,G,s);const i=a(this,it,qt).bind(this);for(const n of wt(s))e(this,o).controller.addEventListener(n,i);ee(()=>{for(const n of wt(s))e(this,o).controller.removeEventListener(n,i)})},O=new WeakSet,pt=function(){e(this,m)||(u(this,v,0),u(this,S,new L(0,0))),e(this,R).stop(),u(this,b,0),u(this,m,null)},tt=new WeakSet,Ut=function(){const t=new Mt("resume-session",{detail:this.session});a(this,U,Lt).call(this,t);const{muted:s,volume:i,savedState:n}=e(this,h).$state,l=n();this.setCurrentTime(Math.max(e(this,o).currentTime,(l==null?void 0:l.currentTime)??0)),this.setMuted(s()),this.setVolume(i()),(l==null?void 0:l.paused)===!1&&this.play()},V=new WeakSet,Ct=function(){this.cast.endCurrentSession(!0);const{remotePlaybackLoader:t}=e(this,h).$state;t.set(null)},et=new WeakSet,Ht=function(){const{savedState:t}=e(this,h).$state;t.set({paused:e(this,o).isPaused,currentTime:e(this,o).currentTime}),a(this,V,Ct).call(this)},st=new WeakSet,Ft=function(){a(this,rt,Xt).call(this)},it=new WeakSet,qt=function(t){e(this,G)[t.type].call(this,t)},$=new WeakSet,Et=function(t){const s=this.cast.getCastState(),i=s===cast.framework.CastState.CONNECTED?"connected":s===cast.framework.CastState.CONNECTING?"connecting":"disconnected";if(e(this,x)===i)return;const n={type:"google-cast",state:i},l=a(this,f,k).call(this,t);u(this,x,i),e(this,h).notify("remote-playback-change",n,l),i==="disconnected"&&a(this,et,Ht).call(this)},U=new WeakSet,Lt=function(t){if(!!!e(this,o).isMediaLoaded)return;const i=ft(e(this,h).$state.source);Promise.resolve().then(()=>
1{if(i!==ft(e(this,h).$state.source)||!e(this,o).isMediaLoaded)return;a(this,O,pt).call(this);const n=e(this,o).duration;u(this,S,new L(0,n));const l={provider:this,duration:n,buffered:new L(0,0),seekable:a(this,X,bt).call(this)},d=a(this,f,k).call(this,t);e(this,h).notify("loaded-metadata",void 0,d),e(this,h).notify("loaded-data",void 0,d),e(this,h).notify("can-play",l,d),a(this,H,vt).call(this),a(this,F,St).call(this,t);const{volume:lt,muted:M}=e(this,h).$state;this.setVolume(lt()),this.setMuted(M()),e(this,R).start(),e(this,C).syncRemoteTracks(d),e(this,C).syncRemoteActiveIds(d)})},H=new WeakSet,vt=function(){e(this,h).$state.canSetVolume.set(e(this,o).canControlVolume)},F=new WeakSet,St=function(t){const s=a(this,f,k).call(this,t);e(this,h).notify("stream-type-change",a(this,at,Bt).call(this),s)},at=new WeakSet,Bt=function(){var s;return((s=e(this,o).mediaInfo)==null?void 0:s.streamType)===chrome.cast.media.StreamType.LIVE?e(this,o).canSeek?"live:dvr":"live":"on-demand"},rt=new WeakSet,Xt=function(){if(e(this,m))return;const t=e(this,o).currentTime;t!==e(this,b)&&(e(this,h).notify("time-change",t),t>e(this,v)&&(u(this,v,t),a(this,B,It).call(this)),e(this,h).$state.seeking()&&e(this,h).notify("seeked",t),u(this,b,t))},nt=new WeakSet,Kt=function(t){if(!e(this,o).isMediaLoaded||e(this,m))return;const s=e(this,o).duration,i=a(this,f,k).call(this,t);u(this,S,new L(0,s)),e(this,h).notify("duration-change",s,i)},q=new WeakSet,At=function(t){if(!e(this,o).isMediaLoaded)return;const s={muted:e(this,o).isMuted,volume:e(this,o).volumeLevel},i=a(this,f,k).call(this,t);e(this,h).notify("volume-change",s,i)},ot=new WeakSet,Yt=function(t){const s=a(this,f,k).call(this,t);e(this,o).isPaused?e(this,h).notify("pause",void 0,s):e(this,h).notify("play",void 0,s)},B=new WeakSet,It=function(t){const s={seekable:a(this,X,bt).call(this),buffered:new L(0,e(this,v))},i=t?a(this,f,k).call(this,t):void 0;e(this,h).notify("progress",s,i)},ht=new WeakSet,jt=function(t){const s=e(this,o).playerState,i=chrome.cast.media.PlayerState;if(u(this,w,s===i.IDLE),s===i.PAUSED)return;const n=a(this,f,k).call(this,t);switch(s){case i.PLAYING:e(this,h).notify("playing",void 0,n);break;case i.BUFFERING:e(this,h).notify("waiting",void 0,n);break;case i.IDLE:e(this,R).stop(),e(this,h).notify("pause"),e(this,h).notify("end");break}},X=new WeakSet,bt=function(){return e(this,o).liveSeekableRange?new L(e(this,o).liveSeekableRange.start,e(this,o).liveSeekableRange.end):e(this,S)},f=new WeakSet,k=function(t){return t instanceof Event?t:new Mt(t.type,{detail:t})},ct=new WeakSet,zt=function(t){const{streamType:s,title:i,poster:n}=e(this,h).$state;return new de(t).setMetadata(i(),n()).setStreamType(s()).setTracks(e(this,C).getLocalTextTracks()).build()},dt=new WeakSet,Jt=function(t){var l,d;const s=a(this,ct,zt).call(this,t),i=new chrome.cast.media.LoadRequest(s),n=e(this,h).$state.savedState();return i.autoplay=(((l=e(this,m))==null?void 0:l.paused)??(n==null?void 0:n.paused))===!1,i.currentTime=((d=e(this,m))==null?void 0:d.time)??(n==null?void 0:n.currentTime)??0,i},K=new WeakSet,Rt=async function(t,s){const i=ft(e(this,h).$state.source);u(this,m,{src:i,paused:t,time:s}),await this.loadSource(i)},ut=new WeakSet,Qt=function(){a(this,K,Rt).call(this,e(this,o).isPaused,e(this,o).currentTime).catch(t=>{})};export{ge as GoogleCastProvider};
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.