@openplayerjs/youtube 3.0.0

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 ADDED
@@ -0,0 +1,294 @@
1
+ # @openplayerjs/youtube
2
+
3
+ YouTube IFrame Player engine for [OpenPlayerJS](https://openplayerjs.com).
4
+
5
+ > This is a direct replacement of the [deprecated OpenPlayer's YouTube plugin](https://github.com/openplayerjs/openplayerjs-youtube)
6
+
7
+ [![npm](https://img.shields.io/npm/v/@openplayerjs/youtube?color=blue&logo=npm&label=npm)](https://www.npmjs.com/package/@openplayerjs/youtube)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@openplayerjs/youtube?logo=npm&label=downloads)](https://www.npmjs.com/package/@openplayerjs/youtube)
9
+ [![License](https://img.shields.io/npm/l/@openplayerjs/youtube)](../../LICENSE.md)
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
11
+ [![JSDelivr](https://data.jsdelivr.com/v1/package/npm/@openplayerjs/youtube/badge)](https://www.jsdelivr.com/package/npm/@openplayerjs/youtube)
12
+
13
+ Integrates the [YouTube IFrame Player API](https://developers.google.com/youtube/iframe_api_reference) into the OpenPlayerJS engine system, so YouTube videos behave like any other media source — you get the same `play()`, `pause()`, `currentTime`, `volume`, and event API as native HTML5 media.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @openplayerjs/youtube @openplayerjs/core
21
+ ```
22
+
23
+ > **Peer dependency:** `@openplayerjs/core` must be installed separately.
24
+
25
+ ---
26
+
27
+ ## Setting the source
28
+
29
+ There are three ways to tell the player which YouTube video to load. All of them work with both the UMD `<script>` build and the ESM package.
30
+
31
+ ### 1. `<source>` element with explicit type (markup-first / UMD recommended)
32
+
33
+ Use `type="x-video/youtube"` so the engine claims the source without any URL pattern matching. This is the most reliable approach for UMD usage and the best match for semantic HTML:
34
+
35
+ ```html
36
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@openplayerjs/player@latest/dist/openplayer.css" />
37
+ <script src="https://cdn.jsdelivr.net/npm/@openplayerjs/player@latest/dist/openplayer.js"></script>
38
+ <script src="https://cdn.jsdelivr.net/npm/@openplayerjs/youtube@latest/dist/openplayer-youtube.js"></script>
39
+
40
+ <video id="my-video">
41
+ <source src="https://www.youtube.com/embed/dQw4w9WgXcQ" type="x-video/youtube" />
42
+ </video>
43
+ <script>
44
+ const player = new OpenPlayerJS('my-video');
45
+ player.init();
46
+ </script>
47
+ ```
48
+
49
+ Bare 11-character video IDs also work with the explicit type:
50
+
51
+ ```html
52
+ <video id="my-video">
53
+ <source src="dQw4w9WgXcQ" type="x-video/youtube" />
54
+ </video>
55
+ ```
56
+
57
+ ### 2. `<source>` element — URL autodetection (no type required)
58
+
59
+ When the `src` is a recognisable YouTube URL the engine detects it automatically — no `type` attribute needed:
60
+
61
+ ```html
62
+ <video id="my-video">
63
+ <source src="https://www.youtube.com/watch?v=dQw4w9WgXcQ" />
64
+ </video>
65
+ <script>
66
+ const player = new OpenPlayerJS('my-video');
67
+ player.init();
68
+ </script>
69
+ ```
70
+
71
+ All supported URL formats are auto-detected (see [Supported source formats](#supported-source-formats)).
72
+
73
+ ### 3. `player.src` / `core.src` — runtime / SPA
74
+
75
+ Set or change the source programmatically at any time after `init()`:
76
+
77
+ ```ts
78
+ // ESM — with @openplayerjs/player
79
+ import { Core } from '@openplayerjs/core';
80
+ import { createUI, buildControls } from '@openplayerjs/player';
81
+ import { YouTubeMediaEngine } from '@openplayerjs/youtube';
82
+
83
+ const video = document.querySelector<HtmlVideoElement>('#video')!;
84
+ const core = new Core(video, {
85
+ plugins: [new YouTubeMediaEngine()],
86
+ });
87
+
88
+ createUI(
89
+ core,
90
+ video,
91
+ buildControls({
92
+ top: ['progress'],
93
+ 'bottom-left': ['play', 'time', 'volume'],
94
+ 'bottom-right': ['captions', 'settings', 'fullscreen'],
95
+ })
96
+ );
97
+
98
+ // Switch to any YouTube URL or bare ID at any time:
99
+ core.src = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
100
+ core.src = 'https://youtu.be/dQw4w9WgXcQ';
101
+ core.src = 'https://www.youtube.com/embed/dQw4w9WgXcQ';
102
+ core.src = 'https://www.youtube.com/shorts/dQw4w9WgXcQ';
103
+ core.src = 'https://m.youtube.com/watch?v=dQw4w9WgXcQ'; // mobile domain
104
+ core.src = 'dQw4w9WgXcQ'; // bare 11-character video ID
105
+ ```
106
+
107
+ ```ts
108
+ // ESM — with @openplayerjs/core directly
109
+ import { Core } from '@openplayerjs/core';
110
+ import { YouTubeMediaEngine } from '@openplayerjs/youtube';
111
+
112
+ const video = document.querySelector('video')!;
113
+ const core = new Core(video, {
114
+ plugins: [new YouTubeMediaEngine()],
115
+ });
116
+
117
+ core.src = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
118
+ await core.play();
119
+ ```
120
+
121
+ ```html
122
+ <!-- UMD — runtime source assignment -->
123
+ <script>
124
+ const player = new OpenPlayerJS('my-video');
125
+ player.init();
126
+ player.src = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
127
+ </script>
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Configuration
133
+
134
+ Pass options to the `YouTubeMediaEngine` constructor (ESM) or via the `youtube` key in the player config (UMD):
135
+
136
+ ```ts
137
+ // ESM
138
+ new YouTubeMediaEngine({ noCookie: true });
139
+
140
+ // UMD
141
+ new OpenPlayerJS('my-video', { youtube: { noCookie: true } });
142
+ ```
143
+
144
+ | Option | Type | Default | Description |
145
+ | ---------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
+ | `noCookie` | `boolean` | `false` | Serve the embed from `https://www.youtube-nocookie.com` instead of `https://www.youtube.com`. YouTube will not set cookies on the viewer's browser until they interact with the player. |
147
+
148
+ ---
149
+
150
+ ## How it works
151
+
152
+ 1. `YouTubeMediaEngine.canPlay()` accepts:
153
+ - An explicit `type="x-video/youtube"` attribute (highest priority)
154
+ - YouTube domain URLs: `youtube.com`, `m.youtube.com`, `youtu.be`, `youtube-nocookie.com`
155
+ - Bare 11-character video IDs (`dQw4w9WgXcQ`)
156
+ 2. On `attach()` the engine:
157
+ - Extracts the `videoId` from the source.
158
+ - Creates a `YouTubeIframeAdapter` that lazily loads the YouTube IFrame API script (`https://www.youtube.com/iframe_api`) the first time it is needed (singleton load — the script tag is only inserted once).
159
+ - Wraps the adapter in an `IframeMediaSurface`, which normalises adapter events into the standard `MediaSurface` contract (same events as `<video>`).
160
+ - Hides the native `<video>` element and mounts the YouTube iframe inside the player container.
161
+ - Subscribes to `ui:controls:show` / `ui:controls:hide` (emitted by `@openplayerjs/player`) to adjust the iframe height when the control bar appears or disappears. See [Caption-aware iframe height](#caption-aware-iframe-height) below.
162
+ 3. The `IframeMediaSurface` polls `getCurrentTime()` / `getDuration()` every 250 ms (configurable) so that `timeupdate` and `durationchange` events fire even though the IFrame API does not push them.
163
+ 4. On `detach()` the adapter is destroyed, the iframe is removed, the native element is restored, and all event subscriptions are cleaned up.
164
+
165
+ ---
166
+
167
+ ## Supported source formats
168
+
169
+ | Format | Example |
170
+ | ------------------- | --------------------------------------------- |
171
+ | Explicit MIME type | `type="x-video/youtube"` (any src) |
172
+ | Standard watch URL | `https://www.youtube.com/watch?v=<id>` |
173
+ | Mobile watch URL | `https://m.youtube.com/watch?v=<id>` |
174
+ | Short URL | `https://youtu.be/<id>` |
175
+ | Embed URL | `https://www.youtube.com/embed/<id>` |
176
+ | Shorts URL | `https://www.youtube.com/shorts/<id>` |
177
+ | No-cookie embed URL | `https://www.youtube-nocookie.com/embed/<id>` |
178
+ | Bare video ID | `dQw4w9WgXcQ` (11 characters) |
179
+
180
+ ---
181
+
182
+ ## API
183
+
184
+ `YouTubeMediaEngine` implements the standard `MediaEnginePlugin` interface from `@openplayerjs/core`. No YouTube-specific API is exposed — control the player through the standard `Core` / `Player` API.
185
+
186
+ ### `YouTubeIframeAdapter`
187
+
188
+ The adapter class is exported for advanced use (e.g. building custom engines):
189
+
190
+ ```ts
191
+ import { YouTubeIframeAdapter } from '@openplayerjs/youtube/src/youtubeAdapter';
192
+
193
+ const adapter = new YouTubeIframeAdapter({ videoId: 'dQw4w9WgXcQ', noCookie: true });
194
+ await adapter.mount(containerEl);
195
+ adapter.play();
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Caption-aware iframe height
201
+
202
+ YouTube renders its own caption overlay inside the iframe. When the OpenPlayerJS control bar is visible, that overlay can overlap or be hidden behind the bar.
203
+
204
+ To prevent this, the engine automatically shrinks the iframe height by the control bar's height (`--op-controls-height`, default `48px`) **only when both conditions are true simultaneously:**
205
+
206
+ | Condition | When true |
207
+ | ------------------------- | ------------------------------------------------------------ |
208
+ | Controls are visible | `ui:controls:show` fired by `@openplayerjs/player` |
209
+ | A caption track is active | `captionProvider.setTrack()` called with a non-null track ID |
210
+
211
+ When either condition is false (controls hidden, or captions off), the iframe is restored to `height: 100%`.
212
+
213
+ This means:
214
+
215
+ - **Captions off** — iframe always fills the full container regardless of controls visibility. No wasted space.
216
+ - **Captions on, controls visible** — iframe shrinks so YouTube's caption text appears above the controls bar.
217
+ - **Captions on, controls hidden** — iframe expands back to full height.
218
+
219
+ The height adjustment is driven entirely through `core.events` and JavaScript — no CSS rule is needed. If you use `@openplayerjs/player`, the `ui:controls:show` / `ui:controls:hide` events are emitted automatically. If you mount the YouTube engine without the player UI (e.g. with a custom control bar), emit those events yourself:
220
+
221
+ ```ts
222
+ // Signal that your controls are now visible
223
+ core.events.emit('ui:controls:show');
224
+
225
+ // Signal that your controls are now hidden
226
+ core.events.emit('ui:controls:hide');
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Caption preference persistence
232
+
233
+ The YouTube IFrame API sets `cc_load_policy: 1`, which auto-enables captions every time the player loads. To respect the user's explicit choice across page refreshes, the player persists the on/off state in `localStorage`.
234
+
235
+ This is handled entirely by `@openplayerjs/player`'s `CaptionsControl` — **no extra configuration is needed** in the YouTube engine or your application.
236
+
237
+ ### How it works
238
+
239
+ | User action | What is stored |
240
+ | ---------------------------------------------- | ------------------------------------------------------- |
241
+ | Clicks captions button to turn **off** | `op:caption:track = ''` (empty string = explicitly off) |
242
+ | Selects a caption track from the settings menu | `op:caption:track = '<track-id>'` (e.g. `en`) |
243
+ | Clicks captions button to turn **on** | `op:caption:track = '<track-id>'` |
244
+
245
+ On the next page load, `CaptionsControl` reads the stored value and:
246
+
247
+ - **`''` (explicitly off)** — calls `setTrack(null)` immediately after the YouTube tracklist loads, overriding `cc_load_policy: 1`. Captions stay off.
248
+ - **`'<track-id>'`** — re-applies the saved track before `refresh()` fires so the captions button appears lit without any flash.
249
+ - **Key absent** — no preference stored (first visit); YouTube's own default applies (`cc_load_policy: 1` shows captions if available).
250
+
251
+ ### Clearing the preference
252
+
253
+ ```ts
254
+ // Programmatically reset to "no preference" (next load will use YouTube's default)
255
+ localStorage.removeItem('op:caption:track');
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Building an iframe engine for other providers
261
+
262
+ The `IframeMediaSurface`, `IframeMediaAdapter` contract, and the full engine authoring guide are documented in the `@openplayerjs/core` README under **Writing a custom media engine → Iframe engine**.
263
+
264
+ Key exports from `@openplayerjs/core`:
265
+
266
+ ```ts
267
+ import {
268
+ IframeMediaSurface,
269
+ type IframeMediaAdapter,
270
+ type IframeMediaAdapterEvents,
271
+ type IframePlaybackState,
272
+ } from '@openplayerjs/core';
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Requirements
278
+
279
+ - `@openplayerjs/core` ≥ 3.0
280
+ - A browser environment (the YouTube IFrame API and DOM APIs are required)
281
+ - Network access to `https://www.youtube.com/iframe_api` at runtime
282
+
283
+ ---
284
+
285
+ ## Code samples
286
+
287
+ - https://codepen.io/rafa8626/pen/yyagYMq
288
+ - https://codepen.io/rafa8626/pen/xbEgwrv
289
+
290
+ ---
291
+
292
+ ## License
293
+
294
+ MIT — see [LICENSE](../../LICENSE).
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.full.d.ts","../../core/dist/types/core/configuration.d.ts","../../core/dist/types/core/events.d.ts","../../core/dist/types/core/lease.d.ts","../../core/dist/types/core/dispose.d.ts","../../core/dist/types/core/state.d.ts","../../core/dist/types/core/plugin.d.ts","../../core/dist/types/core/surface.d.ts","../../core/dist/types/core/index.d.ts","../../core/dist/types/core/media.d.ts","../../core/dist/types/engines/base.d.ts","../../core/dist/types/engines/html5.d.ts","../../core/dist/types/core/overlay.d.ts","../../core/dist/types/core/constants.d.ts","../../core/dist/types/core/utils.d.ts","../../core/dist/types/engines/iframe.d.ts","../../core/dist/types/core/captions.d.ts","../../core/dist/types/index.d.ts","../src/youtubeadapter.ts","../src/youtube.ts","../src/index.ts","../src/umd.ts","../../../node_modules/.pnpm/@jest+expect-utils@29.7.0/node_modules/@jest/expect-utils/build/index.d.ts","../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/index.d.ts","../../../node_modules/.pnpm/@sinclair+typebox@0.27.10/node_modules/@sinclair/typebox/typebox.d.ts","../../../node_modules/.pnpm/@jest+schemas@29.6.3/node_modules/@jest/schemas/build/index.d.ts","../../../node_modules/.pnpm/pretty-format@29.7.0/node_modules/pretty-format/build/index.d.ts","../../../node_modules/.pnpm/jest-diff@29.7.0/node_modules/jest-diff/build/index.d.ts","../../../node_modules/.pnpm/jest-matcher-utils@29.7.0/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.d.ts","../../../node_modules/.pnpm/@types+jest@29.5.14/node_modules/@types/jest/index.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/utility.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/client-stats.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/h2c-client.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@7.16.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/sqlite.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node/index.d.ts"],"fileIdsList":[[86,140,157,158],[77,86,140,157,158],[79,82,86,140,157,158],[86,137,138,140,157,158],[86,139,140,157,158],[140,157,158],[86,140,145,157,158,175],[86,140,141,146,151,157,158,160,172,183],[86,140,141,142,151,157,158,160],[86,140,143,157,158,184],[86,140,144,145,152,157,158,161],[86,140,145,157,158,172,180],[86,140,146,148,151,157,158,160],[86,139,140,147,157,158],[86,140,148,149,157,158],[86,140,150,151,157,158],[86,139,140,151,157,158],[86,140,151,152,153,157,158,172,183],[86,140,151,152,153,157,158,167,172,175],[86,132,140,148,151,154,157,158,160,172,183],[86,140,151,152,154,155,157,158,160,172,180,183],[86,140,154,156,157,158,172,180,183],[84,85,86,87,88,89,90,91,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189],[86,140,151,157,158],[86,140,157,158,159,183],[86,140,148,151,157,158,160,172],[86,140,157,158,161],[86,140,157,158,162],[86,139,140,157,158,163],[86,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189],[86,140,157,158,165],[86,140,157,158,166],[86,140,151,157,158,167,168],[86,140,157,158,167,169,184,186],[86,140,152,157,158],[86,140,151,157,158,172,173,175],[86,140,157,158,174,175],[86,140,157,158,172,173],[86,140,157,158,175],[86,140,157,158,176],[86,137,140,157,158,172,177,183],[86,140,151,157,158,178,179],[86,140,157,158,178,179],[86,140,145,157,158,160,172,180],[86,140,157,158,181],[86,140,157,158,160,182],[86,140,154,157,158,166,183],[86,140,145,157,158,184],[86,140,157,158,172,185],[86,140,157,158,159,186],[86,140,157,158,187],[86,140,145,157,158],[86,132,140,157,158],[86,140,157,158,188],[86,132,140,151,153,157,158,163,172,175,183,185,186,188],[86,140,157,158,172,189],[75,81,86,140,157,158],[79,86,140,157,158],[76,80,86,140,157,158],[78,86,140,157,158],[86,98,101,104,105,140,157,158,183],[86,101,140,157,158,172,183],[86,101,105,140,157,158,183],[86,140,157,158,172],[86,95,140,157,158],[86,99,140,157,158],[86,97,98,101,140,157,158,183],[86,140,157,158,160,180],[86,140,157,158,190],[86,95,140,157,158,190],[86,97,101,140,157,158,160,183],[86,92,93,94,96,100,140,151,157,158,172,183],[86,101,109,117,140,157,158],[86,93,99,140,157,158],[86,101,126,127,140,157,158],[86,93,96,101,140,157,158,175,183,190],[86,101,140,157,158],[86,97,101,140,157,158,183],[86,92,140,157,158],[86,95,96,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,129,130,131,140,157,158],[86,101,119,122,140,148,157,158],[86,101,109,110,111,140,157,158],[86,99,101,110,112,140,157,158],[86,100,140,157,158],[86,93,95,101,140,157,158],[86,101,105,110,112,140,157,158],[86,105,140,157,158],[86,99,101,104,140,157,158,183],[86,93,97,101,109,140,157,158],[86,101,119,140,157,158],[86,112,140,157,158],[86,95,101,126,140,157,158,175,188,190],[61,86,140,157,158],[54,55,56,58,59,60,86,140,157,158],[55,60,61,86,140,157,158],[55,86,140,157,158],[55,56,57,58,61,86,140,157,158],[55,60,62,86,140,157,158],[62,63,86,140,157,158],[60,86,140,157,158],[54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,140,157,158],[72,86,140,157,158],[70,71,86,140,157,158],[70,86,140,157,158]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1305d1e76ca44e30fb8b2b8075fa522b83f60c0bcf5d4326a9d2cf79b53724f8","impliedFormat":1},"70fba65c9d1b53c6f9781c06f8957c12048e4152cc3d4075d1fd793be81b2122","2e2d4be3c79cdf4943849e9f72da272431d9ea24a4325df6dcbdf5c521a13638","81cf4184adbc41b34305f9472ccddabdd4f04c62b0ad99ba71bec06f61ada0eb","cdf2e11d4fc6fd22798ebed27d52d88633c177fa4c3e4d4691259b20eb565b0b","7a0a2e5ffc11cd14e752fb718636b56737a826d7db821f5e84c63ad73faa0b8a","b000a9e9daea63ef6fa8d9e7ea6d02e2b913164e86392e267b01752719891223","90e639b05ad0b5d8e6459c05a030aa03fc756a4ca6855839a6c1fdc4b469732c","ace0d2861e6cbf8c47e94b16fda0aa2cdf9fe758a496ecc0c2db463a157f548c","c032d04283bb3169da849ee9b514d91759d644ce2bcf30cb07690147b3b9dea6","fb886d3bcc7dc549fc7427a90f935e62e01c8af2eb5c033d47a1c961fb545768","ea4f730a74a42dffd08b822fdd60b2e94742566e8c270b3b5b03362298cb8283","a05d02394c51b9e0a82990dca7fcf9cbb55c39d9c44842c874974d00ee8ebdc3","593affee4870a2a8c5bcc6beab16382d5d4713191723e5e23aef03b366bc5ff3","18a813adec9859e3eaac20f7599cdec27a89f01b6c1387afd8ff50e527271d6e","73c58002b2160767de5c3628917c3453b4477688cddbc470e51ac2fd835673ff","2b1f51d864474c8c915130236ce5607b3d924c95d64573ac629a706c203de8b0","3fd706e193e1446c4ff4fdc8a5ad0476fd49fa147bda578c0d25adddeba9392b",{"version":"0f95ee967b467baf647a447fc4e1ed2387742a7172a37da0114340278200e30b","signature":"e3d508c28040bb2ca0d14be8e97896730dffc38b801bd704bca550318833eb50","affectsGlobalScope":true},{"version":"2d811cb96d4797c68758aa0177319976be0d96e16e3126e04b6400d6e8201e83","signature":"9b893719af72c69cee98fda0b17c2eecf3a5f3c6e5b59ec847d4be0372882b46"},{"version":"087c511d027ff5ffacdcebad24a7b7ae0d7ba718598c6bc31014b8b8bb79151d","signature":"432881bac6159b07b19dd79674c622d7187cef153a6d9f6244ab50c5148dabdd"},{"version":"0e47ae20718b2c3536f96e4c3ab6607f856bbe55cda3b30a4e4365681170a1f0","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"e1028394c1cf96d5d057ecc647e31e457b919092f882ed0c7092152b077fed9d","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"378281aa35786c27d5811af7e6bcaa492eebd0c7013d48137c35bbc69a2b9751","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b2dd1cbeb0cc6ae20795958ba5950395ebb2849b7c8326853dd15530c77ab0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"387a023d363f755eb63450a66c28b14cdd7bc30a104565e2dbf0a8988bb4a56c","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"487b694c3de27ddf4ad107d4007ad304d29effccf9800c8ae23c2093638d906a","impliedFormat":1},{"version":"3a80bc85f38526ca3b08007ee80712e7bb0601df178b23fbf0bf87036fce40ce","impliedFormat":1},{"version":"ccf4552357ce3c159ef75f0f0114e80401702228f1898bdc9402214c9499e8c0","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"2931540c47ee0ff8a62860e61782eb17b155615db61e36986e54645ec67f67c2","impliedFormat":1},{"version":"ccab02f3920fc75c01174c47fcf67882a11daf16baf9e81701d0a94636e94556","impliedFormat":1},{"version":"f6faf5f74e4c4cc309a6c6a6c4da02dbb840be5d3e92905a23dcd7b2b0bd1986","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"33e981bf6376e939f99bd7f89abec757c64897d33c005036b9a10d9587d80187","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"b41767d372275c154c7ea6c9d5449d9a741b8ce080f640155cc88ba1763e35b3","impliedFormat":1},{"version":"3bacf516d686d08682751a3bd2519ea3b8041a164bfb4f1d35728993e70a2426","impliedFormat":1},{"version":"7fb266686238369442bd1719bc0d7edd0199da4fb8540354e1ff7f16669b4323","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"54c3e2371e3d016469ad959697fd257e5621e16296fa67082c2575d0bf8eced0","impliedFormat":1},{"version":"beb8233b2c220cfa0feea31fbe9218d89fa02faa81ef744be8dce5acb89bb1fd","impliedFormat":1},{"version":"c183b931b68ad184bc8e8372bf663f3d33304772fb482f29fb91b3c391031f3e","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"48cc3ec153b50985fb95153258a710782b25975b10dd4ac8a4f3920632d10790","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"e1528ca65ac90f6fa0e4a247eb656b4263c470bb22d9033e466463e13395e599","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"866078923a56d026e39243b4392e282c1c63159723996fa89243140e1388a98d","impliedFormat":1},{"version":"f724236417941ea77ec8d38c6b7021f5fb7f8521c7f8c1538e87661f2c6a0774","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d97fb21da858fb18b8ae72c314e9743fd52f73ebe2764e12af1db32fc03f853f","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ea15fd99b2e34cb25fe8346c955000bb70c8b423ae4377a972ef46bfb37f595","impliedFormat":1},{"version":"7cf69dd5502c41644c9e5106210b5da7144800670cbe861f66726fa209e231c4","impliedFormat":1},{"version":"72c1f5e0a28e473026074817561d1bc9647909cf253c8d56c41d1df8d95b85f7","impliedFormat":1},{"version":"f9b4137a0d285bd77dba2e6e895530112264310ae47e07bf311feae428fb8b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b21e13ed07d0df176ae31d6b7f01f7b17d66dbeb489c0d31d00de2ca14883da","impliedFormat":1},{"version":"51aecd2df90a3cffea1eb4696b33b2d78594ea2aa2138e6b9471ec4841c6c2ee","impliedFormat":1},{"version":"9d8f9e63e29a3396285620908e7f14d874d066caea747dc4b2c378f0599166b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"f929f0b6b3421a2d34344b0f421f45aeb2c84ad365ebf29d04312023b3accc58","impliedFormat":1},{"version":"db9ada976f9e52e13f7ae8b9a320f4b67b87685938c5879187d8864b2fbe97f3","impliedFormat":1},{"version":"9f39e70a354d0fba29ac3cdf6eca00b7f9e96f64b2b2780c432e8ea27f133743","impliedFormat":1},{"version":"0dace96cc0f7bc6d0ee2044921bdf19fe42d16284dbcc8ae200800d1c9579335","impliedFormat":1},{"version":"a2e2bbde231b65c53c764c12313897ffdfb6c49183dd31823ee2405f2f7b5378","impliedFormat":1},{"version":"ad1cc0ed328f3f708771272021be61ab146b32ecf2b78f3224959ff1e2cd2a5c","impliedFormat":1},{"version":"c64e1888baaa3253ca4405b455e4bf44f76357868a1bd0a52998ade9a092ad78","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc8c6f5322961b56d9906601b20798725df60baeab45ec014fba9f795d5596fd","impliedFormat":1},{"version":"0904660ae854e6d41f6ff25356db1d654436c6305b0f0aa89d1532df0253486e","impliedFormat":1},{"version":"9cdfd0a77dd7eeed57e91d3f449274ea2470abdb7e167a2f146b1ea8de6224e0","impliedFormat":1},{"version":"230bdc111d7578276e4a3bb9d075d85c78c6b68f428c3a9935e2eaa10f4ae1f5","impliedFormat":1},{"version":"e8aabbee5e7b9101b03bb4222607d57f38859b8115a8050a4eb91b4ee43a3a73","impliedFormat":1},{"version":"bbf42f98a5819f4f06e18c8b669a994afe9a17fe520ae3454a195e6eabf7700d","impliedFormat":1},{"version":"0e5974dfff7a97181c7c376545f126b20acf2f1341db7d3fccea4977bf3ce19c","impliedFormat":1},{"version":"c8b85f7aed29f8f52b813f800611406b0bfe5cf3224d20a4bdda7c7f73ce368e","affectsGlobalScope":true,"impliedFormat":1},{"version":"145dcf25fd4967c610c53d93d7bc4dce8fbb1b6dd7935362472d4ae49363c7ba","impliedFormat":1},{"version":"ff65b8a8bd380c6d129becc35de02f7c29ad7ce03300331ca91311fb4044d1a9","impliedFormat":1},{"version":"04bf1aa481d1adfb16d93d76e44ce71c51c8ef68039d849926551199489637f6","impliedFormat":1},{"version":"9043daec15206650fa119bad6b8d70136021ea7d52673a71f79a87a42ee38d44","affectsGlobalScope":true,"impliedFormat":1},{"version":"19098980aa72095ea5786f527ff6b249cc940d1ee1e6a3b2cd2c1a73fcb5a376","affectsGlobalScope":true,"impliedFormat":1},{"version":"a58a15da4c5ba3df60c910a043281256fa52d36a0fcdef9b9100c646282e88dd","impliedFormat":1},{"version":"b36beffbf8acdc3ebc58c8bb4b75574b31a2169869c70fc03f82895b93950a12","impliedFormat":1},{"version":"de263f0089aefbfd73c89562fb7254a7468b1f33b61839aafc3f035d60766cb4","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"8c81fd4a110490c43d7c578e8c6f69b3af01717189196899a6a44f93daa57a3a","impliedFormat":1},{"version":"5fb39858b2459864b139950a09adae4f38dad87c25bf572ce414f10e4bd7baab","impliedFormat":1},{"version":"2031147ea9cbd361712e0c5d5ebd518b5cead2bbc4d2d501ab15c88385a5aba7","impliedFormat":1},{"version":"b33b74b97952d9bf4fbd2951dcfbb5136656ddb310ce1c84518aaa77dbca9992","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"8d117798e5228c7fdff887f44851d07320739c5cc0d511afae8f250c51809a36","affectsGlobalScope":true,"impliedFormat":1},{"version":"c119835edf36415081dfd9ed15fc0cd37aaa28d232be029ad073f15f3d88c323","impliedFormat":1},{"version":"8e7c3bed5f19ade8f911677ddc83052e2283e25b0a8654cd89db9079d4b323c7","impliedFormat":1},{"version":"9705cd157ffbb91c5cab48bdd2de5a437a372e63f870f8a8472e72ff634d47c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ae86f30d5d10e4f75ce8dcb6e1bd3a12ecec3d071a21e8f462c5c85c678efb41","impliedFormat":1},{"version":"ccf3afaeebbeee4ca9092101e99fd6abd681116b6e5ec23e381bbb1e1f32262c","impliedFormat":1},{"version":"e03460fe72b259f6d25ad029f085e4bedc3f90477da4401d8fbc1efa9793230e","impliedFormat":1},{"version":"4286a3a6619514fca656089aee160bb6f2e77f4dd53dc5a96b26a0b4fc778055","impliedFormat":1},{"version":"ab7818a9d57a9297b90e456fc68b77f84d74395a9210a3cfa9d87db33aff8b14","affectsGlobalScope":true,"impliedFormat":1},{"version":"3585d6891e9ea18e07d0755a6d90d71331558ba5dc5561933553209f886db106","affectsGlobalScope":true,"impliedFormat":1},{"version":"86be71cbb0593468644932a6eb96d527cfa600cecfc0b698af5f52e51804451d","impliedFormat":1},{"version":"255d948f87f24ffd57bcb2fdf95792fd418a2e1f712a98cf2cce88744d75085c","impliedFormat":1},{"version":"0d5b085f36e6dc55bc6332ecb9c733be3a534958c238fb8d8d18d4a2b6f2a15a","impliedFormat":1},{"version":"0c613a01c175585bc5ab6d0d97ce3cf25e6539615ca61e16aa1cab0b1499ea43","affectsGlobalScope":true,"impliedFormat":1},{"version":"2a034894bf28c220a331c7a0229d33564803abe2ac1b9a5feee91b6b9b6e88ea","impliedFormat":1},{"version":"d7e9ab1b0996639047c61c1e62f85c620e4382206b3abb430d9a21fb7bc23c77","impliedFormat":1}],"root":[[71,74]],"options":{"composite":true,"declaration":true,"declarationDir":"./types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":7,"tsBuildInfoFile":"./.tsbuildinfo","useDefineForClassFields":true},"referencedMap":[[75,1],[78,2],[77,1],[83,3],[137,4],[138,4],[139,5],[86,6],[140,7],[141,8],[142,9],[84,1],[143,10],[144,11],[145,12],[146,13],[147,14],[148,15],[149,15],[150,16],[151,17],[152,18],[153,19],[87,1],[85,1],[154,20],[155,21],[156,22],[190,23],[157,24],[158,1],[159,25],[160,26],[161,27],[162,28],[163,29],[164,30],[165,31],[166,32],[167,33],[168,33],[169,34],[170,1],[171,35],[172,36],[174,37],[173,38],[175,39],[176,40],[177,41],[178,42],[179,43],[180,44],[181,45],[182,46],[183,47],[184,48],[185,49],[186,50],[187,51],[88,1],[89,52],[90,1],[91,1],[133,53],[134,54],[135,1],[136,39],[188,55],[189,56],[76,1],[82,57],[80,58],[81,59],[79,60],[51,1],[52,1],[10,1],[8,1],[9,1],[14,1],[13,1],[2,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[3,1],[23,1],[24,1],[4,1],[25,1],[29,1],[26,1],[27,1],[28,1],[30,1],[31,1],[32,1],[5,1],[33,1],[34,1],[35,1],[36,1],[6,1],[40,1],[37,1],[38,1],[39,1],[41,1],[7,1],[42,1],[53,1],[47,1],[48,1],[43,1],[44,1],[45,1],[46,1],[1,1],[49,1],[50,1],[12,1],[11,1],[109,61],[121,62],[107,63],[122,64],[131,65],[98,66],[99,67],[97,68],[130,69],[125,70],[129,71],[101,72],[118,73],[100,74],[128,75],[95,76],[96,70],[102,77],[103,1],[108,78],[106,77],[93,79],[132,80],[123,81],[112,82],[111,77],[113,83],[116,84],[110,85],[114,86],[126,69],[104,87],[105,88],[117,89],[94,64],[120,90],[119,77],[115,91],[124,1],[92,1],[127,92],[69,93],[54,1],[66,1],[57,1],[55,1],[61,94],[56,1],[62,95],[65,96],[59,97],[58,1],[60,96],[67,1],[63,98],[64,99],[68,100],[70,101],[73,102],[74,102],[72,103],[71,104]],"latestChangedDtsFile":"./types/umd.d.ts","version":"5.9.3"}
package/dist/index.js ADDED
@@ -0,0 +1,523 @@
1
+ import { BaseMediaEngine, IframeMediaSurface, setCaptionTrackProvider } from '@openplayerjs/core';
2
+
3
+ // ─── YT player-state → adapter state ─────────────────────────────────────────
4
+ const YT_STATE_MAP = {
5
+ '-1': 'idle', // unstarted
6
+ 0: 'ended',
7
+ 1: 'playing',
8
+ 2: 'paused',
9
+ 3: 'buffering',
10
+ 5: 'idle', // video cued
11
+ };
12
+ // ─── API loader (shared singleton) ───────────────────────────────────────────
13
+ let apiLoadPromise = null;
14
+ function loadYouTubeAPI() {
15
+ if (window.YT?.Player)
16
+ return Promise.resolve();
17
+ if (apiLoadPromise)
18
+ return apiLoadPromise;
19
+ apiLoadPromise = new Promise((resolve) => {
20
+ const prev = window.onYouTubeIframeAPIReady;
21
+ window.onYouTubeIframeAPIReady = () => {
22
+ prev?.();
23
+ resolve();
24
+ };
25
+ if (!document.querySelector('script[src*="youtube.com/iframe_api"]')) {
26
+ const script = document.createElement('script');
27
+ script.src = 'https://www.youtube.com/iframe_api';
28
+ document.head.appendChild(script);
29
+ }
30
+ });
31
+ return apiLoadPromise;
32
+ }
33
+ // ─── YouTubeIframeAdapter ─────────────────────────────────────────────────────
34
+ class YouTubeIframeAdapter {
35
+ constructor(options) {
36
+ Object.defineProperty(this, "player", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: null
41
+ });
42
+ Object.defineProperty(this, "videoId", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: void 0
47
+ });
48
+ Object.defineProperty(this, "noCookie", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: void 0
53
+ });
54
+ Object.defineProperty(this, "handlers", {
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true,
58
+ value: {}
59
+ });
60
+ Object.defineProperty(this, "iframeEl", {
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true,
64
+ value: null
65
+ });
66
+ Object.defineProperty(this, "_ready", {
67
+ enumerable: true,
68
+ configurable: true,
69
+ writable: true,
70
+ value: false
71
+ });
72
+ Object.defineProperty(this, "_pendingPlay", {
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true,
76
+ value: false
77
+ });
78
+ this.videoId = options.videoId;
79
+ this.noCookie = options.noCookie ?? false;
80
+ }
81
+ // ─── Event emitter ──────────────────────────────────────────────────────
82
+ on(evt, cb) {
83
+ if (!this.handlers[evt]) {
84
+ this.handlers[evt] = new Set();
85
+ }
86
+ this.handlers[evt].add(cb);
87
+ }
88
+ off(evt, cb) {
89
+ this.handlers[evt]?.delete(cb);
90
+ }
91
+ emit(evt, ...args) {
92
+ this.handlers[evt]?.forEach((cb) => cb(...args));
93
+ }
94
+ // ─── Lifecycle ──────────────────────────────────────────────────────────
95
+ async mount(container) {
96
+ await loadYouTubeAPI();
97
+ // Ensure the container can act as a positioning context for the iframe.
98
+ if (getComputedStyle(container).position === 'static') {
99
+ container.style.position = 'relative';
100
+ }
101
+ // YT.Player replaces the given element with the iframe.
102
+ const div = document.createElement('div');
103
+ container.appendChild(div);
104
+ return new Promise((resolve) => {
105
+ const opts = {
106
+ videoId: this.videoId,
107
+ width: '100%',
108
+ height: '100%',
109
+ playerVars: {
110
+ controls: 0,
111
+ disablekb: 1,
112
+ modestbranding: 1,
113
+ rel: 0,
114
+ playsinline: 1,
115
+ cc_load_policy: 1,
116
+ },
117
+ events: {
118
+ onReady: () => {
119
+ // Stretch the iframe YT created to fill the container absolutely so it
120
+ // overlays the hidden native media element regardless of its size.
121
+ const iframe = container.querySelector('iframe');
122
+ if (iframe) {
123
+ this.iframeEl = iframe;
124
+ iframe.style.cssText =
125
+ 'position:absolute;top:0;left:0;width:100%;height:100%;border:0;pointer-events:none;';
126
+ iframe.classList.add('op-youtube-iframe');
127
+ }
128
+ this._ready = true;
129
+ if (this._pendingPlay) {
130
+ this._pendingPlay = false;
131
+ this.player?.playVideo();
132
+ }
133
+ this.emit('ready');
134
+ resolve();
135
+ },
136
+ onStateChange: (e) => {
137
+ const state = YT_STATE_MAP[e.data] ?? 'idle';
138
+ this.emit('state', state);
139
+ },
140
+ onError: (e) => {
141
+ this.emit('error', e.data);
142
+ },
143
+ onPlaybackRateChange: (e) => {
144
+ this.emit('ratechange', e.data);
145
+ },
146
+ },
147
+ };
148
+ if (this.noCookie) {
149
+ opts.host = 'https://www.youtube-nocookie.com';
150
+ }
151
+ this.player = new window.YT.Player(div, opts);
152
+ });
153
+ }
154
+ destroy() {
155
+ try {
156
+ this.player?.destroy();
157
+ }
158
+ catch {
159
+ // ignore
160
+ }
161
+ this.player = null;
162
+ this.iframeEl = null;
163
+ this._ready = false;
164
+ this._pendingPlay = false;
165
+ for (const key of Object.keys(this.handlers)) {
166
+ this.handlers[key]?.clear();
167
+ }
168
+ }
169
+ getElement() {
170
+ return this.iframeEl;
171
+ }
172
+ // ─── Playback ───────────────────────────────────────────────────────────
173
+ play() {
174
+ if (!this._ready) {
175
+ this._pendingPlay = true;
176
+ return;
177
+ }
178
+ this.player?.playVideo();
179
+ }
180
+ pause() {
181
+ this._pendingPlay = false;
182
+ this.player?.pauseVideo();
183
+ }
184
+ seekTo(seconds) {
185
+ this.player?.seekTo(seconds, true);
186
+ }
187
+ // ─── Volume ─────────────────────────────────────────────────────────────
188
+ /** Accepts 0..1; YT API uses 0..100. */
189
+ setVolume(volume01) {
190
+ this.player?.setVolume(volume01 * 100);
191
+ }
192
+ /** Returns 0..1. */
193
+ getVolume() {
194
+ return (this.player?.getVolume() ?? 100) / 100;
195
+ }
196
+ mute() {
197
+ this.player?.mute();
198
+ }
199
+ unmute() {
200
+ this.player?.unMute();
201
+ }
202
+ isMuted() {
203
+ return this.player?.isMuted() ?? false;
204
+ }
205
+ // ─── Rate ────────────────────────────────────────────────────────────────
206
+ setPlaybackRate(rate) {
207
+ this.player?.setPlaybackRate(rate);
208
+ }
209
+ getPlaybackRate() {
210
+ return this.player?.getPlaybackRate() ?? 1;
211
+ }
212
+ // ─── Time ────────────────────────────────────────────────────────────────
213
+ getCurrentTime() {
214
+ return this.player?.getCurrentTime() ?? 0;
215
+ }
216
+ getDuration() {
217
+ return this.player?.getDuration() ?? NaN;
218
+ }
219
+ // ─── Captions ────────────────────────────────────────────────────────────
220
+ /** Returns available YouTube caption tracks (best-effort; undocumented API). */
221
+ getAvailableCaptionTracks() {
222
+ try {
223
+ const tracklist = this.player?.getOption?.('captions', 'tracklist') ?? [];
224
+ return tracklist.map((t) => ({
225
+ id: String(t.languageCode ?? t.vss_id ?? ''),
226
+ label: String(t.displayName ?? t.languageCode ?? ''),
227
+ language: String(t.languageCode ?? ''),
228
+ }));
229
+ }
230
+ catch {
231
+ return [];
232
+ }
233
+ }
234
+ /** Returns the active caption track language code, or null if captions are off. */
235
+ getActiveCaptionTrack() {
236
+ try {
237
+ const track = this.player?.getOption?.('captions', 'track');
238
+ const code = track?.languageCode;
239
+ return code && String(code).length > 0 ? String(code) : null;
240
+ }
241
+ catch {
242
+ return null;
243
+ }
244
+ }
245
+ /** Sets the active caption track by language code, or disables captions when null. */
246
+ setCaptionTrack(languageCode) {
247
+ try {
248
+ this.player?.setOption?.('captions', 'track', languageCode ? { languageCode } : {});
249
+ }
250
+ catch {
251
+ // ignore — undocumented API, may not be available
252
+ }
253
+ }
254
+ }
255
+
256
+ class YouTubeMediaEngine extends BaseMediaEngine {
257
+ constructor(config = {}) {
258
+ super();
259
+ Object.defineProperty(this, "name", {
260
+ enumerable: true,
261
+ configurable: true,
262
+ writable: true,
263
+ value: 'youtube'
264
+ });
265
+ Object.defineProperty(this, "version", {
266
+ enumerable: true,
267
+ configurable: true,
268
+ writable: true,
269
+ value: '1.0.0'
270
+ });
271
+ Object.defineProperty(this, "capabilities", {
272
+ enumerable: true,
273
+ configurable: true,
274
+ writable: true,
275
+ value: ['media-engine']
276
+ });
277
+ Object.defineProperty(this, "priority", {
278
+ enumerable: true,
279
+ configurable: true,
280
+ writable: true,
281
+ value: 50
282
+ });
283
+ Object.defineProperty(this, "noCookie", {
284
+ enumerable: true,
285
+ configurable: true,
286
+ writable: true,
287
+ value: void 0
288
+ });
289
+ Object.defineProperty(this, "ytSurface", {
290
+ enumerable: true,
291
+ configurable: true,
292
+ writable: true,
293
+ value: null
294
+ });
295
+ Object.defineProperty(this, "ytAdapter", {
296
+ enumerable: true,
297
+ configurable: true,
298
+ writable: true,
299
+ value: null
300
+ });
301
+ Object.defineProperty(this, "ytCleanupControls", {
302
+ enumerable: true,
303
+ configurable: true,
304
+ writable: true,
305
+ value: null
306
+ });
307
+ this.noCookie = config.noCookie ?? false;
308
+ }
309
+ canPlay(source) {
310
+ const url = source.src;
311
+ if (!url)
312
+ return false;
313
+ // Explicit MIME type declared on a <source> element takes precedence.
314
+ if (source.type === 'x-video/youtube')
315
+ return true;
316
+ return this.isYouTubeUrl(url) || this.looksLikeYouTubeId(url);
317
+ }
318
+ async attach(ctx) {
319
+ const urlOrId = ctx.activeSource?.src ?? '';
320
+ if (!urlOrId)
321
+ throw new Error('YouTubeMediaEngine: missing source URL');
322
+ const videoId = this.extractVideoId(urlOrId, ctx.activeSource?.type);
323
+ if (!videoId)
324
+ throw new Error('YouTubeMediaEngine: cannot parse videoId from source');
325
+ const adapter = new YouTubeIframeAdapter({ videoId, noCookie: this.noCookie });
326
+ const surface = new IframeMediaSurface(adapter, { pollIntervalMs: 250 });
327
+ ctx.setSurface(surface);
328
+ this.bindSurfaceEvents(surface, ctx.events);
329
+ this.bindCommands(ctx);
330
+ // Use display:none to remove the native element from layout; give the container an
331
+ // explicit aspect ratio so its height is determined by CSS inheritance, not the video.
332
+ ctx.media.style.display = 'none';
333
+ const cw = ctx.container.offsetWidth;
334
+ const ch = ctx.container.offsetHeight;
335
+ ctx.container.style.aspectRatio = cw > 0 && ch > 0 ? `${cw} / ${ch}` : '16 / 9';
336
+ // Caption preference helpers — persisted under a YouTube-specific key so the
337
+ // player package stays agnostic about storage.
338
+ const CC_PREF_KEY = 'op:yt:caption:track';
339
+ const readCcPref = () => {
340
+ try {
341
+ const v = localStorage.getItem(CC_PREF_KEY);
342
+ if (v === null)
343
+ return undefined; // key absent = no preference
344
+ if (v === '')
345
+ return null; // '' = explicitly off
346
+ return v; // non-empty string = track id
347
+ }
348
+ catch {
349
+ return undefined;
350
+ }
351
+ };
352
+ const saveCcPref = (id) => {
353
+ try {
354
+ localStorage.setItem(CC_PREF_KEY, id ?? '');
355
+ }
356
+ catch { /* ignore */ }
357
+ };
358
+ // Register the caption provider BEFORE mount() so it is available when
359
+ // the IframeMediaSurface emits 'loadedmetadata' during onAdapterReady().
360
+ // subscribe() lets the provider push a refresh notification to the UI once
361
+ // the YouTube captions module has loaded its tracklist (lazy, post-onReady).
362
+ // Local state — getOption('captions','track') doesn't reflect setOption() synchronously,
363
+ // so we maintain the active track id ourselves. null = captions off.
364
+ // Initialized to undefined until the subscribe poll confirms tracks are available;
365
+ // at that point cc_load_policy:1 means captions are on, so we prime with the first track.
366
+ let activeTrackId = undefined;
367
+ let controlsVisible = false;
368
+ // Shrinks the iframe so YouTube's caption overlay stays above the controls bar,
369
+ // but only when both conditions are true: controls are currently visible AND
370
+ // a caption track is active. Restores full height otherwise.
371
+ const updateIframeHeight = () => {
372
+ const iframe = this.ytAdapter?.getElement();
373
+ if (!iframe)
374
+ return;
375
+ if (controlsVisible && activeTrackId != null) {
376
+ const playerEl = ctx.container.closest('.op-player');
377
+ const raw = playerEl ? getComputedStyle(playerEl).getPropertyValue('--op-controls-height').trim() : '';
378
+ iframe.style.height = `calc(100% - ${raw || '48px'})`;
379
+ }
380
+ else {
381
+ iframe.style.height = '100%';
382
+ }
383
+ };
384
+ const captionProvider = {
385
+ getTracks: () => adapter.getAvailableCaptionTracks(),
386
+ getActiveTrack: () => activeTrackId ?? null,
387
+ setTrack: (id) => {
388
+ activeTrackId = id;
389
+ adapter.setCaptionTrack(id);
390
+ saveCcPref(id);
391
+ // Re-evaluate height immediately when captions are toggled on/off.
392
+ updateIframeHeight();
393
+ },
394
+ subscribe: (notify) => {
395
+ let attempts = 0;
396
+ const MAX = 10;
397
+ const INTERVAL = 500;
398
+ const poll = () => {
399
+ const tracks = adapter.getAvailableCaptionTracks();
400
+ if (tracks.length > 0) {
401
+ if (activeTrackId === undefined) {
402
+ // Apply persisted preference. Stored '' means user explicitly turned
403
+ // captions off — override cc_load_policy:1 by calling setCaptionTrack(null).
404
+ // Stored non-empty string = preferred track id. No key = honour YouTube default.
405
+ const storedPref = readCcPref();
406
+ if (storedPref === null) {
407
+ activeTrackId = null;
408
+ adapter.setCaptionTrack(null);
409
+ }
410
+ else if (storedPref && tracks.some((t) => t.id === storedPref)) {
411
+ activeTrackId = storedPref;
412
+ // cc_load_policy:1 may already show it; ensure consistency.
413
+ adapter.setCaptionTrack(storedPref);
414
+ }
415
+ else {
416
+ // No stored preference — honour whatever YouTube is showing.
417
+ activeTrackId = adapter.getActiveCaptionTrack() ?? tracks[0]?.id ?? null;
418
+ }
419
+ }
420
+ notify();
421
+ return;
422
+ }
423
+ if (++attempts < MAX)
424
+ timer = window.setTimeout(poll, INTERVAL);
425
+ };
426
+ let timer = window.setTimeout(poll, INTERVAL);
427
+ return () => window.clearTimeout(timer);
428
+ },
429
+ };
430
+ setCaptionTrackProvider(ctx.core, captionProvider);
431
+ this.ytSurface = surface;
432
+ this.ytAdapter = adapter;
433
+ await surface.mount(ctx.container);
434
+ const offShow = ctx.events.on('ui:controls:show', () => {
435
+ controlsVisible = true;
436
+ updateIframeHeight();
437
+ });
438
+ const offHide = ctx.events.on('ui:controls:hide', () => {
439
+ controlsVisible = false;
440
+ updateIframeHeight();
441
+ });
442
+ this.ytCleanupControls = () => {
443
+ offShow();
444
+ offHide();
445
+ };
446
+ }
447
+ detach(ctx) {
448
+ this.ytCleanupControls?.();
449
+ this.ytCleanupControls = null;
450
+ this.ytAdapter = null;
451
+ this.unbindCommands();
452
+ this.unbindSurfaceEvents();
453
+ try {
454
+ this.ytSurface?.destroy();
455
+ }
456
+ finally {
457
+ this.ytSurface = null;
458
+ }
459
+ if (ctx) {
460
+ ctx.media.style.display = '';
461
+ ctx.container.style.aspectRatio = '';
462
+ setCaptionTrackProvider(ctx.core, null);
463
+ ctx.resetSurface();
464
+ }
465
+ }
466
+ // ─── Private helpers ──────────────────────────────────────────────────────
467
+ isYouTubeUrl(url) {
468
+ try {
469
+ const u = new URL(url, 'https://example.com');
470
+ const host = u.hostname.toLowerCase();
471
+ return (host === 'youtube.com' ||
472
+ host.endsWith('.youtube.com') || // www., m., music., etc.
473
+ host === 'youtu.be' ||
474
+ host.endsWith('.youtu.be') ||
475
+ host === 'youtube-nocookie.com' ||
476
+ host.endsWith('.youtube-nocookie.com'));
477
+ }
478
+ catch {
479
+ return false;
480
+ }
481
+ }
482
+ looksLikeYouTubeId(s) {
483
+ return /^[a-zA-Z0-9_-]{11}$/.test(s);
484
+ }
485
+ extractVideoId(urlOrId, type) {
486
+ if (this.looksLikeYouTubeId(urlOrId))
487
+ return urlOrId;
488
+ try {
489
+ const u = new URL(urlOrId, 'https://example.com');
490
+ // youtu.be/<id>
491
+ if (u.hostname.toLowerCase().includes('youtu.be')) {
492
+ return u.pathname.split('/').filter(Boolean)[0] ?? null;
493
+ }
494
+ // ?v=<id>
495
+ const v = u.searchParams.get('v');
496
+ if (v)
497
+ return v;
498
+ // /embed/<id> or /shorts/<id>
499
+ const parts = u.pathname.split('/').filter(Boolean);
500
+ const pivotIdx = parts.findIndex((p) => p === 'embed' || p === 'shorts');
501
+ if (pivotIdx >= 0 && parts[pivotIdx + 1])
502
+ return parts[pivotIdx + 1];
503
+ // Last-resort: only when the source was explicitly declared as YouTube via
504
+ // type="x-video/youtube". A bare ID used as <source src="<id>"> gets resolved
505
+ // by the browser to an absolute URL whose last path segment is the raw ID value.
506
+ // e.g. http://localhost/dQw4w9WgXcQ → last segment = 'dQw4w9WgXcQ'
507
+ // We guard on the explicit type to avoid false positives from non-YouTube paths
508
+ // whose last segment happens to match the 11-character pattern.
509
+ if (type === 'x-video/youtube') {
510
+ const lastSegment = parts[parts.length - 1] ?? '';
511
+ if (this.looksLikeYouTubeId(lastSegment))
512
+ return lastSegment;
513
+ }
514
+ return null;
515
+ }
516
+ catch {
517
+ return null;
518
+ }
519
+ }
520
+ }
521
+
522
+ export { YouTubeMediaEngine };
523
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/youtubeAdapter.ts","../src/youtube.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AAkDA;AAEA,MAAM,YAAY,GAAwC;IACxD,IAAI,EAAE,MAAM;AACZ,IAAA,CAAC,EAAE,OAAO;AACV,IAAA,CAAC,EAAE,SAAS;AACZ,IAAA,CAAC,EAAE,QAAQ;AACX,IAAA,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,MAAM;CACV;AAED;AAEA,IAAI,cAAc,GAAyB,IAAI;AAE/C,SAAS,cAAc,GAAA;AACrB,IAAA,IAAI,MAAM,CAAC,EAAE,EAAE,MAAM;AAAE,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE;AAC/C,IAAA,IAAI,cAAc;AAAE,QAAA,OAAO,cAAc;AAEzC,IAAA,cAAc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e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@openplayerjs/core")):"function"==typeof define&&define.amd?define(["@openplayerjs/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpenPlayerJS)}(this,function(e){"use strict";const t={"-1":"idle",0:"ended",1:"playing",2:"paused",3:"buffering",5:"idle"};let i=null;class n{constructor(e){Object.defineProperty(this,"player",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"videoId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"noCookie",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"iframeEl",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_ready",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pendingPlay",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.videoId=e.videoId,this.noCookie=e.noCookie??!1}on(e,t){this.handlers[e]||(this.handlers[e]=new Set),this.handlers[e].add(t)}off(e,t){this.handlers[e]?.delete(t)}emit(e,...t){this.handlers[e]?.forEach(e=>e(...t))}async mount(e){await(window.YT?.Player?Promise.resolve():i||(i=new Promise(e=>{const t=window.onYouTubeIframeAPIReady;if(window.onYouTubeIframeAPIReady=()=>{t?.(),e()},!document.querySelector('script[src*="youtube.com/iframe_api"]')){const e=document.createElement("script");e.src="https://www.youtube.com/iframe_api",document.head.appendChild(e)}}),i)),"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=document.createElement("div");return e.appendChild(n),new Promise(i=>{const r={videoId:this.videoId,width:"100%",height:"100%",playerVars:{controls:0,disablekb:1,modestbranding:1,rel:0,playsinline:1,cc_load_policy:1},events:{onReady:()=>{const t=e.querySelector("iframe");t&&(this.iframeEl=t,t.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;border:0;pointer-events:none;",t.classList.add("op-youtube-iframe")),this._ready=!0,this._pendingPlay&&(this._pendingPlay=!1,this.player?.playVideo()),this.emit("ready"),i()},onStateChange:e=>{const i=t[e.data]??"idle";this.emit("state",i)},onError:e=>{this.emit("error",e.data)},onPlaybackRateChange:e=>{this.emit("ratechange",e.data)}}};this.noCookie&&(r.host="https://www.youtube-nocookie.com"),this.player=new window.YT.Player(n,r)})}destroy(){try{this.player?.destroy()}catch{}this.player=null,this.iframeEl=null,this._ready=!1,this._pendingPlay=!1;for(const e of Object.keys(this.handlers))this.handlers[e]?.clear()}getElement(){return this.iframeEl}play(){this._ready?this.player?.playVideo():this._pendingPlay=!0}pause(){this._pendingPlay=!1,this.player?.pauseVideo()}seekTo(e){this.player?.seekTo(e,!0)}setVolume(e){this.player?.setVolume(100*e)}getVolume(){return(this.player?.getVolume()??100)/100}mute(){this.player?.mute()}unmute(){this.player?.unMute()}isMuted(){return this.player?.isMuted()??!1}setPlaybackRate(e){this.player?.setPlaybackRate(e)}getPlaybackRate(){return this.player?.getPlaybackRate()??1}getCurrentTime(){return this.player?.getCurrentTime()??0}getDuration(){return this.player?.getDuration()??NaN}getAvailableCaptionTracks(){try{return(this.player?.getOption?.("captions","tracklist")??[]).map(e=>({id:String(e.languageCode??e.vss_id??""),label:String(e.displayName??e.languageCode??""),language:String(e.languageCode??"")}))}catch{return[]}}getActiveCaptionTrack(){try{const e=this.player?.getOption?.("captions","track"),t=e?.languageCode;return t&&String(t).length>0?String(t):null}catch{return null}}setCaptionTrack(e){try{this.player?.setOption?.("captions","track",e?{languageCode:e}:{})}catch{}}}class r extends e.BaseMediaEngine{constructor(e={}){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"youtube"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"1.0.0"}),Object.defineProperty(this,"capabilities",{enumerable:!0,configurable:!0,writable:!0,value:["media-engine"]}),Object.defineProperty(this,"priority",{enumerable:!0,configurable:!0,writable:!0,value:50}),Object.defineProperty(this,"noCookie",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ytSurface",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ytAdapter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ytCleanupControls",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.noCookie=e.noCookie??!1}canPlay(e){const t=e.src;return!!t&&("x-video/youtube"===e.type||(this.isYouTubeUrl(t)||this.looksLikeYouTubeId(t)))}async attach(t){const i=t.activeSource?.src??"";if(!i)throw new Error("YouTubeMediaEngine: missing source URL");const r=this.extractVideoId(i,t.activeSource?.type);if(!r)throw new Error("YouTubeMediaEngine: cannot parse videoId from source");const a=new n({videoId:r,noCookie:this.noCookie}),o=new e.IframeMediaSurface(a,{pollIntervalMs:250});t.setSurface(o),this.bindSurfaceEvents(o,t.events),this.bindCommands(t),t.media.style.display="none";const l=t.container.offsetWidth,s=t.container.offsetHeight;t.container.style.aspectRatio=l>0&&s>0?`${l} / ${s}`:"16 / 9";const u="op:yt:caption:track";let c,d=!1;const h=()=>{const e=this.ytAdapter?.getElement();if(e)if(d&&null!=c){const i=t.container.closest(".op-player"),n=i?getComputedStyle(i).getPropertyValue("--op-controls-height").trim():"";e.style.height=`calc(100% - ${n||"48px"})`}else e.style.height="100%"},y={getTracks:()=>a.getAvailableCaptionTracks(),getActiveTrack:()=>c??null,setTrack:e=>{c=e,a.setCaptionTrack(e),(e=>{try{localStorage.setItem(u,e??"")}catch{}})(e),h()},subscribe:e=>{let t=0;const i=()=>{const r=a.getAvailableCaptionTracks();if(r.length>0){if(void 0===c){const e=(()=>{try{const e=localStorage.getItem(u);if(null===e)return;return""===e?null:e}catch{return}})();null===e?(c=null,a.setCaptionTrack(null)):e&&r.some(t=>t.id===e)?(c=e,a.setCaptionTrack(e)):c=a.getActiveCaptionTrack()??r[0]?.id??null}e()}else++t<10&&(n=window.setTimeout(i,500))};let n=window.setTimeout(i,500);return()=>window.clearTimeout(n)}};e.setCaptionTrackProvider(t.core,y),this.ytSurface=o,this.ytAdapter=a,await o.mount(t.container);const p=t.events.on("ui:controls:show",()=>{d=!0,h()}),b=t.events.on("ui:controls:hide",()=>{d=!1,h()});this.ytCleanupControls=()=>{p(),b()}}detach(t){this.ytCleanupControls?.(),this.ytCleanupControls=null,this.ytAdapter=null,this.unbindCommands(),this.unbindSurfaceEvents();try{this.ytSurface?.destroy()}finally{this.ytSurface=null}t&&(t.media.style.display="",t.container.style.aspectRatio="",e.setCaptionTrackProvider(t.core,null),t.resetSurface())}isYouTubeUrl(e){try{const t=new URL(e,"https://example.com").hostname.toLowerCase();return"youtube.com"===t||t.endsWith(".youtube.com")||"youtu.be"===t||t.endsWith(".youtu.be")||"youtube-nocookie.com"===t||t.endsWith(".youtube-nocookie.com")}catch{return!1}}looksLikeYouTubeId(e){return/^[a-zA-Z0-9_-]{11}$/.test(e)}extractVideoId(e,t){if(this.looksLikeYouTubeId(e))return e;try{const i=new URL(e,"https://example.com");if(i.hostname.toLowerCase().includes("youtu.be"))return i.pathname.split("/").filter(Boolean)[0]??null;const n=i.searchParams.get("v");if(n)return n;const r=i.pathname.split("/").filter(Boolean),a=r.findIndex(e=>"embed"===e||"shorts"===e);if(a>=0&&r[a+1])return r[a+1];if("x-video/youtube"===t){const e=r[r.length-1]??"";if(this.looksLikeYouTubeId(e))return e}return null}catch{return null}}}var a;(a=window).OpenPlayerPlugins=a.OpenPlayerPlugins||{},a.OpenPlayerPlugins.youtube={name:"youtube",factory:e=>new r(e||{})},a.OpenPlayerYouTube={YouTubeMediaEngine:r}});
2
+ //# sourceMappingURL=openplayer-youtube.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openplayer-youtube.js","sources":["../src/youtubeAdapter.ts","../src/youtube.ts","../src/umd.ts"],"sourcesContent":[null,null,null],"names":["YT_STATE_MAP","apiLoadPromise","YouTubeIframeAdapter","constructor","options","Object","defineProperty","this","videoId","noCookie","on","evt","cb","handlers","Set","add","off","delete","emit","args","forEach","mount","container","window","YT","Player","Promise","resolve","prev","onYouTubeIframeAPIReady","document","querySelector","script","createElement","src","head","appendChild","getComputedStyle","position","style","div","opts","width","height","playerVars","controls","disablekb","modestbranding","rel","playsinline","cc_load_policy","events","onReady","iframe","iframeEl","cssText","classList","_ready","_pendingPlay","player","playVideo","onStateChange","e","state","data","onError","onPlaybackRateChange","host","destroy","key","keys","clear","getElement","play","pause","pauseVideo","seekTo","seconds","setVolume","volume01","getVolume","mute","unmute","unMute","isMuted","setPlaybackRate","rate","getPlaybackRate","getCurrentTime","getDuration","NaN","getAvailableCaptionTracks","getOption","map","t","id","String","languageCode","vss_id","label","displayName","language","getActiveCaptionTrack","track","code","length","setCaptionTrack","setOption","YouTubeMediaEngine","BaseMediaEngine","config","super","value","canPlay","source","url","type","isYouTubeUrl","looksLikeYouTubeId","attach","ctx","urlOrId","activeSource","Error","extractVideoId","adapter","surface","IframeMediaSurface","pollIntervalMs","setSurface","bindSurfaceEvents","bindCommands","media","display","cw","offsetWidth","ch","offsetHeight","aspectRatio","CC_PREF_KEY","activeTrackId","controlsVisible","updateIframeHeight","ytAdapter","playerEl","closest","raw","getPropertyValue","trim","captionProvider","getTracks","getActiveTrack","setTrack","localStorage","setItem","saveCcPref","subscribe","notify","attempts","poll","tracks","undefined","storedPref","v","getItem","readCcPref","some","timer","setTimeout","clearTimeout","setCaptionTrackProvider","core","ytSurface","offShow","offHide","ytCleanupControls","detach","unbindCommands","unbindSurfaceEvents","resetSurface","URL","hostname","toLowerCase","endsWith","s","test","u","includes","pathname","split","filter","Boolean","searchParams","get","parts","pivotIdx","findIndex","p","lastSegment","global","OpenPlayerPlugins","youtube","name","factory","OpenPlayerYouTube"],"mappings":"iRAoDA,MAAMA,EAAoD,CACxD,KAAM,OACN,EAAG,QACH,EAAG,UACH,EAAG,SACH,EAAG,YACH,EAAG,QAKL,IAAIC,EAAuC,WA+B9BC,EASX,WAAAC,CAAYC,GARJC,OAAAC,eAAAC,KAAA,SAAA,iDAA0B,OAC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AWC,KAiBRhL,QAhBMiL,kBAAoBD,EAAOC,mBAAqB,CAAA,EACvDD,EAAOC,kBAAkBC,QAAU,CACjCC,KAAM,UACNC,QAAU7F,GAAiB,IAAIF,EAAmBE,GAAU,CAAA,IAY9DyF,EAAOK,kBAAoB,CAAEhG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @openplayerjs/youtube
3
+ *
4
+ * YouTube iframe engine for OpenPlayerJS, powered by YT player API.
5
+ * Peer dependency: @openplayerjs/core
6
+ *
7
+ * ESM usage:
8
+ * import { YouTubeMediaEngine } from '@openplayerjs/youtube';
9
+ * new Core(el, { plugins: [new YouTubeMediaEngine()] });
10
+ *
11
+ * UMD / CDN usage: load openplayer-youtube.js after the main OpenPlayer bundle.
12
+ * It auto-registers itself under window.OpenPlayerPlugins.youtube.
13
+ */
14
+ export { YouTubeMediaEngine } from './youtube';
15
+ export type { YouTubeEngineConfig } from './youtube';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=umd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"umd.d.ts","sourceRoot":"","sources":["../../src/umd.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import type { MediaEngineContext, MediaSource } from '@openplayerjs/core';
2
+ import { BaseMediaEngine } from '@openplayerjs/core';
3
+ export type YouTubeEngineConfig = {
4
+ /**
5
+ * When `true`, the YouTube IFrame player is served from
6
+ * `https://www.youtube-nocookie.com` instead of `https://www.youtube.com`,
7
+ * which prevents YouTube from setting cookies on the viewer's browser until
8
+ * they interact with the player.
9
+ *
10
+ * @default false
11
+ */
12
+ noCookie?: boolean;
13
+ };
14
+ export declare class YouTubeMediaEngine extends BaseMediaEngine {
15
+ readonly name = "youtube";
16
+ readonly version = "1.0.0";
17
+ readonly capabilities: string[];
18
+ readonly priority = 50;
19
+ private readonly noCookie;
20
+ private ytSurface;
21
+ private ytAdapter;
22
+ private ytCleanupControls;
23
+ constructor(config?: YouTubeEngineConfig);
24
+ canPlay(source: MediaSource): boolean;
25
+ attach(ctx: MediaEngineContext): Promise<void>;
26
+ detach(ctx?: MediaEngineContext): void;
27
+ private isYouTubeUrl;
28
+ private looksLikeYouTubeId;
29
+ private extractVideoId;
30
+ }
31
+ //# sourceMappingURL=youtube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../src/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,SAAgB,IAAI,aAAa;IACjC,SAAgB,OAAO,WAAW;IAClC,SAAgB,YAAY,EAAE,MAAM,EAAE,CAAoB;IAC1D,SAAgB,QAAQ,MAAM;IAE9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,iBAAiB,CAA6B;gBAE1C,MAAM,GAAE,mBAAwB;IAK5C,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;IAQ/B,MAAM,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6HpD,MAAM,CAAC,GAAG,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAwBtC,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,cAAc;CAoCvB"}
@@ -0,0 +1,104 @@
1
+ import type { IframeMediaAdapter, IframeMediaAdapterEvents } from '@openplayerjs/core';
2
+ declare global {
3
+ interface Window {
4
+ YT?: {
5
+ Player: new (el: HTMLElement, opts: YTPlayerOptions) => YTPlayer;
6
+ PlayerState: {
7
+ ENDED: 0;
8
+ PLAYING: 1;
9
+ PAUSED: 2;
10
+ BUFFERING: 3;
11
+ CUED: 5;
12
+ };
13
+ };
14
+ onYouTubeIframeAPIReady?: () => void;
15
+ }
16
+ }
17
+ type YTPlayerOptions = {
18
+ videoId: string;
19
+ width?: number | string;
20
+ height?: number | string;
21
+ /**
22
+ * Override the player host. Pass `'https://www.youtube-nocookie.com'` to
23
+ * embed without setting cookies on the viewer's browser.
24
+ */
25
+ host?: string;
26
+ playerVars?: Record<string, string | number>;
27
+ events?: {
28
+ onReady?: (e: {
29
+ target: YTPlayer;
30
+ }) => void;
31
+ onStateChange?: (e: {
32
+ data: number;
33
+ }) => void;
34
+ onError?: (e: {
35
+ data: number;
36
+ }) => void;
37
+ onPlaybackRateChange?: (e: {
38
+ data: number;
39
+ }) => void;
40
+ };
41
+ };
42
+ type YTPlayer = {
43
+ playVideo(): void;
44
+ pauseVideo(): void;
45
+ seekTo(seconds: number, allowSeekAhead: boolean): void;
46
+ setVolume(volume: number): void;
47
+ getVolume(): number;
48
+ mute(): void;
49
+ unMute(): void;
50
+ isMuted(): boolean;
51
+ setPlaybackRate(rate: number): void;
52
+ getPlaybackRate(): number;
53
+ getCurrentTime(): number;
54
+ getDuration(): number;
55
+ getPlayerState(): number;
56
+ destroy(): void;
57
+ getOption?(module: string, option: string): any;
58
+ setOption?(module: string, option: string, value: any): void;
59
+ };
60
+ export declare class YouTubeIframeAdapter implements IframeMediaAdapter {
61
+ private player;
62
+ private readonly videoId;
63
+ private readonly noCookie;
64
+ private readonly handlers;
65
+ private iframeEl;
66
+ private _ready;
67
+ private _pendingPlay;
68
+ constructor(options: {
69
+ videoId: string;
70
+ noCookie?: boolean;
71
+ });
72
+ on<E extends keyof IframeMediaAdapterEvents>(evt: E, cb: IframeMediaAdapterEvents[E]): void;
73
+ off<E extends keyof IframeMediaAdapterEvents>(evt: E, cb: IframeMediaAdapterEvents[E]): void;
74
+ private emit;
75
+ mount(container: HTMLElement): Promise<void>;
76
+ destroy(): void;
77
+ getElement(): HTMLElement | null;
78
+ play(): void;
79
+ pause(): void;
80
+ seekTo(seconds: number): void;
81
+ /** Accepts 0..1; YT API uses 0..100. */
82
+ setVolume(volume01: number): void;
83
+ /** Returns 0..1. */
84
+ getVolume(): number;
85
+ mute(): void;
86
+ unmute(): void;
87
+ isMuted(): boolean;
88
+ setPlaybackRate(rate: number): void;
89
+ getPlaybackRate(): number;
90
+ getCurrentTime(): number;
91
+ getDuration(): number;
92
+ /** Returns available YouTube caption tracks (best-effort; undocumented API). */
93
+ getAvailableCaptionTracks(): {
94
+ id: string;
95
+ label: string;
96
+ language: string;
97
+ }[];
98
+ /** Returns the active caption track language code, or null if captions are off. */
99
+ getActiveCaptionTrack(): string | null;
100
+ /** Sets the active caption track by language code, or disables captions when null. */
101
+ setCaptionTrack(languageCode: string | null): void;
102
+ }
103
+ export {};
104
+ //# sourceMappingURL=youtubeAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtubeAdapter.d.ts","sourceRoot":"","sources":["../../src/youtubeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAuB,MAAM,oBAAoB,CAAC;AAE5G,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,EAAE,CAAC,EAAE;YACH,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,KAAK,QAAQ,CAAC;YACjE,WAAW,EAAE;gBAAE,KAAK,EAAE,CAAC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I;IAMhC,IAAI,IAAI,IAAI;IAQZ,KAAK,IAAI,IAAI;IAKb,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM7B,wCAAwC;IACxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIjC,oBAAoB;IACpB,SAAS,IAAI,MAAM;IAInB,IAAI,IAAI,IAAI;IAIZ,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,OAAO;IAMlB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC,eAAe,IAAI,MAAM;IAMzB,cAAc,IAAI,MAAM;IAIxB,WAAW,IAAI,MAAM;IAMrB,gFAAgF;IAChF,yBAAyB,IAAI;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE;IAa9E,mFAAmF;IACnF,qBAAqB,IAAI,MAAM,GAAG,IAAI;IAUtC,sFAAsF;IACtF,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;CAOnD"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@openplayerjs/youtube",
3
+ "version": "3.0.0",
4
+ "description": "YouTube IFrame Player engine for OpenPlayerJS",
5
+ "author": {
6
+ "name": "Rafael Miranda",
7
+ "email": "rafa8626@gmail.com"
8
+ },
9
+ "license": "MIT",
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "types": "./dist/types/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "types": "./dist/types/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/openplayerjs/openplayerjs.git",
27
+ "directory": "packages/youtube"
28
+ },
29
+ "keywords": [
30
+ "youtube",
31
+ "iframe",
32
+ "player",
33
+ "openplayer",
34
+ "video"
35
+ ],
36
+ "scripts": {
37
+ "build:bundles": "rollup -c rollup.config.mjs",
38
+ "test": "jest --passWithNoTests --config ../../jest.config.cjs",
39
+ "release": "dotenv -o -- release-it --config .release-it.cjs",
40
+ "watch": "rollup -c rollup.config.mjs --watch"
41
+ },
42
+ "peerDependencies": {
43
+ "@openplayerjs/core": "workspace:^"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }