@shopify/shop-minis-react 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/___vite-browser-external.js +7 -0
- package/dist/_virtual/___vite-browser-external.js.map +1 -0
- package/dist/_virtual/__vite-browser-external.js +5 -0
- package/dist/_virtual/__vite-browser-external.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +24 -4
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/_virtual/browser-index.js +8 -0
- package/dist/_virtual/browser-index.js.map +1 -0
- package/dist/_virtual/browser-index2.js +5 -0
- package/dist/_virtual/browser-index2.js.map +1 -0
- package/dist/_virtual/clock.js +6 -0
- package/dist/_virtual/clock.js.map +1 -0
- package/dist/_virtual/conventions.js +5 -0
- package/dist/_virtual/conventions.js.map +1 -0
- package/dist/_virtual/document.js +8 -0
- package/dist/_virtual/document.js.map +1 -0
- package/dist/_virtual/dom-parser.js +5 -0
- package/dist/_virtual/dom-parser.js.map +1 -0
- package/dist/_virtual/dom.js +5 -0
- package/dist/_virtual/dom.js.map +1 -0
- package/dist/_virtual/entities.js +5 -0
- package/dist/_virtual/entities.js.map +1 -0
- package/dist/_virtual/extends.js +5 -0
- package/dist/_virtual/extends.js.map +1 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +5 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.js +5 -3
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index5.js +6 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +6 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +5 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/parse-sidx.js +8 -0
- package/dist/_virtual/parse-sidx.js.map +1 -0
- package/dist/_virtual/sax.js +5 -0
- package/dist/_virtual/sax.js.map +1 -0
- package/dist/_virtual/window.js +8 -0
- package/dist/_virtual/window.js.map +1 -0
- package/dist/components/atoms/video-player.js +121 -0
- package/dist/components/atoms/video-player.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +236 -106
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/index.js +199 -192
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +114 -87
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js +20 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/byte-helpers.js +79 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/byte-helpers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/codecs.js +102 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/codecs.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/containers.js +149 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/containers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/ebml-helpers.js +77 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/ebml-helpers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/id3-helpers.js +15 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/id3-helpers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-types.js +7 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-types.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/mp4-helpers.js +31 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/mp4-helpers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/nal-helpers.js +39 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/nal-helpers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/resolve-url.js +14 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/resolve-url.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/stream.js +33 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/stream.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js +42 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +169 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js +75 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js +70 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js +124 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js +151 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js +993 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js +2146 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +14 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js +346 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +308 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +41 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +53 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +157 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js +103 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js +269 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js +12 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js +10 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js +18 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/m3u8-parser@7.2.0/node_modules/m3u8-parser/dist/m3u8-parser.es.js +855 -0
- package/dist/shop-minis-react/node_modules/.pnpm/m3u8-parser@7.2.0/node_modules/m3u8-parser/dist/m3u8-parser.es.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1102 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/tools/parse-sidx.js +32 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/tools/parse-sidx.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js +34 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js +17 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +23 -0
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +27824 -0
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/browser-index.js +26 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/browser-index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vtt.js +802 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vtt.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttcue.js +188 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttcue.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttregion.js +104 -0
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttregion.js.map +1 -0
- package/dist/shop-minis-react.css +1 -1
- package/dist/utils/colors.js +6 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/merchant-card.js +44 -0
- package/dist/utils/merchant-card.js.map +1 -0
- package/package.json +5 -1
- package/src/components/atoms/video-player.tsx +213 -0
- package/src/components/commerce/merchant-card.tsx +219 -49
- package/src/components/index.ts +1 -0
- package/src/mocks.ts +148 -16
- package/src/stories/MerchantCard.stories.tsx +63 -9
- package/src/utils/colors.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/merchant-card.ts +99 -0
- package/src/hooks/navigation/useCloseMini.doc.ts +0 -32
- package/src/hooks/navigation/useCloseMini.example.tsx +0 -7
- package/src/hooks/navigation/useDeeplink.doc.ts +0 -32
- package/src/hooks/navigation/useDeeplink.example.tsx +0 -7
- package/src/hooks/navigation/useShopNavigation.doc.ts +0 -32
- package/src/hooks/navigation/useShopNavigation.example.tsx +0 -32
- package/src/hooks/product/useCuratedProducts.doc.ts +0 -32
- package/src/hooks/product/useCuratedProducts.example.tsx +0 -10
- package/src/hooks/product/useProductList.doc.ts +0 -32
- package/src/hooks/product/useProductList.example.tsx +0 -9
- package/src/hooks/product/useProductListActions.doc.ts +0 -32
- package/src/hooks/product/useProductListActions.example.tsx +0 -60
- package/src/hooks/product/useProductLists.doc.ts +0 -32
- package/src/hooks/product/useProductLists.example.tsx +0 -9
- package/src/hooks/product/useProductSearch.doc.ts +0 -32
- package/src/hooks/product/useProductSearch.example.tsx +0 -13
- package/src/hooks/product/useRecommendedProducts.doc.ts +0 -32
- package/src/hooks/product/useRecommendedProducts.example.tsx +0 -7
- package/src/hooks/shop/useRecommendedShops.doc.ts +0 -32
- package/src/hooks/shop/useRecommendedShops.example.tsx +0 -7
- package/src/hooks/shop/useShop.doc.ts +0 -31
- package/src/hooks/shop/useShop.example.tsx +0 -7
- package/src/hooks/shop/useShopCartActions.doc.ts +0 -32
- package/src/hooks/shop/useShopCartActions.example.tsx +0 -28
- package/src/hooks/storage/useAsyncStorage.doc.ts +0 -32
- package/src/hooks/storage/useAsyncStorage.example.tsx +0 -30
- package/src/hooks/storage/useImageUpload.doc.ts +0 -32
- package/src/hooks/storage/useImageUpload.example.tsx +0 -20
- package/src/hooks/storage/useSecureStorage.doc.ts +0 -32
- package/src/hooks/storage/useSecureStorage.example.tsx +0 -23
- package/src/hooks/user/useBuyerAttributes.doc.ts +0 -32
- package/src/hooks/user/useBuyerAttributes.example.tsx +0 -14
- package/src/hooks/user/useCurrentUser.doc.ts +0 -31
- package/src/hooks/user/useCurrentUser.example.tsx +0 -7
- package/src/hooks/user/useFollowedShopsActions.doc.ts +0 -32
- package/src/hooks/user/useFollowedShopsActions.example.tsx +0 -16
- package/src/hooks/user/useOrders.doc.ts +0 -32
- package/src/hooks/user/useOrders.example.tsx +0 -7
- package/src/hooks/user/useRecentProducts.doc.ts +0 -32
- package/src/hooks/user/useRecentProducts.example.tsx +0 -13
- package/src/hooks/user/useSavedProducts.doc.ts +0 -32
- package/src/hooks/user/useSavedProducts.example.tsx +0 -13
- package/src/hooks/user/useSavedProductsActions.doc.ts +0 -32
- package/src/hooks/user/useSavedProductsActions.example.tsx +0 -32
- package/src/hooks/util/useErrorScreen.doc.ts +0 -32
- package/src/hooks/util/useErrorScreen.example.tsx +0 -15
- package/src/hooks/util/useErrorToast.doc.ts +0 -32
- package/src/hooks/util/useErrorToast.example.tsx +0 -15
- package/src/hooks/util/useImagePicker.example.tsx +0 -77
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { __require as J } from "../../../../global@4.4.0/node_modules/global/document.js";
|
|
2
|
+
var O, U;
|
|
3
|
+
function Q() {
|
|
4
|
+
if (U) return O;
|
|
5
|
+
U = 1;
|
|
6
|
+
var I = J(), N = Object.create || /* @__PURE__ */ function() {
|
|
7
|
+
function e() {
|
|
8
|
+
}
|
|
9
|
+
return function(t) {
|
|
10
|
+
if (arguments.length !== 1)
|
|
11
|
+
throw new Error("Object.create shim only accepts one parameter.");
|
|
12
|
+
return e.prototype = t, new e();
|
|
13
|
+
};
|
|
14
|
+
}();
|
|
15
|
+
function v(e, t) {
|
|
16
|
+
this.name = "ParsingError", this.code = e.code, this.message = t || e.message;
|
|
17
|
+
}
|
|
18
|
+
v.prototype = N(Error.prototype), v.prototype.constructor = v, v.Errors = {
|
|
19
|
+
BadSignature: {
|
|
20
|
+
code: 0,
|
|
21
|
+
message: "Malformed WebVTT signature."
|
|
22
|
+
},
|
|
23
|
+
BadTimeStamp: {
|
|
24
|
+
code: 1,
|
|
25
|
+
message: "Malformed time stamp."
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function P(e) {
|
|
29
|
+
function t(s, x, h, f) {
|
|
30
|
+
return (s | 0) * 3600 + (x | 0) * 60 + (h | 0) + (f | 0) / 1e3;
|
|
31
|
+
}
|
|
32
|
+
var r = e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
|
|
33
|
+
return r ? r[3] ? t(r[1], r[2], r[3].replace(":", ""), r[4]) : r[1] > 59 ? t(r[1], r[2], 0, r[4]) : t(0, r[1], r[2], r[4]) : null;
|
|
34
|
+
}
|
|
35
|
+
function w() {
|
|
36
|
+
this.values = N(null);
|
|
37
|
+
}
|
|
38
|
+
w.prototype = {
|
|
39
|
+
// Only accept the first assignment to any key.
|
|
40
|
+
set: function(e, t) {
|
|
41
|
+
!this.get(e) && t !== "" && (this.values[e] = t);
|
|
42
|
+
},
|
|
43
|
+
// Return the value for a key, or a default value.
|
|
44
|
+
// If 'defaultKey' is passed then 'dflt' is assumed to be an object with
|
|
45
|
+
// a number of possible default values as properties where 'defaultKey' is
|
|
46
|
+
// the key of the property that will be chosen; otherwise it's assumed to be
|
|
47
|
+
// a single value.
|
|
48
|
+
get: function(e, t, r) {
|
|
49
|
+
return r ? this.has(e) ? this.values[e] : t[r] : this.has(e) ? this.values[e] : t;
|
|
50
|
+
},
|
|
51
|
+
// Check whether we have a value for a key.
|
|
52
|
+
has: function(e) {
|
|
53
|
+
return e in this.values;
|
|
54
|
+
},
|
|
55
|
+
// Accept a setting if its one of the given alternatives.
|
|
56
|
+
alt: function(e, t, r) {
|
|
57
|
+
for (var s = 0; s < r.length; ++s)
|
|
58
|
+
if (t === r[s]) {
|
|
59
|
+
this.set(e, t);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
// Accept a setting if its a valid (signed) integer.
|
|
64
|
+
integer: function(e, t) {
|
|
65
|
+
/^-?\d+$/.test(t) && this.set(e, parseInt(t, 10));
|
|
66
|
+
},
|
|
67
|
+
// Accept a setting if its a valid percentage.
|
|
68
|
+
percent: function(e, t) {
|
|
69
|
+
return t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t), t >= 0 && t <= 100) ? (this.set(e, t), !0) : !1;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function E(e, t, r, s) {
|
|
73
|
+
var x = s ? e.split(s) : [e];
|
|
74
|
+
for (var h in x)
|
|
75
|
+
if (typeof x[h] == "string") {
|
|
76
|
+
var f = x[h].split(r);
|
|
77
|
+
if (f.length === 2) {
|
|
78
|
+
var l = f[0].trim(), a = f[1].trim();
|
|
79
|
+
t(l, a);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function V(e, t, r) {
|
|
84
|
+
var s = e;
|
|
85
|
+
function x() {
|
|
86
|
+
var l = P(e);
|
|
87
|
+
if (l === null)
|
|
88
|
+
throw new v(
|
|
89
|
+
v.Errors.BadTimeStamp,
|
|
90
|
+
"Malformed timestamp: " + s
|
|
91
|
+
);
|
|
92
|
+
return e = e.replace(/^[^\sa-zA-Z-]+/, ""), l;
|
|
93
|
+
}
|
|
94
|
+
function h(l, a) {
|
|
95
|
+
var o = new w();
|
|
96
|
+
E(l, function(n, i) {
|
|
97
|
+
switch (n) {
|
|
98
|
+
case "region":
|
|
99
|
+
for (var c = r.length - 1; c >= 0; c--)
|
|
100
|
+
if (r[c].id === i) {
|
|
101
|
+
o.set(n, r[c].region);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case "vertical":
|
|
106
|
+
o.alt(n, i, ["rl", "lr"]);
|
|
107
|
+
break;
|
|
108
|
+
case "line":
|
|
109
|
+
var g = i.split(","), u = g[0];
|
|
110
|
+
o.integer(n, u), o.percent(n, u) && o.set("snapToLines", !1), o.alt(n, u, ["auto"]), g.length === 2 && o.alt("lineAlign", g[1], ["start", "center", "end"]);
|
|
111
|
+
break;
|
|
112
|
+
case "position":
|
|
113
|
+
g = i.split(","), o.percent(n, g[0]), g.length === 2 && o.alt("positionAlign", g[1], ["start", "center", "end"]);
|
|
114
|
+
break;
|
|
115
|
+
case "size":
|
|
116
|
+
o.percent(n, i);
|
|
117
|
+
break;
|
|
118
|
+
case "align":
|
|
119
|
+
o.alt(n, i, ["start", "center", "end", "left", "right"]);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}, /:/, /\s/), a.region = o.get("region", null), a.vertical = o.get("vertical", "");
|
|
123
|
+
try {
|
|
124
|
+
a.line = o.get("line", "auto");
|
|
125
|
+
} catch {
|
|
126
|
+
}
|
|
127
|
+
a.lineAlign = o.get("lineAlign", "start"), a.snapToLines = o.get("snapToLines", !0), a.size = o.get("size", 100);
|
|
128
|
+
try {
|
|
129
|
+
a.align = o.get("align", "center");
|
|
130
|
+
} catch {
|
|
131
|
+
a.align = o.get("align", "middle");
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
a.position = o.get("position", "auto");
|
|
135
|
+
} catch {
|
|
136
|
+
a.position = o.get("position", {
|
|
137
|
+
start: 0,
|
|
138
|
+
left: 0,
|
|
139
|
+
center: 50,
|
|
140
|
+
middle: 50,
|
|
141
|
+
end: 100,
|
|
142
|
+
right: 100
|
|
143
|
+
}, a.align);
|
|
144
|
+
}
|
|
145
|
+
a.positionAlign = o.get("positionAlign", {
|
|
146
|
+
start: "start",
|
|
147
|
+
left: "start",
|
|
148
|
+
center: "center",
|
|
149
|
+
middle: "center",
|
|
150
|
+
end: "end",
|
|
151
|
+
right: "end"
|
|
152
|
+
}, a.align);
|
|
153
|
+
}
|
|
154
|
+
function f() {
|
|
155
|
+
e = e.replace(/^\s+/, "");
|
|
156
|
+
}
|
|
157
|
+
if (f(), t.startTime = x(), f(), e.substr(0, 3) !== "-->")
|
|
158
|
+
throw new v(
|
|
159
|
+
v.Errors.BadTimeStamp,
|
|
160
|
+
"Malformed time stamp (time stamps must be separated by '-->'): " + s
|
|
161
|
+
);
|
|
162
|
+
e = e.substr(3), f(), t.endTime = x(), f(), h(e, t);
|
|
163
|
+
}
|
|
164
|
+
var L = I.createElement && I.createElement("textarea"), X = {
|
|
165
|
+
c: "span",
|
|
166
|
+
i: "i",
|
|
167
|
+
b: "b",
|
|
168
|
+
u: "u",
|
|
169
|
+
ruby: "ruby",
|
|
170
|
+
rt: "rt",
|
|
171
|
+
v: "span",
|
|
172
|
+
lang: "span"
|
|
173
|
+
}, k = {
|
|
174
|
+
white: "rgba(255,255,255,1)",
|
|
175
|
+
lime: "rgba(0,255,0,1)",
|
|
176
|
+
cyan: "rgba(0,255,255,1)",
|
|
177
|
+
red: "rgba(255,0,0,1)",
|
|
178
|
+
yellow: "rgba(255,255,0,1)",
|
|
179
|
+
magenta: "rgba(255,0,255,1)",
|
|
180
|
+
blue: "rgba(0,0,255,1)",
|
|
181
|
+
black: "rgba(0,0,0,1)"
|
|
182
|
+
}, z = {
|
|
183
|
+
v: "title",
|
|
184
|
+
lang: "lang"
|
|
185
|
+
}, R = {
|
|
186
|
+
rt: "ruby"
|
|
187
|
+
};
|
|
188
|
+
function D(e, t) {
|
|
189
|
+
function r() {
|
|
190
|
+
if (!t)
|
|
191
|
+
return null;
|
|
192
|
+
function u(p) {
|
|
193
|
+
return t = t.substr(p.length), p;
|
|
194
|
+
}
|
|
195
|
+
var d = t.match(/^([^<]*)(<[^>]*>?)?/);
|
|
196
|
+
return u(d[1] ? d[1] : d[2]);
|
|
197
|
+
}
|
|
198
|
+
function s(u) {
|
|
199
|
+
return L.innerHTML = u, u = L.textContent, L.textContent = "", u;
|
|
200
|
+
}
|
|
201
|
+
function x(u, d) {
|
|
202
|
+
return !R[d.localName] || R[d.localName] === u.localName;
|
|
203
|
+
}
|
|
204
|
+
function h(u, d) {
|
|
205
|
+
var p = X[u];
|
|
206
|
+
if (!p)
|
|
207
|
+
return null;
|
|
208
|
+
var b = e.document.createElement(p), T = z[u];
|
|
209
|
+
return T && d && (b[T] = d.trim()), b;
|
|
210
|
+
}
|
|
211
|
+
for (var f = e.document.createElement("div"), l = f, a, o = []; (a = r()) !== null; ) {
|
|
212
|
+
if (a[0] === "<") {
|
|
213
|
+
if (a[1] === "/") {
|
|
214
|
+
o.length && o[o.length - 1] === a.substr(2).replace(">", "") && (o.pop(), l = l.parentNode);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
var n = P(a.substr(1, a.length - 2)), i;
|
|
218
|
+
if (n) {
|
|
219
|
+
i = e.document.createProcessingInstruction("timestamp", n), l.appendChild(i);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
var c = a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
|
|
223
|
+
if (!c || (i = h(c[1], c[3]), !i) || !x(l, i))
|
|
224
|
+
continue;
|
|
225
|
+
if (c[2]) {
|
|
226
|
+
var g = c[2].split(".");
|
|
227
|
+
g.forEach(function(u) {
|
|
228
|
+
var d = /^bg_/.test(u), p = d ? u.slice(3) : u;
|
|
229
|
+
if (k.hasOwnProperty(p)) {
|
|
230
|
+
var b = d ? "background-color" : "color", T = k[p];
|
|
231
|
+
i.style[b] = T;
|
|
232
|
+
}
|
|
233
|
+
}), i.className = g.join(" ");
|
|
234
|
+
}
|
|
235
|
+
o.push(c[1]), l.appendChild(i), l = i;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
l.appendChild(e.document.createTextNode(s(a)));
|
|
239
|
+
}
|
|
240
|
+
return f;
|
|
241
|
+
}
|
|
242
|
+
var M = [
|
|
243
|
+
[1470, 1470],
|
|
244
|
+
[1472, 1472],
|
|
245
|
+
[1475, 1475],
|
|
246
|
+
[1478, 1478],
|
|
247
|
+
[1488, 1514],
|
|
248
|
+
[1520, 1524],
|
|
249
|
+
[1544, 1544],
|
|
250
|
+
[1547, 1547],
|
|
251
|
+
[1549, 1549],
|
|
252
|
+
[1563, 1563],
|
|
253
|
+
[1566, 1610],
|
|
254
|
+
[1645, 1647],
|
|
255
|
+
[1649, 1749],
|
|
256
|
+
[1765, 1766],
|
|
257
|
+
[1774, 1775],
|
|
258
|
+
[1786, 1805],
|
|
259
|
+
[1807, 1808],
|
|
260
|
+
[1810, 1839],
|
|
261
|
+
[1869, 1957],
|
|
262
|
+
[1969, 1969],
|
|
263
|
+
[1984, 2026],
|
|
264
|
+
[2036, 2037],
|
|
265
|
+
[2042, 2042],
|
|
266
|
+
[2048, 2069],
|
|
267
|
+
[2074, 2074],
|
|
268
|
+
[2084, 2084],
|
|
269
|
+
[2088, 2088],
|
|
270
|
+
[2096, 2110],
|
|
271
|
+
[2112, 2136],
|
|
272
|
+
[2142, 2142],
|
|
273
|
+
[2208, 2208],
|
|
274
|
+
[2210, 2220],
|
|
275
|
+
[8207, 8207],
|
|
276
|
+
[64285, 64285],
|
|
277
|
+
[64287, 64296],
|
|
278
|
+
[64298, 64310],
|
|
279
|
+
[64312, 64316],
|
|
280
|
+
[64318, 64318],
|
|
281
|
+
[64320, 64321],
|
|
282
|
+
[64323, 64324],
|
|
283
|
+
[64326, 64449],
|
|
284
|
+
[64467, 64829],
|
|
285
|
+
[64848, 64911],
|
|
286
|
+
[64914, 64967],
|
|
287
|
+
[65008, 65020],
|
|
288
|
+
[65136, 65140],
|
|
289
|
+
[65142, 65276],
|
|
290
|
+
[67584, 67589],
|
|
291
|
+
[67592, 67592],
|
|
292
|
+
[67594, 67637],
|
|
293
|
+
[67639, 67640],
|
|
294
|
+
[67644, 67644],
|
|
295
|
+
[67647, 67669],
|
|
296
|
+
[67671, 67679],
|
|
297
|
+
[67840, 67867],
|
|
298
|
+
[67872, 67897],
|
|
299
|
+
[67903, 67903],
|
|
300
|
+
[67968, 68023],
|
|
301
|
+
[68030, 68031],
|
|
302
|
+
[68096, 68096],
|
|
303
|
+
[68112, 68115],
|
|
304
|
+
[68117, 68119],
|
|
305
|
+
[68121, 68147],
|
|
306
|
+
[68160, 68167],
|
|
307
|
+
[68176, 68184],
|
|
308
|
+
[68192, 68223],
|
|
309
|
+
[68352, 68405],
|
|
310
|
+
[68416, 68437],
|
|
311
|
+
[68440, 68466],
|
|
312
|
+
[68472, 68479],
|
|
313
|
+
[68608, 68680],
|
|
314
|
+
[126464, 126467],
|
|
315
|
+
[126469, 126495],
|
|
316
|
+
[126497, 126498],
|
|
317
|
+
[126500, 126500],
|
|
318
|
+
[126503, 126503],
|
|
319
|
+
[126505, 126514],
|
|
320
|
+
[126516, 126519],
|
|
321
|
+
[126521, 126521],
|
|
322
|
+
[126523, 126523],
|
|
323
|
+
[126530, 126530],
|
|
324
|
+
[126535, 126535],
|
|
325
|
+
[126537, 126537],
|
|
326
|
+
[126539, 126539],
|
|
327
|
+
[126541, 126543],
|
|
328
|
+
[126545, 126546],
|
|
329
|
+
[126548, 126548],
|
|
330
|
+
[126551, 126551],
|
|
331
|
+
[126553, 126553],
|
|
332
|
+
[126555, 126555],
|
|
333
|
+
[126557, 126557],
|
|
334
|
+
[126559, 126559],
|
|
335
|
+
[126561, 126562],
|
|
336
|
+
[126564, 126564],
|
|
337
|
+
[126567, 126570],
|
|
338
|
+
[126572, 126578],
|
|
339
|
+
[126580, 126583],
|
|
340
|
+
[126585, 126588],
|
|
341
|
+
[126590, 126590],
|
|
342
|
+
[126592, 126601],
|
|
343
|
+
[126603, 126619],
|
|
344
|
+
[126625, 126627],
|
|
345
|
+
[126629, 126633],
|
|
346
|
+
[126635, 126651],
|
|
347
|
+
[1114109, 1114109]
|
|
348
|
+
];
|
|
349
|
+
function W(e) {
|
|
350
|
+
for (var t = 0; t < M.length; t++) {
|
|
351
|
+
var r = M[t];
|
|
352
|
+
if (e >= r[0] && e <= r[1])
|
|
353
|
+
return !0;
|
|
354
|
+
}
|
|
355
|
+
return !1;
|
|
356
|
+
}
|
|
357
|
+
function G(e) {
|
|
358
|
+
var t = [], r = "", s;
|
|
359
|
+
if (!e || !e.childNodes)
|
|
360
|
+
return "ltr";
|
|
361
|
+
function x(l, a) {
|
|
362
|
+
for (var o = a.childNodes.length - 1; o >= 0; o--)
|
|
363
|
+
l.push(a.childNodes[o]);
|
|
364
|
+
}
|
|
365
|
+
function h(l) {
|
|
366
|
+
if (!l || !l.length)
|
|
367
|
+
return null;
|
|
368
|
+
var a = l.pop(), o = a.textContent || a.innerText;
|
|
369
|
+
if (o) {
|
|
370
|
+
var n = o.match(/^.*(\n|\r)/);
|
|
371
|
+
return n ? (l.length = 0, n[0]) : o;
|
|
372
|
+
}
|
|
373
|
+
if (a.tagName === "ruby")
|
|
374
|
+
return h(l);
|
|
375
|
+
if (a.childNodes)
|
|
376
|
+
return x(l, a), h(l);
|
|
377
|
+
}
|
|
378
|
+
for (x(t, e); r = h(t); )
|
|
379
|
+
for (var f = 0; f < r.length; f++)
|
|
380
|
+
if (s = r.charCodeAt(f), W(s))
|
|
381
|
+
return "rtl";
|
|
382
|
+
return "ltr";
|
|
383
|
+
}
|
|
384
|
+
function Y(e) {
|
|
385
|
+
if (typeof e.line == "number" && (e.snapToLines || e.line >= 0 && e.line <= 100))
|
|
386
|
+
return e.line;
|
|
387
|
+
if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement)
|
|
388
|
+
return -1;
|
|
389
|
+
for (var t = e.track, r = t.textTrackList, s = 0, x = 0; x < r.length && r[x] !== t; x++)
|
|
390
|
+
r[x].mode === "showing" && s++;
|
|
391
|
+
return ++s * -1;
|
|
392
|
+
}
|
|
393
|
+
function S() {
|
|
394
|
+
}
|
|
395
|
+
S.prototype.applyStyles = function(e, t) {
|
|
396
|
+
t = t || this.div;
|
|
397
|
+
for (var r in e)
|
|
398
|
+
e.hasOwnProperty(r) && (t.style[r] = e[r]);
|
|
399
|
+
}, S.prototype.formatStyle = function(e, t) {
|
|
400
|
+
return e === 0 ? 0 : e + t;
|
|
401
|
+
};
|
|
402
|
+
function C(e, t, r) {
|
|
403
|
+
S.call(this), this.cue = t, this.cueDiv = D(e, t.text);
|
|
404
|
+
var s = {
|
|
405
|
+
color: "rgba(255, 255, 255, 1)",
|
|
406
|
+
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
|
407
|
+
position: "relative",
|
|
408
|
+
left: 0,
|
|
409
|
+
right: 0,
|
|
410
|
+
top: 0,
|
|
411
|
+
bottom: 0,
|
|
412
|
+
display: "inline",
|
|
413
|
+
writingMode: t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl",
|
|
414
|
+
unicodeBidi: "plaintext"
|
|
415
|
+
};
|
|
416
|
+
this.applyStyles(s, this.cueDiv), this.div = e.document.createElement("div"), s = {
|
|
417
|
+
direction: G(this.cueDiv),
|
|
418
|
+
writingMode: t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl",
|
|
419
|
+
unicodeBidi: "plaintext",
|
|
420
|
+
textAlign: t.align === "middle" ? "center" : t.align,
|
|
421
|
+
font: r.font,
|
|
422
|
+
whiteSpace: "pre-line",
|
|
423
|
+
position: "absolute"
|
|
424
|
+
}, this.applyStyles(s), this.div.appendChild(this.cueDiv);
|
|
425
|
+
var x = 0;
|
|
426
|
+
switch (t.positionAlign) {
|
|
427
|
+
case "start":
|
|
428
|
+
case "line-left":
|
|
429
|
+
x = t.position;
|
|
430
|
+
break;
|
|
431
|
+
case "center":
|
|
432
|
+
x = t.position - t.size / 2;
|
|
433
|
+
break;
|
|
434
|
+
case "end":
|
|
435
|
+
case "line-right":
|
|
436
|
+
x = t.position - t.size;
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
t.vertical === "" ? this.applyStyles({
|
|
440
|
+
left: this.formatStyle(x, "%"),
|
|
441
|
+
width: this.formatStyle(t.size, "%")
|
|
442
|
+
}) : this.applyStyles({
|
|
443
|
+
top: this.formatStyle(x, "%"),
|
|
444
|
+
height: this.formatStyle(t.size, "%")
|
|
445
|
+
}), this.move = function(h) {
|
|
446
|
+
this.applyStyles({
|
|
447
|
+
top: this.formatStyle(h.top, "px"),
|
|
448
|
+
bottom: this.formatStyle(h.bottom, "px"),
|
|
449
|
+
left: this.formatStyle(h.left, "px"),
|
|
450
|
+
right: this.formatStyle(h.right, "px"),
|
|
451
|
+
height: this.formatStyle(h.height, "px"),
|
|
452
|
+
width: this.formatStyle(h.width, "px")
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
C.prototype = N(S.prototype), C.prototype.constructor = C;
|
|
457
|
+
function m(e) {
|
|
458
|
+
var t, r, s, x;
|
|
459
|
+
if (e.div) {
|
|
460
|
+
r = e.div.offsetHeight, s = e.div.offsetWidth, x = e.div.offsetTop;
|
|
461
|
+
var h = (h = e.div.childNodes) && (h = h[0]) && h.getClientRects && h.getClientRects();
|
|
462
|
+
e = e.div.getBoundingClientRect(), t = h ? Math.max(h[0] && h[0].height || 0, e.height / h.length) : 0;
|
|
463
|
+
}
|
|
464
|
+
this.left = e.left, this.right = e.right, this.top = e.top || x, this.height = e.height || r, this.bottom = e.bottom || x + (e.height || r), this.width = e.width || s, this.lineHeight = t !== void 0 ? t : e.lineHeight;
|
|
465
|
+
}
|
|
466
|
+
m.prototype.move = function(e, t) {
|
|
467
|
+
switch (t = t !== void 0 ? t : this.lineHeight, e) {
|
|
468
|
+
case "+x":
|
|
469
|
+
this.left += t, this.right += t;
|
|
470
|
+
break;
|
|
471
|
+
case "-x":
|
|
472
|
+
this.left -= t, this.right -= t;
|
|
473
|
+
break;
|
|
474
|
+
case "+y":
|
|
475
|
+
this.top += t, this.bottom += t;
|
|
476
|
+
break;
|
|
477
|
+
case "-y":
|
|
478
|
+
this.top -= t, this.bottom -= t;
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
}, m.prototype.overlaps = function(e) {
|
|
482
|
+
return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top;
|
|
483
|
+
}, m.prototype.overlapsAny = function(e) {
|
|
484
|
+
for (var t = 0; t < e.length; t++)
|
|
485
|
+
if (this.overlaps(e[t]))
|
|
486
|
+
return !0;
|
|
487
|
+
return !1;
|
|
488
|
+
}, m.prototype.within = function(e) {
|
|
489
|
+
return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right;
|
|
490
|
+
}, m.prototype.overlapsOppositeAxis = function(e, t) {
|
|
491
|
+
switch (t) {
|
|
492
|
+
case "+x":
|
|
493
|
+
return this.left < e.left;
|
|
494
|
+
case "-x":
|
|
495
|
+
return this.right > e.right;
|
|
496
|
+
case "+y":
|
|
497
|
+
return this.top < e.top;
|
|
498
|
+
case "-y":
|
|
499
|
+
return this.bottom > e.bottom;
|
|
500
|
+
}
|
|
501
|
+
}, m.prototype.intersectPercentage = function(e) {
|
|
502
|
+
var t = Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left)), r = Math.max(0, Math.min(this.bottom, e.bottom) - Math.max(this.top, e.top)), s = t * r;
|
|
503
|
+
return s / (this.height * this.width);
|
|
504
|
+
}, m.prototype.toCSSCompatValues = function(e) {
|
|
505
|
+
return {
|
|
506
|
+
top: this.top - e.top,
|
|
507
|
+
bottom: e.bottom - this.bottom,
|
|
508
|
+
left: this.left - e.left,
|
|
509
|
+
right: e.right - this.right,
|
|
510
|
+
height: this.height,
|
|
511
|
+
width: this.width
|
|
512
|
+
};
|
|
513
|
+
}, m.getSimpleBoxPosition = function(e) {
|
|
514
|
+
var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0, r = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0, s = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0;
|
|
515
|
+
e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e;
|
|
516
|
+
var x = {
|
|
517
|
+
left: e.left,
|
|
518
|
+
right: e.right,
|
|
519
|
+
top: e.top || s,
|
|
520
|
+
height: e.height || t,
|
|
521
|
+
bottom: e.bottom || s + (e.height || t),
|
|
522
|
+
width: e.width || r
|
|
523
|
+
};
|
|
524
|
+
return x;
|
|
525
|
+
};
|
|
526
|
+
function q(e, t, r, s) {
|
|
527
|
+
function x(p, b) {
|
|
528
|
+
for (var T, _ = new m(p), B = 1, A = 0; A < b.length; A++) {
|
|
529
|
+
for (; p.overlapsOppositeAxis(r, b[A]) || p.within(r) && p.overlapsAny(s); )
|
|
530
|
+
p.move(b[A]);
|
|
531
|
+
if (p.within(r))
|
|
532
|
+
return p;
|
|
533
|
+
var H = p.intersectPercentage(r);
|
|
534
|
+
B > H && (T = new m(p), B = H), p = new m(_);
|
|
535
|
+
}
|
|
536
|
+
return T || _;
|
|
537
|
+
}
|
|
538
|
+
var h = new m(t), f = t.cue, l = Y(f), a = [];
|
|
539
|
+
if (f.snapToLines) {
|
|
540
|
+
var o;
|
|
541
|
+
switch (f.vertical) {
|
|
542
|
+
case "":
|
|
543
|
+
a = ["+y", "-y"], o = "height";
|
|
544
|
+
break;
|
|
545
|
+
case "rl":
|
|
546
|
+
a = ["+x", "-x"], o = "width";
|
|
547
|
+
break;
|
|
548
|
+
case "lr":
|
|
549
|
+
a = ["-x", "+x"], o = "width";
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
var n = h.lineHeight, i = n * Math.round(l), c = r[o] + n, g = a[0];
|
|
553
|
+
Math.abs(i) > c && (i = i < 0 ? -1 : 1, i *= Math.ceil(c / n) * n), l < 0 && (i += f.vertical === "" ? r.height : r.width, a = a.reverse()), h.move(g, i);
|
|
554
|
+
} else {
|
|
555
|
+
var u = h.lineHeight / r.height * 100;
|
|
556
|
+
switch (f.lineAlign) {
|
|
557
|
+
case "center":
|
|
558
|
+
l -= u / 2;
|
|
559
|
+
break;
|
|
560
|
+
case "end":
|
|
561
|
+
l -= u;
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
switch (f.vertical) {
|
|
565
|
+
case "":
|
|
566
|
+
t.applyStyles({
|
|
567
|
+
top: t.formatStyle(l, "%")
|
|
568
|
+
});
|
|
569
|
+
break;
|
|
570
|
+
case "rl":
|
|
571
|
+
t.applyStyles({
|
|
572
|
+
left: t.formatStyle(l, "%")
|
|
573
|
+
});
|
|
574
|
+
break;
|
|
575
|
+
case "lr":
|
|
576
|
+
t.applyStyles({
|
|
577
|
+
right: t.formatStyle(l, "%")
|
|
578
|
+
});
|
|
579
|
+
break;
|
|
580
|
+
}
|
|
581
|
+
a = ["+y", "-x", "+x", "-y"], h = new m(t);
|
|
582
|
+
}
|
|
583
|
+
var d = x(h, a);
|
|
584
|
+
t.move(d.toCSSCompatValues(r));
|
|
585
|
+
}
|
|
586
|
+
function y() {
|
|
587
|
+
}
|
|
588
|
+
y.StringDecoder = function() {
|
|
589
|
+
return {
|
|
590
|
+
decode: function(e) {
|
|
591
|
+
if (!e)
|
|
592
|
+
return "";
|
|
593
|
+
if (typeof e != "string")
|
|
594
|
+
throw new Error("Error - expected string data.");
|
|
595
|
+
return decodeURIComponent(encodeURIComponent(e));
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
}, y.convertCueToDOMTree = function(e, t) {
|
|
599
|
+
return !e || !t ? null : D(e, t);
|
|
600
|
+
};
|
|
601
|
+
var F = 0.05, $ = "sans-serif", Z = "1.5%";
|
|
602
|
+
return y.processCues = function(e, t, r) {
|
|
603
|
+
if (!e || !t || !r)
|
|
604
|
+
return null;
|
|
605
|
+
for (; r.firstChild; )
|
|
606
|
+
r.removeChild(r.firstChild);
|
|
607
|
+
var s = e.document.createElement("div");
|
|
608
|
+
s.style.position = "absolute", s.style.left = "0", s.style.right = "0", s.style.top = "0", s.style.bottom = "0", s.style.margin = Z, r.appendChild(s);
|
|
609
|
+
function x(n) {
|
|
610
|
+
for (var i = 0; i < n.length; i++)
|
|
611
|
+
if (n[i].hasBeenReset || !n[i].displayState)
|
|
612
|
+
return !0;
|
|
613
|
+
return !1;
|
|
614
|
+
}
|
|
615
|
+
if (!x(t)) {
|
|
616
|
+
for (var h = 0; h < t.length; h++)
|
|
617
|
+
s.appendChild(t[h].displayState);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
var f = [], l = m.getSimpleBoxPosition(s), a = Math.round(l.height * F * 100) / 100, o = {
|
|
621
|
+
font: a + "px " + $
|
|
622
|
+
};
|
|
623
|
+
(function() {
|
|
624
|
+
for (var n, i, c = 0; c < t.length; c++)
|
|
625
|
+
i = t[c], n = new C(e, i, o), s.appendChild(n.div), q(e, n, l, f), i.displayState = n.div, f.push(m.getSimpleBoxPosition(n));
|
|
626
|
+
})();
|
|
627
|
+
}, y.Parser = function(e, t, r) {
|
|
628
|
+
r || (r = t, t = {}), t || (t = {}), this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "", this.decoder = r || new TextDecoder("utf8"), this.regionList = [];
|
|
629
|
+
}, y.Parser.prototype = {
|
|
630
|
+
// If the error is a ParsingError then report it to the consumer if
|
|
631
|
+
// possible. If it's not a ParsingError then throw it like normal.
|
|
632
|
+
reportOrThrowError: function(e) {
|
|
633
|
+
if (e instanceof v)
|
|
634
|
+
this.onparsingerror && this.onparsingerror(e);
|
|
635
|
+
else
|
|
636
|
+
throw e;
|
|
637
|
+
},
|
|
638
|
+
parse: function(e) {
|
|
639
|
+
var t = this;
|
|
640
|
+
e && (t.buffer += t.decoder.decode(e, { stream: !0 }));
|
|
641
|
+
function r() {
|
|
642
|
+
for (var n = t.buffer, i = 0; i < n.length && n[i] !== "\r" && n[i] !== `
|
|
643
|
+
`; )
|
|
644
|
+
++i;
|
|
645
|
+
var c = n.substr(0, i);
|
|
646
|
+
return n[i] === "\r" && ++i, n[i] === `
|
|
647
|
+
` && ++i, t.buffer = n.substr(i), c;
|
|
648
|
+
}
|
|
649
|
+
function s(n) {
|
|
650
|
+
var i = new w();
|
|
651
|
+
if (E(n, function(g, u) {
|
|
652
|
+
switch (g) {
|
|
653
|
+
case "id":
|
|
654
|
+
i.set(g, u);
|
|
655
|
+
break;
|
|
656
|
+
case "width":
|
|
657
|
+
i.percent(g, u);
|
|
658
|
+
break;
|
|
659
|
+
case "lines":
|
|
660
|
+
i.integer(g, u);
|
|
661
|
+
break;
|
|
662
|
+
case "regionanchor":
|
|
663
|
+
case "viewportanchor":
|
|
664
|
+
var d = u.split(",");
|
|
665
|
+
if (d.length !== 2)
|
|
666
|
+
break;
|
|
667
|
+
var p = new w();
|
|
668
|
+
if (p.percent("x", d[0]), p.percent("y", d[1]), !p.has("x") || !p.has("y"))
|
|
669
|
+
break;
|
|
670
|
+
i.set(g + "X", p.get("x")), i.set(g + "Y", p.get("y"));
|
|
671
|
+
break;
|
|
672
|
+
case "scroll":
|
|
673
|
+
i.alt(g, u, ["up"]);
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
}, /=/, /\s/), i.has("id")) {
|
|
677
|
+
var c = new (t.vttjs.VTTRegion || t.window.VTTRegion)();
|
|
678
|
+
c.width = i.get("width", 100), c.lines = i.get("lines", 3), c.regionAnchorX = i.get("regionanchorX", 0), c.regionAnchorY = i.get("regionanchorY", 100), c.viewportAnchorX = i.get("viewportanchorX", 0), c.viewportAnchorY = i.get("viewportanchorY", 100), c.scroll = i.get("scroll", ""), t.onregion && t.onregion(c), t.regionList.push({
|
|
679
|
+
id: i.get("id"),
|
|
680
|
+
region: c
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function x(n) {
|
|
685
|
+
var i = new w();
|
|
686
|
+
E(n, function(c, g) {
|
|
687
|
+
switch (c) {
|
|
688
|
+
case "MPEGT":
|
|
689
|
+
i.integer(c + "S", g);
|
|
690
|
+
break;
|
|
691
|
+
case "LOCA":
|
|
692
|
+
i.set(c + "L", P(g));
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}, /[^\d]:/, /,/), t.ontimestampmap && t.ontimestampmap({
|
|
696
|
+
MPEGTS: i.get("MPEGTS"),
|
|
697
|
+
LOCAL: i.get("LOCAL")
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
function h(n) {
|
|
701
|
+
n.match(/X-TIMESTAMP-MAP/) ? E(n, function(i, c) {
|
|
702
|
+
switch (i) {
|
|
703
|
+
case "X-TIMESTAMP-MAP":
|
|
704
|
+
x(c);
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
}, /=/) : E(n, function(i, c) {
|
|
708
|
+
switch (i) {
|
|
709
|
+
case "Region":
|
|
710
|
+
s(c);
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
}, /:/);
|
|
714
|
+
}
|
|
715
|
+
try {
|
|
716
|
+
var f;
|
|
717
|
+
if (t.state === "INITIAL") {
|
|
718
|
+
if (!/\r\n|\n/.test(t.buffer))
|
|
719
|
+
return this;
|
|
720
|
+
f = r();
|
|
721
|
+
var l = f.match(/^WEBVTT([ \t].*)?$/);
|
|
722
|
+
if (!l || !l[0])
|
|
723
|
+
throw new v(v.Errors.BadSignature);
|
|
724
|
+
t.state = "HEADER";
|
|
725
|
+
}
|
|
726
|
+
for (var a = !1; t.buffer; ) {
|
|
727
|
+
if (!/\r\n|\n/.test(t.buffer))
|
|
728
|
+
return this;
|
|
729
|
+
switch (a ? a = !1 : f = r(), t.state) {
|
|
730
|
+
case "HEADER":
|
|
731
|
+
/:/.test(f) ? h(f) : f || (t.state = "ID");
|
|
732
|
+
continue;
|
|
733
|
+
case "NOTE":
|
|
734
|
+
f || (t.state = "ID");
|
|
735
|
+
continue;
|
|
736
|
+
case "ID":
|
|
737
|
+
if (/^NOTE($|[ \t])/.test(f)) {
|
|
738
|
+
t.state = "NOTE";
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
if (!f)
|
|
742
|
+
continue;
|
|
743
|
+
t.cue = new (t.vttjs.VTTCue || t.window.VTTCue)(0, 0, "");
|
|
744
|
+
try {
|
|
745
|
+
t.cue.align = "center";
|
|
746
|
+
} catch {
|
|
747
|
+
t.cue.align = "middle";
|
|
748
|
+
}
|
|
749
|
+
if (t.state = "CUE", f.indexOf("-->") === -1) {
|
|
750
|
+
t.cue.id = f;
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
// Process line as start of a cue.
|
|
754
|
+
/*falls through*/
|
|
755
|
+
case "CUE":
|
|
756
|
+
try {
|
|
757
|
+
V(f, t.cue, t.regionList);
|
|
758
|
+
} catch (n) {
|
|
759
|
+
t.reportOrThrowError(n), t.cue = null, t.state = "BADCUE";
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
t.state = "CUETEXT";
|
|
763
|
+
continue;
|
|
764
|
+
case "CUETEXT":
|
|
765
|
+
var o = f.indexOf("-->") !== -1;
|
|
766
|
+
if (!f || o && (a = !0)) {
|
|
767
|
+
t.oncue && t.oncue(t.cue), t.cue = null, t.state = "ID";
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
t.cue.text && (t.cue.text += `
|
|
771
|
+
`), t.cue.text += f.replace(/\u2028/g, `
|
|
772
|
+
`).replace(/u2029/g, `
|
|
773
|
+
`);
|
|
774
|
+
continue;
|
|
775
|
+
case "BADCUE":
|
|
776
|
+
f || (t.state = "ID");
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
} catch (n) {
|
|
781
|
+
t.reportOrThrowError(n), t.state === "CUETEXT" && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t.state = t.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
|
|
782
|
+
}
|
|
783
|
+
return this;
|
|
784
|
+
},
|
|
785
|
+
flush: function() {
|
|
786
|
+
var e = this;
|
|
787
|
+
try {
|
|
788
|
+
if (e.buffer += e.decoder.decode(), (e.cue || e.state === "HEADER") && (e.buffer += `
|
|
789
|
+
|
|
790
|
+
`, e.parse()), e.state === "INITIAL")
|
|
791
|
+
throw new v(v.Errors.BadSignature);
|
|
792
|
+
} catch (t) {
|
|
793
|
+
e.reportOrThrowError(t);
|
|
794
|
+
}
|
|
795
|
+
return e.onflush && e.onflush(), this;
|
|
796
|
+
}
|
|
797
|
+
}, O = y, O;
|
|
798
|
+
}
|
|
799
|
+
export {
|
|
800
|
+
Q as __require
|
|
801
|
+
};
|
|
802
|
+
//# sourceMappingURL=vtt.js.map
|