import { v as v4 } from "./v4.js";
import { n as normalizeComponent } from "./index.js";
const uuid = () => {
  return v4();
};
var render = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    ref: "progressBar",
    staticClass: "progress-bar",
    on: {
      "click": function($event) {
        $event.stopPropagation();
        return _vm.setProgress.apply(null, arguments);
      }
    }
  }, [_c("div", {
    staticClass: "progress-bar--normal"
  }), _c("div", {
    staticClass: "progress-bar--active",
    style: {
      width: _vm.progress + "%"
    }
  }), _c("div", {
    staticClass: "progress-bar--guide",
    class: _vm.randomClass,
    style: {
      left: _vm.guideProgress + "%"
    },
    on: {
      "click": function($event) {
        $event.stopPropagation();
      }
    }
  })]);
};
var staticRenderFns = [];
var index_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.progress-bar{position:relative;width:100%;height:100%}.progress-bar:hover .progress-bar--guide{display:block}.progress-bar--normal,.progress-bar--active{position:absolute;left:0;top:0;width:100%;height:4px;border-radius:32px}.progress-bar--normal{background:rgba(255,255,255,.25)}.progress-bar--active{background:#fff;width:0%}.progress-bar--guide{position:absolute;top:-8px;width:20px;height:20px;border-radius:50%;background:#fff;cursor:pointer;user-select:none;z-index:10}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script = {
  name: "progress-bar",
  props: {
    progress: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      clientWidth: 0,
      isDrag: false,
      startX: 0,
      endX: 0,
      maxProgress: 0,
      diffProgress: 0,
      randomClass: "clipper" + uuid()
    };
  },
  computed: {
    guideProgress({ progress }) {
      const diffProgress = (this.clientWidth - 10) / this.clientWidth;
      return progress * diffProgress;
    }
  },
  mounted() {
    this.init();
    window.addEventListener("resize", this.init);
    document.addEventListener("mousemove", this.onMouseMove, true);
    document.addEventListener("mouseup", this.onMouseUp, true);
    document.addEventListener("mousedown", this.onMouseDown, true);
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.init);
    document.removeEventListener("mousemove", this.onMouseMove, true);
    document.removeEventListener("mouseup", this.onMouseUp, true);
    document.removeEventListener("mousedown", this.onMouseDown, true);
  },
  methods: {
    init() {
      this.$nextTick(() => {
        this.clientWidth = this.$refs.progressBar.clientWidth;
        this.startX = this.$refs.progressBar.getBoundingClientRect().x;
        this.endX = this.startX + this.clientWidth;
      });
    },
    setProgress(e) {
      this.updateProgress(e.x);
    },
    updateProgress(offsetX) {
      const diff = offsetX - this.startX;
      const progress = diff / this.clientWidth * 100;
      this.$emit("update:progress", progress);
    },
    onMouseDown(e) {
      const className = e.target.className;
      if (className.includes(this.randomClass)) {
        this.isDrag = true;
      }
    },
    onMouseMove(e) {
      const offsetX = e.x;
      if (this.isDrag) {
        if (offsetX > this.endX) {
          return this.updateProgress(this.endX);
        } else if (offsetX < this.startX) {
          return this.updateProgress(this.startX);
        }
        this.updateProgress(offsetX);
      }
    },
    onMouseUp() {
      this.isDrag = false;
    }
  }
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
function __vue2_injectStyles(context) {
  for (let o in __cssModules) {
    this[o] = __cssModules[o];
  }
}
var ProgressBar = /* @__PURE__ */ function() {
  return __component__.exports;
}();
function formatTime(time, unit = "ms") {
  const duration = unit === "ms" ? ~~(time / 1e3) : ~~time;
  const minutes = Math.floor(duration / 60).toString().padStart(2, "0");
  const seconds = (duration % 60).toString().padStart(2, "0");
  return `${minutes}:${seconds}`;
}
function requestFullScreen(dom) {
  const _dom = dom;
  const openFullscreen = _dom.requestFullscreen || _dom.webkitRequestFullscreen || _dom.mozRequestFullscreen || (() => {
  });
  openFullscreen.apply(_dom);
}
function exitFullScreen() {
  const _dom = document;
  const closeFullscreen = _dom.exitFullscreen || _dom.webkitExitFullscreen || _dom.mozExitFullscreen || (() => {
  });
  closeFullscreen.apply(_dom);
}
function isFullScreen() {
  return document.fullscreenElement || document.msFullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || false;
}
export { ProgressBar as P, exitFullScreen as e, formatTime as f, isFullScreen as i, requestFullScreen as r };
