/*
 * Device is an iPhone
 *
 * @type {Boolean}
 * @constant
 * @private
 */

/*#__PURE__*/

/**
       * The minimal observable subscription method.
       * @param {Object} observer Any object that can be used as an observer.
       * The observer object should have a `next` method.
       * @returns {subscription} An object with an `unsubscribe` method that can
       * be used to unsubscribe the observable from the store, and prevent further
       * emission of values from the observable.
       */

/**
     * Fires when the playing speed of the audio/video is changed
     */

/**
     * Get percentage of video played
     *
     * @return {Number} Percentage played
     * @method getPercent
     */

/**
   * Adds a change listener. It will be called any time an action is dispatched,
   * and some part of the state tree may potentially have changed. You may then
   * call `getState()` to read the current state tree inside the callback.
   *
   * You may call `dispatch()` from a change listener, with the following
   * caveats:
   *
   * 1. The subscriptions are snapshotted just before every `dispatch()` call.
   * If you subscribe or unsubscribe while the listeners are being invoked, this
   * will not have any effect on the `dispatch()` that is currently in progress.
   * However, the next `dispatch()` call, whether nested or not, will use a more
   * recent snapshot of the subscription list.
   *
   * 2. The listener should not expect to see all state changes, as the state
   * might have been updated multiple times during a nested `dispatch()` before
   * the listener is called. It is, however, guaranteed that all subscribers
   * registered before the `dispatch()` started will be called with the latest
   * state by the time it exits.
   *
   * @param {Function} listener A callback to be invoked on every dispatch.
   * @returns {Function} A function to remove this change listener.
   */

/**
   * Dispatches an action. It is the only way to trigger a state change.
   *
   * The `reducer` function, used to create the store, will be called with the
   * current state tree and the given `action`. Its return value will
   * be considered the **next** state of the tree, and the change listeners
   * will be notified.
   *
   * The base implementation only supports plain object actions. If you want to
   * dispatch a Promise, an Observable, a thunk, or something else, you need to
   * wrap your store creating function into the corresponding middleware. For
   * example, see the documentation for the `redux-thunk` package. Even the
   * middleware will eventually dispatch plain object actions using this method.
   *
   * @param {Object} action A plain object representing “what changed”. It is
   * a good idea to keep actions serializable so you can record and replay user
   * sessions, or use the time travelling `redux-devtools`. An action must have
   * a `type` property which may not be `undefined`. It is a good idea to use
   * string constants for action types.
   *
   * @returns {Object} For convenience, the same action object you dispatched.
   *
   * Note that, if you use a custom middleware, it may wrap `dispatch()` to
   * return something else (for example, a Promise you can await).
   */

/**
   * Interoperability point for observable/reactive libraries.
   * @returns {observable} A minimal observable of state changes.
   * For more information, see the observable proposal:
   * https://github.com/tc39/proposal-observable
   */

/**
   * Reads the state tree managed by the store.
   *
   * @returns {any} The current state tree of your application.
   */

/**
   * Replaces the reducer currently used by the store to calculate the state.
   *
   * You might need this if your app implements code splitting and you want to
   * load some of the reducers dynamically. You might also need this if you
   * implement a hot reloading mechanism for Redux.
   *
   * @param {Function} nextReducer The reducer for the store to use instead.
   * @returns {void}
   */

/**
   * This makes a shallow copy of currentListeners so we can use
   * nextListeners as a temporary list while dispatching.
   *
   * This prevents any bugs around consumers calling
   * subscribe/unsubscribe in the middle of a dispatch.
   */

/**
 * @deprecated
 *
 * **We recommend using the `configureStore` method
 * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
 *
 * Redux Toolkit is our recommended approach for writing Redux logic today,
 * including store setup, reducers, data fetching, and more.
 *
 * **For more details, please read this Redux docs page:**
 * **https://redux.js.org/introduction/why-rtk-is-redux-today**
 *
 * `configureStore` from Redux Toolkit is an improved version of `createStore` that
 * simplifies setup and helps avoid common bugs.
 *
 * You should not be using the `redux` core package by itself today, except for learning purposes.
 * The `createStore` method from the core `redux` package will not be removed, but we encourage
 * all users to migrate to using Redux Toolkit for all Redux code.
 *
 * If you want to use `createStore` without this visual deprecation warning, use
 * the `legacy_createStore` import instead:
 *
 * `import { legacy_createStore as createStore} from 'redux'`
 *
 */

/**
 * @file format-time.js
 *
 * Format seconds as a time string, H:MM:SS or M:SS
 * Supplying a guide (in seconds) will force a number of leading zeros
 * to cover the length of the guide
 *
 * @param  {Number} seconds Number of seconds to be turned into a string
 * @param  {Number} guide   Number (in seconds) to model the string after
 * @return {String}         Time formatted as H:MM:SS or M:SS
 * @private
 * @function formatTime
 */

