From 709068866a834cb99d629634625ba3a4358258b3 Mon Sep 17 00:00:00 2001 From: Andrew S Date: Sun, 19 Nov 2023 22:15:11 -0600 Subject: [PATCH] Upload Web version --- built/web/LICENSE.md | 179 + built/web/i18n.mjs | 8 + built/web/icon128.png | Bin 0 -> 8437 bytes built/web/options/.DS_Store | Bin 0 -> 6148 bytes .../web/options/defaults/DefaultKeybinds.mjs | 25 + built/web/options/defaults/DefaultOptions.mjs | 21 + .../defaults/DefaultSubtitlesSettings.mjs | 9 + built/web/options/options.css | 230 + built/web/options/options.html | 144 + built/web/options/options.mjs | 228 + built/web/player/.DS_Store | Bin 0 -> 10244 bytes built/web/player/FastStreamClient.mjs | 757 + built/web/player/SubtitleTrack.mjs | 64 + built/web/player/VideoSource.mjs | 97 + built/web/player/analyzer/VideoAligner.mjs | 479 + built/web/player/analyzer/VideoAnalyzer.mjs | 349 + built/web/player/analyzer/dHash.mjs | 46 + built/web/player/assets/.DS_Store | Bin 0 -> 6148 bytes .../web/player/assets/coloris/css/coloris.css | 577 + built/web/player/assets/fluidplayer/.DS_Store | Bin 0 -> 6148 bytes .../player/assets/fluidplayer/css/colors.css | 63 + .../assets/fluidplayer/css/fluidplayer.css | 2485 + .../fluidplayer/static/fluid-spinner.svg | 16 + .../assets/fluidplayer/static/icons.svg | 122 + .../fluidplayer/static/skip-backward.svg | 5 + .../fluidplayer/static/skip-forward.svg | 18 + built/web/player/enums/AnalyzerEvents.mjs | 5 + .../web/player/enums/DefaultPlayerEvents.mjs | 102 + built/web/player/enums/DownloadStatus.mjs | 7 + built/web/player/enums/PlayerModes.mjs | 9 + built/web/player/main.mjs | 231 + built/web/player/modules/.DS_Store | Bin 0 -> 10244 bytes built/web/player/modules/FSBlob.mjs | 49 + built/web/player/modules/LargeBuffer.mjs | 66 + built/web/player/modules/Localize.mjs | 257 + built/web/player/modules/StreamSaver.mjs | 122 + built/web/player/modules/coloris.mjs | 8 + built/web/player/modules/dash.mjs | 62185 ++++++++++++++++ .../web/player/modules/dash2mp4/dash2mp4.mjs | 264 + built/web/player/modules/decrypter-worker.js | 807 + built/web/player/modules/eventemitter.mjs | 127 + built/web/player/modules/hls.mjs | 25090 +++++++ .../player/modules/hls2mp4/MP4Generator.mjs | 769 + built/web/player/modules/hls2mp4/hls2mp4.mjs | 262 + .../web/player/modules/hls2mp4/transmuxer.mjs | 198 + built/web/player/modules/knob.mjs | 720 + built/web/player/modules/mp4box.mjs | 7741 ++ built/web/player/modules/pako.mjs | 4 + built/web/player/modules/vad/.DS_Store | Bin 0 -> 6148 bytes built/web/player/modules/vad/LICENSE.md | 43 + built/web/player/modules/vad/ort-wasm.wasm | Bin 0 -> 5972313 bytes built/web/player/modules/vad/ort.mjs | 2835 + built/web/player/modules/vad/silero_vad.ort | Bin 0 -> 1921856 bytes built/web/player/modules/vad/vad.mjs | 260 + built/web/player/modules/vad/vad.worklet.mjs | 84 + built/web/player/modules/vtt.mjs | 4 + built/web/player/modules/yt.mjs | 4 + built/web/player/network/.DS_Store | Bin 0 -> 6148 bytes built/web/player/network/DownloadEntry.mjs | 125 + built/web/player/network/DownloadManager.mjs | 275 + built/web/player/network/IndexedDBManager.mjs | 156 + built/web/player/network/SpeedTracker.mjs | 35 + .../web/player/network/StandardDownloader.mjs | 79 + built/web/player/network/XHRLoader.mjs | 290 + built/web/player/player.html | 204 + built/web/player/players/.DS_Store | Bin 0 -> 6148 bytes .../web/player/players/DirectVideoPlayer.mjs | 92 + built/web/player/players/Fragment.mjs | 24 + built/web/player/players/PlayerLoader.mjs | 21 + .../web/player/players/dash/DashFragment.mjs | 24 + .../players/dash/DashFragmentRequester.mjs | 56 + built/web/player/players/dash/DashLoader.mjs | 108 + built/web/player/players/dash/DashPlayer.mjs | 329 + built/web/player/players/hls/HLSDecrypter.mjs | 42 + built/web/player/players/hls/HLSFragment.mjs | 21 + .../players/hls/HLSFragmentRequester.mjs | 109 + built/web/player/players/hls/HLSLoader.mjs | 165 + built/web/player/players/hls/HLSPlayer.mjs | 338 + built/web/player/players/mp4/MP4Fragment.mjs | 17 + .../players/mp4/MP4FragmentRequester.mjs | 56 + built/web/player/players/mp4/MP4Player.mjs | 610 + .../players/mp4/SourceBufferWrapper.mjs | 68 + built/web/player/players/yt/YTPlayer.mjs | 139 + built/web/player/ui/.DS_Store | Bin 0 -> 6148 bytes built/web/player/ui/DOMElements.mjs | 58 + built/web/player/ui/InterfaceController.mjs | 1273 + built/web/player/ui/KeybindManager.mjs | 147 + built/web/player/ui/OptionsWindow.mjs | 45 + built/web/player/ui/SourcesBrowser.mjs | 223 + .../web/player/ui/audio/AudioChannelMixer.mjs | 297 + built/web/player/ui/audio/AudioCompressor.mjs | 366 + .../player/ui/audio/AudioConfigManager.mjs | 356 + built/web/player/ui/audio/AudioEqualizer.mjs | 555 + .../ui/audio/config/AudioChannelControl.mjs | 19 + .../audio/config/AudioCompressionControl.mjs | 25 + .../player/ui/audio/config/AudioEQNode.mjs | 19 + .../player/ui/audio/config/AudioProfile.mjs | 42 + .../ui/subtitles/OpenSubtitlesSearch.mjs | 361 + .../player/ui/subtitles/SubtitleSyncer.mjs | 294 + .../player/ui/subtitles/SubtitlesManager.mjs | 403 + .../ui/subtitles/SubtitlesSettingsManager.mjs | 103 + built/web/player/utils/AudioUtils.mjs | 51 + built/web/player/utils/BlobManager.mjs | 75 + built/web/player/utils/EnvUtils.mjs | 28 + .../player/utils/FastStreamArchiveUtils.mjs | 123 + built/web/player/utils/InterfaceUtils.mjs | 9 + built/web/player/utils/RequestUtils.mjs | 139 + built/web/player/utils/StringUtils.mjs | 159 + built/web/player/utils/SubtitleUtils.mjs | 108 + built/web/player/utils/URLUtils.mjs | 78 + built/web/player/utils/Utils.mjs | 103 + built/web/player/utils/VideoUtils.mjs | 71 + built/web/player/utils/WebUtils.mjs | 216 + 113 files changed, 117304 insertions(+) create mode 100644 built/web/LICENSE.md create mode 100644 built/web/i18n.mjs create mode 100644 built/web/icon128.png create mode 100644 built/web/options/.DS_Store create mode 100644 built/web/options/defaults/DefaultKeybinds.mjs create mode 100644 built/web/options/defaults/DefaultOptions.mjs create mode 100644 built/web/options/defaults/DefaultSubtitlesSettings.mjs create mode 100644 built/web/options/options.css create mode 100644 built/web/options/options.html create mode 100644 built/web/options/options.mjs create mode 100644 built/web/player/.DS_Store create mode 100644 built/web/player/FastStreamClient.mjs create mode 100644 built/web/player/SubtitleTrack.mjs create mode 100644 built/web/player/VideoSource.mjs create mode 100644 built/web/player/analyzer/VideoAligner.mjs create mode 100644 built/web/player/analyzer/VideoAnalyzer.mjs create mode 100644 built/web/player/analyzer/dHash.mjs create mode 100644 built/web/player/assets/.DS_Store create mode 100644 built/web/player/assets/coloris/css/coloris.css create mode 100644 built/web/player/assets/fluidplayer/.DS_Store create mode 100644 built/web/player/assets/fluidplayer/css/colors.css create mode 100644 built/web/player/assets/fluidplayer/css/fluidplayer.css create mode 100644 built/web/player/assets/fluidplayer/static/fluid-spinner.svg create mode 100644 built/web/player/assets/fluidplayer/static/icons.svg create mode 100644 built/web/player/assets/fluidplayer/static/skip-backward.svg create mode 100644 built/web/player/assets/fluidplayer/static/skip-forward.svg create mode 100644 built/web/player/enums/AnalyzerEvents.mjs create mode 100644 built/web/player/enums/DefaultPlayerEvents.mjs create mode 100644 built/web/player/enums/DownloadStatus.mjs create mode 100644 built/web/player/enums/PlayerModes.mjs create mode 100644 built/web/player/main.mjs create mode 100644 built/web/player/modules/.DS_Store create mode 100644 built/web/player/modules/FSBlob.mjs create mode 100644 built/web/player/modules/LargeBuffer.mjs create mode 100644 built/web/player/modules/Localize.mjs create mode 100644 built/web/player/modules/StreamSaver.mjs create mode 100644 built/web/player/modules/coloris.mjs create mode 100644 built/web/player/modules/dash.mjs create mode 100644 built/web/player/modules/dash2mp4/dash2mp4.mjs create mode 100644 built/web/player/modules/decrypter-worker.js create mode 100644 built/web/player/modules/eventemitter.mjs create mode 100644 built/web/player/modules/hls.mjs create mode 100644 built/web/player/modules/hls2mp4/MP4Generator.mjs create mode 100644 built/web/player/modules/hls2mp4/hls2mp4.mjs create mode 100644 built/web/player/modules/hls2mp4/transmuxer.mjs create mode 100644 built/web/player/modules/knob.mjs create mode 100644 built/web/player/modules/mp4box.mjs create mode 100644 built/web/player/modules/pako.mjs create mode 100644 built/web/player/modules/vad/.DS_Store create mode 100644 built/web/player/modules/vad/LICENSE.md create mode 100755 built/web/player/modules/vad/ort-wasm.wasm create mode 100644 built/web/player/modules/vad/ort.mjs create mode 100644 built/web/player/modules/vad/silero_vad.ort create mode 100644 built/web/player/modules/vad/vad.mjs create mode 100644 built/web/player/modules/vad/vad.worklet.mjs create mode 100644 built/web/player/modules/vtt.mjs create mode 100644 built/web/player/modules/yt.mjs create mode 100644 built/web/player/network/.DS_Store create mode 100644 built/web/player/network/DownloadEntry.mjs create mode 100644 built/web/player/network/DownloadManager.mjs create mode 100644 built/web/player/network/IndexedDBManager.mjs create mode 100644 built/web/player/network/SpeedTracker.mjs create mode 100644 built/web/player/network/StandardDownloader.mjs create mode 100644 built/web/player/network/XHRLoader.mjs create mode 100644 built/web/player/player.html create mode 100644 built/web/player/players/.DS_Store create mode 100644 built/web/player/players/DirectVideoPlayer.mjs create mode 100644 built/web/player/players/Fragment.mjs create mode 100644 built/web/player/players/PlayerLoader.mjs create mode 100644 built/web/player/players/dash/DashFragment.mjs create mode 100644 built/web/player/players/dash/DashFragmentRequester.mjs create mode 100644 built/web/player/players/dash/DashLoader.mjs create mode 100644 built/web/player/players/dash/DashPlayer.mjs create mode 100644 built/web/player/players/hls/HLSDecrypter.mjs create mode 100644 built/web/player/players/hls/HLSFragment.mjs create mode 100644 built/web/player/players/hls/HLSFragmentRequester.mjs create mode 100644 built/web/player/players/hls/HLSLoader.mjs create mode 100644 built/web/player/players/hls/HLSPlayer.mjs create mode 100644 built/web/player/players/mp4/MP4Fragment.mjs create mode 100644 built/web/player/players/mp4/MP4FragmentRequester.mjs create mode 100644 built/web/player/players/mp4/MP4Player.mjs create mode 100644 built/web/player/players/mp4/SourceBufferWrapper.mjs create mode 100644 built/web/player/players/yt/YTPlayer.mjs create mode 100644 built/web/player/ui/.DS_Store create mode 100644 built/web/player/ui/DOMElements.mjs create mode 100644 built/web/player/ui/InterfaceController.mjs create mode 100644 built/web/player/ui/KeybindManager.mjs create mode 100644 built/web/player/ui/OptionsWindow.mjs create mode 100644 built/web/player/ui/SourcesBrowser.mjs create mode 100644 built/web/player/ui/audio/AudioChannelMixer.mjs create mode 100644 built/web/player/ui/audio/AudioCompressor.mjs create mode 100644 built/web/player/ui/audio/AudioConfigManager.mjs create mode 100644 built/web/player/ui/audio/AudioEqualizer.mjs create mode 100644 built/web/player/ui/audio/config/AudioChannelControl.mjs create mode 100644 built/web/player/ui/audio/config/AudioCompressionControl.mjs create mode 100644 built/web/player/ui/audio/config/AudioEQNode.mjs create mode 100644 built/web/player/ui/audio/config/AudioProfile.mjs create mode 100644 built/web/player/ui/subtitles/OpenSubtitlesSearch.mjs create mode 100644 built/web/player/ui/subtitles/SubtitleSyncer.mjs create mode 100644 built/web/player/ui/subtitles/SubtitlesManager.mjs create mode 100644 built/web/player/ui/subtitles/SubtitlesSettingsManager.mjs create mode 100644 built/web/player/utils/AudioUtils.mjs create mode 100644 built/web/player/utils/BlobManager.mjs create mode 100644 built/web/player/utils/EnvUtils.mjs create mode 100644 built/web/player/utils/FastStreamArchiveUtils.mjs create mode 100644 built/web/player/utils/InterfaceUtils.mjs create mode 100644 built/web/player/utils/RequestUtils.mjs create mode 100644 built/web/player/utils/StringUtils.mjs create mode 100644 built/web/player/utils/SubtitleUtils.mjs create mode 100644 built/web/player/utils/URLUtils.mjs create mode 100644 built/web/player/utils/Utils.mjs create mode 100644 built/web/player/utils/VideoUtils.mjs create mode 100644 built/web/player/utils/WebUtils.mjs diff --git a/built/web/LICENSE.md b/built/web/LICENSE.md new file mode 100644 index 00000000..076126b2 --- /dev/null +++ b/built/web/LICENSE.md @@ -0,0 +1,179 @@ +Copyright © 2017-2023 Andrew S (Andrews54757@gmail.com) + +All rights reserved. + +The software is provided AS-IS with no warranties of any kind. This has been a hobby project of mine for the past six years. Don't expect my code to be great. + +You must recieve permission before using my code. + +# OPEN SOURCE LICENSES: + +## Fluidplayer: MIT + +MIT License + +Copyright (c) 2020 Fluid Player and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## Photo Icon: MIT + +MIT License + +Copyright (c) 2020 Bitcoindesign + +https://www.svgrepo.com/svg/470415/photo + +## hls.js: Apache + +Copyright (c) 2017 Dailymotion (http://www.dailymotion.com) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project +are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls) + +That work is also covered by the Apache 2 License, following copyright: +Copyright (c) 2013-2015 Brightcove + + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +## mp4box.js: BSD 3 + +Copyright (c) 2012. Telecom ParisTech/TSI/MM/GPAC Cyril Concolato +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +## Dash.js: BSD + +The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license. + +**Copyright (c) 2015, Dash Industry Forum. +**All rights reserved.** + +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.** + +## Pakojs + +(The MIT License) + +Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +## videojs/vtt.js + +Copyright Brightcove, Inc. and contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +## kevincennis/Mix.js + +The MIT License (MIT) + +Copyright (c) 2014 Kevin Ennis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/built/web/i18n.mjs b/built/web/i18n.mjs new file mode 100644 index 00000000..6a24cb6b --- /dev/null +++ b/built/web/i18n.mjs @@ -0,0 +1,8 @@ +import {Localize} from './player/modules/Localize.mjs'; +window.getI18nMessage = Localize.getMessage; +document.querySelectorAll('[data-i18n]').forEach((elem) => { + elem.innerText = window.getI18nMessage(elem.dataset.i18n); +}); +document.querySelectorAll('[data-i18n-label]').forEach((elem) => { + elem.title = window.getI18nMessage(elem.dataset.i18nLabel); +}); diff --git a/built/web/icon128.png b/built/web/icon128.png new file mode 100644 index 0000000000000000000000000000000000000000..07adb221fd8695584ce708080a25407b06691f95 GIT binary patch literal 8437 zcmY+qby!qU+ciEz4P7Hr14AR--6caw2?EmHHFOT$Afa?9A)thSh~!X$k|GGw-7s_y zeEPi4@BMw>xvqWo-uGF1t-bbj{<`m-pz}_K1HC7w7N0SJrCi zZwG|ysVV|$Mkdn0RGp2fV={#zW`&W=SDt8TAGqJ9&Wr=wjS1Yya8^W zf6)Mdbb#dFp_`qL6+?iVt20C!^^~9fclqC$43ndekEbLbpTEC9ufGtlhqnWtfP{nuAHN`8v_7P5jACn=K;Wj!r&}3gFxig;#atk8UiN&fee?F3!e#J zk1U-O!;z;o*t~N5Jbhku6*`C>FWN88!4~1`HCuNsC&de&Yz9unmO@Sq4{up!)590`%%@wu zH-5aC^XTeG@(;e19`6(T%I5yE%88)`sbzJ(JJojBd3$(xHDK&eI2AOht2%tD%I^-Gjm86?)YR1Qke0?gyc{Ii3ZO&rB>DHkW%qpBFZbaK3ky6_{)hW34_krZ zGFz`9T&=CGVZc(EO#8mJ!`2VJBY7fjkLFauvNy!w&dxZ1i2f8>vCYn#sk*~t7>ftz zG`oCGZh`h@h-Pr`tuihdE}^c8^dRLmdCHJ^c*}g@#N``W`eljxb8l2*ZVkWE2j74} zs^38UN(sZ`#VG!7QDF9GA^ShL>O#H?YFS+Wc){j6+fVG)u)VWk)iy+`_DLH8R z^=wb#cE2&IX~}QS4gAIRkGEv>6=1N42uQ5dgW2tWFk2q2zR&A45FUv4EwpoV`%P{u zqmOO1XwKWuf8FzA4O>e6*1tpxue42uLZeajLmvLLGtyuZ5OjH zX*jvX%O}j0r(%zi`b$!!q@v_~BVEfs8$`nCb&WDw+a&y7id8)ka`bbB4j*xy+((@j zCOzgc;gRN-rx$wDo4nH|98=8y4hF^xW=~f%m*t@&4P%RMC$y3Rf6l{9VExRys;}4S z?^WtY@~PDC6}1j=43dzJj*k4cZG8bhIjs-JyT)*PWqvF@Wh}WbP?(wlbmRtMy&XKK z9=}v)*?GjO_E{a@9uY!D>v|1isQ4}EC+779nx6Hu`fEmlz>7=ZKt>D!3=gC{cxnN~lHF128ARu}8n~Th_=8NaH39mloNZL75y)}>n z&OA`)ebF*I8gFAy*$lg6I`50*rwAdyKd8du|vQ&u|Pj^}=7#v*OySS9{ zqZkC}APt`uKjva5iS__F6sE!vz1WUF!;jrQS7R6kswv4CixDv#OGrvwDE&b7zbR}9 zz4a4OphuYN(%+9e)?Fnm1FU7{jtJ-hY2m;yDW+O3Ub|PIy&k|P1;UulJl+vZ(g&WI z`a=H5d6O4BLb%*E=X?YBtw<*_wkr-ze%cU^1aTlfnQea*C50^ z&Yn<}nX9G0_C3fqOi6z+Lx4wzpA*5WiE>B)n-bv%sAq0-N`hd@LCDK_Y3JgZQmuq zY^Y4w$#rm=6IFH3@xxvc@QCkNiXZz{KC@2$CYT(mwL#O5a_`pMScbnK)y-!_$l~OAZ1y>3C^NNjORKNFd%sTl7$i^K_Gl0jJm(R|T zfNNL6E*u0BN-{L}{>}=X_)z`hv!4zTfRdsB=`;>9I8A$AGT26C4g1FN;!lA28b2Vk zso(4wU$5pvrij{|xPU`R9>@j(iHMbVWO^o6a zVCA9>^s8dSbE#4~p$nXMKrm8Z8pM0%Qxq$FKnZ;^1i<63eJ%kWKt=iRnU?FPzxeZ{ z(wReyyx89#qqh|1Vl-&1VZ7tdon1EBCVdBsUiU1tIRQ;p?p)G_rZnqYo@2|#;5=;E zR(~ZlA;WC3=R3RR*yc2#Q#;T7%4n|jIAc84%v2%EwHYxf^;0ScD`k(DMFvlQvMsTC zD2l{xlz3I-fPa(1RIXtBInDu?cKdzv5seZ(UkKKEM-p$>uU0|TklFoKG<_LzLGJK! zkxoULMC^}9Goj}hWBZ~18e~q&8Gk3O{wFmW4BjY`GJxG@s%~%X^4toMZ63tIw2fj2;bzHn_zJ}tCzST< zr+CrMP1+lSx4xmD{&}q1=&=i`lDDG2XSdMtB@%P1>+?RPdB9r|D-A+`rwTiG1_cU4 z8TdxFPduEv&){ZJ&ZaV7mH4VjKSMvae0_jxr}w5UJybaTzJj&0{(Au)kDPKFNs9g; z(>yCi8*O&(_?}#1%Do9$bA#kV}{u_q6~pr&?}k zY~KrgU(-!lqRO9sQDhS{O#MW_ZGAhknh0Pvd2H26Oypt2%!SxyWFzM8Dk~EC?Yo|? zO003yoq{nj6gfi8KmCP>Hf@b$|ca6#VA83w_{$IkJJ1%kb^{7)#~K zgVuD-CtV6QOhGqifzh<9)DGI^WMcQ2{{28r$R8QM4e-~kUs5My!>%^Wn24kjim%eY zzBNXaJIlU6a=A_kwCq-YxQ~vrC!2ok6)O_ToAiBI8#v$~WqD@=s1NMLepB_1BEg6}l_rv2PZYYB!;67h5 z6RTF8@l6VSWaa2r_|~(E;iR)Wp+u++Q!^UYw04YVeiAro6MuU;P<4?n(UzceMkJ_w zGrr+9Gd(rf^Qp(Z#&lG-@rA}2H|$3CcK_5kNcGo~r3S$`D8we1r)_^FB43|{TPn>b z>EogXUxyFVR<7~o{gfB-XEimm%sPqMxmhM=<$Jiae z_TB}L^@vh(lw9Mkh4UU7b3g+kcT)7c@kYBj)Fbe~#p2d0NY#T}&N*kH-yZdXhk>x{ zOZQA%5SeLM*`}MgSYZ3hLfS8`r(MIWv-JCN88>}IV)OMt!1_%IaW(eSoqZM$~eqiJ%l%sLNV@=Jyyi3D^MC-zVu@@@1R2zyJ2n^n|6JUk#LWW!)Wo10fbgF;He9JS;%>VX!~sW z1fG?K{_1ko7(1qoyM2N23QUMQAhDxNsX{YXaKwF?Hs13)nIs}t1Sl+{%$Gh1!V;f7 z5@hLCrc;Yu zRu-Vp+RmHZY5hJ6M)W7b&oQuPa@76HUlSP(+e2%#JKoVT>I(D&go z8N)85t<@s4_qQl$eWcI4xbN=d_ndFiCMDaGCmkdw3p0QC;;x_BW(`|v<=Nm7|7?_b zMQ~th@pz2z$y*oj9Q}Tm#b))}Yj-zPETudARw-7aP;;V=5?FgDTxdglgPkuwH((W+ zNmTC%rK*f=RXwAy$^ybbt&1oT0i0L1sg5?WFR8J{e@opO2$5EVOQ3V<(BK(8l$^z_VYNGt?0OfX;E ze#I^`;YJqetovygZY8r{CBRoV9B@WSSTUrEL@0{dVJ7>A*LT0K&$n0jS!D@Ou1O+#grij{n1fQRBrled8d7H) z_?x7LC*eUXI^8BdC%t=&2_3iWA5CH@0{MaSyyOT5Pc0Ngrmj~o#=FShDy4f1TrAZN z6TsHi>>H{KN-YPenVu48zMCB)uNeA>VyWFfPxsr#x|iK~Dx&ObqEVW0P=S_Pi=yai zB=!?>iI>A%i7JfyV@l~sO1K5kwQmizJ6dAKgaw15MA-xoj+8&7mrRY-$Sf#RFeLQ;E0-R6m#Pbk4UA zdACdAj37#oB+Y%jT*pzQi)K#g+H6-CE7(Ibq_Sy6QXG@a4-BZ0fOY8Fdv&ObY?Vw#AZex*Kg^CWpp-YMDLXR zD34Kt?e|Ai`%FXWr~ol|M6uw}COA)y9rL3Di`IL2c!~Nj7BhLE$Dht}xu6dfJ6(PjRjiQ}rYAqYIA(u9 zUl4r^cI=2i{EodF5nF1fV5!lH7y}A z%(hcYBu7}ZI={Z0<*=XvD-A*>MhRLh`{0m#9hE)&?T*z^QthSQOU1qVVD)i;XCGKx zLh87B;STl;_j)ILphpBr@C`wOczAtZYugq5_1oQ4&Uy;=krE#cOVBUJBuO9j{=F_XT~Xc^3r+g&;b%eV` zCOgpE&32&$1i03>jh|~vezg;kpC`aI)x;p_zDQ$TO~QA|9}mbqWseXkcEA9Qj2#v&iNu^BYO7o%?Dp=*Yb#DO z0{ss!0H;AC02mc~K>;BOneQjNfT`&V{ZXy&6~I1`>&m~_VQ&cM(K2|z?KZKd?FMFD z1a2bztL|smk)%7A;&=)Mi26@6wA&aY5x@!fy%`2u!p@}y;u7_&YSo2XE&Ry6oM)%A zCB%GIDrob?`zQzG`DM=56U^lAhb3$Pmb0G#fz9yijch5s0J1SGRVqj_wFPdDEkJDS zd0V(PujNgFg%npzs7=V7?BtRpvr6ZBlnpEE**-?6EFr1QeE@ok5iKM?k+X-Rq2YwT zuid?V$u3MJOyW%JQ9p!Q_Vm;1|6)KPEpF&&5s4}7qqK|!j6$)@gB8pmw~W;ACN#hL z=H_)a0J5xT!nXUsYk8pQ*bxT|Nt>!ySXDrZ6`U&?e&Do52nyvAG0pRTO~WB2jSr^} zedw)6KNG-@(#XZC*DM9owE8uGaULqtmQS+^?lN+Qs3D^W<6e!25vA_OZ#aZ9jggO* z6{bKqmKasR!1H&bEN#)z1^+9T%TSkX{S4xYxl` zj8$U~_O=3yD{ucW*t~eR&`whCw$OSW65FdZ3~d?cu}$kxd*p|W39?wcB|!}Zwr-v` z^xfzdyaOB1%{v4=dDJ6`vzV9|p15c8Dw33Nb)HyX{81PwVexmBB66=+lXyf)SXXa= zdsRsMtI&}kIXr*CXzY_^t@dTRE{EY^6AXGS#BSFRt8Fv13RfW95jDynz?3I4{-gPY zB7y!p^qVWvOw*g6-tt7t1fC<_;*M<2zhvM-*XKGb0BYjMtMiY=6Av=o;w@`vWOH7K zgQ64j4dZ~nP=Vx;|7^ky8r2g+Fa}%3os}Wdmnb=)k6E#7*uI*j<{OS21j!v44YE~rNf){W-{DQ*xx#JnVU)A99_%1if@5tMjo(? zcQeBl*rCIU>I1^^$}bvv#QN^0GRp+|0sQUye?+|e6?^UQQhwlj8sh-e!mNeG!yb9l zv6X;T)p$smV~tCKt5Tc+F%ZSLS}pR^>C?+jZen#l2UO2U!=2}uUtZ_<=HK7Vgg6UG zSG+Nl4Prw?nM-eE>9bk$EtS@2PTKuush9>roBpgd+K;r-QgtR6&Oo>7lJ*3IZt;vJ z?Rmz3nCU+j>fY!gUj@C?Nd@Apg&n9Y(?H%|i-SKTypw=EDyuZL8p&h-l}I(g7Ju*L z+SL{;J{GQdep^n|=b>@~RrRFA<0r8Fns1hh(6lZt9kYQc*;tmnXZv~GGe>=dD8Z}yaQ*YfO&j?ss8wxN zfGlNM*!|sgTB+hvYTh5Ua>-ahi}H=WAk_`RhL2)G2Q^q~Jy`N@$FwIebaBJ=PRtYR zqh1SD;=wwM5{Y#FuruEC%4n5w?$_i8)mHI2p>miy2XPpJ9dSaMnbBK$*~*ep$RIhR z>MUTSTnUF!ljBckmIwXk&R=uA@zdXEI#ze%HcyB94HfpeTu3Be$S|kGHr(zAa@qqd ztZ$yjmzLUh_5*s!4M!b=_c^i-Y$~{Dx@x6xFh+^47_O(SFS{_!@Fyzs@~W)?;x%Q4 z+cxG2v)7OB5%3{FTGo#^#v>=LilEX^?BU~ShCA!oH}K41;S^3M4+BEWh-yl9y&xj+ zorvZUspfL*uc*W3mD9B9itM$;I0!0K6d{Q;>>PfW%1JE2I@JEdt zh7flVL;kSZzX^f{x@DuZaEf8iR$(1dia`^Xs$AelQXEfutK*7%_gPq!{Y1S3KWMap zS`74AuWUGY`El08;iE5vwldvl?xRkv`5`Pj^D6NVyf?G4o<0q&+f$nLMmX8@Dmp#X z&3Oq{0>=HXk{3Yd7rs}Cqz~+s4}Z9=|Im2Jn%3_rLJ~Zp#<9BIzYJi?vs787k{oj% zH#+kKQmvs}rh~~>mq^^TYuS(c&CG=5Srikw&?mpmJohZz=bA@qOOpiWEMu>>uL1#t zm50|Fg&vSD+~b!=b)CfSatB*^1|JX(4Xjx z#gj;}lq|m2r8h4t$@HPwyXWBKi@3#bK^mZj5*~x8r<)T8IWh!q$}hKigjxbm-o{?t zFa^uoUT-v4I#0c6Ly_qt0XIPig+S?{{v>~mu|N3L(@3Iemcf2Jc{uRIC;s7)b1gE_ zKou-PK(un`^D^(iBqzoU!f;-L^(*XI{N)12DkU->>_PK1#7l5Jxg>~T6tBWtfkghwT9bbJye6N7|h5_#twl62HH0x9#Sl50B zSpjl>EA42H65!*AxX+zy5Ly2x&~Zn5=ok&``&^_izcGCx7ABV*!| zODXIH^u20%O7jPLJgP@QTBh`Fl!m+3I4G6fY{9Ra3VQ&kiUZ0}D7}>4tugtha_!zJ zT|cLmX*AhAB-%_t{MweKRE2{P`@!{b-YFP_0=2hei zvV{G&u#>8Zm?k57`B}N-Q(U7?8vJXxTxVp_r{cI{4;gzgsf(od%&T2}qC~#2M+;37 z+yyH%Nrt#{4J9L{At!W}EffhBWJ5rAIvdKR6OAI%jtF(`d^Rh{wNQp)mwCy8YJ0F^!r#!cj<*PbiGtKLRJ;nh>3rbRj*IIP|+8Z zSH_R$I$5bOofTq3$=}NXF^10oe^hPQW?xHFE56+84u7lK{a|`{Uq(31SdOaUl19Ss zcI;s0?3ea8HE#{4T0zrqi6?LUYQsk#NW7){&eI&1HfO?urOS$fh!^`B_I%x)apL78 zpR*3W+OGA1O@_qFVD@#TteNp6KS}$G4+sY^vFpqCA*o286xfm1t#$Ywxd)6otVx;Y zqu{V+8F26P7+hMZsJQ4?Q5}=sCE+xyuRHF%7S;9G!B*b0)fllt!EV5(ZU)&nVTx3# z!cUP%F*e+FlIOjxDwIKP| z;ml*`SR0v*JDjJ%k9We0PC_fRnfP2=4;I_7ynSxe34d;Nv$bD`=NYN!dh$hf|GSHz Nrt(a=R?#x@{{Wt|&ujny literal 0 HcmV?d00001 diff --git a/built/web/options/.DS_Store b/built/web/options/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..35b4035171bf9eb6cc6e9222371b96e7045a8fc1 GIT binary patch literal 6148 zcmeHKJx|0i47K4vl~`_M%uk>bBjr?nK_@mi%E!=CPlDU~=lD;Iyce5~iVO@0A!JMO zb7DJ5pVTB45nb*2T4X6A6&g`#6okV?*PaJ2fSTvn$skYiINaA=VWPh{#JyM2%dOnW zwS3zD&A8dxh7V6mF`Kb%*TcA`@8IkujhD~o<+%P^aodNw`&jeDmJS^Z1Ovf9Fc1v< zJOjA1Dbhc9n2!#qTmk_3jLrg^wFGmLW8*j(!UIuD1zM_l ziJ_K`@#Jxh<78;*qF#Kcul!cLXkH!jryMTY7={i8f`K^$`_^6Z{=dL4Q!Mi5DbWiC zf`Na=fG*muUE!nrZvFCkylWHM6&i(c6AcLL*&_fQo+HQEY5qhTagF0-$XPg^(}D32 M$b^In27ZBoS2}ks{{R30 literal 0 HcmV?d00001 diff --git a/built/web/options/defaults/DefaultKeybinds.mjs b/built/web/options/defaults/DefaultKeybinds.mjs new file mode 100644 index 00000000..513be84f --- /dev/null +++ b/built/web/options/defaults/DefaultKeybinds.mjs @@ -0,0 +1,25 @@ +export const DefaultKeybinds = { + 'HidePlayer': 'AltRight', + 'PlayPause': 'Space', + 'Fullscreen': 'KeyF', + 'VolumeUp': 'ArrowUp', + 'VolumeDown': 'ArrowDown', + 'SeekForward': 'ArrowRight', + 'SeekBackward': 'ArrowLeft', + 'SeekForwardSmall': 'Shift+ArrowRight', + 'SeekBackwardSmall': 'Shift+ArrowLeft', + 'SeekForwardLarge': 'Period', + 'SeekBackwardLarge': 'Comma', + 'UndoSeek': 'KeyZ', + 'RedoSeek': 'Shift+KeyZ', + 'ResetFailed': 'Backquote', + 'AddDownloader': 'Equal', + 'RemoveDownloader': 'Minus', + 'SkipIntroOutro': 'KeyS', + 'GoToStart': 'Digit0', + 'SubtrackDelete': 'Delete', + 'SubtrackShiftRight': 'BracketRight', + 'SubtrackShiftLeft': 'BracketLeft', + 'SubtrackDownload': 'KeyD', + 'SubtrackToggleResync': 'KeyR', +}; diff --git a/built/web/options/defaults/DefaultOptions.mjs b/built/web/options/defaults/DefaultOptions.mjs new file mode 100644 index 00000000..af93068a --- /dev/null +++ b/built/web/options/defaults/DefaultOptions.mjs @@ -0,0 +1,21 @@ +import {EnvUtils} from '../../player/utils/EnvUtils.mjs'; +import {DefaultKeybinds} from './DefaultKeybinds.mjs'; +export const DefaultOptions = { + playMP4URLs: false, + playStreamURLs: EnvUtils.isExtension(), + analyzeVideos: EnvUtils.isExtension() && EnvUtils.hasComputationalResources(), + downloadAll: true, + freeUnusedChannels: true, + autoEnableBestSubtitles: false, + autoEnableURLs: [], + keybinds: DefaultKeybinds, + videoBrightness: 1, + videoContrast: 1, + videoSaturation: 1, + videoGrayscale: 0, + videoSepia: 0, + videoInvert: 0, + videoHueRotate: 0, + maxSpeed: 300 * 1000 * 1000, + seekStepSize: 2, +}; diff --git a/built/web/options/defaults/DefaultSubtitlesSettings.mjs b/built/web/options/defaults/DefaultSubtitlesSettings.mjs new file mode 100644 index 00000000..d48927bc --- /dev/null +++ b/built/web/options/defaults/DefaultSubtitlesSettings.mjs @@ -0,0 +1,9 @@ +export const DefaultSubtitlesSettings = { + 'font-size': '40px', + 'color': 'rgba(255,255,255,1)', + 'background': 'rgba(10,10,10,0.3)', + 'default-lang': 'en', +}; +export const SubtitleColorSettings = [ + 'color', 'background', +]; diff --git a/built/web/options/options.css b/built/web/options/options.css new file mode 100644 index 00000000..fdba94d2 --- /dev/null +++ b/built/web/options/options.css @@ -0,0 +1,230 @@ +body { + padding: 15px; + font-family: sans-serif; + user-select: none; + font-size: 14px; + min-width: 450px; +} + + +/* total width */ +::-webkit-scrollbar { + background-color: transparent; + width: 4px; +} + +/* background of the scrollbar except button or resizer */ +::-webkit-scrollbar-track { + background-color: transparent; +} + +/* scrollbar itself */ +::-webkit-scrollbar-thumb { + background-color: rgb(100, 100, 100); + border-radius: 2px; + border: none; +} + +/* set button(top and bottom of the scrollbar) */ +::-webkit-scrollbar-button { + display: none; +} + +h1 { + font-size: 1.2em; + font-weight: bold; + margin-bottom: 10px; + margin-top: 20px; +} + +p { + margin-bottom: 15px; +} + +#submitter { + background-color: #222; + float: right; + width: 100px; + margin: 15px 0 15px 0; + border-radius: 6px; + color: white; + text-align: center; + padding: 10px; + cursor: pointer; + font-size: 1.2em; + font-weight: bold; + transition: background-color 0.3s; +} + +#submitter:hover { + background-color: #aaa; +} + +h2 { + clear: both; + font-size: 1em; + font-weight: bold; +} + +#format { + margin-right: 10px; + margin-bottom: 8px; + width: 500px; +} + +p.hint { + opacity: .7; + font-style: italic; +} + +#keybindslist { + margin-top: 5px; + display: flex; + flex-direction: column; + gap: 4px; +} + +.keybind-container { + display: grid; + align-items: center; + grid-template-columns: 1fr 1fr; + font-size: 14px; +} + +.keybind-name { + display: inline-block; + grid-column: 1; +} + +.keybind-input { + cursor: pointer; + border: 1px solid black; + border-radius: 3px; + text-align: center; + grid-column: 2; + padding: 2px 5px; +} + +.keybind-input:focus { + border: 1px solid blue; + color: rgb(0, 0, 255); +} + +#autoEnableURLs { + color: black; + background-color: transparent; + font-size: 12px; + border-radius: 3px; + padding: 2px 5px; + height: 20px; + outline: none; + border: 1px solid black; + width: 100%; + height: 150px; + resize: none; +} + +#autoEnableURLs:focus { + border: 1px solid blue; +} + +button { + background-color: rgba(255, 255, 255, 0.4); + border: 1px solid rgba(0, 0, 0, 0.4); + border-radius: 3px; + cursor: pointer; + padding: 2px 5px; +} + +button:hover { + color: rgb(0, 0, 255); + border: 1px solid rgb(0, 0, 255); +} + +.option { + display: flex; + align-items: center; + cursor: pointer; +} + +.option input { + position: relative; +} + +.option .label { + position: relative; + display: inline-block; + margin-left: 5px; +} + +.video-option { + display: flex; + padding: 4px 0px; + width: 100%; + max-width: 500px; + align-items: center; +} + +.video-option input { + position: relative; + margin: 0 5px; +} + +.video-option .label { + position: relative; + width: 130px; +} + +.video-option .range { + width: 100%; +} + +.video-option .number { + text-align: center; + width: 50px; +} + +#ratebox { + display: none; + border-radius: 5px; + border: 1px solid blue; + padding: 10px; + margin-bottom: 20px; +} + +.option.grid1 { + display: grid; + gap: 5px; + grid-template-columns: 20px 1fr; + align-items: center; +} + +.option.grid1 .label { + grid-column: 2; +} + +.option.grid1 input { + grid-column: 1; + text-align: center; +} + +.option.grid2 { + display: grid; + gap: 5px; + grid-template-columns: 1fr 150px; + align-items: center; +} + +.option.grid2 .label { + grid-column: 1; +} + +.option.grid2 .number { + grid-column: 2; + text-align: center; +} + +input[type="checkbox"] { + width: 16px; + height: 16px; +} \ No newline at end of file diff --git a/built/web/options/options.html b/built/web/options/options.html new file mode 100644 index 00000000..ac830f9e --- /dev/null +++ b/built/web/options/options.html @@ -0,0 +1,144 @@ + + + + + + + + + + +
+

+

+
    +
  • +
  • +
  • +
+

+ + +
+ +

+

+ + + +
+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +

+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +

+

+ +
+ +

+

+

Regex101

+ + +

+

+ + + + + \ No newline at end of file diff --git a/built/web/options/options.mjs b/built/web/options/options.mjs new file mode 100644 index 00000000..1b05d3d6 --- /dev/null +++ b/built/web/options/options.mjs @@ -0,0 +1,228 @@ +import {DefaultKeybinds} from '../options/defaults/DefaultKeybinds.mjs'; +import {EnvUtils} from '../player/utils/EnvUtils.mjs'; +import {StringUtils} from '../player/utils/StringUtils.mjs'; +import {Utils} from '../player/utils/Utils.mjs'; +import {WebUtils} from '../player/utils/WebUtils.mjs'; +let Options = {}; +const analyzeVideos = document.getElementById('analyzevideos'); +const playStreamURLs = document.getElementById('playstreamurls'); +const playMP4URLs = document.getElementById('playmp4urls'); +const downloadAll = document.getElementById('downloadall'); +const freeUnusedChannels = document.getElementById('freeunusedchannels'); +const keybindsList = document.getElementById('keybindslist'); +const autoEnableURLSInput = document.getElementById('autoEnableURLs'); +const autoSub = document.getElementById('autosub'); +const maxSpeed = document.getElementById('maxspeed'); +const seekStepSize = document.getElementById('seekstepsize'); +autoEnableURLSInput.setAttribute('autocapitalize', 'off'); +autoEnableURLSInput.setAttribute('autocomplete', 'off'); +autoEnableURLSInput.setAttribute('autocorrect', 'off'); +autoEnableURLSInput.setAttribute('spellcheck', false); +autoEnableURLSInput.placeholder = 'https://example.com/movie/\n~^https:\\/\\/example\\.com\\/(movie|othermovie)\\/'; +loadOptions(); +if (!EnvUtils.isExtension()) { + analyzeVideos.disabled = true; + playStreamURLs.disabled = true; + playMP4URLs.disabled = true; + autoSub.disabled = true; + autoEnableURLSInput.disabled = true; +} +async function loadOptions(newOptions) { + newOptions = newOptions || await Utils.getOptionsFromStorage(); + Options = newOptions; + downloadAll.checked = !!Options.downloadAll; + freeUnusedChannels.checked = !!Options.freeUnusedChannels; + analyzeVideos.checked = !!Options.analyzeVideos; + playStreamURLs.checked = !!Options.playStreamURLs; + playMP4URLs.checked = !!Options.playMP4URLs; + autoSub.checked = !!Options.autoEnableBestSubtitles; + maxSpeed.value = StringUtils.getSpeedString(Options.maxSpeed); + seekStepSize.value = Math.round(Options.seekStepSize * 100) / 100; + if (Options.keybinds) { + keybindsList.replaceChildren(); + for (const keybind in Options.keybinds) { + if (Object.hasOwn(Options.keybinds, keybind)) { + createKeybindElement(keybind); + } + } + } + document.querySelectorAll('.video-option').forEach((option) => { + const numberInput = option.querySelector('input.number'); + const rangeInput = option.querySelector('input.range'); + const unit = option.dataset.unit || '%'; + const unitMultiplier = parseInt(option.dataset.multiplier || 100); + const optionKey = option.dataset.option; + const val = Math.round(Options[optionKey] * unitMultiplier); + rangeInput.value = val; + numberInput.value = val + unit; + }); + autoEnableURLSInput.value = Options.autoEnableURLs.join('\n'); +} +document.querySelectorAll('.option').forEach((option) => { + option.addEventListener('click', (e) => { + if (e.target.tagName !== 'INPUT') { + const input = option.querySelector('input'); + input.click(); + } + }); + WebUtils.setupTabIndex(option.querySelector('input')); +}); +document.querySelectorAll('.video-option').forEach((option) => { + const numberInput = option.querySelector('input.number'); + const rangeInput = option.querySelector('input.range'); + const unit = option.dataset.unit || '%'; + const unitMultiplier = parseInt(option.dataset.multiplier || 100); + const optionKey = option.dataset.option; + function numberInputChanged() { + rangeInput.value = parseInt(numberInput.value.replace(unit, '')) || 0; + Options[optionKey] = parseInt(rangeInput.value) / unitMultiplier; + optionChanged(); + } + function rangeInputChanged() { + numberInput.value = rangeInput.value + unit; + Options[optionKey] = parseInt(rangeInput.value) / unitMultiplier; + optionChanged(); + } + numberInput.addEventListener('change', numberInputChanged); + numberInput.addEventListener('input', numberInputChanged); + rangeInput.addEventListener('change', rangeInputChanged); + rangeInput.addEventListener('input', rangeInputChanged); +}); +function createKeybindElement(keybind) { + const containerElement = document.createElement('div'); + containerElement.classList.add('keybind-container'); + const keybindNameElement = document.createElement('div'); + keybindNameElement.classList.add('keybind-name'); + const keybindName = keybind.replace(/([A-Z])/g, ' $1').trim(); + keybindNameElement.textContent = keybindName; + containerElement.appendChild(keybindNameElement); + const keybindInput = document.createElement('div'); + keybindInput.classList.add('keybind-input'); + keybindInput.tabIndex = 0; + keybindInput.name = keybindName; + keybindInput.textContent = Options.keybinds[keybind]; + keybindInput.addEventListener('keydown', (e) => { + if (e.key === 'Tab') { + return; + } else if (e.key === 'Escape') { + keybindInput.textContent = Options.keybinds[keybind] = 'None'; + optionChanged(); + keybindInput.blur(); + return; + } + e.stopPropagation(); + e.preventDefault(); + keybindInput.textContent = WebUtils.getKeyString(e); + Options.keybinds[keybind] = keybindInput.textContent; + optionChanged(); + }); + keybindInput.addEventListener('keyup', (e) => { + e.stopPropagation(); + e.preventDefault(); + }); + keybindInput.addEventListener('click', (e) => { + keybindInput.textContent = 'Press a key'; + }); + keybindInput.addEventListener('blur', (e) => { + keybindInput.textContent = Options.keybinds[keybind]; + }); + containerElement.appendChild(keybindInput); + keybindsList.appendChild(containerElement); +} +document.getElementById('welcome').href = chrome?.runtime?.getURL('welcome.html') || './../welcome.html'; +playMP4URLs.addEventListener('change', () => { + Options.playMP4URLs = playMP4URLs.checked; + optionChanged(); +}); +autoSub.addEventListener('change', () => { + Options.autoEnableBestSubtitles = autoSub.checked; + optionChanged(); +}); +playStreamURLs.addEventListener('change', () => { + Options.playStreamURLs = playStreamURLs.checked; + optionChanged(); +}); +analyzeVideos.addEventListener('change', () => { + Options.analyzeVideos = analyzeVideos.checked; + optionChanged(); +}); +downloadAll.addEventListener('change', () => { + Options.downloadAll = downloadAll.checked; + optionChanged(); +}); +freeUnusedChannels.addEventListener('change', () => { + Options.freeUnusedChannels = freeUnusedChannels.checked; + optionChanged(); +}); +maxSpeed.addEventListener('change', () => { + // parse value, number unit/s + Options.maxSpeed = StringUtils.getSpeedValue(maxSpeed.value); + maxSpeed.value = StringUtils.getSpeedString(Options.maxSpeed); + optionChanged(); +}); +seekStepSize.addEventListener('change', () => { + Options.seekStepSize = parseFloat(seekStepSize.value); + optionChanged(); +}); +document.getElementById('resetdefault').addEventListener('click', () => { + Options.keybinds = JSON.parse(JSON.stringify(DefaultKeybinds)); + keybindsList.replaceChildren(); + for (const keybind in Options.keybinds) { + if (Object.hasOwn(Options.keybinds, keybind)) { + createKeybindElement(keybind); + } + } + optionChanged(); +}); +WebUtils.setupTabIndex(document.getElementById('resetdefault')); +autoEnableURLSInput.addEventListener('input', (e) => { + Options.autoEnableURLs = autoEnableURLSInput.value.split('\n').map((o)=>o.trim()).filter((o)=>o.length); + optionChanged(); +}); +function optionChanged() { + if (EnvUtils.isExtension()) { + chrome?.runtime?.sendMessage({ + type: 'options', + options: JSON.stringify(Options), + }); + } else { + window.postMessage({ + type: 'options', + options: JSON.stringify(Options), + }, '*'); + localStorage.setItem('options', JSON.stringify(Options)); + } +} +if (EnvUtils.isExtension()) { +// Load options on options event + chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.type === 'options') { + loadOptions(JSON.parse(request.options)); + } + }); + const ratebox = document.getElementById('ratebox'); + document.getElementById('rate').addEventListener('click', (e) => { + chrome?.storage?.local?.set({ + rateus: 'yes', + }); + ratebox.style.display = 'none'; + let url = 'https://addons.mozilla.org/en-US/firefox/addon/faststream/reviews/'; + // SPLICER:FIREFOX:REMOVE_START + url = 'https://chromewebstore.google.com/u/1/detail/faststream-video-player/kkeakohpadmbldjaiggikmnldlfkdfog/reviews'; + // SPLICER:FIREFOX:REMOVE_END + chrome?.tabs?.create({ + url, + }); + }); + document.getElementById('norate').addEventListener('click', (e) => { + chrome.storage.local.set({ + rateus: 'no', + }); + ratebox.style.display = 'none'; + }); + chrome.storage.local.get('rateus', (result) => { + if (!result || !result.rateus) { + ratebox.style.display = 'block'; + } + }); +} diff --git a/built/web/player/.DS_Store b/built/web/player/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..604c01a157b55d605cea8c617d9cdf71c4e2c9fd GIT binary patch literal 10244 zcmeHMYitx%6uxKrnxWHn3I*!g!a~(5G}2OD1%d4Y>i5;e|jX3pGu z&bjBCZ_b&yca{(W4GE=&5I-S=$DK+^#KQy|)zf|4#yLHeC;|Nm*-iEkmBjSkn&3EV zuft=&W58p;W58p;W8mMw0KT*7#^*EX9X$p-20R8v8KBPxKkifp967?I{pi4hy#zp+ zjotQ!=eQ2Aef*9LIC6wZ+ZD%Ts|Rpg!C7Jeb4R_OnxhOja)e3dPJp=+a3X`VLIFEE z`uS~h0s$tyqsM^9z<37e+MOpdF>u$@*Y6QC+Rw}fE>C0=HJh5kx*4XrlQXtPr*xmL zpV&_MOLqNzHNml%BRCYvMNAg{R1znaVny_@Y3j88T?+cKVbl@srl4K=bf9&GO}%fl z+CVdG#z0PH;{pgDQh+%K%^(R9C6)^X5x2Xw=@^ck+oa9!u`#6iN6j$=6I;0Av!`Mn zMmC9p2y{eZg$J#E=a!rb_v@M!udeWQdfg{0z$tVa^M99QdgJ*e$bv9HLA#7te^VpwFyVGIyDSQ9ZTp{r)?k{Eu2|4=f-&p7S*k6xP3$O`68)! z>a-G3?8cj6#I?ILHP$w$De=B8*@~!!q8Ys%NzKy2y4q^UQMDMV1i|(yz0T+BOoX+8 zgcjc|Rq(vsTRzJtZc`A%CR3rKDblMvv!6T5=j)-G#+Zsn#c{Z)(kHfBh*gpu!}(RB z*t!$5MY5bw)it88O_#%}E-3qs)5r43H!@)FV4iNzenOR=23RjYlz?KJF0 z*@`#!s|G@P$BEsDkh-X@UQuj7Q>Ee}-&)^#Uiygdw)*6l+B}G9eBSBb%=7j=#eO>4 z8bynnqskVllr$r$VTIuBV}&AAr0A~*%wwk&tFN*X`?7_KK(%ASlX9|D4&<_J(!Cn}~{2qb*a1b7Zhv5-;6m$G3 z%yOFJ&%+CF1YU#_a1u_zYw#w#1!v%Gco(z&WB3BTf$!mmj9lL2&Sm&zd@iTIm-!9# z#M)=SmoqXx{oOpdmFxX{_96|QF-|fVGj!AFMGdXDJe)hwsm&n1!((Kp>t#j`w2!w) zM|^nIFFEV5{Q4{j7_)@2SRnJTu@>0{P7m)P@hfw z>NmR_sIGC+p-yh)g32ad98P&O7Ygq3&xpeAPmlfh(Cp2}_uH`@-Pkm1pIl(R%qX;V zt~gmEI2=y!5_p3&q$Oj5cZkk4(zNL@Lj`*;?n~G)T^3`JC$@0K#~SiBj{%PXkAZ8( zKo%R>Prv`Knf(9%YZl)d*kizB;GbszvYUcU4TvMP3e1E=zqR{u-+?>bsND#YwhJDp z3GKH($76$jj=$OIOD&J7KH&6?FloDEzwM5aea*k-e+GE#e{cOy6Oe8o{4dx4e*y*n Bu?_$L literal 0 HcmV?d00001 diff --git a/built/web/player/FastStreamClient.mjs b/built/web/player/FastStreamClient.mjs new file mode 100644 index 00000000..8c0da3dc --- /dev/null +++ b/built/web/player/FastStreamClient.mjs @@ -0,0 +1,757 @@ +import {InterfaceController} from './ui/InterfaceController.mjs'; +import {KeybindManager} from './ui/KeybindManager.mjs'; +import {DownloadManager} from './network/DownloadManager.mjs'; +import {DefaultPlayerEvents} from './enums/DefaultPlayerEvents.mjs'; +import {DownloadStatus} from './enums/DownloadStatus.mjs'; +import {SubtitlesManager} from './ui/subtitles/SubtitlesManager.mjs'; +import {VideoAnalyzer} from './analyzer/VideoAnalyzer.mjs'; +import {AnalyzerEvents} from './enums/AnalyzerEvents.mjs'; +import {EventEmitter} from './modules/eventemitter.mjs'; +import {SourcesBrowser} from './ui/SourcesBrowser.mjs'; +import {SubtitleSyncer} from './ui/subtitles/SubtitleSyncer.mjs'; +import {PlayerLoader} from './players/PlayerLoader.mjs'; +import {DOMElements} from './ui/DOMElements.mjs'; +import {AudioConfigManager} from './ui/audio/AudioConfigManager.mjs'; +import {EnvUtils} from './utils/EnvUtils.mjs'; +import {Localize} from './modules/Localize.mjs'; +export class FastStreamClient extends EventEmitter { + constructor() { + super(); + this.version = EnvUtils.getVersion(); + this.options = { + maxSpeed: 300 * 1000 * 1000, // 300 MB/s + introCutoff: 5 * 60, + outroCutoff: 5 * 60, + bufferAhead: 120, + bufferBehind: 20, + freeFragments: true, + downloadAll: false, + freeUnusedChannels: true, + videoBrightness: 1, + videoContrast: 1, + videoSaturation: 1, + videoGrayscale: 0, + videoSepia: 0, + videoInvert: 0, + videoHueRotate: 0, + seekStepSize: 0.2, + }; + this.persistent = { + playing: false, + buffering: false, + currentTime: 0, + volume: 1, + muted: false, + latestVolume: 1, + playbackRate: 1, + }; + this.playerLoader = new PlayerLoader(); + this.interfaceController = new InterfaceController(this); + this.keybindManager = new KeybindManager(this); + this.downloadManager = new DownloadManager(this); + this.subtitlesManager = new SubtitlesManager(this); + this.sourcesBrowser = new SourcesBrowser(this); + this.videoAnalyzer = new VideoAnalyzer(this); + this.subtitleSyncer = new SubtitleSyncer(this); + this.audioConfigManager = new AudioConfigManager(this); + this.videoAnalyzer.on(AnalyzerEvents.MATCH, () => { + this.interfaceController.updateIntroOutroBar(); + }); + this.interfaceController.updateVolumeBar(); + this.player = null; + this.previewPlayer = null; + this.saveSeek = true; + this.pastSeeks = []; + this.pastUnseeks = []; + this.fragmentsStore = {}; + this.audioContext = new AudioContext(); + this.audioConfigManager.setupNodes(); + this.mainloop(); + } + async setup() { + await this.downloadManager.setup(); + } + shouldDownloadAll() { + return this.options.downloadAll && this.hasDownloadSpace; + } + setSeekSave(value) { + this.saveSeek = value; + } + resetFailed() { + for (const levelID in this.fragmentsStore) { + if (Object.hasOwn(this.fragmentsStore, levelID)) { + this.fragmentsStore[levelID].forEach((fragment) => { + if (fragment.status === DownloadStatus.DOWNLOAD_FAILED) { + fragment.status = DownloadStatus.WAITING; + } + }); + } + } + this.interfaceController.updateFragmentsLoaded(); + } + destroy() { + this.destroyed = true; + this.resetPlayer(); + this.downloadManager.destroy(); + this.videoAnalyzer.destroy(); + this.interfaceController.destroy(); + } + setOptions(options) { + this.options.analyzeVideos = options.analyzeVideos; + this.options.downloadAll = options.downloadAll; + this.options.freeUnusedChannels = options.freeUnusedChannels; + this.options.autoEnableBestSubtitles = options.autoEnableBestSubtitles; + this.options.maxSpeed = options.maxSpeed; + this.options.seekStepSize = options.seekStepSize; + this.options.videoBrightness = options.videoBrightness; + this.options.videoContrast = options.videoContrast; + this.options.videoSaturation = options.videoSaturation; + this.options.videoGrayscale = options.videoGrayscale; + this.options.videoSepia = options.videoSepia; + this.options.videoInvert = options.videoInvert; + this.options.videoHueRotate = options.videoHueRotate; + this.updateCSSFilters(); + if (options.keybinds) { + this.keybindManager.setKeybinds(options.keybinds); + } + if (this.options.analyzeVideos) { + this.videoAnalyzer.enable(); + } else { + this.videoAnalyzer.disable(); + } + } + updateCSSFilters() { + const filters = []; + if (this.options.videoBrightness !== 1) { + filters.push(`brightness(${this.options.videoBrightness})`); + } + if (this.options.videoContrast !== 1) { + filters.push(`contrast(${this.options.videoContrast})`); + } + if (this.options.videoSaturation !== 1) { + filters.push(`saturate(${this.options.videoSaturation})`); + } + if (this.options.videoGrayscale !== 0) { + filters.push(`grayscale(${this.options.videoGrayscale})`); + } + if (this.options.videoSepia !== 0) { + filters.push(`sepia(${this.options.videoSepia})`); + } + if (this.options.videoInvert !== 0) { + filters.push(`invert(${this.options.videoInvert})`); + } + if (this.options.videoHueRotate !== 0) { + filters.push(`hue-rotate(${this.options.videoHueRotate}deg)`); + } + const filterStr = filters.join(' '); + if (this.player) { + this.player.getVideo().style.filter = filterStr; + } + if (this.previewPlayer) { + this.previewPlayer.getVideo().style.filter = filterStr; + } + } + loadAnalyzerData(data) { + if (data) this.videoAnalyzer.loadAnalyzerData(data); + } + clearSubtitles() { + this.subtitlesManager.clearTracks(); + } + loadSubtitleTrack(subtitleTrack, autoset = false) { + return this.subtitlesManager.loadTrackAndActivateBest(subtitleTrack, autoset); + } + updateDuration() { + this.interfaceController.durationChanged(); + this.updateHasDownloadSpace(); + } + updateTime(time) { + this.persistent.currentTime = time; + this.interfaceController.updateProgress(); + this.subtitlesManager.renderSubtitles(); + this.subtitleSyncer.onVideoTimeUpdate(); + this.interfaceController.updateIntroOutroBar(); + } + seekPreview(time) { + if (this.previewPlayer) { + this.previewPlayer.currentTime = time; + this.updatePreview(); + } + } + hidePreview() { + if (this.previewPlayer) { + this.previewPlayer.getVideo().style.opacity = 0; + clearTimeout(this.previewPlayerLoadingTimeout); + this.previewPlayerLoadingTimeout = setTimeout(() => { + if (parseFloat(this.previewPlayer.getVideo().style.opacity) === 0) { + DOMElements.seekPreviewVideo.classList.add('loading'); + } + }, 200); + } + } + showPreview() { + if (this.previewPlayer) { + this.previewPlayer.getVideo().style.opacity = 1; + DOMElements.seekPreviewVideo.classList.remove('loading'); + clearTimeout(this.previewPlayerLoadingTimeout); + } + } + updatePreview() { + if (!this.previewPlayer) return; + if (this.previewPlayer.getVideo().readyState > 1) { + this.showPreview(); + return; + } + let shouldShowPreview = false; + // check if time is buffered + const time = this.previewPlayer.currentTime; + const buffered = this.previewPlayer.buffered; + for (let i = 0; i < buffered.length; i++) { + if (time >= buffered.start(i) && time <= buffered.end(i)) { + shouldShowPreview = true; + break; + } + } + if (shouldShowPreview) { + this.showPreview(); + } else { + this.hidePreview(); + } + } + updateQualityLevels() { + this.interfaceController.updateQualityLevels(); + this.updateHasDownloadSpace(); + } + updateHasDownloadSpace() { + this.hasDownloadSpace = false; + const levels = this.levels; + if (!levels) return; + const currentLevel = this.previousLevel; + const level = levels.get(currentLevel); + if (!level) return; + if (EnvUtils.isIncognito()) { + this.interfaceController.setStatusMessage('info', Localize.getMessage('player_buffer_incognito_warning', [this.options.bufferBehind + this.options.bufferAhead]), 'warning', 5000); + this.hasDownloadSpace = false; + } else { + if (level.bitrate && this.duration) { + const storageAvailable = (this.storageAvailable * 8) * 0.6; + this.hasDownloadSpace = (level.bitrate * this.duration) < storageAvailable; + } else { + this.hasDownloadSpace = true; + } + if (!this.hasDownloadSpace) { + this.interfaceController.setStatusMessage('info', Localize.getMessage('player_buffer_storage_warning', [this.options.bufferBehind + this.options.bufferAhead]), 'warning', 5000); + } + } + } + async addSource(source, setSource = false) { + source = source.copy(); + console.log('addSource', source); + source = this.sourcesBrowser.addSource(source); + if (setSource) { + await this.setSource(source); + } + this.sourcesBrowser.updateSources(); + return source; + } + async setSource(source) { + source = source.copy(); + console.log('setSource', source); + await this.resetPlayer(); + this.source = source; + const estimate = await navigator.storage.estimate(); + this.storageAvailable = estimate.quota - estimate.usage; + this.player = await this.playerLoader.createPlayer(source.mode, this); + await this.player.setup(); + this.bindPlayer(this.player); + await this.player.setSource(source); + this.interfaceController.addVideo(this.player.getVideo()); + this.audioContext = new AudioContext(); + this.audioSource = this.audioContext.createMediaElementSource(this.player.getVideo()); + this.audioConfigManager.setupNodes(); + this.audioGain = this.audioContext.createGain(); + this.audioConfigManager.getOutputNode().connect(this.audioGain); + this.audioGain.connect(this.audioContext.destination); + this.updateVolume(); + this.player.playbackRate = this.persistent.playbackRate; + this.setSeekSave(false); + this.currentTime = 0; + this.setSeekSave(true); + this.previewPlayer = await this.playerLoader.createPlayer(this.player.getSource().mode, this, { + isPreview: true, + }); + await this.previewPlayer.setup(); + this.bindPreviewPlayer(this.previewPlayer); + await this.previewPlayer.setSource(this.player.getSource()); + this.interfaceController.addPreviewVideo(this.previewPlayer.getVideo()); + await this.videoAnalyzer.setSource(this.player.getSource()); + this.updateCSSFilters(); + this.interfaceController.updateToolVisibility(); + } + getNextToDownload() { + const currentFragment = this.currentFragment; + const audioFragment = this.currentAudioFragment; + const nextVideo = this.getNextToDownloadTrack(currentFragment); + const nextAudio = this.getNextToDownloadTrack(audioFragment); + if (!nextVideo) { + return nextAudio; + } + if (!nextAudio) { + return nextVideo; + } + const diffV = Math.abs(nextVideo.start - this.persistent.currentTime); + const diffA = Math.abs(nextAudio.start - this.persistent.currentTime); + if (diffV < diffA) { + return nextVideo; + } else { + return nextAudio; + } + } + getNextToDownloadTrack(currentFragment) { + if (!currentFragment) { + return null; + } + const fragments = this.getFragments(currentFragment.level); + if (!fragments) { + return null; + } + const index = currentFragment.sn; + const nextItem = this.getNextForward(fragments, index) || this.getNextBackward(fragments, index); + return nextItem; + } + getNextForward(fragments, index) { + for (let i = index; i < fragments.length; i++) { + const fragment = fragments[i]; + if (fragment && fragment.status === DownloadStatus.WAITING) { + return fragment; + } + } + } + getNextBackward(fragments, index) { + for (let i = index - 1; i >= 0; i--) { + const fragment = fragments[i]; + if (fragment && fragment.status === DownloadStatus.WAITING) { + return fragment; + } + } + } + mainloop() { + if (this.destroyed) return; + setTimeout(this.mainloop.bind(this), 1000); + if (this.player) { + this.updatePreview(); + this.predownloadFragments(); + if (!this.shouldDownloadAll()) { + if (this.fragments) this.freeFragments(this.fragments); + if (this.audioFragments) this.freeFragments(this.audioFragments); + } + this.interfaceController.updateFragmentsLoaded(); + // Detect buffering + if (this.persistent.playing) { + const time = this.currentTime; + if (time === this.lastTime) { + this.interfaceController.setBuffering(true); + } else { + this.interfaceController.setBuffering(false); + } + this.lastTime = time; + } else if (this.currentVideo) { + if (this.currentVideo.readyState === 0) { + this.interfaceController.setBuffering(true); + } else if (this.currentVideo.readyState > 1) { + this.interfaceController.setBuffering(false); + } + } + } + this.videoAnalyzer.update(); + this.videoAnalyzer.saveAnalyzerData(); + this.interfaceController.updateStatusMessage(); + } + predownloadFragments() { + let nextDownload = this.getNextToDownload(); + let hasDownloaded = false; + let index = 0; + const speed = this.downloadManager.getSpeed(); + // throttle download speed so blob can catch up + if (speed > this.options.maxSpeed) { + return false; + } + while (nextDownload) { + if (nextDownload.canFree() && !this.shouldDownloadAll()) { + if (nextDownload.start > this.persistent.currentTime + this.options.bufferAhead) { + break; + } + if (nextDownload.end < this.persistent.currentTime - this.options.bufferBehind) { + break; + } + } + if (!this.downloadManager.canGetFile(nextDownload.getContext())) { + break; + } + hasDownloaded = true; + this.player.downloadFragment(nextDownload); + nextDownload = this.getNextToDownload(); + if (index++ > 10000) { + throw new Error('Infinite loop detected'); + } + } + if (!hasDownloaded && this.videoAnalyzer.isRunning()) { + hasDownloaded = this.predownloadReservedFragments(); + } + return hasDownloaded; + } + predownloadReservedFragments() { + const fragments = this.getReservedFragments(this.fragments); + const audioFragments = this.getReservedFragments(this.audioFragments); + if (audioFragments.length) { + let currentVideoIndex = 0; + audioFragments.forEach((fragment) => { + const videoFragment = fragments[currentVideoIndex]; + while (videoFragment && videoFragment.start < fragment.start) { + currentVideoIndex++; + } + fragments.splice(currentVideoIndex, 0, fragment); + }); + } + let hasDownloaded = false; + fragments.every((fragment) => { + if (!this.downloadManager.canGetFile(fragment.getContext())) { + return false; + } + this.player.downloadFragment(fragment); + hasDownloaded = true; + return true; + }); + return hasDownloaded; + } + getReservedFragments(fragments) { + if (!fragments) return []; + return fragments.filter((fragment) => { + return fragment && fragment.status === DownloadStatus.WAITING && !fragment.canFree(); + }); + } + freeFragments(fragments) { + for (let i = 0; i < fragments.length; i++) { + const fragment = fragments[i]; + if (fragment && fragment.status === DownloadStatus.DOWNLOAD_COMPLETE && fragment.canFree()) { + if (fragment.end < this.persistent.currentTime - this.options.bufferBehind || fragment.start > this.persistent.currentTime + this.options.bufferAhead) { + this.freeFragment(fragment); + } + } + } + } + freeFragment(fragment) { + this.downloadManager.removeFile(fragment.getContext()); + fragment.status = DownloadStatus.WAITING; + } + getFragment(level, sn) { + if (!this.fragmentsStore[level]) { + return null; + } + return this.fragmentsStore[level][sn]; + } + makeFragment(level, sn, frag) { + if (!this.fragmentsStore[level]) { + this.fragmentsStore[level] = []; + } + this.fragmentsStore[level][sn] = frag; + } + failedToLoad(reason) { + this.downloadManager.removeAllDownloaders(); + this.interfaceController.failedToLoad(reason); + } + async resetPlayer() { + const promises = []; + this.lastTime = 0; + this.fragmentsStore = {}; + this.pastSeeks.length = 0; + this.pastUnseeks.length = 0; + if (this.context) { + this.context.destroy(); + this.context = null; + } + if (this.previewContext) { + this.previewContext.destroy(); + this.previewContext = null; + } + if (this.player) { + this.player.destroy(); + this.player = null; + } + if (this.source) { + this.source.destroy(); + this.source = null; + } + if (this.previewPlayer) { + this.previewPlayer.destroy(); + this.previewPlayer = null; + } + if (this.audioContext) { + this.audioContext.close(); + this.audioContext = null; + } + if (this.audioSource) { + this.audioSource.disconnect(); + this.audioSource = null; + } + if (this.audioGain) { + this.audioGain.disconnect(); + this.audioGain = null; + } + promises.push(this.downloadManager.reset()); + this.interfaceController.reset(); + this.subtitlesManager.clearTracks(); + this.persistent.buffering = false; + this.storageAvailable = 0; + this.hasDownloadSpace = false; + this.previousLevel = -1; + this.previousAudioLevel = -1; + await Promise.all(promises); + } + setMediaName(name) { + this.mediaName = name; + this.subtitlesManager.mediaNameSet(); + } + bindPlayer(player) { + this.context = player.createContext(); + this.context.on(DefaultPlayerEvents.MANIFEST_PARSED, (maxLevel, maxAudioLevel) => { + const source = player.getSource(); + console.log('MANIFEST_PARSED', maxLevel, maxAudioLevel); + if (maxLevel !== undefined) { + if (source.defaultLevelInfo?.level !== undefined) { + this.currentLevel = source.defaultLevelInfo.level; + } else { + this.currentLevel = maxLevel; + } + } else { + console.warn('No recommended level found'); + } + if (maxAudioLevel !== undefined) { + if (source.defaultLevelInfo?.audio !== undefined) { + this.currentAudioLevel = source.defaultLevelInfo.audio; + } else { + this.currentAudioLevel = maxAudioLevel; + } + } + this.player.load(); + this.updateQualityLevels(); + }); + this.context.on(DefaultPlayerEvents.ABORT, (event) => { + }); + this.context.on(DefaultPlayerEvents.CANPLAY, (event) => { + }); + this.context.on(DefaultPlayerEvents.CANPLAYTHROUGH, (event) => { + }); + this.context.on(DefaultPlayerEvents.COMPLETE, (event) => { + }); + this.context.on(DefaultPlayerEvents.DURATIONCHANGE, (event) => { + this.updateDuration(); + this.interfaceController.updateFragmentsLoaded(); + }); + this.context.on(DefaultPlayerEvents.EMPTIED, (event) => { + }); + this.context.on(DefaultPlayerEvents.ENDED, (event) => { + this.pause(); + }); + this.context.on(DefaultPlayerEvents.ERROR, (event) => { + console.error('ERROR', event); + this.failedToLoad(Localize.getMessage('player_error_load')); + }); + this.context.on(DefaultPlayerEvents.NEED_KEY, (event) => { + this.failedToLoad(Localize.getMessage('player_error_drm')); + }); + this.context.on(DefaultPlayerEvents.LOADEDDATA, (event) => { + }); + this.context.on(DefaultPlayerEvents.LOADEDMETADATA, (event) => { + }); + this.context.on(DefaultPlayerEvents.PAUSE, (event) => { + this.interfaceController.pause(); + }); + this.context.on(DefaultPlayerEvents.PLAY, (event) => { + this.interfaceController.play(); + }); + this.context.on(DefaultPlayerEvents.PLAYING, (event) => { + this.interfaceController.setBuffering(false); + }); + this.context.on(DefaultPlayerEvents.PROGRESS, (event) => { + }); + this.context.on(DefaultPlayerEvents.RATECHANGE, (event) => { + }); + this.context.on(DefaultPlayerEvents.SEEKED, (event) => { + this.interfaceController.updateFragmentsLoaded(); + }); + this.context.on(DefaultPlayerEvents.SEEKING, (event) => { + }); + this.context.on(DefaultPlayerEvents.STALLED, (event) => { + }); + this.context.on(DefaultPlayerEvents.SUSPEND, (event) => { + }); + this.context.on(DefaultPlayerEvents.TIMEUPDATE, (event) => { + if (this.interfaceController.isSeeking) return; + this.updateTime(this.currentTime); + if (this.videoAnalyzer.pushFrame(this.player.getVideo())) { + this.videoAnalyzer.calculate(); + } + }); + this.context.on(DefaultPlayerEvents.VOLUMECHANGE, (event) => { + }); + this.context.on(DefaultPlayerEvents.WAITING, (event) => { + this.interfaceController.setBuffering(true); + }); + this.context.on(DefaultPlayerEvents.FRAGMENT_UPDATE, () => { + this.interfaceController.updateFragmentsLoaded(); + }); + } + bindPreviewPlayer(player) { + this.previewContext = player.createContext(); + this.previewContext.on(DefaultPlayerEvents.MANIFEST_PARSED, () => { + player.currentLevel = this.previousLevel; + player.load(); + }); + this.previewContext.on(DefaultPlayerEvents.FRAGMENT_UPDATE, (fragment) => { + this.interfaceController.updateFragmentsLoaded(); + }); + this.previewContext.on(DefaultPlayerEvents.SEEKED, (event) => { + this.updatePreview(); + }); + this.previewContext.on(DefaultPlayerEvents.SEEKING, (event) => { + this.updatePreview(); + }); + this.previewContext.on(DefaultPlayerEvents.ERROR, (e) => { + console.log('Preview player error', e); + }); + } + async play() { + if (!this.player) { + throw new Error('No source is loaded!'); + } + await this.player.play(); + this.interfaceController.play(); + if (this.audioContext && this.audioContext.state === 'suspended') { + await this.audioContext.resume(); + } + } + async pause() { + await this.player.pause(); + this.interfaceController.pause(); + } + undoSeek() { + if (this.pastSeeks.length) { + this.pastUnseeks.push(this.player.currentTime); + this.player.currentTime = this.pastSeeks.pop(); + this.interfaceController.updateMarkers(); + } + } + redoSeek() { + if (this.pastUnseeks.length) { + this.pastSeeks.push(this.player.currentTime); + this.player.currentTime = this.pastUnseeks.pop(); + this.interfaceController.updateMarkers(); + } + } + savePosition() { + if (!this.pastSeeks.length || this.pastSeeks[this.pastSeeks.length - 1] != this.persistent.currentTime) { + this.pastSeeks.push(this.persistent.currentTime); + } + if (this.pastSeeks.length > 50) { + this.pastSeeks.shift(); + } + this.pastUnseeks.length = 0; + this.interfaceController.updateMarkers(); + } + set currentTime(value) { + if (this.saveSeek) { + this.savePosition(); + } + this.persistent.currentTime = value; + if (this.player) { + this.player.currentTime = value; + } + } + get duration() { + return this.player?.duration || 0; + } + get currentTime() { + return this.player?.currentTime || 0; + } + get paused() { + return this.player?.paused || true; + } + get levels() { + return this.player?.levels || new Map(); + } + get currentLevel() { + return this.player?.currentLevel; + } + get currentAudioLevel() { + return this.player?.currentAudioLevel; + } + set currentLevel(value) { + const previousLevel = this.previousLevel; + this.previousLevel = value; + this.player.currentLevel = value; + if (this.previewPlayer) { + this.previewPlayer.currentLevel = value; + } + this.videoAnalyzer.setLevel(value); + if (this.options.freeUnusedChannels && value !== previousLevel && this.fragmentsStore[previousLevel]) { + this.fragmentsStore[previousLevel].forEach((fragment, i) => { + if (i === -1) return; + this.freeFragment(fragment); + }); + } + // Reset failed fragments + this.resetFailed(); + this.updateQualityLevels(); + } + set currentAudioLevel(value) { + const previousLevel = this.previousAudioLevel; + this.previousAudioLevel = value; + this.player.currentAudioLevel = value; + if (value !== previousLevel && this.fragmentsStore[previousLevel]) { + this.fragmentsStore[previousLevel].forEach((fragment, i) => { + if (i === -1) return; + this.freeFragment(fragment); + }); + } + this.updateQualityLevels(); + } + get fragments() { + return this.fragmentsStore[this.currentLevel]; + } + get audioFragments() { + return this.fragmentsStore[this.currentAudioLevel]; + } + get currentFragment() { + return this.player?.currentFragment || null; + } + get currentAudioFragment() { + return this.player?.currentAudioFragment || null; + } + getFragments(level) { + return this.fragmentsStore[level]; + } + updateVolume() { + const value = this.persistent.volume; + if (this.player) this.player.volume = 1; + if (this.audioGain) this.audioGain.gain.value = value; + this.interfaceController.updateVolumeBar(); + } + get volume() { + return this.persistent.volume; + } + set volume(value) { + this.persistent.volume = value; + this.updateVolume(); + } + get playbackRate() { + return this.player?.playbackRate || this.persistent.playbackRate; + } + set playbackRate(value) { + this.persistent.playbackRate = value; + if (this.player) this.player.playbackRate = value; + this.interfaceController.updatePlaybackRate(); + } + get currentVideo() { + return this.player?.getVideo() || null; + } +} diff --git a/built/web/player/SubtitleTrack.mjs b/built/web/player/SubtitleTrack.mjs new file mode 100644 index 00000000..27dd86ba --- /dev/null +++ b/built/web/player/SubtitleTrack.mjs @@ -0,0 +1,64 @@ +import {WebVTT} from './modules/vtt.mjs'; +import {SubtitleUtils} from './utils/SubtitleUtils.mjs'; +export class SubtitleTrack { + constructor(label, language) { + this.label = label; + this.language = language; + this.cues = []; + this.regions = []; + } + loadURL(url) { + return fetch(url).then((response) => { + return response.text(); + }).then((text) => { + this.loadText(text); + }); + } + shift(time) { + this.cues.forEach((cue) => { + cue.startTime += time; + cue.endTime += time; + }); + } + loadText(text) { + if (text.substring(0, 5) === ' { + this.regions.push(region); + }; + parser.oncue = (cue) => { + this.cues.push(cue); + }; + parser.onflush = () => { + this.cues.sort((a, b) => { + return a.startTime - b.startTime; + }); + }; + parser.onparsingerror = (error) => { + throw error; + }; + parser.parse(text); + parser.flush(); + } + equals(otherTrack) { + if (this.label !== otherTrack.label && this.language !== otherTrack.language) { + return false; + } + if (this.cues.length !== otherTrack.cues.length) { + return false; + } + for (let i = 0; i < this.cues.length; i++) { + const cue = this.cues[i]; + const otherCue = otherTrack.cues[i]; + if (cue.startTime !== otherCue.startTime || cue.endTime !== otherCue.endTime || cue.text !== otherCue.text) { + return false; + } + } + return true; + } +} diff --git a/built/web/player/VideoSource.mjs b/built/web/player/VideoSource.mjs new file mode 100644 index 00000000..39b29a3d --- /dev/null +++ b/built/web/player/VideoSource.mjs @@ -0,0 +1,97 @@ +import {PlayerModes} from './enums/PlayerModes.mjs'; +const headerBlacklist = [ + 'accept', + 'accept-charset', + 'accept-encoding', + 'accept-language', + 'cache-control', + 'pragma', + 'sec-ch-ua', + 'sec-ch-ua-mobile', + 'sec-ch-ua-platform', + 'sec-fetch-dest', + 'sec-fetch-mode', + 'sec-fetch-site', + 'user-agent', + 'range', + 'host', + 'connection', + 'dnt', + 'cookie', +]; +const redirectHeaders = [ + 'origin', + 'referer', +]; +export class VideoSource { + constructor(source, headers, mode) { + if (source instanceof File) { + this.fromFile(source); + } else { + this.url = source; + this.identifier = this.url.split(/[?#]/)[0]; + } + this.mode = mode || PlayerModes.DIRECT; + if (Array.isArray(headers)) { + this.headers = {}; + headers.forEach((header) => { + if (header.name && header.value) { + this.headers[header.name] = header.value; + } + }); + } else { + this.headers = headers || {}; + } + this.headers = this.filterHeaders(this.headers); + this.defaultLevelInfo = null; + } + fromFile(file) { + this.url = URL.createObjectURL(file); + this.identifier = file.name; + this.shouldRevoke = true; + } + destroy() { + if (this.shouldRevoke) { + URL.revokeObjectURL(this.url); + this.url = null; + } + } + filterHeaders(headers) { + const filteredHeaders = {}; + for (const key in headers) { + if (headerBlacklist.includes(key.toLowerCase())) { + continue; + } + if (redirectHeaders.includes(key.toLowerCase())) { + filteredHeaders['x-faststream-setheader-' + key.toLowerCase()] = headers[key]; + } else { + filteredHeaders[key.toLowerCase()] = headers[key]; + } + } + return filteredHeaders; + } + equals(other) { + if (this.url !== other.url) { + return false; + } + if (this.mode !== other.mode) { + return false; + } + if (Object.keys(this.headers).length !== Object.keys(other.headers).length) { + return false; + } + for (const key in this.headers) { + if (this.headers[key] !== other.headers[key]) { + return false; + } + } + return true; + } + copy() { + const newsource = new VideoSource(this.url, {}, this.mode); + newsource.identifier = this.identifier; + newsource.defaultLevelInfo = this.defaultLevelInfo; + newsource.headers = {...this.headers}; + return newsource; + } +} diff --git a/built/web/player/analyzer/VideoAligner.mjs b/built/web/player/analyzer/VideoAligner.mjs new file mode 100644 index 00000000..cac552f9 --- /dev/null +++ b/built/web/player/analyzer/VideoAligner.mjs @@ -0,0 +1,479 @@ +import {AnalyzerEvents} from '../enums/AnalyzerEvents.mjs'; +import {EventEmitter} from '../modules/eventemitter.mjs'; +import Pako from '../modules/pako.mjs'; +import {Utils} from '../utils/Utils.mjs'; +import {dHash} from './dHash.mjs'; +const WIDTH = 16; +const HEIGHT = 8; +const HASH_BITS = WIDTH * HEIGHT / 2; +const HASH_LENGTH = Math.ceil(HASH_BITS / 32); +const ALIGN_CUTOFF = 12; +const MAX_MATCH_LENGTH = 60 * 2; +export class VideoAligner extends EventEmitter { + constructor() { + super(); + this.canvas = document.createElement('canvas'); + this.canvas.width = WIDTH; + this.canvas.height = HEIGHT; + this.ctx = this.canvas.getContext('2d', { + willReadFrequently: true, + }); + this.currentSequence = []; + this.currentIdentifier = ''; + this.found = false; + this.lastMatched = null; + this.memory = new Map(); + this.hasMemoryChanges = false; + } + setRange(start, end) { + this.scanStart = start; + this.scanEnd = end; + } + prepare(identifier) { + // identifier += Math.random(); + this.detectedStartTime = -1; + this.detectedEndTime = -1; + this.lastMatched = null; + this.currentIdentifier = identifier; + this.scanStart = -Infinity; + this.scanEnd = Infinity; + if (this.currentSequence) { + this.currentSequence.forEach((value) => { + delete value.entries; + delete value.timeSet; + }); + } + this.currentSequence = []; + this.memory.set(identifier, { + sequence: this.currentSequence, + identifier: identifier, + deleteIn: 3, + matchStart: -1, + matchEnd: -1, + }); + this.cleanMemory(); + if (this.found) { + this.found = false; + this.emit(AnalyzerEvents.MATCH, this); + } + } + hashEquals(a, b) { + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + hashDistance(a, b) { + let distance = 0; + for (let i = 0; i < a.length; i++) { + distance += this.linearBitDistance(a[i], b[i]); + } + return distance; + } + cleanMemory() { + this.memory.forEach((value, key) => { + if (value.deleteIn <= 0) { + this.memory.delete(key); + } else if (key !== this.currentIdentifier) { + value.deleteIn--; + } + }); + this.hasMemoryChanges = true; + } + getCurrentMemory() { + return this.memory.get(this.currentIdentifier); + } + pushVideoFrame(video) { + const data = this.extractData(video); + const hs = dHash.getHash(data.data); + const hash = new Uint32Array(HASH_LENGTH); + for (let i = 0; i < HASH_LENGTH; i++) { + hash[i] = parseInt(hs.substring(i * 32, (i + 1) * 32), 2); + } + const time = Math.round(data.time); + const index = Utils.binarySearch(this.currentSequence, time, (time, item) => { + if (time > item.time) { + return 1; + } + if (time < item.time) { + return -1; + } + return 0; + }); + let entry = null; + if (index < 0) { + entry = { + time, + hash: null, + entries: [], + timeSet: new Set(), + hashCounts: new Uint8Array(HASH_LENGTH * 32), + }; + this.currentSequence.splice(-index - 1, 0, entry); + this.hasMemoryChanges = true; + } else { + entry = this.currentSequence[index]; + } + if (entry.timeSet.has(data.time)) return; + entry.timeSet.add(data.time); + for (let i = 0; i < HASH_LENGTH; i++) { + for (let j = 0; j < 32; j++) { + if (hash[i] & (1 << j)) { + entry.hashCounts[i * 32 + j]++; + } + } + } + const averageHash = new Uint32Array(HASH_LENGTH); + for (let i = 0; i < HASH_LENGTH; i++) { + for (let j = 0; j < 32; j++) { + if (entry.hashCounts[i * 32 + j] > (entry.timeSet.size / 2)) { + averageHash[i] |= (1 << j); + } + } + } + if (!entry.hash || !this.hashEquals(entry.hash, averageHash)) { + this.hasMemoryChanges = true; + entry.hash = averageHash; + } + } + getClosestIndex(sequence, time) { + let index = Utils.binarySearch(sequence, time, (time, item) => { + if (time > item.time) { + return 1; + } + if (time < item.time) { + return -1; + } + return 0; + }); + if (index >= 0) { + return index; + } + index = -index - 1; + if (index <= 0) { + return 0; + } + if (index >= sequence.length) { + return sequence.length - 1; + } + const timeA = sequence[index - 1].time; + const timeB = sequence[index].time; + if (Math.abs(timeA - time) < Math.abs(timeB - time)) { + return index - 1; + } + return index; + } + clampTime(time) { + return Math.max(this.scanStart, Math.min(this.scanEnd, time)); + } + calculate() { + const matches = []; + this.memory.forEach((memoryEntry, identifier) => { + if (identifier === this.currentIdentifier) return; + const sequence = memoryEntry.sequence; + const aligned = this.hackyAlignment(this.currentSequence, sequence); + if (aligned && aligned.count > 4 && aligned.score > (ALIGN_CUTOFF * 9)) { + const offsetStart = this.currentSequence[aligned.startA].time - sequence[aligned.startB].time; + const offsetEnd = this.currentSequence[aligned.endA].time - sequence[aligned.endB].time; + if (memoryEntry.matchStart === -1) { + memoryEntry.matchStart = aligned.startB; + this.hasMemoryChanges = true; + } + if (memoryEntry.matchEnd === -1) { + memoryEntry.matchEnd = aligned.endB; + this.hasMemoryChanges = true; + } + const timeStart = this.clampTime(sequence[memoryEntry.matchStart].time + offsetStart); + const timeEnd = this.clampTime(sequence[memoryEntry.matchEnd].time + offsetEnd); + const indexBStart = this.getClosestIndex(sequence, timeStart - offsetStart); + const indexBEnd = this.getClosestIndex(sequence, timeEnd - offsetEnd); + let indexStart = this.getClosestIndex(this.currentSequence, timeStart); + if (this.currentSequence[indexStart].time < timeStart) { + // get closest one that is bigger + while (indexStart < this.currentSequence.length && this.currentSequence[indexStart].time < timeStart) { + indexStart++; + } + } + let indexEnd = this.getClosestIndex(this.currentSequence, timeEnd); + if (this.currentSequence[indexEnd].time > timeEnd) { + // get closest one that is smaller + while (indexEnd > 0 && this.currentSequence[indexEnd].time > timeEnd) { + indexEnd--; + } + } + let filled = (indexEnd - indexStart) / (indexBEnd - indexBStart); + if (timeEnd === timeStart) { + filled = 1; + } + if (aligned.count > 8 && filled > 0.75 && Math.abs(this.currentSequence[indexEnd].time - timeEnd) <= 2) { + if (aligned.startB !== memoryEntry.matchStart) { + memoryEntry.matchStart = aligned.startB; + this.hasMemoryChanges = true; + } + if (aligned.endB !== memoryEntry.matchEnd) { + memoryEntry.matchEnd = aligned.endB; + this.hasMemoryChanges = true; + } + } + if (aligned.endB >= memoryEntry.matchStart && aligned.startB <= memoryEntry.matchEnd) { + const obj = { + identifier, + startTime: sequence[memoryEntry.matchStart].time + offsetStart, + endTime: sequence[memoryEntry.matchEnd].time + offsetEnd, + count: memoryEntry.matchEnd - memoryEntry.matchStart, + }; + const diff = obj.endTime - obj.startTime; + if (diff > 0 && diff < MAX_MATCH_LENGTH) { + matches.push(obj); + } + } + }; + }); + this.found = false; + if (matches.length > 0) { + let maxCountIndex = 0; + for (let i = 1; i < matches.length; i++) { + if (matches[i].count > matches[maxCountIndex].count) { + maxCountIndex = i; + } + } + this.found = true; + const hasChanged = this.detectedStartTime !== matches[maxCountIndex].startTime || this.detectedEndTime !== matches[maxCountIndex].endTime; + this.detectedStartTime = matches[maxCountIndex].startTime; + this.detectedEndTime = matches[maxCountIndex].endTime; + if (this.lastMatched !== matches[maxCountIndex].identifier) { + if (this.lastMatched) { + const item = this.memory.get(this.lastMatched); + item.deleteIn += -2; + this.hasMemoryChanges = true; + } + this.lastMatched = matches[maxCountIndex].identifier; + const item = this.memory.get(matches[maxCountIndex].identifier); + if (item.deleteIn < 3) { + item.deleteIn += 2; + this.hasMemoryChanges = true; + } + } + if (hasChanged) { + this.emit(AnalyzerEvents.MATCH, this); + } + } + } + stringifyBuffer(buffer) { + const result = []; + for (let i = 0; i < buffer.length; i++) { + result.push(String.fromCharCode(buffer[i])); + } + return btoa(result.join('')); + } + getMemoryForSave() { + const memory = {}; + this.memory.forEach((item, identifier) => { + if (!item.sequence.length) return; + const timeBuffer = new Uint16Array(item.sequence.length); + const hashBuffer = new Uint32Array(item.sequence.length * HASH_LENGTH); + let startTime = item.sequence[0].time; + item.sequence.forEach((item, index) => { + timeBuffer[index] = item.time - startTime; + startTime = item.time; + for (let i = 0; i < HASH_LENGTH; i++) { + hashBuffer[index * HASH_LENGTH + i] = item.hash[i]; + } + }); + memory[identifier] = { + hashBuffer: this.stringifyBuffer(Pako.deflate(hashBuffer.buffer)), + timeBuffer: this.stringifyBuffer(Pako.deflate(timeBuffer.buffer)), + deleteIn: item.deleteIn, + matchStart: item.matchStart, + matchEnd: item.matchEnd, + startTime: item.sequence[0].time, + }; + }); + return memory; + } + unsetChangesFlag() { + this.hasMemoryChanges = false; + } + hashToDebugString(hash) { + const str = []; + for (let i = 0; i < hash.length; i++) { + str.push(hash[i].toString(2).padStart(32, '0')); + } + return str.join('|'); + } + loadMemoryFromSave(saved) { + // console.log("Load") + const memory = this.memory; + for (const identifier in saved) { + if (!Object.hasOwn(saved, identifier)) continue; + const hashBuffer = new Uint32Array(Pako.inflate(Uint8Array.from(atob(saved[identifier].hashBuffer), (c) => c.charCodeAt(0))).buffer); + const timeBuffer = new Uint16Array(Pako.inflate(Uint8Array.from(atob(saved[identifier].timeBuffer), (c) => c.charCodeAt(0))).buffer); + const sequence = []; + let startTime = saved[identifier].startTime; + for (let i = 0; i < timeBuffer.length; i++) { + startTime = timeBuffer[i] + startTime; + const hash = hashBuffer.slice(i * HASH_LENGTH, (i + 1) * HASH_LENGTH); + sequence.push({ + time: startTime, + hash: hash, + }); + } + if (identifier === this.currentIdentifier) { + sequence.forEach((item) => { + item.hashCounts = new Uint8Array(HASH_LENGTH * 32); + item.timeSet = new Set(); + }); + this.currentSequence = sequence; + } + memory.set(identifier, { + identifier, + sequence, + deleteIn: saved[identifier].deleteIn, + matchStart: saved[identifier].matchStart, + matchEnd: saved[identifier].matchEnd, + }); + } + } + getMatch() { + if (!this.found) return null; + const obj = { + startTime: this.clampTime(this.detectedStartTime), + endTime: this.clampTime(this.detectedEndTime), + }; + obj.diff = obj.endTime - obj.startTime; + if (obj.diff <= 0) { + return null; + } + // if (obj.diff > 60 * 2) { + // return null; + // } + return obj; + } + extractData(video) { + const time = video.currentTime; + this.ctx.drawImage(video, 0, 0, this.canvas.width, this.canvas.height); + const data = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + return { + data: data, + time: time, + }; + } + linearBitDistance(a, b) { + let xor = a ^ b; + let count = 0; + while (xor) { + xor = xor & (xor - 1); + count++; + } + return count; + } + printMatrix() { + this.calculate(); + if (!this.lastMatched) return; + const memoryEntry = this.memory.get(this.lastMatched); + const sequenceA = this.currentSequence; + const sequenceB = memoryEntry.sequence; + const aligned = this.hackyAlignment(sequenceA, sequenceB); + console.log(aligned.matrix.map((row) => row.map((val) => val.value.toString()).join('\t')).join('\n')); + console.log(aligned); + } + printComparison() { + this.calculate(); + if (!this.lastMatched) return; + const memoryEntry = this.memory.get(this.lastMatched); + const sequenceA = this.currentSequence; + const sequenceB = memoryEntry.sequence; + const aligned = this.hackyAlignment(sequenceA, sequenceB); + const offsetTime = sequenceA[aligned.startA].time - sequenceB[aligned.startB].time; + const start = Math.min(sequenceA[0].time, sequenceB[0].time + offsetTime); + const end = Math.max(sequenceA[sequenceA.length - 1].time, sequenceB[sequenceB.length - 1].time + offsetTime); + const arr = []; + for (let i = start; i <= end; i++) { + const a = sequenceA.find((item) => item.time === i); + const b = sequenceB.find((item) => (item.time + offsetTime) === i); + if (a && b) { + arr.push(`T+${i}:${this.hashDistance(a.hash, b.hash)}\n${this.debugHashString(a.hash)}\n${this.debugHashString(b.hash)}`); + } else if (a) { + arr.push(`T+${i}\n${this.debugHashString(a.hash)}\n`); + } else if (b) { + arr.push(`T+${i}\n\n${this.debugHashString(b.hash)}`); + } + } + console.log(arr.join('\n\n')); + } + debugHashString(hash) { + const str = []; + for (let i = 0; i < hash.length; i++) { + str.push(hash[i].toString(2).padStart(32, '0')); + } + return str.join(''); + } + hackyAlignment(sequenceA, sequenceB) { + let matrixMax = null; + const matrix = new Array(sequenceA.length); + for (let a = 0; a < matrix.length; a++) { + matrix[a] = new Array(sequenceB.length); + for (let b = 0; b < matrix[a].length; b++) { + const dist = this.hashDistance(sequenceA[a].hash, sequenceB[b].hash); + matrix[a][b] = { + a, b, + value: Math.max(0, ALIGN_CUTOFF - dist), + prev: null, + }; + if (matrix[a][b].value > 0) { + matrix[a][b].value += ALIGN_CUTOFF; + let ai = a - 1; + let bi = b - 1; + const timeA = sequenceA[a].time; + const timeB = sequenceB[b].time; + let max = 0; + let maxCell = null; + while (ai >= 0 && bi >= 0) { + const durationA = timeA - sequenceA[ai].time; + const durationB = timeB - sequenceB[bi].time; + if (durationA > 8 || durationB > 8) { + break; + } + const diff = Math.abs(durationA - durationB); + if (diff <= 2) { + const val = matrix[ai][bi].value - diff * Math.ceil(ALIGN_CUTOFF / 4); + if (val > max) { + max = val; + maxCell = matrix[ai][bi]; + } + } + if (durationB > durationA) { + ai--; + } else { + bi--; + } + } + matrix[a][b].value += max; + matrix[a][b].prev = maxCell; + if (!matrixMax || matrix[a][b].value > matrixMax.value) { + matrixMax = matrix[a][b]; + } + } + } + } + if (matrixMax) { + let count = 0; + let start = matrixMax; + while (start.prev) { + count++; + start = start.prev; + } + return { + count: count, + score: matrixMax.value, + startA: start.a, + startB: start.b, + endA: matrixMax.a, + endB: matrixMax.b, + matrix: matrix, + }; + } else { + return null; + } + } +} diff --git a/built/web/player/analyzer/VideoAnalyzer.mjs b/built/web/player/analyzer/VideoAnalyzer.mjs new file mode 100644 index 00000000..2775bac2 --- /dev/null +++ b/built/web/player/analyzer/VideoAnalyzer.mjs @@ -0,0 +1,349 @@ +import {AnalyzerEvents} from '../enums/AnalyzerEvents.mjs'; +import {DefaultPlayerEvents} from '../enums/DefaultPlayerEvents.mjs'; +import {DownloadStatus} from '../enums/DownloadStatus.mjs'; +import {PlayerModes} from '../enums/PlayerModes.mjs'; +import {EventEmitter} from '../modules/eventemitter.mjs'; +import {EnvUtils} from '../utils/EnvUtils.mjs'; +import {VideoAligner} from './VideoAligner.mjs'; +const AnalyzerStatus = { + IDLE: 'idle', + RUNNING: 'running', + FINISHED: 'finished', + FAILED: 'failed', +}; +export class VideoAnalyzer extends EventEmitter { + constructor(client, options) { + super(); + this.options = { + introCutoff: 5 * 60, + outroCutoff: 5 * 60, + ...options, + }; + this.client = client; + this.introAligner = new VideoAligner(); + this.outroAligner = new VideoAligner(); + this.introAligner.on(AnalyzerEvents.MATCH, (aligner) => { + this.emit(AnalyzerEvents.INTRO_MATCH, this); + this.emit(AnalyzerEvents.MATCH, this); + }); + this.outroAligner.on(AnalyzerEvents.MATCH, (aligner) => { + this.emit(AnalyzerEvents.OUTRO_MATCH, this); + this.emit(AnalyzerEvents.MATCH, this); + }); + this.introPlayer = null; + this.outroPlayer = null; + this.introStatus = AnalyzerStatus.IDLE; + this.outroStatus = AnalyzerStatus.IDLE; + this.lastAnalyzerSave = 0; + this.enabled = true; + } + getOutro() { + if (!this.enabled) return null; + return this.outroAligner.getMatch(); + } + getIntro() { + if (!this.enabled) return null; + return this.introAligner.getMatch(); + } + reset() { + this.destroyPlayers(); + this.introStatus = AnalyzerStatus.IDLE; + this.outroStatus = AnalyzerStatus.IDLE; + } + saveAnalyzerData() { + if (!this.introAligner.hasMemoryChanges && !this.outroAligner.hasMemoryChanges) { + return; + } + const now = Date.now(); + if (now - this.lastAnalyzerSave <= 1000 * 10) { + return; + } + this.lastAnalyzerSave = now; + if (EnvUtils.isExtension()) { + this.introAligner.unsetChangesFlag(); + this.outroAligner.unsetChangesFlag(); + chrome.runtime.sendMessage({ + type: 'analyzerData', + data: { + intro: this.introAligner.getMemoryForSave(), + outro: this.outroAligner.getMemoryForSave(), + }, + }); + } + } + loadAnalyzerData(data) { + console.log('[VideoAnalyzer] Loading analyzer data'); + if (data.intro) { + this.introAligner.loadMemoryFromSave(data.intro); + } + if (data.outro) { + this.outroAligner.loadMemoryFromSave(data.outro); + } + } + destroyPlayers() { + if (this.introPlayer) { + this.introPlayer.destroy(); + this.introPlayer = null; + } + if (this.outroPlayer) { + this.outroPlayer.destroy(); + this.outroPlayer = null; + } + } + async update() { + if (!this.shouldAnalyze()) return; + const duration = this.client.duration; + const introStart = 0; + const introEnd = Math.min(introStart + this.options.introCutoff, duration); + const outroStart = Math.max(duration - this.options.outroCutoff, introEnd); + const outroEnd = duration; + this.introAligner.setRange(introStart, introEnd); + this.outroAligner.setRange(outroStart, outroEnd); + if (this.outroStatus !== AnalyzerStatus.RUNNING && this.introStatus === AnalyzerStatus.IDLE && introEnd - introStart > 30) { + if (this.shouldLoadPlayer(introStart, introEnd)) { + console.log('[VideoAnalyzer] Running intro finder in background', introStart, introEnd); + this.introStatus = AnalyzerStatus.RUNNING; + const reserved = this.referenceFragments(introStart, introEnd); + this.introPlayer = await this.loadPlayer(this.introAligner, introStart, introEnd, (completed) => { + this.introStatus = completed ? AnalyzerStatus.FINISHED : AnalyzerStatus.FAILED; + this.introPlayer = null; + console.log('[VideoAnalyzer] Intro finder completed', completed); + this.dereferenceFragments(reserved); + this.client.interfaceController.updateMarkers(); + }); + if (!this.introPlayer) { + this.introStatus = AnalyzerStatus.FAILED; + console.log('[VideoAnalyzer] Intro finder failed'); + this.client.interfaceController.updateMarkers(); + } + } + } + if (this.introStatus !== AnalyzerStatus.RUNNING && this.outroStatus === AnalyzerStatus.IDLE && outroEnd - outroStart > 30) { + if (this.shouldLoadPlayer(outroStart, outroEnd)) { + console.log('[VideoAnalyzer] Running outro finder in background', outroStart, outroEnd); + this.outroStatus = AnalyzerStatus.RUNNING; + const reserved = this.referenceFragments(outroStart, outroEnd); + this.outroPlayer = await this.loadPlayer(this.outroAligner, outroStart, outroEnd, (completed) => { + this.outroStatus = completed ? AnalyzerStatus.FINISHED : AnalyzerStatus.FAILED; + this.outroPlayer = null; + console.log('[VideoAnalyzer] Outro finder completed', completed); + this.dereferenceFragments(reserved); + this.client.interfaceController.updateMarkers(); + }); + if (!this.outroPlayer) { + this.outroStatus = AnalyzerStatus.FAILED; + console.log('[VideoAnalyzer] Outro finder failed'); + this.client.interfaceController.updateMarkers(); + } + } + } + } + isRunning() { + return this.introStatus === AnalyzerStatus.RUNNING || this.outroStatus === AnalyzerStatus.RUNNING; + } + destroy() { + this.destroyPlayers(); + } + isModeSupported() { + const mode = this.source.mode; + const supportedModes = [ + PlayerModes.ACCELERATED_HLS, + PlayerModes.ACCELERATED_MP4, + PlayerModes.ACCELERATED_DASH, + ]; + return supportedModes.includes(mode); + } + shouldLoadPlayer(timeStart, timeEnd) { + if (this.isModeSupported()) { + const fragments = this.client.fragments; + if (!fragments || fragments.length === 0) return false; + if (this.client.currentLevel === -1) return false; + const start = fragments.find((fragment) => { + return fragment && fragment.start <= timeStart && fragment.end >= timeStart; + }); + if (!start) return false; + return start.status === DownloadStatus.DOWNLOAD_COMPLETE || !this.client.options.downloadAll; + } else if (this.source.mode === PlayerModes.DIRECT) { + return true; + } + return false; + } + dereferenceFragments(fragments) { + for (let i = 0; i < fragments.length; i++) { + fragments[i].removeReference(); + } + fragments.length = 0; + } + referenceFragments(timeStart, timeEnd) { + if (!this.isModeSupported()) { + return []; + } + const fragments = this.client.fragments; + if (!fragments || fragments.length === 0) return []; + let start = fragments.find((fragment) => { + return fragment && fragment.start <= timeStart && fragment.end >= timeStart; + }); + if (!start) return []; + start = fragments.indexOf(start); + const reserved = []; + for (let i = start; i < fragments.length; i++) { + if (fragments[i].end > timeEnd) { + break; + } + fragments[i].addReference(); + reserved.push(fragments[i]); + } + return reserved; + } + async loadPlayer(aligner, timeStart, timeEnd, onDone) { + const player = await this.client.playerLoader.createPlayer(this.source.mode, this.client, { + isAnalyzer: true, + }); + await player.setup(); + player.on(DefaultPlayerEvents.MANIFEST_PARSED, () => { + player.currentLevel = this.client.currentLevel; + player.load(); + }); + const onLoadMeta = () => { + player.off(DefaultPlayerEvents.LOADEDMETADATA, onLoadMeta); + this.runAnalyzerInBackground(player, aligner, timeStart, timeEnd, onDone); + }; + player.on(DefaultPlayerEvents.LOADEDMETADATA, onLoadMeta); + await player.setSource(this.source); + return player; + } + shouldAnalyze() { + if (!this.enabled) { + return false; + } + if (!this.source) { + return false; + } + const duration = this.client.duration; + if (!duration) { // No duration + return false; + } + if (duration < 5 * 60) { // Video is too short + return false; + } + if (duration > 90 * 60) { // Video is likely a movie + return false; + } + return true; + } + getMarkerPosition() { + if (this.introStatus === AnalyzerStatus.RUNNING) { + return this.introPlayer.currentTime; + } else if (this.outroStatus === AnalyzerStatus.RUNNING) { + return this.outroPlayer.currentTime; + } + return null; + } + runAnalyzerInBackground(player, aligner, timeStart, timeEnd, onDone) { + // document.body.appendChild(player.video); + player.currentTime = timeStart; + player.playbackRate = 6; + player.volume = 0; + player.play(); + let destroyed = false; + let completed = false; + const context = player.createContext(); + context.on(DefaultPlayerEvents.DESTROYED, () => { + context.destroy(); + destroyed = true; + onDone(completed); + }); + context.on(DefaultPlayerEvents.ENDED, () => { + completed = true; + player.destroy(); + }); + let pauseTimeout; + let lastTime = -1; + let lastCalculate = Date.now(); + const onAnimFrame = () => { + if (destroyed) { + aligner.calculate(); + return; + } + if (player.readyState >= 1 && player.paused) { + player.play(); + player.currentTime = Math.max(player.currentTime - 1.5, timeStart); + console.log('[VideoAnalyzer] Resumed analyzer'); + } + requestAnimationFrame(onAnimFrame); + clearTimeout(pauseTimeout); + pauseTimeout = setTimeout(() => { + if (!destroyed && player.readyState >= 1) { + player.pause(); + console.log('[VideoAnalyzer] Paused analyzer'); + } + }, 100); + if (player.readyState < 2) { + return; + } + const time = player.currentTime; + if (time + 1 < timeStart) { + console.log('[VideoAnalyzer] Seeking analyzer back to start'); + player.currentTime = timeStart; + return; + } + if (time === lastTime) return; + lastTime = time; + if (time < timeStart) { + player.currentTime = timeStart; + return; + } + if (time >= timeEnd) { + completed = true; + player.destroy(); + return; + } + aligner.pushVideoFrame(player.getVideo()); + if (Date.now() - lastCalculate > 1000) { + setTimeout(() => { + aligner.calculate(); + lastCalculate = Date.now(); + }, 1); + lastCalculate = Date.now(); + } + this.client.interfaceController.updateMarkers(); + }; + requestAnimationFrame(onAnimFrame); + } + setLevel(level) { + this.destroyPlayers(); + if (this.introStatus === AnalyzerStatus.FAILED) { + this.introStatus = AnalyzerStatus.IDLE; + } + if (this.outroStatus === AnalyzerStatus.FAILED) { + this.outroStatus = AnalyzerStatus.IDLE; + } + } + pushFrame(video) { + if (!this.shouldAnalyze()) return false; + const time = video.currentTime; + if (time < this.options.introCutoff) { + return this.introAligner.pushVideoFrame(video); + } else if (this.client.duration - this.options.outroCutoff < time) { + return this.outroAligner.pushVideoFrame(video); + } + return false; + } + calculate() { + this.introAligner.calculate(); + this.outroAligner.calculate(); + } + async setSource(source) { + this.reset(); + this.source = source; + this.introAligner.prepare(source.identifier); + this.outroAligner.prepare(source.identifier); + } + enable() { + this.enabled = true; + } + disable() { + this.enabled = false; + this.reset(); + } +} diff --git a/built/web/player/analyzer/dHash.mjs b/built/web/player/analyzer/dHash.mjs new file mode 100644 index 00000000..9f9a18eb --- /dev/null +++ b/built/web/player/analyzer/dHash.mjs @@ -0,0 +1,46 @@ +export class dHash { + static getHash(imageData) { + const width = imageData.width; + const height = imageData.height; + return this.computeHash(this.convertToGrayscale(imageData.data), width, height); + } + static computeHash(data, width, height) { + let hash = ''; + for (let y = 1; y < height; y += 2) { + for (let x = 1; x < width; x += 2) { + if (data[y * width + x] > data[y * width + x - 1]) { + hash += '1'; + } else { + hash += '0'; + } + if (data[y * width + x] > data[(y - 1) * width + x]) { + hash += '1'; + } else { + hash += '0'; + } + } + } + return hash; + } + static convertToGrayscale(data) { + const newArr = new Uint8ClampedArray(data.length / 4); + for (let i = 0; i < data.length; i += 4) { + // Grayscale = 0.299R + 0.587G + 0.114B + const gray = data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114; + newArr[i / 4] = gray; + } + return newArr; + } + static splitRGB(data) { + const r = new Uint8ClampedArray(data.length / 4); + const g = new Uint8ClampedArray(data.length / 4); + const b = new Uint8ClampedArray(data.length / 4); + for (let i = 0; i < data.length; i += 4) { + // Grayscale = 0.299R + 0.587G + 0.114B + r[i / 4] = data[i]; + g[i / 4] = data[i + 1]; + b[i / 4] = data[i + 2]; + } + return [r, g, b]; + } +} diff --git a/built/web/player/assets/.DS_Store b/built/web/player/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5f658a6f54fc10e31b3b4c59325df72414411cb0 GIT binary patch literal 6148 zcmeHKL5mYH6n@#QHnj*v6c@Y%ya*O-cb5fOSjKMs1J0rcl{(X@yQ9;|Fw+XEs-EXVC-R`2T=8tzfZMDC5uvj$Yo%@dtpAFt8<5Yj5 z)nhKiWN7Rr;}XuXQt@(8F-$^SEKw^cHm|Z$;;2#0T-~30`NJ=tFTTIt82p>k4e!#}=LcPpj|$>p||xDc}_NuM`lqzTfZREAiR7@p5$5D)cw#WW*~i mnh-4bI5rhJig(bBVV|N3qQ_WT#1=I7BVc53g;U_4D)0;C%%4^O literal 0 HcmV?d00001 diff --git a/built/web/player/assets/coloris/css/coloris.css b/built/web/player/assets/coloris/css/coloris.css new file mode 100644 index 00000000..795691c1 --- /dev/null +++ b/built/web/player/assets/coloris/css/coloris.css @@ -0,0 +1,577 @@ +.clr-picker { + display: none; + flex-wrap: wrap; + position: absolute; + width: 200px; + z-index: 1000; + border-radius: 10px; + background-color: #fff; + justify-content: flex-end; + direction: ltr; + box-shadow: 0 0 5px rgba(0,0,0,.05), 0 5px 20px rgba(0,0,0,.1); + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; +} + +.clr-picker.clr-open, +.clr-picker[data-inline="true"] { + display: flex; +} + +.clr-picker[data-inline="true"] { + position: relative; +} + +.clr-gradient { + position: relative; + width: 100%; + height: 100px; + margin-bottom: 15px; + border-radius: 3px 3px 0 0; + background-image: linear-gradient(rgba(0,0,0,0), #000), linear-gradient(90deg, #fff, currentColor); + cursor: pointer; +} + +.clr-marker { + position: absolute; + width: 12px; + height: 12px; + margin: -6px 0 0 -6px; + border: 1px solid #fff; + border-radius: 50%; + background-color: currentColor; + cursor: pointer; +} + +.clr-picker input[type="range"]::-webkit-slider-runnable-track { + width: 100%; + height: 16px; +} + +.clr-picker input[type="range"]::-webkit-slider-thumb { + width: 16px; + height: 16px; + -webkit-appearance: none; +} + +.clr-picker input[type="range"]::-moz-range-track { + width: 100%; + height: 16px; + border: 0; +} + +.clr-picker input[type="range"]::-moz-range-thumb { + width: 16px; + height: 16px; + border: 0; +} + +.clr-hue { + background-image: linear-gradient(to right, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%); +} + +.clr-hue, +.clr-alpha { + position: relative; + width: calc(100% - 40px); + height: 8px; + margin: 5px 20px; + border-radius: 4px; +} + +.clr-alpha span { + display: block; + height: 100%; + width: 100%; + border-radius: inherit; + background-image: linear-gradient(90deg, rgba(0,0,0,0), currentColor); +} + +.clr-hue input, +.clr-alpha input { + position: absolute; + width: calc(100% + 32px); + height: 16px; + left: -16px; + top: -4px; + margin: 0; + background-color: transparent; + opacity: 0; + cursor: pointer; + appearance: none; + -webkit-appearance: none; +} + +.clr-hue div, +.clr-alpha div { + position: absolute; + width: 16px; + height: 16px; + left: 0; + top: 50%; + margin-left: -8px; + transform: translateY(-50%); + border: 2px solid #fff; + border-radius: 50%; + background-color: currentColor; + box-shadow: 0 0 1px #888; + pointer-events: none; +} + +.clr-alpha div:before { + content: ''; + position: absolute; + height: 100%; + width: 100%; + left: 0; + top: 0; + border-radius: 50%; + background-color: currentColor; +} + +.clr-format { + display: none; + order: 1; + width: calc(100% - 40px); + margin: 0 20px 20px; +} + +.clr-segmented { + display: flex; + position: relative; + width: 100%; + margin: 0; + padding: 0; + border: 1px solid #ddd; + border-radius: 15px; + box-sizing: border-box; + color: #999; + font-size: 12px; +} + +.clr-segmented input, +.clr-segmented legend { + position: absolute; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + border: 0; + left: 0; + top: 0; + opacity: 0; + pointer-events: none; +} + +.clr-segmented label { + flex-grow: 1; + margin: 0; + padding: 4px 0; + font-size: inherit; + font-weight: normal; + line-height: initial; + text-align: center; + cursor: pointer; +} + +.clr-segmented label:first-of-type { + border-radius: 10px 0 0 10px; +} + +.clr-segmented label:last-of-type { + border-radius: 0 10px 10px 0; +} + +.clr-segmented input:checked + label { + color: #fff; + background-color: #666; +} + +.clr-swatches { + order: 2; + width: calc(100% - 32px); + margin: 0 16px; +} + +.clr-swatches div { + display: flex; + flex-wrap: wrap; + padding-bottom: 12px; + justify-content: center; +} + +.clr-swatches button { + position: relative; + width: 20px; + height: 20px; + margin: 0 4px 6px 4px; + padding: 0; + border: 0; + border-radius: 50%; + color: inherit; + text-indent: -1000px; + white-space: nowrap; + overflow: hidden; + cursor: pointer; +} + +.clr-swatches button:after { + content: ''; + display: block; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border-radius: inherit; + background-color: currentColor; + box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); +} + +input.clr-color { + order: 1; + width: calc(100% - 80px); + height: 32px; + margin: 15px 20px 20px auto; + padding: 0 10px; + border: 1px solid #ddd; + border-radius: 16px; + color: #444; + background-color: #fff; + font-family: sans-serif; + font-size: 14px; + text-align: center; + box-shadow: none; +} + +input.clr-color:focus { + outline: none; + border: 1px solid #1e90ff; +} + +.clr-close, +.clr-clear { + display: none; + order: 2; + height: 24px; + margin: 0 20px 20px; + padding: 0 20px; + border: 0; + border-radius: 12px; + color: #fff; + background-color: #666; + font-family: inherit; + font-size: 12px; + font-weight: 400; + cursor: pointer; +} + +.clr-close { + display: block; + margin: 0 20px 20px auto; +} + +.clr-preview { + position: relative; + width: 32px; + height: 32px; + margin: 15px 0 20px 20px; + border-radius: 50%; + overflow: hidden; +} + +.clr-preview:before, +.clr-preview:after { + content: ''; + position: absolute; + height: 100%; + width: 100%; + left: 0; + top: 0; + border: 1px solid #fff; + border-radius: 50%; +} + +.clr-preview:after { + border: 0; + background-color: currentColor; + box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); +} + +.clr-preview button { + position: absolute; + width: 100%; + height: 100%; + z-index: 1; + margin: 0; + padding: 0; + border: 0; + border-radius: 50%; + outline-offset: -2px; + background-color: transparent; + text-indent: -9999px; + cursor: pointer; + overflow: hidden; +} + +.clr-marker, +.clr-hue div, +.clr-alpha div, +.clr-color { + box-sizing: border-box; +} + +.clr-field { + display: inline-block; + position: relative; + color: transparent; +} + +.clr-field input { + margin: 0; + direction: ltr; +} + +.clr-field.clr-rtl input { + text-align: right; +} + +.clr-field button { + position: absolute; + width: 30px; + height: 100%; + right: 0; + top: 50%; + transform: translateY(-50%); + margin: 0; + padding: 0; + border: 0; + color: inherit; + text-indent: -1000px; + white-space: nowrap; + overflow: hidden; + pointer-events: none; +} + +.clr-field.clr-rtl button { + right: auto; + left: 0; +} + +.clr-field button:after { + content: ''; + display: block; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border-radius: inherit; + background-color: currentColor; + box-shadow: inset 0 0 1px rgba(0,0,0,.5); +} + +.clr-alpha, +.clr-alpha div, +.clr-swatches button, +.clr-preview:before, +.clr-field button { + background-image: repeating-linear-gradient(45deg, #aaa 25%, transparent 25%, transparent 75%, #aaa 75%, #aaa), repeating-linear-gradient(45deg, #aaa 25%, #fff 25%, #fff 75%, #aaa 75%, #aaa); + background-position: 0 0, 4px 4px; + background-size: 8px 8px; +} + +.clr-marker:focus { + outline: none; +} + +.clr-keyboard-nav .clr-marker:focus, +.clr-keyboard-nav .clr-hue input:focus + div, +.clr-keyboard-nav .clr-alpha input:focus + div, +.clr-keyboard-nav .clr-segmented input:focus + label { + outline: none; + box-shadow: 0 0 0 2px #1e90ff, 0 0 2px 2px #fff; +} + +.clr-picker[data-alpha="false"] .clr-alpha { + display: none; +} + +.clr-picker[data-minimal="true"] { + padding-top: 16px; +} + +.clr-picker[data-minimal="true"] .clr-gradient, +.clr-picker[data-minimal="true"] .clr-hue, +.clr-picker[data-minimal="true"] .clr-alpha, +.clr-picker[data-minimal="true"] .clr-color, +.clr-picker[data-minimal="true"] .clr-preview { + display: none; +} + +/** Dark theme **/ + +.clr-dark { + background-color: #444; +} + +.clr-dark .clr-segmented { + border-color: #777; +} + +.clr-dark .clr-swatches button:after { + box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); +} + +.clr-dark input.clr-color { + color: #fff; + border-color: #777; + background-color: #555; +} + +.clr-dark input.clr-color:focus { + border-color: #1e90ff; +} + +.clr-dark .clr-preview:after { + box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); +} + +.clr-dark .clr-alpha, +.clr-dark .clr-alpha div, +.clr-dark .clr-swatches button, +.clr-dark .clr-preview:before { + background-image: repeating-linear-gradient(45deg, #666 25%, transparent 25%, transparent 75%, #888 75%, #888), repeating-linear-gradient(45deg, #888 25%, #444 25%, #444 75%, #888 75%, #888); +} + +/** Polaroid theme **/ + +.clr-picker.clr-polaroid { + border-radius: 6px; + box-shadow: 0 0 5px rgba(0,0,0,.1), 0 5px 30px rgba(0,0,0,.2); +} + +.clr-picker.clr-polaroid:before { + content: ''; + display: block; + position: absolute; + width: 16px; + height: 10px; + left: 20px; + top: -10px; + border: solid transparent; + border-width: 0 8px 10px 8px; + border-bottom-color: currentColor; + box-sizing: border-box; + color: #fff; + filter: drop-shadow(0 -4px 3px rgba(0,0,0,.1)); + pointer-events: none; +} + +.clr-picker.clr-polaroid.clr-dark:before { + color: #444; +} + +.clr-picker.clr-polaroid.clr-left:before { + left: auto; + right: 20px; +} + +.clr-picker.clr-polaroid.clr-top:before { + top: auto; + bottom: -10px; + transform: rotateZ(180deg); +} + +.clr-polaroid .clr-gradient { + width: calc(100% - 20px); + height: 120px; + margin: 10px; + border-radius: 3px; +} + +.clr-polaroid .clr-hue, +.clr-polaroid .clr-alpha { + width: calc(100% - 30px); + height: 10px; + margin: 6px 15px; + border-radius: 5px; +} + +.clr-polaroid .clr-hue div, +.clr-polaroid .clr-alpha div { + box-shadow: 0 0 5px rgba(0,0,0,.2); +} + +.clr-polaroid .clr-format { + width: calc(100% - 20px); + margin: 0 10px 15px; +} + +.clr-polaroid .clr-swatches { + width: calc(100% - 12px); + margin: 0 6px; +} +.clr-polaroid .clr-swatches div { + padding-bottom: 10px; +} + +.clr-polaroid .clr-swatches button { + width: 22px; + height: 22px; +} + +.clr-polaroid input.clr-color { + width: calc(100% - 60px); + margin: 10px 10px 15px auto; +} + +.clr-polaroid .clr-clear { + margin: 0 10px 15px 10px; +} + +.clr-polaroid .clr-close { + margin: 0 10px 15px auto; +} + +.clr-polaroid .clr-preview { + margin: 10px 0 15px 10px; +} + +/** Large theme **/ + +.clr-picker.clr-large { + width: 275px; +} + +.clr-large .clr-gradient { + height: 150px; +} + +.clr-large .clr-swatches button { + width: 22px; + height: 22px; +} + +/** Pill (horizontal) theme **/ + +.clr-picker.clr-pill { + width: 380px; + padding-left: 180px; + box-sizing: border-box; +} + +.clr-pill .clr-gradient { + position: absolute; + width: 180px; + height: 100%; + left: 0; + top: 0; + margin-bottom: 0; + border-radius: 3px 0 0 3px; +} + +.clr-pill .clr-hue { + margin-top: 20px; +} \ No newline at end of file diff --git a/built/web/player/assets/fluidplayer/.DS_Store b/built/web/player/assets/fluidplayer/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b7d1f51520d2f999702e9b1e7480bba3517ede23 GIT binary patch literal 6148 zcmeHKJ5Iwu5S>jTWS~h2ov)A^m|*CrasjX{K_punWT3?*2jC!xmYSABZ~~6No1G!? z5<-bkG$YNv&3x9g&(>~+h}`tHnh=eND1kB#b}{@Q>}Oq*fm-%}j@Kyb!uy)7LvKE_gs=w+7 zFTR5UZs-C!r}C>1d{eO_F6a31yT4!5-QmmWTN8?k7H|Bjv`sN_fx3Gx)5I7s28@C2 zV1Un8NU|?zqcLC%7z0ZN_*7Mp#=brU=D&g_Y$0wDrSnEAUqH!sX$3} z+G03KhdtG}OtBM`baL8!IDN9y4#kD1WBoLQlgk8cGzN@;m;r6l$9(^vZ0`T#B>QCy z7z10yfE(qre2OjU-MY3pzH3wHIh2LtI>BWMCgCbZEMLV3&>*mvideo { + position: absolute; + inset: 0px; + width: 100%; + height: 100%; +} + +.mainplayer { + background-color: var(--mainplayer-background-color); + user-select: none; + justify-content: center; + display: flex; + width: 100%; + height: 100%; +} + +.mainplayer.player-hidden { + opacity: 0; +} + +.fluid_video_sources_list { + border: var(--menu-border); +} + +.fluid_video_source_list_item.source_active { + font-weight: bold; + background-color: var(--menu-list-item-active-background-color); +} + +.fluid_controls_progress_container .seek_preview { + position: absolute; + background-color: var(--seek-preview-background-color); + font-size: 16px; + text-align: center; + padding: 3px 10px; + border-radius: 3px; + color: var(--seek-preview-text-color); + transform: translate(-50%, 0%); + bottom: 16px; + pointer-events: none; +} + +.fluid_controls_progress_container .seek_preview_tip { + position: absolute; + bottom: 3px; + pointer-events: none; +} + +.fluid_controls_progress_container .seek_preview_tip>div { + border-width: 5px; + border-style: solid; + border-color: var(--seek-preview-background-color) transparent transparent; + width: 0px; + left: calc(50% - 5px); + position: absolute; + bottom: 3px; +} + +.fluid_controls_progress_container .seek_preview_tip.detached>div { + border-color: var(--seek-preview-detached-tip-color) transparent transparent; +} + +.fluid_controls_progress_container .seek_preview .seek_preview_video { + position: absolute; + bottom: 25px; + left: 50%; + transform: translate(-50%, 0%); + border: 1px solid rgba(200, 200, 200, 0.2); + height: 100px; + background-color: black; + background-clip: padding-box; + overflow: hidden; + border-radius: 3px; +} + +.fluid_controls_progress_container .seek_preview .seek_preview_video video { + height: 100px; +} + +.progress_loaded_container { + position: absolute; + overflow: hidden; + inset: 0px; + z-index: -1; +} + +.progress_loaded_container>div { + position: absolute; + top: 0px; + bottom: 0px; +} + +.progress_loaded_container>div.download-audio { + top: auto; + height: 1px; +} + +.progress_loaded_container>div.download-video { + bottom: 1px; +} + +.progress_loaded_container>div.download-initiated { + background-color: var(--progress-download-initiated-color); +} + +.progress_loaded_container>div.download-complete { + background-color: var(--progress-download-complete-color); +} + +.progress_loaded_container>div.download-failed { + background-color: var(--progress-download-failed-color); +} + +.subtitles_menu { + border-top-right-radius: 3px; + border: var(--menu-border); + border-top-left-radius: 3px; + position: absolute; + bottom: 36px; + background-color: var(--menu-background-color); + color: var(--menu-text-color); + width: 250px; + max-height: calc(100vh - 200px); + overflow-y: auto; + right: 0px; + z-index: 1000; + font-size: 16px; + cursor: auto; + word-wrap: break-word; + white-space: normal; +} + +.status_message { + display: inline-block; + height: 24px; + line-height: 22px; + vertical-align: top; + font-size: 15px; + margin-left: 2px; + overflow: hidden; + text-overflow: ellipsis; + flex: 0 1 auto; + min-width: 50px; +} + +.status_message.success { + color: var(--status-success-color); +} +.status_message.error { + color: var(--status-error-color); +} +.status_message.warning { + color: var(--status-warning-color); +} + +.reset_failed { + color: var(--status-error-color); + display: inline-block; + height: 24px; + line-height: 22px; + vertical-align: top; + font-size: 13px; + margin-left: 2px; + flex: 0 1 auto; + padding: 0px 3px; + border-radius: 4px; + cursor: pointer; +} + +.reset_failed:focus, +.reset_failed:hover { + outline: 1px solid var(--status-error-color); +} + + +.spinner { + background-image: url("../static/fluid-spinner.svg"); + background-repeat: no-repeat; + background-position: center; + width: 24px; + height: 24px; + opacity: 0.8; +} + +.seek_preview_video .spinner { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + visibility: hidden; +} + +.seek_preview_video.loading .spinner { + visibility: visible; +} + + + +.buffering_spinner { + display: inline-block; + vertical-align: top; + height: 24px; + font-size: 13px; + line-height: 22px; + min-width: 100px; +} + +.buffering_spinner>.spinner { + float: left; + margin-right: 4px; +} + +.subtitle-track-wrapper { + margin-top: 5px; +} + +.intro_outro_container { + position: absolute; + inset: 0px; + z-index: 1; +} + +.intro_outro_container>div { + border-radius: 1px; + position: absolute; + top: 3px; + bottom: 0px; + background-color: var(--intro-outro-bar-color); +} + + +.hide_button { + color: var(--popbutton-text-color); + position: absolute; + bottom: 50px; + left: 12px; + background-color: var(--popbutton-background-color); + padding: 0px; + font-size: 18px; + opacity: 0; + width: 0px; + height: 0px; + transition: bottom 0.5s; + overflow: hidden; +} + +.hide_button:focus { + opacity: 1; + height: auto; + width: auto; + cursor: pointer; + padding: 4px 10px; + background-color: var(--popbutton-hover-background-color); + border: var(--popbutton-hover-border); +} + +.skip_button { + color: var(--popbutton-text-color); + position: absolute; + bottom: 50px; + right: 12px; + background-color: var(--popbutton-background-color); + border: var(--popbutton-border); + padding: 4px 10px; + font-size: 18px; + cursor: pointer; + transition: bottom 0.5s; +} + +.fluid_video_wrapper.fluid_player_layout_default.expanded.controls_visible .hide_button, +.fluid_video_wrapper.fluid_player_layout_default.expanded.controls_visible .skip_button { + bottom: 130px; +} + +.skip_button:hover { + background-color: var(--popbutton-hover-background-color); + border: var(--popbutton-hover-border); +} + +.marker_container { + position: absolute; + inset: 0px; + z-index: 2; +} + +.marker_container>div { + border-radius: 1px; + position: absolute; + transform: translate(-50%, 0); +} + +.marker_container>div.seek_marker { + top: 0px; + width: 0px; + height: 0px; + border-top: 3px solid var(--seek-marker-undo-color); + border-left: 2px solid transparent; + border-right: 2px solid transparent; +} + +.fluid_controls_progress_container .seek_marker { + display: none; +} + +.fluid_controls_progress_container:hover .seek_marker, +.fluid_controls_progress_container.skip_freeze .seek_marker { + display: block; +} + +.marker_container>div.unseek_marker { + border-top: 3px solid var(--seek-marker-redo-color); +} + +.marker_container>div.analyzer_marker { + background-color: var(--analyzer-marker-color); + bottom: 0px; + top: 3px; + width: 2px; +} + +.volume_block { + display: flex; +} + +.subtitles_options { + padding-bottom: 5px; +} + +.subtitles_options_back { + border-radius: 5px; + cursor: pointer; + padding: 3px 10px; + background-color: var(--menu-textbutton-background-color); + color: var(--menu-textbutton-text-color); +} + +.subtitles_options_header { + display: flex; + justify-content: center; + align-items: center; + padding: 5px 5px; + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + gap: 5px; + margin-bottom: 5px; +} + +.subtitles_title { + flex: 1 1 auto; + text-align: center; + font-size: 16px; +} + +.subtitles_options_back:hover { + background-color: var(--menu-textbutton-hover-background-color); +} + +.subtitles_options .option { + position: relative; + font-size: 14px; + width: 100%; + height: 25px; + margin-bottom: 5px; +} + +.subtitles_options .option div { + position: absolute; + top: 50%; + transform: translate(0, -50%); + left: 10px; + right: 50%; +} + +.subtitles_options .option input { + border: 1px solid rgba(255, 255, 255, 0.3); + background-color: rgba(0, 0, 0, 0.2); + border-radius: 4px; + color: white; + position: absolute; + top: 0px; + bottom: 0px; + right: 10px; + left: 50%; + +} + +.subtitles_options .option input:focus { + outline: none; + border: 1px solid rgba(255, 255, 255, 0.5); +} + +.subtitles_test_button { + display: inline-block; + border-radius: 5px; + cursor: pointer; + padding: 5px 10px; + background-color: var(--menu-textbutton-background-color); + color: var(--menu-textbutton-text-color); + min-width: 120px; + max-width: 200px; + text-align: center; +} + +.subtitles_test_button:hover { + background-color: var(--menu-textbutton-hover-background-color); +} + + +.close_button { + cursor: pointer; + position: absolute; + width: 14px; + height: 14px; + background-color: var(--close-button-color); + border-radius: 50%; +} + +.close_button:hover { + background-color: var(--close-button-hover-color); +} + +.popwindow .close_button { + top: 5px; + right: 5px; +} + +.popwindow { + padding: 1px 20px; + border-radius: 5px; + border: var(--popwindow-border); + position: absolute; + display: flex; + gap: 5px; + flex-direction: column; + top: 20px; + bottom: 60px; + left: 10%; + right: 10%; + background-color: var(--popwindow-background-color); + color: var(--popwindow-text-color); + z-index: 2; + transition: bottom 0.5s; + cursor: auto; +} + +.popwindow .title { + font-size: 13px; + text-align: center; +} + +.expanded.controls_visible .popwindow { + bottom: 140px; +} + +.dropdown { + position: relative; + cursor: pointer; + user-select: none; + background-color: var(--popwindow-button-background-color); + border-radius: 2px; + display: inline-block; + color: var(--popwindow-button-titletext-color); + padding: 3px 10px; +} + +.dropdown:hover { + outline: none; +} + +.dropdown>div { + text-align: center; +} + +.dropdown>div>div { + text-align: center; + width: 100%; + color: var(--popwindow-button-text-color); + padding: 4px 0px; + background-color: var(--popwindow-dropdown-item-background-color); +} + +.dropdown .items { + overflow-y: auto; + max-height: calc(80vh - 50px); + display: none; + z-index: 1000; +} + +.dropdown:hover .items { + display: block; +} + +.dropdown:focus .items { + display: block; +} + +.dropdown>.items>div:hover { + background-color: var(--popwindow-dropdown-item-hover-background-color); +} + +.dropdown:hover { + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +.dropdown_text { + display: inline-block; + border: none; + outline: none; + border-radius: 3px; + color: var(--popwindow-button-text-color); +} + +.dropdown_text:focus { + outline: var(--popwindow-dropdown-text-focus-outline); + padding: 0px 5px; +} + +.subtitle-type-selector, +.subtitle-sort-selector, +.subtitle-sort-direction-selector { + margin-right: 4px; + font-size: 14px; + min-width: 120px; + height: 25px; + line-height: 25px; + border-radius: 4px; + margin-bottom: 5px; +} + +.subtitle-sort-selector { + min-width: 160px; +} + +.text_input { + color: var(--popwindow-button-text-color); + background-color: transparent; + font-size: 15px; + border-radius: 2px; + padding: 2px 5px; + height: 20px; + outline: none; + background-color: var(--popwindow-button-background-color); + border: 1px solid var(--popwindow-button-background-color); +} + +.text_input:focus { + border: 1px solid var(--popwindow-textinput-focus-border-color); +} + +.subtitle-episode-input, +.subtitle-season-input, +.subtitle-language-input, +.subtitle-year-input, +.subtitle-search-input { + margin-right: 4px; + width: 70px; + text-align: center; + height: 25px; + border-radius: 4px; + margin-bottom: 5px; +} + +.subtitle-search-input { + width: calc(100% - 100px); + margin-bottom: 5px; + text-align: left; +} + +.textbutton { + display: inline-block; + cursor: pointer; + padding: 2px 10px; + font-size: 15px; + height: 27px; + text-align: center; + line-height: 25px; + border-radius: 4px; + background-color: var(--popwindow-button-background-color); + color: var(--popwindow-button-text-color); +} + +.subtitle-search-btn { + width: 60px; +} + +.textbutton:hover { + background-color: var(--popwindow-button-hover-background-color); +} + +.subtitle-results { + overflow-y: auto; + flex: 1 1 auto; +} + +.linkui-sources-found { + font-size: 18px; + display: block; + text-align: center; +} + +.linkui-addnew-button, +.linkui-clear-button { + position: absolute; + top: 20px; + right: 20px; + cursor: pointer; + padding: 2px 10px; + font-size: 12px; + height: 25px; + text-align: center; + line-height: 25px; + border-radius: 4px; + background-color: var(--popwindow-button-background-color); + color: var(--popwindow-button-text-color); +} + + +.linkui-addnew-button { + left: 20px; + right: auto; +} + +.linkui-addnew-button:hover, +.linkui-clear-button:hover { + background-color: var(--popwindow-button-hover-background-color); +} + +.linkui-sources-list { + border-top: var(--menu-border); + margin-top: 10px; + overflow-y: auto; + flex: 1 1 auto; +} + +.linkui-source { + padding: 5px 0px; + border-bottom: var(--menu-border); +} + +.linkui-source-url { + display: block; + width: calc(100% - 20px); + margin-bottom: 5px; +} + +.linkui-source-mode { + font-size: 12px; + min-width: 180px; + line-height: 25px; + height: 25px; + padding: 2px 5px; + border-radius: 4px; + margin-right: 5px; +} + +.linkui-source-headers-button, +.linkui-source-set-button, +.linkui-source-delete-button { + display: inline-block; + cursor: pointer; + padding: 2px 10px; + font-size: 12px; + height: 25px; + text-align: center; + line-height: 25px; + border-radius: 4px; + background-color: var(--popwindow-button-background-color); + color: var(--popwindow-button-text-color); + margin-right: 5px; +} + +.linkui-source-headers-button:hover, +.linkui-source-set-button:hover { + background-color: var(--popwindow-button-hover-background-color); +} + +.linkui-source-headers-button.active { + background-color: var(--popwindow-button-active-background-color); +} + +.linkui-source-delete-button:hover { + background-color: var(--source-delete-button-hover-color); +} + +.linkui-source-delete-button { + background-color: var(--source-delete-button-color); +} + +.linkui-source.active>.linkui-source-url { + color: var(--source-active-url-color); +} + +.linkui-source.active>.linkui-source-set-button { + background-color: var(--popwindow-button-active-background-color); +} + +.linkui-source-headers { + resize: none; + display: block; + width: calc(100% - 20px); + height: 200px; + margin-top: 5px; + overflow-y: auto; +} + +.linkui-source-headers.invalid { + border: var(--source-headers-invalid-border); +} + +.fluid_video_wrapper.fluid_player_layout_default .fluid_controls_timeline_syncer { + position: absolute; + top: 53px; + height: 80px; + left: 13px; + right: 13px; + overflow: hidden; + transition: visibility 0.5s; + visibility: hidden; +} + +.fluid_video_wrapper.fluid_player_layout_default.controls_visible.expanded .fluid_controls_timeline_syncer { + visibility: visible; +} + +.timeline_container { + position: absolute; + top: 0px; + bottom: 0px; +} + +.current_position_bar { + position: absolute; + top: 0px; + bottom: 0px; + width: 1px; + background-color: var(--timeline-current-position-color); + left: 50%; + transform: translate(-50%, 0%); + border-radius: 1px; + z-index: 100; +} + +.timeline_ticks { + position: absolute; + top: 0px; + height: 22px; + left: 0px; + right: 0px; + cursor: grab; +} + +.timeline_track { + position: absolute; + top: 52px; + height: 30px; + left: 0px; + right: 0px; + cursor: grab; +} + +.timeline_track_cue { + position: absolute; + box-sizing: border-box; + height: 20px; + background-color: var(--timeline-cue-background-color); + border-radius: 2px; + font-size: 12px; + color: var(--timeline-cue-text-color); + padding: 0px 2px; + line-height: 20px; +} + +.timeline_track_cue * { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.timeline_vod { + position: absolute; + top: 22px; + height: 22px; + left: 0px; + right: 0px; +} + +.timeline_ticks .timeline_tick { + position: absolute; + width: 1px; + height: 3px; + background-color: var(--timeline-tick-color); + transform: translate(-50%, 0%); +} + +.timeline_ticks .timeline_tick.major { + height: 5px; +} + +.timeline_ticks .timeline_tick.minute { + height: 6px; +} + +.timeline_ticks .timeline_tick.hour { + height: 9px; +} + +.timeline_ticks .timeline_tick .timeline_tick_label { + position: absolute; + top: 9px; + font-size: 10px; + color: var(--timeline-tick-label-color); + transform: translate(-50%, 0%); +} + +.mainplayer { + cursor: none; + overflow: hidden; +} + +.mainplayer.controls_visible { + cursor: auto; +} + +.timeline_vod_canvas { + position: absolute; + height: 20px; +} + +/* total width */ +::-webkit-scrollbar { + background-color: transparent; + width: 5px; + height: 5px; +} + +/* background of the scrollbar except button or resizer */ +::-webkit-scrollbar-track { + background-color: transparent; +} + +/* scrollbar itself */ +::-webkit-scrollbar-thumb { + background-color: #babac0; + border-radius: 2px; + border: none; +} + +/* set button(top and bottom of the scrollbar) */ +::-webkit-scrollbar-button { + display: none; +} + +.page-marker { + display: inline-block; + margin: 2px 3px; + user-select: none; + cursor: pointer; + padding: 3px 8px; + min-width: 15px; + text-align: center; + border-radius: 3px; + background-color: var(--popwindow-button-background-color); + color: var(--popwindow-button-text-color); +} + +.page-marker:hover { + background-color: var(--popwindow-button-hover-background-color); +} + +.page-marker.selected { + background-color: var(--popwindow-button-active-background-color); + cursor: text; +} + +.subtitle-pages { + text-align: center; +} + +.page-bar { + padding-bottom: 5px; +} + +.subtitle-result-container { + display: grid; + column-gap: 5px; + grid-template-columns: 50px 1fr 150px 50px; + position: relative; + user-select: none; + cursor: pointer; + font-size: 15px; + width: 100%; + border-top: var(--menu-border); + padding: 15px 0px; +} + +.subtitle-result-lang { + grid-column: 1; + text-align: center; +} + +.subtitle-result-title { + grid-column: 2; +} + +.subtitle-result-user { + grid-column: 3; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.subtitle-result-rank { + grid-column: 4; +} + +.subtitle-track-element { + position: relative; + border-bottom: var(--menu-border); + padding: 8px 5px; + color: var(--menu-text-color); + word-wrap: break-word; + cursor: pointer; +} + +.subtitle-resync-tool, +.subtitle-download-tool, +.subtitle-remove-tool, +.subtitle-shiftl-tool, +.subtitle-shiftr-tool { + display: none; + position: absolute !important; + cursor: pointer; + top: 50%; + transform: translate(0%, -50%); +} + +.subtitle-remove-tool, +.subtitle-shiftl-tool, +.subtitle-shiftr-tool { + opacity: 0.85; + transition: opacity 0.2s; +} + +.subtitle-resync-tool, +.subtitle-download-tool { + width: 20px; + height: 20px; +} + +.subtitle-resync-tool, +.subtitle-download-tool { + color: var(--subtitle-tool-color); + width: 20px; + height: 20px; +} + +.subtitle-track-element:hover .subtitle-resync-tool, +.subtitle-track-element:hover .subtitle-download-tool, +.subtitle-track-element:hover .subtitle-remove-tool, +.subtitle-track-element:hover .subtitle-shiftl-tool, +.subtitle-track-element:hover .subtitle-shiftr-tool { + display: block; +} + +.subtitle-remove-tool:hover, +.subtitle-shiftl-tool:hover, +.subtitle-shiftr-tool:hover { + opacity: 1 +} + +.subtitle-resync-tool { + right: 70px; +} + +.subtitle-download-tool { + right: 20px; +} + +.subtitle-remove-tool { + right: 5px; + width: 10px; + height: 10px; + background-color: var(--close-button-hover-color); + border-radius: 50%; +} + +.subtitle-shiftl-tool { + right: 60px; + width: 0px; + height: 0px; + border-right: 8px solid var(--subtitle-tool-color); + border-bottom: 8px solid transparent; + border-top: 8px solid transparent; +} + +.subtitle-shiftr-tool { + right: 45px; + width: 0px; + height: 0px; + border-left: 8px solid var(--subtitle-tool-color); + border-bottom: 8px solid transparent; + border-top: 8px solid transparent; +} + +.rate_menu_container { + position: absolute; + bottom: 36px; + width: 60px; + transform: translate(-50%, 0%); + left: 13px; + overflow: hidden; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + height: 150px; + z-index: 1000; + background-color: var(--menu-background-color); +} + +.rate_menu { + position: absolute; + inset: 0px; + background: linear-gradient(rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0) 85%, rgba(0, 0, 0, 0.3) 100%); +} + +.rate-changer-list { + overflow-y: scroll; + padding-right: 20px; + box-sizing: content-box; + width: 80px; + height: 100%; +} + +.rate-changer-list>div { + font-size: 18px; + width: 60px; + text-align: center; + padding: 3px 0px; + border-top: 1px solid rgba(100, 100, 100, 0.2); +} + +.rate-changer-list>div:first-child { + border-top: none; +} + +.rate-changer-list>div:hover { + background-color: var(--menu-list-item-hover-background-color); +} + +.rate-changer-list>div.rate-selected { + background-color: var(--menu-list-item-active-background-color); +} + + +.subtitle-menu-option { + padding: 8px 5px; + color: var(--menu-text-color); + border-top: var(--menu-border); + cursor: pointer; +} + +.subtitle-menu-option:nth-child(2) { + border-top: none; +} + +.unity_volume_marker { + position: absolute; + top: 0px; + bottom: 0px; + width: 3px; + border-radius: 50% !important; + background-color: rgb(192, 192, 192); + left: 33.333%; + transform: translate(-50%, 0%); + border-radius: 1px; + z-index: 2; +} + + +.tooltip { + position: relative; +} + + +.tooltip .tooltiptext { + visibility: hidden; + background-color: rgb(200, 200, 200); + color: black; + text-align: center; + padding: 2px 0; + border-radius: 3px; + position: absolute; + z-index: 1; + + width: 50px; + bottom: 100%; + left: 50%; + margin-left: -25px; + margin-bottom: 5px; + font-size: 12px; + + white-space: pre-line; +} + +.equalizer_node .tooltiptext { + width: 200px; + margin-left: -100px; +} + +.tooltip:hover .tooltiptext { + visibility: visible; +} + +.tooltip .tooltiptext::after { + content: " "; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: rgb(200, 200, 200) transparent transparent transparent; +} + +.tooltip .tooltiptext.right { + margin-left: -10px; +} +.tooltip .tooltiptext.right::after { + left: 10px; +} + +.tooltip .tooltiptext.left { + margin-left: -190px; +} +.tooltip .tooltiptext.left::after { + left: auto; + right: 5px; +} + + +.tooltip .tooltiptext.down { + bottom: auto; + top: 100%; + margin-bottom: 0px; + margin-top: 5px; +} + +.tooltip .tooltiptext.down::after { + bottom: 100%; + top: auto; + border-color: transparent transparent rgb(200, 200, 200) transparent; +} + + +.volume_block:focus .tooltip .tooltiptext { + visibility: visible; +} + +.options_frame { + width: 100%; + height: 100%; + border: none; + background-color: rgba(255, 255, 255, .9); +} + +.options_container { + padding: 1px 0px; + overflow: hidden; + max-width: 500px; + width: 90%; + margin: auto; + left: auto; + right: auto; +} + +.profile_manager { + display: flex; + flex-wrap: wrap; + gap: 5px; +} + +.profile_selector { + font-size: 14px; + height: 25px; + line-height: 25px; + border-radius: 4px; + text-overflow: ellipsis; + white-space: nowrap; + flex: 1 1 auto; +} + +.delete_button:hover { + background-color: rgb(100, 0, 0); +} + +.delete_button { + background-color: rgb(120, 0, 0); +} + +.dynamics_container { + width: 100%; + overflow: auto; + display: flex; + flex-wrap: wrap; + gap: 10px; +} + +.equalizer { + position: relative; + width: 100%; + height: 300px; + background-color: black; + border-radius: 3px; + min-width: 560px; +} + +.equalizer canvas { + position: absolute; + z-index: 2; + top: 30px; + left: 30px; + width: calc(100% - 60px); + height: calc(100% - 60px); +} + +.equalizer .equalizer_frequency_axis { + position: absolute; + z-index: 1; + left: 30px; + top: 0px; + bottom: 0px; + right: 30px; +} + +.equalizer .equalizer_decibel_axis { + position: absolute; + z-index: 1; + top: 30px; + bottom: 30px; + left: 0px; + right: 0px; +} + +.equalizer .eq_tick_marker { + position: absolute; +} + +.equalizer_frequency_axis .eq_tick_marker { + width: 1px; + top: 30px; + bottom: 30px; +} + +.equalizer_frequency_axis .eq_tick_marker.major_tick { + background-color: rgba(255, 255, 255, 0.25); +} + +.equalizer_frequency_axis .eq_tick_marker .tick_label { + position: absolute; + bottom: -20px; + font-size: 10px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-50%, 0%); +} + +.equalizer_frequency_axis .eq_tick_marker.minor_tick { + background-color: rgba(255, 255, 255, 0.2); +} + + +.equalizer_decibel_axis .eq_tick_marker { + left: 30px; + right: 30px; + height: 1px; +} + +.equalizer_decibel_axis .eq_tick_marker.major_tick { + background-color: rgba(255, 255, 255, 0.25); +} + +.equalizer_decibel_axis .eq_tick_marker.zero_tick { + background-color: rgba(100, 255, 255, 0.3); +} + +.equalizer_decibel_axis .eq_tick_marker .tick_label { + position: absolute; + top: 0px; + left: -5px; + font-size: 10px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-100%, -50%); +} + +.equalizer .zero_line_node { + cursor: pointer; + position: absolute; + border-radius: 50%; + background-color: rgba(100, 255, 255, 0.25); + border: 1px solid rgba(100, 255, 255, 0.5); + width: 10px; + height: 10px; + transform: translate(-50%, -50%); + top: 50%; +} + +.equalizer .zero_line_node.highpass, +.equalizer .zero_line_node.lowpass { + background-color: rgba(255, 201, 100, 0.25); + border: 1px solid rgba(255, 201, 100, 0.5) +} + +.equalizer_decibel_axis .eq_tick_marker.minor_tick { + background-color: rgba(255, 255, 255, 0.2); +} + +.equalizer .equalizer_nodes { + position: absolute; + top: 30px; + bottom: 30px; + left: 30px; + right: 30px; + z-index: 3; +} + +.equalizer .equalizer_nodes .equalizer_node { + cursor: grab; + position: absolute; + border-radius: 50%; + width: 10px; + height: 10px; + transform: translate(-50%, -50%); + top: 50%; + background-color: rgba(100, 255, 255, 0.25); + border: 1px solid rgba(100, 255, 255, 0.5); +} + +.equalizer .equalizer_nodes .equalizer_node:hover { + outline: 1px solid rgba(255, 255, 255, 0.5); +} + +.equalizer .equalizer_title { + top: 5px; + left: 0px; + right: 0px; + text-align: center; + position: absolute; + font-size: 14px; + color: rgba(255, 255, 255, 0.8); +} + +.mixer { + position: relative; + min-width: 250px; + flex: 1 1 auto; + width: 30%; + height: 300px; + background-color: black; + border-radius: 3px; +} + +.mixer .mixer_title { + top: 5px; + left: 50%; + transform: translate(-50%, 0%); + position: absolute; + font-size: 14px; + color: rgba(255, 255, 255, 0.8); +} + +.dynamics_container .dynamics_center_text { + position: absolute; + top: 50%; + left: 0px; + right: 0px; + text-align: center; + transform: translate(0%, -50%); +} + +.mixer .mixer_container { + display: flex; + position: absolute; + top: 30px; + bottom: 15px; + left: 15px; + right: 15px; + gap: 5px; +} + +.mixer .channels { + flex: 6 1 auto; + display: flex; + flex-direction: row; + overflow-x: auto; + overflow-y: hidden; + gap: 5px; +} + +.mixer .master { + flex: 1 1 auto; +} +.mixer_channel_container { + flex: 1 1 auto; + position: relative; + min-width: 70px; + height: 100%; + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 3px; + box-sizing: border-box; +} + +.mixer_channel_title { + position: absolute; + top: 15px; + left: 2px; + right: 2px; + text-align: center; + font-size: 10px; + color: rgba(255, 255, 255, 0.8); + transform: translate(0%, -50%); +} + +.mixer_channel_buttons { + display: flex; + position: absolute; + top: 30px; + right: 1px; + left: 1px; + gap: 1px; +} + +.mixer_channel_mute, +.mixer_channel_solo { + flex: 1 1 auto; + top: 0px; + right: 0px; + padding: 3px 5px; + font-size: 12px; + border-radius: 3px; + text-align: center; + cursor: pointer; + color: rgba(255, 255, 255, 0.8); + background-color: rgba(60, 60, 60, 0.6); +} + +.mixer_channel_mute.active, +.mixer_channel_solo.active { + color: rgba(255, 80, 80, 0.9); + background-color: rgba(255, 255, 255, 0.1); +} + +.mixer_channel_volume { + position: absolute; + top: 75px; + left: 0px; + right: 0px; + bottom: 25px; +} + +.mixer_channel_volume_axis { + position: absolute; + top: 1px; + left: 0px; + right: 0px; + bottom: 1px; +} + +.mixer_channel_volume_tick { + border-radius: 1px; + position: absolute; + left: 20px; + right: 20px; + height: 1px; + background-color: rgba(255, 255, 255, 0.6); + transform: translate(0%, -50%); +} + +.mixer_channel_volume_tick_label { + position: absolute; + top: 0px; + left: -3px; + font-size: 6px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-100%, -50%); +} + +.mixer_channel_volume_track { + cursor: pointer; + border-radius: 1px; + position: absolute; + top: 0px; + bottom: 0px; + left: 50%; + width: 8px; + transform: translate(-50%, 0%); + background-color: rgb(30, 30, 30); + border: 1px solid rgba(0, 0, 0, 0.2); +} + +.mixer_channel_volume_handle { + position: absolute; + background: linear-gradient(to top, hsl(214, 8%, 59%) 0%, hsl(214, 8%, 95%) 15%, hsl(214, 8%, 71%) 35%, hsl(214, 8%, 63%) 50%, hsl(214, 8%, 71%) 65%, hsl(214, 8%, 95%) 85%, hsl(214, 8%, 59%) 100%); + left: 50%; + width: 20px; + height: 40px; + border-radius: 4px; + transform: translate(-50%, -50%); + opacity: 0.9; + cursor: grab; +} + +.mixer_channel_volume_meter { + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} + + +.compressor { + position: relative; + width: 30%; + min-width: 560px; + flex: 1 1 auto; + height: 300px; + background-color: black; + border-radius: 3px; +} + +.compressor .compressor_title { + top: 5px; + left: 0px; + right: 0px; + text-align: center; + position: absolute; + font-size: 14px; + color: rgba(255, 255, 255, 0.8); +} + +.compressor_container { + display: flex; + position: absolute; + top: 30px; + bottom: 0px; + left: 0px; + right: 0px; + gap: 10px; +} + +.compressor_container .compressor_graph { + position: relative; + height: 270px; + width: 270px; + min-width: 270px; + border-radius: 3px; + box-sizing: border-box; +} + +.compressor_graph .compressor_y_axis { + position: absolute; + top: 0px; + bottom: 30px; + left: 0px; + width: 30px; +} + +.compressor_graph .compressor_x_axis { + position: absolute; + bottom: 0px; + left: 30px; + right: 0px; + height: 30px; +} + +.compressor_graph .compressor_graph_container { + position: absolute; + top: 0px; + bottom: 30px; + left: 30px; + right: 0px; + border: 1px solid rgba(255, 255, 255, 0.3); +} + +.compressor_graph .compressor_graph_container canvas { + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} + + +.compressor_container .compressor_controls { + display: flex; + flex-wrap: wrap; + position: relative; + flex: 1 1 auto; + height: 100%; + border-radius: 3px; + box-sizing: border-box; + overflow-y: auto; + margin-right: 15px; +} + +.compressor_x_axis_tick { + position: absolute; + width: 1px; + transform: translate(-50%, 0%); + background-color: rgba(255, 255, 255, 0.3); +} + +.compressor_x_axis_tick.major { + height: 5px; +} + +.compressor_x_axis_tick.minor { + height: 3px; +} + +.compressor_x_axis_tick .tick_label { + position: absolute; + top: 9px; + font-size: 10px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-50%, 0%); +} + + +.compressor_y_axis_tick { + position: absolute; + height: 1px; + right: 0px; + transform: translate(0%, -50%); + background-color: rgba(255, 255, 255, 0.3); +} + +.compressor_y_axis_tick.major { + width: 5px; +} + +.compressor_y_axis_tick.minor { + width: 3px; +} + +.compressor_y_axis_tick .tick_label { + position: absolute; + left: -4px; + font-size: 10px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-100%, -50%); +} + +.compressor_y_axis_tick.zero, +.compressor_x_axis_tick.zero { + height: 0px; +} + + +.compressor_toggle { + flex: 1 1 auto; + top: 0px; + font-size: 12px; + border-radius: 3px; + text-align: center; + cursor: pointer; + color: rgba(255, 255, 255, 0.8); + border: 1px solid rgba(255, 255, 255, 0.2); + color: rgba(220, 80, 80, 0.9); + width: 100%; + height: 30px; + line-height: 30px;; +} + +.compressor_toggle:hover { + background-color: rgba(255, 255, 255, 0.1); +} + +.compressor_toggle.enabled { + color: rgba(80, 220, 80, 0.9); +} + +.knob_container { + position: relative; + width: 80px; + height: 100px; + flex: 1 1 auto; +} + +.knob_container .knob_name { + position: absolute; + top: 4px; + left: 0px; + right: 0px; + text-align: center; + font-size: 12px; + color: rgba(255, 255, 255, 0.8); +} + +.knob_knob_container { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.knob_knob { + width: 50px; + height: 50px; + border-radius: 50%; + border: 4px solid rgba(255, 255, 255, 0.3); + box-sizing: border-box; + background: -webkit-radial-gradient(center, ellipse, hsl(214, 8%, 87%) 0%, hsl(214, 8%, 60%) 100%) +} + +.knob_bump { + position: absolute; + bottom: -7px; + width: 4px; + height: 25px; + left: 50%; + transform: translate(-50%, 0); + background-color: rgb(80, 80, 80); + border-radius: 4px; + border: 1px solid rgba(255, 255, 255, 0.1); +} + +.knob_min_value_tick, +.knob_max_value_tick { + position: absolute; + width: 2px; + height: 8px; + border-radius: 1px; + background-color: rgba(255, 255, 255, 0.7); + top: calc(50% + 17px); +} + +.knob_max_value_tick { + transform: rotate(-45deg); + left: calc(50% + 21px); +} + + +.knob_min_value_tick { + transform: rotate(45deg); + left: calc(50% - 22px); +} + +.knob_min_value_label, +.knob_max_value_label { + position: absolute; + font-size: 8px; + color: rgba(255, 255, 255, 0.8); + transform: translate(-50%, -50%); +} + +.knob_max_value_label { + left: calc(50% + 29px); + top: calc(50% + 30px); +} + +.knob_min_value_label { + left: calc(50% - 29px); + top: calc(50% + 30px); +} + +.knob_value { + position: absolute; + display: inline-block; + font-size: 12px; + color: rgba(255, 255, 255, 0.8); + text-align: center; + bottom: 0px; + padding: 2px 5px; + left: 50%; + transform: translate(-50%, 0%); + white-space: nowrap; +} + +.playinfo { + color: var(--menu-text-color); + padding: 5px 10px; + text-align: center; + font-size: 14px; +} +/* when screen is 700x or smaller */ +@media screen and (max-width: 700px) { + .fluid_button { + width: 18px; + height: 18px; + } + + .fluid_controls_right, + .fluid_controls_left { + gap: 2px; + } + + .status_message, + .fluid_video_wrapper.fluid_player_layout_default .fluid_controls_container .fluid_fluid_control_duration { + font-size: 13px; + } + + .popwindow { + left: 5px; + right: 5px; + } +} + +@media screen and (max-width: 500px) { + + .fluid_button_soundwave, + .fluid_button_link, + .fluid_button_settings { + display: none !important; + } + + +} \ No newline at end of file diff --git a/built/web/player/assets/fluidplayer/static/fluid-spinner.svg b/built/web/player/assets/fluidplayer/static/fluid-spinner.svg new file mode 100644 index 00000000..841294ea --- /dev/null +++ b/built/web/player/assets/fluidplayer/static/fluid-spinner.svg @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/built/web/player/assets/fluidplayer/static/icons.svg b/built/web/player/assets/fluidplayer/static/icons.svg new file mode 100644 index 00000000..f7b84204 --- /dev/null +++ b/built/web/player/assets/fluidplayer/static/icons.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/built/web/player/assets/fluidplayer/static/skip-backward.svg b/built/web/player/assets/fluidplayer/static/skip-backward.svg new file mode 100644 index 00000000..ab4a5575 --- /dev/null +++ b/built/web/player/assets/fluidplayer/static/skip-backward.svg @@ -0,0 +1,5 @@ + + + + diff --git a/built/web/player/assets/fluidplayer/static/skip-forward.svg b/built/web/player/assets/fluidplayer/static/skip-forward.svg new file mode 100644 index 00000000..503c3fce --- /dev/null +++ b/built/web/player/assets/fluidplayer/static/skip-forward.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + diff --git a/built/web/player/enums/AnalyzerEvents.mjs b/built/web/player/enums/AnalyzerEvents.mjs new file mode 100644 index 00000000..79bea5c1 --- /dev/null +++ b/built/web/player/enums/AnalyzerEvents.mjs @@ -0,0 +1,5 @@ +export const AnalyzerEvents = { + MATCH: 'match', + INTRO_MATCH: 'introMatch', + OUTRO_MATCH: 'outroMatch', +}; diff --git a/built/web/player/enums/DefaultPlayerEvents.mjs b/built/web/player/enums/DefaultPlayerEvents.mjs new file mode 100644 index 00000000..0c87ec81 --- /dev/null +++ b/built/web/player/enums/DefaultPlayerEvents.mjs @@ -0,0 +1,102 @@ +export const DefaultPlayerEvents = { + /** + * The abort event is fired when the resource was not fully loaded, but not as the result of an error. + */ + ABORT: 'abort', + /** + * The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. + */ + CANPLAY: 'canplay', + /** + * The browser estimates it can play the media up to its end without stopping for content buffering. + */ + CANPLAYTHROUGH: 'canplaythrough', + /** + * The rendering of an OfflineAudioContext is terminated. + */ + COMPLETE: 'complete', + /** + * The duration attribute has been updated. + */ + DURATIONCHANGE: 'durationchange', + /** + * The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. + */ + EMPTIED: 'emptied', + /** + * Playback has stopped because the end of the media was reached. + */ + ENDED: 'ended', + /** + * The first frame of the media has finished loading. + */ + LOADEDDATA: 'loadeddata', + /** + * The metadata has been loaded. + */ + LOADEDMETADATA: 'loadedmetadata', + /** + * Playback has been paused. + */ + PAUSE: 'pause', + /** + * Playback has begun. + */ + PLAY: 'play', + /** + * Playback is ready to start after having been paused or delayed due to lack of data. + */ + PLAYING: 'playing', + /** + * Fired periodically as the browser loads a resource. + */ + PROGRESS: 'progress', + /** + * The playback rate has changed. + */ + RATECHANGE: 'ratechange', + /** + * A seek operation completed. + */ + SEEKED: 'seeked', + /** + * A seek operation began. + */ + SEEKING: 'seeking', + /** + * The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. + */ + STALLED: 'stalled', + /** + * The loading of a resource has been suspended. + */ + SUSPEND: 'suspend', + /** + * The time indicated by the currentTime attribute has been updated. + */ + TIMEUPDATE: 'timeupdate', + /** + * The volume has changed. + */ + VOLUMECHANGE: 'volumechange', + /** + * Playback has stopped because of a temporary lack of data. + */ + WAITING: 'waiting', + LEVELUPDATE: 'levelupdate', + FRAGMENT_UPDATE: 'fragmentupdate', + /** + * The manifest has been loaded. Levels are available + * @param {number} suggestedLevel - The suggested level to load + */ + MANIFEST_PARSED: 'manifestparsed', + DESTROYED: 'destroyed', + /** + * Failed to load video + */ + ERROR: 'error', + /** + * Fired when the player requests a key (DRM not supported) + */ + NEED_KEY: 'needkey', +}; diff --git a/built/web/player/enums/DownloadStatus.mjs b/built/web/player/enums/DownloadStatus.mjs new file mode 100644 index 00000000..c8774855 --- /dev/null +++ b/built/web/player/enums/DownloadStatus.mjs @@ -0,0 +1,7 @@ +export const DownloadStatus = { + WAITING: 0, + ENQUEUED: 1, + DOWNLOAD_INITIATED: 2, + DOWNLOAD_COMPLETE: 3, + DOWNLOAD_FAILED: 4, +}; diff --git a/built/web/player/enums/PlayerModes.mjs b/built/web/player/enums/PlayerModes.mjs new file mode 100644 index 00000000..498b2922 --- /dev/null +++ b/built/web/player/enums/PlayerModes.mjs @@ -0,0 +1,9 @@ +export const PlayerModes = { + AUTO: 'auto', + DIRECT: 'direct', + ACCELERATED_MP4: 'accelerated_mp4', + ACCELERATED_HLS: 'accelerated_hls', + ACCELERATED_DASH: 'accelerated_dash', + ACCELERATED_YT: 'accelerated_yt', + IFRAME: 'iframe', +}; diff --git a/built/web/player/main.mjs b/built/web/player/main.mjs new file mode 100644 index 00000000..affcee82 --- /dev/null +++ b/built/web/player/main.mjs @@ -0,0 +1,231 @@ +import {PlayerModes} from './enums/PlayerModes.mjs'; +import {FastStreamClient} from './FastStreamClient.mjs'; +import {SubtitleTrack} from './SubtitleTrack.mjs'; +import {EnvUtils} from './utils/EnvUtils.mjs'; +import {RequestUtils} from './utils/RequestUtils.mjs'; +import {URLUtils} from './utils/URLUtils.mjs'; +import {Utils} from './utils/Utils.mjs'; +import {VideoSource} from './VideoSource.mjs'; +let OPTIONS = null; +if (EnvUtils.isExtension()) { + chrome.runtime.onMessage.addListener( + (request, sender, sendResponse) => { + if (request.type === 'init') { + if (window.parent !== window) { + window.parent.postMessage({ + type: 'frame', + id: request.frameId, + }, '*'); + } + } else if (request.type === 'options') { + OPTIONS = JSON.parse(request.options); + if (window.fastStream) window.fastStream.setOptions(OPTIONS); + } if (request.type === 'analyzerData') { + window.fastStream.loadAnalyzerData(request.data); + } else if (request.type === 'media_name') { + const name = request.name; + if (name) { + if (window.fastStream) window.fastStream.setMediaName(name); + } + } else if (request.type === 'fullscreen_change' && window.fastStream) { + window.fastStream.interfaceController.setFullscreenStatus(request.fullscreen); + } else if (request.type === 'sources' && window.fastStream) { + recieveSources(request, sendResponse); + return true; + } else { + sendResponse('unknown'); + return; + } + sendResponse('ok'); + }); + setInterval(() => { + chrome.runtime.sendMessage({ + type: 'ping', + }); + }, 10000); +} +async function recieveSources(request, sendResponse) { + console.log('Recieved sources', request.sources, request.subtitles); + let subs = request.subtitles; + const sources = request.sources; + if (sources.length === 0) { + sendResponse('no_sources'); + return; + } + // Sources are ordered by time, so we can just choose the first one and it will be the oldest. + // But we also want to minimize depth + let autoPlaySource = sources.reduce((result, curr) => { + // Choose lower depth + if (result.depth > curr.depth) { + return curr; + } + // Always choose the newest yt source if it exists + if (curr.mode === PlayerModes.ACCELERATED_YT) { + return curr; + } + // If result isn't using streaming technologies, try to find one that does + const streamingModes = [PlayerModes.ACCELERATED_HLS, PlayerModes.ACCELERATED_DASH, PlayerModes.ACCELERATED_YT]; + if (!streamingModes.includes(result.mode) && streamingModes.includes(curr.mode)) { + return curr; + } + return result; + }, sources[0]); + // Play the newest source at lowest depth if it is mp4 + if (autoPlaySource.mode === PlayerModes.ACCELERATED_MP4) { + const mp4SourceCandidates = sources.filter((item) => { + return item !== autoPlaySource && item.mode === PlayerModes.ACCELERATED_MP4; + }); + mp4SourceCandidates.sort((a, b) => { + // Lower depth is better + if (a.depth !== b.depth) { + return a.depth - b.depth; + } + // Newer is better + return b.time - a.time; + }); + if (mp4SourceCandidates.length > 0) { + autoPlaySource = mp4SourceCandidates[0]; + } + } + if (window.fastStream.source || !request.autoSetSource) { + autoPlaySource = null; + } + if (autoPlaySource) { + window.fastStream.clearSubtitles(); + } + sources.forEach((s) => { + window.fastStream.addSource(new VideoSource(s.url, s.headers, s.mode), s === autoPlaySource); + }); + if (subs) { + subs = await loadSubtitles(subs); + subs = await sortSubtitles(subs); + try { + subs.forEach((sub, i) => { + const track = new SubtitleTrack(sub.label, sub.language); + try { + track.loadText(sub.data); + window.fastStream.loadSubtitleTrack(track, request.autoSetSource); + } catch (e) { + console.error(e); + } + }); + } catch (e) { + console.error(e); + } + } + sendResponse('sources_recieved'); +} +async function loadSubtitles(subs) { + await Promise.all(subs.map(async (sub) => { + if (sub && !sub.data && sub.source) { + const headers = sub.headers || []; + const customHeaderCommands = headers.filter((header) => { + return header.name.toLowerCase() === 'origin' || header.name.toLowerCase() === 'referer'; + }).map((header) => { + return { + operation: 'set', + header: header.name.toLowerCase(), + value: header.value, + }; + }); + await chrome.runtime.sendMessage({ + type: 'header_commands', + url: sub.source, + commands: customHeaderCommands, + }); + const xhr = await RequestUtils.requestSimple(sub.source); + const body = xhr.responseText; + if ((xhr.status === 200 || xhr.status === 206) && body) { + sub.data = body; + } + } + })); + return subs.filter((sub) => sub.data); +} +async function sortSubtitles(subs) { + if (!chrome?.i18n?.detectLanguage) { + return subs; + } + let defLang = 'en'; + const subtitlesSettings = await Utils.getConfig('subtitlesSettings'); + try { + const settings = JSON.parse(subtitlesSettings); + if (settings['default-lang']) { + defLang = settings['default-lang']; + } + } catch (e) { + console.log(e); + } + await Promise.all(subs.map((sub) => { + return new Promise((resolve, reject)=>{ + chrome.i18n.detectLanguage(sub.data, (result) => { + const lang = result.languages.find((lang) => lang.language === defLang); + const score = lang ? lang.percentage : 0; + sub.score = score; + if (!sub.language && result.languages.length > 0 && result.languages[0].percentage > 50) { + sub.language = result.languages[0].language; + } + resolve(); + }); + }); + })); + subs.sort((a, b) => { + return b.score - a.score; + }); + return subs; +} +async function setup() { + if (!window.fastStream) { + window.fastStream = new FastStreamClient(); + await window.fastStream.setup(); + } + if (OPTIONS && window.fastStream) window.fastStream.setOptions(OPTIONS); + const urlParams = new URLSearchParams(window.location.search); + const myParam = urlParams.get('frame_id'); + chrome?.runtime?.sendMessage({ + type: 'faststream', + url: window.location.href, + isExt: true, + frameId: parseInt(myParam) || 0, + }).then((data) => { + chrome.runtime.sendMessage({ + type: 'ready', + }); + }); + const version = window.fastStream.version; + console.log('\n %c %c %cFast%cStream %c-%c ' + version + ' %c By Andrews54757 \n', 'background: url(https://user-images.githubusercontent.com/13282284/57593160-3a4fb080-7508-11e9-9507-33d45c4f9e41.png) no-repeat; background-size: 16px 16px; padding: 2px 6px; margin-right: 4px', 'background: rgb(50,50,50); padding:5px 0;', 'color: rgb(200,200,200); background: rgb(50,50,50); padding:5px 0;', 'color: rgb(200,200,200); background: rgb(50,50,50); padding:5px 0;', 'color: rgb(200,200,200); background: rgb(50,50,50); padding:5px 0;', 'color: #afbc2a; background: rgb(50,50,50); padding:5px 0;', 'color: black; background: #e9e9e9; padding:5px 0;'); + window.addEventListener('beforeunload', () => { + if (window.fastStream) { + window.fastStream.destroy(); + delete window.fastStream; + } + }); + if (window.location.hash) { + const url = window.location.hash.substring(1); + const ext = URLUtils.get_url_extension(url); + let mode = PlayerModes.DIRECT; + if (URLUtils.is_url_yt(url) && URLUtils.is_url_yt_watch(url)) { + mode = PlayerModes.ACCELERATED_YT; + } + if (mode === PlayerModes.DIRECT && URLUtils.getModeFromExtension(ext)) { + mode = URLUtils.getModeFromExtension(ext); + } + if (url.startsWith('file://') && mode === PlayerModes.ACCELERATED_MP4) { + mode = PlayerModes.DIRECT; + } + window.fastStream.addSource(new VideoSource(url, {}, mode), true).then(() => { + }); + } + if (!EnvUtils.isExtension()) { + window.fastStream.setOptions(await Utils.getOptionsFromStorage()); + // if not extension context then use iframe messager + window.addEventListener('message', (e) => { + if (e.data?.type === 'options') { + window.fastStream.setOptions(JSON.parse(e.data.options)); + } else if (e.data?.type === 'sources') { + recieveSources(e.data, () => {}); + } + }); + } +} +setup(); diff --git a/built/web/player/modules/.DS_Store b/built/web/player/modules/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..50e7639b1e964a4b4979e9a0dc03e8046836b18a GIT binary patch literal 10244 zcmeHMTWl0n7(V~Bz>FQ}wDht9vfC6DOMy~Kp(46%w?L)R%5LeF0?X{qNGHtBEIYGX zq@qO=6EqlaF@%UOJ}BNEjCV8|O$qwogW?5aOoYUk=z~w*ANae_UH(wZ0o>=l>kVK zk1w0M}XGuBGHIS95Ohueoxuy3|C)f&!m&KBax(OC#h`Uw%>18`bJx4 z*3jk`hYw@bKEE z4fUax<|Fl?;g-gR`cTu_<|9WWv9fmc#vO?RX4aix_e0cQK1c{Sx=PNI&E3EvR!pfy^cRNj}e&0N}Y5=vQ0HB&iLb@f)$j2ee^a%ELt-f)bhsrRc+O1Ct_+TS~5Xzt)Hd>58$+-2xlNh*W-n5Cw5W)%o5S}cl6 zZ9JDW4(1H^Za!8Z7?MQg_1zjea)+%^OU=^{E)&H8%5Tr=*mAZUSbh^4s4)lq_1syx zN|F>Ob^rr|o63!AMM=?mO*N^T9&7yuWNquqbF4jPz%;;@$Fo5crP{(Ps14WgN48R_Hq3SdWQpWD+zcY5i|iv=GE9z>6XZqm z8W|;L$rt21@&oyW{0aa96v135feNUEDhNOg)WHg#&K z*l-Z?a374oQFs83!Q=1*JPA+1Gw>Wd52xW(I0Ns(d+FkwHN(mO+ESaVTX5iXIiU8O(59u(Q!?VjrvzBRF`;k{jp2;rwJs$xd0UrS$0UrS$fy+anh?|Az`G3dk|Nmd! z;J%fQfRDgcfdCXoqLDUqb+(_{^sGIE_ddMoMfFBFWhU5A70PGF@z|lq@yk74p?s(E iu*VzWl$j%+nIq+=`TzT$0e=1e|DT`v_5T%J|NjFGC;fB) literal 0 HcmV?d00001 diff --git a/built/web/player/modules/FSBlob.mjs b/built/web/player/modules/FSBlob.mjs new file mode 100644 index 00000000..e57bb6f6 --- /dev/null +++ b/built/web/player/modules/FSBlob.mjs @@ -0,0 +1,49 @@ +import {IndexedDBManager} from '../network/IndexedDBManager.mjs'; +import {EnvUtils} from '../utils/EnvUtils.mjs'; +const BrowserCanAutoOffloadBlobs = EnvUtils.isChrome(); +export class FSBlob { + constructor() { + if (BrowserCanAutoOffloadBlobs) { + this.blobStore = new Map(); + } else { + this.indexedDBManager = new IndexedDBManager(); + this.setupPromise = this.indexedDBManager.setup(); + this.blobStorePromises = new Map(); + } + this.blobIndex = 0; + } + async saveBlobAsync(identifier, blob) { + await this.setupPromise; + await this.indexedDBManager.setFile(identifier, blob); + return true; + } + _saveBlob(identifier, blob) { + if (BrowserCanAutoOffloadBlobs) { + this.blobStore.set(identifier, blob); + } else { + this.blobStorePromises.set(identifier, this.saveBlobAsync(identifier, blob)); + } + } + saveBlob(blob) { + const identifier = `blob${this.blobIndex++}`; + this._saveBlob(identifier, blob); + return identifier; + } + createBlob(data) { + const identifier = `blob${this.blobIndex++}`; + const blob = new Blob([data], {type: 'application/octet-stream'}); + this._saveBlob(identifier, blob); + return identifier; + } + async getBlob(identifier) { + if (BrowserCanAutoOffloadBlobs) { + return this.blobStore.get(identifier); + } else { + await this.blobStorePromises.get(identifier); + return await this.indexedDBManager.getFile(identifier); + } + } + close() { + return this.indexedDBManager?.close(); + } +} diff --git a/built/web/player/modules/LargeBuffer.mjs b/built/web/player/modules/LargeBuffer.mjs new file mode 100644 index 00000000..b001098e --- /dev/null +++ b/built/web/player/modules/LargeBuffer.mjs @@ -0,0 +1,66 @@ +export class LargeBuffer { + constructor(byteLength, bufferLength) { + this.byteLength = byteLength; + this.bufferLength = bufferLength; + this.currentBuffer = null; + this.nextPreloadedBuffer = null; + this.offset = 0; + this.index = 0; + this.bufferIndex = 0; + } + async initialize(getBufferFn) { + this.getBuffer = getBufferFn; + this.nextPreloadedBuffer = this.getBuffer(this.bufferIndex); + return this.nextBuffer(); + } + async nextBuffer() { + this.index = 0; + this.bufferIndex++; + const preloaded = this.nextPreloadedBuffer; + if (this.bufferIndex < this.bufferLength) { + this.nextPreloadedBuffer = this.getBuffer(this.bufferIndex); + } + this.currentBuffer = await preloaded; + } + async getParts(length) { + const parts = []; + this.offset += length; + if (this.offset > this.byteLength) { + throw new Error('Index ' + this.offset + ' out of range'); + } + while (length > 0) { + if (this.index >= this.currentBuffer.byteLength) { + await this.nextBuffer(); + } + if (!this.currentBuffer) { + throw new Error('Buffer ' + this.bufferIndex + ' not found'); + } + const newlen = Math.min(this.currentBuffer.byteLength - this.index, length); + parts.push(this.currentBuffer.subarray(this.index, this.index + newlen)); + this.index += newlen; + length = length - newlen; + } + return parts; + } + async read(length) { + const uint8 = new Uint8Array(length); + const parts = await this.getParts(length); + let offset = 0; + for (let i = 0; i < parts.length; i++) { + uint8.set(parts[i], offset); + offset += parts[i].byteLength; + } + return uint8; + } + async uint8() { + return (await this.read(1))[0]; + } + async uint16() { + const arr = await this.read(2); + return (arr[0] << 8) | arr[1]; + } + async uint32() { + const arr = await this.read(4); + return (arr[0] << 24) | (arr[1] << 16) | (arr[2] << 8) | arr[3]; + } +} diff --git a/built/web/player/modules/Localize.mjs b/built/web/player/modules/Localize.mjs new file mode 100644 index 00000000..269a716f --- /dev/null +++ b/built/web/player/modules/Localize.mjs @@ -0,0 +1,257 @@ +import {EnvUtils} from '../utils/EnvUtils.mjs'; +const TranslationMap = { +"extension_name": "FastStream Video Player", + "extension_description": "Stream without buffering, a great video player and download accelerator all in one.", + "extension_toggle_label": "Toggle FastStream", + "welcome_page_title": "Welcome to FastStream", + "welcome_page_usage_header": "Usage", + "welcome_page_usage_content0": "There are four ways to use FastStream", + "welcome_page_usage_content1": "You can go to a website with a video stream, and turn faststream on by clicking on the icon. Play the stream and the client will be auto-replaced with FastStream", + "welcome_page_usage_content2": "You can go to a new tab, and press the extension icon to go to the player.", + "welcome_page_usage_content3": "If you have the option enabled, go to a mp4/mpd/m3u8 url and the player will play it.", + "welcome_page_usage_content4": "Keep the player open in a new tab and it will collect sources as you browse elsewhere.", + "welcome_page_usage_end": "Thank you for installing FastStream! Please let us know if you have any issues or suggestions.", + "welcome_page_keybinds_header": "Default Keyboard Controls", + "welcome_page_keybinds_content0": "You can change these keybinds in extension settings", + "welcome_page_keybinds_content1": "arrow keys - 1 second seek forward/back", + "welcome_page_keybinds_content2": "keys - 10 second seek forward/back", + "welcome_page_keybinds_content3": "key - Undo seek", + "welcome_page_keybinds_content4": "arrow keys - 10% volume up/down", + "welcome_page_keybinds_content5": "- Full screen", + "welcome_page_keybinds_content6": "- Add/decrease concurrent requests", + "welcome_page_keybinds_content7": "- Force retry key - use this to re-attempt failed downloads", + "welcome_page_keybinds_content8": "- Skip intro/outro if applicable", + "welcome_page_keybinds_content9": "- Hide/show player", + "perms_page_title": "FastStream Permissions", + "perms_page_about_header": "About the Permissions Required by FastStream", + "perms_page_about_content0": "In order for the extension to function, it needs to be able to have certain permissions. These permissions are only used for basic functionality.", + "perms_page_about_content1": "FastStream does not collect any data from you. It does not track you. It does not send any data to any servers. It does not even have a server to send data to.", + "perms_page_about_content2": "Don't trust me? FastStream has its source available on", + "perms_page_about_content3": "You can look through the code yourself, or manually install your very own custom build by following the instructions.", + "perms_page_breakdown_header": "Breakdown of Permissions", + "perms_page_breakdown_content0": "Here is a breakdown of the permissions FastStream requires, and why it needs them.", + "perms_page_breakdown_content1": "Note: The linked examples may refer to an older version of the code, but the gist should be the same overall. The list is not exhaustive, items are ordered by importance.", + "perms_page_breakdown_perm1h": "Be able to access and modify all websites", + "perms_page_breakdown_perm1d": "FastStream needs to be able to access all websites so that it can inject the player into the website directly. It injects a content script into websites you visit in order to:", + "perms_page_breakdown_perm1r1": "Identify the largest visible video element to replace with the player.", + "perms_page_breakdown_perm1r2": "Enable fullscreen permissions when the player is injected into a frame.", + "perms_page_breakdown_perm1r3": "Scrape subtitle elements from the page.", + "perms_page_breakdown_perm2h": "Access the webRequest API", + "perms_page_breakdown_perm2d": "FastStream needs to be able to intercept HTTP requests to video sources in order to:", + "perms_page_breakdown_perm2r1": "Identify video sources", + "perms_page_breakdown_perm3h": "Access the declarativeNetRequest API", + "perms_page_breakdown_perm3d": "FastStream needs to be able to modify HTTP headers of select requests in order to:", + "perms_page_breakdown_perm3r1": "Override headers for video sources.", + "perms_page_breakdown_perm4h": "Store data on your browser", + "perms_page_breakdown_perm4d": "FastStream needs to be able to store data in your browser so that it can remember your settings.", + "perms_page_breakdown_perm4r1": "General extension options.", + "perms_page_breakdown_perm5h": "Access the tabs API", + "perms_page_breakdown_perm5d": "FastStream needs to be able to send messages between players and content scripts in each tab.", + "perms_page_breakdown_perm5r1": "Sending sources to players from the background script.", + "perms_page_granted": "Granted", + "perms_page_notgranted": "Not Granted, click to grant", + "player_skipintro": "Skip Intro", + "player_skipoutro": "Skip Outro", + "player_hidecontrols": "Hide Controls", + "player_loading": "Loading...", + "player_nosource_header": "No source is loaded!", + "player_nosource_instruction1": "Drag and drop a video file to play it.", + "player_nosource_instruction2p1": "Click", + "player_nosource_instruction2p2": "to load sources detected from other tabs.", + "player_playpause_label": "Play or pause video", + "player_mute_label": "Mute audio", + "player_timestamp_label": "Timestamp", + "player_sourcesbrowser_title": "Sources Browser", + "player_sourcesbrowser_toggle_label": "Toggle sources browser", + "player_sourcesbrowser_closebtn_label": "Close sources browser", + "player_audioconfig_title": "Audio Configuration", + "player_audioconfig_toggle_label": "Toggle audio config window", + "player_audioconfig_toggle_closebtn_label": "Close audio config window", + "player_opensubtitles_title": "OpenSubtitles Search", + "player_opensubtitles_closebtn_label": "Close OpenSubtitles search window", + "player_opensubtitles_search_placeholder": "Search by title, filename, etc...", + "player_opensubtitles_searchbtn": "Search", + "player_opensubtitles_seasonnum": "Season #", + "player_opensubtitles_episodenum": "Episode #", + "player_opensubtitles_type_all": "All", + "player_opensubtitles_type_movie": "Movie", + "player_opensubtitles_type_episode": "Episode", + "player_opensubtitles_language": "Language", + "player_opensubtitles_year": "Year", + "player_opensubtitles_sortby": "Sort By", + "player_opensubtitles_sortby_downloads": "Downloads", + "player_opensubtitles_sortby_date": "Upload Date", + "player_opensubtitles_sortby_rating": "Rating", + "player_opensubtitles_sortby_votes": "Votes", + "player_opensubtitles_sort": "Sort", + "player_opensubtitles_sort_desc": "Descending", + "player_opensubtitles_sort_asc": "Ascending", + "player_opensubtitles_searching": "Searching...", + "player_opensubtitles_error": "Error: $1", + "player_opensubtitles_disabled": "Cannot set proper headers! Install the extension to use this feature!", + "player_opensubtitles_error_down": "OpenSubtitles is down!", + "player_opensubtitles_down_alert": "OpenSubtitles download failed! Their servers are probably down!", + "player_opensubtitles_noresults": "No results found!", + "player_opensubtitles_quota": "OpenSubtitles limits subtitle downloads! You have no more downloads left! Your quota resets in $1", + "player_opensubtitles_askopen": "Would you like to open the OpenSubtitles website to download the subtitle file manually?", + "player_subtitlesmenu_toggle_label": "Toggle subtitles menu", + "player_subtitlesmenu_backbtn": "Back", + "player_subtitlesmenu_settings": "Subtitle Settings", + "player_subtitlesmenu_testbtn": "Test Subtitles", + "player_subtitlesmenu_testbtn_stop": "Stop Testing", + "player_subtitlesmenu_uploadbtn": "Upload File", + "player_subtitlesmenu_urlbtn": "From URL", + "player_subtitlesmenu_urlprompt": "Enter URL", + "player_subtitlesmenu_searchbtn": "Search OpenSubtitles", + "player_subtitlesmenu_clearbtn": "Clear Subtitles", + "player_subtitlesmenu_settingsbtn": "Subtitle Settings", + "player_subtitlesmenu_resynctool_label": "Resync Tool", + "player_subtitlesmenu_savetool_label": "Save subtitle file", + "player_subtitlesmenu_removetool_label": "Remove subtitle track", + "player_subtitlesmenu_shifttool_label": "Shift subtitles $1s", + "player_testsubtitle": "This is a test subtitle", + "player_qualitymenu_label": "Video quality", + "player_playbackrate_label": "Playback rate", + "player_settings_title": "FastStream Settings", + "player_settings_closebtn_label": "Close settings window", + "player_settings_label": "Settings", + "player_savevideo_label": "Save video. hold ALT to save partial video. hold SHIFT to dump buffer.", + "player_screenshot_label": "Take screenshot", + "player_pip_label": "Picture in picture", + "player_fullscreen_label": "Fullscreen", + "player_fragment_failed_singular": "$1 Fragment Failed! Click to retry.", + "player_fragment_failed_plural": "$1 Fragments Failed! Click to retry.", + "player_fragment_allbuffered": "100% Buffered", + "player_welcometext": "Welcome to FastStream v$1!", + "player_nosource_alert": "No source is loaded!", + "player_archive_loading": "Loading archive... $1%", + "player_archive_loaded": "Loaded archive!", + "player_archive_fail": "Failed to load archive!", + "player_filename_prompt": "Enter a name for the file", + "player_screenshot_saving": "Taking screenshot...", + "player_screenshot_saved": "Screenshot saved!", + "player_screenshot_fail": "Failed to take screenshot!", + "player_savevideo_inprogress_alert": "Already making save!", + "player_savevideo_unsupported": "Saving is not supported for this video!", + "player_savevideo_partial_confirm": "Video has not finished downloading yet! Are you sure you want to save it?", + "player_savevideo_incognito_confirm": "Incognito Mode will use RAM to buffer videos. Your computer may not have enough memory to save the entire video!\nAre you sure you want to proceed?", + "player_savevideo_start": "Making save...", + "player_savevideo_progress": "Saving $1%", + "player_savevideo_fail": "Failed to save video!", + "player_savevideo_failed_ask_archive": "Failed to save video!\nWould you like to archive the player's buffer storage instead?\n- Drag and drop archive files on the player to load it", + "player_savevideo_complete": "Save complete!", + "player_archiver_progress": "Archiving $1", + "player_archiver_saved": "Archive saved!", + "player_quality_current": "(current)", + "player_buffer_incognito_warning": "Not enough space to predownload in incognito mode, will buffer $1s", + "player_buffer_storage_warning": "Not enough space to predownload, will buffer $1s", + "player_error_drm": "Failed to load! DRM is not supported!", + "player_error_load": "Failed to load video!", + "player_source_autodetect": "Auto Detect", + "player_source_direct": "Direct", + "player_source_accelmp4": "Accelerated MP4", + "player_source_accelhls": "Accelerated HLS", + "player_source_acceldash": "Accelerated DASH", + "player_source_accelyt": "Accelerated YouTube", + "player_source_mode": "Mode", + "player_source_url_placeholder": "Source URL", + "player_source_headerbtn": "Header Override ($1)", + "player_source_headerbtn_label": "Toggle header override input", + "player_source_headerbtn_disabled": "Header Override (Extension Only)", + "player_source_playbtn": "Play", + "player_source_playbtn_playing": "Playing", + "player_source_playbtn_loading": "Loading...", + "player_source_deletebtn": "Delete", + "player_source_headers_label": "Header override input", + "player_source_headers_placeholder": "Header-Name: Header Value\nHeader2-Name: Header2 Value", + "player_source_nonelisted": "No Sources Listed", + "player_source_onelisted": "1 Source Listed", + "player_source_multilisted": "$1 Sources Listed", + "player_source_addbtn": "Add Source", + "player_source_clearbtn": "Clear Sources", + "player_audioconfig_duplicate_profile": "(loaded from file on $1)", + "player_audioconfig_create_profile": "Create new profile", + "player_audioconfig_import_profile": "Import profiles from file", + "player_audioconfig_import_invalid": "Invalid profile file", + "player_audioconfig_profile": "Profile", + "player_audioconfig_profile_unnamed": "Unnamed Profile", + "player_audioconfig_profile_load": "Load Profile", + "player_audioconfig_profile_loaded": "Loaded Profile!", + "player_audioconfig_profile_save": "Save Profile", + "player_audioconfig_profile_saving": "Saving...", + "player_audioconfig_profile_saved": "Saved Profile!", + "player_audioconfig_profile_download": "Download Profile", + "player_audioconfig_profile_downloaded": "Downloaded!", + "player_audioconfig_profile_delete": "Delete", + "player_audioconfig_profile_deleting": "Deleting...", + "player_audioconfig_profile_deleted": "Deleted!", + "audiomixer_title": "Audio Channel Mixer", + "audiomixer_solo_label": "Solo", + "audiomixer_mute_label": "Mute", + "audiocompressor_title": "Audio Compressor", + "audiocompressor_enabled": "Compressor Enabled", + "audiocompressor_disabled": "Compressor Disabled", + "audiocompressor_threshold": "Threshold", + "audiocompressor_knee": "Knee", + "audiocompressor_ratio": "Ratio", + "audiocompressor_attack": "Attack", + "audiocompressor_release": "Release", + "audiocompressor_gain": "Gain", + "audioeq_title": "Audio Equalizer", + "audioeq_instructions": "Double click to change type", + "audioeq_gain": "Gain: $1dB", + "audioeq_qscroll": "Scroll to change Q", + "options_title": "FastStream Options", + "options_promo_header": "Enjoy FastStream? Leave a review!", + "options_promo_body": "FastStream is a hobby project maintained by volunteers. We appreciate your feedback as it helps us to know where to improve. Please feel free tell us:", + "options_promo_l1": "How you use it", + "options_promo_l2": "Any bugs you encounter", + "options_promo_l3": "Feature requests", + "options_promo_end": "We also take accessibility very seriously. If you need accommodations that are lacking in the current version, please make a request and we will work on it ASAP.", + "options_promo_rate": "OK I'll review FastStream", + "options_promo_norate": "I don't want to review :(", + "options_video_header": "Video Options", + "options_video_body": "Applies CSS filters to the video. Doesn't work with picture-in-picture.", + "options_video_brightness": "Brightness", + "options_video_contrast": "Contrast", + "options_video_saturation": "Saturation", + "options_video_grayscale": "Grayscale", + "options_video_sepia": "Sepia", + "options_video_invert": "Invert", + "options_video_hue": "Hue Rotate", + "options_general_header": "General Options", + "options_general_predownload": "Predownload entire video in the background if possible", + "options_general_targetspeed": "Target download speed of predownloader", + "options_general_freeunused": "Free unused channel buffers when switching quality levels", + "options_general_analyze": "Automatically analyze sequential videos for intros/outros\n(turn off if you have CPU performance issues)", + "options_general_autosub": "Automatically enable best found subtitle track\n(Change default language in subtitle settings)", + "options_general_stream": "Use player to play HLS/DASH streams when opening playlist URLs (.m3u8/.mpd)", + "options_general_mp4": "Use player to play MP4 videos when opening video URLs (.mp4)", + "options_general_seekstep": "Seek keybind base step size (seconds)", + "options_keybinds_header": "Keyboard Shortcuts", + "options_keybinds_body": "Keybinds are only active when the player is focused.", + "options_keybinds_reset": "Reset to Defaults", + "options_autourl_header": "Auto-enable URLs", + "options_autourl_body": "Will automatically enable the extension upon visiting these URLs and disable upon leaving. One URL per line, pages starting with that URL will also match. For regex, prepend with a tilde (~). One regex per line.", + "options_autourl_hint": "Hint: Test regex on", + "options_help_header": "Help", + "options_help_welcome": "Welcome Page", + "options_help_issues": "Issue Tracker" +}; +export class Localize { + static getMessage(key, substitutions) { + if (EnvUtils.isExtension()) { + return chrome.i18n.getMessage(key, substitutions); + } + if (!Object.hasOwn(TranslationMap, key)) { + return key; + } + // Replace $1, $2, etc. with substitutions + let result = TranslationMap[key]; + substitutions = substitutions || []; + for (let i = 0; i < substitutions.length; i++) { + result = result.replace(`$${i + 1}`, substitutions[i]); + } + return result; + } +} diff --git a/built/web/player/modules/StreamSaver.mjs b/built/web/player/modules/StreamSaver.mjs new file mode 100644 index 00000000..3de9a854 --- /dev/null +++ b/built/web/player/modules/StreamSaver.mjs @@ -0,0 +1,122 @@ +import {EnvUtils} from '../utils/EnvUtils.mjs'; +import {FSBlob} from './FSBlob.mjs'; +/* ! streamsaver. MIT License. Jimmy Wärting */ +export const streamSaver = { + createWriteStream, +}; +const useBlobFallback = !EnvUtils.isExtension() || navigator.serviceWorker === undefined; +function getServiceWorker() { + return navigator.serviceWorker.getRegistration('./').then((swReg) => { + const swRegTmp = swReg.installing || swReg.waiting; + return swReg.active || new Promise((resolve) => { + swRegTmp.addEventListener('statechange', fn = () => { + if (swRegTmp.state === 'activated') { + swRegTmp.removeEventListener('statechange', fn); + sw = swReg.active; + resolve(); + } + }); + }); + }); +}; +function makeIframe(src) { + if (!src) throw new Error('meh'); + const iframe = document.createElement('iframe'); + iframe.hidden = true; + iframe.src = src; + iframe.loaded = false; + iframe.name = 'iframe'; + iframe.isIframe = true; + iframe.postMessage = (...args) => iframe.contentWindow.postMessage(...args); + iframe.addEventListener('load', () => { + iframe.loaded = true; + }, {once: true}); + document.body.appendChild(iframe); + return iframe; +} +function createWriteStreamBlob(filename, opts, size) { + const blobManager = new FSBlob(); + const blobs = []; + return new WritableStream({ + write(chunk) { + blobs.push(blobManager.createBlob(chunk)); + }, + async close() { + const chunks = await Promise.all(blobs.map((blob) => blobManager.getBlob(blob))); + const blob = new Blob(chunks, {type: 'application/octet-stream'}); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = filename; + document.body.appendChild(a); + a.click(); + a.remove(); + URL.revokeObjectURL(url); + setTimeout(() => { + blobManager.close(); + }, 120000); + }, + abort() { + chunks = []; + }, + }, opts.writableStrategy); +} +/** + * @param {string} filename filename that should be used + * @param {object} options [description] + * @param {number} size deprecated + * @return {WritableStream} + */ +function createWriteStream(filename, options, size) { + const opts = options || {}; + if (useBlobFallback) { + return createWriteStreamBlob(filename, opts, size); + } + let channel = null; + let ts = null; + channel = new MessageChannel(); + // Make filename RFC5987 compatible + filename = encodeURIComponent(filename.replace(/\//g, ':')) + .replace(/['()]/g, escape) + .replace(/\*/g, '%2A'); + const response = { + filename: filename, + headers: { + 'Content-Type': 'application/octet-stream', + 'Content-Disposition': 'attachment; filename*=UTF-8\'\'' + filename, + }, + }; + if (opts.size) { + response.headers['Content-Length'] = opts.size; + } + const args = [response, [channel.port2]]; + const transformer = undefined; + ts = new TransformStream( + transformer, + opts.writableStrategy, + opts.readableStrategy, + ); + const readableStream = ts.readable; + channel.port1.postMessage({readableStream}, [readableStream]); + channel.port1.onmessage = (evt) => { + // Service worker sent us a link that we should open. + if (evt.data.download) { + makeIframe(evt.data.download); + } else if (evt.data.abort) { + channel.port1.postMessage('abort'); // send back so controller is aborted + channel.port1.onmessage = null; + channel.port1.close(); + channel.port2.close(); + channel = null; + } else if (evt.data.close) { + channel.port1.onmessage = null; + channel.port1.close(); + channel.port2.close(); + channel = null; + } + }; + getServiceWorker().then((sw)=>{ + sw.postMessage(...args); + }); + return ts.writable; +} diff --git a/built/web/player/modules/coloris.mjs b/built/web/player/modules/coloris.mjs new file mode 100644 index 00000000..e02ce86a --- /dev/null +++ b/built/web/player/modules/coloris.mjs @@ -0,0 +1,8 @@ +/* eslint-disable */ +// Minified to reduce loading time (https://minify-js.com/) +/*! +* Copyright (c) 2021 Momo Bassit. +* Licensed under the MIT License (MIT) +* https://github.com/mdbassit/Coloris +*/ +var container,picker,colorArea,colorMarker,colorPreview,colorValue,clearButton,closeButton,hueSlider,hueMarker,alphaSlider,alphaMarker,currentEl,currentFormat,oldColor,keyboardNav,ctx=document.createElement("canvas").getContext("2d"),currentColor={r:0,g:0,b:0,h:0,s:0,v:0,a:1},colorAreaDims={},settings={el:"[data-coloris]",parent:"body",theme:"default",themeMode:"light",rtl:!1,wrap:!0,margin:2,format:"hex",formatToggle:!1,swatches:[],swatchesOnly:!1,alpha:!0,forceAlpha:!1,focusInput:!0,selectInput:!1,inline:!1,defaultColor:"#000000",clearButton:!1,clearLabel:"Clear",closeButton:!1,closeLabel:"Close",onChange:function(){},a11y:{open:"Open color picker",close:"Close color picker",clear:"Clear the selected color",marker:"Saturation: {s}. Brightness: {v}.",hueSlider:"Hue slider",alphaSlider:"Opacity slider",input:"Color value field",format:"Color format",swatch:"Color swatch",instruction:"Saturation and brightness selector. Use up, down, left and right arrow keys to select."}},instances={},currentInstanceId="",defaultInstance={},hasInstance=!1;function configure(e){if("object"==typeof e)for(var t in e)switch(t){case"el":bindFields(e.el),!1!==e.wrap&&wrapFields(e.el);break;case"parent":(container=document.querySelector(e.parent))&&(container.appendChild(picker),settings.parent=e.parent,container===document.body&&(container=void 0));break;case"themeMode":settings.themeMode=e.themeMode,"auto"===e.themeMode&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(settings.themeMode="dark");case"theme":e.theme&&(settings.theme=e.theme),picker.className="clr-picker clr-"+settings.theme+" clr-"+settings.themeMode,settings.inline&&updatePickerPosition();break;case"rtl":settings.rtl=!!e.rtl,document.querySelectorAll(".clr-field").forEach((function(e){return e.classList.toggle("clr-rtl",settings.rtl)}));break;case"margin":e.margin*=1,settings.margin=isNaN(e.margin)?settings.margin:e.margin;break;case"wrap":e.el&&e.wrap&&wrapFields(e.el);break;case"formatToggle":settings.formatToggle=!!e.formatToggle,getEl("clr-format").style.display=settings.formatToggle?"block":"none",settings.formatToggle&&(settings.format="auto");break;case"swatches":Array.isArray(e.swatches)&&function(){var t=[];e.swatches.forEach((function(e,r){t.push('")})),getEl("clr-swatches").innerHTML=t.length?"
"+t.join("")+"
":"",settings.swatches=e.swatches.slice()}();break;case"swatchesOnly":settings.swatchesOnly=!!e.swatchesOnly,picker.setAttribute("data-minimal",settings.swatchesOnly);break;case"alpha":settings.alpha=!!e.alpha,picker.setAttribute("data-alpha",settings.alpha);break;case"inline":if(settings.inline=!!e.inline,picker.setAttribute("data-inline",settings.inline),settings.inline){var r=e.defaultColor||settings.defaultColor;currentFormat=getColorFormatFromStr(r),updatePickerPosition(),setColorFromStr(r)}break;case"clearButton":"object"==typeof e.clearButton&&(e.clearButton.label&&(settings.clearLabel=e.clearButton.label,clearButton.innerHTML=settings.clearLabel),e.clearButton=e.clearButton.show),settings.clearButton=!!e.clearButton,clearButton.style.display=settings.clearButton?"block":"none";break;case"clearLabel":settings.clearLabel=e.clearLabel,clearButton.innerHTML=settings.clearLabel;break;case"closeButton":settings.closeButton=!!e.closeButton,settings.closeButton?picker.insertBefore(closeButton,colorPreview):colorPreview.appendChild(closeButton);break;case"closeLabel":settings.closeLabel=e.closeLabel,closeButton.innerHTML=settings.closeLabel;break;case"a11y":var a=e.a11y,o=!1;if("object"==typeof a)for(var l in a)a[l]&&settings.a11y[l]&&(settings.a11y[l]=a[l],o=!0);if(o){var n=getEl("clr-open-label"),i=getEl("clr-swatch-label");n.innerHTML=settings.a11y.open,i.innerHTML=settings.a11y.swatch,closeButton.setAttribute("aria-label",settings.a11y.close),clearButton.setAttribute("aria-label",settings.a11y.clear),hueSlider.setAttribute("aria-label",settings.a11y.hueSlider),alphaSlider.setAttribute("aria-label",settings.a11y.alphaSlider),colorValue.setAttribute("aria-label",settings.a11y.input),colorArea.setAttribute("aria-label",settings.a11y.instruction)}break;default:settings[t]=e[t]}}function setVirtualInstance(e,t){"string"==typeof e&&"object"==typeof t&&(instances[e]=t,hasInstance=!0)}function removeVirtualInstance(e){delete instances[e],0===Object.keys(instances).length&&(hasInstance=!1,e===currentInstanceId&&resetVirtualInstance())}function attachVirtualInstance(e){if(hasInstance){var t=["el","wrap","rtl","inline","defaultColor","a11y"],r=function(r){var a=instances[r];if(e.matches(r)){for(var o in currentInstanceId=r,defaultInstance={},t.forEach((function(e){return delete a[e]})),a)defaultInstance[o]=Array.isArray(settings[o])?settings[o].slice():settings[o];return configure(a),"break"}};for(var a in instances){if("break"===r(a))break}}}function resetVirtualInstance(){Object.keys(defaultInstance).length>0&&(configure(defaultInstance),currentInstanceId="",defaultInstance={})}function bindFields(e){addListener(document,"click",e,(function(e){settings.inline||(attachVirtualInstance(e.target),currentEl=e.target,oldColor=currentEl.value,currentFormat=getColorFormatFromStr(oldColor),picker.classList.add("clr-open"),updatePickerPosition(),setColorFromStr(oldColor),(settings.focusInput||settings.selectInput)&&(colorValue.focus({preventScroll:!0}),colorValue.setSelectionRange(currentEl.selectionStart,currentEl.selectionEnd)),settings.selectInput&&colorValue.select(),(keyboardNav||settings.swatchesOnly)&&getFocusableElements().shift().focus(),currentEl.dispatchEvent(new Event("open",{bubbles:!0})))})),addListener(document,"input",e,(function(e){var t=e.target.parentNode;t.classList.contains("clr-field")&&(t.style.color=e.target.value)}))}function bindElement(e){e.addEventListener("click",(function(e){settings.inline||(attachVirtualInstance(e.target),currentEl=e.target,oldColor=currentEl.value,currentFormat=getColorFormatFromStr(oldColor),picker.classList.add("clr-open"),updatePickerPosition(),setColorFromStr(oldColor),(settings.focusInput||settings.selectInput)&&(colorValue.focus({preventScroll:!0}),colorValue.setSelectionRange(currentEl.selectionStart,currentEl.selectionEnd)),settings.selectInput&&colorValue.select(),(keyboardNav||settings.swatchesOnly)&&getFocusableElements().shift().focus(),currentEl.dispatchEvent(new Event("open",{bubbles:!0})))})),e.addEventListener("input",(function(e){var t=e.target.parentNode;t.classList.contains("clr-field")&&(t.style.color=e.target.value)}))}function updatePickerPosition(){var e,t,r,a=container,o=window.scrollY,l=picker.offsetWidth,n=picker.offsetHeight,i={left:!1,top:!1},s={x:0,y:0};if(a&&(e=window.getComputedStyle(a),t=parseFloat(e.marginTop),r=parseFloat(e.borderTopWidth),(s=a.getBoundingClientRect()).y+=r+o),!settings.inline){var c=currentEl.getBoundingClientRect(),u=c.x,d=o+c.y+c.height+settings.margin;a?(u-=s.x,d-=s.y,u+l>a.clientWidth&&(u+=c.width-l,i.left=!0),d+n>a.clientHeight-t&&n+settings.margin<=c.top-(s.y-o)&&(d-=c.height+n+2*settings.margin,i.top=!0),d+=a.scrollTop):(u+l>document.documentElement.clientWidth&&(u+=c.width-l,i.left=!0),d+n-o>document.documentElement.clientHeight&&n+settings.margin<=c.top&&(d=o+c.y-n-settings.margin,i.top=!0)),picker.classList.toggle("clr-left",i.left),picker.classList.toggle("clr-top",i.top),picker.style.left=u+"px",picker.style.top=d+"px",s.x+=picker.offsetLeft,s.y+=picker.offsetTop}colorAreaDims={width:colorArea.offsetWidth,height:colorArea.offsetHeight,x:colorArea.offsetLeft+s.x,y:colorArea.offsetTop+s.y}}function wrapFields(e){document.querySelectorAll(e).forEach((function(e){var t=e.parentNode;if(!t.classList.contains("clr-field")){var r=document.createElement("div"),a="clr-field";(settings.rtl||e.classList.contains("clr-rtl"))&&(a+=" clr-rtl"),r.innerHTML='',t.insertBefore(r,e),r.setAttribute("class",a),r.style.color=e.value,r.appendChild(e)}}))}function closePicker(e){if(currentEl&&!settings.inline){var t=currentEl;e&&(currentEl=void 0,oldColor!==t.value&&(t.value=oldColor,t.dispatchEvent(new Event("input",{bubbles:!0})))),setTimeout((function(){oldColor!==t.value&&t.dispatchEvent(new Event("change",{bubbles:!0}))})),picker.classList.remove("clr-open"),hasInstance&&resetVirtualInstance(),t.dispatchEvent(new Event("close",{bubbles:!0})),settings.focusInput&&t.focus({preventScroll:!0}),currentEl=void 0}}function setColorFromStr(e){var t=strToRGBA(e),r=RGBAtoHSVA(t);updateMarkerA11yLabel(r.s,r.v),updateColor(t,r),hueSlider.value=r.h,picker.style.color="hsl("+r.h+", 100%, 50%)",hueMarker.style.left=r.h/360*100+"%",colorMarker.style.left=colorAreaDims.width*r.s/100+"px",colorMarker.style.top=colorAreaDims.height-colorAreaDims.height*r.v/100+"px",alphaSlider.value=100*r.a,alphaMarker.style.left=100*r.a+"%"}function getColorFormatFromStr(e){var t=e.substring(0,3).toLowerCase();return"rgb"===t||"hsl"===t?t:"hex"}function pickColor(e){e=void 0!==e?e:colorValue.value,currentEl&&(currentEl.value=e,currentEl.dispatchEvent(new Event("input",{bubbles:!0}))),settings.onChange&&settings.onChange.call(window,e,currentEl),document.dispatchEvent(new CustomEvent("coloris:pick",{detail:{color:e,currentEl:currentEl}}))}function setColorAtPosition(e,t){var r={h:1*hueSlider.value,s:e/colorAreaDims.width*100,v:100-t/colorAreaDims.height*100,a:alphaSlider.value/100},a=HSVAtoRGBA(r);updateMarkerA11yLabel(r.s,r.v),updateColor(a,r),pickColor()}function updateMarkerA11yLabel(e,t){var r=settings.a11y.marker;e=1*e.toFixed(1),t=1*t.toFixed(1),r=(r=r.replace("{s}",e)).replace("{v}",t),colorMarker.setAttribute("aria-label",r)}function getPointerPosition(e){return{pageX:e.changedTouches?e.changedTouches[0].pageX:e.pageX,pageY:e.changedTouches?e.changedTouches[0].pageY:e.pageY}}function moveMarker(e){var t=getPointerPosition(e),r=t.pageX-colorAreaDims.x,a=t.pageY-colorAreaDims.y;container&&(a+=container.scrollTop),setMarkerPosition(r,a),e.preventDefault(),e.stopPropagation()}function moveMarkerOnKeydown(e,t){setMarkerPosition(1*colorMarker.style.left.replace("px","")+e,1*colorMarker.style.top.replace("px","")+t)}function setMarkerPosition(e,t){e=e<0?0:e>colorAreaDims.width?colorAreaDims.width:e,t=t<0?0:t>colorAreaDims.height?colorAreaDims.height:t,colorMarker.style.left=e+"px",colorMarker.style.top=t+"px",setColorAtPosition(e,t),colorMarker.focus()}function updateColor(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=settings.format;for(var a in e)currentColor[a]=e[a];for(var o in t)currentColor[o]=t[o];var l=RGBAToHex(currentColor),n=l.substring(0,7);switch(colorMarker.style.color=n,alphaMarker.parentNode.style.color=n,alphaMarker.style.color=l,colorPreview.style.color=l,colorArea.style.display="none",colorArea.offsetHeight,colorArea.style.display="",alphaMarker.nextElementSibling.style.display="none",alphaMarker.nextElementSibling.offsetHeight,alphaMarker.nextElementSibling.style.display="","mixed"===r?r=1===currentColor.a?"hex":"rgb":"auto"===r&&(r=currentFormat),r){case"hex":colorValue.value=l;break;case"rgb":colorValue.value=RGBAToStr(currentColor);break;case"hsl":colorValue.value=HSLAToStr(HSVAtoHSLA(currentColor))}document.querySelector('.clr-format [value="'+r+'"]').checked=!0}function setHue(){var e=1*hueSlider.value,t=1*colorMarker.style.left.replace("px",""),r=1*colorMarker.style.top.replace("px","");picker.style.color="hsl("+e+", 100%, 50%)",hueMarker.style.left=e/360*100+"%",setColorAtPosition(t,r)}function setAlpha(){var e=alphaSlider.value/100;alphaMarker.style.left=100*e+"%",updateColor({a:e}),pickColor()}function HSVAtoRGBA(e){var t=e.s/100,r=e.v/100,a=t*r,o=e.h/60,l=a*(1-Math.abs(o%2-1)),n=r-a;a+=n,l+=n;var i=Math.floor(o)%6,s=[a,l,n,n,l,a][i],c=[l,a,a,l,n,n][i],u=[n,n,l,a,a,l][i];return{r:Math.round(255*s),g:Math.round(255*c),b:Math.round(255*u),a:e.a}}function HSVAtoHSLA(e){var t,r=e.v/100,a=r*(1-e.s/100/2);return a>0&&a<1&&(t=Math.round((r-a)/Math.min(a,1-a)*100)),{h:e.h,s:t||0,l:Math.round(100*a),a:e.a}}function RGBAtoHSVA(e){var t=e.r/255,r=e.g/255,a=e.b/255,o=Math.max(t,r,a),l=o-Math.min(t,r,a),n=o,i=0,s=0;return l&&(o===t&&(i=(r-a)/l),o===r&&(i=2+(a-t)/l),o===a&&(i=4+(t-r)/l),o&&(s=l/o)),{h:(i=Math.floor(60*i))<0?i+360:i,s:Math.round(100*s),v:Math.round(100*n),a:e.a}}function strToRGBA(e){var t,r;return ctx.fillStyle="#000",ctx.fillStyle=e,(t=/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i.exec(ctx.fillStyle))?(r={r:1*t[3],g:1*t[4],b:1*t[5],a:1*t[6]}).a=+r.a.toFixed(2):r={r:(t=ctx.fillStyle.replace("#","").match(/.{2}/g).map((function(e){return parseInt(e,16)})))[0],g:t[1],b:t[2],a:1},r}function RGBAToHex(e){var t=e.r.toString(16),r=e.g.toString(16),a=e.b.toString(16),o="";if(e.r<16&&(t="0"+t),e.g<16&&(r="0"+r),e.b<16&&(a="0"+a),settings.alpha&&(e.a<1||settings.forceAlpha)){var l=255*e.a|0;o=l.toString(16),l<16&&(o="0"+o)}return"#"+t+r+a+o}function RGBAToStr(e){return!settings.alpha||1===e.a&&!settings.forceAlpha?"rgb("+e.r+", "+e.g+", "+e.b+")":"rgba("+e.r+", "+e.g+", "+e.b+", "+e.a+")"}function HSLAToStr(e){return!settings.alpha||1===e.a&&!settings.forceAlpha?"hsl("+e.h+", "+e.s+"%, "+e.l+"%)":"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"}function init(){container=void 0,(picker=document.createElement("div")).setAttribute("id","clr-picker"),picker.className="clr-picker",picker.innerHTML='
'+settings.a11y.format+'
",document.body.appendChild(picker),colorArea=getEl("clr-color-area"),colorMarker=getEl("clr-color-marker"),clearButton=getEl("clr-clear"),closeButton=getEl("clr-close"),colorPreview=getEl("clr-color-preview"),colorValue=getEl("clr-color-value"),hueSlider=getEl("clr-hue-slider"),hueMarker=getEl("clr-hue-marker"),alphaSlider=getEl("clr-alpha-slider"),alphaMarker=getEl("clr-alpha-marker"),bindFields(settings.el),wrapFields(settings.el),addListener(picker,"mousedown",(function(e){picker.classList.remove("clr-keyboard-nav"),e.stopPropagation()})),addListener(colorArea,"mousedown",(function(e){addListener(document,"mousemove",moveMarker)})),addListener(colorArea,"touchstart",(function(e){document.addEventListener("touchmove",moveMarker,{passive:!1})})),addListener(colorMarker,"mousedown",(function(e){addListener(document,"mousemove",moveMarker)})),addListener(colorMarker,"touchstart",(function(e){document.addEventListener("touchmove",moveMarker,{passive:!1})})),addListener(colorValue,"change",(function(e){var t=colorValue.value;(currentEl||settings.inline)&&pickColor(""===t?t:setColorFromStr(t))})),addListener(colorValue,"keydown",(function(e){"Tab"!==e.key&&"Escape"!==e.key&&e.stopPropagation()})),addListener(clearButton,"click",(function(e){pickColor(""),closePicker()})),addListener(closeButton,"click",(function(e){pickColor(),closePicker()})),addListener(getEl("clr-format"),"click",".clr-format input",(function(e){currentFormat=e.target.value,updateColor(),pickColor()})),addListener(picker,"click",".clr-swatches button",(function(e){setColorFromStr(e.target.textContent),pickColor(),settings.swatchesOnly&&closePicker()})),addListener(document,"mouseup",(function(e){document.removeEventListener("mousemove",moveMarker)})),addListener(document,"touchend",(function(e){document.removeEventListener("touchmove",moveMarker)})),addListener(document,"mousedown",(function(e){keyboardNav=!1,picker.classList.remove("clr-keyboard-nav"),closePicker()})),addListener(document,"keydown",(function(e){var t=e.key,r=e.target,a=e.shiftKey;if("Escape"===t?closePicker(!0):["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t)&&(keyboardNav=!0,picker.classList.add("clr-keyboard-nav")),"Tab"===t&&r.matches(".clr-picker *")){var o=getFocusableElements(),l=o.shift(),n=o.pop();a&&r===l?(n.focus(),e.preventDefault(),e.stopPropagation()):a||r!==n||(l.focus(),e.preventDefault(),e.stopPropagation())}})),addListener(document,"click",".clr-field button",(function(e){hasInstance&&resetVirtualInstance(),e.target.nextElementSibling.dispatchEvent(new Event("click",{bubbles:!0}))})),addListener(colorMarker,"keydown",(function(e){var t={ArrowUp:[0,-1],ArrowDown:[0,1],ArrowLeft:[-1,0],ArrowRight:[1,0]};Object.keys(t).includes(e.key)&&(moveMarkerOnKeydown.apply(void 0,t[e.key]),e.preventDefault(),e.stopPropagation())})),addListener(hueSlider,"keydown",(function(e){const t=1*hueSlider.value;"ArrowLeft"===e.key?(hueSlider.value=t-5,setHue(),e.stopPropagation(),e.preventDefault()):"ArrowRight"===e.key&&(hueSlider.value=t+5,setHue(),e.stopPropagation(),e.preventDefault())})),addListener(alphaSlider,"keydown",(function(e){const t=1*alphaSlider.value;"ArrowLeft"===e.key?(alphaSlider.value=t-2,setAlpha(),e.stopPropagation(),e.preventDefault()):"ArrowRight"===e.key&&(alphaSlider.value=t+2,setAlpha(),e.stopPropagation(),e.preventDefault())})),addListener(colorArea,"click",moveMarker),addListener(hueSlider,"input",setHue),addListener(alphaSlider,"input",setAlpha)}function getFocusableElements(){return Array.from(picker.querySelectorAll("input, button")).filter((function(e){return!!e.offsetWidth}))}function getEl(e){return document.getElementById(e)}function addListener(e,t,r,a){var o=Element.prototype.matches||Element.prototype.msMatchesSelector;"string"==typeof r?e.addEventListener(t,(function(e){o.call(e.target,r)&&a.call(e.target,e)}),!0):(a=r,e.addEventListener(t,a))}function DOMReady(e,t){t=void 0!==t?t:[],"loading"!==document.readyState?e.apply(void 0,t):document.addEventListener("DOMContentLoaded",(function(){e.apply(void 0,t)}))}void 0!==NodeList&&NodeList.prototype&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);export const Coloris=function(){var e={set:configure,wrap:wrapFields,close:closePicker,setInstance:setVirtualInstance,removeInstance:removeVirtualInstance,updatePosition:updatePickerPosition};function t(e){DOMReady((function(){e&&("string"==typeof e?bindFields(e):configure(e))}))}var r=function(r){t[r]=function(){for(var t=arguments.length,a=new Array(t),o=0;o> 6); + u.push(0x80 | 63 & c); + } else if (c < 0x10000) { + u.push(0xE0 | c >> 12); + u.push(0x80 | 63 & c >> 6); + u.push(0x80 | 63 & c); + } else { + u.push(0xF0 | c >> 18); + u.push(0x80 | 63 & c >> 12); + u.push(0x80 | 63 & c >> 6); + u.push(0x80 | 63 & c); + } + } + return u; + }; + UTF8.decode = function (u) { + var a = []; + var i = 0; + while (i < u.length) { + var v = u[i++]; + if (v < 0x80) {// no need to mask byte + } else if (v < 0xE0) { + v = (31 & v) << 6; + v |= 63 & u[i++]; + } else if (v < 0xF0) { + v = (15 & v) << 12; + v |= (63 & u[i++]) << 6; + v |= 63 & u[i++]; + } else { + v = (7 & v) << 18; + v |= (63 & u[i++]) << 12; + v |= (63 & u[i++]) << 6; + v |= 63 & u[i++]; + } + a.push(String.fromCharCode(v)); + } + return a.join(''); + }; + var BASE64 = {}; + (function (T) { + var encodeArray = function encodeArray(u) { + var i = 0; + var a = []; + var n = 0 | u.length / 3; + while (0 < n--) { + var v = (u[i] << 16) + (u[i + 1] << 8) + u[i + 2]; + i += 3; + a.push(T.charAt(63 & v >> 18)); + a.push(T.charAt(63 & v >> 12)); + a.push(T.charAt(63 & v >> 6)); + a.push(T.charAt(63 & v)); + } + if (2 == u.length - i) { + var v = (u[i] << 16) + (u[i + 1] << 8); + a.push(T.charAt(63 & v >> 18)); + a.push(T.charAt(63 & v >> 12)); + a.push(T.charAt(63 & v >> 6)); + a.push('='); + } else if (1 == u.length - i) { + var v = u[i] << 16; + a.push(T.charAt(63 & v >> 18)); + a.push(T.charAt(63 & v >> 12)); + a.push('=='); + } + return a.join(''); + }; + var R = function () { + var a = []; + for (var i = 0; i < T.length; ++i) { + a[T.charCodeAt(i)] = i; + } + a['='.charCodeAt(0)] = 0; + return a; + }(); + var decodeArray = function decodeArray(s) { + var i = 0; + var u = []; + var n = 0 | s.length / 4; + while (0 < n--) { + var v = (R[s.charCodeAt(i)] << 18) + (R[s.charCodeAt(i + 1)] << 12) + (R[s.charCodeAt(i + 2)] << 6) + R[s.charCodeAt(i + 3)]; + u.push(255 & v >> 16); + u.push(255 & v >> 8); + u.push(255 & v); + i += 4; + } + if (u) { + if ('=' == s.charAt(i - 2)) { + u.pop(); + u.pop(); + } else if ('=' == s.charAt(i - 1)) { + u.pop(); + } + } + return u; + }; + var ASCII = {}; + ASCII.encode = function (s) { + var u = []; + for (var i = 0; i < s.length; ++i) { + u.push(s.charCodeAt(i)); + } + return u; + }; + ASCII.decode = function (u) { + for (var i = 0; i < s.length; ++i) { + a[i] = String.fromCharCode(a[i]); + } + return a.join(''); + }; + BASE64.decodeArray = function (s) { + var u = decodeArray(s); + return new Uint8Array(u); + }; + BASE64.encodeASCII = function (s) { + var u = ASCII.encode(s); + return encodeArray(u); + }; + BASE64.decodeASCII = function (s) { + var a = decodeArray(s); + return ASCII.decode(a); + }; + BASE64.encode = function (s) { + var u = UTF8.encode(s); + return encodeArray(u); + }; + BASE64.decode = function (s) { + var u = decodeArray(s); + return UTF8.decode(u); + }; + })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); + /*The following polyfills are not used in dash.js but have caused multiplayer integration issues. + Therefore commenting them out. + if (undefined === btoa) { + var btoa = BASE64.encode; + } + if (undefined === atob) { + var atob = BASE64.decode; + } + */ + if (true) { + exports.decode = BASE64.decode; + exports.decodeArray = BASE64.decodeArray; + exports.encode = BASE64.encode; + exports.encodeASCII = BASE64.encodeASCII; + } + /***/ +}), +/***/ "./externals/cea608-parser.js": +/*!************************************!*\ + !*** ./externals/cea608-parser.js ***! + \************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + /** + * The copyright in this software is being made available under the BSD License, + * included below. This software may be subject to other third party and contributor + * rights, including patent rights, and no such rights are granted under this license. + * + * Copyright (c) 2015-2016, DASH Industry Forum. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * 2. Neither the name of Dash Industry Forum nor the names of its + * contributors may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + (function (exports) { + "use strict"; + /** + * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes + */ + var specialCea608CharsCodes = { + 0x2a: 0xe1, + // lowercase a, acute accent + 0x5c: 0xe9, + // lowercase e, acute accent + 0x5e: 0xed, + // lowercase i, acute accent + 0x5f: 0xf3, + // lowercase o, acute accent + 0x60: 0xfa, + // lowercase u, acute accent + 0x7b: 0xe7, + // lowercase c with cedilla + 0x7c: 0xf7, + // division symbol + 0x7d: 0xd1, + // uppercase N tilde + 0x7e: 0xf1, + // lowercase n tilde + 0x7f: 0x2588, + // Full block + // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS + // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F + // THIS MEANS THAT \x50 MUST BE ADDED TO THE VALUES + 0x80: 0xae, + // Registered symbol (R) + 0x81: 0xb0, + // degree sign + 0x82: 0xbd, + // 1/2 symbol + 0x83: 0xbf, + // Inverted (open) question mark + 0x84: 0x2122, + // Trademark symbol (TM) + 0x85: 0xa2, + // Cents symbol + 0x86: 0xa3, + // Pounds sterling + 0x87: 0x266a, + // Music 8'th note + 0x88: 0xe0, + // lowercase a, grave accent + 0x89: 0x20, + // transparent space (regular) + 0x8a: 0xe8, + // lowercase e, grave accent + 0x8b: 0xe2, + // lowercase a, circumflex accent + 0x8c: 0xea, + // lowercase e, circumflex accent + 0x8d: 0xee, + // lowercase i, circumflex accent + 0x8e: 0xf4, + // lowercase o, circumflex accent + 0x8f: 0xfb, + // lowercase u, circumflex accent + // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS + // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F + 0x90: 0xc1, + // capital letter A with acute + 0x91: 0xc9, + // capital letter E with acute + 0x92: 0xd3, + // capital letter O with acute + 0x93: 0xda, + // capital letter U with acute + 0x94: 0xdc, + // capital letter U with diaresis + 0x95: 0xfc, + // lowercase letter U with diaeresis + 0x96: 0x2018, + // opening single quote + 0x97: 0xa1, + // inverted exclamation mark + 0x98: 0x2a, + // asterisk + 0x99: 0x2019, + // closing single quote + 0x9a: 0x2501, + // box drawings heavy horizontal + 0x9b: 0xa9, + // copyright sign + 0x9c: 0x2120, + // Service mark + 0x9d: 0x2022, + // (round) bullet + 0x9e: 0x201c, + // Left double quotation mark + 0x9f: 0x201d, + // Right double quotation mark + 0xa0: 0xc0, + // uppercase A, grave accent + 0xa1: 0xc2, + // uppercase A, circumflex + 0xa2: 0xc7, + // uppercase C with cedilla + 0xa3: 0xc8, + // uppercase E, grave accent + 0xa4: 0xca, + // uppercase E, circumflex + 0xa5: 0xcb, + // capital letter E with diaresis + 0xa6: 0xeb, + // lowercase letter e with diaresis + 0xa7: 0xce, + // uppercase I, circumflex + 0xa8: 0xcf, + // uppercase I, with diaresis + 0xa9: 0xef, + // lowercase i, with diaresis + 0xaa: 0xd4, + // uppercase O, circumflex + 0xab: 0xd9, + // uppercase U, grave accent + 0xac: 0xf9, + // lowercase u, grave accent + 0xad: 0xdb, + // uppercase U, circumflex + 0xae: 0xab, + // left-pointing double angle quotation mark + 0xaf: 0xbb, + // right-pointing double angle quotation mark + // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS + // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F + 0xb0: 0xc3, + // Uppercase A, tilde + 0xb1: 0xe3, + // Lowercase a, tilde + 0xb2: 0xcd, + // Uppercase I, acute accent + 0xb3: 0xcc, + // Uppercase I, grave accent + 0xb4: 0xec, + // Lowercase i, grave accent + 0xb5: 0xd2, + // Uppercase O, grave accent + 0xb6: 0xf2, + // Lowercase o, grave accent + 0xb7: 0xd5, + // Uppercase O, tilde + 0xb8: 0xf5, + // Lowercase o, tilde + 0xb9: 0x7b, + // Open curly brace + 0xba: 0x7d, + // Closing curly brace + 0xbb: 0x5c, + // Backslash + 0xbc: 0x5e, + // Caret + 0xbd: 0x5f, + // Underscore + 0xbe: 0x7c, + // Pipe (vertical line) + 0xbf: 0x223c, + // Tilde operator + 0xc0: 0xc4, + // Uppercase A, umlaut + 0xc1: 0xe4, + // Lowercase A, umlaut + 0xc2: 0xd6, + // Uppercase O, umlaut + 0xc3: 0xf6, + // Lowercase o, umlaut + 0xc4: 0xdf, + // Esszett (sharp S) + 0xc5: 0xa5, + // Yen symbol + 0xc6: 0xa4, + // Generic currency sign + 0xc7: 0x2503, + // Box drawings heavy vertical + 0xc8: 0xc5, + // Uppercase A, ring + 0xc9: 0xe5, + // Lowercase A, ring + 0xca: 0xd8, + // Uppercase O, stroke + 0xcb: 0xf8, + // Lowercase o, strok + 0xcc: 0x250f, + // Box drawings heavy down and right + 0xcd: 0x2513, + // Box drawings heavy down and left + 0xce: 0x2517, + // Box drawings heavy up and right + 0xcf: 0x251b // Box drawings heavy up and left + }; + /** + * Get Unicode Character from CEA-608 byte code + */ + var getCharForByte = function getCharForByte(_byte) { + var charCode = _byte; + if (specialCea608CharsCodes.hasOwnProperty(_byte)) { + charCode = specialCea608CharsCodes[_byte]; + } + return String.fromCharCode(charCode); + }; + var NR_ROWS = 15, + NR_COLS = 32; // Tables to look up row from PAC data + var rowsLowCh1 = { + 0x11: 1, + 0x12: 3, + 0x15: 5, + 0x16: 7, + 0x17: 9, + 0x10: 11, + 0x13: 12, + 0x14: 14 + }; + var rowsHighCh1 = { + 0x11: 2, + 0x12: 4, + 0x15: 6, + 0x16: 8, + 0x17: 10, + 0x13: 13, + 0x14: 15 + }; + var rowsLowCh2 = { + 0x19: 1, + 0x1A: 3, + 0x1D: 5, + 0x1E: 7, + 0x1F: 9, + 0x18: 11, + 0x1B: 12, + 0x1C: 14 + }; + var rowsHighCh2 = { + 0x19: 2, + 0x1A: 4, + 0x1D: 6, + 0x1E: 8, + 0x1F: 10, + 0x1B: 13, + 0x1C: 15 + }; + var backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent']; + /** + * Simple logger class to be able to write with time-stamps and filter on level. + */ + var logger = { + verboseFilter: { + 'DATA': 3, + 'DEBUG': 3, + 'INFO': 2, + 'WARNING': 2, + 'TEXT': 1, + 'ERROR': 0 + }, + time: null, + verboseLevel: 0, + // Only write errors + setTime: function setTime(newTime) { + this.time = newTime; + }, + log: function log(severity, msg) { + var minLevel = this.verboseFilter[severity]; + if (this.verboseLevel >= minLevel) { + console.log(this.time + " [" + severity + "] " + msg); + } + } + }; + var numArrayToHexArray = function numArrayToHexArray(numArray) { + var hexArray = []; + for (var j = 0; j < numArray.length; j++) { + hexArray.push(numArray[j].toString(16)); + } + return hexArray; + }; + /** + * State of CEA-608 pen or character + * @constructor + */ + var PenState = function PenState(foreground, underline, italics, background, flash) { + this.foreground = foreground || "white"; + this.underline = underline || false; + this.italics = italics || false; + this.background = background || "black"; + this.flash = flash || false; + }; + PenState.prototype = { + reset: function reset() { + this.foreground = "white"; + this.underline = false; + this.italics = false; + this.background = "black"; + this.flash = false; + }, + setStyles: function setStyles(styles) { + var attribs = ["foreground", "underline", "italics", "background", "flash"]; + for (var i = 0; i < attribs.length; i++) { + var style = attribs[i]; + if (styles.hasOwnProperty(style)) { + this[style] = styles[style]; + } + } + }, + isDefault: function isDefault() { + return this.foreground === "white" && !this.underline && !this.italics && this.background === "black" && !this.flash; + }, + equals: function equals(other) { + return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash; + }, + copy: function copy(newPenState) { + this.foreground = newPenState.foreground; + this.underline = newPenState.underline; + this.italics = newPenState.italics; + this.background = newPenState.background; + this.flash = newPenState.flash; + }, + toString: function toString() { + return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this.italics + ", background=" + this.background + ", flash=" + this.flash; + } + }; + /** + * Unicode character with styling and background. + * @constructor + */ + var StyledUnicodeChar = function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) { + this.uchar = uchar || ' '; // unicode character + this.penState = new PenState(foreground, underline, italics, background, flash); + }; + StyledUnicodeChar.prototype = { + reset: function reset() { + this.uchar = ' '; + this.penState.reset(); + }, + setChar: function setChar(uchar, newPenState) { + this.uchar = uchar; + this.penState.copy(newPenState); + }, + setPenState: function setPenState(newPenState) { + this.penState.copy(newPenState); + }, + equals: function equals(other) { + return this.uchar === other.uchar && this.penState.equals(other.penState); + }, + copy: function copy(newChar) { + this.uchar = newChar.uchar; + this.penState.copy(newChar.penState); + }, + isEmpty: function isEmpty() { + return this.uchar === ' ' && this.penState.isDefault(); + } + }; + /** + * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar. + * @constructor + */ + var Row = function Row() { + this.chars = []; + for (var i = 0; i < NR_COLS; i++) { + this.chars.push(new StyledUnicodeChar()); + } + this.pos = 0; + this.currPenState = new PenState(); + }; + Row.prototype = { + equals: function equals(other) { + var equal = true; + for (var i = 0; i < NR_COLS; i++) { + if (!this.chars[i].equals(other.chars[i])) { + equal = false; + break; + } + } + return equal; + }, + copy: function copy(other) { + for (var i = 0; i < NR_COLS; i++) { + this.chars[i].copy(other.chars[i]); + } + }, + isEmpty: function isEmpty() { + var empty = true; + for (var i = 0; i < NR_COLS; i++) { + if (!this.chars[i].isEmpty()) { + empty = false; + break; + } + } + return empty; + }, + /** + * Set the cursor to a valid column. + */ + setCursor: function setCursor(absPos) { + if (this.pos !== absPos) { + this.pos = absPos; + } + if (this.pos < 0) { + logger.log("ERROR", "Negative cursor position " + this.pos); + this.pos = 0; + } else if (this.pos > NR_COLS) { + logger.log("ERROR", "Too large cursor position " + this.pos); + this.pos = NR_COLS; + } + }, + /** + * Move the cursor relative to current position. + */ + moveCursor: function moveCursor(relPos) { + var newPos = this.pos + relPos; + if (relPos > 1) { + for (var i = this.pos + 1; i < newPos + 1; i++) { + this.chars[i].setPenState(this.currPenState); + } + } + this.setCursor(newPos); + }, + /** + * Backspace, move one step back and clear character. + */ + backSpace: function backSpace() { + this.moveCursor(-1); + this.chars[this.pos].setChar(' ', this.currPenState); + }, + insertChar: function insertChar(_byte2) { + if (_byte2 >= 0x90) { + //Extended char + this.backSpace(); + } + var _char = getCharForByte(_byte2); + if (this.pos >= NR_COLS) { + logger.log("ERROR", "Cannot insert " + _byte2.toString(16) + " (" + _char + ") at position " + this.pos + ". Skipping it!"); + return; + } + this.chars[this.pos].setChar(_char, this.currPenState); + this.moveCursor(1); + }, + clearFromPos: function clearFromPos(startPos) { + var i; + for (i = startPos; i < NR_COLS; i++) { + this.chars[i].reset(); + } + }, + clear: function clear() { + this.clearFromPos(0); + this.pos = 0; + this.currPenState.reset(); + }, + clearToEndOfRow: function clearToEndOfRow() { + this.clearFromPos(this.pos); + }, + getTextString: function getTextString() { + var chars = []; + var empty = true; + for (var i = 0; i < NR_COLS; i++) { + var _char2 = this.chars[i].uchar; + if (_char2 !== " ") { + empty = false; + } + chars.push(_char2); + } + if (empty) { + return ""; + } else { + return chars.join(""); + } + }, + setPenStyles: function setPenStyles(styles) { + this.currPenState.setStyles(styles); + var currChar = this.chars[this.pos]; + currChar.setPenState(this.currPenState); + } + }; + /** + * Keep a CEA-608 screen of 32x15 styled characters + * @constructor + */ + var CaptionScreen = function CaptionScreen() { + this.rows = []; + for (var i = 0; i < NR_ROWS; i++) { + this.rows.push(new Row()); // Note that we use zero-based numbering (0-14) + } + this.currRow = NR_ROWS - 1; + this.nrRollUpRows = null; + this.reset(); + }; + CaptionScreen.prototype = { + reset: function reset() { + for (var i = 0; i < NR_ROWS; i++) { + this.rows[i].clear(); + } + this.currRow = NR_ROWS - 1; + }, + equals: function equals(other) { + var equal = true; + for (var i = 0; i < NR_ROWS; i++) { + if (!this.rows[i].equals(other.rows[i])) { + equal = false; + break; + } + } + return equal; + }, + copy: function copy(other) { + for (var i = 0; i < NR_ROWS; i++) { + this.rows[i].copy(other.rows[i]); + } + }, + isEmpty: function isEmpty() { + var empty = true; + for (var i = 0; i < NR_ROWS; i++) { + if (!this.rows[i].isEmpty()) { + empty = false; + break; + } + } + return empty; + }, + backSpace: function backSpace() { + var row = this.rows[this.currRow]; + row.backSpace(); + }, + clearToEndOfRow: function clearToEndOfRow() { + var row = this.rows[this.currRow]; + row.clearToEndOfRow(); + }, + /** + * Insert a character (without styling) in the current row. + */ + insertChar: function insertChar(_char3) { + var row = this.rows[this.currRow]; + row.insertChar(_char3); + }, + setPen: function setPen(styles) { + var row = this.rows[this.currRow]; + row.setPenStyles(styles); + }, + moveCursor: function moveCursor(relPos) { + var row = this.rows[this.currRow]; + row.moveCursor(relPos); + }, + setCursor: function setCursor(absPos) { + logger.log("INFO", "setCursor: " + absPos); + var row = this.rows[this.currRow]; + row.setCursor(absPos); + }, + setPAC: function setPAC(pacData) { + logger.log("INFO", "pacData = " + JSON.stringify(pacData)); + var newRow = pacData.row - 1; + if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) { + newRow = this.nrRollUpRows - 1; + } + this.currRow = newRow; + var row = this.rows[this.currRow]; + if (pacData.indent !== null) { + var indent = pacData.indent; + var prevPos = Math.max(indent - 1, 0); + row.setCursor(pacData.indent); + pacData.color = row.chars[prevPos].penState.foreground; + } + var styles = { + foreground: pacData.color, + underline: pacData.underline, + italics: pacData.italics, + background: 'black', + flash: false + }; + this.setPen(styles); + }, + /** + * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility). + */ + setBkgData: function setBkgData(bkgData) { + logger.log("INFO", "bkgData = " + JSON.stringify(bkgData)); + this.backSpace(); + this.setPen(bkgData); + this.insertChar(0x20); //Space + }, + setRollUpRows: function setRollUpRows(nrRows) { + this.nrRollUpRows = nrRows; + }, + rollUp: function rollUp() { + if (this.nrRollUpRows === null) { + logger.log("DEBUG", "roll_up but nrRollUpRows not set yet"); + return; //Not properly setup + } + logger.log("TEXT", this.getDisplayText()); + var topRowIndex = this.currRow + 1 - this.nrRollUpRows; + var topRow = this.rows.splice(topRowIndex, 1)[0]; + topRow.clear(); + this.rows.splice(this.currRow, 0, topRow); + logger.log("INFO", "Rolling up"); //logger.log("TEXT", this.get_display_text()) + }, + /** + * Get all non-empty rows with as unicode text. + */ + getDisplayText: function getDisplayText(asOneRow) { + asOneRow = asOneRow || false; + var displayText = []; + var text = ""; + var rowNr = -1; + for (var i = 0; i < NR_ROWS; i++) { + var rowText = this.rows[i].getTextString(); + if (rowText) { + rowNr = i + 1; + if (asOneRow) { + displayText.push("Row " + rowNr + ': "' + rowText + '"'); + } else { + displayText.push(rowText.trim()); + } + } + } + if (displayText.length > 0) { + if (asOneRow) { + text = "[" + displayText.join(" | ") + "]"; + } else { + text = displayText.join("\n"); + } + } + return text; + }, + getTextAndFormat: function getTextAndFormat() { + return this.rows; + } + }; + /** + * Handle a CEA-608 channel and send decoded data to outputFilter + * @constructor + * @param {Number} channelNumber (1 or 2) + * @param {CueHandler} outputFilter Output from channel1 newCue(startTime, endTime, captionScreen) + */ + var Cea608Channel = function Cea608Channel(channelNumber, outputFilter) { + this.chNr = channelNumber; + this.outputFilter = outputFilter; + this.mode = null; + this.verbose = 0; + this.displayedMemory = new CaptionScreen(); + this.nonDisplayedMemory = new CaptionScreen(); + this.lastOutputScreen = new CaptionScreen(); + this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1]; + this.writeScreen = this.displayedMemory; + this.mode = null; + this.cueStartTime = null; // Keeps track of where a cue started. + }; + Cea608Channel.prototype = { + modes: ["MODE_ROLL-UP", "MODE_POP-ON", "MODE_PAINT-ON", "MODE_TEXT"], + reset: function reset() { + this.mode = null; + this.displayedMemory.reset(); + this.nonDisplayedMemory.reset(); + this.lastOutputScreen.reset(); + this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1]; + this.writeScreen = this.displayedMemory; + this.mode = null; + this.cueStartTime = null; + this.lastCueEndTime = null; + }, + getHandler: function getHandler() { + return this.outputFilter; + }, + setHandler: function setHandler(newHandler) { + this.outputFilter = newHandler; + }, + setPAC: function setPAC(pacData) { + this.writeScreen.setPAC(pacData); + }, + setBkgData: function setBkgData(bkgData) { + this.writeScreen.setBkgData(bkgData); + }, + setMode: function setMode(newMode) { + if (newMode === this.mode) { + return; + } + this.mode = newMode; + logger.log("INFO", "MODE=" + newMode); + if (this.mode == "MODE_POP-ON") { + this.writeScreen = this.nonDisplayedMemory; + } else { + this.writeScreen = this.displayedMemory; + this.writeScreen.reset(); + } + if (this.mode !== "MODE_ROLL-UP") { + this.displayedMemory.nrRollUpRows = null; + this.nonDisplayedMemory.nrRollUpRows = null; + } + this.mode = newMode; + }, + insertChars: function insertChars(chars) { + for (var i = 0; i < chars.length; i++) { + this.writeScreen.insertChar(chars[i]); + } + var screen = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP"; + logger.log("INFO", screen + ": " + this.writeScreen.getDisplayText(true)); + if (this.mode === "MODE_PAINT-ON" || this.mode === "MODE_ROLL-UP") { + logger.log("TEXT", "DISPLAYED: " + this.displayedMemory.getDisplayText(true)); + this.outputDataUpdate(); + } + }, + cc_RCL: function cc_RCL() { + // Resume Caption Loading (switch mode to Pop On) + logger.log("INFO", "RCL - Resume Caption Loading"); + this.setMode("MODE_POP-ON"); + }, + cc_BS: function cc_BS() { + // BackSpace + logger.log("INFO", "BS - BackSpace"); + if (this.mode === "MODE_TEXT") { + return; + } + this.writeScreen.backSpace(); + if (this.writeScreen === this.displayedMemory) { + this.outputDataUpdate(); + } + }, + cc_AOF: function cc_AOF() { + // Reserved (formerly Alarm Off) + return; + }, + cc_AON: function cc_AON() { + // Reserved (formerly Alarm On) + return; + }, + cc_DER: function cc_DER() { + // Delete to End of Row + logger.log("INFO", "DER- Delete to End of Row"); + this.writeScreen.clearToEndOfRow(); + this.outputDataUpdate(); + }, + cc_RU: function cc_RU(nrRows) { + //Roll-Up Captions-2,3,or 4 Rows + logger.log("INFO", "RU(" + nrRows + ") - Roll Up"); + this.writeScreen = this.displayedMemory; + this.setMode("MODE_ROLL-UP"); + this.writeScreen.setRollUpRows(nrRows); + }, + cc_FON: function cc_FON() { + //Flash On + logger.log("INFO", "FON - Flash On"); + this.writeScreen.setPen({ + flash: true + }); + }, + cc_RDC: function cc_RDC() { + // Resume Direct Captioning (switch mode to PaintOn) + logger.log("INFO", "RDC - Resume Direct Captioning"); + this.setMode("MODE_PAINT-ON"); + }, + cc_TR: function cc_TR() { + // Text Restart in text mode (not supported, however) + logger.log("INFO", "TR"); + this.setMode("MODE_TEXT"); + }, + cc_RTD: function cc_RTD() { + // Resume Text Display in Text mode (not supported, however) + logger.log("INFO", "RTD"); + this.setMode("MODE_TEXT"); + }, + cc_EDM: function cc_EDM() { + // Erase Displayed Memory + logger.log("INFO", "EDM - Erase Displayed Memory"); + this.displayedMemory.reset(); + this.outputDataUpdate(); + }, + cc_CR: function cc_CR() { + // Carriage Return + logger.log("CR - Carriage Return"); + this.writeScreen.rollUp(); + this.outputDataUpdate(); + }, + cc_ENM: function cc_ENM() { + //Erase Non-Displayed Memory + logger.log("INFO", "ENM - Erase Non-displayed Memory"); + this.nonDisplayedMemory.reset(); + }, + cc_EOC: function cc_EOC() { + //End of Caption (Flip Memories) + logger.log("INFO", "EOC - End Of Caption"); + if (this.mode === "MODE_POP-ON") { + var tmp = this.displayedMemory; + this.displayedMemory = this.nonDisplayedMemory; + this.nonDisplayedMemory = tmp; + this.writeScreen = this.nonDisplayedMemory; + logger.log("TEXT", "DISP: " + this.displayedMemory.getDisplayText()); + } + this.outputDataUpdate(); + }, + cc_TO: function cc_TO(nrCols) { + // Tab Offset 1,2, or 3 columns + logger.log("INFO", "TO(" + nrCols + ") - Tab Offset"); + this.writeScreen.moveCursor(nrCols); + }, + cc_MIDROW: function cc_MIDROW(secondByte) { + // Parse MIDROW command + var styles = { + flash: false + }; + styles.underline = secondByte % 2 === 1; + styles.italics = secondByte >= 0x2e; + if (!styles.italics) { + var colorIndex = Math.floor(secondByte / 2) - 0x10; + var colors = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"]; + styles.foreground = colors[colorIndex]; + } else { + styles.foreground = "white"; + } + logger.log("INFO", "MIDROW: " + JSON.stringify(styles)); + this.writeScreen.setPen(styles); + }, + outputDataUpdate: function outputDataUpdate() { + var t = logger.time; + if (t === null) { + return; + } + if (this.outputFilter) { + if (this.outputFilter.updateData) { + this.outputFilter.updateData(t, this.displayedMemory); + } + if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) { + // Start of a new cue + this.cueStartTime = t; + } else { + if (!this.displayedMemory.equals(this.lastOutputScreen)) { + if (this.outputFilter.newCue) { + this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen); + } + this.cueStartTime = this.displayedMemory.isEmpty() ? null : t; + } + } + this.lastOutputScreen.copy(this.displayedMemory); + } + }, + cueSplitAtTime: function cueSplitAtTime(t) { + if (this.outputFilter) { + if (!this.displayedMemory.isEmpty()) { + if (this.outputFilter.newCue) { + this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory); + } + this.cueStartTime = t; + } + } + } + }; + /** + * Parse CEA-608 data and send decoded data to out1 and out2. + * @constructor + * @param {Number} field CEA-608 field (1 or 2) + * @param {CueHandler} out1 Output from channel1 newCue(startTime, endTime, captionScreen) + * @param {CueHandler} out2 Output from channel2 newCue(startTime, endTime, captionScreen) + */ + var Cea608Parser = function Cea608Parser(field, out1, out2) { + this.field = field || 1; + this.outputs = [out1, out2]; + this.channels = [new Cea608Channel(1, out1), new Cea608Channel(2, out2)]; + this.currChNr = -1; // Will be 1 or 2 + this.lastCmdA = null; // First byte of last command + this.lastCmdB = null; // Second byte of last command + this.bufferedData = []; + this.startTime = null; + this.lastTime = null; + this.dataCounters = { + 'padding': 0, + 'char': 0, + 'cmd': 0, + 'other': 0 + }; + }; + Cea608Parser.prototype = { + getHandler: function getHandler(index) { + return this.channels[index].getHandler(); + }, + setHandler: function setHandler(index, newHandler) { + this.channels[index].setHandler(newHandler); + }, + /** + * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs. + */ + addData: function addData(t, byteList) { + var cmdFound, + a, + b, + charsFound = false; + this.lastTime = t; + logger.setTime(t); + for (var i = 0; i < byteList.length; i += 2) { + a = byteList[i] & 0x7f; + b = byteList[i + 1] & 0x7f; + if (a >= 0x10 && a <= 0x1f && a === this.lastCmdA && b === this.lastCmdB) { + this.lastCmdA = null; + this.lastCmdB = null; + logger.log("DEBUG", "Repeated command (" + numArrayToHexArray([a, b]) + ") is dropped"); + continue; // Repeated commands are dropped (once) + } + if (a === 0 && b === 0) { + this.dataCounters.padding += 2; + continue; + } else { + logger.log("DATA", "[" + numArrayToHexArray([byteList[i], byteList[i + 1]]) + "] -> (" + numArrayToHexArray([a, b]) + ")"); + } + cmdFound = this.parseCmd(a, b); + if (!cmdFound) { + cmdFound = this.parseMidrow(a, b); + } + if (!cmdFound) { + cmdFound = this.parsePAC(a, b); + } + if (!cmdFound) { + cmdFound = this.parseBackgroundAttributes(a, b); + } + if (!cmdFound) { + charsFound = this.parseChars(a, b); + if (charsFound) { + if (this.currChNr && this.currChNr >= 0) { + var channel = this.channels[this.currChNr - 1]; + channel.insertChars(charsFound); + } else { + logger.log("WARNING", "No channel found yet. TEXT-MODE?"); + } + } + } + if (cmdFound) { + this.dataCounters.cmd += 2; + } else if (charsFound) { + this.dataCounters["char"] += 2; + } else { + this.dataCounters.other += 2; + logger.log("WARNING", "Couldn't parse cleaned data " + numArrayToHexArray([a, b]) + " orig: " + numArrayToHexArray([byteList[i], byteList[i + 1]])); + } + } + }, + /** + * Parse Command. + * @returns {Boolean} Tells if a command was found + */ + parseCmd: function parseCmd(a, b) { + var chNr = null; + var cond1 = (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) && 0x20 <= b && b <= 0x2F; + var cond2 = (a === 0x17 || a === 0x1F) && 0x21 <= b && b <= 0x23; + if (!(cond1 || cond2)) { + return false; + } + if (a === 0x14 || a === 0x15 || a === 0x17) { + chNr = 1; + } else { + chNr = 2; // (a === 0x1C || a === 0x1D || a=== 0x1f) + } + var channel = this.channels[chNr - 1]; + if (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) { + if (b === 0x20) { + channel.cc_RCL(); + } else if (b === 0x21) { + channel.cc_BS(); + } else if (b === 0x22) { + channel.cc_AOF(); + } else if (b === 0x23) { + channel.cc_AON(); + } else if (b === 0x24) { + channel.cc_DER(); + } else if (b === 0x25) { + channel.cc_RU(2); + } else if (b === 0x26) { + channel.cc_RU(3); + } else if (b === 0x27) { + channel.cc_RU(4); + } else if (b === 0x28) { + channel.cc_FON(); + } else if (b === 0x29) { + channel.cc_RDC(); + } else if (b === 0x2A) { + channel.cc_TR(); + } else if (b === 0x2B) { + channel.cc_RTD(); + } else if (b === 0x2C) { + channel.cc_EDM(); + } else if (b === 0x2D) { + channel.cc_CR(); + } else if (b === 0x2E) { + channel.cc_ENM(); + } else if (b === 0x2F) { + channel.cc_EOC(); + } + } else { + //a == 0x17 || a == 0x1F + channel.cc_TO(b - 0x20); + } + this.lastCmdA = a; + this.lastCmdB = b; + this.currChNr = chNr; + return true; + }, + /** + * Parse midrow styling command + * @returns {Boolean} + */ + parseMidrow: function parseMidrow(a, b) { + var chNr = null; + if ((a === 0x11 || a === 0x19) && 0x20 <= b && b <= 0x2f) { + if (a === 0x11) { + chNr = 1; + } else { + chNr = 2; + } + if (chNr !== this.currChNr) { + logger.log("ERROR", "Mismatch channel in midrow parsing"); + return false; + } + var channel = this.channels[chNr - 1]; // cea608 spec says midrow codes should inject a space + channel.insertChars([0x20]); + channel.cc_MIDROW(b); + logger.log("DEBUG", "MIDROW (" + numArrayToHexArray([a, b]) + ")"); + this.lastCmdA = a; + this.lastCmdB = b; + return true; + } + return false; + }, + /** + * Parse Preable Access Codes (Table 53). + * @returns {Boolean} Tells if PAC found + */ + parsePAC: function parsePAC(a, b) { + var chNr = null; + var row = null; + var case1 = (0x11 <= a && a <= 0x17 || 0x19 <= a && a <= 0x1F) && 0x40 <= b && b <= 0x7F; + var case2 = (a === 0x10 || a === 0x18) && 0x40 <= b && b <= 0x5F; + if (!(case1 || case2)) { + return false; + } + chNr = a <= 0x17 ? 1 : 2; + if (0x40 <= b && b <= 0x5F) { + row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a]; + } else { + // 0x60 <= b <= 0x7F + row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a]; + } + var pacData = this.interpretPAC(row, b); + var channel = this.channels[chNr - 1]; + channel.setPAC(pacData); + this.lastCmdA = a; + this.lastCmdB = b; + this.currChNr = chNr; + return true; + }, + /** + * Interpret the second byte of the pac, and return the information. + * @returns {Object} pacData with style parameters. + */ + interpretPAC: function interpretPAC(row, _byte3) { + var pacIndex = _byte3; + var pacData = { + color: null, + italics: false, + indent: null, + underline: false, + row: row + }; + if (_byte3 > 0x5F) { + pacIndex = _byte3 - 0x60; + } else { + pacIndex = _byte3 - 0x40; + } + pacData.underline = (pacIndex & 1) === 1; + if (pacIndex <= 0xd) { + pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)]; + } else if (pacIndex <= 0xf) { + pacData.italics = true; + pacData.color = 'white'; + } else { + pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4; + } + return pacData; // Note that row has zero offset. The spec uses 1. + }, + /** + * Parse characters. + * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise. + */ + parseChars: function parseChars(a, b) { + var channelNr = null, + charCodes = null, + charCode1 = null, + charCode2 = null; + if (a >= 0x19) { + channelNr = 2; + charCode1 = a - 8; + } else { + channelNr = 1; + charCode1 = a; + } + if (0x11 <= charCode1 && charCode1 <= 0x13) { + // Special character + var oneCode = b; + if (charCode1 === 0x11) { + oneCode = b + 0x50; + } else if (charCode1 === 0x12) { + oneCode = b + 0x70; + } else { + oneCode = b + 0x90; + } + logger.log("INFO", "Special char '" + getCharForByte(oneCode) + "' in channel " + channelNr); + charCodes = [oneCode]; + this.lastCmdA = a; + this.lastCmdB = b; + } else if (0x20 <= a && a <= 0x7f) { + charCodes = b === 0 ? [a] : [a, b]; + this.lastCmdA = null; + this.lastCmdB = null; + } + if (charCodes) { + var hexCodes = numArrayToHexArray(charCodes); + logger.log("DEBUG", "Char codes = " + hexCodes.join(",")); + } + return charCodes; + }, + /** + * Parse extended background attributes as well as new foreground color black. + * @returns{Boolean} Tells if background attributes are found + */ + parseBackgroundAttributes: function parseBackgroundAttributes(a, b) { + var bkgData, index, chNr, channel; + var case1 = (a === 0x10 || a === 0x18) && 0x20 <= b && b <= 0x2f; + var case2 = (a === 0x17 || a === 0x1f) && 0x2d <= b && b <= 0x2f; + if (!(case1 || case2)) { + return false; + } + bkgData = {}; + if (a === 0x10 || a === 0x18) { + index = Math.floor((b - 0x20) / 2); + bkgData.background = backgroundColors[index]; + if (b % 2 === 1) { + bkgData.background = bkgData.background + "_semi"; + } + } else if (b === 0x2d) { + bkgData.background = "transparent"; + } else { + bkgData.foreground = "black"; + if (b === 0x2f) { + bkgData.underline = true; + } + } + chNr = a < 0x18 ? 1 : 2; + channel = this.channels[chNr - 1]; + channel.setBkgData(bkgData); + this.lastCmdA = a; + this.lastCmdB = b; + return true; + }, + /** + * Reset state of parser and its channels. + */ + reset: function reset() { + for (var i = 0; i < this.channels.length; i++) { + if (this.channels[i]) { + this.channels[i].reset(); + } + } + this.lastCmdA = null; + this.lastCmdB = null; + }, + /** + * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty. + */ + cueSplitAtTime: function cueSplitAtTime(t) { + for (var i = 0; i < this.channels.length; i++) { + if (this.channels[i]) { + this.channels[i].cueSplitAtTime(t); + } + } + } + }; + /** + * Find ranges corresponding to SEA CEA-608 NALUS in sizeprepended NALU array. + * @param {raw} dataView of binary data + * @param {startPos} start position in raw + * @param {size} total size of data in raw to consider + * @returns + */ + var findCea608Nalus = function findCea608Nalus(raw, startPos, size) { + var nalSize = 0, + cursor = startPos, + nalType = 0, + cea608NaluRanges = [], + // Check SEI data according to ANSI-SCTE 128 + isCEA608SEI = function isCEA608SEI(payloadType, payloadSize, raw, pos) { + if (payloadType !== 4 || payloadSize < 8) { + return null; + } + var countryCode = raw.getUint8(pos); + var providerCode = raw.getUint16(pos + 1); + var userIdentifier = raw.getUint32(pos + 3); + var userDataTypeCode = raw.getUint8(pos + 7); + return countryCode == 0xB5 && providerCode == 0x31 && userIdentifier == 0x47413934 && userDataTypeCode == 0x3; + }; + while (cursor < startPos + size) { + nalSize = raw.getUint32(cursor); + nalType = raw.getUint8(cursor + 4) & 0x1F; //console.log(time + " NAL " + nalType); + if (nalType === 6) { + // SEI NAL Unit. The NAL header is the first byte + //console.log("SEI NALU of size " + nalSize + " at time " + time); + var pos = cursor + 5; + var payloadType = -1; + while (pos < cursor + 4 + nalSize - 1) { + // The last byte should be rbsp_trailing_bits + payloadType = 0; + var b = 0xFF; + while (b === 0xFF) { + b = raw.getUint8(pos); + payloadType += b; + pos++; + } + var payloadSize = 0; + b = 0xFF; + while (b === 0xFF) { + b = raw.getUint8(pos); + payloadSize += b; + pos++; + } + if (isCEA608SEI(payloadType, payloadSize, raw, pos)) { + //console.log("CEA608 SEI " + time + " " + payloadSize); + cea608NaluRanges.push([pos, payloadSize]); + } + pos += payloadSize; + } + } + cursor += nalSize + 4; + } + return cea608NaluRanges; + }; + var extractCea608DataFromRange = function extractCea608DataFromRange(raw, cea608Range) { + var pos = cea608Range[0]; + var fieldData = [[], []]; + pos += 8; // Skip the identifier up to userDataTypeCode + var ccCount = raw.getUint8(pos) & 0x1f; + pos += 2; // Advance 1 and skip reserved byte + for (var i = 0; i < ccCount; i++) { + var _byte4 = raw.getUint8(pos); + var ccValid = _byte4 & 0x4; + var ccType = _byte4 & 0x3; + pos++; + var ccData1 = raw.getUint8(pos); // Keep parity bit + pos++; + var ccData2 = raw.getUint8(pos); // Keep parity bit + pos++; + if (ccValid && (ccData1 & 0x7f) + (ccData2 & 0x7f) !== 0) { + //Check validity and non-empty data + if (ccType === 0) { + fieldData[0].push(ccData1); + fieldData[0].push(ccData2); + } else if (ccType === 1) { + fieldData[1].push(ccData1); + fieldData[1].push(ccData2); + } + } + } + return fieldData; + }; + exports.logger = logger; + exports.PenState = PenState; + exports.CaptionScreen = CaptionScreen; + exports.Cea608Parser = Cea608Parser; + exports.findCea608Nalus = findCea608Nalus; + exports.extractCea608DataFromRange = extractCea608DataFromRange; + })(false ? undefined : exports); + /***/ +}), +/***/ "./externals/xml2json.js": +/*!*******************************!*\ + !*** ./externals/xml2json.js ***! + \*******************************/ +/*! exports provided: default */ +/***/ (function (module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + /* + Copyright 2011-2013 Abdulla Abdurakhmanov + Original sources are available at https://code.google.com/p/x2js/ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + /* + Further modified for dashjs to: + - keep track of children nodes in order in attribute __children. + - add type conversion matchers + - re-add ignoreRoot + - allow zero-length attributePrefix + - don't add white-space text nodes + - remove explicit RequireJS support + */ + function X2JS(config) { + 'use strict'; + var VERSION = "1.2.0"; + config = config || {}; + initConfigDefaults(); + initRequiredPolyfills(); + function initConfigDefaults() { + if (config.escapeMode === undefined) { + config.escapeMode = true; + } + if (config.attributePrefix === undefined) { + config.attributePrefix = "_"; + } + config.arrayAccessForm = config.arrayAccessForm || "none"; + config.emptyNodeForm = config.emptyNodeForm || "text"; + if (config.enableToStringFunc === undefined) { + config.enableToStringFunc = true; + } + config.arrayAccessFormPaths = config.arrayAccessFormPaths || []; + if (config.skipEmptyTextNodesForObj === undefined) { + config.skipEmptyTextNodesForObj = true; + } + if (config.stripWhitespaces === undefined) { + config.stripWhitespaces = true; + } + config.datetimeAccessFormPaths = config.datetimeAccessFormPaths || []; + if (config.useDoubleQuotes === undefined) { + config.useDoubleQuotes = false; + } + config.xmlElementsFilter = config.xmlElementsFilter || []; + config.jsonPropertiesFilter = config.jsonPropertiesFilter || []; + if (config.keepCData === undefined) { + config.keepCData = false; + } + if (config.ignoreRoot === undefined) { + config.ignoreRoot = false; + } + } + var DOMNodeTypes = { + ELEMENT_NODE: 1, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9 + }; + function initRequiredPolyfills() { } + function getNodeLocalName(node) { + var nodeLocalName = node.localName; + if (nodeLocalName == null) // Yeah, this is IE!! + nodeLocalName = node.baseName; + if (nodeLocalName == null || nodeLocalName == "") // =="" is IE too + nodeLocalName = node.nodeName; + return nodeLocalName; + } + function getNodePrefix(node) { + return node.prefix; + } + function escapeXmlChars(str) { + if (typeof str == "string") return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); else return str; + } + function unescapeXmlChars(str) { + return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); + } + function checkInStdFiltersArrayForm(stdFiltersArrayForm, obj, name, path) { + var idx = 0; + for (; idx < stdFiltersArrayForm.length; idx++) { + var filterPath = stdFiltersArrayForm[idx]; + if (typeof filterPath === "string") { + if (filterPath == path) break; + } else if (filterPath instanceof RegExp) { + if (filterPath.test(path)) break; + } else if (typeof filterPath === "function") { + if (filterPath(obj, name, path)) break; + } + } + return idx != stdFiltersArrayForm.length; + } + function toArrayAccessForm(obj, childName, path) { + switch (config.arrayAccessForm) { + case "property": + if (!(obj[childName] instanceof Array)) obj[childName + "_asArray"] = [obj[childName]]; else obj[childName + "_asArray"] = obj[childName]; + break; + /*case "none": + break;*/ + } + if (!(obj[childName] instanceof Array) && config.arrayAccessFormPaths.length > 0) { + if (checkInStdFiltersArrayForm(config.arrayAccessFormPaths, obj, childName, path)) { + obj[childName] = [obj[childName]]; + } + } + } + function fromXmlDateTime(prop) { + // Implementation based up on http://stackoverflow.com/questions/8178598/xml-datetime-to-javascript-date-object + // Improved to support full spec and optional parts + var bits = prop.split(/[-T:+Z]/g); + var d = new Date(bits[0], bits[1] - 1, bits[2]); + var secondBits = bits[5].split("\."); + d.setHours(bits[3], bits[4], secondBits[0]); + if (secondBits.length > 1) d.setMilliseconds(secondBits[1]); // Get supplied time zone offset in minutes + if (bits[6] && bits[7]) { + var offsetMinutes = bits[6] * 60 + Number(bits[7]); + var sign = /\d\d-\d\d:\d\d$/.test(prop) ? '-' : '+'; // Apply the sign + offsetMinutes = 0 + (sign == '-' ? -1 * offsetMinutes : offsetMinutes); // Apply offset and local timezone + d.setMinutes(d.getMinutes() - offsetMinutes - d.getTimezoneOffset()); + } else if (prop.indexOf("Z", prop.length - 1) !== -1) { + d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())); + } // d is now a local time equivalent to the supplied time + return d; + } + function checkFromXmlDateTimePaths(value, childName, fullPath) { + if (config.datetimeAccessFormPaths.length > 0) { + var path = fullPath.split("\.#")[0]; + if (checkInStdFiltersArrayForm(config.datetimeAccessFormPaths, value, childName, path)) { + return fromXmlDateTime(value); + } else return value; + } else return value; + } + function checkXmlElementsFilter(obj, childType, childName, childPath) { + if (childType == DOMNodeTypes.ELEMENT_NODE && config.xmlElementsFilter.length > 0) { + return checkInStdFiltersArrayForm(config.xmlElementsFilter, obj, childName, childPath); + } else return true; + } + function parseDOMChildren(node, path) { + if (node.nodeType == DOMNodeTypes.DOCUMENT_NODE) { + var result = new Object(); + var nodeChildren = node.childNodes; // Alternative for firstElementChild which is not supported in some environments + for (var cidx = 0; cidx < nodeChildren.length; cidx++) { + var child = nodeChildren[cidx]; + if (child.nodeType == DOMNodeTypes.ELEMENT_NODE) { + if (config.ignoreRoot) { + result = parseDOMChildren(child); + } else { + result = {}; + var childName = getNodeLocalName(child); + result[childName] = parseDOMChildren(child); + } + } + } + return result; + } else if (node.nodeType == DOMNodeTypes.ELEMENT_NODE) { + var result = new Object(); + result.__cnt = 0; + var children = []; + var nodeChildren = node.childNodes; // Children nodes + for (var cidx = 0; cidx < nodeChildren.length; cidx++) { + var child = nodeChildren[cidx]; + var childName = getNodeLocalName(child); + if (child.nodeType != DOMNodeTypes.COMMENT_NODE) { + var childPath = path + "." + childName; + if (checkXmlElementsFilter(result, child.nodeType, childName, childPath)) { + result.__cnt++; + if (result[childName] == null) { + var c = parseDOMChildren(child, childPath); + if (childName != "#text" || /[^\s]/.test(c)) { + var o = {}; + o[childName] = c; + children.push(o); + } + result[childName] = c; + toArrayAccessForm(result, childName, childPath); + } else { + if (result[childName] != null) { + if (!(result[childName] instanceof Array)) { + result[childName] = [result[childName]]; + toArrayAccessForm(result, childName, childPath); + } + } + var c = parseDOMChildren(child, childPath); + if (childName != "#text" || /[^\s]/.test(c)) { + // Don't add white-space text nodes + var o = {}; + o[childName] = c; + children.push(o); + } + result[childName][result[childName].length] = c; + } + } + } + } + result.__children = children; // Attributes + var nodeLocalName = getNodeLocalName(node); + for (var aidx = 0; aidx < node.attributes.length; aidx++) { + var attr = node.attributes[aidx]; + result.__cnt++; + var value2 = attr.value; + for (var m = 0, ml = config.matchers.length; m < ml; m++) { + var matchobj = config.matchers[m]; + if (matchobj.test(attr, nodeLocalName)) value2 = matchobj.converter(attr.value); + } + result[config.attributePrefix + attr.name] = value2; + } // Node namespace prefix + var nodePrefix = getNodePrefix(node); + if (nodePrefix != null && nodePrefix != "") { + result.__cnt++; + result.__prefix = nodePrefix; + } + if (result["#text"] != null) { + result.__text = result["#text"]; + if (result.__text instanceof Array) { + result.__text = result.__text.join("\n"); + } //if(config.escapeMode) + // result.__text = unescapeXmlChars(result.__text); + if (config.stripWhitespaces) result.__text = result.__text.trim(); + delete result["#text"]; + if (config.arrayAccessForm == "property") delete result["#text_asArray"]; + result.__text = checkFromXmlDateTimePaths(result.__text, childName, path + "." + childName); + } + if (result["#cdata-section"] != null) { + result.__cdata = result["#cdata-section"]; + delete result["#cdata-section"]; + if (config.arrayAccessForm == "property") delete result["#cdata-section_asArray"]; + } + if (result.__cnt == 0 && config.emptyNodeForm == "text") { + result = ''; + } else if (result.__cnt == 1 && result.__text != null) { + result = result.__text; + } else if (result.__cnt == 1 && result.__cdata != null && !config.keepCData) { + result = result.__cdata; + } else if (result.__cnt > 1 && result.__text != null && config.skipEmptyTextNodesForObj) { + if (config.stripWhitespaces && result.__text == "" || result.__text.trim() == "") { + delete result.__text; + } + } + delete result.__cnt; + if (config.enableToStringFunc && (result.__text != null || result.__cdata != null)) { + result.toString = function () { + return (this.__text != null ? this.__text : '') + (this.__cdata != null ? this.__cdata : ''); + }; + } + return result; + } else if (node.nodeType == DOMNodeTypes.TEXT_NODE || node.nodeType == DOMNodeTypes.CDATA_SECTION_NODE) { + return node.nodeValue; + } + } + function startTag(jsonObj, element, attrList, closed) { + var resultStr = "<" + (jsonObj != null && jsonObj.__prefix != null ? jsonObj.__prefix + ":" : "") + element; + if (attrList != null) { + for (var aidx = 0; aidx < attrList.length; aidx++) { + var attrName = attrList[aidx]; + var attrVal = jsonObj[attrName]; + if (config.escapeMode) attrVal = escapeXmlChars(attrVal); + resultStr += " " + attrName.substr(config.attributePrefix.length) + "="; + if (config.useDoubleQuotes) resultStr += '"' + attrVal + '"'; else resultStr += "'" + attrVal + "'"; + } + } + if (!closed) resultStr += ">"; else resultStr += "/>"; + return resultStr; + } + function endTag(jsonObj, elementName) { + return ""; + } + function endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; + } + function jsonXmlSpecialElem(jsonObj, jsonObjField) { + if (config.arrayAccessForm == "property" && endsWith(jsonObjField.toString(), "_asArray") || jsonObjField.toString().indexOf(config.attributePrefix) == 0 || jsonObjField.toString().indexOf("__") == 0 || jsonObj[jsonObjField] instanceof Function) return true; else return false; + } + function jsonXmlElemCount(jsonObj) { + var elementsCnt = 0; + if (jsonObj instanceof Object) { + for (var it in jsonObj) { + if (jsonXmlSpecialElem(jsonObj, it)) continue; + elementsCnt++; + } + } + return elementsCnt; + } + function checkJsonObjPropertiesFilter(jsonObj, propertyName, jsonObjPath) { + return config.jsonPropertiesFilter.length == 0 || jsonObjPath == "" || checkInStdFiltersArrayForm(config.jsonPropertiesFilter, jsonObj, propertyName, jsonObjPath); + } + function parseJSONAttributes(jsonObj) { + var attrList = []; + if (jsonObj instanceof Object) { + for (var ait in jsonObj) { + if (ait.toString().indexOf("__") == -1 && ait.toString().indexOf(config.attributePrefix) == 0) { + attrList.push(ait); + } + } + } + return attrList; + } + function parseJSONTextAttrs(jsonTxtObj) { + var result = ""; + if (jsonTxtObj.__cdata != null) { + result += ""; + } + if (jsonTxtObj.__text != null) { + if (config.escapeMode) result += escapeXmlChars(jsonTxtObj.__text); else result += jsonTxtObj.__text; + } + return result; + } + function parseJSONTextObject(jsonTxtObj) { + var result = ""; + if (jsonTxtObj instanceof Object) { + result += parseJSONTextAttrs(jsonTxtObj); + } else if (jsonTxtObj != null) { + if (config.escapeMode) result += escapeXmlChars(jsonTxtObj); else result += jsonTxtObj; + } + return result; + } + function getJsonPropertyPath(jsonObjPath, jsonPropName) { + if (jsonObjPath === "") { + return jsonPropName; + } else return jsonObjPath + "." + jsonPropName; + } + function parseJSONArray(jsonArrRoot, jsonArrObj, attrList, jsonObjPath) { + var result = ""; + if (jsonArrRoot.length == 0) { + result += startTag(jsonArrRoot, jsonArrObj, attrList, true); + } else { + for (var arIdx = 0; arIdx < jsonArrRoot.length; arIdx++) { + result += startTag(jsonArrRoot[arIdx], jsonArrObj, parseJSONAttributes(jsonArrRoot[arIdx]), false); + result += parseJSONObject(jsonArrRoot[arIdx], getJsonPropertyPath(jsonObjPath, jsonArrObj)); + result += endTag(jsonArrRoot[arIdx], jsonArrObj); + } + } + return result; + } + function parseJSONObject(jsonObj, jsonObjPath) { + var result = ""; + var elementsCnt = jsonXmlElemCount(jsonObj); + if (elementsCnt > 0) { + for (var it in jsonObj) { + if (jsonXmlSpecialElem(jsonObj, it) || jsonObjPath != "" && !checkJsonObjPropertiesFilter(jsonObj, it, getJsonPropertyPath(jsonObjPath, it))) continue; + var subObj = jsonObj[it]; + var attrList = parseJSONAttributes(subObj); + if (subObj == null || subObj == undefined) { + result += startTag(subObj, it, attrList, true); + } else if (subObj instanceof Object) { + if (subObj instanceof Array) { + result += parseJSONArray(subObj, it, attrList, jsonObjPath); + } else if (subObj instanceof Date) { + result += startTag(subObj, it, attrList, false); + result += subObj.toISOString(); + result += endTag(subObj, it); + } else { + var subObjElementsCnt = jsonXmlElemCount(subObj); + if (subObjElementsCnt > 0 || subObj.__text != null || subObj.__cdata != null) { + result += startTag(subObj, it, attrList, false); + result += parseJSONObject(subObj, getJsonPropertyPath(jsonObjPath, it)); + result += endTag(subObj, it); + } else { + result += startTag(subObj, it, attrList, true); + } + } + } else { + result += startTag(subObj, it, attrList, false); + result += parseJSONTextObject(subObj); + result += endTag(subObj, it); + } + } + } + result += parseJSONTextObject(jsonObj); + return result; + } + this.parseXmlString = function (xmlDocStr) { + var isIEParser = window.ActiveXObject || "ActiveXObject" in window; + if (xmlDocStr === undefined) { + return null; + } + var xmlDoc; + if (window.DOMParser) { + var parser = new window.DOMParser(); + var parsererrorNS = null; + try { + xmlDoc = parser.parseFromString(xmlDocStr, "text/xml"); + if (xmlDoc.getElementsByTagNameNS("*", "parsererror").length > 0) { + xmlDoc = null; + } + } catch (err) { + xmlDoc = null; + } + } else { + // IE :( + if (xmlDocStr.indexOf("") + 2); + } + xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); + xmlDoc.async = "false"; + xmlDoc.loadXML(xmlDocStr); + } + return xmlDoc; + }; + this.asArray = function (prop) { + if (prop === undefined || prop == null) return []; else if (prop instanceof Array) return prop; else return [prop]; + }; + this.toXmlDateTime = function (dt) { + if (dt instanceof Date) return dt.toISOString(); else if (typeof dt === 'number') return new Date(dt).toISOString(); else return null; + }; + this.asDateTime = function (prop) { + if (typeof prop == "string") { + return fromXmlDateTime(prop); + } else return prop; + }; + this.xml2json = function (xmlDoc) { + return parseDOMChildren(xmlDoc); + }; + this.xml_str2json = function (xmlDocStr) { + var xmlDoc = this.parseXmlString(xmlDocStr); + if (xmlDoc != null) return this.xml2json(xmlDoc); else return null; + }; + this.json2xml_str = function (jsonObj) { + return parseJSONObject(jsonObj, ""); + }; + this.json2xml = function (jsonObj) { + var xmlDocStr = this.json2xml_str(jsonObj); + return this.parseXmlString(xmlDocStr); + }; + this.getVersion = function () { + return VERSION; + }; + } +/* harmony default export */ __webpack_exports__["default"] = (X2JS); + /***/ +}), +/***/ "./index.js": +/*!******************!*\ + !*** ./index.js ***! + \******************/ +/*! exports provided: default, MediaPlayer, Protection, MetricsReporting, MediaPlayerFactory, Debug, supportsMediaSource */ +/***/ (function (module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); +/* harmony import */ var _index_mediaplayerOnly__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index_mediaplayerOnly */ "./index_mediaplayerOnly.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaPlayer", function () { return _index_mediaplayerOnly__WEBPACK_IMPORTED_MODULE_0__["MediaPlayer"]; }); +/* harmony import */ var _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/streaming/utils/Capabilities */ "./src/streaming/utils/Capabilities.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "supportsMediaSource", function () { return _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__["supportsMediaSource"]; }); +/* harmony import */ var _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/streaming/metrics/MetricsReporting */ "./src/streaming/metrics/MetricsReporting.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MetricsReporting", function () { return _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__["default"]; }); +/* harmony import */ var _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/streaming/protection/Protection */ "./src/streaming/protection/Protection.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Protection", function () { return _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__["default"]; }); +/* harmony import */ var _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./src/streaming/MediaPlayerFactory */ "./src/streaming/MediaPlayerFactory.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaPlayerFactory", function () { return _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__["default"]; }); +/* harmony import */ var _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/core/Debug */ "./src/core/Debug.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Debug", function () { return _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"]; }); + /** + * The copyright in this software is being made available under the BSD License, + * included below. This software may be subject to other third party and contributor + * rights, including patent rights, and no such rights are granted under this license. + * + * Copyright (c) 2013, Dash Industry Forum. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * * Neither the name of Dash Industry Forum nor the names of its + * contributors may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + dashjs.Protection = _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__["default"]; + dashjs.MetricsReporting = _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__["default"]; + dashjs.MediaPlayerFactory = _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__["default"]; + dashjs.Debug = _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"]; + dashjs.supportsMediaSource = _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__["supportsMediaSource"]; +/* harmony default export */ __webpack_exports__["default"] = (dashjs); + /***/ +}), +/***/ "./index_mediaplayerOnly.js": +/*!**********************************!*\ + !*** ./index_mediaplayerOnly.js ***! + \**********************************/ +/*! exports provided: default, MediaPlayer, FactoryMaker, Debug */ +/***/ (function (module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function (global) {/* harmony import */ var _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/streaming/MediaPlayer */ "./src/streaming/MediaPlayer.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaPlayer", function () { return _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__["default"]; }); +/* harmony import */ var _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/core/FactoryMaker */ "./src/core/FactoryMaker.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FactoryMaker", function () { return _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"]; }); +/* harmony import */ var _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/core/Debug */ "./src/core/Debug.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Debug", function () { return _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"]; }); +/* harmony import */ var _src_core_Version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/core/Version */ "./src/core/Version.js"); +/* harmony import */ var es6_promise_auto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! es6-promise/auto */ "./node_modules/es6-promise/auto.js"); +/* harmony import */ var es6_promise_auto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(es6_promise_auto__WEBPACK_IMPORTED_MODULE_4__); + /** + * The copyright in this software is being made available under the BSD License, + * included below. This software may be subject to other third party and contributor + * rights, including patent rights, and no such rights are granted under this license. + * + * Copyright (c) 2013, Dash Industry Forum. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * * Neither the name of Dash Industry Forum nor the names of its + * contributors may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + // Shove both of these into the global scope + var context = typeof window !== 'undefined' && window || global; + var dashjs = context.dashjs; + if (!dashjs) { + dashjs = context.dashjs = {}; + } + dashjs.MediaPlayer = _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__["default"]; + dashjs.FactoryMaker = _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"]; + dashjs.Debug = _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"]; + dashjs.Version = Object(_src_core_Version__WEBPACK_IMPORTED_MODULE_3__["getVersionString"])(); +/* harmony default export */ __webpack_exports__["default"] = (dashjs); + /* WEBPACK VAR INJECTION */ +}.call(this, __webpack_require__(/*! ./node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + /***/ +}), +/***/ "./node_modules/base64-js/index.js": +/*!*****************************************!*\ + !*** ./node_modules/base64-js/index.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + exports.byteLength = byteLength + exports.toByteArray = toByteArray + exports.fromByteArray = fromByteArray + var lookup = [] + var revLookup = [] + var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' + for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i + } + // Support decoding URL-safe base64 strings, as Node.js does. + // See: https://en.wikipedia.org/wiki/Base64#URL_applications + revLookup['-'.charCodeAt(0)] = 62 + revLookup['_'.charCodeAt(0)] = 63 + function getLens(b64) { + var len = b64.length + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + return [validLen, placeHoldersLen] + } + // base64 is 4/3 + up to two characters of the original data + function byteLength(b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen + } + function _byteLength(b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen + } + function toByteArray(b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + var curByte = 0 + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + for (var i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + return arr + } + function tripletToBase64(num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] + } + function encodeChunk(uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') + } + function fromByteArray(uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )) + } + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + return parts.join('') + } + /***/ +}), +/***/ "./node_modules/bcp-47-match/index.js": +/*!********************************************!*\ + !*** ./node_modules/bcp-47-match/index.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + // See https://tools.ietf.org/html/rfc4647#section-3.1 + // for more information on the algorithms. + exports.basicFilter = factory(basic, true) + exports.extendedFilter = factory(extended, true) + exports.lookup = factory(lookup) + // Basic Filtering (Section 3.3.1) matches a language priority list consisting + // of basic language ranges (Section 2.1) to sets of language tags. + function basic(tag, range) { + return range === '*' || tag === range || tag.indexOf(range + '-') > -1 + } + // Extended Filtering (Section 3.3.2) matches a language priority list + // consisting of extended language ranges (Section 2.2) to sets of language + // tags. + function extended(tag, range) { + // 3.3.2.1 + var left = tag.split('-') + var right = range.split('-') + var leftIndex = 0 + var rightIndex = 0 + // 3.3.2.2 + if (right[rightIndex] !== '*' && left[leftIndex] !== right[rightIndex]) { + return false + } + leftIndex++ + rightIndex++ + // 3.3.2.3 + while (rightIndex < right.length) { + // 3.3.2.3.A + if (right[rightIndex] === '*') { + rightIndex++ + continue + } + // 3.3.2.3.B + if (!left[leftIndex]) return false + // 3.3.2.3.C + if (left[leftIndex] === right[rightIndex]) { + leftIndex++ + rightIndex++ + continue + } + // 3.3.2.3.D + if (left[leftIndex].length === 1) return false + // 3.3.2.3.E + leftIndex++ + } + // 3.3.2.4 + return true + } + // Lookup (Section 3.4) matches a language priority list consisting of basic + // language ranges to sets of language tags to find the one exact language tag + // that best matches the range. + function lookup(tag, range) { + var right = range + var index + /* eslint-disable-next-line no-constant-condition */ + while (true) { + if (right === '*' || tag === right) return true + index = right.lastIndexOf('-') + if (index < 0) return false + if (right.charAt(index - 2) === '-') index -= 2 + right = right.slice(0, index) + } + } + // Factory to perform a filter or a lookup. + // This factory creates a function that accepts a list of tags and a list of + // ranges, and contains logic to exit early for lookups. + // `check` just has to deal with one tag and one range. + // This match function iterates over ranges, and for each range, + // iterates over tags. That way, earlier ranges matching any tag have + // precedence over later ranges. + function factory(check, filter) { + return match + function match(tags, ranges) { + var left = cast(tags, 'tag') + var right = cast(ranges == null ? '*' : ranges, 'range') + var matches = [] + var rightIndex = -1 + var range + var leftIndex + var next + while (++rightIndex < right.length) { + range = right[rightIndex].toLowerCase() + // Ignore wildcards in lookup mode. + if (!filter && range === '*') continue + leftIndex = -1 + next = [] + while (++leftIndex < left.length) { + if (check(left[leftIndex].toLowerCase(), range)) { + // Exit if this is a lookup and we have a match. + if (!filter) return left[leftIndex] + matches.push(left[leftIndex]) + } else { + next.push(left[leftIndex]) + } + } + left = next + } + // If this is a filter, return the list. If it’s a lookup, we didn’t find + // a match, so return `undefined`. + return filter ? matches : undefined + } + } + // Validate tags or ranges, and cast them to arrays. + function cast(values, name) { + var value = values && typeof values === 'string' ? [values] : values + if (!value || typeof value !== 'object' || !('length' in value)) { + throw new Error( + 'Invalid ' + name + ' `' + value + '`, expected non-empty string' + ) + } + return value + } + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/index.js": +/*!************************************************!*\ + !*** ./node_modules/bcp-47-normalize/index.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + module.exports = __webpack_require__(/*! ./lib */ "./node_modules/bcp-47-normalize/lib/index.js") + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/lib/defaults.json": +/*!*********************************************************!*\ + !*** ./node_modules/bcp-47-normalize/lib/defaults.json ***! + \*********************************************************/ +/*! exports provided: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, default */ +/***/ (function (module) { + module.exports = JSON.parse("[\"mni-beng-in\",\"mni-mtei-in\",\"sat-deva-in\",\"sat-olck-in\",\"shi-latn-ma\",\"shi-tfng-ma\",\"vai-latn-lr\",\"vai-vaii-lr\",\"yue-hans-cn\",\"yue-hant-hk\",\"az-arab-ir\",\"az-cyrl-az\",\"az-latn-az\",\"bm-nkoo-ml\",\"bs-cyrl-ba\",\"bs-latn-ba\",\"en-dsrt-us\",\"ff-adlm-gn\",\"ff-latn-sn\",\"ha-arab-ng\",\"hi-latn-in\",\"iu-latn-ca\",\"ks-arab-in\",\"ks-deva-in\",\"mn-mong-cn\",\"ms-arab-my\",\"pa-arab-pk\",\"pa-guru-in\",\"sd-arab-pk\",\"sd-deva-in\",\"sr-cyrl-rs\",\"sr-latn-rs\",\"su-latn-id\",\"uz-arab-af\",\"uz-cyrl-uz\",\"uz-latn-uz\",\"zh-hans-cn\",\"zh-hant-tw\",\"mni-beng\",\"sat-olck\",\"shi-tfng\",\"vai-vaii\",\"yue-hant\",\"az-latn\",\"bs-latn\",\"ff-latn\",\"jbo-001\",\"ks-arab\",\"pa-guru\",\"prg-001\",\"sd-arab\",\"sr-cyrl\",\"su-latn\",\"uz-latn\",\"zh-hans\",\"agq-cm\",\"ar-001\",\"arn-cl\",\"asa-tz\",\"ast-es\",\"bas-cm\",\"bem-zm\",\"bez-tz\",\"bgn-pk\",\"blt-vn\",\"brx-in\",\"bss-cm\",\"byn-er\",\"cad-us\",\"cch-ng\",\"ccp-bd\",\"ceb-ph\",\"cgg-ug\",\"chr-us\",\"cic-us\",\"ckb-iq\",\"dav-ke\",\"dje-ne\",\"doi-in\",\"dsb-de\",\"dua-cm\",\"dyo-sn\",\"ebu-ke\",\"eo-001\",\"ewo-cm\",\"fil-ph\",\"fur-it\",\"gaa-gh\",\"gez-et\",\"gsw-ch\",\"guz-ke\",\"haw-us\",\"hsb-de\",\"ia-001\",\"ife-tg\",\"io-001\",\"jgo-cm\",\"jmc-tz\",\"kab-dz\",\"kaj-ng\",\"kam-ke\",\"kcg-ng\",\"kde-tz\",\"kea-cv\",\"ken-cm\",\"khq-ml\",\"kkj-cm\",\"kln-ke\",\"kok-in\",\"kpe-lr\",\"ksb-tz\",\"ksf-cm\",\"ksh-de\",\"lag-tz\",\"lkt-us\",\"lrc-ir\",\"luo-ke\",\"luy-ke\",\"mai-in\",\"mas-ke\",\"mer-ke\",\"mfe-mu\",\"mgh-mz\",\"mgo-cm\",\"moh-ca\",\"mua-cm\",\"mus-us\",\"myv-ru\",\"mzn-ir\",\"naq-na\",\"nds-de\",\"nmg-cm\",\"nnh-cm\",\"nqo-gn\",\"nso-za\",\"nus-ss\",\"nyn-ug\",\"osa-us\",\"pcm-ng\",\"quc-gt\",\"rof-tz\",\"rwk-tz\",\"sah-ru\",\"saq-ke\",\"sbp-tz\",\"scn-it\",\"sdh-ir\",\"seh-mz\",\"ses-ml\",\"sid-et\",\"sma-se\",\"smj-se\",\"smn-fi\",\"sms-fi\",\"ssy-er\",\"syr-iq\",\"szl-pl\",\"teo-ug\",\"tig-er\",\"trv-tw\",\"trw-pk\",\"twq-ne\",\"tzm-ma\",\"vo-001\",\"vun-tz\",\"wae-ch\",\"wal-et\",\"wbp-au\",\"xog-ug\",\"yav-cm\",\"yi-001\",\"zgh-ma\",\"aa-et\",\"af-za\",\"ak-gh\",\"am-et\",\"an-es\",\"as-in\",\"ba-ru\",\"be-by\",\"bg-bg\",\"bm-ml\",\"bn-bd\",\"bo-cn\",\"br-fr\",\"ca-es\",\"ce-ru\",\"co-fr\",\"cs-cz\",\"cu-ru\",\"cv-ru\",\"cy-gb\",\"da-dk\",\"de-de\",\"dv-mv\",\"dz-bt\",\"ee-gh\",\"el-gr\",\"en-us\",\"es-es\",\"et-ee\",\"eu-es\",\"fa-ir\",\"fi-fi\",\"fo-fo\",\"fr-fr\",\"fy-nl\",\"ga-ie\",\"gd-gb\",\"gl-es\",\"gn-py\",\"gu-in\",\"gv-im\",\"ha-ng\",\"he-il\",\"hi-in\",\"hr-hr\",\"hu-hu\",\"hy-am\",\"id-id\",\"ig-ng\",\"ii-cn\",\"is-is\",\"it-it\",\"iu-ca\",\"ja-jp\",\"jv-id\",\"ka-ge\",\"ki-ke\",\"kk-kz\",\"kl-gl\",\"km-kh\",\"kn-in\",\"ko-kr\",\"ku-tr\",\"kw-gb\",\"ky-kg\",\"lb-lu\",\"lg-ug\",\"ln-cd\",\"lo-la\",\"lt-lt\",\"lu-cd\",\"lv-lv\",\"mg-mg\",\"mi-nz\",\"mk-mk\",\"ml-in\",\"mn-mn\",\"mr-in\",\"ms-my\",\"mt-mt\",\"my-mm\",\"nb-no\",\"nd-zw\",\"ne-np\",\"nl-nl\",\"nn-no\",\"nr-za\",\"nv-us\",\"ny-mw\",\"oc-fr\",\"om-et\",\"or-in\",\"os-ge\",\"pl-pl\",\"ps-af\",\"pt-br\",\"qu-pe\",\"rm-ch\",\"rn-bi\",\"ro-ro\",\"ru-ru\",\"rw-rw\",\"sa-in\",\"sc-it\",\"se-no\",\"sg-cf\",\"si-lk\",\"sk-sk\",\"sl-si\",\"sn-zw\",\"so-so\",\"sq-al\",\"ss-za\",\"st-za\",\"sv-se\",\"sw-tz\",\"ta-in\",\"te-in\",\"tg-tj\",\"th-th\",\"ti-et\",\"tk-tm\",\"tn-za\",\"to-to\",\"tr-tr\",\"ts-za\",\"tt-ru\",\"ug-cn\",\"uk-ua\",\"ur-pk\",\"ve-za\",\"vi-vn\",\"wa-be\",\"wo-sn\",\"xh-za\",\"yo-ng\",\"zu-za\"]"); + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/lib/fields.json": +/*!*******************************************************!*\ + !*** ./node_modules/bcp-47-normalize/lib/fields.json ***! + \*******************************************************/ +/*! exports provided: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, default */ +/***/ (function (module) { + module.exports = JSON.parse("[{\"from\":{\"field\":\"script\",\"value\":\"qaai\"},\"to\":{\"field\":\"script\",\"value\":\"zinh\"}},{\"from\":{\"field\":\"region\",\"value\":\"bu\"},\"to\":{\"field\":\"region\",\"value\":\"mm\"}},{\"from\":{\"field\":\"region\",\"value\":\"ct\"},\"to\":{\"field\":\"region\",\"value\":\"ki\"}},{\"from\":{\"field\":\"region\",\"value\":\"dd\"},\"to\":{\"field\":\"region\",\"value\":\"de\"}},{\"from\":{\"field\":\"region\",\"value\":\"dy\"},\"to\":{\"field\":\"region\",\"value\":\"bj\"}},{\"from\":{\"field\":\"region\",\"value\":\"fx\"},\"to\":{\"field\":\"region\",\"value\":\"fr\"}},{\"from\":{\"field\":\"region\",\"value\":\"hv\"},\"to\":{\"field\":\"region\",\"value\":\"bf\"}},{\"from\":{\"field\":\"region\",\"value\":\"jt\"},\"to\":{\"field\":\"region\",\"value\":\"um\"}},{\"from\":{\"field\":\"region\",\"value\":\"mi\"},\"to\":{\"field\":\"region\",\"value\":\"um\"}},{\"from\":{\"field\":\"region\",\"value\":\"nh\"},\"to\":{\"field\":\"region\",\"value\":\"vu\"}},{\"from\":{\"field\":\"region\",\"value\":\"nq\"},\"to\":{\"field\":\"region\",\"value\":\"aq\"}},{\"from\":{\"field\":\"region\",\"value\":\"pu\"},\"to\":{\"field\":\"region\",\"value\":\"um\"}},{\"from\":{\"field\":\"region\",\"value\":\"pz\"},\"to\":{\"field\":\"region\",\"value\":\"pa\"}},{\"from\":{\"field\":\"region\",\"value\":\"qu\"},\"to\":{\"field\":\"region\",\"value\":\"eu\"}},{\"from\":{\"field\":\"region\",\"value\":\"rh\"},\"to\":{\"field\":\"region\",\"value\":\"zw\"}},{\"from\":{\"field\":\"region\",\"value\":\"tp\"},\"to\":{\"field\":\"region\",\"value\":\"tl\"}},{\"from\":{\"field\":\"region\",\"value\":\"uk\"},\"to\":{\"field\":\"region\",\"value\":\"gb\"}},{\"from\":{\"field\":\"region\",\"value\":\"vd\"},\"to\":{\"field\":\"region\",\"value\":\"vn\"}},{\"from\":{\"field\":\"region\",\"value\":\"wk\"},\"to\":{\"field\":\"region\",\"value\":\"um\"}},{\"from\":{\"field\":\"region\",\"value\":\"yd\"},\"to\":{\"field\":\"region\",\"value\":\"ye\"}},{\"from\":{\"field\":\"region\",\"value\":\"zr\"},\"to\":{\"field\":\"region\",\"value\":\"cd\"}},{\"from\":{\"field\":\"region\",\"value\":\"230\"},\"to\":{\"field\":\"region\",\"value\":\"et\"}},{\"from\":{\"field\":\"region\",\"value\":\"280\"},\"to\":{\"field\":\"region\",\"value\":\"de\"}},{\"from\":{\"field\":\"region\",\"value\":\"736\"},\"to\":{\"field\":\"region\",\"value\":\"sd\"}},{\"from\":{\"field\":\"region\",\"value\":\"886\"},\"to\":{\"field\":\"region\",\"value\":\"ye\"}},{\"from\":{\"field\":\"region\",\"value\":\"958\"},\"to\":{\"field\":\"region\",\"value\":\"aa\"}},{\"from\":{\"field\":\"region\",\"value\":\"020\"},\"to\":{\"field\":\"region\",\"value\":\"ad\"}},{\"from\":{\"field\":\"region\",\"value\":\"784\"},\"to\":{\"field\":\"region\",\"value\":\"ae\"}},{\"from\":{\"field\":\"region\",\"value\":\"004\"},\"to\":{\"field\":\"region\",\"value\":\"af\"}},{\"from\":{\"field\":\"region\",\"value\":\"028\"},\"to\":{\"field\":\"region\",\"value\":\"ag\"}},{\"from\":{\"field\":\"region\",\"value\":\"660\"},\"to\":{\"field\":\"region\",\"value\":\"ai\"}},{\"from\":{\"field\":\"region\",\"value\":\"008\"},\"to\":{\"field\":\"region\",\"value\":\"al\"}},{\"from\":{\"field\":\"region\",\"value\":\"051\"},\"to\":{\"field\":\"region\",\"value\":\"am\"}},{\"from\":{\"field\":\"region\",\"value\":\"024\"},\"to\":{\"field\":\"region\",\"value\":\"ao\"}},{\"from\":{\"field\":\"region\",\"value\":\"010\"},\"to\":{\"field\":\"region\",\"value\":\"aq\"}},{\"from\":{\"field\":\"region\",\"value\":\"032\"},\"to\":{\"field\":\"region\",\"value\":\"ar\"}},{\"from\":{\"field\":\"region\",\"value\":\"016\"},\"to\":{\"field\":\"region\",\"value\":\"as\"}},{\"from\":{\"field\":\"region\",\"value\":\"040\"},\"to\":{\"field\":\"region\",\"value\":\"at\"}},{\"from\":{\"field\":\"region\",\"value\":\"036\"},\"to\":{\"field\":\"region\",\"value\":\"au\"}},{\"from\":{\"field\":\"region\",\"value\":\"533\"},\"to\":{\"field\":\"region\",\"value\":\"aw\"}},{\"from\":{\"field\":\"region\",\"value\":\"248\"},\"to\":{\"field\":\"region\",\"value\":\"ax\"}},{\"from\":{\"field\":\"region\",\"value\":\"031\"},\"to\":{\"field\":\"region\",\"value\":\"az\"}},{\"from\":{\"field\":\"region\",\"value\":\"070\"},\"to\":{\"field\":\"region\",\"value\":\"ba\"}},{\"from\":{\"field\":\"region\",\"value\":\"052\"},\"to\":{\"field\":\"region\",\"value\":\"bb\"}},{\"from\":{\"field\":\"region\",\"value\":\"050\"},\"to\":{\"field\":\"region\",\"value\":\"bd\"}},{\"from\":{\"field\":\"region\",\"value\":\"056\"},\"to\":{\"field\":\"region\",\"value\":\"be\"}},{\"from\":{\"field\":\"region\",\"value\":\"854\"},\"to\":{\"field\":\"region\",\"value\":\"bf\"}},{\"from\":{\"field\":\"region\",\"value\":\"100\"},\"to\":{\"field\":\"region\",\"value\":\"bg\"}},{\"from\":{\"field\":\"region\",\"value\":\"048\"},\"to\":{\"field\":\"region\",\"value\":\"bh\"}},{\"from\":{\"field\":\"region\",\"value\":\"108\"},\"to\":{\"field\":\"region\",\"value\":\"bi\"}},{\"from\":{\"field\":\"region\",\"value\":\"204\"},\"to\":{\"field\":\"region\",\"value\":\"bj\"}},{\"from\":{\"field\":\"region\",\"value\":\"652\"},\"to\":{\"field\":\"region\",\"value\":\"bl\"}},{\"from\":{\"field\":\"region\",\"value\":\"060\"},\"to\":{\"field\":\"region\",\"value\":\"bm\"}},{\"from\":{\"field\":\"region\",\"value\":\"096\"},\"to\":{\"field\":\"region\",\"value\":\"bn\"}},{\"from\":{\"field\":\"region\",\"value\":\"068\"},\"to\":{\"field\":\"region\",\"value\":\"bo\"}},{\"from\":{\"field\":\"region\",\"value\":\"535\"},\"to\":{\"field\":\"region\",\"value\":\"bq\"}},{\"from\":{\"field\":\"region\",\"value\":\"076\"},\"to\":{\"field\":\"region\",\"value\":\"br\"}},{\"from\":{\"field\":\"region\",\"value\":\"044\"},\"to\":{\"field\":\"region\",\"value\":\"bs\"}},{\"from\":{\"field\":\"region\",\"value\":\"064\"},\"to\":{\"field\":\"region\",\"value\":\"bt\"}},{\"from\":{\"field\":\"region\",\"value\":\"104\"},\"to\":{\"field\":\"region\",\"value\":\"mm\"}},{\"from\":{\"field\":\"region\",\"value\":\"074\"},\"to\":{\"field\":\"region\",\"value\":\"bv\"}},{\"from\":{\"field\":\"region\",\"value\":\"072\"},\"to\":{\"field\":\"region\",\"value\":\"bw\"}},{\"from\":{\"field\":\"region\",\"value\":\"112\"},\"to\":{\"field\":\"region\",\"value\":\"by\"}},{\"from\":{\"field\":\"region\",\"value\":\"084\"},\"to\":{\"field\":\"region\",\"value\":\"bz\"}},{\"from\":{\"field\":\"region\",\"value\":\"124\"},\"to\":{\"field\":\"region\",\"value\":\"ca\"}},{\"from\":{\"field\":\"region\",\"value\":\"166\"},\"to\":{\"field\":\"region\",\"value\":\"cc\"}},{\"from\":{\"field\":\"region\",\"value\":\"180\"},\"to\":{\"field\":\"region\",\"value\":\"cd\"}},{\"from\":{\"field\":\"region\",\"value\":\"140\"},\"to\":{\"field\":\"region\",\"value\":\"cf\"}},{\"from\":{\"field\":\"region\",\"value\":\"178\"},\"to\":{\"field\":\"region\",\"value\":\"cg\"}},{\"from\":{\"field\":\"region\",\"value\":\"756\"},\"to\":{\"field\":\"region\",\"value\":\"ch\"}},{\"from\":{\"field\":\"region\",\"value\":\"384\"},\"to\":{\"field\":\"region\",\"value\":\"ci\"}},{\"from\":{\"field\":\"region\",\"value\":\"184\"},\"to\":{\"field\":\"region\",\"value\":\"ck\"}},{\"from\":{\"field\":\"region\",\"value\":\"152\"},\"to\":{\"field\":\"region\",\"value\":\"cl\"}},{\"from\":{\"field\":\"region\",\"value\":\"120\"},\"to\":{\"field\":\"region\",\"value\":\"cm\"}},{\"from\":{\"field\":\"region\",\"value\":\"156\"},\"to\":{\"field\":\"region\",\"value\":\"cn\"}},{\"from\":{\"field\":\"region\",\"value\":\"170\"},\"to\":{\"field\":\"region\",\"value\":\"co\"}},{\"from\":{\"field\":\"region\",\"value\":\"188\"},\"to\":{\"field\":\"region\",\"value\":\"cr\"}},{\"from\":{\"field\":\"region\",\"value\":\"192\"},\"to\":{\"field\":\"region\",\"value\":\"cu\"}},{\"from\":{\"field\":\"region\",\"value\":\"132\"},\"to\":{\"field\":\"region\",\"value\":\"cv\"}},{\"from\":{\"field\":\"region\",\"value\":\"531\"},\"to\":{\"field\":\"region\",\"value\":\"cw\"}},{\"from\":{\"field\":\"region\",\"value\":\"162\"},\"to\":{\"field\":\"region\",\"value\":\"cx\"}},{\"from\":{\"field\":\"region\",\"value\":\"196\"},\"to\":{\"field\":\"region\",\"value\":\"cy\"}},{\"from\":{\"field\":\"region\",\"value\":\"203\"},\"to\":{\"field\":\"region\",\"value\":\"cz\"}},{\"from\":{\"field\":\"region\",\"value\":\"278\"},\"to\":{\"field\":\"region\",\"value\":\"de\"}},{\"from\":{\"field\":\"region\",\"value\":\"276\"},\"to\":{\"field\":\"region\",\"value\":\"de\"}},{\"from\":{\"field\":\"region\",\"value\":\"262\"},\"to\":{\"field\":\"region\",\"value\":\"dj\"}},{\"from\":{\"field\":\"region\",\"value\":\"208\"},\"to\":{\"field\":\"region\",\"value\":\"dk\"}},{\"from\":{\"field\":\"region\",\"value\":\"212\"},\"to\":{\"field\":\"region\",\"value\":\"dm\"}},{\"from\":{\"field\":\"region\",\"value\":\"214\"},\"to\":{\"field\":\"region\",\"value\":\"do\"}},{\"from\":{\"field\":\"region\",\"value\":\"012\"},\"to\":{\"field\":\"region\",\"value\":\"dz\"}},{\"from\":{\"field\":\"region\",\"value\":\"218\"},\"to\":{\"field\":\"region\",\"value\":\"ec\"}},{\"from\":{\"field\":\"region\",\"value\":\"233\"},\"to\":{\"field\":\"region\",\"value\":\"ee\"}},{\"from\":{\"field\":\"region\",\"value\":\"818\"},\"to\":{\"field\":\"region\",\"value\":\"eg\"}},{\"from\":{\"field\":\"region\",\"value\":\"732\"},\"to\":{\"field\":\"region\",\"value\":\"eh\"}},{\"from\":{\"field\":\"region\",\"value\":\"232\"},\"to\":{\"field\":\"region\",\"value\":\"er\"}},{\"from\":{\"field\":\"region\",\"value\":\"724\"},\"to\":{\"field\":\"region\",\"value\":\"es\"}},{\"from\":{\"field\":\"region\",\"value\":\"231\"},\"to\":{\"field\":\"region\",\"value\":\"et\"}},{\"from\":{\"field\":\"region\",\"value\":\"246\"},\"to\":{\"field\":\"region\",\"value\":\"fi\"}},{\"from\":{\"field\":\"region\",\"value\":\"242\"},\"to\":{\"field\":\"region\",\"value\":\"fj\"}},{\"from\":{\"field\":\"region\",\"value\":\"238\"},\"to\":{\"field\":\"region\",\"value\":\"fk\"}},{\"from\":{\"field\":\"region\",\"value\":\"583\"},\"to\":{\"field\":\"region\",\"value\":\"fm\"}},{\"from\":{\"field\":\"region\",\"value\":\"234\"},\"to\":{\"field\":\"region\",\"value\":\"fo\"}},{\"from\":{\"field\":\"region\",\"value\":\"250\"},\"to\":{\"field\":\"region\",\"value\":\"fr\"}},{\"from\":{\"field\":\"region\",\"value\":\"249\"},\"to\":{\"field\":\"region\",\"value\":\"fr\"}},{\"from\":{\"field\":\"region\",\"value\":\"266\"},\"to\":{\"field\":\"region\",\"value\":\"ga\"}},{\"from\":{\"field\":\"region\",\"value\":\"826\"},\"to\":{\"field\":\"region\",\"value\":\"gb\"}},{\"from\":{\"field\":\"region\",\"value\":\"308\"},\"to\":{\"field\":\"region\",\"value\":\"gd\"}},{\"from\":{\"field\":\"region\",\"value\":\"268\"},\"to\":{\"field\":\"region\",\"value\":\"ge\"}},{\"from\":{\"field\":\"region\",\"value\":\"254\"},\"to\":{\"field\":\"region\",\"value\":\"gf\"}},{\"from\":{\"field\":\"region\",\"value\":\"831\"},\"to\":{\"field\":\"region\",\"value\":\"gg\"}},{\"from\":{\"field\":\"region\",\"value\":\"288\"},\"to\":{\"field\":\"region\",\"value\":\"gh\"}},{\"from\":{\"field\":\"region\",\"value\":\"292\"},\"to\":{\"field\":\"region\",\"value\":\"gi\"}},{\"from\":{\"field\":\"region\",\"value\":\"304\"},\"to\":{\"field\":\"region\",\"value\":\"gl\"}},{\"from\":{\"field\":\"region\",\"value\":\"270\"},\"to\":{\"field\":\"region\",\"value\":\"gm\"}},{\"from\":{\"field\":\"region\",\"value\":\"324\"},\"to\":{\"field\":\"region\",\"value\":\"gn\"}},{\"from\":{\"field\":\"region\",\"value\":\"312\"},\"to\":{\"field\":\"region\",\"value\":\"gp\"}},{\"from\":{\"field\":\"region\",\"value\":\"226\"},\"to\":{\"field\":\"region\",\"value\":\"gq\"}},{\"from\":{\"field\":\"region\",\"value\":\"300\"},\"to\":{\"field\":\"region\",\"value\":\"gr\"}},{\"from\":{\"field\":\"region\",\"value\":\"239\"},\"to\":{\"field\":\"region\",\"value\":\"gs\"}},{\"from\":{\"field\":\"region\",\"value\":\"320\"},\"to\":{\"field\":\"region\",\"value\":\"gt\"}},{\"from\":{\"field\":\"region\",\"value\":\"316\"},\"to\":{\"field\":\"region\",\"value\":\"gu\"}},{\"from\":{\"field\":\"region\",\"value\":\"624\"},\"to\":{\"field\":\"region\",\"value\":\"gw\"}},{\"from\":{\"field\":\"region\",\"value\":\"328\"},\"to\":{\"field\":\"region\",\"value\":\"gy\"}},{\"from\":{\"field\":\"region\",\"value\":\"344\"},\"to\":{\"field\":\"region\",\"value\":\"hk\"}},{\"from\":{\"field\":\"region\",\"value\":\"334\"},\"to\":{\"field\":\"region\",\"value\":\"hm\"}},{\"from\":{\"field\":\"region\",\"value\":\"340\"},\"to\":{\"field\":\"region\",\"value\":\"hn\"}},{\"from\":{\"field\":\"region\",\"value\":\"191\"},\"to\":{\"field\":\"region\",\"value\":\"hr\"}},{\"from\":{\"field\":\"region\",\"value\":\"332\"},\"to\":{\"field\":\"region\",\"value\":\"ht\"}},{\"from\":{\"field\":\"region\",\"value\":\"348\"},\"to\":{\"field\":\"region\",\"value\":\"hu\"}},{\"from\":{\"field\":\"region\",\"value\":\"360\"},\"to\":{\"field\":\"region\",\"value\":\"id\"}},{\"from\":{\"field\":\"region\",\"value\":\"372\"},\"to\":{\"field\":\"region\",\"value\":\"ie\"}},{\"from\":{\"field\":\"region\",\"value\":\"376\"},\"to\":{\"field\":\"region\",\"value\":\"il\"}},{\"from\":{\"field\":\"region\",\"value\":\"833\"},\"to\":{\"field\":\"region\",\"value\":\"im\"}},{\"from\":{\"field\":\"region\",\"value\":\"356\"},\"to\":{\"field\":\"region\",\"value\":\"in\"}},{\"from\":{\"field\":\"region\",\"value\":\"086\"},\"to\":{\"field\":\"region\",\"value\":\"io\"}},{\"from\":{\"field\":\"region\",\"value\":\"368\"},\"to\":{\"field\":\"region\",\"value\":\"iq\"}},{\"from\":{\"field\":\"region\",\"value\":\"364\"},\"to\":{\"field\":\"region\",\"value\":\"ir\"}},{\"from\":{\"field\":\"region\",\"value\":\"352\"},\"to\":{\"field\":\"region\",\"value\":\"is\"}},{\"from\":{\"field\":\"region\",\"value\":\"380\"},\"to\":{\"field\":\"region\",\"value\":\"it\"}},{\"from\":{\"field\":\"region\",\"value\":\"832\"},\"to\":{\"field\":\"region\",\"value\":\"je\"}},{\"from\":{\"field\":\"region\",\"value\":\"388\"},\"to\":{\"field\":\"region\",\"value\":\"jm\"}},{\"from\":{\"field\":\"region\",\"value\":\"400\"},\"to\":{\"field\":\"region\",\"value\":\"jo\"}},{\"from\":{\"field\":\"region\",\"value\":\"392\"},\"to\":{\"field\":\"region\",\"value\":\"jp\"}},{\"from\":{\"field\":\"region\",\"value\":\"404\"},\"to\":{\"field\":\"region\",\"value\":\"ke\"}},{\"from\":{\"field\":\"region\",\"value\":\"417\"},\"to\":{\"field\":\"region\",\"value\":\"kg\"}},{\"from\":{\"field\":\"region\",\"value\":\"116\"},\"to\":{\"field\":\"region\",\"value\":\"kh\"}},{\"from\":{\"field\":\"region\",\"value\":\"296\"},\"to\":{\"field\":\"region\",\"value\":\"ki\"}},{\"from\":{\"field\":\"region\",\"value\":\"174\"},\"to\":{\"field\":\"region\",\"value\":\"km\"}},{\"from\":{\"field\":\"region\",\"value\":\"659\"},\"to\":{\"field\":\"region\",\"value\":\"kn\"}},{\"from\":{\"field\":\"region\",\"value\":\"408\"},\"to\":{\"field\":\"region\",\"value\":\"kp\"}},{\"from\":{\"field\":\"region\",\"value\":\"410\"},\"to\":{\"field\":\"region\",\"value\":\"kr\"}},{\"from\":{\"field\":\"region\",\"value\":\"414\"},\"to\":{\"field\":\"region\",\"value\":\"kw\"}},{\"from\":{\"field\":\"region\",\"value\":\"136\"},\"to\":{\"field\":\"region\",\"value\":\"ky\"}},{\"from\":{\"field\":\"region\",\"value\":\"398\"},\"to\":{\"field\":\"region\",\"value\":\"kz\"}},{\"from\":{\"field\":\"region\",\"value\":\"418\"},\"to\":{\"field\":\"region\",\"value\":\"la\"}},{\"from\":{\"field\":\"region\",\"value\":\"422\"},\"to\":{\"field\":\"region\",\"value\":\"lb\"}},{\"from\":{\"field\":\"region\",\"value\":\"662\"},\"to\":{\"field\":\"region\",\"value\":\"lc\"}},{\"from\":{\"field\":\"region\",\"value\":\"438\"},\"to\":{\"field\":\"region\",\"value\":\"li\"}},{\"from\":{\"field\":\"region\",\"value\":\"144\"},\"to\":{\"field\":\"region\",\"value\":\"lk\"}},{\"from\":{\"field\":\"region\",\"value\":\"430\"},\"to\":{\"field\":\"region\",\"value\":\"lr\"}},{\"from\":{\"field\":\"region\",\"value\":\"426\"},\"to\":{\"field\":\"region\",\"value\":\"ls\"}},{\"from\":{\"field\":\"region\",\"value\":\"440\"},\"to\":{\"field\":\"region\",\"value\":\"lt\"}},{\"from\":{\"field\":\"region\",\"value\":\"442\"},\"to\":{\"field\":\"region\",\"value\":\"lu\"}},{\"from\":{\"field\":\"region\",\"value\":\"428\"},\"to\":{\"field\":\"region\",\"value\":\"lv\"}},{\"from\":{\"field\":\"region\",\"value\":\"434\"},\"to\":{\"field\":\"region\",\"value\":\"ly\"}},{\"from\":{\"field\":\"region\",\"value\":\"504\"},\"to\":{\"field\":\"region\",\"value\":\"ma\"}},{\"from\":{\"field\":\"region\",\"value\":\"492\"},\"to\":{\"field\":\"region\",\"value\":\"mc\"}},{\"from\":{\"field\":\"region\",\"value\":\"498\"},\"to\":{\"field\":\"region\",\"value\":\"md\"}},{\"from\":{\"field\":\"region\",\"value\":\"499\"},\"to\":{\"field\":\"region\",\"value\":\"me\"}},{\"from\":{\"field\":\"region\",\"value\":\"663\"},\"to\":{\"field\":\"region\",\"value\":\"mf\"}},{\"from\":{\"field\":\"region\",\"value\":\"450\"},\"to\":{\"field\":\"region\",\"value\":\"mg\"}},{\"from\":{\"field\":\"region\",\"value\":\"584\"},\"to\":{\"field\":\"region\",\"value\":\"mh\"}},{\"from\":{\"field\":\"region\",\"value\":\"807\"},\"to\":{\"field\":\"region\",\"value\":\"mk\"}},{\"from\":{\"field\":\"region\",\"value\":\"466\"},\"to\":{\"field\":\"region\",\"value\":\"ml\"}},{\"from\":{\"field\":\"region\",\"value\":\"496\"},\"to\":{\"field\":\"region\",\"value\":\"mn\"}},{\"from\":{\"field\":\"region\",\"value\":\"446\"},\"to\":{\"field\":\"region\",\"value\":\"mo\"}},{\"from\":{\"field\":\"region\",\"value\":\"580\"},\"to\":{\"field\":\"region\",\"value\":\"mp\"}},{\"from\":{\"field\":\"region\",\"value\":\"474\"},\"to\":{\"field\":\"region\",\"value\":\"mq\"}},{\"from\":{\"field\":\"region\",\"value\":\"478\"},\"to\":{\"field\":\"region\",\"value\":\"mr\"}},{\"from\":{\"field\":\"region\",\"value\":\"500\"},\"to\":{\"field\":\"region\",\"value\":\"ms\"}},{\"from\":{\"field\":\"region\",\"value\":\"470\"},\"to\":{\"field\":\"region\",\"value\":\"mt\"}},{\"from\":{\"field\":\"region\",\"value\":\"480\"},\"to\":{\"field\":\"region\",\"value\":\"mu\"}},{\"from\":{\"field\":\"region\",\"value\":\"462\"},\"to\":{\"field\":\"region\",\"value\":\"mv\"}},{\"from\":{\"field\":\"region\",\"value\":\"454\"},\"to\":{\"field\":\"region\",\"value\":\"mw\"}},{\"from\":{\"field\":\"region\",\"value\":\"484\"},\"to\":{\"field\":\"region\",\"value\":\"mx\"}},{\"from\":{\"field\":\"region\",\"value\":\"458\"},\"to\":{\"field\":\"region\",\"value\":\"my\"}},{\"from\":{\"field\":\"region\",\"value\":\"508\"},\"to\":{\"field\":\"region\",\"value\":\"mz\"}},{\"from\":{\"field\":\"region\",\"value\":\"516\"},\"to\":{\"field\":\"region\",\"value\":\"na\"}},{\"from\":{\"field\":\"region\",\"value\":\"540\"},\"to\":{\"field\":\"region\",\"value\":\"nc\"}},{\"from\":{\"field\":\"region\",\"value\":\"562\"},\"to\":{\"field\":\"region\",\"value\":\"ne\"}},{\"from\":{\"field\":\"region\",\"value\":\"574\"},\"to\":{\"field\":\"region\",\"value\":\"nf\"}},{\"from\":{\"field\":\"region\",\"value\":\"566\"},\"to\":{\"field\":\"region\",\"value\":\"ng\"}},{\"from\":{\"field\":\"region\",\"value\":\"558\"},\"to\":{\"field\":\"region\",\"value\":\"ni\"}},{\"from\":{\"field\":\"region\",\"value\":\"528\"},\"to\":{\"field\":\"region\",\"value\":\"nl\"}},{\"from\":{\"field\":\"region\",\"value\":\"578\"},\"to\":{\"field\":\"region\",\"value\":\"no\"}},{\"from\":{\"field\":\"region\",\"value\":\"524\"},\"to\":{\"field\":\"region\",\"value\":\"np\"}},{\"from\":{\"field\":\"region\",\"value\":\"520\"},\"to\":{\"field\":\"region\",\"value\":\"nr\"}},{\"from\":{\"field\":\"region\",\"value\":\"570\"},\"to\":{\"field\":\"region\",\"value\":\"nu\"}},{\"from\":{\"field\":\"region\",\"value\":\"554\"},\"to\":{\"field\":\"region\",\"value\":\"nz\"}},{\"from\":{\"field\":\"region\",\"value\":\"512\"},\"to\":{\"field\":\"region\",\"value\":\"om\"}},{\"from\":{\"field\":\"region\",\"value\":\"591\"},\"to\":{\"field\":\"region\",\"value\":\"pa\"}},{\"from\":{\"field\":\"region\",\"value\":\"604\"},\"to\":{\"field\":\"region\",\"value\":\"pe\"}},{\"from\":{\"field\":\"region\",\"value\":\"258\"},\"to\":{\"field\":\"region\",\"value\":\"pf\"}},{\"from\":{\"field\":\"region\",\"value\":\"598\"},\"to\":{\"field\":\"region\",\"value\":\"pg\"}},{\"from\":{\"field\":\"region\",\"value\":\"608\"},\"to\":{\"field\":\"region\",\"value\":\"ph\"}},{\"from\":{\"field\":\"region\",\"value\":\"586\"},\"to\":{\"field\":\"region\",\"value\":\"pk\"}},{\"from\":{\"field\":\"region\",\"value\":\"616\"},\"to\":{\"field\":\"region\",\"value\":\"pl\"}},{\"from\":{\"field\":\"region\",\"value\":\"666\"},\"to\":{\"field\":\"region\",\"value\":\"pm\"}},{\"from\":{\"field\":\"region\",\"value\":\"612\"},\"to\":{\"field\":\"region\",\"value\":\"pn\"}},{\"from\":{\"field\":\"region\",\"value\":\"630\"},\"to\":{\"field\":\"region\",\"value\":\"pr\"}},{\"from\":{\"field\":\"region\",\"value\":\"275\"},\"to\":{\"field\":\"region\",\"value\":\"ps\"}},{\"from\":{\"field\":\"region\",\"value\":\"620\"},\"to\":{\"field\":\"region\",\"value\":\"pt\"}},{\"from\":{\"field\":\"region\",\"value\":\"585\"},\"to\":{\"field\":\"region\",\"value\":\"pw\"}},{\"from\":{\"field\":\"region\",\"value\":\"600\"},\"to\":{\"field\":\"region\",\"value\":\"py\"}},{\"from\":{\"field\":\"region\",\"value\":\"634\"},\"to\":{\"field\":\"region\",\"value\":\"qa\"}},{\"from\":{\"field\":\"region\",\"value\":\"959\"},\"to\":{\"field\":\"region\",\"value\":\"qm\"}},{\"from\":{\"field\":\"region\",\"value\":\"960\"},\"to\":{\"field\":\"region\",\"value\":\"qn\"}},{\"from\":{\"field\":\"region\",\"value\":\"962\"},\"to\":{\"field\":\"region\",\"value\":\"qp\"}},{\"from\":{\"field\":\"region\",\"value\":\"963\"},\"to\":{\"field\":\"region\",\"value\":\"qq\"}},{\"from\":{\"field\":\"region\",\"value\":\"964\"},\"to\":{\"field\":\"region\",\"value\":\"qr\"}},{\"from\":{\"field\":\"region\",\"value\":\"965\"},\"to\":{\"field\":\"region\",\"value\":\"qs\"}},{\"from\":{\"field\":\"region\",\"value\":\"966\"},\"to\":{\"field\":\"region\",\"value\":\"qt\"}},{\"from\":{\"field\":\"region\",\"value\":\"967\"},\"to\":{\"field\":\"region\",\"value\":\"eu\"}},{\"from\":{\"field\":\"region\",\"value\":\"968\"},\"to\":{\"field\":\"region\",\"value\":\"qv\"}},{\"from\":{\"field\":\"region\",\"value\":\"969\"},\"to\":{\"field\":\"region\",\"value\":\"qw\"}},{\"from\":{\"field\":\"region\",\"value\":\"970\"},\"to\":{\"field\":\"region\",\"value\":\"qx\"}},{\"from\":{\"field\":\"region\",\"value\":\"971\"},\"to\":{\"field\":\"region\",\"value\":\"qy\"}},{\"from\":{\"field\":\"region\",\"value\":\"972\"},\"to\":{\"field\":\"region\",\"value\":\"qz\"}},{\"from\":{\"field\":\"region\",\"value\":\"638\"},\"to\":{\"field\":\"region\",\"value\":\"re\"}},{\"from\":{\"field\":\"region\",\"value\":\"642\"},\"to\":{\"field\":\"region\",\"value\":\"ro\"}},{\"from\":{\"field\":\"region\",\"value\":\"688\"},\"to\":{\"field\":\"region\",\"value\":\"rs\"}},{\"from\":{\"field\":\"region\",\"value\":\"643\"},\"to\":{\"field\":\"region\",\"value\":\"ru\"}},{\"from\":{\"field\":\"region\",\"value\":\"646\"},\"to\":{\"field\":\"region\",\"value\":\"rw\"}},{\"from\":{\"field\":\"region\",\"value\":\"682\"},\"to\":{\"field\":\"region\",\"value\":\"sa\"}},{\"from\":{\"field\":\"region\",\"value\":\"090\"},\"to\":{\"field\":\"region\",\"value\":\"sb\"}},{\"from\":{\"field\":\"region\",\"value\":\"690\"},\"to\":{\"field\":\"region\",\"value\":\"sc\"}},{\"from\":{\"field\":\"region\",\"value\":\"729\"},\"to\":{\"field\":\"region\",\"value\":\"sd\"}},{\"from\":{\"field\":\"region\",\"value\":\"752\"},\"to\":{\"field\":\"region\",\"value\":\"se\"}},{\"from\":{\"field\":\"region\",\"value\":\"702\"},\"to\":{\"field\":\"region\",\"value\":\"sg\"}},{\"from\":{\"field\":\"region\",\"value\":\"654\"},\"to\":{\"field\":\"region\",\"value\":\"sh\"}},{\"from\":{\"field\":\"region\",\"value\":\"705\"},\"to\":{\"field\":\"region\",\"value\":\"si\"}},{\"from\":{\"field\":\"region\",\"value\":\"744\"},\"to\":{\"field\":\"region\",\"value\":\"sj\"}},{\"from\":{\"field\":\"region\",\"value\":\"703\"},\"to\":{\"field\":\"region\",\"value\":\"sk\"}},{\"from\":{\"field\":\"region\",\"value\":\"694\"},\"to\":{\"field\":\"region\",\"value\":\"sl\"}},{\"from\":{\"field\":\"region\",\"value\":\"674\"},\"to\":{\"field\":\"region\",\"value\":\"sm\"}},{\"from\":{\"field\":\"region\",\"value\":\"686\"},\"to\":{\"field\":\"region\",\"value\":\"sn\"}},{\"from\":{\"field\":\"region\",\"value\":\"706\"},\"to\":{\"field\":\"region\",\"value\":\"so\"}},{\"from\":{\"field\":\"region\",\"value\":\"740\"},\"to\":{\"field\":\"region\",\"value\":\"sr\"}},{\"from\":{\"field\":\"region\",\"value\":\"728\"},\"to\":{\"field\":\"region\",\"value\":\"ss\"}},{\"from\":{\"field\":\"region\",\"value\":\"678\"},\"to\":{\"field\":\"region\",\"value\":\"st\"}},{\"from\":{\"field\":\"region\",\"value\":\"222\"},\"to\":{\"field\":\"region\",\"value\":\"sv\"}},{\"from\":{\"field\":\"region\",\"value\":\"534\"},\"to\":{\"field\":\"region\",\"value\":\"sx\"}},{\"from\":{\"field\":\"region\",\"value\":\"760\"},\"to\":{\"field\":\"region\",\"value\":\"sy\"}},{\"from\":{\"field\":\"region\",\"value\":\"748\"},\"to\":{\"field\":\"region\",\"value\":\"sz\"}},{\"from\":{\"field\":\"region\",\"value\":\"796\"},\"to\":{\"field\":\"region\",\"value\":\"tc\"}},{\"from\":{\"field\":\"region\",\"value\":\"148\"},\"to\":{\"field\":\"region\",\"value\":\"td\"}},{\"from\":{\"field\":\"region\",\"value\":\"260\"},\"to\":{\"field\":\"region\",\"value\":\"tf\"}},{\"from\":{\"field\":\"region\",\"value\":\"768\"},\"to\":{\"field\":\"region\",\"value\":\"tg\"}},{\"from\":{\"field\":\"region\",\"value\":\"764\"},\"to\":{\"field\":\"region\",\"value\":\"th\"}},{\"from\":{\"field\":\"region\",\"value\":\"762\"},\"to\":{\"field\":\"region\",\"value\":\"tj\"}},{\"from\":{\"field\":\"region\",\"value\":\"772\"},\"to\":{\"field\":\"region\",\"value\":\"tk\"}},{\"from\":{\"field\":\"region\",\"value\":\"626\"},\"to\":{\"field\":\"region\",\"value\":\"tl\"}},{\"from\":{\"field\":\"region\",\"value\":\"795\"},\"to\":{\"field\":\"region\",\"value\":\"tm\"}},{\"from\":{\"field\":\"region\",\"value\":\"788\"},\"to\":{\"field\":\"region\",\"value\":\"tn\"}},{\"from\":{\"field\":\"region\",\"value\":\"776\"},\"to\":{\"field\":\"region\",\"value\":\"to\"}},{\"from\":{\"field\":\"region\",\"value\":\"792\"},\"to\":{\"field\":\"region\",\"value\":\"tr\"}},{\"from\":{\"field\":\"region\",\"value\":\"780\"},\"to\":{\"field\":\"region\",\"value\":\"tt\"}},{\"from\":{\"field\":\"region\",\"value\":\"798\"},\"to\":{\"field\":\"region\",\"value\":\"tv\"}},{\"from\":{\"field\":\"region\",\"value\":\"158\"},\"to\":{\"field\":\"region\",\"value\":\"tw\"}},{\"from\":{\"field\":\"region\",\"value\":\"834\"},\"to\":{\"field\":\"region\",\"value\":\"tz\"}},{\"from\":{\"field\":\"region\",\"value\":\"804\"},\"to\":{\"field\":\"region\",\"value\":\"ua\"}},{\"from\":{\"field\":\"region\",\"value\":\"800\"},\"to\":{\"field\":\"region\",\"value\":\"ug\"}},{\"from\":{\"field\":\"region\",\"value\":\"581\"},\"to\":{\"field\":\"region\",\"value\":\"um\"}},{\"from\":{\"field\":\"region\",\"value\":\"840\"},\"to\":{\"field\":\"region\",\"value\":\"us\"}},{\"from\":{\"field\":\"region\",\"value\":\"858\"},\"to\":{\"field\":\"region\",\"value\":\"uy\"}},{\"from\":{\"field\":\"region\",\"value\":\"860\"},\"to\":{\"field\":\"region\",\"value\":\"uz\"}},{\"from\":{\"field\":\"region\",\"value\":\"336\"},\"to\":{\"field\":\"region\",\"value\":\"va\"}},{\"from\":{\"field\":\"region\",\"value\":\"670\"},\"to\":{\"field\":\"region\",\"value\":\"vc\"}},{\"from\":{\"field\":\"region\",\"value\":\"862\"},\"to\":{\"field\":\"region\",\"value\":\"ve\"}},{\"from\":{\"field\":\"region\",\"value\":\"092\"},\"to\":{\"field\":\"region\",\"value\":\"vg\"}},{\"from\":{\"field\":\"region\",\"value\":\"850\"},\"to\":{\"field\":\"region\",\"value\":\"vi\"}},{\"from\":{\"field\":\"region\",\"value\":\"704\"},\"to\":{\"field\":\"region\",\"value\":\"vn\"}},{\"from\":{\"field\":\"region\",\"value\":\"548\"},\"to\":{\"field\":\"region\",\"value\":\"vu\"}},{\"from\":{\"field\":\"region\",\"value\":\"876\"},\"to\":{\"field\":\"region\",\"value\":\"wf\"}},{\"from\":{\"field\":\"region\",\"value\":\"882\"},\"to\":{\"field\":\"region\",\"value\":\"ws\"}},{\"from\":{\"field\":\"region\",\"value\":\"973\"},\"to\":{\"field\":\"region\",\"value\":\"xa\"}},{\"from\":{\"field\":\"region\",\"value\":\"974\"},\"to\":{\"field\":\"region\",\"value\":\"xb\"}},{\"from\":{\"field\":\"region\",\"value\":\"975\"},\"to\":{\"field\":\"region\",\"value\":\"xc\"}},{\"from\":{\"field\":\"region\",\"value\":\"976\"},\"to\":{\"field\":\"region\",\"value\":\"xd\"}},{\"from\":{\"field\":\"region\",\"value\":\"977\"},\"to\":{\"field\":\"region\",\"value\":\"xe\"}},{\"from\":{\"field\":\"region\",\"value\":\"978\"},\"to\":{\"field\":\"region\",\"value\":\"xf\"}},{\"from\":{\"field\":\"region\",\"value\":\"979\"},\"to\":{\"field\":\"region\",\"value\":\"xg\"}},{\"from\":{\"field\":\"region\",\"value\":\"980\"},\"to\":{\"field\":\"region\",\"value\":\"xh\"}},{\"from\":{\"field\":\"region\",\"value\":\"981\"},\"to\":{\"field\":\"region\",\"value\":\"xi\"}},{\"from\":{\"field\":\"region\",\"value\":\"982\"},\"to\":{\"field\":\"region\",\"value\":\"xj\"}},{\"from\":{\"field\":\"region\",\"value\":\"983\"},\"to\":{\"field\":\"region\",\"value\":\"xk\"}},{\"from\":{\"field\":\"region\",\"value\":\"984\"},\"to\":{\"field\":\"region\",\"value\":\"xl\"}},{\"from\":{\"field\":\"region\",\"value\":\"985\"},\"to\":{\"field\":\"region\",\"value\":\"xm\"}},{\"from\":{\"field\":\"region\",\"value\":\"986\"},\"to\":{\"field\":\"region\",\"value\":\"xn\"}},{\"from\":{\"field\":\"region\",\"value\":\"987\"},\"to\":{\"field\":\"region\",\"value\":\"xo\"}},{\"from\":{\"field\":\"region\",\"value\":\"988\"},\"to\":{\"field\":\"region\",\"value\":\"xp\"}},{\"from\":{\"field\":\"region\",\"value\":\"989\"},\"to\":{\"field\":\"region\",\"value\":\"xq\"}},{\"from\":{\"field\":\"region\",\"value\":\"990\"},\"to\":{\"field\":\"region\",\"value\":\"xr\"}},{\"from\":{\"field\":\"region\",\"value\":\"991\"},\"to\":{\"field\":\"region\",\"value\":\"xs\"}},{\"from\":{\"field\":\"region\",\"value\":\"992\"},\"to\":{\"field\":\"region\",\"value\":\"xt\"}},{\"from\":{\"field\":\"region\",\"value\":\"993\"},\"to\":{\"field\":\"region\",\"value\":\"xu\"}},{\"from\":{\"field\":\"region\",\"value\":\"994\"},\"to\":{\"field\":\"region\",\"value\":\"xv\"}},{\"from\":{\"field\":\"region\",\"value\":\"995\"},\"to\":{\"field\":\"region\",\"value\":\"xw\"}},{\"from\":{\"field\":\"region\",\"value\":\"996\"},\"to\":{\"field\":\"region\",\"value\":\"xx\"}},{\"from\":{\"field\":\"region\",\"value\":\"997\"},\"to\":{\"field\":\"region\",\"value\":\"xy\"}},{\"from\":{\"field\":\"region\",\"value\":\"998\"},\"to\":{\"field\":\"region\",\"value\":\"xz\"}},{\"from\":{\"field\":\"region\",\"value\":\"720\"},\"to\":{\"field\":\"region\",\"value\":\"ye\"}},{\"from\":{\"field\":\"region\",\"value\":\"887\"},\"to\":{\"field\":\"region\",\"value\":\"ye\"}},{\"from\":{\"field\":\"region\",\"value\":\"175\"},\"to\":{\"field\":\"region\",\"value\":\"yt\"}},{\"from\":{\"field\":\"region\",\"value\":\"710\"},\"to\":{\"field\":\"region\",\"value\":\"za\"}},{\"from\":{\"field\":\"region\",\"value\":\"894\"},\"to\":{\"field\":\"region\",\"value\":\"zm\"}},{\"from\":{\"field\":\"region\",\"value\":\"716\"},\"to\":{\"field\":\"region\",\"value\":\"zw\"}},{\"from\":{\"field\":\"region\",\"value\":\"999\"},\"to\":{\"field\":\"region\",\"value\":\"zz\"}},{\"from\":{\"field\":\"variants\",\"value\":\"aaland\"},\"to\":{\"field\":\"region\",\"value\":\"ax\"}},{\"from\":{\"field\":\"variants\",\"value\":\"polytoni\"},\"to\":{\"field\":\"variants\",\"value\":\"polyton\"}},{\"from\":{\"field\":\"variants\",\"value\":\"heploc\"},\"to\":{\"field\":\"variants\",\"value\":\"alalc97\"}},{\"from\":{\"field\":\"variants\",\"value\":\"arevela\"},\"to\":{\"field\":\"language\",\"value\":\"hy\"}},{\"from\":{\"field\":\"variants\",\"value\":\"arevmda\"},\"to\":{\"field\":\"language\",\"value\":\"hyw\"}}]"); + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/lib/index.js": +/*!****************************************************!*\ + !*** ./node_modules/bcp-47-normalize/lib/index.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + var bcp47 = __webpack_require__(/*! bcp-47 */ "./node_modules/bcp-47/index.js") + var match = __webpack_require__(/*! bcp-47-match */ "./node_modules/bcp-47-match/index.js") + var matches = __webpack_require__(/*! ./matches.json */ "./node_modules/bcp-47-normalize/lib/matches.json") + var fields = __webpack_require__(/*! ./fields.json */ "./node_modules/bcp-47-normalize/lib/fields.json") + var defaults = __webpack_require__(/*! ./defaults.json */ "./node_modules/bcp-47-normalize/lib/defaults.json") + var many = __webpack_require__(/*! ./many.json */ "./node_modules/bcp-47-normalize/lib/many.json") + module.exports = normalize + var own = {}.hasOwnProperty + var collator = new Intl.Collator() + var emptyExtraFields = { + variants: [], + extensions: [], + privateuse: [], + irregular: null, + regular: null + } + function normalize(value, options) { + var settings = options || {} + // 1. normalize and lowercase the tag (`sgn-be-fr` -> `sfb`). + var schema = bcp47.parse(String(value || '').toLowerCase(), settings) + var tag = bcp47.stringify(schema) + var index = -1 + var key + if (!tag) { + return tag + } + // 2. Do fancy, expensive replaces (`ha-latn-gh` -> `ha-gh`). + while (++index < matches.length) { + if (match.extendedFilter(tag, matches[index].from).length) { + replace(schema, matches[index].from, matches[index].to) + tag = bcp47.stringify(schema) + } + } + // 3. Do basic field replaces (`en-840` -> `en-us`). + index = -1 + while (++index < fields.length) { + if (remove(schema, fields[index].from.field, fields[index].from.value)) { + add(schema, fields[index].to.field, fields[index].to.value) + } + } + // 4. Remove defaults (`nl-nl` -> `nl`). + tag = bcp47.stringify(Object.assign({}, schema, emptyExtraFields)) + index = -1 + while (++index < defaults.length) { + if (tag === defaults[index]) { + replace( + schema, + defaults[index], + defaults[index].split('-').slice(0, -1).join('-') + ) + tag = bcp47.stringify(Object.assign({}, schema, emptyExtraFields)) + } + } + // 5. Sort extensions on singleton. + schema.extensions.sort(compareSingleton) + // 6. Warn if fields (currently only regions) should be updated but have + // multiple choices. + if (settings.warning) { + for (key in many) { + if (own.call(many[key], schema[key])) { + settings.warning( + 'Deprecated ' + + key + + ' `' + + schema[key] + + '`, expected one of `' + + many[key][schema[key]].join('`, `') + + '`', + null, + 7 + ) + } + } + } + // 7. Add proper casing back. + // Format script (ISO 15924) as titlecase (example: `Latn`): + if (schema.script) { + schema.script = + schema.script.charAt(0).toUpperCase() + schema.script.slice(1) + } + // Format region (ISO 3166) as uppercase (note: this doesn’t affect numeric + // codes, which is fine): + if (schema.region) { + schema.region = schema.region.toUpperCase() + } + return bcp47.stringify(schema) + } + function replace(schema, from, to) { + var left = bcp47.parse(from) + var right = bcp47.parse(to) + var removed = [] + var key + // Remove values from `from`: + for (key in left) { + if (left[key] && left[key].length && remove(schema, key, left[key])) { + removed.push(key) + } + } + // Add values from `to`: + for (key in right) { + // Only add values that are defined on `to`, and that were either removed by + // `from` or are currently empty. + if ( + right[key] && + right[key].length && + (removed.indexOf(key) > -1 || !schema[key] || !schema[key].length) + ) { + add(schema, key, right[key]) + } + } + } + function remove(object, key, value) { + var removed = false + var current + var result + var index + var item + /* istanbul ignore else - this is currently done by wrapping code, so else is + * never reached. + * However, that could change in the future, so leave this guard here. */ + if (value) { + current = object[key] + result = current + if (current && typeof current === 'object') { + result = [] + index = -1 + while (++index < current.length) { + item = current[index] + if (value.indexOf(item) < 0) { + result.push(item) + } else { + removed = true + } + } + } else if (current === value) { + result = null + removed = true + } + object[key] = result + } + return removed + } + function add(object, key, value) { + var current = object[key] + var list + var index + var item + if (current && typeof current === 'object') { + list = [].concat(value) + index = -1 + while (++index < list.length) { + item = list[index] + /* istanbul ignore else - this currently can’t happen, but guard for the + * future. */ + if (current.indexOf(item) < 0) { + current.push(item) + } + } + } else { + object[key] = value + } + } + function compareSingleton(left, right) { + return collator.compare(left.singleton, right.singleton) + } + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/lib/many.json": +/*!*****************************************************!*\ + !*** ./node_modules/bcp-47-normalize/lib/many.json ***! + \*****************************************************/ +/*! exports provided: region, default */ +/***/ (function (module) { + module.exports = JSON.parse("{\"region\":{\"172\":[\"ru\",\"am\",\"az\",\"by\",\"ge\",\"kg\",\"kz\",\"md\",\"tj\",\"tm\",\"ua\",\"uz\"],\"200\":[\"cz\",\"sk\"],\"530\":[\"cw\",\"sx\",\"bq\"],\"532\":[\"cw\",\"sx\",\"bq\"],\"536\":[\"sa\",\"iq\"],\"582\":[\"fm\",\"mh\",\"mp\",\"pw\"],\"810\":[\"ru\",\"am\",\"az\",\"by\",\"ee\",\"ge\",\"kz\",\"kg\",\"lv\",\"lt\",\"md\",\"tj\",\"tm\",\"ua\",\"uz\"],\"830\":[\"je\",\"gg\"],\"890\":[\"rs\",\"me\",\"si\",\"hr\",\"mk\",\"ba\"],\"891\":[\"rs\",\"me\"],\"an\":[\"cw\",\"sx\",\"bq\"],\"cs\":[\"rs\",\"me\"],\"fq\":[\"aq\",\"tf\"],\"nt\":[\"sa\",\"iq\"],\"pc\":[\"fm\",\"mh\",\"mp\",\"pw\"],\"su\":[\"ru\",\"am\",\"az\",\"by\",\"ee\",\"ge\",\"kz\",\"kg\",\"lv\",\"lt\",\"md\",\"tj\",\"tm\",\"ua\",\"uz\"],\"yu\":[\"rs\",\"me\"],\"062\":[\"034\",\"143\"],\"ant\":[\"cw\",\"sx\",\"bq\"],\"scg\":[\"rs\",\"me\"],\"ntz\":[\"sa\",\"iq\"],\"sun\":[\"ru\",\"am\",\"az\",\"by\",\"ee\",\"ge\",\"kz\",\"kg\",\"lv\",\"lt\",\"md\",\"tj\",\"tm\",\"ua\",\"uz\"],\"yug\":[\"rs\",\"me\"]}}"); + /***/ +}), +/***/ "./node_modules/bcp-47-normalize/lib/matches.json": +/*!********************************************************!*\ + !*** ./node_modules/bcp-47-normalize/lib/matches.json ***! + \********************************************************/ +/*! exports provided: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, default */ +/***/ (function (module) { + module.exports = JSON.parse("[{\"from\":\"in\",\"to\":\"id\"},{\"from\":\"iw\",\"to\":\"he\"},{\"from\":\"ji\",\"to\":\"yi\"},{\"from\":\"jw\",\"to\":\"jv\"},{\"from\":\"mo\",\"to\":\"ro\"},{\"from\":\"scc\",\"to\":\"sr\"},{\"from\":\"scr\",\"to\":\"hr\"},{\"from\":\"aam\",\"to\":\"aas\"},{\"from\":\"adp\",\"to\":\"dz\"},{\"from\":\"aue\",\"to\":\"ktz\"},{\"from\":\"ayx\",\"to\":\"nun\"},{\"from\":\"bgm\",\"to\":\"bcg\"},{\"from\":\"bjd\",\"to\":\"drl\"},{\"from\":\"ccq\",\"to\":\"rki\"},{\"from\":\"cjr\",\"to\":\"mom\"},{\"from\":\"cka\",\"to\":\"cmr\"},{\"from\":\"cmk\",\"to\":\"xch\"},{\"from\":\"coy\",\"to\":\"pij\"},{\"from\":\"cqu\",\"to\":\"quh\"},{\"from\":\"drh\",\"to\":\"mn\"},{\"from\":\"drw\",\"to\":\"fa-af\"},{\"from\":\"gav\",\"to\":\"dev\"},{\"from\":\"gfx\",\"to\":\"vaj\"},{\"from\":\"ggn\",\"to\":\"gvr\"},{\"from\":\"gti\",\"to\":\"nyc\"},{\"from\":\"guv\",\"to\":\"duz\"},{\"from\":\"hrr\",\"to\":\"jal\"},{\"from\":\"ibi\",\"to\":\"opa\"},{\"from\":\"ilw\",\"to\":\"gal\"},{\"from\":\"jeg\",\"to\":\"oyb\"},{\"from\":\"kgc\",\"to\":\"tdf\"},{\"from\":\"kgh\",\"to\":\"kml\"},{\"from\":\"koj\",\"to\":\"kwv\"},{\"from\":\"krm\",\"to\":\"bmf\"},{\"from\":\"ktr\",\"to\":\"dtp\"},{\"from\":\"kvs\",\"to\":\"gdj\"},{\"from\":\"kwq\",\"to\":\"yam\"},{\"from\":\"kxe\",\"to\":\"tvd\"},{\"from\":\"kzj\",\"to\":\"dtp\"},{\"from\":\"kzt\",\"to\":\"dtp\"},{\"from\":\"lii\",\"to\":\"raq\"},{\"from\":\"lmm\",\"to\":\"rmx\"},{\"from\":\"meg\",\"to\":\"cir\"},{\"from\":\"mst\",\"to\":\"mry\"},{\"from\":\"mwj\",\"to\":\"vaj\"},{\"from\":\"myt\",\"to\":\"mry\"},{\"from\":\"nad\",\"to\":\"xny\"},{\"from\":\"ncp\",\"to\":\"kdz\"},{\"from\":\"nnx\",\"to\":\"ngv\"},{\"from\":\"nts\",\"to\":\"pij\"},{\"from\":\"oun\",\"to\":\"vaj\"},{\"from\":\"pcr\",\"to\":\"adx\"},{\"from\":\"pmc\",\"to\":\"huw\"},{\"from\":\"pmu\",\"to\":\"phr\"},{\"from\":\"ppa\",\"to\":\"bfy\"},{\"from\":\"ppr\",\"to\":\"lcq\"},{\"from\":\"pry\",\"to\":\"prt\"},{\"from\":\"puz\",\"to\":\"pub\"},{\"from\":\"sca\",\"to\":\"hle\"},{\"from\":\"skk\",\"to\":\"oyb\"},{\"from\":\"tdu\",\"to\":\"dtp\"},{\"from\":\"thc\",\"to\":\"tpo\"},{\"from\":\"thx\",\"to\":\"oyb\"},{\"from\":\"tie\",\"to\":\"ras\"},{\"from\":\"tkk\",\"to\":\"twm\"},{\"from\":\"tlw\",\"to\":\"weo\"},{\"from\":\"tmp\",\"to\":\"tyj\"},{\"from\":\"tne\",\"to\":\"kak\"},{\"from\":\"tnf\",\"to\":\"fa-af\"},{\"from\":\"tsf\",\"to\":\"taj\"},{\"from\":\"uok\",\"to\":\"ema\"},{\"from\":\"xba\",\"to\":\"cax\"},{\"from\":\"xia\",\"to\":\"acn\"},{\"from\":\"xkh\",\"to\":\"waw\"},{\"from\":\"xsj\",\"to\":\"suj\"},{\"from\":\"ybd\",\"to\":\"rki\"},{\"from\":\"yma\",\"to\":\"lrr\"},{\"from\":\"ymt\",\"to\":\"mtm\"},{\"from\":\"yos\",\"to\":\"zom\"},{\"from\":\"yuu\",\"to\":\"yug\"},{\"from\":\"asd\",\"to\":\"snz\"},{\"from\":\"dit\",\"to\":\"dif\"},{\"from\":\"llo\",\"to\":\"ngt\"},{\"from\":\"myd\",\"to\":\"aog\"},{\"from\":\"nns\",\"to\":\"nbr\"},{\"from\":\"sgn-br\",\"to\":\"bzs\"},{\"from\":\"sgn-co\",\"to\":\"csn\"},{\"from\":\"sgn-de\",\"to\":\"gsg\"},{\"from\":\"sgn-dk\",\"to\":\"dsl\"},{\"from\":\"sgn-fr\",\"to\":\"fsl\"},{\"from\":\"sgn-gb\",\"to\":\"bfi\"},{\"from\":\"sgn-gr\",\"to\":\"gss\"},{\"from\":\"sgn-ie\",\"to\":\"isg\"},{\"from\":\"sgn-it\",\"to\":\"ise\"},{\"from\":\"sgn-jp\",\"to\":\"jsl\"},{\"from\":\"sgn-mx\",\"to\":\"mfs\"},{\"from\":\"sgn-ni\",\"to\":\"ncs\"},{\"from\":\"sgn-nl\",\"to\":\"dse\"},{\"from\":\"sgn-no\",\"to\":\"nsi\"},{\"from\":\"sgn-pt\",\"to\":\"psr\"},{\"from\":\"sgn-se\",\"to\":\"swl\"},{\"from\":\"sgn-us\",\"to\":\"ase\"},{\"from\":\"sgn-za\",\"to\":\"sfs\"},{\"from\":\"no-bokmal\",\"to\":\"nb\"},{\"from\":\"no-nynorsk\",\"to\":\"nn\"},{\"from\":\"aa-saaho\",\"to\":\"ssy\"},{\"from\":\"sh\",\"to\":\"sr-latn\"},{\"from\":\"cnr\",\"to\":\"sr-me\"},{\"from\":\"no\",\"to\":\"nb\"},{\"from\":\"tl\",\"to\":\"fil\"},{\"from\":\"az-az\",\"to\":\"az-latn-az\"},{\"from\":\"bs-ba\",\"to\":\"bs-latn-ba\"},{\"from\":\"ha-latn-gh\",\"to\":\"ha-gh\"},{\"from\":\"ha-latn-ne\",\"to\":\"ha-ne\"},{\"from\":\"ha-latn-ng\",\"to\":\"ha-ng\"},{\"from\":\"kk-cyrl-kz\",\"to\":\"kk-kz\"},{\"from\":\"ky-cyrl-kg\",\"to\":\"ky-kg\"},{\"from\":\"ks-arab-in\",\"to\":\"ks-in\"},{\"from\":\"mn-cyrl-mn\",\"to\":\"mn-mn\"},{\"from\":\"ms-latn-bn\",\"to\":\"ms-bn\"},{\"from\":\"ms-latn-my\",\"to\":\"ms-my\"},{\"from\":\"ms-latn-sg\",\"to\":\"ms-sg\"},{\"from\":\"pa-in\",\"to\":\"pa-guru-in\"},{\"from\":\"pa-pk\",\"to\":\"pa-arab-pk\"},{\"from\":\"shi-ma\",\"to\":\"shi-tfng-ma\"},{\"from\":\"sr-ba\",\"to\":\"sr-cyrl-ba\"},{\"from\":\"sr-me\",\"to\":\"sr-latn-me\"},{\"from\":\"sr-rs\",\"to\":\"sr-cyrl-rs\"},{\"from\":\"sr-xk\",\"to\":\"sr-cyrl-xk\"},{\"from\":\"tzm-latn-ma\",\"to\":\"tzm-ma\"},{\"from\":\"ug-arab-cn\",\"to\":\"ug-cn\"},{\"from\":\"uz-af\",\"to\":\"uz-arab-af\"},{\"from\":\"uz-uz\",\"to\":\"uz-latn-uz\"},{\"from\":\"vai-lr\",\"to\":\"vai-vaii-lr\"},{\"from\":\"yue-cn\",\"to\":\"yue-hans-cn\"},{\"from\":\"yue-hk\",\"to\":\"yue-hant-hk\"},{\"from\":\"zh-cn\",\"to\":\"zh-hans-cn\"},{\"from\":\"zh-hk\",\"to\":\"zh-hant-hk\"},{\"from\":\"zh-mo\",\"to\":\"zh-hant-mo\"},{\"from\":\"zh-sg\",\"to\":\"zh-hans-sg\"},{\"from\":\"zh-tw\",\"to\":\"zh-hant-tw\"},{\"from\":\"aju\",\"to\":\"jrb\"},{\"from\":\"als\",\"to\":\"sq\"},{\"from\":\"arb\",\"to\":\"ar\"},{\"from\":\"ayr\",\"to\":\"ay\"},{\"from\":\"azj\",\"to\":\"az\"},{\"from\":\"bcc\",\"to\":\"bal\"},{\"from\":\"bcl\",\"to\":\"bik\"},{\"from\":\"bxk\",\"to\":\"luy\"},{\"from\":\"bxr\",\"to\":\"bua\"},{\"from\":\"cld\",\"to\":\"syr\"},{\"from\":\"cmn\",\"to\":\"zh\"},{\"from\":\"cwd\",\"to\":\"cr\"},{\"from\":\"dgo\",\"to\":\"doi\"},{\"from\":\"dhd\",\"to\":\"mwr\"},{\"from\":\"dik\",\"to\":\"din\"},{\"from\":\"diq\",\"to\":\"zza\"},{\"from\":\"lbk\",\"to\":\"bnc\"},{\"from\":\"ekk\",\"to\":\"et\"},{\"from\":\"emk\",\"to\":\"man\"},{\"from\":\"esk\",\"to\":\"ik\"},{\"from\":\"fat\",\"to\":\"ak\"},{\"from\":\"fuc\",\"to\":\"ff\"},{\"from\":\"gaz\",\"to\":\"om\"},{\"from\":\"gbo\",\"to\":\"grb\"},{\"from\":\"gno\",\"to\":\"gon\"},{\"from\":\"gug\",\"to\":\"gn\"},{\"from\":\"gya\",\"to\":\"gba\"},{\"from\":\"hdn\",\"to\":\"hai\"},{\"from\":\"hea\",\"to\":\"hmn\"},{\"from\":\"ike\",\"to\":\"iu\"},{\"from\":\"kmr\",\"to\":\"ku\"},{\"from\":\"knc\",\"to\":\"kr\"},{\"from\":\"kng\",\"to\":\"kg\"},{\"from\":\"knn\",\"to\":\"kok\"},{\"from\":\"kpv\",\"to\":\"kv\"},{\"from\":\"lvs\",\"to\":\"lv\"},{\"from\":\"mhr\",\"to\":\"chm\"},{\"from\":\"mup\",\"to\":\"raj\"},{\"from\":\"khk\",\"to\":\"mn\"},{\"from\":\"npi\",\"to\":\"ne\"},{\"from\":\"ojg\",\"to\":\"oj\"},{\"from\":\"ory\",\"to\":\"or\"},{\"from\":\"pbu\",\"to\":\"ps\"},{\"from\":\"pes\",\"to\":\"fa\"},{\"from\":\"plt\",\"to\":\"mg\"},{\"from\":\"pnb\",\"to\":\"lah\"},{\"from\":\"quz\",\"to\":\"qu\"},{\"from\":\"rmy\",\"to\":\"rom\"},{\"from\":\"spy\",\"to\":\"kln\"},{\"from\":\"src\",\"to\":\"sc\"},{\"from\":\"swh\",\"to\":\"sw\"},{\"from\":\"ttq\",\"to\":\"tmh\"},{\"from\":\"tw\",\"to\":\"ak\"},{\"from\":\"umu\",\"to\":\"del\"},{\"from\":\"uzn\",\"to\":\"uz\"},{\"from\":\"xpe\",\"to\":\"kpe\"},{\"from\":\"xsl\",\"to\":\"den\"},{\"from\":\"ydd\",\"to\":\"yi\"},{\"from\":\"zai\",\"to\":\"zap\"},{\"from\":\"zsm\",\"to\":\"ms\"},{\"from\":\"zyb\",\"to\":\"za\"},{\"from\":\"him\",\"to\":\"srx\"},{\"from\":\"mnk\",\"to\":\"man\"},{\"from\":\"bh\",\"to\":\"bho\"},{\"from\":\"prs\",\"to\":\"fa-af\"},{\"from\":\"swc\",\"to\":\"sw-cd\"},{\"from\":\"aar\",\"to\":\"aa\"},{\"from\":\"abk\",\"to\":\"ab\"},{\"from\":\"ave\",\"to\":\"ae\"},{\"from\":\"afr\",\"to\":\"af\"},{\"from\":\"aka\",\"to\":\"ak\"},{\"from\":\"amh\",\"to\":\"am\"},{\"from\":\"arg\",\"to\":\"an\"},{\"from\":\"ara\",\"to\":\"ar\"},{\"from\":\"asm\",\"to\":\"as\"},{\"from\":\"ava\",\"to\":\"av\"},{\"from\":\"aym\",\"to\":\"ay\"},{\"from\":\"aze\",\"to\":\"az\"},{\"from\":\"bak\",\"to\":\"ba\"},{\"from\":\"bel\",\"to\":\"be\"},{\"from\":\"bul\",\"to\":\"bg\"},{\"from\":\"bih\",\"to\":\"bho\"},{\"from\":\"bis\",\"to\":\"bi\"},{\"from\":\"bam\",\"to\":\"bm\"},{\"from\":\"ben\",\"to\":\"bn\"},{\"from\":\"bod\",\"to\":\"bo\"},{\"from\":\"bre\",\"to\":\"br\"},{\"from\":\"bos\",\"to\":\"bs\"},{\"from\":\"cat\",\"to\":\"ca\"},{\"from\":\"che\",\"to\":\"ce\"},{\"from\":\"cha\",\"to\":\"ch\"},{\"from\":\"cos\",\"to\":\"co\"},{\"from\":\"cre\",\"to\":\"cr\"},{\"from\":\"ces\",\"to\":\"cs\"},{\"from\":\"chu\",\"to\":\"cu\"},{\"from\":\"chv\",\"to\":\"cv\"},{\"from\":\"cym\",\"to\":\"cy\"},{\"from\":\"dan\",\"to\":\"da\"},{\"from\":\"deu\",\"to\":\"de\"},{\"from\":\"div\",\"to\":\"dv\"},{\"from\":\"dzo\",\"to\":\"dz\"},{\"from\":\"ewe\",\"to\":\"ee\"},{\"from\":\"ell\",\"to\":\"el\"},{\"from\":\"eng\",\"to\":\"en\"},{\"from\":\"epo\",\"to\":\"eo\"},{\"from\":\"spa\",\"to\":\"es\"},{\"from\":\"est\",\"to\":\"et\"},{\"from\":\"eus\",\"to\":\"eu\"},{\"from\":\"fas\",\"to\":\"fa\"},{\"from\":\"ful\",\"to\":\"ff\"},{\"from\":\"fin\",\"to\":\"fi\"},{\"from\":\"fij\",\"to\":\"fj\"},{\"from\":\"fao\",\"to\":\"fo\"},{\"from\":\"fra\",\"to\":\"fr\"},{\"from\":\"fry\",\"to\":\"fy\"},{\"from\":\"gle\",\"to\":\"ga\"},{\"from\":\"gla\",\"to\":\"gd\"},{\"from\":\"glg\",\"to\":\"gl\"},{\"from\":\"grn\",\"to\":\"gn\"},{\"from\":\"guj\",\"to\":\"gu\"},{\"from\":\"glv\",\"to\":\"gv\"},{\"from\":\"hau\",\"to\":\"ha\"},{\"from\":\"heb\",\"to\":\"he\"},{\"from\":\"hin\",\"to\":\"hi\"},{\"from\":\"hmo\",\"to\":\"ho\"},{\"from\":\"hrv\",\"to\":\"hr\"},{\"from\":\"hat\",\"to\":\"ht\"},{\"from\":\"hun\",\"to\":\"hu\"},{\"from\":\"hye\",\"to\":\"hy\"},{\"from\":\"her\",\"to\":\"hz\"},{\"from\":\"ina\",\"to\":\"ia\"},{\"from\":\"ind\",\"to\":\"id\"},{\"from\":\"ile\",\"to\":\"ie\"},{\"from\":\"ibo\",\"to\":\"ig\"},{\"from\":\"iii\",\"to\":\"ii\"},{\"from\":\"ipk\",\"to\":\"ik\"},{\"from\":\"ido\",\"to\":\"io\"},{\"from\":\"isl\",\"to\":\"is\"},{\"from\":\"ita\",\"to\":\"it\"},{\"from\":\"iku\",\"to\":\"iu\"},{\"from\":\"jpn\",\"to\":\"ja\"},{\"from\":\"jav\",\"to\":\"jv\"},{\"from\":\"kat\",\"to\":\"ka\"},{\"from\":\"kon\",\"to\":\"kg\"},{\"from\":\"kik\",\"to\":\"ki\"},{\"from\":\"kua\",\"to\":\"kj\"},{\"from\":\"kaz\",\"to\":\"kk\"},{\"from\":\"kal\",\"to\":\"kl\"},{\"from\":\"khm\",\"to\":\"km\"},{\"from\":\"kan\",\"to\":\"kn\"},{\"from\":\"kor\",\"to\":\"ko\"},{\"from\":\"kau\",\"to\":\"kr\"},{\"from\":\"kas\",\"to\":\"ks\"},{\"from\":\"kur\",\"to\":\"ku\"},{\"from\":\"kom\",\"to\":\"kv\"},{\"from\":\"cor\",\"to\":\"kw\"},{\"from\":\"kir\",\"to\":\"ky\"},{\"from\":\"lat\",\"to\":\"la\"},{\"from\":\"ltz\",\"to\":\"lb\"},{\"from\":\"lug\",\"to\":\"lg\"},{\"from\":\"lim\",\"to\":\"li\"},{\"from\":\"lin\",\"to\":\"ln\"},{\"from\":\"lao\",\"to\":\"lo\"},{\"from\":\"lit\",\"to\":\"lt\"},{\"from\":\"lub\",\"to\":\"lu\"},{\"from\":\"lav\",\"to\":\"lv\"},{\"from\":\"mlg\",\"to\":\"mg\"},{\"from\":\"mah\",\"to\":\"mh\"},{\"from\":\"mri\",\"to\":\"mi\"},{\"from\":\"mkd\",\"to\":\"mk\"},{\"from\":\"mal\",\"to\":\"ml\"},{\"from\":\"mon\",\"to\":\"mn\"},{\"from\":\"mol\",\"to\":\"ro\"},{\"from\":\"mar\",\"to\":\"mr\"},{\"from\":\"msa\",\"to\":\"ms\"},{\"from\":\"mlt\",\"to\":\"mt\"},{\"from\":\"mya\",\"to\":\"my\"},{\"from\":\"nau\",\"to\":\"na\"},{\"from\":\"nob\",\"to\":\"nb\"},{\"from\":\"nde\",\"to\":\"nd\"},{\"from\":\"nep\",\"to\":\"ne\"},{\"from\":\"ndo\",\"to\":\"ng\"},{\"from\":\"nld\",\"to\":\"nl\"},{\"from\":\"nno\",\"to\":\"nn\"},{\"from\":\"nor\",\"to\":\"nb\"},{\"from\":\"nbl\",\"to\":\"nr\"},{\"from\":\"nav\",\"to\":\"nv\"},{\"from\":\"nya\",\"to\":\"ny\"},{\"from\":\"oci\",\"to\":\"oc\"},{\"from\":\"oji\",\"to\":\"oj\"},{\"from\":\"orm\",\"to\":\"om\"},{\"from\":\"ori\",\"to\":\"or\"},{\"from\":\"oss\",\"to\":\"os\"},{\"from\":\"pan\",\"to\":\"pa\"},{\"from\":\"pli\",\"to\":\"pi\"},{\"from\":\"pol\",\"to\":\"pl\"},{\"from\":\"pus\",\"to\":\"ps\"},{\"from\":\"por\",\"to\":\"pt\"},{\"from\":\"que\",\"to\":\"qu\"},{\"from\":\"roh\",\"to\":\"rm\"},{\"from\":\"run\",\"to\":\"rn\"},{\"from\":\"ron\",\"to\":\"ro\"},{\"from\":\"rus\",\"to\":\"ru\"},{\"from\":\"kin\",\"to\":\"rw\"},{\"from\":\"san\",\"to\":\"sa\"},{\"from\":\"srd\",\"to\":\"sc\"},{\"from\":\"snd\",\"to\":\"sd\"},{\"from\":\"sme\",\"to\":\"se\"},{\"from\":\"sag\",\"to\":\"sg\"},{\"from\":\"hbs\",\"to\":\"sr-latn\"},{\"from\":\"sin\",\"to\":\"si\"},{\"from\":\"slk\",\"to\":\"sk\"},{\"from\":\"slv\",\"to\":\"sl\"},{\"from\":\"smo\",\"to\":\"sm\"},{\"from\":\"sna\",\"to\":\"sn\"},{\"from\":\"som\",\"to\":\"so\"},{\"from\":\"sqi\",\"to\":\"sq\"},{\"from\":\"srp\",\"to\":\"sr\"},{\"from\":\"ssw\",\"to\":\"ss\"},{\"from\":\"sot\",\"to\":\"st\"},{\"from\":\"sun\",\"to\":\"su\"},{\"from\":\"swe\",\"to\":\"sv\"},{\"from\":\"swa\",\"to\":\"sw\"},{\"from\":\"tam\",\"to\":\"ta\"},{\"from\":\"tel\",\"to\":\"te\"},{\"from\":\"tgk\",\"to\":\"tg\"},{\"from\":\"tha\",\"to\":\"th\"},{\"from\":\"tir\",\"to\":\"ti\"},{\"from\":\"tuk\",\"to\":\"tk\"},{\"from\":\"tgl\",\"to\":\"fil\"},{\"from\":\"tsn\",\"to\":\"tn\"},{\"from\":\"ton\",\"to\":\"to\"},{\"from\":\"tur\",\"to\":\"tr\"},{\"from\":\"tso\",\"to\":\"ts\"},{\"from\":\"tat\",\"to\":\"tt\"},{\"from\":\"twi\",\"to\":\"ak\"},{\"from\":\"tah\",\"to\":\"ty\"},{\"from\":\"uig\",\"to\":\"ug\"},{\"from\":\"ukr\",\"to\":\"uk\"},{\"from\":\"urd\",\"to\":\"ur\"},{\"from\":\"uzb\",\"to\":\"uz\"},{\"from\":\"ven\",\"to\":\"ve\"},{\"from\":\"vie\",\"to\":\"vi\"},{\"from\":\"vol\",\"to\":\"vo\"},{\"from\":\"wln\",\"to\":\"wa\"},{\"from\":\"wol\",\"to\":\"wo\"},{\"from\":\"xho\",\"to\":\"xh\"},{\"from\":\"yid\",\"to\":\"yi\"},{\"from\":\"yor\",\"to\":\"yo\"},{\"from\":\"zha\",\"to\":\"za\"},{\"from\":\"zho\",\"to\":\"zh\"},{\"from\":\"zul\",\"to\":\"zu\"},{\"from\":\"alb\",\"to\":\"sq\"},{\"from\":\"arm\",\"to\":\"hy\"},{\"from\":\"baq\",\"to\":\"eu\"},{\"from\":\"bur\",\"to\":\"my\"},{\"from\":\"chi\",\"to\":\"zh\"},{\"from\":\"cze\",\"to\":\"cs\"},{\"from\":\"dut\",\"to\":\"nl\"},{\"from\":\"fre\",\"to\":\"fr\"},{\"from\":\"geo\",\"to\":\"ka\"},{\"from\":\"ger\",\"to\":\"de\"},{\"from\":\"gre\",\"to\":\"el\"},{\"from\":\"ice\",\"to\":\"is\"},{\"from\":\"mac\",\"to\":\"mk\"},{\"from\":\"mao\",\"to\":\"mi\"},{\"from\":\"may\",\"to\":\"ms\"},{\"from\":\"per\",\"to\":\"fa\"},{\"from\":\"rum\",\"to\":\"ro\"},{\"from\":\"slo\",\"to\":\"sk\"},{\"from\":\"tib\",\"to\":\"bo\"},{\"from\":\"wel\",\"to\":\"cy\"}]"); + /***/ +}), +/***/ "./node_modules/bcp-47/index.js": +/*!**************************************!*\ + !*** ./node_modules/bcp-47/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + exports.parse = __webpack_require__(/*! ./lib/parse */ "./node_modules/bcp-47/lib/parse.js") + exports.stringify = __webpack_require__(/*! ./lib/stringify */ "./node_modules/bcp-47/lib/stringify.js") + /***/ +}), +/***/ "./node_modules/bcp-47/lib/normalize.json": +/*!************************************************!*\ + !*** ./node_modules/bcp-47/lib/normalize.json ***! + \************************************************/ +/*! exports provided: en-gb-oed, i-ami, i-bnn, i-default, i-enochian, i-hak, i-klingon, i-lux, i-mingo, i-navajo, i-pwn, i-tao, i-tay, i-tsu, sgn-be-fr, sgn-be-nl, sgn-ch-de, art-lojban, cel-gaulish, no-bok, no-nyn, zh-guoyu, zh-hakka, zh-min, zh-min-nan, zh-xiang, default */ +/***/ (function (module) { + module.exports = JSON.parse("{\"en-gb-oed\":\"en-GB-oxendict\",\"i-ami\":\"ami\",\"i-bnn\":\"bnn\",\"i-default\":null,\"i-enochian\":null,\"i-hak\":\"hak\",\"i-klingon\":\"tlh\",\"i-lux\":\"lb\",\"i-mingo\":null,\"i-navajo\":\"nv\",\"i-pwn\":\"pwn\",\"i-tao\":\"tao\",\"i-tay\":\"tay\",\"i-tsu\":\"tsu\",\"sgn-be-fr\":\"sfb\",\"sgn-be-nl\":\"vgt\",\"sgn-ch-de\":\"sgg\",\"art-lojban\":\"jbo\",\"cel-gaulish\":null,\"no-bok\":\"nb\",\"no-nyn\":\"nn\",\"zh-guoyu\":\"cmn\",\"zh-hakka\":\"hak\",\"zh-min\":null,\"zh-min-nan\":\"nan\",\"zh-xiang\":\"hsn\"}"); + /***/ +}), +/***/ "./node_modules/bcp-47/lib/parse.js": +/*!******************************************!*\ + !*** ./node_modules/bcp-47/lib/parse.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + var alphanumeric = __webpack_require__(/*! is-alphanumerical */ "./node_modules/is-alphanumerical/index.js") + var alphabetical = __webpack_require__(/*! is-alphabetical */ "./node_modules/is-alphabetical/index.js") + var decimal = __webpack_require__(/*! is-decimal */ "./node_modules/is-decimal/index.js") + var regular = __webpack_require__(/*! ./regular.json */ "./node_modules/bcp-47/lib/regular.json") + var normal = __webpack_require__(/*! ./normalize.json */ "./node_modules/bcp-47/lib/normalize.json") + module.exports = parse + var own = {}.hasOwnProperty + // Parse a BCP 47 language tag. + /* eslint-disable-next-line complexity */ + function parse(tag, options) { + var settings = options || {} + var result = empty() + var source = String(tag) + var value = source.toLowerCase() + var index = 0 + var start + var groups + var offset + // Check input. + if (tag == null) { + throw new Error('Expected string, got `' + tag + '`') + } + // Let’s start. + // First: the edge cases. + if (own.call(normal, value)) { + if ((settings.normalize == null || settings.normalize) && normal[value]) { + return parse(normal[value]) + } + result[regular.indexOf(value) === -1 ? 'irregular' : 'regular'] = source + return result + } + // Now, to actually parse, eat what could be a language. + while (alphabetical(value.charCodeAt(index)) && index < 9) index++ + // A language. + if (index > 1 /* Min 639. */ && index < 9 /* Max subtag. */) { + // 5 and up is a subtag. + // 4 is the size of reserved languages. + // 3 an ISO 639-2 or ISO 639-3. + // 2 is an ISO 639-1. + // + // + result.language = source.slice(0, index) + if (index < 4 /* Max 639. */) { + groups = 0 + while ( + value.charCodeAt(index) === 45 /* `-` */ && + alphabetical(value.charCodeAt(index + 1)) && + alphabetical(value.charCodeAt(index + 2)) && + alphabetical(value.charCodeAt(index + 3)) && + !alphabetical(value.charCodeAt(index + 4)) + ) { + if (groups > 2 /* Max extended language subtag count. */) { + return fail( + index, + 3, + 'Too many extended language subtags, expected at most 3 subtags' + ) + } + // Extended language subtag. + result.extendedLanguageSubtags.push(source.slice(index + 1, index + 4)) + index += 4 + groups++ + } + } + // ISO 15924 script. + // + if ( + value.charCodeAt(index) === 45 /* `-` */ && + alphabetical(value.charCodeAt(index + 1)) && + alphabetical(value.charCodeAt(index + 2)) && + alphabetical(value.charCodeAt(index + 3)) && + alphabetical(value.charCodeAt(index + 4)) && + !alphabetical(value.charCodeAt(index + 5)) + ) { + result.script = source.slice(index + 1, index + 5) + index += 5 + } + if (value.charCodeAt(index) === 45 /* `-` */) { + // ISO 3166-1 region. + // + if ( + alphabetical(value.charCodeAt(index + 1)) && + alphabetical(value.charCodeAt(index + 2)) && + !alphabetical(value.charCodeAt(index + 3)) + ) { + result.region = source.slice(index + 1, index + 3) + index += 3 + } + // UN M49 region. + // + else if ( + decimal(value.charCodeAt(index + 1)) && + decimal(value.charCodeAt(index + 2)) && + decimal(value.charCodeAt(index + 3)) && + !decimal(value.charCodeAt(index + 4)) + ) { + result.region = source.slice(index + 1, index + 4) + index += 4 + } + } + while (value.charCodeAt(index) === 45 /* `-` */) { + offset = start = index + 1 + while (alphanumeric(value.charCodeAt(offset))) { + if (offset - start > 7 /* Max variant. */) { + return fail( + offset, + 1, + 'Too long variant, expected at most 8 characters' + ) + } + offset++ + } + if ( + // Long variant. + offset - start > 4 /* Min alpha numeric variant. */ || + // Short variant. + (offset - start > 3 /* Min variant. */ && + decimal(value.charCodeAt(start))) + ) { + result.variants.push(source.slice(start, offset)) + index = offset + } + // Something else. + else { + break + } + } + // Extensions. + while (value.charCodeAt(index) === 45 /* `-` */) { + // Exit if this isn’t an extension. + if ( + value.charCodeAt(index + 1) === 120 /* `x` */ || + !alphanumeric(value.charCodeAt(index + 1)) || + value.charCodeAt(index + 2) !== 45 /* `-` */ || + !alphanumeric(value.charCodeAt(index + 3)) + ) { + break + } + offset = index + 2 + groups = 0 + while ( + value.charCodeAt(offset) === 45 /* `-` */ && + alphanumeric(value.charCodeAt(offset + 1)) && + alphanumeric(value.charCodeAt(offset + 2)) + ) { + start = offset + 1 + offset = start + 2 + groups++ + while (alphanumeric(value.charCodeAt(offset))) { + if (offset - start > 7 /* Max extension. */) { + return fail( + offset, + 2, + 'Too long extension, expected at most 8 characters' + ) + } + offset++ + } + } + if (!groups) { + return fail( + offset, + 4, + 'Empty extension, extensions must have at least 2 characters of content' + ) + } + result.extensions.push({ + singleton: source.charAt(index + 1), + extensions: source.slice(index + 3, offset).split('-') + }) + index = offset + } + } + // Not a language. + else { + index = 0 + } + // Private use. + if ( + (index === 0 && value.charCodeAt(index) === 120) /* `x` */ || + (value.charCodeAt(index) === 45 /* `-` */ && + value.charCodeAt(index + 1) === 120) /* `x` */ + ) { + offset = index = index ? index + 2 : 1 + while ( + value.charCodeAt(offset) === 45 /* `-` */ && + alphanumeric(value.charCodeAt(offset + 1)) + ) { + offset = start = index + 1 + while (alphanumeric(value.charCodeAt(offset))) { + if (offset - start > 7 /* Max private use. */) { + return fail( + offset, + 5, + 'Too long private-use area, expected at most 8 characters' + ) + } + offset++ + } + result.privateuse.push(source.slice(index + 1, offset)) + index = offset + } + } + if (index !== source.length) { + return fail(index, 6, 'Found superfluous content after tag') + } + return result + function fail(offset, code, reason) { + if (settings.warning) settings.warning(reason, code, offset) + return settings.forgiving ? result : empty() + } + } + // Create an empty results object. + function empty() { + return { + language: null, + extendedLanguageSubtags: [], + script: null, + region: null, + variants: [], + extensions: [], + privateuse: [], + irregular: null, + regular: null + } + } + /***/ +}), +/***/ "./node_modules/bcp-47/lib/regular.json": +/*!**********************************************!*\ + !*** ./node_modules/bcp-47/lib/regular.json ***! + \**********************************************/ +/*! exports provided: 0, 1, 2, 3, 4, 5, 6, 7, 8, default */ +/***/ (function (module) { + module.exports = JSON.parse("[\"art-lojban\",\"cel-gaulish\",\"no-bok\",\"no-nyn\",\"zh-guoyu\",\"zh-hakka\",\"zh-min\",\"zh-min-nan\",\"zh-xiang\"]"); + /***/ +}), +/***/ "./node_modules/bcp-47/lib/stringify.js": +/*!**********************************************!*\ + !*** ./node_modules/bcp-47/lib/stringify.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + module.exports = stringify + // Compile a language schema to a BCP 47 language tag. + function stringify(schema) { + var fields = schema || {} + var result = [] + var values + var index + var value + if (fields.irregular || fields.regular) { + return fields.irregular || fields.regular + } + if (fields.language) { + result = result.concat( + fields.language, + fields.extendedLanguageSubtags || [], + fields.script || [], + fields.region || [], + fields.variants || [] + ) + values = fields.extensions || [] + index = -1 + while (++index < values.length) { + value = values[index] + if (value.singleton && value.extensions && value.extensions.length) { + result = result.concat(value.singleton, value.extensions) + } + } + } + if (fields.privateuse && fields.privateuse.length) { + result = result.concat('x', fields.privateuse) + } + return result.join('-') + } + /***/ +}), +/***/ "./node_modules/codem-isoboxer/dist/iso_boxer.js": +/*!*******************************************************!*\ + !*** ./node_modules/codem-isoboxer/dist/iso_boxer.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + /*! codem-isoboxer v0.3.6 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */ + var ISOBoxer = {}; + ISOBoxer.parseBuffer = function (arrayBuffer) { + return new ISOFile(arrayBuffer).parse(); + }; + ISOBoxer.addBoxProcessor = function (type, parser) { + if (typeof type !== 'string' || typeof parser !== 'function') { + return; + } + ISOBox.prototype._boxProcessors[type] = parser; + }; + ISOBoxer.createFile = function () { + return new ISOFile(); + }; + // See ISOBoxer.append() for 'pos' parameter syntax + ISOBoxer.createBox = function (type, parent, pos) { + var newBox = ISOBox.create(type); + if (parent) { + parent.append(newBox, pos); + } + return newBox; + }; + // See ISOBoxer.append() for 'pos' parameter syntax + ISOBoxer.createFullBox = function (type, parent, pos) { + var newBox = ISOBoxer.createBox(type, parent, pos); + newBox.version = 0; + newBox.flags = 0; + return newBox; + }; + ISOBoxer.Utils = {}; + ISOBoxer.Utils.dataViewToString = function (dataView, encoding) { + var impliedEncoding = encoding || 'utf-8'; + if (typeof TextDecoder !== 'undefined') { + return new TextDecoder(impliedEncoding).decode(dataView); + } + var a = []; + var i = 0; + if (impliedEncoding === 'utf-8') { + /* The following algorithm is essentially a rewrite of the UTF8.decode at + http://bannister.us/weblog/2007/simple-base64-encodedecode-javascript/ + */ + while (i < dataView.byteLength) { + var c = dataView.getUint8(i++); + if (c < 0x80) { + // 1-byte character (7 bits) + } else if (c < 0xe0) { + // 2-byte character (11 bits) + c = (c & 0x1f) << 6; + c |= (dataView.getUint8(i++) & 0x3f); + } else if (c < 0xf0) { + // 3-byte character (16 bits) + c = (c & 0xf) << 12; + c |= (dataView.getUint8(i++) & 0x3f) << 6; + c |= (dataView.getUint8(i++) & 0x3f); + } else { + // 4-byte character (21 bits) + c = (c & 0x7) << 18; + c |= (dataView.getUint8(i++) & 0x3f) << 12; + c |= (dataView.getUint8(i++) & 0x3f) << 6; + c |= (dataView.getUint8(i++) & 0x3f); + } + a.push(String.fromCharCode(c)); + } + } else { // Just map byte-by-byte (probably wrong) + while (i < dataView.byteLength) { + a.push(String.fromCharCode(dataView.getUint8(i++))); + } + } + return a.join(''); + }; + ISOBoxer.Utils.utf8ToByteArray = function (string) { + // Only UTF-8 encoding is supported by TextEncoder + var u, i; + if (typeof TextEncoder !== 'undefined') { + u = new TextEncoder().encode(string); + } else { + u = []; + for (i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + if (c < 0x80) { + u.push(c); + } else if (c < 0x800) { + u.push(0xC0 | (c >> 6)); + u.push(0x80 | (63 & c)); + } else if (c < 0x10000) { + u.push(0xE0 | (c >> 12)); + u.push(0x80 | (63 & (c >> 6))); + u.push(0x80 | (63 & c)); + } else { + u.push(0xF0 | (c >> 18)); + u.push(0x80 | (63 & (c >> 12))); + u.push(0x80 | (63 & (c >> 6))); + u.push(0x80 | (63 & c)); + } + } + } + return u; + }; + // Method to append a box in the list of child boxes + // The 'pos' parameter can be either: + // - (number) a position index at which to insert the new box + // - (string) the type of the box after which to insert the new box + // - (object) the box after which to insert the new box + ISOBoxer.Utils.appendBox = function (parent, box, pos) { + box._offset = parent._cursor.offset; + box._root = (parent._root ? parent._root : parent); + box._raw = parent._raw; + box._parent = parent; + if (pos === -1) { + // The new box is a sub-box of the parent but not added in boxes array, + // for example when the new box is set as an entry (see dref and stsd for example) + return; + } + if (pos === undefined || pos === null) { + parent.boxes.push(box); + return; + } + var index = -1, + type; + if (typeof pos === "number") { + index = pos; + } else { + if (typeof pos === "string") { + type = pos; + } else if (typeof pos === "object" && pos.type) { + type = pos.type; + } else { + parent.boxes.push(box); + return; + } + for (var i = 0; i < parent.boxes.length; i++) { + if (type === parent.boxes[i].type) { + index = i + 1; + break; + } + } + } + parent.boxes.splice(index, 0, box); + }; + if (true) { + exports.parseBuffer = ISOBoxer.parseBuffer; + exports.addBoxProcessor = ISOBoxer.addBoxProcessor; + exports.createFile = ISOBoxer.createFile; + exports.createBox = ISOBoxer.createBox; + exports.createFullBox = ISOBoxer.createFullBox; + exports.Utils = ISOBoxer.Utils; + } + ISOBoxer.Cursor = function (initialOffset) { + this.offset = (typeof initialOffset == 'undefined' ? 0 : initialOffset); + }; + var ISOFile = function (arrayBuffer) { + this._cursor = new ISOBoxer.Cursor(); + this.boxes = []; + if (arrayBuffer) { + this._raw = new DataView(arrayBuffer); + } + }; + ISOFile.prototype.fetch = function (type) { + var result = this.fetchAll(type, true); + return (result.length ? result[0] : null); + }; + ISOFile.prototype.fetchAll = function (type, returnEarly) { + var result = []; + ISOFile._sweep.call(this, type, result, returnEarly); + return result; + }; + ISOFile.prototype.parse = function () { + this._cursor.offset = 0; + this.boxes = []; + while (this._cursor.offset < this._raw.byteLength) { + var box = ISOBox.parse(this); + // Box could not be parsed + if (typeof box.type === 'undefined') break; + this.boxes.push(box); + } + return this; + }; + ISOFile._sweep = function (type, result, returnEarly) { + if (this.type && this.type == type) result.push(this); + for (var box in this.boxes) { + if (result.length && returnEarly) return; + ISOFile._sweep.call(this.boxes[box], type, result, returnEarly); + } + }; + ISOFile.prototype.write = function () { + var length = 0, + i; + for (i = 0; i < this.boxes.length; i++) { + length += this.boxes[i].getLength(false); + } + var bytes = new Uint8Array(length); + this._rawo = new DataView(bytes.buffer); + this.bytes = bytes; + this._cursor.offset = 0; + for (i = 0; i < this.boxes.length; i++) { + this.boxes[i].write(); + } + return bytes.buffer; + }; + ISOFile.prototype.append = function (box, pos) { + ISOBoxer.Utils.appendBox(this, box, pos); + }; + var ISOBox = function () { + this._cursor = new ISOBoxer.Cursor(); + }; + ISOBox.parse = function (parent) { + var newBox = new ISOBox(); + newBox._offset = parent._cursor.offset; + newBox._root = (parent._root ? parent._root : parent); + newBox._raw = parent._raw; + newBox._parent = parent; + newBox._parseBox(); + parent._cursor.offset = newBox._raw.byteOffset + newBox._raw.byteLength; + return newBox; + }; + ISOBox.create = function (type) { + var newBox = new ISOBox(); + newBox.type = type; + newBox.boxes = []; + return newBox; + }; + ISOBox.prototype._boxContainers = ['dinf', 'edts', 'mdia', 'meco', 'mfra', 'minf', 'moof', 'moov', 'mvex', 'stbl', 'strk', 'traf', 'trak', 'tref', 'udta', 'vttc', 'sinf', 'schi', 'encv', 'enca']; + ISOBox.prototype._boxProcessors = {}; + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Generic read/write functions + ISOBox.prototype._procField = function (name, type, size) { + if (this._parsing) { + this[name] = this._readField(type, size); + } + else { + this._writeField(type, size, this[name]); + } + }; + ISOBox.prototype._procFieldArray = function (name, length, type, size) { + var i; + if (this._parsing) { + this[name] = []; + for (i = 0; i < length; i++) { + this[name][i] = this._readField(type, size); + } + } + else { + for (i = 0; i < this[name].length; i++) { + this._writeField(type, size, this[name][i]); + } + } + }; + ISOBox.prototype._procFullBox = function () { + this._procField('version', 'uint', 8); + this._procField('flags', 'uint', 24); + }; + ISOBox.prototype._procEntries = function (name, length, fn) { + var i; + if (this._parsing) { + this[name] = []; + for (i = 0; i < length; i++) { + this[name].push({}); + fn.call(this, this[name][i]); + } + } + else { + for (i = 0; i < length; i++) { + fn.call(this, this[name][i]); + } + } + }; + ISOBox.prototype._procSubEntries = function (entry, name, length, fn) { + var i; + if (this._parsing) { + entry[name] = []; + for (i = 0; i < length; i++) { + entry[name].push({}); + fn.call(this, entry[name][i]); + } + } + else { + for (i = 0; i < length; i++) { + fn.call(this, entry[name][i]); + } + } + }; + ISOBox.prototype._procEntryField = function (entry, name, type, size) { + if (this._parsing) { + entry[name] = this._readField(type, size); + } + else { + this._writeField(type, size, entry[name]); + } + }; + ISOBox.prototype._procSubBoxes = function (name, length) { + var i; + if (this._parsing) { + this[name] = []; + for (i = 0; i < length; i++) { + this[name].push(ISOBox.parse(this)); + } + } + else { + for (i = 0; i < length; i++) { + if (this._rawo) { + this[name][i].write(); + } else { + this.size += this[name][i].getLength(); + } + } + } + }; + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Read/parse functions + ISOBox.prototype._readField = function (type, size) { + switch (type) { + case 'uint': + return this._readUint(size); + case 'int': + return this._readInt(size); + case 'template': + return this._readTemplate(size); + case 'string': + return (size === -1) ? this._readTerminatedString() : this._readString(size); + case 'data': + return this._readData(size); + case 'utf8': + return this._readUTF8String(); + default: + return -1; + } + }; + ISOBox.prototype._readInt = function (size) { + var result = null, + offset = this._cursor.offset - this._raw.byteOffset; + switch (size) { + case 8: + result = this._raw.getInt8(offset); + break; + case 16: + result = this._raw.getInt16(offset); + break; + case 32: + result = this._raw.getInt32(offset); + break; + case 64: + // Warning: JavaScript cannot handle 64-bit integers natively. + // This will give unexpected results for integers >= 2^53 + var s1 = this._raw.getInt32(offset); + var s2 = this._raw.getInt32(offset + 4); + result = (s1 * Math.pow(2, 32)) + s2; + break; + } + this._cursor.offset += (size >> 3); + return result; + }; + ISOBox.prototype._readUint = function (size) { + var result = null, + offset = this._cursor.offset - this._raw.byteOffset, + s1, s2; + switch (size) { + case 8: + result = this._raw.getUint8(offset); + break; + case 16: + result = this._raw.getUint16(offset); + break; + case 24: + s1 = this._raw.getUint16(offset); + s2 = this._raw.getUint8(offset + 2); + result = (s1 << 8) + s2; + break; + case 32: + result = this._raw.getUint32(offset); + break; + case 64: + // Warning: JavaScript cannot handle 64-bit integers natively. + // This will give unexpected results for integers >= 2^53 + s1 = this._raw.getUint32(offset); + s2 = this._raw.getUint32(offset + 4); + result = (s1 * Math.pow(2, 32)) + s2; + break; + } + this._cursor.offset += (size >> 3); + return result; + }; + ISOBox.prototype._readString = function (length) { + var str = ''; + for (var c = 0; c < length; c++) { + var char = this._readUint(8); + str += String.fromCharCode(char); + } + return str; + }; + ISOBox.prototype._readTemplate = function (size) { + var pre = this._readUint(size / 2); + var post = this._readUint(size / 2); + return pre + (post / Math.pow(2, size / 2)); + }; + ISOBox.prototype._readTerminatedString = function () { + var str = ''; + while (this._cursor.offset - this._offset < this._raw.byteLength) { + var char = this._readUint(8); + if (char === 0) break; + str += String.fromCharCode(char); + } + return str; + }; + ISOBox.prototype._readData = function (size) { + var length = (size > 0) ? size : (this._raw.byteLength - (this._cursor.offset - this._offset)); + if (length > 0) { + var data = new Uint8Array(this._raw.buffer, this._cursor.offset, length); + this._cursor.offset += length; + return data; + } + else { + return null; + } + }; + ISOBox.prototype._readUTF8String = function () { + var length = this._raw.byteLength - (this._cursor.offset - this._offset); + var data = null; + if (length > 0) { + data = new DataView(this._raw.buffer, this._cursor.offset, length); + this._cursor.offset += length; + } + return data ? ISOBoxer.Utils.dataViewToString(data) : data; + }; + ISOBox.prototype._parseBox = function () { + this._parsing = true; + this._cursor.offset = this._offset; + // return immediately if there are not enough bytes to read the header + if (this._offset + 8 > this._raw.buffer.byteLength) { + this._root._incomplete = true; + return; + } + this._procField('size', 'uint', 32); + this._procField('type', 'string', 4); + if (this.size === 1) { this._procField('largesize', 'uint', 64); } + if (this.type === 'uuid') { this._procFieldArray('usertype', 16, 'uint', 8); } + switch (this.size) { + case 0: + this._raw = new DataView(this._raw.buffer, this._offset, (this._raw.byteLength - this._cursor.offset + 8)); + break; + case 1: + if (this._offset + this.size > this._raw.buffer.byteLength) { + this._incomplete = true; + this._root._incomplete = true; + } else { + this._raw = new DataView(this._raw.buffer, this._offset, this.largesize); + } + break; + default: + if (this._offset + this.size > this._raw.buffer.byteLength) { + this._incomplete = true; + this._root._incomplete = true; + } else { + this._raw = new DataView(this._raw.buffer, this._offset, this.size); + } + } + // additional parsing + if (!this._incomplete) { + if (this._boxProcessors[this.type]) { + this._boxProcessors[this.type].call(this); + } + if (this._boxContainers.indexOf(this.type) !== -1) { + this._parseContainerBox(); + } else { + // Unknown box => read and store box content + this._data = this._readData(); + } + } + }; + ISOBox.prototype._parseFullBox = function () { + this.version = this._readUint(8); + this.flags = this._readUint(24); + }; + ISOBox.prototype._parseContainerBox = function () { + this.boxes = []; + while (this._cursor.offset - this._raw.byteOffset < this._raw.byteLength) { + this.boxes.push(ISOBox.parse(this)); + } + }; + /////////////////////////////////////////////////////////////////////////////////////////////////// + // Write functions + ISOBox.prototype.append = function (box, pos) { + ISOBoxer.Utils.appendBox(this, box, pos); + }; + ISOBox.prototype.getLength = function () { + this._parsing = false; + this._rawo = null; + this.size = 0; + this._procField('size', 'uint', 32); + this._procField('type', 'string', 4); + if (this.size === 1) { this._procField('largesize', 'uint', 64); } + if (this.type === 'uuid') { this._procFieldArray('usertype', 16, 'uint', 8); } + if (this._boxProcessors[this.type]) { + this._boxProcessors[this.type].call(this); + } + if (this._boxContainers.indexOf(this.type) !== -1) { + for (var i = 0; i < this.boxes.length; i++) { + this.size += this.boxes[i].getLength(); + } + } + if (this._data) { + this._writeData(this._data); + } + return this.size; + }; + ISOBox.prototype.write = function () { + this._parsing = false; + this._cursor.offset = this._parent._cursor.offset; + switch (this.size) { + case 0: + this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, (this.parent._rawo.byteLength - this._cursor.offset)); + break; + case 1: + this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, this.largesize); + break; + default: + this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, this.size); + } + this._procField('size', 'uint', 32); + this._procField('type', 'string', 4); + if (this.size === 1) { this._procField('largesize', 'uint', 64); } + if (this.type === 'uuid') { this._procFieldArray('usertype', 16, 'uint', 8); } + if (this._boxProcessors[this.type]) { + this._boxProcessors[this.type].call(this); + } + if (this._boxContainers.indexOf(this.type) !== -1) { + for (var i = 0; i < this.boxes.length; i++) { + this.boxes[i].write(); + } + } + if (this._data) { + this._writeData(this._data); + } + this._parent._cursor.offset += this.size; + return this.size; + }; + ISOBox.prototype._writeInt = function (size, value) { + if (this._rawo) { + var offset = this._cursor.offset - this._rawo.byteOffset; + switch (size) { + case 8: + this._rawo.setInt8(offset, value); + break; + case 16: + this._rawo.setInt16(offset, value); + break; + case 32: + this._rawo.setInt32(offset, value); + break; + case 64: + // Warning: JavaScript cannot handle 64-bit integers natively. + // This will give unexpected results for integers >= 2^53 + var s1 = Math.floor(value / Math.pow(2, 32)); + var s2 = value - (s1 * Math.pow(2, 32)); + this._rawo.setUint32(offset, s1); + this._rawo.setUint32(offset + 4, s2); + break; + } + this._cursor.offset += (size >> 3); + } else { + this.size += (size >> 3); + } + }; + ISOBox.prototype._writeUint = function (size, value) { + if (this._rawo) { + var offset = this._cursor.offset - this._rawo.byteOffset, + s1, s2; + switch (size) { + case 8: + this._rawo.setUint8(offset, value); + break; + case 16: + this._rawo.setUint16(offset, value); + break; + case 24: + s1 = (value & 0xFFFF00) >> 8; + s2 = (value & 0x0000FF); + this._rawo.setUint16(offset, s1); + this._rawo.setUint8(offset + 2, s2); + break; + case 32: + this._rawo.setUint32(offset, value); + break; + case 64: + // Warning: JavaScript cannot handle 64-bit integers natively. + // This will give unexpected results for integers >= 2^53 + s1 = Math.floor(value / Math.pow(2, 32)); + s2 = value - (s1 * Math.pow(2, 32)); + this._rawo.setUint32(offset, s1); + this._rawo.setUint32(offset + 4, s2); + break; + } + this._cursor.offset += (size >> 3); + } else { + this.size += (size >> 3); + } + }; + ISOBox.prototype._writeString = function (size, str) { + for (var c = 0; c < size; c++) { + this._writeUint(8, str.charCodeAt(c)); + } + }; + ISOBox.prototype._writeTerminatedString = function (str) { + if (str.length === 0) { + return; + } + for (var c = 0; c < str.length; c++) { + this._writeUint(8, str.charCodeAt(c)); + } + this._writeUint(8, 0); + }; + ISOBox.prototype._writeTemplate = function (size, value) { + var pre = Math.floor(value); + var post = (value - pre) * Math.pow(2, size / 2); + this._writeUint(size / 2, pre); + this._writeUint(size / 2, post); + }; + ISOBox.prototype._writeData = function (data) { + var i; + //data to copy + if (data) { + if (this._rawo) { + //Array and Uint8Array has also to be managed + if (data instanceof Array) { + var offset = this._cursor.offset - this._rawo.byteOffset; + for (var i = 0; i < data.length; i++) { + this._rawo.setInt8(offset + i, data[i]); + } + this._cursor.offset += data.length; + } + if (data instanceof Uint8Array) { + this._root.bytes.set(data, this._cursor.offset); + this._cursor.offset += data.length; + } + } else { + //nothing to copy only size to compute + this.size += data.length; + } + } + }; + ISOBox.prototype._writeUTF8String = function (string) { + var u = ISOBoxer.Utils.utf8ToByteArray(string); + if (this._rawo) { + var dataView = new DataView(this._rawo.buffer, this._cursor.offset, u.length); + for (var i = 0; i < u.length; i++) { + dataView.setUint8(i, u[i]); + } + } else { + this.size += u.length; + } + }; + ISOBox.prototype._writeField = function (type, size, value) { + switch (type) { + case 'uint': + this._writeUint(size, value); + break; + case 'int': + this._writeInt(size, value); + break; + case 'template': + this._writeTemplate(size, value); + break; + case 'string': + if (size == -1) { + this._writeTerminatedString(value); + } else { + this._writeString(size, value); + } + break; + case 'data': + this._writeData(value); + break; + case 'utf8': + this._writeUTF8String(value); + break; + default: + break; + } + }; + // ISO/IEC 14496-15:2014 - avc1 box + ISOBox.prototype._boxProcessors['avc1'] = ISOBox.prototype._boxProcessors['encv'] = function () { + // SampleEntry fields + this._procFieldArray('reserved1', 6, 'uint', 8); + this._procField('data_reference_index', 'uint', 16); + // VisualSampleEntry fields + this._procField('pre_defined1', 'uint', 16); + this._procField('reserved2', 'uint', 16); + this._procFieldArray('pre_defined2', 3, 'uint', 32); + this._procField('width', 'uint', 16); + this._procField('height', 'uint', 16); + this._procField('horizresolution', 'template', 32); + this._procField('vertresolution', 'template', 32); + this._procField('reserved3', 'uint', 32); + this._procField('frame_count', 'uint', 16); + this._procFieldArray('compressorname', 32, 'uint', 8); + this._procField('depth', 'uint', 16); + this._procField('pre_defined3', 'int', 16); + // AVCSampleEntry fields + this._procField('config', 'data', -1); + }; + // ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box + ISOBox.prototype._boxProcessors['dref'] = function () { + this._procFullBox(); + this._procField('entry_count', 'uint', 32); + this._procSubBoxes('entries', this.entry_count); + }; + // ISO/IEC 14496-12:2012 - 8.6.6 Edit List Box + ISOBox.prototype._boxProcessors['elst'] = function () { + this._procFullBox(); + this._procField('entry_count', 'uint', 32); + this._procEntries('entries', this.entry_count, function (entry) { + this._procEntryField(entry, 'segment_duration', 'uint', (this.version === 1) ? 64 : 32); + this._procEntryField(entry, 'media_time', 'int', (this.version === 1) ? 64 : 32); + this._procEntryField(entry, 'media_rate_integer', 'int', 16); + this._procEntryField(entry, 'media_rate_fraction', 'int', 16); + }); + }; + // ISO/IEC 23009-1:2014 - 5.10.3.3 Event Message Box + ISOBox.prototype._boxProcessors['emsg'] = function () { + this._procFullBox(); + if (this.version == 1) { + this._procField('timescale', 'uint', 32); + this._procField('presentation_time', 'uint', 64); + this._procField('event_duration', 'uint', 32); + this._procField('id', 'uint', 32); + this._procField('scheme_id_uri', 'string', -1); + this._procField('value', 'string', -1); + } else { + this._procField('scheme_id_uri', 'string', -1); + this._procField('value', 'string', -1); + this._procField('timescale', 'uint', 32); + this._procField('presentation_time_delta', 'uint', 32); + this._procField('event_duration', 'uint', 32); + this._procField('id', 'uint', 32); + } + this._procField('message_data', 'data', -1); + }; + // ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box + ISOBox.prototype._boxProcessors['free'] = ISOBox.prototype._boxProcessors['skip'] = function () { + this._procField('data', 'data', -1); + }; + // ISO/IEC 14496-12:2012 - 8.12.2 Original Format Box + ISOBox.prototype._boxProcessors['frma'] = function () { + this._procField('data_format', 'uint', 32); + }; + // ISO/IEC 14496-12:2012 - 4.3 File Type Box / 8.16.2 Segment Type Box + ISOBox.prototype._boxProcessors['ftyp'] = + ISOBox.prototype._boxProcessors['styp'] = function () { + this._procField('major_brand', 'string', 4); + this._procField('minor_version', 'uint', 32); + var nbCompatibleBrands = -1; + if (this._parsing) { + nbCompatibleBrands = (this._raw.byteLength - (this._cursor.offset - this._raw.byteOffset)) / 4; + } + this._procFieldArray('compatible_brands', nbCompatibleBrands, 'string', 4); + }; + // ISO/IEC 14496-12:2012 - 8.4.3 Handler Reference Box + ISOBox.prototype._boxProcessors['hdlr'] = function () { + this._procFullBox(); + this._procField('pre_defined', 'uint', 32); + this._procField('handler_type', 'string', 4); + this._procFieldArray('reserved', 3, 'uint', 32); + this._procField('name', 'string', -1); + }; + // ISO/IEC 14496-12:2012 - 8.1.1 Media Data Box + ISOBox.prototype._boxProcessors['mdat'] = function () { + this._procField('data', 'data', -1); + }; + // ISO/IEC 14496-12:2012 - 8.4.2 Media Header Box + ISOBox.prototype._boxProcessors['mdhd'] = function () { + this._procFullBox(); + this._procField('creation_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('modification_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('timescale', 'uint', 32); + this._procField('duration', 'uint', (this.version == 1) ? 64 : 32); + if (!this._parsing && typeof this.language === 'string') { + // In case of writing and language has been set as a string, then convert it into char codes array + this.language = ((this.language.charCodeAt(0) - 0x60) << 10) | + ((this.language.charCodeAt(1) - 0x60) << 5) | + ((this.language.charCodeAt(2) - 0x60)); + } + this._procField('language', 'uint', 16); + if (this._parsing) { + this.language = String.fromCharCode(((this.language >> 10) & 0x1F) + 0x60, + ((this.language >> 5) & 0x1F) + 0x60, + (this.language & 0x1F) + 0x60); + } + this._procField('pre_defined', 'uint', 16); + }; + // ISO/IEC 14496-12:2012 - 8.8.2 Movie Extends Header Box + ISOBox.prototype._boxProcessors['mehd'] = function () { + this._procFullBox(); + this._procField('fragment_duration', 'uint', (this.version == 1) ? 64 : 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.5 Movie Fragment Header Box + ISOBox.prototype._boxProcessors['mfhd'] = function () { + this._procFullBox(); + this._procField('sequence_number', 'uint', 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.11 Movie Fragment Random Access Box + ISOBox.prototype._boxProcessors['mfro'] = function () { + this._procFullBox(); + this._procField('mfra_size', 'uint', 32); // Called mfra_size to distinguish from the normal "size" attribute of a box + }; + // ISO/IEC 14496-12:2012 - 8.5.2.2 mp4a box (use AudioSampleEntry definition and naming) + ISOBox.prototype._boxProcessors['mp4a'] = ISOBox.prototype._boxProcessors['enca'] = function () { + // SampleEntry fields + this._procFieldArray('reserved1', 6, 'uint', 8); + this._procField('data_reference_index', 'uint', 16); + // AudioSampleEntry fields + this._procFieldArray('reserved2', 2, 'uint', 32); + this._procField('channelcount', 'uint', 16); + this._procField('samplesize', 'uint', 16); + this._procField('pre_defined', 'uint', 16); + this._procField('reserved3', 'uint', 16); + this._procField('samplerate', 'template', 32); + // ESDescriptor fields + this._procField('esds', 'data', -1); + }; + // ISO/IEC 14496-12:2012 - 8.2.2 Movie Header Box + ISOBox.prototype._boxProcessors['mvhd'] = function () { + this._procFullBox(); + this._procField('creation_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('modification_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('timescale', 'uint', 32); + this._procField('duration', 'uint', (this.version == 1) ? 64 : 32); + this._procField('rate', 'template', 32); + this._procField('volume', 'template', 16); + this._procField('reserved1', 'uint', 16); + this._procFieldArray('reserved2', 2, 'uint', 32); + this._procFieldArray('matrix', 9, 'template', 32); + this._procFieldArray('pre_defined', 6, 'uint', 32); + this._procField('next_track_ID', 'uint', 32); + }; + // ISO/IEC 14496-30:2014 - WebVTT Cue Payload Box. + ISOBox.prototype._boxProcessors['payl'] = function () { + this._procField('cue_text', 'utf8'); + }; + //ISO/IEC 23001-7:2011 - 8.1 Protection System Specific Header Box + ISOBox.prototype._boxProcessors['pssh'] = function () { + this._procFullBox(); + this._procFieldArray('SystemID', 16, 'uint', 8); + this._procField('DataSize', 'uint', 32); + this._procFieldArray('Data', this.DataSize, 'uint', 8); + }; + // ISO/IEC 14496-12:2012 - 8.12.5 Scheme Type Box + ISOBox.prototype._boxProcessors['schm'] = function () { + this._procFullBox(); + this._procField('scheme_type', 'uint', 32); + this._procField('scheme_version', 'uint', 32); + if (this.flags & 0x000001) { + this._procField('scheme_uri', 'string', -1); + } + }; + // ISO/IEC 14496-12:2012 - 8.6.4.1 sdtp box + ISOBox.prototype._boxProcessors['sdtp'] = function () { + this._procFullBox(); + var sample_count = -1; + if (this._parsing) { + sample_count = (this._raw.byteLength - (this._cursor.offset - this._raw.byteOffset)); + } + this._procFieldArray('sample_dependency_table', sample_count, 'uint', 8); + }; + // ISO/IEC 14496-12:2012 - 8.16.3 Segment Index Box + ISOBox.prototype._boxProcessors['sidx'] = function () { + this._procFullBox(); + this._procField('reference_ID', 'uint', 32); + this._procField('timescale', 'uint', 32); + this._procField('earliest_presentation_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('first_offset', 'uint', (this.version == 1) ? 64 : 32); + this._procField('reserved', 'uint', 16); + this._procField('reference_count', 'uint', 16); + this._procEntries('references', this.reference_count, function (entry) { + if (!this._parsing) { + entry.reference = (entry.reference_type & 0x00000001) << 31; + entry.reference |= (entry.referenced_size & 0x7FFFFFFF); + entry.sap = (entry.starts_with_SAP & 0x00000001) << 31; + entry.sap |= (entry.SAP_type & 0x00000003) << 28; + entry.sap |= (entry.SAP_delta_time & 0x0FFFFFFF); + } + this._procEntryField(entry, 'reference', 'uint', 32); + this._procEntryField(entry, 'subsegment_duration', 'uint', 32); + this._procEntryField(entry, 'sap', 'uint', 32); + if (this._parsing) { + entry.reference_type = (entry.reference >> 31) & 0x00000001; + entry.referenced_size = entry.reference & 0x7FFFFFFF; + entry.starts_with_SAP = (entry.sap >> 31) & 0x00000001; + entry.SAP_type = (entry.sap >> 28) & 0x00000007; + entry.SAP_delta_time = (entry.sap & 0x0FFFFFFF); + } + }); + }; + // ISO/IEC 14496-12:2012 - 8.4.5.3 Sound Media Header Box + ISOBox.prototype._boxProcessors['smhd'] = function () { + this._procFullBox(); + this._procField('balance', 'uint', 16); + this._procField('reserved', 'uint', 16); + }; + // ISO/IEC 14496-12:2012 - 8.16.4 Subsegment Index Box + ISOBox.prototype._boxProcessors['ssix'] = function () { + this._procFullBox(); + this._procField('subsegment_count', 'uint', 32); + this._procEntries('subsegments', this.subsegment_count, function (subsegment) { + this._procEntryField(subsegment, 'ranges_count', 'uint', 32); + this._procSubEntries(subsegment, 'ranges', subsegment.ranges_count, function (range) { + this._procEntryField(range, 'level', 'uint', 8); + this._procEntryField(range, 'range_size', 'uint', 24); + }); + }); + }; + // ISO/IEC 14496-12:2012 - 8.5.2 Sample Description Box + ISOBox.prototype._boxProcessors['stsd'] = function () { + this._procFullBox(); + this._procField('entry_count', 'uint', 32); + this._procSubBoxes('entries', this.entry_count); + }; + // ISO/IEC 14496-12:2015 - 8.7.7 Sub-Sample Information Box + ISOBox.prototype._boxProcessors['subs'] = function () { + this._procFullBox(); + this._procField('entry_count', 'uint', 32); + this._procEntries('entries', this.entry_count, function (entry) { + this._procEntryField(entry, 'sample_delta', 'uint', 32); + this._procEntryField(entry, 'subsample_count', 'uint', 16); + this._procSubEntries(entry, 'subsamples', entry.subsample_count, function (subsample) { + this._procEntryField(subsample, 'subsample_size', 'uint', (this.version === 1) ? 32 : 16); + this._procEntryField(subsample, 'subsample_priority', 'uint', 8); + this._procEntryField(subsample, 'discardable', 'uint', 8); + this._procEntryField(subsample, 'codec_specific_parameters', 'uint', 32); + }); + }); + }; + //ISO/IEC 23001-7:2011 - 8.2 Track Encryption Box + ISOBox.prototype._boxProcessors['tenc'] = function () { + this._procFullBox(); + this._procField('default_IsEncrypted', 'uint', 24); + this._procField('default_IV_size', 'uint', 8); + this._procFieldArray('default_KID', 16, 'uint', 8); + }; + // ISO/IEC 14496-12:2012 - 8.8.12 Track Fragmnent Decode Time + ISOBox.prototype._boxProcessors['tfdt'] = function () { + this._procFullBox(); + this._procField('baseMediaDecodeTime', 'uint', (this.version == 1) ? 64 : 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.7 Track Fragment Header Box + ISOBox.prototype._boxProcessors['tfhd'] = function () { + this._procFullBox(); + this._procField('track_ID', 'uint', 32); + if (this.flags & 0x01) this._procField('base_data_offset', 'uint', 64); + if (this.flags & 0x02) this._procField('sample_description_offset', 'uint', 32); + if (this.flags & 0x08) this._procField('default_sample_duration', 'uint', 32); + if (this.flags & 0x10) this._procField('default_sample_size', 'uint', 32); + if (this.flags & 0x20) this._procField('default_sample_flags', 'uint', 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.10 Track Fragment Random Access Box + ISOBox.prototype._boxProcessors['tfra'] = function () { + this._procFullBox(); + this._procField('track_ID', 'uint', 32); + if (!this._parsing) { + this.reserved = 0; + this.reserved |= (this.length_size_of_traf_num & 0x00000030) << 4; + this.reserved |= (this.length_size_of_trun_num & 0x0000000C) << 2; + this.reserved |= (this.length_size_of_sample_num & 0x00000003); + } + this._procField('reserved', 'uint', 32); + if (this._parsing) { + this.length_size_of_traf_num = (this.reserved & 0x00000030) >> 4; + this.length_size_of_trun_num = (this.reserved & 0x0000000C) >> 2; + this.length_size_of_sample_num = (this.reserved & 0x00000003); + } + this._procField('number_of_entry', 'uint', 32); + this._procEntries('entries', this.number_of_entry, function (entry) { + this._procEntryField(entry, 'time', 'uint', (this.version === 1) ? 64 : 32); + this._procEntryField(entry, 'moof_offset', 'uint', (this.version === 1) ? 64 : 32); + this._procEntryField(entry, 'traf_number', 'uint', (this.length_size_of_traf_num + 1) * 8); + this._procEntryField(entry, 'trun_number', 'uint', (this.length_size_of_trun_num + 1) * 8); + this._procEntryField(entry, 'sample_number', 'uint', (this.length_size_of_sample_num + 1) * 8); + }); + }; + // ISO/IEC 14496-12:2012 - 8.3.2 Track Header Box + ISOBox.prototype._boxProcessors['tkhd'] = function () { + this._procFullBox(); + this._procField('creation_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('modification_time', 'uint', (this.version == 1) ? 64 : 32); + this._procField('track_ID', 'uint', 32); + this._procField('reserved1', 'uint', 32); + this._procField('duration', 'uint', (this.version == 1) ? 64 : 32); + this._procFieldArray('reserved2', 2, 'uint', 32); + this._procField('layer', 'uint', 16); + this._procField('alternate_group', 'uint', 16); + this._procField('volume', 'template', 16); + this._procField('reserved3', 'uint', 16); + this._procFieldArray('matrix', 9, 'template', 32); + this._procField('width', 'template', 32); + this._procField('height', 'template', 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.3 Track Extends Box + ISOBox.prototype._boxProcessors['trex'] = function () { + this._procFullBox(); + this._procField('track_ID', 'uint', 32); + this._procField('default_sample_description_index', 'uint', 32); + this._procField('default_sample_duration', 'uint', 32); + this._procField('default_sample_size', 'uint', 32); + this._procField('default_sample_flags', 'uint', 32); + }; + // ISO/IEC 14496-12:2012 - 8.8.8 Track Run Box + // Note: the 'trun' box has a direct relation to the 'tfhd' box for defaults. + // These defaults are not set explicitly here, but are left to resolve for the user. + ISOBox.prototype._boxProcessors['trun'] = function () { + this._procFullBox(); + this._procField('sample_count', 'uint', 32); + if (this.flags & 0x1) this._procField('data_offset', 'int', 32); + if (this.flags & 0x4) this._procField('first_sample_flags', 'uint', 32); + this._procEntries('samples', this.sample_count, function (sample) { + if (this.flags & 0x100) this._procEntryField(sample, 'sample_duration', 'uint', 32); + if (this.flags & 0x200) this._procEntryField(sample, 'sample_size', 'uint', 32); + if (this.flags & 0x400) this._procEntryField(sample, 'sample_flags', 'uint', 32); + if (this.flags & 0x800) this._procEntryField(sample, 'sample_composition_time_offset', (this.version === 1) ? 'int' : 'uint', 32); + }); + }; + // ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box + ISOBox.prototype._boxProcessors['url '] = ISOBox.prototype._boxProcessors['urn '] = function () { + this._procFullBox(); + if (this.type === 'urn ') { + this._procField('name', 'string', -1); + } + this._procField('location', 'string', -1); + }; + // ISO/IEC 14496-30:2014 - WebVTT Source Label Box + ISOBox.prototype._boxProcessors['vlab'] = function () { + this._procField('source_label', 'utf8'); + }; + // ISO/IEC 14496-12:2012 - 8.4.5.2 Video Media Header Box + ISOBox.prototype._boxProcessors['vmhd'] = function () { + this._procFullBox(); + this._procField('graphicsmode', 'uint', 16); + this._procFieldArray('opcolor', 3, 'uint', 16); + }; + // ISO/IEC 14496-30:2014 - WebVTT Configuration Box + ISOBox.prototype._boxProcessors['vttC'] = function () { + this._procField('config', 'utf8'); + }; + // ISO/IEC 14496-30:2014 - WebVTT Empty Sample Box + ISOBox.prototype._boxProcessors['vtte'] = function () { + // Nothing should happen here. + }; + /***/ +}), +/***/ "./node_modules/core-util-is/lib/util.js": +/*!***********************************************!*\ + !*** ./node_modules/core-util-is/lib/util.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { +/* WEBPACK VAR INJECTION */(function (Buffer) {// Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; + } + exports.isArray = isArray; + function isBoolean(arg) { + return typeof arg === 'boolean'; + } + exports.isBoolean = isBoolean; + function isNull(arg) { + return arg === null; + } + exports.isNull = isNull; + function isNullOrUndefined(arg) { + return arg == null; + } + exports.isNullOrUndefined = isNullOrUndefined; + function isNumber(arg) { + return typeof arg === 'number'; + } + exports.isNumber = isNumber; + function isString(arg) { + return typeof arg === 'string'; + } + exports.isString = isString; + function isSymbol(arg) { + return typeof arg === 'symbol'; + } + exports.isSymbol = isSymbol; + function isUndefined(arg) { + return arg === void 0; + } + exports.isUndefined = isUndefined; + function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; + } + exports.isRegExp = isRegExp; + function isObject(arg) { + return typeof arg === 'object' && arg !== null; + } + exports.isObject = isObject; + function isDate(d) { + return objectToString(d) === '[object Date]'; + } + exports.isDate = isDate; + function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); + } + exports.isError = isError; + function isFunction(arg) { + return typeof arg === 'function'; + } + exports.isFunction = isFunction; + function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; + } + exports.isPrimitive = isPrimitive; + exports.isBuffer = Buffer.isBuffer; + function objectToString(o) { + return Object.prototype.toString.call(o); + } + /* WEBPACK VAR INJECTION */ +}.call(this, __webpack_require__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */ "./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer)) + /***/ +}), +/***/ "./node_modules/es6-promise/auto.js": +/*!******************************************!*\ + !*** ./node_modules/es6-promise/auto.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + // This file can be required in Browserify and Node.js for automatic polyfill + // To use it: require('es6-promise/auto'); + module.exports = __webpack_require__(/*! ./ */ "./node_modules/es6-promise/dist/es6-promise.js").polyfill(); + /***/ +}), +/***/ "./node_modules/es6-promise/dist/es6-promise.js": +/*!******************************************************!*\ + !*** ./node_modules/es6-promise/dist/es6-promise.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { +/* WEBPACK VAR INJECTION */(function (process, global) {/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + (function (global, factory) { + true ? module.exports = factory() : + undefined; + }(this, (function () { + 'use strict'; + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + function isFunction(x) { + return typeof x === 'function'; + } + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + var isArray = _isArray; + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + function setAsap(asapFn) { + asap = asapFn; + } + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + return useSetTimeout(); + } + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + return function () { + node.data = iterations = ++iterations % 2; + }; + } + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + callback(arg); + queue[i] = undefined; + queue[i + 1] = undefined; + } + len = 0; + } + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && "function" === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + function then(onFulfillment, onRejection) { + var parent = this; + var child = new this.constructor(noop); + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + var _state = parent._state; + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + return child; + } + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + promise.then(function(value){ + // value === 1 + }); + ``` + Instead of writing the above, your code now simply becomes the following: + ```javascript + let promise = Promise.resolve(1); + promise.then(function(value){ + // value === 1 + }); + ``` + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + var PROMISE_ID = Math.random().toString(36).substring(2); + function noop() { } + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + publish(promise); + } + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + promise._result = value; + promise._state = FULFILLED; + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + asap(publishRejection, promise); + } + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + parent._onerror = null; + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + if (subscribers.length === 0) { + return; + } + var child = void 0, + callback = void 0, + detail = promise._result; + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + promise._subscribers.length = 0; + } + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + var id = 0; + function nextId() { + return id++; + } + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + this._result = new Array(this.length); + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + if (promise._state === PENDING) { + this._remaining--; + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + return Enumerator; + }(); + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + Example: + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + Example: + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + Example: + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + An example real-world use case is implementing timeouts: + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + Instead of writing the above, your code now simply becomes the following: + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + Terminology + ----------- + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + A promise can be in one of three states: pending, fulfilled, or rejected. + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + Basic Usage: + ------------ + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + // on failure + reject(reason); + }); + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + Advanced Usage: + --------------- + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + Unlike callbacks, promises are great composable primitives. + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + return values; + }); + ``` + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + Synchronous example: + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + Asynchronous example: + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + @method finally + @param {Function} callback + @return {Promise} + */ + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + return promise.then(callback, callback); + }; + return Promise; + }(); + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + /*global self*/ + function polyfill() { + var local = void 0; + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + var P = local.Promise; + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + local.Promise = Promise$1; + } + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + return Promise$1; + }))); + //# sourceMappingURL=es6-promise.map + /* WEBPACK VAR INJECTION */ +}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + /***/ +}), +/***/ "./node_modules/fast-deep-equal/index.js": +/*!***********************************************!*\ + !*** ./node_modules/fast-deep-equal/index.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + "use strict"; + var isArray = Array.isArray; + var keyList = Object.keys; + var hasProp = Object.prototype.hasOwnProperty; + module.exports = function equal(a, b) { + if (a === b) return true; + if (a && b && typeof a == 'object' && typeof b == 'object') { + var arrA = isArray(a) + , arrB = isArray(b) + , i + , length + , key; + if (arrA && arrB) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + if (arrA != arrB) return false; + var dateA = a instanceof Date + , dateB = b instanceof Date; + if (dateA != dateB) return false; + if (dateA && dateB) return a.getTime() == b.getTime(); + var regexpA = a instanceof RegExp + , regexpB = b instanceof RegExp; + if (regexpA != regexpB) return false; + if (regexpA && regexpB) return a.toString() == b.toString(); + var keys = keyList(a); + length = keys.length; + if (length !== keyList(b).length) + return false; + for (i = length; i-- !== 0;) + if (!hasProp.call(b, keys[i])) return false; + for (i = length; i-- !== 0;) { + key = keys[i]; + if (!equal(a[key], b[key])) return false; + } + return true; + } + return a !== a && b !== b; + }; + /***/ +}), +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function (module, exports) { + exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + i += d + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) { } + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) { } + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) + } + exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + value = Math.abs(value) + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) { } + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) { } + buffer[offset + i - d] |= s * 128 + } + /***/ +}), +/***/ "./node_modules/imsc/src/main/js/doc.js": +/*!**********************************************!*\ + !*** ./node_modules/imsc/src/main/js/doc.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function (module, exports, __webpack_require__) { + /* + * Copyright (c) 2016, Pierre-Anthony Lemieux + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + /** + * @module imscDoc + */ + ; + (function (imscDoc, sax, imscNames, imscStyles, imscUtils) { + /** + * Allows a client to provide callbacks to handle children of the element + * @typedef {Object} MetadataHandler + * @property {?OpenTagCallBack} onOpenTag + * @property {?CloseTagCallBack} onCloseTag + * @property {?TextCallBack} onText + */ + /** + * Called when the opening tag of an element node is encountered. + * @callback OpenTagCallBack + * @param {string} ns Namespace URI of the element + * @param {string} name Local name of the element + * @param {Object[]} attributes List of attributes, each consisting of a + * `uri`, `name` and `value` + */ + /** + * Called when the closing tag of an element node is encountered. + * @callback CloseTagCallBack + */ + /** + * Called when a text node is encountered. + * @callback TextCallBack + * @param {string} contents Contents of the text node + */ + /** + * Parses an IMSC1 document into an opaque in-memory representation that exposes + * a single method
getMediaTimeEvents()
that returns a list of time + * offsets (in seconds) of the ISD, i.e. the points in time where the visual + * representation of the document change. `metadataHandler` allows the caller to + * be called back when nodes are present in elements. + * + * @param {string} xmlstring XML document + * @param {?module:imscUtils.ErrorHandler} errorHandler Error callback + * @param {?MetadataHandler} metadataHandler Callback for elements + * @returns {Object} Opaque in-memory representation of an IMSC1 document + */ + imscDoc.fromXML = function (xmlstring, errorHandler, metadataHandler) { + var p = sax.parser(true, { xmlns: true }); + var estack = []; + var xmllangstack = []; + var xmlspacestack = []; + var metadata_depth = 0; + var doc = null; + p.onclosetag = function (node) { + if (estack[0] instanceof Styling) { + /* flatten chained referential styling */ + for (var sid in estack[0].styles) { + mergeChainedStyles(estack[0], estack[0].styles[sid], errorHandler); + } + } else if (estack[0] instanceof P || estack[0] instanceof Span) { + /* merge anonymous spans */ + if (estack[0].contents.length > 1) { + var cs = [estack[0].contents[0]]; + var c; + for (c = 1; c < estack[0].contents.length; c++) { + if (estack[0].contents[c] instanceof AnonymousSpan && + cs[cs.length - 1] instanceof AnonymousSpan) { + cs[cs.length - 1].text += estack[0].contents[c].text; + } else { + cs.push(estack[0].contents[c]); + } + } + estack[0].contents = cs; + } + // remove redundant nested anonymous spans (9.3.3(1)(c)) + if (estack[0] instanceof Span && + estack[0].contents.length === 1 && + estack[0].contents[0] instanceof AnonymousSpan) { + estack[0].text = estack[0].contents[0].text; + delete estack[0].contents; + } + } else if (estack[0] instanceof ForeignElement) { + if (estack[0].node.uri === imscNames.ns_tt && + estack[0].node.local === 'metadata') { + /* leave the metadata element */ + metadata_depth--; + } else if (metadata_depth > 0 && + metadataHandler && + 'onCloseTag' in metadataHandler) { + /* end of child of metadata element */ + metadataHandler.onCloseTag(); + } + } + // TODO: delete stylerefs? + // maintain the xml:space stack + xmlspacestack.shift(); + // maintain the xml:lang stack + xmllangstack.shift(); + // prepare for the next element + estack.shift(); + }; + p.ontext = function (str) { + if (estack[0] === undefined) { + /* ignoring text outside of elements */ + } else if (estack[0] instanceof Span || estack[0] instanceof P) { + /* create an anonymous span */ + var s = new AnonymousSpan(); + s.initFromText(doc, estack[0], str, xmlspacestack[0], errorHandler); + estack[0].contents.push(s); + } else if (estack[0] instanceof ForeignElement && + metadata_depth > 0 && + metadataHandler && + 'onText' in metadataHandler) { + /* text node within a child of metadata element */ + metadataHandler.onText(str); + } + }; + p.onopentag = function (node) { + // maintain the xml:space stack + var xmlspace = node.attributes["xml:space"]; + if (xmlspace) { + xmlspacestack.unshift(xmlspace.value); + } else { + if (xmlspacestack.length === 0) { + xmlspacestack.unshift("default"); + } else { + xmlspacestack.unshift(xmlspacestack[0]); + } + } + /* maintain the xml:lang stack */ + var xmllang = node.attributes["xml:lang"]; + if (xmllang) { + xmllangstack.unshift(xmllang.value); + } else { + if (xmllangstack.length === 0) { + xmllangstack.unshift(""); + } else { + xmllangstack.unshift(xmllangstack[0]); + } + } + /* process the element */ + if (node.uri === imscNames.ns_tt) { + if (node.local === 'tt') { + if (doc !== null) { + reportFatal(errorHandler, "Two elements at (" + this.line + "," + this.column + ")"); + } + doc = new TT(); + doc.initFromNode(node, errorHandler); + estack.unshift(doc); + } else if (node.local === 'head') { + if (!(estack[0] instanceof TT)) { + reportFatal(errorHandler, "Parent of element is not at (" + this.line + "," + this.column + ")"); + } + if (doc.head !== null) { + reportFatal("Second element at (" + this.line + "," + this.column + ")"); + } + doc.head = new Head(); + estack.unshift(doc.head); + } else if (node.local === 'styling') { + if (!(estack[0] instanceof Head)) { + reportFatal(errorHandler, "Parent of element is not at (" + this.line + "," + this.column + ")"); + } + if (doc.head.styling !== null) { + reportFatal("Second element at (" + this.line + "," + this.column + ")"); + } + doc.head.styling = new Styling(); + estack.unshift(doc.head.styling); + } else if (node.local === 'style') { + var s; + if (estack[0] instanceof Styling) { + s = new Style(); + s.initFromNode(node, errorHandler); + /* ignore