@oxiaom/adoremix-linux-x64 1.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.
Files changed (262) hide show
  1. package/index.js +24 -0
  2. package/native/.adoremix-native.json +1 -0
  3. package/native/AdoreMixV8.0.17_console_linuxx64 +0 -0
  4. package/native/README.md +20 -0
  5. package/native/audio/libqtaudio_alsa.so +0 -0
  6. package/native/audio/libqtmedia_pulse.so +0 -0
  7. package/native/bearer/libqconnmanbearer.so +0 -0
  8. package/native/bearer/libqgenericbearer.so +0 -0
  9. package/native/bearer/libqnmbearer.so +0 -0
  10. package/native/etc/Demo1.ini +49 -0
  11. package/native/etc/docroot/bangzhu/.project +22 -0
  12. package/native/etc/docroot/bangzhu/css/app.css +21 -0
  13. package/native/etc/docroot/bangzhu/css/feedback.css +131 -0
  14. package/native/etc/docroot/bangzhu/css/icons-extra.css +63 -0
  15. package/native/etc/docroot/bangzhu/css/mui.dtpicker.css +136 -0
  16. package/native/etc/docroot/bangzhu/css/mui.imageviewer.css +123 -0
  17. package/native/etc/docroot/bangzhu/css/mui.indexedlist.css +112 -0
  18. package/native/etc/docroot/bangzhu/css/mui.listpicker.css +95 -0
  19. package/native/etc/docroot/bangzhu/css/mui.min.css +5 -0
  20. package/native/etc/docroot/bangzhu/css/mui.picker.all.css +285 -0
  21. package/native/etc/docroot/bangzhu/css/mui.picker.css +85 -0
  22. package/native/etc/docroot/bangzhu/css/mui.picker.min.css +7 -0
  23. package/native/etc/docroot/bangzhu/css/mui.poppicker.css +64 -0
  24. package/native/etc/docroot/bangzhu/examples/accordion.html +125 -0
  25. package/native/etc/docroot/bangzhu/examples/actionsheet-plus.html +128 -0
  26. package/native/etc/docroot/bangzhu/examples/actionsheet.html +153 -0
  27. package/native/etc/docroot/bangzhu/examples/ad.html +47 -0
  28. package/native/etc/docroot/bangzhu/examples/ajax.html +155 -0
  29. package/native/etc/docroot/bangzhu/examples/badges.html +54 -0
  30. package/native/etc/docroot/bangzhu/examples/beecloud.html +150 -0
  31. package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/detail.html +104 -0
  32. package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/list-to-detail.css +160 -0
  33. package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/listview.html +326 -0
  34. package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/vue.min.js +8 -0
  35. package/native/etc/docroot/bangzhu/examples/buttons-with-badges.html +48 -0
  36. package/native/etc/docroot/bangzhu/examples/buttons-with-block.html +50 -0
  37. package/native/etc/docroot/bangzhu/examples/buttons-with-icons.html +68 -0
  38. package/native/etc/docroot/bangzhu/examples/buttons-with-loading.html +86 -0
  39. package/native/etc/docroot/bangzhu/examples/buttons.html +89 -0
  40. package/native/etc/docroot/bangzhu/examples/card.html +97 -0
  41. package/native/etc/docroot/bangzhu/examples/checkbox.html +68 -0
  42. package/native/etc/docroot/bangzhu/examples/clouddb_wilddog.html +268 -0
  43. package/native/etc/docroot/bangzhu/examples/date.html +88 -0
  44. package/native/etc/docroot/bangzhu/examples/dialog.html +82 -0
  45. package/native/etc/docroot/bangzhu/examples/dtpicker.html +129 -0
  46. package/native/etc/docroot/bangzhu/examples/echarts.html +150 -0
  47. package/native/etc/docroot/bangzhu/examples/feedback.html +72 -0
  48. package/native/etc/docroot/bangzhu/examples/grid-default.html +61 -0
  49. package/native/etc/docroot/bangzhu/examples/grid-pagination.html +266 -0
  50. package/native/etc/docroot/bangzhu/examples/guide.html +269 -0
  51. package/native/etc/docroot/bangzhu/examples/icons-extra.html +161 -0
  52. package/native/etc/docroot/bangzhu/examples/icons.html +182 -0
  53. package/native/etc/docroot/bangzhu/examples/im-chat.html +711 -0
  54. package/native/etc/docroot/bangzhu/examples/imageviewer-native.html +90 -0
  55. package/native/etc/docroot/bangzhu/examples/imageviewer.html +197 -0
  56. package/native/etc/docroot/bangzhu/examples/indexed-list-select.html +459 -0
  57. package/native/etc/docroot/bangzhu/examples/indexed-list.html +265 -0
  58. package/native/etc/docroot/bangzhu/examples/info.html +119 -0
  59. package/native/etc/docroot/bangzhu/examples/input.html +108 -0
  60. package/native/etc/docroot/bangzhu/examples/lazyload-image.html +73 -0
  61. package/native/etc/docroot/bangzhu/examples/list-triplex-row.html +115 -0
  62. package/native/etc/docroot/bangzhu/examples/list-with-input.html +91 -0
  63. package/native/etc/docroot/bangzhu/examples/locker-dom.html +85 -0
  64. package/native/etc/docroot/bangzhu/examples/login.html +83 -0
  65. package/native/etc/docroot/bangzhu/examples/media-list.html +220 -0
  66. package/native/etc/docroot/bangzhu/examples/message-bottom.html +87 -0
  67. package/native/etc/docroot/bangzhu/examples/modals.html +45 -0
  68. package/native/etc/docroot/bangzhu/examples/nav-nativeObj.html +45 -0
  69. package/native/etc/docroot/bangzhu/examples/nav.html +135 -0
  70. package/native/etc/docroot/bangzhu/examples/nav_transparent.html +127 -0
  71. package/native/etc/docroot/bangzhu/examples/nav_transparent_native.html +121 -0
  72. package/native/etc/docroot/bangzhu/examples/numbox.html +114 -0
  73. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-down.html +384 -0
  74. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left-plus-main.html +293 -0
  75. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left-plus-menu.html +102 -0
  76. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left.html +228 -0
  77. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right-plus-main.html +292 -0
  78. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right-plus-menu.html +111 -0
  79. package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right.html +220 -0
  80. package/native/etc/docroot/bangzhu/examples/pagination.html +236 -0
  81. package/native/etc/docroot/bangzhu/examples/picker.html +159 -0
  82. package/native/etc/docroot/bangzhu/examples/popovers.html +200 -0
  83. package/native/etc/docroot/bangzhu/examples/progressbar.html +171 -0
  84. package/native/etc/docroot/bangzhu/examples/pullrefresh.html +86 -0
  85. package/native/etc/docroot/bangzhu/examples/pullrefresh_main.html +46 -0
  86. package/native/etc/docroot/bangzhu/examples/pullrefresh_sub.html +101 -0
  87. package/native/etc/docroot/bangzhu/examples/pullrefresh_with_tab.html +586 -0
  88. package/native/etc/docroot/bangzhu/examples/radio.html +93 -0
  89. package/native/etc/docroot/bangzhu/examples/range.html +89 -0
  90. package/native/etc/docroot/bangzhu/examples/setting.html +910 -0
  91. package/native/etc/docroot/bangzhu/examples/slider-default.html +98 -0
  92. package/native/etc/docroot/bangzhu/examples/slider-native.html +43 -0
  93. package/native/etc/docroot/bangzhu/examples/slider-table-default.html +62 -0
  94. package/native/etc/docroot/bangzhu/examples/slider-table-pagination.html +74 -0
  95. package/native/etc/docroot/bangzhu/examples/slider-with-title.html +99 -0
  96. package/native/etc/docroot/bangzhu/examples/switches.html +92 -0
  97. package/native/etc/docroot/bangzhu/examples/tab-top-subpage-1.html +131 -0
  98. package/native/etc/docroot/bangzhu/examples/tab-top-subpage-2.html +131 -0
  99. package/native/etc/docroot/bangzhu/examples/tab-top-subpage-3.html +56 -0
  100. package/native/etc/docroot/bangzhu/examples/tab-top-subpage-4.html +110 -0
  101. package/native/etc/docroot/bangzhu/examples/tab-top-subpage-5.html +131 -0
  102. package/native/etc/docroot/bangzhu/examples/tab-top-webview-main.html +183 -0
  103. package/native/etc/docroot/bangzhu/examples/tab-vertical-scroll.html +170 -0
  104. package/native/etc/docroot/bangzhu/examples/tab-webview-main.html +112 -0
  105. package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-about.html +38 -0
  106. package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-chat.html +127 -0
  107. package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-contact.html +155 -0
  108. package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-setting.html +79 -0
  109. package/native/etc/docroot/bangzhu/examples/tab-with-segmented-control-vertical.html +85 -0
  110. package/native/etc/docroot/bangzhu/examples/tab-with-segmented-control.html +195 -0
  111. package/native/etc/docroot/bangzhu/examples/tab-with-viewpagerindicator.html +203 -0
  112. package/native/etc/docroot/bangzhu/examples/tabbar-labels-only.html +44 -0
  113. package/native/etc/docroot/bangzhu/examples/tabbar-with-submenus.html +75 -0
  114. package/native/etc/docroot/bangzhu/examples/tabbar.html +247 -0
  115. package/native/etc/docroot/bangzhu/examples/tableviews-with-badges.html +78 -0
  116. package/native/etc/docroot/bangzhu/examples/tableviews-with-collapses.html +83 -0
  117. package/native/etc/docroot/bangzhu/examples/tableviews-with-swipe.html +184 -0
  118. package/native/etc/docroot/bangzhu/examples/tableviews.html +87 -0
  119. package/native/etc/docroot/bangzhu/examples/typography.html +41 -0
  120. package/native/etc/docroot/bangzhu/fonts/mui-icons-extra.ttf +0 -0
  121. package/native/etc/docroot/bangzhu/fonts/mui.ttf +0 -0
  122. package/native/etc/docroot/bangzhu/images/60x60.gif +0 -0
  123. package/native/etc/docroot/bangzhu/images/cbd.jpg +0 -0
  124. package/native/etc/docroot/bangzhu/images/login-1.png +0 -0
  125. package/native/etc/docroot/bangzhu/images/logo.png +0 -0
  126. package/native/etc/docroot/bangzhu/images/muwu.jpg +0 -0
  127. package/native/etc/docroot/bangzhu/images/qrcode.png +0 -0
  128. package/native/etc/docroot/bangzhu/images/shuijiao.jpg +0 -0
  129. package/native/etc/docroot/bangzhu/images/yuantiao.jpg +0 -0
  130. package/native/etc/docroot/bangzhu/index-menu.html +196 -0
  131. package/native/etc/docroot/bangzhu/index.html +414 -0
  132. package/native/etc/docroot/bangzhu/js/95516.js +32 -0
  133. package/native/etc/docroot/bangzhu/js/arttmpl.js +2 -0
  134. package/native/etc/docroot/bangzhu/js/beecloud.js +141 -0
  135. package/native/etc/docroot/bangzhu/js/city.data-3.js +11548 -0
  136. package/native/etc/docroot/bangzhu/js/city.data.js +1605 -0
  137. package/native/etc/docroot/bangzhu/js/feedback.js +234 -0
  138. package/native/etc/docroot/bangzhu/js/mui.dtpicker.js +471 -0
  139. package/native/etc/docroot/bangzhu/js/mui.imageViewer.js +268 -0
  140. package/native/etc/docroot/bangzhu/js/mui.indexedlist.js +187 -0
  141. package/native/etc/docroot/bangzhu/js/mui.js +8390 -0
  142. package/native/etc/docroot/bangzhu/js/mui.lazyload.img.js +116 -0
  143. package/native/etc/docroot/bangzhu/js/mui.lazyload.js +327 -0
  144. package/native/etc/docroot/bangzhu/js/mui.listpicker.js +399 -0
  145. package/native/etc/docroot/bangzhu/js/mui.locker.js +303 -0
  146. package/native/etc/docroot/bangzhu/js/mui.min.js +6 -0
  147. package/native/etc/docroot/bangzhu/js/mui.picker.all.js +1018 -0
  148. package/native/etc/docroot/bangzhu/js/mui.picker.js +389 -0
  149. package/native/etc/docroot/bangzhu/js/mui.picker.min.js +7 -0
  150. package/native/etc/docroot/bangzhu/js/mui.poppicker.js +160 -0
  151. package/native/etc/docroot/bangzhu/js/mui.previewimage.js +382 -0
  152. package/native/etc/docroot/bangzhu/js/mui.pullToRefresh.js +407 -0
  153. package/native/etc/docroot/bangzhu/js/mui.pullToRefresh.material.js +352 -0
  154. package/native/etc/docroot/bangzhu/js/mui.view.js +628 -0
  155. package/native/etc/docroot/bangzhu/js/mui.zoom.js +322 -0
  156. package/native/etc/docroot/bangzhu/js/update.js +45 -0
  157. package/native/etc/docroot/bangzhu/js/webviewGroup.js +286 -0
  158. package/native/etc/docroot/bangzhu/libs/echarts-all.js +35 -0
  159. package/native/etc/docroot/bangzhu/manifest.json +994 -0
  160. package/native/etc/docroot/index.html +1 -0
  161. package/native/etc/docroot/luyin2/index.html +145 -0
  162. package/native/etc/docroot/luyin2/js/jquery-1.10.1.min.js +6 -0
  163. package/native/etc/docroot/luyin2/js/jquery-1.5.min.js +16 -0
  164. package/native/etc/docroot/luyin2/js/jquery.js +18 -0
  165. package/native/etc/docroot/luyin2/js/jquery.multiselect.js +104 -0
  166. package/native/etc/docroot/luyin2/js/lame.min.js +308 -0
  167. package/native/etc/docroot/luyin2/js/recordmp3.js +239 -0
  168. package/native/etc/docroot/luyin2/js/worker-realtime.js +106 -0
  169. package/native/etc/docroot/luyin2//346/223/215/344/275/234/346/214/207/345/215/227.txt +3 -0
  170. package/native/etc/docroot/static/css/app.8421a6d597ba48619941ccd4e386fbb2.css +675 -0
  171. package/native/etc/docroot/static/css/app.8421a6d597ba48619941ccd4e386fbb2.css.map +1 -0
  172. package/native/etc/docroot/static/fonts/element-icons.535877f.woff +0 -0
  173. package/native/etc/docroot/static/fonts/element-icons.732389d.ttf +0 -0
  174. package/native/etc/docroot/static/img/login_bg.ad6b482.jpg +0 -0
  175. package/native/etc/docroot/static/js/app.eff1c2200a448936b027.js +2 -0
  176. package/native/etc/docroot/static/js/app.eff1c2200a448936b027.js.map +1 -0
  177. package/native/etc/docroot/static/js/manifest.400eada2d24447a4fc30.js +2 -0
  178. package/native/etc/docroot/static/js/manifest.400eada2d24447a4fc30.js.map +1 -0
  179. package/native/etc/docroot/static/js/vendor.ca4f735ec1dfe336a804.js +45 -0
  180. package/native/etc/docroot/static/js/vendor.ca4f735ec1dfe336a804.js.map +1 -0
  181. package/native/etc/docroot/tts.js +151 -0
  182. package/native/etc/docroot/xcx/Discover.html +156 -0
  183. package/native/etc/docroot/xcx/css/mui.css +5649 -0
  184. package/native/etc/docroot/xcx/css/mui.min.css +5 -0
  185. package/native/etc/docroot/xcx/devicelist.html +659 -0
  186. package/native/etc/docroot/xcx/fonts/mui.ttf +0 -0
  187. package/native/etc/docroot/xcx/index.html +75 -0
  188. package/native/etc/docroot/xcx/index.js +1 -0
  189. package/native/etc/docroot/xcx/js/axios.min.js +3 -0
  190. package/native/etc/docroot/xcx/js/axios.min.map +1 -0
  191. package/native/etc/docroot/xcx/js/js.cookie.js +8 -0
  192. package/native/etc/docroot/xcx/js/mui.js +8390 -0
  193. package/native/etc/docroot/xcx/js/mui.min.js +6 -0
  194. package/native/etc/docroot/xcx/main.html +85 -0
  195. package/native/etc/ssl/README.txt +5 -0
  196. package/native/etc/ssl/ca.crt +21 -0
  197. package/native/etc/ssl/ca.key +27 -0
  198. package/native/etc/ssl/client.crt +20 -0
  199. package/native/etc/ssl/client.key +28 -0
  200. package/native/etc/ssl/client.p12 +0 -0
  201. package/native/etc/ssl/server.crt +20 -0
  202. package/native/etc/ssl/server.key +28 -0
  203. package/native/etc/templates/demo-de.tpl +12 -0
  204. package/native/etc/templates/demo.tpl +12 -0
  205. package/native/etc/ttys/adore03.sql +426 -0
  206. package/native/etc/ttys/adore04.sql +426 -0
  207. package/native/etc/ttys/adore1.sql +859 -0
  208. package/native/etc/ttys/adore_mix22.sql +806 -0
  209. package/native/etc/ttys/sqlite.sql +1140 -0
  210. package/native/etc/ttys/sqlite3main.sql +434 -0
  211. package/native/etc/ttys/sqltest.sql +279 -0
  212. package/native/etc/ttys/tp3sql.sql +1412 -0
  213. package/native/find.js +529 -0
  214. package/native/findsc.js +701 -0
  215. package/native/iconengines/libqsvgicon.so +0 -0
  216. package/native/imageformats/libqgif.so +0 -0
  217. package/native/imageformats/libqico.so +0 -0
  218. package/native/imageformats/libqjpeg.so +0 -0
  219. package/native/imageformats/libqsvg.so +0 -0
  220. package/native/lib/libQt5Concurrent.so.5 +0 -0
  221. package/native/lib/libQt5Core.so.5 +0 -0
  222. package/native/lib/libQt5DBus.so.5 +0 -0
  223. package/native/lib/libQt5Multimedia.so.5 +0 -0
  224. package/native/lib/libQt5MultimediaGstTools.so.5 +0 -0
  225. package/native/lib/libQt5Network.so.5 +0 -0
  226. package/native/lib/libQt5Sql.so.5 +0 -0
  227. package/native/lib/libQt5Svg.so.5 +0 -0
  228. package/native/lib/libQt5WebSockets.so.5 +0 -0
  229. package/native/lib/libQt5Xml.so.5 +0 -0
  230. package/native/lib/libcrypto.so.3 +0 -0
  231. package/native/lib/libgcc_s.so.1 +0 -0
  232. package/native/lib/libmariadb.so.3 +0 -0
  233. package/native/lib/libmp3lame.so.0 +0 -0
  234. package/native/lib/libmp3lame.so.0.0.0 +0 -0
  235. package/native/lib/libopus.so.0 +0 -0
  236. package/native/lib/libopus.so.0.8.0 +0 -0
  237. package/native/lib/libopusfile.so.0 +0 -0
  238. package/native/lib/libopusfile.so.0.4.2 +0 -0
  239. package/native/lib/libopusurl.so.0 +0 -0
  240. package/native/lib/libopusurl.so.0.4.2 +0 -0
  241. package/native/lib/libsqlite3.so.0 +0 -0
  242. package/native/lib/libsqlite3.so.0.8.6 +0 -0
  243. package/native/lib/libssl.so.3 +0 -0
  244. package/native/lib/libstdc++.so.6 +0 -0
  245. package/native/lib/libstdc++.so.6.0.30 +0 -0
  246. package/native/mediaservice/libgstaudiodecoder.so +0 -0
  247. package/native/mediaservice/libgstcamerabin.so +0 -0
  248. package/native/mediaservice/libgstmediacapture.so +0 -0
  249. package/native/mediaservice/libgstmediaplayer.so +0 -0
  250. package/native/platforms/libqeglfs.so +0 -0
  251. package/native/platforms/libqlinuxfb.so +0 -0
  252. package/native/platforms/libqminimal.so +0 -0
  253. package/native/platforms/libqminimalegl.so +0 -0
  254. package/native/platforms/libqoffscreen.so +0 -0
  255. package/native/platforms/libqvnc.so +0 -0
  256. package/native/platforms/libqxcb.so +0 -0
  257. package/native/qt.conf +3 -0
  258. package/native/sqldrivers/libqsqlite.so +0 -0
  259. package/native/sqldrivers/libqsqlmysql.so +0 -0
  260. package/native/sqldrivers/libsqlitecipher.so +0 -0
  261. package/native/tts.js +151 -0
  262. package/package.json +23 -0
@@ -0,0 +1,2 @@
1
+ webpackJsonp([1],{"0YRJ":function(e,t){},Bugp:function(e,t){},C8EH:function(e,t){},"D/H6":function(e,t){},DYiY:function(e,t){},F2H3:function(e,t){},H7kg:function(e,t){},JzLO:function(e,t){},NHnr:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});s("tvR6");var i=s("7+uW"),a={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{attrs:{id:"app"}},[t("router-view")],1)},staticRenderFns:[]};var n=s("VU/8")({name:"app",data:function(){return{msg:"Welcome to Your Vue.js App"}}},a,!1,function(e){s("H7kg")},null,null).exports,r=s("/ocq"),o=s("mtWM"),l=(s("mw3O"),{data:function(){return{input_passwd:"",input_username:""}},created:function(){if(this.Pass&&this.Phone){sessionStorage.removeItem("token");var e=hpps1+"user/checkin.boxuds",t=this.Phone,s=this.Pass;o.a.post(e,{action:"user/checkin",params:{login_id:t,passwd:s,type:0}},{headers:{"Content-Type":"application/json"}}).then(function(e){8200==e.data.code?(console.log(e.data.result.token),sessionStorage.setItem("token",e.data.result.token),this.$router.push({path:"/"})):alert(e.data.msg)}.bind(this)).catch(function(e){alert("error: "+e)})}console.log(this.$router.currentRoute.query.username),console.log(this.$router.currentRoute.query.passwd),void 0!=this.$router.currentRoute.query.passwd&&void 0!=this.$router.currentRoute.query.passwd?(console.log("传参传入了账号密码"),o.a.postForm("user/fnkukei/gtoken",{params:{passwd:this.$router.currentRoute.query.passwd,username:this.$router.currentRoute.query.username}}).then(function(e){e.data.res?(sessionStorage.setItem("token",e.data.data.token),sessionStorage.setItem("username",e.data.data.user_name),sessionStorage.setItem("id",e.data.data.id),sessionStorage.setItem("passwd",e.data.data.user_pass),sessionStorage.setItem("user_type",e.data.data.user_type),sessionStorage.setItem("master_id",e.data.data.master_id),sessionStorage.setItem("mask",e.data.data.mask),sessionStorage.setItem("play_level",e.data.data.play_level),sessionStorage.setItem("user_level",e.data.data.user_level),sessionStorage.setItem("nickname",e.data.data.nickname),-99==e.data.data.master_id?this.$router.push({path:"/mglg"}):this.$router.push({path:"/mgll"}),this.$notify.success({title:"Info",message:"验证通过",showClose:!1})):this.$notify.success({title:"Info",message:"验证不通过",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})):console.log("没有传入账号密码")},methods:{loginii:function(){var e=new FormData;e.append("username",this.input_username),e.append("passwd",this.input_passwd),o.a.post("user/fnkukei/gtoken",e).then(function(e){e.data.res?(sessionStorage.setItem("token",e.data.data.token),sessionStorage.setItem("username",e.data.data.user_name),sessionStorage.setItem("id",e.data.data.id),sessionStorage.setItem("passwd",e.data.data.user_pass),sessionStorage.setItem("user_type",e.data.data.user_type),sessionStorage.setItem("master_id",e.data.data.master_id),sessionStorage.setItem("mask",e.data.data.mask),sessionStorage.setItem("play_level",e.data.data.play_level),sessionStorage.setItem("user_level",e.data.data.user_level),sessionStorage.setItem("nickname",e.data.data.nickname),-99==e.data.data.master_id?this.$router.push({path:"/mglg"}):this.$router.push({path:"/mgll"}),this.$notify.success({title:"Info",message:"验证通过",showClose:!1})):this.$notify.success({title:"Info",message:"验证不通过",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}},computed:{Phone:function(){return sessionStorage.getItem("phone")},Pass:function(){return sessionStorage.getItem("pass")}}}),d={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"foo"},[s("div",{attrs:{id:"fucklogin"}},[s("el-row",{staticClass:"fucko"},[s("el-col",{attrs:{span:18}},[s("h2",{staticClass:"title"},[e._v("ST广播系统")])])],1),e._v(" "),s("el-row",{staticClass:"fucko"},[s("el-col",{attrs:{span:18}},[s("el-input",{attrs:{placeholder:"username"},model:{value:e.input_username,callback:function(t){e.input_username=t},expression:"input_username"}},[s("template",{slot:"prepend"},[e._v("账号:")])],2)],1)],1),e._v(" "),s("el-row",{staticClass:"fucko"},[s("el-col",{attrs:{span:18}},[s("el-input",{attrs:{type:"password",placeholder:"password"},model:{value:e.input_passwd,callback:function(t){e.input_passwd=t},expression:"input_passwd"}},[s("template",{slot:"prepend"},[e._v("密码:")])],2),e._v(" "),s("el-button",{staticClass:"fucko",attrs:{type:"primary",plain:""},on:{click:e.loginii}},[e._v("Login[登录]")])],1)],1)],1)])},staticRenderFns:[]};var c=s("VU/8")(l,d,!1,function(e){s("mT+7")},"data-v-35a90a7a",null).exports,h={data:function(){return{showbtn:!1,login_id:sessionStorage.getItem("username"),nickname:sessionStorage.getItem("nickname")}},methods:{showxiala:function(){this.showbtn=!this.showbtn},user_logout:function(){sessionStorage.removeItem("username"),sessionStorage.removeItem("passwd"),this.$router.push({path:"/login"})}},computed:{token:function(){return sessionStorage.getItem("username")}}},u={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"righthead"},[s("div",{staticClass:"userinfo",on:{click:e.showxiala}},[e._v(e._s(e.login_id))]),e._v(" "),s("div",{staticClass:"userinfo",on:{click:e.showxiala}},[e._v(e._s(e.nickname))]),e._v(" "),e.showbtn?s("div",{staticClass:"logout",on:{click:e.user_logout}},[e._v("1退出登录")]):e._e()])},staticRenderFns:[]};var f=s("VU/8")(h,u,!1,function(e){s("k9/Y")},"data-v-01321940",null).exports,g=s("mvHQ"),p=s.n(g);o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var m=s("xrTZ").Base64,v=["启用闭合触发","启用断开触发"],y={data:function(){return{checkAll:!1,checkedCities:["启用闭合触发","启用断开触发"],cities:v,isIndeterminate:!0,tableData:[],tnodeid:0,sel1:[],sel2:[],options:[],nodeid:"",tableDatafilelist:[],warningSetList:[],warningSet:{flag:!0,seedList1:{data:[],value:[]},seedList2:{data:[],value:[]},file1:"",file2:"",portwr:"",portct:"",seed:"",ip:"",id:"",shenhe:""},quedinganqiuenable:!1,duankaienable:!0,biheenable:!0,dialogVisible_adddevice:!1}},created:function(){},methods:{handleCheckedCitiesChange:function(e){var t=e.length;console.log(e),t>0?(this.quedinganqiuenable=!1,2==t?(this.duankaienable=!0,this.biheenable=!0):"启用闭合触发"==e[0]?(console.log("danbihe"),this.biheenable=!0,this.duankaienable=!1):(console.log("danduankai"),this.biheenable=!1,this.duankaienable=!0)):(this.quedinganqiuenable=!0,this.biheenable=!1,this.duankaienable=!1)},shenhechange:function(e,t){console.log(e+" "+t)},enablechange:function(e,t){console.log(e+" "+t);var s=0;if(2==e)s=1;else{if(0!=e)return;s=3}o.a.get("/Warningeable.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),enable:s,id:t}}).then(function(e){e.data.res&&(this.reflash_devlist(),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},enablechange_file:function(e,t){console.log(e+" "+t);var s=0;if(2==e)s=1;else{if(0!=e)return;s=3}o.a.get("/Warningeable_savefile.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),enable:s,id:t}}).then(function(e){e.data.res?(this.$message({type:"success",message:"文件生成成功;快到媒体资源->文件列表里面 启用吧~!"}),this.reflash_devlist(),this.$forceUpdate()):this.$message({type:"warning",message:"已经生成了有对应报警联动配置音频素材;不要再点了;快到媒体资源->文件列表里面 启用吧"})}.bind(this)).catch(function(e){console.log(e)})},nodechange_:function(){o.a.get("/get_user_nodedevws.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),nodeid:this.nodeid}}).then(function(e){e.data.res&&(this.warningSet.seedList1.data=e.data.dev_info,this.warningSet.seedList2.data=e.data.dev_info,this.warningSet.ip=e.data.nodeip,this.warningSet.portwr=e.data.nodeport6,this.warningSet.portct=e.data.nodeport3,this.warningSet.seedList1.value=[],this.warningSet.seedList2.value=[],console.log("----------------"),console.log(this.nodeid),console.log(this.tnodeid),console.log(this.sel1),console.log(this.sel2),this.nodeid==this.tnodeid?(this.warningSet.seedList1.value=this.sel1,this.warningSet.seedList2.value=this.sel2):(this.warningSet.seedList1.value=[],this.warningSet.seedList2.value=[]),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},handleChange1:function(e,t,s){console.log(this.warningSet.seedList2.value)},handleChange2:function(e,t,s){console.log(this.warningSet.seedList1.value)},reflash_nodeinfo:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.options=e.data.outlableid,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_nodeinfosss:function(e){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(t){t.data.res&&(this.options=t.data.outlableid,this.nodeid=e,this.nodechange_(),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},goEdit:function(e,t){this.get_file_list(),this.warningSet.seed=t[e].seed,this.warningSet.portwr=t[e].portwr,this.warningSet.id=t[e].id,console.log(t[e].nodeid),this.nodeid=t[e].nodeid,this.warningSet.seed=t[e].seed;var s=JSON.parse(t[e].cmd1),i=JSON.parse(t[e].cmd2);this.sel1=s.snlist,this.checkedCities=[],0==this.sel1.length?this.biheenable=!1:(this.checkedCities.push("启用闭合触发"),this.biheenable=!0),this.sel2=i.snlist,0==this.sel2.length?this.duankaienable=!1:(this.checkedCities.push("启用断开触发"),this.duankaienable=!0),this.tnodeid=t[e].play_nodeid,this.reflash_nodeinfosss(this.tnodeid),this.dialogVisible_adddevice=!0},edit:function(){var e,t;if(console.log("edit1"),""!=this.warningSet.seed)if(console.log("edit2"),""!=this.warningSet.portwr)if(console.log("edit3"),""!=this.nodeid)if(console.log("edit4"),0!=this.duankaienable||0!=this.biheenable){if(this.duankaienable){if(""==this.warningSet.file2||0==this.warningSet.seedList2.value.length)return void this.$message({type:"warning",message:"断开模式不能为空"});(t={cmd:"PLAYOFF",snlist:this.warningSet.seedList2.value,filelist:[]}).filelist[0]=this.warningSet.file2}if(console.log("edit6"),this.biheenable){if(""==this.warningSet.file1||0==this.warningSet.seedList1.value.length)return void this.$message({type:"warning",message:"闭合模式不能为空"});(e={cmd:"PLAYOFF",snlist:this.warningSet.seedList1.value,filelist:[]}).filelist[0]=this.warningSet.file1}console.log("edit7"),this.duankaienable||((t={cmd:"CANCEL",snlist:[],filelist:[]}).filelist[0]="http://xx.xxx.xx.xx"),this.biheenable||((e={cmd:"CANCEL",snlist:[],filelist:[]}).filelist[0]="http://xx.xxx.xx.xx"),console.log("edit8"),console.log(this.warningSet.seedList1.value),console.log(this.warningSet.seedList2.value);var s=new FormData;s.append("username",sessionStorage.getItem("username")),s.append("passwd",sessionStorage.getItem("passwd")),s.append("user_id",sessionStorage.getItem("id")),s.append("enable",0),s.append("portwr",this.warningSet.portwr),s.append("portct",this.warningSet.portct),s.append("seed",this.warningSet.seed),s.append("ip",this.warningSet.ip),s.append("cmd1",p()(e)),s.append("cmd2",p()(t)),s.append("id",this.warningSet.id),s.append("play_nodeid",this.nodeid),o.a.post("/warningset.php",s).then(function(e){e.data.res?(console.log(e.data),this.$forceUpdate(),this.$notify.success({title:"Info",message:"编辑成功",showClose:!1}),this.reflash_devlist()):this.$notify.success({title:"Info",message:"编辑出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice=!1}else console.log("edit5");else this.$message({type:"warning",message:"播放服务不能为空"});else this.$message({type:"warning",message:"报警端口不能为空"});else this.$message({type:"warning",message:"报警设备不能为空"})},putMode:function(){var e=this,t=document.getElementById("transfer1"),s=document.getElementById("transfer2");this.warningSet.flag?(setTimeout(function(){e.warningSet.flag=!1,t.style.transform="rotateY(0deg)"},500),t.style.transition="all 0.5s linear",t.style.transform="rotateY(345deg)"):(setTimeout(function(){e.warningSet.flag=!0,s.style.transform="rotateY(0deg)"},500),s.style.transition="all 0.5s linear",s.style.transform="rotateY(345deg)")},reflash_devlist:function(){},reflash_devlist2:function(){this.warningSet.seedList=[],o.a.get("/get_devicelistweb.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){if(e.data.res){this.tableData=e.data.dataJson;for(var t=[],s=0;s<this.tableData.length;s++)t.push({key:this.tableData[s].seed,label:this.tableData[s].name});this.warningSet.seedList1.data=t,this.warningSet.seedList2.data=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})},get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){if(e.data.res){var t=e.data.file;t.forEach(function(e,t){e.filename=m.decode(e.filename),e.filesize=e.filesize}),this.tableDatafilelist=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})}}},b={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmg"}},[s("el-table",{staticStyle:{width:"1050px"},attrs:{data:e.warningSetList,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",label:"编号",width:"50"}}),e._v(" "),s("el-table-column",{attrs:{prop:"update",label:"最后更新时间",width:"150"}}),e._v(" "),s("el-table-column",{attrs:{prop:"count",label:"报警播放次数",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{prop:"seed",label:"关联通道编码",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"device_name",label:"设备名字",width:"150"}}),e._v(" "),s("el-table-column",{attrs:{prop:"enable",label:"操作",width:"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"success",icon:"el-icon-save",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.enablechange_file(e.warningSetList[t.$index].enable,e.warningSetList[t.$index].id)}}},[e._v("生成报警配置文件")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作",align:"center",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"warning",icon:"el-icon-edit",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goEdit(t.$index,e.warningSetList)}}},[e._v("编辑")])]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:"报警设置",visible:e.dialogVisible_adddevice,width:"800px"},on:{"update:visible":function(t){e.dialogVisible_adddevice=t}}},[s("el-form",{ref:"form",attrs:{"label-width":"80px",align:"left"}},[s("el-form-item",{attrs:{label:"播放节点 :"}},[s("el-select",{staticStyle:{width:"150px"},attrs:{placeholder:"选择网络节点"},on:{change:e.nodechange_},model:{value:e.nodeid,callback:function(t){e.nodeid=t},expression:"nodeid"}},e._l(e.options,function(t){return s("el-option",{key:t.label,attrs:{label:t.label,value:t.id}},[s("span",{staticStyle:{float:"left"}},[e._v(e._s(t.label))]),e._v(" "),s("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[e._v(e._s(t.nodeip))])])}),1)],1),e._v(" "),s("el-checkbox-group",{on:{change:e.handleCheckedCitiesChange},model:{value:e.checkedCities,callback:function(t){e.checkedCities=t},expression:"checkedCities"}},e._l(e.cities,function(t){return s("el-checkbox",{key:t,attrs:{label:t}},[e._v(e._s(t))])}),1),e._v(" "),s("div",{directives:[{name:"show",rawName:"v-show",value:e.biheenable,expression:"biheenable"}],staticStyle:{"text-align":"left"},attrs:{id:"transfer1"}},[s("h3",{staticStyle:{margin:"20px 0 20px"}},[e._v("输入闭合触发")]),e._v(" "),s("el-form-item",{attrs:{label:"文件选择 :"}},[s("el-select",{attrs:{placeholder:"请选择报警文件"},model:{value:e.warningSet.file1,callback:function(t){e.$set(e.warningSet,"file1",t)},expression:"warningSet.file1"}},e._l(e.tableDatafilelist,function(e,t){return s("el-option",{key:t,staticStyle:{width:"300px"},attrs:{label:e.filename,value:e.url}})}),1)],1),e._v(" "),s("el-transfer",{staticStyle:{display:"inline-block"},attrs:{filterable:"",titles:["Source","Target"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.warningSet.seedList1.data},on:{change:e.handleChange2},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.warningSet.seedList1.value,callback:function(t){e.$set(e.warningSet.seedList1,"value",t)},expression:"warningSet.seedList1.value"}})],1),e._v(" "),s("div",{directives:[{name:"show",rawName:"v-show",value:e.duankaienable,expression:"duankaienable"}],staticStyle:{"text-align":"left"},attrs:{id:"transfer2"}},[s("h3",{staticStyle:{margin:"20px 0 20px"}},[e._v("输入断开报触发")]),e._v(" "),s("el-form-item",{attrs:{label:"文件选择 :"}},[s("el-select",{attrs:{placeholder:"请选择报警文件"},model:{value:e.warningSet.file2,callback:function(t){e.$set(e.warningSet,"file2",t)},expression:"warningSet.file2"}},e._l(e.tableDatafilelist,function(e,t){return s("el-option",{key:t,staticStyle:{width:"300px"},attrs:{label:e.filename,value:e.url}})}),1)],1),e._v(" "),s("el-transfer",{staticStyle:{display:"inline-block"},attrs:{filterable:"",titles:["Source","Target"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.warningSet.seedList2.data},on:{change:e.handleChange1},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.warningSet.seedList2.value,callback:function(t){e.$set(e.warningSet.seedList2,"value",t)},expression:"warningSet.seedList2.value"}})],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_adddevice=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary",disabled:e.quedinganqiuenable},on:{click:e.edit}},[e._v("确定")])],1)],1)],1)},staticRenderFns:[]};var _=s("VU/8")(y,b,!1,function(e){s("zSuI")},"data-v-7ad345e8",null).exports,k=s("Ixwk"),T=s.n(k);o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var S=s("xrTZ").Base64,w={components:{"a-player":T.a},data:function(){return{flag:!1,actions:"",diantailen:60,actionsmp3:"",diantaidialogVisible:!1,userid:0,fileList:[],tableDatafilelist:[],songList:[],diantaiurl:"",diantainame:"",autoplay:!1,isroot:!1,options:[{value:"选项1",label:"黄金糕"},{value:"选项2",label:"双皮奶"},{value:"选项3",label:"蚵仔煎"},{value:"选项4",label:"龙须面"},{value:"选项5",label:"北京烤鸭"}],uploaddata:{}}},created:function(){this.userid=sessionStorage.getItem("id"),this.actions="/user/uploadfile",this.get_file_list(),-1==sessionStorage.getItem("master_id")?this.isroot=!0:this.isroot=!1},methods:{uploadbefore:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),this.uploaddata.id=sessionStorage.getItem("id"),this.uploaddata.token=sessionStorage.getItem("token"),this.uploaddata.name=t,s||i?!!a||(this.$message({message:"上传文件大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MP3格式!",type:"warning"}),!1)},click_shenqingdiantai:function(){if(!(this.diantaiurl.length<10||this.diantailen<60||this.diantailen>3600||0==this.diantainame.length)){var e=S.encode(this.diantaiurl),t=S.encode(this.diantainame);o.a.get("/uploader_fordiantai.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3",len:this.diantailen,url:e,name:t}}).then(function(e){e.data.res?(this.$message({type:"success",message:"添加成功!"+this.diantainame}),this.diantaidialogVisible=!1,this.get_file_list()):(this.$message({type:"warming",message:"添加失败!检查是否已重复添加及规范"+this.diantainame}),this.diantaidialogVisible=!1)}.bind(this)).catch(function(e){console.log(e)})}},playurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},downloadurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},deleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该文件, 是否继续? "+t[e].filename,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("fileid",t[e].id),o.a.post("/user/delfile",i).then(function(s){s.data.res&&(t.splice(e,1),this.get_file_list(),this.$message({type:"success",message:"删除成功!"+filename}))}.bind(s)).catch(function(e){console.log(e)})}).catch(function(){s.$message({type:"info",message:"已取消删除"})})},uploadError:function(e,t,s){this.$message({message:"上传文件出错了!",type:"error"})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},shelltask:function(e,t){console.log("fuckser"),o.a.get("/Change_fenxiang_status.php",{params:{file_id:t[e].id,ziuse:t[e].ziuse}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},uploadbeforemp3:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),s||i?!!a||(this.$message({message:"上传文件大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MP3格式!",type:"warning"}),!1)},uploadSuccess:function(e,t,s){1==e.res?(this.$message({message:"文件上传成功!",type:"success"}),this.get_file_list()):this.$message({message:"文件上传失败!【可能已经上上传过了这个文件,也可能是这个文件不能被正常解析】"+e.info,type:"warning"})},uploadSuccessmp3:function(e,t,s){console.log("上传文件",e),this.get_file_list()},get_file_list:function(){sessionStorage.getItem("master_id")>0&&(this.isroot=!1);var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listfile",e).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.filelist,console.log(this.tableDatafilelist),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},E={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("div",{attrs:{id:"uoloaddiv33",align:"left"}},[s("el-upload",{staticClass:"upload-demo",attrs:{action:e.actions,onSuccess:e.uploadSuccess,"on-error":e.uploadError,"before-upload":e.uploadbefore,"file-list":e.fileList,data:e.uploaddata}},[s("el-button",{attrs:{id:"topbuttn",size:"big",icon:"el-icon-upload2",type:"primary"}},[e._v("点击上传 只能上传Mp3文件,且单个文件不超过15M【文件上传解析校验会持续比较久耐心等待】")]),e._v(" "),s("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"})],1),e._v(" "),s("el-button",{attrs:{size:"big"},on:{click:e.get_file_list}},[e._v(" 刷新文件列表 ")]),e._v(" "),s("div",{staticStyle:{padding:"10px 0"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"1000px"},attrs:{data:e.tableDatafilelist,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"编号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filename",label:"文件名",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"sizeStr",label:"文件大小",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{label:"试听",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.playurl(t.$index,e.tableDatafilelist)}}},[e._v("播放")]),e._v(" "),s("el-link",{attrs:{href:e.tableDatafilelist[t.$index].url,type:"success"}},[e._v("右键另存为")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{disabled:1==e.tableDatafilelist[t.$index].ismasterd,type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.deleteRow(t.$index,e.tableDatafilelist)}}},[e._v("移除")])]}}])})],1)],1)])},staticRenderFns:[]};var I=s("VU/8")(w,E,!1,function(e){s("C8EH")},"data-v-62b83de0",null).exports,D=s("zL8q"),A=s.n(D),L={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticStyle:{"margin-left":"10px"}},[s("el-row",[s("el-col",{attrs:{span:20}},[s("el-transfer",{staticStyle:{"text-align":"left",display:"inline-block"},attrs:{titles:["所有文件","播放文件"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.inputList,props:e.alias,"target-order":"push"},on:{"right-check-change":e.rightCheck,"left-check-change":e.leftCheck,change:e.chnage},model:{value:e.outputListTemp,callback:function(t){e.outputListTemp=t},expression:"outputListTemp"}})],1),e._v(" "),s("el-col",{staticStyle:{"margin-top":"95px"},attrs:{span:2}},[s("div",{staticStyle:{"margin-bottom":"10px"}},[s("el-button",{attrs:{icon:"el-icon-arrow-up",circle:"",disabled:e.upDownDisable},on:{click:e.upData}})],1),e._v(" "),s("div",[s("el-button",{attrs:{icon:"el-icon-arrow-down",circle:"",disabled:e.upDownDisable},on:{click:e.downData}})],1),e._v(" "),s("div",[s("el-button",{attrs:{icon:"el-icon-arrow-down",circle:"",disabled:e.upDownDisable},on:{click:e.doubleit}},[e._v("Double")])],1)])],1)],1)},staticRenderFns:[]},R=s("VU/8")({name:"myTransfer",props:["value","inputList","alias"],data:function(){return{upDownDisable:!0,tempSelectionKeys:[],outputListTemp:[]}},watch:{value:function(e){this.outputListTemp=e},outputListTemp:function(e){this.$emit("input",e)}},mounted:function(){},methods:{chnage:function(){this.$emit("countLength")},leftCheck:function(e,t){this.$emit("countLength")},rightCheck:function(e,t){this.$emit("countLength"),this.tempSelectionKeys=e,e.length>0?this.upDownDisable=!1:this.upDownDisable=!0},upData:function(){if(this.tempSelectionKeys.length>1)this.$message({type:"warning",message:"仅支持单选调顺序"});else for(var e=0,t=0;t<this.tempSelectionKeys.length;t++)(e=this.outputListTemp.indexOf(this.tempSelectionKeys[t]))>0&&(this.outputListTemp.splice(e-1,0,this.tempSelectionKeys[t]),this.outputListTemp.splice(e+1,1))},doubleit:function(){if(this.tempSelectionKeys.length>1)this.$message({type:"warning",message:"仅支持单选调顺序"});else for(var e=0;e<this.tempSelectionKeys.length;e++)this.outputListTemp.push(this.tempSelectionKeys[e])},downData:function(){if(this.tempSelectionKeys.length>1)this.$message({type:"warning",message:"仅支持单选调顺序"});else for(var e=0,t=0;t<this.tempSelectionKeys.length;t++)(e=this.outputListTemp.indexOf(this.tempSelectionKeys[t]))>-1&&e!=this.outputListTemp.length-1&&(this.outputListTemp.splice(e+2,0,this.tempSelectionKeys[t]),this.outputListTemp.splice(e,1))}}},L,!1,null,null,null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var x=s("xrTZ").Base64,C=new Date;var P={data:function(){return{options_taskgroup:[{value:0,label:"全部任务分组[ALLtaskGP]"}],loading2:!1,nums:1,falss:!1,dialogVisible_addtaskgroup:!1,dialogVisible_edgtaskgroup:!1,taskgroupv:0,taskgroupvv:0,localtime:"111",systemtime:"2222",edgtaskid:0,edgtaskname:"",NewtaskGoupname:"",loading:!1,tableDatatasklist:[],dialogVisible_addtask:!1,dialog_titel:"创建任务",checked1:"",checked2:"",is_create:!0,upDownDisable:!0,tempSelectionKeys:[],outputListTemp:[],week:[!0,!0,!0,!0,!0,!0,!0],form:{id:"",name:"",nodeid:"",startDate:"",endDate:"",estartDate:0,eendDate:0,kind:"1",num:1,startTime:{},timepicker:new Array(new Date,new Date),len:0,nsptime:"2022-01-01 00:00:00",jiange:1,weekStr:"",seedlist:{data:[],value:[]},filelist:{data:[],value:[]},taskEnable:"1",isedit_mode:!1},tableData1:[],tableData2:[],tableDatafilelist:[],taskgpnamelist:[],pickerOptions1:{shortcuts:[{text:"今天",onClick:function(e){e.$emit("pick",new Date)}},{text:"一周后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+6048e5),e.$emit("pick",t)}},{text:"一个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+2592e6),e.$emit("pick",t)}},{text:"二个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+5184e6),e.$emit("pick",t)}},{text:"三个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+78624e5),e.$emit("pick",t)}},{text:"六个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+157248e5),e.$emit("pick",t)}},{text:"十二个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+31536e6),e.$emit("pick",t)}}]},pickerOptions2:{shortcuts:[{text:"今天",onClick:function(e){e.$emit("pick",new Date)}},{text:"一周后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+6048e5),e.$emit("pick",t)}},{text:"一个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+2592e6),e.$emit("pick",t)}},{text:"二个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+5184e6),e.$emit("pick",t)}},{text:"三个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+78624e5),e.$emit("pick",t)}},{text:"六个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+157248e5),e.$emit("pick",t)}},{text:"十二个月后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+31536e6),e.$emit("pick",t)}}]}}},watch:{"form.filelist.value":{deep:!0,handler:function(e,t){this.countLength()}}},created:function(){var e=this;this._get_timer_tasklist(),this.get_taskgroup_ap(),self.setInterval(function(){var t=new Date;e.localtime=t.toString()},1e3),self.setInterval(function(){var t,s;e.systemtime=(t=e.systemtime,s=new Date(t),C.setTime(s.getTime()+1e3),C.toString())},1e3)},components:{myTransfer:R},methods:{edit_task_enddate:function(){var e="0000-00-00";this.checked2&&void 0!==this.form.endDate?e=this.form.endDate.getFullYear()+"-"+(this.form.endDate.getMonth()+1)+"-"+this.form.endDate.getDate():console.log("enddate:undefined"),console.log("enddate:"+e),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),t.append("enddate",e),o.a.post("/user/edit_task",t).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_task_startdate:function(){var e="0000-00-00";this.checked1&&void 0!==this.form.startDate?e=this.form.startDate.getFullYear()+"-"+this.form.startDate.getMonth()+"-"+this.form.startDate.getDate():console.log("startDate:undefined"),console.log("startdate:"+e),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),t.append("startdate",e),o.a.post("/user/edit_task",t).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_tasksj_len:function(){if(console.log(this.form.kind),console.log(this.form.num),"0"==this.form.kind){var e=this.form.timepicker[0].getTime()/1e3,t=this.form.timepicker[1].getTime()/1e3-e;if(!(t<100)){console.log("sjlen:"+this.form.len),this.loading2=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("taskid",this.form.id),s.append("len",t),o.a.post("/user/edit_task",s).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})}}},task_cishu:function(){this.form.num<2&&(this.form.num=1),console.log("num:"+this.form.num),this.loading2=!0;var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("taskid",this.form.id),e.append("kind",this.form.num),this.form.num>0&&e.append("len",this.form.len),o.a.post("/user/edit_task",e).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_taskjiange:function(){this.form.jiange<2&&(this.form.jiange=2),console.log("jiange"+this.form.jiange),this.loading2=!0;var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("taskid",this.form.id),e.append("jiange",this.form.jiange),this.form.num>0&&e.append("len",this.form.len),o.a.post("/user/edit_task",e).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res,setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_taskweeks:function(){this.form.weekStr="";for(var e=0;e<this.week.length;e++)this.week[e]?this.form.weekStr+="1":this.form.weekStr+="0";console.log("weekStr"+this.form.weekStr),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),t.append("week",this.form.weekStr),o.a.post("/user/edit_task",t).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_taskstarttime:function(){console.log("task_starttime"+this.form.startTime);var e=this.form.startTime.getHours()+":"+this.form.startTime.getMinutes()+":"+this.form.startTime.getSeconds();console.log(e),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),t.append("start_time",e),o.a.post("/user/edit_task",t).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},edit_taskname:function(){if(console.log("taskid"+this.form.id),!(this.form.name.length<2)){this.loading2=!0;var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("taskid",this.form.id),e.append("task_name",this.form.name),o.a.post("/user/edit_task",e).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})}},get_nowtask_detail:function(e){console.log("taskid"+this.form.id),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),o.a.post("/user/getone_task",t).then(function(e){var t=this;e.data.res&&(console.log(e.data),this.form.filelist.value=[],this.form.seedlist.value=[],e.data.devlistary.length>0&&e.data.devlistary.forEach(function(e,s){t.form.seedlist.value.push(e.devseedid)}),e.data.filelistary.length>0&&e.data.filelistary.forEach(function(e,s){t.form.filelist.value.push(e.id)})),setTimeout(function(){t.loading2=!1},1e3)}.bind(this)).catch(function(e){console.log(e)})},go_edit_task:function(e,t){this.form.isedit_mode=!0,console.log(t[e]),this.form.id=t[e].id,this.form.name=t[e].task_name,this.form.nodeid=t[e].nodeid,0==t[e].kind?this.form.kind="0":this.form.kind="1",this.form.num=t[e].kind,this.form.len=t[e].len,this.form.jiange=t[e].jiange,this.form.taskEnable=t[e].enable,this.is_create=!1,"无限制"==t[e].startdate_?this.checked1=!1:(this.checked1=!0,this.form.startDate=t[e].startdate_),"无限制"==t[e].enddate_?this.checked2=!1:(this.checked2=!0,this.form.endDate=t[e].enddate_);var s=new Date,i=s.getFullYear()+"-"+s.getMonth()+"-"+s.getDate()+" "+t[e].tasktime,a=[];console.log(t[e].tasktime),this.form.startTime=new Date(i);var n=new Date(this.form.startTime.getTime()+1e3*parseInt(t[e].len));0==t[e].kind&&(a.push(this.form.startTime),a.push(n),this.form.timepicker=a),console.log(t[e].tasktime);for(var r=0;r<t[e].week.length;r++)0==t[e].week.charAt(r)?this.week[r]=!1:this.week[r]=!0;this.nodechange_(),this.get_file_list(),this.get_nowtask_detail(this.form.id),this.dialog_titel="修改任务","无限制"!=t[e].enddate&&(this.form.endDate=new Date(t[e].enddate+" 00:00:00")),"无限制"!=t[e].startdate&&(this.form.startDate=new Date(t[e].startdate+" 00:00:00")),this.dialogVisible_addtask=!0},stopTask:function(e,t){this.loading=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("taskid",t[e].id),o.a.post("/user/stoptask",s).then(function(e){var t=this;e.data.res&&console.log(e.data),setTimeout(function(){t.loading=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})},startTask:function(e,t){this.loading=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("taskid",t[e].id),o.a.post("/user/starttask",s).then(function(e){var t=this;e.data.res&&console.log(e.data),setTimeout(function(){t.loading=!1,t._get_timer_tasklist()},3e3)}.bind(this)).catch(function(e){console.log(e)})},edit_taskfiles:function(){if(0!=this.form.filelist.value.length){var e=[];for(var t in this.form.filelist.value)e.push(this.form.filelist.value[t]);var s=e.join("|");console.log(s),this.loading2=!0;var i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("taskid",this.form.id),i.append("fileids",s),o.a.post("/user/editfiles_task",i).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})}},edit_taskdevices:function(){if(0!=this.form.seedlist.value.length){var e=this.form.seedlist.value.join("|");console.log("seedidlist:"+e),this.loading2=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("taskid",this.form.id),t.append("snids",e),o.a.post("/user/editsns_task",t).then(function(e){var t=this;this.dialogVisible_addtask=!1,e.data.res&&console.log(e.data),setTimeout(function(){t.loading2=!1,t.dialogVisible_addtask=!1,t._get_timer_tasklist()},4e3)}.bind(this)).catch(function(e){console.log(e)})}},save_task:function(){if(""!=this.form.name)if(0!=this.form.seedlist.value.length)if(0!=this.form.filelist.value.length)if(null!=this.form.startTime&&0!=this.form.startTime)if(""!=this.form.kind){if(this.checked1)if(""!=this.form.startDate){var e=new Date(this.form.startDate);this.form.estartDate=e.getFullYear()+"-"+e.getMonth()+"-"+e.getDate()}else this.form.estartDate="";else this.form.estartDate="";if(this.checked2)if(""!=this.form.endDate){var t=new Date(this.form.endDate);this.form.eendDate=t.getFullYear()+"-"+t.getMonth()+"-"+t.getDate()}else this.form.eendDate="";else this.form.eendDate="";"1"==this.form.kind&&this.form.len<600&&(this.form.len=600),"0"==this.form.kind&&(this.Timerpickerchange2(),this.form.len<10&&(this.form.len=10),this.form.num=0);for(var s=0;s<this.week.length;s++)this.week[s]?this.week[s]=1:this.week[s]=0;this.form.weekStr="";for(s=0;s<this.week.length;s++)this.form.weekStr+=this.week[s];var i=new Date(this.form.startTime),a=i.getHours()+":"+i.getMinutes()+":"+i.getSeconds(),n=this.form.seedlist.value.join("|"),r=[];for(var s in this.form.filelist.value)r.push(this.form.filelist.value[s]);var l=r.join("|"),d=new FormData;d.append("id",sessionStorage.getItem("id")),d.append("token",sessionStorage.getItem("token")),d.append("snids",n),d.append("fileids",l),d.append("weeks",this.form.weekStr),d.append("kind",this.form.num),d.append("task_name",this.form.name),d.append("len",this.form.len),d.append("jiange",this.form.jiange),""!=this.form.estartDate&&d.append("startdate",this.form.estartDate),""!=this.form.eendDate&&d.append("enddate",this.form.eendDate),d.append("start_time",a),o.a.post("/user/add_task",d).then(function(e){e.data.res?this._get_timer_tasklist():this.$notify.success({title:"Info",message:"添加出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_addtask=!1,this.form={id:"",name:"",nodeid:"",startDate:"",endDate:"",estartDate:0,eendDate:0,kind:"1",num:1,startTime:0,len:0,weekStr:"",seedlist:{data:[],value:[]},filelist:{data:[],value:[]}}}else this.$message({type:"warning",message:"没有选择播放模式"});else this.$message({type:"warning",message:"没有选择播放开始时间"});else this.$message({type:"warning",message:"没有选择播放的音频文件"});else this.$message({type:"warning",message:"没有选择播放设备"});else this.$message({type:"warning",message:"任务名字不能为空"})},creatTask:function(){this.dialog_titel="创建任务",this.form.isedit_mode=!1,this.form.jiange=1,this.nodechange_(),this.get_file_list(),this.dialogVisible_addtask=!0,this.week=[!0,!0,!0,!0,!0,!0,!0],this.form.startDate="",this.form.endDate="",this.is_create=!0,this.form.startTime=""},get_file_list:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listfile",e).then(function(e){if(e.data.res&&(this.tableDatafilelist=e.data.filelist,this.tableDatafilelist.length>0)){var t=[];this.tableDatafilelist.forEach(function(e,s){t.push({key:e.id,label:e.filename})}),this.form.filelist.data=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})},nodechange_:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listdev",e).then(function(e){if(console.log(e.data),e.data.res){if(e.data.devlist.length>0){var t=[];e.data.devlist.forEach(function(e,s){var i={};i.device_name=e.device_name,i.device_seed=e.device_seed,i.id=e.id,i.key=e.id,i.label=e.device_name,t.push(i)}),this.form.seedlist.data=t}this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})},deletetask:function(e,t){"0"==t[e].enable?this.$confirm("此操作将永久删除该任務, 是否继续?"+t[e].task_name,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){console.log(t[e].enable);var s=t[e].id,i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("taskid",s),o.a.post("/user/del_task",i).then(function(s){s.data.res&&(t.splice(e,1),this._get_timer_tasklist(),this.$message({type:"success",message:"删除成功!"+filename}))}.bind(this)).catch(function(e){console.log(e)})}).catch(function(){}):this.$message({type:"warning",message:"请先禁用该任务"})},abletask:function(e,t){var s=t[e].id,i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("taskid",s),this.loading=!0,"1"==t[e].enable?o.a.post("/user/enabletask",i).then(function(s){this.loading=!1,s.data.res&&this.$alert("任务生效了到时间点执行自动播放","提示:"+t[e].task_name,{confirmButtonText:"确定"})}.bind(this)).catch(function(e){console.log(e)}):o.a.post("/user/disabletask",i).then(function(s){this.loading=!1,s.data.res&&this.$alert("任务停止运行,到点不会播放","提示:"+t[e].task_name,{confirmButtonText:"确定"})}.bind(this)).catch(function(e){console.log(e)})},_get_timer_tasklist:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/list_task",e).then(function(e){e.data.res&&(this.tableDatatasklist=e.data.taskary,this.tableDatatasklist.forEach(function(e,t){1==e.enable?e.enable="1":e.enable="0"}))}.bind(this)).catch(function(e){console.log(e)})},gotimesave:function(){var e=new Date;this.localtime=e.toString();e=new Date(this.localtime);console.log("=>"),console.log(e);var t=new Date(e.getTime());console.log(t.toString()),o.a.get("/save_nsptime.php?tc="+t.getTime()).then(function(e){e.data.res&&this.get_nsptime()}.bind(this)).catch(function(e){console.log(e)})},get_nsptime:function(){o.a.get("/get_nsptime.php").then(function(e){e.data.res&&(this.nsptime=e.data.time,this.systemtime=e.data.time)}.bind(this)).catch(function(e){console.log(e)})},countfuck:function(){},countLength:function(){var e=0,t=this.tableDatafilelist;this.form.filelist.value.forEach(function(s){t.forEach(function(t){t.id==s&&(e=Number(e)+Number(t.len))})});var s=Number(this.form.jiange)*Number(this.form.num);e=Number(e)*Number(this.form.num),this.form.len=Number(s)+Number(e)},Timerpickerchange:function(){console.log(this.form.startTime)},Timerpickerchange2:function(){this.form.startTime=this.form.timepicker[0];var e=new Date(this.form.timepicker[0]),t=new Date(this.form.timepicker[1]),s=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),i=3600*t.getHours()+60*t.getMinutes()+t.getSeconds();s==i?(this.$message({type:"warning",message:"随机播放开始时间不能等于结束时间"}),t.setMinutes(t.getMinutes()+10),console.log(this.form.timepicker[1]),console.log(t),this.form.timepicker[1]=t,this.form.len=600):i-s>7200?(t.setMinutes(e.getMinutes()+120),this.form.timepicker[1]=t,console.log(this.form.timepicker[0]),console.log(this.form.timepicker[1]),this.form.len=7200):this.form.len=i-s},handleTransfer:function(e,t,s){"left"==e?this.form.filelist.data=this.form.filelist.data.concat(this.form.filelist.value[t]):this.form.filelist.value=this.form.filelist.value.concat(this.form.filelist.data[t]),this[e+"Data"].splice(t,1),s(e)},handleSort:function(e,t,s,i){t&&"right"!=t?"left"==t?"up"==e?(this.form.filelist.value=this.swapItems(this.form.filelist.value,s[0],s[0]-1),i(t,[s[0]-1,s[1]])):(this.form.filelist.value=this.swapItems(this.form.filelist.value,s[0],s[0]+1),i(t,[s[0]+1,s[1]])):"both"==t&&("up"==e?(0!=s[0]&&(this.form.filelist.value=this.swapItems(this.form.filelist.value,s[0],s[0]-1)),0!=s[1]&&(this.form.filelist.data=this.swapItems(this.form.filelist.data,s[1],s[1]-1)),i(t,[0==s[0]?s[0]:s[0]-1,0==s[1]?s[1]:s[1]-1])):(s[0]!=this.form.filelist.value.length-1&&(this.form.filelist.value=this.swapItems(this.form.filelist.value,s[0],s[0]+1)),s[1]!=this.form.filelist.data.length-1&&(this.form.filelist.data=this.swapItems(this.form.filelist.data,s[1],s[1]+1)),i(t,[s[0]==this.form.filelist.value.length-1?s[0]:s[0]+1,s[1]==this.form.filelist.data.length-1?s[1]:s[1]+1]))):"up"==e?(this.form.filelist.data=this.swapItems(this.form.filelist.data,s[1],s[1]-1),i(t,[s[0],s[1]-1])):(this.form.filelist.data=this.swapItems(this.form.filelist.data,s[1],s[1]+1),i(t,[s[0],s[1]+1]))},swapItems:function(e,t,s){return e[t]=e.splice(s,1,e[t])[0],e},rightCheck:function(e,t){this.tempSelectionKeys=e,e.length>0?this.upDownDisable=!1:this.upDownDisable=!0},upData:function(){if(this.tempSelectionKeys.length>1)this.$message({type:"warning",message:"仅支持单选调顺序"});else for(var e=0,t=0;t<this.tempSelectionKeys.length;t++)(e=this.form.filelist.value.indexOf(this.tempSelectionKeys[t]))>0&&(this.form.filelist.value.splice(e-1,0,this.tempSelectionKeys[t]),this.form.filelist.value.splice(e+1,1))},downData:function(){if(this.tempSelectionKeys.length>1)this.$message({type:"warning",message:"仅支持单选调顺序"});else for(var e=0,t=0;t<this.tempSelectionKeys.length;t++)(e=this.form.filelist.value.indexOf(this.tempSelectionKeys[t]))>-1&&e!=this.form.filelist.value.length-1&&(this.form.filelist.value.splice(e+2,0,this.tempSelectionKeys[t]),this.form.filelist.value.splice(e,1))},task_mode_change:function(){"0"==this.form.kind?(this.form.num=0,this.form.jiange=0,this.form.len<10&&(this.form.len=10)):(this.form.num=1,this.form.len=0)},get_taskgroup_ap:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listplant",e).then(function(e){var t=this;e.data.res&&(this.options_taskgroup=[],e.data.list.length>0&&e.data.list.forEach(function(e,s){t.options_taskgroup.push({value:e.pid,label:e.pname}),t.taskgpnamelist[e.pid]=e.pname}))}.bind(this)).catch(function(e){console.log(e)})},_eab_taskgroup:function(){if(0!=this.taskgroupv){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("pid",this.taskgroupv),o.a.post("/user/plantenable",e).then(function(e){e.data.res?(this.$alert("应用成功[Apply suc]"),this.dialogVisible_edgtaskgroup=!1,this._get_timer_tasklist()):this.$alert("Sth ER")}.bind(this)).catch(function(e){console.log(e)})}},_disab_taskgroup:function(){if(0!=this.taskgroupv){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("pid",this.taskgroupv),o.a.post("/user/plantdisable",e).then(function(e){e.data.res?(this.$alert("应用成功[Apply suc]"),this.dialogVisible_edgtaskgroup=!1,this._get_timer_tasklist()):this.$alert("Sth ER")}.bind(this)).catch(function(e){console.log(e)})}},_edg_taskgroup_ap:function(){if(0!=this.edgtaskid){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("pid",this.taskgroupvv),e.append("taskid",this.edgtaskid),o.a.post("/user/plantedittask",e).then(function(e){e.data.res?(this.$alert("应用成功[Apply suc]"),this.dialogVisible_edgtaskgroup=!1,this._get_timer_tasklist()):this.$alert("Sth ER")}.bind(this)).catch(function(e){console.log(e)})}},_add_taskgroup_ap:function(){var e="";if(this.NewtaskGoupname.length>0){e=this.NewtaskGoupname;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("pname",e),o.a.post("/user/addplant",t).then(function(e){e.data.res?(this.$alert("添加成功[add suc]"),this.dialogVisible_addtaskgroup=!1,this.get_taskgroup_ap()):this.$alert("名字重复重新取名[tName was used]")}.bind(this)).catch(function(e){console.log(e)})}},_del_taskgroup_ap:function(){if(0!=this.taskgroupv){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("pid",this.taskgroupv),o.a.post("/user/deleteplant",e).then(function(e){e.data.res?(this.$alert("删除成功[delete suc]"),this.taskgroupv=0,this.get_taskgroup_ap()):this.$alert("删除失败[delete FALSE]")}.bind(this)).catch(function(e){console.log(e)})}},_add_taskgroup:function(){this.dialogVisible_addtaskgroup=!0},filterMethod:function(e,t){return t.pinyin.indexOf(e)>-1},kind_change:function(e){this.timepickerVisible="1"===e},str_pull:function(e){var t="";return e.forEach(function(e,s){t+=e,t+="|"}),t.substring(0,t.length-1)},add_taskadd:function(){this.dialog_titel="添加任务",o.a.get("/get_addtask_needs.php").then(function(e){var t=this;e.data.res&&(this.form.data2=e.data.devices,this.form.data3=e.data.files,this.form.data3.forEach(function(e,s){t.form.data3[s].label=x.decode(e.label)}),this.dialogVisible_addtask=!0,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},deletetaskS:function(e,t){console.log(e),console.log(t)},edgtask:function(e,t){this.edgtaskid=t[e].id,this.edgtaskname=t[e].task_name,this.dialogVisible_edgtaskgroup=!0},detailtask:function(e,t){this.dialog_titel="查看/编辑 任务",o.a.get("/get_task_detail.php",{params:{task_id:t[e].id}}).then(function(e){e.data.res&&(this.form=e.data.dataJson,this.form.time=new Date(2019,2,2,e.data.dataJson.time.h,e.data.dataJson.time.m),o.a.get("/get_addtask_needs.php").then(function(e){var t=this;e.data.res&&(this.form.data2=e.data.devices,this.form.data3=e.data.files,this.form.data3.forEach(function(e,s){t.form.data3[s].label=x.decode(e.label)}),this.dialogVisible_addtask=!0,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)}))}.bind(this)).catch(function(e){console.log(e)})},_get_timer_tasklist_s:function(e,t){o.a.get("/Get_list_of_time_task.php").then(function(s){s.data.res&&(console.log(s),this.tableDatatasklist=s.data.dataJson,"1"===e?this.$message({type:"success",message:"已生效!"+this.tableDatatasklist[t].task_name}):this.$message({type:"success",message:"已经禁用!"+this.tableDatatasklist[t].task_name}))}.bind(this)).catch(function(e){console.log(e)})},get_devlist:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.tableData1=e.data.dataJson)}.bind(this)).catch(function(e){console.log(e)})}}},F={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"uoloaddiv","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("el-row",[s("el-button",{attrs:{size:"medium",icon:"el-icon-plus",type:"primary"},on:{click:function(t){return e.creatTask()}}},[e._v("创建任务")]),e._v(" "),s("el-button",{attrs:{size:"medium",icon:"el-icon-refresh",type:"success"},on:{click:e._get_timer_tasklist}},[e._v("手動刷新")]),e._v(" "),s("el-select",{attrs:{placeholder:"ALL全部"},model:{value:e.taskgroupv,callback:function(t){e.taskgroupv=t},expression:"taskgroupv"}},e._l(e.options_taskgroup,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value,disabled:e.disabled}})}),1),e._v(" "),s("el-button",{attrs:{size:"medium",type:"success"},on:{click:e._add_taskgroup}},[e._v("Add_Plan组方案")]),e._v(" "),s("el-button",{attrs:{size:"medium",type:"success"},on:{click:e._del_taskgroup_ap}},[e._v("Del_Plan组方案")]),e._v(" "),s("el-button",{attrs:{size:"medium",type:"success"},on:{click:e._disab_taskgroup}},[e._v("组方案禁Disable")]),e._v(" "),s("el-button",{attrs:{size:"medium",type:"success"},on:{click:e._eab_taskgroup}},[e._v("组方案生效Enable")])],1),e._v(" "),s("el-dialog",{attrs:{title:"添加任务组[Add task Group]",visible:e.dialogVisible_addtaskgroup,width:"30%"},on:{"update:visible":function(t){e.dialogVisible_addtaskgroup=t}}},[s("el-input",{attrs:{placeholder:"",maxlength:"15","show-word-limit":""},model:{value:e.NewtaskGoupname,callback:function(t){e.NewtaskGoupname=t},expression:"NewtaskGoupname"}},[s("template",{slot:"prepend"},[e._v("任务组名字[New task group name]:")])],2),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_addtaskgroup=!1}}},[e._v("取 消[Cancel]")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e._add_taskgroup_ap}},[e._v("确 定[Apply]")])],1)],1),e._v(" "),s("el-dialog",{attrs:{title:"应用任务组[Apply task Group]",visible:e.dialogVisible_edgtaskgroup,width:"30%"},on:{"update:visible":function(t){e.dialogVisible_edgtaskgroup=t}}},[s("el-row",[s("span",[e._v("为任务:"+e._s(e.edgtaskname)+" --"+e._s(e.edgtaskid)+" 选择应用分组")]),e._v(" "),s("el-select",{attrs:{placeholder:"ALL全部"},model:{value:e.taskgroupvv,callback:function(t){e.taskgroupvv=t},expression:"taskgroupvv"}},e._l(e.options_taskgroup,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value,disabled:e.disabled}})}),1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_edgtaskgroup=!1}}},[e._v("取 消[Cancel]")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e._edg_taskgroup_ap}},[e._v("确 定[Apply]")])],1)],1),e._v(" "),s("br"),e._v(" "),s("br"),e._v(" "),s("el-table",{attrs:{data:e.tableDatatasklist,border:""}},[s("el-table-column",{attrs:{type:"index",width:"100px",label:"编号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"task_name",label:"任务名",width:"200px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"tasktime",label:"启动时间",width:"100px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"len",label:"时长[秒]",width:"100px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"kind",label:"循环次数",width:"130px"},scopedSlots:e._u([{key:"default",fn:function(t){return[0==e.tableDatatasklist[t.$index].kind?s("span",[e._v(" 随机播放 ")]):e._e(),e._v(" "),e.tableDatatasklist[t.$index].kind>0?s("span",[e._v(" 循环"+e._s(e.tableDatatasklist[t.$index].kind)+"遍 ")]):e._e()]}}])}),e._v(" "),s("el-table-column",{attrs:{prop:"startdate",label:"开始日期",width:"100px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"enddate",label:"停止日期",width:"100px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"gname",label:"任务方案组[GPLAN]",width:"200px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.edgtask(t.$index,e.tableDatatasklist)}}},[e._v("ChangeGP ")]),e._v(" "),0==e.tableDatatasklist[t.$index].groupid?s("span",[e._v("尚未归组")]):e._e(),e._v(" "),e.tableDatatasklist[t.$index].groupid>0?s("span",[e._v(e._s(e.taskgpnamelist[e.tableDatatasklist[t.$index].groupid])+" ")]):e._e()]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"[删]-[启/禁-用]-[改]",align:"center",width:"150px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.deletetask(t.$index,e.tableDatatasklist)}}},[e._v("删除")]),e._v(" "),s("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(s){return e.abletask(t.$index,e.tableDatatasklist)}},model:{value:e.tableDatatasklist[t.$index].enable,callback:function(s){e.$set(e.tableDatatasklist[t.$index],"enable",s)},expression:"tableDatatasklist[scope.$index].enable"}}),e._v(" "),s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.go_edit_task(t.$index,e.tableDatatasklist)}}},[e._v("修改")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{directives:[{name:"show",rawName:"v-show",value:0==t.row.statu,expression:"scope.row.statu==0"}],attrs:{type:"success",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.startTask(t.$index,e.tableDatatasklist)}}},[e._v("试听")]),e._v(" "),s("el-button",{directives:[{name:"show",rawName:"v-show",value:1==t.row.statu,expression:"scope.row.statu==1"}],attrs:{type:"warning",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.stopTask(t.$index,e.tableDatatasklist)}}},[e._v("停止")])]}}])})],1)],1),e._v(" "),s("div",[s("el-dialog",{attrs:{title:e.dialog_titel,visible:e.dialogVisible_addtask,width:"1000px"},on:{"update:visible":function(t){e.dialogVisible_addtask=t}}},[s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading2,expression:"loading2",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"uoloaddiv2","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}}),e._v(" "),s("el-form",{ref:"form",attrs:{model:e.form,"label-width":"80px",align:"left"}},[s("el-row",[s("el-form-item",{attrs:{label:"任务名称"}},[s("el-col",{attrs:{span:6}},[s("el-input",{staticStyle:{width:"300"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),e._v(" "),s("el-col",{attrs:{span:2}},[s("span",[e._v(" ")])]),e._v(" "),s("el-col",{attrs:{span:4}},[1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskname}},[e._v("修改")]):e._e()],1)],1)],1),e._v(" "),s("el-form-item",{attrs:{label:"其他限制"}},[s("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-text":"限制条件非必须不要设置"},model:{value:e.falss,callback:function(t){e.falss=t},expression:"falss"}})],1),e._v(" "),e.falss?s("el-row",[s("el-form-item",{attrs:{label:"选择日期"}},[s("el-col",{attrs:{span:3}},[s("el-checkbox",{model:{value:e.checked1,callback:function(t){e.checked1=t},expression:"checked1"}},[e._v("启用开始日期")])],1),e._v(" "),s("el-col",{attrs:{span:6}},[s("el-date-picker",{attrs:{type:"date",placeholder:"选择日期",disabled:!e.checked1,"picker-options":e.pickerOptions1},model:{value:e.form.startDate,callback:function(t){e.$set(e.form,"startDate",t)},expression:"form.startDate"}})],1),e._v(" "),s("el-col",{attrs:{span:3}},[e._v("\n    "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_task_startdate}},[e._v("修改")]):e._e()],1)],1)],1):e._e(),e._v(" "),s("el-form-item",[e.falss?s("el-row",[s("el-col",{attrs:{span:3}},[s("el-checkbox",{model:{value:e.checked2,callback:function(t){e.checked2=t},expression:"checked2"}},[e._v("启用结束日期")])],1),e._v(" "),s("el-col",{attrs:{span:6}},[s("el-date-picker",{attrs:{type:"date",placeholder:"选择日期",disabled:!e.checked2,"picker-options":e.pickerOptions2},model:{value:e.form.endDate,callback:function(t){e.$set(e.form,"endDate",t)},expression:"form.endDate"}})],1),e._v(" "),s("el-col",{attrs:{span:3}},[e._v("\n    "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_task_enddate}},[e._v("修改")]):e._e()],1)],1):e._e()],1),e._v(" "),s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.form.kind>=1,expression:"form.kind>=1"}],attrs:{label:"开始时间"}},[s("el-time-picker",{attrs:{placeholder:"任意时间点"},on:{change:e.Timerpickerchange},model:{value:e.form.startTime,callback:function(t){e.$set(e.form,"startTime",t)},expression:"form.startTime"}}),e._v("   \n "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskstarttime}},[e._v("修改")]):e._e()],1),e._v(" "),s("el-form-item",{attrs:{label:"任务周期"}},[s("el-checkbox",{attrs:{name:"type1"},model:{value:e.week[0],callback:function(t){e.$set(e.week,0,t)},expression:"week[0]"}},[e._v("周一")]),e._v(" "),s("el-checkbox",{attrs:{name:"type2"},model:{value:e.week[1],callback:function(t){e.$set(e.week,1,t)},expression:"week[1]"}},[e._v("周二")]),e._v(" "),s("el-checkbox",{attrs:{name:"type3"},model:{value:e.week[2],callback:function(t){e.$set(e.week,2,t)},expression:"week[2]"}},[e._v("周三")]),e._v(" "),s("el-checkbox",{attrs:{name:"type4"},model:{value:e.week[3],callback:function(t){e.$set(e.week,3,t)},expression:"week[3]"}},[e._v("周四")]),e._v(" "),s("el-checkbox",{attrs:{name:"type5"},model:{value:e.week[4],callback:function(t){e.$set(e.week,4,t)},expression:"week[4]"}},[e._v("周五")]),e._v(" "),s("el-checkbox",{attrs:{name:"type6"},model:{value:e.week[5],callback:function(t){e.$set(e.week,5,t)},expression:"week[5]"}},[e._v("周六")]),e._v(" "),s("el-checkbox",{attrs:{name:"type7"},model:{value:e.week[6],callback:function(t){e.$set(e.week,6,t)},expression:"week[6]"}},[e._v("周日")]),e._v("    \n "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskweeks}},[e._v("修改")]):e._e()],1),e._v(" "),s("h3",{staticStyle:{margin:"50px 0 20px"}},[e._v("选择需要播放的设备")]),e._v(" "),s("div",[s("el-transfer",{staticStyle:{"text-align":"left",display:"inline-block"},attrs:{filterable:"",titles:["所有设备","被播放的设备"],"button-texts":["移除","添加"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.form.seedlist.data},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.form.seedlist.value,callback:function(t){e.$set(e.form.seedlist,"value",t)},expression:"form.seedlist.value"}}),e._v("  \n "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskdevices}},[e._v("修改任务设备")]):e._e()],1),e._v(" "),s("h3",{staticStyle:{margin:"50px 0 20px"}},[e._v("选择任务音频文件")]),e._v(" "),s("div",[s("el-row",[s("div",{staticStyle:{"text-align":"left"}},[s("myTransfer",{staticStyle:{"text-align":"left"},attrs:{inputList:e.form.filelist.data},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.form.filelist.value,callback:function(t){e.$set(e.form.filelist,"value",t)},expression:"form.filelist.value"}})],1)]),e._v(" "),s("el-row",[s("el-col",{attrs:{span:6}},[e._v("  ")]),e._v(" "),s("el-col",{attrs:{span:3}},[1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskfiles}},[e._v("修改任务播放文件")]):e._e()],1)],1),e._v(" "),s("br")],1),e._v(" "),s("br"),e._v(" "),s("el-row",[s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.kind,expression:"form.kind==1"}],attrs:{label:"任务时长"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"以秒为单位;顺序播放次数循环时长如果比设置时长短会提前终止,以此处总时长为准,此处为0,则循环结束即停止;",placement:"right-start"}},[s("el-input-number",{attrs:{min:1==e.form.kind?0:600,max:72e3,disabled:!0},model:{value:e.form.len,callback:function(t){e.$set(e.form,"len",t)},expression:"form.len"}})],1),e._v(" "),s("el-button",{on:{click:e.countLength}},[e._v("计算")])],1),e._v(" "),s("el-form-item",{attrs:{label:"间隔时长"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"播放完一个节目之后间隔多少秒播放下一个条目",placement:"right-start"}},[s("el-input-number",{attrs:{min:1},on:{change:e.countLength},model:{value:e.form.jiange,callback:function(t){e.$set(e.form,"jiange",t)},expression:"form.jiange"}})],1),e._v("\n    \n "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_taskjiange}},[e._v("修改")]):e._e()],1)],1),e._v(" "),s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:0==e.form.kind,expression:"form.kind==0"}],attrs:{label:"时间选择"}},[s("el-time-picker",{attrs:{"is-range":"","range-separator":"至","arrow-control":"",placeholder:"任意时间点"},on:{change:e.Timerpickerchange2},model:{value:e.form.timepicker,callback:function(t){e.$set(e.form,"timepicker",t)},expression:"form.timepicker"}}),e._v("  \n "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.edit_tasksj_len}},[e._v("修改")]):e._e()],1),e._v(" "),s("el-row",{staticClass:"fucko"},[0==e.form.isedit_mode?s("el-col",{attrs:{span:5}},[s("el-form-item",{attrs:{label:"播放模式"}},[s("el-select",{attrs:{placeholder:"请选择任务类型"},on:{change:e.task_mode_change},model:{value:e.form.kind,callback:function(t){e.$set(e.form,"kind",t)},expression:"form.kind"}},[s("el-option",{attrs:{label:"顺序播放",value:"1"}}),e._v(" "),s("el-option",{attrs:{label:"随机播放",value:"0"}})],1)],1)],1):e._e(),e._v(" "),s("el-col",{attrs:{span:9}},[s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1==e.form.kind,expression:"form.kind==1"}],attrs:{label:"播放次数"}},[s("el-row",[s("el-input-number",{attrs:{min:1},on:{change:e.countLength},model:{value:e.form.num,callback:function(t){e.$set(e.form,"num",t)},expression:"form.num"}}),e._v(" "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:e.task_cishu}},[e._v("修改")]):e._e()],1)],1)],1)],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[0==e.form.isedit_mode?s("el-button",{on:{click:function(t){e.dialogVisible_addtask=!1}}},[e._v("取 消")]):e._e(),e._v(" "),1==e.form.isedit_mode?s("el-button",{attrs:{type:"danger"},on:{click:function(t){e.dialogVisible_addtask=!1}}},[e._v("关闭")]):e._e(),e._v(" "),0==e.form.isedit_mode?s("el-button",{attrs:{type:"primary"},on:{click:e.save_task}},[e._v("确 定")]):e._e()],1)],1)],1)])},staticRenderFns:[]};var O=s("VU/8")(P,F,!1,function(e){s("jvML")},"data-v-636daa68",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var M=s("xrTZ").Base64,N={data:function(){return{tableDatatasklist:[],dialogVisible_addtask:!1,timepickerVisible:!1,dialog_titel:"",time_len_visable:!1,form:{name:"",kind:"2",date:"",date1:"",date2:"",time:"00:00",data2:[],data3:[],value4:[],value5:[],week:[],length:0,tags_devices:[{name:"设备1"},{name:"设备1"},{name:"设备1"}],music_files:[]},value3:[],value2:[]}},created:function(){},methods:{kind_change:function(e){this.timepickerVisible="1"===e},str_pull:function(e){var t="";return e.forEach(function(e,s){t+=e,t+="|"}),t.substring(0,t.length-1)},_get_triger_tasklist:function(){o.a.get("/Get_list_of_trigertask.php").then(function(e){e.data.res&&(this.tableDatatasklist=e.data.dataJson)}.bind(this)).catch(function(e){console.log(e)})},_save_task:function(){var e=new URLSearchParams;e.append("taskname",this.form.name),e.append("kind",this.form.kind),e.append("time",this.form.time),e.append("week",this.str_pull(this.form.week)),e.append("filelist",this.str_pull(this.form.value5)),e.append("seedlist",this.str_pull(this.form.value4)),e.append("length",this.form.length),"添加任务"!=this.dialog_titel&&(e.append("task_id",this.form.task_id),alert(this.dialog_titel),alert(this.form.task_id)),o.a.post("/add_save_task.php",e).then(function(e){e.data.res&&(this._get_triger_tasklist(),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_addtask=!1},add_taskadd:function(){this.dialog_titel="添加任务",o.a.get("/get_addtask_needs.php").then(function(e){var t=this;e.data.res&&(this.form.data2=e.data.devices,this.form.data3=e.data.files,this.form.data3.forEach(function(e,s){t.form.data3[s].label=M.decode(e.label)}),this.dialogVisible_addtask=!0,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},deletetask:function(e,t){var s=this;this.$confirm("此操作将永久删除该任務,是否继续?"+t[e].task_name,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){if(4==t[e].task_status){t[e].id;o.a.get("/del_task.php",{params:{task_id:t[e].id}}).then(function(s){s.data.res&&(t.splice(e,1),this._get_triger_tasklist(),this.$message({type:"success",message:"删除成功!"+filename}))}.bind(this)).catch(function(e){console.log(e)})}else this.$message({type:"warning",message:"请先禁用该任务"})}).catch(function(){s.$message({type:"info",message:"已取消删除"})})},detailtask:function(e,t){this.dialog_titel="查看/编辑 任务",o.a.get("/get_task_detail.php",{params:{task_id:t[e].id}}).then(function(e){e.data.res&&(this.form=e.data.dataJson,o.a.get("/get_addtask_needs.php").then(function(e){var t=this;e.data.res&&(this.form.data2=e.data.devices,this.form.data3=e.data.files,this.form.data3.forEach(function(e,s){t.form.data3[s].label=M.decode(e.label)}),this.dialogVisible_addtask=!0,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)}))}.bind(this)).catch(function(e){console.log(e)})},abletask:function(e,t){console.log(e),console.log(t[e].task_name),console.log(t[e].task_enable);t[e].id;o.a.get("/Change_task_status.php",{params:{task_id:t[e].id,task_enable:t[e].task_enable}}).then(function(s){s.data.res&&this._get_triger_tasklist_st(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},_get_triger_tasklist_st:function(e,t){o.a.get("/Get_list_of_trigertask.php").then(function(s){s.data.res&&(this.tableDatatasklist=s.data.dataJson,"1"===e?this.$message({type:"success",message:"已生效!"+this.tableDatatasklist[t].task_name}):this.$message({type:"success",message:"已经禁用!"+this.tableDatatasklist[t].task_name}))}.bind(this)).catch(function(e){console.log(e)})}}},$={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("br"),e._v(" "),s("br"),e._v(" "),s("div",{attrs:{id:"uoloaddiv2"}},[s("el-row",[s("el-button",{staticClass:"topbuttn",attrs:{size:"medium",icon:"el-icon-circle-plus",type:"primary"},on:{click:e.add_taskadd}},[e._v("创建任务")]),e._v(" "),s("el-button",{staticClass:"topbuttn",attrs:{size:"medium",icon:"el-icon-star-on",type:"primary"},on:{click:e._get_triger_tasklist}},[e._v("手動刷新")])],1),e._v(" "),s("br"),e._v(" "),s("br"),e._v(" "),s("el-table",{attrs:{data:e.tableDatatasklist,border:""}},[s("el-table-column",{attrs:{type:"index",width:"50px",label:"编号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"task_name",label:"任务名字",width:"300px"}}),e._v(" "),s("el-table-column",{attrs:{prop:"task_status",label:"状态",width:"100px"}}),e._v(" "),s("el-table-column",{attrs:{fixed:"right",label:"[操作]-[启用]-[修改] ",width:"200px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.deletetask(t.$index,e.tableDatatasklist)}}},[e._v("移除")]),e._v(" "),s("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(s){return e.abletask(t.$index,e.tableDatatasklist)}},model:{value:e.tableDatatasklist[t.$index].task_enable,callback:function(s){e.$set(e.tableDatatasklist[t.$index],"task_enable",s)},expression:"tableDatatasklist[scope.$index].task_enable"}}),e._v(" "),s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.detailtask(t.$index,e.tableDatatasklist)}}},[e._v("詳情")])]}}])})],1)],1),e._v(" "),s("div",[s("el-dialog",{attrs:{title:e.dialog_titel,visible:e.dialogVisible_addtask},on:{"update:visible":function(t){e.dialogVisible_addtask=t}}},[s("el-form",{ref:"form",attrs:{model:e.form,"label-width":"80px",align:"left"}},[s("el-form-item",{attrs:{label:"任务名字"}},[s("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),e._v(" "),s("el-form-item",{attrs:{label:"任务类型"}},[s("el-select",{attrs:{placeholder:"请选择任务类型"},on:{change:e.kind_change},model:{value:e.form.kind,callback:function(t){e.$set(e.form,"kind",t)},expression:"form.kind"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"定时触发启动",placement:"right-start"}},[s("el-option",{attrs:{label:"定时任务",value:"1"}})],1),e._v(" "),s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"手动启动 或者 由报警信号触发",placement:"right-start"}},[s("el-option",{attrs:{label:"触发任务",value:"2"}})],1)],1)],1),e._v(" "),e.timepickerVisible?s("el-form-item",{attrs:{label:"任务时间"}},[s("el-time-picker",{staticStyle:{},attrs:{editable:!0,size:"min",placeholder:"任意时间点"},model:{value:e.form.time,callback:function(t){e.$set(e.form,"time",t)},expression:"form.time"}})],1):e._e(),e._v(" "),e.time_len_visable?s("el-form-item",{attrs:{label:"任务时长"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"为0时 播放时间为 音频文件播放完就结束,单位为秒",placement:"right-start"}},[s("el-input-number",{attrs:{min:0,max:72e3},model:{value:e.form.length,callback:function(t){e.$set(e.form,"length",t)},expression:"form.length"}})],1)],1):e._e(),e._v(" "),s("el-form-item",{attrs:{label:"任务周期"}},[s("el-checkbox-group",{model:{value:e.form.week,callback:function(t){e.$set(e.form,"week",t)},expression:"form.week"}},[s("el-checkbox",{attrs:{label:"1",name:"type"}},[e._v("周一")]),e._v(" "),s("el-checkbox",{attrs:{label:"2",name:"type"}},[e._v("周二")]),e._v(" "),s("el-checkbox",{attrs:{label:"3",name:"type"}},[e._v("周三")]),e._v(" "),s("el-checkbox",{attrs:{label:"4",name:"type"}},[e._v("周四")]),e._v(" "),s("el-checkbox",{attrs:{label:"5",name:"type"}},[e._v("周五")]),e._v(" "),s("el-checkbox",{attrs:{label:"6",name:"type"}},[e._v("周六")]),e._v(" "),s("el-checkbox",{attrs:{label:"0",name:"type"}},[e._v("周日")])],1)],1),e._v(" "),s("h3",{staticStyle:{"text-align":"center",margin:"50px 0 20px"}},[e._v("选择需要播放的设备")]),e._v(" "),s("div",{staticStyle:{"text-align":"center"}},[s("el-transfer",{staticStyle:{"text-align":"left",display:"inline-block"},attrs:{filterable:"",titles:["Source","Target"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.form.data2},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.form.value4,callback:function(t){e.$set(e.form,"value4",t)},expression:"form.value4"}})],1),e._v(" "),s("h3",{staticStyle:{"text-align":"center",margin:"50px 0 20px"}},[e._v("选择任务音频文件")]),e._v(" "),s("div",{staticStyle:{"text-align":"center"}},[s("el-transfer",{staticStyle:{"text-align":"left",display:"inline-block"},attrs:{filterable:"",titles:["所有文件","播放文件"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.form.data3},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.form.value5,callback:function(t){e.$set(e.form,"value5",t)},expression:"form.value5"}})],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_addtask=!1}}},[e._v("取 消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e._save_task}},[e._v("确 定")])],1)],1)],1)])},staticRenderFns:[]};var U=s("VU/8")(N,$,!1,function(e){s("VU7S")},"data-v-0791732e",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var B={data:function(){return{tableData:[],dialogVisible_adddevice:!1,node_name:"",node_detail:"",node_nodeid:0,node_ip:"",node_name_e:"",isroot:!1,node_port:3333,node_port5:6003,node_port3:6006,node_port4:6002,save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,dialogVisible_edg_nodename:!1,dialogVisible_edg_nodeip:!1}},created:function(){this.reflash_devlist(),-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{edgRow:function(e,t){this.node_nodeid=t[e].id,this.dialogVisible_edg_nodeip=!0},edgRowName:function(e,t){this.node_nodeid=t[e].id,this.dialogVisible_edg_nodename=!0},func_synaudio:function(){this.$notify.success({title:"Info",message:"同步开始 会持续 10秒钟左右,同步期间会中断正在播放的音频文件",showClose:!0}),o.a.get("/srn/tb.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&this.$notify.success({title:"Info",message:"同步结束",showClose:!0})}.bind(this)).catch(function(e){console.log(e)})},edg_nodename_save:function(){console.log("fuckser111"),this.node_name_e.length<2||this.node_name_e.length>10?this.$notify.success({title:"Info",message:"修改的名字不合法",showClose:!0}):o.a.get("/Change_nodenamebyid.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),node_id:this.node_nodeid,node_newname:this.node_name_e}}).then(function(e){e.data.res&&(this.reflash_devlist(),this.$notify.success({title:"Info",message:"修改完IP地址需要核对与主机NSPIP地址是否一直,确认之后再系统监控软件里 重启,任务系统和媒体系统",showClose:!0}),this.dialogVisible_edg_nodename=!1)}.bind(this)).catch(function(e){console.log(e)})},edg_nodeip_save:function(){console.log("fuckser111"),this.node_ip.length<9?this.$notify.success({title:"Info",message:"修改的IP地址不合法",showClose:!0}):o.a.get("/Change_nodeipbyid.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),node_id:this.node_nodeid,node_newip:this.node_ip}}).then(function(e){e.data.res&&(this.reflash_devlist(),this.$notify.success({title:"Info",message:"网络节点名字修改成功",showClose:!0}),this.dialogVisible_edg_nodeip=!1)}.bind(this)).catch(function(e){console.log(e)})},goDeleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该服务, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){s.deleteRow(e,t)}).catch(function(){})},open5:function(){this.$alert(this.save_backdata,"配置详情",{dangerouslyUseHTMLString:!1})},handleClose_save_back:function(){},func_addone_device:function(){if(this.dialogVisible_adddevice=!1,""!=this.node_name.trim())if(""==this.node_detail.trim()&&(this.node_detail=this.node_name.trim()+"没有备注信息"),""!=this.node_ip.trim())if(0!=this.node_port){var e=new FormData;e.append("username",sessionStorage.getItem("username")),e.append("passwd",sessionStorage.getItem("passwd")),e.append("nodeip",this.node_ip.trim()),e.append("detail",this.node_detail.trim()),e.append("nodename",this.node_name.trim()),e.append("port1",this.node_port),e.append("port2",6e3),e.append("port3",this.node_port3),e.append("port4",this.node_port4),e.append("port5",this.node_port5),o.a.post("/add_user_node.php",e).then(function(e){e.data.res?(this.$notify.success({title:"Info",message:"添加成功",showClose:!1}),this.reflash_devlist()):this.$notify.success({title:"Info",message:"添加节点出现异常检查是否重复添加",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"节点端口不正确",showClose:!0});else this.$notify.success({title:"Info",message:"节点IP不正确",showClose:!0});else this.$notify.success({title:"Info",message:"节点名字不能为空",showClose:!0})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},func_adddevic:function(){this.dialogVisible_adddevice=!0},func_savedevic:function(){var e=this.$loading({lock:!0,text:"Processing",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)",target:document.querySelector(".div1")});o.a.get("/create_config.php").then(function(t){t.data.res?(this.save_backdata=t.data.config,this.dialogVisible_save_back=!0,e.close()):this.$notify.success({title:"Info",message:"哪里出现错误了",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},deleteRow:function(e,t){var s=t[e].nodeip;o.a.get("/del_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),nodeip:s}}).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"删除成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"删除失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},editRow:function(e,t){console.log(e,t),this.id=t[e].id,this.node_name=t[e].node_name,this.node_ip=t[e].nodeip,this.node_port=t[e].nodeport1,this.node_detail=t[e].detail,this.dialogVisible_adddevice2=!0},handleClose_adddevice:function(){this.dialogVisible_adddevice=!1},tableRowClassName:function(e){e.row;var t=e.rowIndex;return 1===t?"warning-row":3===t?"success-row":""},reflash_devlist:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.tableData=e.data.dataJson,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},G={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmg"}},[s("el-row",[e.isroot?s("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.func_adddevic}},[e._v("添加服务")]):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"1100px"},attrs:{data:e.tableData,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",label:"编号",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{prop:"id",label:"ID",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{prop:"node_name",label:"名字",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{prop:"nodeip",label:"IP地址",width:"150"}}),e._v(" "),s("el-table-column",{attrs:{prop:"nodeport1",label:"端口信息",width:"150"}}),e._v(" "),s("el-table-column",{attrs:{prop:"detail",label:"描述",width:"250"}}),e._v(" "),e.isroot?s("el-table-column",{attrs:{label:"操作",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"修改节点名字",placement:"top"}},[s("el-button",{attrs:{icon:"el-icon-s-tools",type:"danger",circle:""},nativeOn:{click:function(s){return s.preventDefault(),e.edgRowName(t.$index,e.tableData)}}})],1),e._v(" "),s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除服务,用户不得自行维护",placement:"top"}},[s("el-button",{attrs:{icon:"el-icon-edit",type:"info",circle:""},nativeOn:{click:function(s){return s.preventDefault(),e.goDeleteRow(t.$index,e.tableData)}}})],1)]}}],null,!1,3291745085)}):e._e()],1),e._v(" "),s("el-dialog",{attrs:{title:"添加节点",visible:e.dialogVisible_adddevice,width:"400px","before-close":e.handleClose_adddevice},on:{"update:visible":function(t){e.dialogVisible_adddevice=t}}},[s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"NODE NAME"},model:{value:e.node_name,callback:function(t){e.node_name=t},expression:"node_name"}},[s("template",{slot:"prepend"},[e._v("[节点名字]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"XXX.XXX.XXX.XXX"},model:{value:e.node_ip,callback:function(t){e.node_ip=t},expression:"node_ip"}},[s("template",{slot:"prepend"},[e._v("[节 点 I P ]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"3333"},model:{value:e.node_port,callback:function(t){e.node_port=t},expression:"node_port"}},[s("template",{slot:"prepend"},[e._v("[服务端口]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"6002"},model:{value:e.node_port4,callback:function(t){e.node_port4=t},expression:"node_port4"}},[s("template",{slot:"prepend"},[e._v("[数据端口]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"6003"},model:{value:e.node_port5,callback:function(t){e.node_port5=t},expression:"node_port5"}},[s("template",{slot:"prepend"},[e._v("[控制端口]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"6006"},model:{value:e.node_port3,callback:function(t){e.node_port3=t},expression:"node_port3"}},[s("template",{slot:"prepend"},[e._v("[音频端口]:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"Note info"},model:{value:e.node_detail,callback:function(t){e.node_detail=t},expression:"node_detail"}},[s("template",{slot:"prepend"},[e._v("[节点备注]:")])],2)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_addone_device}},[e._v("添加节点")])],1)]),e._v(" "),s("el-dialog",{attrs:{title:"提示",visible:e.dialogVisible_save_back,width:"30%","before-close":e.handleClose_save_back},on:{"update:visible":function(t){e.dialogVisible_save_back=t}}},[s("span",[e._v("1分钟后生效 等待一下")]),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"text"},on:{click:e.open5}},[e._v("配置详情")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogVisible_save_back=!1}}},[e._v("确 定")])],1)]),e._v(" "),s("el-dialog",{attrs:{title:"提示",visible:e.dialogVisible_edg_nodeip,width:"30%"},on:{"update:visible":function(t){e.dialogVisible_edg_nodeip=t}}},[s("span",[e._v("修改节点服务IP地址")]),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"XXX.XXX.XXX.XXX"},model:{value:e.node_ip,callback:function(t){e.node_ip=t},expression:"node_ip"}},[s("template",{slot:"prepend"},[e._v("[节 点 I P ]:")])],2)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"text"},on:{click:function(t){e.dialogVisible_edg_nodeip=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.edg_nodeip_save}},[e._v("确 定")])],1)]),e._v(" "),s("el-dialog",{attrs:{title:"提示",visible:e.dialogVisible_edg_nodename,width:"30%"},on:{"update:visible":function(t){e.dialogVisible_edg_nodename=t}}},[s("span",[e._v("修改节点服务名字")]),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"服务"},model:{value:e.node_name_e,callback:function(t){e.node_name_e=t},expression:"node_name_e"}},[s("template",{slot:"prepend"},[e._v("[节 点 名字 ]:")])],2)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"text"},on:{click:function(t){e.dialogVisible_edg_nodename=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.edg_nodename_save}},[e._v("确 定")])],1)])],1)},staticRenderFns:[]};var V=s("VU/8")(B,G,!1,function(e){s("u/6E")},"data-v-6d0bb82f",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};s("xrTZ").Base64;var z={data:function(){return{devkindkind:0,has_warning:!1,optionsdevkind:[{value:0,label:"音响"},{value:1,label:"报警A"},{value:2,label:"报警B"},{value:3,label:"报警C"},{value:12,label:"输入A"},{value:13,label:"输入B"},{value:14,label:"输出A"},{value:15,label:"输出B"},{value:16,label:"TTSA"},{value:17,label:"TTSB"}],search:"",volvalue:[],voldata:[],volumeAdjust:{ip:"",port:"",seed:"",vol1:0,vol2:0,vol3:0,vol4:0},warningSet:{flag:!0,seedList1:{data:[],value:[]},seedList2:{data:[],value:[]},file1:"",file2:"",portwr:"",portct:"",seed:"",ip:""},xinhaodengset:{seed:"",name:"",ip:"",portct:"",xhstatus:"",nsgo:0,nsleft:0,wego:0,weleft:0,nowk:0,mode:0,imagesrc:"",time:""},loading:!1,options:[],nodeid:"",isroot:!1,tableData:[],tableDatatmp:[],dialogVisible_adddevice7:!1,dialogVisible_adddevice6:!1,dialogVisible_adddevice4:!1,tableDatafilelist:[],dialogVisible_adddevice:!1,dialogVisible_adddevice2:!1,dialogVisible_adddevice3:!1,name_adddevice:"",seed_adddevice:"",seed_ofnode:"",tag1:"区域标签A可选",tag2:"编码标签B可选",type:"1",device_status:"1",sqr_adddevice:"",save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,options_fuck1:[{value:1,label:"左转直行分别亮灯"},{value:2,label:"左转直行同时亮灯",disabled:!0}]}},created:function(){this.reflash_devlist(),-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{researchdev:function(){var e=this;console.log("researchdev"),console.log(this.search),this.tableData=this.tableDatatmp,this.tableData=this.tableData.filter(function(t){return!e.search||t.devname.includes(e.search)})},revols:function(){this.dialogVisible_adddevice4=!0},goSetWarning:function(e,t){this.warningSet.ip=t[e].nodeip,this.warningSet.portct=t[e].nodeport3,this.warningSet.seed=t[e].seed,this.dialogVisible_adddevice3=!0},goSetWarningauto:function(e,t){this.warningSet.ip=t[e].nodeip,this.warningSet.portct=t[e].nodeport3,this.warningSet.seed=t[e].seed,this.dialogVisible_adddevice6=!0},setWarningcancelauto:function(){console.log(this.warningSet);var e=new FormData;e.append("username",sessionStorage.getItem("username")),e.append("passwd",sessionStorage.getItem("passwd")),e.append("user_id",sessionStorage.getItem("id")),e.append("enable",0),e.append("portct",this.warningSet.portct),e.append("seed",this.warningSet.seed),e.append("ip",this.warningSet.ip),e.append("id",-2),e.append("url_bihe","http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3"),e.append("url_duankai","http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3"),o.a.post("/warningsetauto.php",e).then(function(e){e.data.res?(console.log(e.data),this.$notify.success({title:"Info",message:"报警注销成功",showClose:!1})):this.$notify.success({title:"Info",message:"报警注销出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice3=!1},closePromptTone:function(e,t){this.loading=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("dsv",2),s.append("sn",t[e].device_seed),o.a.post("/user/sndebug",s).then(function(s){s.data.res?(this.loading=!1,this.$notify.success({title:"Info",message:"关闭成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):(console.log(s.data),this.$notify.success({title:"Info",message:"关闭失败",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)})},openPromptTone:function(e,t){this.loading=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("dsv",1),s.append("sn",t[e].device_seed),o.a.post("/user/sndebug",s).then(function(s){s.data.res?(this.loading=!1,this.$notify.success({title:"Info",message:"开启成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):(console.log(s.data),this.$notify.success({title:"Info",message:"开启失败",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)})},goAdjustVolume:function(e,t){parseInt(t[e].vol)<=1?this.volumeAdjust.vol1=0:parseInt(t[e].vol)<=15?this.volumeAdjust.vol1=10:parseInt(t[e].vol)<=25?this.volumeAdjust.vol1=20:parseInt(t[e].vol)<=30?this.volumeAdjust.vol1=30:parseInt(t[e].vol)<=35?this.volumeAdjust.vol1=40:parseInt(t[e].vol)<=40?this.volumeAdjust.vol1=50:parseInt(t[e].vol)<=45?this.volumeAdjust.vol1=60:parseInt(t[e].vol)<=50?this.volumeAdjust.vol1=70:parseInt(t[e].vol)<=55?this.volumeAdjust.vol1=80:parseInt(t[e].vol)<=60?this.volumeAdjust.vol1=90:this.volumeAdjust.vol1=100,console.log(t[e].device_seed),this.volumeAdjust.seed=t[e].device_seed,this.dialogVisible_adddevice2=!0},adjustVolume:function(){switch(this.volumeAdjust.vol1){case 0:this.volumeAdjust.vol2=1;break;case 10:this.volumeAdjust.vol2=15;break;case 20:this.volumeAdjust.vol2=25;break;case 30:this.volumeAdjust.vol2=30;break;case 40:this.volumeAdjust.vol2=35;break;case 50:this.volumeAdjust.vol2=40;break;case 60:this.volumeAdjust.vol2=45;break;case 70:this.volumeAdjust.vol2=50;break;case 80:this.volumeAdjust.vol2=55;break;case 90:this.volumeAdjust.vol2=60;break;case 100:this.volumeAdjust.vol2=63}console.log(this.volumeAdjust);var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("snlist",this.volumeAdjust.seed),e.append("vol",this.volumeAdjust.vol2),o.a.post("/user/editvols",e).then(function(e){e.data.res?(console.log(e.data),this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),rows.splice(index,1),this.reflash_devlist()):(console.log(e.data),this.$notify.success({title:"Info",message:"修改失败",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice2=!1},adjustVolumes:function(){switch(this.dialogVisible_adddevice4=!1,this.volumeAdjust.vol3){case 0:this.volumeAdjust.vol4=1;break;case 10:this.volumeAdjust.vol4=15;break;case 20:this.volumeAdjust.vol4=25;break;case 30:this.volumeAdjust.vol4=30;break;case 40:this.volumeAdjust.vol4=35;break;case 50:this.volumeAdjust.vol4=40;break;case 60:this.volumeAdjust.vol4=45;break;case 70:this.volumeAdjust.vol4=50;break;case 80:this.volumeAdjust.vol4=55;break;case 90:this.volumeAdjust.vol4=60;break;case 100:this.volumeAdjust.vol4=63}console.log(this.volumeAdjust);for(var e=[],t=0;t<this.volvalue.length;t++)e.push(this.volvalue[t]);if(!(e.length<1)){var s=e.join("|"),i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("snlist",s),i.append("vol",this.volumeAdjust.vol4),o.a.post("/user/editvols",i).then(function(e){e.data.res?(console.log(e.data),this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),this.reflash_devlist()):(console.log(e.data),this.$notify.success({title:"Info",message:"修改失败",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice2=!1}},goDeleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该设备, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){s.deleteRow(e,t)}).catch(function(){})},open5:function(){this.$alert(this.save_backdata,"配置详情",{dangerouslyUseHTMLString:!1})},handleClose_save_back:function(){},func_addone_device:function(){if(this.dialogVisible_adddevice=!1,""!=this.name_adddevice.trim())if(""!=this.seed_adddevice.trim()&&32==this.seed_adddevice.trim().length)if(""!=this.sqr_adddevice.trim()&&32==this.sqr_adddevice.trim().length){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("name",this.name_adddevice),e.append("sn",this.seed_adddevice+"|"+this.sqr_adddevice),o.a.post("/user/deviceadd",e).then(function(e){e.data.res?(this.$notify.success({title:"Info",message:"添加成功",showClose:!1}),this.reflash_devlist()):this.$notify.success({title:"Info",message:"添加设备出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"设备序公钥 sqr 不正确",showClose:!0});else this.$notify.success({title:"Info",message:"设备序列号 seed 不正确",showClose:!0});else this.$notify.success({title:"Info",message:"设备名字不能为空",showClose:!0})},func_adddevic:function(){this.dialogVisible_adddevice=!0},func_savedevic:function(){var e=this.$loading({lock:!0,text:"Processing",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)",target:document.querySelector(".div1")});o.a.get("/create_config.php").then(function(t){t.data.res?(this.save_backdata=t.data.config,this.dialogVisible_save_back=!0,e.close()):this.$notify.success({title:"Info",message:"哪里出现错误了",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},deleteRow:function(e,t){var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("snid",t[e].id),o.a.post("/user/deldevs",s).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"删除成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"删除失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},renameRow:function(e,t){var s=this;t[e].seed,t[e].id,sessionStorage.getItem("username"),sessionStorage.getItem("passwd");this.$prompt("New NAME:","提示",{confirmButtonText:"确定",cancelButtonText:"取消",inputPattern:/^[\u4e00-\u9fa5_a-zA-Z0-9]+$/,inputErrorMessage:"格式不正确"}).then(function(i){var a=i.value;if(a.length>=30)s.$message({type:"info",message:"名字输入不合规"});else{console.log(a);var n=t[e].id,r=new FormData;r.append("id",sessionStorage.getItem("id")),r.append("token",sessionStorage.getItem("token")),r.append("newname",a),r.append("devid",n),o.a.post("/user/redevname",r).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(s)).catch(function(e){console.log(e)})}}).catch(function(){s.$message({type:"info",message:"取消输入"})})},resnRow:function(e,t){var s=this,i=t[e].device_seed;t[e].id;this.$prompt("New SEED:"+i+" INDEX:"+e,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",inputPattern:/^(?!\d+$)[\da-zA-Z]+$/,inputErrorMessage:"格式不正确"}).then(function(i){var a=i.value;if(32==a.length){var n=t[e].id,r=new FormData;r.append("id",sessionStorage.getItem("id")),r.append("token",sessionStorage.getItem("token")),r.append("newsn",a),r.append("devid",n),o.a.post("/user/resn",r).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(s)).catch(function(e){console.log(e)})}else s.$message({type:"info",message:"输入编码不正确 请认真输入"})}).catch(function(){s.$message({type:"info",message:"取消输入"})})},rerqRow:function(e,t){var s=this,i=t[e].seed;t[e].id,sessionStorage.getItem("username"),sessionStorage.getItem("passwd");this.$prompt("New TAG1区域标签:"+i+" INDEX:"+e,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",inputErrorMessage:"格式不正确"}).then(function(i){var a=i.value;if(a.length<2)s.$message({type:"info",message:"输入编码不正确 请认真输入"});else{var n=t[e].seed,r=a,l=t[e].id,d=sessionStorage.getItem("username"),c=sessionStorage.getItem("passwd");o.a.get("/retg1.php",{params:{olseed:n,retg2:r,devid:l,username:d,passwd:c}}).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(s)).catch(function(e){console.log(e)})}}).catch(function(){s.$message({type:"info",message:"取消输入"})})},rerRow:function(e,t){var s=this,i=t[e].seed;t[e].id,sessionStorage.getItem("username"),sessionStorage.getItem("passwd");this.$prompt("New TAG2编码标签:"+i+" INDEX:"+e,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",inputPattern:/^(?!\d+$)[\da-zA-Z]+$/,inputErrorMessage:"格式不正确"}).then(function(i){var a=i.value;if(a.length<2)s.$message({type:"info",message:"输入编码不正确 请认真输入"});else{var n=t[e].seed,r=a,l=t[e].id,d=sessionStorage.getItem("username"),c=sessionStorage.getItem("passwd");o.a.get("/retg2.php",{params:{olseed:n,retg2:r,devid:l,username:d,passwd:c}}).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(s)).catch(function(e){console.log(e)})}}).catch(function(){s.$message({type:"info",message:"取消输入"})})},handleClose_adddevice3:function(){this.dialogVisible_adddevice3=!1},tableRowClassName:function(e){var t=e.row;e.rowIndex;return 1==t.kind?"error-row":2==t.kind?"success-row":t.status>0?"success-row":"warning-row"},reflash_devlist:function(){this.warningSet.seedList=[];var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),console.log(e),this.voldata=[],o.a.post("/user/fnckukei/listmydevice",e).then(function(e){if(e.data.res){for(var t in this.tableData=e.data.results,this.tableDatatmp=e.data.results,this.has_warning=!1,this.voldata=[],this.tableData)1==this.tableData[t].kind&&(this.has_warning=!0),-1==this.tableData[t].vol&&(this.tableData[t].vol=0),this.voldata.push({key:this.tableData[t].device_seed,label:this.tableData[t].devname});this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})}}},K={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("el-row",{staticStyle:{"margin-left":"20px"}},[s("el-col",{staticStyle:{"margin-left":"20px"},attrs:{span:3}},[s("el-input",{attrs:{placeholder:"输入设备名关键字","prefix-icon":"el-icon-search"},model:{value:e.search,callback:function(t){e.search=t},expression:"search"}})],1),e._v(" "),s("el-col",{attrs:{span:1}},[s("el-button",{attrs:{type:"success",icon:"el-icon-search"},on:{click:e.researchdev}},[e._v("搜索")])],1),e._v(" "),s("el-col",{staticStyle:{"margin-left":"20px"},attrs:{span:8}},[e.isroot?s("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.func_adddevic}},[e._v("添加设备")]):e._e(),e._v(" "),s("el-button",{attrs:{type:"success",icon:"el-icon-refresh"},on:{click:e.reflash_devlist}},[e._v("刷新设备")]),e._v(" "),s("el-button",{attrs:{type:"success",icon:"el-icon-s-operation"},on:{click:e.revols}},[e._v("批量调节音量")])],1)],1),e._v(" "),s("br"),e._v(" "),s("el-alert",{directives:[{name:"show",rawName:"v-show",value:e.has_warning,expression:"has_warning"}],attrs:{title:"红色标注行:代表没有关闭提示音(设备会报连接成功或者是连接失败,仅仅用作安装调试,安装调试完之后一定记得关闭提示音);关闭提示音红色警告行会恢复正常",type:"error"}}),e._v(" "),s("el-table",{staticStyle:{width:"1610px"},attrs:{data:e.tableData,"row-class-name":e.tableRowClassName,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",label:"编号",width:"50",align:"center"}}),e._v(" "),s("el-table-column",{attrs:{prop:"devname",label:"设备名",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{prop:"device_seed",label:"序列号[Seed]",width:"280"}}),e._v(" "),s("el-table-column",{attrs:{prop:"changetime",label:"信息更新时间",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{label:"播放状态",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-tag",{directives:[{name:"show",rawName:"v-show",value:1==t.row.status,expression:"props.row.status ==1 "}],attrs:{type:"success"}},[e._v("在线")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:2==t.row.status,expression:"props.row.status ==2 "}],attrs:{type:"warning"}},[e._v("正在播放")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:0==t.row.status,expression:"props.row.status == 0"}],attrs:{type:"info"}},[e._v("不在线")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:-1==t.row.status,expression:"props.row.status == -1 "}],attrs:{type:"danger"}},[e._v(" 等待消息 ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:-2==t.row.status,expression:"props.row.status ==-2 "}],attrs:{type:"danger"}},[e._v(" 到期禁用 ")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"声音",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{staticClass:"test",attrs:{type:"warning",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goAdjustVolume(t.$index,e.tableData)}}},[e._v("调节音量")]),e._v(" "),s("el-button",{directives:[{name:"show",rawName:"v-show",value:2!=t.row.kind,expression:"scopeeee.row.kind != 2 "}],staticClass:"test",attrs:{type:"danger",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.closePromptTone(t.$index,e.tableData)}}},[e._v("关闭提示")]),e._v(" "),s("el-button",{directives:[{name:"show",rawName:"v-show",value:1!=t.row.kind,expression:"scopeeee.row.kind != 1 "}],staticClass:"test",attrs:{type:"danger",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.openPromptTone(t.$index,e.tableData)}}},[e._v("提示")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"提示音",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-tag",{directives:[{name:"show",rawName:"v-show",value:1==t.row.kind,expression:"props.row.kind == 1 "}],attrs:{type:"success"}},[e._v(" 已开启 ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:2==t.row.kind,expression:"props.row.kind == 2"}],attrs:{type:"danger"}},[e._v("已关闭")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:t.row.kind>2,expression:"props.row.kind > 2 "}]},[e._v("其他")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:t.row.kind<1,expression:"props.row.kind < 1 "}]},[e._v("y其他")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"音量",width:"150"},scopedSlots:e._u([{key:"default",fn:function(e){return s("el-progress",{attrs:{percentage:Math.round(e.row.vol/63*100)}})}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作",align:"center",width:"220"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{staticClass:"test",attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.renameRow(t.$index,e.tableData)}}},[e._v("改名")]),e._v(" "),e.isroot?s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.resnRow(t.$index,e.tableData)}}},[e._v("改SN")]):e._e(),e._v(" "),e.isroot?s("el-button",{staticStyle:{color:"#f56c6c"},attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.goDeleteRow(t.$index,e.tableData)}}},[e._v("移除")]):e._e()]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:"添加设备",visible:e.dialogVisible_adddevice,width:"400px"},on:{"update:visible":function(t){e.dialogVisible_adddevice=t}}},[s("div",{staticStyle:{"margin-top":"30px"}},[s("el-input",{attrs:{placeholder:"设备名字"},model:{value:e.name_adddevice,callback:function(t){e.name_adddevice=t},expression:"name_adddevice"}},[s("template",{slot:"prepend"},[e._v("NAME:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"设备序列号Seed"},model:{value:e.seed_adddevice,callback:function(t){e.seed_adddevice=t},expression:"seed_adddevice"}},[s("template",{slot:"prepend"},[e._v("SEED:")])],2)],1),e._v(" "),s("div",{staticStyle:{"margin-top":"15px"}},[s("el-input",{attrs:{placeholder:"设备公钥SQR"},model:{value:e.sqr_adddevice,callback:function(t){e.sqr_adddevice=t},expression:"sqr_adddevice"}},[s("template",{slot:"prepend"},[e._v("S Q R:")])],2)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_adddevice=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.func_addone_device}},[e._v("添加设备")])],1)]),e._v(" "),s("el-dialog",{attrs:{title:"调节音量",visible:e.dialogVisible_adddevice2,width:"400px"},on:{"update:visible":function(t){e.dialogVisible_adddevice2=t}}},[s("div",{staticClass:"block"},[s("el-slider",{attrs:{step:10},model:{value:e.volumeAdjust.vol1,callback:function(t){e.$set(e.volumeAdjust,"vol1",t)},expression:"volumeAdjust.vol1"}})],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_adddevice2=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.adjustVolume}},[e._v("保存")])],1)]),e._v(" "),s("el-dialog",{attrs:{title:"批量调节音量",visible:e.dialogVisible_adddevice4,width:"760px"},on:{"update:visible":function(t){e.dialogVisible_adddevice4=t}}},[s("div",{staticClass:"edit_dev"},[s("el-transfer",{attrs:{filterable:"",titles:["所有设备","需要被调节音量的设备"],data:e.voldata},model:{value:e.volvalue,callback:function(t){e.volvalue=t},expression:"volvalue"}})],1),e._v(" "),s("span",{staticClass:"demonstration"},[e._v("音量")]),e._v(" "),s("div",{staticClass:"block"},[s("el-slider",{attrs:{step:10},model:{value:e.volumeAdjust.vol3,callback:function(t){e.$set(e.volumeAdjust,"vol3",t)},expression:"volumeAdjust.vol3"}})],1),e._v(" "),s("br"),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.adjustVolumes}},[e._v("保存")]),e._v(" "),s("el-button",{on:{click:function(t){e.dialogVisible_adddevice4=!1}}},[e._v("取消")])],1)],1)},staticRenderFns:[]};var H=s("VU/8")(z,K,!1,function(e){s("NtWK"),s("F2H3")},"data-v-78c125a7",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Y=s("xrTZ").Base64,W={data:function(){return{form:{space:0,kind:"随机播放",num:1,length1:0,length2:0,length3:0,mode:0,port:"",ip:"",fileStr:"",seedStr:"",filelist:{data:[],value:[]}},drawer:!1,playList:[],playNameList:[],tableDatatasklist:[],tableDatafilelist:[],options:[],nodeid:"",group_name:"",tableData:[],dialogVisible_adddevice:!1,dialogVisible_adddevice2:!1,name_adddevice:"",seed_adddevice:"",seed_ofnode:"",tag1:"自定义标签A可选",tag2:"自定义标签B可选",type:"1",device_status:"1",sqr_adddevice:"",save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,valueT:[],Tdata:[],valueT2:[],Tdata2:[],forgid:-1,loading:!1}},created:function(){this.reflash_devlist()},components:{myTransfer:R},methods:{getPlayList:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/tmplistpl",e).then(function(e){e.data.res?e.data.tps.length>0&&(this.playList=e.data.tps,this.drawer=!0):(this.$notify.success({title:"Info",message:"当前没有正在播放的序列",showClose:!0}),this.drawer=!1)}.bind(this)).catch(function(e){console.log(e)})},countfuck:function(){this.countLength()},stopGroup:function(e){console.log(e),this.loading=!0;var t=new FormData;t.append("id",sessionStorage.getItem("id")),t.append("token",sessionStorage.getItem("token")),t.append("tpid",e.tmpid),o.a.post("/user/tmpstoppl",t).then(function(e){var t=this;e.data.res?(console.log(e.data),setTimeout(function(){t.getPlayList(),t.loading=!1},5e3)):(this.loading=!1,this.$notify.success({title:"Info",message:"获取失败",showClose:!0}))}.bind(this)).catch(function(e){console.log(e)})},goDeleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该分组, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){s.deleteRow(e,t)}).catch(function(){})},startGroup:function(){this.form.num>0&&(this.form.mode=this.form.num),this.form.kind=this.form.mode;var e=[];for(var t in this.valueT2)e.push(this.valueT2[t]);if(this.form.fileStr=e.join("|"),this.form.fileStr){var s=[];for(var t in this.Tdata2)this.valueT2.includes(this.Tdata2[t].key)&&s.push(this.Tdata2[t].id);console.log(s),this.form.fileStr=s.join("|"),console.log(this.form.fileStr);var i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("playmode",this.form.mode),i.append("len",this.form.length3),i.append("jiange",this.form.space),i.append("fileids",this.form.fileStr),i.append("snids",this.form.seedStr),o.a.post("/user/tmpstartpl",i).then(function(e){e.data.res?this.$notify.success({title:"Info",message:"播放成功",showClose:!0}):(console.log(e.data),this.$notify.success({title:"Info",message:"添加出现异常",showClose:!0}))}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice2=!1}else this.$message({type:"warning",message:"没有选择文件"})},countNum:function(){this.form.length2=this.form.length1+this.form.space*(this.valueT2.length-1)},countSpace:function(){this.form.length2=this.form.length1+this.form.space*(this.valueT2.length-1),this.form.length3=this.form.length2*this.form.num+this.form.space*this.form.num},countLength:function(){this.form.length1=0;for(var e=0;e<this.tableDatafilelist.length;e++)for(var t=0;t<this.valueT2.length;t++)this.valueT2[t]==this.tableDatafilelist[e].url+","+this.tableDatafilelist[e].len&&(this.form.length1+=parseInt(this.tableDatafilelist[e].len));this.countSpace()},task_mode_change:function(){"0"==this.form.kind?(this.form.num=0,this.form.length3=this.form.length2):this.form.num=1},setPlay:function(e,t){this.get_file_list();var s=[];s=t[e].idlist,this.form.seedStr=s.join("|"),console.log(this.form.seedStr),this.dialogVisible_adddevice2=!0,this.valueT2=[]},func_addgoupKey:function(){if(this.dialogVisible_adddevice=!1,""!=this.group_name.trim()){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("gname",this.group_name),o.a.post("/user/addgname",e).then(function(e){e.data.res?this.reflash_devlist():this.$notify.success({title:"Info",message:"添加出现异常",showClose:!0})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"分组字不能为空",showClose:!0})},func_save_group:function(){var e=this;if(console.log(this.valueT.length),0!=this.valueT.length){var t="";if(0!=this.valueT.length){this.Tdata.forEach(function(s){e.valueT.includes(s.key)&&(t+=s.id,t+="|")}),t=t.substr(0,t.length-1),console.log(t);var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("gid",this.forgid),s.append("devids",t),o.a.post("/user/editgdevs",s).then(function(e){e.data.res?(this.reflash_devlist(),this.dialogVisible_adddevice=!1,this.$notify.success({title:"Info",message:"修改成功",showClose:!0})):this.$notify.success({title:"Info",message:"添加出现异常",showClose:!0})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"分组为空不能保存",showClose:!0})}},func_addgoup:function(){},func_adddevic:function(){this.dialogVisible_adddevice=!0},deleteRow:function(e,t){var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("gid",t[e].gid),s.append("token",sessionStorage.getItem("token")),o.a.post("/user/delgroup",s).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"删除成功",showClose:!0}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"删除失败",showClose:!0})}.bind(this)).catch(function(e){console.log(e)})},EditRow:function(e,t){this.dialogVisible_adddevice=!1;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("gid",t[e].gid),o.a.post("/user/fnckukei/getonegdevs",s).then(function(s){s.data.res?(this.Tdata=s.data.dev_info,this.valueT=s.data.dev_info_S,this.forgid=t[e].gid,this.dialogVisible_adddevice=!0):this.$notify.success({title:"Info",message:"添加出现异常1",showClose:!0})}.bind(this)).catch(function(e){console.log(e)})},handleClose_adddevice:function(){this.dialogVisible_adddevice=!1},handleClose_adddevice2:function(){this.dialogVisible_adddevice2=!1},tableRowClassName:function(e){e.row;var t=e.rowIndex;return 1===t?"warning-row":3===t?"success-row":""},reflash_devlist:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listdetailgroups",e).then(function(e){e.data.res&&(this.tableData=e.data.list,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_devlist2:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.options=e.data.outlableid,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},get_file_list:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listfile",e).then(function(e){if(e.data.res){this.tableDatafilelist=e.data.filelist,this.tableDatafilelist.forEach(function(e,t){e.filename=Y.decode(e.filenamebase64),e.filesize=e.sizeStr});for(var t=[],s=0;s<this.tableDatafilelist.length;s++)t.push({key:this.tableDatafilelist[s].url+","+this.tableDatafilelist[s].len,label:this.tableDatafilelist[s].filename,id:this.tableDatafilelist[s].id});this.Tdata2=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})}}},j={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)",align:"left"}},[s("el-row",[s("div",{staticClass:"up"},[s("el-input",{staticClass:"input-with-select",attrs:{placeholder:"输入分组名称"},model:{value:e.group_name,callback:function(t){e.group_name=t},expression:"group_name"}},[s("el-button",{attrs:{slot:"append",icon:"el-icon-plus"},on:{click:e.func_addgoupKey},slot:"append"},[e._v("添加分组")]),e._v(" "),s("el-button",{attrs:{slot:"append",icon:"el-icon-tickets"},on:{click:e.getPlayList},slot:"append"},[e._v("播放菜单")])],1)],1)]),e._v(" "),s("el-table",{staticStyle:{width:"900px"},attrs:{data:e.tableData,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"编号 "}}),e._v(" "),s("el-table-column",{attrs:{prop:"name",label:"分组名字 ",width:"400"}}),e._v(" "),s("el-table-column",{attrs:{prop:"dlist.length",label:"设备个数 ",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{label:"操作[Operation]",align:"center",width:"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"warning",icon:"el-icon-edit",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.EditRow(t.$index,e.tableData)}}},[e._v("编辑")]),e._v(" "),s("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goDeleteRow(t.$index,e.tableData)}}},[e._v("删除")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"实时播放",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"primary",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.setPlay(t.$index,e.tableData)}}},[e._v("分组点播")])]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:"编辑设备",visible:e.dialogVisible_adddevice,"before-close":e.handleClose_adddevice,width:"800px"},on:{"update:visible":function(t){e.dialogVisible_adddevice=t}}},[s("el-transfer",{attrs:{filterable:"",titles:["所有设备","选中的"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.Tdata},model:{value:e.valueT,callback:function(t){e.valueT=t},expression:"valueT"}}),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_save_group}},[e._v("保存分组")])],1)],1),e._v(" "),s("el-dialog",{attrs:{title:"分组点播",visible:e.dialogVisible_adddevice2,"before-close":e.handleClose_adddevice2,width:"800px"},on:{"update:visible":function(t){e.dialogVisible_adddevice2=t}}},[s("el-form",{ref:"form",attrs:{model:e.form,"label-width":"80px",align:"left"}},[s("myTransfer",{staticStyle:{"margin-left":"20px"},attrs:{inputList:e.Tdata2},on:{countLength:e.countLength},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.option;return s("span",{},[e._v(e._s(i.label))])}}]),model:{value:e.valueT2,callback:function(t){e.valueT2=t},expression:"valueT2"}}),e._v(" "),s("el-form-item",{staticStyle:{"margin-top":"50px"},attrs:{label:"文件间隔"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"以秒为单位,默认1秒; 一个文件播放完毕之后 间隔多少秒再播下一个",placement:"right-start"}},[s("el-input-number",{attrs:{min:1},on:{change:e.countLength},model:{value:e.form.space,callback:function(t){e.$set(e.form,"space",t)},expression:"form.space"}})],1)],1),e._v(" "),s("el-row",{staticClass:"fucko"},[s("el-col",{attrs:{span:6}},[s("el-form-item",{attrs:{label:"播放次数"}},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"整个列表循环播放多少遍",placement:"right-start"}},[s("el-input-number",{attrs:{min:1},on:{change:e.countLength},model:{value:e.form.num,callback:function(t){e.$set(e.form,"num",t)},expression:"form.num"}})],1)],1)],1)],1),e._v(" "),s("el-form-item",{attrs:{label:"总时长"}},[s("el-input-number",{model:{value:e.form.length3,callback:function(t){e.$set(e.form,"length3",t)},expression:"form.length3"}})],1)],1),e._v(" "),s("span",{staticStyle:{"text-align":"center"}},[s("el-button",{attrs:{type:"success"},on:{click:e.startGroup}},[e._v("播放")])],1)],1),e._v(" "),s("el-drawer",{attrs:{title:"播放列表",visible:e.drawer,direction:"btt"},on:{"update:visible":function(t){e.drawer=t}}},[s("div",{staticStyle:{"overflow-y":"auto",height:"200px"}},e._l(e.playList,function(t,i){return s("div",{key:i,staticStyle:{"padding-left":"20px"}},[s("div",[e._v("播放序列:"+e._s(t.Name)+" 每个文件播放间隔: "+e._s(t.jiange)+" 播放循环次数:"+e._s(t.playmode))]),e._v(" "),s("el-button",{attrs:{type:"warning",size:"small",plain:""},on:{click:function(s){return e.stopGroup(t)}}},[e._v("停止")])],1)}),0)])],1)},staticRenderFns:[]};var q=s("VU/8")(W,j,!1,function(e){s("oPea")},"data-v-47ff1b6c",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var X={components:{"a-player":T.a},data:function(){return{options:[],nodeid:"",zipasswd:"",zibeizhu:"",ziusername:"",group_name:"",tableData:[],dialogVisible_adddevice1:!1,dialogVisible_adddevice2:!1,dialogVisible_adddevice3:!1,name_adddevice:"",seed_adddevice:"",seed_ofnode:"",tag1:"自定义标签A可选",tag2:"自定义标签B可选",type:"1",device_status:"1",sqr_adddevice:"",save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,valueT:[],valueFS:[],dev_info_zS:[],Tdata:[],fornodeid:-1,forgid:-1,userlevel:1,autoplay:!1,isroot:!1,fileList:[],tableDatafilelist:[],songList:[],flag:!1,mask:"",canCreate:!1}},created:function(){this.userlevel=sessionStorage.getItem("user_level")-1,this.reflash_devlist(),this.mask=sessionStorage.getItem("mask"),console.log("===================>"),console.log(this.mask),console.log("===================>"),"1"==this.mask.charAt(0)&&(this.canCreate=!0)},methods:{goTokenRow:function(e,t){var s=new FormData;s.append("username",t[e].user_name),s.append("passwd",t[e].user_pass),o.a.post("/user/gtoken",s).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"测试成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"测试失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},goDeleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该用户, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){s.deleteRow(e,t)}).catch(function(){})},open5:function(){this.$alert(this.save_backdata,"配置详情",{dangerouslyUseHTMLString:!1})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},playurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},func_addziuserKey:function(){if(""==this.ziusername.trim()||this.ziusername.length<7)this.$notify.success({title:"Info",message:"用户名需要11位数字手机号码",showClose:!0});else if(""==this.zipasswd||this.zipasswd.length<7)this.$notify.success({title:"Info",message:"密码必须为7位以上 英文或数字混写",showClose:!0});else{if(console.log("==>"+this.userlevel+"=>"+sessionStorage.getItem("user_level")+"==>"+sessionStorage.getItem("user_type")),this.userlevel>=1&&this.userlevel<sessionStorage.getItem("user_level")){""==this.zibeizhu.trim()&&(this.zibeizhu="NOTHING");var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("zipasswd",this.zipasswd),e.append("ziusername",this.ziusername),e.append("beizhu",this.zibeizhu),e.append("level",this.userlevel),e.append("nickname","nickname"),e.append("mask","00000000000000000000000000000000000000000000"),o.a.post("/user/fnckukei/addziuser",e).then(function(e){e.data.res?this.reflash_devlist():this.$notify.success({title:"Info",message:"添加出错 可能用户名已经被占用",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"用户等级不正确",showClose:!0});this.dialogVisible_adddevice1=!1}},func_save_ziuserdev:function(){var e="",t="",s=[],i=[],a=[],n=[],r=[],l=[];if(console.log(this.Tdata),console.log(this.valueT),console.log(this.valueT.length),0!=this.valueT.length){this.valueFS.forEach(function(e,t,i){s.push(e)}),this.valueT.forEach(function(e,t,s){l.push(e)}),s.forEach(function(e,t,s){0==l.includes(e)&&(a.push(e),console.log("dis_cols ->",e))}),console.log("dis_cols--\x3e"),console.log(a),l.forEach(function(e,t,a){0==s.includes(e)&&(i.push(e),console.log("pus_cols ->",e))}),console.log("pus_cols->"),console.log(i),this.dev_info_zS.forEach(function(e,t,s){1==a.includes(e.device_seed)&&r.push(e.id)}),console.log("-----------------dis_idcols------------------"),console.log(r),this.Tdata.forEach(function(e,t,s){1==i.includes(e.device_seed)&&n.push(e.id)}),console.log("-----------------pus_idcols------------------"),console.log(n),t=r.length>0?r.join("|"):"null",e=n.length>0?n.join("|"):"null",console.log("pus_idstr:",e),console.log("dis_idstr:",t);var d=new FormData;d.append("id",sessionStorage.getItem("id")),d.append("token",sessionStorage.getItem("token")),d.append("gid",this.forgid),d.append("pus_idstr",e),d.append("dis_idstr",t),o.a.post("/user/fnckukei/changezidevices",d).then(function(e){e.data.res?(this.reflash_devlist(),this.dialogVisible_adddevice=!1):this.$notify.success({title:"Info",message:"添加出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice2=!1}},func_addgoup:function(){},func_adddevic:function(){this.dialogVisible_adddevice2=!0},deleteRow:function(e,t){var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("zid",t[e].id),o.a.post("/user/fnckukei/delziuser",s).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"删除成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"删除失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},EditRow:function(e,t){this.dialogVisible_adddevice2=!0;var s=new FormData;s.append("id",sessionStorage.getItem("id")),s.append("token",sessionStorage.getItem("token")),s.append("zid",t[e].id),s.append("ztoken",t[e].token),this.ziusername=t[e].user_name,o.a.post("/user/fnckukei/info_edit_listziuser",s).then(function(s){s.data.res?(this.Tdata=s.data.dev_info,this.valueT=s.data.dev_info_S,this.valueFS=s.data.dev_info_S,this.dev_info_zS=s.data.dev_info_zS,this.forgid=t[e].id,this.dialogVisible_adddevice=!0):this.$notify.success({title:"Info",message:"添加出现异常1",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},Edittg:function(e,t){var s=this;t[e].ziuserid;this.$prompt("New 备注:","提示",{confirmButtonText:"确定",cancelButtonText:"取消",inputErrorMessage:"格式不正确"}).then(function(i){var a=i.value;if(a.length<5)s.$message({type:"info",message:"输入备注不正确 请认真输入"});else{var n=new FormData;n.append("id",t[e].id),n.append("token",t[e].token),n.append("nickname",a),o.a.post("/user/fnckukei/newnickname",n).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"修改成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(s)).catch(function(e){console.log(e)})}}).catch(function(){s.$message({type:"info",message:"取消输入"})})},refileRow:function(e,t){this.dialogVisible_adddevice3=!0,o.a.get("/Get_file_Listbyid.php",{params:{username:t[e].user_name,ziuserid:t[e].ziuserid,kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Base64.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},handleClose_adddevice1:function(){this.dialogVisible_adddevice1=!1},handleClose_adddevice2:function(){this.dialogVisible_adddevice2=!1},handleClose_adddevice3:function(){this.dialogVisible_adddevice3=!1,this.reflash_devlist()},tableRowClassName:function(e){e.row;var t=e.rowIndex;return 1===t?"warning-row":3===t?"success-row":""},reflash_devlist:function(){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/fnckukei/listziuser",e).then(function(e){e.data.res&&(console.log(e),1==e.data.res?(this.tableData=e.data.results,console.log(e.data)):this.newusererroinfo="添加异常")}.bind(this)).catch(function(e){console.log(e)})}}},Q={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmgerji"}},[s("el-row",[e.canCreate?s("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(t){e.dialogVisible_adddevice1=!0}}},[e._v("添加子账户")]):e._e(),e._v(" "),s("el-button",{attrs:{type:"success",icon:"el-icon-refresh"},on:{click:e.reflash_devlist}},[e._v("刷新")])],1),e._v(" "),s("el-table",{staticStyle:{width:"1420px"},attrs:{data:e.tableData,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"编号 "}}),e._v(" "),s("el-table-column",{attrs:{prop:"user_name",label:"子账户名字 ",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{prop:"user_level",label:"子账户等级 ",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{prop:"nickname",label:"昵称",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{prop:"ctime",label:"时间 ",width:"200"}}),e._v(" "),s("el-table-column",{attrs:{label:"操作[Operation]",width:"400",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-badge",{staticClass:"item"},[s("el-button",{attrs:{type:"warning",icon:"el-icon-edit",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.EditRow(t.$index,e.tableData)}}},[e._v("编辑")])],1),e._v(" "),s("el-badge",{staticClass:"item"},[s("el-button",{attrs:{type:"warning",icon:"el-icon-edit",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.Edittg(t.$index,e.tableData)}}},[e._v("改昵称")])],1),e._v(" "),s("el-badge",{staticClass:"item",attrs:{value:e.tableData[t.$index].shenhecount,max:10,type:"primary"}}),e._v(" "),s("el-badge",{staticClass:"item"},[s("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goDeleteRow(t.$index,e.tableData)}}},[e._v("删除")])],1),e._v(" "),s("el-badge",{staticClass:"item"},[s("el-button",{attrs:{type:"danger",icon:"el-icon-refresh",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goTokenRow(t.$index,e.tableData)}}},[e._v("状态测试")])],1)]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:"编辑设备",visible:e.dialogVisible_adddevice2,"before-close":e.handleClose_adddevice2,width:"800px"},on:{"update:visible":function(t){e.dialogVisible_adddevice2=t}}},[[s("span",[e._v("子用户名:"+e._s(e.ziusername))]),e._v(" "),s("el-divider"),e._v(" "),s("el-transfer",{attrs:{width:"800px",filterable:"",titles:["所有设备","选中的"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.Tdata},model:{value:e.valueT,callback:function(t){e.valueT=t},expression:"valueT"}})],e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_save_ziuserdev}},[e._v("保存")])],1)],2),e._v(" "),s("el-dialog",{attrs:{title:"添子账户",visible:e.dialogVisible_adddevice1,width:"400px","before-close":e.handleClose_adddevice1},on:{"update:visible":function(t){e.dialogVisible_adddevice1=t}}},[s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"建议使用该用户的手机号码",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:"子账户用户名"},model:{value:e.ziusername,callback:function(t){e.ziusername=t},expression:"ziusername"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"密码为数字或者是英文字符",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{placeholder:"子账户密码","show-password":""},model:{value:e.zipasswd,callback:function(t){e.zipasswd=t},expression:"zipasswd"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"账号备注",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{placeholder:"子账户备注信息"},model:{value:e.zibeizhu,callback:function(t){e.zibeizhu=t},expression:"zibeizhu"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"子用户等级不得高于自己等级",placement:"top-start"}},[s("el-input-number",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{min:1,max:e.userlevel,label:"用户等级"},model:{value:e.userlevel,callback:function(t){e.userlevel=t},expression:"userlevel"}})],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_addziuserKey}},[e._v("添加子账户")])],1)],1),e._v(" "),s("el-dialog",{attrs:{title:"审核文件",visible:e.dialogVisible_adddevice3,"before-close":e.handleClose_adddevice3,width:"900px"},on:{"update:visible":function(t){e.dialogVisible_adddevice3=t}}},[s("div",{staticStyle:{padding:"10px 0"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"800px"},attrs:{data:e.tableDatafilelist,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"编号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filename",label:"文件名",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filesize",label:"文件大小",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{label:"试听",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.playurl(t.$index,e.tableDatafilelist)}}},[e._v("播放")])]}}])}),e._v(" "),e.isroot?s("el-table-column",{attrs:{label:"审核",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(s){return e.abletask(t.$index,e.tableDatafilelist)}},model:{value:e.tableDatafilelist[t.$index].enable,callback:function(s){e.$set(e.tableDatafilelist[t.$index],"enable",s)},expression:"tableDatafilelist[scope.$index].enable"}})]}}],null,!1,2873227358)}):e._e()],1)],1)],1)},staticRenderFns:[]};var J=s("VU/8")(X,Q,!1,function(e){s("faL3")},"data-v-ddd1071a",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Z={data:function(){return{passwd:"",newpass1:"",newpass2:"",options:[],nodeid:"",group_name:"",tableData:[],dialogVisible_adddevice:!1,name_adddevice:"",seed_adddevice:"",seed_ofnode:"",tag1:"自定义标签A可选",tag2:"自定义标签B可选",type:"1",device_status:"1",sqr_adddevice:"",save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,valueT:[],Tdata:[],fornodeid:-1,forgid:-1}},created:function(){},methods:{func_changepasswd:function(){if(""!=this.passwd.trim())if(""!=this.newpass1.trim())if(""!=this.newpass2.trim())if(this.newpass1.trim()==this.newpass2.trim()&&this.passwd.trim()==sessionStorage.getItem("passwd")){var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("newpass",this.newpass1),o.a.post("/user/fnkukei/newpasswdnick",e).then(function(e){e.data.res?(this.$notify.success({title:"Info",message:"密码修改成功",showClose:!1}),sessionStorage.setItem("passwd",this.newpass1)):this.$notify.success({title:"Info",message:"密码修改失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"密码不相符",showClose:!1});else this.$notify.success({title:"Info",message:"不能为空",showClose:!1});else this.$notify.success({title:"Info",message:"不能为空",showClose:!1});else this.$notify.success({title:"Info",message:"不能为空",showClose:!1})}}},ee={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmgpasswd"}},[s("el-input",{staticClass:"oxiaom_input",attrs:{placeholder:"****","show-password":""},model:{value:e.passwd,callback:function(t){e.passwd=t},expression:"passwd"}},[s("template",{slot:"prepend"},[e._v("旧密码")])],2),e._v(" "),s("br"),e._v(" "),s("el-input",{staticClass:"oxiaom_input",attrs:{placeholder:"****","show-password":""},model:{value:e.newpass1,callback:function(t){e.newpass1=t},expression:"newpass1"}},[s("template",{slot:"prepend"},[e._v("新密码")])],2),e._v(" "),s("el-input",{staticClass:"oxiaom_input",attrs:{placeholder:"****","show-password":""},model:{value:e.newpass2,callback:function(t){e.newpass2=t},expression:"newpass2"}},[s("template",{slot:"prepend"},[e._v("新密码")])],2),e._v(" "),s("el-button",{staticClass:"oxiaom_input",attrs:{type:"primary",round:""},on:{click:e.func_changepasswd}},[e._v("修改密码")])],1)},staticRenderFns:[]};var te=s("VU/8")(Z,ee,!1,function(e){s("Bugp")},"data-v-902300ba",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};s("xrTZ").Base64;var se={components:{"a-player":T.a},data:function(){return{optionsshengyin:[{value:"xiaoyan",label:"讯飞小燕"},{value:"aisjiuxu",label:"讯飞徐久"},{value:"aisxping",label:"讯飞AI小萍"},{value:"aisjinger",label:"讯飞AI小婧"}],optionsyusu:[{value:50,label:"中"},{value:35,label:"慢"},{value:65,label:"快"}],valueshengyin:"xiaoyan",valueyusu:50,flag:!1,actions:"",actionsmp3:"",dialogVisible:!1,userid:0,fileList:[],inputfilename:"",tableDatafilelist:[],textarea:"",songList:[],autoplay:!1,isroot:!1,loading:!1}},created:function(){this.userid=sessionStorage.getItem("id"),this.actions="/uploader.php?username="+sessionStorage.getItem("username")+"&passwd="+sessionStorage.getItem("passwd")+"&kind=mp3",this.actionsmp3="/uploader.php?username="+sessionStorage.getItem("username")+"&passwd="+sessionStorage.getItem("passwd")+"&kind=mp3",this.get_file_list(),-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{playurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},handleClose:function(){},add_tty:function(){if(""!=this.filename&&!(this.textarea.length<3)){this.loading=!0;var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),e.append("vol",100),e.append("text",this.textarea),e.append("speed",this.valueyusu),e.append("shengyin",this.valueshengyin),e.append("filename",this.inputfilename),o.a.post("/user/savettsfile",e).then(function(e){e.data.res?(console.log(e),this.$notify.success({title:"Info",message:"添加成功",showClose:!1}),this.get_file_list(),this.dialogVisible=!1,this.loading=!1):(this.loading=!1,this.$notify.success({title:"Info",message:"添加节点出现异常检查是否重复添加",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)})}},deleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该文件, 是否继续? "+t[e].filename,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var i=new FormData;i.append("id",sessionStorage.getItem("id")),i.append("token",sessionStorage.getItem("token")),i.append("fileid",t[e].id),o.a.post("/user/delfile",i).then(function(s){s.data.res&&(t.splice(e,1),this.get_file_list(),this.$message({type:"success",message:"删除成功!"+filename}))}.bind(s)).catch(function(e){console.log(e)})}).catch(function(){s.$message({type:"info",message:"已取消删除"})})},uploadError:function(e,t,s){this.$message({message:"上传文件出错了!",type:"error"})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},uploadbefore:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),s||i?!!a||(this.$message({message:"上传模板大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MK格式!",type:"warning"}),!1)},uploadbeforemp3:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),s||i?!!a||(this.$message({message:"上传模板大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MP3格式!",type:"warning"}),!1)},uploadSuccess:function(e,t,s){console.log("上传文件",e),this.get_file_list()},uploadSuccessmp3:function(e,t,s){console.log("上传文件",e),this.get_file_list()},get_file_list:function(){sessionStorage.getItem("master_id")>0&&(this.isroot=!1);var e=new FormData;e.append("id",sessionStorage.getItem("id")),e.append("token",sessionStorage.getItem("token")),o.a.post("/user/listfile",e).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.filelist,console.log(this.tableDatafilelist),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},ie={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{"element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("div",{attrs:{id:"uoloaddiv34",align:"left"}},[s("el-button",{attrs:{type:"button"},on:{click:function(t){e.dialogVisible=!0}}},[e._v("添加文字转语音 ")]),e._v(" "),s("el-dialog",{attrs:{title:"添加文字转语音",visible:e.dialogVisible,width:"50%"},on:{"update:visible":function(t){e.dialogVisible=t}}},[s("div",[s("el-tag",{attrs:{type:"warning"}},[e._v("文字转语音要保存的文件名")]),s("el-input",{attrs:{placeholder:"请输入保存的资源名称"},model:{value:e.inputfilename,callback:function(t){e.inputfilename=t},expression:"inputfilename"}},[s("template",{slot:"prepend"},[e._v("SRC-NAME:")])],2)],1),e._v(" "),s("br"),s("el-tag",[e._v("男声女声选择:")]),e._v(" "),s("el-select",{model:{value:e.valueshengyin,callback:function(t){e.valueshengyin=t},expression:"valueshengyin"}},e._l(e.optionsshengyin,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1),e._v(" "),s("el-tag",[e._v("语速:")]),e._v(" "),s("el-select",{model:{value:e.valueyusu,callback:function(t){e.valueyusu=t},expression:"valueyusu"}},e._l(e.optionsyusu,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1),e._v(" "),s("el-divider"),e._v(" "),s("el-input",{attrs:{type:"textarea",rows:20,placeholder:"请输入内容",maxlength:"2000","show-word-limit":"",minlength:"3"},model:{value:e.textarea,callback:function(t){e.textarea=t},expression:"textarea"}}),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.add_tty}},[e._v("确 定")])],1)],1),e._v(" "),s("div",{staticStyle:{padding:"10px 0"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"800px"},attrs:{data:e.tableDatafilelist,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"编号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filename",label:"文件名",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"sizeStr",label:"文件大小",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{label:"试听",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.playurl(t.$index,e.tableDatafilelist)}}},[e._v("播放")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{disabled:1==e.tableDatafilelist[t.$index].ismasterd,type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.deleteRow(t.$index,e.tableDatafilelist)}}},[e._v("移除")])]}}])})],1)],1)])},staticRenderFns:[]};var ae=s("VU/8")(se,ie,!1,function(e){s("JzLO")},"data-v-465171d6",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var ne=s("xrTZ").Base64,re={components:{"a-player":T.a},data:function(){return{flag:!1,actions:"",actionsmp3:"",dialogVisible:!1,userid:0,fileList:[],diantainame:"",diantaidetail:"",tableDatafilelist:[],activeName:"wangluodiantai",songList:[],autoplay:!1,isroot:!1,diantaileixing:"",tableData:[],tableDatawl:[],tableDatawlCollected:[],options:[{value:0,label:"专用电台"},{value:1,label:"网络电台"}]}},created:function(){this.userid=sessionStorage.getItem("id"),-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{handleClickdiantaitab:function(e,t){e.name},ablediantai:function(e,t){console.log(e),console.log(t[e].id),console.log(t[e].enable);t[e].id;o.a.get("/Change_diantai_statusweb.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),diantai_id:t[e].id,diantai_enable:t[e].enable}}).then(function(e){e.data.res&&this.reflush_wodediantai()}.bind(this)).catch(function(e){console.log(e)})},markdiantai:function(e,t){t[e].id;o.a.get("/mark_diantai_statusweb.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),diantai_id:t[e].id,diantai_enable:t[e].enable}}).then(function(e){e.data.res&&reflush_wodediantai()}.bind(this)).catch(function(e){console.log(e)})},click_shenqingdiantai:function(){if(""!=this.diantaidetail)if(""!=this.diantainame)if(0==this.diantaileixing||1==this.diantaileixing){var e=new FormData;e.append("username",sessionStorage.getItem("username")),e.append("passwd",sessionStorage.getItem("passwd")),e.append("detail",this.diantaidetail),e.append("diantainame",this.diantainame),e.append("kind",this.diantaileixing),o.a.post("/shenqingdiantai.php",e).then(function(e){e.data.res?(reflush_wodediantai(),this.dialogVisible=!1):this.$notify.success({title:"提示",message:"已经有正在申请的 频道信息!或者参数有误",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else console.log("diantaileixing budui");else console.log("diantaimingzi budui");else console.log("diantaixiangqingbudui")},reflush_wodediantai:function(){o.a.get("/Get_mydiantai_list.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){if(e.data.res){console.log(e.data),console.log("hh"),this.tableDatawlCollected=[];for(var t=0;t<e.data.diantai.length;t++)1==e.data.diantai[t].enable&&this.tableDatawlCollected.push(e.data.diantai[t]);this.tableData=e.data.diantai,this.tableDatawl=e.data.diantai}}.bind(this)).catch(function(e){console.log(e)})},playurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},deleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该文件, 是否继续? "+t[e].filename,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var i=t[e].filename;o.a.get("/del_file.php",{params:{filename:ne.encode(i),username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(s){s.data.res&&(t.splice(e,1),this.get_file_list(),this.$message({type:"success",message:"删除成功!"+i}))}.bind(s)).catch(function(e){console.log(e)})}).catch(function(){s.$message({type:"info",message:"已取消删除"})})},uploadError:function(e,t,s){this.$message({message:"上传文件出错了!",type:"error"})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},uploadbefore:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),s||i?!!a||(this.$message({message:"上传模板大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MK格式!",type:"warning"}),!1)},uploadbeforemp3:function(e){var t=new Array,s="mp3"===(t=e.name.split("."))[t.length-1],i="MP3"===t[t.length-1],a=e.size/1024/1024<40;return t=e.name.split("."),s||i?!!a||(this.$message({message:"上传模板大小不能超过 40MB!",type:"warning"}),!1):(this.$message({message:"上传文件只能是MP3格式!",type:"warning"}),!1)},uploadSuccess:function(e,t,s){console.log("上传文件",e),this.get_file_list()},uploadSuccessmp3:function(e,t,s){console.log("上传文件",e),this.get_file_list()},get_file_list:function(){o.a.get("/Get_file_List.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=ne.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},oe={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("div",{attrs:{id:"uoloaddiv35",align:"left"}},[s("el-button",{staticClass:"margingbot10",attrs:{type:"button"},on:{click:function(t){e.dialogVisible=!0}}},[e._v("申请入驻电台")]),e._v(" "),s("el-dialog",{attrs:{title:"申请入驻:",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t}}},[s("div",{staticClass:"shenqingdiantai123"},[s("el-select",{attrs:{placeholder:"选择电台类型"},model:{value:e.diantaileixing,callback:function(t){e.diantaileixing=t},expression:"diantaileixing"}},e._l(e.options,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)],1),e._v(" "),s("div",{staticClass:"shenqingdiantai123"},[s("el-input",{attrs:{placeholder:"电台名字",maxlength:"10","show-word-limit":""},model:{value:e.diantainame,callback:function(t){e.diantainame=t},expression:"diantainame"}},[s("template",{slot:"prepend"},[e._v("NAME:")])],2)],1),e._v(" "),s("div",{staticClass:"shenqingdiantai123"},[s("el-input",{attrs:{type:"textarea",placeholder:"电台描述",maxlength:"100","show-word-limit":""},model:{value:e.diantaidetail,callback:function(t){e.diantaidetail=t},expression:"diantaidetail"}},[s("template",{slot:"prepend"},[e._v("DETAIL:")])],2)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.click_shenqingdiantai}},[e._v("确 定")])],1)]),e._v(" "),s("el-tabs",{on:{"tab-click":e.handleClickdiantaitab},model:{value:e.activeName,callback:function(t){e.activeName=t},expression:"activeName"}},[s("el-tab-pane",{attrs:{label:"我的电台",name:"wodediantai"}},[s("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData}},[s("el-table-column",{attrs:{type:"expand"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-form",{staticClass:"demo-table-expand",attrs:{"label-position":"left",inline:""}},[s("el-form-item",{attrs:{label:"名字"}},[s("span",[e._v(e._s(t.row.name))])]),e._v(" "),s("el-form-item",{attrs:{label:"分类"}},[s("span",[e._v(e._s(t.row.kind))])]),e._v(" "),s("el-form-item",{attrs:{label:"大类"}},[s("span",[e._v(e._s(t.row.mkind))])]),e._v(" "),s("el-form-item",{attrs:{label:"描述"}},[s("span",[e._v(e._s(t.row.detail))])]),e._v(" "),s("el-form-item",{attrs:{label:"状态"}},[s("span",[e._v(e._s(t.row.type))])]),e._v(" "),s("el-form-item",{attrs:{label:"地址"}},[s("span",[e._v(e._s(t.row.md5md5))])]),e._v(" "),s("el-form-item",{attrs:{label:"开关"}},[s("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-value":"1","inactive-value":"0"},on:{change:function(s){return e.ablediantai(t.$index,e.tableData)}},model:{value:t.row.enable,callback:function(s){e.$set(t.row,"enable",s)},expression:"props.row.enable"}})],1)],1)]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"电台",prop:"icon",width:"350px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("div",{staticClass:"item"},[s("div",{staticClass:"left"},[s("img",{attrs:{src:"src/assets/logo.png",alt:"#"}})]),e._v(" "),s("div",{staticClass:"right"},[s("h4",[e._v(e._s(t.row.name))]),e._v(" "),s("p",[e._v(e._s(t.row.detail))])])])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"分类",prop:"kind"}}),e._v(" "),s("el-table-column",{attrs:{label:"状态",prop:"type"}})],1)],1),e._v(" "),s("el-tab-pane",{attrs:{label:"网络电台",name:"wangluodiantai"}},[s("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableDatawl}},[s("el-table-column",{attrs:{type:"expand"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-form",{staticClass:"demo-table-expand",attrs:{"label-position":"left",inline:""}},[s("el-form-item",{attrs:{label:"名字"}},[s("span",[e._v(e._s(t.row.name))])]),e._v(" "),s("el-form-item",{attrs:{label:"分类"}},[s("span",[e._v(e._s(t.row.kind))])]),e._v(" "),s("el-form-item",{attrs:{label:"大类"}},[s("span",[e._v(e._s(t.row.mkind))])]),e._v(" "),s("el-form-item",{attrs:{label:"描述"}},[s("span",[e._v(e._s(t.row.detail))])]),e._v(" "),s("el-form-item",{attrs:{label:"状态"}},[s("span",[e._v(e._s(t.row.type))])]),e._v(" "),s("el-form-item",{attrs:{label:"地址"}},[s("span",[e._v(e._s(t.row.md5md5))])]),e._v(" "),s("el-form-item",{attrs:{label:"开关"}},[s("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-value":"1","inactive-value":"0"},on:{change:function(s){return e.ablediantai(t.$index,e.tableData)}},model:{value:t.row.enable,callback:function(s){e.$set(t.row,"enable",s)},expression:"props.row.enable"}})],1)],1)]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"电台",prop:"icon",width:"350px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("div",{staticClass:"item"},[s("div",{staticClass:"left"},[s("img",{attrs:{src:"src/assets/logo.png",alt:"#"}})]),e._v(" "),s("div",{staticClass:"right"},[s("h4",[e._v(e._s(t.row.name))]),e._v(" "),s("p",[e._v(e._s(t.row.detail))])])])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"分类",prop:"kind"}}),e._v(" "),s("el-table-column",{attrs:{label:"收藏",prop:"type"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("img",{directives:[{name:"show",rawName:"v-show",value:1==t.row.enable,expression:"props.row.enable==1"}],staticClass:"icon",attrs:{src:"src/assets/star_fill.jpg",alt:""}}),e._v(" "),s("img",{directives:[{name:"show",rawName:"v-show",value:0==t.row.enable,expression:"props.row.enable==0"}],staticClass:"icon",attrs:{src:"src/assets/star.jpg",alt:""}})]}}])})],1)],1),e._v(" "),s("el-tab-pane",{attrs:{label:"电台收藏",name:"diantaishouchang"}},[s("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableDatawlCollected}},[s("el-table-column",{attrs:{type:"expand"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-form",{staticClass:"demo-table-expand",attrs:{"label-position":"left",inline:""}},[s("el-form-item",{attrs:{label:"名字"}},[s("span",[e._v(e._s(t.row.name))])]),e._v(" "),s("el-form-item",{attrs:{label:"分类"}},[s("span",[e._v(e._s(t.row.kind))])]),e._v(" "),s("el-form-item",{attrs:{label:"大类"}},[s("span",[e._v(e._s(t.row.mkind))])]),e._v(" "),s("el-form-item",{attrs:{label:"描述"}},[s("span",[e._v(e._s(t.row.detail))])]),e._v(" "),s("el-form-item",{attrs:{label:"状态"}},[s("span",[e._v(e._s(t.row.type))])]),e._v(" "),s("el-form-item",{attrs:{label:"地址"}},[s("span",[e._v(e._s(t.row.md5md5))])]),e._v(" "),s("el-form-item",{attrs:{label:"开关"}},[s("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-value":"1","inactive-value":"0"},on:{change:function(s){return e.ablediantai(t.$index,e.tableData)}},model:{value:t.row.enable,callback:function(s){e.$set(t.row,"enable",s)},expression:"props.row.enable"}})],1)],1)]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"电台",prop:"icon",width:"350px"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("div",{staticClass:"item"},[s("div",{staticClass:"left"},[s("img",{attrs:{src:"src/assets/logo.png",alt:"#"}})]),e._v(" "),s("div",{staticClass:"right"},[s("h4",[e._v(e._s(t.row.name))]),e._v(" "),s("p",[e._v(e._s(t.row.detail))])])])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"分类",prop:"kind"}}),e._v(" "),s("el-table-column",{attrs:{label:"收藏",prop:"type"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("img",{directives:[{name:"show",rawName:"v-show",value:1==t.row.enable,expression:"props.row.enable==1"}],staticClass:"icon",attrs:{src:"src/assets/star_fill.jpg",alt:""}}),e._v(" "),s("img",{directives:[{name:"show",rawName:"v-show",value:0==t.row.enable,expression:"props.row.enable==0"}],staticClass:"icon",attrs:{src:"src/assets/star.jpg",alt:""}})]}}])})],1)],1)],1),e._v(" "),s("div",{staticStyle:{padding:"10px 0"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1)],1)])},staticRenderFns:[]};var le=s("VU/8")(re,oe,!1,function(e){s("q6vj")},"data-v-5ac91c0e",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var de={components:{"a-player":T.a},data:function(){return{options_useridnamebeizhu:[],options:[],rootid:0,nodeid:"",zipasswd:"",zibeizhu:"",ziusername:"",group_name:"",tableData:[],tableDatarizhi:[],dialogVisible_adddevice1:!1,dialogVisible_adddevice2:!1,dialogVisible_adddevice3:!1,name_adddevice:"",seed_adddevice:"",seed_ofnode:"",tag1:"自定义标签A可选",tag2:"自定义标签B可选",type:"1",device_status:"1",sqr_adddevice:"",save_backdata:"",dialogVisible_save_back:!1,dialogVisible_save_back_detail:!1,valueT:[],Tdata:[],fornodeid:-1,forgid:-1,userlevel:1,autoplay:!1,isroot:!1,fileList:[],tableDatafilelist:[],songList:[],visablerizhiye:!0,visablerizhiyeb:!0,visablerizhiyef:!0,rizhiindexcu:1,rizhiindexcuf:1,rizhiindexcub:1,rizhiindexcou:1,rizhiindexuserid:1,flag:!1}},created:function(){this.userlevel=sessionStorage.getItem("user_level")-1,-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{goDeleteRow:function(e,t){var s=this;this.$confirm("此操作将永久删除该用户, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){s.deleteRow(e,t)}).catch(function(){})},open5:function(){this.$alert(this.save_backdata,"配置详情",{dangerouslyUseHTMLString:!1})},abletask:function(e,t){console.log("fuckser"),o.a.get("/Change_file_status.php",{params:{file_id:t[e].id,enable:t[e].enable}}).then(function(s){s.data.res&&this._get_timer_tasklist_s(t[e].task_enable,e)}.bind(this)).catch(function(e){console.log(e)})},playurl:function(e,t){this.flag=!1,console.log(t[e].url),console.log(t[e].filename);var s={},i=t[e].url,a=t[e].filename;s.title=a,s.author="试听上传歌曲",s.url=i,this.songList=s,this.flag=!0,this.autoplay=!0},func_addziuserKey:function(){if(console.log("=============================================================================="),""==this.ziusername.trim()||this.ziusername.length<5)this.$notify.success({title:"Info",message:"用户名需要5位以上数字或字母",showClose:!0});else if(""!=this.nodeid)if(""==this.zipasswd||this.zipasswd.length<7)this.$notify.success({title:"Info",message:"密码必须为7位以上 英文或数字混写",showClose:!0});else{if(console.log("=============================================================================="),console.log(sessionStorage.getItem("user_type")),console.log(this.userlevel),console.log("=============================================================================="),this.userlevel>=1&&this.userlevel<sessionStorage.getItem("user_level")&&0==sessionStorage.getItem("user_type")){""==this.zibeizhu.trim()&&(this.zibeizhu="NOTHING");var e=new FormData;e.append("username",sessionStorage.getItem("username")),e.append("passwd",sessionStorage.getItem("passwd")),e.append("nodeid",this.nodeid),e.append("zipasswd",this.zipasswd),e.append("ziusername",this.ziusername),e.append("zibeizhu",Base64.encode(this.zibeizhu)),e.append("level",this.userlevel),o.a.post("/new_ziuser.php",e).then(function(e){e.data.res?this.reflash_devlist():this.$notify.success({title:"Info",message:"添加出错 可能用户名已经被占用",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})}else this.$notify.success({title:"Info",message:"用户等级不正确",showClose:!0});this.dialogVisible_adddevice1=!1}else this.$notify.success({title:"Info",message:"您还没有选者设备节点",showClose:!0})},func_save_ziuserdev:function(){if(console.log(this.valueT.length),0!=this.valueT.length){console.log(this.Tdata),console.log(this.valueT);var e="";this.valueT.forEach(function(t){e+=t,e+="|"}),e=e.substr(0,e.length-1);var t=new FormData;t.append("username",sessionStorage.getItem("username")),t.append("passwd",sessionStorage.getItem("passwd")),t.append("nodeid",this.fornodeid),t.append("ziuserid",this.forgid),t.append("type",1),t.append("seed",e),o.a.post("/add_ziuser_devices.php",t).then(function(e){e.data.res?(this.reflash_devlist(),this.dialogVisible_adddevice=!1):this.$notify.success({title:"Info",message:"添加出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice2=!1}},func_addgoup:function(){},func_adddevic:function(){this.dialogVisible_adddevice2=!0},deleteRow:function(e,t){var s=t[e].ziuserid,i=sessionStorage.getItem("username"),a=sessionStorage.getItem("passwd");o.a.get("/del_ziuser.php",{params:{ziuserid:s,username:i,passwd:a}}).then(function(s){s.data.res?(this.$notify.success({title:"Info",message:"删除成功",showClose:!1}),t.splice(e,1),this.reflash_devlist()):this.$notify.success({title:"Info",message:"删除失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},EditRow:function(e,t){this.dialogVisible_adddevice2=!0;var s=new FormData;s.append("username",sessionStorage.getItem("username")),s.append("passwd",sessionStorage.getItem("passwd")),s.append("nodeip",t[e].nodeip),s.append("nodeid",t[e].nodeid),s.append("ziuserid",t[e].ziuserid),s.append("nodeport3",t[e].nodeport3),s.append("nodeport5",t[e].nodeport5),s.append("nodeport1",t[e].nodeport1),s.append("nodeport4",t[e].nodeport4),s.append("nodeport2",t[e].nodeport2),console.log(t[e].nodeip),console.log(t[e].nodeid),console.log(t[e].ziuserid),o.a.post("/get_ziuser_nodedevs.php",s).then(function(s){s.data.res?(this.Tdata=s.data.dev_info,this.valueT=s.data.dev_info_S,this.forgid=t[e].ziuserid,this.fornodeid=t[e].nodeid,this.dialogVisible_adddevice=!0):this.$notify.success({title:"Info",message:"添加出现异常1",showClose:!1})}.bind(this)).catch(function(e){console.log(e)})},refileRow:function(e,t){this.dialogVisible_adddevice3=!0,o.a.get("/Get_file_Listbyid.php",{params:{username:t[e].user_name,ziuserid:t[e].ziuserid,kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Base64.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},handleClose_adddevice1:function(){this.dialogVisible_adddevice1=!1},handleClose_adddevice2:function(){this.dialogVisible_adddevice2=!1},handleClose_adddevice3:function(){this.dialogVisible_adddevice3=!1,this.reflash_devlist()},tableRowClassName:function(e){e.row;var t=e.rowIndex;return 1===t?"warning-row":3===t?"success-row":""},reflash_devlist:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.options=e.data.outlableid,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)}),o.a.get("/get_ziuser_info.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.tableData=e.data.dataJson,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_devlistrizhi:function(){o.a.get("/get_riziselect.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.options_useridnamebeizhu=e.data.dataJson,this.rootid=e.data.dataJson[0].value,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_getrizhi:function(){var e=this.rootid;o.a.get("/get_rizbyid.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),selectid:e,index:1}}).then(function(e){e.data.res&&(this.tableDatarizhi=e.data.dataJson,this.tableDatarizhi.forEach(function(e,t){e.filename=Base64.decode(e.filename)}),1==e.data.outlableid.index&&e.data.outlableid.cou<50?this.visablerizhiye=!0:this.visablerizhiye=!1,1==e.data.outlableid.index?this.visablerizhiyef=!0:this.visablerizhiyef=!1,e.data.outlableid.cou<50?this.visablerizhiyeb=!0:this.visablerizhiyeb=!1,console.log("-==================frist=================="),console.log(e.data.outlableid),this.rizhiindexcu=e.data.outlableid.index,this.rizhiindexcuf=e.data.outlableid.findex,this.rizhiindexcub=e.data.outlableid.bindex,this.rizhiindexcou=e.data.outlableid.cou,this.rizhiindexuserid=e.data.outlableid.userid,console.log(this.rizhiindexcu),console.log(this.rizhiindexcuf),console.log(this.rizhiindexcub),console.log(this.rizhiindexcou),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_getrizhib:function(){this.rootid,this.rootid;this.rizhiindexcou<50?alert("--没有了--"):o.a.get("/get_rizbyid.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),selectid:this.rizhiindexuserid,index:this.rizhiindexcub}}).then(function(e){e.data.res&&(this.tableDatarizhi=e.data.dataJson,this.tableDatarizhi.forEach(function(e,t){e.filename=Base64.decode(e.filename)}),1==e.data.outlableid.index&&e.data.outlableid.cou<50?this.visablerizhiye=!0:this.visablerizhiye=!1,1==e.data.outlableid.index?this.visablerizhiyef=!0:this.visablerizhiyef=!1,e.data.outlableid.cou<50?this.visablerizhiyeb=!0:this.visablerizhiyeb=!1,console.log("-==================frist=================="),console.log(e.data.outlableid),this.rizhiindexcu=e.data.outlableid.index,this.rizhiindexcuf=e.data.outlableid.findex,this.rizhiindexcub=e.data.outlableid.bindex,this.rizhiindexcou=e.data.outlableid.cou,this.rizhiindexuserid=e.data.outlableid.userid,console.log(this.rizhiindexcu),console.log(this.rizhiindexcuf),console.log(this.rizhiindexcub),console.log(this.rizhiindexcou),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_getrizhif:function(){this.rizhiindexcub<1||o.a.get("/get_rizbyid.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),selectid:this.rizhiindexuserid,index:this.rizhiindexcuf}}).then(function(e){e.data.res&&(this.tableDatarizhi=e.data.dataJson,this.tableDatarizhi.forEach(function(e,t){e.filename=Base64.decode(e.filename)}),1==e.data.outlableid.index&&e.data.outlableid.cou<50?this.visablerizhiye=!0:this.visablerizhiye=!1,1==e.data.outlableid.index?this.visablerizhiyef=!0:this.visablerizhiyef=!1,e.data.outlableid.cou<50?this.visablerizhiyeb=!0:this.visablerizhiyeb=!1,console.log("-==================frist=================="),console.log(e.data.outlableid),this.rizhiindexcu=e.data.outlableid.index,this.rizhiindexcuf=e.data.outlableid.findex,this.rizhiindexcub=e.data.outlableid.bindex,this.rizhiindexcou=e.data.outlableid.cou,this.rizhiindexuserid=e.data.outlableid.userid,console.log(this.rizhiindexcu),console.log(this.rizhiindexcuf),console.log(this.rizhiindexcub),console.log(this.rizhiindexcou),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},ce={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmgerji"}},[s("el-row",[s("el-select",{staticStyle:{width:"1080px"},attrs:{filterable:"",placeholder:"请选择用户"},model:{value:e.rootid,callback:function(t){e.rootid=t},expression:"rootid"}},e._l(e.options_useridnamebeizhu,function(e){return s("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1),e._v(" "),s("el-button",{attrs:{type:"success",icon:"el-icon-refresh"},on:{click:e.reflash_getrizhi}},[e._v("查询日志")])],1),e._v(" "),s("br"),e._v(" "),s("div",{staticStyle:{margin:"auto",width:"1201px"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"1201px"},attrs:{data:e.tableDatarizhi,"highlight-current-row":"",border:""}},[e._v("3\n\t "),s("el-table-column",{attrs:{prop:"hang",width:"50",label:"序号"}}),e._v(" "),s("el-table-column",{attrs:{prop:"time",width:"200",label:"时间"}}),e._v(" "),s("el-table-column",{attrs:{prop:"infoname",label:"播放描述",width:"350"}}),e._v(" "),s("el-table-column",{attrs:{prop:"len",label:"播放时长(s)",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filename",label:"文件名 ",width:"400"}}),e._v(" "),s("el-table-column",{attrs:{label:"试听",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.playurl(t.$index,e.tableDatarizhi)}}},[e._v("播放")])]}}])})],1),e._v(" "),s("el-row",{attrs:{disabled:e.visablerizhiye}},[s("el-button",{attrs:{type:"text",disabled:e.visablerizhiyef},on:{click:e.reflash_getrizhif}},[e._v("上一页")]),e._v("\n\t 当前第:"+e._s(e.rizhiindexcu)+"页\n\t "),s("el-button",{attrs:{type:"text",disabled:e.visablerizhiyeb},on:{click:e.reflash_getrizhib}},[e._v("下一页")])],1),e._v(" "),s("el-dialog",{attrs:{title:"编辑设备",visible:e.dialogVisible_adddevice2,"before-close":e.handleClose_adddevice2,width:"800px"},on:{"update:visible":function(t){e.dialogVisible_adddevice2=t}}},[[s("el-transfer",{attrs:{width:"800px",filterable:"",titles:["所有设备","选中的"],"button-texts":["到左边","到右边"],format:{noChecked:"${total}",hasChecked:"${checked}/${total}"},data:e.Tdata},model:{value:e.valueT,callback:function(t){e.valueT=t},expression:"valueT"}})],e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_save_ziuserdev}},[e._v("保存")])],1)],2),e._v(" "),s("el-dialog",{attrs:{title:"添子账户",visible:e.dialogVisible_adddevice1,width:"400px","before-close":e.handleClose_adddevice1},on:{"update:visible":function(t){e.dialogVisible_adddevice1=t}}},[s("div",{staticStyle:{margin:"15px"}},[e._v("\n 网络节点:\n "),s("el-select",{attrs:{slot:"prepend",placeholder:"选择网络节点"},slot:"prepend",model:{value:e.nodeid,callback:function(t){e.nodeid=t},expression:"nodeid"}},e._l(e.options,function(t){return s("el-option",{key:t.label,attrs:{label:t.label,value:t.id}},[s("span",{staticStyle:{float:"left"}},[e._v(e._s(t.label))]),e._v(" "),s("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[e._v(e._s(t.nodeip))])])}),1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"建议使用该用户的手机号码",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:"子账户用户名"},model:{value:e.ziusername,callback:function(t){e.ziusername=t},expression:"ziusername"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"密码为数字或者是英文字符",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{placeholder:"子账户密码","show-password":""},model:{value:e.zipasswd,callback:function(t){e.zipasswd=t},expression:"zipasswd"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"账号备注",placement:"top-start"}},[s("el-input",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{placeholder:"子账户备注信息"},model:{value:e.zibeizhu,callback:function(t){e.zibeizhu=t},expression:"zibeizhu"}})],1)],1),e._v(" "),s("el-row",[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"子用户等级不得高于自己等级",placement:"top-start"}},[s("el-input-number",{staticStyle:{width:"300px","margin-top":"10px"},attrs:{min:1,max:e.userlevel,label:"用户等级"},model:{value:e.userlevel,callback:function(t){e.userlevel=t},expression:"userlevel"}})],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{type:"primary"},on:{click:e.func_addziuserKey}},[e._v("添加子账户")])],1)],1),e._v(" "),s("el-dialog",{attrs:{title:"审核文件",visible:e.dialogVisible_adddevice3,"before-close":e.handleClose_adddevice3,width:"900px"},on:{"update:visible":function(t){e.dialogVisible_adddevice3=t}}},[s("div",{staticStyle:{padding:"10px 0"}},[e.flag?s("a-player",{ref:"player",attrs:{autoplay:e.autoplay,music:e.songList,mutex:"",listmaxheight:"10px"}}):e._e()],1),e._v(" "),s("el-table",{staticStyle:{width:"800px"},attrs:{data:e.tableDatafilelist,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",width:"100",label:"时间"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filename",label:"文件名",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"filesize",label:"文件大小",width:"100"}}),e._v(" "),s("el-table-column",{attrs:{label:"试听",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(s){return s.preventDefault(),e.playurl(t.$index,e.tableDatafilelist)}}},[e._v("播放")])]}}])}),e._v(" "),e.isroot?s("el-table-column",{attrs:{label:"审核",width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(s){return e.abletask(t.$index,e.tableDatafilelist)}},model:{value:e.tableDatafilelist[t.$index].enable,callback:function(s){e.$set(e.tableDatafilelist[t.$index],"enable",s)},expression:"tableDatafilelist[scope.$index].enable"}})]}}],null,!1,2873227358)}):e._e()],1)],1)],1)},staticRenderFns:[]};var he=s("VU/8")(de,ce,!1,function(e){s("a74R")},"data-v-5ef97c81",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var ue=s("xrTZ").Base64,fe=["启用闭合触发","启用断开触发"],ge={data:function(){return{checkAll:!1,checkedCities:["启用闭合触发","启用断开触发"],cities:fe,isIndeterminate:!0,tableData:[],tnodeid:0,sel1:[],sel2:[],options:[],nodeid:"",tableDatafilelist:[],warningSetList:[],warningSet:{flag:!0,seedList1:{data:[],value:[]},seedList2:{data:[],value:[]},file1:"",file2:"",portwr:"",portct:"",seed:"",ip:"",id:"",shenhe:""},quedinganqiuenable:!1,quedinganqiuenable22:!1,duankaienable:!0,biheenable:!0,dialogVisible_adddevice:!1}},created:function(){},methods:{handleCheckedCitiesChange:function(e){var t=e.length;console.log(e),t>0?(this.quedinganqiuenable=!1,2==t?(this.duankaienable=!0,this.biheenable=!0):"启用闭合触发"==e[0]?(console.log("danbihe"),this.biheenable=!0,this.duankaienable=!1):(console.log("danduankai"),this.biheenable=!1,this.duankaienable=!0)):(this.quedinganqiuenable=!1,this.biheenable=!1,this.duankaienable=!1)},shenhechange:function(e,t){console.log(e+" "+t)},enablechange:function(e,t){this.quedinganqiuenable22=!0,console.log(e+" "+t);var s=0;if(2==e)s=1;else{if(0!=e)return;s=3}o.a.get("/Warningeableauto.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),enable:s,id:t}}).then(function(e){var t=this;e.data.res?(this.reflash_devlist(),this.$forceUpdate(),this.$alert("状态应用及更新成功","自动报警设置",{confirmButtonText:"确定",callback:function(e){t.$notify.success({title:"Info",message:"状态更新成功",showClose:!0}),t.quedinganqiuenable22=!1}})):this.$message({type:"warning",message:"设备不在线或其他条件不满足"}),this.quedinganqiuenable22=!1}.bind(this)).catch(function(e){console.log(e)})},nodechange_:function(){o.a.get("/get_user_nodedevws.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),nodeid:this.nodeid}}).then(function(e){e.data.res&&(this.warningSet.seedList1.data=e.data.dev_info,this.warningSet.seedList2.data=e.data.dev_info,this.warningSet.ip=e.data.nodeip,this.warningSet.portwr=e.data.nodeport6,this.warningSet.portct=e.data.nodeport3,this.warningSet.seedList1.value=[],this.warningSet.seedList2.value=[],console.log("----------------"),console.log(this.nodeid),console.log(this.tnodeid),console.log(this.sel1),console.log(this.sel2),this.nodeid==this.tnodeid?(this.warningSet.seedList1.value=this.sel1,this.warningSet.seedList2.value=this.sel2):(this.warningSet.seedList1.value=[],this.warningSet.seedList2.value=[]),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},handleChange1:function(e,t,s){console.log(this.warningSet.seedList2.value)},handleChange2:function(e,t,s){console.log(this.warningSet.seedList1.value)},reflash_nodeinfo:function(){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){e.data.res&&(this.options=e.data.outlableid,this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},reflash_nodeinfosss:function(e){o.a.get("/get_user_node.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(t){t.data.res&&(this.options=t.data.outlableid,this.nodeid=e,this.nodechange_(),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})},goEdit:function(e,t){this.get_file_list(),this.warningSet.seed=t[e].seed,this.warningSet.portct=t[e].portct,this.warningSet.id=t[e].id,this.warningSet.ip=t[e].nodeip,this.dialogVisible_adddevice=!0},edit:function(){if(console.log("edit1"),""!=this.warningSet.seed){var e,t;this.duankaienable&&(console.log("this.warningSet.file2 +====="+this.warningSet.file2),t=""==this.warningSet.file2?"http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3":this.warningSet.file2),this.biheenable&&(console.log("this.warningSet.file1 +====="+this.warningSet.file1),e=""==this.warningSet.file1?"http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3":this.warningSet.file1),this.duankaienable||(t="http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3"),this.biheenable||(e="http://x/x/x/x/5peg5oql6K2m6YWN572u.mp3");var s=new FormData;s.append("username",sessionStorage.getItem("username")),s.append("passwd",sessionStorage.getItem("passwd")),s.append("user_id",sessionStorage.getItem("id")),s.append("enable",0),s.append("portct",this.warningSet.portct),s.append("seed",this.warningSet.seed),s.append("ip",this.warningSet.ip),s.append("url_bihe",e),s.append("url_duankai",t),s.append("id",this.warningSet.id),s.append("play_nodeid",this.nodeid),o.a.post("/warningsetauto.php",s).then(function(e){e.data.res?(console.log(e.data),this.$forceUpdate(),this.$notify.success({title:"Info",message:"编辑成功",showClose:!1}),this.reflash_devlist()):this.$notify.success({title:"Info",message:"编辑出现异常",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.dialogVisible_adddevice=!1}else this.$message({type:"warning",message:"报警设备不能为空"})},putMode:function(){var e=this,t=document.getElementById("transfer1"),s=document.getElementById("transfer2");this.warningSet.flag?(setTimeout(function(){e.warningSet.flag=!1,t.style.transform="rotateY(0deg)"},500),t.style.transition="all 0.5s linear",t.style.transform="rotateY(345deg)"):(setTimeout(function(){e.warningSet.flag=!0,s.style.transform="rotateY(0deg)"},500),s.style.transition="all 0.5s linear",s.style.transform="rotateY(345deg)")},reflash_devlist:function(){},reflash_devlist2:function(){this.warningSet.seedList=[],o.a.get("/get_devicelistweb.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd")}}).then(function(e){if(e.data.res){this.tableData=e.data.dataJson;for(var t=[],s=0;s<this.tableData.length;s++)t.push({key:this.tableData[s].seed,label:this.tableData[s].name});this.warningSet.seedList1.data=t,this.warningSet.seedList2.data=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})},get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){if(e.data.res){var t=e.data.file;t.forEach(function(e,t){e.filename=ue.decode(e.filename),e.filesize=e.filesize}),this.tableDatafilelist=t,this.$forceUpdate()}}.bind(this)).catch(function(e){console.log(e)})}}},pe={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"devmg"}},[s("el-table",{staticStyle:{width:"1200px"},attrs:{data:e.warningSetList,"highlight-current-row":"",border:""}},[s("el-table-column",{attrs:{type:"index",label:"编号",width:"50"}}),e._v(" "),s("el-table-column",{attrs:{prop:"seed",label:"设备码",width:"300"}}),e._v(" "),s("el-table-column",{attrs:{prop:"device_name",label:"设备名字",width:"150"}}),e._v(" "),s("el-table-column",{attrs:{prop:"url_bihe2",label:"报警触发播放[支持联动]",width:"240"}}),e._v(" "),s("el-table-column",{attrs:{prop:"url_duankai2",label:"报警解除播放",width:"240"}}),e._v(" "),s("el-table-column",{attrs:{prop:"enable",label:"工作状态",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"danger",icon:"el-icon-edit",size:"small",plain:"",disabled:e.quedinganqiuenable22},nativeOn:{click:function(s){return s.preventDefault(),e.enablechange(e.warningSetList[t.$index].enable,e.warningSetList[t.$index].id)}}},[e._v("应用")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作",align:"center",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{type:"warning",icon:"el-icon-edit",size:"small",plain:""},nativeOn:{click:function(s){return s.preventDefault(),e.goEdit(t.$index,e.warningSetList)}}},[e._v("编辑")])]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:"自动报警设置",visible:e.dialogVisible_adddevice,width:"1000px"},on:{"update:visible":function(t){e.dialogVisible_adddevice=t}}},[s("el-form",{ref:"form",attrs:{"label-width":"80px",align:"left"}},[s("el-checkbox-group",{on:{change:e.handleCheckedCitiesChange},model:{value:e.checkedCities,callback:function(t){e.checkedCities=t},expression:"checkedCities"}},e._l(e.cities,function(t){return s("el-checkbox",{key:t,attrs:{label:t}},[e._v(e._s(t))])}),1),e._v(" "),s("div",{directives:[{name:"show",rawName:"v-show",value:e.biheenable,expression:"biheenable"}],staticStyle:{"text-align":"left"},attrs:{id:"transfer1"}},[s("h3",{staticStyle:{margin:"20px 0 20px"}},[e._v("输入闭合触发[联动专用]")]),e._v(" "),s("el-form-item",{attrs:{label:"文件选择 :"}},[s("el-select",{attrs:{placeholder:"请选择报警文件"},model:{value:e.warningSet.file1,callback:function(t){e.$set(e.warningSet,"file1",t)},expression:"warningSet.file1"}},e._l(e.tableDatafilelist,function(e,t){return s("el-option",{key:t,staticStyle:{width:"300px"},attrs:{label:e.filename,value:e.url}})}),1)],1)],1),e._v(" "),s("div",{directives:[{name:"show",rawName:"v-show",value:e.duankaienable,expression:"duankaienable"}],staticStyle:{"text-align":"left"},attrs:{id:"transfer2"}},[s("h3",{staticStyle:{margin:"20px 0 20px"}},[e._v("输入断开报触发")]),e._v(" "),s("el-form-item",{attrs:{label:"文件选择 :"}},[s("el-select",{attrs:{placeholder:"请选择报警文件"},model:{value:e.warningSet.file2,callback:function(t){e.$set(e.warningSet,"file2",t)},expression:"warningSet.file2"}},e._l(e.tableDatafilelist,function(e,t){return s("el-option",{key:t,staticStyle:{width:"300px"},attrs:{label:e.filename,value:e.url}})}),1)],1)],1)],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_adddevice=!1}}},[e._v("取消")]),e._v(" "),s("el-button",{attrs:{type:"primary",disabled:e.quedinganqiuenable},on:{click:e.edit}},[e._v("确定")])],1)],1)],1)},staticRenderFns:[]};var me=s("VU/8")(ge,pe,!1,function(e){s("cvxZ")},"data-v-59bf5658",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};s("xrTZ").Base64;var ve={data:function(){return{loading:!1,setys:!1,setlc:!1,loadingfo:!1,ysbackdata:[],lcbackdata:[],ysapptoken:"",ysappsecret:"",ysappid:"",lcappid:"",lcappsecret:"",lcappusername:"",lcapppasswd:"",activeName:"first"}},created:function(){-1==sessionStorage.getItem("master_id")&&(this.isroot=!0)},methods:{delete_lc:function(){var e=sessionStorage.getItem("username"),t=sessionStorage.getItem("passwd");this.loadingfo=!0,this.lcappid="",this.lcappsecret="",this.lcappusername="",this.lcapppasswd="",o.a.get("/delete_lc.php",{params:{username:e,passwd:t}}).then(function(e){e.data.res?this.$notify.success({title:"Info",message:"已加载",showClose:!1}):this.$notify.success({title:"Info",message:"监控平台还没绑定...",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.get_user_ys()},delete_ys:function(){var e=sessionStorage.getItem("username"),t=sessionStorage.getItem("passwd");this.loadingfo=!0,o.a.get("/delete_ys.php",{params:{username:e,passwd:t}}).then(function(e){e.data.res?(this.ysappsecret="",this.ysappid="",this.ysapptoken="",this.$notify.success({title:"Info",message:"已加载",showClose:!1})):this.$notify.success({title:"Info",message:"监控平台还没绑定...",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.get_user_ys()},get_user_ys:function(){var e=sessionStorage.getItem("username"),t=sessionStorage.getItem("passwd");o.a.get("/get_user_ys.php",{params:{username:e,passwd:t}}).then(function(e){e.data.res?(this.setys=e.data.isys,this.setlc=e.data.islc,this.setlc&&(this.lcbackdata=e.data.lc,this.lcappid=e.data.lc.appkey,this.lcappsecret=e.data.lc.appSecret,this.lcappusername=e.data.lc.username,this.lcapppasswd=e.data.lc.passwd),this.setys&&(this.ysbackdata=e.data.ys,this.ysappsecret=e.data.ys.appSecret,this.ysappid=e.data.ys.appkey,this.ysapptoken=e.data.ys.apptoken),this.$notify.success({title:"Info",message:"已加载",showClose:!1})):(this.setys=!1,this.setlc=!1,this.$notify.success({title:"Info",message:"监控平台还没绑定...",showClose:!1}))}.bind(this)).catch(function(e){console.log(e)}),this.loadingfo=!1},Save_lc:function(){this.loadingfo=!0;var e=sessionStorage.getItem("username"),t=sessionStorage.getItem("passwd");this.lcappusername.length<5?console.log(this.lcappusername.length):this.lcapppasswd.length<6?console.log(this.lcapppasswd.length):this.lcappid.length<10?console.log(this.lcappid.length):this.lcappsecret.length<10?console.log(this.lcappsecret.length):(o.a.get("/savelc.php",{params:{lcapppasswd:this.lcapppasswd,lcappusername:this.lcappusername,lcappid:this.lcappid,lcappsecret:this.lcappsecret,username:e,passwd:t}}).then(function(e){e.data.res?this.$notify.success({title:"Info",message:"修改成功",showClose:!1}):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.get_user_ys())},Save_ys:function(){this.loadingfo=!0,console.log(this.ysapptoken.length);var e=sessionStorage.getItem("username"),t=sessionStorage.getItem("passwd");this.ysapptoken.length<30?console.log(this.ysapptoken.length):this.ysappsecret.length<32?console.log(this.ysapptoken.length):this.ysappid.length<30?console.log(this.ysappid.length):(o.a.get("/saveys.php",{params:{ysapptoken:this.ysapptoken,ysappsecret:this.ysappsecret,ysappid:this.ysappid,username:e,passwd:t}}).then(function(e){e.data.res?this.$notify.success({title:"Info",message:"修改成功",showClose:!1}):this.$notify.success({title:"Info",message:"修改失败",showClose:!1})}.bind(this)).catch(function(e){console.log(e)}),this.get_user_ys())}}},ye={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("div",{staticStyle:{width:"800px"}},[s("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"danger",icon:"el-icon-orange"},on:{click:e.get_user_ys}},[e._v("刷新")])],1),e._v(" "),s("el-tabs",{staticStyle:{padding:"40px",width:"800px"},attrs:{type:"card"},model:{value:e.activeName,callback:function(t){e.activeName=t},expression:"activeName"}},[s("el-tab-pane",{staticStyle:{padding:"20px"},attrs:{label:"海康萤石云账号绑定配置",name:"first"}},[e._v("海康萤石云账号绑定配置\n\n\n "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"萤石云APP ID"},model:{value:e.ysappid,callback:function(t){e.ysappid=t},expression:"ysappid"}},[s("template",{slot:"prepend"},[e._v("APPuser ID:")])],2),e._v(" "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"萤石云APP Secret","show-password":""},model:{value:e.ysappsecret,callback:function(t){e.ysappsecret=t},expression:"ysappsecret"}},[s("template",{slot:"prepend"},[e._v("APP Secret:")])],2),e._v(" "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"萤石云APPToken","show-password":""},model:{value:e.ysapptoken,callback:function(t){e.ysapptoken=t},expression:"ysapptoken"}},[s("template",{staticStyle:{"margin-top":"10px"},slot:"prepend"},[e._v("APP -Token:")])],2),e._v(" "),s("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"success",icon:"el-icon-orange"},on:{click:e.Save_ys}},[e._v("绑定")]),e._v(" "),s("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"danger",icon:"el-icon-orange"},on:{click:e.delete_ys}},[e._v("解除绑定")])],1),e._v(" "),s("el-tab-pane",{staticStyle:{padding:"20px"},attrs:{label:"大华乐橙云账号绑定配置",name:"second"}},[e._v("大华乐橙云账号绑定配置\n "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"乐橙AppId"},model:{value:e.lcappid,callback:function(t){e.lcappid=t},expression:"lcappid"}},[s("template",{slot:"prepend"},[e._v("APPuser ID:")])],2),e._v(" "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"乐橙云APPSecret","show-password":""},model:{value:e.lcappsecret,callback:function(t){e.lcappsecret=t},expression:"lcappsecret"}},[s("template",{slot:"prepend"},[e._v("APP Secret:")])],2),e._v(" "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"乐橙APP用户名"},model:{value:e.lcappusername,callback:function(t){e.lcappusername=t},expression:"lcappusername"}},[s("template",{staticStyle:{"margin-top":"10px"},slot:"prepend"},[e._v("imoulife 账号:")])],2),e._v(" "),s("el-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:"乐橙APP登录密码","show-password":""},model:{value:e.lcapppasswd,callback:function(t){e.lcapppasswd=t},expression:"lcapppasswd"}},[s("template",{staticStyle:{"margin-top":"10px"},slot:"prepend"},[e._v("imoulife 密码:")])],2),e._v(" "),s("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"success",icon:"el-icon-orange"},on:{click:e.Save_lc}},[e._v("绑定")]),e._v(" "),s("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"danger",icon:"el-icon-orange"},on:{click:e.delete_lc}},[e._v("解除绑定")])],1)],1)],1)},staticRenderFns:[]};var be={data:function(){return{msg:"极速精简板广播系统",nickname:"gsdfdfhdfg",tabtype:"媒资管理",tabnum:999,isroot:!1,isGM:!1,tabtype1:"文件列表",tableData:[],tabdata:[{type:"设备管理",type1:"分组管理"},{type:"设备管理",type1:"设备列表"}],tabdata1:[{type:"播控设备",type1:"设备管理"}],tabdata2:[{type:"账户管理",type1:"子账户管理"}],tabdata3:[{type:"媒体管理",type1:"文件管理"},{type:"媒体管理",type1:"文字转语音"}],tabdata6:[{type:"报警系统",type1:"联动报警设置"},{type:"报警系统",type1:"自动报警设置"}],tabdata4:[{type:"账户信息",type1:"用户信息"}],tabdata10:[{type:"账户信息",type1:"二级账户"}],tabdata5:[{type:"定时播报",type1:"定时任务"}]}},created:function(){-1==sessionStorage.getItem("master_id")&&(this.isroot=!0),"1"==sessionStorage.getItem("mask").charAt(0)&&(this.isGM=!0)},methods:{tologin:function(){this.$router.push({path:"/"})},tabfun1001:function(e,t){this.tabnum=100+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun:function(e,t){this.tabnum=0,this.tabtype=t.type,this.tabtype1=t.type1},tabfun1:function(e,t){this.tabnum=1,this.tabtype=t.type,this.tabtype1=t.type1},tabfun2:function(e,t){this.tabnum=4,this.tabtype=t.type,this.tabtype1=t.type1},tabfun3:function(e,t){this.tabnum=999,this.tabtype=t.type,this.tabtype1=t.type1},tabfun4:function(e,t){this.tabnum=500+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun100:function(e,t){this.tabnum=200+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun101:function(e,t){this.tabnum=300+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun6:function(e,t){this.tabnum=600+e,this.tabtype=t.type,this.tabtype1=t.type1,0==e&&this.$refs.tabnum3.reflash_devlist(),1==e&&this.$refs.tabnum15.reflash_devlist()},tabfun7:function(e,t){this.tabnum=700+e,this.tabtype=t.type,this.tabtype1=t.type1,0==e?this.$refs.tabnum4.get_file_list():1==e&&this.$refs.tabnum12.get_file_list()}},components:{HeaderBar:f,Tabnum3:_,Tabnum4:I,Tabnum5:O,Tabnum6:U,Tabnum7:V,Tabnum8:H,Tabnum9:q,Tabnum10:J,Tabnum11:te,Tabnum12:ae,Tabnum13:le,Tabnum14:he,Tabnum15:me,Tabnum16:s("VU/8")(ve,ye,!1,function(e){s("n5LF")},"data-v-60426329",null).exports},computed:{usertype:function(){return sessionStorage.getItem("UserType")}}},_e={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"index"},[s("div",{staticClass:"leftbar"},[s("div",{staticClass:"homename"},[e._v(e._s(e.msg))]),e._v(" "),s("div",{staticClass:"barbox"},[s("el-collapse",{attrs:{accordion:""}},[s("el-collapse-item",{attrs:{title:"设备管理",name:"0"}},e._l(e.tabdata,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun1001(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"媒体管理",name:"3"}},e._l(e.tabdata3,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun7(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"定时播报",name:"2"}},e._l(e.tabdata5,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun4(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"报警系统",name:"6"}},e._l(e.tabdata6,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun6(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"账户管理",name:"4"}},e._l(e.tabdata4,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun100(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),e.isGM?s("el-collapse-item",{attrs:{title:"账户信息",name:"5"}},e._l(e.tabdata10,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun101(i,t)}}},[e._v(e._s(t.type1))])}),0):e._e()],1)],1)]),e._v(" "),s("div",{staticClass:"rightbar"},[s("HeaderBar"),e._v(" "),s("div",{staticClass:"tab"},[e._v("\n 首页 /\n "),s("em",[e._v(e._s(e.tabtype)+" / "+e._s(e.tabtype1))])]),e._v(" "),s("Tabnum3",{directives:[{name:"show",rawName:"v-show",value:600==e.tabnum,expression:"tabnum == 600"}],ref:"tabnum3"}),e._v(" "),s("Tabnum4",{directives:[{name:"show",rawName:"v-show",value:700==e.tabnum,expression:"tabnum == 700"}],ref:"tabnum4"}),e._v(" "),s("Tabnum5",{directives:[{name:"show",rawName:"v-show",value:500==e.tabnum,expression:"tabnum == 500"}]}),e._v(" "),s("Tabnum6",{directives:[{name:"show",rawName:"v-show",value:6==e.tabnum,expression:"tabnum == 6"}]}),e._v(" "),s("Tabnum8",{directives:[{name:"show",rawName:"v-show",value:101==e.tabnum,expression:"tabnum == 101"}]}),e._v(" "),s("Tabnum9",{directives:[{name:"show",rawName:"v-show",value:100==e.tabnum,expression:"tabnum == 100"}],ref:"tabnum9"}),e._v(" "),s("Tabnum10",{directives:[{name:"show",rawName:"v-show",value:300==e.tabnum,expression:"tabnum == 300"}]}),e._v(" "),s("Tabnum11",{directives:[{name:"show",rawName:"v-show",value:200==e.tabnum,expression:"tabnum == 200"}]}),e._v(" "),s("Tabnum12",{directives:[{name:"show",rawName:"v-show",value:701==e.tabnum,expression:"tabnum == 701"}],ref:"tabnum12"}),e._v(" "),s("Tabnum13",{directives:[{name:"show",rawName:"v-show",value:702==e.tabnum,expression:"tabnum == 702"}]}),e._v(" "),s("Tabnum14",{directives:[{name:"show",rawName:"v-show",value:301==e.tabnum,expression:"tabnum == 301"}]}),e._v(" "),s("Tabnum15",{directives:[{name:"show",rawName:"v-show",value:601==e.tabnum,expression:"tabnum == 601"}],ref:"tabnum15"}),e._v(" "),s("Tabnum16",{directives:[{name:"show",rawName:"v-show",value:302==e.tabnum,expression:"tabnum == 302"}],ref:"tabnum16"})],1)])},staticRenderFns:[]};var ke=s("VU/8")(be,_e,!1,function(e){s("DYiY")},"data-v-7407fb76",null).exports,Te={data:function(){return{nickname:"管理后台",showbtn:!1,login_id:sessionStorage.getItem("username")}},methods:{showxiala:function(){this.showbtn=!this.showbtn,console.log(sessionStorage.getItem("username"))},user_logout:function(){sessionStorage.removeItem("username"),sessionStorage.removeItem("passwd"),this.$router.push({path:"/login"})}},computed:{token:function(){return sessionStorage.getItem("username")}}},Se={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"righthead"},[s("div",{staticClass:"userinfo",on:{click:e.showxiala}},[e._v(e._s(e.login_id))]),e._v(" "),e.showbtn?s("div",{staticClass:"logout",on:{click:e.user_logout}},[e._v("退出登录")]):e._e()])},staticRenderFns:[]};var we=s("VU/8")(Te,Se,!1,function(e){s("UHIj")},"data-v-5b25ca36",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Ee=s("xrTZ").Base64,Ie={data:function(){return{loading:!1,devkindkind:0}},created:function(){},methods:{get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Ee.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},De={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:this.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[this._v("\n\n admin_users_Mg\n\n\n\n\n")])},staticRenderFns:[]};var Ae=s("VU/8")(Ie,De,!1,function(e){s("j+mA")},"data-v-5e142e6b",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Le=s("xrTZ").Base64,Re={data:function(){return{loading:!1,devkindkind:0}},created:function(){},methods:{get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Le.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},xe={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:this.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[this._v("\n\nzhanlan\n\n\n ")])},staticRenderFns:[]};var Ce=s("VU/8")(Re,xe,!1,function(e){s("eFIO")},"data-v-0c76f9a6",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Pe=s("xrTZ").Base64,Fe={data:function(){return{loading:!1,devkindkind:0,xieyineirong:"",id:0,token:""}},created:function(){this.id=sessionStorage.getItem("id"),this.token=sessionStorage.getItem("token"),this.get_user_yinsixieyi()},methods:{save_user_yinsixieyi:function(){if(!(this.xieyineirong.length<3e3)){var e=Pe.encode(this.xieyineirong),t=new FormData;t.append("id",this.id),t.append("token",this.token),t.append("xieyi",e),o.a.post("user/fnckukei/save_user_yinsixieyi",t).then(function(e){e.data.res&&console.log(e.data)}.bind(this)).catch(function(e){console.log(e)})}},get_user_yinsixieyi:function(){var e=new FormData;e.append("id",this.id),e.append("token",this.token),o.a.post("user/fnckukei/get_user_yinsixieyi",e).then(function(e){e.data.res&&(this.xieyineirong=Pe.decode(e.data.data.xieyi))}.bind(this)).catch(function(e){console.log(e)})},get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Pe.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},Oe={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("el-link",{attrs:{type:"primary"}},[e._v("用户APP使用隐私协议")]),e._v(" "),s("el-input",{attrs:{type:"textarea",placeholder:"",maxlength:"50000",rows:"30","show-word-limit":""},model:{value:e.xieyineirong,callback:function(t){e.xieyineirong=t},expression:"xieyineirong"}}),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e.save_user_yinsixieyi}},[e._v("保存用户隐私协议")])],1)},staticRenderFns:[]};var Me=s("VU/8")(Fe,Oe,!1,function(e){s("pe1/")},"data-v-74b1a91f",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Ne=s("xrTZ").Base64,$e={data:function(){return{loading:!1,devkindkind:0}},created:function(){},methods:{get_file_list:function(){var e=new FormData;e.append("username",this.input_username),e.append("passwd",this.input_passwd),o.a.get("user",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Ne.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},Ue={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:this.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[this._v("\n\n 用户管理\n\n\n\n\n")])},staticRenderFns:[]};var Be=s("VU/8")($e,Ue,!1,function(e){s("D/H6")},"data-v-21c415f6",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var Ge=s("xrTZ").Base64;var Ve={data:function(){return{loading:!1,trues:!0,devkindkind:0,id:0,token:"",dialogVisible:!1,userData:[],userdevice:[],addpasswd:"",addusername:"",userid:0,zmask:"",z0:0,z1:0,z2:0,z3:0,z4:0,z5:0,z6:0,z7:0,zuser_name:"",dialogVisible_adduser:!1}},created:function(){this.id=sessionStorage.getItem("id"),this.token=sessionStorage.getItem("token"),this.get_userinfo()},methods:{_admin_adduser:function(){if(!(this.addpasswd.length<6||this.addusername.length<6)){var e=new FormData;e.append("id",this.id),e.append("token",this.token),e.append("username",this.addusername),e.append("passwd",this.addpasswd),o.a.post("user/fnckukei/add_user_admin",e).then(function(e){console.log(e),1==e.data.res&&(this.get_userinfo(),this.dialogVisible_adduser=!1)}.bind(this)).catch(function(e){console.log(e)})}},change_mask:function(e,t){var s=this,i=new FormData;i.append("id",this.id),i.append("token",this.token),i.append("userid",this.userid),i.append("zdex",e),i.append("zcase",t),o.a.post("user/fnkukei/changezimask",i).then(function(e){console.log(e),e.data.res&&(console.log(e.data.endmask),this.zmask=e.data.endmask,"1"==this.zmask.charAt(0)?this.z0=1:this.z0=0,"1"==this.zmask.charAt(1)?this.z1=1:this.z1=0,"1"==this.zmask.charAt(2)?this.z2=1:this.z2=0,"1"==this.zmask.charAt(3)?this.z3=1:this.z3=0,"1"==this.zmask.charAt(4)?this.z4=1:this.z4=0,"1"==this.zmask.charAt(5)?this.z5=1:this.z5=0,"1"==this.zmask.charAt(6)?this.z6=1:this.z6=0,"1"==this.zmask.charAt(7)?this.z7=1:this.z7=0,s.$forceUpdate()),e.data.res1&&(console.log(e.data.endmask),this.zmask=e.data.endmask,"1"==this.zmask.charAt(0)?this.z0=1:this.z0=0,"1"==this.zmask.charAt(1)?this.z1=1:this.z1=0,"1"==this.zmask.charAt(2)?this.z2=1:this.z2=0,"1"==this.zmask.charAt(3)?this.z3=1:this.z3=0,"1"==this.zmask.charAt(4)?this.z4=1:this.z4=0,"1"==this.zmask.charAt(5)?this.z5=1:this.z5=0,"1"==this.zmask.charAt(6)?this.z6=1:this.z6=0,"1"==this.zmask.charAt(7)?this.z7=1:this.z7=0,s.$forceUpdate()),this.get_userinfo()}.bind(this)).catch(function(e){console.log(e)})},change_user_device:function(e,t){var s=new FormData;s.append("id",this.id),s.append("token",this.token),s.append("userid",this.userid),s.append("deviceid",t[e].id),s.append("kind",t[e].kind),s.append("iswarning",t[e].iswarning),s.append("device_type",t[e].device_type),o.a.post("user/fnkukei/changeuserdevicemode",s).then(function(e){e.data.res&&this.user_devicelist()}.bind(this)).catch(function(e){console.log(e)})},user_devicelist:function(){var e=new FormData;e.append("id",this.id),e.append("token",this.token),e.append("userid",this.userid),o.a.post("user/fnkukei/getusersdevice",e).then(function(e){var t=this;e.data.res&&(this.userdevice=e.data.data,this.userdevice.forEach(function(e,s){t.userdevice[s].device_name=Ge.decode(e.device_name)}),console.log(this.userdevice))}.bind(this)).catch(function(e){console.log(e)})},select_user_device:function(e,t){this.dialogVisible=!0;var s=new FormData;s.append("id",this.id),s.append("token",this.token),s.append("userid",t[e].id),this.userid=t[e].id,this.zmask=t[e].mask,this.zuser_name=t[e].user_name,"1"==this.zmask.charAt(0)?this.z0=1:this.z0=0,"1"==this.zmask.charAt(1)?this.z1=1:this.z1=0,"1"==this.zmask.charAt(2)?this.z2=1:this.z2=0,"1"==this.zmask.charAt(3)?this.z3=1:this.z3=0,"1"==this.zmask.charAt(4)?this.z4=1:this.z4=0,"1"==this.zmask.charAt(5)?this.z5=1:this.z5=0,"1"==this.zmask.charAt(6)?this.z6=1:this.z6=0,"1"==this.zmask.charAt(7)?this.z7=1:this.z7=0,o.a.post("user/fnkukei/getusersdevice",s).then(function(e){e.data.res&&(this.userdevice=e.data.data,this.userdevice.forEach(function(e,t){console.log(Ge.decode(e.device_name)),e.device_name=Ge.decode(e.device_name)}),console.log(this.userdevice))}.bind(this)).catch(function(e){console.log(e)})},get_userinfo:function(){var e=new FormData;e.append("id",this.id),e.append("token",this.token),o.a.post("user/fnkukei/getusersinfo",e).then(function(e){e.data.res&&(this.userData=e.data.data)}.bind(this)).catch(function(e){console.log(e)})},get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=Ge.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},ze={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:e.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[s("el-button",{attrs:{type:"text"},on:{click:function(t){e.dialogVisible_adduser=!0}}},[e._v(" 添加新用户")]),e._v(" "),s("el-dialog",{attrs:{title:"添加用户",visible:e.dialogVisible_adduser},on:{"update:visible":function(t){e.dialogVisible_adduser=t}}},[s("el-input",{attrs:{placeholder:"用户名",clearable:""},model:{value:e.addusername,callback:function(t){e.addusername=t},expression:"addusername"}}),e._v(" "),s("el-input",{attrs:{placeholder:"密码",clearable:""},model:{value:e.addpasswd,callback:function(t){e.addpasswd=t},expression:"addpasswd"}}),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible_adduser=!1}}},[e._v("取 消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:e._admin_adduser}},[e._v("确 定")])],1)],1),e._v(" "),s("el-table",{staticStyle:{width:"900px"},attrs:{data:e.userData}},[s("el-table-column",{attrs:{prop:"id",label:"ID",width:"60"}}),e._v(" "),s("el-table-column",{attrs:{prop:"user_name",label:"用户名",width:"180"}}),e._v(" "),s("el-table-column",{attrs:{prop:"nickname",label:"昵称",width:"180"}}),e._v(" "),s("el-table-column",{attrs:{prop:"user_type",label:"用户类型"}}),e._v(" "),s("el-table-column",{attrs:{prop:"master_id",label:"账户层级"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-tag",{directives:[{name:"show",rawName:"v-show",value:"-99"==t.row.master_id,expression:"props.row.master_id == '-99'"}],attrs:{type:"success"}},[e._v(" GM ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:-1==t.row.master_id,expression:"props.row.master_id == -1 "}],attrs:{type:"warning"}},[e._v(" USER ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:t.row.master_id>0,expression:"props.row.master_id > 0 "}],attrs:{type:"warning"}},[e._v(" ZRUSER ")])]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{size:"mini",type:"primary",icon:"el-icon-coordinate"},nativeOn:{click:function(s){return s.preventDefault(),e.select_user_device(t.$index,e.userData)}}})]}}])})],1),e._v(" "),s("el-dialog",{attrs:{title:e.zuser_name,visible:e.dialogVisible,fullscreen:e.trues,width:"width:100%;"},on:{"update:visible":function(t){e.dialogVisible=t}}},[s("div",[s("el-row",[0==e.z0?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户可以不可以创建子账户")]):e._e(),e._v(" "),1==e.z0?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户可以创建子账户")]):e._e(),e._v(" "),0==e.z0?s("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(t){return e.change_mask(0,!0)}}},[e._v("开启子账户权限")]):e._e(),e._v(" "),1==e.z0?s("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(t){return e.change_mask(0,!1)}}},[e._v("关闭子账户权限")]):e._e(),e._v(" "),s("el-divider",{attrs:{direction:"vertical"}}),e._v(" "),0==e.z1?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户不可以添加设备")]):e._e(),e._v(" "),1==e.z1?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户可以添加设备")]):e._e(),e._v(" "),0==e.z1?s("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(t){return e.change_mask(1,!0)}}},[e._v("开启添加设备权限")]):e._e(),e._v(" "),1==e.z1?s("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(t){return e.change_mask(1,!1)}}},[e._v("禁用添加设备权限")]):e._e(),e._v(" "),s("el-divider",{attrs:{direction:"vertical"}}),e._v(" "),0==e.z2?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户不可以上传文件")]):e._e(),e._v(" "),1==e.z2?s("el-tag",{attrs:{type:"success"}},[e._v("当前账户可以上传文件")]):e._e(),e._v(" "),0==e.z2?s("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(t){return e.change_mask(2,!0)}}},[e._v("当前账户不可以上传文件")]):e._e(),e._v(" "),1==e.z2?s("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(t){return e.change_mask(2,!1)}}},[e._v("当前账户可以上传文件")]):e._e()],1)],1),e._v(" "),s("el-divider"),e._v(" "),s("span",[e._v("用户已注册设备")]),e._v(" "),s("el-table",{staticStyle:{width:"100%"},attrs:{data:e.userdevice}},[s("el-table-column",{attrs:{type:"index",label:"index",width:"60"}}),e._v(" "),s("el-table-column",{attrs:{prop:"id",label:"ID",width:"60"}}),e._v(" "),s("el-table-column",{attrs:{prop:"device_name",label:"设备名",width:"180"}}),e._v(" "),s("el-table-column",{attrs:{prop:"device_seed",label:"设备序列号",width:"180"}}),e._v(" "),s("el-table-column",{attrs:{prop:"status",label:"设备状态"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-tag",{directives:[{name:"show",rawName:"v-show",value:1==t.row.status,expression:"props.row.status == 1 "}],attrs:{type:"success"}},[e._v(" 在线 ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:-1==t.row.status,expression:"props.row.status == -1 "}],attrs:{type:"warning"}},[e._v(" 离线 ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:2==t.row.status,expression:"props.row.status == 2 "}],attrs:{type:"success"}},[e._v(" 正在播放 ")]),e._v(" "),s("el-tag",{directives:[{name:"show",rawName:"v-show",value:-2==t.row.status,expression:"props.row.status == -2 "}],attrs:{type:"warning"}},[e._v(" 禁用 ")])]}}])}),e._v(" "),s("el-table-column",{attrs:{prop:"device_type",label:"类型"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-input-number",{attrs:{size:"mini",min:-100,max:100},model:{value:t.row.device_type,callback:function(s){e.$set(t.row,"device_type",s)},expression:"props.row.device_type"}})]}}])}),e._v(" "),s("el-table-column",{attrs:{prop:"vol",label:"音量"}}),e._v(" "),s("el-table-column",{attrs:{prop:"iswarning",label:"B类"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-input-number",{attrs:{size:"mini",min:-100,max:100},model:{value:t.row.iswarning,callback:function(s){e.$set(t.row,"iswarning",s)},expression:"props.row.iswarning"}})]}}])}),e._v(" "),s("el-table-column",{attrs:{prop:"kind",label:"K类"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-input-number",{attrs:{size:"mini",min:-100,max:100},model:{value:t.row.kind,callback:function(s){e.$set(t.row,"kind",s)},expression:"props.row.kind"}})]}}])}),e._v(" "),s("el-table-column",{attrs:{label:"应用保存"},scopedSlots:e._u([{key:"default",fn:function(t){return[s("el-button",{attrs:{size:"mini",type:"primary",icon:"el-icon-grape"},nativeOn:{click:function(s){return s.preventDefault(),e.change_user_device(t.$index,e.userdevice)}}})]}}])})],1),e._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),e._v(" "),s("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogVisible=!1}}},[e._v("确 定")])],1)],1)],1)},staticRenderFns:[]};var Ke=s("VU/8")(Ve,ze,!1,function(e){s("lkBL")},"data-v-03b1a4be",null).exports;o.a.defaults.headers={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"};var He=s("xrTZ").Base64,Ye={data:function(){return{loading:!1,devkindkind:0}},created:function(){},methods:{get_file_list:function(){o.a.get("/Get_file_List_val.php",{params:{username:sessionStorage.getItem("username"),passwd:sessionStorage.getItem("passwd"),kind:"mp3"}}).then(function(e){e.data.res&&(this.tableDatafilelist=e.data.file,this.tableDatafilelist.forEach(function(e,t){e.filename=He.decode(e.filename),e.filesize=e.filesize}),this.$forceUpdate())}.bind(this)).catch(function(e){console.log(e)})}}},We={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:this.loading,expression:"loading",modifiers:{fullscreen:!0,lock:!0}}],attrs:{id:"devmg","element-loading-text":"Waiting....","element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[this._v("\nadmin_jifei\n\n\n\n")])},staticRenderFns:[]};var je={data:function(){return{msg:"PLOYQ",nickname:"Admin",tabtype:"媒资管理",tabnum:999,isroot:!1,isGM:!1,tabtype1:"文件列表",tableData:[],tabdata:[{type:"用户资料",type1:"信息操作"},{type:"用户资料",type1:"用户&权限"},{type:"用户资料",type1:"其他"}],tabdata1:[{type:"播控设备",type1:"设备管理"}],tabdata2:[{type:"账户管理",type1:"子账户管理"}],tabdata3:[{type:"系统设置",type1:"公布信息管理"},{type:"系统设置",type1:"计费资料设置"}],tabdata6:[{type:"报警系统",type1:"联动报警设置"},{type:"报警系统",type1:"自动报警设置"}],tabdata4:[{type:"账户信息",type1:"用户信息"}],tabdata10:[{type:"账户信息",type1:"二级账户"}],tabdata5:[{type:"展报信息",type1:"展报概览"}]}},created:function(){-99!=sessionStorage.getItem("master_id")&&this.$router.push({path:"/login"}),sessionStorage.getItem("master_id"),99!=sessionStorage.getItem("master_id")&&(this.nickname=sessionStorage.getItem("nickname")),0==sessionStorage.getItem("user_type")&&(this.isGM=!0)},methods:{tologin:function(){this.$router.push({path:"/"})},tabfun1001:function(e,t){this.tabnum=100+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun:function(e,t){this.tabnum=0,this.tabtype=t.type,this.tabtype1=t.type1},tabfun1:function(e,t){this.tabnum=1,this.tabtype=t.type,this.tabtype1=t.type1},tabfun2:function(e,t){this.tabnum=4,this.tabtype=t.type,this.tabtype1=t.type1},tabfun3:function(e,t){this.tabnum=999,this.tabtype=t.type,this.tabtype1=t.type1},tabfun4:function(e,t){this.tabnum=500+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun100:function(e,t){this.tabnum=200+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun101:function(e,t){this.tabnum=300+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun6:function(e,t){this.tabnum=600+e,this.tabtype=t.type,this.tabtype1=t.type1},tabfun7:function(e,t){this.tabnum=700+e,this.tabtype=t.type,this.tabtype1=t.type1}},components:{HeaderBar:we,Tabnum4:Ae,Tabnum5:Ce,Tabnum7:Me,Tabnum8:Be,Tabnum9:Ke,Tabnum12:s("VU/8")(Ye,We,!1,function(e){s("RVNh")},"data-v-1bd04e58",null).exports},computed:{usertype:function(){return sessionStorage.getItem("UserType")}}},qe={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"index"},[s("div",{staticClass:"leftbar"},[s("div",{staticClass:"homename"},[e._v(e._s(e.msg))]),e._v(" "),s("div",{staticClass:"barbox"},[s("el-collapse",{attrs:{accordion:""}},[s("el-collapse-item",{attrs:{title:"用户资料",name:"0"}},e._l(e.tabdata,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun1001(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"系统设置",name:"3"}},e._l(e.tabdata3,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun7(i,t)}}},[e._v(e._s(t.type1))])}),0),e._v(" "),s("el-collapse-item",{attrs:{title:"展报信息",name:"2"}},e._l(e.tabdata5,function(t,i){return s("div",{key:i,staticClass:"bar",on:{click:function(s){return e.tabfun4(i,t)}}},[e._v(e._s(t.type1))])}),0)],1)],1)]),e._v(" "),s("div",{staticClass:"rightbar"},[s("HeaderBar"),e._v(" "),s("div",{staticClass:"tab"},[e._v("\n "+e._s(e.nickname)+"首页 /\n "),s("em",[e._v(e._s(e.tabtype)+" / "+e._s(e.tabtype1))])]),e._v(" "),s("Tabnum4",{directives:[{name:"show",rawName:"v-show",value:700==e.tabnum,expression:"tabnum == 700"}],ref:"tabnum4"}),e._v(" "),s("Tabnum5",{directives:[{name:"show",rawName:"v-show",value:500==e.tabnum,expression:"tabnum == 500"}]}),e._v(" "),s("Tabnum7",{directives:[{name:"show",rawName:"v-show",value:100==e.tabnum,expression:"tabnum == 100"}]}),e._v(" "),s("Tabnum8",{directives:[{name:"show",rawName:"v-show",value:102==e.tabnum,expression:"tabnum == 102"}]}),e._v(" "),s("Tabnum9",{directives:[{name:"show",rawName:"v-show",value:101==e.tabnum,expression:"tabnum == 101"}],ref:"tabnum9"}),e._v(" "),s("Tabnum12",{directives:[{name:"show",rawName:"v-show",value:701==e.tabnum,expression:"tabnum == 701"}],ref:"tabnum12"})],1)])},staticRenderFns:[]};var Xe=s("VU/8")(je,qe,!1,function(e){s("0YRJ")},"data-v-009d14a5",null).exports,Qe=s("LvQi");i.default.use(Qe.a);var Je=new Qe.a.Store({state:{songid:"",rightdata:[],firstplay:!1,playstate:!1,songlist:[]},getters:{}});i.default.use(r.a),i.default.use(A.a),i.default.use(Qe.a),i.default.prototype.$axios=o.a;var Ze=new r.a({mode:"history",routes:[{path:"/mgll",component:ke,meta:{auth:!0}},{path:"/login",component:c},{path:"/mglg",component:Xe},{path:"/",component:c,query:{passwd:"",username:""}}]});Ze.beforeEach(function(e,t,s){e.matched.some(function(e){return e.meta.auth})?null!=sessionStorage.getItem("username")&&null!=sessionStorage.getItem("passwd")?s():s({path:"/login",query:{redirect:e.fullPath}}):s()}),new i.default({el:"#app",router:Ze,store:Je,render:function(e){return e(n)}})},NtWK:function(e,t){},RVNh:function(e,t){},S9Lj:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),s.d(t,"default",function(){return sn});var i,a,n,r,o,l={};function d(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function c(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?d(Object(s),!0).forEach(function(t){h(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):d(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function h(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var i=s.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e}).apply(this,arguments)}i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,a=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,s){if(s=s||{},e=e.trim(),!(t=t.trim())){if(!s.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var n=o.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return s.alwaysNormalize?(n.path=o.normalizePath(n.path),o.buildURLFromParts(n)):t;var r=o.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&"/"!==r.path[0]){var l=a.exec(r.path);r.netLoc=l[1],r.path=l[2]}r.netLoc&&!r.path&&(r.path="/");var d={scheme:r.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(d.netLoc=r.netLoc,"/"!==n.path[0]))if(n.path){var c=r.path,h=c.substring(0,c.lastIndexOf("/")+1)+n.path;d.path=o.normalizePath(h)}else d.path=r.path,n.params||(d.params=r.params,n.query||(d.query=r.query));return null===d.path&&(d.path=s.alwaysNormalize?o.normalizePath(n.path):n.path),o.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},{get exports(){return l},set exports(e){l=e}}.exports=o;const f=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)};let g=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e}({}),p=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),m=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e}({});const v=function(){},y={trace:v,debug:v,log:v,warn:v,info:v,error:v};let b=y;function _(e,...t){t.forEach(function(t){b[t]=e[t]?e[t].bind(e):function(e){const t=self.console[e];return t?t.bind(self.console,`[${e}] >`):v}(t)})}const k=b,T=/^(\d+)x(\d+)$/,S=/(.+?)=(".*?"|.*?)(?:,|$)/g;class w{constructor(e){"string"==typeof e&&(e=w.parseAttrList(e));for(const t in e)e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const s=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)s[e]=parseInt(t.slice(2*e,2*e+2),16);return s}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=T.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={};for(S.lastIndex=0;null!==(t=S.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1)),s[t[1].trim()]=e}return s}}function E(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class I{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const t in s)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==s[t]){k.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=u(new w({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);f(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(f(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&f(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class D{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var A={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class L{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[A.AUDIO]:null,[A.VIDEO]:null,[A.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2),i=[];1===s.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(s[1]),i[1]=parseInt(s[0])+i[0],this._byteRange=i}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=l.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class R extends L{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new D,this.urlId=0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!f(this.programDateTime))return null;const e=f(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,s,i,a,n=!1){const{elementaryStreams:r}=this,o=r[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,s),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,a)):r[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:a,partial:n}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[A.AUDIO]=null,e[A.VIDEO]=null,e[A.AUDIOVIDEO]=null}}class x extends L{constructor(e,t,s,i,a){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new D,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,a),a&&(this.fragOffset=a.fragOffset+a.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const C=10;class P{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t,this.advanced=this.endSN>e.endSN||t>0||0===t&&s>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&f(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||C}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function F(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function O(e){const t=e.split(":");let s=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),i=e[e.length-1].split(",");if(2===i.length){const t="base64"===i[0],a=i[1];t?(e.splice(-1,1),s=F(a)):s=function(e){const t=M(e).subarray(0,16),s=new Uint8Array(16);return s.set(t,16-t.length),s}(a)}}return s}function M(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}var N={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},$={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function U(e){switch(e){case $.FAIRPLAY:return N.FAIRPLAY;case $.PLAYREADY:return N.PLAYREADY;case $.WIDEVINE:return N.WIDEVINE;case $.CLEARKEY:return N.CLEARKEY}}var B={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function G(e){switch(e){case N.FAIRPLAY:return $.FAIRPLAY;case N.PLAYREADY:return $.PLAYREADY;case N.WIDEVINE:return $.WIDEVINE;case N.CLEARKEY:return $.CLEARKEY}}function V(e){const{drmSystems:t,widevineLicenseUrl:s}=e,i=t?[N.FAIRPLAY,N.WIDEVINE,N.PLAYREADY,N.CLEARKEY].filter(e=>!!t[e]):[];return!i[N.WIDEVINE]&&s&&i.push(N.WIDEVINE),i}const z="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function K(e,t,s){return Uint8Array.prototype.slice?e.slice(t,s):new Uint8Array(Array.prototype.slice.call(e,t,s))}const H=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,Y=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,W=(e,t)=>{const s=t;let i=0;for(;H(e,t);){i+=10,i+=j(e,t+6),Y(e,t+10)&&(i+=10),t+=i}if(i>0)return e.subarray(s,s+i)},j=(e,t)=>{let s=0;return s=(127&e[t])<<21,s|=(127&e[t+1])<<14,s|=(127&e[t+2])<<7,s|=127&e[t+3]},q=(e,t)=>H(e,t)&&j(e,t+6)+10<=e.length-t,X=e=>{const t=Z(e);for(let e=0;e<t.length;e++){const s=t[e];if(Q(s))return ae(s)}},Q=e=>e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,J=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),s=j(e,4);return{type:t,size:s,data:e.subarray(10,10+s)}},Z=e=>{let t=0;const s=[];for(;H(e,t);){const i=j(e,t+6),a=(t+=10)+i;for(;t+8<a;){const i=J(e.subarray(t)),a=ee(i);a&&s.push(a),t+=i.size+10}Y(e,t)&&(t+=10)}return s},ee=e=>"PRIV"===e.type?te(e):"W"===e.type[0]?ie(e):se(e),te=e=>{if(e.size<2)return;const t=ne(e.data,!0),s=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:s.buffer}},se=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const s=ne(e.data.subarray(t),!0);t+=s.length+1;const i=ne(e.data.subarray(t));return{key:e.type,info:s,data:i}}const t=ne(e.data.subarray(1));return{key:e.type,data:t}},ie=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const s=ne(e.data.subarray(t),!0);t+=s.length+1;const i=ne(e.data.subarray(t));return{key:e.type,info:s,data:i}}const t=ne(e.data);return{key:e.type,data:t}},ae=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),s=1&t[3];let i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,s&&(i+=47721858.84),Math.round(i)}},ne=(e,t=!1)=>{const s=oe();if(s){const i=s.decode(e);if(t){const e=i.indexOf("\0");return-1!==e?i.substring(0,e):i}return i.replace(/\0/g,"")}const i=e.length;let a,n,r,o="",l=0;for(;l<i;){if(0===(a=e[l++])&&t)return o;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(a);break;case 12:case 13:n=e[l++],o+=String.fromCharCode((31&a)<<6|63&n);break;case 14:n=e[l++],r=e[l++],o+=String.fromCharCode((15&a)<<12|(63&n)<<6|(63&r)<<0)}}return o};let re;function oe(){return re||void 0===self.TextDecoder||(re=new self.TextDecoder("utf-8")),re}const le={hexDump:function(e){let t="";for(let s=0;s<e.length;s++){let i=e[s].toString(16);i.length<2&&(i="0"+i),t+=i}return t}},de=Math.pow(2,32)-1,ce=[].push,he={video:1,audio:2,id3:3,text:4};function ue(e){return String.fromCharCode.apply(null,e)}function fe(e,t){const s=e[t]<<8|e[t+1];return s<0?65536+s:s}function ge(e,t){const s=pe(e,t);return s<0?4294967296+s:s}function pe(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function me(e,t,s){e[t]=s>>24,e[t+1]=s>>16&255,e[t+2]=s>>8&255,e[t+3]=255&s}function ve(e,t){const s=[];if(!t.length)return s;const i=e.byteLength;for(let a=0;a<i;){const n=ge(e,a),r=ue(e.subarray(a+4,a+8)),o=n>1?a+n:i;if(r===t[0])if(1===t.length)s.push(e.subarray(a+8,o));else{const i=ve(e.subarray(a+8,o),t.slice(1));i.length&&ce.apply(s,i)}a=o}return s}function ye(e){const t=[],s=e[0];let i=8;const a=ge(e,i);i+=4;i+=0===s?8:16,i+=2;let n=e.length+0;const r=fe(e,i);i+=2;for(let s=0;s<r;s++){let s=i;const r=ge(e,s);s+=4;const o=2147483647&r;if(1===(2147483648&r)>>>31)return k.warn("SIDX has hierarchical references (not supported)"),null;const l=ge(e,s);s+=4,t.push({referenceSize:o,subsegmentDuration:l,info:{duration:l/a,start:n,end:n+o-1}}),n+=o,i=s+=4}return{earliestPresentationTime:0,timescale:a,version:s,referencesCount:r,references:t}}function be(e){const t=[],s=ve(e,["moov","trak"]);for(let e=0;e<s.length;e++){const i=s[e],a=ve(i,["tkhd"])[0];if(a){let e=a[0],s=0===e?12:20;const n=ge(a,s),r=ve(i,["mdia","mdhd"])[0];if(r){const a=ge(r,s=0===(e=r[0])?12:20),o=ve(i,["mdia","hdlr"])[0];if(o){const e=ue(o.subarray(8,12)),s={soun:A.AUDIO,vide:A.VIDEO}[e];if(s){const e=ve(i,["mdia","minf","stbl","stsd"])[0];let r;e&&(r=ue(e.subarray(12,16))),t[n]={timescale:a,type:s},t[s]={timescale:a,id:n,codec:r}}}}}}return ve(e,["moov","mvex","trex"]).forEach(e=>{const s=ge(e,4),i=t[s];i&&(i.default={duration:ge(e,12),flags:ge(e,20)})}),t}function _e(e){const t=ve(e,["schm"])[0];if(t){const s=ue(t.subarray(4,8));if("cbcs"===s||"cenc"===s)return ve(e,["schi","tenc"])[0]}return k.error("[eme] missing 'schm' box"),null}function ke(e){const t=ge(e,0);let s=8;1&t&&(s+=4),4&t&&(s+=4);let i=0;const a=ge(e,4);for(let n=0;n<a;n++){if(256&t){i+=ge(e,s),s+=4}512&t&&(s+=4),1024&t&&(s+=4),2048&t&&(s+=4)}return i}function Te(e,t){const s=new Uint8Array(e.length+t.length);return s.set(e),s.set(t,e.length),s}function Se(e,t){const s=[],i=t.samples,a=t.timescale,n=t.id;let r=!1;return ve(i,["moof"]).map(o=>{const l=o.byteOffset-8;ve(o,["traf"]).map(o=>{const d=ve(o,["tfdt"]).map(e=>{const t=e[0];let s=ge(e,4);return 1===t&&(s*=Math.pow(2,32),s+=ge(e,8)),s/a})[0];return void 0!==d&&(e=d),ve(o,["tfhd"]).map(d=>{const c=ge(d,4),h=16777215&ge(d,0);let u=0;const f=0!=(16&h);let g=0;const p=0!=(32&h);let m=8;c===n&&(0!=(1&h)&&(m+=8),0!=(2&h)&&(m+=4),0!=(8&h)&&(u=ge(d,m),m+=4),f&&(g=ge(d,m),m+=4),p&&(m+=4),"video"===t.type&&(r=function(e){if(!e)return!1;const t=e.indexOf("."),s=t<0?e:e.substring(0,t);return"hvc1"===s||"hev1"===s||"dvh1"===s||"dvhe"===s}(t.codec)),ve(o,["trun"]).map(n=>{const o=n[0],d=16777215&ge(n,0),c=0!=(1&d);let h=0;const f=0!=(4&d),p=0!=(256&d);let m=0;const v=0!=(512&d);let y=0;const b=0!=(1024&d),_=0!=(2048&d);let k=0;const T=ge(n,4);let S=8;c&&(h=ge(n,S),S+=4),f&&(S+=4);let w=h+l;for(let l=0;l<T;l++){if(p?(m=ge(n,S),S+=4):m=u,v?(y=ge(n,S),S+=4):y=g,b&&(S+=4),_&&(k=0===o?ge(n,S):pe(n,S),S+=4),t.type===A.VIDEO){let t=0;for(;t<y;){const n=ge(i,w);if(we(r,i[w+=4])){Ee(i.subarray(w,w+n),r?2:1,e+k/a,s)}w+=n,t+=n+4}}e+=m/a}}))})})}),s}function we(e,t){if(e){const e=t>>1&63;return 39===e||40===e}return 6===(31&t)}function Ee(e,t,s,i){const a=Ie(e);let n=0;n+=t;let r=0,o=0,l=!1,d=0;for(;n<a.length;){r=0;do{if(n>=a.length)break;r+=d=a[n++]}while(255===d);o=0;do{if(n>=a.length)break;o+=d=a[n++]}while(255===d);const e=a.length-n;if(!l&&4===r&&n<a.length){if(l=!0,181===a[n++]){const e=fe(a,n);if(n+=2,49===e){const e=ge(a,n);if(n+=4,1195456820===e){const e=a[n++];if(3===e){const t=a[n++],o=64&t,l=o?2+3*(31&t):0,d=new Uint8Array(l);if(o){d[0]=t;for(let e=1;e<l;e++)d[e]=a[n++]}i.push({type:e,payloadType:r,pts:s,bytes:d})}}}}}else if(5===r&&o<e){if(l=!0,o>16){const e=[];for(let t=0;t<16;t++){const s=a[n++].toString(16);e.push(1==s.length?"0"+s:s),3!==t&&5!==t&&7!==t&&9!==t||e.push("-")}const t=o-16,l=new Uint8Array(t);for(let e=0;e<t;e++)l[e]=a[n++];i.push({payloadType:r,pts:s,uuid:e.join(""),userData:ne(l),userDataBytes:l})}}else if(o<e)n+=o;else if(o>e)break}}function Ie(e){const t=e.byteLength,s=[];let i=1;for(;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(s.push(i+2),i+=2):i++;if(0===s.length)return e;const a=t-s.length,n=new Uint8Array(a);let r=0;for(i=0;i<a;r++,i++)r===s[0]&&(r++,s.shift()),n[i]=e[r];return n}function De(e,t,s){if(16!==e.byteLength)throw new RangeError("Invalid system id");let i,a,n;if(t){i=1,a=new Uint8Array(16*t.length);for(let e=0;e<t.length;e++){const s=t[e];if(16!==s.byteLength)throw new RangeError("Invalid key");a.set(s,16*e)}}else i=0,a=new Uint8Array;i>0?(n=new Uint8Array(4),t.length>0&&new DataView(n.buffer).setUint32(0,t.length,!1)):n=new Uint8Array;const r=new Uint8Array(4);return s&&s.byteLength>0&&new DataView(r.buffer).setUint32(0,s.byteLength,!1),function(e,...t){const s=t.length;let i=8,a=s;for(;a--;)i+=t[a].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=255&i,n.set(e,4),a=0,i=8;a<s;a++)n.set(t[a],i),i+=t[a].byteLength;return n}([112,115,115,104],new Uint8Array([i,0,0,0]),e,n,a,r,s||new Uint8Array)}let Ae={};class Le{static clearKeyUriToKeyIdMap(){Ae={}}constructor(e,t,s,i=[1],a=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=i,this.iv=a,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&"AES-128"!==e}isSupported(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case $.FAIRPLAY:case $.WIDEVINE:case $.PLAYREADY:case $.CLEARKEY:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof e&&("AES-128"!==this.method||this.iv||k.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const t=function(e){const t=new Uint8Array(16);for(let s=12;s<16;s++)t[s]=e>>8*(15-s)&255;return t}(e);return new Le(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=O(this.uri);if(t)switch(this.keyFormat){case $.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case $.PLAYREADY:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=De(e,null,t);const s=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),i=String.fromCharCode.apply(null,Array.from(s)),a=i.substring(i.indexOf("<"),i.length),n=(new DOMParser).parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(n){const e=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(e){const t=F(e).subarray(0,16);!function(e){const t=function(e,t,s){const i=e[t];e[t]=e[s],e[s]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=Ae[this.uri];if(!e){const t=Object.keys(Ae).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16),new DataView(e.buffer,12,4).setUint32(0,t),Ae[this.uri]=e}this.keyId=e}return this}}const Re=/\{\$([a-zA-Z0-9-_]+)\}/g;function xe(e){return Re.test(e)}function Ce(e,t,s){if(null!==e.variableList||e.hasVariableRefs)for(let i=s.length;i--;){const a=s[i],n=t[a];n&&(t[a]=Pe(e,n))}}function Pe(e,t){if(null!==e.variableList||e.hasVariableRefs){const s=e.variableList;return t.replace(Re,t=>{const i=t.substring(2,t.length-1),a=null==s?void 0:s[i];return void 0===a?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),t):a})}return t}function Fe(e,t,s){let i,a,n=e.variableList;if(n||(e.variableList=n={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{const t=new self.URL(s).searchParams;if(!t.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${s}"`);a=t.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else i=t.NAME,a=t.VALUE;i in n?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=a||""}function Oe(e,t,s){const i=t.IMPORT;if(s&&i in s){let t=e.variableList;t||(e.variableList=t={}),t[i]=s[i]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Me={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function Ne(e,t){return MediaSource.isTypeSupported(`${t||"video"}/mp4;codecs="${e}"`)}const $e=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Ue=/#EXT-X-MEDIA:(.*)/g,Be=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ge=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ve=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class ze{static findGroup(e,t){for(let s=0;s<e.length;s++){const i=e[s];if(i.id===t)return i}}static convertAVC1ToAVCOTI(e){const t=e.split(".");if(t.length>2){let e=t.shift()+".";return e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).slice(-4)}return e}static resolve(e,t){return l.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Be.test(e)}static parseMasterPlaylist(e,t){const s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:xe(e)},i=[];let a;for($e.lastIndex=0;null!=(a=$e.exec(e));)if(a[1]){var n;const e=new w(a[1]);Ce(s,e,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const r=Pe(s,a[2]),o={attrs:e,bitrate:e.decimalInteger("AVERAGE-BANDWIDTH")||e.decimalInteger("BANDWIDTH"),name:e.NAME,url:ze.resolve(r,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Ye((e.CODECS||"").split(/[ ,]+/).filter(e=>e),o),o.videoCodec&&-1!==o.videoCodec.indexOf("avc1")&&(o.videoCodec=ze.convertAVC1ToAVCOTI(o.videoCodec)),null!=(n=o.unknownCodecs)&&n.length||i.push(o),s.levels.push(o)}else if(a[3]){const e=a[3],i=a[4];switch(e){case"SESSION-DATA":{const e=new w(i);Ce(s,e,["DATA-ID","LANGUAGE","VALUE","URI"]);const t=e["DATA-ID"];t&&(null===s.sessionData&&(s.sessionData={}),s.sessionData[t]=e);break}case"SESSION-KEY":{const e=Ke(i,t,s);e.encrypted&&e.isSupported()?(null===s.sessionKeys&&(s.sessionKeys=[]),s.sessionKeys.push(e)):k.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":{const e=new w(i);Ce(s,e,["NAME","VALUE","QUERYPARAM"]),Fe(s,e,t)}break;case"CONTENT-STEERING":{const e=new w(i);Ce(s,e,["SERVER-URI","PATHWAY-ID"]),s.contentSteering={uri:ze.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":s.startTimeOffset=He(i)}}const r=i.length>0&&i.length<s.levels.length;return s.levels=r?i:s.levels,0===s.levels.length&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,s){let i;const a={},n=s.levels,r={AUDIO:n.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:n.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(Ue.lastIndex=0;null!==(i=Ue.exec(e));){const e=new w(i[1]),n=e.TYPE;if(n){const i=r[n],l=a[n]||[];a[n]=l,Ce(s,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",instreamId:e["INSTREAM-ID"],name:e.NAME||e.LANGUAGE||"",type:n,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:e.LANGUAGE,url:e.URI?ze.resolve(e.URI,t):""};if(null!=i&&i.length){const e=ze.findGroup(i,d.groupId)||i[0];We(d,e,"audioCodec"),We(d,e,"textCodec")}l.push(d)}}return a}static parseLevelPlaylist(e,t,s,i,a,n){const r=new P(t),o=r.fragments;let l,d,c,h=null,g=0,p=0,m=0,v=0,y=null,b=new R(i,t),_=-1,T=!1;for(Ge.lastIndex=0,r.m3u8=e,r.hasVariableRefs=xe(e);null!==(l=Ge.exec(e));){T&&(T=!1,(b=new R(i,t)).start=m,b.sn=g,b.cc=v,b.level=s,h&&(b.initSegment=h,b.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null));const e=l[1];if(e){b.duration=parseFloat(e);const t=(" "+l[2]).slice(1);b.title=t||null,b.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(f(b.duration)){b.start=m,c&&Xe(b,c,r),b.sn=g,b.level=s,b.cc=v,b.urlId=a,o.push(b);const e=(" "+l[3]).slice(1);b.relurl=Pe(r,e),je(b,y),y=b,m+=b.duration,g++,p=0,T=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);y?b.setByteRange(e,y):b.setByteRange(e)}else if(l[5])b.rawProgramDateTime=(" "+l[5]).slice(1),b.tagList.push(["PROGRAM-DATE-TIME",b.rawProgramDateTime]),-1===_&&(_=o.length);else{if(!(l=l[0].match(Ve))){k.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d<l.length&&void 0===l[d];d++);const e=(" "+l[d]).slice(1),a=(" "+l[d+1]).slice(1),m=l[d+2]?(" "+l[d+2]).slice(1):"";switch(e){case"PLAYLIST-TYPE":r.type=a.toUpperCase();break;case"MEDIA-SEQUENCE":g=r.startSN=parseInt(a);break;case"SKIP":{const e=new w(a);Ce(r,e,["RECENTLY-REMOVED-DATERANGES"]);const t=e.decimalInteger("SKIPPED-SEGMENTS");if(f(t)){r.skippedSegments=t;for(let e=t;e--;)o.unshift(null);g+=t}const s=e.enumeratedString("RECENTLY-REMOVED-DATERANGES");s&&(r.recentlyRemovedDateranges=s.split("\t"));break}case"TARGETDURATION":r.targetduration=Math.max(parseInt(a),1);break;case"VERSION":r.version=parseInt(a);break;case"EXTM3U":break;case"ENDLIST":r.live=!1;break;case"#":(a||m)&&b.tagList.push(m?[a,m]:[a]);break;case"DISCONTINUITY":v++,b.tagList.push(["DIS"]);break;case"GAP":b.gap=!0,b.tagList.push([e]);break;case"BITRATE":b.tagList.push([e,a]);break;case"DATERANGE":{const e=new w(a);Ce(r,e,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Ce(r,e,e.clientAttrs);const t=new I(e,r.dateRanges[e.ID]);t.isValid||r.skippedSegments?r.dateRanges[t.id]=t:k.warn(`Ignoring invalid DATERANGE tag: "${a}"`),b.tagList.push(["EXT-X-DATERANGE",a]);break}case"DEFINE":{const e=new w(a);Ce(r,e,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in e?Oe(r,e,n):Fe(r,e,t)}break;case"DISCONTINUITY-SEQUENCE":v=parseInt(a);break;case"KEY":{const e=Ke(a,t,r);if(e.isSupported()){if("NONE"===e.method){c=void 0;break}c||(c={}),c[e.keyFormat]&&(c=u({},c)),c[e.keyFormat]=e}else k.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${a}"`);break}case"START":r.startTimeOffset=He(a);break;case"MAP":{const e=new w(a);if(Ce(r,e,["BYTERANGE","URI"]),b.duration){const a=new R(i,t);qe(a,e,s,c),h=a,b.initSegment=h,h.rawProgramDateTime&&!b.rawProgramDateTime&&(b.rawProgramDateTime=h.rawProgramDateTime)}else qe(b,e,s,c),h=b,T=!0;break}case"SERVER-CONTROL":{const e=new w(a);r.canBlockReload=e.bool("CAN-BLOCK-RELOAD"),r.canSkipUntil=e.optionalFloat("CAN-SKIP-UNTIL",0),r.canSkipDateRanges=r.canSkipUntil>0&&e.bool("CAN-SKIP-DATERANGES"),r.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),r.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new w(a);r.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=r.partList;e||(e=r.partList=[]);const s=p>0?e[e.length-1]:void 0,i=p++,n=new w(a);Ce(r,n,["BYTERANGE","URI"]);const o=new x(n,b,t,i,s);e.push(o),b.duration+=o.duration;break}case"PRELOAD-HINT":{const e=new w(a);Ce(r,e,["URI"]),r.preloadHint=e;break}case"RENDITION-REPORT":{const e=new w(a);Ce(r,e,["URI"]),r.renditionReports=r.renditionReports||[],r.renditionReports.push(e);break}default:k.warn(`line parsed but not handled: ${l}`)}}}y&&!y.relurl?(o.pop(),m-=y.duration,r.partList&&(r.fragmentHint=y)):r.partList&&(je(b,y),b.cc=v,r.fragmentHint=b,c&&Xe(b,c,r));const S=o.length,E=o[0],D=o[S-1];if((m+=r.skippedSegments*r.targetduration)>0&&S&&D){r.averagetargetduration=m/S;const e=D.sn;r.endSN="initSegment"!==e?e:0,r.live||(D.endList=!0),E&&(r.startCC=E.cc)}else r.endSN=0,r.startCC=0;return r.fragmentHint&&(m+=r.fragmentHint.duration),r.totalduration=m,r.endCC=v,_>0&&function(e,t){let s=e[t];for(let i=t;i--;){const t=e[i];if(!t)return;t.programDateTime=s.programDateTime-1e3*t.duration,s=t}}(o,_),r}}function Ke(e,t,s){var i,a;const n=new w(e);Ce(s,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const r=null!=(i=n.METHOD)?i:"",o=n.URI,l=n.hexadecimalInteger("IV"),d=n.KEYFORMATVERSIONS,c=null!=(a=n.KEYFORMAT)?a:"identity";o&&n.IV&&!l&&k.error(`Invalid IV: ${n.IV}`);const h=o?ze.resolve(o,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Le(r,h,c,u,l)}function He(e){const t=new w(e).decimalFloatingPoint("TIME-OFFSET");return f(t)?t:null}function Ye(e,t){["video","audio","text"].forEach(s=>{const i=e.filter(e=>(function(e,t){const s=Me[t];return!!s&&!0===s[e.slice(0,4)]})(e,s));if(i.length){const a=i.filter(e=>0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0));t[`${s}Codec`]=a.length>0?a[0]:i[0],e=e.filter(e=>-1===i.indexOf(e))}}),t.unknownCodecs=e}function We(e,t,s){const i=t[s];i&&(e[s]=i)}function je(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),f(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function qe(e,t,s,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=s,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Xe(e,t,s){e.levelkeys=t;const{encryptedFragments:i}=s;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some(e=>t[e].isCommonEncryption)||i.push(e)}var Qe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Je={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Ze(e){const{type:t}=e;switch(t){case Qe.AUDIO_TRACK:return Je.AUDIO;case Qe.SUBTITLE_TRACK:return Je.SUBTITLE;default:return Je.MAIN}}function et(e,t){let s=e.url;return void 0!==s&&0!==s.indexOf("data:")||(s=t.url),s}class tt{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,i=t.loader,a=new(s||i)(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Qe.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:i,url:a,deliveryDirectives:n}=t;this.load({id:s,level:i,responseType:"text",type:Qe.LEVEL,url:a,deliveryDirectives:n})}onAudioTrackLoading(e,t){const{id:s,groupId:i,url:a,deliveryDirectives:n}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:Qe.AUDIO_TRACK,url:a,deliveryDirectives:n})}onSubtitleTrackLoading(e,t){const{id:s,groupId:i,url:a,deliveryDirectives:n}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:Qe.SUBTITLE_TRACK,url:a,deliveryDirectives:n})}load(e){var t;const s=this.hls.config;let i,a=this.getInternalLoader(e);if(a){const t=a.context;if(t&&t.url===e.url)return void k.trace("[playlist-loader]: playlist request ongoing");k.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),a.abort()}if(i=e.type===Qe.MANIFEST?s.manifestLoadPolicy.default:u({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),a=this.createInternalLoader(e),null!=(t=e.deliveryDirectives)&&t.part){let t;if(e.type===Qe.LEVEL&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Qe.AUDIO_TRACK&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===Qe.SUBTITLE_TRACK&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,s=t.targetduration;if(e&&s){const t=1e3*Math.max(3*e,.8*s);i=u({},i,{maxTimeToFirstByteMs:Math.min(t,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,i.maxTimeToFirstByteMs)})}}}const n=i.errorRetry||i.timeoutRetry||{},r={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},o={onSuccess:(e,t,s,i)=>{const a=this.getInternalLoader(s);this.resetInternalLoader(s.type);const n=e.data;0===n.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),ze.isMediaPlaylist(n)?this.handleTrackOrLevelPlaylist(e,t,s,i||null,a):this.handleMasterPlaylist(e,t,s,i)):this.handleManifestParsingError(e,s,new Error("no EXTM3U delimiter"),i||null,t)},onError:(e,t,s,i)=>{this.handleNetworkError(t,s,!1,e,i)},onTimeout:(e,t,s)=>{this.handleNetworkError(t,s,!0,void 0,e)}};a.load(e,r,o)}handleMasterPlaylist(e,t,s,i){const a=this.hls,n=e.data,r=et(e,s),o=ze.parseMasterPlaylist(n,r);if(o.playlistParsingError)return void this.handleManifestParsingError(e,s,o.playlistParsingError,i,t);const{contentSteering:l,levels:d,sessionData:c,sessionKeys:h,startTimeOffset:u,variableList:f}=o;this.variableList=f;const{AUDIO:p=[],SUBTITLES:m,"CLOSED-CAPTIONS":v}=ze.parseMasterPlaylistMedia(n,r,o);if(p.length){p.some(e=>!e.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(k.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new w({}),bitrate:0,url:""}))}a.trigger(g.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:m,captions:v,contentSteering:l,url:r,stats:t,networkDetails:i,sessionData:c,sessionKeys:h,startTimeOffset:u,variableList:f})}handleTrackOrLevelPlaylist(e,t,s,i,a){const n=this.hls,{id:r,level:o,type:l}=s,d=et(e,s),c=f(r)?r:0,h=f(o)?o:c,u=Ze(s),p=ze.parseLevelPlaylist(e.data,d,h,u,c,this.variableList);if(l===Qe.MANIFEST){const e={attrs:new w({}),bitrate:0,details:p,name:"",url:d};n.trigger(g.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=p,this.handlePlaylistLoaded(p,e,t,s,i,a)}handleManifestParsingError(e,t,s,i,a){this.hls.trigger(g.ERROR,{type:p.NETWORK_ERROR,details:m.MANIFEST_PARSING_ERROR,fatal:t.type===Qe.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:i,stats:a})}handleNetworkError(e,t,s=!1,i,a){let n=`A network ${s?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Qe.LEVEL?n+=`: ${e.level} id: ${e.id}`:e.type!==Qe.AUDIO_TRACK&&e.type!==Qe.SUBTITLE_TRACK||(n+=` id: ${e.id} group-id: "${e.groupId}"`);const r=new Error(n);k.warn(`[playlist-loader]: ${n}`);let o=m.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case Qe.MANIFEST:o=s?m.MANIFEST_LOAD_TIMEOUT:m.MANIFEST_LOAD_ERROR,l=!0;break;case Qe.LEVEL:o=s?m.LEVEL_LOAD_TIMEOUT:m.LEVEL_LOAD_ERROR,l=!1;break;case Qe.AUDIO_TRACK:o=s?m.AUDIO_TRACK_LOAD_TIMEOUT:m.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Qe.SUBTITLE_TRACK:o=s?m.SUBTITLE_TRACK_LOAD_TIMEOUT:m.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:p.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:d,context:e,error:r,networkDetails:t,stats:a};if(i){const s=(null==t?void 0:t.url)||e.url;h.response=c({url:s,data:void 0},i)}this.hls.trigger(g.ERROR,h)}handlePlaylistLoaded(e,t,s,i,a,n){const r=this.hls,{type:o,level:l,id:d,groupId:c,deliveryDirectives:h}=i,u=et(t,i),f=Ze(i),v="number"==typeof i.level&&f===Je.MAIN?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void r.trigger(g.ERROR,{type:p.NETWORK_ERROR,details:m.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:i,level:v,parent:f,networkDetails:a,stats:s})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const y=e.playlistParsingError;if(y)r.trigger(g.ERROR,{type:p.NETWORK_ERROR,details:m.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:y,reason:y.message,response:t,context:i,level:v,parent:f,networkDetails:a,stats:s});else switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case Qe.MANIFEST:case Qe.LEVEL:r.trigger(g.LEVEL_LOADED,{details:e,level:v||0,id:d||0,stats:s,networkDetails:a,deliveryDirectives:h});break;case Qe.AUDIO_TRACK:r.trigger(g.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:c||"",stats:s,networkDetails:a,deliveryDirectives:h});break;case Qe.SUBTITLE_TRACK:r.trigger(g.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:c||"",stats:s,networkDetails:a,deliveryDirectives:h})}}}function st(e,t){let s;try{s=new Event("addtrack")}catch(e){(s=document.createEvent("Event")).initEvent("addtrack",!1,!1)}s.track=e,t.dispatchEvent(s)}function it(e,t){const s=e.mode;if("disabled"===s&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(s){k.debug(`[texttrack-utils]: ${s}`);const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}"disabled"===s&&(e.mode=s)}function at(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function nt(e,t,s,i){const a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&e.cues.length>0){const a=function(e,t,s){const i=[],a=function(e,t){if(t<e[0].startTime)return 0;const s=e.length-1;if(t>e[s].endTime)return-1;let i=0,a=s;for(;i<=a;){const n=Math.floor((a+i)/2);if(t<e[n].startTime)a=n-1;else{if(!(t>e[n].startTime&&i<s))return n;i=n+1}}return e[i].startTime-t<t-e[a].startTime?i:a}(e,t);if(a>-1)for(let n=a,r=e.length;n<r;n++){const a=e[n];if(a.startTime>=t&&a.endTime<=s)i.push(a);else if(a.startTime>s)return i}return i}(e.cues,t,s);for(let t=0;t<a.length;t++)i&&!i(a[t])||e.removeCue(a[t])}"disabled"===a&&(e.mode=a)}var rt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const ot=.25;function lt(){if("undefined"!=typeof self)return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}const dt=(()=>{const e=lt();try{new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ct(e,t){return e.getTime()/1e3-t}class ht{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(at(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const s=e[t];if("metadata"===s.kind&&"id3"===s.label)return st(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:i}}}=this;if(!s&&!i)return;const{samples:a}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=lt();for(let e=0;e<a.length;e++){const t=a[e].type;if(t===rt.emsg&&!s||!i)continue;const r=Z(a[e].data);if(r){const s=a[e].pts;let i=s+a[e].duration;i>dt&&(i=dt),i-s<=0&&(i=s+ot);for(let e=0;e<r.length;e++){const a=r[e];if(!Q(a)){this.updateId3CueEnds(s);const e=new n(s,i,"");e.value=a,t&&(e.type=t),this.id3Track.addCue(e)}}}}}updateId3CueEnds(e){var t;const s=null==(t=this.id3Track)?void 0:t.cues;if(s)for(let t=s.length;t--;){const i=s[t];i.startTime<e&&i.endTime===dt&&(i.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:i}){const{id3Track:a,hls:n}=this;if(!n)return;const{config:{enableEmsgMetadataCues:r,enableID3MetadataCues:o}}=n;if(a&&(r||o)){let e;nt(a,t,s,e="audio"===i?e=>e.type===rt.audioId3&&o:"video"===i?e=>e.type===rt.emsg&&r:e=>e.type===rt.audioId3&&o||e.type===rt.emsg&&r)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:i}=this,{dateRanges:a}=t,n=Object.keys(a);if(i){const e=Object.keys(s).filter(e=>!n.includes(e));for(let t=e.length;t--;){const a=e[t];Object.keys(s[a].cues).forEach(e=>{i.removeCue(s[a].cues[e])}),delete s[a]}}const r=t.fragments[t.fragments.length-1];if(0===n.length||!f(null==r?void 0:r.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=r.programDateTime/1e3-r.start,l=lt();for(let e=0;e<n.length;e++){const t=n[e],i=a[t],r=s[t],h=(null==r?void 0:r.cues)||{};let u=(null==r?void 0:r.durationKnown)||!1;const f=ct(i.startDate,o);let g=dt;const p=i.endDate;if(p)g=ct(p,o),u=!0;else if(i.endOnNext&&!u){const e=n.reduce((e,t)=>{const s=a[t];return s.class===i.class&&s.id!==t&&s.startDate>i.startDate&&e.push(s),e},[]).sort((e,t)=>e.startDate.getTime()-t.startDate.getTime())[0];e&&(g=ct(e.startDate,o),u=!0)}const m=Object.keys(i.attr);for(let e=0;e<m.length;e++){const s=m[e];if("ID"===(c=s)||"CLASS"===c||"START-DATE"===c||"DURATION"===c||"END-DATE"===c||"END-ON-NEXT"===c)continue;let a=h[s];if(a)u&&!r.durationKnown&&(a.endTime=g);else{let e=i.attr[s];a=new l(f,g,""),E(s)&&(d=e,e=Uint8Array.from(d.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),a.value={key:s,data:e},a.type=rt.dateRange,a.id=t,this.id3Track.addCue(a),h[s]=a}}s[t]={cues:h,dateRange:i,durationKnown:u}}var d,c}}class ut{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=(()=>this.timeupdate()),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:a,liveSyncDurationCount:n,lowLatencyMode:r}=this.config,o=this.hls.userConfig;let l=r&&s||t;(o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==a?a:n*i);const d=i;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(null===e||null===t||null===s)return null;const i=s.edge,a=e-t-this.edgeStalled,n=i-s.totalduration,r=i-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(n,a),r)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(g.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(g.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===m.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(s=this.levelDetails)&&s.live&&k.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const s=this.computeLatency();if(null===s)return;this._latency=s;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:a}=this.config;if(!i||1===a)return;const n=this.targetLatency;if(null===n)return;const r=s-n,o=r<Math.min(this.maxLatency,n+t.targetduration);if(t.live&&o&&r>.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,a)),s=Math.round(2/(1+Math.exp(-.75*r-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,s))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const ft=["NONE","TYPE-0","TYPE-1",null];var gt={No:"",Yes:"YES",v2:"v2"};class pt{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class mt{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>e).join(",").replace(/\.[^.,]+/g,"")}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get attrs(){return this._attrs[this._urlId]}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get uri(){return this.url[this._urlId]||""}get urlId(){return this._urlId}set urlId(e){const t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}get audioGroupId(){var e;return null==(e=this.audioGroupIds)?void 0:e[this.urlId]}get textGroupId(){var e;return null==(e=this.textGroupIds)?void 0:e[this.urlId]}addFallback(e){this.url.push(e.url),this._attrs.push(e.attrs)}}function vt(e,t){const s=t.startPTS;if(f(s)){let i,a=0;t.sn>e.sn?(a=s-e.start,i=e):(a=e.start-s,i=t),i.duration!==a&&(i.duration=a)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function yt(e,t,s,i,a,n){i-s<=0&&(k.warn("Fragment should have a positive duration",t),i=s+t.duration,n=a+t.duration);let r=s,o=i;const l=t.startPTS,d=t.endPTS;if(f(l)){const e=Math.abs(l-s);f(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,r=Math.max(s,l),s=Math.min(s,l),a=Math.min(a,t.startDTS),o=Math.min(i,d),i=Math.max(i,d),n=Math.max(n,t.endDTS)}const c=s-t.start;0!==t.start&&(t.start=s),t.duration=i-t.start,t.startPTS=s,t.maxStartPTS=r,t.startDTS=a,t.endPTS=i,t.minEndPTS=o,t.endDTS=n;const h=t.sn;if(!e||h<e.startSN||h>e.endSN)return 0;let u;const g=h-e.startSN,p=e.fragments;for(p[g]=t,u=g;u>0;u--)vt(p[u],p[u-1]);for(u=g;u<p.length-1;u++)vt(p[u],p[u+1]);return e.fragmentHint&&vt(p[p.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,c}function bt(e,t){let s=null;const i=e.fragments;for(let e=i.length-1;e>=0;e--){const t=i[e].initSegment;if(t){s=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let a,n=0;if(function(e,t,s){const i=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,n=(e.fragmentHint?1:0)+(i?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,r=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=a;e<=n;e++){const a=l[r+e];let n=o[e];i&&!n&&e<i&&(n=t.fragments[e]=a),a&&n&&s(a,n)}}(e,t,(e,i)=>{e.relurl&&(n=e.cc-i.cc),f(e.startPTS)&&f(e.endPTS)&&(i.start=i.startPTS=e.startPTS,i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.duration=e.endPTS-e.startPTS,i.duration&&(a=i),t.PTSKnown=t.alignedSliding=!0),i.elementaryStreams=e.elementaryStreams,i.loader=e.loader,i.stats=e.stats,i.urlId=e.urlId,e.initSegment&&(i.initSegment=e.initSegment,s=e.initSegment)}),s){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach(e=>{var t;e.initSegment&&e.initSegment.relurl!==(null==(t=s)?void 0:t.relurl)||(e.initSegment=s)})}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some(e=>!e),t.deltaUpdateFailed){k.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,s){const i=u({},e);s&&s.forEach(e=>{delete i[e]});return Object.keys(t).forEach(e=>{const s=new I(t[e].attr,i[e]);s.isValid?i[e]=s:k.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)}),i}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const r=t.fragments;if(n){k.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e<r.length;e++)r[e].cc+=n}t.skippedSegments&&(t.startCC=t.fragments[0].cc),function(e,t,s){if(e&&t){let i=0;for(let a=0,n=e.length;a<=n;a++){const n=e[a],r=t[a+i];n&&r&&n.index===r.index&&n.fragment.sn===r.fragment.sn?s(n,r):i--}}}(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),a?yt(t,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):_t(e,t),r.length&&(t.totalduration=t.edge-r[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const o=t.advancedDateTime;if(t.advanced&&o){const e=t.edge;t.driftStart||(t.driftStartTime=o,t.driftStart=e),t.driftEndTime=o,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function _t(e,t){const s=t.startSN+t.skippedSegments-e.startSN,i=e.fragments;s<0||s>=i.length||kt(t,i[s].start)}function kt(e,t){if(t){const s=e.fragments;for(let i=e.skippedSegments;i<s.length;i++)s[i].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function Tt(e,t,s){var i;return null!=e&&e.details?St(null==(i=e.details)?void 0:i.partList,t,s):null}function St(e,t,s){if(e)for(let i=e.length;i--;){const a=e[i];if(a.index===s&&a.fragment.sn===t)return a}return null}function wt(e){switch(e.details){case m.FRAG_LOAD_TIMEOUT:case m.KEY_LOAD_TIMEOUT:case m.LEVEL_LOAD_TIMEOUT:case m.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Et(e,t){const s=wt(t);return e.default[`${s?"timeout":"error"}Retry`]}function It(e,t){const s="linear"===e.backoff?1:Math.pow(2,t);return Math.min(s*e.retryDelayMs,e.maxRetryDelayMs)}function Dt(e){return c(c({},e),{errorRetry:null,timeoutRetry:null})}function At(e,t,s,i){return!!e&&t<e.maxNumRetry&&(function(e){return 0===e&&!1===navigator.onLine||!!e&&(e<400||e>499)}(i)||!!s)}const Lt={search:function(e,t){let s=0,i=e.length-1,a=null,n=null;for(;s<=i;){const r=t(n=e[a=(s+i)/2|0]);if(r>0)s=a+1;else{if(!(r<0))return n;i=a-1}}return null}};function Rt(e,t,s=0,i=0){let a=null;if(e?a=t[e.sn-t[0].sn+1]||null:0===s&&0===t[0].start&&(a=t[0]),a&&0===xt(s,i,a))return a;const n=Lt.search(t,xt.bind(null,s,i));return!n||n===e&&a?a:n}function xt(e=0,t=0,s){if(s.start<=e&&s.start+s.duration>e)return 0;const i=Math.min(t,s.duration+(s.deltaPTS?s.deltaPTS:0));return s.start+s.duration-i<=e?1:s.start-i>e&&s.start?-1:0}function Ct(e,t,s){const i=1e3*Math.min(t,s.duration+(s.deltaPTS?s.deltaPTS:0));return(s.endProgramDateTime||0)-i>e}const Pt=3e5;var Ft={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ot={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};function Mt(e,t,s){if(performance.now()-e.lastErrorPerfMs>Pt)return!0;const i=e.details;if(t.details===m.FRAG_GAP&&i&&t.frag){const e=t.frag.start,s=Rt(null,i.fragments,e);if(s&&!s.gap)return!0}if(s&&e.errors.length<s.errors.length){const s=e.errors[e.errors.length-1];if(i&&s.frag&&t.frag&&Math.abs(s.frag.start-t.frag.start)>3*i.targetduration)return!0}return!1}class Nt{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=k.log.bind(k,`${t}:`),this.warn=k.warn.bind(k,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){clearTimeout(this.timer),this.timer=-1}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const s=null==t?void 0:t.renditionReports;if(s){let i=-1;for(let a=0;a<s.length;a++){const n=s[a];let r;try{r=new self.URL(n.URI,t.url).href}catch(e){k.warn(`Could not construct new URL for Rendition Report: ${e}`),r=n.URI||""}if(r===e){i=a;break}r===e.substring(0,r.length)&&(i=a)}if(-1!==i){const e=s[i],a=parseInt(e["LAST-MSN"])||(null==t?void 0:t.lastPartSn);let n=parseInt(e["LAST-PART"])||(null==t?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const e=Math.min(t.age-t.partTarget,t.targetduration);n>=0&&e>t.partTarget&&(n+=1)}return new pt(a,n>=0?n:void 0,gt.No)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:i,stats:a}=t,n=self.performance.now(),r=a.loading.first?Math.max(0,n-a.loading.first):0;if(i.advancedDateTime=Date.now()-r,i.live||null!=s&&s.live){if(i.reloaded(s),s&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED"}`),s&&i.fragments.length>0&&bt(s,i),!this.canLoad||!i.live)return;let r,o=void 0,l=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){const e=this.hls.config.lowLatencyMode,a=i.lastPartSn,n=i.endSN,d=i.lastPartIndex,c=a===n;-1!==d?(o=c?n+1:a,l=c?e?0:d:d+1):o=n+1;const h=i.age,u=h+i.ageHeader;let f=Math.min(u-i.partTarget,1.5*i.targetduration);if(f>0){if(s&&f>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${f} with playlist age: ${i.age}`),f=0;else{const e=Math.floor(f/i.targetduration);if(o+=e,void 0!==l){l+=Math.round(f%i.targetduration/i.partTarget)}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${h.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}i.tuneInGoal=f}if(r=this.getDeliveryDirectives(i,t.deliveryDirectives,o,l),e||!c)return void this.loadPlaylist(r)}else i.canBlockReload&&(r=this.getDeliveryDirectives(i,t.deliveryDirectives,o,l));const d=this.hls.mainForwardBufferInfo,c=d?d.end-d.len:0,h=function(e,t=1/0){let s=1e3*e.targetduration;if(e.updated){const i=e.fragments,a=4;if(i.length&&s*a>t){const e=1e3*i[i.length-1].duration;e<s&&(s=e)}}else s/=2;return Math.round(s)}(i,1e3*(i.edge-c));i.updated&&n>this.requestScheduled+h&&(this.requestScheduled=a.loading.start),void 0!==o&&i.canBlockReload?this.requestScheduled=a.loading.first+h-(1e3*i.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+h<n?this.requestScheduled=n:this.requestScheduled-n<=0&&(this.requestScheduled+=h);let u=this.requestScheduled-n;u=Math.max(0,u),this.log(`reload live playlist ${e} in ${Math.round(u)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(r),u)}else this.clearTimer()}getDeliveryDirectives(e,t,s,i){let a=function(e,t){const{canSkipUntil:s,canSkipDateRanges:i,endSN:a}=e;return s&&(void 0!==t?t-a:0)<s?i?gt.v2:gt.Yes:gt.No}(e,s);return null!=t&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,a=gt.No),new pt(s,i,a)}checkRetry(e){const t=e.details,s=wt(e),i=e.errorAction,{action:a,retryCount:n=0,retryConfig:r}=i||{},o=a===Ft.RetryRequest&&!!i&&!!r;if(o){var l;if(this.requestScheduled=-1,s&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${n+1}/${r.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=It(r,n);this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${n+1}/${r.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,i.resolved=!0}return o}}let $t;class Ut extends Nt{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}startLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.startLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=[],i={};let a;t.levels.forEach(e=>{var t;const n=e.attrs;-1!==(null==(t=e.audioCodec)?void 0:t.indexOf("mp4a.40.34"))&&($t||($t=/chrome|firefox/i.test(navigator.userAgent)),$t&&(e.audioCodec=void 0));const{AUDIO:r,CODECS:o,"FRAME-RATE":l,"PATHWAY-ID":d,RESOLUTION:c,SUBTITLES:h}=n,u=`${`${d||"."}-`}${e.bitrate}-${c}-${l}-${o}`;(a=i[u])?a.addFallback(e):(a=new mt(e),i[u]=a,s.push(a)),Bt(a,"audio",r),Bt(a,"text",h)}),this.filterAndSortMediaOptions(s,t)}filterAndSortMediaOptions(e,t){let s=[],i=[],a=!1,n=!1,r=!1,o=e.filter(({audioCodec:e,videoCodec:t,width:s,height:i,unknownCodecs:o})=>(a||(a=!(!s||!i)),n||(n=!!t),r||(r=!!e),!(null!=o&&o.length)&&(!e||Ne(e,"audio"))&&(!t||Ne(t,"video"))));if((a||n)&&r&&(o=o.filter(({videoCodec:e,width:t,height:s})=>!!e||!(!t||!s))),0===o.length)return void Promise.resolve().then(()=>{if(this.hls){const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}});t.audioTracks&&Gt(s=t.audioTracks.filter(e=>!e.audioCodec||Ne(e.audioCodec,"audio"))),t.subtitles&&Gt(i=t.subtitles);const l=o.slice(0);o.sort((e,t)=>e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"]?(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1:e.bitrate!==t.bitrate?e.bitrate-t.bitrate:e.attrs["FRAME-RATE"]!==t.attrs["FRAME-RATE"]?e.attrs.decimalFloatingPoint("FRAME-RATE")-t.attrs.decimalFloatingPoint("FRAME-RATE"):e.attrs.SCORE!==t.attrs.SCORE?e.attrs.decimalFloatingPoint("SCORE")-t.attrs.decimalFloatingPoint("SCORE"):a&&e.height!==t.height?e.height-t.height:0);let d=l[0];if(this.steering&&(o=this.steering.filterParsedLevels(o)).length!==l.length)for(let e=0;e<l.length;e++)if(l[e].pathwayId===o[0].pathwayId){d=l[e];break}this._levels=o;for(let e=0;e<o.length;e++)if(o[e]===d){this._firstLevel=e,this.log(`manifest loaded, ${o.length} level(s) found, first bitrate: ${d.bitrate}`);break}const c=r&&!n,h={levels:o,audioTracks:s,subtitleTracks:i,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:!c&&s.some(e=>!!e.url)};this.hls.trigger(g.MANIFEST_PARSED,h),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const s=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(g.ERROR,{type:p.OTHER_ERROR,details:m.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:s,reason:s.message}),i)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,i=this.currentLevel,a=i?i.attrs["PATHWAY-ID"]:void 0,n=t[e],r=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,s===e&&n.details&&i&&a===r)return;this.log(`Switching to level ${e}${r?" with Pathway "+r:""} from level ${s}${a?" with Pathway "+a:""}`);const o=u({},n,{level:e,maxBitrate:n.maxBitrate,attrs:n.attrs,uri:n.uri,urlId:n.urlId});delete o._attrs,delete o._urlId,this.hls.trigger(g.LEVEL_SWITCHING,o);const l=n.details;if(!l||l.live){const e=this.switchParams(n.uri,null==i?void 0:i.details);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===Qe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragLoaded(e,{frag:t}){if(void 0!==t&&t.type===Je.MAIN){const e=this._levels[t.level];void 0!==e&&(e.loadError=0)}}onLevelLoaded(e,t){var s;const{level:i,details:a}=t,n=this._levels[i];var r;if(!n)return this.warn(`Invalid level index ${i}`),void(null!=(r=t.deliveryDirectives)&&r.skip&&(a.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0),this.playlistLoaded(i,t,n.details)):null!=(s=t.deliveryDirectives)&&s.skip&&(a.deltaUpdateFailed=!0)}onAudioTrackSwitched(e,t){const s=this.currentLevel;if(!s)return;const i=this.hls.audioTracks[t.id].groupId;if(s.audioGroupIds&&s.audioGroupId!==i){let e=-1;for(let t=0;t<s.audioGroupIds.length;t++)if(s.audioGroupIds[t]===i){e=t;break}-1!==e&&e!==s.urlId&&(s.urlId=e,this.canLoad&&this.startLoad())}}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){const i=s.urlId;let a=s.uri;if(e)try{a=e.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const n=s.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} URI ${i+1}/${s.url.length} ${a}`),this.clearTimer(),this.hls.trigger(g.LEVEL_LOADING,{url:a,level:t,id:i,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e,t){const s=(e,s)=>s!==t,i=this._levels.filter((i,a)=>a!==e||(i.url.length>1&&void 0!==t?(i.url=i.url.filter(s),i.audioGroupIds&&(i.audioGroupIds=i.audioGroupIds.filter(s)),i.textGroupIds&&(i.textGroupIds=i.textGroupIds.filter(s)),i.urlId=0,!0):(this.steering&&this.steering.removeLevel(i),!1)));this.hls.trigger(g.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){t.forEach((e,t)=>{const{details:s}=e;null!=s&&s.fragments&&s.fragments.forEach(e=>{e.level=t})}),this._levels=t}}function Bt(e,t,s){s&&("audio"===t?(e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds[e.url.length-1]=s):"text"===t&&(e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds[e.url.length-1]=s))}function Gt(e){const t={};e.forEach(e=>{const s=e.groupId||"";e.id=t[s]=t[s]||0,t[s]++})}var Vt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class zt{constructor(e){this.mainFragEntity=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.mainFragEntity=this.activeParts=null}getAppendedFrag(e,t){if(t===Je.MAIN){const{mainFragEntity:t,activeParts:s}=this;if(t)if(t&&s)for(let i=s.length;i--;){const a=s[i],n=a?a.end:t.appendedPTS;if(a.start<=e&&null!==n&&e<=n)return i>9&&(this.activeParts=s.slice(i-9)),a}else if(t.body.start<=e&&null!==t.appendedPTS&&e<=t.appendedPTS)return t.body}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,i=Object.keys(s);for(let a=i.length;a--;){const n=s[i[a]];if((null==n?void 0:n.body.type)===t&&n.buffered){const t=n.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,s){this.timeRanges&&(this.timeRanges[e]=t),Object.keys(this.fragments).forEach(i=>{const a=this.fragments[i];if(!a)return;if(!a.buffered&&!a.loaded)return void(a.body.type===s&&this.removeFragment(a.body));const n=a.range[e];n&&n.time.some(e=>{const s=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return s&&this.removeFragment(a.body),s})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:i}=e;if(!t||"initSegment"===s.sn)return;const a=Ht(s),n=this.fragments[a];n&&(Object.keys(t).forEach(e=>{const a=s.elementaryStreams[e];if(!a)return;const r=t[e],o=null!==i||!0===a.partial;n.range[e]=this.getBufferedTimes(s,i,o,r)}),n.loaded=null,Object.keys(n.range).length?(n.buffered=!0,n.body.endList&&(this.endListFragments[n.body.type]=n)):this.removeFragment(n.body))}fragBuffered(e,t){const s=Ht(e);let i=this.fragments[s];!i&&t&&(i=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,s,i){const a={time:[],partial:s},n=t?t.start:e.start,r=t?t.end:e.end,o=e.minEndPTS||r,l=e.maxStartPTS||n;for(let e=0;e<i.length;e++){const t=i.start(e)-this.bufferPadding,s=i.end(e)+this.bufferPadding;if(l>=t&&o<=s){a.time.push({startPTS:Math.max(n,i.start(e)),endPTS:Math.min(r,i.end(e))});break}if(n<s&&r>t)a.partial=!0,a.time.push({startPTS:Math.max(n,i.start(e)),endPTS:Math.min(r,i.end(e))});else if(r<=t)break}return a}getPartialFragment(e){let t,s,i,a=null,n=0;const{bufferPadding:r,fragments:o}=this;return Object.keys(o).forEach(l=>{const d=o[l];d&&Kt(d)&&(s=d.body.start-r,i=d.body.end+r,e>=s&&e<=i&&(t=Math.min(e-s,i-e),n<=t&&(a=d.body,n=t)))}),a}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Kt(t))}getState(e){const t=Ht(e),s=this.fragments[t];return s?s.buffered?Kt(s)?Vt.PARTIAL:Vt.OK:Vt.APPENDING:Vt.NOT_LOADED}isTimeBuffered(e,t,s){let i,a;for(let n=0;n<s.length;n++){if(i=s.start(n)-this.bufferPadding,a=s.end(n)+this.bufferPadding,e>=i&&t<=a)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:i}=t;if("initSegment"===s.sn||s.bitrateTest||i)return;const a=Ht(s);this.fragments[a]={body:s,appendedPTS:null,loaded:t,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:i,timeRanges:a}=t;let n=this.mainFragEntity;if(s.type===Je.MAIN){const e=n?n.body:null;if(e!==s){n&&e&&e.sn!==s.sn&&(n.buffered=!0,this.fragments[Ht(e)]=n);const t=Ht(s);n=this.mainFragEntity=this.fragments[t]||{body:s,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)}}if(i){let e=this.activeParts;e||(this.activeParts=e=[]),e.push(i)}else this.activeParts=null}this.timeRanges=a,Object.keys(a).forEach(e=>{const t=a[e];if(this.detectEvictedFragments(e,t),!i&&n){const i=s.elementaryStreams[e];if(!i)return;for(let e=0;e<t.length;e++){const s=t.end(e);s<=i.endPTS&&s>i.startPTS?n.appendedPTS=Math.max(s,n.appendedPTS||0):n.appendedPTS=i.endPTS}}})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Ht(e);return!!this.fragments[t]}removeFragmentsInRange(e,t,s,i,a){i&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const r=this.fragments[n];if(!r)return;const o=r.body;o.type!==s||i&&!o.gap||o.start<t&&o.end>e&&(r.buffered||a)&&this.removeFragment(o)})}removeFragment(e){const t=Ht(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),this.mainFragEntity===this.fragments[t]&&(this.mainFragEntity=null),delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.mainFragEntity=null,this.activeParts=null,this.hasGaps=!1}}function Kt(e){var t,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(s=e.range.audio)?void 0:s.partial))}function Ht(e){return`${e.type}_${e.level}_${e.urlId}_${e.sn}`}const Yt=Math.pow(2,17);class Wt{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const s=e.url;if(!s)return Promise.reject(new Xt({type:p.NETWORK_ERROR,details:m.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,a=i.fLoader,n=i.loader;return new Promise((r,o)=>{if(this.loader&&this.loader.destroy(),e.gap)return void o(qt(e));const l=this.loader=e.loader=a?new a(i):new n(i),d=jt(e),h=Dt(i.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Yt};e.stats=l.stats,l.load(d,u,{onSuccess:(t,s,i,a)=>{this.resetLoader(e,l);let n=t.data;i.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(n.slice(0,16)),n=n.slice(16)),r({frag:e,part:null,payload:n,networkDetails:a})},onError:(t,i,a,n)=>{this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:c({url:s,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:a,stats:n}))},onAbort:(t,s,i)=>{this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:i,stats:t}))},onTimeout:(t,s,i)=>{this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:i,stats:t}))},onProgress:(s,i,a,n)=>{t&&t({frag:e,part:null,payload:a,networkDetails:n})}})})}loadPart(e,t,s){this.abort();const i=this.config,a=i.fLoader,n=i.loader;return new Promise((r,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(qt(e,t));const l=this.loader=e.loader=a?new a(i):new n(i),d=jt(e,t),h=Dt(i.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Yt};t.stats=l.stats,l.load(d,u,{onSuccess:(i,a,n,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:i.data,networkDetails:o};s(d),r(d)},onError:(s,i,a,n)=>{this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:c({url:d.url,data:void 0},s),error:new Error(`HTTP Error ${s.code} ${s.text}`),networkDetails:a,stats:n}))},onAbort:(s,i,a)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:a,stats:s}))},onTimeout:(s,i,a)=>{this.resetLoader(e,l),o(new Xt({type:p.NETWORK_ERROR,details:m.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:a,stats:s}))}})})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,a=i.total;if(s.loaded+=i.loaded,a){const i=Math.round(e.duration/t.duration),n=Math.min(Math.round(s.loaded/a),i),r=(i-n)*Math.round(s.loaded/n);s.total=s.loaded+r}else s.total=Math.max(s.loaded,s.total);const n=s.loading,r=i.loading;n.start?n.first+=r.first-r.start:(n.start=r.start,n.first=r.first),n.end=r.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function jt(e,t=null){const s=t||e,i={frag:e,part:t,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},a=s.byteRangeStartOffset,n=s.byteRangeEndOffset;if(f(a)&&f(n)){var r;let t=a,s=n;if("initSegment"===e.sn&&"AES-128"===(null==(r=e.decryptdata)?void 0:r.method)){const e=n-a;e%16&&(s=n+(16-e%16)),0!==a&&(i.resetIV=!0,t=a-16)}i.rangeStart=t,i.rangeEnd=s}return i}function qt(e,t){const s=new Error(`GAP ${e.gap?"tag":"attribute"} found`),i={type:p.MEDIA_ERROR,details:m.FRAG_GAP,fatal:!1,frag:e,error:s,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new Xt(i)}class Xt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Qt{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.abort()}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=m.KEY_LOAD_ERROR,s,i,a){return new Xt({type:p.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:a,error:s,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:i}=e;for(let e=0;e<t.length;e++){const a=t[e];if(i<=a.cc&&("initSegment"===s||"initSegment"===a.sn||s<a.sn)){this.emeController.selectKeySystemFormat(a).then(e=>{a.setKeyFormat(e)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,i;t&&e.setKeyFormat(t);const a=e.decryptdata;if(!a){const s=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,m.KEY_LOAD_ERROR,s))}const n=a.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,m.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));let r=this.keyUriToKeyInfo[n];if(null!=(s=r)&&s.decryptdata.key)return a.key=r.decryptdata.key,Promise.resolve({frag:e,keyInfo:r});var o;if(null!=(i=r)&&i.keyLoadPromise)switch(null==(o=r.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return r.keyLoadPromise.then(t=>(a.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:r}))}switch(r=this.keyUriToKeyInfo[n]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===a.keyFormat?this.loadKeyHTTP(r,e):this.loadKeyEME(r,e);case"AES-128":return this.loadKeyHTTP(r,e);default:return Promise.reject(this.createKeyLoadError(e,m.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${a.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(s);if(t)return(e.keyLoadPromise=t.then(t=>(e.mediaKeySessionContext=t,s))).catch(t=>{throw e.keyLoadPromise=null,t})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,i=new(0,s.loader)(s);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((a,n)=>{const r={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=s.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,s,i)=>{const{frag:r,keyInfo:o,url:l}=s;if(!r.decryptdata||o!==this.keyUriToKeyInfo[l])return n(this.createKeyLoadError(r,m.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),i));o.decryptdata.key=r.decryptdata.key=new Uint8Array(e.data),r.keyLoader=null,o.loader=null,a({frag:r,keyInfo:o})},onError:(e,s,i,a)=>{this.resetLoader(s),n(this.createKeyLoadError(t,m.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),i,c({url:r.url,data:void 0},e)))},onTimeout:(e,s,i)=>{this.resetLoader(s),n(this.createKeyLoadError(t,m.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:(e,s,i)=>{this.resetLoader(s),n(this.createKeyLoadError(t,m.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};i.load(r,l,d)})}resetLoader(e){const{frag:t,keyInfo:s,url:i}=e,a=s.loader;t.keyLoader===a&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[i],a&&a.destroy()}}class Jt{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}const Zt={length:0,start:()=>0,end:()=>0};class es{static isBuffered(e,t){try{if(e){const s=es.getBuffered(e);for(let e=0;e<s.length;e++)if(t>=s.start(e)&&t<=s.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,s){try{if(e){const i=es.getBuffered(e),a=[];let n;for(n=0;n<i.length;n++)a.push({start:i.start(n),end:i.end(n)});return this.bufferedInfo(a,t,s)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.sort(function(e,t){const s=e.start-t.start;return s||t.end-e.end});let i=[];if(s)for(let t=0;t<e.length;t++){const a=i.length;if(a){const n=i[a-1].end;e[t].start-n<s?e[t].end>n&&(i[a-1].end=e[t].end):i.push(e[t])}else i.push(e[t])}else i=e;let a,n=0,r=t,o=t;for(let e=0;e<i.length;e++){const l=i[e].start,d=i[e].end;if(t+s>=l&&t<d)r=l,n=(o=d)-t;else if(t+s<l){a=l;break}}return{len:n,start:r||0,end:o||0,nextStart:a}}static getBuffered(e){try{return e.buffered}catch(e){return k.log("failed to get media.buffered",e),Zt}}}class ts{constructor(e,t,s,i=0,a=-1,n=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=a,this.partial=n}}function ss(e,t){let s=null;for(let i=0,a=e.length;i<a;i++){const a=e[i];if(a&&a.cc===t){s=a;break}}return s}function is(e,t){if(e){const s=e.start+t;e.start=e.startPTS=s,e.endPTS=s+e.duration}}function as(e,t){const s=t.fragments;for(let t=0,i=s.length;t<i;t++)is(s[t],e);t.fragmentHint&&is(t.fragmentHint,e),t.alignedSliding=!0}function ns(e,t,s){t&&(!function(e,t,s){if(function(e,t,s){return!(!t.details||!(s.endCC>s.startCC||e&&e.cc<s.startCC))}(e,s,t)){const e=function(e,t,s=0){const i=e.fragments,a=t.fragments;if(!a.length||!i.length)return void k.log("No fragments to align");const n=ss(i,a[0].cc);if(n&&(!n||n.startPTS))return n;k.log("No frag in previous level to align on")}(s.details,t);e&&f(e.start)&&(k.log(`Adjusting PTS using last level due to CC increase within current level ${t.url}`),as(e.start,t))}}(e,s,t),!s.alignedSliding&&t.details&&function(e,t){if(!t.fragments.length||!e.hasProgramDateTime||!t.hasProgramDateTime)return;const s=t.fragments[0].programDateTime,i=e.fragments[0].programDateTime,a=(i-s)/1e3+t.fragments[0].start;a&&f(a)&&(k.log(`Adjusting PTS using programDateTime delta ${i-s}ms, sliding:${a.toFixed(3)} ${e.url} `),as(a,e))}(s,t.details),s.alignedSliding||!t.details||s.skippedSegments||_t(t.details,s))}function rs(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const s=e.fragments,i=t.fragments;if(!s.length||!i.length)return;const a=i[Math.round(i.length/2)-1],n=ss(s,a.cc)||s[Math.round(s.length/2)-1],r=a.programDateTime,o=n.programDateTime;null!==r&&null!==o&&as((o-r)/1e3-(n.start-a.start),e)}class os{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class ls{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class ds{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let e=0;e<4;e++)s[e]=t.getUint32(4*e);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,i=s[0],a=s[1],n=s[2],r=s[3],o=this.invSubMix,l=o[0],d=o[1],c=o[2],h=o[3],u=new Uint32Array(256);let f=0,g=0,p=0;for(p=0;p<256;p++)u[p]=p<128?p<<1:p<<1^283;for(p=0;p<256;p++){let s=g^g<<1^g<<2^g<<3^g<<4;s=s>>>8^255&s^99,e[f]=s,t[s]=f;const o=u[f],p=u[o],m=u[p];let v=257*u[s]^16843008*s;i[f]=v<<24|v>>>8,a[f]=v<<16|v>>>16,n[f]=v<<8|v>>>24,r[f]=v,v=16843009*m^65537*p^257*o^16843008*f,l[s]=v<<24|v>>>8,d[s]=v<<16|v>>>16,c[s]=v<<8|v>>>24,h[s]=v,f?(f=o^u[u[u[m^o]]],g^=u[u[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,i=0;for(;i<t.length&&s;)s=t[i]===this.key[i],i++;if(s)return;this.key=t;const a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);const n=this.ksRows=4*(a+6+1);let r,o;const l=this.keySchedule=new Uint32Array(n),d=this.invKeySchedule=new Uint32Array(n),c=this.sBox,h=this.rcon,u=this.invSubMix,f=u[0],g=u[1],p=u[2],m=u[3];let v,y;for(r=0;r<n;r++)r<a?v=l[r]=t[r]:(y=v,r%a==0?(y=c[(y=y<<8|y>>>24)>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y],y^=h[r/a|0]<<24):a>6&&r%a==4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y]),l[r]=v=(l[r-a]^y)>>>0);for(o=0;o<n;o++)r=n-o,y=3&o?l[r]:l[r-4],d[o]=o<4||r<=4?y:f[c[y>>>24]]^g[c[y>>>16&255]]^p[c[y>>>8&255]]^m[c[255&y]],d[o]=d[o]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}decrypt(e,t,s){const i=this.keySize+6,a=this.invKeySchedule,n=this.invSBox,r=this.invSubMix,o=r[0],l=r[1],d=r[2],c=r[3],h=this.uint8ArrayToUint32Array_(s);let u=h[0],f=h[1],g=h[2],p=h[3];const m=new Int32Array(e),v=new Int32Array(m.length);let y,b,_,k,T,S,w,E,I,D,A,L,R,x;const C=this.networkToHostOrderSwap;for(;t<m.length;){for(I=C(m[t]),D=C(m[t+1]),A=C(m[t+2]),L=C(m[t+3]),T=I^a[0],S=L^a[1],w=A^a[2],E=D^a[3],R=4,x=1;x<i;x++)y=o[T>>>24]^l[S>>16&255]^d[w>>8&255]^c[255&E]^a[R],b=o[S>>>24]^l[w>>16&255]^d[E>>8&255]^c[255&T]^a[R+1],_=o[w>>>24]^l[E>>16&255]^d[T>>8&255]^c[255&S]^a[R+2],k=o[E>>>24]^l[T>>16&255]^d[S>>8&255]^c[255&w]^a[R+3],T=y,S=b,w=_,E=k,R+=4;y=n[T>>>24]<<24^n[S>>16&255]<<16^n[w>>8&255]<<8^n[255&E]^a[R],b=n[S>>>24]<<24^n[w>>16&255]<<16^n[E>>8&255]<<8^n[255&T]^a[R+1],_=n[w>>>24]<<24^n[E>>16&255]<<16^n[T>>8&255]<<8^n[255&S]^a[R+2],k=n[E>>>24]<<24^n[T>>16&255]<<16^n[S>>8&255]<<8^n[255&w]^a[R+3],v[t]=C(y^u),v[t+1]=C(k^f),v[t+2]=C(_^g),v[t+3]=C(b^p),u=I,f=D,g=A,p=L,t+=4}return v.buffer}}const cs=16;class hs{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}null===this.subtle&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){const t=e.byteLength,s=t&&new DataView(e.buffer).getUint8(t-1);return s?K(e,0,t-s):e}(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s){return this.useSoftware?new Promise((i,a)=>{this.softwareDecrypt(new Uint8Array(e),t,s);const n=this.flush();n?i(n.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s)}softwareDecrypt(e,t,s){const{currentIV:i,currentResult:a,remainderData:n}=this;this.logOnce("JS AES decrypt"),n&&(e=Te(n,e),this.remainderData=null);const r=this.getValidChunk(e);if(!r.length)return null;i&&(s=i);let o=this.softwareDecrypter;o||(o=this.softwareDecrypter=new ds),o.expandKey(t);const l=a;return this.currentResult=o.decrypt(r.buffer,0,s),this.currentIV=K(r,-16).buffer,l||null}webCryptoDecrypt(e,t,s){const i=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new ls(i,t)),this.fastAesKey.expandKey().then(t=>{if(!i)return Promise.reject(new Error("web crypto not initialized"));return this.logOnce("WebCrypto AES decrypt"),new os(i,new Uint8Array(s)).decrypt(e.buffer,t)}).catch(i=>(k.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%cs;return s!==e.length&&(t=K(e,0,s),this.remainderData=K(e,s)),t}logOnce(e){this.logEnabled&&(k.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const us={toString:function(e){let t="";const s=e.length;for(let i=0;i<s;i++)t+=`[${e.start(i).toFixed(3)}-${e.end(i).toFixed(3)}]`;return t}},fs={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class gs extends Jt{constructor(e,t,s,i,a){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=fs.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=a,this.logPrefix=i,this.log=k.log.bind(k,`${i}:`),this.warn=k.warn.bind(k,`${i}:`),this.hls=e,this.fragmentLoader=new Wt(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new hs(e.config),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort();const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=fs.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const s=t.partList;if(null!=s&&s.length){const e=s[s.length-1];return es.isBuffered(this.media,e.start+e.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levels[this.levelLastLoaded])?void 0:e.details}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),s.addEventListener("seeking",this.onvseeking),s.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===fs.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(){const e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:s,mediaBuffer:i,state:a}=this,n=s?s.currentTime:0,r=es.bufferInfo(i||s,n,e.maxBufferHole);if(this.log(`media seeking to ${f(n)?n.toFixed(3):n}, state: ${a}`),this.state===fs.ENDED)this.resetLoadingState();else if(t){const s=e.maxFragLookUpTolerance,i=t.start-s,a=t.start+t.duration+s;if(!r.len||a<r.start||i>r.end){const e=n>a;(n<i||e)&&(e&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests()),this.resetLoadingState())}}s&&(this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!0),this.lastCurrentTime=n),this.loadedmetadata||r.len||(this.nextLoadPosition=this.startPosition=n),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.stopLoad(),super.onHandlerDestroying()}onHandlerDestroyed(){this.state=fs.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,s){this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){this._doFragLoad(e,t,s,t=>{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)}).then(t=>{if(!t)return;const s=this.state;this.fragContextChanged(e)?(s===fs.FRAG_LOADING||!this.fragCurrent&&s===fs.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=fs.IDLE):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(g.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))}).catch(t=>{this.state!==fs.STOPPED&&this.state!==fs.ERROR&&(this.warn(t),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;if(this.fragmentTracker.getState(e)===Vt.APPENDING){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),i=Math.max(e.duration,s?s.len:this.config.maxBufferLength);this.reduceMaxBufferLength(i)&&this.fragmentTracker.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)&&this.fragmentTracker.removeAllFragments()}flushMainBuffer(e,t,s=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:s};this.hls.trigger(g.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t}).then(t=>{const{hls:s}=this,{payload:i}=t,a=e.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){const n=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).catch(t=>{throw s.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(i=>{const a=self.performance.now();return s.trigger(g.FRAG_DECRYPTED,{frag:e,payload:i,stats:{tstart:n,tdecrypt:a}}),t.payload=i,t})}return t}).then(s=>{const{fragCurrent:i,hls:a,levels:n}=this;if(!n)throw new Error("init load aborted, missing levels");const r=e.stats;this.state=fs.IDLE,t.fragmentError=0,e.data=new Uint8Array(s.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),s.frag===i&&a.trigger(g.FRAG_BUFFERED,{stats:r,frag:i,part:null,id:e.type}),this.tick()}).catch(t=>{this.state!==fs.STOPPED&&this.state!==fs.ERROR&&(this.warn(t),this.resetFragmentLoading(e))})}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId}fragBufferedComplete(e,t){var s,i,a,n;const r=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level} (frag:[${(null!=(s=e.startPTS)?s:NaN).toFixed(3)}-${(null!=(i=e.endPTS)?i:NaN).toFixed(3)}] > buffer:${r?us.toString(es.getBuffered(r)):"(detached)"})`),this.state=fs.IDLE,r&&(!this.loadedmetadata&&e.type==Je.MAIN&&r.buffered.length&&(null==(a=this.fragCurrent)?void 0:a.sn)===(null==(n=this.fragPrevious)?void 0:n.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:i,partsLoaded:a}=e,n=!a||0===a.length||a.some(e=>!e),r=new ts(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(r)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var a;const n=null==t?void 0:t.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let r=null;if(!e.encrypted||null!=(a=e.decryptdata)&&a.key?!e.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(e,n.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=fs.KEY_LOADING,this.fragCurrent=e,r=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(g.KEY_LOADED,e),this.state===fs.KEY_LOADING&&(this.state=fs.IDLE),e}),this.hls.trigger(g.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(r=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),s=Math.max(e.start,s||0),this.config.lowLatencyMode){const a=n.partList;if(a&&i){s>e.end&&n.fragmentHint&&(e=n.fragmentHint);const o=this.getNextPart(a,e,s);if(o>-1){const l=a[o];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${n.startSN}-${n.endSN}] parts [0-${o}-${a.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=fs.FRAG_LOADING,d=r?r.then(s=>!s||this.fragContextChanged(s.frag)?null:this.doFragPartsLoad(e,l,t,i)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,l,t,i).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(g.FRAG_LOADING,{frag:e,part:l,targetBufferTime:s}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(a,s))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${n?"of ["+n.startSN+"-"+n.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),f(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=fs.FRAG_LOADING;const o=this.config.progressive;let l;return l=o&&r?r.then(t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,i)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,o?i:void 0),r]).then(([e])=>(!o&&e&&i&&i(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(g.FRAG_LOADING,{frag:e,targetBufferTime:s}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,s,i){return new Promise((a,n)=>{var r;const o=[],l=null==(r=s.details)?void 0:r.partList,d=t=>{this.fragmentLoader.loadPart(e,t,i).then(i=>{o[t.index]=i;const n=i.part;this.hls.trigger(g.FRAG_LOADED,i);const r=Tt(s,e.sn,t.index+1)||St(l,e.sn,t.index+1);if(!r)return a({frag:e,part:n,partsLoaded:o});d(r)}).catch(n)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===m.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(g.ERROR,t)}else this.hls.trigger(g.ERROR,{type:p.OTHER_ERROR,details:m.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==fs.PARSING)return void(this.fragCurrent||this.state===fs.STOPPED||this.state===fs.ERROR||(this.state=fs.IDLE));const{frag:s,part:i,level:a}=t,n=self.performance.now();s.stats.parsing.end=n,i&&(i.stats.parsing.end=n),this.updateLevelTiming(s,i,a,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:i,sn:a,part:n}=e;if(null==t||!t[i])return this.warn(`Levels object was unset while buffering fragment ${a} of level ${i}. The current chunk will not be buffered.`),null;const r=t[i],o=n>-1?Tt(r,a,n):null,l=o?o.fragment:function(e,t,s){if(null==e||!e.details)return null;const i=e.details;let a=i.fragments[t-i.startSN];return a||((a=i.fragmentHint)&&a.sn===t?a:t<i.startSN&&s&&s.sn===t?s:null)}(r,a,s);return l?(s&&s!==l&&(l.stats=s.stats),{frag:l,part:o,level:r}):null}bufferFragmentData(e,t,s,i){var a;if(!e||this.state!==fs.PARSING)return;const{data1:n,data2:r}=e;let o=n;if(n&&r&&(o=Te(n,r)),null==(a=o)||!a.length)return;const l={type:e.type,frag:t,part:s,chunkMeta:i,parent:t.type,data:o};this.hls.trigger(g.BUFFER_APPENDING,l),e.dropped&&e.independent&&!s&&this.flushBufferGap(t)}flushBufferGap(e){const t=this.media;if(!t)return;if(!es.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const s=t.currentTime,i=es.bufferInfo(t,s,0),a=e.duration,n=Math.min(2*this.config.maxFragLookUpTolerance,.25*a),r=Math.max(Math.min(e.start-n,i.end-n),s+n);e.start-r>n&&this.flushMainBuffer(r,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return f(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:i}}=this,a=es.bufferInfo(e,t,i);if(0===a.len&&void 0!==a.nextStart){const n=this.fragmentTracker.getBufferedFrag(t,s);if(n&&a.nextStart<n.end)return es.bufferInfo(e,t,Math.max(a.nextStart,i))}return a}getMaxBufferLength(e){const{config:t}=this;let s;return s=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,s=e||t.maxBufferLength;return t.maxMaxBufferLength>=s&&(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0)}getNextFragment(e,t){const s=t.fragments,i=s.length;if(!i)return null;const{config:a}=this,n=s[0].start;let r;if(t.live){const n=a.initialLiveManifestSize;if(i<n)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${n})`),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(r=this.getInitialLiveFragment(t,s),this.startPosition=r?this.hls.liveSyncPosition||r.start:e)}else e<=n&&(r=s[0]);if(!r){const s=a.lowLatencyMode?t.partEnd:t.fragmentEnd;r=this.getFragmentAtPosition(e,s,t)}return this.mapToInitFragWhenRequired(r)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===Vt.OK||s===Vt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,i,a){const n=e.gap,r=this.getNextFragment(this.nextLoadPosition,t);if(null===r)return r;if(e=r,n&&e&&!e.gap&&s.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i);if(null!==t&&s.len+t.len>=a)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,s){let i=-1,a=!1,n=!0;for(let r=0,o=e.length;r<o;r++){const o=e[r];if(n=n&&!o.independent,i>-1&&s<o.start)break;const l=o.loaded;l?i=-1:(a||o.independent||n)&&o.fragment===t&&(i=r),a=l}return i}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let i=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=function(e,t,s){if(null===t||!Array.isArray(e)||!e.length||!f(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;s=s||0;for(let i=0;i<e.length;++i){const a=e[i];if(Ct(t,s,a))return a}return null}(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const a=s.sn+1;if(a>=e.startSN&&a<=e.endSN){const n=t[a-e.startSN];s.cc===n.cc&&(i=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=function(e,t){return Lt.search(e,e=>e.cc<t?1:e.cc>t?-1:0)}(t,s.cc))&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`)}}else{const t=this.hls.liveSyncPosition;null!==t&&(i=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,s){const{config:i}=this;let{fragPrevious:a}=this,{fragments:n,endSN:r}=s;const{fragmentHint:o}=s,l=i.maxFragLookUpTolerance,d=!!(i.lowLatencyMode&&s.partList&&o);let c;if(d&&o&&!this.bitrateTest&&(n=n.concat(o),r=o.sn),e<t){c=Rt(a,n,e,e>t-l?0:l)}else c=n[n.length-1];if(c){const e=c.sn-s.startSN,t=this.fragmentTracker.getState(c);if((t===Vt.OK||t===Vt.PARTIAL&&c.gap)&&(a=c),a&&c.sn===a.sn&&!d){if(a&&c.level===a.level){const t=n[e+1];c=c.sn<r&&this.fragmentTracker.getState(t)!==Vt.OK?t:null}}}return c}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const i=this.hls.liveSyncPosition,a=s.currentTime,n=e.fragments[0].start,r=e.edge,o=a>=n-t.maxFragLookUpTolerance&&a<=r;if(null!==i&&s.duration>i&&(a<i||!o)){const n=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&s.readyState<4||a<r-n)&&(this.loadedmetadata||(this.nextLoadPosition=i),s.readyState&&(this.warn(`Playback: ${a.toFixed(3)} is located too far from the end of live sliding playlist: ${r}, reset currentTime to : ${i.toFixed(3)}`),s.currentTime=i))}}alignPlaylists(e,t){const{levels:s,levelLastLoaded:i,fragPrevious:a}=this,n=null!==i?s[i]:null,r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const o=e.fragments[0].start,l=!t,d=e.alignedSliding&&f(o);if(l||!d&&!o){ns(a,n,e);const s=e.fragments[0].start;return this.log(`Live playlist sliding: ${s.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${a?a.sn:"na"} fragments: ${r}`),s}return o}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let s=this.startPosition;if(s<t&&(s=-1),-1===s||-1===this.lastCurrentTime){const i=null!==this.startTimeOffset,a=i?this.startTimeOffset:e.startTimeOffset;null!==a&&f(a)?(s=t+a,a<0&&(s+=e.totalduration),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Start time offset ${a} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${s}`),this.startPosition=s):e.live?s=this.hls.liveSyncPosition||t:this.startPosition=s=0,this.lastCurrentTime=s}this.nextLoadPosition=s}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part"+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===fs.FRAG_LOADING_WAITING_RETRY)||(this.state=fs.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;var i;if(this.fragContextChanged(s))return void this.warn(`Frag load error must match current frag to retry ${s.url} > ${null==(i=this.fragCurrent)?void 0:i.url}`);const a=t.details===m.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(s,!0);const n=t.errorAction,{action:r,retryCount:o=0,retryConfig:l}=n||{};if(n&&r===Ft.RetryRequest&&l){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);const i=It(l,o);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${o+1}/${l.maxNumRetry} in ${i}ms`),n.resolved=!0,this.retryDate=self.performance.now()+i,this.state=fs.FRAG_LOADING_WAITING_RETRY}else l&&n?(this.resetFragmentErrors(e),o<l.maxNumRetry?a||(n.resolved=!0):k.warn(`${t.details} reached or exceeded max retry (${o})`)):this.state=fs.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===fs.PARSING||this.state===fs.PARSED){const t=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,t),i=s&&s.len>.5;i&&this.reduceMaxBufferLength(s.len);const a=!i;return a&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===Je.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==fs.STOPPED&&(this.state=fs.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const i=es.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===fs.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=fs.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=this.levels?this.levels[e].details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(e.level),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,i){var a;const n=s.details;if(n){if(Object.keys(e.elementaryStreams).reduce((t,a)=>{const r=e.elementaryStreams[a];if(r){const o=r.endPTS-r.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${a} duration reliably (${o})`),t||!1;const l=i?0:yt(n,e,r.startPTS,r.endPTS,r.startDTS,r.endDTS);return this.hls.trigger(g.LEVEL_PTS_UPDATED,{details:n,level:s,drift:l,type:a,frag:e,start:r.startPTS,end:r.endPTS}),!0}return t},!1))s.fragmentError=0;else if(null===(null==(a=this.transmuxer)?void 0:a.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${s.id} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=fs.PARSED,this.hls.trigger(g.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.resetTransmuxer(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function ps(){if("undefined"!=typeof self)return self.MediaSource||self.WebKitMediaSource}function ms(){return self.SourceBuffer||self.WebKitSourceBuffer}function vs(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class ys{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,s,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,s){}demux(e,t){this.cachedData&&(e=Te(this.cachedData,e),this.cachedData=null);let s,i=W(e,0),a=i?i.length:0;const n=this._audioTrack,r=this._id3Track,o=i?X(i):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&f(o))&&(this.basePTS=bs(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:rt.audioId3,duration:Number.POSITIVE_INFINITY});a<l;){if(this.canParse(e,a)){const t=this.appendFrame(n,e,a);t?(this.frameIndex++,this.lastPTS=t.sample.pts,s=a+=t.length):a=l}else q(e,a)?(i=W(e,a),r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:rt.audioId3,duration:Number.POSITIVE_INFINITY}),s=a+=i.length):a++;if(a===l&&s!==l){const t=K(e,s);this.cachedData?this.cachedData=Te(this.cachedData,t):this.cachedData=t}}return{audioTrack:n,videoTrack:vs(),id3Track:r,textTrack:vs()}}demuxSampleAes(e,t,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:vs(),id3Track:this._id3Track,textTrack:vs()}}destroy(){}}const bs=(e,t,s)=>{if(f(e))return 90*e;return 9e4*t+(s?9e4*s.baseTime/s.timescale:0)};function _s(e,t){return 255===e[t]&&240==(246&e[t+1])}function ks(e,t){return 1&e[t+1]?7:9}function Ts(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Ss(e,t){return t+1<e.length&&_s(e,t)}function ws(e,t){if(Ss(e,t)){const s=ks(e,t);if(t+s>=e.length)return!1;const i=Ts(e,t);if(i<=s)return!1;const a=t+i;return a===e.length||Ss(e,a)}return!1}function Es(e,t,s,i,a){if(!e.samplerate){const n=function(e,t,s,i){let a,n,r,o;const l=navigator.userAgent.toLowerCase(),d=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=1+((192&t[s+2])>>>6);const h=(60&t[s+2])>>>2;if(!(h>c.length-1))return r=(1&t[s+2])<<2,r|=(192&t[s+3])>>>6,k.log(`manifest codec:${i}, ADTS type:${a}, samplingIndex:${h}`),/firefox/i.test(l)?h>=6?(a=5,o=new Array(4),n=h-3):(a=2,o=new Array(2),n=h):-1!==l.indexOf("android")?(a=2,o=new Array(2),n=h):(a=5,o=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&h>=6?n=h-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(h>=6&&1===r||/vivaldi/i.test(l))||!i&&1===r)&&(a=2,o=new Array(2)),n=h)),o[0]=a<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=r<<3,5===a&&(o[1]|=(14&n)>>1,o[2]=(1&n)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:c[h],channelCount:r,codec:"mp4a.40."+a,manifestCodec:d};e.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,fatal:!0,reason:`invalid ADTS sampling index:${h}`})}(t,s,i,a);if(!n)return;e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,k.log(`parsed codec:${e.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function Is(e){return 9216e4/e}function Ds(e,t,s,i,a){const n=i+a*Is(e.samplerate),r=function(e,t){const s=ks(e,t);if(t+s<=e.length){const i=Ts(e,t)-s;if(i>0)return{headerLength:s,frameLength:i}}}(t,s);let o;if(r){const{frameLength:i,headerLength:a}=r,l=a+i,d=Math.max(0,s+l-t.length);d?(o=new Uint8Array(l-a)).set(t.subarray(s+a,t.length),0):o=t.subarray(s+a,s+l);const c={unit:o,pts:n};return d||e.samples.push(c),{sample:c,length:l,missing:d}}const l=t.length-s;return(o=new Uint8Array(l)).set(t.subarray(s,t.length),0),{sample:{unit:o,pts:n},length:l,missing:-1}}const As=/\/emsg[-/]ID3/i;let Ls=null;const Rs=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],xs=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Cs=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ps=[0,1,1,4];function Fs(e,t,s,i,a){if(s+24>t.length)return;const n=Os(t,s);if(n&&s+n.frameLength<=t.length){const r=i+a*(9e4*n.samplesPerFrame/n.sampleRate),o={unit:t.subarray(s,s+n.frameLength),pts:r,dts:r};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(o),{sample:o,length:n.frameLength,missing:0}}}function Os(e,t){const s=e[t+1]>>3&3,i=e[t+1]>>1&3,a=e[t+2]>>4&15,n=e[t+2]>>2&3;if(1!==s&&0!==a&&15!==a&&3!==n){const r=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*Rs[14*(3===s?3-i:3===i?3:4)+a-1],d=xs[3*(3===s?0:2===s?1:2)+n],c=3===o?1:2,h=Cs[s][i],u=Ps[i],f=8*h*u,g=Math.floor(h*l/d+r)*u;if(null===Ls){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ls=e?parseInt(e[1]):0}return!!Ls&&Ls<=87&&2===i&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:c,frameLength:g,samplesPerFrame:f}}}function Ms(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Ns(e,t){return t+1<e.length&&Ms(e,t)}function $s(e,t){if(t+1<e.length&&Ms(e,t)){const s=4,i=Os(e,t);let a=s;null!=i&&i.frameLength&&(a=i.frameLength);const n=t+a;return n===e.length||Ns(e,n)}return!1}class Us{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");i.set(e.subarray(s,s+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&k.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?s<<t|this.readBits(t):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,s=8,i=8;for(let a=0;a<e;a++)0!==i&&(i=(s+(t=this.readEG())+256)%256),s=0===i?s:i}readSPS(){let e,t,s,i=0,a=0,n=0,r=0;const o=this.readUByte.bind(this),l=this.readBits.bind(this),d=this.readUEG.bind(this),c=this.readBoolean.bind(this),h=this.skipBits.bind(this),u=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);o();const p=o();if(l(5),h(3),o(),f(),100===p||110===p||122===p||244===p||44===p||83===p||86===p||118===p||128===p){const e=d();if(3===e&&h(1),f(),f(),h(1),c())for(t=3!==e?8:12,s=0;s<t;s++)c()&&g(s<6?16:64)}f();const m=d();if(0===m)d();else if(1===m)for(h(1),u(),u(),e=d(),s=0;s<e;s++)u();f(),h(1);const v=d(),y=d(),b=l(1);0===b&&h(1),h(1),c()&&(i=d(),a=d(),n=d(),r=d());let _=[1,1];if(c()&&c()){switch(o()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[o()<<8|o(),o()<<8|o()]}}return{width:Math.ceil(16*(v+1)-2*i-2*a),height:(2-b)*(y+1)*16-(b?2:4)*(n+r),pixelRatio:_}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Bs{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new hs(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const i=e[t].unit;if(i.length<=16)return;const a=i.subarray(16,i.length-i.length%16),n=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(n).then(a=>{const n=new Uint8Array(a);i.set(n,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length)return void s();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,s=new Int8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)s.set(e.subarray(t,t+16),i);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)e.set(s.subarray(i,i+16),t);return e}decryptAvcSample(e,t,s,i,a){const n=Ie(a.data),r=this.getAvcEncryptedData(n);this.decryptBuffer(r.buffer).then(r=>{a.data=this.getAvcDecryptedUnit(n,r),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i)})}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length)return void i();const a=e[t].units;for(;!(s>=a.length);s++){const n=a[s];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(e,t,s,i,n),this.decrypter.isSync())))return}}}}const Gs=188;class Vs{constructor(e,t,s){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=s}static probe(e){const t=Vs.syncOffset(e);return t>0&&k.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length,s=Math.min(5*Gs,e.length-Gs)+1;let i=0;for(;i<s;){let a=!1;for(let n=i;n<t&&71===e[n];n+=Gs)if(a||0!==Ks(e,n)||(a=!0),a&&n+Gs>s)return i;i++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:he[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=Vs.createTrack("video"),this._audioTrack=Vs.createTrack("audio",i),this._id3Track=Vs.createTrack("id3"),this._txtTrack=Vs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_avcTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null}demux(e,t,s=!1,i=!1){let a;s||(this.sampleAes=null);const n=this._avcTrack,r=this._audioTrack,o=this._id3Track,l=this._txtTrack;let d=n.pid,c=n.pesData,h=r.pid,u=o.pid,f=r.pesData,v=o.pesData,y=null,b=this.pmtParsed,_=this._pmtId,T=e.length;if(this.remainderData&&(T=(e=Te(this.remainderData,e)).length,this.remainderData=null),T<Gs&&!i)return this.remainderData=e,{audioTrack:r,videoTrack:n,id3Track:o,textTrack:l};const S=Math.max(0,Vs.syncOffset(e));(T-=(T-S)%Gs)<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,T,e.buffer.byteLength-T));let w=0;for(let t=S;t<T;t+=Gs)if(71===e[t]){const i=!!(64&e[t+1]),g=Ks(e,t);let p;if((48&e[t+3])>>4>1){if((p=t+5+e[t+4])===t+Gs)continue}else p=t+4;switch(g){case d:i&&(c&&(a=Ws(c))&&this.parseAVCPES(n,l,a,!1),c={data:[],size:0}),c&&(c.data.push(e.subarray(p,t+Gs)),c.size+=t+Gs-p);break;case h:if(i){if(f&&(a=Ws(f)))switch(r.segmentCodec){case"aac":this.parseAACPES(r,a);break;case"mp3":this.parseMPEGPES(r,a)}f={data:[],size:0}}f&&(f.data.push(e.subarray(p,t+Gs)),f.size+=t+Gs-p);break;case u:i&&(v&&(a=Ws(v))&&this.parseID3PES(o,a),v={data:[],size:0}),v&&(v.data.push(e.subarray(p,t+Gs)),v.size+=t+Gs-p);break;case 0:i&&(p+=e[p]+1),_=this._pmtId=Hs(e,p);break;case _:{i&&(p+=e[p]+1);const a=Ys(e,p,this.typeSupported,s);(d=a.avc)>0&&(n.pid=d),(h=a.audio)>0&&(r.pid=h,r.segmentCodec=a.segmentCodec),(u=a.id3)>0&&(o.pid=u),null===y||b||(k.warn(`MPEG-TS PMT found at ${t} after unknown PID '${y}'. Backtracking to sync byte @${S} to parse all TS packets.`),y=null,t=S-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=g}}else w++;if(w>0){const e=new Error(`Found ${w} TS packet/s that do not start with 0x47`);this.observer.emit(g.ERROR,g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message})}n.pesData=c,r.pesData=f,o.pesData=v;const E={audioTrack:r,videoTrack:n,id3Track:o,textTrack:l};return i&&this.extractRemainingSamples(E),E}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:i,textTrack:a}=e,n=s.pesData,r=t.pesData,o=i.pesData;let l;if(n&&(l=Ws(n))?(this.parseAVCPES(s,a,l,!0),s.pesData=null):s.pesData=n,r&&(l=Ws(r))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l)}t.pesData=null}else null!=r&&r.size&&k.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=r;o&&(l=Ws(o))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=o}demuxSampleAes(e,t,s){const i=this.demux(e,s,!0,!this.config.progressive),a=this.sampleAes=new Bs(this.observer,this.config,t);return this.decrypt(i,a)}decrypt(e,t){return new Promise(s=>{const{audioTrack:i,videoTrack:a}=e;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,()=>{a.samples?t.decryptAvcSamples(a.samples,0,0,()=>{s(e)}):s(e)}):a.samples&&t.decryptAvcSamples(a.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAVCPES(e,t,s,i){const a=this.parseAVCNALu(e,s.data);let n,r=this.avcSample,o=!1;s.data=null,r&&a.length&&!e.audFound&&(js(r,e),r=this.avcSample=zs(!1,s.pts,s.dts,"")),a.forEach(i=>{switch(i.type){case 1:{n=!0,r||(r=this.avcSample=zs(!0,s.pts,s.dts,"")),r.frame=!0;const e=i.data;if(o&&e.length>4){const t=new Us(e).readSliceType();2!==t&&4!==t&&7!==t&&9!==t||(r.key=!0)}break}case 5:n=!0,r||(r=this.avcSample=zs(!0,s.pts,s.dts,"")),r.key=!0,r.frame=!0;break;case 6:n=!0,Ee(i.data,1,s.pts,t.samples);break;case 7:if(n=!0,o=!0,!e.sps){const t=i.data,s=new Us(t).readSPS();e.width=s.width,e.height=s.height,e.pixelRatio=s.pixelRatio,e.sps=[t],e.duration=this._duration;const a=t.subarray(1,4);let n="avc1.";for(let e=0;e<3;e++){let t=a[e].toString(16);t.length<2&&(t="0"+t),n+=t}e.codec=n}break;case 8:n=!0,e.pps||(e.pps=[i.data]);break;case 9:n=!1,e.audFound=!0,r&&js(r,e),r=this.avcSample=zs(!1,s.pts,s.dts,"");break;case 12:n=!0;break;default:n=!1,r&&(r.debug+="unknown NAL "+i.type+" ")}if(r&&n){r.units.push(i)}}),i&&r&&(js(r,e),this.avcSample=null)}getLastNalUnit(e){var t;let s,i=this.avcSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){const e=i.units;s=e[e.length-1]}return s}parseAVCNALu(e,t){const s=t.byteLength;let i=e.naluState||0;const a=i,n=[];let r,o,l,d=0,c=-1,h=0;for(-1===i&&(c=0,h=31&t[0],i=0,d=1);d<s;)if(r=t[d++],i)if(1!==i)if(r)if(1===r){if(c>=0){const e={data:t.subarray(c,d-i-1),type:h};n.push(e)}else{const s=this.getLastNalUnit(e.samples);if(s&&(a&&d<=4-a&&s.state&&(s.data=s.data.subarray(0,s.data.byteLength-a)),(o=d-i-1)>0)){const e=new Uint8Array(s.data.byteLength+o);e.set(s.data,0),e.set(t.subarray(0,o),s.data.byteLength),s.data=e,s.state=0}}d<s?(c=d,h=l=31&t[d],i=0):i=-1}else i=0;else i=3;else i=r?0:2;else i=r?0:1;if(c>=0&&i>=0){const e={data:t.subarray(c,s),type:h,state:i};n.push(e)}if(0===n.length){const s=this.getLastNalUnit(e.samples);if(s){const e=new Uint8Array(s.data.byteLength+t.byteLength);e.set(s.data,0),e.set(t,s.data.byteLength),s.data=e}}return e.naluState=i,n}parseAACPES(e,t){let s=0;const i=this.aacOverFlow;let a,n,r,o=t.data;if(i){this.aacOverFlow=null;const t=i.missing,a=i.sample.unit.byteLength;if(-1===t){const e=new Uint8Array(a+o.byteLength);e.set(i.sample.unit,0),e.set(o,a),o=e}else{const n=a-t;i.sample.unit.set(o.subarray(0,t),n),e.samples.push(i.sample),s=i.missing}}for(a=s,n=o.length;a<n-1&&!Ss(o,a);a++);if(a!==s){let e;const t=a<n-1;e=t?`AAC PES did not start with ADTS header,offset:${a}`:"No ADTS header found in AAC PES";const s=new Error(e);if(k.warn(`parsing error: ${e}`),this.observer.emit(g.ERROR,g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:s,reason:e}),!t)return}if(Es(e,this.observer,o,a,this.audioCodec),void 0!==t.pts)r=t.pts;else{if(!i)return void k.warn("[tsdemuxer]: AAC PES unknown PTS");{const t=Is(e.samplerate);r=i.sample.pts+t}}let l,d=0;for(;a<n;){if(a+=(l=Ds(e,o,a,r,d)).length,l.missing){this.aacOverFlow=l;break}for(d++;a<n-1&&!Ss(o,a);a++);}}parseMPEGPES(e,t){const s=t.data,i=s.length;let a=0,n=0;const r=t.pts;if(void 0!==r)for(;n<i;)if(Ns(s,n)){const t=Fs(e,s,n,r,a);if(!t)break;n+=t.length,a++}else n++;else k.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseID3PES(e,t){if(void 0===t.pts)return void k.warn("[tsdemuxer]: ID3 PES unknown PTS");const s=u({},t,{type:this._avcTrack?rt.emsg:rt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function zs(e,t,s,i){return{key:e,frame:!1,pts:t,dts:s,units:[],debug:i,length:0}}function Ks(e,t){return((31&e[t+1])<<8)+e[t+2]}function Hs(e,t){return(31&e[t+10])<<8|e[t+11]}function Ys(e,t,s,i){const a={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<n;){const n=Ks(e,t);switch(e[t]){case 207:if(!i){k.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===a.audio&&(a.audio=n);break;case 21:-1===a.id3&&(a.id3=n);break;case 219:if(!i){k.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===a.avc&&(a.avc=n);break;case 3:case 4:!0!==s.mpeg&&!0!==s.mp3?k.log("MPEG audio found, not supported in this browser"):-1===a.audio&&(a.audio=n,a.segmentCodec="mp3");break;case 36:k.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return a}function Ws(e){let t,s,i,a,n,r=0;const o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;){const e=new Uint8Array(o[0].length+o[1].length);e.set(o[0]),e.set(o[1],o[0].length),o[0]=e,o.splice(1,1)}if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((s=(t[4]<<8)+t[5])&&s>e.size-6)return null;const l=t[7];192&l&&(a=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?a-(n=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(k.warn(`${Math.round((a-n)/9e4)}s delta between PTS and DTS, align them`),a=n):n=a);let d=(i=t[8])+9;if(e.size<=d)return null;e.size-=d;const c=new Uint8Array(e.size);for(let e=0,s=o.length;e<s;e++){let s=(t=o[e]).byteLength;if(d){if(d>s){d-=s;continue}t=t.subarray(d),s-=d,d=0}c.set(t,r),r+=s}return s&&(s-=i+3),{data:c,pts:a,dts:n,len:s}}return null}function js(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const s=t.samples,i=s.length;if(!i)return void t.dropped++;{const t=s[i-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}e.debug.length&&k.log(e.pts+"/"+e.dts+":"+e.debug)}class qs{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const Xs=Math.pow(2,32)-1;class Qs{static init(){let e;for(e in Qs.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},Qs.types)Qs.types.hasOwnProperty(e)&&(Qs.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Qs.HDLR_TYPES={video:t,audio:s};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);Qs.STTS=Qs.STSC=Qs.STCO=a,Qs.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Qs.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Qs.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Qs.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const n=new Uint8Array([105,115,111,109]),r=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);Qs.FTYP=Qs.box(Qs.types.ftyp,n,o,n,r),Qs.DINF=Qs.box(Qs.types.dinf,Qs.box(Qs.types.dref,i))}static box(e,...t){let s=8,i=t.length;const a=i;for(;i--;)s+=t[i].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=255&s,n.set(e,4),i=0,s=8;i<a;i++)n.set(t[i],s),s+=t[i].byteLength;return n}static hdlr(e){return Qs.box(Qs.types.hdlr,Qs.HDLR_TYPES[e])}static mdat(e){return Qs.box(Qs.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(Xs+1)),i=Math.floor(t%(Xs+1));return Qs.box(Qs.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}static mdia(e){return Qs.box(Qs.types.mdia,Qs.mdhd(e.timescale,e.duration),Qs.hdlr(e.type),Qs.minf(e))}static mfhd(e){return Qs.box(Qs.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?Qs.box(Qs.types.minf,Qs.box(Qs.types.smhd,Qs.SMHD),Qs.DINF,Qs.stbl(e)):Qs.box(Qs.types.minf,Qs.box(Qs.types.vmhd,Qs.VMHD),Qs.DINF,Qs.stbl(e))}static moof(e,t,s){return Qs.box(Qs.types.moof,Qs.mfhd(e),Qs.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=Qs.trak(e[t]);return Qs.box.apply(null,[Qs.types.moov,Qs.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(Qs.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=Qs.trex(e[t]);return Qs.box.apply(null,[Qs.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Xs+1)),i=Math.floor(t%(Xs+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Qs.box(Qs.types.mvhd,a)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let i,a;for(i=0;i<t.length;i++)a=t[i].flags,s[i+4]=a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy;return Qs.box(Qs.types.sdtp,s)}static stbl(e){return Qs.box(Qs.types.stbl,Qs.stsd(e),Qs.box(Qs.types.stts,Qs.STTS),Qs.box(Qs.types.stsc,Qs.STSC),Qs.box(Qs.types.stsz,Qs.STSZ),Qs.box(Qs.types.stco,Qs.STCO))}static avc1(e){let t,s,i,a=[],n=[];for(t=0;t<e.sps.length;t++)i=(s=e.sps[t]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(s));for(t=0;t<e.pps.length;t++)i=(s=e.pps[t]).byteLength,n.push(i>>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(s));const r=Qs.box(Qs.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(n))),o=e.width,l=e.height,d=e.pixelRatio[0],c=e.pixelRatio[1];return Qs.box(Qs.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),r,Qs.box(Qs.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Qs.box(Qs.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,c>>24,c>>16&255,c>>8&255,255&c])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static mp4a(e){const t=e.samplerate;return Qs.box(Qs.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),Qs.box(Qs.types.esds,Qs.esds(e)))}static mp3(e){const t=e.samplerate;return Qs.box(Qs.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?Qs.box(Qs.types.stsd,Qs.STSD,Qs.mp3(e)):Qs.box(Qs.types.stsd,Qs.STSD,Qs.mp4a(e)):Qs.box(Qs.types.stsd,Qs.STSD,Qs.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,i=e.width,a=e.height,n=Math.floor(s/(Xs+1)),r=Math.floor(s%(Xs+1));return Qs.box(Qs.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))}static traf(e,t){const s=Qs.sdtp(e),i=e.id,a=Math.floor(t/(Xs+1)),n=Math.floor(t%(Xs+1));return Qs.box(Qs.types.traf,Qs.box(Qs.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),Qs.box(Qs.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,n>>24,n>>16&255,n>>8&255,255&n])),Qs.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,Qs.box(Qs.types.trak,Qs.tkhd(e),Qs.mdia(e))}static trex(e){const t=e.id;return Qs.box(Qs.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],i=s.length,a=12+16*i,n=new Uint8Array(a);let r,o,l,d,c,h;for(t+=8+a,n.set(["video"===e.type?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),r=0;r<i;r++)l=(o=s[r]).duration,d=o.size,c=o.flags,h=o.cts,n.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*r);return Qs.box(Qs.types.trun,n)}static initSegment(e){Qs.types||Qs.init();const t=Qs.moov(e),s=new Uint8Array(Qs.FTYP.byteLength+t.byteLength);return s.set(Qs.FTYP),s.set(t,Qs.FTYP.byteLength),s}}Qs.types=void 0,Qs.HDLR_TYPES=void 0,Qs.STTS=void 0,Qs.STSC=void 0,Qs.STCO=void 0,Qs.STSZ=void 0,Qs.VMHD=void 0,Qs.SMHD=void 0,Qs.STSD=void 0,Qs.FTYP=void 0,Qs.DINF=void 0;const Js=9e4;function Zs(e,t,s=1,i=!1){const a=e*t*s;return i?Math.round(a):a}function ei(e,t=!1){return Zs(e,1e3,1/Js,t)}const ti=1e4,si=1024,ii=1152;let ai,ni=null,ri=null;class oi{constructor(e,t,s,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,null===ni){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ni=e?parseInt(e[1]):0}if(null===ri){const e=navigator.userAgent.match(/Safari\/(\d+)/i);ri=e?parseInt(e[1]):0}}destroy(){}resetTimeStamp(e){k.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){k.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){k.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1}getVideoStartPts(e){let t=!1;const s=e.reduce((e,s)=>{const i=s.pts-e;return i<-4294967296?(t=!0,li(e,s.pts)):i>0?e:s.pts},e[0].pts);return t&&k.debug("PTS rollover detected"),s}remux(e,t,s,i,a,n,r,o){let l,d,c,h,u,f,g=a,p=a;const m=e.pid>-1,v=t.pid>-1,y=t.samples.length,b=e.samples.length>0,_=r&&y>0||y>1;if((!m||b)&&(!v||_)||this.ISGenerated||r){this.ISGenerated||(c=this.generateIS(e,t,a,n));const s=this.isVideoContiguous;let i,r=-1;if(_&&(r=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!s&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,r>0){k.warn(`[mp4-remuxer]: Dropped ${r} out of ${y} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(r),t.dropped+=r,i=p+=(t.samples[0].pts-e)/t.inputTimeScale}else-1===r&&(k.warn(`[mp4-remuxer]: No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(b&&_){const s=this.getVideoStartPts(t.samples),i=(li(e.samples[0].pts,s)-s)/t.inputTimeScale;g+=Math.max(0,i),p+=Math.max(0,-i)}if(b){if(e.samplerate||(k.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,a,n)),d=this.remuxAudio(e,g,this.isAudioContiguous,n,v||_||o===Je.AUDIO?p:void 0),_){const i=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(k.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,a,n)),l=this.remuxVideo(t,p,s,i)}}else _&&(l=this.remuxVideo(t,p,s,0));l&&(l.firstKeyFrame=r,l.independent=-1!==r,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(u=di(s,a,this._initPTS,this._initDTS)),i.samples.length&&(h=ci(i,a,this._initPTS))),{audio:d,video:l,initSegment:c,independent:f,text:h,id3:u}}generateIS(e,t,s,i){const a=e.samples,n=t.samples,r=this.typeSupported,o={},l=this._initPTS;let d,c,h,u=!l||i,f="audio/mp4";if(u&&(d=c=1/0),e.config&&a.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":r.mpeg?(f="audio/mpeg",e.codec=""):r.mp3&&(e.codec="mp3")}o.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&r.mpeg?new Uint8Array(0):Qs.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(h=e.inputTimeScale,l&&h===l.timescale?u=!1:d=c=a[0].pts-Math.round(h*s))}if(t.sps&&t.pps&&n.length&&(t.timescale=t.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Qs.initSegment([t]),metadata:{width:t.width,height:t.height}},u))if(h=t.inputTimeScale,l&&h===l.timescale)u=!1;else{const e=this.getVideoStartPts(n),t=Math.round(h*s);c=Math.min(c,li(n[0].dts,e)-t),d=Math.min(d,e-t)}if(Object.keys(o).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:h},this._initDTS={baseTime:c,timescale:h}):d=h=void 0,{tracks:o,initPTS:d,timescale:h}}remuxVideo(e,t,s,i){const a=e.inputTimeScale,n=e.samples,r=[],o=n.length,l=this._initPTS;let d,c,h=this.nextAvcDts,f=8,v=this.videoSampleDuration,y=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,_=!1;if(!s||null===h){h=t*a-(n[0].pts-li(n[0].dts,n[0].pts))}const T=l.baseTime*a/l.timescale;for(let e=0;e<o;e++){const t=n[e];t.pts=li(t.pts-T,h),t.dts=li(t.dts-T,h),t.dts<n[e>0?e-1:e].dts&&(_=!0)}_&&n.sort(function(e,t){const s=e.dts-t.dts,i=e.pts-t.pts;return s||i}),d=n[0].dts;const S=(c=n[n.length-1].dts)-d,w=S?Math.round(S/(o-1)):v||e.inputTimeScale/30;if(s){const e=d-h,t=e>w,s=e<-1;if((t||s)&&(t?k.warn(`AVC: ${ei(e,!0)} ms (${e}dts) hole between fragments detected, filling it`):k.warn(`AVC: ${ei(-e,!0)} ms (${e}dts) overlapping between fragments detected`),!s||h>n[0].pts)){d=h;const t=n[0].pts-e;n[0].dts=d,n[0].pts=t,k.log(`Video: First PTS/DTS adjusted: ${ei(t,!0)}/${ei(d,!0)}, delta: ${ei(e,!0)} ms`)}}d=Math.max(0,d);let E=0,I=0;for(let e=0;e<o;e++){const t=n[e],s=t.units,i=s.length;let a=0;for(let e=0;e<i;e++)a+=s[e].data.length;I+=a,E+=i,t.length=a,t.dts=Math.max(t.dts,d),y=Math.min(t.pts,y),b=Math.max(t.pts,b)}c=n[o-1].dts;const D=I+4*E+8;let A;try{A=new Uint8Array(D)}catch(e){return void this.observer.emit(g.ERROR,g.ERROR,{type:p.MUX_ERROR,details:m.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:D,reason:`fail allocating video mdat ${D}`})}const L=new DataView(A.buffer);L.setUint32(0,D),A.set(Qs.types.mdat,4);let R=!1,x=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,P=Number.NEGATIVE_INFINITY,F=Number.NEGATIVE_INFINITY;for(let e=0;e<o;e++){const t=n[e],s=t.units;let l,d=0;for(let e=0,t=s.length;e<t;e++){const t=s[e],i=t.data,a=t.data.byteLength;L.setUint32(f,a),f+=4,A.set(i,f),f+=a,d+=4+a}if(e<o-1)v=n[e+1].dts-t.dts,l=n[e+1].pts-t.pts;else{const s=this.config,r=e>0?t.dts-n[e-1].dts:w;if(l=e>0?t.pts-n[e-1].pts:w,s.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(s.maxBufferHole*a),n=(i?y+i*a:this.nextAudioPts)-t.pts;n>e?((v=n-r)<0?v=r:R=!0,k.log(`[mp4-remuxer]: It is approximately ${n/90} ms to the next segment; using duration ${v/90} ms for the last video frame.`)):v=r}else v=r}const c=Math.round(t.pts-t.dts);x=Math.min(x,v),P=Math.max(P,v),C=Math.min(C,l),F=Math.max(F,l),r.push(new hi(t.key,v,d,c))}if(r.length)if(ni){if(ni<70){const e=r[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(ri&&F-C<P-x&&w/P<.025&&0===r[0].cts){k.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=d;for(let t=0,s=r.length;t<s;t++){const i=e+r[t].duration,a=e+r[t].cts;if(t<s-1){const e=i+r[t+1].cts;r[t].duration=e-a}else r[t].duration=t?r[t-1].duration:w;r[t].cts=0,e=i}}v=R||!v?w:v,this.nextAvcDts=h=c+v,this.videoSampleDuration=v,this.isVideoContiguous=!0;const O={data1:Qs.moof(e.sequenceNumber++,d,u({},e,{samples:r})),data2:A,startPTS:y/a,endPTS:(b+v)/a,startDTS:d/a,endDTS:h/a,type:"video",hasAudio:!1,hasVideo:!0,nb:r.length,dropped:e.dropped};return e.samples=[],e.dropped=0,O}remuxAudio(e,t,s,i,a){const n=e.inputTimeScale,r=n/(e.samplerate?e.samplerate:n),o="aac"===e.segmentCodec?si:ii,l=o*r,d=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,h=[],f=void 0!==a;let v=e.samples,y=c?0:8,b=this.nextAudioPts||-1;const _=t*n,T=d.baseTime*n/d.timescale;if(this.isAudioContiguous=s=s||v.length&&b>0&&(i&&Math.abs(_-b)<9e3||Math.abs(li(v[0].pts-T,_)-b)<20*l),v.forEach(function(e){e.pts=li(e.pts-T,_)}),!s||b<0){if(!(v=v.filter(e=>e.pts>=0)).length)return;b=0===a?0:i&&!f?Math.max(0,_):v[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let s=0,i=b;s<v.length;s++){const a=v[s],r=a.pts,o=r-i,d=Math.abs(1e3*o/n);if(o<=-t*l&&f)0===s&&(k.warn(`Audio frame @ ${(r/n).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*o/n)} ms.`),this.nextAudioPts=b=i=r);else if(o>=t*l&&d<ti&&f){let t=Math.round(o/l);(i=r-t*l)<0&&(t--,i+=l),0===s&&(this.nextAudioPts=b=i),k.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(i/n).toFixed(3)}s due to ${Math.round(1e3*o/n)} ms gap.`);for(let n=0;n<t;n++){const t=Math.max(i,0);let n=qs.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);n||(k.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),n=a.unit.subarray()),v.splice(s,0,{unit:n,pts:t}),i+=l,s++}}a.pts=i,i+=l}}let S,w=null,E=null,I=0,D=v.length;for(;D--;)I+=v[D].unit.byteLength;for(let t=0,i=v.length;t<i;t++){const i=v[t],a=i.unit;let n=i.pts;if(null!==E){h[t-1].duration=Math.round((n-E)/r)}else{if(s&&"aac"===e.segmentCodec&&(n=b),w=n,!(I>0))return;I+=y;try{S=new Uint8Array(I)}catch(e){return void this.observer.emit(g.ERROR,g.ERROR,{type:p.MUX_ERROR,details:m.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:I,reason:`fail allocating audio mdat ${I}`})}if(!c){new DataView(S.buffer).setUint32(0,I),S.set(Qs.types.mdat,4)}}S.set(a,y);const l=a.byteLength;y+=l,h.push(new hi(!0,o,l,0)),E=n}const A=h.length;if(!A)return;const L=h[h.length-1];this.nextAudioPts=b=E+r*L.duration;const R=c?new Uint8Array(0):Qs.moof(e.sequenceNumber++,w/r,u({},e,{samples:h}));e.samples=[];const x=w/n,C=b/n,P={data1:R,data2:S,startPTS:x,endPTS:C,startDTS:x,endDTS:C,type:"audio",hasAudio:!0,hasVideo:!1,nb:A};return this.isAudioContiguous=!0,P}remuxEmptyAudio(e,t,s,i){const a=e.inputTimeScale,n=a/(e.samplerate?e.samplerate:a),r=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,d=(null!==r?r:i.startDTS*a)+l,c=i.endDTS*a+l,h=n*si,u=Math.ceil((c-d)/h),f=qs.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(k.warn("[mp4-remuxer]: remux empty Audio"),!f)return void k.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const g=[];for(let e=0;e<u;e++){const t=d+e*h;g.push({unit:f,pts:t,dts:t})}return e.samples=g,this.remuxAudio(e,t,s,!1)}}function li(e,t){let s;if(null===t)return e;for(s=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=s;return e}function di(e,t,s,i){const a=e.samples.length;if(!a)return;const n=e.inputTimeScale;for(let r=0;r<a;r++){const a=e.samples[r];a.pts=li(a.pts-9e4*s.baseTime/s.timescale,t*n)/n,a.dts=li(a.dts-9e4*i.baseTime/i.timescale,t*n)/n}const r=e.samples;return e.samples=[],{samples:r}}function ci(e,t,s){const i=e.samples.length;if(!i)return;const a=e.inputTimeScale;for(let n=0;n<i;n++){const i=e.samples[n];i.pts=li(i.pts-9e4*s.baseTime/s.timescale,t*a)/a}e.samples.sort((e,t)=>e.pts-t.pts);const n=e.samples;return e.samples=[],{samples:n}}class hi{constructor(e,t,s,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=i,this.flags=new ui(e)}}class ui{constructor(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}}function fi(e,t){const s=null==e?void 0:e.codec;return s&&s.length>4?s:"hvc1"===s||"hev1"===s?"hvc1.1.c.L120.90":"av01"===s?"av01.0.04M.08":"avc1"===s||t===A.VIDEO?"avc1.42e01e":"mp4a.40.5"}try{ai=self.performance.now.bind(self.performance)}catch(e){k.debug("Unable to use Performance API on this environment"),ai="undefined"!=typeof self&&self.Date.now}const gi=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,s,i){const a=this.videoTrack=vs("video",1),n=this.audioTrack=vs("audio",1),r=this.txtTrack=vs("text",1);if(this.id3Track=vs("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const o=be(e);if(o.video){const{id:e,timescale:t,codec:s}=o.video;a.id=e,a.timescale=r.timescale=t,a.codec=s}if(o.audio){const{id:e,timescale:t,codec:s}=o.audio;n.id=e,n.timescale=t,n.codec=s}r.id=he.text,a.sampleDuration=0,a.duration=n.duration=i}resetContiguity(){}static probe(e){return ve(e=e.length>16384?e.subarray(0,16384):e,["moof"]).length>0}demux(e,t){this.timeOffset=t;let s=e;const i=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Te(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},s=ve(e,["moof"]);if(!s)return t;if(s.length<2)return t.remainder=e,t;const i=s[s.length-1];return t.valid=K(e,0,i.byteOffset-8),t.remainder=K(e,i.byteOffset-8),t}(s);this.remainderData=t.remainder,i.samples=t.valid||new Uint8Array}else i.samples=s;const n=this.extractID3Track(i,t);return a.samples=Se(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:n,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return s.samples=Se(e,t),{videoTrack:t,audioTrack:vs(),id3Track:i,textTrack:vs()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const i=ve(e.samples,["emsg"]);i&&i.forEach(e=>{const i=function(e){const t=e[0];let s="",i="",a=0,n=0,r=0,o=0,l=0,d=0;if(0===t){for(;"\0"!==ue(e.subarray(d,d+1));)s+=ue(e.subarray(d,d+1)),d+=1;for(s+=ue(e.subarray(d,d+1)),d+=1;"\0"!==ue(e.subarray(d,d+1));)i+=ue(e.subarray(d,d+1)),d+=1;i+=ue(e.subarray(d,d+1)),d+=1,a=ge(e,12),n=ge(e,16),o=ge(e,20),l=ge(e,24),d=28}else if(1===t){a=ge(e,d+=4);const t=ge(e,d+=4),n=ge(e,d+=4);for(d+=4,r=2**32*t+n,Number.isSafeInteger(r)||(r=Number.MAX_SAFE_INTEGER,k.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ge(e,d),l=ge(e,d+=4),d+=4;"\0"!==ue(e.subarray(d,d+1));)s+=ue(e.subarray(d,d+1)),d+=1;for(s+=ue(e.subarray(d,d+1)),d+=1;"\0"!==ue(e.subarray(d,d+1));)i+=ue(e.subarray(d,d+1)),d+=1;i+=ue(e.subarray(d,d+1)),d+=1}return{schemeIdUri:s,value:i,timeScale:a,presentationTime:r,presentationTimeDelta:n,eventDuration:o,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(As.test(i.schemeIdUri)){const e=f(i.presentationTime)?i.presentationTime/i.timeScale:t+i.presentationTimeDelta/i.timeScale;let a=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;a<=.001&&(a=Number.POSITIVE_INFINITY);const n=i.payload;s.samples.push({data:n,len:n.byteLength,dts:e,pts:e,type:rt.emsg,duration:a})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(function(e,t){if(!e||!t)return e;const s=t.keyId;return s&&t.isCommonEncryption&&ve(e,["moov","trak"]).forEach(e=>{const t=ve(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let i=ve(t,["enca"]);const a=i.length>0;a||(i=ve(t,["encv"])),i.forEach(e=>{ve(a?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{const t=_e(e);if(t){const e=t.subarray(8,24);e.some(e=>0!==e)||(k.log(`[eme] Patching keyId in 'enc${a?"a":"v"}>sinf>>tenc' box: ${le.hexDump(e)} -> ${le.hexDump(s)}`),t.set(s,8))}})})}),e}(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const i=this.initData=be(e);t||(t=fi(i.audio,A.AUDIO)),s||(s=fi(i.video,A.VIDEO));const a={};i.audio&&i.video?a.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:i.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?a.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:k.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,s,i,a,n){var r,o;let{initPTS:l,lastEndTime:d}=this;const c={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};f(d)||(d=this.lastEndTime=a||0);const h=t.samples;if(null==h||!h.length)return c;const u={initPTS:void 0,timescale:1};let g=this.initData;if(null!=(r=g)&&r.length||(this.generateInitSegment(h),g=this.initData),null==(o=g)||!o.length)return k.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const p=function(e,t){return ve(t,["moof","traf"]).reduce((t,s)=>{const i=ve(s,["tfdt"])[0],a=i[0],n=ve(s,["tfhd"]).reduce((t,s)=>{const n=ge(s,4),r=e[n];if(r){let e=ge(i,4);if(1===a){if(e===de)return k.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=de+1,e+=ge(i,8)}const s=e/(r.timescale||9e4);if(isFinite(s)&&(null===t||s<t))return s}return t},null);return null!==n&&isFinite(n)&&(null===t||n<t)?n:t},null)}(g,h),m=null===p?a:p;((function(e,t,s){if(null===e)return!0;const i=t-e.baseTime/e.timescale;return i<0&&Math.abs(i-s)>1})(l,m,a)||u.timescale!==l.timescale&&n)&&(u.initPTS=m-a,this.initPTS=l={baseTime:u.initPTS,timescale:1});const v=function(e,t){let s=0,i=0,a=0;const n=ve(e,["moof","traf"]);for(let e=0;e<n.length;e++){const r=n[e],o=ve(r,["tfhd"])[0],l=t[ge(o,4)];if(!l)continue;const d=l.default,c=ge(o,0)|(null==d?void 0:d.flags);let h=null==d?void 0:d.duration;8&c&&(h=ge(o,2&c?12:8));const u=l.timescale||9e4,f=ve(r,["trun"]);for(let e=0;e<f.length;e++)!(s=ke(f[e]))&&h&&(s=h*ge(f[e],4)),l.type===A.VIDEO?i+=s/u:l.type===A.AUDIO&&(a+=s/u)}if(0===i&&0===a){let t=0;const s=ve(e,["sidx"]);for(let e=0;e<s.length;e++){const i=ye(s[e]);null!=i&&i.references&&(t+=i.references.reduce((e,t)=>e+t.info.duration||0,0))}return t}return i||a}(h,g),y=e?m-l.baseTime/l.timescale:d,b=y+v;!function(e,t,s){ve(t,["moof","traf"]).forEach(t=>{ve(t,["tfhd"]).forEach(i=>{const a=ge(i,4),n=e[a];if(!n)return;const r=n.timescale||9e4;ve(t,["tfdt"]).forEach(e=>{const t=e[0];let i=ge(e,4);if(0===t)i-=s*r,me(e,4,i=Math.max(i,0));else{i*=Math.pow(2,32),i+=ge(e,8),i-=s*r,i=Math.max(i,0);const t=Math.floor(i/(de+1)),a=Math.floor(i%(de+1));me(e,4,t),me(e,8,a)}})})})}(g,h,l.baseTime/l.timescale),v>0?this.lastEndTime=b:(k.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const _=!!g.audio,T=!!g.video;let S="";_&&(S+="audio"),T&&(S+="video");const w={data1:h,startPTS:y,startDTS:y,endPTS:b,endDTS:b,type:S,hasAudio:_,hasVideo:T,nb:1,dropped:0};return c.audio="audio"===w.type?w:void 0,c.video="audio"!==w.type?w:void 0,c.initSegment=u,c.id3=di(s,a,l,l),i.samples.length&&(c.text=ci(i,a,l)),c}}},{demux:Vs,remux:oi},{demux:class extends ys{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=(W(e,0)||[]).length;for(let s=e.length;t<s;t++)if(ws(e,t))return k.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&_s(e,t)&&Ts(e,t)<=e.length-t}(e,t)}appendFrame(e,t,s){Es(e,this.observer,t,s,e.manifestCodec);const i=Ds(e,t,s,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i}},remux:oi},{demux:class extends ys{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=(W(e,0)||[]).length;for(let s=e.length;t<s;t++)if($s(e,t))return k.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return Ms(e,t)&&4<=e.length-t}(e,t)}appendFrame(e,t,s){if(null!==this.basePTS)return Fs(e,t,s,this.basePTS,this.frameIndex)}},remux:oi}];class pi{constructor(e,t,s,i,a){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.vendor=i,this.id=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,i){const a=s.transmuxing;a.executeStart=ai();let n=new Uint8Array(e);const{currentTransmuxState:r,transmuxConfig:o}=this;i&&(this.currentTransmuxState=i);const{contiguous:l,discontinuity:d,trackSwitch:c,accurateTimeOffset:h,timeOffset:u,initSegmentChange:f}=i||r,{audioCodec:v,videoCodec:y,defaultInitPts:b,duration:_,initSegmentData:T}=o,S=function(e,t){let s=null;e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(s=t);return s}(n,t);if(S&&"AES-128"===S.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(n,S.key.buffer,S.iv.buffer).then(e=>{const t=this.push(e,null,s);return this.decryptionPromise=null,t}),this.decryptionPromise;{let t=e.softwareDecrypt(n,S.key.buffer,S.iv.buffer);if(s.part>-1&&(t=e.flush()),!t)return a.executeEnd=ai(),mi(s);n=new Uint8Array(t)}}const w=this.needsProbing(d,c);if(w){const e=this.configureTransmuxer(n);if(e)return k.warn(`[transmuxer] ${e.message}`),this.observer.emit(g.ERROR,g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),a.executeEnd=ai(),mi(s)}(d||c||f||w)&&this.resetInitSegment(T,v,y,_,t),(d||f||w)&&this.resetInitialTimestamp(b),l||this.resetContiguity();const E=this.transmux(n,S,u,h,s),I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,a.executeEnd=ai(),E}flush(e){const t=e.transmuxing;t.executeStart=ai();const{decrypter:s,currentTransmuxState:i,decryptionPromise:a}=this;if(a)return a.then(()=>this.flush(e));const n=[],{timeOffset:r}=i;if(s){const t=s.flush();t&&n.push(this.push(t,null,e))}const{demuxer:o,remuxer:l}=this;if(!o||!l)return t.executeEnd=ai(),[mi(e)];const d=o.flush(r);return vi(d)?d.then(t=>(this.flushRemux(n,t,e),n)):(this.flushRemux(n,d,e),n)}flushRemux(e,t,s){const{audioTrack:i,videoTrack:a,id3Track:n,textTrack:r}=t,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;k.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const d=this.remuxer.remux(i,a,n,r,l,o,!0,this.id);e.push({remuxResult:d,chunkMeta:s}),s.transmuxing.executeEnd=ai()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;t&&s&&(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,i,a){const{demuxer:n,remuxer:r}=this;n&&r&&(n.resetInitSegment(e,t,s,i),r.resetInitSegment(e,t,s,a))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,i,a){let n;return n=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,s,i,a):this.transmuxUnencrypted(e,s,i,a)}transmuxUnencrypted(e,t,s,i){const{audioTrack:a,videoTrack:n,id3Track:r,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(a,n,r,o,t,s,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,a){return this.demuxer.demuxSampleAes(e,t,s).then(e=>{return{remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,s,i,!1,this.id),chunkMeta:a}})}configureTransmuxer(e){const{config:t,observer:s,typeSupported:i,vendor:a}=this;let n;for(let t=0,s=gi.length;t<s;t++)if(gi[t].demux.probe(e)){n=gi[t];break}if(!n)return new Error("Failed to find demuxer by probing fragment data");const r=this.demuxer,o=this.remuxer,l=n.remux,d=n.demux;o&&o instanceof l||(this.remuxer=new l(s,t,i,a)),r&&r instanceof d||(this.demuxer=new d(s,t,i),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new hs(this.config)),e}}const mi=e=>({remuxResult:{},chunkMeta:e});function vi(e){return"then"in e&&e.then instanceof Function}class yi{constructor(e,t,s,i,a){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=a||null}}class bi{constructor(e,t,s,i,a,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=a,this.initSegmentChange=n}}var _i={};!function(e){var t=Object.prototype.hasOwnProperty,s="~";function i(){}function a(e,t,i,a,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");var r=new function(e,t,s){this.fn=e,this.context=t,this.once=s||!1}(i,a||e,n),o=s?s+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],r]:e._events[o].push(r):(e._events[o]=r,e._eventsCount++),e}function n(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function r(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),r.prototype.eventNames=function(){var e,i,a=[];if(0===this._eventsCount)return a;for(i in e=this._events)t.call(e,i)&&a.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},r.prototype.listeners=function(e){var t=s?s+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var a=0,n=i.length,r=new Array(n);a<n;a++)r[a]=i[a].fn;return r},r.prototype.listenerCount=function(e){var t=s?s+e:e,i=this._events[t];return i?i.fn?1:i.length:0},r.prototype.emit=function(e,t,i,a,n,r){var o=s?s+e:e;if(!this._events[o])return!1;var l,d,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,a),!0;case 5:return c.fn.call(c.context,t,i,a,n),!0;case 6:return c.fn.call(c.context,t,i,a,n,r),!0}for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var u,f=c.length;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),h){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,i);break;case 4:c[d].fn.call(c[d].context,t,i,a);break;default:if(!l)for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c[d].fn.apply(c[d].context,l)}}return!0},r.prototype.on=function(e,t,s){return a(this,e,t,s,!1)},r.prototype.once=function(e,t,s){return a(this,e,t,s,!0)},r.prototype.removeListener=function(e,t,i,a){var r=s?s+e:e;if(!this._events[r])return this;if(!t)return n(this,r),this;var o=this._events[r];if(o.fn)o.fn!==t||a&&!o.once||i&&o.context!==i||n(this,r);else{for(var l=0,d=[],c=o.length;l<c;l++)(o[l].fn!==t||a&&!o[l].once||i&&o[l].context!==i)&&d.push(o[l]);d.length?this._events[r]=1===d.length?d[0]:d:n(this,r)}return this},r.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&n(this,t)):(this._events=new i,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=s,r.EventEmitter=r,e.exports=r}({get exports(){return _i},set exports(e){_i=e}});const ki=ps()||{isTypeSupported:()=>!1};class Ti{constructor(e,t,s,i){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const a=e.config;this.hls=e,this.id=t,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=s,this.onFlush=i;const n=(e,t)=>{(t=t||{}).frag=this.frag,t.id=this.id,e===g.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new _i,this.observer.on(g.FRAG_DECRYPTED,n),this.observer.on(g.ERROR,n);const r={mp4:ki.isTypeSupported("video/mp4"),mpeg:ki.isTypeSupported("audio/mpeg"),mp3:ki.isTypeSupported('audio/mp4; codecs="mp3"')},o=navigator.vendor;if(this.useWorker&&"undefined"!=typeof Worker){if(a.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{a.workerPath?(k.log(`loading Web Worker ${a.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(a.workerPath)):(k.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=(e=>this.onWorkerMessage(e));const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=(e=>{const s=new Error(`${e.message} (${e.filename}:${e.lineno})`);a.enableWorker=!1,k.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(g.ERROR,{type:p.OTHER_ERROR,details:m.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:s})}),e.postMessage({cmd:"init",typeSupported:r,vendor:o,id:t,config:JSON.stringify(a)})}catch(e){k.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new pi(this.observer,r,a,o,t)}return}}this.transmuxer=new pi(this.observer,r,a,o,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,i,a,n,r,o,l,d){var c,h;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,f=n?n.start:a.start,g=a.decryptdata,p=this.frag,m=!(p&&a.cc===p.cc),v=!(p&&l.level===p.level),y=p?l.sn-p.sn:-1,b=this.part?l.part-this.part.index:-1,_=0===y&&l.id>1&&l.id===(null==p?void 0:p.stats.chunkCount),T=!v&&(1===y||0===y&&(1===b||_&&b<=0)),S=self.performance.now();(v||y||0===a.stats.parsing.start)&&(a.stats.parsing.start=S),!n||!b&&T||(n.stats.parsing.start=S);const w=!(p&&(null==(c=a.initSegment)?void 0:c.url)===(null==(h=p.initSegment)?void 0:h.url)),E=new bi(m,T,o,v,f,w);if(!T||m||w){k.log(`[transmuxer-interface, ${a.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${m}\n trackSwitch: ${v}\n contiguous: ${T}\n accurateTimeOffset: ${o}\n timeOffset: ${f}\n initSegmentChange: ${w}`);const e=new yi(s,i,t,r,d);this.configureTransmuxer(e)}if(this.frag=a,this.part=n,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,g,l,E);vi(t)?(u.async=!0,t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")})):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let s=t.flush(e);vi(s)||t.async?(vi(s)||(s=Promise.resolve(s)),s.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,s=this.hls;switch(t.event){case"init":{var i;const e=null==(i=this.workerContext)?void 0:i.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":k[t.data.logType]&&k[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Si=250,wi=2,Ei=.1,Ii=.05;class Di{constructor(e,t,s,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=s,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:i,stalled:a}=this;if(null===i)return;const{currentTime:n,seeking:r}=i,o=this.seeking&&!r,l=!this.seeking&&r;if(this.seeking=r,n!==e){if(this.moved=!0,null!==a){if(this.stallReported){const e=self.performance.now()-a;k.warn(`playback not stuck anymore @${n}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if(l||o)return void(this.stalled=null);if(i.paused&&!r||i.ended||0===i.playbackRate||!es.getBuffered(i).length)return;const d=es.bufferInfo(i,n,0),c=d.len>0,h=d.nextStart||0;if(!c&&!h)return;if(r){const e=d.len>wi,s=!h||t&&t.start<=n||h-n>wi&&!this.fragmentTracker.getPartialFragment(n);if(e||s)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var u;const e=Math.max(h,d.start||0)-n,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,s=(null==t?void 0:null==(u=t.details)?void 0:u.live)?2*t.details.targetduration:wi,i=this.fragmentTracker.getPartialFragment(n);if(e>0&&(e<=s||i))return void this._trySkipBufferHole(i)}const f=self.performance.now();if(null===a)return void(this.stalled=f);const g=f-a;if(!r&&g>=Si&&(this._reportStall(d),!this.media))return;const p=es.bufferInfo(i,n,s.maxBufferHole);this._tryFixBufferStall(p,g)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:i,media:a}=this;if(null===a)return;const n=a.currentTime,r=i.getPartialFragment(n);if(r){if(this._trySkipBufferHole(r)||!this.media)return}(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-n<s.maxBufferHole)&&t>1e3*s.highBufferWatchdogPeriod&&(k.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:i}=this;if(!i&&s){this.stallReported=!0;const i=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);k.warn(i.message),t.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:i}=this;if(null===i)return 0;const a=i.currentTime,n=es.bufferInfo(i,a,0),r=a<n.start?n.start:n.nextStart;if(r){const o=n.len<=t.maxBufferHole,l=n.len>0&&n.len<1&&i.readyState<3,d=r-a;if(d>0&&(o||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let s=!1;if(0===a){const e=t.getAppendedFrag(0,Je.MAIN);e&&r<e.end&&(s=!0)}if(!s){const s=e||t.getAppendedFrag(a,Je.MAIN);if(s){let e=!1,i=s.end;for(;i<r;){const s=t.getPartialFragment(i);if(!s){e=!0;break}i+=s.duration}if(e)return 0}}}const n=Math.max(r+Ii,a+Ei);if(k.warn(`skipping hole, adjusting currentTime from ${a} to ${n}`),this.moved=!0,this.stalled=null,i.currentTime=n,e&&!e.gap){const t=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${n}`);s.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,frag:e})}return n}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:s,nudgeRetry:i}=this;if(null===s)return;const a=s.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const n=a+(i+1)*e.nudgeOffset,r=new Error(`Nudging 'currentTime' from ${a} to ${n}`);k.warn(r.message),s.currentTime=n,t.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_NUDGE_ON_STALL,error:r,fatal:!1})}else{const s=new Error(`Playhead still not moving while enough data buffered @${a} after ${e.nudgeMaxRetry} nudges`);k.error(s.message),t.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_STALLED_ERROR,error:s,fatal:!0})}}}const Ai=100;class Li extends gs{constructor(e,t,s){super(e,t,s,"[stream-controller]",Je.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(g.ERROR,this.onError,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(g.ERROR,this.onError,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),this.onMediaDetaching()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:s}=this;if(this.stopLoad(),this.setInterval(Ai),this.level=-1,!this.startFragRequested){let e=s.startLevel;-1===e&&(s.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=s.nextAutoLevel),this.level=s.nextLoadLevel=e,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=fs.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=fs.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case fs.WAITING_LEVEL:{var e;const{levels:t,level:s}=this,i=null==t?void 0:null==(e=t[s])?void 0:e.details;if(i&&(!i.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(i))break;this.state=fs.IDLE;break}break}case fs.FRAG_LOADING_WAITING_RETRY:{var t;const e=self.performance.now(),s=this.retryDate;(!s||e>=s||null!=(t=this.media)&&t.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=fs.IDLE)}}this.state===fs.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:i}=this,{config:a,nextLoadLevel:n}=e;if(null===t||!i&&(this.startFragRequested||!a.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(null==s||!s[n])return;const r=s[n],o=this.getMainFwdBufferInfo();if(null===o)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(g.BUFFER_EOS,e),void(this.state=fs.ENDED)}e.loadLevel!==n&&-1===e.manualLevel&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=r.details;if(!d||this.state===fs.WAITING_LEVEL||d.live&&this.levelLastLoaded!==n)return this.level=n,void(this.state=fs.WAITING_LEVEL);const c=o.len,h=this.getMaxBufferLength(r.maxBitrate);if(c>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(u,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&"initSegment"!==f.sn&&this.fragmentTracker.getState(f)!==Vt.OK){var p;const e=(null!=(p=this.backtrackFragment)?p:f).sn-d.startSN,t=d.fragments[e-1];t&&f.cc===t.cc&&(f=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,u)){if(!f.gap){const e=this.audioOnly&&!this.altAudio?A.AUDIO:A.VIDEO,t=(e===A.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Je.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,Je.MAIN,h)}f&&(!f.initSegment||f.initSegment.data||this.bitrateTest||(f=f.initSegment),this.loadFragment(f,r,u))}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===Vt.NOT_LOADED?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}getAppendedFrag(e){const t=this.fragmentTracker.getAppendedFrag(e,Je.MAIN);return t&&"fragment"in t?t.fragment:t}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Je.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let s;const i=this.getAppendedFrag(t.currentTime);if(i&&i.start>1&&this.flushMainBuffer(0,i.start-1),!t.paused&&e){const t=e[this.hls.nextLoadLevel],i=this.fragLastKbps;s=i&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*i)+1:0}else s=0;const a=this.getBufferedFrag(t.currentTime+s);if(a){const e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,s=e.duration,i=Math.max(a.end,t+Math.min(Math.max(s-this.config.maxFragLookUpTolerance,.5*s),.75*s));this.flushMainBuffer(i,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case fs.KEY_LOADING:case fs.FRAG_LOADING:case fs.FRAG_LOADING_WAITING_RETRY:case fs.PARSING:case fs.PARSED:this.state=fs.IDLE}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new Di(this.config,s,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;f(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const s=this.getMainFwdBufferInfo();null!==s&&0!==s.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${s?s.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(g.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null}onManifestParsed(e,t){let s,i=!1,a=!1;t.levels.forEach(e=>{(s=e.audioCodec)&&(-1!==s.indexOf("mp4a.40.2")&&(i=!0),-1!==s.indexOf("mp4a.40.5")&&(a=!0))}),this.audioCodecSwitch=i&&a&&!function(){var e;const t=ms();return"function"==typeof(null==t?void 0:null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:s}=this;if(!s||this.state!==fs.IDLE)return;const i=s[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(i.details))&&(this.state=fs.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:i}=this,a=t.level,n=t.details,r=n.totalduration;if(!i)return void this.warn(`Levels were reset while loading level ${a}`);this.log(`Level ${a} loaded [${n.startSN},${n.endSN}], cc [${n.startCC}, ${n.endCC}] duration:${r}`);const o=i[a],l=this.fragCurrent;!l||this.state!==fs.FRAG_LOADING&&this.state!==fs.FRAG_LOADING_WAITING_RETRY||l.level===t.level&&l.urlId===o.urlId||!l.loader||this.abortCurrentFrag();let d=0;if(n.live||null!=(s=o.details)&&s.live){if(n.fragments[0]||(n.deltaUpdateFailed=!0),n.deltaUpdateFailed)return;d=this.alignPlaylists(n,o.details)}if(o.details=n,this.levelLastLoaded=a,this.hls.trigger(g.LEVEL_UPDATED,{details:n,level:a}),this.state===fs.WAITING_LEVEL){if(this.waitForCdnTuneIn(n))return;this.state=fs.IDLE}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:a}=e,{levels:n}=this;if(!n)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);const r=n[s.level],o=r.details;if(!o)return this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),void this.fragmentTracker.removeFragment(s);const l=r.videoCodec,d=o.PTSKnown||!o.live,c=null==(t=s.initSegment)?void 0:t.data,h=this._getAudioCodec(r),u=this.transmuxer=this.transmuxer||new Ti(this.hls,Je.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=-1!==f,p=new ts(s.level,s.sn,s.stats.chunkCount,a.byteLength,f,g),m=this.initPTS[s.cc];u.push(a,c,h,l,s,i,o.totalduration,d,p,m)}onAudioTrackSwitching(e,t){const s=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;s&&(e.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(g.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,i=!!this.hls.audioTracks[s].url;if(i){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const s=t.tracks;let i,a,n=!1;for(const e in s){const t=s[e];if("main"===t.id){if(a=e,i=t,"video"===e){const t=s[e];t&&(this.videoBuffer=t.buffer)}}else n=!0}n&&i?(this.log(`Alternate track found, use ${a}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s&&s.type!==Je.MAIN)return;if(this.fragContextChanged(s))return this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===fs.PARSED&&(this.state=fs.IDLE));const a=i?i.stats:s.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==s.sn&&(this.fragPrevious=s),this.fragBufferedComplete(s,i)}onError(e,t){var s;if(t.fatal)this.state=fs.ERROR;else switch(t.details){case m.FRAG_GAP:case m.FRAG_PARSING_ERROR:case m.FRAG_DECRYPT_ERROR:case m.FRAG_LOAD_ERROR:case m.FRAG_LOAD_TIMEOUT:case m.KEY_LOAD_ERROR:case m.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Je.MAIN,t);break;case m.LEVEL_LOAD_ERROR:case m.LEVEL_LOAD_TIMEOUT:case m.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==fs.WAITING_LEVEL||(null==(s=t.context)?void 0:s.type)!==Qe.LEVEL||(this.state=fs.IDLE);break;case m.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case m.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!es.getBuffered(e).length){const e=this.state!==fs.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=fs.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==A.AUDIO||this.audioOnly&&!this.altAudio){const e=(t===A.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,Je.MAIN)}}onLevelsUpdated(e,t){this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking)return void this.log(`could not seek to ${s}, already seeking at ${t}`);const i=es.getBuffered(e),a=(i.length?i.start(0):0)-s;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),s+=a,this.startPosition=s),this.log(`seek to target start position ${s} from current time ${t}`),e.currentTime=s}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:i}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=fs.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=e.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(g.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:i}=this,{remuxResult:a,chunkMeta:n}=e,r=this.getCurrentContext(n);if(!r)return void this.resetWhenMissingContext(n);const{frag:o,part:l,level:d}=r,{video:c,text:h,id3:u,initSegment:p}=a,{details:m}=d,v=this.altAudio?void 0:a.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=fs.PARSING,p){p.tracks&&(this._bufferInitSegment(d,p.tracks,o,n),i.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:o,id:s,tracks:p.tracks}));const e=p.initPTS,t=p.timescale;f(e)&&(this.initPTS[o.cc]={baseTime:e,timescale:t},i.trigger(g.INIT_PTS_FOUND,{frag:o,id:s,initPTS:e,timescale:t}))}if(c&&!1!==a.independent){if(m){const{startPTS:e,endPTS:t,startDTS:s,endDTS:i}=c;if(l)l.elementaryStreams[c.type]={startPTS:e,endPTS:t,startDTS:s,endDTS:i};else if(c.firstKeyFrame&&c.independent&&1===n.id&&(this.couldBacktrack=!0),c.dropped&&c.independent){const s=this.getMainFwdBufferInfo();if((s?s.end:this.getLoadPosition())+this.config.maxBufferHole<(c.firstKeyFramePTS?c.firstKeyFramePTS:e)-this.config.maxBufferHole)return void this.backtrack(o);o.setElementaryStreamInfo(c.type,o.start,t,o.start,i,!0)}o.setElementaryStreamInfo(c.type,e,t,s,i),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,l,n)}}else if(!1===a.independent)return void this.backtrack(o);if(v){const{startPTS:e,endPTS:t,startDTS:s,endDTS:i}=v;l&&(l.elementaryStreams[A.AUDIO]={startPTS:e,endPTS:t,startDTS:s,endDTS:i}),o.setElementaryStreamInfo(A.AUDIO,e,t,s,i),this.bufferFragmentData(v,o,l,n)}if(m&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:s,frag:o,details:m,samples:u.samples};i.trigger(g.FRAG_PARSING_METADATA,e)}if(m&&h){const e={id:s,frag:o,details:m,samples:h.samples};i.trigger(g.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,s,i){if(this.state!==fs.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:a,video:n,audiovideo:r}=t;if(a){let t=e.audioCodec;const s=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==a.metadata.channelCount&&-1===s.indexOf("firefox")&&(t="mp4a.40.5")),-1!==s.indexOf("android")&&"audio/mpeg"!==a.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),a.levelCodec=t,a.id="main",this.log(`Init audio buffer, container:${a.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${a.codec}]`)}n&&(n.levelCodec=e.videoCodec,n.id="main",this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${e.videoCodec||""}/${n.codec}]`)),r&&this.log(`Init audiovideo buffer, container:${r.container}, codecs[level/parsed]=[${e.attrs.CODECS||""}/${r.codec}]`),this.hls.trigger(g.BUFFER_CODECS,t),Object.keys(t).forEach(e=>{const a=t[e].initSegment;null!=a&&a.byteLength&&this.hls.trigger(g.BUFFER_APPENDING,{type:e,data:a,frag:s,part:null,chunkMeta:i,parent:s.type})}),this.tick()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Je.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=fs.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const s=e.currentTime;if(es.isBuffered(e,s)?t=this.getAppendedFrag(s):es.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,s=t.level;e&&t.sn===e.sn&&e.level===s&&t.urlId===e.urlId||(this.fragPlaying=t,this.hls.trigger(g.FRAG_CHANGED,{frag:t}),e&&e.level===s||this.hls.trigger(g.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,s=this.currentFrag;if(s&&f(t)&&f(s.programDateTime)){const e=s.programDateTime+1e3*(t-s.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Ri{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class xi{constructor(e,t,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Ri(e),this.fast_=new Ri(t),this.defaultTTFB_=i,this.ttfb_=new Ri(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:a}=this;s.halfLife!==e&&(this.slow_=new Ri(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Ri(t,i.getEstimate(),i.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new Ri(e,a.getEstimate(),a.getTotalWeight()))}sample(e,t){const s=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/s;this.fast_.sample(s,i),this.slow_.sample(s,i)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}class Ci{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;return e.length?(s=1===e.length?e[0]:function(e,t){const s=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const a=e[t];s.set(a,i),i+=a.length}return s}(e,t),this.reset(),s):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}const Pi=100;function Fi(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(!Oi(e[s].attrs,t[s].attrs))return!1;return!0}function Oi(e,t){const s=e["STABLE-RENDITION-ID"];return s?s===t["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(s=>e[s]!==t[s])}const Mi=500;class Ni{constructor(e){this.buffered=void 0;const t=(t,s,i)=>{if((s>>>=0)>i-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${i})`);return e[s][t]};this.buffered={get length(){return e.length},end:s=>t("end",s,e.length),start:s=>t("start",s,e.length)}}}function $i(e){const t=[];for(let s=0;s<e.length;s++){const i=e[s];"subtitles"!==i.kind&&"captions"!==i.kind||!i.label||t.push(e[s])}return t}class Ui{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t){const s=this.queues[t];s.push(e),1===s.length&&this.buffers[t]&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(e=>{t=e}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),s}executeNext(e){const{buffers:t,queues:s}=this,i=t[e],a=s[e];if(a.length){const t=a[0];try{t.execute()}catch(s){k.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),t.onError(s),null!=i&&i.updating||(a.shift(),this.executeNext(e))}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Bi=ps(),Gi=/([ha]vc.)(?:\.[^.,]+)+/;const Vi={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},zi=function(e){let t=e;return Vi.hasOwnProperty(e)&&(t=Vi[e]),String.fromCharCode(t)},Ki=15,Hi=100,Yi={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Wi={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ji={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},qi={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Xi=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Qi{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s="function"==typeof t?t():t;k.log(`${this.time} [${e}] ${s}`)}}}const Ji=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class Zi{constructor(e,t,s,i,a){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=s||!1,this.background=i||"black",this.flash=a||!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let s=0;s<t.length;s++){const i=t[s];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class ea{constructor(e,t,s,i,a,n){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Zi(t,s,i,a,n)}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class ta{constructor(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(let e=0;e<Hi;e++)this.chars.push(new ea);this.logger=e,this.pos=0,this.currPenState=new Zi}equals(e){let t=!0;for(let s=0;s<Hi;s++)if(!this.chars[s].equals(e.chars[s])){t=!1;break}return t}copy(e){for(let t=0;t<Hi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Hi;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Hi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Hi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=zi(e);this.pos>=Hi?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<Hi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let s=0;s<Hi;s++){const i=this.chars[s].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class sa{constructor(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(let t=0;t<Ki;t++)this.rows.push(new ta(e));this.logger=e,this.currRow=Ki-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}reset(){for(let e=0;e<Ki;e++)this.rows[e].clear();this.currRow=Ki-1}equals(e){let t=!0;for(let s=0;s<Ki;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<Ki;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ki;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<Ki;e++)this.rows[e].clear();const e=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){const i=s.rows[e].cueStartTime,a=this.logger.time;if(i&&null!==a&&i<a)for(let i=0;i<this.nrRollUpRows;i++)this.rows[t-this.nrRollUpRows+i+1].copy(s.rows[e+i])}}this.currRow=t;const s=this.rows[this.currRow];if(null!==e.indent){const t=e.indent,i=Math.max(t-1,0);s.setCursor(e.indent),e.color=s.chars[i].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",i=-1;for(let s=0;s<Ki;s++){const a=this.rows[s].getTextString();a&&(i=s+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(s=e?"["+t.join(" | ")+"]":t.join("\n")),s}getTextAndFormat(){return this.rows}}class ia{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new sa(s),this.nonDisplayedMemory=new sa(s),this.lastOutputScreen=new sa(s),this.currRollUpRow=this.displayedMemory.rows[Ki-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Ki-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[s]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class aa{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;const i=new Qi;this.channels=[null,new ia(e,t,i),new ia(e+1,s,i)],this.cmdHistory={a:null,b:null},this.logger=i}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let s,i,a,n=!1;this.logger.time=e;for(let e=0;e<t.length;e+=2)if(i=127&t[e],a=127&t[e+1],0!==i||0!==a){if(this.logger.log(3,"["+Ji([t[e],t[e+1]])+"] -> ("+Ji([i,a])+")"),(s=this.parseCmd(i,a))||(s=this.parseMidrow(i,a)),s||(s=this.parsePAC(i,a)),s||(s=this.parseBackgroundAttributes(i,a)),!s&&(n=this.parseChars(i,a))){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(n)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}s||n||this.logger.log(2,"Couldn't parse cleaned data "+Ji([i,a])+" orig: "+Ji([t[e],t[e+1]]))}}parseCmd(e,t){const{cmdHistory:s}=this;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;if(ra(e,t,s))return na(null,null,s),this.logger.log(3,"Repeated command ("+Ji([e,t])+") is dropped"),!0;const i=20===e||21===e||23===e?1:2,a=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?a.ccRCL():33===t?a.ccBS():34===t?a.ccAOF():35===t?a.ccAON():36===t?a.ccDER():37===t?a.ccRU(2):38===t?a.ccRU(3):39===t?a.ccRU(4):40===t?a.ccFON():41===t?a.ccRDC():42===t?a.ccTR():43===t?a.ccRTD():44===t?a.ccEDM():45===t?a.ccCR():46===t?a.ccENM():47===t&&a.ccEOC():a.ccTO(t-32),na(e,t,s),this.currentChannel=i,!0}parseMidrow(e,t){let s=0;if((17===e||25===e)&&t>=32&&t<=47){if((s=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[s];return!!i&&(i.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Ji([e,t])+")"),!0)}return!1}parsePAC(e,t){let s;const i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;if(ra(e,t,i))return na(null,null,i),!0;const a=e<=23?1:2;s=t>=64&&t<=95?1===a?Yi[e]:ji[e]:1===a?Wi[e]:qi[e];const n=this.channels[a];return!!n&&(n.setPAC(this.interpretPAC(s,t)),na(e,t,i),this.currentChannel=a,!0)}interpretPAC(e,t){let s;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return s=t>95?t-96:t-64,i.underline=1==(1&s),s<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((s-16)/2),i}parseChars(e,t){let s,i=null,a=null;if(e>=25?(s=2,a=e-8):(s=1,a=e),a>=17&&a<=19){let e;e=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,"Special char '"+zi(e)+"' in channel "+s),i=[e]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);if(i){const s=Ji(i);this.logger.log(3,"Char codes = "+s.join(",")),na(e,t,this.cmdHistory)}return i}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let s;const i={};16===e||24===e?(s=Math.floor((t-32)/2),i.background=Xi[s],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(i),na(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function na(e,t,s){s.a=e,s.b=t}function ra(e,t,s){return s.a===e&&s.b===t}class oa{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var la=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function s(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const s=t.toLowerCase();return!!~e.indexOf(s)&&s}function i(e){return s(t,e)}function a(e,...t){let s=1;for(;s<arguments.length;s++){const t=arguments[s];for(const s in t)e[s]=t[s]}return e}function n(t,n,r){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let d="",c=!1,h=t,u=n,f=r,g=null,p="",m=!0,v="auto",y="start",b=50,_="middle",k=50,T="middle";Object.defineProperty(o,"id",a({},l,{get:function(){return d},set:function(e){d=""+e}})),Object.defineProperty(o,"pauseOnExit",a({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",a({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",a({},l,{get:function(){return u},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",a({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",a({},l,{get:function(){return g},set:function(e){g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",a({},l,{get:function(){return p},set:function(t){const i=function(t){return s(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");p=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",a({},l,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",a({},l,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",a({},l,{get:function(){return y},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",a({},l,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",a({},l,{get:function(){return _},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",a({},l,{get:function(){return k},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");k=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",a({},l,{get:function(){return T},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");T=t,this.hasBeenReset=!0}})),o.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();class da{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ca(e){function t(e,t,s,i){return 3600*(0|e)+60*(0|t)+(0|s)+parseFloat(i||0)}const s=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return s?parseFloat(s[2])>59?t(s[2],s[3],0,s[4]):t(s[1],s[2],s[3],s[4]):null}class ha{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i<s.length;++i)if(t===s[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function ua(e,t,s,i){const a=i?e.split(i):[e];for(const e in a){if("string"!=typeof a[e])continue;const i=a[e].split(s);2===i.length&&t(i[0],i[1])}}const fa=new la(0,0,""),ga="middle"===fa.align?"middle":"center";function pa(e,t,s){const i=e;function a(){const t=ca(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(){e=e.replace(/^\s+/,"")}if(n(),t.startTime=a(),n(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),n(),t.endTime=a(),n(),function(e,t){const i=new ha;ua(e,function(e,t){let a;switch(e){case"region":for(let a=s.length-1;a>=0;a--)if(s[a].id===t){i.set(e,s[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":a=t.split(","),i.integer(e,a[0]),i.percent(e,a[0])&&i.set("snapToLines",!1),i.alt(e,a[0],["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start",ga,"end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start",ga,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",ga,"end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");let a=i.get("line","auto");"auto"===a&&-1===fa.line&&(a=-1),t.line=a,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",ga);let n=i.get("position","auto");"auto"===n&&50===fa.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}(e,t)}function ma(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class va{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new da,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function s(){let e=t.buffer,s=0;for(e=ma(e);s<e.length&&"\r"!==e[s]&&"\n"!==e[s];)++s;const i=e.slice(0,s);return"\r"===e[s]&&++s,"\n"===e[s]&&++s,t.buffer=e.slice(s),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;const i=(e=s()).match(/^()?WEBVTT([ \t].*)?$/);if(null==i||!i[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let i=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(i?i=!1:e=s(),t.state){case"HEADER":/:/.test(e)?ua(e,function(e,t){},/:/):e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new la(0,0,""),t.state="CUE",-1===e.indexOf("--\x3e")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{pa(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const s=-1!==e.indexOf("--\x3e");if(!e||s&&(i=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const ya=/\r\n|\n\r|\n|\r/g,ba=function(e,t,s=0){return e.slice(s,s+t.length)===t},_a=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),a=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(f(t)&&f(s)&&f(i)&&f(a)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=6e4*i,t+=36e5*a},ka=function(e){let t=5381,s=e.length;for(;s;)t=33*t^e.charCodeAt(--s);return(t>>>0).toString()};function Ta(e,t,s){return ka(e.toString())+ka(t.toString())+ka(s)}const Sa=function(e,t,s){let i=e[t],a=e[i.prevCC];if(!a||!a.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(n=a)&&n.new;){var n;e.ccOffset+=i.start-a.start,i.new=!1,a=e[(i=a).prevCC]}e.presentationOffset=s};function wa(e,t,s,i,a,n,r){const o=new va,l=ne(new Uint8Array(e)).trim().replace(ya,"\n").split("\n"),d=[],c=function(e,t=1){return Zs(e,Js,1/t)}(t.baseTime,t.timescale);let h,u="00:00.000",f=0,g=0,p=!0;o.oncue=function(e){const t=s[i];let n=s.ccOffset;const r=(f-c)/9e4;null!=t&&t.new&&(void 0!==g?n=s.ccOffset=t.start:Sa(s,i,r)),r&&(n=r-s.presentationOffset);const o=e.endTime-e.startTime,l=li(9e4*(e.startTime+n-g),9e4*a)/9e4;e.startTime=Math.max(l,0),e.endTime=Math.max(l+o,0);const h=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(h)),e.id||(e.id=Ta(e.startTime,e.endTime,h)),e.endTime>0&&d.push(e)},o.onparsingerror=function(e){h=e},o.onflush=function(){h?r(h):n(d)},l.forEach(e=>{if(p){if(ba(e,"X-TIMESTAMP-MAP=")){p=!1,e.slice(16).split(",").forEach(e=>{ba(e,"LOCAL:")?u=e.slice(6):ba(e,"MPEGTS:")&&(f=parseInt(e.slice(7)))});try{g=_a(u)/1e3}catch(e){h=e}return}""===e&&(p=!1)}o.parse(e+"\n")}),o.flush()}const Ea="stpp.ttml.im1t",Ia=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Da=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Aa={left:"start",center:"center",right:"end",start:"start",end:"end"};function La(e,t,s,i){const a=ve(new Uint8Array(e),["mdat"]);if(0===a.length)return void i(new Error("Could not parse IMSC1 mdat"));const n=a.map(e=>ne(e)),r=function(e,t,s=1,i=!1){return Zs(e,t,1/s,i)}(t.baseTime,1,t.timescale);try{n.forEach(e=>s(function(e,t){const s=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(i).reduce((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||i[t],e),{}),n="preserve"!==s.getAttribute("xml:space"),r=xa(Ra(s,"styling","style")),o=xa(Ra(s,"layout","region")),l=Ra(s,"body","[begin]");return[].map.call(l,e=>{const s=function e(t,s){return[].slice.call(t.childNodes).reduce((t,i,a)=>{var n;return"br"===i.nodeName&&a?t+"\n":null!=(n=i.childNodes)&&n.length?e(i,s):s?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}(e,n);if(!s||!e.hasAttribute("begin"))return null;const i=Fa(e.getAttribute("begin"),a),l=Fa(e.getAttribute("dur"),a);let d=Fa(e.getAttribute("end"),a);if(null===i)throw Pa(e);if(null===d){if(null===l)throw Pa(e);d=i+l}const c=new la(i-t,d-t,s);c.id=Ta(c.startTime,c.endTime,c.text);const h=o[e.getAttribute("region")],f=r[e.getAttribute("style")],g=function(e,t,s){const i="http://www.w3.org/ns/ttml#styling";let a=null;const n=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;n&&s.hasOwnProperty(n)&&(a=s[n]);return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((s,n)=>{const r=Ca(t,i,n)||Ca(e,i,n)||Ca(a,i,n);return r&&(s[n]=r),s},{})}(h,f,r),{textAlign:p}=g;if(p){const e=Aa[p];e&&(c.lineAlign=e),c.align=p}return u(c,g),c}).filter(e=>null!==e)}(e,r)))}catch(e){i(e)}}function Ra(e,t,s){const i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(s)):[]}function xa(e){return e.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Ca(e,t,s){return e&&e.hasAttributeNS(t,s)?e.getAttributeNS(t,s):null}function Pa(e){return new Error(`Could not parse ttml timestamp ${e}`)}function Fa(e,t){if(!e)return null;let s=ca(e);return null===s&&(Ia.test(e)?s=function(e,t){const s=Ia.exec(e),i=(0|s[4])+(0|s[5])/t.subFrameRate;return 3600*(0|s[1])+60*(0|s[2])+(0|s[3])+i/t.frameRate}(e,t):Da.test(e)&&(s=function(e,t){const s=Da.exec(e),i=Number(s[1]);switch(s[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),s}class Oa{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){const e=this.hls.levels;if(e.length){const t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((t,s)=>this.isLevelAllowed(t)&&s<=e);return this.clientRect=null,Oa.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,t.width||t.height||(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,s){if(null==e||!e.length)return-1;const i=(e,t)=>!t||(e.width!==t.width||e.height!==t.height);let a=e.length-1;for(let n=0;n<e.length;n+=1){const r=e[n];if((r.width>=t||r.height>=s)&&i(r,e[n+1])){a=n;break}}return a}}const Ma="[eme]";class Na{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Na.CDMCleanupPromise?[Na.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=k.debug.bind(k,Ma),this.log=k.log.bind(k,Ma),this.warn=k.warn.bind(k,Ma),this.error=k.error.bind(k,Ma),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===N.WIDEVINE&&s)return s;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(e,t,s)=>!!e&&s.indexOf(e)===t,i=t.map(e=>e.audioCodec).filter(s),a=t.map(e=>e.videoCodec).filter(s);return i.length+a.length===0&&a.push("avc1.42e01e"),new Promise((t,s)=>{const n=e=>{const r=e.shift();this.getMediaKeysPromise(r,i,a).then(e=>t({keySystem:r,mediaKeys:e})).catch(t=>{e.length?n(e):s(t instanceof $a?t:new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};n(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if("function"!=typeof s){let e=`Configured requestMediaKeySystemAccess is not a function ${s}`;return null===z&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return s(e,t)}getMediaKeysPromise(e,t,s){const i=function(e,t,s,i){let a;switch(e){case N.FAIRPLAY:a=["cenc","sinf"];break;case N.WIDEVINE:case N.PLAYREADY:a=["cenc"];break;case N.CLEARKEY:a=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,s,i){return[{initDataTypes:e,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:s.map(e=>({contentType:`video/mp4; codecs="${e}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}(a,t,s,i)}(e,t,s,this.config.drmSystemOptions),a=this.keySystemAccessPromises[e];let n=null==a?void 0:a.keySystemAccess;if(!n){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),n=this.requestMediaKeySystemAccess(e,i);const t=this.keySystemAccessPromises[e]={keySystemAccess:n};return n.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),n.then(s=>{this.log(`Access for key-system "${s.keySystem}" obtained`);const i=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=s.createMediaKeys().then(t=>(this.log(`Media-keys created for "${e}"`),i.then(s=>s?this.setMediaKeysServerCertificate(t,e,s):t))),t.mediaKeys.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),t.mediaKeys})}return n.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${le.hexDump(e.keyId||[])}`);const i={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:s.createSession(),keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),a="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(s,a,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return le.hexDump(e.keyId)}updateKeySession(e,t){var s;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${le.hexDump((null==(s=e.decryptdata)?void 0:s.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,s)=>{const i=V(this.config),a=e.map(U).filter(e=>!!e&&-1!==i.indexOf(e));return this.getKeySystemSelectionPromise(a).then(({keySystem:e})=>{const i=G(e);i?t(i):s(new Error(`Unable to find format for key-system "${e}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),i=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let a=this.keyIdToKeySessionPromise[s];return a||(a=this.keyIdToKeySessionPromise[s]=this.getKeySystemForKeyPromise(t).then(({keySystem:s,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(s,a).then(()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:s,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")})))).catch(e=>this.handleError(e)),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof $a?this.hls.trigger(g.ERROR,e.data):this.hls.trigger(g.ERROR,{type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const t=U(e.keyFormat),s=t?[t]:V(this.config);return this.attemptKeySystemAccess(s)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=V(this.config)),0===e.length)throw new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:s}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===s)return;let i,a;if("sinf"===t&&this.config.drmSystems[N.FAIRPLAY]){const e=ue(new Uint8Array(s));try{const t=F(JSON.parse(e).sinf),s=_e(new Uint8Array(t));if(!s)return;i=s.subarray(8,24),a=N.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},s=new DataView(e),i=s.getUint32(0);if(e.byteLength!==i&&i>44)return null;if(1886614376!==s.getUint32(4))return null;if(t.version=s.getUint32(8)>>>24,t.version>1)return null;t.systemId=le.hexDump(new Uint8Array(e,12,16));const a=s.getUint32(28);if(0===t.version){if(i-32<a)return null;t.data=new Uint8Array(e,32,a)}else if(1===t.version){t.kids=[];for(let s=0;s<a;s++)t.kids.push(new Uint8Array(e,32+16*s,16))}return t}(s);if(null===e)return;0===e.version&&e.systemId===B.WIDEVINE&&e.data&&(i=e.data.subarray(8,24)),a=function(e){if(e===B.WIDEVINE)return N.WIDEVINE}(e.systemId)}if(!a||!i)return;const n=le.hexDump(i),{keyIdToKeySessionPromise:r,mediaKeySessions:o}=this;let l=r[n];for(let e=0;e<o.length;e++){const a=o[e],d=a.decryptdata;if(d.pssh||!d.keyId)continue;const c=le.hexDump(d.keyId);if(n===c||-1!==d.uri.replace(/-/g,"").indexOf(n)){l=r[c],delete r[c],d.pssh=new Uint8Array(s),d.keyId=i,l=r[n]=l.then(()=>this.generateRequestWithPreferredKeySession(a,t,s,"encrypted-event-key-match"));break}}l||(l=r[n]=this.getKeySystemSelectionPromise([a]).then(({keySystem:e,mediaKeys:a})=>{var r;this.throwIfDestroyed();const o=new Le("ISO-23001-7",n,null!=(r=G(e))?r:"");return o.pssh=new Uint8Array(s),o.keyId=i,this.attemptSetMediaKeys(e,a).then(()=>{this.throwIfDestroyed();const i=this.createMediaKeySessionContext({decryptdata:o,keySystem:e,mediaKeys:a});return this.generateRequestWithPreferredKeySession(i,t,s,"encrypted-event-no-match")})})),l.catch(e=>this.handleError(e))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===s.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,s,i){var a,n;const r=null==(a=this.config.drmSystems)?void 0:null==(n=a[e.keySystem])?void 0:n.generateRequest;if(r)try{const i=r.call(this.hls,t,s,e);if(!i)throw new Error("Invalid response from configured generateRequest filter");t=i.initDataType,s=e.decryptdata.pssh=i.initData?new Uint8Array(i.initData):null}catch(e){var o;if(this.warn(e.message),null!=(o=this.hls)&&o.config.debug)throw e}if(null===s)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${l} (init data type: ${t} length: ${s?s.byteLength:null})`);const d=new _i;e.mediaKeysSession.onmessage=(t=>{const s=e.mediaKeysSession;if(!s)return void d.emit("error",new Error("invalid state"));const{messageType:i,message:a}=t;this.log(`"${i}" message event for session "${s.sessionId}" message size: ${a.byteLength}`),"license-request"===i||"license-renewal"===i?this.renewLicense(e,a).catch(e=>{this.handleError(e),d.emit("error",e)}):"license-release"===i?e.keySystem===N.FAIRPLAY&&(this.updateKeySession(e,M("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${i}"`)}),e.mediaKeysSession.onkeystatuseschange=(t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const s=e.keyStatus;d.emit("keyStatus",s),"expired"===s&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))});const c=new Promise((e,t)=>{d.on("error",t),d.on("keyStatus",s=>{s.startsWith("usable")?e():"output-restricted"===s?t(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===s?t(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${s}"`)):"expired"===s?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${s}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)}).catch(e=>{throw new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)}).then(()=>c).catch(t=>{throw d.removeAllListeners(),this.removeSession(e),t}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${le.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${le.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=new(0,t.loader)(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching serverCertificate for "${e}"`),new Promise((a,n)=>{const r={responseType:"arraybuffer",url:i},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,s,i)=>{a(e.data)},onError:(t,s,a,o)=>{n(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:c({url:r.url,data:void 0},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,s,a)=>{n(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:r.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,s)=>{n(new Error("aborted"))}};s.load(r,l,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((i,a)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${null==s?void 0:s.byteLength}) on "${t}"`),i(e)}).catch(e=>{a(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(e=>{throw new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}setupLicenseXHR(e,t,s,i){const a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return a.call(this.hls,e,t,s,i)}).catch(n=>{if(!s.decryptdata)throw n;return e.open("POST",t,!0),a.call(this.hls,e,t,s,i)}).then(s=>{return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||i}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((i,a)=>{const n=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${n}`);const r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=(()=>{if(!this.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(4===r.readyState)if(200===r.status){this._requestLicenseFailureCount=0;let t=r.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const s=this.config.licenseResponseCallback;if(s)try{t=s.call(this.hls,r,n,e)}catch(e){this.error(e)}i(t)}else{const o=s.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||r.status>=400&&r.status<500)a(new $a({type:p.KEY_SYSTEM_ERROR,details:m.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:n,data:void 0,code:r.status,text:r.statusText}},`License Request XHR failed (${n}). Status: ${r.status} (${r.statusText})`));else{const s=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${s} attempts left`),this.requestLicense(e,t).then(i,a)}}}),e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=r,this.setupLicenseXHR(r,n,e,t).then(({xhr:e,licenseChallenge:t})=>{e.send(t)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Le.clearKeyUriToKeyIdMap();const s=t.length;Na.CDMCleanupPromise=Promise.all(t.map(e=>this.removeSession(e)).concat(null==e?void 0:e.setMediaKeys(null).catch(t=>{this.log(`Could not clear media keys: ${t}. media.src: ${null==e?void 0:e.src}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(t=>{this.log(`Could not close sessions and clear media keys: ${t}. media.src: ${null==e?void 0:e.src}`)})}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),t.onmessage=null,t.onkeystatuseschange=null,s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(e=>{this.log(`Could not remove session: ${e}`)}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`)})}}}Na.CDMCleanupPromise=void 0;class $a extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}const Ua=1;var Ba={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"};const Ga="h";class Va{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=(()=>{this.initialized&&(this.starved=!0),this.buffering=!0}),this.onPlaying=(()=>{this.initialized||(this.initialized=!0),this.buffering=!1}),this.applyPlaylistData=(e=>{try{this.apply(e,{ot:Ba.MANIFEST,su:!this.initialized})}catch(e){k.warn("Could not generate manifest CMCD data.",e)}}),this.applyFragmentData=(e=>{try{const t=e.frag,s=this.hls.levels[t.level],i=this.getObjectType(t),a={d:1e3*t.duration,ot:i};i!==Ba.VIDEO&&i!==Ba.AUDIO&&i!=Ba.MUXED||(a.br=s.bitrate/1e3,a.tb=this.getTopBandwidth(i)/1e3,a.bl=this.getBufferLength(i)),this.apply(e,a)}catch(e){k.warn("Could not generate segment CMCD data.",e)}}),this.hls=e;const t=this.config=e.config,{cmcd:s}=t;null!=s&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||Va.uuid(),this.cid=s.contentId,this.useHeaders=!0===s.useHeaders,this.registerListeners())}registerListeners(){const e=this.hls;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,i;this.audioBuffer=null==(s=t.tracks.audio)?void 0:s.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer}createData(){var e;return{v:Ua,sf:Ga,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){u(t,this.createData());const s=t.ot===Ba.INIT||t.ot===Ba.VIDEO||t.ot===Ba.MUXED;if(this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering),this.useHeaders){const s=Va.toHeaders(t);if(!Object.keys(s).length)return;e.headers||(e.headers={}),u(e.headers,s)}else{const s=Va.toQuery(t);if(!s)return;e.url=Va.appendQueryToUri(e.url,s)}}getObjectType(e){const{type:t}=e;return"subtitle"===t?Ba.TIMED_TEXT:"initSegment"===e.sn?Ba.INIT:"audio"===t?Ba.AUDIO:"main"===t?this.hls.audioTracks.length?Ba.VIDEO:Ba.MUXED:void 0}getTopBandwidth(e){let t,s=0;const i=this.hls;if(e===Ba.AUDIO)t=i.audioTracks;else{const e=i.maxAutoLevel,s=e>-1?e+1:i.levels.length;t=i.levels.slice(0,s)}for(const e of t)e.bitrate>s&&(s=e.bitrate);return s>0?s:NaN}getBufferLength(e){const t=this.hls.media,s=e===Ba.AUDIO?this.audioBuffer:this.videoBuffer;return s&&t?1e3*es.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len:NaN}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new s(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,s,i){t(e),this.loader.load(e,s,i)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new s(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,s,i){t(e),this.loader.load(e,s,i)}}}static uuid(){const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}static serialize(e){const t=[],s=e=>!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e,i=e=>Math.round(e),a=e=>100*i(e/100),n={br:i,d:i,bl:a,dl:a,mtp:a,nor:e=>encodeURIComponent(e),rtp:a,tb:i},r=Object.keys(e||{}).sort();for(const i of r){let a=e[i];if(!s(a))continue;if("v"===i&&1===a)continue;if("pr"==i&&1===a)continue;const r=n[i];r&&(a=r(a));const o=typeof a;let l;l="ot"===i||"sf"===i||"st"===i?`${i}=${a}`:"boolean"===o?i:"number"===o?`${i}=${a}`:`${i}=${JSON.stringify(a)}`,t.push(l)}return t.join(",")}static toHeaders(e){const t=Object.keys(e),s={},i=["Object","Request","Session","Status"],a=[{},{},{},{}],n={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(const s of t){a[null!=n[s]?n[s]:1][s]=e[s]}for(let e=0;e<a.length;e++){const t=Va.serialize(a[e]);t&&(s[`CMCD-${i[e]}`]=t)}return s}static toQuery(e){return`CMCD=${encodeURIComponent(Va.serialize(e))}`}static appendQueryToUri(e,t){if(!t)return e;return`${e}${e.includes("?")?"&":"?"}${t}`}}const za=3e5;function Ka(e,t,s,i){e&&Object.keys(t).forEach(a=>{const n=e.filter(e=>e.groupId===a).map(e=>{const n=u({},e);return n.details=void 0,n.attrs=new w(n.attrs),n.url=n.attrs.URI=Ha(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",s),n.groupId=n.attrs["GROUP-ID"]=t[a],n.attrs["PATHWAY-ID"]=i,n});e.push(...n)})}function Ha(e,t,s,i){const{HOST:a,PARAMS:n,[s]:r}=i;let o;t&&(o=null==r?void 0:r[t])&&(e=o);const l=new self.URL(e);return a&&!o&&(l.host=a),n&&Object.keys(n).sort().forEach(e=>{e&&l.searchParams.set(e,n[e])}),l.href}const Ya=/^age:\s*[\d.]+\s*$/im;class Wa{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new D,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e)return;const s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0;const a=this.xhrSetup;a?Promise.resolve().then(()=>{if(!this.stats.aborted)return a(s,t.url)}).catch(e=>(s.open("GET",t.url,!0),a(s,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(e=>{this.callbacks.onError({code:s.status,text:e.message},t,s,i)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const i=this.context.headers,{maxTimeToFirstByteMs:a,maxLoadTimeMs:n}=s.loadPolicy;if(i)for(const t in i)e.setRequestHeader(t,i[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=a&&f(a)?a:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const i=t.readyState,a=this.config;if(!s.aborted&&i>=2&&(0===s.loading.first&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const i=t.status,n="text"!==t.responseType;if(i>=200&&i<300&&(n&&t.response||null!==t.responseText)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const a=n?t.response:t.responseText,r="arraybuffer"===t.responseType?a.byteLength:a.length;if(s.loaded=s.total=r,s.bwEstimate=8e3*s.total/(s.loading.end-s.loading.first),!this.callbacks)return;const o=this.callbacks.onProgress;if(o&&o(s,e,a,t),!this.callbacks)return;const l={url:t.responseURL,data:a,code:i};this.callbacks.onSuccess(l,s,e,t)}else{const n=a.loadPolicy.errorRetry;At(n,s.retry,!1,i)?this.retry(n):(k.error(`${i} while loading ${e.url}`),this.callbacks.onError({code:i,text:t.statusText},e,t,s))}}}loadtimeout(){var e;const t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(At(t,this.stats.retry,!0))this.retry(t);else{k.warn(`timeout while loading ${this.context.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=It(e,s.retry),s.retry++,k.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Ya.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const ja=/(\d+)-(\d+)\/(\d+)/;class qa{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Xa,this.controller=new self.AbortController,this.stats=new D}destroy(){this.loader=this.callbacks=null,this.abortInternal()}abortInternal(){const e=this.response;null!=e&&e.ok||(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const a=function(e,t){const s={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(u({},e.headers))};e.rangeEnd&&s.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return s}(e,this.controller.signal),n=s.onProgress,r="arraybuffer"===e.responseType,o=r?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,a),self.clearTimeout(this.requestTimeout),t.timeout=l&&f(l)?l:d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(a=>{this.response=this.loader=a;const o=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},d-(o-i.loading.start)),!a.ok){const{status:e,statusText:t}=a;throw new Qa(t||"fetch, bad network response",e,a)}return i.loading.first=o,i.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=ja.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(f(e))return e}const s=e.get("Content-Length");if(s)return parseInt(s)}(a.headers)||i.total,n&&f(t.highWaterMark)?this.loadProgressively(a,i,e,t.highWaterMark,n):r?a.arrayBuffer():"json"===e.responseType?a.json():a.text()}).then(a=>{const{response:r}=this;self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const l=a[o];l&&(i.loaded=i.total=l);const d={url:r.url,data:a,code:r.status};n&&!f(t.highWaterMark)&&n(i,e,a,r),s.onSuccess(d,i,e,r)}).catch(t=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const a=t&&t.code||0,n=t?t.message:null;s.onError({code:a,text:n},e,t?t.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,i=0,a){const n=new Ci,r=e.body.getReader(),o=()=>r.read().then(r=>{if(r.done)return n.dataLength&&a(t,s,n.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=r.value,d=l.length;return t.loaded+=d,d<i||n.dataLength?(n.push(l),n.dataLength>=i&&a(t,s,n.flush(),e)):a(t,s,l,e),o()}).catch(()=>Promise.reject());return o()}}function Xa(e,t){return new self.Request(e.url,t)}class Qa extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const Ja=/\s/,Za=c(c({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Wa,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;const t=e.config;this.bwEstimator=new xi(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this)}unregisterListeners(){const{hls:e}=this;e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this)}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null}onFragLoading(e,t){var s;const i=t.frag;this.ignoreFragment(i)||(this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))}onLevelSwitching(e,t){this.clearTimer()}getTimeToLoadFrag(e,t,s,i){return e+s/t+(i?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const s=this.hls.config,{total:i,bwEstimate:a}=t.stats;f(i)&&f(a)&&(this.lastLevelLoadSec=8*i/a),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}_abandonRulesCheck(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{autoLevelEnabled:i,media:a}=s;if(!e||!a)return;const n=performance.now(),r=t?t.stats:e.stats,o=t?t.duration:e.duration,l=n-r.loading.start;if(r.aborted||r.loaded&&r.loaded===r.total||0===e.level)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!i||a.paused||!a.playbackRate||!a.readyState)return;const d=s.mainForwardBufferInfo;if(null===d)return;const c=this.bwEstimator.getEstimateTTFB(),h=Math.abs(a.playbackRate);if(l<=Math.max(c,o/(2*h)*1e3))return;const u=d.len/h;if(u>=2*o/h)return;const p=r.loading.first?r.loading.first-r.loading.start:-1,m=r.loaded&&p>-1,v=this.bwEstimator.getEstimate(),{levels:y,minAutoLevel:b}=s,_=y[e.level],T=r.total||Math.max(r.loaded,Math.round(o*_.maxBitrate/8));let S=l-p;S<1&&m&&(S=Math.min(l,8*r.loaded/v));const w=m?1e3*r.loaded/S:0,E=w?(T-r.loaded)/w:8*T/v+c/1e3;if(E<=u)return;const I=w?8*w:v;let D,A=Number.POSITIVE_INFINITY;for(D=e.level-1;D>b;D--){const e=y[D].maxBitrate;if((A=this.getTimeToLoadFrag(c/1e3,I,o*e,!y[D].details))<u)break}A>=E||A>10*o||(s.nextLoadLevel=D,m?this.bwEstimator.sample(l-Math.min(c,p),r.loaded):this.bwEstimator.sampleTTFB(l),this.clearTimer(),k.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${u.toFixed(3)} s\n Estimated load time for current fragment: ${E.toFixed(3)} s\n Estimated load time for down switch fragment: ${A.toFixed(3)} s\n TTFB estimate: ${p}\n Current BW estimate: ${f(v)?(v/1024).toFixed(3):"Unknown"} Kb/s\n New BW estimate: ${(this.bwEstimator.getEstimate()/1024).toFixed(3)} Kb/s\n Aborting and switching to level ${D}`),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),s.trigger(g.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:r}))}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===Je.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){const e=s?s.duration:t.duration,a=this.hls.levels[t.level],n=(a.loaded?a.loaded.bytes:0)+i.loaded,r=(a.loaded?a.loaded.duration:0)+e;a.loaded={bytes:n,duration:r},a.realBitrate=Math.round(8*n/r)}if(t.bitrateTest){const e={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(g.FRAG_BUFFERED,e),t.bitrateTest=!1}}}onFragBuffered(e,t){const{frag:s,part:i}=t,a=null!=i&&i.stats.loaded?i.stats:s.stats;if(a.aborted)return;if(this.ignoreFragment(s))return;const n=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,a.loaded),a.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Je.MAIN||"initSegment"===e.sn}clearTimer(){self.clearInterval(this.timer)}get nextAutoLevel(){const e=this._nextAutoLevel,t=this.bwEstimator;if(-1!==e&&!t.canEstimate())return e;let s=this.getNextABRAutoLevel();if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return-1!==e&&(s=Math.min(e,s)),s}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:i,config:a,minAutoLevel:n,media:r}=s,o=t?t.duration:e?e.duration:0,l=r&&0!==r.playbackRate?Math.abs(r.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():a.abrEwmaDefaultEstimate,c=s.mainForwardBufferInfo,h=(c?c.len:0)/l;let u=this.findBestLevel(d,n,i,h,a.abrBandWidthFactor,a.abrBandWidthUpFactor);if(u>=0)return u;k.trace(`[abr] ${h?"rebuffering expected":"buffer is empty"}, finding optimal quality level`);let f=o?Math.min(o,a.maxStarvationDelay):a.maxStarvationDelay,g=a.abrBandWidthFactor,p=a.abrBandWidthUpFactor;if(!h){const e=this.bitrateTestDelay;e&&(f=(o?Math.min(o,a.maxLoadingDelay):a.maxLoadingDelay)-e,k.trace(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),g=p=1)}return u=this.findBestLevel(d,n,i,h+f,g,p),Math.max(u,0)}findBestLevel(e,t,s,i,a,n){var r;const{fragCurrent:o,partCurrent:l,lastLoadedFragLevel:d}=this,{levels:c}=this.hls,h=c[d],u=!(null==h||null==(r=h.details)||!r.live),g=null==h?void 0:h.codecSet,p=l?l.duration:o?o.duration:0,m=this.bwEstimator.getEstimateTTFB()/1e3;let v=t,y=-1;for(let r=s;r>=t;r--){const t=c[r];if(!t||g&&t.codecSet!==g){t&&(v=Math.min(r,v),y=Math.max(r,y));continue}-1!==y&&k.trace(`[abr] Skipped level(s) ${v}-${y} with CODECS:"${c[y].attrs.CODECS}"; not compatible with "${h.attrs.CODECS}"`);const s=t.details,o=(l?null==s?void 0:s.partTarget:null==s?void 0:s.averagetargetduration)||p;let b;b=r<=d?a*e:n*e;const _=c[r].maxBitrate,T=this.getTimeToLoadFrag(m,b,_*o,void 0===s);if(k.trace(`[abr] level:${r} adjustedbw-bitrate:${Math.round(b-_)} avgDuration:${o.toFixed(1)} maxFetchDuration:${i.toFixed(1)} fetchDuration:${T.toFixed(1)}`),b>_&&(0===T||!f(T)||u&&!this.bitrateTestDelay||T<i))return r}return-1}set nextAutoLevel(e){this._nextAutoLevel=e}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=(()=>{const{media:e,mediaSource:t}=this;k.log("[buffer-controller]: Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(g.MEDIA_ATTACHED,{media:e})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()}),this._onMediaSourceClose=(()=>{k.log("[buffer-controller]: Media source closed")}),this._onMediaSourceEnded=(()=>{k.log("[buffer-controller]: Media source ended")}),this._onMediaEmptied=(()=>{const{media:e,_objectUrl:t}=this;e&&e.src!==t&&k.error(`Media element src was set while attaching MediaSource (${t} > ${e.src})`)}),this.hls=e,this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.BUFFER_EOS,this.onBufferEos,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.FRAG_PARSED,this.onFragParsed,this),e.on(g.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_EOS,this.onBufferEos,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.FRAG_PARSED,this.onFragParsed,this),e.off(g.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Ui(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,k.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media;if(s&&Bi){const e=this.mediaSource=new Bi;e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(e),this._objectUrl=s.src,s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(k.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){k.warn(`[buffer-controller]: onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),e.src===s?(e.removeAttribute("src"),e.load()):k.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(g.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];try{t&&(this.removeBufferListeners(e),this.mediaSource&&this.mediaSource.removeSourceBuffer(t),this.sourceBuffer[e]=void 0)}catch(t){k.warn(`[buffer-controller]: Failed to reset the ${e} buffer`,t)}}),this._initSourceBuffer()}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length;Object.keys(t).forEach(e=>{if(s){const s=this.tracks[e];if(s&&"function"==typeof s.buffer.changeType){const{id:i,codec:a,levelCodec:n,container:r,metadata:o}=t[e],l=(s.levelCodec||s.codec).replace(Gi,"$1"),d=(n||a).replace(Gi,"$1");if(l!==d){const t=`${r};codecs=${n||a}`;this.appendChangeType(e,t),k.log(`[buffer-controller]: switching codec ${l} to ${d}`),this.tracks[e]={buffer:s.buffer,codec:a,container:r,levelCodec:n,metadata:o,id:i}}}}else this.pendingTracks[e]=t[e]}),s||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())}appendChangeType(e,t){const{operationQueue:s}=this,i={execute:()=>{const i=this.sourceBuffer[e];i&&(k.log(`[buffer-controller]: changing ${e} sourceBuffer type to ${t}`),i.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{k.warn(`[buffer-controller]: Failed to change ${e} SourceBuffer type`,t)}};s.append(i,e)}onBufferAppending(e,t){const{hls:s,operationQueue:i,tracks:a}=this,{data:n,type:r,frag:o,part:l,chunkMeta:d}=t,c=d.buffering[r],h=self.performance.now();c.start=h;const u=o.stats.buffering,f=l?l.stats.buffering:null;0===u.start&&(u.start=h),f&&0===f.start&&(f.start=h);const v=a.audio;let y=!1;"audio"===r&&"audio/mpeg"===(null==v?void 0:v.container)&&(y=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const b=o.start,_={execute:()=>{if(c.executeStart=self.performance.now(),y){const e=this.sourceBuffer[r];if(e){const t=b-e.timestampOffset;Math.abs(t)>=.1&&(k.log(`[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${b} (delta: ${t}) sn: ${o.sn})`),e.timestampOffset=b)}}this.appendExecutor(n,r)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();c.executeEnd=c.end=e,0===u.first&&(u.first=e),f&&0===f.first&&(f.first=e);const{sourceBuffer:t}=this,s={};for(const e in t)s[e]=es.getBuffered(t[e]);this.appendError=0,this.hls.trigger(g.BUFFER_APPENDED,{type:r,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:s})},onError:e=>{k.error(`[buffer-controller]: Error encountered while trying to append to the ${r} SourceBuffer`,e);const t={type:p.MEDIA_ERROR,parent:o.type,details:m.BUFFER_APPEND_ERROR,frag:o,part:l,chunkMeta:d,error:e,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=m.BUFFER_FULL_ERROR:(this.appendError++,t.details=m.BUFFER_APPEND_ERROR,this.appendError>s.config.appendErrorMaxRetry&&(k.error(`[buffer-controller]: Failed ${s.config.appendErrorMaxRetry} times to append segment in sourceBuffer`),t.fatal=!0)),s.trigger(g.ERROR,t)}};i.append(_,r)}onBufferFlushing(e,t){const{operationQueue:s}=this,i=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(g.BUFFER_FLUSHED,{type:e})},onError:t=>{k.warn(`[buffer-controller]: Failed to remove from ${e} SourceBuffer`,t)}});t.type?s.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(e=>{s.append(i(e),e)})}onFragParsed(e,t){const{frag:s,part:i}=t,a=[],n=i?i.elementaryStreams:s.elementaryStreams;n[A.AUDIOVIDEO]?a.push("audiovideo"):(n[A.AUDIO]&&a.push("audio"),n[A.VIDEO]&&a.push("video")),0===a.length&&k.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(()=>{const e=self.performance.now();s.stats.buffering.end=e,i&&(i.stats.buffering.end=e);const t=i?i.stats:s.stats;this.hls.trigger(g.FRAG_BUFFERED,{frag:s,part:i,stats:t,id:s.type})},a)}onFragChanged(e,t){this.flushBackBuffer()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((e,s)=>{const i=this.sourceBuffer[s];return!i||t.type&&t.type!==s||(i.ending=!0,i.ended||(i.ended=!0,k.log(`[buffer-controller]: ${s} sourceBuffer now EOS`))),e&&!(i&&!i.ended)},!0)&&(k.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)});const{mediaSource:e}=this;e&&"open"===e.readyState?(k.log("[buffer-controller]: Calling mediaSource.endOfStream()"),e.endOfStream()):e&&k.info(`[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}flushBackBuffer(){const{hls:e,details:t,media:s,sourceBuffer:i}=this;if(!s||null===t)return;const a=this.getSourceBufferTypes();if(!a.length)return;const n=t.live&&null!==e.config.liveBackBufferLength?e.config.liveBackBufferLength:e.config.backBufferLength;if(!f(n)||n<0)return;const r=s.currentTime,o=t.levelTargetDuration,l=Math.max(n,o),d=Math.floor(r/o)*o-l;a.forEach(s=>{const a=i[s];if(a){const i=es.getBuffered(a);if(i.length>0&&d>i.start(0)){if(e.trigger(g.BACK_BUFFER_REACHED,{bufferEnd:d}),t.live)e.trigger(g.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d});else if(a.ended&&i.end(i.length-1)-r<2*o)return void k.info(`[buffer-controller]: Cannot flush ${s} back buffer while SourceBuffer is in ended state`);e.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:s})}}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:s,mediaSource:i}=this,a=e.fragments[0].start+e.totalduration,n=s.duration,r=f(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(k.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(a>r&&a>n||!f(n))&&(k.log(`[buffer-controller]: Updating Media Source duration to ${a.toFixed(3)}`),i.duration=a)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&null!=t&&t.setLiveSeekableRange){const i=Math.max(0,s[0].start),a=Math.max(i,i+e.totalduration);t.setLiveSeekableRange(i,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,i=Object.keys(s).length;if(i&&!e||2===i){this.createSourceBuffers(s),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(g.BUFFER_CREATED,{tracks:this.tracks}),e.forEach(e=>{t.executeNext(e)});else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const i in e)if(!t[i]){const a=e[i];if(!a)throw Error(`source buffer exists for track ${i}, however track does not`);const n=a.levelCodec||a.codec,r=`${a.container};codecs=${n}`;k.log(`[buffer-controller]: creating sourceBuffer(${r})`);try{const e=t[i]=s.addSourceBuffer(r),o=i;this.addBufferListener(o,"updatestart",this._onSBUpdateStart),this.addBufferListener(o,"updateend",this._onSBUpdateEnd),this.addBufferListener(o,"error",this._onSBUpdateError),this.tracks[i]={buffer:e,codec:n,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(e){k.error(`[buffer-controller]: error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:r})}}}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){const{operationQueue:t}=this;t.current(e).onComplete(),t.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){const s=new Error(`${e} SourceBuffer error`);k.error(`[buffer-controller]: ${s}`,t),this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.BUFFER_APPENDING_ERROR,error:s,fatal:!1});const i=this.operationQueue.current(e);i&&i.onError(t)}removeExecutor(e,t,s){const{media:i,mediaSource:a,operationQueue:n,sourceBuffer:r}=this,o=r[e];if(!i||!a||!o)return k.warn(`[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void n.shiftAndExecuteNext(e);const l=f(i.duration)?i.duration:1/0,d=f(a.duration)?a.duration:1/0,c=Math.max(0,t),h=Math.min(s,l,d);h>c&&!o.ending?(o.ended=!1,k.log(`[buffer-controller]: Removing [${c},${h}] from the ${e} SourceBuffer`),o.remove(c,h)):n.shiftAndExecuteNext(e)}appendExecutor(e,t){const{operationQueue:s,sourceBuffer:i}=this,a=i[t];if(!a)return k.warn(`[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist`),void s.shiftAndExecuteNext(t);a.ended=!1,a.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return k.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:s}=this,i=t.map(e=>s.appendBlocker(e));Promise.all(i).then(()=>{e(),t.forEach(e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||s.shiftAndExecuteNext(e)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const i=this.sourceBuffer[e];if(!i)return;const a=s.bind(this,e);this.listeners[e].push({event:t,listener:a}),i.addEventListener(t,a)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(e=>{t.removeEventListener(e.event,e.listener)})}},capLevelController:Oa,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=k.log.bind(k,"[info]:"),this.warn=k.warn.bind(k,"[warning]:"),this.error=k.error.bind(k,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(g.ERROR,this.onError,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.ERROR,this.onError,this),e.off(g.ERROR,this.onErrorOut,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){this.playlistError=0}stopLoad(){}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Je.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onError(e,t){var s;if(t.fatal)return;const i=this.hls,a=t.context;switch(t.details){case m.FRAG_LOAD_ERROR:case m.FRAG_LOAD_TIMEOUT:case m.KEY_LOAD_ERROR:case m.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case m.FRAG_GAP:case m.FRAG_PARSING_ERROR:case m.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Ft.SendAlternateToPenaltyBox);case m.LEVEL_EMPTY_ERROR:case m.LEVEL_PARSING_ERROR:{var n,r;const e=t.parent===Je.MAIN?t.level:i.loadLevel;t.details===m.LEVEL_EMPTY_ERROR&&null!=(n=t.context)&&null!=(r=n.levelDetails)&&r.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case m.LEVEL_LOAD_ERROR:case m.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==a?void 0:a.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level)));case m.AUDIO_TRACK_LOAD_ERROR:case m.AUDIO_TRACK_LOAD_TIMEOUT:case m.SUBTITLE_LOAD_ERROR:case m.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const e=i.levels[i.loadLevel];if(e&&(a.type===Qe.AUDIO_TRACK&&a.groupId===e.audioGroupId||a.type===Qe.SUBTITLE_TRACK&&a.groupId===e.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=Ft.SendAlternateToPenaltyBox,void(t.errorAction.flags=Ot.MoveAllAlternatesMatchingHost)}return;case m.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=i.levels[i.loadLevel],s=null==e?void 0:e.attrs["HDCP-LEVEL"];s&&(t.errorAction={action:Ft.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHDCP,hdcpLevel:s})}return;case m.BUFFER_ADD_CODEC_ERROR:case m.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:i.loadLevel));case m.INTERNAL_EXCEPTION:case m.BUFFER_APPENDING_ERROR:case m.BUFFER_APPEND_ERROR:case m.BUFFER_FULL_ERROR:case m.LEVEL_SWITCH_ERROR:case m.BUFFER_STALLED_ERROR:case m.BUFFER_SEEK_OVER_HOLE:case m.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:Ft.DoNothing,flags:Ot.None})}if(t.type===p.KEY_SYSTEM_ERROR){const e=this.getVariantLevelIndex(t.frag);return t.levelRetry=!1,void(t.errorAction=this.getLevelSwitchAction(t,e))}}getPlaylistRetryOrSwitchAction(e,t){var s,i;const a=Et(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++,r=null==(s=e.response)?void 0:s.code;return At(a,n,wt(e),r)?{action:Ft.RetryRequest,flags:Ot.None,retryConfig:a,retryCount:n}:null!=(i=e.context)&&i.deliveryDirectives?{action:Ft.DoNothing,flags:Ot.None,retryConfig:a||{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},retryCount:n}:this.getLevelSwitchAction(e,t)}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:a,keyLoadPolicy:n}=t.config,r=Et(e.details.startsWith("key")?n:a,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(i){var l;e.details!==m.FRAG_GAP&&i.fragmentError++;const t=null==(l=e.response)?void 0:l.code;if(At(r,o,wt(e),t))return{action:Ft.RetryRequest,flags:Ot.None,retryConfig:r,retryCount:o}}const d=this.getLevelSwitchAction(e,s);return r&&(d.retryConfig=r,d.retryCount=o),d}getLevelSwitchAction(e,t){const s=this.hls;null!==t&&void 0!==t||(t=s.loadLevel);const i=this.hls.levels[t];if(i&&(i.loadError++,s.autoLevelEnabled)){var a,n;let t=-1;const r=s.levels,o=null==(a=e.frag)?void 0:a.type,{type:l,groupId:d}=null!=(n=e.context)?n:{};for(let a=r.length;a--;){const n=(a+s.loadLevel)%r.length;if(n!==s.loadLevel&&0===r[n].loadError){const s=r[n];if(e.details===m.FRAG_GAP&&e.frag){const t=r[n].details;if(t){const s=Rt(e.frag,t.fragments,e.frag.start);if(null!=s&&s.gap)continue}}else{if(l===Qe.AUDIO_TRACK&&d===s.audioGroupId||l===Qe.SUBTITLE_TRACK&&d===s.textGroupId)continue;if(o===Je.AUDIO&&i.audioGroupId===s.audioGroupId||o===Je.SUBTITLE&&i.textGroupId===s.textGroupId)continue}t=n;break}}if(t>-1&&s.loadLevel!==t)return e.levelRetry=!0,{action:Ft.SendAlternateToPenaltyBox,flags:Ot.None,nextAutoLevel:t}}return{action:Ft.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch(null==(s=t.errorAction)?void 0:s.action){case Ft.DoNothing:break;case Ft.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===m.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:i,hdcpLevel:a,nextAutoLevel:n}=s;switch(i){case Ot.None:this.switchLevel(e,n);break;case Ot.MoveAllAlternatesMatchingHost:s.resolved||(s.resolved=this.redundantFailover(e));break;case Ot.MoveAllAlternatesMatchingHDCP:a&&(t.maxHdcpLevel=ft[ft.indexOf(a)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}s.resolved||this.switchLevel(e,n)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}redundantFailover(e){const{hls:t,penalizedRenditions:s}=this,i=e.parent===Je.MAIN?e.level:t.loadLevel,a=t.levels[i],n=a.url.length,r=e.frag?e.frag.urlId:a.urlId;a.urlId!==r||e.frag&&!a.details||this.penalizeRendition(a,e);for(let o=1;o<n;o++){const l=(r+o)%n,d=s[l];if(!d||Mt(d,e,s[r]))return this.warn(`Switching to Redundant Stream ${l+1}/${n}: "${a.url[l]}" after ${e.details}`),this.playlistError=0,t.levels.forEach(e=>{e.urlId=l}),t.nextLoadLevel=i,!0}return!1}penalizeRendition(e,t){const{penalizedRenditions:s}=this,i=s[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};i.lastErrorPerfMs=performance.now(),i.errors.push(t),i.details=e.details,s[e.urlId]=i}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,s){const i=performance.now();if(t){if(this.lastTime){const e=i-this.lastTime,a=s-this.lastDroppedFrames,n=t-this.lastDecodedFrames,r=1e3*a/e,o=this.hls;if(o.trigger(g.FPS_DROP,{currentDropped:a,currentDecoded:n,totalDroppedFrames:s}),r>0&&a>o.config.fpsDroppedMonitoringThreshold*n){let e=o.currentLevel;k.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(g.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:z,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue(e,t,s,i){const a=[];let n,r,o,l,d;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(o=!0,l=0,d="",!(n=i.rows[u]).isEmpty()){var h;for(let e=0;e<n.chars.length;e++)Ja.test(n.chars[e].uchar)&&o?l++:(d+=n.chars[e].uchar,o=!1);n.cueStartTime=t,t===s&&(s+=1e-4),l>=16?l--:l++;const i=ma(d.trim()),f=Ta(t,s,i);null!=e&&null!=(h=e.cues)&&h.getCueById(f)||((r=new c(t,s,i)).id=f,r.line=u+1,r.align="left",r.position=10+Math.min(80,10*Math.floor(8*l/32)),a.push(r))}return e&&a.length&&(a.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),a.forEach(t=>it(e,t))),a}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends gs{constructor(e,t,s){super(e,t,s,"[subtitle-stream-controller]",Je.SUBTITLE),this.levels=[],this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.ERROR,this.onError,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.ERROR,this.onError,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=fs.IDLE,this.setInterval(Mi),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:i}=t;if(this.fragPrevious=s,this.state=fs.IDLE,!i)return;const a=this.tracksBuffered[this.currentTrackId];if(!a)return;let n;const r=s.start;for(let e=0;e<a.length;e++)if(r>=a[e].start&&r<=a[e].end){n=a[e];break}const o=s.start+s.duration;n?n.end=o:(n={start:r,end:o},a.push(n)),this.fragmentTracker.fragBuffered(s)}onBufferFlushing(e,t){const{startOffset:s,endOffset:i}=t;if(0===s&&i!==Number.POSITIVE_INFINITY){const{currentTrackId:e,levels:a}=this;if(!a.length||!a[e]||!a[e].details)return;const n=i-a[e].details.targetduration;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(e=>{for(let t=0;t<e.length;)if(e[t].end<=n)e.shift();else{if(!(e[t].start<n))break;e[t].start=n,t++}}),this.fragmentTracker.removeFragmentsInRange(s,n,Je.SUBTITLE)}}onFragBuffered(e,t){var s;this.loadedmetadata||t.frag.type!==Je.MAIN||null!=(s=this.media)&&s.buffered.length&&(this.loadedmetadata=!0)}onError(e,t){const s=t.frag;(null==s?void 0:s.type)===Je.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==fs.STOPPED&&(this.state=fs.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){Fi(this.levels,t)?this.levels=t.map(e=>new mt(e)):(this.tracksBuffered=[],this.levels=t.map(e=>{const t=new mt(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Je.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){if(this.currentTrackId=t.id,!this.levels.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(Mi)}onSubtitleTrackLoaded(e,t){var s;const{details:i,id:a}=t,{currentTrackId:n,levels:r}=this;if(!r.length)return;const o=r[n];if(a>=r.length||a!==n||!o)return;this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(i.live||null!=(s=o.details)&&s.live){const e=this.mainDetails;if(i.deltaUpdateFailed||!e)return;const t=e.fragments[0];o.details?0===(l=this.alignPlaylists(i,o.details))&&t&&kt(i,l=t.start):i.hasProgramDateTime&&e.hasProgramDateTime?(rs(i,e),l=i.fragments[0].start):t&&kt(i,l=t.start)}o.details=i,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(o.details,l),this.tick(),i.live&&!this.fragCurrent&&this.media&&this.state===fs.IDLE&&(Rt(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,i=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer).catch(e=>{throw a.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(s=>{const i=performance.now();a.trigger(g.FRAG_DECRYPTED,{frag:t,payload:s,stats:{tstart:e,tdecrypt:i}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=fs.IDLE})}}doTick(){if(this.media){if(this.state===fs.IDLE){const{currentTrackId:e,levels:t}=this,s=t[e];if(!t.length||!s||!s.details)return;const i=s.details,a=i.targetduration,{config:n}=this,r=this.getLoadPosition(),o=es.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r-a,n.maxBufferHole),{end:l,len:d}=o,c=this.getFwdBufferInfo(this.media,Je.MAIN);if(d>this.getMaxBufferLength(null==c?void 0:c.len)+a)return;const h=i.fragments,u=h.length,f=i.edge;let g=null;const p=this.fragPrevious;if(l<f){const{maxFragLookUpTolerance:e}=n;!(g=Rt(p,h,Math.max(h[0].start,l),e))&&p&&p.start<h[0].start&&(g=h[0])}else g=h[u-1];if(!g)return;g=this.mapToInitFragWhenRequired(g),this.fragmentTracker.getState(g)===Vt.NOT_LOADED&&this.loadFragment(g,s,l)}}else this.state=fs.IDLE}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,s){this.fragCurrent=e,"initSegment"===e.sn?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,s))}get mediaBufferTimeRanges(){return new Ni(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends Nt{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.trackChangeListener=(()=>this.onTextTracksChanged()),this.asyncPollTrackChange=(()=>this.pollTrackChange(0)),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes(this.trackId)}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)}onMediaDetaching(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),$i(this.media.textTracks).forEach(e=>{at(e)}),this.subtitleTrack=-1,this.media=null)}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,details:i}=t,{trackId:a}=this,n=this.tracksInGroup[a];if(!n)return void this.warn(`Invalid subtitle track id ${s}`);const r=n.details;n.details=t.details,this.log(`subtitle track ${s} loaded [${i.startSN}-${i.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,r)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(null==t||!t.textGroupIds)return;const s=t.textGroupIds[t.urlId],i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==s){const e=this.tracks.filter(e=>!s||e.groupId===s);this.tracksInGroup=e;const t=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=s||null;const a={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${s}" group-id`),this.hls.trigger(g.SUBTITLE_TRACKS_UPDATED,a),-1!==t&&this.setSubtitleTrack(t,i)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId,i)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const i=t[s];if((!this.selectDefaultTrack||i.default)&&(!e||e===i.name))return i.id}return-1}onError(e,t){!t.fatal&&t.context&&t.context.type===Qe.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.checkRetry(t)}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1;const t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const s=t.id,i=t.groupId;let a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(g.SUBTITLE_TRACK_LOADING,{url:a,id:s,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(e){const{media:t,trackId:s}=this;if(!t)return;const i=$i(t.textTracks),a=i.filter(e=>e.groupId===this.groupId);if(-1===e)[].slice.call(i).forEach(e=>{e.mode="disabled"});else{const e=a[s];e&&(e.mode="disabled")}const n=a[e];n&&(n.mode=this.subtitleDisplay?"showing":"hidden")}setSubtitleTrack(e,t){var s;const i=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(-1===e||null!=(s=i[e])&&s.details)||e<-1||e>=i.length)return;this.clearTimer();const a=i[e];if(this.log(`Switching to subtitle-track ${e}`+(a?` "${a.name}" lang:${a.lang} group:${a.groupId}`:"")),this.trackId=e,a){const{id:e,groupId:s="",name:i,type:n,url:r}=a;this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:e,groupId:s,name:i,type:n,url:r});const o=this.switchParams(a.url,null==t?void 0:t.details);this.loadPlaylist(o)}else this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:e})}onTextTracksChanged(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=-1;const t=$i(this.media.textTracks);for(let s=0;s<t.length;s++)if("hidden"===t[s].mode)e=s;else if("showing"===t[s].mode){e=s;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}},timelineController:class{constructor(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){const e=new oa(this,"textTrack1"),t=new oa(this,"textTrack2"),s=new oa(this,"textTrack3"),i=new oa(this,"textTrack4");this.cea608Parser1=new aa(1,e,t),this.cea608Parser2=new aa(3,s,i)}e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null}addCues(e,t,s,i,a){let n=!1;for(let e=a.length;e--;){const i=a[e],c=(r=i[0],o=i[1],l=t,d=s,Math.min(o,d)-Math.max(r,l));if(c>=0&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],s),n=!0,c/(s-t)>.5))return}var r,o,l,d;if(n||a.push([t,s]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,s,i)}else{const a=this.Cues.newCue(null,t,s,i);this.hls.trigger(g.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:a}){const{unparsedVttFrags:n}=this;"main"===s&&(this.initPTS[t.cc]={baseTime:i,timescale:a}),n.length&&(this.unparsedVttFrags=[],n.forEach(e=>{this.onFragLoaded(g.FRAG_LOADED,e)}))}getExistingTrack(e){const{media:t}=this;if(t)for(let s=0;s<t.textTracks.length;s++){const i=t.textTracks[s];if(i[e])return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:s,media:i}=this,{label:a,languageCode:n}=t[e],r=this.getExistingTrack(e);if(r)s[e]=r,at(s[e]),st(s[e],i);else{const t=this.createTextTrack("captions",a,n);t&&(t[e]=!0,s[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,s){const i=this.media;if(i)return i.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{at(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;e<t.length;e++)at(t[e])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],i=s.some(e=>e.textCodec===Ea);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Fi(this.tracks,s))return void(this.tracks=s);if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const e=this.media?this.media.textTracks:null;this.tracks.forEach((t,s)=>{let i;if(e&&s<e.length){let s=null;for(let i=0;i<e.length;i++)if(s=e[i],n=t,s&&s.label===n.name&&!s.textTrack1&&!s.textTrack2){s=e[i];break}s&&(i=s)}if(i)at(i);else{const e=this._captionsOrSubtitlesFromCharacteristics(t);(i=this.createTextTrack(e,t.name,t.lang))&&(i.mode="disabled")}i&&(i.groupId=t.groupId,this.textTracks.push(i))})}else if(this.tracks.length){const e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}var a,n}_captionsOrSubtitlesFromCharacteristics(e){if(e.attrs.CHARACTERISTICS){const t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),s=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&s)return"captions"}return"subtitles"}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const s=`textTrack${t[1]}`,i=this.captionsProperties[s];i&&(i.label=e.name,e.lang&&(i.languageCode=e.lang),i.media=e)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){const{cea608Parser1:s,cea608Parser2:i,lastSn:a,lastPartIndex:n}=this;if(this.enabled&&s&&i&&t.frag.type===Je.MAIN){var r,o;const e=t.frag.sn,l=null!=(r=null==t?void 0:null==(o=t.part)?void 0:o.index)?r:-1;e===a+1||e===a&&l===n+1||(s.reset(),i.reset()),this.lastSn=e,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:s,payload:i}=t,{initPTS:a,unparsedVttFrags:n}=this;if(s.type===Je.SUBTITLE)if(i.byteLength){if(!a[s.cc])return n.push(t),void(a.length&&this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")}));const e=s.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[s.level],t=this.vttCCs;t[s.cc]||(t[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),e&&e.textCodec===Ea?this._parseIMSC1(s,i):this._parseVTTs(s,i,t)}}else this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;La(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),s.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{k.log(`Failed to parse IMSC1: ${t}`),s.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e,t,s){var i;const a=this.hls;wa(null!=(i=e.initSegment)&&i.data?Te(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],s,e.cc,e.start,t=>{this._appendCues(t,e.level),a.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{this._fallbackToIMSC1(e,t),k.log(`Failed to parse VTT cue: ${s}`),a.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||La(t,this.initPTS[e.cc],()=>{s.textCodec=Ea,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||"disabled"===s.mode)return;e.forEach(e=>it(s,e))}else{const i=this.tracks[t];if(!i)return;const a=i.default?"default":"subtitles"+t;s.trigger(g.CUES_PARSED,{type:"subtitles",cues:e,track:a})}}onFragDecrypted(e,t){const{frag:s}=t;if(s.type===Je.SUBTITLE){if(!this.initPTS[s.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(g.FRAG_LOADED,t)}}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){const{cea608Parser1:s,cea608Parser2:i}=this;if(!this.enabled||!s||!i)return;const{frag:a,samples:n}=t;if(a.type!==Je.MAIN||"NONE"!==this.closedCaptionsForLevel(a))for(let e=0;e<n.length;e++){const t=n[e].bytes;if(t){const a=this.extractCea608Data(t);s.addData(n[e].pts,a[0]),i.addData(n[e].pts,a[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:i,type:a}){const{media:n}=this;if(n&&!(n.currentTime<s)){if(!a||"video"===a){const{captionsTracks:e}=this;Object.keys(e).forEach(i=>nt(e[i],t,s))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==i){const{textTracks:e}=this;Object.keys(e).forEach(s=>nt(e[s],t,i))}}}extractCea608Data(e){const t=[[],[]],s=31&e[0];let i=2;for(let a=0;a<s;a++){const s=e[i++],a=127&e[i++],n=127&e[i++];if((0!==a||0!==n)&&0!=(4&s)){const e=3&s;0!==e&&1!==e||(t[e].push(a),t[e].push(n))}}return t}},audioStreamController:class extends gs{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",Je.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.ERROR,this.onError,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.ERROR,this.onError,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:a}){if("main"===s){const e=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:a},this.log(`InitPTS for cc: ${e} found from main: ${i}`),this.videoTrackCC=e,this.state===fs.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels)return this.startPosition=e,void(this.state=fs.STOPPED);const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Pi),t>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=fs.IDLE):(this.loadedmetadata=!1,this.state=fs.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case fs.IDLE:this.doTickIdle();break;case fs.WAITING_TRACK:{var e;const{levels:t,trackId:s}=this,i=null==t?void 0:null==(e=t[s])?void 0:e.details;if(i){if(this.waitForCdnTuneIn(i))break;this.state=fs.WAITING_INIT_PTS}break}case fs.FRAG_LOADING_WAITING_RETRY:{var t;const e=performance.now(),s=this.retryDate;(!s||e>=s||null!=(t=this.media)&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=fs.IDLE);break}case fs.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:i,complete:a}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=fs.FRAG_LOADING;const e={frag:t,part:s,payload:i.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),a&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),s=es.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);xt(s.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${s.end} is needed`),this.clearWaitingFragment())}}else this.state=fs.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=fs.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:s,trackId:i}=this,a=e.config;if(null==t||!t[i])return;if(!s&&(this.startFragRequested||!a.startFragPrefetch))return;const n=t[i],r=n.details;if(!r||r.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(r))return void(this.state=fs.WAITING_TRACK);const o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,A.AUDIO,Je.AUDIO));const l=this.getFwdBufferInfo(o,Je.AUDIO);if(null===l)return;const{bufferedTrack:d,switchingTrack:c}=this;if(!c&&this._streamEnded(l,r))return e.trigger(g.BUFFER_EOS,{type:"audio"}),void(this.state=fs.ENDED);const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Je.MAIN),u=l.len,f=this.getMaxBufferLength(null==h?void 0:h.len);if(u>=f&&!c)return;const p=r.fragments[0].start;let m=l.end;if(c&&s){const e=this.getLoadPosition();d&&c.attrs!==d.attrs&&(m=e),r.PTSKnown&&e<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=p+.05)}let v=this.getNextFragment(m,r),y=!1;if(v&&this.isLoopLoading(v,m)&&(y=!!v.gap,v=this.getNextFragmentLoopLoading(v,r,l,Je.MAIN,f)),!v)return void(this.bufferFlushed=!0);const b=h&&v.start>h.end+r.targetduration;if(b||(null==h||!h.len)&&l.len){const e=this.fragmentTracker.getBufferedFrag(v.start,Je.MAIN);if(null===e)return;if(y||(y=!!e.gap||!!b&&0===h.len),b&&!y||y&&l.nextStart&&l.nextStart<e.end)return}this.loadFragment(v,n,m)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new mt(e))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?this.setInterval(Pi):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=fs.IDLE):(this.switchingTrack=null,this.bufferedTrack=t,this.state=fs.STOPPED),this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.bufferedTrack=null,this.switchingTrack=null}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(g.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:i}=this,{details:a,id:n}=t;if(!i)return void this.warn(`Audio tracks were reset while loading level ${n}`);this.log(`Track ${n} loaded [${a.startSN},${a.endSN}],duration:${a.totalduration}`);const r=i[n];let o=0;if(a.live||null!=(s=r.details)&&s.live){const e=this.mainDetails;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed||!e)return;!r.details&&a.hasProgramDateTime&&e.hasProgramDateTime?(rs(a,e),o=a.fragments[0].start):o=this.alignPlaylists(a,r.details)}r.details=a,this.levelLastLoaded=n,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(r.details,o),this.state!==fs.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=fs.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:a}=e,{config:n,trackId:r,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);const l=o[r];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(s.start);const c=n.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Ti(this.hls,Je.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[s.cc],f=null==(t=s.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=i?i.index:-1,n=-1!==t,r=new ts(s.level,s.sn,s.stats.chunkCount,a.byteLength,t,n);h.push(a,f,c,"",s,i,d.totalduration,e,r,u)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${d.startSN} ,${d.endSN}],track ${r}`);const{cache:e}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new Ci,complete:!1};e.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=fs.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:i}=t;var a;if(s.type===Je.AUDIO)if(this.fragContextChanged(s))this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==s.sn){this.fragPrevious=s;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(g.AUDIO_TRACK_SWITCHED,c({},e)))}this.fragBufferedComplete(s,i)}else this.loadedmetadata||s.type!==Je.MAIN||null!=(a=this.videoBuffer||this.media)&&a.buffered.length&&(this.loadedmetadata=!0)}onError(e,t){var s;if(t.fatal)this.state=fs.ERROR;else switch(t.details){case m.FRAG_GAP:case m.FRAG_PARSING_ERROR:case m.FRAG_DECRYPT_ERROR:case m.FRAG_LOAD_ERROR:case m.FRAG_LOAD_TIMEOUT:case m.KEY_LOAD_ERROR:case m.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Je.AUDIO,t);break;case m.AUDIO_TRACK_LOAD_ERROR:case m.AUDIO_TRACK_LOAD_TIMEOUT:case m.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==fs.WAITING_TRACK||(null==(s=t.context)?void 0:s.type)!==Qe.AUDIO_TRACK||(this.state=fs.IDLE);break;case m.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case m.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushed(e,{type:t}){t===A.AUDIO&&(this.bufferFlushed=!0,this.state===fs.ENDED&&(this.state=fs.IDLE))}_handleTransmuxComplete(e){var t;const s="audio",{hls:i}=this,{remuxResult:a,chunkMeta:n}=e,r=this.getCurrentContext(n);if(!r)return void this.resetWhenMissingContext(n);const{frag:o,part:l,level:d}=r,{details:c}=d,{audio:h,text:f,id3:p,initSegment:m}=a;if(!this.fragContextChanged(o)&&c){if(this.state=fs.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=m&&m.tracks&&(this._bufferInitSegment(m.tracks,o,n),i.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:o,id:s,tracks:m.tracks})),h){const{startPTS:e,endPTS:t,startDTS:s,endDTS:i}=h;l&&(l.elementaryStreams[A.AUDIO]={startPTS:e,endPTS:t,startDTS:s,endDTS:i}),o.setElementaryStreamInfo(A.AUDIO,e,t,s,i),this.bufferFragmentData(h,o,l,n)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=u({id:s,frag:o,details:c},p);i.trigger(g.FRAG_PARSING_METADATA,e)}if(f){const e=u({id:s,frag:o,details:c},f);i.trigger(g.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(e,t,s){if(this.state!==fs.PARSING)return;e.video&&delete e.video;const i=e.audio;if(!i)return;i.levelCodec=i.codec,i.id="audio",this.log(`Init audio buffer, container:${i.container}, codecs[parsed]=[${i.codec}]`),this.hls.trigger(g.BUFFER_CODECS,e);const a=i.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:t,part:null,chunkMeta:s,parent:t.type,data:a};this.hls.trigger(g.BUFFER_APPENDING,e)}this.tick()}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);var a;this.fragCurrent=e,this.switchingTrack||i===Vt.NOT_LOADED||i===Vt.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e,t):null!=(a=t.details)&&a.live&&!this.initPTS[e.cc]?(this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=fs.WAITING_INIT_PTS):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}completeAudioSwitch(e){const{hls:t,media:s,bufferedTrack:i}=this,a=null==i?void 0:i.attrs,n=e.attrs;s&&a&&(a.CHANNELS!==n.CHANNELS||a.NAME!==n.NAME||a.LANGUAGE!==n.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(g.AUDIO_TRACK_SWITCHED,c({},e))}},audioTrackController:class extends Nt{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:i,details:a}=t,n=this.tracksInGroup[s];if(!n||n.groupId!==i)return void this.warn(`Track with id:${s} and group:${i} not found in active group ${n.groupId}`);const r=n.details;n.details=t.details,this.log(`audio-track ${s} "${n.name}" lang:${n.lang} group:${i} loaded [${a.startSN}-${a.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,r)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(null==t||!t.audioGroupIds)return;const s=t.audioGroupIds[t.urlId];if(this.groupId!==s){this.groupId=s||null;const e=this.tracks.filter(e=>!s||e.groupId===s);this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=e;const t={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group:${s}`),this.hls.trigger(g.AUDIO_TRACKS_UPDATED,t),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&t.context.type===Qe.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(t))}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn("Invalid id passed to audio-track controller");this.clearTimer();const s=this.currentTrack;t[this.trackId];const i=t[e],{groupId:a,name:n}=i;if(this.log(`Switching to audio-track ${e} "${n}" lang:${i.lang} group:${a}`),this.trackId=e,this.currentTrack=i,this.selectDefaultTrack=!1,this.hls.trigger(g.AUDIO_TRACK_SWITCHING,c({},i)),i.details&&!i.details.live)return;const r=this.switchParams(i.url,null==s?void 0:s.details);this.loadPlaylist(r)}selectInitialTrack(){const e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(-1!==t)this.setAudioTrack(t);else{const t=new Error(`No track found for running audio group-ID: ${this.groupId} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(g.ERROR,{type:p.MEDIA_ERROR,details:m.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const i=t[s];if(!this.selectDefaultTrack||i.default){if(!e||e.attrs["STABLE-RENDITION-ID"]===i.attrs["STABLE-RENDITION-ID"])return i.id;if(e.name===i.name&&e.lang===i.lang)return i.id}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const s=t.id,i=t.groupId;let a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`loading audio-track playlist ${s} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(g.AUDIO_TRACK_LOADING,{url:a,id:s,groupId:i,deliveryDirectives:e||null})}}},emeController:Na,cmcdController:Va,contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=k.log.bind(k,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.ERROR,this.onError,this))}startLoad(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){const e=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;null!==s&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((null==s?void 0:s.action)===Ft.SendAlternateToPenaltyBox&&s.flags===Ot.MoveAllAlternatesMatchingHost){let e=this.pathwayPriority;const t=this.pathwayId;this.penalizedPathways[t]||(this.penalizedPathways[t]=performance.now()),!e&&this.levels&&(e=this.levels.reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])),e&&e.length>1&&(this.updatePathwayPriority(e),s.resolved=this.pathwayId!==t)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this.pathwayPriority=e;const s=this.penalizedPathways,i=performance.now();Object.keys(s).forEach(e=>{i-s[e]>za&&delete s[e]});for(let i=0;i<e.length;i++){const a=e[i];if(s[a])continue;if(a===this.pathwayId)return;const n=this.hls.nextLoadLevel,r=this.hls.levels[n];if((t=this.getLevelsForPathway(a)).length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,this.hls.trigger(g.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[n];r&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==r.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==r.bitrate&&this.log(`Unstable Pathways change from bitrate ${r.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=n);break}}}clonePathways(e){const t=this.levels;if(!t)return;const s={},i={};e.forEach(e=>{const{ID:a,"BASE-ID":n,"URI-REPLACEMENT":r}=e;if(t.some(e=>e.pathwayId===a))return;const o=this.getLevelsForPathway(n).map(e=>{const t=u({},e);t.details=void 0,t.url=Ha(e.uri,e.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",r);const n=new w(e.attrs);n["PATHWAY-ID"]=a;const o=n.AUDIO&&`${n.AUDIO}_clone_${a}`,l=n.SUBTITLES&&`${n.SUBTITLES}_clone_${a}`;o&&(s[n.AUDIO]=o,n.AUDIO=o),l&&(i[n.SUBTITLES]=l,n.SUBTITLES=l),t.attrs=n;const d=new mt(t);return Bt(d,"audio",o),Bt(d,"text",l),d});t.push(...o),Ka(this.audioTracks,s,r,a),Ka(this.subtitleTracks,i,r,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;let i;this.loader&&this.loader.destroy(),this.loader=new s(t);try{i=new self.URL(e)}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${e}`)}if("data:"!==i.protocol){const e=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+e)}const a={responseType:"json",url:i.href},n=t.steeringManifestLoadPolicy.default,r=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},l={onSuccess:(e,t,s,a)=>{this.log(`Loaded steering manifest: "${i}"`);const n=e.data;if(1!==n.VERSION)return void this.log(`Steering VERSION ${n.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=n.TTL;const{"RELOAD-URI":r,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=n;if(r)try{this.uri=new self.URL(r,i).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${r}`)}this.scheduleRefresh(this.uri||s.url),o&&this.clonePathways(o),l&&this.updatePathwayPriority(l)},onError:(e,t,s,i)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let a=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,a);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(a=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,s)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(a,o,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(()=>{this.loadSteeringManifest(e)},t)}}});function en(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(en):Object.keys(e).reduce((t,s)=>(t[s]=en(e[s]),t),{}):e}function tn(e){const t=e.loader;if(t!==qa&&t!==Wa)k.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=qa,e.progressive=!0,e.enableSoftwareAES=!0,k.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class sn{static get version(){return"1.4.0"}static isSupported(){return function(){const e=ps();if(!e)return!1;const t=ms(),s=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!s&&!!i}()}static get Events(){return g}static get ErrorTypes(){return p}static get ErrorDetails(){return m}static get DefaultConfig(){return sn.defaultConfig?sn.defaultConfig:Za}static set DefaultConfig(e){sn.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new _i,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,function(e,t){if(self.console&&!0===e||"object"==typeof e){_(e,"debug","log","info","warn","error");try{b.log(`Debug logs enabled for "${t}" in hls.js version 1.4.0`)}catch(e){b=y}}else b=y}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=en(e),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{const a=`${"level"===e?"playlist":e}LoadPolicy`,n=void 0===t[a],r=[];i.forEach(i=>{const o=`${e}Loading${i}`,l=t[o];if(void 0!==l&&n){r.push(o);const e=s[a].default;switch(t[a]={default:e},i){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),r.length&&k.warn(`hls.js config: "${r.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(t[a])}`)}),c(c({},s),t)}(sn.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&tn(t);const{abrController:s,bufferController:i,capLevelController:a,errorController:n,fpsController:r}=t,o=new n(this),l=this.abrController=new s(this),d=this.bufferController=new i(this),h=this.capLevelController=new a(this),u=new r(this),f=new tt(this),p=new ht(this),m=t.contentSteeringController,v=m?new m(this):null,T=this.levelController=new Ut(this,v),S=new zt(this),w=new Qt(this.config),E=this.streamController=new Li(this,S,w);h.setStreamController(E),u.setStreamController(E);const I=[f,T,E];v&&I.splice(1,0,v),this.networkControllers=I;const D=[l,d,h,u,p,S];this.audioTrackController=this.createController(t.audioTrackController,I);const A=t.audioStreamController;A&&I.push(new A(this,S,w)),this.subtitleTrackController=this.createController(t.subtitleTrackController,I);const L=t.subtitleStreamController;L&&I.push(new L(this,S,w)),this.createController(t.timelineController,D),w.emeController=this.emeController=this.createController(t.emeController,D),this.cmcdController=this.createController(t.cmcdController,D),this.latencyController=this.createController(ut,D),this.coreComponents=D,I.push(o);const R=o.onErrorOut;"function"==typeof R&&this.on(g.ERROR,R,o)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,i){this._emitter.off(e,t,s,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){k.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(g.ERROR,{type:p.OTHER_ERROR,details:m.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){k.log("destroy"),this.trigger(g.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){k.log("attachMedia"),this._media=e,this.trigger(g.MEDIA_ATTACHING,{media:e})}detachMedia(){k.log("detachMedia"),this.trigger(g.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,i=this.url=l.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});k.log(`loadSource:${i}`),t&&s&&s!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(g.MANIFEST_LOADING,{url:e})}startLoad(e=-1){k.log(`startLoad(${e})`),this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){k.log("stopLoad"),this.networkControllers.forEach(e=>{e.stopLoad()})}swapAudioCodec(){k.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){k.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e,t=0){this.levelController.removeLevel(e,t)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){k.log(`set currentLevel:${e}`),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){k.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){k.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){k.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){return this.levelController.startLevel}set startLevel(e){k.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(k.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e)}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ft.indexOf(e)>-1&&(this._maxHdcpLevel=e)}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let i=0;i<s;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let i;if(i=-1===t&&e&&e.length?e.length-1:t,s)for(let t=i;t--;){const i=e[t].attrs["HDCP-LEVEL"];if(i&&i<=s)return t}return i}get nextAutoLevel(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)}set nextAutoLevel(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}sn.defaultConfig=void 0},UHIj:function(e,t){},VU7S:function(e,t){},a74R:function(e,t){},cvxZ:function(e,t){},eFIO:function(e,t){},faL3:function(e,t){},"j+mA":function(e,t){},jvML:function(e,t){},"k9/Y":function(e,t){},lkBL:function(e,t){},"mT+7":function(e,t){},n5LF:function(e,t){},oPea:function(e,t){},"pe1/":function(e,t){},q6vj:function(e,t){},tvR6:function(e,t){},"u/6E":function(e,t){},zSuI:function(e,t){}},["NHnr"]);
2
+ //# sourceMappingURL=app.eff1c2200a448936b027.js.map