/**
 * @param {any} obj The object to inspect.
 * @returns {boolean} True if the argument appears to be a plain object.
 */

/**
 * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
 *
 * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
 * during build.
 * @param {number} code
 */

/**
 * Composes single-argument functions from right to left. The rightmost
 * function can take multiple arguments as it provides the signature for
 * the resulting composite function.
 *
 * @param {...Function} funcs The functions to compose.
 * @returns {Function} A function obtained by composing the argument functions
 * from right to left. For example, compose(f, g, h) is identical to doing
 * (...args) => f(g(h(...args))).
 */

/**
 * Creates a Redux store that holds the state tree.
 *
 * **We recommend using `configureStore` from the
 * `@reduxjs/toolkit` package**, which replaces `createStore`:
 * **https://redux.js.org/introduction/why-rtk-is-redux-today**
 *
 * The only way to change the data in the store is to call `dispatch()` on it.
 *
 * There should only be a single store in your app. To specify how different
 * parts of the state tree respond to actions, you may combine several reducers
 * into a single reducer function by using `combineReducers`.
 *
 * @param {Function} reducer A function that returns the next state tree, given
 * the current state tree and the action to handle.
 *
 * @param {any} [preloadedState] The initial state. You may optionally specify it
 * to hydrate the state from the server in universal apps, or to restore a
 * previously serialized user session.
 * If you use `combineReducers` to produce the root reducer function, this must be
 * an object with the same shape as `combineReducers` keys.
 *
 * @param {Function} [enhancer] The store enhancer. You may optionally specify it
 * to enhance the store with third-party capabilities such as middleware,
 * time travel, persistence, etc. The only store enhancer that ships with Redux
 * is `applyMiddleware()`.
 *
 * @returns {Store} A Redux store that lets you read the state, dispatch actions
 * and subscribe to changes.
 */

/**
 * Creates a store enhancer that applies middleware to the dispatch method
 * of the Redux store. This is handy for a variety of tasks, such as expressing
 * asynchronous actions in a concise manner, or logging every action payload.
 *
 * See `redux-thunk` package as an example of the Redux middleware.
 *
 * Because middleware is potentially asynchronous, this should be the first
 * store enhancer in the composition chain.
 *
 * Note that each middleware will be given the `dispatch` and `getState` functions
 * as named arguments.
 *
 * @param {...Function} middlewares The middleware chain to be applied.
 * @returns {Function} A store enhancer applying the middleware.
 */

/**
 * Get pointer position in a React Node ref
 * Returns an object with x and y coordinates.
 * The base on the coordinates are the bottom left of the element.
 *
 * @function getPointerPosition
 * @param {ReactNodeRef} el React Node ref on which to get the pointer position on
 * @param {Event} event Event object
 * @return {Object} This object will have x and y coordinates corresponding to the mouse position
 */

/**
 * Offset Left
 * getBoundingClientRect technique from
 * John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
 *
 * @function findElPosition
 * @param {ReactNodeRef} el React Node ref from which to get offset
 * @return {Object}
 */

/**
 * Prints a warning in the console if it exists.
 *
 * @param {String} message The warning message.
 * @returns {void}
 */

/**
 * Temporary utility for generating the warnings
 */

/**
 * These are private action types reserved by Redux.
 * For any unknown actions, you must return the current state.
 * If the current state is undefined, you must return the initial state.
 * Do not reference these action types directly in your code.
 */

/**
 * Turns an object whose values are action creators, into an object with the
 * same keys, but with every function wrapped into a `dispatch` call so they
 * may be invoked directly. This is just a convenience method, as you can call
 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
 *
 * For convenience, you can also pass an action creator as the first argument,
 * and get a dispatch wrapped function in return.
 *
 * @param {Function|Object} actionCreators An object whose values are action
 * creator functions. One handy way to obtain it is to use ES6 `import * as`
 * syntax. You may also pass a single function.
 *
 * @param {Function} dispatch The `dispatch` function available on your Redux
 * store.
 *
 * @returns {Function|Object} The object mimicking the original object, but with
 * every action creator wrapped into the `dispatch` call. If you passed a
 * function as `actionCreators`, the return value will also be a single
 * function.
 */

/**
 * Turns an object whose values are different reducer functions, into a single
 * reducer function. It will call every child reducer, and gather their results
 * into a single state object, whose keys correspond to the keys of the passed
 * reducer functions.
 *
 * @param {Object} reducers An object whose values correspond to different
 * reducer functions that need to be combined into one. One handy way to obtain
 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
 * undefined for any action. Instead, they should return their initial state
 * if the state passed to them was undefined, and the current state for any
 * unrecognized action.
 *
 * @returns {Function} A reducer function that invokes every reducer inside the
 * passed object, and builds a state object with the same shape.
 */

