@deep-eye/core 1.3.36 → 1.3.39

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +2 -2
  3. package/dist/chat-token.css +1 -0
  4. package/dist/components/chat/ChatApp.vue.d.ts +5 -3
  5. package/dist/components/chat/ChatApp.vue.d.ts.map +1 -1
  6. package/dist/components/chat/ChatBot.vue.d.ts +5 -3
  7. package/dist/components/chat/ChatBot.vue.d.ts.map +1 -1
  8. package/dist/components/chat/askUser.d.ts +15 -0
  9. package/dist/components/chat/askUser.d.ts.map +1 -1
  10. package/dist/components/chat/attachments.d.ts +2 -0
  11. package/dist/components/chat/attachments.d.ts.map +1 -1
  12. package/dist/components/chat/buildTimelineSegments.d.ts +19 -2
  13. package/dist/components/chat/buildTimelineSegments.d.ts.map +1 -1
  14. package/dist/components/chat/chatEditSend.d.ts +10 -0
  15. package/dist/components/chat/chatEditSend.d.ts.map +1 -0
  16. package/dist/components/chat/chatSessionSidebarAssets.d.ts +4 -0
  17. package/dist/components/chat/chatSessionSidebarAssets.d.ts.map +1 -1
  18. package/dist/components/chat/chatSessionSidebarTypes.d.ts +5 -0
  19. package/dist/components/chat/chatSessionSidebarTypes.d.ts.map +1 -1
  20. package/dist/components/chat/citation/CatalogHighlightList.vue.d.ts +9 -0
  21. package/dist/components/chat/citation/CatalogHighlightList.vue.d.ts.map +1 -0
  22. package/dist/components/chat/citation/CitationHoverLayer.vue.d.ts +25 -0
  23. package/dist/components/chat/citation/CitationHoverLayer.vue.d.ts.map +1 -0
  24. package/dist/components/chat/citation/CitationPreviewDialog.vue.d.ts +22 -0
  25. package/dist/components/chat/citation/CitationPreviewDialog.vue.d.ts.map +1 -0
  26. package/dist/components/chat/citation/ParsedPdfPage.vue.d.ts +26 -0
  27. package/dist/components/chat/citation/ParsedPdfPage.vue.d.ts.map +1 -0
  28. package/dist/components/chat/citation/ParsedPdfPageSkeleton.vue.d.ts +7 -0
  29. package/dist/components/chat/citation/ParsedPdfPageSkeleton.vue.d.ts.map +1 -0
  30. package/dist/components/chat/citation/ParsedPdfPagesViewer.vue.d.ts +23 -0
  31. package/dist/components/chat/citation/ParsedPdfPagesViewer.vue.d.ts.map +1 -0
  32. package/dist/components/chat/citation/locateCitation.d.ts +22 -0
  33. package/dist/components/chat/citation/locateCitation.d.ts.map +1 -0
  34. package/dist/components/chat/citation/renderCitationMarkdown.d.ts +2 -0
  35. package/dist/components/chat/citation/renderCitationMarkdown.d.ts.map +1 -0
  36. package/dist/components/chat/citation/useCitationPreview.d.ts +62 -0
  37. package/dist/components/chat/citation/useCitationPreview.d.ts.map +1 -0
  38. package/dist/components/chat/cloudConfig.d.ts +22 -2
  39. package/dist/components/chat/cloudConfig.d.ts.map +1 -1
  40. package/dist/components/chat/components/ArtifactPreview.vue.d.ts.map +1 -1
  41. package/dist/components/chat/components/ChatActionbar.vue.d.ts +15 -0
  42. package/dist/components/chat/components/ChatActionbar.vue.d.ts.map +1 -1
  43. package/dist/components/chat/components/ChatAttachments.vue.d.ts +3 -0
  44. package/dist/components/chat/components/ChatAttachments.vue.d.ts.map +1 -1
  45. package/dist/components/chat/components/ChatFileCard.vue.d.ts.map +1 -1
  46. package/dist/components/chat/components/ChatFilePreview.vue.d.ts +4 -2
  47. package/dist/components/chat/components/ChatFilePreview.vue.d.ts.map +1 -1
  48. package/dist/components/chat/components/ChatFilePreviewPanel.vue.d.ts +2 -2
  49. package/dist/components/chat/components/ChatFilePreviewPanel.vue.d.ts.map +1 -1
  50. package/dist/components/chat/components/ChatMessage.vue.d.ts +23 -1
  51. package/dist/components/chat/components/ChatMessage.vue.d.ts.map +1 -1
  52. package/dist/components/chat/components/ChatQueue.vue.d.ts +2 -2
  53. package/dist/components/chat/components/ChatReasoning.vue.d.ts +11 -0
  54. package/dist/components/chat/components/ChatReasoning.vue.d.ts.map +1 -1
  55. package/dist/components/chat/components/ChatSender.vue.d.ts +3 -3
  56. package/dist/components/chat/components/ChatSender.vue.d.ts.map +1 -1
  57. package/dist/components/chat/components/ChatSessionOverflowTooltip.vue.d.ts.map +1 -1
  58. package/dist/components/chat/components/ChatSessionSidebar.vue.d.ts.map +1 -1
  59. package/dist/components/chat/components/ConversationList.vue.d.ts +7 -1
  60. package/dist/components/chat/components/ConversationList.vue.d.ts.map +1 -1
  61. package/dist/components/chat/components/InputContentParts.vue.d.ts.map +1 -1
  62. package/dist/components/chat/components/KnowledgeRetrievalProcessRow.vue.d.ts +16 -0
  63. package/dist/components/chat/components/KnowledgeRetrievalProcessRow.vue.d.ts.map +1 -0
  64. package/dist/components/chat/components/MessageBubble.vue.d.ts +23 -1
  65. package/dist/components/chat/components/MessageBubble.vue.d.ts.map +1 -1
  66. package/dist/components/chat/components/OpenFileViewerHost.vue.d.ts +24 -0
  67. package/dist/components/chat/components/OpenFileViewerHost.vue.d.ts.map +1 -0
  68. package/dist/components/chat/components/ProcessStepGroup.vue.d.ts +14 -1
  69. package/dist/components/chat/components/ProcessStepGroup.vue.d.ts.map +1 -1
  70. package/dist/components/chat/components/ReasoningMarkdown.vue.d.ts.map +1 -1
  71. package/dist/components/chat/components/ToolCallPart.vue.d.ts.map +1 -1
  72. package/dist/components/chat/components/UserMessageEditor.vue.d.ts +22 -0
  73. package/dist/components/chat/components/UserMessageEditor.vue.d.ts.map +1 -0
  74. package/dist/components/chat/components/WebSearchProcessRow.vue.d.ts.map +1 -1
  75. package/dist/components/chat/components/document-viewer/DocViewerToolbar.vue.d.ts +2 -2
  76. package/dist/components/chat/components/index.d.ts +2 -1
  77. package/dist/components/chat/components/index.d.ts.map +1 -1
  78. package/dist/components/chat/composables/chatApiRequest.d.ts.map +1 -1
  79. package/dist/components/chat/composables/chatReferenceApi.d.ts +52 -0
  80. package/dist/components/chat/composables/chatReferenceApi.d.ts.map +1 -0
  81. package/dist/components/chat/composables/chatTtsApi.d.ts +14 -0
  82. package/dist/components/chat/composables/chatTtsApi.d.ts.map +1 -0
  83. package/dist/components/chat/composables/useChatSessionSlots.d.ts +3 -0
  84. package/dist/components/chat/composables/useChatSessionSlots.d.ts.map +1 -1
  85. package/dist/components/chat/composables/useTtsPlayback.d.ts +24 -0
  86. package/dist/components/chat/composables/useTtsPlayback.d.ts.map +1 -0
  87. package/dist/components/chat/formatToolArguments.d.ts +8 -1
  88. package/dist/components/chat/formatToolArguments.d.ts.map +1 -1
  89. package/dist/components/chat/harness/DisclosureRow.vue.d.ts.map +1 -1
  90. package/dist/components/chat/harness/icons.d.ts +30 -2
  91. package/dist/components/chat/harness/icons.d.ts.map +1 -1
  92. package/dist/components/chat/harness/index.d.ts +1 -1
  93. package/dist/components/chat/harness/index.d.ts.map +1 -1
  94. package/dist/components/chat/hydrateHistory.d.ts +3 -2
  95. package/dist/components/chat/hydrateHistory.d.ts.map +1 -1
  96. package/dist/components/chat/icons/ChatSpeakingIcon.vue.d.ts +9 -0
  97. package/dist/components/chat/icons/ChatSpeakingIcon.vue.d.ts.map +1 -0
  98. package/dist/components/chat/icons/index.d.ts +1 -0
  99. package/dist/components/chat/icons/index.d.ts.map +1 -1
  100. package/dist/components/chat/index.d.ts +10 -3
  101. package/dist/components/chat/index.d.ts.map +1 -1
  102. package/dist/components/chat/knowledgeRetrieval.d.ts +19 -0
  103. package/dist/components/chat/knowledgeRetrieval.d.ts.map +1 -0
  104. package/dist/components/chat/mdoc/AskUserForm.vue.d.ts.map +1 -1
  105. package/dist/components/chat/mdoc/ContentNodes.vue.d.ts.map +1 -1
  106. package/dist/components/chat/mdoc/textContent.d.ts +9 -0
  107. package/dist/components/chat/mdoc/textContent.d.ts.map +1 -1
  108. package/dist/components/chat/mdoc/widget/InlineWidgetCard.vue.d.ts +17 -0
  109. package/dist/components/chat/mdoc/widget/InlineWidgetCard.vue.d.ts.map +1 -0
  110. package/dist/components/chat/mdoc/widget/parseWidget.d.ts +32 -0
  111. package/dist/components/chat/mdoc/widget/parseWidget.d.ts.map +1 -0
  112. package/dist/components/chat/mdoc/widget/sanitizeSvg.d.ts +8 -0
  113. package/dist/components/chat/mdoc/widget/sanitizeSvg.d.ts.map +1 -0
  114. package/dist/components/chat/mdoc/widget/widgetDownload.d.ts +28 -0
  115. package/dist/components/chat/mdoc/widget/widgetDownload.d.ts.map +1 -0
  116. package/dist/components/chat/mentionEditor.d.ts +2 -0
  117. package/dist/components/chat/mentionEditor.d.ts.map +1 -1
  118. package/dist/components/chat/messageChrome.d.ts +8 -1
  119. package/dist/components/chat/messageChrome.d.ts.map +1 -1
  120. package/dist/components/chat/morphOrb/fromSteps.d.ts.map +1 -1
  121. package/dist/components/chat/openFileViewer.d.ts +22 -0
  122. package/dist/components/chat/openFileViewer.d.ts.map +1 -0
  123. package/dist/components/chat/previewRenderers.d.ts +8 -1
  124. package/dist/components/chat/previewRenderers.d.ts.map +1 -1
  125. package/dist/components/chat/processGroupSummary.d.ts +23 -11
  126. package/dist/components/chat/processGroupSummary.d.ts.map +1 -1
  127. package/dist/components/chat/responseStream.d.ts +11 -1
  128. package/dist/components/chat/responseStream.d.ts.map +1 -1
  129. package/dist/components/chat/restartUserTurn.d.ts +12 -0
  130. package/dist/components/chat/restartUserTurn.d.ts.map +1 -0
  131. package/dist/components/chat/toolLabels.d.ts +10 -0
  132. package/dist/components/chat/toolLabels.d.ts.map +1 -1
  133. package/dist/components/chat/types.d.ts +63 -4
  134. package/dist/components/chat/types.d.ts.map +1 -1
  135. package/dist/components/skill/components/ChatSkillCard.vue.d.ts.map +1 -1
  136. package/dist/components/ui/components/UiPopover.vue.d.ts +48 -0
  137. package/dist/components/ui/components/UiPopover.vue.d.ts.map +1 -0
  138. package/dist/components/ui/components/index.d.ts +1 -0
  139. package/dist/components/ui/components/index.d.ts.map +1 -1
  140. package/dist/{index-C-_Ruklc.js → index-BglIsE2F.js} +1 -1
  141. package/dist/{index-DAi7oZ-t.js → index-Cu2OIMVP.js} +81537 -76817
  142. package/dist/{index-CSngFmD5.cjs → index-DJ6ebHrV.cjs} +1 -1
  143. package/dist/index-YbPtpb2R.cjs +1215 -0
  144. package/dist/index.cjs +1 -1
  145. package/dist/index.js +366 -343
  146. package/dist/style.css +2 -2
  147. package/package.json +2 -1
  148. package/dist/errors-CHzikrqu.js +0 -70
  149. package/dist/errors-upLl4kf2.cjs +0 -1
  150. package/dist/index-CmSyVjHn.cjs +0 -1129
  151. package/dist/media-community-skin-Djo8L1G9.js +0 -302
  152. package/dist/media-community-skin-YI6NjsJg.cjs +0 -1
  153. package/dist/media-core-CkW37AYl.js +0 -3827
  154. package/dist/media-core-Rxz2MNwG.cjs +0 -1
  155. package/dist/media-outlet-CZTh6XmJ.cjs +0 -1
  156. package/dist/media-outlet-D2rcuhYN.js +0 -2
  157. package/dist/media-player-BZrIM0O_.js +0 -387
  158. package/dist/media-player-D_USOhtK.cjs +0 -1
  159. package/dist/media-ui-DfPbRfFS.js +0 -2832
  160. package/dist/media-ui-zZVnK1ts.cjs +0 -1
  161. package/dist/prod-Ba2x-T01.cjs +0 -4
  162. package/dist/prod-DBMM0zDd.js +0 -992
  163. package/dist/provider-B7wAEcCR.js +0 -163
  164. package/dist/provider-BPphQwpc.cjs +0 -1
  165. package/dist/provider-BSeBwvzM.cjs +0 -1
  166. package/dist/provider-DgSZc2dM.js +0 -162
  167. package/dist/provider-EKFFiZS1.js +0 -27
  168. package/dist/provider-O8r0RFmF.cjs +0 -1
  169. package/dist/provider-WrRdjcjY.js +0 -483
  170. package/dist/provider-sqICX3H9.cjs +0 -1
  171. package/dist/srt-parser-BECMkbXb.cjs +0 -2
  172. package/dist/srt-parser-BR28Llpk.js +0 -27
  173. package/dist/ssa-parser-BJTK0kd-.js +0 -209
  174. package/dist/ssa-parser-CuKkTpK_.cjs +0 -4
