((typeof self !== 'undefined' ? self : this)["webpackJsonpcutting_mat_widgets"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpcutting_mat_widgets"] || []).push([[2],{

/***/ 106:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MarkerPlugin; });
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(102);
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(101);


var Component$1 = video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].getComponent("Component");
var TimeTooltip = video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].getComponent("TimeTooltip");

var MarkerPointTip = /*#__PURE__*/function (_Component$) {
  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(MarkerPointTip, _Component$);

  function MarkerPointTip(player, options) {
    var _this;

    _this = _Component$.call(this, player, options) || this;
    _this.options = options;
    _this.timeToltip = new TimeTooltip(player);

    _this.timeToltip.hide();

    _this.addChild(_this.timeToltip);

    _this.addClass("vjs-marker-point-tip");

    _this.timeToltip.el_.innerHTML = "\n      <p class=\"vjs-marker-point-tip-time\">" + video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].formatTime(_this.options.offset, 600) + "</p>\n      <p class=\"vjs-marker-point-tip-content\">" + (_this.options.data ? _this.options.data.content : "") + "</p>\n    ";
    return _this;
  }

  var _proto = MarkerPointTip.prototype;

  _proto.updatePosition = function updatePosition() {
    this.timeToltip.el_.style.left = "-" + this.timeToltip.el_.getBoundingClientRect().width / 2 + "px";
  };

  return MarkerPointTip;
}(Component$1);

var MarkerPoint = /*#__PURE__*/function (_Component$2) {
  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(MarkerPoint, _Component$2);

  function MarkerPoint(player, options) {
    var _this2;

    _this2 = _Component$2.call(this, player, options) || this;
    _this2.offset = options.offset;
    _this2.data = options.data;
    _this2.tip = new MarkerPointTip(player, {
      data: _this2.data,
      offset: _this2.offset
    });
    _this2.mouseDisplay = player.getDescendant(["ControlBar", "ProgressControl", "SeekBar", "MouseTimeDisplay"]);

    _this2.addChild(_this2.tip);

    _this2.enableTouchActivity();

    _this2.on("mouseenter", function (ev) {
      _this2.mouseDisplay.hide();

      _this2.tip.timeToltip.show();

      _this2.tip.updatePosition();
    });

    _this2.on("mouseleave", function (ev) {
      _this2.mouseDisplay.show();

      _this2.tip.timeToltip.hide();
    });

    _this2.on("mousedown", function (ev) {
      typeof options.onClick === "function" && options.onClick(ev);
    });

    return _this2;
  }

  var _proto2 = MarkerPoint.prototype;

  _proto2.createEl = function createEl() {
    return video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].dom.createEl("div", {
      className: "vjs-marker-point"
    });
  };

  _proto2.updatePosition = function updatePosition(duration) {
    this.el_ && (this.el_.style.left = this.offset / duration * 100 + "%");
  };

  return MarkerPoint;
}(Component$1);

var Component = video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].getComponent("Component");
var playerDuration;

var MarkerBar = /*#__PURE__*/function (_Component) {
  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(MarkerBar, _Component);

  MarkerBar.build = function build(player, options) {
    if (!(options.markers instanceof Array)) {
      options.markers = [];
    }

    var markers = [];

    for (var i = options.markers.length; i--;) {
      markers.push(new MarkerPoint(player, options.markers[i]));
    }

    return new MarkerBar(player, {
      markers: markers,
      barName: "markerPoint"
    });
  };

  function MarkerBar(player, options) {
    var _this3;

    _this3 = _Component.call(this, player, options) || this;
    options.markers.forEach(function (marker) {
      return _this3.addChild(marker);
    });

    var setMarkers = function setMarkers() {
      options.markers.forEach(function (marker) {
        marker.updatePosition(playerDuration);
      });
    };

    var onLoadedMetaData = function onLoadedMetaData() {
      playerDuration = player.duration();
      setMarkers();
      player.off("loadedmetadata", onLoadedMetaData);
    };

    if (playerDuration) {
      setMarkers();
    } else {
      player.on("loadedmetadata", onLoadedMetaData);
    }

    return _this3;
  }

  var _proto3 = MarkerBar.prototype;

  _proto3.createEl = function createEl() {
    return video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].dom.createEl("div", {
      className: "vjs-marker-bar"
    });
  };

  return MarkerBar;
}(Component);

video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].registerComponent("MarkerBar", MarkerBar);
var version = "0.0.8";
var plugin = "";
var videojs;

if (window.videojs) {
  videojs = window.videojs;
  console.warn("MarkerPlugin: \u68C0\u6D4B\u5230window.videojs");
} else {
  videojs = video_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"];
}

var Plugin = videojs.getPlugin("plugin");
var defaults = {};

var MarkerPlugin = /*#__PURE__*/function (_Plugin) {
  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(MarkerPlugin, _Plugin);

  function MarkerPlugin(player, options) {
    var _this4;

    _this4 = _Plugin.call(this, player) || this;

    _this4.player.addClass("vjs-marker-plugin");

    _this4.updateOptions(options);

    return _this4;
  }

  var _proto4 = MarkerPlugin.prototype;

  _proto4.createMarkerBar = function createMarkerBar() {
    this.markerBar = MarkerBar.build(this.player, {
      markers: this.options.markers
    });
    return this.markerBar;
  };

  _proto4.updateOptions = function updateOptions(options) {
    this.options = videojs.mergeOptions(defaults, options);
    if (this.markerBar) this.markerBar.dispose();
    var container = this.player.getDescendant(["ControlBar", "ProgressControl", "SeekBar"]);
    this.createMarkerBar();
    container.addChild(this.markerBar);
  };

  return MarkerPlugin;
}(Plugin);

MarkerPlugin.defaultState = {};
MarkerPlugin.VERSION = version;
videojs.registerPlugin("markerPlugin", MarkerPlugin);


/***/ })

}]);