peertube-plugin-live-casting 0.0.0-stage → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
1
+ # PeerTube live casting
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Cast PeerTube live streams and on-demand videos to Chromecast and Apple TV
4
+ (AirPlay).
5
+
6
+ A fork of [kontrollanten's TV streaming plugin](https://framagit.org/kontrollanten/peertube-plugin-tv-streaming),
7
+ with added live stream casting support.
8
+
9
+ Tested on PeerTube **6.3.3**. May work on older versions, but these have not been
10
+ tested.
11
+
12
+ ## Installation
13
+
14
+ Install the plugin on your PeerTube instance and enable HLS for live streaming.
15
+ Leave **Chromecast receiver app id** blank unless you use a custom receiver.
16
+
17
+ ## Development
18
+
19
+ ```sh
20
+ yarn install --frozen-lockfile
21
+ npm test
22
+ npm run build
23
+ ```
@@ -0,0 +1,181 @@
1
+ import './style.scss'
2
+
3
+ const registerChromecastPlugin = require('@silvermine/videojs-chromecast')
4
+ const registerAirplayPlugin = require('@silvermine/videojs-airplay')
5
+
6
+ const GCAST_SCRIPT_STATUSES = {
7
+ NOT_INITIATED: 0,
8
+ INITIATED: 1,
9
+ AVAILABLE: 2,
10
+ NOT_AVAILABLE: 3,
11
+ }
12
+ let gcastScriptStatus = GCAST_SCRIPT_STATUSES.NOT_INITIATED
13
+
14
+ const isHlsSource = source => typeof source === 'string' && /\.m3u8(?:[?#]|$)/i.test(source)
15
+ const isMp4Source = source => typeof source === 'string' && /\.mp4(?:[?#]|$)/i.test(source)
16
+
17
+ function registerChromecastSeekingCompatibility (videojs) {
18
+ const ChromecastTech = videojs?.getTech?.('Chromecast')
19
+
20
+ if (!ChromecastTech || typeof ChromecastTech.prototype.seeking === 'function') return
21
+
22
+ class PeerTubeChromecastTech extends ChromecastTech {
23
+ seeking () {
24
+ // This tech exposes no seek-in-progress state; receiver buffering is not seeking.
25
+ return false
26
+ }
27
+ }
28
+
29
+ videojs.registerTech('chromecast', PeerTubeChromecastTech)
30
+ }
31
+
32
+ const waitForGcastScript = () => {
33
+ let tries = 0;
34
+
35
+ return new Promise((resolve, reject) => {
36
+ const timer = setInterval(() => {
37
+ if (gcastScriptStatus > GCAST_SCRIPT_STATUSES.INITIATED) {
38
+ resolve();
39
+ clearInterval(timer);
40
+ return;
41
+ }
42
+
43
+ tries++;
44
+
45
+ console.debug(`Waiting for gcastScriptExecuted`);
46
+
47
+ if (tries > 25) {
48
+ reject();
49
+ clearInterval(timer);
50
+ }
51
+ }, 100);
52
+ });
53
+ };
54
+
55
+ function register ({
56
+ registerHook,
57
+ peertubeHelpers,
58
+ }) {
59
+ let mediaSource
60
+ let isLive = false
61
+
62
+ registerHook({
63
+ target: 'action:video-watch.video.loaded',
64
+ handler: async ({ videojs, video }) => {
65
+ const files = Array.isArray(video?.files) ? video.files : []
66
+ const playlists = Array.isArray(video?.streamingPlaylists) ? video.streamingPlaylists : []
67
+ const hlsPlaylist = playlists.find(playlist => isHlsSource(playlist?.playlistUrl))
68
+
69
+ // HLS-only VODs also have no static files, so prefer explicit live metadata.
70
+ isLive = !!hlsPlaylist && (video?.isLive === true || (video?.isLive == null && files.length === 0))
71
+ mediaSource = isLive
72
+ ? hlsPlaylist.playlistUrl
73
+ : files.find(file => isMp4Source(file?.fileUrl))?.fileUrl
74
+
75
+ if (gcastScriptStatus > GCAST_SCRIPT_STATUSES.NOT_INITIATED) return;
76
+
77
+ if (window.WebKitPlaybackTargetAvailabilityEvent) {
78
+ registerAirplayPlugin(videojs)
79
+ }
80
+
81
+ window['__onGCastApiAvailable'] = (isAvailable) => {
82
+ gcastScriptStatus = isAvailable ? GCAST_SCRIPT_STATUSES.AVAILABLE : GCAST_SCRIPT_STATUSES.NOT_AVAILABLE
83
+
84
+ if (isAvailable) {
85
+ registerChromecastPlugin(videojs, { preloadWebComponents: true })
86
+ registerChromecastSeekingCompatibility(videojs)
87
+ }
88
+ };
89
+
90
+ const script = document.createElement('script')
91
+ script.src = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'
92
+
93
+ gcastScriptStatus = GCAST_SCRIPT_STATUSES.INITIATED
94
+ document.body.appendChild(script)
95
+ },
96
+ })
97
+
98
+ registerHook({
99
+ target: 'filter:internal.player.videojs.options.result',
100
+ handler: opts => {
101
+ return peertubeHelpers.getSettings()
102
+ .then(async (settings) => {
103
+ await waitForGcastScript();
104
+
105
+ return settings;
106
+ })
107
+ .then((settings) => Promise.all([settings, opts])) // Fix PT v5 bug https://github.com/Chocobozzz/PeerTube/pull/5551
108
+ .then(([settings, options]) => {
109
+ if (gcastScriptStatus === GCAST_SCRIPT_STATUSES.AVAILABLE) {
110
+ return Object.assign(
111
+ {},
112
+ options,
113
+ {
114
+ chromecast: {
115
+ modifyLoadRequestFn: function (loadRequest) {
116
+ const media = loadRequest.media;
117
+ // Lives never play MP4, so an MP4 source means the live state is stale.
118
+ const live = isLive && !isMp4Source(media.contentId);
119
+ // Preserve the selected MP4 rendition when casting a VOD.
120
+ if (mediaSource && !isMp4Source(media.contentId)) {
121
+ media.contentId = mediaSource;
122
+ }
123
+
124
+ if (isHlsSource(media.contentId)) {
125
+ media.contentType = 'application/x-mpegURL';
126
+ // PeerTube uses MPEG-TS for live HLS and fMP4 for HLS VOD.
127
+ media.hlsSegmentFormat = live ? 'ts' : 'fmp4';
128
+ media.hlsVideoSegmentFormat = live ? 'mpeg2_ts' : 'fmp4';
129
+ } else if (isMp4Source(media.contentId)) {
130
+ media.contentType = 'video/mp4';
131
+ }
132
+
133
+ if (live) {
134
+ media.streamType = window.chrome.cast.media.StreamType.LIVE;
135
+ delete media.duration;
136
+ delete loadRequest.currentTime;
137
+ }
138
+ return loadRequest;
139
+ }
140
+ },
141
+ plugins: Object.assign(
142
+ {},
143
+ options.plugins,
144
+ {
145
+ chromecast: {
146
+ receiverAppID: settings['chromecast-receiver-app-id'] || undefined,
147
+ },
148
+ },
149
+ window.WebKitPlaybackTargetAvailabilityEvent ? { airPlay: {} } : {}
150
+ ),
151
+ techOrder: ['chromecast', 'html5'],
152
+ }
153
+ );
154
+ }
155
+
156
+ if (window.WebKitPlaybackTargetAvailabilityEvent) {
157
+ return Object.assign(
158
+ {},
159
+ options,
160
+ {
161
+ plugins: Object.assign(
162
+ {},
163
+ options.plugins,
164
+ {
165
+ airPlay: {},
166
+ }
167
+ ),
168
+ }
169
+ );
170
+ }
171
+
172
+ return options;
173
+ });
174
+
175
+ }
176
+ })
177
+ }
178
+
179
+ export {
180
+ register
181
+ }
@@ -0,0 +1,25 @@
1
+ function attachMediaSessionListener (tech, castSession, eventType) {
2
+ const attach = () => {
3
+ const mediaSession = tech._getMediaSession()
4
+ if (!mediaSession) return false
5
+
6
+ mediaSession.addUpdateListener(tech._onMediaSessionStatusChanged.bind(tech))
7
+ return true
8
+ }
9
+
10
+ if (attach()) return
11
+
12
+ const onMediaSession = () => {
13
+ if (!attach()) return
14
+
15
+ const listener = tech._eventListeners.find(listener =>
16
+ listener.target === castSession && listener.callback === onMediaSession
17
+ )
18
+ tech._removeEventListener(listener)
19
+ }
20
+
21
+ // The Cast SDK can publish the media session after loadMedia resolves.
22
+ tech._addEventListener(castSession, eventType, onMediaSession, tech)
23
+ }
24
+
25
+ module.exports = { attachMediaSessionListener }
@@ -0,0 +1,23 @@
1
+ @use "@silvermine/videojs-airplay/src/scss/videojs-airplay.scss" with (
2
+ $icon-airplay--default: '@silvermine/videojs-airplay/src/images/ic_airplay_white_24px.svg',
3
+ $icon-airplay--hover: '@silvermine/videojs-airplay/src/images/ic_airplay_white_24px.svg',
4
+ $airplay-icon-size: 22px
5
+ );
6
+
7
+ @use '@silvermine/videojs-chromecast/src/scss/videojs-chromecast.scss' with (
8
+ $icon-chromecast--default: '@silvermine/videojs-chromecast/src/images/ic_cast_white_24dp.png',
9
+ $icon-chromecast--hover: '@silvermine/videojs-chromecast/src/images/ic_cast_white_24dp.png',
10
+ $chromecast-icon-size: 22px,
11
+ $icon-chromecast-casting: '@silvermine/videojs-chromecast/src/images/ic_cast_connected_white_24dp.png',
12
+ $icon-chromecast-casting--hover: '@silvermine/videojs-chromecast/src/images/ic_cast_connected_white_24dp.png'
13
+ );
14
+
15
+ .video-js .vjs-control-bar .vjs-airplay-button,
16
+ .video-js .vjs-control-bar .vjs-chromecast-button {
17
+ width: 47px;
18
+ }
19
+
20
+ .video-js .vjs-control-bar .vjs-airplay-button .vjs-icon-placeholder,
21
+ .video-js .vjs-control-bar .vjs-chromecast-button .vjs-icon-placeholder {
22
+ display: inline-block;
23
+ }
@@ -0,0 +1 @@
1
+ .vjs-airplay-button .vjs-icon-placeholder{background:url('data:image/svg+xml,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">%0A <defs>%0A <path d="M0 0h24v24H0V0z" id="a"/>%0A </defs>%0A <defs>%0A <path d="M0 0h24v24H0V0z" id="c"/>%0A </defs>%0A <clipPath id="b">%0A <use overflow="visible" xlink:href="%23a"/>%0A </clipPath>%0A <clipPath clip-path="url(%23b)" id="d">%0A <use overflow="visible" xlink:href="%23c"/>%0A </clipPath>%0A <path clip-path="url(%23d)" d="M6 22h12l-6-6zM21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v-2H3V5h18v12h-4v2h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>%0A</svg>%0A') center center no-repeat;background-size:contain;display:inline-block;width:22px;height:22px}.vjs-airplay-button:hover{cursor:pointer}.vjs-airplay-button:hover .vjs-icon-placeholder{background-image:url('data:image/svg+xml,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">%0A <defs>%0A <path d="M0 0h24v24H0V0z" id="a"/>%0A </defs>%0A <defs>%0A <path d="M0 0h24v24H0V0z" id="c"/>%0A </defs>%0A <clipPath id="b">%0A <use overflow="visible" xlink:href="%23a"/>%0A </clipPath>%0A <clipPath clip-path="url(%23b)" id="d">%0A <use overflow="visible" xlink:href="%23c"/>%0A </clipPath>%0A <path clip-path="url(%23d)" d="M6 22h12l-6-6zM21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v-2H3V5h18v12h-4v2h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>%0A</svg>%0A')}.vjs-airplay-button.vjs-airplay-button-lg:not(.vjs-hidden){display:flex;align-items:center;width:auto;padding:0 4px}.vjs-airplay-button.vjs-airplay-button-lg:not(.vjs-hidden) .vjs-airplay-button-label{flex-grow:1;margin-left:4px}.vjs-airplay-button.vjs-airplay-button-lg:not(.vjs-hidden) .vjs-icon-placeholder{flex-grow:1}.vjs-chromecast-button .vjs-icon-placeholder{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAvJJREFUaAXtmTtoFFEUhrMhpRZipQELBQsbwUoEQYPaWFhpYSloJ1bai502tqnVRojYWPlA1CKCjWUKLYRsGmOKdKKs3xnmzpz57+xjdMaZhTnw79zzuOdx79zH7i4s9NSPQD8C/Qh0ZgRGo9EyeAKGoGu0SUKW27IfsEFgUsVn+P1B1tHnNnkdHwwGm5bfokvyAe2uJ2/pWo73rWHkZ2AIfyCRdv9jixk4aGn6AkY+bwwynZe31bYF6WOH/Pwr5PVz0+4LaHuq+hloewaWQgJhVQd+Xp79K9T2TM39DGRrgINul9G060TAV9ovwEfWR+EURNY9sqN6DG0hXwXn2sxac4tyUYMx/DvkJ6PO/0Gg+UQh1WAKv4b+cOSkQYHmE0JlN04M9iK067RdUw+B8+Ai2AfKaAfhFdbHqzJl3TIrwPuc6dyizxJYAc9AGf1CeNM7bqqtwSvHwcEp8EEdpfzDyg4rdtC4Fbvn5ji6BWzklRqdCQ2WZ5S2MNgFG+ANuAtOREa57QX0O8CTFdXYVusDWTvKTQ1S3gq6HBkjQH4MaBE/kDWyO+G3QFFOBW3MrCOKEkNmM6Gv01rkvAaBphS5VIMS/juyM9oRma0JpdoPOw2gedgrsQccBVfBU/ATKJmsrAjdnd5HAf5RoIlMdUeHI6Bs/7eZKLxO8LbFKtW6oNX51AKCAR1vg9/iYD3owxO9FrsadHU8JX68C00KQmcrQqmwO6E8KwZ2i82uKpP8z6IT33EBGNg5YLvNDRAFRqYjvOEDo7drh22jnmpbzN6ptX3spC0Gr+ELv5PC25rQhV047NA/Ap7uRYH+UuCdWju4WQwNea7AP8Yumwluf1+QPRe7S8K/FL6w2E2niczKi1/71pjQuAJMaUVcT6zyDy3gdK5KWt+ET35BFlkd7NvgZFIBZnMtGKbPT8IX/i1Bl41MatdEAdv4viN5jJ1a+6KfEdNth52nSnpz5DtXbA+xj/5iypLrG/0I9CPQj0ArI/AHixCE2UoSwqgAAAAASUVORK5CYII=) center center no-repeat;background-size:contain;display:inline-block;width:22px;height:22px}.vjs-chromecast-button:hover{cursor:pointer}.vjs-chromecast-button:hover .vjs-icon-placeholder{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAvJJREFUaAXtmTtoFFEUhrMhpRZipQELBQsbwUoEQYPaWFhpYSloJ1bai502tqnVRojYWPlA1CKCjWUKLYRsGmOKdKKs3xnmzpz57+xjdMaZhTnw79zzuOdx79zH7i4s9NSPQD8C/Qh0ZgRGo9EyeAKGoGu0SUKW27IfsEFgUsVn+P1B1tHnNnkdHwwGm5bfokvyAe2uJ2/pWo73rWHkZ2AIfyCRdv9jixk4aGn6AkY+bwwynZe31bYF6WOH/Pwr5PVz0+4LaHuq+hloewaWQgJhVQd+Xp79K9T2TM39DGRrgINul9G060TAV9ovwEfWR+EURNY9sqN6DG0hXwXn2sxac4tyUYMx/DvkJ6PO/0Gg+UQh1WAKv4b+cOSkQYHmE0JlN04M9iK067RdUw+B8+Ai2AfKaAfhFdbHqzJl3TIrwPuc6dyizxJYAc9AGf1CeNM7bqqtwSvHwcEp8EEdpfzDyg4rdtC4Fbvn5ji6BWzklRqdCQ2WZ5S2MNgFG+ANuAtOREa57QX0O8CTFdXYVusDWTvKTQ1S3gq6HBkjQH4MaBE/kDWyO+G3QFFOBW3MrCOKEkNmM6Gv01rkvAaBphS5VIMS/juyM9oRma0JpdoPOw2gedgrsQccBVfBU/ATKJmsrAjdnd5HAf5RoIlMdUeHI6Bs/7eZKLxO8LbFKtW6oNX51AKCAR1vg9/iYD3owxO9FrsadHU8JX68C00KQmcrQqmwO6E8KwZ2i82uKpP8z6IT33EBGNg5YLvNDRAFRqYjvOEDo7drh22jnmpbzN6ptX3spC0Gr+ELv5PC25rQhV047NA/Ap7uRYH+UuCdWju4WQwNea7AP8Yumwluf1+QPRe7S8K/FL6w2E2niczKi1/71pjQuAJMaUVcT6zyDy3gdK5KWt+ET35BFlkd7NvgZFIBZnMtGKbPT8IX/i1Bl41MatdEAdv4viN5jJ1a+6KfEdNth52nSnpz5DtXbA+xj/5iypLrG/0I9CPQj0ArI/AHixCE2UoSwqgAAAAASUVORK5CYII=)}.vjs-chromecast-button.vjs-chromecast-casting-state .vjs-icon-placeholder{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA49JREFUaAXtmTtoFFEUhrMhVtFCBEEDFgoWNqIgaCAQg9pYWGlhKWgnNkaxDHba2KZWGyFiI0J8ohZRbOwMqIWQpDGmSCfK+p1x7+y5/8zuzmQ3yQbmwL9z3vfc59zdHRioqBqBagSqEeibEajX6yPgIVgE/UYLFGS1jfgBqwWhYfiMvCvo+vS5TF2Ha7XagtU36Iq8C9/vxVu5VuMdY4z8DCwi70m0/f+xxAzstTJ9B+q+bhxSm9dvFm8b0rcd6vNLyNu3DF91YLOnaqhoAboGi8at1S+s8U7xW34JpTNQtMedRmSj7WVmYJLi5je6wJ63x14YA89sT6wnaeHaltpLyyQ8CT5q4l7JWpDmDfb0bYvDKkq7TgR8h38KPrA/orcguoSIsSV4E0yBbYmyRx+6J60DPrXaB8yhBS2hnwanfALPYzsCvoKekc9vvCZWe8ZBAxryW57HM8H/G9iNrWdLStvQetRetAMhzwzMfk2CbhjMBqdunjm5o3TB7vfADpR2nbZr6j5wGpwFO0EeraC8wFp84Y20Moz8Ghzz+rK8rnGr3udQu7elPDFDYAI8Bnn0B+XVNKDBoLPl1NWeyMkZta/2jjLRo+B9lKUp3NMEmGxj/266lONy8kUJ1F5YJss1YCOvlDcTt9SpqKwFaZzabROvgnnwCkyBoxmnhgLbGbACPFmnoqMWeRCs6WTStn1Dxqu91SlkHTqfcUaB/hDQTvxCF51OyPbGLk3apiZQe6sOhLg5mKgwS4DOZkKX04wmx6f03SknB2mapPZOHbDIn2BcA9HZnlA64f0w2gWwFPl44zVY7eawHRwEF8EjkHeCmG5cg9Hp6fQux+cLfoUpJz6KVXtGxvsAyDv/bSai5YQ8CpR0Q19Xh3ayFqS+am8pEzgJ/kqCOQ3Arp2dVp9uZGk/ewq1S06wdUIpOp0w6mljt9j0qtIufxGbNp6JwcHeA3baXAGZhtHpCEdfL7HbtcOOUU+5N9dM4wUUPqnxmRBxeIlsF7uUkG1P6MaOXnbY7wNPt9MEXTI+qfEh3WBg5DmB/AC/dCa4/X1D90T8zon8XORos5tNCykqS1771phQqw6Y0TpxOfFqfmgHxpqmhPshcvILsuh6Ib4JSdp1wHwuBcfG85PI0b8l2NKRafitRweWyX1D6mg5tfZFPyWm2152nkrZLZEPLskv4p/5iyktrmKqEahGoBqBTRmBfwb8WzXqcsYyAAAAAElFTkSuQmCC)}.vjs-chromecast-button.vjs-chromecast-casting-state:hover .vjs-icon-placeholder{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA49JREFUaAXtmTtoFFEUhrMhVtFCBEEDFgoWNqIgaCAQg9pYWGlhKWgnNkaxDHba2KZWGyFiI0J8ohZRbOwMqIWQpDGmSCfK+p1x7+y5/8zuzmQ3yQbmwL9z3vfc59zdHRioqBqBagSqEeibEajX6yPgIVgE/UYLFGS1jfgBqwWhYfiMvCvo+vS5TF2Ha7XagtU36Iq8C9/vxVu5VuMdY4z8DCwi70m0/f+xxAzstTJ9B+q+bhxSm9dvFm8b0rcd6vNLyNu3DF91YLOnaqhoAboGi8at1S+s8U7xW34JpTNQtMedRmSj7WVmYJLi5je6wJ63x14YA89sT6wnaeHaltpLyyQ8CT5q4l7JWpDmDfb0bYvDKkq7TgR8h38KPrA/orcguoSIsSV4E0yBbYmyRx+6J60DPrXaB8yhBS2hnwanfALPYzsCvoKekc9vvCZWe8ZBAxryW57HM8H/G9iNrWdLStvQetRetAMhzwzMfk2CbhjMBqdunjm5o3TB7vfADpR2nbZr6j5wGpwFO0EeraC8wFp84Y20Moz8Ghzz+rK8rnGr3udQu7elPDFDYAI8Bnn0B+XVNKDBoLPl1NWeyMkZta/2jjLRo+B9lKUp3NMEmGxj/266lONy8kUJ1F5YJss1YCOvlDcTt9SpqKwFaZzabROvgnnwCkyBoxmnhgLbGbACPFmnoqMWeRCs6WTStn1Dxqu91SlkHTqfcUaB/hDQTvxCF51OyPbGLk3apiZQe6sOhLg5mKgwS4DOZkKX04wmx6f03SknB2mapPZOHbDIn2BcA9HZnlA64f0w2gWwFPl44zVY7eawHRwEF8EjkHeCmG5cg9Hp6fQux+cLfoUpJz6KVXtGxvsAyDv/bSai5YQ8CpR0Q19Xh3ayFqS+am8pEzgJ/kqCOQ3Arp2dVp9uZGk/ewq1S06wdUIpOp0w6mljt9j0qtIufxGbNp6JwcHeA3baXAGZhtHpCEdfL7HbtcOOUU+5N9dM4wUUPqnxmRBxeIlsF7uUkG1P6MaOXnbY7wNPt9MEXTI+qfEh3WBg5DmB/AC/dCa4/X1D90T8zon8XORos5tNCykqS1771phQqw6Y0TpxOfFqfmgHxpqmhPshcvILsuh6Ib4JSdp1wHwuBcfG85PI0b8l2NKRafitRweWyX1D6mg5tfZFPyWm2152nkrZLZEPLskv4p/5iyktrmKqEahGoBqBTRmBfwb8WzXqcsYyAAAAAElFTkSuQmCC)}.vjs-chromecast-button.vjs-chromecast-button-lg:not(.vjs-hidden){display:flex;align-items:center;width:auto;padding:0 4px}.vjs-chromecast-button.vjs-chromecast-button-lg:not(.vjs-hidden) .vjs-chromecast-button-label{flex-grow:1;margin-left:4px}.vjs-chromecast-button.vjs-chromecast-button-lg:not(.vjs-hidden) .vjs-icon-placeholder{flex-grow:1}.vjs-tech-chromecast{display:flex;flex-direction:column;justify-content:center;align-items:center;overflow:hidden}.vjs-tech-chromecast .vjs-tech-chromecast-poster:after{content:" ";display:block;height:2px;width:100px;background-color:#ccc;position:absolute;left:calc(50% - 50px)}.vjs-tech-chromecast .vjs-tech-chromecast-poster-img{max-height:180px;width:auto;border:2px solid #cccccc}.vjs-tech-chromecast .vjs-tech-chromecast-poster-img.vjs-tech-chromecast-poster-img-empty{width:160px;height:90px}.vjs-tech-chromecast .vjs-tech-chromecast-title-container{position:absolute;bottom:50%;margin-bottom:100px;color:#ccc;text-align:center}.vjs-tech-chromecast .vjs-tech-chromecast-title{font-size:22px}.vjs-tech-chromecast .vjs-tech-chromecast-title.vjs-tech-chromecast-title-empty{display:none}.vjs-tech-chromecast .vjs-tech-chromecast-subtitle{font-size:18px;padding-top:.5em}.vjs-tech-chromecast .vjs-tech-chromecast-subtitle.vjs-tech-chromecast-subtitle-empty{display:none}.video-js .vjs-control-bar .vjs-airplay-button,.video-js .vjs-control-bar .vjs-chromecast-button{width:47px}.video-js .vjs-control-bar .vjs-airplay-button .vjs-icon-placeholder,.video-js .vjs-control-bar .vjs-chromecast-button .vjs-icon-placeholder{display:inline-block}
@@ -0,0 +1,14 @@
1
+ var Ee=Object.defineProperty;var Ce=(t,i,a)=>i in t?Ee(t,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[i]=a;var x=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var K=(t,i,a)=>(Ce(t,typeof i!="symbol"?i+"":i,a),a);var Y=x(()=>{(function(){window.WebComponents=window.WebComponents||{flags:{}};var t="webcomponents-lite.js",i=document.querySelector('script[src*="'+t+'"]'),a={};if(!a.noOpts){if(location.search.slice(1).split("&").forEach(function(h){var l=h.split("="),u;l[0]&&(u=l[0].match(/wc-(.+)/))&&(a[u[1]]=l[1]||!0)}),i)for(var o=0,n;n=i.attributes[o];o++)n.name!=="src"&&(a[n.name]=n.value||!0);if(a.log&&a.log.split){var r=a.log.split(",");a.log={},r.forEach(function(h){a.log[h]=!0})}else a.log={}}a.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=a.register),WebComponents.flags=a})();(function(t){"use strict";var i=!1;if(!t.forceJURL)try{var a=new URL("b","http://a");a.pathname="c%20d",i=a.href==="http://a/c%20d"}catch(f){}if(i)return;var o=Object.create(null);o.ftp=21,o.file=0,o.gopher=70,o.http=80,o.https=443,o.ws=80,o.wss=443;var n=Object.create(null);n["%2e"]=".",n[".%2e"]="..",n["%2e."]="..",n["%2e%2e"]="..";function r(f){return o[f]!==void 0}function h(){m.call(this),this._isInvalid=!0}function l(f){return f==""&&h.call(this),f.toLowerCase()}function u(f){var T=f.charCodeAt(0);return T>32&&T<127&&[34,35,60,62,63,96].indexOf(T)==-1?f:encodeURIComponent(f)}function _(f){var T=f.charCodeAt(0);return T>32&&T<127&&[34,35,60,62,96].indexOf(T)==-1?f:encodeURIComponent(f)}var E=void 0,S=/[a-zA-Z]/,D=/[a-zA-Z0-9\+\-\.]/;function s(f,T,p){function L(O){c.push(O)}var I=T||"scheme start",M=0,C="",d=!1,v=!1,c=[];e:for(;(f[M-1]!=E||M==0)&&!this._isInvalid;){var e=f[M];switch(I){case"scheme start":if(e&&S.test(e))C+=e.toLowerCase(),I="scheme";else if(T){L("Invalid scheme.");break e}else{C="",I="no scheme";continue}break;case"scheme":if(e&&D.test(e))C+=e.toLowerCase();else if(e==":"){if(this._scheme=C,C="",T)break e;r(this._scheme)&&(this._isRelative=!0),this._scheme=="file"?I="relative":this._isRelative&&p&&p._scheme==this._scheme?I="relative or authority":this._isRelative?I="authority first slash":I="scheme data"}else if(T){if(E==e)break e;L("Code point not allowed in scheme: "+e);break e}else{C="",M=0,I="no scheme";continue}break;case"scheme data":e=="?"?(this._query="?",I="query"):e=="#"?(this._fragment="#",I="fragment"):E!=e&&e!=" "&&e!="\n"&&e!="\r"&&(this._schemeData+=u(e));break;case"no scheme":if(!p||!r(p._scheme))L("Missing scheme."),h.call(this);else{I="relative";continue}break;case"relative or authority":if(e=="/"&&f[M+1]=="/")I="authority ignore slashes";else{L("Expected /, got: "+e),I="relative";continue}break;case"relative":if(this._isRelative=!0,this._scheme!="file"&&(this._scheme=p._scheme),E==e){this._host=p._host,this._port=p._port,this._path=p._path.slice(),this._query=p._query,this._username=p._username,this._password=p._password;break e}else if(e=="/"||e=="\\")e=="\\"&&L("\\ is an invalid code point."),I="relative slash";else if(e=="?")this._host=p._host,this._port=p._port,this._path=p._path.slice(),this._query="?",this._username=p._username,this._password=p._password,I="query";else if(e=="#")this._host=p._host,this._port=p._port,this._path=p._path.slice(),this._query=p._query,this._fragment="#",this._username=p._username,this._password=p._password,I="fragment";else{var b=f[M+1],w=f[M+2];(this._scheme!="file"||!S.test(e)||b!=":"&&b!="|"||E!=w&&w!="/"&&w!="\\"&&w!="?"&&w!="#")&&(this._host=p._host,this._port=p._port,this._username=p._username,this._password=p._password,this._path=p._path.slice(),this._path.pop()),I="relative path";continue}break;case"relative slash":if(e=="/"||e=="\\")e=="\\"&&L("\\ is an invalid code point."),this._scheme=="file"?I="file host":I="authority ignore slashes";else{this._scheme!="file"&&(this._host=p._host,this._port=p._port,this._username=p._username,this._password=p._password),I="relative path";continue}break;case"authority first slash":if(e=="/")I="authority second slash";else{L("Expected '/', got: "+e),I="authority ignore slashes";continue}break;case"authority second slash":if(I="authority ignore slashes",e!="/"){L("Expected '/', got: "+e);continue}break;case"authority ignore slashes":if(e!="/"&&e!="\\"){I="authority";continue}else L("Expected authority, got: "+e);break;case"authority":if(e=="@"){d&&(L("@ already seen."),C+="%40"),d=!0;for(var P=0;P<C.length;P++){var A=C[P];if(A==" "||A=="\n"||A=="\r"){L("Invalid whitespace in authority.");continue}if(A==":"&&this._password===null){this._password="";continue}var R=u(A);this._password!==null?this._password+=R:this._username+=R}C=""}else if(E==e||e=="/"||e=="\\"||e=="?"||e=="#"){M-=C.length,C="",I="host";continue}else C+=e;break;case"file host":if(E==e||e=="/"||e=="\\"||e=="?"||e=="#"){C.length==2&&S.test(C[0])&&(C[1]==":"||C[1]=="|")?I="relative path":(C.length==0||(this._host=l.call(this,C),C=""),I="relative path start");continue}else e==" "||e=="\n"||e=="\r"?L("Invalid whitespace in file host."):C+=e;break;case"host":case"hostname":if(e==":"&&!v){if(this._host=l.call(this,C),C="",I="port",T=="hostname")break e}else if(E==e||e=="/"||e=="\\"||e=="?"||e=="#"){if(this._host=l.call(this,C),C="",I="relative path start",T)break e;continue}else e!=" "&&e!="\n"&&e!="\r"?(e=="["?v=!0:e=="]"&&(v=!1),C+=e):L("Invalid code point in host/hostname: "+e);break;case"port":if(/[0-9]/.test(e))C+=e;else if(E==e||e=="/"||e=="\\"||e=="?"||e=="#"||T){if(C!=""){var k=parseInt(C,10);k!=o[this._scheme]&&(this._port=k+""),C=""}if(T)break e;I="relative path start";continue}else e==" "||e=="\n"||e=="\r"?L("Invalid code point in port: "+e):h.call(this);break;case"relative path start":if(e=="\\"&&L("'\\' not allowed in path."),I="relative path",e!="/"&&e!="\\")continue;break;case"relative path":if(E==e||e=="/"||e=="\\"||!T&&(e=="?"||e=="#")){e=="\\"&&L("\\ not allowed in relative path.");var N;(N=n[C.toLowerCase()])&&(C=N),C==".."?(this._path.pop(),e!="/"&&e!="\\"&&this._path.push("")):C=="."&&e!="/"&&e!="\\"?this._path.push(""):C!="."&&(this._scheme=="file"&&this._path.length==0&&C.length==2&&S.test(C[0])&&C[1]=="|"&&(C=C[0]+":"),this._path.push(C)),C="",e=="?"?(this._query="?",I="query"):e=="#"&&(this._fragment="#",I="fragment")}else e!=" "&&e!="\n"&&e!="\r"&&(C+=u(e));break;case"query":!T&&e=="#"?(this._fragment="#",I="fragment"):E!=e&&e!=" "&&e!="\n"&&e!="\r"&&(this._query+=_(e));break;case"fragment":E!=e&&e!=" "&&e!="\n"&&e!="\r"&&(this._fragment+=e);break}M++}}function m(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function y(f,T){T!==void 0&&!(T instanceof y)&&(T=new y(String(T))),this._url=f,m.call(this);var p=f.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");s.call(this,p,null,T)}y.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var f="";return(this._username!=""||this._password!=null)&&(f=this._username+(this._password!=null?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+f+this.host:"")+this.pathname+this._query+this._fragment},set href(f){m.call(this),s.call(this,f)},get protocol(){return this._scheme+":"},set protocol(f){this._isInvalid||s.call(this,f+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(f){this._isInvalid||!this._isRelative||s.call(this,f,"host")},get hostname(){return this._host},set hostname(f){this._isInvalid||!this._isRelative||s.call(this,f,"hostname")},get port(){return this._port},set port(f){this._isInvalid||!this._isRelative||s.call(this,f,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(f){this._isInvalid||!this._isRelative||(this._path=[],s.call(this,f,"relative path start"))},get search(){return this._isInvalid||!this._query||this._query=="?"?"":this._query},set search(f){this._isInvalid||!this._isRelative||(this._query="?",f[0]=="?"&&(f=f.slice(1)),s.call(this,f,"query"))},get hash(){return this._isInvalid||!this._fragment||this._fragment=="#"?"":this._fragment},set hash(f){this._isInvalid||(this._fragment="#",f[0]=="#"&&(f=f.slice(1)),s.call(this,f,"fragment"))},get origin(){var f;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return f=this.host,f?this._scheme+"://"+f:""}};var g=t.URL;g&&(y.createObjectURL=function(f){return g.createObjectURL.apply(g,arguments)},y.revokeObjectURL=function(f){g.revokeObjectURL(f)}),t.URL=y})(self);typeof WeakMap>"u"&&function(){var t=Object.defineProperty,i=Date.now()%1e9,a=function(){this.name="__st"+(Math.random()*1e9>>>0)+(i+++"__")};a.prototype={set:function(o,n){var r=o[this.name];return r&&r[0]===o?r[1]=n:t(o,this.name,{value:[o,n],writable:!0}),this},get:function(o){var n;return(n=o[this.name])&&n[0]===o?n[1]:void 0},delete:function(o){var n=o[this.name];return!n||n[0]!==o?!1:(n[0]=n[1]=void 0,!0)},has:function(o){var n=o[this.name];return n?n[0]===o:!1}},window.WeakMap=a}();(function(t){if(t.JsMutationObserver)return;var i=new WeakMap,a;if(/Trident|Edge/.test(navigator.userAgent))a=setTimeout;else if(window.setImmediate)a=window.setImmediate;else{var o=[],n=String(Math.random());window.addEventListener("message",function(d){if(d.data===n){var v=o;o=[],v.forEach(function(c){c()})}}),a=function(d){o.push(d),window.postMessage(n,"*")}}var r=!1,h=[];function l(d){h.push(d),r||(r=!0,a(_))}function u(d){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(d)||d}function _(){r=!1;var d=h;h=[],d.sort(function(c,e){return c.uid_-e.uid_});var v=!1;d.forEach(function(c){var e=c.takeRecords();E(c),e.length&&(c.callback_(e,c),v=!0)}),v&&_()}function E(d){d.nodes_.forEach(function(v){var c=i.get(v);c&&c.forEach(function(e){e.observer===d&&e.removeTransientObservers()})})}function S(d,v){for(var c=d;c;c=c.parentNode){var e=i.get(c);if(e)for(var b=0;b<e.length;b++){var w=e[b],P=w.options;if(!(c!==d&&!P.subtree)){var A=v(P);A&&w.enqueue(A)}}}}var D=0;function s(d){this.callback_=d,this.nodes_=[],this.records_=[],this.uid_=++D}s.prototype={observe:function(d,v){if(d=u(d),!v.childList&&!v.attributes&&!v.characterData||v.attributeOldValue&&!v.attributes||v.attributeFilter&&v.attributeFilter.length&&!v.attributes||v.characterDataOldValue&&!v.characterData)throw new SyntaxError;var c=i.get(d);c||i.set(d,c=[]);for(var e,b=0;b<c.length;b++)if(c[b].observer===this){e=c[b],e.removeListeners(),e.options=v;break}e||(e=new C(this,d,v),c.push(e),this.nodes_.push(d)),e.addListeners()},disconnect:function(){this.nodes_.forEach(function(d){for(var v=i.get(d),c=0;c<v.length;c++){var e=v[c];if(e.observer===this){e.removeListeners(),v.splice(c,1);break}}},this),this.records_=[]},takeRecords:function(){var d=this.records_;return this.records_=[],d}};function m(d,v){this.type=d,this.target=v,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function y(d){var v=new m(d.type,d.target);return v.addedNodes=d.addedNodes.slice(),v.removedNodes=d.removedNodes.slice(),v.previousSibling=d.previousSibling,v.nextSibling=d.nextSibling,v.attributeName=d.attributeName,v.attributeNamespace=d.attributeNamespace,v.oldValue=d.oldValue,v}var g,f;function T(d,v){return g=new m(d,v)}function p(d){return f||(f=y(g),f.oldValue=d,f)}function L(){g=f=void 0}function I(d){return d===f||d===g}function M(d,v){return d===v?d:f&&I(d)?f:null}function C(d,v,c){this.observer=d,this.target=v,this.options=c,this.transientObservedNodes=[]}C.prototype={enqueue:function(d){var v=this.observer.records_,c=v.length;if(v.length>0){var e=v[c-1],b=M(e,d);if(b){v[c-1]=b;return}}else l(this.observer);v[c]=d},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(d){var v=this.options;v.attributes&&d.addEventListener("DOMAttrModified",this,!0),v.characterData&&d.addEventListener("DOMCharacterDataModified",this,!0),v.childList&&d.addEventListener("DOMNodeInserted",this,!0),(v.childList||v.subtree)&&d.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(d){var v=this.options;v.attributes&&d.removeEventListener("DOMAttrModified",this,!0),v.characterData&&d.removeEventListener("DOMCharacterDataModified",this,!0),v.childList&&d.removeEventListener("DOMNodeInserted",this,!0),(v.childList||v.subtree)&&d.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(d){if(d!==this.target){this.addListeners_(d),this.transientObservedNodes.push(d);var v=i.get(d);v||i.set(d,v=[]),v.push(this)}},removeTransientObservers:function(){var d=this.transientObservedNodes;this.transientObservedNodes=[],d.forEach(function(v){this.removeListeners_(v);for(var c=i.get(v),e=0;e<c.length;e++)if(c[e]===this){c.splice(e,1);break}},this)},handleEvent:function(d){switch(d.stopImmediatePropagation(),d.type){case"DOMAttrModified":var v=d.attrName,c=d.relatedNode.namespaceURI,e=d.target,N=new T("attributes",e);N.attributeName=v,N.attributeNamespace=c;var b=d.attrChange===MutationEvent.ADDITION?null:d.prevValue;S(e,function(O){if(O.attributes&&!(O.attributeFilter&&O.attributeFilter.length&&O.attributeFilter.indexOf(v)===-1&&O.attributeFilter.indexOf(c)===-1))return O.attributeOldValue?p(b):N});break;case"DOMCharacterDataModified":var e=d.target,N=T("characterData",e),b=d.prevValue;S(e,function(O){if(O.characterData)return O.characterDataOldValue?p(b):N});break;case"DOMNodeRemoved":this.addTransientObserver(d.target);case"DOMNodeInserted":var w=d.target,P,A;d.type==="DOMNodeInserted"?(P=[w],A=[]):(P=[],A=[w]);var R=w.previousSibling,k=w.nextSibling,N=T("childList",d.target.parentNode);N.addedNodes=P,N.removedNodes=A,N.previousSibling=R,N.nextSibling=k,S(d.relatedNode,function(O){if(O.childList)return N})}L()}},t.JsMutationObserver=s,t.MutationObserver||(t.MutationObserver=s,s._isPolyfilled=!0)})(self);(function(){var t=typeof HTMLTemplateElement>"u";/Trident/.test(navigator.userAgent)&&function(){var m=document.importNode;document.importNode=function(){var y=m.apply(document,arguments);if(y.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=document.createDocumentFragment();return g.appendChild(y),g}else return y}}();var i=function(){if(!t){var m=document.createElement("template"),y=document.createElement("template");y.content.appendChild(document.createElement("div")),m.content.appendChild(y);var g=m.cloneNode(!0);return g.content.childNodes.length===0||g.content.firstChild.content.childNodes.length===0}}(),a="template",o=function(){};if(t){let m=function(g){switch(g){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case"\xA0":return"&nbsp;"}},y=function(g){return g.replace(_,m)};var D=m,s=y,n=document.implementation.createHTMLDocument("template"),r=!0,h=document.createElement("style");h.textContent=a+"{display:none;}";var l=document.head;l.insertBefore(h,l.firstElementChild),o.prototype=Object.create(HTMLElement.prototype),o.decorate=function(g){if(!g.content){g.content=n.createDocumentFragment();for(var f;f=g.firstChild;)g.content.appendChild(f);if(g.cloneNode=function(T){return o.cloneNode(this,T)},r)try{Object.defineProperty(g,"innerHTML",{get:function(){for(var T="",p=this.content.firstChild;p;p=p.nextSibling)T+=p.outerHTML||y(p.data);return T},set:function(T){for(n.body.innerHTML=T,o.bootstrap(n);this.content.firstChild;)this.content.removeChild(this.content.firstChild);for(;n.body.firstChild;)this.content.appendChild(n.body.firstChild)},configurable:!0})}catch(T){r=!1}o.bootstrap(g.content)}},o.bootstrap=function(g){for(var f=g.querySelectorAll(a),T=0,p=f.length,L;T<p&&(L=f[T]);T++)o.decorate(L)},document.addEventListener("DOMContentLoaded",function(){o.bootstrap(document)});var u=document.createElement;document.createElement=function(){"use strict";var g=u.apply(document,arguments);return g.localName==="template"&&o.decorate(g),g};var _=/[&\u00A0<>]/g}if(t||i){var E=Node.prototype.cloneNode;o.cloneNode=function(m,y){var g=E.call(m,!1);return this.decorate&&this.decorate(g),y&&(g.content.appendChild(E.call(m.content,!0)),this.fixClonedDom(g.content,m.content)),g},o.fixClonedDom=function(m,y){if(y.querySelectorAll)for(var g=y.querySelectorAll(a),f=m.querySelectorAll(a),T=0,p=f.length,L,I;T<p;T++)I=g[T],L=f[T],this.decorate&&this.decorate(I),L.parentNode.replaceChild(I.cloneNode(!0),L)};var S=document.importNode;Node.prototype.cloneNode=function(m){var y=E.call(this,m);return m&&o.fixClonedDom(y,this),y},document.importNode=function(m,y){if(m.localName===a)return o.cloneNode(m,y);var g=S.call(document,m,y);return y&&o.fixClonedDom(g,m),g},i&&(HTMLTemplateElement.prototype.cloneNode=function(m){return o.cloneNode(this,m)})}t&&(window.HTMLTemplateElement=o)})();(function(t){"use strict";if(!(window.performance&&window.performance.now)){var i=Date.now();window.performance={now:function(){return Date.now()-i}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var h=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return h?function(l){return h(function(){l(performance.now())})}:function(l){return window.setTimeout(l,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(h){clearTimeout(h)}}());var a=function(){var h=document.createEvent("Event");return h.initEvent("foo",!0,!0),h.preventDefault(),h.defaultPrevented}();if(!a){var o=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(o.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var n=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||n&&typeof window.CustomEvent!="function")&&(window.CustomEvent=function(h,l){l=l||{};var u=document.createEvent("CustomEvent");return u.initCustomEvent(h,!!l.bubbles,!!l.cancelable,l.detail),u},window.CustomEvent.prototype=window.Event.prototype),!window.Event||n&&typeof window.Event!="function"){var r=window.Event;window.Event=function(h,l){l=l||{};var u=document.createEvent("Event");return u.initEvent(h,!!l.bubbles,!!l.cancelable),u},window.Event.prototype=r.prototype}})(window.WebComponents);window.HTMLImports=window.HTMLImports||{flags:{}};(function(t){var i="import",a=i in document.createElement("link"),o=!!window.ShadowDOMPolyfill,n=function(p){return o?window.ShadowDOMPolyfill.wrapIfNeeded(p):p},r=n(document),h={get:function(){var p=window.HTMLImports.currentScript||document.currentScript||(document.readyState!=="complete"?document.scripts[document.scripts.length-1]:null);return n(p)},configurable:!0};Object.defineProperty(document,"_currentScript",h),Object.defineProperty(r,"_currentScript",h);var l=/Trident/.test(navigator.userAgent);function u(p,L){L=L||r,D(function(){m(p,L)},L)}var _=l?"complete":"interactive",E="readystatechange";function S(p){return p.readyState==="complete"||p.readyState===_}function D(p,L){if(S(L))p&&p();else{var I=function(){(L.readyState==="complete"||L.readyState===_)&&(L.removeEventListener(E,I),D(p,L))};L.addEventListener(E,I)}}function s(p){p.target.__loaded=!0}function m(p,L){var I=L.querySelectorAll("link[rel=import]"),M=0,C=I.length,d=[],v=[];function c(){M==C&&p&&p({allImports:I,loadedImports:d,errorImports:v})}function e(A){s(A),d.push(this),M++,c()}function b(A){v.push(this),M++,c()}if(C)for(var w=0,P;w<C&&(P=I[w]);w++)y(P)?(d.push(this),M++,c()):(P.addEventListener("load",e),P.addEventListener("error",b));else c()}function y(p){return a?p.__loaded||p.import&&p.import.readyState!=="loading":p.__importParsed}if(a){let p=function(M){for(var C=0,d=M.length,v;C<d&&(v=M[C]);C++)L(v)&&I(v)},L=function(M){return M.localName==="link"&&M.rel==="import"},I=function(M){var C=M.import;C?s({target:M}):(M.addEventListener("load",s),M.addEventListener("error",s))};var g=p,f=L,T=I;new MutationObserver(function(M){for(var C=0,d=M.length,v;C<d&&(v=M[C]);C++)v.addedNodes&&p(v.addedNodes)}).observe(document.head,{childList:!0}),function(){if(document.readyState==="loading")for(var M=document.querySelectorAll("link[rel=import]"),C=0,d=M.length,v;C<d&&(v=M[C]);C++)I(v)}()}u(function(p){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=new Date().getTime();var L=r.createEvent("CustomEvent");L.initCustomEvent("HTMLImportsLoaded",!0,!0,p),r.dispatchEvent(L)}),t.IMPORT_LINK_TYPE=i,t.useNative=a,t.rootDocument=r,t.whenReady=u,t.isIE=l})(window.HTMLImports);(function(t){var i=[],a=function(n){i.push(n)},o=function(){i.forEach(function(n){n(t)})};t.addModule=a,t.initializeModules=o})(window.HTMLImports);window.HTMLImports.addModule(function(t){var i=/(url\()([^)]*)(\))/g,a=/(@import[\s]+(?!url\())([^;]*)(;)/g,o={resolveUrlsInStyle:function(n,r){var h=n.ownerDocument,l=h.createElement("a");return n.textContent=this.resolveUrlsInCssText(n.textContent,r,l),n},resolveUrlsInCssText:function(n,r,h){var l=this.replaceUrls(n,h,r,i);return l=this.replaceUrls(l,h,r,a),l},replaceUrls:function(n,r,h,l){return n.replace(l,function(u,_,E,S){var D=E.replace(/["']/g,"");return h&&(D=new URL(D,h).href),r.href=D,D=r.href,_+"'"+D+"'"+S})}};t.path=o});window.HTMLImports.addModule(function(t){var i={async:!0,ok:function(a){return a.status>=200&&a.status<300||a.status===304||a.status===0},load:function(a,o,n){var r=new XMLHttpRequest;return(t.flags.debug||t.flags.bust)&&(a+="?"+Math.random()),r.open("GET",a,i.async),r.addEventListener("readystatechange",function(h){if(r.readyState===4){var l=null;try{var u=r.getResponseHeader("Location");u&&(l=u.substr(0,1)==="/"?location.origin+u:u)}catch(_){console.error(_.message)}o.call(n,!i.ok(r)&&r,r.response||r.responseText,l)}}),r.send(),r},loadDocument:function(a,o,n){this.load(a,o,n).responseType="document"}};t.xhr=i});window.HTMLImports.addModule(function(t){var i=t.xhr,a=t.flags,o=function(n,r){this.cache={},this.onload=n,this.oncomplete=r,this.inflight=0,this.pending={}};o.prototype={addNodes:function(n){this.inflight+=n.length;for(var r=0,h=n.length,l;r<h&&(l=n[r]);r++)this.require(l);this.checkDone()},addNode:function(n){this.inflight++,this.require(n),this.checkDone()},require:function(n){var r=n.src||n.href;n.__nodeUrl=r,this.dedupe(r,n)||this.fetch(r,n)},dedupe:function(n,r){if(this.pending[n])return this.pending[n].push(r),!0;var h;return this.cache[n]?(this.onload(n,r,this.cache[n]),this.tail(),!0):(this.pending[n]=[r],!1)},fetch:function(n,r){if(a.load&&console.log("fetch",n,r),!n)setTimeout((function(){this.receive(n,r,{error:"href must be specified"},null)}).bind(this),0);else if(n.match(/^data:/)){var h=n.split(","),l=h[0],u=h[1];l.indexOf(";base64")>-1?u=atob(u):u=decodeURIComponent(u),setTimeout((function(){this.receive(n,r,null,u)}).bind(this),0)}else{var _=(function(E,S,D){this.receive(n,r,E,S,D)}).bind(this);i.load(n,_)}},receive:function(n,r,h,l,u){this.cache[n]=l;for(var _=this.pending[n],E=0,S=_.length,D;E<S&&(D=_[E]);E++)this.onload(n,D,l,h,u),this.tail();this.pending[n]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},t.Loader=o});window.HTMLImports.addModule(function(t){var i=function(a){this.addCallback=a,this.mo=new MutationObserver(this.handler.bind(this))};i.prototype={handler:function(a){for(var o=0,n=a.length,r;o<n&&(r=a[o]);o++)r.type==="childList"&&r.addedNodes.length&&this.addedNodes(r.addedNodes)},addedNodes:function(a){this.addCallback&&this.addCallback(a);for(var o=0,n=a.length,r,h;o<n&&(r=a[o]);o++)r.children&&r.children.length&&this.addedNodes(r.children)},observe:function(a){this.mo.observe(a,{childList:!0,subtree:!0})}},t.Observer=i});window.HTMLImports.addModule(function(t){var i=t.path,a=t.rootDocument,o=t.flags,n=t.isIE,r=t.IMPORT_LINK_TYPE,h="link[rel="+r+"]",l={documentSelectors:h,importsSelectors:[h,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var s=this.nextToParse();s&&this.parse(s)},parse:function(s){if(this.isParsed(s)){o.parse&&console.log("[%s] is already parsed",s.localName);return}var m=this[this.map[s.localName]];m&&(this.markParsing(s),m.call(this,s))},parseDynamic:function(s,m){this.dynamicElements.push(s),m||this.parseNext()},markParsing:function(s){o.parse&&console.log("parsing",s),this.parsingElement=s},markParsingComplete:function(s){s.__importParsed=!0,this.markDynamicParsingComplete(s),s.__importElement&&(s.__importElement.__importParsed=!0,this.markDynamicParsingComplete(s.__importElement)),this.parsingElement=null,o.parse&&console.log("completed",s)},markDynamicParsingComplete:function(s){var m=this.dynamicElements.indexOf(s);m>=0&&this.dynamicElements.splice(m,1)},parseImport:function(s){if(s.import=s.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(s),s.import&&(s.import.__importParsed=!0),this.markParsingComplete(s),s.__resource&&!s.__error?s.dispatchEvent(new CustomEvent("load",{bubbles:!1})):s.dispatchEvent(new CustomEvent("error",{bubbles:!1})),s.__pending)for(var m;s.__pending.length;)m=s.__pending.shift(),m&&m({target:s});this.parseNext()},parseLink:function(s){u(s)?this.parseImport(s):(s.href=s.href,this.parseGeneric(s))},parseStyle:function(s){var m=s;s=D(s),m.__appliedElement=s,s.__importElement=m,this.parseGeneric(s)},parseGeneric:function(s){this.trackElement(s),this.addElementToDocument(s)},rootImportForElement:function(s){for(var m=s;m.ownerDocument.__importLink;)m=m.ownerDocument.__importLink;return m},addElementToDocument:function(s){var m=this.rootImportForElement(s.__importElement||s);m.parentNode.insertBefore(s,m)},trackElement:function(s,m){var y=this,g=function(M){s.removeEventListener("load",g),s.removeEventListener("error",g),m&&m(M),y.markParsingComplete(s),y.parseNext()};if(s.addEventListener("load",g),s.addEventListener("error",g),n&&s.localName==="style"){var f=!1;if(s.textContent.indexOf("@import")==-1)f=!0;else if(s.sheet){f=!0;for(var T=s.sheet.cssRules,p=T?T.length:0,L=0,I;L<p&&(I=T[L]);L++)I.type===CSSRule.IMPORT_RULE&&(f=f&&!!I.styleSheet)}f&&setTimeout(function(){s.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(s){var m=document.createElement("script");m.__importElement=s,m.src=s.src?s.src:_(s),t.currentScript=s,this.trackElement(m,function(y){m.parentNode&&m.parentNode.removeChild(m),t.currentScript=null}),this.addElementToDocument(m)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(a)||this.nextToParseDynamic())},nextToParseInDoc:function(s,m){if(s&&this._mayParse.indexOf(s)<0){this._mayParse.push(s);for(var y=s.querySelectorAll(this.parseSelectorsForNode(s)),g=0,f=y.length,T;g<f&&(T=y[g]);g++)if(!this.isParsed(T))return this.hasResource(T)?u(T)?this.nextToParseInDoc(T.__doc,T):T:void 0}return m},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(s){var m=s.ownerDocument||s;return m===a?this.documentSelectors:this.importsSelectors},isParsed:function(s){return s.__importParsed},needsDynamicParsing:function(s){return this.dynamicElements.indexOf(s)>=0},hasResource:function(s){return!(u(s)&&s.__doc===void 0)}};function u(s){return s.localName==="link"&&s.rel===r}function _(s){var m=E(s);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(m)}function E(s){return s.textContent+S(s)}function S(s){var m=s.ownerDocument;m.__importedScripts=m.__importedScripts||0;var y=s.ownerDocument.baseURI,g=m.__importedScripts?"-"+m.__importedScripts:"";return m.__importedScripts++,"\n//# sourceURL="+y+g+".js\n"}function D(s){var m=s.ownerDocument.createElement("style");return m.textContent=s.textContent,i.resolveUrlsInStyle(m),m}t.parser=l,t.IMPORT_SELECTOR=h});window.HTMLImports.addModule(function(t){var i=t.flags,a=t.IMPORT_LINK_TYPE,o=t.IMPORT_SELECTOR,n=t.rootDocument,r=t.Loader,h=t.Observer,l=t.parser,u={documents:{},documentPreloadSelectors:o,importsPreloadSelectors:[o].join(","),loadNode:function(y){_.addNode(y)},loadSubtree:function(y){var g=this.marshalNodes(y);_.addNodes(g)},marshalNodes:function(y){return y.querySelectorAll(this.loadSelectorsForNode(y))},loadSelectorsForNode:function(y){var g=y.ownerDocument||y;return g===n?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(y,g,f,T,p){if(i.load&&console.log("loaded",y,g),g.__resource=f,g.__error=T,E(g)){var L=this.documents[y];L===void 0&&(L=T?null:s(f,p||y),L&&(L.__importLink=g,this.bootDocument(L)),this.documents[y]=L),g.__doc=L}l.parseNext()},bootDocument:function(y){this.loadSubtree(y),this.observer.observe(y),l.parseNext()},loadedAll:function(){l.parseNext()}},_=new r(u.loaded.bind(u),u.loadedAll.bind(u));u.observer=new h;function E(y){return S(y,a)}function S(y,g){return y.localName==="link"&&y.getAttribute("rel")===g}function D(y){return!!Object.getOwnPropertyDescriptor(y,"baseURI")}function s(y,g){var f=document.implementation.createHTMLDocument(a);f._URL=g;var T=f.createElement("base");T.setAttribute("href",g),!f.baseURI&&!D(f)&&Object.defineProperty(f,"baseURI",{value:g});var p=f.createElement("meta");return p.setAttribute("charset","utf-8"),f.head.appendChild(p),f.head.appendChild(T),f.body.innerHTML=y,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(f),f}if(!document.baseURI){var m={get:function(){var y=document.querySelector("base");return y?y.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",m),Object.defineProperty(n,"baseURI",m)}t.importer=u,t.importLoader=_});window.HTMLImports.addModule(function(t){var i=t.parser,a=t.importer,o={added:function(r){for(var h,l,u,_=0,E=r.length,S;_<E&&(S=r[_]);_++)h||(h=S.ownerDocument,l=i.isParsed(h)),u=this.shouldLoadNode(S),u&&a.loadNode(S),this.shouldParseNode(S)&&l&&i.parseDynamic(S,u)},shouldLoadNode:function(r){return r.nodeType===1&&n.call(r,a.loadSelectorsForNode(r))},shouldParseNode:function(r){return r.nodeType===1&&n.call(r,i.parseSelectorsForNode(r))}};a.observer.addCallback=o.added.bind(o);var n=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector});(function(t){var i=t.initializeModules,a=t.isIE;if(t.useNative)return;i();var o=t.rootDocument;function n(){window.HTMLImports.importer.bootDocument(o)}document.readyState==="complete"||document.readyState==="interactive"&&!window.attachEvent?n():document.addEventListener("DOMContentLoaded",n)})(window.HTMLImports);window.CustomElements=window.CustomElements||{flags:{}};(function(t){var i=t.flags,a=[],o=function(r){a.push(r)},n=function(){a.forEach(function(r){r(t)})};t.addModule=o,t.initializeModules=n,t.hasNative=!!document.registerElement,t.isIE=/Trident/.test(navigator.userAgent),t.useNative=!i.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)})(window.CustomElements);window.CustomElements.addModule(function(t){var i=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";function a(l,u){o(l,function(_){if(u(_))return!0;n(_,u)}),n(l,u)}function o(l,u,_){var E=l.firstElementChild;if(!E)for(E=l.firstChild;E&&E.nodeType!==Node.ELEMENT_NODE;)E=E.nextSibling;for(;E;)u(E,_)!==!0&&o(E,u,_),E=E.nextElementSibling;return null}function n(l,u){for(var _=l.shadowRoot;_;)a(_,u),_=_.olderShadowRoot}function r(l,u){h(l,u,[])}function h(l,u,_){if(l=window.wrap(l),!(_.indexOf(l)>=0)){_.push(l);for(var E=l.querySelectorAll("link[rel="+i+"]"),S=0,D=E.length,s;S<D&&(s=E[S]);S++)s.import&&h(s.import,u,_);u(l)}}t.forDocumentTree=r,t.forSubtree=a});window.CustomElements.addModule(function(t){var i=t.flags,a=t.forSubtree,o=t.forDocumentTree;function n(c,e){return r(c,e)||h(c,e)}function r(c,e){if(t.upgrade(c,e))return!0;e&&D(c)}function h(c,e){a(c,function(b){if(r(b,e))return!0})}var l=window.MutationObserver._isPolyfilled&&i["throttle-attached"];t.hasPolyfillMutations=l,t.hasThrottledAttached=l;var u=!1,_=[];function E(c){_.push(c),u||(u=!0,setTimeout(S))}function S(){u=!1;for(var c=_,e=0,b=c.length,w;e<b&&(w=c[e]);e++)w();_=[]}function D(c){l?E(function(){s(c)}):s(c)}function s(c){c.__upgraded__&&!c.__attached&&(c.__attached=!0,c.attachedCallback&&c.attachedCallback())}function m(c){y(c),a(c,function(e){y(e)})}function y(c){l?E(function(){g(c)}):g(c)}function g(c){c.__upgraded__&&c.__attached&&(c.__attached=!1,c.detachedCallback&&c.detachedCallback())}function f(c){for(var e=c,b=window.wrap(document);e;){if(e==b)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}function T(c){if(c.shadowRoot&&!c.shadowRoot.__watched){i.dom&&console.log("watching shadow-root for: ",c.localName);for(var e=c.shadowRoot;e;)M(e),e=e.olderShadowRoot}}function p(c,e){if(i.dom){var b=e[0];if(b&&b.type==="childList"&&b.addedNodes&&b.addedNodes){for(var w=b.addedNodes[0];w&&w!==document&&!w.host;)w=w.parentNode;var P=w&&(w.URL||w._URL||w.host&&w.host.localName)||"";P=P.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,P||"")}var A=f(c);e.forEach(function(R){R.type==="childList"&&(I(R.addedNodes,function(k){k.localName&&n(k,A)}),I(R.removedNodes,function(k){k.localName&&m(k)}))}),i.dom&&console.groupEnd()}function L(c){for(c=window.wrap(c),c||(c=window.wrap(document));c.parentNode;)c=c.parentNode;var e=c.__observer;e&&(p(c,e.takeRecords()),S())}var I=Array.prototype.forEach.call.bind(Array.prototype.forEach);function M(c){if(!c.__observer){var e=new MutationObserver(p.bind(this,c));e.observe(c,{childList:!0,subtree:!0}),c.__observer=e}}function C(c){c=window.wrap(c),i.dom&&console.group("upgradeDocument: ",c.baseURI.split("/").pop());var e=c===window.wrap(document);n(c,e),M(c),i.dom&&console.groupEnd()}function d(c){o(c,C)}var v=Element.prototype.createShadowRoot;v&&(Element.prototype.createShadowRoot=function(){var c=v.call(this);return window.CustomElements.watchShadow(this),c}),t.watchShadow=T,t.upgradeDocumentTree=d,t.upgradeDocument=C,t.upgradeSubtree=h,t.upgradeAll=n,t.attached=D,t.takeRecords=L});window.CustomElements.addModule(function(t){var i=t.flags;function a(l,u){if(l.localName==="template"&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(l),!l.__upgraded__&&l.nodeType===Node.ELEMENT_NODE){var _=l.getAttribute("is"),E=t.getRegisteredDefinition(l.localName)||t.getRegisteredDefinition(_);if(E&&(_&&E.tag==l.localName||!_&&!E.extends))return o(l,E,u)}}function o(l,u,_){return i.upgrade&&console.group("upgrade:",l.localName),u.is&&l.setAttribute("is",u.is),n(l,u),l.__upgraded__=!0,h(l),_&&t.attached(l),t.upgradeSubtree(l,_),i.upgrade&&console.groupEnd(),l}function n(l,u){Object.__proto__||r(l,u.prototype,u.native),l.__proto__=u.prototype}function r(l,u,_){for(var E={},S=u;S!==_&&S!==HTMLElement.prototype;){for(var D=Object.getOwnPropertyNames(S),s=0,m;m=D[s];s++)E[m]||(Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(S,m)),E[m]=1);S=Object.getPrototypeOf(S)}}function h(l){l.createdCallback&&l.createdCallback()}t.upgrade=a,t.upgradeWithDefinition=o,t.implementPrototype=n});window.CustomElements.addModule(function(t){var i=t.isIE,a=t.upgradeDocumentTree,o=t.upgradeAll,n=t.upgradeWithDefinition,r=t.implementPrototype,h=t.useNative;function l(e,b){var w=b||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(E(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(f(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return w.prototype||(w.prototype=Object.create(HTMLElement.prototype)),w.__name=e.toLowerCase(),w.extends&&(w.extends=w.extends.toLowerCase()),w.lifecycle=w.lifecycle||{},w.ancestry=D(w.extends),s(w),m(w),u(w.prototype),T(w.__name,w),w.ctor=p(w),w.ctor.prototype=w.prototype,w.prototype.constructor=w.ctor,t.ready&&a(document),w.ctor}function u(e){if(!e.setAttribute._polyfilled){var b=e.setAttribute;e.setAttribute=function(P,A){_.call(this,P,A,b)};var w=e.removeAttribute;e.removeAttribute=function(P){_.call(this,P,null,w)},e.setAttribute._polyfilled=!0}}function _(e,b,w){e=e.toLowerCase();var P=this.getAttribute(e);w.apply(this,arguments);var A=this.getAttribute(e);this.attributeChangedCallback&&A!==P&&this.attributeChangedCallback(e,P,A)}function E(e){for(var b=0;b<S.length;b++)if(e===S[b])return!0}var S=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];function D(e){var b=f(e);return b?D(b.extends).concat([b]):[]}function s(e){for(var b=e.extends,w=0,P;P=e.ancestry[w];w++)b=P.is&&P.tag;e.tag=b||e.__name,b&&(e.is=e.__name)}function m(e){if(!Object.__proto__){var b=HTMLElement.prototype;if(e.is){var w=document.createElement(e.tag);b=Object.getPrototypeOf(w)}for(var P=e.prototype,A,R=!1;P;)P==b&&(R=!0),A=Object.getPrototypeOf(P),A&&(P.__proto__=A),P=A;R||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e.native=b}}function y(e){return n(C(e.tag),e)}var g={};function f(e){if(e)return g[e.toLowerCase()]}function T(e,b){g[e]=b}function p(e){return function(){return y(e)}}var L="http://www.w3.org/1999/xhtml";function I(e,b,w){return e===L?M(b,w):d(e,b)}function M(e,b){e&&(e=e.toLowerCase()),b&&(b=b.toLowerCase());var w=f(b||e);if(w){if(e==w.tag&&b==w.is)return new w.ctor;if(!b&&!w.is)return new w.ctor}var P;return b?(P=M(e),P.setAttribute("is",b),P):(P=C(e),e.indexOf("-")>=0&&r(P,HTMLElement),P)}var C=document.createElement.bind(document),d=document.createElementNS.bind(document),v;!Object.__proto__&&!h?v=function(e,b){if(e instanceof b)return!0;for(var w=e;w;){if(w===b.prototype)return!0;w=w.__proto__}return!1}:v=function(e,b){return e instanceof b};function c(e,b){var w=e[b];e[b]=function(){var P=w.apply(this,arguments);return o(P),P}}c(Node.prototype,"cloneNode"),c(document,"importNode"),document.registerElement=l,document.createElement=M,document.createElementNS=I,t.registry=g,t.instanceof=v,t.reservedTagList=S,t.getRegisteredDefinition=f,document.register=document.registerElement});(function(t){var i=t.useNative,a=t.initializeModules,o=t.isIE;if(i){var n=function(){};t.watchShadow=n,t.upgrade=n,t.upgradeAll=n,t.upgradeDocumentTree=n,t.upgradeSubtree=n,t.takeRecords=n,t.instanceof=function(_,E){return _ instanceof E}}else a();var r=t.upgradeDocumentTree,h=t.upgradeDocument;window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(_){return _}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(_){_.import&&h(wrap(_.import))});function l(){r(window.wrap(document)),window.CustomElements.ready=!0;var _=window.requestAnimationFrame||function(E){setTimeout(E,16)};_(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}if(document.readyState==="complete"||t.flags.eager)l();else if(document.readyState==="interactive"&&!window.attachEvent&&(!window.HTMLImports||window.HTMLImports.ready))l();else{var u=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(u,l)}})(window.CustomElements);(function(t){var i=document.createElement("style");i.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var a=document.querySelector("head");a.insertBefore(i,a.firstChild)})(window.WebComponents)});var J=x((et,$)=>{function B(t){return typeof window.navigator.userAgent=="string"&&window.navigator.userAgent.indexOf(t)>=0}$.exports=function(){var t=!document.registerElement,i=B("CriOS"),a;a=B("Android")&&B("Chrome/")&&window.navigator.presentation,(a||i)&&t&&Y()}});var Z=x((tt,X)=>{X.exports=function(t){let i=t.getComponent("Button");class a extends i{constructor(n,r){super(n,r),n.on("chromecastConnected",this._onChromecastConnected.bind(this)),n.on("chromecastDisconnected",this._onChromecastDisconnected.bind(this)),n.on("chromecastDevicesAvailable",this._onChromecastDevicesAvailable.bind(this)),n.on("chromecastDevicesUnavailable",this._onChromecastDevicesUnavailable.bind(this)),n.chromecastSessionManager&&n.chromecastSessionManager.hasAvailableDevices()?this._onChromecastDevicesAvailable():this._onChromecastDevicesUnavailable(),r.addCastLabelToButton?(this.el().classList.add("vjs-chromecast-button-lg"),this._labelEl=document.createElement("span"),this._labelEl.classList.add("vjs-chromecast-button-label"),this._updateCastLabelText(),this.el().appendChild(this._labelEl)):this.controlText("Open Chromecast menu")}buildCSSClass(){return"vjs-chromecast-button "+(this._isChromecastConnected?"vjs-chromecast-casting-state ":"")+(this.options_.addCastLabelToButton?"vjs-chromecast-button-lg ":"")+i.prototype.buildCSSClass()}handleClick(){this.player().trigger("chromecastRequested")}_onChromecastConnected(){this._isChromecastConnected=!0,this._reloadCSSClasses(),this._updateCastLabelText()}_onChromecastDisconnected(){this._isChromecastConnected=!1,this._reloadCSSClasses(),this._updateCastLabelText()}_onChromecastDevicesAvailable(){this.show()}_onChromecastDevicesUnavailable(){this.hide()}_reloadCSSClasses(){this.el_&&(this.el_.className=this.buildCSSClass())}_updateCastLabelText(){this._labelEl&&(this._labelEl.textContent=this._isChromecastConnected?this.localize("Disconnect Cast"):this.localize("Cast"))}}t.registerComponent("chromecastButton",a)}});var ee=x((rt,Q)=>{function Te(t,i,a){let o=()=>{let r=t._getMediaSession();return r?(r.addUpdateListener(t._onMediaSessionStatusChanged.bind(t)),!0):!1};if(o())return;let n=()=>{if(!o())return;let r=t._eventListeners.find(h=>h.target===i&&h.callback===n);t._removeEventListener(r)};t._addEventListener(i,a,n,t)}Q.exports={attachMediaSessionListener:Te}});var V=x((it,te)=>{var q=class q{constructor(i){this.player=i,this._sessionListener=this._onSessionStateChange.bind(this),this._castListener=this._onCastStateChange.bind(this),this._addCastContextEventListeners(),this.player.on("dispose",this._removeCastContextEventListeners.bind(this)),this._notifyPlayerOfDevicesAvailabilityChange(this.getCastContext().getCastState()),this.remotePlayer=new cast.framework.RemotePlayer,this.remotePlayerController=new cast.framework.RemotePlayerController(this.remotePlayer)}_addCastContextEventListeners(){var i=cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a=cast.framework.CastContextEventType.CAST_STATE_CHANGED;this.getCastContext().addEventListener(i,this._sessionListener),this.getCastContext().addEventListener(a,this._castListener)}_removeCastContextEventListeners(){var i=cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a=cast.framework.CastContextEventType.CAST_STATE_CHANGED;this.getCastContext().removeEventListener(i,this._sessionListener),this.getCastContext().removeEventListener(a,this._castListener)}_onSessionStateChange(i){i.sessionState===cast.framework.SessionState.SESSION_ENDED&&(this.player.trigger("chromecastDisconnected"),this._reloadTech())}_onCastStateChange(i){this._notifyPlayerOfDevicesAvailabilityChange(i.castState)}_notifyPlayerOfDevicesAvailabilityChange(i){this.hasAvailableDevices(i)?this.player.trigger("chromecastDevicesAvailable"):this.player.trigger("chromecastDevicesUnavailable")}hasAvailableDevices(i){return i=i||this.getCastContext().getCastState(),i===cast.framework.CastState.NOT_CONNECTED||i===cast.framework.CastState.CONNECTING||i===cast.framework.CastState.CONNECTED}openCastMenu(){var i;this.player.currentSource()&&(i=(function(){q.hasConnected=!0,this.player.trigger("chromecastConnected"),this._reloadTech()}).bind(this),this.getCastContext().requestSession().then(i,function(){}))}_reloadTech(){var i=this.player,a=i.currentTime(),o=i.paused(),n=i.currentSources();i.src(n),i.ready(function(){o?i.pause():i.play(),i.currentTime(a||0)})}getCastContext(){return cast.framework.CastContext.getInstance()}getRemotePlayer(){return this.remotePlayer}getRemotePlayerController(){return this.remotePlayerController}static isChromecastAPIAvailable(){return window.chrome&&window.chrome.cast&&window.cast}static isChromecastConnected(){return q.isChromecastAPIAvailable()&&cast.framework.CastContext.getInstance().getCastState()===cast.framework.CastState.CONNECTED&&q.hasConnected}};K(q,"hasConnected",!1);var F=q;te.exports=F});var ie=x((at,re)=>{var G=class{constructor(){this._el=this._createDOMElement()}_createDOMElement(){var i=this._createElement("div","vjs-tech vjs-tech-chromecast"),a=this._createElement("div","vjs-tech-chromecast-poster"),o=this._createElement("img","vjs-tech-chromecast-poster-img"),n=this._createElement("div","vjs-tech-chromecast-title"),r=this._createElement("div","vjs-tech-chromecast-subtitle"),h=this._createElement("div","vjs-tech-chromecast-title-container");return a.appendChild(o),h.appendChild(n),h.appendChild(r),i.appendChild(h),i.appendChild(a),i}_createElement(i,a){var o=document.createElement(i);return o.className=a,o}getDOMElement(){return this._el}_findPosterEl(){return this._el.querySelector(".vjs-tech-chromecast-poster")}_findPosterImageEl(){return this._el.querySelector(".vjs-tech-chromecast-poster-img")}_findTitleEl(){return this._el.querySelector(".vjs-tech-chromecast-title")}_findSubtitleEl(){return this._el.querySelector(".vjs-tech-chromecast-subtitle")}updatePoster(i){var a=this._findPosterImageEl();this._poster=i||null,i?(a.setAttribute("src",i),a.classList.remove("vjs-tech-chromecast-poster-img-empty")):(a.removeAttribute("src"),a.classList.add("vjs-tech-chromecast-poster-img-empty"))}getPoster(){return this._poster}updateTitle(i){var a=this._findTitleEl();this._title=i,i?(a.innerHTML=i,a.classList.remove("vjs-tech-chromecast-title-empty")):a.classList.add("vjs-tech-chromecast-title-empty")}updateSubtitle(i){var a=this._findSubtitleEl();this._subtitle=i,i?(a.innerHTML=i,a.classList.remove("vjs-tech-chromecast-subtitle-empty")):a.classList.add("vjs-tech-chromecast-subtitle-empty")}};re.exports=G});var se=x((st,ae)=>{var Se=ee().attachMediaSessionListener,ne=V(),Le=ie();ae.exports=function(t){var i=t.getComponent("Tech"),a=10*1e3;class o extends i{constructor(r){super(r),this.featuresVolumeControl=!0,this.featuresPlaybackRate=!1,this.movingMediaElementInDOM=!1,this.featuresFullscreenResize=!0,this.featuresTimeupdateEvents=!0,this.featuresProgressEvents=!1,this.featuresNativeTextTracks=!1,this.featuresNativeAudioTracks=!1,this.featuresNativeVideoTracks=!1,this.videojs=t,this._eventListeners=[],this.videojsPlayer=this.videojs(r.playerId),this._chromecastSessionManager=this.videojsPlayer.chromecastSessionManager,this._ui.updatePoster(this.videojsPlayer.poster()),this._remotePlayer=this._chromecastSessionManager.getRemotePlayer(),this._remotePlayerController=this._chromecastSessionManager.getRemotePlayerController(),this._listenToPlayerControllerEvents(),this.on("dispose",this._removeAllEventListeners.bind(this)),this._hasPlayedAnyItem=!1,this._requestTitle=r.requestTitleFn||function(){},this._requestSubtitle=r.requestSubtitleFn||function(){},this._requestCustomData=r.requestCustomDataFn||function(){},this._modifyLoadRequestFn=r.modifyLoadRequestFn||function(h){return h},this._initialStartTime=r.startTime||0,this._playSource(r.source,this._initialStartTime),this.ready((function(){this.setMuted(r.muted)}).bind(this))}createEl(){return this._ui=this._ui||new Le,this._ui.getDOMElement()}play(){this.paused()&&(this.ended()&&!this._isMediaLoading?this._playSource({src:this.videojsPlayer.src()},0):this._remotePlayerController.playOrPause())}pause(){!this.paused()&&this._remotePlayer.canPause&&this._remotePlayerController.playOrPause()}paused(){return this._remotePlayer.isPaused||this.ended()||this._remotePlayer.playerState===null}setSource(r){this._currentSource&&this._currentSource.src===r.src&&this._currentSource.type===r.type||(this._currentSource=r,this._playSource(r,0))}_playSource(r,h){var l=this._getCastSession(),u=new chrome.cast.media.MediaInfo(r.src,r.type),_=this._requestTitle(r),E=this._requestSubtitle(r),S=this.poster(),D=this._requestCustomData(r),s;this.trigger("waiting"),this._clearSessionTimeout(),u.metadata=new chrome.cast.media.GenericMediaMetadata,u.metadata.metadataType=chrome.cast.media.MetadataType.GENERIC,u.metadata.title=_,u.metadata.subtitle=E,u.streamType=this.videojsPlayer.liveTracker&&this.videojsPlayer.liveTracker.isLive()?chrome.cast.media.StreamType.LIVE:chrome.cast.media.StreamType.BUFFERED,S&&(u.metadata.images=[{url:S}]),D&&(u.customData=D),this._ui.updateTitle(_),this._ui.updateSubtitle(E),s=new chrome.cast.media.LoadRequest(u),s.autoplay=!0,s.currentTime=h,s=this._modifyLoadRequestFn(s),this._isMediaLoading=!0,this._hasPlayedCurrentItem=!1,l.loadMedia(s).then((function(){this._clearSessionTimeout(),this._hasPlayedAnyItem||this.triggerReady(),this.trigger("loadstart"),this.trigger("loadeddata"),this.trigger("play"),this.trigger("playing"),this._hasPlayedAnyItem=!0,this._isMediaLoading=!1,Se(this,l,cast.framework.SessionEventType.MEDIA_SESSION)}).bind(this),this._triggerErrorEvent.bind(this))}setCurrentTime(r){var h=this.duration();r>h||!this._remotePlayer.canSeek||(this._remotePlayer.currentTime=Math.min(h-1,r),this._remotePlayerController.seek(),this._triggerTimeUpdateEvent())}currentTime(){return this._hasPlayedAnyItem?this._remotePlayer.currentTime:this._initialStartTime}duration(){return this._hasPlayedAnyItem?this._remotePlayer.duration:this.videojsPlayer.duration()}ended(){var r=this._getMediaSession();return!r&&this._hasMediaSessionEnded?!0:r?r.idleReason===chrome.cast.media.IdleReason.FINISHED:!1}volume(){return this._remotePlayer.volumeLevel}setVolume(r){this._remotePlayer.volumeLevel=r,this._remotePlayerController.setVolumeLevel(),this._triggerVolumeChangeEvent()}muted(){return this._remotePlayer.isMuted}setMuted(r){(this._remotePlayer.isMuted&&!r||!this._remotePlayer.isMuted&&r)&&this._remotePlayerController.muteOrUnmute()}poster(){return this._ui.getPoster()}setPoster(r){this._ui.updatePoster(r)}buffered(){}seekable(){return this.videojs.createTimeRange(0,this.duration())}controls(){return!1}playsinline(){return!0}supportsFullScreen(){return!0}setAutoplay(){}playbackRate(){var r=this._getMediaSession();return r?r.playbackRate:1}setPlaybackRate(){}preload(){}load(){}readyState(){return this._remotePlayer.playerState==="IDLE"||this._remotePlayer.playerState==="BUFFERING"?0:4}_listenToPlayerControllerEvents(){var r=cast.framework.RemotePlayerEventType;this._addEventListener(this._remotePlayerController,r.PLAYER_STATE_CHANGED,this._onPlayerStateChanged,this),this._addEventListener(this._remotePlayerController,r.VOLUME_LEVEL_CHANGED,this._triggerVolumeChangeEvent,this),this._addEventListener(this._remotePlayerController,r.IS_MUTED_CHANGED,this._triggerVolumeChangeEvent,this),this._addEventListener(this._remotePlayerController,r.CURRENT_TIME_CHANGED,this._triggerTimeUpdateEvent,this),this._addEventListener(this._remotePlayerController,r.DURATION_CHANGED,this._triggerDurationChangeEvent,this)}_addEventListener(r,h,l,u){var _;_={target:r,type:h,callback:l,context:u,listener:l.bind(u)},r.addEventListener(h,_.listener),this._eventListeners.push(_)}_removeAllEventListeners(){for(;this._eventListeners.length>0;)this._removeEventListener(this._eventListeners[0]);this._eventListeners=[]}_removeEventListener(r){var h=-1,l=!1,u;for(r.target.removeEventListener(r.type,r.listener),u=0;u<this._eventListeners.length;u++)if(l=this._eventListeners[u].target===r.target&&this._eventListeners[u].type===r.type&&this._eventListeners[u].callback===r.callback&&this._eventListeners[u].context===r.context,l){h=u;break}h!==-1&&this._eventListeners.splice(h,1)}_onPlayerStateChanged(){var r=chrome.cast.media.PlayerState,h=this._remotePlayer.playerState;h===r.PLAYING?(this._hasPlayedCurrentItem=!0,this.trigger("play"),this.trigger("playing")):h===r.PAUSED?this.trigger("pause"):h===r.IDLE&&this.ended()||h===null&&this._hasPlayedCurrentItem?(this._hasPlayedCurrentItem=!1,this._closeSessionOnTimeout(),this.trigger("ended"),this._triggerTimeUpdateEvent()):h===r.BUFFERING&&this.trigger("waiting")}_onMediaSessionStatusChanged(r){this._hasMediaSessionEnded=!!r}_closeSessionOnTimeout(){this._clearSessionTimeout(),this._sessionTimeoutID=setTimeout((function(){var r=this._getCastSession();r&&r.endSession(!0),this._clearSessionTimeout()}).bind(this),a)}_clearSessionTimeout(){this._sessionTimeoutID&&(clearTimeout(this._sessionTimeoutID),this._sessionTimeoutID=!1)}_getCastContext(){return this._chromecastSessionManager.getCastContext()}_getCastSession(){return this._getCastContext().getCurrentSession()}_getMediaSession(){var r=this._getCastSession();return r?r.getMediaSession():null}_triggerVolumeChangeEvent(){this.trigger("volumechange")}_triggerTimeUpdateEvent(){this.trigger("timeupdate")}_triggerDurationChangeEvent(){this.trigger("durationchange")}_triggerErrorEvent(){this.trigger("error")}}o.canPlaySource=()=>ne.isChromecastConnected(),o.isSupported=()=>ne.isChromecastConnected(),t.registerTech("chromecast",o)}});var ue=x((ot,ce)=>{var W=V(),oe=1e3,Ie=30*1e3;function Pe(t){var i=cast.framework.CastContext.getInstance();i.setOptions({receiverApplicationId:t.receiverAppID||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED})}function Me(t){t.chromecastSessionManager.openCastMenu()}function De(t,i){var a;i.addButtonToControlBar&&!t.controlBar.getChild("chromecastButton")&&(a=t.controlBar.children().length,typeof i.buttonPositionIndex<"u"&&(a=i.buttonPositionIndex>=0?i.buttonPositionIndex:t.controlBar.children().length+i.buttonPositionIndex),t.controlBar.addChild("chromecastButton",i,a)),t.on("chromecastRequested",Me.bind(null,t))}function Ae(t){t.chromecastSessionManager||(t.chromecastSessionManager=new W(t))}function le(t,i){Pe(i),Ae(t),De(t,i)}function Ne(t,i){var a=Ie/oe,o=1,n;n=setInterval(function(){if(o>a){clearInterval(n);return}W.isChromecastAPIAvailable()&&(clearInterval(n),le(t,i)),o=o+1},oe)}ce.exports=function(t){t.registerPlugin("chromecast",function(i){var a=Object.assign({addButtonToControlBar:!0},i||{});this.ready((function(){this.controlBar&&(W.isChromecastAPIAvailable()?le(this,a):Ne(this,a))}).bind(this))})}});var de=x((lt,he)=>{var Oe=J(),xe=Z(),Re=se(),ke=ue();he.exports=function(t,i){var a=Object.assign({preloadWebComponents:!1},i);a.preloadWebComponents&&Oe(),t=t||window.videojs,xe(t),Re(t),ke(t)}});var z=x((ct,fe)=>{fe.exports=function(){return!!window.WebKitPlaybackTargetAvailabilityEvent}});var pe=x((ut,ve)=>{var me=z();ve.exports=function(t){let i=t.getComponent("Button");class a extends i{constructor(n,r){super(n,r),me()||this.hide(),this._reactToAirPlayAvailableEvents(),r.addAirPlayLabelToButton?(this.el().classList.add("vjs-airplay-button-lg"),this._labelEl=document.createElement("span"),this._labelEl.classList.add("vjs-airplay-button-label"),this._labelEl.textContent=this.localize("AirPlay"),this.el().appendChild(this._labelEl)):this.controlText("Start AirPlay")}buildCSSClass(){return"vjs-airplay-button "+super.buildCSSClass()}handleClick(){this.player().trigger("airPlayRequested")}_getMediaEl(){var n=this.player().el();return n.querySelector("video, audio")}_reactToAirPlayAvailableEvents(){var n=this._getMediaEl(),r=this;if(!n||!me())return;function h(l){l.availability==="available"?r.show():r.hide()}n.addEventListener("webkitplaybacktargetavailabilitychanged",h),this.on("dispose",function(){n.removeEventListener("webkitplaybacktargetavailabilitychanged",h)})}}t.registerComponent("airPlayButton",a)}});var ge=x((ht,_e)=>{var je=z();function qe(t){return t.controlBar.getChild("airPlayButton")}function He(t,i){var a=qe(t),o;i.addButtonToControlBar&&!a&&(o=t.controlBar.children().length,typeof i.buttonPositionIndex<"u"&&(o=i.buttonPositionIndex>=0?i.buttonPositionIndex:t.controlBar.children().length+i.buttonPositionIndex),t.controlBar.addChild("airPlayButton",i,o))}function Ue(t){var i=t.el().querySelector("video, audio");i&&i.webkitShowPlaybackTargetPicker&&i.webkitShowPlaybackTargetPicker()}function Be(t){t.on("airPlayRequested",Ue.bind(null,t))}function Fe(t,i){t.controlBar&&je()&&(Be(t),He(t,i))}_e.exports=function(t){t.registerPlugin("airPlay",function(i){var a=Object.assign({addButtonToControlBar:!0},i||{});this.ready(Fe.bind(this,this,a))})}});var ye=x((dt,we)=>{var Ve=pe(),Ge=ge();we.exports=function(t){t=t||window.videojs,Ve(t),Ge(t)}});var We=de(),ze=ye(),j={NOT_INITIATED:0,INITIATED:1,AVAILABLE:2,NOT_AVAILABLE:3},H=j.NOT_INITIATED,be=t=>typeof t=="string"&&/\.m3u8(?:[?#]|$)/i.test(t),U=t=>typeof t=="string"&&/\.mp4(?:[?#]|$)/i.test(t);function Ke(t){var o;let i=(o=t==null?void 0:t.getTech)==null?void 0:o.call(t,"Chromecast");if(!i||typeof i.prototype.seeking=="function")return;class a extends i{seeking(){return!1}}t.registerTech("chromecast",a)}var Ye=()=>{let t=0;return new Promise((i,a)=>{let o=setInterval(()=>{if(H>j.INITIATED){i(),clearInterval(o);return}t++,console.debug("Waiting for gcastScriptExecuted"),t>25&&(a(),clearInterval(o))},100)})};function mt({registerHook:t,peertubeHelpers:i}){let a,o=!1;t({target:"action:video-watch.video.loaded",handler:async({videojs:n,video:r})=>{var E;let h=Array.isArray(r==null?void 0:r.files)?r.files:[],u=(Array.isArray(r==null?void 0:r.streamingPlaylists)?r.streamingPlaylists:[]).find(S=>be(S==null?void 0:S.playlistUrl));if(o=!!u&&((r==null?void 0:r.isLive)===!0||(r==null?void 0:r.isLive)==null&&h.length===0),a=o?u.playlistUrl:(E=h.find(S=>U(S==null?void 0:S.fileUrl)))==null?void 0:E.fileUrl,H>j.NOT_INITIATED)return;window.WebKitPlaybackTargetAvailabilityEvent&&ze(n),window.__onGCastApiAvailable=S=>{H=S?j.AVAILABLE:j.NOT_AVAILABLE,S&&(We(n,{preloadWebComponents:!0}),Ke(n))};let _=document.createElement("script");_.src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",H=j.INITIATED,document.body.appendChild(_)}}),t({target:"filter:internal.player.videojs.options.result",handler:n=>i.getSettings().then(async r=>(await Ye(),r)).then(r=>Promise.all([r,n])).then(([r,h])=>H===j.AVAILABLE?Object.assign({},h,{chromecast:{modifyLoadRequestFn:function(l){let u=l.media,_=o&&!U(u.contentId);return a&&!U(u.contentId)&&(u.contentId=a),be(u.contentId)?(u.contentType="application/x-mpegURL",u.hlsSegmentFormat=_?"ts":"fmp4",u.hlsVideoSegmentFormat=_?"mpeg2_ts":"fmp4"):U(u.contentId)&&(u.contentType="video/mp4"),_&&(u.streamType=window.chrome.cast.media.StreamType.LIVE,delete u.duration,delete l.currentTime),l}},plugins:Object.assign({},h.plugins,{chromecast:{receiverAppID:r["chromecast-receiver-app-id"]||void 0}},window.WebKitPlaybackTargetAvailabilityEvent?{airPlay:{}}:{}),techOrder:["chromecast","html5"]}):window.WebKitPlaybackTargetAvailabilityEvent?Object.assign({},h,{plugins:Object.assign({},h.plugins,{airPlay:{}})}):h)})}export{mt as register};
2
+ /*! Bundled license information:
3
+
4
+ webcomponents.js/webcomponents-lite.js:
5
+ (**
6
+ * @license
7
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
8
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
9
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
10
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
11
+ * Code distributed by Google as part of the polymer project is also
12
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
13
+ *)
14
+ */
package/main.js ADDED
@@ -0,0 +1,25 @@
1
+ async function register ({
2
+ registerHook,
3
+ registerSetting,
4
+ settingsManager,
5
+ storageManager,
6
+ videoCategoryManager,
7
+ videoLicenceManager,
8
+ videoLanguageManager
9
+ }) {
10
+ registerSetting({
11
+ name: 'chromecast-receiver-app-id',
12
+ label: 'Chromecast receiver app id',
13
+ type: 'input',
14
+ private: false,
15
+ });
16
+ }
17
+
18
+ async function unregister () {
19
+ return
20
+ }
21
+
22
+ module.exports = {
23
+ register,
24
+ unregister
25
+ }
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "peertube-plugin-live-casting",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Chromecast and AirPlay casting for PeerTube live streams and on-demand videos.",
4
+ "version": "1.0.2",
5
+ "author": "kntndrsn",
6
+ "license": "AGPL-3.0-only",
7
+ "bugs": "https://framagit.org/kntndrsn/peertube-plugin-live-casting/issues",
8
+ "clientScripts": [
9
+ {
10
+ "script": "dist/common-client-plugin.js",
11
+ "scopes": [
12
+ "video-watch"
13
+ ]
14
+ }
15
+ ],
16
+ "css": [
17
+ "dist/common-client-plugin.css"
18
+ ],
19
+ "devDependencies": {
20
+ "esbuild": "^0.20.1",
21
+ "esbuild-plugin-inline-image": "^0.0.9",
22
+ "esbuild-sass-plugin": "^3.1.0",
23
+ "file-loader": "^6.2.0"
24
+ },
25
+ "engine": {
26
+ "peertube": ">=3.3.0"
27
+ },
28
+ "homepage": "https://framagit.org/kntndrsn/peertube-plugin-live-casting",
29
+ "keywords": [
30
+ "peertube",
31
+ "plugin"
32
+ ],
33
+ "library": "./main.js",
34
+ "scripts": {
35
+ "prepare": "npm run build",
36
+ "build": "node scripts/build.js",
37
+ "test": "node --test test/*.test.cjs"
38
+ },
39
+ "staticDirs": {
40
+ "images": "dist/images"
41
+ },
42
+ "translations": {},
43
+ "dependencies": {
44
+ "@silvermine/videojs-airplay": "^1.0.2",
45
+ "@silvermine/videojs-chromecast": "1.5.0"
46
+ }
47
+ }
@@ -0,0 +1,28 @@
1
+ const path = require('path')
2
+ const esbuild = require('esbuild')
3
+ const { sassPlugin } = require('esbuild-sass-plugin')
4
+ const inlineImage = require('esbuild-plugin-inline-image')
5
+ const { chromecastCompatibilityPlugin } = require('./chromecast-compatibility')
6
+
7
+ const clientFiles = [
8
+ 'common-client-plugin.js'
9
+ ]
10
+
11
+ const configs = clientFiles.map(f => ({
12
+ entryPoints: [ path.resolve(__dirname, '..', 'client', f) ],
13
+ bundle: true,
14
+ minify: true,
15
+ format: 'esm',
16
+ target: 'safari11',
17
+ plugins: [
18
+ chromecastCompatibilityPlugin,
19
+ sassPlugin(),
20
+ inlineImage(),
21
+ ],
22
+ outfile: path.resolve(__dirname, '..', 'dist', f),
23
+ }))
24
+
25
+ const promises = configs.map(c => esbuild.build(c))
26
+
27
+ Promise.all(promises)
28
+ .catch(() => process.exit(1))
@@ -0,0 +1,32 @@
1
+ const fs = require('fs/promises')
2
+ const path = require('path')
3
+
4
+ const original = 'this._getMediaSession().addUpdateListener(this._onMediaSessionStatusChanged.bind(this));'
5
+
6
+ function patchChromecastTech (source) {
7
+ if (source.split(original).length !== 2) {
8
+ throw new Error('Chromecast media-session compatibility patch does not match the installed dependency')
9
+ }
10
+
11
+ const helper = require.resolve('../client/media-session-listener')
12
+ return `var attachMediaSessionListener = require(${JSON.stringify(helper)}).attachMediaSessionListener;\n` +
13
+ source.replace(original,
14
+ 'attachMediaSessionListener(this, castSession, cast.framework.SessionEventType.MEDIA_SESSION);')
15
+ }
16
+
17
+ const chromecastCompatibilityPlugin = {
18
+ name: 'chromecast-media-session-compatibility',
19
+ setup (build) {
20
+ const techPath = require.resolve('@silvermine/videojs-chromecast/src/js/tech/ChromecastTech')
21
+ build.onLoad({ filter: /ChromecastTech\.js$/ }, async args => {
22
+ if (args.path !== techPath) return
23
+ return {
24
+ contents: patchChromecastTech(await fs.readFile(args.path, 'utf8')),
25
+ loader: 'js',
26
+ resolveDir: path.dirname(args.path)
27
+ }
28
+ })
29
+ }
30
+ }
31
+
32
+ module.exports = { patchChromecastTech, chromecastCompatibilityPlugin }