@@ -1,3827 +0,0 @@
1
- var ds = Object.defineProperty;
2
- var ps = (e, s, t) => s in e ? ds(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
- var l = (e, s, t) => ps(e, typeof s != "symbol" ? s + "" : s, t);
4
- const I = Symbol(0);
5
- let pt = !1, jt = !1, A = null, V = null, T = null, k = 0, F = [], Bt = {};
6
- const ms = () => {
7
- }, U = 0, xe = 1, st = 2, kt = 3;
8
- function ys() {
9
- pt = !0, queueMicrotask(Pe);
10
- }
11
- function Pe() {
12
- if (!F.length) {
13
- pt = !1;
14
- return;
15
- }
16
- jt = !0;
17
- for (let e = 0; e < F.length; e++)
18
- F[e].$st !== U && gs(F[e]);
19
- F = [], pt = !1, jt = !1;
20
- }
21
- function gs(e) {
22
- let s = [e];
23
- for (; e = e[I]; )
24
- e.$e && e.$st !== U && s.push(e);
25
- for (let t = s.length - 1; t >= 0; t--)
26
- Gt(s[t]);
27
- }
28
- function Ce(e) {
29
- const s = ws();
30
- return rt(s, e.length ? e.bind(null, B.bind(s)) : e, null);
31
- }
32
- function u(e) {
33
- return rt(A, e, null);
34
- }
35
- function bs(e) {
36
- return rt(null, e, null);
37
- }
38
- function W() {
39
- jt || Pe();
40
- }
41
- function wt() {
42
- return A;
43
- }
44
- function S(e, s) {
45
- try {
46
- return rt(s, e, null);
47
- } catch (t) {
48
- Ut(s, t);
49
- return;
50
- }
51
- }
52
- function Ie(e, s = A) {
53
- return s == null ? void 0 : s.$cx[e];
54
- }
55
- function Es(e, s, t = A) {
56
- t && (t.$cx = { ...t.$cx, [e]: s });
57
- }
58
- function L(e) {
59
- if (!e || !A)
60
- return e || ms;
61
- const s = A;
62
- return s.$d ? Array.isArray(s.$d) ? s.$d.push(e) : s.$d = [s.$d, e] : s.$d = e, function() {
63
- s.$st !== kt && (e.call(null), N(s.$d) ? s.$d = null : Array.isArray(s.$d) && s.$d.splice(s.$d.indexOf(e), 1));
64
- };
65
- }
66
- function B(e = !0) {
67
- if (this.$st !== kt) {
68
- if (this.$h)
69
- if (Array.isArray(this.$h))
70
- for (let s = this.$h.length - 1; s >= 0; s--)
71
- B.call(this.$h[s]);
72
- else
73
- B.call(this.$h);
74
- if (e) {
75
- const s = this[I];
76
- s && (Array.isArray(s.$h) ? s.$h.splice(s.$h.indexOf(this), 1) : s.$h = null), ks(this);
77
- }
78
- }
79
- }
80
- function ks(e) {
81
- e.$st = kt, e.$d && Oe(e), e.$s && ft(e, 0), e[I] = null, e.$s = null, e.$o = null, e.$h = null, e.$cx = Bt, e.$eh = null;
82
- }
83
- function Oe(e) {
84
- try {
85
- if (Array.isArray(e.$d))
86
- for (let s = e.$d.length - 1; s >= 0; s--) {
87
- const t = e.$d[s];
88
- t.call(t);
89
- }
90
- else
91
- e.$d.call(e.$d);
92
- e.$d = null;
93
- } catch (s) {
94
- Ut(e, s);
95
- }
96
- }
97
- function rt(e, s, t) {
98
- const i = A, n = V;
99
- A = e, V = t;
100
- try {
101
- return s.call(e);
102
- } finally {
103
- A = i, V = n;
104
- }
105
- }
106
- function Ut(e, s) {
107
- if (!e || !e.$eh)
108
- throw s;
109
- let t = 0, i = e.$eh.length, n = ae(s);
110
- for (t = 0; t < i; t++)
111
- try {
112
- e.$eh[t](n);
113
- break;
114
- } catch (r) {
115
- n = ae(r);
116
- }
117
- if (t === i)
118
- throw n;
119
- }
120
- function ae(e) {
121
- return e instanceof Error ? e : Error(JSON.stringify(e));
122
- }
123
- function Zt() {
124
- return this.$st === kt ? this.$v : (V && !this.$e && (!T && V.$s && V.$s[k] == this ? k++ : T ? T.push(this) : T = [this]), this.$c && Gt(this), this.$v);
125
- }
126
- function Ne(e) {
127
- const s = N(e) ? e(this.$v) : e;
128
- if (this.$ch(this.$v, s) && (this.$v = s, this.$o))
129
- for (let t = 0; t < this.$o.length; t++)
130
- je(this.$o[t], st);
131
- return this.$v;
132
- }
133
- const Kt = function() {
134
- this[I] = null, this.$h = null, A && A.append(this);
135
- }, R = Kt.prototype;
136
- R.$cx = Bt;
137
- R.$eh = null;
138
- R.$c = null;
139
- R.$d = null;
140
- R.append = function(e) {
141
- e[I] = this, this.$h ? Array.isArray(this.$h) ? this.$h.push(e) : this.$h = [this.$h, e] : this.$h = e, e.$cx = e.$cx === Bt ? this.$cx : { ...this.$cx, ...e.$cx }, this.$eh && (e.$eh = e.$eh ? [...e.$eh, ...this.$eh] : this.$eh);
142
- };
143
- R.dispose = function() {
144
- B.call(this);
145
- };
146
- function ws() {
147
- return new Kt();
148
- }
149
- const _e = function(s, t, i) {
150
- Kt.call(this), this.$st = t ? st : U, this.$i = !1, this.$e = !1, this.$s = null, this.$o = null, this.$v = s, t && (this.$c = t), i && i.dirty && (this.$ch = i.dirty);
151
- }, Xt = _e.prototype;
152
- Object.setPrototypeOf(Xt, R);
153
- Xt.$ch = Ts;
154
- Xt.call = Zt;
155
- function Yt(e, s, t) {
156
- return new _e(e, s, t);
157
- }
158
- function Ts(e, s) {
159
- return e !== s;
160
- }
161
- function N(e) {
162
- return typeof e == "function";
163
- }
164
- function Gt(e) {
165
- if (e.$st === xe)
166
- for (let s = 0; s < e.$s.length && (Gt(e.$s[s]), e.$st !== st); s++)
167
- ;
168
- e.$st === st ? qe(e) : e.$st = U;
169
- }
170
- function oe(e) {
171
- e.$h && B.call(e, !1), e.$d && Oe(e), e.$eh = e[I] ? e[I].$eh : null;
172
- }
173
- function qe(e) {
174
- let s = T, t = k;
175
- T = null, k = 0;
176
- try {
177
- oe(e);
178
- const i = rt(e, e.$c, e);
179
- if (T) {
180
- if (e.$s && ft(e, k), e.$s && k > 0) {
181
- e.$s.length = k + T.length;
182
- for (let r = 0; r < T.length; r++)
183
- e.$s[k + r] = T[r];
184
- } else
185
- e.$s = T;
186
- let n;
187
- for (let r = k; r < e.$s.length; r++)
188
- n = e.$s[r], n.$o ? n.$o.push(e) : n.$o = [e];
189
- } else e.$s && k < e.$s.length && (ft(e, k), e.$s.length = k);
190
- !e.$e && e.$i ? Ne.call(e, i) : (e.$v = i, e.$i = !0);
191
- } catch (i) {
192
- Ut(e, i), e.$st === st && (oe(e), e.$s && ft(e, 0));
193
- return;
194
- }
195
- T = s, k = t, e.$st = U;
196
- }
197
- function je(e, s) {
198
- if (!(e.$st >= s) && (e.$e && e.$st === U && (F.push(e), pt || ys()), e.$st = s, e.$o))
199
- for (let t = 0; t < e.$o.length; t++)
200
- je(e.$o[t], xe);
201
- }
202
- function ft(e, s) {
203
- let t, i;
204
- for (let n = s; n < e.$s.length; n++)
205
- t = e.$s[n], t.$o && (i = t.$o.indexOf(e), t.$o[i] = t.$o[t.$o.length - 1], t.$o.pop());
206
- }
207
- function _(e, s) {
208
- const t = Yt(e, null, s), i = Zt.bind(t);
209
- return i[I] = !0, i.set = Ne.bind(t), i;
210
- }
211
- function $s(e) {
212
- return N(e) && I in e;
213
- }
214
- function Tt(e, s) {
215
- const t = Yt(
216
- s == null ? void 0 : s.initial,
217
- e,
218
- s
219
- ), i = Zt.bind(t);
220
- return i[I] = !0, i;
221
- }
222
- function K(e, s) {
223
- const t = Yt(
224
- null,
225
- function() {
226
- let n = e();
227
- return N(n) && L(n), null;
228
- },
229
- void 0
230
- );
231
- return t.$e = !0, qe(t), B.bind(t, !0);
232
- }
233
- function ln(e) {
234
- return $s(e) && "set" in e;
235
- }
236
- function $t(...e) {
237
- }
238
- function St(e) {
239
- return e === null;
240
- }
241
- function x(e) {
242
- return typeof e > "u";
243
- }
244
- function Ss(e) {
245
- return St(e) || x(e);
246
- }
247
- function mt(e) {
248
- return typeof e == "number" && !Number.isNaN(e);
249
- }
250
- function O(e) {
251
- return typeof e == "string";
252
- }
253
- function De(e) {
254
- return typeof e == "boolean";
255
- }
256
- function b(e) {
257
- return typeof e == "function";
258
- }
259
- function P(e) {
260
- return Array.isArray(e);
261
- }
262
- function vs(e) {
263
- return { id: Symbol(), provide: e };
264
- }
265
- function As(e, s, t = wt()) {
266
- var n;
267
- const i = !x(s);
268
- Es(e.id, i ? s : (n = e.provide) == null ? void 0 : n.call(e), t);
269
- }
270
- function Me(e) {
271
- return Ie(e.id);
272
- }
273
- function cn(e) {
274
- return !x(Ie(e.id));
275
- }
276
- var xs = class {
277
- constructor(e) {
278
- this.id = Symbol(0), this.record = e, this.v = Object.getOwnPropertyDescriptors(e);
279
- }
280
- create() {
281
- const e = {}, s = new Proxy(e, { get: (t, i) => e[i]() });
282
- for (const t of Object.keys(this.record)) {
283
- const i = this.v[t].get;
284
- e[t] = i ? Tt(i.bind(s)) : _(this.record[t]);
285
- }
286
- return e;
287
- }
288
- reset(e, s) {
289
- for (const t of Object.keys(e))
290
- !this.v[t].get && (!s || s(t)) && e[t].set(this.record[t]);
291
- }
292
- };
293
- function hn(e) {
294
- return Me(e);
295
- }
296
- var d = K;
297
- function Le(e) {
298
- let s = e;
299
- for (; typeof s == "function"; )
300
- s = s();
301
- return s;
302
- }
303
- var Ps = Event, Re = Symbol("DOM_EVENT"), Fe, y = class extends Ps {
304
- constructor(e, ...s) {
305
- var t, i;
306
- super(e, s[0]), this[Fe] = !0, this.detail = (t = s[0]) == null ? void 0 : t.detail, this.trigger = (i = s[0]) == null ? void 0 : i.trigger;
307
- }
308
- /**
309
- * Walks up the event chain (following each `trigger`) and returns the origin event
310
- * that started the chain.
311
- */
312
- get originEvent() {
313
- return yt(this) ?? this;
314
- }
315
- /**
316
- * Walks up the event chain (following each `trigger`) and determines whether the initial
317
- * event was triggered by the end user (ie: check whether `isTrusted` on the `originEvent` `true`).
318
- */
319
- get isOriginTrusted() {
320
- var e;
321
- return ((e = yt(this)) == null ? void 0 : e.isTrusted) ?? !1;
322
- }
323
- };
324
- Fe = Re;
325
- function Cs(e) {
326
- return !!(e != null && e[Re]);
327
- }
328
- function yt(e) {
329
- let s = e.trigger;
330
- for (; s && s.trigger; )
331
- s = s.trigger;
332
- return s;
333
- }
334
- function m(e, s) {
335
- const t = yt(e) ?? e;
336
- if (t === s)
337
- throw Error(
338
- ""
339
- );
340
- Object.defineProperty(t, "trigger", {
341
- configurable: !0,
342
- enumerable: !0,
343
- get: () => s
344
- });
345
- }
346
- var Qt = class extends EventTarget {
347
- addEventListener(e, s, t) {
348
- return super.addEventListener(e, s, t);
349
- }
350
- removeEventListener(e, s, t) {
351
- return super.removeEventListener(e, s, t);
352
- }
353
- };
354
- function f(e, s, t, i) {
355
- return e.addEventListener(s, t, i), L(() => e.removeEventListener(s, t, i));
356
- }
357
- function Is(e) {
358
- return !!(e != null && e.type.startsWith("pointer"));
359
- }
360
- function Os(e) {
361
- return !!(e != null && e.type.startsWith("touch"));
362
- }
363
- function Ns(e) {
364
- return /^(click|mouse)/.test((e == null ? void 0 : e.type) ?? "");
365
- }
366
- function Jt(e) {
367
- return !!(e != null && e.type.startsWith("key"));
368
- }
369
- function te(e) {
370
- return Jt(e) && (e.key === "Enter" || e.key === " ");
371
- }
372
- function vt(e) {
373
- return e instanceof Node;
374
- }
375
- function He(e) {
376
- return vt(e) && e.nodeType === 1;
377
- }
378
- function Ve() {
379
- return document.createDocumentFragment();
380
- }
381
- function ee(e) {
382
- return document.createComment(e);
383
- }
384
- function it(e, s, t) {
385
- if (!t && t !== "" && t !== 0)
386
- e.removeAttribute(s);
387
- else {
388
- const i = t + "";
389
- e.getAttribute(s) !== i && e.setAttribute(s, i);
390
- }
391
- }
392
- function nt(e, s, t) {
393
- !t && t !== 0 ? e.style.removeProperty(s) : e.style.setProperty(s, t + "");
394
- }
395
- function ze(e, s) {
396
- for (const t of e)
397
- t(s);
398
- }
399
- function We(e) {
400
- return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
401
- }
402
- function _s(e) {
403
- return e.replace(/-./g, (s) => s[1].toUpperCase());
404
- }
405
- function qs(e) {
406
- return e.charAt(0).toUpperCase() + e.slice(1);
407
- }
408
- function se(e) {
409
- const s = [];
410
- for (let t = 0; t < e.length; t++)
411
- P(e[t]) ? s.push(...se(e[t])) : (e[t] || e[t] === 0) && s.push(e[t]);
412
- return s;
413
- }
414
- var C = class {
415
- /**
416
- * The custom element this component is attached to. This is safe to use server-side with the
417
- * limited API listed below.
418
- *
419
- * **Important:** Only specific DOM APIs are safe to call server-side. This includes:
420
- *
421
- * - Attributes: `getAttribute`, `setAttribute`, `removeAttribute`, and `hasAttribute`
422
- * - Classes: `classList` API
423
- * - Styles: `style` API
424
- * - Events (noop): `addEventListener`, `removeEventListener`, and `dispatchEvent`
425
- */
426
- get el() {
427
- return this.instance.m;
428
- }
429
- /**
430
- * Reactive component properties.
431
- */
432
- get $props() {
433
- return this.instance.e;
434
- }
435
- /**
436
- * Reactive component store.
437
- */
438
- get $store() {
439
- return this.instance.k;
440
- }
441
- constructor(e) {
442
- this.instance = e, this.onAttach && e.d.push(this.onAttach.bind(this)), this.onConnect && e.p.push(this.onConnect.bind(this)), this.onDisconnect && e.i.push(this.onDisconnect.bind(this)), this.onDestroy && e.x.push(this.onDestroy.bind(this));
443
- }
444
- /**
445
- * This method can be used to specify attributes that should be set on the host element. Any
446
- * attributes that are assigned to a function will be considered a signal and updated accordingly.
447
- */
448
- setAttributes(e) {
449
- this.instance.f && Object.assign(this.instance.f, e);
450
- }
451
- /**
452
- * This method can be used to specify styles that should set be set on the host element. Any
453
- * styles that are assigned to a function will be considered a signal and updated accordingly.
454
- */
455
- setStyles(e) {
456
- this.instance.q && Object.assign(this.instance.q, e);
457
- }
458
- /**
459
- * This method is used to satisfy the CSS variables contract specified on the current
460
- * custom element definition. Other CSS variables can be set via the `setStyles` method.
461
- */
462
- setCSSVars(e) {
463
- this.setStyles(e);
464
- }
465
- /**
466
- * Type-safe utility for creating component DOM events.
467
- */
468
- createEvent(e, ...s) {
469
- return new y(e, s[0]);
470
- }
471
- /**
472
- * Creates a `DOMEvent` and dispatches it from the host element. This method is typed to
473
- * match all component events.
474
- */
475
- dispatch(e, ...s) {
476
- if (!this.el)
477
- return;
478
- const t = new y(e, s[0]);
479
- this.el.dispatchEvent(t);
480
- }
481
- /**
482
- * Adds an event listener for the given `type` and returns a function which can be invoked to
483
- * remove the event listener.
484
- *
485
- * - The listener is removed if the current scope is disposed.
486
- * - This method is safe to use on the server (noop).
487
- */
488
- listen(e, s, t) {
489
- return this.el ? f(this.el, e, s, t) : $t;
490
- }
491
- }, js = class extends C {
492
- constructor(e) {
493
- super(e), this.render && !e.F && !e.h && (e.h = this.render.bind(this));
494
- }
495
- destroy() {
496
- this.instance.y();
497
- }
498
- }, Be = (e) => (
499
- // @ts-expect-error - filter accepts `boolean` but not typed.
500
- document.createTreeWalker(e, NodeFilter.SHOW_COMMENT, (s) => s.nodeValue === "$")
501
- ), $ = null;
502
- function Ds(e, s) {
503
- const t = $;
504
- $ = { w: Be(s.target) };
505
- const i = e();
506
- return $ = t, i;
507
- }
508
- var Dt = /* @__PURE__ */ Symbol(0), Ms = ee("$$"), Mt = /* @__PURE__ */ Symbol(0), Ls = /* @__PURE__ */ ee("/$"), Rs = "/[]";
509
- function ie(e, s, t) {
510
- let i = b(s);
511
- i && s[Ws] && (s = s(), i = b(s)), i ? Ze(e, s, t) : !$ && (s || s === 0) && Ue(
512
- e,
513
- P(s) ? Ke(s) : vt(s) ? s : document.createTextNode(s + ""),
514
- t
515
- );
516
- }
517
- function Ue(e, s, t) {
518
- s && (t ? e.insertBefore(s, t) : e.appendChild(s));
519
- }
520
- function Ze(e, s, t) {
521
- const i = t && t.nodeType === 8 ? t : Ms.cloneNode();
522
- i !== t && Ue(e, i, t), d(() => void Fs(i, Le(s)));
523
- }
524
- function Fs(e, s) {
525
- const t = e[Mt];
526
- if (P(s))
527
- if ($)
528
- e[Mt] = Hs(e);
529
- else {
530
- t && at(e, t);
531
- const i = Ke(s);
532
- if (!i)
533
- return;
534
- t || i.appendChild(Pt(e)), e.after(i);
535
- }
536
- else if (vt(s))
537
- t && at(e, t), $ || e.after(s), t || s.after(Pt(e));
538
- else if (O(s) || mt(s)) {
539
- if (e[Dt]) {
540
- e.nextSibling.data = s + "";
541
- return;
542
- }
543
- t && at(e, t);
544
- let i;
545
- $ ? i = e.nextSibling : (i = document.createTextNode(s + ""), e.after(i)), e[Dt] = !0, t || i.after(Pt(e));
546
- } else t && at(e, t);
547
- }
548
- function Pt(e) {
549
- return e[Mt] = Ls.cloneNode();
550
- }
551
- function Hs(e) {
552
- for (; e; ) {
553
- if (e.nodeType === 8 && e.nodeValue === Rs)
554
- return e;
555
- e = e.nextSibling;
556
- }
557
- }
558
- function at(e, s) {
559
- for (; e.nextSibling !== s; )
560
- e.nextSibling.remove();
561
- e[Dt] = !1;
562
- }
563
- function Ke(e) {
564
- const s = se(e);
565
- if (!s.length)
566
- return null;
567
- const t = Ve();
568
- for (let i = 0; i < s.length; i++) {
569
- const n = s[i];
570
- b(n) ? Ze(t, n) : t.append(n);
571
- }
572
- return t;
573
- }
574
- function un(e) {
575
- Xe(e, {
576
- insert: ie
577
- });
578
- }
579
- var dt = Symbol(0);
580
- function Xe(e, s) {
581
- const t = e.el.tagName;
582
- window.customElements.get(t) || (window[dt] || (window[dt] = /* @__PURE__ */ new Map()), window[dt].set(t, e), window.customElements.define(t, Ys(e, s)));
583
- }
584
- function Ye(e) {
585
- const s = document.createElement("template");
586
- return s.innerHTML = e, s.content;
587
- }
588
- function At(e, s = $ == null ? void 0 : $.w) {
589
- try {
590
- return [Vs(s), s];
591
- } catch {
592
- return At(e, Be(document.importNode(e, !0)));
593
- }
594
- }
595
- function fn(e) {
596
- return At(e)[0];
597
- }
598
- function Vs(e) {
599
- let s = e.nextNode().nextSibling;
600
- if (s.localName.indexOf("-") > 0 && s.firstChild && s.firstChild.nodeName === "SHADOW-ROOT") {
601
- let t = s.firstChild.nextSibling || s.nextSibling;
602
- t && (e.currentNode = t);
603
- }
604
- return s;
605
- }
606
- var dn = $;
607
- function pn(e, s) {
608
- var n;
609
- const t = (n = window[dt]) == null ? void 0 : n.get(e.localName);
610
- if (!t)
611
- throw Error(
612
- e.localName
613
- );
614
- const i = Qe(t, { props: s });
615
- return e.attachComponent(i), i.instance.c;
616
- }
617
- function mn(e) {
618
- return document.importNode(e, !0).firstElementChild;
619
- }
620
- function zs(e) {
621
- return document.createElement(e);
622
- }
623
- var yn = ie;
624
- function gn(e, s) {
625
- ie(e.parentElement, s, e);
626
- }
627
- function bn(e, s = {}) {
628
- return u(() => e(s));
629
- }
630
- var Ws = /* @__PURE__ */ Symbol(0);
631
- function Ge(e, s) {
632
- P(s) ? s.filter(b).forEach((t) => t(e)) : b(s) && s(e);
633
- }
634
- var X = it;
635
- function En(e, s, t, i = !1) {
636
- b(t) && f(e, s, t, { capture: i });
637
- }
638
- var kn = u, wn = S, Y = d, Tn = Tt, z = /* @__PURE__ */ Symbol(0), G = /* @__PURE__ */ Symbol(0), Q = /* @__PURE__ */ Symbol(0);
639
- function Qe(e, s) {
640
- const t = new Bs(e, s);
641
- return S(() => new e(t), t.c);
642
- }
643
- var Bs = class {
644
- constructor(e, s = {}) {
645
- this.m = null, this.h = null, this.F = !1, this.j = !1, this.f = {}, this.q = {}, this.e = {}, this.z = null, this.k = null, this.d = [], this.p = [], this.i = [], this.x = [], Ce((t) => {
646
- var r;
647
- this.c = wt(), this.G = t, s.scope && s.scope.append(this.c);
648
- const i = e.el.store;
649
- i && (this.k = i.create(), this.z = new Proxy(this.k, {
650
- get: (a, o) => this.k[o]()
651
- }), As(i, this.k));
652
- const n = e.el.props;
653
- if (n && (this.e = Us(n), s.props)) {
654
- for (const a of Object.keys(s.props))
655
- if (a in n) {
656
- const o = s.props[a];
657
- N(o) ? K(() => void this.e[a].set(o())) : this.e[a].set(o);
658
- }
659
- }
660
- (r = s.props) != null && r.innerHTML && (this.F = !0), L(this.y.bind(this));
661
- });
662
- }
663
- y() {
664
- var e;
665
- if (!this.j) {
666
- this.j = !0;
667
- for (const s of this.x)
668
- S(() => s(this.m), this.c);
669
- (e = this.m) == null || e.destroy(), this.d.length = 0, this.p.length = 0, this.i.length = 0, this.x.length = 0, W(), this.G(), this.m = null, this.h = null;
670
- }
671
- }
672
- };
673
- function Us(e) {
674
- const s = {};
675
- for (const t of Object.keys(e)) {
676
- const i = e[t];
677
- s[t] = _(i.value, i);
678
- }
679
- return s;
680
- }
681
- async function Zs(e) {
682
- var n;
683
- const s = Xs(e), t = e.constructor, i = t.a;
684
- s && (await customElements.whenDefined(s.localName), s[z] === !0 || await new Promise((r) => s[z].push(r))), e.isConnected && (s != null && s.keepAlive && (e.keepAlive = !0), e.attachComponent(
685
- Qe(i, {
686
- scope: (n = s == null ? void 0 : s.component) == null ? void 0 : n.instance.c
687
- })
688
- ));
689
- }
690
- function Ks(e) {
691
- var n;
692
- const s = e.constructor, t = s.a, i = {};
693
- if (!s.f)
694
- return i;
695
- for (const r of e.attributes) {
696
- let a = s.f.get(r.name), o = a && ((n = t.el.props[a].type) == null ? void 0 : n.from);
697
- if (o) {
698
- let h = e.getAttribute(r.name);
699
- i[a] = o(h);
700
- }
701
- }
702
- return i;
703
- }
704
- function Xs(e) {
705
- let s = e.constructor, t = s.a, i = e.parentNode, n = t.el.tagName.split("-", 1)[0] + "-";
706
- for (; i; ) {
707
- if (i.nodeType === 1 && i.localName.startsWith(n))
708
- return i;
709
- i = i.parentNode;
710
- }
711
- return null;
712
- }
713
- function Ys(e, s) {
714
- const t = e.register;
715
- if (e.register) {
716
- const o = P(t) ? t : t == null ? void 0 : t();
717
- if (P(o))
718
- for (const h of o)
719
- Xe(h, s);
720
- }
721
- let i;
722
- if (e.el.props) {
723
- i = /* @__PURE__ */ new Map();
724
- for (const o of Object.keys(e.el.props)) {
725
- const c = e.el.props[o].attribute;
726
- if (c !== !1) {
727
- const p = c ?? We(o);
728
- i.set(p, o);
729
- }
730
- }
731
- }
732
- class n extends Qs {
733
- static get a() {
734
- return e;
735
- }
736
- }
737
- n.H = s, n.f = i;
738
- const r = n.prototype, a = e.prototype;
739
- if (e.el.props)
740
- for (const o of Object.keys(e.el.props))
741
- Object.defineProperty(r, o, {
742
- enumerable: !0,
743
- configurable: !0,
744
- get() {
745
- return this.component ? this.component.instance.e[o]() : e.el.props[o].value;
746
- },
747
- set(h) {
748
- const c = () => this.component.instance.e[o].set(h);
749
- if (!this.component) {
750
- this.l.delete(o), this.l.set(o, c);
751
- return;
752
- }
753
- c();
754
- }
755
- });
756
- if (a[G])
757
- for (const o of a[G])
758
- Object.defineProperty(r, o, {
759
- enumerable: !0,
760
- configurable: !0,
761
- get() {
762
- return this.component ? this.component[o] : void 0;
763
- },
764
- set(h) {
765
- if (!this.component) {
766
- this.l.delete(o), this.l.set(o, () => {
767
- this.component[o] = h;
768
- });
769
- return;
770
- }
771
- this.component[o] = h;
772
- }
773
- });
774
- if (a[Q])
775
- for (const o of a[Q])
776
- r[o] = function(...h) {
777
- return this.component[o](...h);
778
- };
779
- return n;
780
- }
781
- var Gs = HTMLElement, Je, Qs = class extends Gs {
782
- constructor() {
783
- super(...arguments), this.r = !1, this.j = !1, this.a = null, this.s = null, this.d = /* @__PURE__ */ new Set(), this.i = [], this.l = /* @__PURE__ */ new Map(), this.keepAlive = !1, this[Je] = [], this.B = !1;
784
- }
785
- get A() {
786
- return this.hasAttribute("mk-d");
787
- }
788
- get component() {
789
- return this.a;
790
- }
791
- get $store() {
792
- var e;
793
- return (e = this.a) == null ? void 0 : e.instance.k;
794
- }
795
- get state() {
796
- return this.a.instance.z;
797
- }
798
- static get observedAttributes() {
799
- return this.f ? Array.from(this.f.keys()) : [];
800
- }
801
- attributeChangedCallback(e, s, t) {
802
- var a, o;
803
- const i = this.constructor;
804
- if (!this.a || !i.f)
805
- return;
806
- const n = i.f.get(e), r = (o = (a = i.a.el.props[n]) == null ? void 0 : a.type) == null ? void 0 : o.from;
807
- r && this.a.instance.e[n].set(r(t));
808
- }
809
- connectedCallback() {
810
- var s;
811
- const e = (s = this.a) == null ? void 0 : s.instance;
812
- if (!this.A && !e)
813
- return this.N();
814
- !e || !this.isConnected || this.r || this.j || (this.hasAttribute("keep-alive") && (this.keepAlive = !0), this.r = !0, e.p.length && S(() => {
815
- Ce((t) => {
816
- this.s = wt();
817
- for (const i of e.p)
818
- S(() => {
819
- const n = i(this);
820
- N(n) && this.i.push(n);
821
- }, this.s);
822
- this.i.push(t);
823
- });
824
- }, e.c), P(this[z]) && (ze(this[z], this), this[z] = !0));
825
- }
826
- disconnectedCallback() {
827
- var s;
828
- const e = (s = this.a) == null ? void 0 : s.instance;
829
- if (!(!this.r || this.j)) {
830
- this.r = !1;
831
- for (const t of this.i)
832
- S(t, this.s);
833
- if (e != null && e.i.length)
834
- for (const t of e.i)
835
- S(() => t(this), e.c);
836
- this.s = null, !this.A && !this.keepAlive && requestAnimationFrame(() => {
837
- this.isConnected || (e == null || e.y(), this.j = !0);
838
- });
839
- }
840
- }
841
- attachComponent(e) {
842
- const s = e.instance, t = this.constructor, i = t.a.el, n = t.H;
843
- this.a || this.j || S(() => {
844
- var h;
845
- this.o = s.h ? i.shadowRoot ? this.shadowRoot ?? this.attachShadow(De(i.shadowRoot) ? { mode: "open" } : i.shadowRoot) : Js(this) : null, !$ && i.shadowRoot && i.css && (n != null && n.adoptCSS) && n.adoptCSS(this.o, i.css), s.m = this, this.a = e;
846
- const r = Ks(this);
847
- for (const c of Object.keys(r))
848
- s.e[c].set(r[c]);
849
- if ((h = this.l) != null && h.size)
850
- for (const c of this.l.values())
851
- c();
852
- this.l = null;
853
- for (const c of [...s.d, ...this.d])
854
- S(() => c(this), s.c);
855
- s.d.length = 0, this.d = null;
856
- const a = s.f, o = s.q;
857
- if (a)
858
- for (const c of Object.keys(a))
859
- N(a[c]) ? K(() => it(this, c, a[c]())) : it(this, c, a[c]);
860
- if (o)
861
- for (const c of Object.keys(o))
862
- N(o[c]) ? K(() => nt(this, c, o[c]())) : nt(this, c, o[c]);
863
- if (this.dispatchEvent(new Event("attached")), this.o && n && s.h) {
864
- const c = () => n.insert(this.o, s.h);
865
- this.hasAttribute("mk-h") && !t.a.el.nohydrate ? Ds(c, { target: this.o }) : c();
866
- }
867
- this.connectedCallback();
868
- }, s.c);
869
- }
870
- subscribe(e) {
871
- return S(() => K(() => e(this.a.instance.z)), this.a.instance.c);
872
- }
873
- onAttach(e) {
874
- return this.a ? (e(this), $t) : (this.d.add(e), () => {
875
- var s;
876
- return (s = this.d) == null ? void 0 : s.delete(e);
877
- });
878
- }
879
- onEventDispatch(e) {
880
- const s = this.constructor;
881
- if (s.n)
882
- for (const t of s.n)
883
- e(t);
884
- this.I = e;
885
- }
886
- destroy() {
887
- var e;
888
- this.disconnectedCallback(), (e = this.a) == null || e.destroy(), this.a = null, this.j = !0;
889
- }
890
- dispatchEvent(e) {
891
- var s;
892
- if (this.A) {
893
- const t = this.constructor;
894
- t.n || (t.n = /* @__PURE__ */ new Set()), t.n.has(e.type) || ((s = this.I) == null || s.call(this, e.type), t.n.add(e.type));
895
- }
896
- return bs(() => super.dispatchEvent(e));
897
- }
898
- async N() {
899
- this.B || (this.B = !0, await Zs(this), this.B = !1);
900
- }
901
- P(e) {
902
- }
903
- };
904
- Je = z;
905
- function Js(e) {
906
- if (e.firstChild && He(e.firstChild) && e.firstChild.localName === "shadow-root")
907
- return e.firstChild;
908
- {
909
- const s = zs("shadow-root");
910
- return e.prepend(s), s;
911
- }
912
- }
913
- var Lt = Symbol(0);
914
- function Ct(e) {
915
- return { [Lt]: !0, ...e };
916
- }
917
- function ti(e) {
918
- var s;
919
- if ("props" in e) {
920
- const t = e.props;
921
- for (const i of Object.keys(t)) {
922
- const n = (s = t[i]) != null && s[Lt] ? t[i] : { [Lt]: !0, value: t[i] };
923
- n.attribute !== !1 && !n.type && (n.type = ai(n.value)), t[i] = n;
924
- }
925
- }
926
- return e;
927
- }
928
- var ot = {
929
- from: (e) => e === null ? "" : e + ""
930
- }, ei = {
931
- from: (e) => e === null ? 0 : Number(e)
932
- }, si = {
933
- from: (e) => e !== null,
934
- to: (e) => e ? "" : null
935
- }, ii = {
936
- from: !1,
937
- to: () => null
938
- }, ni = {
939
- from: (e) => e === null ? [] : JSON.parse(e),
940
- to: (e) => JSON.stringify(e)
941
- }, ri = {
942
- from: (e) => e === null ? {} : JSON.parse(e),
943
- to: (e) => JSON.stringify(e)
944
- };
945
- function ai(e) {
946
- if (e === null)
947
- return ot;
948
- switch (typeof e) {
949
- case "undefined":
950
- return ot;
951
- case "string":
952
- return ot;
953
- case "boolean":
954
- return si;
955
- case "number":
956
- return ei;
957
- case "function":
958
- return ii;
959
- case "object":
960
- return P(e) ? ni : ri;
961
- default:
962
- return ot;
963
- }
964
- }
965
- function $n(e, s, t) {
966
- e[G] || (e[G] = /* @__PURE__ */ new Set()), e[G].add(s);
967
- }
968
- function Sn(e, s, t) {
969
- e[Q] || (e[Q] = /* @__PURE__ */ new Set()), e[Q].add(s);
970
- }
971
- function oi(e) {
972
- return e ? "true" : "false";
973
- }
974
- function ts() {
975
- const e = /* @__PURE__ */ new Set();
976
- return {
977
- add(...s) {
978
- for (const t of s)
979
- e.add(t);
980
- },
981
- empty() {
982
- for (const s of e)
983
- s();
984
- e.clear();
985
- }
986
- };
987
- }
988
- function li() {
989
- const e = ts();
990
- return L(e.empty), e;
991
- }
992
- function es() {
993
- let e, s;
994
- return { promise: new Promise((i, n) => {
995
- e = i, s = n;
996
- }), resolve: e, reject: s };
997
- }
998
- function ss(e) {
999
- return new Promise((s) => setTimeout(s, e));
1000
- }
1001
- function is(e) {
1002
- let s = -1, t;
1003
- function i(...n) {
1004
- t = n, !(s >= 0) && (s = window.requestAnimationFrame(() => {
1005
- e.apply(this, t), s = -1, t = void 0;
1006
- }));
1007
- }
1008
- return i;
1009
- }
1010
- var ci = "requestIdleCallback" in window ? window.requestIdleCallback : (e) => window.requestAnimationFrame(e);
1011
- function hi(e, s) {
1012
- return new Promise((t) => {
1013
- ci((i) => {
1014
- e == null || e(i), t();
1015
- }, s);
1016
- });
1017
- }
1018
- const ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1019
- __proto__: null,
1020
- DOMEvent: y,
1021
- EventsTarget: Qt,
1022
- animationFrameThrottle: is,
1023
- appendTriggerEvent: m,
1024
- ariaBool: oi,
1025
- camelToKebabCase: We,
1026
- createComment: ee,
1027
- createDisposalBin: ts,
1028
- createFragment: Ve,
1029
- deferredPromise: es,
1030
- flattenArray: se,
1031
- getOriginEvent: yt,
1032
- isArray: P,
1033
- isBoolean: De,
1034
- isDOMElement: He,
1035
- isDOMEvent: Cs,
1036
- isDOMNode: vt,
1037
- isFunction: b,
1038
- isKeyboardClick: te,
1039
- isKeyboardEvent: Jt,
1040
- isMouseEvent: Ns,
1041
- isNil: Ss,
1042
- isNull: St,
1043
- isNumber: mt,
1044
- isPointerEvent: Is,
1045
- isString: O,
1046
- isTouchEvent: Os,
1047
- isUndefined: x,
1048
- kebabToCamelCase: _s,
1049
- listenEvent: f,
1050
- noop: $t,
1051
- runAll: ze,
1052
- setAttribute: it,
1053
- setStyle: nt,
1054
- unwrapDeep: Le,
1055
- uppercaseFirstChar: qs,
1056
- useDisposalBin: li,
1057
- waitIdlePeriod: hi,
1058
- waitTimeout: ss
1059
- }, Symbol.toStringTag, { value: "Module" }));
1060
- function fi(e) {
1061
- return e instanceof HTMLAudioElement;
1062
- }
1063
- function di(e) {
1064
- return e instanceof HTMLVideoElement;
1065
- }
1066
- function pi(e) {
1067
- return fi(e) || di(e);
1068
- }
1069
- const mi = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i, yi = /* @__PURE__ */ new Set([
1070
- "audio/mpeg",
1071
- "audio/ogg",
1072
- "audio/3gp",
1073
- "audio/mp4",
1074
- "audio/webm",
1075
- "audio/flac"
1076
- ]), gi = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i, bi = /* @__PURE__ */ new Set([
1077
- "video/mp4",
1078
- "video/webm",
1079
- "video/3gp",
1080
- "video/ogg",
1081
- "video/avi",
1082
- "video/mpeg"
1083
- ]), ns = /\.(m3u8)($|\?)/i, rs = /* @__PURE__ */ new Set([
1084
- // Apple sanctioned
1085
- "application/vnd.apple.mpegurl",
1086
- // Apple sanctioned for backwards compatibility
1087
- "audio/mpegurl",
1088
- // Very common
1089
- "audio/x-mpegurl",
1090
- // Very common
1091
- "application/x-mpegurl",
1092
- // Included for completeness
1093
- "video/x-mpegurl",
1094
- "video/mpegurl",
1095
- "application/mpegurl"
1096
- ]);
1097
- function Ei({ src: e, type: s }) {
1098
- return typeof e == "string" && ns.test(e) || rs.has(s);
1099
- }
1100
- function vn(e) {
1101
- return typeof window.MediaStream < "u" && e instanceof window.MediaStream;
1102
- }
1103
- const ki = /* @__PURE__ */ Ye('<!$><audio preload="none" aria-hidden="true"></audio>'), wi = ki;
1104
- class Ti {
1105
- constructor() {
1106
- l(this, "kh");
1107
- }
1108
- canPlay({ src: s, type: t }) {
1109
- return O(s) ? mi.test(s) || yi.has(t) || s.startsWith("blob:") && t === "audio/object" : t === "audio/object";
1110
- }
1111
- mediaType() {
1112
- return "audio";
1113
- }
1114
- async load() {
1115
- return new (await import("./provider-EKFFiZS1.js")).AudioProvider(this.kh);
1116
- }
1117
- render(s) {
1118
- return (() => {
1119
- const [t, i] = At(wi);
1120
- return Y(() => X(t, "controls", s.controls())), Y(() => X(t, "crossorigin", s.crossorigin())), Ge(t, (n) => void (this.kh = n)), t;
1121
- })();
1122
- }
1123
- }
1124
- const $i = /* @__PURE__ */ Ye('<!$><video preload="none" aria-hidden="true"></video>'), Si = $i;
1125
- class as {
1126
- constructor() {
1127
- l(this, "qa");
1128
- }
1129
- canPlay(s) {
1130
- return O(s.src) ? gi.test(s.src) || bi.has(s.type) || s.src.startsWith("blob:") && s.type === "video/object" || Ei(s) && Oi() : s.type === "video/object";
1131
- }
1132
- mediaType() {
1133
- return "video";
1134
- }
1135
- async load(s) {
1136
- return new (await import("./provider-DgSZc2dM.js")).VideoProvider(this.qa, s);
1137
- }
1138
- render(s) {
1139
- const t = Tt(() => s.poster() && s.controls() ? s.poster() : null);
1140
- return (() => {
1141
- const [i, n] = At(Si);
1142
- return Y(() => X(i, "controls", s.controls())), Y(() => X(i, "crossorigin", s.crossorigin())), Y(() => X(i, "poster", t())), Ge(i, (r) => void (this.qa = r)), i;
1143
- })();
1144
- }
1145
- }
1146
- const Et = class Et extends as {
1147
- preconnect() {
1148
- fs("https://cdn.jsdelivr.net", "preconnect");
1149
- }
1150
- canPlay({ src: s, type: t }) {
1151
- return Et.supported && O(s) && (ns.test(s) || rs.has(t));
1152
- }
1153
- async load(s) {
1154
- return new (await import("./provider-B7wAEcCR.js")).HLSProvider(this.qa, s);
1155
- }
1156
- };
1157
- l(Et, "supported", qi());
1158
- let Rt = Et;
1159
- const gt = Symbol(0), Ft = Symbol(0), Ht = Symbol(0), It = Symbol(0), lt = Symbol(0), le = Symbol(0), os = Symbol(0), ls = Symbol(0), cs = Symbol(0);
1160
- var ke;
1161
- class hs extends Qt {
1162
- constructor() {
1163
- super(...arguments);
1164
- l(this, "a", []);
1165
- /* @internal */
1166
- l(this, ke, !1);
1167
- }
1168
- get length() {
1169
- return this.a.length;
1170
- }
1171
- get readonly() {
1172
- return this[lt];
1173
- }
1174
- /**
1175
- * Transform list to an array.
1176
- */
1177
- toArray() {
1178
- return [...this.a];
1179
- }
1180
- [(ke = lt, Symbol.iterator)]() {
1181
- return this.a.values();
1182
- }
1183
- /* @internal */
1184
- [gt](t, i) {
1185
- const n = this.a.length;
1186
- "" + n in this || Object.defineProperty(this, n, {
1187
- get() {
1188
- return this.a[n];
1189
- }
1190
- }), !this.a.includes(t) && (this.a.push(t), this.dispatchEvent(new y("add", { detail: t, trigger: i })));
1191
- }
1192
- /* @internal */
1193
- [Ft](t, i) {
1194
- var r;
1195
- const n = this.a.indexOf(t);
1196
- n >= 0 && ((r = this[ls]) == null || r.call(this, t, i), this.a.splice(n, 1), this.dispatchEvent(new y("remove", { detail: t, trigger: i })));
1197
- }
1198
- /* @internal */
1199
- [Ht](t) {
1200
- var i;
1201
- for (const n of [...this.a])
1202
- this[Ft](n, t);
1203
- this.a = [], this[le](!1, t), (i = this[os]) == null || i.call(this);
1204
- }
1205
- /* @internal */
1206
- [le](t, i) {
1207
- this[lt] !== t && (this[lt] = t, this.dispatchEvent(new y("readonly-change", { detail: t, trigger: i })));
1208
- }
1209
- }
1210
- var E = {
1211
- fullscreenEnabled: 0,
1212
- fullscreenElement: 1,
1213
- requestFullscreen: 2,
1214
- exitFullscreen: 3,
1215
- fullscreenchange: 4,
1216
- fullscreenerror: 5,
1217
- fullscreen: 6
1218
- }, ce = [
1219
- "webkitFullscreenEnabled",
1220
- "webkitFullscreenElement",
1221
- "webkitRequestFullscreen",
1222
- "webkitExitFullscreen",
1223
- "webkitfullscreenchange",
1224
- "webkitfullscreenerror",
1225
- "-webkit-full-screen"
1226
- ], he = [
1227
- "mozFullScreenEnabled",
1228
- "mozFullScreenElement",
1229
- "mozRequestFullScreen",
1230
- "mozCancelFullScreen",
1231
- "mozfullscreenchange",
1232
- "mozfullscreenerror",
1233
- "-moz-full-screen"
1234
- ], ue = [
1235
- "msFullscreenEnabled",
1236
- "msFullscreenElement",
1237
- "msRequestFullscreen",
1238
- "msExitFullscreen",
1239
- "MSFullscreenChange",
1240
- "MSFullscreenError",
1241
- "-ms-fullscreen"
1242
- ], g = typeof window < "u" && typeof window.document < "u" ? window.document : {}, w = "fullscreenEnabled" in g && Object.keys(E) || ce[0] in g && ce || he[0] in g && he || ue[0] in g && ue || [], vi = {
1243
- requestFullscreen: function(e) {
1244
- return e[w[E.requestFullscreen]]();
1245
- },
1246
- requestFullscreenFunction: function(e) {
1247
- return e[w[E.requestFullscreen]];
1248
- },
1249
- get exitFullscreen() {
1250
- return g[w[E.exitFullscreen]].bind(g);
1251
- },
1252
- get fullscreenPseudoClass() {
1253
- return ":" + w[E.fullscreen];
1254
- },
1255
- addEventListener: function(e, s, t) {
1256
- return g.addEventListener(w[E[e]], s, t);
1257
- },
1258
- removeEventListener: function(e, s, t) {
1259
- return g.removeEventListener(w[E[e]], s, t);
1260
- },
1261
- get fullscreenEnabled() {
1262
- return !!g[w[E.fullscreenEnabled]];
1263
- },
1264
- set fullscreenEnabled(e) {
1265
- },
1266
- get fullscreenElement() {
1267
- return g[w[E.fullscreenElement]];
1268
- },
1269
- set fullscreenElement(e) {
1270
- },
1271
- get onfullscreenchange() {
1272
- return g[("on" + w[E.fullscreenchange]).toLowerCase()];
1273
- },
1274
- set onfullscreenchange(e) {
1275
- return g[("on" + w[E.fullscreenchange]).toLowerCase()] = e;
1276
- },
1277
- get onfullscreenerror() {
1278
- return g[("on" + w[E.fullscreenerror]).toLowerCase()];
1279
- },
1280
- set onfullscreenerror(e) {
1281
- return g[("on" + w[E.fullscreenerror]).toLowerCase()] = e;
1282
- }
1283
- }, D = vi;
1284
- const bt = D.fullscreenEnabled;
1285
- class Ai extends C {
1286
- constructor() {
1287
- super(...arguments);
1288
- /**
1289
- * Tracks whether we're the active fullscreen event listener. Fullscreen events can only be
1290
- * listened to globally on the document so we need to know if they relate to the current host
1291
- * element or not.
1292
- */
1293
- l(this, "b", !1);
1294
- l(this, "c", !1);
1295
- }
1296
- get active() {
1297
- return this.c;
1298
- }
1299
- get supported() {
1300
- return bt;
1301
- }
1302
- onConnect() {
1303
- f(D, "fullscreenchange", this.d.bind(this)), f(D, "fullscreenerror", this.e.bind(this));
1304
- }
1305
- async onDisconnect() {
1306
- bt && await this.exit();
1307
- }
1308
- d(t) {
1309
- const i = Ot(this.el);
1310
- i !== this.c && (i || (this.b = !1), this.c = i, this.dispatch("fullscreen-change", { detail: i, trigger: t }));
1311
- }
1312
- e(t) {
1313
- this.b && (this.dispatch("fullscreen-error", { detail: null, trigger: t }), this.b = !1);
1314
- }
1315
- async enter() {
1316
- try {
1317
- return this.b = !0, !this.el || Ot(this.el) ? void 0 : (fe(), D.requestFullscreen(this.el));
1318
- } catch (t) {
1319
- throw this.b = !1, t;
1320
- }
1321
- }
1322
- async exit() {
1323
- if (!(!this.el || !Ot(this.el)))
1324
- return fe(), D.exitFullscreen();
1325
- }
1326
- }
1327
- function An() {
1328
- return bt;
1329
- }
1330
- function Ot(e) {
1331
- if (D.fullscreenElement === e)
1332
- return !0;
1333
- try {
1334
- return e.matches(
1335
- // @ts-expect-error - `fullscreenPseudoClass` is missing from `@types/fscreen`.
1336
- D.fullscreenPseudoClass
1337
- );
1338
- } catch {
1339
- return !1;
1340
- }
1341
- }
1342
- function fe() {
1343
- if (!bt)
1344
- throw Error(
1345
- "[vidstack] no fullscreen API"
1346
- );
1347
- }
1348
- const xi = navigator == null ? void 0 : navigator.userAgent.toLowerCase(), Pi = /iphone|ipad|ipod|ios|crios|fxios/i.test(xi), xn = /(iphone|ipod)/gi.test(navigator == null ? void 0 : navigator.platform), Pn = !!window.chrome, Ci = !!window.safari || Pi;
1349
- function Ii() {
1350
- return !x(screen.orientation) && b(screen.orientation.lock) && b(screen.orientation.unlock);
1351
- }
1352
- function Oi(e) {
1353
- return e || (e = document.createElement("video")), e.canPlayType("application/vnd.apple.mpegurl").length > 0;
1354
- }
1355
- function Cn(e) {
1356
- return !!document.pictureInPictureEnabled && !e.disablePictureInPicture;
1357
- }
1358
- function In(e) {
1359
- return b(e.webkitSupportsPresentationMode) && b(e.webkitSetPresentationMode);
1360
- }
1361
- async function On() {
1362
- const e = document.createElement("video");
1363
- return e.volume = 0.5, await ss(0), e.volume === 0.5;
1364
- }
1365
- function Ni() {
1366
- return (window == null ? void 0 : window.MediaSource) ?? (window == null ? void 0 : window.WebKitMediaSource);
1367
- }
1368
- function _i() {
1369
- return (window == null ? void 0 : window.SourceBuffer) ?? (window == null ? void 0 : window.WebKitSourceBuffer);
1370
- }
1371
- function qi() {
1372
- const e = Ni();
1373
- if (x(e))
1374
- return !1;
1375
- const s = e && b(e.isTypeSupported) && e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'), t = _i(), i = x(t) || !x(t.prototype) && b(t.prototype.appendBuffer) && b(t.prototype.remove);
1376
- return !!s && !!i;
1377
- }
1378
- const J = Ii();
1379
- class ji extends C {
1380
- constructor() {
1381
- super(...arguments);
1382
- l(this, "g", _(pe()));
1383
- l(this, "f", _(!1));
1384
- l(this, "h");
1385
- }
1386
- /**
1387
- * The current screen orientation type.
1388
- *
1389
- * @signal
1390
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation}
1391
- * @see https://w3c.github.io/screen-orientation/#screen-orientation-types-and-locks
1392
- */
1393
- get type() {
1394
- return this.g();
1395
- }
1396
- /**
1397
- * Whether the screen orientation is currently locked.
1398
- *
1399
- * @signal
1400
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation}
1401
- * @see https://w3c.github.io/screen-orientation/#screen-orientation-types-and-locks
1402
- */
1403
- get locked() {
1404
- return this.f();
1405
- }
1406
- /**
1407
- * Whether the viewport is in a portrait orientation.
1408
- *
1409
- * @signal
1410
- */
1411
- get portrait() {
1412
- return this.g().startsWith("portrait");
1413
- }
1414
- /**
1415
- * Whether the viewport is in a landscape orientation.
1416
- *
1417
- * @signal
1418
- */
1419
- get landscape() {
1420
- return this.g().startsWith("landscape");
1421
- }
1422
- /**
1423
- * Whether the native Screen Orientation API is available.
1424
- */
1425
- get supported() {
1426
- return J;
1427
- }
1428
- onConnect() {
1429
- if (J)
1430
- f(screen.orientation, "change", this.i.bind(this));
1431
- else {
1432
- const t = window.matchMedia("(orientation: landscape)");
1433
- return t.onchange = this.i.bind(this), () => t.onchange = null;
1434
- }
1435
- }
1436
- async onDisconnect() {
1437
- J && this.f() && await this.unlock();
1438
- }
1439
- i(t) {
1440
- this.g.set(pe()), this.dispatch("orientation-change", {
1441
- detail: {
1442
- orientation: u(this.g),
1443
- lock: this.h
1444
- },
1445
- trigger: t
1446
- });
1447
- }
1448
- /**
1449
- * Locks the orientation of the screen to the desired orientation type using the
1450
- * Screen Orientation API.
1451
- *
1452
- * @param lockType - The screen lock orientation type.
1453
- * @throws Error - If screen orientation API is unavailable.
1454
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation}
1455
- * @see {@link https://w3c.github.io/screen-orientation}
1456
- */
1457
- async lock(t) {
1458
- u(this.f) || this.h === t || (de(), await screen.orientation.lock(t), this.f.set(!0), this.h = t);
1459
- }
1460
- /**
1461
- * Unlocks the orientation of the screen to it's default state using the Screen Orientation
1462
- * API. This method will throw an error if the API is unavailable.
1463
- *
1464
- * @throws Error - If screen orientation API is unavailable.
1465
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation}
1466
- * @see {@link https://w3c.github.io/screen-orientation}
1467
- */
1468
- async unlock() {
1469
- u(this.f) && (de(), this.h = void 0, await screen.orientation.unlock(), this.f.set(!1));
1470
- }
1471
- }
1472
- function de() {
1473
- if (!J)
1474
- throw Error(
1475
- "[vidstack] no orientation API"
1476
- );
1477
- }
1478
- function pe() {
1479
- return J ? window.screen.orientation.type : window.innerWidth >= window.innerHeight ? "landscape-primary" : "portrait-primary";
1480
- }
1481
- function Nn(e, s, t) {
1482
- e.hasAttribute(s) || e.setAttribute(s, t);
1483
- }
1484
- function _n(e, s) {
1485
- if (e.hasAttribute("aria-label") || e.hasAttribute("aria-describedby"))
1486
- return;
1487
- function t() {
1488
- it(e, "aria-label", s());
1489
- }
1490
- d(t);
1491
- }
1492
- function qn(e, s, t) {
1493
- for (; s; ) {
1494
- if (s === e)
1495
- return !0;
1496
- if (s.localName === e.localName || t != null && t(s))
1497
- break;
1498
- s = s.parentElement;
1499
- }
1500
- return !1;
1501
- }
1502
- function jn(e, s) {
1503
- f(e, "pointerup", (t) => {
1504
- t.button === 0 && s(t);
1505
- }), f(e, "keydown", (t) => {
1506
- te(t) && s(t);
1507
- });
1508
- }
1509
- function Di(e) {
1510
- const s = wt();
1511
- requestAnimationFrame(() => S(e, s));
1512
- }
1513
- const Mi = vs();
1514
- function ne() {
1515
- return Me(Mi);
1516
- }
1517
- const Dn = [
1518
- "autoplay",
1519
- "autoplayError",
1520
- "canFullscreen",
1521
- "canPictureInPicture",
1522
- "canLoad",
1523
- "canPlay",
1524
- "canSeek",
1525
- "ended",
1526
- "error",
1527
- "fullscreen",
1528
- "loop",
1529
- "live",
1530
- "liveEdge",
1531
- "mediaType",
1532
- "muted",
1533
- "paused",
1534
- "pictureInPicture",
1535
- "playing",
1536
- "playsinline",
1537
- "seeking",
1538
- "started",
1539
- "streamType",
1540
- "userIdle",
1541
- "viewType",
1542
- "waiting"
1543
- ], Li = {
1544
- togglePaused: "k Space",
1545
- toggleMuted: "m",
1546
- toggleFullscreen: "f",
1547
- togglePictureInPicture: "i",
1548
- toggleCaptions: "c",
1549
- seekBackward: "ArrowLeft",
1550
- seekForward: "ArrowRight",
1551
- volumeUp: "ArrowUp",
1552
- volumeDown: "ArrowDown"
1553
- }, me = /* @__PURE__ */ new Set(["Shift", "Alt", "Meta", "Control"]), Ri = 'button, [role="button"]', ye = 'input, textarea, select, [contenteditable], [role^="menuitem"]';
1554
- class Mn extends C {
1555
- constructor(t, i) {
1556
- super(t);
1557
- l(this, "Ua");
1558
- l(this, "Ta", null);
1559
- this.j = i;
1560
- }
1561
- onConnect() {
1562
- d(this.Xa.bind(this));
1563
- }
1564
- Xa() {
1565
- const { keyDisabled: t, keyTarget: i } = this.$props;
1566
- if (t())
1567
- return;
1568
- const n = i() === "player" ? this.el : document, r = _(!1);
1569
- n === this.el ? (this.listen("focusin", () => r.set(!0)), this.listen("focusout", (a) => {
1570
- this.el.contains(a.target) || r.set(!1);
1571
- })) : (u(r) || r.set(document.querySelector("media-player") === this.el), f(document, "focusin", (a) => {
1572
- const o = a.composedPath().find((h) => h instanceof Element && h.localName === "media-player");
1573
- o !== void 0 && r.set(this.el === o);
1574
- })), d(() => {
1575
- r() && (f(n, "keyup", this.Ya.bind(this)), f(n, "keydown", this.Za.bind(this)), f(n, "keydown", this._a.bind(this), { capture: !0 }));
1576
- });
1577
- }
1578
- Ya(t) {
1579
- const i = document.activeElement, n = i == null ? void 0 : i.hasAttribute("data-media-slider");
1580
- if (!t.key || !this.$store.canSeek() || n || i != null && i.matches(ye))
1581
- return;
1582
- const r = this.Va(t);
1583
- if (r != null && r.startsWith("seek") && (t.preventDefault(), t.stopPropagation(), this.Ta ? (this.Wa(t), this.Ta = null) : (this.j.remote.seek(this.Ua, t), this.Ua = void 0)), r != null && r.startsWith("volume")) {
1584
- const a = this.el.querySelector("media-volume-slider");
1585
- a == null || a.dispatchEvent(new y("keyup", { trigger: t }));
1586
- }
1587
- }
1588
- Za(t) {
1589
- var a, o;
1590
- if (!t.key || me.has(t.key))
1591
- return;
1592
- const i = document.activeElement;
1593
- if (i != null && i.matches(ye) || te(t) && (i != null && i.matches(Ri)))
1594
- return;
1595
- const n = i == null ? void 0 : i.hasAttribute("data-media-slider"), r = this.Va(t);
1596
- if (!r && !t.metaKey && /[0-9]/.test(t.key) && !n) {
1597
- t.preventDefault(), t.stopPropagation(), this.j.remote.seek(this.$store.duration() / 10 * Number(t.key), t);
1598
- return;
1599
- }
1600
- if (!(!r || /volume|seek/.test(r) && n))
1601
- switch (t.preventDefault(), t.stopPropagation(), r) {
1602
- case "seekForward":
1603
- case "seekBackward":
1604
- this.$a(t, r);
1605
- break;
1606
- case "volumeUp":
1607
- case "volumeDown":
1608
- const h = this.el.querySelector("media-volume-slider");
1609
- if (h)
1610
- h.dispatchEvent(new y("keydown", { trigger: t }));
1611
- else {
1612
- const c = t.shiftKey ? 0.1 : 0.05;
1613
- this.j.remote.changeVolume(
1614
- this.$store.volume() + (r === "volumeUp" ? +c : -c),
1615
- t
1616
- );
1617
- }
1618
- break;
1619
- case "toggleFullscreen":
1620
- this.j.remote.toggleFullscreen("prefer-media", t);
1621
- break;
1622
- default:
1623
- (o = (a = this.j.remote)[r]) == null || o.call(a, t);
1624
- }
1625
- }
1626
- _a(t) {
1627
- pi(t.target) && this.Va(t) && t.preventDefault();
1628
- }
1629
- Va(t) {
1630
- const i = {
1631
- ...this.$props.keyShortcuts(),
1632
- ...this.j.ariaKeys
1633
- };
1634
- return Object.keys(i).find(
1635
- (n) => i[n].split(" ").some(
1636
- (r) => Hi(r).replace(/Control/g, "Ctrl").split("+").every(
1637
- (a) => me.has(a) ? t[a.toLowerCase() + "Key"] : t.key === a.replace("Space", " ")
1638
- )
1639
- )
1640
- );
1641
- }
1642
- ab(t, i) {
1643
- const n = t.shiftKey ? 10 : 5;
1644
- return this.Ua = Math.max(
1645
- 0,
1646
- Math.min(
1647
- (this.Ua ?? this.$store.currentTime()) + (i === "seekForward" ? +n : -n),
1648
- this.$store.duration()
1649
- )
1650
- );
1651
- }
1652
- Wa(t) {
1653
- var i;
1654
- (i = this.Ta) == null || i.dispatchEvent(new y(t.type, { trigger: t }));
1655
- }
1656
- $a(t, i) {
1657
- this.$store.canSeek() && (this.Ta || (this.Ta = this.el.querySelector("media-time-slider")), this.Ta ? this.Wa(t) : this.j.remote.seeking(this.ab(t, i), t));
1658
- }
1659
- }
1660
- const Fi = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")"];
1661
- function Hi(e) {
1662
- return e.replace(/Shift\+(\d)/g, (s, t) => Fi[t - 1]);
1663
- }
1664
- const Ln = {
1665
- autoplay: !1,
1666
- aspectRatio: Ct({
1667
- value: null,
1668
- type: {
1669
- from(e) {
1670
- if (!e)
1671
- return null;
1672
- if (!e.includes("/"))
1673
- return +e;
1674
- const [s, t] = e.split("/").map(Number);
1675
- return +(s / t).toFixed(4);
1676
- }
1677
- }
1678
- }),
1679
- controls: !1,
1680
- currentTime: 0,
1681
- crossorigin: null,
1682
- fullscreenOrientation: "landscape",
1683
- load: "visible",
1684
- logLevel: "silent",
1685
- loop: !1,
1686
- muted: !1,
1687
- paused: !0,
1688
- playsinline: !1,
1689
- playbackRate: 1,
1690
- poster: "",
1691
- preload: "metadata",
1692
- preferNativeHLS: Ct({
1693
- value: !1,
1694
- attribute: "prefer-native-hls"
1695
- }),
1696
- src: "",
1697
- userIdleDelay: 2e3,
1698
- viewType: "unknown",
1699
- streamType: "unknown",
1700
- volume: 1,
1701
- liveEdgeTolerance: 10,
1702
- minLiveDVRWindow: 60,
1703
- keyDisabled: !1,
1704
- keyTarget: "player",
1705
- keyShortcuts: Li,
1706
- title: "",
1707
- thumbnails: null,
1708
- textTracks: Ct({
1709
- value: [],
1710
- attribute: !1
1711
- }),
1712
- smallBreakpointX: 600,
1713
- largeBreakpointX: 980,
1714
- smallBreakpointY: 380,
1715
- largeBreakpointY: 600
1716
- };
1717
- class Nt {
1718
- constructor(s, t) {
1719
- l(this, "W");
1720
- P(s) ? this.W = s : !x(s) && !x(t) ? this.W = [[s, t]] : this.W = [];
1721
- }
1722
- get length() {
1723
- return this.W.length;
1724
- }
1725
- start(s) {
1726
- return this.W[s][0] ?? 1 / 0;
1727
- }
1728
- end(s) {
1729
- return this.W[s][1] ?? 1 / 0;
1730
- }
1731
- }
1732
- function ge(e) {
1733
- if (!e.length)
1734
- return null;
1735
- let s = e.start(0);
1736
- for (let t = 1; t < e.length; t++) {
1737
- const i = e.start(t);
1738
- i < s && (s = i);
1739
- }
1740
- return s;
1741
- }
1742
- function be(e) {
1743
- if (!e.length)
1744
- return null;
1745
- let s = e.end(0);
1746
- for (let t = 1; t < e.length; t++) {
1747
- const i = e.end(t);
1748
- i > s && (s = i);
1749
- }
1750
- return s;
1751
- }
1752
- const Vi = new xs({
1753
- audioTracks: [],
1754
- audioTrack: null,
1755
- autoplay: !1,
1756
- autoplayError: void 0,
1757
- buffered: new Nt(),
1758
- duration: 0,
1759
- canLoad: !1,
1760
- canFullscreen: !1,
1761
- canPictureInPicture: !1,
1762
- canPlay: !1,
1763
- controls: !1,
1764
- crossorigin: null,
1765
- poster: "",
1766
- currentTime: 0,
1767
- ended: !1,
1768
- error: void 0,
1769
- fullscreen: !1,
1770
- loop: !1,
1771
- logLevel: "silent",
1772
- mediaType: "unknown",
1773
- muted: !1,
1774
- paused: !0,
1775
- played: new Nt(),
1776
- playing: !1,
1777
- playsinline: !1,
1778
- pictureInPicture: !1,
1779
- preload: "metadata",
1780
- playbackRate: 1,
1781
- qualities: [],
1782
- quality: null,
1783
- autoQuality: !1,
1784
- canSetQuality: !0,
1785
- seekable: new Nt(),
1786
- seeking: !1,
1787
- source: { src: "", type: "" },
1788
- sources: [],
1789
- started: !1,
1790
- title: "",
1791
- textTracks: [],
1792
- textTrack: null,
1793
- thumbnails: null,
1794
- thumbnailCues: [],
1795
- volume: 1,
1796
- waiting: !1,
1797
- get viewType() {
1798
- return this.providedViewType !== "unknown" ? this.providedViewType : this.mediaType;
1799
- },
1800
- get streamType() {
1801
- return this.providedStreamType !== "unknown" ? this.providedStreamType : this.inferredStreamType;
1802
- },
1803
- get currentSrc() {
1804
- return this.source;
1805
- },
1806
- get bufferedStart() {
1807
- return ge(this.buffered) ?? 0;
1808
- },
1809
- get bufferedEnd() {
1810
- return be(this.buffered) ?? 0;
1811
- },
1812
- get seekableStart() {
1813
- return ge(this.seekable) ?? 0;
1814
- },
1815
- get seekableEnd() {
1816
- return this.canPlay ? be(this.seekable) ?? 1 / 0 : 0;
1817
- },
1818
- get seekableWindow() {
1819
- return Math.max(0, this.seekableEnd - this.seekableStart);
1820
- },
1821
- // ~~ responsive design ~~
1822
- touchPointer: !1,
1823
- orientation: "landscape",
1824
- mediaWidth: 0,
1825
- mediaHeight: 0,
1826
- breakpointX: "sm",
1827
- breakpointY: "sm",
1828
- // ~~ user props ~~
1829
- userIdle: !1,
1830
- userBehindLiveEdge: !1,
1831
- // ~~ live props ~~
1832
- liveEdgeTolerance: 10,
1833
- minLiveDVRWindow: 60,
1834
- get canSeek() {
1835
- return /unknown|on-demand|:dvr/.test(this.streamType) && Number.isFinite(this.seekableWindow) && (!this.live || /:dvr/.test(this.streamType) && this.seekableWindow >= this.minLiveDVRWindow);
1836
- },
1837
- get live() {
1838
- return this.streamType.includes("live") || !Number.isFinite(this.duration);
1839
- },
1840
- get liveEdgeStart() {
1841
- return this.live && Number.isFinite(this.seekableEnd) ? Math.max(0, (this.liveSyncPosition ?? this.seekableEnd) - this.liveEdgeTolerance) : 0;
1842
- },
1843
- get liveEdge() {
1844
- return this.live && (!this.canSeek || !this.userBehindLiveEdge && this.currentTime >= this.liveEdgeStart);
1845
- },
1846
- get liveEdgeWindow() {
1847
- return this.live && Number.isFinite(this.seekableEnd) ? this.seekableEnd - this.liveEdgeStart : 0;
1848
- },
1849
- // ~~ internal props ~~
1850
- autoplaying: !1,
1851
- providedViewType: "unknown",
1852
- providedStreamType: "unknown",
1853
- inferredStreamType: "unknown",
1854
- liveSyncPosition: null
1855
- }), zi = /* @__PURE__ */ new Set([
1856
- "autoplay",
1857
- "breakpointX",
1858
- "breakpointY",
1859
- "canFullscreen",
1860
- "canLoad",
1861
- "canPictureInPicture",
1862
- "controls",
1863
- "fullscreen",
1864
- "logLevel",
1865
- "loop",
1866
- "mediaHeight",
1867
- "mediaWidth",
1868
- "muted",
1869
- "orientation",
1870
- "pictureInPicture",
1871
- "playsinline",
1872
- "poster",
1873
- "preload",
1874
- "providedStreamType",
1875
- "providedViewType",
1876
- "source",
1877
- "sources",
1878
- "textTrack",
1879
- "textTracks",
1880
- "thumbnailCues",
1881
- "thumbnails",
1882
- "title",
1883
- "touchPointer",
1884
- "volume"
1885
- ]);
1886
- function Wi(e) {
1887
- Vi.reset(e, (s) => !zi.has(s)), W();
1888
- }
1889
- const Z = Symbol(0);
1890
- class us extends hs {
1891
- get selected() {
1892
- return this.a.find((s) => s.selected) ?? null;
1893
- }
1894
- get selectedIndex() {
1895
- return this.a.findIndex((s) => s.selected);
1896
- }
1897
- /* @internal */
1898
- [ls](s, t) {
1899
- this[It](s, !1, t);
1900
- }
1901
- /* @internal */
1902
- [gt](s, t) {
1903
- s[Z] = !1, Object.defineProperty(s, "selected", {
1904
- get() {
1905
- return this[Z];
1906
- },
1907
- set: (i) => {
1908
- var n;
1909
- this.readonly || ((n = this[cs]) == null || n.call(this), this[It](s, i));
1910
- }
1911
- }), super[gt](s, t);
1912
- }
1913
- /* @internal */
1914
- [It](s, t, i) {
1915
- if (t === s[Z])
1916
- return;
1917
- const n = this.selected;
1918
- s[Z] = t, (t ? n !== s : n === s) && (n && (n[Z] = !1), this.dispatchEvent(
1919
- new y("change", {
1920
- detail: { prev: n, current: this.selected },
1921
- trigger: i
1922
- })
1923
- ));
1924
- }
1925
- }
1926
- const ct = Symbol(0), _t = Symbol(0);
1927
- var we;
1928
- class Rn extends us {
1929
- constructor() {
1930
- super(...arguments);
1931
- l(this, "Sa", !1);
1932
- /**
1933
- * Configures quality switching:
1934
- *
1935
- * - `current`: Trigger an immediate quality level switch. This will abort the current fragment
1936
- * request if any, flush the whole buffer, and fetch fragment matching with current position
1937
- * and requested quality level.
1938
- *
1939
- * - `next`: Trigger a quality level switch for next fragment. This could eventually flush
1940
- * already buffered next fragment.
1941
- *
1942
- * - `load`: Set quality level for next loaded fragment.
1943
- *
1944
- * @see {@link https://vidstack.io/docs/player/core-concepts/quality#switch}
1945
- * @see {@link https://github.com/video-dev/hls.js/blob/master/docs/API.md#quality-switch-control-api}
1946
- */
1947
- l(this, "switch", "current");
1948
- /* @internal */
1949
- l(this, we);
1950
- }
1951
- /**
1952
- * Whether automatic quality selection is enabled.
1953
- */
1954
- get auto() {
1955
- return this.Sa || this.readonly;
1956
- }
1957
- /* @internal */
1958
- [(we = _t, cs)]() {
1959
- this[ct](!1);
1960
- }
1961
- /* @internal */
1962
- [os](t) {
1963
- this[ct](!1, t);
1964
- }
1965
- /**
1966
- * Request automatic quality selection (if supported). This will be a no-op if the list is
1967
- * `readonly` as that already implies auto-selection.
1968
- */
1969
- autoSelect(t) {
1970
- this.readonly || this.Sa || !this[_t] || (this[_t](), this[ct](!0, t));
1971
- }
1972
- /* @internal */
1973
- [ct](t, i) {
1974
- this.Sa !== t && (this.Sa = t, this.dispatchEvent(
1975
- new y("auto-change", {
1976
- detail: t,
1977
- trigger: i
1978
- })
1979
- ));
1980
- }
1981
- }
1982
- class Fn extends C {
1983
- constructor(s, t) {
1984
- super(s), this.jf = t;
1985
- }
1986
- async onAttach(s) {
1987
- const t = this.$props.load();
1988
- if (t === "eager")
1989
- requestAnimationFrame(this.jf);
1990
- else if (t === "idle") {
1991
- const { waitIdlePeriod: i } = await Promise.resolve().then(() => ui);
1992
- i(this.jf);
1993
- } else if (t === "visible") {
1994
- const i = new IntersectionObserver((n) => {
1995
- n[0].isIntersecting && (i.disconnect(), this.jf());
1996
- });
1997
- return i.observe(s), i.disconnect.bind(i);
1998
- }
1999
- }
2000
- }
2001
- class Hn {
2002
- constructor(s, t) {
2003
- this.N = s, this.j = t;
2004
- }
2005
- p(s, ...t) {
2006
- this.N(new y(s, t == null ? void 0 : t[0]));
2007
- }
2008
- async lf(s, t) {
2009
- const { $store: i, logger: n } = this.j;
2010
- u(i.canPlay) || (this.p("can-play", { detail: s, trigger: t }), W(), i.canPlay() && i.autoplay() && !i.started() && await this.kf());
2011
- }
2012
- async kf() {
2013
- const { player: s, $store: t } = this.j;
2014
- t.autoplaying.set(!0);
2015
- try {
2016
- await s.play(), this.p("autoplay", { detail: { muted: t.muted() } });
2017
- } catch (i) {
2018
- this.p("autoplay-fail", {
2019
- detail: {
2020
- muted: t.muted(),
2021
- error: i
2022
- }
2023
- });
2024
- } finally {
2025
- t.autoplaying.set(!1);
2026
- }
2027
- }
2028
- }
2029
- class Bi {
2030
- constructor() {
2031
- l(this, "Ze", /* @__PURE__ */ new Map());
2032
- }
2033
- /**
2034
- * Queue the given `item` under the given `key` to be processed at a later time by calling
2035
- * `serve(key)`.
2036
- */
2037
- t(s, t) {
2038
- this.Ze.has(s) || this.Ze.set(s, /* @__PURE__ */ new Set()), this.Ze.get(s).add(t);
2039
- }
2040
- /**
2041
- * Process all items in queue for the given `key`.
2042
- */
2043
- cf(s, t) {
2044
- const i = this.Ze.get(s);
2045
- if (i)
2046
- for (const n of i)
2047
- t(n);
2048
- this.Ze.delete(s);
2049
- }
2050
- /**
2051
- * Removes all queued items under the given `key`.
2052
- */
2053
- yf(s) {
2054
- this.Ze.delete(s);
2055
- }
2056
- /**
2057
- * The number of items currently queued under the given `key`.
2058
- */
2059
- df(s) {
2060
- var t;
2061
- return ((t = this.Ze.get(s)) == null ? void 0 : t.size) ?? 0;
2062
- }
2063
- /**
2064
- * Clear all items in the queue.
2065
- */
2066
- gf() {
2067
- this.Ze.clear();
2068
- }
2069
- }
2070
- function ht(e) {
2071
- return e instanceof Error ? e : Error(JSON.stringify(e));
2072
- }
2073
- class Ui extends C {
2074
- constructor() {
2075
- super(...arguments);
2076
- l(this, "da", -2);
2077
- l(this, "ba", 2e3);
2078
- l(this, "ea", !1);
2079
- l(this, "ca", null);
2080
- }
2081
- /**
2082
- * Whether the media user is currently idle.
2083
- */
2084
- get idling() {
2085
- return this.$store.userIdle();
2086
- }
2087
- /**
2088
- * The amount of delay in milliseconds while media playback is progressing without user
2089
- * activity to indicate an idle state.
2090
- *
2091
- * @defaultValue 2000
2092
- */
2093
- get idleDelay() {
2094
- return this.ba;
2095
- }
2096
- set idleDelay(t) {
2097
- this.ba = t;
2098
- }
2099
- /**
2100
- * Change the user idle state.
2101
- */
2102
- idle(t, i = this.ba, n) {
2103
- this.fa(), this.ea || this.ga(t, i, n);
2104
- }
2105
- /**
2106
- * Whether all idle tracking should be paused until resumed again.
2107
- */
2108
- pauseIdleTracking(t, i) {
2109
- this.ea = t, t && (this.fa(), this.ga(!1, 0, i));
2110
- }
2111
- onConnect() {
2112
- d(this.C.bind(this)), f(this.el, "play", this.ia.bind(this)), f(this.el, "pause", this.ja.bind(this));
2113
- }
2114
- C() {
2115
- if (this.$store.paused())
2116
- return;
2117
- const t = this.ka.bind(this);
2118
- for (const i of ["pointerup", "keydown"])
2119
- f(this.el, i, t);
2120
- d(() => {
2121
- this.$store.touchPointer() || f(this.el, "pointermove", t);
2122
- });
2123
- }
2124
- ia(t) {
2125
- this.idle(!0, this.ba, t);
2126
- }
2127
- ja(t) {
2128
- this.idle(!1, 0, t);
2129
- }
2130
- fa() {
2131
- window.clearTimeout(this.da), this.da = -1;
2132
- }
2133
- ka(t) {
2134
- var i;
2135
- t.MEDIA_GESTURE || (Jt(t) && (t.key === "Escape" ? ((i = this.el) == null || i.focus(), this.ca = null) : this.ca && (t.preventDefault(), requestAnimationFrame(() => {
2136
- var n;
2137
- (n = this.ca) == null || n.focus(), this.ca = null;
2138
- }))), this.idle(!1, 0, t), this.idle(!0, this.ba, t));
2139
- }
2140
- ga(t, i, n) {
2141
- if (i === 0) {
2142
- this.ha(t, n);
2143
- return;
2144
- }
2145
- this.da = window.setTimeout(() => {
2146
- this.ha(t && !this.ea, n);
2147
- }, i);
2148
- }
2149
- ha(t, i) {
2150
- var n;
2151
- this.$store.userIdle() !== t && (this.$store.userIdle.set(t), t && document.activeElement && ((n = this.el) != null && n.contains(document.activeElement)) && (this.ca = document.activeElement, requestAnimationFrame(() => {
2152
- var r;
2153
- return (r = this.el) == null ? void 0 : r.focus();
2154
- })), this.dispatch("user-idle-change", {
2155
- detail: t,
2156
- trigger: i
2157
- }));
2158
- }
2159
- }
2160
- class Vn {
2161
- constructor() {
2162
- l(this, "$a", !1);
2163
- l(this, "rf", !1);
2164
- l(this, "pf", !1);
2165
- l(this, "Ze", new Bi());
2166
- }
2167
- }
2168
- class zn extends C {
2169
- constructor(t, i, n, r) {
2170
- super(t);
2171
- l(this, "Q");
2172
- l(this, "of");
2173
- l(this, "nb");
2174
- l(this, "nf");
2175
- l(this, "q");
2176
- l(this, "qf", !1);
2177
- this.u = i, this.mf = n, this.j = r, this.nf = r.$store, this.q = r.$provider, this.Q = new Ui(t), this.of = new Ai(t), this.nb = new ji(t);
2178
- }
2179
- onConnect() {
2180
- d(this.uf.bind(this)), d(this.vf.bind(this)), d(this.wf.bind(this));
2181
- const t = Object.getOwnPropertyNames(Object.getPrototypeOf(this)), i = this.xf.bind(this);
2182
- for (const n of t)
2183
- n.startsWith("media-") && this.listen(n, i);
2184
- this.listen("fullscreen-change", this.d.bind(this));
2185
- }
2186
- xf(t) {
2187
- var i;
2188
- t.stopPropagation(), u(this.q) && ((i = this[t.type]) == null || i.call(this, t));
2189
- }
2190
- async M() {
2191
- const { canPlay: t, paused: i, ended: n, autoplaying: r, seekableStart: a } = this.nf;
2192
- if (u(i))
2193
- try {
2194
- const o = u(this.q);
2195
- return qt(o, u(t)), u(n) && (o.currentTime = a() + 0.1), o.play();
2196
- } catch (o) {
2197
- const h = this.createEvent("play-fail", { detail: ht(o) });
2198
- throw h.autoplay = r(), this.u.N(h), o;
2199
- }
2200
- }
2201
- async L() {
2202
- const { canPlay: t, paused: i } = this.nf;
2203
- if (u(i))
2204
- return;
2205
- const n = u(this.q);
2206
- return qt(n, u(t)), n.pause();
2207
- }
2208
- V() {
2209
- const { canPlay: t, live: i, liveEdge: n, canSeek: r, liveSyncPosition: a, seekableEnd: o, userBehindLiveEdge: h } = this.nf;
2210
- if (h.set(!1), u(() => !i() || n() || !r()))
2211
- return;
2212
- const c = u(this.q);
2213
- qt(c, u(t)), c.currentTime = a() ?? o() - 2;
2214
- }
2215
- async R(t = "prefer-media") {
2216
- const i = u(this.q), n = t === "prefer-media" && this.of.supported || t === "media" ? this.of : i == null ? void 0 : i.fullscreen;
2217
- if (Ee(t, n), !n.active)
2218
- return u(this.nf.pictureInPicture) && (this.qf = !0, await this.U()), n.enter();
2219
- }
2220
- async S(t = "prefer-media") {
2221
- const i = u(this.q), n = t === "prefer-media" && this.of.supported || t === "media" ? this.of : i == null ? void 0 : i.fullscreen;
2222
- if (Ee(t, n), !!n.active) {
2223
- this.nb.locked && await this.nb.unlock();
2224
- try {
2225
- const r = await n.exit();
2226
- return this.qf && u(this.nf.canPictureInPicture) && await this.T(), r;
2227
- } finally {
2228
- this.qf = !1;
2229
- }
2230
- }
2231
- }
2232
- async T() {
2233
- if (this.sf(), !this.nf.pictureInPicture())
2234
- return await this.q().pictureInPicture.enter();
2235
- }
2236
- async U() {
2237
- if (this.sf(), !!this.nf.pictureInPicture())
2238
- return await this.q().pictureInPicture.exit();
2239
- }
2240
- sf() {
2241
- if (!this.nf.canPictureInPicture())
2242
- throw Error(
2243
- "[vidstack] no pip support"
2244
- );
2245
- }
2246
- uf() {
2247
- this.Q.idleDelay = this.$props.userIdleDelay();
2248
- }
2249
- vf() {
2250
- var r, a;
2251
- const { canLoad: t, canFullscreen: i } = this.nf, n = this.of.supported || ((a = (r = this.q()) == null ? void 0 : r.fullscreen) == null ? void 0 : a.supported) || !1;
2252
- t() && u(i) === n || i.set(n);
2253
- }
2254
- wf() {
2255
- var r, a;
2256
- const { canLoad: t, canPictureInPicture: i } = this.nf, n = ((a = (r = this.q()) == null ? void 0 : r.pictureInPicture) == null ? void 0 : a.supported) || !1;
2257
- t() && u(i) === n || i.set(n);
2258
- }
2259
- "media-audio-track-change-request"(t) {
2260
- if (this.j.audioTracks.readonly)
2261
- return;
2262
- const i = t.detail, n = this.j.audioTracks[i];
2263
- n && (this.mf.Ze.t("audioTrack", t), n.selected = !0);
2264
- }
2265
- async "media-enter-fullscreen-request"(t) {
2266
- try {
2267
- this.mf.Ze.t("fullscreen", t), await this.R(t.detail);
2268
- } catch (i) {
2269
- this.e(i);
2270
- }
2271
- }
2272
- async "media-exit-fullscreen-request"(t) {
2273
- try {
2274
- this.mf.Ze.t("fullscreen", t), await this.S(t.detail);
2275
- } catch (i) {
2276
- this.e(i);
2277
- }
2278
- }
2279
- async d(t) {
2280
- if (t.detail)
2281
- try {
2282
- const i = u(this.$props.fullscreenOrientation);
2283
- this.nb.supported && !x(i) && await this.nb.lock(i);
2284
- } catch {
2285
- }
2286
- }
2287
- e(t) {
2288
- this.u.N(
2289
- this.createEvent("fullscreen-error", {
2290
- detail: ht(t)
2291
- })
2292
- );
2293
- }
2294
- async "media-enter-pip-request"(t) {
2295
- try {
2296
- this.mf.Ze.t("pip", t), await this.T();
2297
- } catch (i) {
2298
- this.tf(i);
2299
- }
2300
- }
2301
- async "media-exit-pip-request"(t) {
2302
- try {
2303
- this.mf.Ze.t("pip", t), await this.U();
2304
- } catch (i) {
2305
- this.tf(i);
2306
- }
2307
- }
2308
- tf(t) {
2309
- this.u.N(
2310
- this.createEvent("picture-in-picture-error", {
2311
- detail: ht(t)
2312
- })
2313
- );
2314
- }
2315
- "media-live-edge-request"(t) {
2316
- const { live: i, liveEdge: n, canSeek: r } = this.nf;
2317
- if (!(!i() || n() || !r())) {
2318
- this.mf.Ze.t("seeked", t);
2319
- try {
2320
- this.V();
2321
- } catch {
2322
- }
2323
- }
2324
- }
2325
- "media-loop-request"() {
2326
- window.requestAnimationFrame(async () => {
2327
- try {
2328
- this.mf.rf = !0, this.mf.pf = !0, await this.M();
2329
- } catch {
2330
- this.mf.rf = !1, this.mf.pf = !1;
2331
- }
2332
- });
2333
- }
2334
- async "media-pause-request"(t) {
2335
- if (!this.nf.paused())
2336
- try {
2337
- this.mf.Ze.t("pause", t), await this.q().pause();
2338
- } catch {
2339
- this.mf.Ze.yf("pause");
2340
- }
2341
- }
2342
- async "media-play-request"(t) {
2343
- if (this.nf.paused())
2344
- try {
2345
- this.mf.Ze.t("play", t), await this.q().play();
2346
- } catch (i) {
2347
- const n = this.createEvent("play-fail", { detail: ht(i) });
2348
- this.u.N(n);
2349
- }
2350
- }
2351
- "media-rate-change-request"(t) {
2352
- this.nf.playbackRate() !== t.detail && (this.mf.Ze.t("rate", t), this.q().playbackRate = t.detail);
2353
- }
2354
- "media-quality-change-request"(t) {
2355
- if (this.j.qualities.readonly)
2356
- return;
2357
- this.mf.Ze.t("quality", t);
2358
- const i = t.detail;
2359
- if (i < 0)
2360
- this.j.qualities.autoSelect(t);
2361
- else {
2362
- const n = this.j.qualities[i];
2363
- n && (n.selected = !0);
2364
- }
2365
- }
2366
- "media-resume-user-idle-request"(t) {
2367
- this.mf.Ze.t("userIdle", t), this.Q.pauseIdleTracking(!1, t);
2368
- }
2369
- "media-pause-user-idle-request"(t) {
2370
- this.mf.Ze.t("userIdle", t), this.Q.pauseIdleTracking(!0, t);
2371
- }
2372
- "media-seek-request"(t) {
2373
- const { seekableStart: i, seekableEnd: n, ended: r, canSeek: a, live: o, userBehindLiveEdge: h } = this.nf;
2374
- r() && (this.mf.pf = !0), this.mf.$a = !1, this.mf.Ze.yf("seeking");
2375
- const c = Math.min(Math.max(i() + 0.1, t.detail), n() - 0.1);
2376
- !Number.isFinite(c) || !a() || (this.mf.Ze.t("seeked", t), this.q().currentTime = c, o() && t.isOriginTrusted && Math.abs(n() - c) >= 2 && h.set(!0));
2377
- }
2378
- "media-seeking-request"(t) {
2379
- this.mf.Ze.t("seeking", t), this.nf.seeking.set(!0), this.mf.$a = !0;
2380
- }
2381
- "media-start-loading"(t) {
2382
- this.nf.canLoad() || (this.mf.Ze.t("load", t), this.u.N(this.createEvent("can-load")));
2383
- }
2384
- "media-text-track-change-request"(t) {
2385
- const { index: i, mode: n } = t.detail, r = this.j.textTracks[i];
2386
- r && (this.mf.Ze.t("textTrack", t), r.setMode(n, t));
2387
- }
2388
- "media-mute-request"(t) {
2389
- this.nf.muted() || (this.mf.Ze.t("volume", t), this.q().muted = !0);
2390
- }
2391
- "media-unmute-request"(t) {
2392
- const { muted: i, volume: n } = this.nf;
2393
- i() && (this.mf.Ze.t("volume", t), this.j.$provider().muted = !1, n() === 0 && (this.mf.Ze.t("volume", t), this.q().volume = 0.25));
2394
- }
2395
- "media-volume-change-request"(t) {
2396
- const { muted: i, volume: n } = this.nf, r = t.detail;
2397
- n() !== r && (this.mf.Ze.t("volume", t), this.q().volume = r, r > 0 && i() && (this.mf.Ze.t("volume", t), this.q().muted = !1));
2398
- }
2399
- }
2400
- function qt(e, s) {
2401
- if (!(e && s))
2402
- throw Error(
2403
- "[vidstack] media not ready"
2404
- );
2405
- }
2406
- function Ee(e, s) {
2407
- if (!(s != null && s.supported))
2408
- throw Error(
2409
- "[vidstack] no fullscreen support"
2410
- );
2411
- }
2412
- var Zi = Ki;
2413
- function Ki(e, s, t) {
2414
- var i = null, n = null, r = function() {
2415
- i && (clearTimeout(i), n = null, i = null);
2416
- }, a = function() {
2417
- var h = n;
2418
- r(), h && h();
2419
- }, o = function() {
2420
- if (!s)
2421
- return e.apply(this, arguments);
2422
- var h = this, c = arguments, p = t && !i;
2423
- if (r(), n = function() {
2424
- e.apply(h, c);
2425
- }, i = setTimeout(function() {
2426
- if (i = null, !p) {
2427
- var q = n;
2428
- return n = null, q();
2429
- }
2430
- }, s), p)
2431
- return n();
2432
- };
2433
- return o.cancel = r, o.flush = a, o;
2434
- }
2435
- var Xi = Yi;
2436
- function Yi(e, s, t) {
2437
- var i = null, n = null, r = t && t.leading, a = t && t.trailing;
2438
- r == null && (r = !0), a == null && (a = !r), r == !0 && (a = !1);
2439
- var o = function() {
2440
- i && (clearTimeout(i), i = null);
2441
- }, h = function() {
2442
- var p = n;
2443
- o(), p && p();
2444
- }, c = function() {
2445
- var p = r && !i, q = this, xt = arguments;
2446
- if (n = function() {
2447
- return e.apply(q, xt);
2448
- }, i || (i = setTimeout(function() {
2449
- if (i = null, a)
2450
- return n();
2451
- }, s)), p)
2452
- return p = !1, n();
2453
- };
2454
- return c.cancel = o, c.flush = h, c;
2455
- }
2456
- const Gi = Symbol(0), tt = Symbol(0), j = Symbol(0), H = Symbol(0), et = Symbol(0), Vt = Symbol(0), v = Symbol(0), Qi = Symbol(0), Ji = /* @__PURE__ */ new Set([
2457
- "autoplay",
2458
- "autoplay-fail",
2459
- "can-load",
2460
- "sources-change",
2461
- "source-change",
2462
- "load-start",
2463
- "abort",
2464
- "error",
2465
- "loaded-metadata",
2466
- "loaded-data",
2467
- "can-play",
2468
- "play",
2469
- "play-fail",
2470
- "pause",
2471
- "playing",
2472
- "seeking",
2473
- "seeked",
2474
- "waiting"
2475
- ]);
2476
- class Wn extends C {
2477
- constructor(t, i, n) {
2478
- super(t);
2479
- l(this, "nf");
2480
- l(this, "zf", /* @__PURE__ */ new Map());
2481
- l(this, "Gf", !0);
2482
- l(this, "Df", !1);
2483
- l(this, "Bf");
2484
- l(this, "seeking", Xi(
2485
- (t) => {
2486
- const { seeking: i, currentTime: n, paused: r } = this.nf;
2487
- i.set(!0), n.set(t.detail), this.Af("seeking", t), r() && (this.Bf = t, this.Ff());
2488
- },
2489
- 150,
2490
- { leading: !0 }
2491
- ));
2492
- l(this, "Ff", Zi(() => {
2493
- if (!this.Bf)
2494
- return;
2495
- this.Df = !0;
2496
- const { waiting: t, playing: i } = this.nf;
2497
- t.set(!0), i.set(!1);
2498
- const n = this.createEvent("waiting", { trigger: this.Bf });
2499
- this.zf.set("waiting", n), this.el.dispatchEvent(n), this.Bf = void 0, this.Df = !1;
2500
- }, 300));
2501
- this.mf = i, this.j = n, this.nf = n.$store;
2502
- }
2503
- onAttach(t) {
2504
- t.setAttribute("aria-busy", "true");
2505
- }
2506
- onConnect(t) {
2507
- this.Mf(), this.Nf(), this.Of(), this.listen("fullscreen-change", this["fullscreen-change"].bind(this)), this.listen("fullscreen-error", this["fullscreen-error"].bind(this));
2508
- }
2509
- N(t) {
2510
- var n, r;
2511
- const i = t.type;
2512
- (n = this[t.type]) == null || n.call(this, t), Ji.has(i) && this.zf.set(i, t), (r = this.el) == null || r.dispatchEvent(t);
2513
- }
2514
- Cf() {
2515
- this.Hf(), this.mf.pf = !1, this.mf.rf = !1, this.Df = !1, this.Bf = void 0, this.zf.clear();
2516
- }
2517
- Af(t, i) {
2518
- this.mf.Ze.cf(t, (n) => {
2519
- i.request = n, m(i, n);
2520
- });
2521
- }
2522
- Mf() {
2523
- this.Ef(), this.If();
2524
- const t = this.j.textTracks;
2525
- f(t, "add", this.Ef.bind(this)), f(t, "remove", this.Ef.bind(this)), f(t, "mode-change", this.If.bind(this));
2526
- }
2527
- Nf() {
2528
- const t = this.j.qualities;
2529
- f(t, "add", this.Jf.bind(this)), f(t, "remove", this.Jf.bind(this)), f(t, "change", this.Pf.bind(this)), f(t, "auto-change", this.Qf.bind(this)), f(t, "readonly-change", this.Rf.bind(this));
2530
- }
2531
- Of() {
2532
- const t = this.j.audioTracks;
2533
- f(t, "add", this.Kf.bind(this)), f(t, "remove", this.Kf.bind(this)), f(t, "change", this.Sf.bind(this));
2534
- }
2535
- Ef(t) {
2536
- const { textTracks: i } = this.nf;
2537
- i.set(this.j.textTracks.toArray()), this.dispatch("text-tracks-change", {
2538
- detail: i(),
2539
- trigger: t
2540
- });
2541
- }
2542
- If(t) {
2543
- t && this.Af("textTrack", t);
2544
- const i = this.j.textTracks.selected, { textTrack: n } = this.nf;
2545
- n() !== i && (n.set(i), this.dispatch("text-track-change", {
2546
- detail: i,
2547
- trigger: t
2548
- }));
2549
- }
2550
- Kf(t) {
2551
- const { audioTracks: i } = this.nf;
2552
- i.set(this.j.audioTracks.toArray()), this.dispatch("audio-tracks-change", {
2553
- detail: i(),
2554
- trigger: t
2555
- });
2556
- }
2557
- Sf(t) {
2558
- const { audioTrack: i } = this.nf;
2559
- i.set(this.j.audioTracks.selected), this.Af("audioTrack", t), this.dispatch("audio-track-change", {
2560
- detail: i(),
2561
- trigger: t
2562
- });
2563
- }
2564
- Jf(t) {
2565
- const { qualities: i } = this.nf;
2566
- i.set(this.j.qualities.toArray()), this.dispatch("qualities-change", {
2567
- detail: i(),
2568
- trigger: t
2569
- });
2570
- }
2571
- Pf(t) {
2572
- const { quality: i } = this.nf;
2573
- i.set(this.j.qualities.selected), this.Af("quality", t), this.dispatch("quality-change", {
2574
- detail: i(),
2575
- trigger: t
2576
- });
2577
- }
2578
- Qf() {
2579
- this.nf.autoQuality.set(this.j.qualities.auto);
2580
- }
2581
- Rf() {
2582
- this.nf.canSetQuality.set(!this.j.qualities.readonly);
2583
- }
2584
- "provider-change"(t) {
2585
- this.j.$provider.set(t.detail);
2586
- }
2587
- autoplay(t) {
2588
- m(t, this.zf.get("play")), m(t, this.zf.get("can-play")), this.nf.autoplayError.set(void 0);
2589
- }
2590
- "autoplay-fail"(t) {
2591
- m(t, this.zf.get("play-fail")), m(t, this.zf.get("can-play")), this.nf.autoplayError.set(t.detail), this.Cf();
2592
- }
2593
- "can-load"(t) {
2594
- this.nf.canLoad.set(!0), this.zf.set("can-load", t), this.Af("load", t), this.j.textTracks[et]();
2595
- }
2596
- "media-type-change"(t) {
2597
- m(t, this.zf.get("source-change"));
2598
- const i = this.nf.viewType();
2599
- this.nf.mediaType.set(t.detail), i !== this.nf.viewType() && setTimeout(
2600
- () => this.dispatch("view-type-change", {
2601
- detail: this.nf.viewType(),
2602
- trigger: t
2603
- }),
2604
- 0
2605
- );
2606
- }
2607
- "stream-type-change"(t) {
2608
- const { streamType: i, inferredStreamType: n } = this.nf;
2609
- m(t, this.zf.get("source-change")), n.set(t.detail), t.detail = i();
2610
- }
2611
- "rate-change"(t) {
2612
- this.nf.playbackRate.set(t.detail), this.Af("rate", t);
2613
- }
2614
- "sources-change"(t) {
2615
- this.nf.sources.set(t.detail);
2616
- }
2617
- "source-change"(t) {
2618
- var i;
2619
- if (m(t, this.zf.get("sources-change")), this.nf.source.set(t.detail), (i = this.el) == null || i.setAttribute("aria-busy", "true"), this.Gf) {
2620
- this.Gf = !1;
2621
- return;
2622
- }
2623
- this.j.audioTracks[Ht](t), this.j.qualities[Ht](t), this.Cf(), Wi(this.j.$store), this.zf.set(t.type, t);
2624
- }
2625
- abort(t) {
2626
- m(t, this.zf.get("source-change")), m(t, this.zf.get("can-load"));
2627
- }
2628
- "load-start"(t) {
2629
- m(t, this.zf.get("source-change"));
2630
- }
2631
- error(t) {
2632
- this.nf.error.set(t.detail), m(t, this.zf.get("abort"));
2633
- }
2634
- "loaded-metadata"(t) {
2635
- m(t, this.zf.get("load-start"));
2636
- }
2637
- "loaded-data"(t) {
2638
- m(t, this.zf.get("load-start"));
2639
- }
2640
- "can-play"(t) {
2641
- var i, n;
2642
- ((i = t.trigger) == null ? void 0 : i.type) !== "loadedmetadata" && m(t, this.zf.get("loaded-metadata")), this.Lf(t.detail), (n = this.el) == null || n.setAttribute("aria-busy", "false");
2643
- }
2644
- "can-play-through"(t) {
2645
- this.Lf(t.detail), m(t, this.zf.get("can-play"));
2646
- }
2647
- Lf(t) {
2648
- const { seekable: i, seekableEnd: n, buffered: r, duration: a, canPlay: o } = this.nf;
2649
- i.set(t.seekable), r.set(t.buffered), a.set(n), o.set(!0);
2650
- }
2651
- "duration-change"(t) {
2652
- const { live: i, duration: n } = this.nf, r = t.detail;
2653
- i() || n.set(Number.isNaN(r) ? 0 : r);
2654
- }
2655
- progress(t) {
2656
- const { buffered: i, seekable: n, live: r, duration: a, seekableEnd: o } = this.nf, h = t.detail;
2657
- i.set(h.buffered), n.set(h.seekable), r() && (a.set(o), this.dispatch("duration-change", {
2658
- detail: o(),
2659
- trigger: t
2660
- }));
2661
- }
2662
- play(t) {
2663
- const { paused: i, autoplayError: n, ended: r, autoplaying: a } = this.nf;
2664
- if (t.autoplay = a(), this.mf.rf || !i()) {
2665
- t.stopImmediatePropagation();
2666
- return;
2667
- }
2668
- m(t, this.zf.get("waiting")), this.Af("play", t), i.set(!1), n.set(void 0), (r() || this.mf.pf) && (this.mf.pf = !1, r.set(!1), this.N(this.createEvent("replay", { trigger: t })));
2669
- }
2670
- "play-fail"(t) {
2671
- m(t, this.zf.get("play")), this.Af("play", t);
2672
- const { paused: i, playing: n } = this.nf;
2673
- i.set(!0), n.set(!1), this.Cf();
2674
- }
2675
- playing(t) {
2676
- const i = this.zf.get("play");
2677
- i ? (m(t, this.zf.get("waiting")), m(t, i)) : m(t, this.zf.get("seeked")), setTimeout(() => this.Cf(), 0);
2678
- const { paused: n, playing: r, seeking: a, ended: o } = this.nf;
2679
- if (n.set(!1), r.set(!0), a.set(!1), o.set(!1), this.mf.rf) {
2680
- t.stopImmediatePropagation(), this.mf.rf = !1;
2681
- return;
2682
- }
2683
- this.started(t);
2684
- }
2685
- started(t) {
2686
- const { started: i, live: n, liveSyncPosition: r, seekableEnd: a } = this.nf;
2687
- if (!i()) {
2688
- if (n()) {
2689
- const o = r() ?? a() - 2;
2690
- Number.isFinite(o) && (this.j.$provider().currentTime = o);
2691
- }
2692
- i.set(!0), this.N(this.createEvent("started", { trigger: t }));
2693
- }
2694
- }
2695
- pause(t) {
2696
- if (this.mf.rf) {
2697
- t.stopImmediatePropagation();
2698
- return;
2699
- }
2700
- m(t, this.zf.get("seeked")), this.Af("pause", t);
2701
- const { paused: i, playing: n, seeking: r } = this.nf;
2702
- i.set(!0), n.set(!1), r.set(!1), this.Cf();
2703
- }
2704
- "time-update"(t) {
2705
- const { currentTime: i, played: n, waiting: r } = this.nf, a = t.detail;
2706
- i.set(a.currentTime), n.set(a.played), r.set(!1);
2707
- for (const o of this.j.textTracks)
2708
- o[H](a.currentTime, t);
2709
- }
2710
- "volume-change"(t) {
2711
- const { volume: i, muted: n } = this.nf, r = t.detail;
2712
- i.set(r.volume), n.set(r.muted || r.volume === 0), this.Af("volume", t);
2713
- }
2714
- seeked(t) {
2715
- var h;
2716
- const { seeking: i, currentTime: n, paused: r, duration: a, ended: o } = this.nf;
2717
- if (this.mf.$a)
2718
- i.set(!0), t.stopImmediatePropagation();
2719
- else if (i()) {
2720
- const c = this.zf.get("waiting");
2721
- m(t, c), ((h = c == null ? void 0 : c.trigger) == null ? void 0 : h.type) !== "seeking" && m(t, this.zf.get("seeking")), r() && this.Hf(), i.set(!1), t.detail !== a() && o.set(!1), n.set(t.detail), this.Af("seeked", t);
2722
- const p = t.originEvent;
2723
- p && p.isTrusted && !/seek/.test(p.type) && this.started(t);
2724
- }
2725
- }
2726
- waiting(t) {
2727
- this.Df || this.mf.$a || (t.stopImmediatePropagation(), this.Bf = t, this.Ff());
2728
- }
2729
- ended(t) {
2730
- if (this.mf.rf) {
2731
- t.stopImmediatePropagation();
2732
- return;
2733
- }
2734
- const { paused: i, playing: n, seeking: r, ended: a } = this.nf;
2735
- i.set(!0), n.set(!1), r.set(!1), a.set(!0), this.Cf();
2736
- }
2737
- Hf() {
2738
- this.Ff.cancel(), this.nf.waiting.set(!1);
2739
- }
2740
- "fullscreen-change"(t) {
2741
- this.nf.fullscreen.set(t.detail), this.Af("fullscreen", t);
2742
- }
2743
- "fullscreen-error"(t) {
2744
- this.Af("fullscreen", t);
2745
- }
2746
- "picture-in-picture-change"(t) {
2747
- this.nf.pictureInPicture.set(t.detail), this.Af("pip", t);
2748
- }
2749
- "picture-in-picture-error"(t) {
2750
- this.Af("pip", t);
2751
- }
2752
- }
2753
- class Bn extends C {
2754
- onAttach(s) {
2755
- d(this.Tf.bind(this)), d(this.Uf.bind(this)), d(this.Vf.bind(this)), d(this.Wf.bind(this)), d(this.Xf.bind(this)), d(this.Yf.bind(this)), d(this.Zf.bind(this)), d(this._f.bind(this)), d(this.$f.bind(this)), d(this.ag.bind(this));
2756
- }
2757
- bg() {
2758
- }
2759
- Tf() {
2760
- const s = this.$props.autoplay();
2761
- this.$store.autoplay.set(s), this.dispatch("autoplay-change", { detail: s });
2762
- }
2763
- Vf() {
2764
- const s = this.$props.loop();
2765
- this.$store.loop.set(s), this.dispatch("loop-change", { detail: s });
2766
- }
2767
- Wf() {
2768
- const s = this.$props.controls();
2769
- this.$store.controls.set(s), this.dispatch("controls-change", { detail: s });
2770
- }
2771
- Uf() {
2772
- const s = this.$props.poster();
2773
- this.$store.poster.set(s), this.dispatch("poster-change", { detail: s });
2774
- }
2775
- Xf() {
2776
- this.$store.crossorigin.set(this.$props.crossorigin());
2777
- }
2778
- Yf() {
2779
- const s = this.$props.playsinline();
2780
- this.$store.playsinline.set(s), this.dispatch("playsinline-change", { detail: s });
2781
- }
2782
- _f() {
2783
- this.dispatch("live-change", { detail: this.$store.live() });
2784
- }
2785
- Zf() {
2786
- this.$store.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()), this.$store.minLiveDVRWindow.set(this.$props.minLiveDVRWindow());
2787
- }
2788
- $f() {
2789
- this.dispatch("live-edge-change", { detail: this.$store.liveEdge() });
2790
- }
2791
- ag() {
2792
- this.$store.thumbnails.set(this.$props.thumbnails());
2793
- }
2794
- }
2795
- function fs(e, s = "preconnect") {
2796
- const t = document.querySelector(`link[href="${e}"]`);
2797
- if (!St(t))
2798
- return !0;
2799
- const i = document.createElement("link");
2800
- return i.rel = s, i.href = e, i.crossOrigin = "true", document.head.append(i), !0;
2801
- }
2802
- const ut = {};
2803
- function Un(e) {
2804
- if (ut[e])
2805
- return ut[e].promise;
2806
- const s = es(), t = document.querySelector(`script[src="${e}"]`);
2807
- if (!St(t))
2808
- return s.resolve(), s.promise;
2809
- const i = document.createElement("script");
2810
- return i.src = e, i.onload = () => {
2811
- s.resolve(), delete ut[e];
2812
- }, i.onerror = () => {
2813
- s.reject(), delete ut[e];
2814
- }, setTimeout(() => document.head.append(i), 0), s.promise;
2815
- }
2816
- function re(e) {
2817
- return e === "use-credentials" ? "include" : O(e) ? "same-origin" : void 0;
2818
- }
2819
- function Zn(e, s) {
2820
- for (let t = 0, i = s.length; t < i; t++)
2821
- if (zt(s[t], e))
2822
- return s[t];
2823
- return null;
2824
- }
2825
- function zt(e, s) {
2826
- return s >= e.startTime && s < e.endTime;
2827
- }
2828
- function Kn(e, s, t) {
2829
- const i = e.toArray().find((n) => n.kind === "chapters" && n.mode === "showing");
2830
- if (i !== s) {
2831
- if (!i) {
2832
- t(null);
2833
- return;
2834
- }
2835
- i.readyState == 2 ? t(i) : (t(null), i.addEventListener("load", () => t(i), { once: !0 }));
2836
- }
2837
- }
2838
- var Te, $e, Se, ve;
2839
- class Wt extends Qt {
2840
- constructor(t) {
2841
- super();
2842
- l(this, "src");
2843
- l(this, "content");
2844
- l(this, "type");
2845
- l(this, "encoding");
2846
- l(this, "id", "");
2847
- l(this, "label", "");
2848
- l(this, "language", "");
2849
- l(this, "kind");
2850
- l(this, "default", !1);
2851
- l(this, "Ia", !1);
2852
- l(this, "Ea", 0);
2853
- l(this, "Ga", "disabled");
2854
- l(this, "Ja", {});
2855
- l(this, "Ha", []);
2856
- l(this, "Da", []);
2857
- l(this, "Fa", []);
2858
- /* @internal */
2859
- l(this, ve, 0);
2860
- /* @internal */
2861
- l(this, Se);
2862
- /* @internal */
2863
- l(this, $e, null);
2864
- /* @internal */
2865
- l(this, Te, null);
2866
- for (const i of Object.keys(t))
2867
- this[i] = t[i];
2868
- this.type || (this.type = "vtt"), t.content ? import("./prod-DBMM0zDd.js").then((i) => i.d).then(({ parseText: i, VTTCue: n, VTTRegion: r }) => {
2869
- t.type === "json" ? this.Ka(t.content, n, r) : i(t.content, { type: t.type }).then(({ cues: a, regions: o }) => {
2870
- this.Da = a, this.Ha = o, this.La();
2871
- });
2872
- }) : t.src || (this[j] = 2);
2873
- }
2874
- static createId(t) {
2875
- return `id::${t.type}-${t.kind}-${t.src ?? t.label}`;
2876
- }
2877
- get metadata() {
2878
- return this.Ja;
2879
- }
2880
- get regions() {
2881
- return this.Ha;
2882
- }
2883
- get cues() {
2884
- return this.Da;
2885
- }
2886
- get activeCues() {
2887
- return this.Fa;
2888
- }
2889
- /**
2890
- * - 0: Not Loading
2891
- * - 1: Loading
2892
- * - 2: Ready
2893
- * - 3: Error
2894
- */
2895
- get readyState() {
2896
- return this[j];
2897
- }
2898
- get mode() {
2899
- return this.Ga;
2900
- }
2901
- set mode(t) {
2902
- this.setMode(t);
2903
- }
2904
- addCue(t, i) {
2905
- var a;
2906
- let n = 0, r = this.Da.length;
2907
- for (n = 0; n < r && !(t.endTime <= this.Da[n].startTime); n++)
2908
- ;
2909
- n === r ? this.Da.push(t) : this.Da.splice(n, 0, t), (i == null ? void 0 : i.type) !== "cuechange" && ((a = this[v]) == null || a.track.addCue(t)), this.dispatchEvent(new y("add-cue", { detail: t, trigger: i })), zt(t, this.Ea) && this[H](this.Ea, i);
2910
- }
2911
- removeCue(t, i) {
2912
- var r;
2913
- const n = this.Da.indexOf(t);
2914
- if (n >= 0) {
2915
- const a = this.Fa.includes(t);
2916
- this.Da.splice(n, 1), (r = this[v]) == null || r.track.removeCue(t), this.dispatchEvent(new y("remove-cue", { detail: t, trigger: i })), a && this[H](this.Ea, i);
2917
- }
2918
- }
2919
- setMode(t, i) {
2920
- var n;
2921
- this.Ga !== t && (this.Ga = t, t === "disabled" ? (this.Fa = [], this.Ma()) : this.readyState === 2 ? this[H](this.Ea, i) : this.Na(), this.dispatchEvent(new y("mode-change", { detail: this, trigger: i })), (n = this[Vt]) == null || n.call(this));
2922
- }
2923
- /* @internal */
2924
- [(ve = j, Se = tt, $e = Vt, Te = v, H)](t, i) {
2925
- if (this.Ea = t, this.mode === "disabled" || !this.Da.length)
2926
- return;
2927
- const n = [];
2928
- for (let a = 0, o = this.Da.length; a < o; a++) {
2929
- const h = this.Da[a];
2930
- zt(h, t) && n.push(h);
2931
- }
2932
- let r = n.length !== this.Fa.length;
2933
- if (!r) {
2934
- for (let a = 0; a < n.length; a++)
2935
- if (!this.Fa.includes(n[a])) {
2936
- r = !0;
2937
- break;
2938
- }
2939
- }
2940
- this.Fa = n, r && this.Ma(i);
2941
- }
2942
- /* @internal */
2943
- [et]() {
2944
- this.Ia = !0, this.Ga !== "disabled" && this.Na();
2945
- }
2946
- async Na() {
2947
- var t, i;
2948
- if (!(!this.Ia || !this.src || this[j] > 0)) {
2949
- this[j] = 1, this.dispatchEvent(new y("load-start"));
2950
- try {
2951
- const { parseResponse: n, VTTCue: r, VTTRegion: a } = await import("./prod-DBMM0zDd.js").then((c) => c.d), o = (t = this[tt]) == null ? void 0 : t.call(this), h = fetch(this.src, {
2952
- headers: this.type === "json" ? { "Content-Type": "application/json" } : void 0,
2953
- credentials: re(o)
2954
- });
2955
- if (this.type === "json")
2956
- this.Ka(await (await h).text(), r, a);
2957
- else {
2958
- const { errors: c, metadata: p, regions: q, cues: xt } = await n(h, {
2959
- type: this.type,
2960
- encoding: this.encoding
2961
- });
2962
- if (((i = c[0]) == null ? void 0 : i.code) === 0)
2963
- throw c[0];
2964
- this.Ja = p, this.Ha = q, this.Da = xt;
2965
- }
2966
- this.La();
2967
- } catch (n) {
2968
- this.Oa(n);
2969
- }
2970
- }
2971
- }
2972
- La() {
2973
- var i;
2974
- if (this[j] = 2, !this.src || this.type !== "vtt") {
2975
- const n = (i = this[v]) == null ? void 0 : i.track;
2976
- if (n)
2977
- for (const r of this.Da)
2978
- n.addCue(r);
2979
- }
2980
- const t = new y("load");
2981
- this[H](this.Ea, t), this.dispatchEvent(t);
2982
- }
2983
- Oa(t) {
2984
- this[j] = 3, this.dispatchEvent(new y("error", { detail: t }));
2985
- }
2986
- Ka(t, i, n) {
2987
- try {
2988
- t = JSON.parse(t), t.regions && (this.Ha = t.regions.map((r) => Object.assign(new n(), r))), t.cues && (this.Da = t.cues.filter((r) => mt(r.startTime) && mt(r.endTime)).map((r) => Object.assign(new i(0, 0, ""), r)));
2989
- } catch (r) {
2990
- this.Oa(r);
2991
- }
2992
- }
2993
- Ma(t) {
2994
- this.dispatchEvent(new y("cue-change", { trigger: t }));
2995
- }
2996
- }
2997
- const tn = /captions|subtitles/;
2998
- function M(e) {
2999
- return tn.test(e.kind);
3000
- }
3001
- class Xn {
3002
- constructor(s) {
3003
- l(this, "Z", null);
3004
- l(this, "Y", null);
3005
- l(this, "_", -1);
3006
- this.$ = s;
3007
- }
3008
- /**
3009
- * Set the target from which to dispatch media requests events from. The events should bubble
3010
- * up from this target to the `<media-player>` element.
3011
- *
3012
- * @example
3013
- * ```ts
3014
- * const button = document.querySelector('button');
3015
- * remote.setTarget(button);
3016
- * ```
3017
- */
3018
- setTarget(s) {
3019
- this.Z = s;
3020
- }
3021
- /**
3022
- * Returns the current `<media-player>` element. This method will attempt to find the player by
3023
- * searching up from either the given `target` or default target set via `remote.setTarget`.
3024
- *
3025
- * @example
3026
- * ```ts
3027
- * const player = remote.getPlayer();
3028
- * ```
3029
- */
3030
- getPlayer(s) {
3031
- var t;
3032
- return this.Y ? this.Y : ((t = s ?? this.Z) == null || t.dispatchEvent(
3033
- new y("find-media-player", {
3034
- detail: (i) => void (this.Y = i),
3035
- bubbles: !0,
3036
- composed: !0
3037
- })
3038
- ), this.Y);
3039
- }
3040
- /**
3041
- * Set the current `<media-player>` element so the remote can support toggle methods such as
3042
- * `togglePaused` as they rely on the current media state.
3043
- */
3044
- setPlayer(s) {
3045
- this.Y = s;
3046
- }
3047
- /**
3048
- * Dispatch a request to start the media loading process. This will only work if the media
3049
- * player has been initialized with a custom loading strategy `<media-player load="custom">`.
3050
- *
3051
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/loading#loading-strategies}
3052
- */
3053
- startLoading(s) {
3054
- this.X("media-start-loading", s);
3055
- }
3056
- /**
3057
- * Dispatch a request to begin/resume media playback.
3058
- */
3059
- play(s) {
3060
- this.X("media-play-request", s);
3061
- }
3062
- /**
3063
- * Dispatch a request to pause media playback.
3064
- */
3065
- pause(s) {
3066
- this.X("media-pause-request", s);
3067
- }
3068
- /**
3069
- * Dispatch a request to set the media volume to mute (0).
3070
- */
3071
- mute(s) {
3072
- this.X("media-mute-request", s);
3073
- }
3074
- /**
3075
- * Dispatch a request to unmute the media volume and set it back to it's previous state.
3076
- */
3077
- unmute(s) {
3078
- this.X("media-unmute-request", s);
3079
- }
3080
- /**
3081
- * Dispatch a request to enter fullscreen.
3082
- *
3083
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/fullscreen#media-remote}
3084
- */
3085
- enterFullscreen(s, t) {
3086
- this.X("media-enter-fullscreen-request", t, s);
3087
- }
3088
- /**
3089
- * Dispatch a request to exit fullscreen.
3090
- *
3091
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/fullscreen#media-remote}
3092
- */
3093
- exitFullscreen(s, t) {
3094
- this.X("media-exit-fullscreen-request", t, s);
3095
- }
3096
- /**
3097
- * Dispatch a request to enter picture-in-picture mode.
3098
- *
3099
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/picture-in-picture#media-remote}
3100
- */
3101
- enterPictureInPicture(s) {
3102
- this.X("media-enter-pip-request", s);
3103
- }
3104
- /**
3105
- * Dispatch a request to exit picture-in-picture mode.
3106
- *
3107
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/picture-in-picture#media-remote}
3108
- */
3109
- exitPictureInPicture(s) {
3110
- this.X("media-exit-pip-request", s);
3111
- }
3112
- /**
3113
- * Notify the media player that a seeking process is happening and to seek to the given `time`.
3114
- */
3115
- seeking(s, t) {
3116
- this.X("media-seeking-request", t, s);
3117
- }
3118
- /**
3119
- * Notify the media player that a seeking operation has completed and to seek to the given `time`.
3120
- * This is generally called after a series of `remote.seeking()` calls.
3121
- */
3122
- seek(s, t) {
3123
- this.X("media-seek-request", t, s);
3124
- }
3125
- seekToLiveEdge(s) {
3126
- this.X("media-live-edge-request", s);
3127
- }
3128
- /**
3129
- * Dispatch a request to update the media volume to the given `volume` level which is a value
3130
- * between 0 and 1.
3131
- *
3132
- * @example
3133
- * ```ts
3134
- * remote.changeVolume(0); // 0%
3135
- * remote.changeVolume(0.05); // 5%
3136
- * remote.changeVolume(0.5); // 50%
3137
- * remote.changeVolume(0.75); // 70%
3138
- * remote.changeVolume(1); // 100%
3139
- * ```
3140
- */
3141
- changeVolume(s, t) {
3142
- this.X("media-volume-change-request", t, Math.max(0, Math.min(1, s)));
3143
- }
3144
- /**
3145
- * Dispatch a request to change the current audio track.
3146
- *
3147
- * @example
3148
- * ```ts
3149
- * remote.changeAudioTrack(1); // track at index 1
3150
- * ```
3151
- */
3152
- changeAudioTrack(s, t) {
3153
- this.X("media-audio-track-change-request", t, s);
3154
- }
3155
- /**
3156
- * Dispatch a request to change the video quality. The special value `-1` represents auto quality
3157
- * selection.
3158
- *
3159
- * @example
3160
- * ```ts
3161
- * remote.changeQuality(-1); // auto
3162
- * remote.changeQuality(1); // quality at index 1
3163
- * ```
3164
- */
3165
- changeQuality(s, t) {
3166
- this.X("media-quality-change-request", t, s);
3167
- }
3168
- /**
3169
- * Dispatch a request to change the mode of the text track at the given index.
3170
- *
3171
- * @example
3172
- * ```ts
3173
- * remote.changeTextTrackMode(1, 'showing'); // track at index 1
3174
- * ```
3175
- */
3176
- changeTextTrackMode(s, t, i) {
3177
- this.X("media-text-track-change-request", i, {
3178
- index: s,
3179
- mode: t
3180
- });
3181
- }
3182
- /**
3183
- * Dispatch a request to change the media playback rate.
3184
- *
3185
- * @example
3186
- * ```ts
3187
- * remote.changePlaybackRate(0.5); // Half the normal speed
3188
- * remote.changePlaybackRate(1); // Normal speed
3189
- * remote.changePlaybackRate(1.5); // 50% faster than normal
3190
- * remote.changePlaybackRate(2); // Double the normal speed
3191
- * ```
3192
- */
3193
- changePlaybackRate(s, t) {
3194
- this.X("media-rate-change-request", t, s);
3195
- }
3196
- /**
3197
- * Dispatch a request to resume user idle tracking. Refer to {@link MediaRemoteControl.pauseUserIdle}
3198
- * for more information.
3199
- */
3200
- resumeUserIdle(s) {
3201
- this.X("media-resume-user-idle-request", s);
3202
- }
3203
- /**
3204
- * Dispatch a request to pause user idle tracking. Pausing tracking will result in the `user-idle`
3205
- * attribute and state being `false` until `remote.resumeUserIdle()` is called. This method
3206
- * is generally used when building custom controls and you'd like to prevent the UI from
3207
- * dissapearing.
3208
- *
3209
- * @example
3210
- * ```ts
3211
- * // Prevent user idling while menu is being interacted with.
3212
- * function onSettingsOpen() {
3213
- * remote.pauseUserIdle();
3214
- * }
3215
- *
3216
- * function onSettingsClose() {
3217
- * remote.resumeUserIdle();
3218
- * }
3219
- * ```
3220
- */
3221
- pauseUserIdle(s) {
3222
- this.X("media-pause-user-idle-request", s);
3223
- }
3224
- /**
3225
- * Dispatch a request to toggle the media playback state.
3226
- */
3227
- togglePaused(s) {
3228
- const t = this.getPlayer(s == null ? void 0 : s.target);
3229
- t && (t.state.paused ? this.play(s) : this.pause(s));
3230
- }
3231
- /**
3232
- * Dispatch a request to toggle the user idle state.
3233
- */
3234
- toggleUserIdle(s) {
3235
- const t = this.getPlayer(s == null ? void 0 : s.target);
3236
- t && t.user.idle(!t.user.idling, 0, s);
3237
- }
3238
- /**
3239
- * Dispatch a request to toggle the media muted state.
3240
- */
3241
- toggleMuted(s) {
3242
- const t = this.getPlayer(s == null ? void 0 : s.target);
3243
- t && (t.state.muted ? this.unmute(s) : this.mute(s));
3244
- }
3245
- /**
3246
- * Dispatch a request to toggle the media fullscreen state.
3247
- *
3248
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/fullscreen#media-remote}
3249
- */
3250
- toggleFullscreen(s, t) {
3251
- const i = this.getPlayer(t == null ? void 0 : t.target);
3252
- i && (i.state.fullscreen ? this.exitFullscreen(s, t) : this.enterFullscreen(s, t));
3253
- }
3254
- /**
3255
- * Dispatch a request to toggle the media picture-in-picture mode.
3256
- *
3257
- * @docs {@link https://www.vidstack.io/docs/player/core-concepts/picture-in-picture#media-remote}
3258
- */
3259
- togglePictureInPicture(s) {
3260
- const t = this.getPlayer(s == null ? void 0 : s.target);
3261
- t && (t.state.pictureInPicture ? this.exitPictureInPicture(s) : this.enterPictureInPicture(s));
3262
- }
3263
- /**
3264
- * Dispatch a request to toggle the current captions mode.
3265
- */
3266
- toggleCaptions(s) {
3267
- const t = this.getPlayer(s == null ? void 0 : s.target);
3268
- if (!t)
3269
- return;
3270
- const i = t.state.textTracks, n = t.state.textTrack;
3271
- if (n) {
3272
- const r = i.indexOf(n);
3273
- this.changeTextTrackMode(r, "disabled", s), this._ = r;
3274
- } else {
3275
- let r = this._;
3276
- (!i[r] || !M(i[r])) && (r = -1), r === -1 && (r = i.findIndex((a) => M(a) && a.default)), r === -1 && (r = i.findIndex((a) => M(a))), r >= 0 && this.changeTextTrackMode(r, "showing", s), this._ = -1;
3277
- }
3278
- }
3279
- X(s, t, i) {
3280
- const n = new y(s, {
3281
- bubbles: !0,
3282
- composed: !0,
3283
- detail: i,
3284
- trigger: t
3285
- }), a = (t == null ? void 0 : t.target) && (t.target === document || t.target === window || t.target === document.body || this.Y && !this.Y.contains(t.target)) ? this.Z ?? this.getPlayer() : (t == null ? void 0 : t.target) ?? this.Z;
3286
- a == null || a.dispatchEvent(n);
3287
- }
3288
- aa(s) {
3289
- }
3290
- }
3291
- class Yn extends C {
3292
- constructor() {
3293
- super(...arguments);
3294
- l(this, "j");
3295
- }
3296
- onConnect() {
3297
- this.j = ne(), d(this.cg.bind(this));
3298
- }
3299
- cg() {
3300
- const { canLoad: t, thumbnailCues: i } = this.j.$store;
3301
- if (!t())
3302
- return;
3303
- const n = new AbortController(), { crossorigin: r, thumbnails: a } = this.j.$store, o = a();
3304
- if (o)
3305
- return import("./prod-DBMM0zDd.js").then((h) => h.d).then(({ parseResponse: h }) => {
3306
- h(
3307
- fetch(o, {
3308
- signal: n.signal,
3309
- credentials: re(r())
3310
- })
3311
- ).then(({ cues: c }) => i.set(c)).catch($t);
3312
- }), () => {
3313
- n.abort(), i.set([]);
3314
- };
3315
- }
3316
- }
3317
- class Gn extends us {
3318
- getById(s) {
3319
- return s === "" ? null : this.a.find((t) => t.id === s) ?? null;
3320
- }
3321
- }
3322
- class en {
3323
- constructor() {
3324
- l(this, "priority", 0);
3325
- l(this, "eg", !0);
3326
- l(this, "qa", null);
3327
- l(this, "ya", null);
3328
- l(this, "dg", /* @__PURE__ */ new Set());
3329
- }
3330
- canRender() {
3331
- return !0;
3332
- }
3333
- attach(s) {
3334
- this.qa = s, s.textTracks.onchange = this.Hc.bind(this);
3335
- }
3336
- addTrack(s) {
3337
- this.dg.add(s), this.gg(s);
3338
- }
3339
- removeTrack(s) {
3340
- var t, i;
3341
- (i = (t = s[v]) == null ? void 0 : t.remove) == null || i.call(t), s[v] = null, this.dg.delete(s);
3342
- }
3343
- changeTrack(s) {
3344
- const t = s == null ? void 0 : s[v];
3345
- t && t.track.mode !== "showing" && (t.track.mode = "showing"), this.ya = s;
3346
- }
3347
- setDisplay(s) {
3348
- this.eg = s, this.Hc();
3349
- }
3350
- detach() {
3351
- this.qa && (this.qa.textTracks.onchange = null);
3352
- for (const s of this.dg)
3353
- this.removeTrack(s);
3354
- this.dg.clear(), this.qa = null, this.ya = null;
3355
- }
3356
- gg(s) {
3357
- if (!this.qa)
3358
- return;
3359
- const t = s[v] ?? (s[v] = this.hg(s));
3360
- t instanceof HTMLElement && (this.qa.append(t), t.track.mode = t.default ? "showing" : "hidden");
3361
- }
3362
- hg(s) {
3363
- const t = document.createElement("track"), i = s.default || s.mode === "showing", n = s.src && s.type === "vtt";
3364
- return t.id = s.id, t.src = n ? s.src : "https://cdn.jsdelivr.net/npm/vidstack@0.6.12/empty.vtt", t.label = s.label, t.kind = s.kind, t.default = i, s.language && (t.srclang = s.language), i && !n && this.fg(s, t.track), t;
3365
- }
3366
- fg(s, t) {
3367
- var i;
3368
- if (!(s.src && s.type === "vtt" || (i = t.cues) != null && i.length))
3369
- for (const n of s.cues)
3370
- t.addCue(n);
3371
- }
3372
- Hc(s) {
3373
- var t;
3374
- for (const i of this.dg) {
3375
- const n = (t = i[v]) == null ? void 0 : t.track;
3376
- if (!n)
3377
- continue;
3378
- if (!this.eg) {
3379
- n.mode = "disabled";
3380
- continue;
3381
- }
3382
- const r = n.mode === "showing";
3383
- r && this.fg(i, n), i.setMode(r ? "showing" : "disabled", s);
3384
- }
3385
- }
3386
- }
3387
- class Qn {
3388
- constructor(s) {
3389
- l(this, "qa", null);
3390
- l(this, "pa");
3391
- l(this, "oa", []);
3392
- l(this, "sa", !1);
3393
- l(this, "la", null);
3394
- l(this, "ma", null);
3395
- this.j = s;
3396
- const t = s.textTracks;
3397
- this.pa = t, d(this.ua.bind(this)), L(this.ra.bind(this)), f(t, "add", this.va.bind(this)), f(t, "remove", this.wa.bind(this)), f(t, "mode-change", this.na.bind(this));
3398
- }
3399
- ua() {
3400
- const { $store: s, $iosControls: t } = this.j;
3401
- this.sa = s.controls() || t(), this.na();
3402
- }
3403
- add(s) {
3404
- this.oa.push(s), this.na();
3405
- }
3406
- remove(s) {
3407
- s.detach(), this.oa.splice(this.oa.indexOf(s), 1), this.na();
3408
- }
3409
- /* @internal */
3410
- [Gi](s) {
3411
- requestAnimationFrame(() => {
3412
- if (this.qa = s, s) {
3413
- this.la = new en(), this.la.attach(s);
3414
- for (const t of this.pa)
3415
- this.ta(t);
3416
- }
3417
- this.na();
3418
- });
3419
- }
3420
- ta(s) {
3421
- var t;
3422
- M(s) && ((t = this.la) == null || t.addTrack(s));
3423
- }
3424
- xa(s) {
3425
- var t;
3426
- M(s) && ((t = this.la) == null || t.removeTrack(s));
3427
- }
3428
- va(s) {
3429
- this.ta(s.detail);
3430
- }
3431
- wa(s) {
3432
- this.xa(s.detail);
3433
- }
3434
- na() {
3435
- var i, n, r;
3436
- if (!this.qa) {
3437
- this.ra();
3438
- return;
3439
- }
3440
- const s = this.pa.selected;
3441
- if (this.sa || s != null && s[Qi]) {
3442
- (i = this.ma) == null || i.changeTrack(null), this.la.setDisplay(!0), this.la.changeTrack(s);
3443
- return;
3444
- }
3445
- if (this.la.setDisplay(!1), this.la.changeTrack(null), !s) {
3446
- (n = this.ma) == null || n.changeTrack(null);
3447
- return;
3448
- }
3449
- const t = this.oa.sort((a, o) => a.priority - o.priority).find((a) => a.canRender(s));
3450
- this.ma !== t && ((r = this.ma) == null || r.detach(), t == null || t.attach(this.qa), this.ma = t ?? null), t == null || t.changeTrack(s);
3451
- }
3452
- ra() {
3453
- var s, t;
3454
- (s = this.la) == null || s.detach(), this.la = null, (t = this.ma) == null || t.detach(), this.ma = null;
3455
- }
3456
- }
3457
- var Ae;
3458
- class Jn extends hs {
3459
- constructor() {
3460
- super(...arguments);
3461
- l(this, "Ia", !1);
3462
- l(this, "Pa", {});
3463
- /** @internal */
3464
- l(this, Ae);
3465
- l(this, "Qa", this.Ra.bind(this));
3466
- }
3467
- get selected() {
3468
- return this.a.find((i) => i.mode === "showing" && M(i)) ?? null;
3469
- }
3470
- add(t, i) {
3471
- const n = t instanceof Wt, r = n ? t : new Wt(t);
3472
- return this.Pa[t.kind] && t.default && delete t.default, r.addEventListener("mode-change", this.Qa), this[gt](r, i), r[tt] = this[tt], this.Ia && r[et](), t.default && (this.Pa[t.kind] = r, r.mode = "showing"), this;
3473
- }
3474
- remove(t, i) {
3475
- if (this.a.includes(t))
3476
- return t === this.Pa[t.kind] && delete this.Pa[t.kind], t.mode = "disabled", t[Vt] = null, t.removeEventListener("mode-change", this.Qa), this[Ft](t, i), this;
3477
- }
3478
- clear(t) {
3479
- for (const i of this.a)
3480
- this.remove(i, t);
3481
- return this;
3482
- }
3483
- getById(t) {
3484
- return this.a.find((i) => i.id === t) ?? null;
3485
- }
3486
- getByKind(t) {
3487
- const i = Array.isArray(t) ? t : [t];
3488
- return this.a.filter((n) => i.includes(n.kind));
3489
- }
3490
- /* @internal */
3491
- [(Ae = tt, et)]() {
3492
- if (!this.Ia) {
3493
- for (const t of this.a)
3494
- t[et]();
3495
- this.Ia = !0;
3496
- }
3497
- }
3498
- Ra(t) {
3499
- const i = t.detail;
3500
- if (i.mode === "showing") {
3501
- const n = M(i) ? ["captions", "subtitles"] : [i.kind];
3502
- for (const r of this.a)
3503
- r.mode === "showing" && r != i && n.includes(r.kind) && (r.mode = "disabled");
3504
- }
3505
- this.dispatchEvent(
3506
- new y("mode-change", {
3507
- detail: t.detail,
3508
- trigger: t
3509
- })
3510
- );
3511
- }
3512
- }
3513
- class sn {
3514
- constructor(s, t, i) {
3515
- l(this, "Ie");
3516
- this.l = s, this.j = t, this.k = i;
3517
- const n = new Rt(), r = new as(), a = new Ti();
3518
- this.Ie = Tt(() => t.$props.preferNativeHLS() ? [r, a, n] : [n, r, a]), d(this.Ke.bind(this)), d(this.Le.bind(this)), d(this.Me.bind(this)), d(this.Ne.bind(this));
3519
- }
3520
- Ke() {
3521
- this.j.delegate.p("sources-change", {
3522
- detail: [...nn(this.j.$props.src()), ...this.l()]
3523
- });
3524
- }
3525
- Le() {
3526
- var a;
3527
- const { $store: s } = this.j, t = s.sources(), i = u(s.source), n = this.Je(i, t);
3528
- if (((a = t[0]) == null ? void 0 : a.src) && !n.src && !n.type) {
3529
- const { crossorigin: o } = s, h = re(o()), c = new AbortController();
3530
- return Promise.all(
3531
- t.map(
3532
- (p) => O(p.src) && p.type === "?" ? fetch(p.src, {
3533
- method: "HEAD",
3534
- credentials: h,
3535
- signal: c.signal
3536
- }).then((q) => (p.type = q.headers.get("content-type") || "??", p)).catch(() => p) : p
3537
- )
3538
- ).then((p) => {
3539
- c.signal.aborted || (this.Je(u(s.source), p), W());
3540
- }), () => c.abort();
3541
- }
3542
- W();
3543
- }
3544
- Je(s, t) {
3545
- let i = { src: "", type: "" }, n = null;
3546
- for (const r of t) {
3547
- const a = u(this.Ie).find((o) => o.canPlay(r));
3548
- a && (i = r, n = a);
3549
- }
3550
- return this.Oe(s, i, n), this.Pe(u(this.k), n), i;
3551
- }
3552
- Oe(s, t, i) {
3553
- t.src === s.src && t.type === s.type || (this.j.delegate.p("source-change", { detail: t }), this.j.delegate.p("media-type-change", {
3554
- detail: (i == null ? void 0 : i.mediaType(t)) || "unknown"
3555
- }));
3556
- }
3557
- Pe(s, t) {
3558
- t !== s && (this.j.delegate.p("provider-change", { detail: null }), t && u(() => {
3559
- var i;
3560
- return (i = t.preconnect) == null ? void 0 : i.call(t, this.j);
3561
- }), this.k.set(t), this.j.delegate.p("provider-loader-change", { detail: t }));
3562
- }
3563
- Me() {
3564
- const s = this.j.$provider();
3565
- if (s) {
3566
- if (this.j.$store.canLoad()) {
3567
- u(
3568
- () => s.setup({
3569
- ...this.j,
3570
- player: this.j.player
3571
- })
3572
- );
3573
- return;
3574
- }
3575
- u(() => {
3576
- var t;
3577
- return (t = s.preconnect) == null ? void 0 : t.call(s, this.j);
3578
- });
3579
- }
3580
- }
3581
- Ne() {
3582
- const s = this.j.$provider(), t = this.j.$store.source();
3583
- if (this.j.$store.canLoad()) {
3584
- u(() => s == null ? void 0 : s.loadSource(t, u(this.j.$store.preload)));
3585
- return;
3586
- }
3587
- try {
3588
- O(t.src) && fs(new URL(t.src).origin, "preconnect");
3589
- } catch {
3590
- }
3591
- }
3592
- }
3593
- function nn(e) {
3594
- return (P(e) ? e : [!O(e) && "src" in e ? e : { src: e }]).map(
3595
- ({ src: s, type: t }) => ({
3596
- src: s,
3597
- type: t ?? (!O(s) || s.startsWith("blob:") ? "video/object" : "?")
3598
- })
3599
- );
3600
- }
3601
- class rn {
3602
- constructor(s, t) {
3603
- l(this, "Ge", []);
3604
- this.m = s, this.j = t, d(this.He.bind(this));
3605
- }
3606
- He() {
3607
- const s = [...this.j.$props.textTracks(), ...this.m()];
3608
- for (const t of this.Ge)
3609
- if (!s.some((i) => i.id === t.id)) {
3610
- const i = t.id && this.j.textTracks.getById(t.id);
3611
- i && this.j.textTracks.remove(i);
3612
- }
3613
- for (const t of s) {
3614
- const i = t.id || Wt.createId(t);
3615
- this.j.textTracks.getById(i) || (t.id = i, this.j.textTracks.add(t));
3616
- }
3617
- this.Ge = s;
3618
- }
3619
- }
3620
- class an extends js {
3621
- constructor(t) {
3622
- super(t);
3623
- l(this, "j");
3624
- l(this, "l", _([]));
3625
- l(this, "m", _([]));
3626
- l(this, "k", _(null));
3627
- this.j = ne(), new sn(this.l, this.j, this.k), new rn(this.m, this.j);
3628
- }
3629
- onAttach(t) {
3630
- t.setAttribute("keep-alive", "");
3631
- }
3632
- onConnect(t) {
3633
- const i = new ResizeObserver(is(this.n.bind(this)));
3634
- i.observe(t);
3635
- const n = new MutationObserver(this.o.bind(this));
3636
- return n.observe(t, { attributes: !0, childList: !0 }), Ci && f(t, "touchstart", (r) => r.preventDefault(), { passive: !1 }), Di(() => {
3637
- this.n(), this.o();
3638
- }), () => {
3639
- i.disconnect(), n.disconnect();
3640
- };
3641
- }
3642
- onDestroy() {
3643
- this.j.$store.currentTime.set(0);
3644
- }
3645
- n() {
3646
- const t = this.j.player, i = this.el.offsetWidth, n = this.el.offsetHeight;
3647
- t && (t.$store.mediaWidth.set(i), t.$store.mediaHeight.set(n), nt(t, "--media-width", i + "px"), nt(t, "--media-height", n + "px"));
3648
- }
3649
- o() {
3650
- const t = [], i = [], n = this.el.children;
3651
- for (const r of n)
3652
- r instanceof HTMLSourceElement ? t.push({
3653
- src: r.src,
3654
- type: r.type
3655
- }) : r instanceof HTMLTrackElement && i.push({
3656
- id: r.id,
3657
- src: r.src,
3658
- kind: r.track.kind,
3659
- language: r.srclang,
3660
- label: r.label,
3661
- default: r.default,
3662
- type: r.getAttribute("data-type")
3663
- });
3664
- this.l.set(t), this.m.set(i), W();
3665
- }
3666
- render() {
3667
- let t;
3668
- return L(() => {
3669
- var i;
3670
- return (i = t == null ? void 0 : t.destroy) == null ? void 0 : i.call(t);
3671
- }), () => {
3672
- t == null || t.destroy();
3673
- const i = this.k();
3674
- if (!i)
3675
- return null;
3676
- const n = i.render(this.j.$store);
3677
- return u(() => {
3678
- i.load(this.j).then((r) => {
3679
- u(this.k) === i && (this.j.delegate.p("provider-change", {
3680
- detail: r
3681
- }), t = r);
3682
- });
3683
- }), n;
3684
- };
3685
- }
3686
- }
3687
- l(an, "el", ti({
3688
- tagName: "media-outlet"
3689
- }));
3690
- class tr extends C {
3691
- constructor(s, t) {
3692
- super(s), this.ig = t;
3693
- }
3694
- onAttach(s) {
3695
- const { $props: t, ariaKeys: i } = ne(), n = s.getAttribute("aria-keyshortcuts");
3696
- if (n) {
3697
- i[this.ig] = n, L(() => {
3698
- delete i[this.ig];
3699
- });
3700
- return;
3701
- }
3702
- const r = t.keyShortcuts()[this.ig];
3703
- r && s.setAttribute("aria-keyshortcuts", r);
3704
- }
3705
- }
3706
- export {
3707
- mn as $,
3708
- Gn as A,
3709
- $n as B,
3710
- js as C,
3711
- Sn as D,
3712
- wt as E,
3713
- Xn as F,
3714
- M as G,
3715
- es as H,
3716
- xn as I,
3717
- ne as J,
3718
- vs as K,
3719
- yn as L,
3720
- Vi as M,
3721
- bn as N,
3722
- an as O,
3723
- pn as P,
3724
- Ye as Q,
3725
- wn as R,
3726
- ji as S,
3727
- Jn as T,
3728
- X as U,
3729
- Rn as V,
3730
- Me as W,
3731
- x as X,
3732
- O as Y,
3733
- y as Z,
3734
- ht as _,
3735
- Bn as a,
3736
- Ss as a$,
3737
- Un as a0,
3738
- b as a1,
3739
- qi as a2,
3740
- fs as a3,
3741
- At as a4,
3742
- dn as a5,
3743
- C as a6,
3744
- Y as a7,
3745
- En as a8,
3746
- fn as a9,
3747
- W as aA,
3748
- Jt as aB,
3749
- qn as aC,
3750
- L as aD,
3751
- zt as aE,
3752
- mt as aF,
3753
- Ci as aG,
3754
- Cs as aH,
3755
- kn as aI,
3756
- He as aJ,
3757
- ts as aK,
3758
- Wt as aL,
3759
- v as aM,
3760
- j as aN,
3761
- Qi as aO,
3762
- Cn as aP,
3763
- In as aQ,
3764
- Oi as aR,
3765
- Gi as aS,
3766
- _t as aT,
3767
- Vt as aU,
3768
- It as aV,
3769
- ct as aW,
3770
- gt as aX,
3771
- Pn as aY,
3772
- li as aZ,
3773
- Ei as a_,
3774
- cn as aa,
3775
- Di as ab,
3776
- Zn as ac,
3777
- is as ad,
3778
- Ge as ae,
3779
- _n as af,
3780
- jn as ag,
3781
- xs as ah,
3782
- Vs as ai,
3783
- oi as aj,
3784
- nt as ak,
3785
- Ct as al,
3786
- Tn as am,
3787
- Xi as an,
3788
- Kn as ao,
3789
- On as ap,
3790
- hn as aq,
3791
- gn as ar,
3792
- St as as,
3793
- tr as at,
3794
- ln as au,
3795
- Is as av,
3796
- Ns as aw,
3797
- Os as ax,
3798
- _s as ay,
3799
- S as az,
3800
- tt as b,
3801
- Ft as b0,
3802
- vn as b1,
3803
- Tt as c,
3804
- ti as d,
3805
- Qn as e,
3806
- Mi as f,
3807
- Mn as g,
3808
- Yn as h,
3809
- Wn as i,
3810
- Vn as j,
3811
- zn as k,
3812
- Hn as l,
3813
- Ln as m,
3814
- Fn as n,
3815
- Nn as o,
3816
- As as p,
3817
- d as q,
3818
- un as r,
3819
- _ as s,
3820
- f as t,
3821
- it as u,
3822
- qs as v,
3823
- Dn as w,
3824
- We as x,
3825
- An as y,
3826
- u as z
3827
- };