@polyv/wx-live-player-core 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+
2
+ # 直播小程序播放核心 SDK
3
+
4
+ ## 安装
5
+ ```
6
+ pnpm install
7
+
8
+ ```
9
+
10
+ ## 开发环境
11
+
12
+ ```
13
+ pnpm run dev
14
+ ```
15
+
16
+ ## 注意事项
17
+ - 该SDK仅逻辑层,不包含UI层。
18
+ - 由于小程序体积限制。package.json files字段中,仅包含了核心SDK的文件。
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@polyv/wx-live-player-core",
3
+ "version": "3.0.0",
4
+ "main": "polyv-live-player.js",
5
+ "types": "polyv-live-player.d.ts",
6
+ "dependencies": {
7
+ "aes-js": "^3.1.2",
8
+ "eventemitter3": "^5.0.1",
9
+ "js-base64": "^3.7.7",
10
+ "md5": "^2.3.0"
11
+ },
12
+ "files": [
13
+ "polyv-live-player.d.ts",
14
+ "polyv-live-player.js"
15
+ ],
16
+ "lint-staged": {
17
+ "*.{js,ts}": [
18
+ "eslint --fix",
19
+ "prettier --write"
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,656 @@
1
+ // Generated by dts-bundle v0.7.3
2
+
3
+ /** @file 入口文件 */
4
+ export default PolyvLive;
5
+
6
+ export class PolyvLive {
7
+ constructor(config: PlayerConfig);
8
+ /**
9
+ * 播放器初始化
10
+ * @description 初始化播放器, 包括鉴权, 解析当前状态等操作
11
+ */
12
+ setUp(): Promise<void>;
13
+ /**
14
+ * 获取播放类型
15
+ * @returns 播放类型
16
+ * @description 可以通过 `getPlayType` 主动获取当前的播放类型
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const playType = player.getPlayType();
21
+ *
22
+ * if (playType === PlayType.WAIT_START) {
23
+ * console.log('当前暂无直播, 显示暂未直播盖图');
24
+ * }}
25
+ * ```
26
+ */
27
+ getPlayType(): PlayType;
28
+ /**
29
+ * 刷新当前播放流
30
+ * @description 一般用于直播过程中, 出现卡顿等情况, 主动刷新当前播放流
31
+ * @example
32
+ * ```ts
33
+ * <button bind:tap="refresh"></button>
34
+ *
35
+ * player.on(PlayerEventsType.UPDATE_MEDIA_INFO, (mediaInfo: MediaInfo) => {
36
+ * const { playType, src } = mediaInfo;
37
+ * this.setData({ src });
38
+ * });
39
+ *
40
+ * // 调用刷新流接口,触发`UPDATE_MEDIA_INFO`事件更新视频播放地址
41
+ * function refresh() {
42
+ * player.refresh();
43
+ * }
44
+ * ```
45
+ */
46
+ refresh(): void;
47
+ /**
48
+ * 设置统计参数
49
+ * @description 播放中途如设置昵称, 可以通过`setStatics`更新统计参数。一般param1用于设置用户唯一Id,param2用于设置用户昵称等信息
50
+ * @param statics 统计参数
51
+ * @example
52
+ * ```ts
53
+ * player.setStatics({
54
+ * param2: '昵称',
55
+ * });
56
+ * ```
57
+ */
58
+ setStatics(statics: PlayerStatisticsSetting): void;
59
+ /**
60
+ * 开始统计播放时长
61
+ * @description 连麦结束,需要调用`startCountPd`开始统计播放时长
62
+ * @ignore
63
+ */
64
+ startCountPd(): void;
65
+ /**
66
+ * 暂停统计播放时长
67
+ * @description 连麦中途,CDN播放器会暂停统计播放时长,需要调用`stopCountPd`暂停统计播放时长
68
+ * @ignore
69
+ */
70
+ stopCountPd(): void;
71
+ /**
72
+ * 切换线路
73
+ * @description 切换线路, 切换线路后, 会触发`UPDATE_MEDIA_INFO`事件
74
+ * @param line 线路索引 0 代表线路1
75
+ * @example
76
+ * ```ts
77
+ * <button bind:tap="changeLine"></button>
78
+ *
79
+ * player.on(PlayerEventsType.UPDATE_MEDIA_INFO, (mediaInfo: MediaInfo) => {
80
+ * const { playType, src } = mediaInfo;
81
+ * this.setData({ src });
82
+ * });
83
+ *
84
+ * // 调用切换线路接口,触发`UPDATE_MEDIA_INFO`事件更新视频播放地址
85
+ * function changeLine() {
86
+ * player.changeLine(0);
87
+ * }
88
+ * ```
89
+ */
90
+ changeLine(line: number): void;
91
+ /**
92
+ * 切换清晰度
93
+ * @description 切换清晰度, 切换清晰度后, 会触发`UPDATE_MEDIA_INFO`事件
94
+ * @param level 清晰度索引 0 代表流畅
95
+ * @example
96
+ * ```ts
97
+ * <button bind:tap="changeLevel"></button>
98
+ *
99
+ * player.on(PlayerEventsType.UPDATE_MEDIA_INFO, (mediaInfo: MediaInfo) => {
100
+ * const { playType, src } = mediaInfo;
101
+ * this.setData({ src });
102
+ * });
103
+ *
104
+ * // 调用切换清晰度接口,触发`UPDATE_MEDIA_INFO`事件更新视频播放地址
105
+ * function changeLevel() {
106
+ * player.changeLevel();
107
+ * }
108
+ * ```
109
+ */
110
+ changeLevel(level: number): void;
111
+ /**
112
+ * 切换延迟内核
113
+ * @description 切换延迟内核, 切换延迟内核后, 会触发`UPDATE_MEDIA_INFO`事件
114
+ * @param playCore 延迟内核索引 0 代表普通延迟 1 代表无延迟
115
+ */
116
+ changePlayCore(playCore: number): void;
117
+ /**
118
+ * 监测播放组件状态回调
119
+ */
120
+ setLivePlayerStateChange(e: WechatMiniprogram.LivePlayerStateChange): void;
121
+ /**
122
+ * 事件监听
123
+ */
124
+ on<K extends keyof PlayerEventMap>(event: K, listener: PlayerEventMap[K]): void;
125
+ /**
126
+ * 取消事件监听
127
+ */
128
+ off<K extends keyof PlayerEventMap>(event: K, listener: PlayerEventMap[K]): void;
129
+ /**
130
+ * 销毁播放实例
131
+ */
132
+ destroy(): void;
133
+ }
134
+
135
+ /**
136
+ * 是/否
137
+ */
138
+ export type YN = 'Y' | 'N';
139
+ /** 鉴权配置 */
140
+ export interface AuthSetting {
141
+ /** 应用ID */
142
+ appId: string;
143
+ /**
144
+ * 校验签名
145
+ * @example
146
+ * 签名计算示例,注意:请勿在前端代码出现明文appSecret,建议通过后端接口获取appSecret
147
+ * ```ts
148
+ * const params = {
149
+ * appId: appId,
150
+ * channelId: channelId,
151
+ * timestamp: new Date().getTime(),
152
+ * }
153
+ * const appSecret = '123456';
154
+ * const sign = md5(`${appId}${timestamp}${appSecret}`).toUpperCase();
155
+ * ```
156
+ */
157
+ sign: string;
158
+ /** 校验时间戳 */
159
+ timestamp: number;
160
+ }
161
+ /**
162
+ * 播放器初始化配置项
163
+ */
164
+ export interface PlayerConfig {
165
+ /**
166
+ * 鉴权参数
167
+ */
168
+ auth: AuthSetting;
169
+ /**
170
+ * 用户id
171
+ */
172
+ uid: string;
173
+ /**
174
+ * 频道id
175
+ */
176
+ cid: string;
177
+ /**
178
+ * 统计数据
179
+ */
180
+ statistics?: StatisticsSetting;
181
+ /**
182
+ * 回放地址
183
+ */
184
+ vodSrc?: string;
185
+ /**
186
+ * 回放时长
187
+ */
188
+ vodDuration?: number;
189
+ /**
190
+ * 自动切换直播和回放视频,默认false
191
+ */
192
+ isAutoChange?: boolean;
193
+ /**
194
+ * 是否强制使用video组件播放直播, 默认false
195
+ */
196
+ forceVideo?: boolean;
197
+ /**
198
+ * 默认使用线路
199
+ */
200
+ line?: number;
201
+ /**
202
+ * 默认使用清晰度
203
+ */
204
+ level?: number;
205
+ /**
206
+ * 鉴权token
207
+ */
208
+ xAuthToken?: string;
209
+ /**
210
+ * 延迟内核
211
+ */
212
+ playCore?: number;
213
+ }
214
+ /**
215
+ * 统计数据
216
+ */
217
+ export type StatisticsSetting = Partial<{
218
+ param1: string;
219
+ param2: string;
220
+ param4: string;
221
+ param5: string;
222
+ sessionId: string;
223
+ }>;
224
+ /**
225
+ * 播放器设置的统计数据
226
+ */
227
+ export type PlayerStatisticsSetting = Omit<StatisticsSetting, 'sessionId'>;
228
+ /**
229
+ * 播放类型
230
+ */
231
+ export enum PlayType {
232
+ /**
233
+ * 直播
234
+ */
235
+ LIVE = "live",
236
+ /**
237
+ * 回放
238
+ */
239
+ VOD = "vod",
240
+ /**
241
+ * 暖场图片
242
+ */
243
+ WARM_IMAGE = "warmImage",
244
+ /**
245
+ * 暖场视频
246
+ */
247
+ WARM_VIDEO = "warmVideo",
248
+ /**
249
+ * 等待开始直播
250
+ */
251
+ WAIT_START = "waitStart"
252
+ }
253
+ /**
254
+ * 清晰度类型
255
+ */
256
+ export enum LevelType {
257
+ /**
258
+ * 流畅
259
+ */
260
+ SD = "sd",
261
+ /**
262
+ * 高清
263
+ */
264
+ HD = "hd",
265
+ /**
266
+ * 超清
267
+ */
268
+ FHD = "fhd"
269
+ }
270
+ /**
271
+ * 清晰度列表节点
272
+ */
273
+ export interface LevelItem {
274
+ /** 清晰度类型 */
275
+ type: LevelType;
276
+ /** 级别 */
277
+ level: number;
278
+ }
279
+ /**
280
+ * 线路列表节点
281
+ */
282
+ export interface LineItem {
283
+ /** 线路类型 */
284
+ type: string;
285
+ /** 线路 */
286
+ line: number;
287
+ }
288
+ /**
289
+ * 延迟内核类型
290
+ */
291
+ export enum PlayCoreType {
292
+ /** 普通延迟 */
293
+ CDN = "cdn",
294
+ /** 无延迟 */
295
+ QUICK = "quick"
296
+ }
297
+ /**
298
+ * 延迟内核列表节点
299
+ */
300
+ export interface PlayCoreItem {
301
+ /** 延迟内核类型 */
302
+ type: PlayCoreType;
303
+ /** 延迟内核 */
304
+ core: number;
305
+ /** 是否可启用 */
306
+ enabled: boolean;
307
+ }
308
+ export interface PlayerMediaInfo {
309
+ /** 链接(直播、回放、暖场图片、暖场视频链接) */
310
+ src: string;
311
+ /** 回放视频返回回放时长 */
312
+ duration?: number;
313
+ /** 播放类型 */
314
+ type: typeof PlayType;
315
+ /** 线路选项信息 */
316
+ lines?: {
317
+ /** 线路选项 */
318
+ options: LineItem[];
319
+ /** 当前选中线路 */
320
+ active: number;
321
+ };
322
+ /** 清晰度选项信息 */
323
+ levels?: {
324
+ /** 清晰度选项 */
325
+ options: LevelItem[];
326
+ /** 当前选中清晰度 */
327
+ active: number;
328
+ };
329
+ /** 延迟内核选项信息 */
330
+ playCores?: {
331
+ /** 延迟内核选项 */
332
+ options: PlayCoreItem[];
333
+ /** 当前选中延迟内核 */
334
+ active: number;
335
+ };
336
+ }
337
+
338
+ /**
339
+ * 播放器事件类型
340
+ */
341
+ export enum PlayerEventsType {
342
+ /**
343
+ * 播放器准备完成
344
+ */
345
+ READY = "ready",
346
+ /**
347
+ * 播放器状态变化
348
+ */
349
+ API_STATUS_CHANGE = "api_status_change",
350
+ /**
351
+ * 播放器播放类型变化
352
+ */
353
+ PLAY_TYPE_CHANGE = "play_type_change",
354
+ /**
355
+ * 播放器错误
356
+ */
357
+ ERROR = "error",
358
+ /**
359
+ * 播放器播放
360
+ */
361
+ PLAYING = "playing",
362
+ /**
363
+ * 播放器暂停
364
+ */
365
+ PAUSE = "pause",
366
+ /**
367
+ * 更新媒体信息
368
+ */
369
+ UPDATE_MEDIA_INFO = "update_media_info",
370
+ /**
371
+ * 线路切换
372
+ */
373
+ LINE_CHANGE = "line_change",
374
+ /**
375
+ * 清晰度切换
376
+ */
377
+ LEVEL_CHANGE = "level_change",
378
+ /**
379
+ * 播放配置更新
380
+ * @ignore
381
+ */
382
+ UPDATE_CHANNEL_JSON = "update_channel_json",
383
+ /**
384
+ * 播放状态更新
385
+ * @ignore
386
+ */
387
+ LIVE_STATUS_CHANGE = "live_status_change",
388
+ /**
389
+ * 延迟播放错误, 切换到正常延迟播放
390
+ */
391
+ LATENCY_PLAY_ERROR = "latency_play_error"
392
+ }
393
+ /** 播放器事件 */
394
+ export type PlayerEventMap = {
395
+ /** 播放器就绪 */
396
+ [PlayerEventsType.READY]: () => void;
397
+ /** 播放类型变更 */
398
+ [PlayerEventsType.PLAY_TYPE_CHANGE]: (playType: PlayType) => void;
399
+ /** 播放器错误 */
400
+ [PlayerEventsType.ERROR]: (error: PlayerError) => void;
401
+ /** 更新媒体信息 */
402
+ [PlayerEventsType.UPDATE_MEDIA_INFO]: (mediaInfo: PlayerMediaInfo) => void;
403
+ /** 线路切换 */
404
+ [PlayerEventsType.LINE_CHANGE]: (line: number) => void;
405
+ /** 清晰度切换 */
406
+ [PlayerEventsType.LEVEL_CHANGE]: (level: number) => void;
407
+ /**
408
+ * 播放状态更新
409
+ * @ignore
410
+ */
411
+ [PlayerEventsType.LIVE_STATUS_CHANGE]: (statusInfo: IGetApiStatusResponse) => void;
412
+ /**
413
+ * 播放配置更新
414
+ * @ignore
415
+ */
416
+ [PlayerEventsType.UPDATE_CHANNEL_JSON]: (channelJsonInfo: IChannelJsonConfig) => void;
417
+ /** 延迟播放错误 */
418
+ [PlayerEventsType.LATENCY_PLAY_ERROR]: () => void;
419
+ };
420
+
421
+ export interface PlayerError {
422
+ /**
423
+ * 错误码, 详见`ErrorCode`
424
+ */
425
+ code: string;
426
+ }
427
+ export enum ErrorCode {
428
+ /**
429
+ * 未知错误
430
+ */
431
+ UNKNOWN = "000",
432
+ /**
433
+ * 传入参数非法或鉴权失败
434
+ */
435
+ UN_LEGAL = "001",
436
+ /**
437
+ * 账号异常
438
+ */
439
+ ACCOUNT_ABNORMAL = "002",
440
+ /**
441
+ * 配置加载失败
442
+ */
443
+ CONFIG_LOAD_FAIL = "011"
444
+ }
445
+
446
+ /**
447
+ * 播放器状态
448
+ */
449
+ export enum ApiStatus {
450
+ /**
451
+ * 直播进行中
452
+ */
453
+ LIVE = "live",
454
+ /**
455
+ * 直播结束
456
+ */
457
+ END = "end",
458
+ /**
459
+ * 中途暂停
460
+ */
461
+ STOP = "stop"
462
+ }
463
+ /**
464
+ * 获取API状态接口响应参数
465
+ */
466
+ export interface IGetApiStatusResponse {
467
+ /**
468
+ * 状态
469
+ */
470
+ status: ApiStatus;
471
+ /**
472
+ * 场次ID
473
+ */
474
+ sessionId: string;
475
+ }
476
+ /**
477
+ * 获取API状态接口请求参数
478
+ */
479
+ export interface IGetApiStatusRequest {
480
+ /**
481
+ * 频道ID
482
+ */
483
+ channelId: string;
484
+ /**
485
+ * 流名
486
+ */
487
+ stream: string;
488
+ /**
489
+ * 随机数
490
+ */
491
+ ran: number;
492
+ }
493
+
494
+ /**
495
+ * 多码率配置
496
+ */
497
+ export interface IDefinitions {
498
+ /**
499
+ * 码率
500
+ */
501
+ definition: string;
502
+ /**
503
+ * 地址
504
+ */
505
+ url: string;
506
+ /**
507
+ * m3u8地址
508
+ */
509
+ m3u8: string;
510
+ }
511
+ /**
512
+ * 多码率配置
513
+ */
514
+ export interface IMultirateModel {
515
+ /**
516
+ * 默认码率
517
+ */
518
+ defaultDefinition: string;
519
+ /**
520
+ * 默认码率地址
521
+ */
522
+ defaultDefinitionUrl: string;
523
+ /**
524
+ * 默认码率m3u8地址
525
+ */
526
+ defaultDefinitionM3u8Url: string;
527
+ /**
528
+ * 多码率配置
529
+ */
530
+ definitions: IDefinitions[];
531
+ }
532
+ export interface ILineModel {
533
+ /**
534
+ * flv地址
535
+ */
536
+ flv: string;
537
+ /**
538
+ * m3u8地址
539
+ */
540
+ m3u8: string;
541
+ /**
542
+ * cdn类型
543
+ */
544
+ cdnType: string;
545
+ /**
546
+ * 多码率配置
547
+ */
548
+ multirateModel: IMultirateModel;
549
+ /**
550
+ * 无延迟播放地址
551
+ */
552
+ quickLiveUrl?: string;
553
+ /**
554
+ * 无延迟播放是否开启
555
+ */
556
+ quickLiveEnabled: YN;
557
+ }
558
+ /**
559
+ * 频道配置接口响应加密数据
560
+ */
561
+ export interface IChannelJsonEncryptResponse {
562
+ /**
563
+ * 状态码
564
+ */
565
+ code: number;
566
+ /**
567
+ * 状态信息
568
+ */
569
+ status: string;
570
+ /**
571
+ * 加密数据
572
+ */
573
+ body: string;
574
+ }
575
+ /**
576
+ * 频道播放器配置响应参数
577
+ */
578
+ export interface IChannelJsonConfig {
579
+ /**
580
+ * 流名
581
+ */
582
+ stream: string;
583
+ /**
584
+ * 封面图片
585
+ */
586
+ coverImage: string;
587
+ /**
588
+ * 暖场图片
589
+ */
590
+ waitImage: string;
591
+ /**
592
+ * 暖场视频
593
+ */
594
+ warmUpFlv: string;
595
+ /**
596
+ * m3u8地址
597
+ */
598
+ m3u8Url: string;
599
+ /**
600
+ * 频道直播状态查询频率, 单位秒
601
+ */
602
+ channelLiveStatusQueryFrequency: number;
603
+ /**
604
+ * 线路配置
605
+ */
606
+ lines: ILineModel[];
607
+ /**
608
+ * 回放视频 (mp4格式)
609
+ */
610
+ recordFileUrl: string;
611
+ /**
612
+ * 回放视频(m3u8格式)
613
+ */
614
+ recordFileM3u8Url: string;
615
+ /**
616
+ * 回放时长
617
+ */
618
+ recordFileDuration: number;
619
+ /**
620
+ * 回放场次ID
621
+ */
622
+ recordFileSessionId: string;
623
+ /**
624
+ * 频道详细信息
625
+ */
626
+ channelRestrictModel: {
627
+ /**
628
+ * 直播频道所属的账号情况
629
+ */
630
+ userStatus: string;
631
+ };
632
+ /**
633
+ * 拉流防盗链
634
+ */
635
+ aliPullProtectExpTime: number;
636
+ }
637
+ /**
638
+ * 频道配置接口请求参数
639
+ */
640
+ export interface IChannelJsonRequest {
641
+ /**
642
+ * 随机数
643
+ */
644
+ ran: number;
645
+ }
646
+ export interface IGetNewestPlayUrlsResponse {
647
+ /**
648
+ * flv地址
649
+ */
650
+ flv: string;
651
+ /**
652
+ * m3u8地址
653
+ */
654
+ m3u8: string;
655
+ }
656
+
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @polyv/wx-live-player-core v3.0.0
3
+ * (c) 2025 POLYV
4
+ */
5
+ function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r){return e=o(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,r||[],o(t).constructor):e.apply(t,r))}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(s=function(){return!!t})()}function c(){c=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new T(n||[]);return i(a,"_invoke",{value:x(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",v="suspendedYield",y="executing",g="completed",d={};function _(){}function m(){}function C(){}var w={};l(w,a,(function(){return this}));var b=Object.getPrototypeOf,S=b&&b(b(D([])));S&&S!==r&&n.call(S,a)&&(w=S);var k=C.prototype=_.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function x(e,r,n){var i=p;return function(o,a){if(i===y)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=A(s,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=y;var u=f(e,r,n);if("normal"===u.type){if(i=n.done?g:v,u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=g,n.method="throw",n.arg=u.arg)}}}function A(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=f(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function D(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=C,i(k,"constructor",{value:C,configurable:!0}),i(C,"constructor",{value:m,configurable:!0}),m.displayName=l(C,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,C):(t.__proto__=C,l(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},E(P.prototype),l(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new P(h(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(k),l(k,u,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=D,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function l(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function f(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var p=function(){return i((function t(){r(this,t),this.state={},this.watchers={},this.computed={}}),[{key:"setState",value:function(t,e){var r,n=this.state[t];for(var i in this.state[t]=e,this.watchers[t]&&(null===(r=this.watchers[t])||void 0===r||r.forEach((function(t){return t(e,n)}))),this.computed)this.computed[i]()}},{key:"getState",value:function(t){return this.state[t]}},{key:"watch",value:function(t,e){var r;this.watchers[t]||(this.watchers[t]=[]),null===(r=this.watchers[t])||void 0===r||r.push(e)}},{key:"computedProperty",value:function(t,e){this.computed[t]=e}}])}(),v=function(){return i((function t(e){r(this,t),this.__playerCore=e}),[{key:"getPlayerCore",value:function(){return this.__playerCore}},{key:"destroy",value:function(){}}])}();function y(t,e){return new Promise((function(r,n){wx.request({url:t,data:e,timeout:1e4,success:function(t){var e=t.data.code;e<200||e>=400?n(t.data):r(t.data)},fail:function(t){n(t)}})}))}var g,d,_,m="https://player.polyv.net",C="https://livejson.polyv.net",w="https://live.polyv.net",b="https://rtas.videocc.net",S="https://rtas-2.videocc.net",k="https://live-normal.polyv.net",E="".concat("https://api.polyv.net","/live/v3/applet/sdk/get-channel-token-detail"),P="".concat(C,"/service/v3/restrict_$UID_$CID.json"),x="".concat(w,"/service/v3/restrict_$UID_$CID.json"),A="".concat(m,"/service/lts3/enc_$UID_$CID.json"),I="".concat(w,"/service/lts3/enc_$UID_$CID.json"),L="".concat(k,"/live/v4/live-status-sessionid/$CID/$STREAM-NAME"),T="".concat(b,"/v2/view"),D="".concat(S,"/v2/view");function O(t){return y(E,t)}function R(t,e){return y(x.replace("$UID",t).replace("$CID",e),{ran:Math.floor(9999999*Math.random())})}function N(t,e){return y(P.replace("$UID",t).replace("$CID",e),{ran:Math.floor(9999999*Math.random())})}function M(t,e){return y(A.replace("$UID",t).replace("$CID",e),{ran:Math.floor(9999999*Math.random())})}function j(t,e){return y(I.replace("$UID",t).replace("$CID",e),{ran:Math.floor(9999999*Math.random())})}function U(t,e){return y(L.replace("$CID",t).replace("$STREAM-NAME",e),{ran:Math.floor(9999999*Math.random())})}function B(t){return y(D,t)}!function(t){t.LIVE="live",t.VOD="vod",t.WARM_IMAGE="warmImage",t.WARM_VIDEO="warmVideo",t.WAIT_START="waitStart"}(g||(g={})),function(t){t.SD="sd",t.HD="hd",t.FHD="fhd"}(d||(d={})),function(t){t.CDN="cdn",t.QUICK="quick"}(_||(_={}));var F,z,V={exports:{}},G={exports:{}};F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",z={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&z.rotl(t,8)|4278255360&z.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=z.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],r=0;r<t.length;r+=3)for(var n=t[r]<<16|t[r+1]<<8|t[r+2],i=0;i<4;i++)8*r+6*i<=8*t.length?e.push(F.charAt(n>>>6*(3-i)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,n=0;r<t.length;n=++r%4)0!=n&&e.push((F.indexOf(t.charAt(r-1))&Math.pow(2,-2*n+8)-1)<<2*n|F.indexOf(t.charAt(r))>>>6-2*n);return e}},G.exports=z;var K={utf8:{stringToBytes:function(t){return K.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(K.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}},$=K,H=function(t){return null!=t&&(W(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&W(t.slice(0,0))}(t)||!!t._isBuffer)};function W(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}!function(){var t=G.exports,e=$.utf8,r=H,n=$.bin,i=function(o,a){o.constructor==String?o=a&&"binary"===a.encoding?n.stringToBytes(o):e.stringToBytes(o):r(o)?o=Array.prototype.slice.call(o,0):Array.isArray(o)||o.constructor===Uint8Array||(o=o.toString());for(var s=t.bytesToWords(o),c=8*o.length,u=1732584193,l=-271733879,h=-1732584194,f=271733878,p=0;p<s.length;p++)s[p]=16711935&(s[p]<<8|s[p]>>>24)|4278255360&(s[p]<<24|s[p]>>>8);s[c>>>5]|=128<<c%32,s[14+(c+64>>>9<<4)]=c;var v=i._ff,y=i._gg,g=i._hh,d=i._ii;for(p=0;p<s.length;p+=16){var _=u,m=l,C=h,w=f;u=v(u,l,h,f,s[p+0],7,-680876936),f=v(f,u,l,h,s[p+1],12,-389564586),h=v(h,f,u,l,s[p+2],17,606105819),l=v(l,h,f,u,s[p+3],22,-1044525330),u=v(u,l,h,f,s[p+4],7,-176418897),f=v(f,u,l,h,s[p+5],12,1200080426),h=v(h,f,u,l,s[p+6],17,-1473231341),l=v(l,h,f,u,s[p+7],22,-45705983),u=v(u,l,h,f,s[p+8],7,1770035416),f=v(f,u,l,h,s[p+9],12,-1958414417),h=v(h,f,u,l,s[p+10],17,-42063),l=v(l,h,f,u,s[p+11],22,-1990404162),u=v(u,l,h,f,s[p+12],7,1804603682),f=v(f,u,l,h,s[p+13],12,-40341101),h=v(h,f,u,l,s[p+14],17,-1502002290),u=y(u,l=v(l,h,f,u,s[p+15],22,1236535329),h,f,s[p+1],5,-165796510),f=y(f,u,l,h,s[p+6],9,-1069501632),h=y(h,f,u,l,s[p+11],14,643717713),l=y(l,h,f,u,s[p+0],20,-373897302),u=y(u,l,h,f,s[p+5],5,-701558691),f=y(f,u,l,h,s[p+10],9,38016083),h=y(h,f,u,l,s[p+15],14,-660478335),l=y(l,h,f,u,s[p+4],20,-405537848),u=y(u,l,h,f,s[p+9],5,568446438),f=y(f,u,l,h,s[p+14],9,-1019803690),h=y(h,f,u,l,s[p+3],14,-187363961),l=y(l,h,f,u,s[p+8],20,1163531501),u=y(u,l,h,f,s[p+13],5,-1444681467),f=y(f,u,l,h,s[p+2],9,-51403784),h=y(h,f,u,l,s[p+7],14,1735328473),u=g(u,l=y(l,h,f,u,s[p+12],20,-1926607734),h,f,s[p+5],4,-378558),f=g(f,u,l,h,s[p+8],11,-2022574463),h=g(h,f,u,l,s[p+11],16,1839030562),l=g(l,h,f,u,s[p+14],23,-35309556),u=g(u,l,h,f,s[p+1],4,-1530992060),f=g(f,u,l,h,s[p+4],11,1272893353),h=g(h,f,u,l,s[p+7],16,-155497632),l=g(l,h,f,u,s[p+10],23,-1094730640),u=g(u,l,h,f,s[p+13],4,681279174),f=g(f,u,l,h,s[p+0],11,-358537222),h=g(h,f,u,l,s[p+3],16,-722521979),l=g(l,h,f,u,s[p+6],23,76029189),u=g(u,l,h,f,s[p+9],4,-640364487),f=g(f,u,l,h,s[p+12],11,-421815835),h=g(h,f,u,l,s[p+15],16,530742520),u=d(u,l=g(l,h,f,u,s[p+2],23,-995338651),h,f,s[p+0],6,-198630844),f=d(f,u,l,h,s[p+7],10,1126891415),h=d(h,f,u,l,s[p+14],15,-1416354905),l=d(l,h,f,u,s[p+5],21,-57434055),u=d(u,l,h,f,s[p+12],6,1700485571),f=d(f,u,l,h,s[p+3],10,-1894986606),h=d(h,f,u,l,s[p+10],15,-1051523),l=d(l,h,f,u,s[p+1],21,-2054922799),u=d(u,l,h,f,s[p+8],6,1873313359),f=d(f,u,l,h,s[p+15],10,-30611744),h=d(h,f,u,l,s[p+6],15,-1560198380),l=d(l,h,f,u,s[p+13],21,1309151649),u=d(u,l,h,f,s[p+4],6,-145523070),f=d(f,u,l,h,s[p+11],10,-1120210379),h=d(h,f,u,l,s[p+2],15,718787259),l=d(l,h,f,u,s[p+9],21,-343485551),u=u+_>>>0,l=l+m>>>0,h=h+C>>>0,f=f+w>>>0}return t.endian([u,l,h,f])};i._ff=function(t,e,r,n,i,o,a){var s=t+(e&r|~e&n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},i._gg=function(t,e,r,n,i,o,a){var s=t+(e&n|r&~n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},i._hh=function(t,e,r,n,i,o,a){var s=t+(e^r^n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},i._ii=function(t,e,r,n,i,o,a){var s=t+(r^(e|~n))+(i>>>0)+a;return(s<<o|s>>>32-o)+e},i._blocksize=16,i._digestsize=16,V.exports=function(e,r){if(null==e)throw new Error("Illegal argument "+e);var o=t.wordsToBytes(i(e,r));return r&&r.asBytes?o:r&&r.asString?n.bytesToString(o):t.bytesToHex(o)}}();var Y=V.exports;const q="function"==typeof Buffer,J="function"==typeof TextDecoder?new TextDecoder:void 0,Q="function"==typeof TextEncoder?new TextEncoder:void 0,Z=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),X=(()=>{let t={};return Z.forEach(((e,r)=>t[e]=r)),t})(),tt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,et=String.fromCharCode.bind(String),rt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),nt=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),it=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),ot=t=>{let e,r,n,i,o="";const a=t.length%3;for(let a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=r<<16|n<<8|i,o+=Z[e>>18&63]+Z[e>>12&63]+Z[e>>6&63]+Z[63&e]}return a?o.slice(0,a-3)+"===".substring(a):o},at="function"==typeof btoa?t=>btoa(t):q?t=>Buffer.from(t,"binary").toString("base64"):ot,st=q?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let r=0,n=t.length;r<n;r+=4096)e.push(et.apply(null,t.subarray(r,r+4096)));return at(e.join(""))},ct=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?et(192|e>>>6)+et(128|63&e):et(224|e>>>12&15)+et(128|e>>>6&63)+et(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return et(240|e>>>18&7)+et(128|e>>>12&63)+et(128|e>>>6&63)+et(128|63&e)},ut=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,lt=t=>t.replace(ut,ct),ht=q?t=>Buffer.from(t,"utf8").toString("base64"):Q?t=>st(Q.encode(t)):t=>at(lt(t)),ft=(t,e=!1)=>e?nt(ht(t)):ht(t),pt=t=>ft(t,!0),vt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,yt=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return et(55296+(e>>>10))+et(56320+(1023&e));case 3:return et((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return et((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},gt=t=>t.replace(vt,yt),dt=t=>{if(t=t.replace(/\s+/g,""),!tt.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,r,n,i="";for(let o=0;o<t.length;)e=X[t.charAt(o++)]<<18|X[t.charAt(o++)]<<12|(r=X[t.charAt(o++)])<<6|(n=X[t.charAt(o++)]),i+=64===r?et(e>>16&255):64===n?et(e>>16&255,e>>8&255):et(e>>16&255,e>>8&255,255&e);return i},_t="function"==typeof atob?t=>atob(it(t)):q?t=>Buffer.from(t,"base64").toString("binary"):dt,mt=q?t=>rt(Buffer.from(t,"base64")):t=>rt(_t(t).split("").map((t=>t.charCodeAt(0)))),Ct=q?t=>Buffer.from(t,"base64").toString("utf8"):J?t=>J.decode(mt(t)):t=>gt(_t(t)),wt=t=>it(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),bt=t=>Ct(wt(t)),St=pt,kt=bt;function Et(t,e,r){return void 0!==e&&(t=Math.max(t,e)),void 0!==r&&(t=Math.min(t,r)),t}function Pt(t){return t.replace(/"/g,"")}var xt,At=function(){function t(n){var i;return r(this,t),(i=e(this,t,[n])).__startTimeStamps=0,i.__pollingInterval=0,i.pid="",i.__pollingIntervalTime=1e4,i.playDuration=0,i.__playDurationCountInterval=0,i.__stayDurationStartTimeStamps=0,i.__updatingStatistics={},i.__init(),i}return a(t,v),i(t,[{key:"__init",value:function(){var t=this;this.getPlayerCore().store.watch("playType",(function(e,r){e!==r&&(e||r)&&(e===g.LIVE||e===g.VOD?(t.changeStatisticsBaseParams(),t.startCountPd(),t.startPolling()):t.stopPolling())}))}},{key:"startPolling",value:function(){var t=this;this.stopPolling(),this.__pollingInterval=setInterval((function(){return f(t,void 0,void 0,c().mark((function t(){var e;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(e=Date.now())-this.__startTimeStamps>this.__pollingIntervalTime&&(this.__startTimeStamps=e,this.sendStatistics());case 2:case"end":return t.stop()}}),t,this)})))}),1e3)}},{key:"stopPolling",value:function(){this.__pollingInterval>0&&(clearInterval(this.__pollingInterval),this.__pollingInterval=0)}},{key:"startCountPd",value:function(){var t=this;this.stopCountPd(),this.__playDurationCountInterval=setInterval((function(){var e=t.getPlayerCore().store.getState("playType"),r=t.getPlayerCore().store.getState("status");e===g.LIVE&&"live"===r&&(t.playDuration+=1),e===g.VOD&&"end"===r&&(t.playDuration+=1)}),1e3)}},{key:"stopCountPd",value:function(){this.__playDurationCountInterval>0&&(clearInterval(this.__playDurationCountInterval),this.__playDurationCountInterval=0)}},{key:"sendStatistics",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i,o,a,s,u,l,h,f,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=this.getPlayerCore().store.getState("playType"))===g.LIVE||e===g.VOD){t.next=3;break}return t.abrupt("return");case 3:return r=this.getPlayerCore().getConfig(),n=r.statistics,i=Object.assign({},n,this.__updatingStatistics),o=r.uid,a=r.cid,s=this.pid,u=this.playDuration,l=Y("rtas.net".concat(s).concat(a,"0").concat(u)),h=this.getPlayerCore().store.getState("sessionId"),0===this.__stayDurationStartTimeStamps&&(this.__stayDurationStartTimeStamps=Date.now()),f=Math.floor((Date.now()-this.__stayDurationStartTimeStamps)/1e3),p={pid:s,uid:o,cid:a,pd:u,sd:f,sign:l,flow:0,ts:Date.now(),session_id:h,param1:St((null==i?void 0:i.param1)||""),param2:St((null==i?void 0:i.param2)||""),param3:St(e),param4:St((null==i?void 0:i.param4)||""),param5:St((null==i?void 0:i.param5)||""),pn:Pt('"webapp_sdk_live"'),pv:Pt('"3.0.0"')},t.prev=14,t.next=17,y(T,p);case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(14),console.warn("Send statistics failed:",t.t0),B(p);case 23:case"end":return t.stop()}}),t,this,[[14,19]])})))}},{key:"setStatics",value:function(t){this.__updatingStatistics=t}},{key:"changeStatisticsBaseParams",value:function(){this.pid=this.__getPid(),this.playDuration=0,this.__stayDurationStartTimeStamps=0}},{key:"__getPid",value:function(){var t="".concat(Date.now()),e=Math.floor(1e6*Math.random()+1e6).toString();return"".concat(t,"X").concat(e)}},{key:"destroy",value:function(){this.stopPolling()}}])}();!function(t){t.READY="ready",t.API_STATUS_CHANGE="api_status_change",t.PLAY_TYPE_CHANGE="play_type_change",t.ERROR="error",t.PLAYING="playing",t.PAUSE="pause",t.UPDATE_MEDIA_INFO="update_media_info",t.LINE_CHANGE="line_change",t.LEVEL_CHANGE="level_change",t.UPDATE_CHANNEL_JSON="update_channel_json",t.LIVE_STATUS_CHANGE="live_status_change",t.LATENCY_PLAY_ERROR="latency_play_error"}(xt||(xt={}));var It,Lt=function(){function t(n){var i;return r(this,t),(i=e(this,t,[n])).__startTimeStamps=0,i.__pollingInterval=0,i.__init(),i}return a(t,v),i(t,[{key:"__init",value:function(){var t=this.getPlayerCore();t.store.watch("status",(function(e,r){(e||r)&&e!==r&&t.updatePlayerInfo()}))}},{key:"__getPollingIntervalTime",value:function(){var t=(this.getPlayerCore().store.getState("channelConfig")||{}).channelLiveStatusQueryFrequency;return t?1e3*t:1e5}},{key:"__getStreamName",value:function(){var t=this.getPlayerCore().store.getState("channelConfig");return(null==t?void 0:t.stream)||""}},{key:"__getCid",value:function(){return this.getPlayerCore().getConfig().cid}},{key:"startPolling",value:function(){var t=this,e=this.getPlayerCore().store;this.stopPolling();var r=this.__getPollingIntervalTime(),n=this.__getStreamName(),i=this.__getCid();this.__pollingInterval=setInterval((function(){return f(t,void 0,void 0,c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((o=Date.now())-this.__startTimeStamps>r)){t.next=10;break}return this.__startTimeStamps=o,t.next=5,U(i,n);case 5:a=t.sent,e.setState("status",a.status),"live"===a.status&&e.setState("sessionId",a.sessionId),this.getPlayerCore().events.emit(xt.API_STATUS_CHANGE,a);case 10:case"end":return t.stop()}}),t,this)})))}),1e3)}},{key:"stopPolling",value:function(){this.__pollingInterval>0&&(clearInterval(this.__pollingInterval),this.__pollingInterval=0)}},{key:"destroy",value:function(){this.stopPolling()}}])}();!function(t){t.UNKNOWN="000",t.UN_LEGAL="001",t.ACCOUNT_ABNORMAL="002",t.CONFIG_LOAD_FAIL="011"}(It||(It={}));var Tt,Dt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"__getRestrictJson",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.getPlayerCore(),r=e.getConfig(),n=r.uid,i=r.cid,t.abrupt("return",N(n,i));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"__getBackupRestrictJson",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.getPlayerCore(),r=e.getConfig(),n=r.uid,i=r.cid,t.abrupt("return",R(n,i));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"checkCanWatch",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.getPlayerCore().events,t.prev=1,t.prev=2,t.next=5,this.__getRestrictJson();case 5:r=t.sent,t.next=13;break;case 8:return t.prev=8,t.t0=t.catch(2),t.next=12,this.__getBackupRestrictJson();case 12:r=t.sent;case 13:if(r){t.next=16;break}throw e.emit(xt.ERROR,{code:It.CONFIG_LOAD_FAIL}),new Error("获取限制信息失败");case 16:if(r.canWatch){t.next=19;break}throw e.emit(xt.ERROR,{code:"".concat(r.errorCode||It.UNKNOWN).replace("LIVE-#","")}),new Error("您没有权限观看此频道");case 19:t.next=24;break;case 21:throw t.prev=21,t.t1=t.catch(1),t.t1;case 24:case"end":return t.stop()}}),t,this,[[1,21],[2,8]])})))}}])}(),Ot={exports:{}};
6
+ /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
7
+ Tt=Ot,function(){function t(t){return parseInt(t)===t}function e(e){if(!t(e.length))return!1;for(var r=0;r<e.length;r++)if(!t(e[r])||e[r]<0||e[r]>255)return!1;return!0}function r(r,n){if(r.buffer&&"Uint8Array"===r.name)return n&&(r=r.slice?r.slice():Array.prototype.slice.call(r)),r;if(Array.isArray(r)){if(!e(r))throw new Error("Array contains invalid value: "+r);return new Uint8Array(r)}if(t(r.length)&&e(r))return new Uint8Array(r);throw new Error("unsupported array-like object")}function n(t){return new Uint8Array(t)}function i(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var o,a={toBytes:function(t){var e=[],n=0;for(t=encodeURI(t);n<t.length;){var i=t.charCodeAt(n++);37===i?(e.push(parseInt(t.substr(n,2),16)),n+=2):e.push(i)}return r(e)},fromBytes:function(t){for(var e=[],r=0;r<t.length;){var n=t[r];n<128?(e.push(String.fromCharCode(n)),r++):n>191&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},s=(o="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},fromBytes:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];e.push(o[(240&n)>>4]+o[15&n])}return e.join("")}}),c={16:10,24:12,32:14},u=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],l=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],f=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],v=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],y=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],g=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],d=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],m=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],C=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],w=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],b=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function k(t){for(var e=[],r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}var E=function(t){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:r(t,!0)}),this._prepare()};E.prototype._prepare=function(){var t=c[this.key.length];if(null==t)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var e=0;e<=t;e++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(t+1),i=this.key.length/4,o=k(this.key);for(e=0;e<i;e++)r=e>>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var a,s=0,h=i;h<n;){if(a=o[i-1],o[0]^=l[a>>16&255]<<24^l[a>>8&255]<<16^l[255&a]<<8^l[a>>24&255]^u[s]<<24,s+=1,8!=i)for(e=1;e<i;e++)o[e]^=o[e-1];else{for(e=1;e<i/2;e++)o[e]^=o[e-1];for(a=o[i/2-1],o[i/2]^=l[255&a]^l[a>>8&255]<<8^l[a>>16&255]<<16^l[a>>24&255]<<24,e=i/2+1;e<i;e++)o[e]^=o[e-1]}for(e=0;e<i&&h<n;)f=h>>2,p=h%4,this._Ke[f][p]=o[e],this._Kd[t-f][p]=o[e++],h++}for(var f=1;f<t;f++)for(var p=0;p<4;p++)a=this._Kd[f][p],this._Kd[f][p]=C[a>>24&255]^w[a>>16&255]^b[a>>8&255]^S[255&a]},E.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],i=k(t),o=0;o<4;o++)i[o]^=this._Ke[0][o];for(var a=1;a<e;a++){for(o=0;o<4;o++)r[o]=f[i[o]>>24&255]^p[i[(o+1)%4]>>16&255]^v[i[(o+2)%4]>>8&255]^y[255&i[(o+3)%4]]^this._Ke[a][o];i=r.slice()}var s,c=n(16);for(o=0;o<4;o++)s=this._Ke[e][o],c[4*o]=255&(l[i[o]>>24&255]^s>>24),c[4*o+1]=255&(l[i[(o+1)%4]>>16&255]^s>>16),c[4*o+2]=255&(l[i[(o+2)%4]>>8&255]^s>>8),c[4*o+3]=255&(l[255&i[(o+3)%4]]^s);return c},E.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],i=k(t),o=0;o<4;o++)i[o]^=this._Kd[0][o];for(var a=1;a<e;a++){for(o=0;o<4;o++)r[o]=g[i[o]>>24&255]^d[i[(o+3)%4]>>16&255]^_[i[(o+2)%4]>>8&255]^m[255&i[(o+1)%4]]^this._Kd[a][o];i=r.slice()}var s,c=n(16);for(o=0;o<4;o++)s=this._Kd[e][o],c[4*o]=255&(h[i[o]>>24&255]^s>>24),c[4*o+1]=255&(h[i[(o+3)%4]>>16&255]^s>>16),c[4*o+2]=255&(h[i[(o+2)%4]>>8&255]^s>>8),c[4*o+3]=255&(h[255&i[(o+1)%4]]^s);return c};var P=function(t){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new E(t)};P.prototype.encrypt=function(t){if((t=r(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=n(t.length),o=n(16),a=0;a<t.length;a+=16)i(t,o,0,a,a+16),i(o=this._aes.encrypt(o),e,a);return e},P.prototype.decrypt=function(t){if((t=r(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=n(t.length),o=n(16),a=0;a<t.length;a+=16)i(t,o,0,a,a+16),i(o=this._aes.decrypt(o),e,a);return e};var x=function(t,e){if(!(this instanceof x))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=n(16);this._lastCipherblock=r(e,!0),this._aes=new E(t)};x.prototype.encrypt=function(t){if((t=r(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=n(t.length),o=n(16),a=0;a<t.length;a+=16){i(t,o,0,a,a+16);for(var s=0;s<16;s++)o[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(o),i(this._lastCipherblock,e,a)}return e},x.prototype.decrypt=function(t){if((t=r(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=n(t.length),o=n(16),a=0;a<t.length;a+=16){i(t,o,0,a,a+16),o=this._aes.decrypt(o);for(var s=0;s<16;s++)e[a+s]=o[s]^this._lastCipherblock[s];i(t,this._lastCipherblock,0,a,a+16)}return e};var A=function(t,e,i){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 size)")}else e=n(16);i||(i=1),this.segmentSize=i,this._shiftRegister=r(e,!0),this._aes=new E(t)};A.prototype.encrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var e,n=r(t,!0),o=0;o<n.length;o+=this.segmentSize){e=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[o+a]^=e[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(n,this._shiftRegister,16-this.segmentSize,o,o+this.segmentSize)}return n},A.prototype.decrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var e,n=r(t,!0),o=0;o<n.length;o+=this.segmentSize){e=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[o+a]^=e[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(t,this._shiftRegister,16-this.segmentSize,o,o+this.segmentSize)}return n};var I=function(t,e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=n(16);this._lastPrecipher=r(e,!0),this._lastPrecipherIndex=16,this._aes=new E(t)};I.prototype.encrypt=function(t){for(var e=r(t,!0),n=0;n<e.length;n++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),e[n]^=this._lastPrecipher[this._lastPrecipherIndex++];return e},I.prototype.decrypt=I.prototype.encrypt;var L=function(t){if(!(this instanceof L))throw Error("Counter must be instanitated with `new`");0===t||t||(t=1),"number"==typeof t?(this._counter=n(16),this.setValue(t)):this.setBytes(t)};L.prototype.setValue=function(t){if("number"!=typeof t||parseInt(t)!=t)throw new Error("invalid counter value (must be an integer)");if(t>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var e=15;e>=0;--e)this._counter[e]=t%256,t=parseInt(t/256)},L.prototype.setBytes=function(t){if(16!=(t=r(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},L.prototype.increment=function(){for(var t=15;t>=0;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var T=function(t,e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof L||(e=new L(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new E(t)};T.prototype.encrypt=function(t){for(var e=r(t,!0),n=0;n<e.length;n++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),e[n]^=this._remainingCounter[this._remainingCounterIndex++];return e},T.prototype.decrypt=T.prototype.encrypt;var D={AES:E,Counter:L,ModeOfOperation:{ecb:P,cbc:x,cfb:A,ofb:I,ctr:T},utils:{hex:s,utf8:a},padding:{pkcs7:{pad:function(t){var e=16-(t=r(t,!0)).length%16,o=n(t.length+e);i(t,o);for(var a=t.length;a<o.length;a++)o[a]=e;return o},strip:function(t){if((t=r(t,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=t[t.length-1];if(e>16)throw new Error("PKCS#7 padding byte out of range");for(var o=t.length-e,a=0;a<e;a++)if(t[o+a]!==e)throw new Error("PKCS#7 invalid padding byte");var s=n(o);return i(t,s,0,0,o),s}}},_arrayTest:{coerceArray:r,createArray:n,copyArray:i}};Tt.exports=D}();var Rt=Ot.exports;function Nt(t){for(var e,r,n=[],i=0;i<t.length;i++){e=t.charCodeAt(i),r=[];do{r.push(255&e),e>>=8}while(e);n=n.concat(r.reverse())}return n.length<16?n=[].concat(l(n),l(new Array(16-n.length).fill(0))):n.length>16&&(n=n.slice(0,16)),n}var Mt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"getChannelJson",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.getPlayerCore(),r=e.getConfig(),n=r.uid,i=r.cid,t.prev=2,t.next=5,M(n,i);case 5:o=t.sent,t.next=13;break;case 8:return t.prev=8,t.t0=t.catch(2),t.next=12,j(n,i);case 12:o=t.sent;case 13:if(!(o.code>=200&&o.code<400)){t.next=20;break}return(a=this.__decryptChannelData(o.body)).lines&&a.lines.forEach((function(t){t.multirateModel&&Array.isArray(t.multirateModel.definitions)&&t.multirateModel.definitions.reverse()})),e.store.setState("channelConfig",a),this.getPlayerCore().events.emit(xt.UPDATE_CHANNEL_JSON,a),t.abrupt("return",a);case 20:case"end":return t.stop()}}),t,this,[[2,8]])})))}},{key:"__decryptChannelData",value:function(t){var e=Rt.utils.hex.toBytes(t),r=new Rt.ModeOfOperation.cbc(Nt(function(){for(var t="divcss".charCodeAt(0),e=[12,11,8,21,18,8,5,18,1,44,45,46,47,48,49,50,10,11,12,3,7,8,17,2],r="",n=0;n<16;n++){var i=void 0;i=n>8?t-e[n]:t+e[n],r+=String.fromCharCode(i)}return r}()),Nt("1111000011110010")).decrypt(e),n=Rt.utils.utf8.fromBytes(r),i=kt(n);return JSON.parse(i)}},{key:"__checkAccount",value:function(t){if(!/NORMAL|TRIAL/.test(t))throw this.getPlayerCore().events.emit(xt.ERROR,{code:It.ACCOUNT_ABNORMAL}),new Error("账号异常")}},{key:"getChannelJsonAndStoreConfig",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i,o,a,s=this;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){throw s.getPlayerCore().events.emit(xt.ERROR,{code:It.UN_LEGAL}),new Error("获取频道配置失败")},t.prev=1,t.next=4,this.getChannelJson();case 4:if(r=t.sent){t.next=8;break}return e(),t.abrupt("return");case 8:return this.__checkAccount(r.channelRestrictModel.userStatus),n=this.getPlayerCore(),i=n.lineControl,o=n.levelControl,a=n.quickControl,i.setInitDefaultLine(),o.setInitDefaultLevel(),a.setInitDefaultPlayCore(),t.abrupt("return",r);case 17:t.prev=17,t.t0=t.catch(1),e();case 20:case"end":return t.stop()}}),t,this,[[1,17]])})))}}])}(),jt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"check",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n,i,o,a,s,u,l,h,f,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,e=this.getPlayerCore(),r=e.store,n=e.getConfig(),i=n.auth,o=n.cid,a=n.xAuthToken,s=i.appId,u=i.sign,l=i.timestamp,!a){t.next=12;break}return t.next=8,y(E,{token:a,channelId:o});case 8:f=t.sent,h=f.data,t.next=16;break;case 12:return t.next=14,O({appId:s,sign:u,timestamp:l,channelId:o});case 14:p=t.sent,h=p.data;case 16:r.setState("detailConfig",h),t.next=24;break;case 19:throw t.prev=19,t.t0=t.catch(0),this.getPlayerCore().events.emit(xt.ERROR,{code:It.UN_LEGAL}),new Error("Auth play failed");case 24:case"end":return t.stop()}}),t,this,[[0,19]])})))}}])}(),Ut=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"getWarmSetting",value:function(){var t=this.getPlayerCore().store.getState("channelConfig")||{},e=t.coverImage,r=t.warmUpFlv;if(e||r)return{playType:e?g.WARM_IMAGE:g.WARM_VIDEO,src:e||r||""}}}])}(),Bt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"getLiveSrc",value:function(){var t=this.getPlayerCore(),e=t.lineControl,r=t.levelControl,n=t.quickControl,i="";return i=e.getSrcFromLine(i),i=r.getSrcFromLevel(i),i=n.getSrcFromQuick(i)}},{key:"resetLatestPlayUrl",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e,r,n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.getPlayerCore(),r=e.store,n=e.channel,r.getState("playType")===g.LIVE){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,n.getChannelJson();case 6:e.updatePlayerInfo();case 7:case"end":return t.stop()}}),t,this)})))}}])}(),Ft=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"getPlaybackSetting",value:function(){var t=this.getPlayerCore().store.getState("channelConfig")||{},e=t.recordFileUrl,r=t.recordFileM3u8Url,n=t.recordFileDuration,i=t.recordFileSessionId;if(e||r)return{playType:g.VOD,src:e||r||"",duration:n,sessionId:i||""}}}])}(),zt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"getLineSetting",value:function(){var t=(this.getPlayerCore().store.getState("channelConfig")||{}).lines;return t?t.reduce((function(t,e,r){return t.push({type:"LINE".concat(r),line:r}),t}),[]):[]}},{key:"setInitDefaultLine",value:function(){var t=this.getPlayerCore(),e=t.store,r=Et(t.config.line||0,0,this.getLineSetting().length-1);e.setState("currentLine",r)}},{key:"changeLine",value:function(t){var e=this.getPlayerCore(),r=e.store,n=e.events;if(r.getState("currentLine")!==t){var i=this.getLineSetting();0===i.length||i.length<=t||(r.setState("currentLine",t),this.getPlayerCore().updatePlayerInfo(),n.emit(xt.LINE_CHANGE,{line:t}))}}},{key:"getSrcFromLine",value:function(t){var e=this.getPlayerCore().store,r=this.getPlayerCore().config.forceVideo,n=e.getState("currentLine")||0,i=(e.getState("channelConfig")||{}).lines;return i&&0!==i.length?r?i[n].m3u8:i[n].flv:t}}])}(),Vt=function(){function t(){var n;return r(this,t),(n=e(this,t,arguments)).definitionMap={"流畅":"SD","高清":"HD","超清":"FHD"},n}return a(t,v),i(t,[{key:"getLevelSetting",value:function(){var t=this,e=this.getPlayerCore().store,r=(e.getState("channelConfig")||{}).lines,n=e.getState("currentLine")||0;return r&&0!==r.length&&r[n]&&r[n].multirateModel&&r[n].multirateModel.definitions?r[n].multirateModel.definitions.reduce((function(e,r,n){var i=t.definitionMap[r.definition]||r.definition;return e.push({type:d[i],level:n}),e}),[]):[]}},{key:"setInitDefaultLevel",value:function(){var t=this.getPlayerCore(),e=t.store,r=t.config.level,n=e.getState("currentLine")||0;if(void 0===r){var i=this.getDefaultLevelIndexByLineIndex(n);e.setState("currentLevel",i)}else{var o=Et(r||0,0,this.getLevelSetting().length-1);e.setState("currentLevel",o)}}},{key:"getDefaultLevelIndexByLineIndex",value:function(t){var e,r,n=(this.getPlayerCore().store.getState("channelConfig")||{}).lines;if(!(n&&0!==n.length&&n[t]&&n[t].multirateModel&&n[t].multirateModel.definitions))return 0;var i=null===(e=n[t].multirateModel)||void 0===e?void 0:e.defaultDefinition;return i?null===(r=n[t].multirateModel)||void 0===r?void 0:r.definitions.findIndex((function(t){return t.definition===i})):0}},{key:"changeLevel",value:function(t){var e=this.getPlayerCore(),r=e.store,n=e.events;if(r.getState("currentLevel")!==t){var i=this.getLevelSetting();0===i.length||i.length<=t||(r.setState("currentLevel",t),this.getPlayerCore().updatePlayerInfo(),n.emit(xt.LEVEL_CHANGE,{level:t}))}}},{key:"getSrcFromLevel",value:function(t){var e,r,n=this.getPlayerCore().store,i=this.getPlayerCore().config.forceVideo,o=n.getState("currentLine")||0,a=n.getState("currentLevel")||0;if(0===this.getLevelSetting().length)return t;var s=(n.getState("channelConfig")||{}).lines;return s&&0!==s.length?i?null===(e=s[o].multirateModel)||void 0===e?void 0:e.definitions[a].m3u8:null===(r=s[o].multirateModel)||void 0===r?void 0:r.definitions[a].url:t}}])}(),Gt=function(){function t(){return r(this,t),e(this,t,arguments)}return a(t,v),i(t,[{key:"canUseQuick",value:function(){var t=this.getPlayerCore().store.getState("detailConfig");if(!t)return!1;var e=t.pureRtcAvailState,r=t.quickLiveEnabled;return"trtc"===t.rtcType&&"Y"===e&&"Y"===r}},{key:"canQuickSupport",value:function(){return!0}},{key:"getSrcFromQuick",value:function(t){if(!this.canUseQuick()||!this.canQuickSupport())return t;var e=this.getPlayerCore().store,r=e.getState("currentPlayCore")||0;if(0===r)return t;var n=this.getPlayCoreSetting();if(n[r]&&n[r].enabled){var i=(e.getState("channelConfig")||{}).lines;if(!i||0===i.length)return t;var o=i[0],a=o.quickLiveUrl;if("Y"===o.quickLiveEnabled)return a||t;e.setState("currentPlayCore",0)}return t}},{key:"getPlayCoreSetting",value:function(){var t=[{type:_.CDN,core:0,enabled:!0}];return this.canUseQuick()&&this.canQuickSupport()&&t.push({type:_.QUICK,core:1,enabled:!0}),t}},{key:"setInitDefaultPlayCore",value:function(){var t=this.getPlayerCore(),e=t.store;t.config.playCore;var r=this.getPlayCoreSetting();e.setState("currentPlayCore",r.length>1?1:0)}},{key:"changePlayCore",value:function(t){var e=this.getPlayCoreSetting(),r=t<e.length,n=e[t]&&e[t].enabled;if(r&&n){var i=this.getPlayerCore();i.store.setState("currentPlayCore",t),i.updatePlayerInfo()}}},{key:"setLivePlayerStateChange",value:function(t){var e=t.detail.code,r=this.getPlayerCore().store,n=r.getState("currentPlayCore");-2301!==e&&-2302!==e||1!==n||r.getState("playType")!==g.LIVE||(this.getPlayerCore().events.emit(xt.ERROR),this.changePlayCore(0))}}])}(),Kt=function(){function t(){var n;return r(this,t),(n=e(this,t,arguments)).__timer=0,n}return a(t,v),i(t,[{key:"start",value:function(){if(this.__stopTimer(),this.isStartCheck()){var t=this.getPlayerCore();this.__timer=setTimeout((function(){t.live.resetLatestPlayUrl()}),this.__getPullTime())}}},{key:"isStartCheck",value:function(){var t=this.getPlayerCore().store,e=t.getState("playType"),r=t.getState("currentUrl"),n=e===g.LIVE,i="m3u8"===((r||"").split("?")[0].split(".").pop()||"").toLowerCase();return n&&i}},{key:"__getPullTime",value:function(){var t=(this.getPlayerCore().store.getState("channelConfig")||{}).aliPullProtectExpTime;if(!t)return 18e5;var e=1e3*t;return t<600?e:e-(Math.floor(24e4*Math.random())+6e4)}},{key:"__stopTimer",value:function(){this.__timer&&(clearInterval(this.__timer),this.__timer=0)}}])}(),$t={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||t,a),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],s]:t._events[c].push(s):(t._events[c]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},s.prototype.emit=function(t,e,n,i,o,a){var s=r?r+t:t;if(!this._events[s])return!1;var c,u,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,i),!0;case 5:return l.fn.call(l.context,e,n,i,o),!0;case 6:return l.fn.call(l.context,e,n,i,o,a),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var f,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,n);break;case 4:l[u].fn.call(l[u].context,e,n,i);break;default:if(!c)for(f=1,c=new Array(h-1);f<h;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0},s.prototype.on=function(t,e,r){return o(this,t,e,r,!1)},s.prototype.once=function(t,e,r){return o(this,t,e,r,!0)},s.prototype.removeListener=function(t,e,n,i){var o=r?r+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],l=s.length;c<l;c++)(s[c].fn!==e||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,t.exports=s}($t);var Ht,Wt=$t.exports;!function(t){t.LIVE="live",t.END="end",t.STOP="stop"}(Ht||(Ht={}));var Yt=function(){return i((function t(e){r(this,t),this.config=e,this.store=new p,this.events=new Wt,this.auth=new jt(this),this.restrict=new Dt(this),this.channel=new Mt(this),this.status=new Lt(this),this.statistics=new At(this),this.warm=new Ut(this),this.live=new Bt(this),this.playback=new Ft(this),this.quickControl=new Gt(this),this.lineControl=new zt(this),this.levelControl=new Vt(this),this.monitor=new Kt(this),this.__hasTriggerReady=!1,this.config=e,this.initStore()}),[{key:"initStore",value:function(){this.store.setState("playerConfig",this.config)}},{key:"getConfig",value:function(){return this.config}},{key:"updatePlayerInfo",value:function(){var t=this.store,e=this.config,r=e.vodSrc,n=e.vodDuration,i=e.statistics,o=e.isAutoChange,a=this.playback.getPlaybackSetting(),s=this.warm.getWarmSetting();r?(t.setState("sessionId",(null==i?void 0:i.sessionId)||""),this.__emitTypeChangeEvent(g.VOD,r,n)):t.getState("status")===Ht.LIVE?this.__emitTypeChangeEvent(g.LIVE,this.live.getLiveSrc()):!0===o&&a?(t.setState("sessionId",a.sessionId),this.__emitTypeChangeEvent(a.playType,a.src,a.duration)):s?this.__emitTypeChangeEvent(s.playType,s.src):this.__emitTypeChangeEvent(g.WAIT_START,""),this.monitor.start()}},{key:"__emitTypeChangeEvent",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.store,i=this.events;n.setState("playType",t),n.setState("currentUrl",e),this.__hasTriggerReady||(this.__hasTriggerReady=!0,i.emit(xt.READY)),i.emit(xt.PLAY_TYPE_CHANGE,t);var o,a,s,c=this.statistics,u=c.pid,l=c.playDuration,h=this.config.statistics,f=(o=e,a="client=".concat(Pt('"webapp_sdk_live"'),"-").concat(Pt('"3.0.0"'),"&pid=").concat(u,"&param1=").concat((null==h?void 0:h.param1)||"","&pd=").concat(l),"".concat(o).concat(o.indexOf("?")>-1?"&":"?").concat(a));s={type:t,src:t===g.LIVE||t===g.VOD?f:e};var p=n.getState("currentPlayCore");t===g.LIVE&&(s=Object.assign(Object.assign({},s),{lines:1===p?null:{options:this.lineControl.getLineSetting(),active:n.getState("currentLine")},levels:1===p?null:{options:this.levelControl.getLevelSetting(),active:n.getState("currentLevel")},playCores:{options:this.quickControl.getPlayCoreSetting(),active:n.getState("currentPlayCore")}})),t===g.VOD&&(s=Object.assign(Object.assign({},s),{duration:r})),i.emit(xt.UPDATE_MEDIA_INFO,s)}},{key:"destroy",value:function(){this.status&&this.status.destroy(),this.statistics&&this.statistics.destroy()}}])}(),qt=function(){return i((function t(e){r(this,t),this.__inited=!1,this.__playerCore=new Yt(e)}),[{key:"setUp",value:function(){return f(this,void 0,void 0,c().mark((function t(){var e;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.__inited){t.next=3;break}throw new Error("Player has been inited");case 3:return this.__inited=!0,e=this.__playerCore,t.next=7,e.auth.check();case 7:return t.next=9,e.restrict.checkCanWatch();case 9:return t.next=11,e.channel.getChannelJsonAndStoreConfig();case 11:e.status.startPolling();case 12:case"end":return t.stop()}}),t,this)})))}},{key:"getPlayType",value:function(){var t;return null===(t=this.__playerCore)||void 0===t?void 0:t.store.getState("playType")}},{key:"refresh",value:function(){this.__playerCore.live.resetLatestPlayUrl()}},{key:"setStatics",value:function(t){this.__playerCore.statistics.setStatics(t)}},{key:"startCountPd",value:function(){this.__playerCore.statistics.startCountPd()}},{key:"stopCountPd",value:function(){this.__playerCore.statistics.stopCountPd()}},{key:"changeLine",value:function(t){this.__playerCore.lineControl.changeLine(t)}},{key:"changeLevel",value:function(t){this.__playerCore.levelControl.changeLevel(t)}},{key:"changePlayCore",value:function(t){this.__playerCore.quickControl.changePlayCore(t)}},{key:"setLivePlayerStateChange",value:function(t){this.__playerCore.quickControl.setLivePlayerStateChange(t)}},{key:"on",value:function(t,e){this.__playerCore.events.on(t,e)}},{key:"off",value:function(t,e){this.__playerCore.events.off(t,e)}},{key:"destroy",value:function(){this.__playerCore.destroy()}}])}();export{Ht as ApiStatus,d as LevelType,_ as PlayCoreType,g as PlayType,xt as PlayerEventsType,qt as default};