/***/

// '-' is false for all relational operators (e.g. <, >=) so this setting

// <MyComponent isVideoChild />

// A handler for events that

// Add a new text track to the video

// Always show at least one digit of minutes.

// Android sometimes returns slightly off decimal values, so need to round

// Any reducers that existed in both the new and old rootReducer

// Change the video source and re-load the video:

// Check if leading zero is need for seconds

// Check if the element belongs to a video element

// Check if we need to show hours

// Check if your browser can play different types of video:

// Decrease speed

// Decrease volume 5%

// Depends mode to implement different actions

// Don't let video end while scrubbing.

// Down (40) key press

// Down arrow

// End

// Enter (13) key

// Escape (27) key

// Fired when the duration of

// Fired when the end of the media resource

// Fired when the player has

// Fired when the user agent

// Fired whenever the media begins waiting

// Fired whenever the media has been paused

// Fired whenever the media has been started

// Fired whenever the player

// Fired while the user agent

// Fires when an error occurred

// Fires when the browser has loaded

// Fires when the browser is

// Fires when the browser is trying to

// Fires when the current

// Fires when the current playlist is empty

// Fires when the loading of an audio/video is aborted

// Fires when the volume has been changed

// For the 'subtitles-off' button, the first condition will never match

// Go to end of video

// Handle Fullscreen Change

// Home

// If Width contains "auto", set "auto" in style

// If hours are showing, we may need to add a leading zero.

// Increase speed

// Increase volume 5%

// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of

// Inlined version of the `symbol-observable` polyfill

// Its weird event positions make the player seek a wrong time.

// Left and Down Arrows

// Left arrow

// On iOS safari, a subsequent mouseup event will be fired after touchend.

// Pass mode into parent function

// Protect against no duration and other division issues

// Remove event listener

// Right arrow

// Set new time (tell video to seek to new time)

// Shift + <

// Shift + >

// Shows load progress

// Shows play progress

// Support Space (32) or Enter (13) key operation to fire a click event

// Tab (9) key

// The Facebook app's UIWebView identifies as both an iPhone and iPad, so

// The aspect ratio is either used directly or to calculate width and height.

// This action has a similiar effect to ActionTypes.INIT.

// This is used to make sure we don't warn about the same

// Up (38) key

// Up and Right Arrows

// Up arrow

// Use any height that's been specifically set

// Use any width that's been specifically set

// When a store is created, an "INIT" action is dispatched so that every

// add child elements to represent the individual buffered time ranges

// add onError to <source />

// begins looking for media data

// blur an element

// calling preventDefault (at touchend phase) will prevent the mouseup event

// cancel it

// check if an element has a class name

// check if two components are the same type

// console.log(e, 'Video is not ready.')

// const appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;

// const webkitVersionMap = (/AppleWebKit\/([\d.]+)/i).exec(USER_AGENT);

// during the loading of an audio/video

// elements

// enter or exist full screen

// eslint-disable-next-line no-console

// eslint-disable-next-line prefer-rest-params

// event.preventDefault();

// event.stopPropagation();

// f

// filter them by `disabled` property

// finished jumping to a new time

// focus an element

// focus root when switching fullscreen mode to avoid confusion #276

// get all video properties

// get media data, but data is not available

// get playback rate

// get redux state

// get the percent width of a time compared to the total end

// handle invalid times

// hide it after 0.5s

// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/

// if it shows the `Off` menu, the first item is `Off`

// ignore invalid text track kind

// ignore order from parent

// intentionally not getting media data

// is downloading media data

// is jumping to a new time

// is reached (currentTime == duration)

// it's just for the key down event

// j

// jump back x seconds

// jump forward x seconds

// k

// keys multiple times.

// l

// make sure the children can get the video property

// merge default children

// merge the shortcuts from props

// meta data for the audio/video

// no NaN

// only accept <source />, <track />,

// only displays for shortcut so far

// only if player is active and player is ready

// only keep <source />, <track />, <MyComponent isVideoChild /> elements

// pause the video

// play the video

// playback position has changed

// player resize

// previous animation is not finished

// reducer returns their initial state. This effectively populates

// remove className

// seek video by time

// set playback rate

// show it

// signal that waiting has ended

// so all subtitles will be turned off

// sort them by `order` property

// spacebar

// speed of video

// subscribe state change

// subscribe to operation state change

// subscribe to player state change

// the Video component

// the current frame of the audio/video

// the html5 video

// the initial state tree.

// the media resource is first known or changed

// the new state tree with any relevant data from the old one.

// the width of the progress bar

// this component dose not render anything

// to identify iPhones, we need to exclude iPads.

// to make sure the children can get video property

// toggle play

// update operation

// used in Player

// video height

// video width

// will add the minimum number of fields specified by the guide

// will receive the previous state. This effectively populates

// { player, operation }
