@ezuikit/player-theme 1.0.0 → 1.0.1-alpha.0

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/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v1.0.0
3
- * Copyright (c) 2025-11-03 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v1.0.1-alpha.0
3
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -366,7 +366,12 @@
366
366
  /**
367
367
  * 播放器的类名前缀
368
368
  */ var PREFIX_CLASS = 'ezplayer';
369
- var DATE_PICKER_ICON_WIDTH = 36;
369
+ /** */ var DATE_PICKER_ICON_WIDTH = 36;
370
+ /** 填充模式 */ var THEME_SCALE_MODE_TYPE = {
371
+ /** 画面完全填充canvas区域,画面会被拉伸 */ full: 0,
372
+ /** 画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边 */ auto: 1,
373
+ /** 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全 */ fullAuto: 2
374
+ };
370
375
  // 切换主题时把当前的状态传给控件, 而不是传 theme 对象, 为了解耦
371
376
  // 不要添加方法,只添加状态
372
377
  var THEME_PROPS = [
@@ -789,8 +794,8 @@
789
794
  return Control;
790
795
  }(EventEmitter);
791
796
 
792
- function _extends$r() {
793
- _extends$r = Object.assign || function(target) {
797
+ function _extends$q() {
798
+ _extends$q = Object.assign || function(target) {
794
799
  for(var i = 1; i < arguments.length; i++){
795
800
  var source = arguments[i];
796
801
  for(var key in source){
@@ -801,7 +806,7 @@
801
806
  }
802
807
  return target;
803
808
  };
804
- return _extends$r.apply(this, arguments);
809
+ return _extends$q.apply(this, arguments);
805
810
  }
806
811
  function _inherits$q(subClass, superClass) {
807
812
  if (typeof superClass !== "function" && superClass !== null) {
@@ -832,7 +837,7 @@
832
837
  function Loading(options) {
833
838
  if (options === void 0) options = {};
834
839
  var _this;
835
- _this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$r({}, options, {
840
+ _this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$q({}, options, {
836
841
  tagName: 'div',
837
842
  controlType: 'block',
838
843
  classNameSuffix: 'loading'
@@ -870,8 +875,8 @@
870
875
  return Loading;
871
876
  }(Control);
872
877
 
873
- function _extends$q() {
874
- _extends$q = Object.assign || function(target) {
878
+ function _extends$p() {
879
+ _extends$p = Object.assign || function(target) {
875
880
  for(var i = 1; i < arguments.length; i++){
876
881
  var source = arguments[i];
877
882
  for(var key in source){
@@ -882,7 +887,7 @@
882
887
  }
883
888
  return target;
884
889
  };
885
- return _extends$q.apply(this, arguments);
890
+ return _extends$p.apply(this, arguments);
886
891
  }
887
892
  function _inherits$p(subClass, superClass) {
888
893
  if (typeof superClass !== "function" && superClass !== null) {
@@ -918,7 +923,7 @@
918
923
  function Poster(options) {
919
924
  if (options === void 0) options = {};
920
925
  var _this;
921
- _this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$q({}, options, {
926
+ _this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$p({}, options, {
922
927
  tagName: 'div',
923
928
  controlType: 'block',
924
929
  classNameSuffix: 'poster'
@@ -1175,8 +1180,8 @@
1175
1180
  }
1176
1181
  };
1177
1182
 
1178
- function _extends$p() {
1179
- _extends$p = Object.assign || function(target) {
1183
+ function _extends$o() {
1184
+ _extends$o = Object.assign || function(target) {
1180
1185
  for(var i = 1; i < arguments.length; i++){
1181
1186
  var source = arguments[i];
1182
1187
  for(var key in source){
@@ -1187,7 +1192,7 @@
1187
1192
  }
1188
1193
  return target;
1189
1194
  };
1190
- return _extends$p.apply(this, arguments);
1195
+ return _extends$o.apply(this, arguments);
1191
1196
  }
1192
1197
  function _inherits$o(subClass, superClass) {
1193
1198
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1218,7 +1223,7 @@
1218
1223
  function Message(options) {
1219
1224
  if (options === void 0) options = {};
1220
1225
  var _this;
1221
- _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$p({}, options, {
1226
+ _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$o({}, options, {
1222
1227
  tagName: 'div',
1223
1228
  controlType: 'block'
1224
1229
  }))) || this;
@@ -1371,8 +1376,8 @@
1371
1376
  if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
1372
1377
  return Constructor;
1373
1378
  }
1374
- function _extends$o() {
1375
- _extends$o = Object.assign || function(target) {
1379
+ function _extends$n() {
1380
+ _extends$n = Object.assign || function(target) {
1376
1381
  for(var i = 1; i < arguments.length; i++){
1377
1382
  var source = arguments[i];
1378
1383
  for(var key in source){
@@ -1383,7 +1388,7 @@
1383
1388
  }
1384
1389
  return target;
1385
1390
  };
1386
- return _extends$o.apply(this, arguments);
1391
+ return _extends$n.apply(this, arguments);
1387
1392
  }
1388
1393
  function _inherits$n(subClass, superClass) {
1389
1394
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1412,7 +1417,7 @@
1412
1417
  _inherits$n(Play, Control);
1413
1418
  function Play(options) {
1414
1419
  var _this;
1415
- _this = Control.call(this, _extends$o({}, options, {
1420
+ _this = Control.call(this, _extends$n({}, options, {
1416
1421
  tagName: 'span',
1417
1422
  controlType: 'button',
1418
1423
  classNameSuffix: 'play'
@@ -1464,641 +1469,704 @@
1464
1469
  }(Control);
1465
1470
 
1466
1471
  /*
1467
- * @skax/picker v1.0.3
1468
- * Copyright (c) 2025-10-28 ShineShao <xiaoshaoqq@gmail.com>
1472
+ * @skax/picker v1.1.2
1473
+ * Copyright (c) 2025-11-09 ShineShao <xiaoshaoqq@gmail.com>
1469
1474
  * Released under the MIT License.
1470
1475
  */
1471
- /**
1472
- * PickerProvider 单例类
1473
- */ class PickerProvider {
1474
- /**
1475
- * 获取单例实例
1476
- * @returns Picker 实例
1477
- */ static getInstance() {
1478
- if (!PickerProvider.instance) {
1479
- PickerProvider.instance = new PickerProvider();
1480
- }
1481
- return PickerProvider.instance;
1482
- }
1483
- /**
1484
- * 添加picker
1485
- * @param picker Picker 实例
1486
- */ add(picker) {
1487
- this.pickers.push(picker);
1488
- }
1489
- /**
1490
- * 移除picker
1491
- * @param picker Picker 实例
1492
- */ remove(picker) {
1493
- const index = this.pickers.indexOf(picker);
1494
- if (index > -1) {
1495
- this.pickers.splice(index, 1);
1496
- } else {
1497
- console.warn("Picker not found in the provider.");
1498
- }
1499
- }
1500
- /**
1501
- * 关闭其他picker
1502
- * @param e 事件
1503
- */ closeOther(e) {
1504
- for (const p of this.pickers){
1505
- var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1506
- if (p && !(e.target === p.$container || ((_p_$container = p.$container) == null ? void 0 : (_p_$container_contains = _p_$container.contains) == null ? void 0 : _p_$container_contains.call(_p_$container, e.target)) || e.target === p.$wrapperContent || ((_p_$wrapperContent = p.$wrapperContent) == null ? void 0 : (_p_$wrapperContent_contains = _p_$wrapperContent.contains) == null ? void 0 : _p_$wrapperContent_contains.call(_p_$wrapperContent, e.target)))) {
1507
- p.open = false;
1508
- }
1509
- }
1510
- }
1511
- constructor(){
1512
- this.pickers = [];
1513
- // Private constructor to prevent instantiation
1514
- }
1515
- }
1516
- const pickerProvider = PickerProvider.getInstance();
1517
1476
 
1518
- /**
1519
- * picker 位置
1520
- *
1521
- * | top | tl | tr | bottom | bl | br |
1522
- * |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
1523
- * | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
1524
- *
1525
- * @public
1526
- */ // eslint-disable-next-line @typescript-eslint/naming-convention
1527
- const PICKER_PLACEMENT = [
1528
- "top",
1529
- "tl",
1530
- "tr",
1531
- "bottom",
1532
- "bl",
1533
- "br"
1534
- ];
1535
- /**
1536
- * 默认样式前缀
1537
- */ const PICKER_PREFIX_CLS = "epicker";
1538
- /**
1539
- * Picker 默认值
1540
- */ // eslint-disable-next-line @typescript-eslint/naming-convention
1541
- const __PICKER_DEFAULT_OPTIONS__ = {
1542
- getPopupContainer: ()=>document.body,
1543
- wrapClassName: "",
1544
- open: false,
1545
- placement: "br",
1546
- offset: [
1547
- 0,
1548
- 0
1549
- ],
1550
- zIndex: 1000,
1551
- content: "",
1552
- trigger: "click",
1553
- mouseLeaveDelay: 0.1,
1554
- mouseEnterDelay: 0.1,
1555
- isMobile: false
1556
- };
1557
- /**
1558
- * Picker 弹窗, 支持 PC 和移动端
1559
- * @remarks
1560
- * Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
1561
- * 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
1562
- *
1563
- * @example
1564
- * ```ts
1565
- * import "@skax/picker/dist/style/css";
1566
- * import Picker from '@skax/picker';
1567
- * const picker = new Picker(document.getElementById('picker-container'),
1568
- * {
1569
- * placement: 'bottom',
1570
- * content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
1571
- * trigger: 'click',
1572
- * isMobile: false,
1573
- * });
1574
- * picker.open = true; // 打开弹窗
1575
- * picker.setPlacement('top'); // 设置弹窗位置
1576
- * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1577
- * picker.destroy(); // 销毁弹窗
1578
- * ```
1579
- */ class Picker {
1580
- /**
1581
- * picker 内容挂载节点
1582
- * @example
1583
- * ```ts
1584
- * console.log(picker.$popupContainer); // 获取挂载节点
1585
- * ```
1586
- */ get $popupContainer() {
1587
- // prettier-ignore
1588
- if (typeof this._options.getPopupContainer === "function") {
1589
- const $popupContainer = this._options.getPopupContainer();
1590
- if ($popupContainer) {
1591
- if ([
1592
- "INPUT",
1593
- "CANVAS",
1594
- "VIDEO",
1595
- "IMG"
1596
- ].includes($popupContainer == null ? void 0 : $popupContainer.tagName)) {
1597
- console.warn("popup container node does not support child elements, default body!");
1598
- } else {
1599
- // prettier-ignore
1600
- if ($popupContainer !== document.body) $popupContainer.style.cssText += `position: relative;`;
1601
- return $popupContainer;
1602
- }
1603
- } else {
1604
- console.warn("popup container does not exist, default body!");
1605
- }
1606
- }
1607
- return document.body;
1608
- }
1609
- /**
1610
- * 获取当前打开状态
1611
- * @example
1612
- * ```ts
1613
- * console.log(picker.open); // 获取当前打开状态
1614
- * picker.open = true; // 打开
1615
- * picker.open = false; // 关闭
1616
- * ```
1617
- */ get open() {
1618
- return this._open;
1619
- }
1620
- set open(open) {
1621
- if (this._disabled) {
1622
- return;
1623
- }
1624
- if (this._open !== !!open) {
1625
- this._animationTimerClear();
1626
- if (this._timer) {
1627
- clearTimeout(this._timer);
1628
- this._timer = null;
1629
- }
1630
- if (open) {
1631
- this._timer = setTimeout(()=>{
1632
- this.$wrapperContent.style.display = "inline-flex";
1633
- this.$wrapperContent.style.pointerEvents = "";
1634
- // prettier-ignore
1635
- if (this._options.isMobile) document.body.classList.add(`${PICKER_PREFIX_CLS}-body-noscroll`);
1636
- this._animationTimer = setTimeout(()=>{
1637
- this._animationTimerClear();
1638
- this.$wrapperContent.style.opacity = "1";
1639
- }, 0);
1640
- requestAnimationFrame(()=>{
1641
- this._setPlacement();
1642
- });
1643
- this._OpenChange = open;
1644
- this._onOpenChange(open);
1645
- }, // prettier-ignore
1646
- (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1647
- } else {
1648
- this._timer = setTimeout(()=>{
1649
- this.$wrapperContent.style.opacity = "0";
1650
- this.$wrapperContent.style.pointerEvents = "none";
1651
- // prettier-ignore
1652
- if (this._options.isMobile) document.body.classList.remove(`${PICKER_PREFIX_CLS}-body-noscroll`);
1653
- this._animationTimer = setTimeout(()=>{
1654
- this._animationTimerClear();
1655
- this.$wrapperContent.style.display = "none";
1656
- }, 301); // css 动画是 300ms
1657
- this._OpenChange = open;
1658
- this._onOpenChange(open);
1659
- }, // prettier-ignore
1660
- (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1661
- }
1662
- if (this._OpenChange === open) {
1663
- if (this._timer) {
1664
- clearTimeout(this._timer);
1665
- this._timer = null;
1666
- }
1667
- }
1668
- this._open = !!open;
1669
- }
1670
- }
1671
- /**
1672
- * 获取或设置禁用状态
1673
- * @example
1674
- * ```ts
1675
- * picker.disabled = true; // 禁用
1676
- * picker.disabled = false; // 启用
1677
- * console.log(picker.disabled); // 获取禁用状态
1678
- * ```
1679
- */ get disabled() {
1680
- return this._disabled;
1681
- }
1682
- set disabled(disabled) {
1683
- if (disabled) {
1684
- var _this_$container_classList_add, _this_$container_classList, _this_$container;
1685
- (_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, `${PICKER_PREFIX_CLS}-disabled`);
1686
- } else {
1687
- var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
1688
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, `${PICKER_PREFIX_CLS}-disabled`);
1689
- }
1690
- this._disabled = disabled;
1691
- }
1692
- /**
1693
- * 设置弹出位置(移动端不生效)
1694
- * @param placement - 弹出位置
1695
- * @example
1696
- * ```ts
1697
- * picker.setPlacement("top");
1698
- * picker.setPlacement("tl");
1699
- * picker.setPlacement("tr");
1700
- * picker.setPlacement("bottom");
1701
- * picker.setPlacement("bl");
1702
- * picker.setPlacement("br");
1703
- * ```
1704
- */ setPlacement(placement) {
1705
- if (this._disabled) {
1706
- return;
1707
- }
1708
- if (PICKER_PLACEMENT.includes(placement)) {
1709
- this._options.placement = placement;
1710
- } else {
1711
- console.warn(`${placement} is not a valid placement`);
1712
- }
1713
- this._setPlacement();
1714
- }
1715
- /**
1716
- * 销毁
1717
- * @example
1718
- * ```ts
1719
- * picker.destroy();
1720
- * ```
1721
- */ destroy() {
1722
- this._animationTimerClear();
1723
- this._removeHtml();
1724
- pickerProvider.remove(this);
1725
- }
1726
- /**
1727
- * 设置内容(会覆盖之前内容)
1728
- * @param html - html 字符串内容
1729
- * @example
1730
- * ```ts
1731
- * picker.innerHTML('<div>内容</div>');
1732
- * ```
1733
- */ innerHTML(html) {
1734
- if (this.$body) {
1735
- this.$body.innerHTML = html || "";
1736
- this._setPlacement();
1737
- }
1738
- }
1739
- // --------------------------------------------------------------------------
1740
- // Private methods
1741
- // --------------------------------------------------------------------------
1742
- /**
1743
- * picker 面板展开或关闭变化时触发
1744
- * @param open - true: 展开, false:关闭
1745
- */ _onOpenChange(open) {
1746
- this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1747
- }
1748
- /**
1749
- * 移除动画定时器
1750
- */ _animationTimerClear() {
1751
- if (this._animationTimer) {
1752
- clearTimeout(this._animationTimer);
1753
- this._animationTimer = null;
1754
- }
1755
- }
1756
- /**
1757
- * 移除html
1758
- */ _removeHtml() {
1759
- var // eslint-disable-next-line @typescript-eslint/unbound-method
1760
- _this_$wrapperContent, _this_$container_removeEventListener, _this_$container;
1761
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener("click", this._onContentClick);
1762
- (_this_$container = this.$container) == null ? void 0 : (_this_$container_removeEventListener = _this_$container.removeEventListener) == null ? void 0 : _this_$container_removeEventListener.call(_this_$container, "click", this._onContentClick);
1763
- if (this._options.trigger === "click") {
1764
- var _this_$container_removeEventListener1, _this_$container1;
1765
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, "click", this._onShow);
1766
- }
1767
- if (this._options.trigger === "hover") {
1768
- var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4, // prettier-ignore
1769
- _this_$wrapperContent1, _this_$wrapperContent2;
1770
- (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_removeEventListener2 = _this_$container2.removeEventListener) == null ? void 0 : _this_$container_removeEventListener2.call(_this_$container2, "mouseenter", this._onShow);
1771
- (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_removeEventListener3 = _this_$container3.removeEventListener) == null ? void 0 : _this_$container_removeEventListener3.call(_this_$container3, "mouseover", this._onShow);
1772
- (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_removeEventListener4 = _this_$container4.removeEventListener) == null ? void 0 : _this_$container_removeEventListener4.call(_this_$container4, "mouseleave", this._onHide);
1773
- (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
1774
- (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener("mouseleave", this._onHide);
1775
- }
1776
- if (!this._options.isMobile) {
1777
- // eslint-disable-next-line @typescript-eslint/unbound-method
1778
- window.removeEventListener("blur", this._onHide);
1779
- // eslint-disable-next-line @typescript-eslint/unbound-method
1780
- document.removeEventListener("visibilitychange", this._onHide);
1781
- // eslint-disable-next-line @typescript-eslint/unbound-method
1782
- window.removeEventListener("resize", this._onHide);
1783
- // eslint-disable-next-line @typescript-eslint/unbound-method
1784
- document.removeEventListener("click", this._onDocumentClick);
1785
- }
1786
- if (this._$mask) {
1787
- this._$mask.removeEventListener("click", this._onHide);
1788
- try {
1789
- var _this_$wrapperContent3;
1790
- (_this_$wrapperContent3 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent3.removeChild(this._$mask);
1791
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1792
- this._$mask = null;
1793
- } catch (error) {}
1794
- }
1795
- if (this._options.isMobile) document.body.classList.remove(`${PICKER_PREFIX_CLS}-body-noscroll`);
1796
- try {
1797
- var _this_$popupContainer;
1798
- (_this_$popupContainer = this.$popupContainer) == null ? void 0 : _this_$popupContainer.removeChild(this.$wrapperContent);
1799
- this.$wrapperContent.innerHTML = "";
1800
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1801
- this.$wrapperContent = null;
1802
- } catch (error) {}
1803
- }
1804
- /**
1805
- * 现实位置
1806
- */ _setPlacement() {
1807
- var _this_$container_getBoundingClientRect, _this_$container;
1808
- if (!this._open || this._options.isMobile || !this.$container) {
1809
- return;
1810
- }
1811
- const $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1812
- const $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1813
- const $popupContainerRect = this.$popupContainer.getBoundingClientRect();
1814
- // 容器的坐标 - 挂载的容器的坐标差
1815
- // prettier-ignore
1816
- const containerLeft = $containerRect.left - $popupContainerRect.left;
1817
- const containerRight = -($containerRect.right - $popupContainerRect.right);
1818
- // prettier-ignore
1819
- const containerTop = $containerRect.y - $popupContainerRect.y;
1820
- let left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1821
- let right;
1822
- const top = containerTop - $wrapperContentRect.height;
1823
- const bottom = containerTop + $containerRect.height;
1824
- if (/^t/.test(this._options.placement)) {
1825
- var _this__options_offset, _this__options_offset1, _this__options_offset2;
1826
- switch(this._options.placement){
1827
- case "top":
1828
- right = undefined;
1829
- break;
1830
- case "tl":
1831
- right = undefined;
1832
- left = containerLeft;
1833
- break;
1834
- case "tr":
1835
- left = undefined;
1836
- right = containerRight;
1837
- break;
1838
- }
1839
- this.$wrapperContent.style.cssText += `
1840
- ${right !== undefined ? `right: ${right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)}px;` : ""}
1841
- ${left !== undefined ? `left: ${left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)}px;` : ""}
1842
- top: ${top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)}px;
1843
- z-index:${this._options.zIndex};
1844
- `;
1845
- } else if (/^b/.test(this._options.placement)) {
1846
- var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1847
- switch(this._options.placement){
1848
- case "bottom":
1849
- right = undefined;
1850
- break;
1851
- case "bl":
1852
- right = undefined;
1853
- left = containerLeft;
1854
- break;
1855
- case "br":
1856
- left = undefined;
1857
- right = containerRight;
1858
- break;
1859
- }
1860
- if (this.$wrapperContent) this.$wrapperContent.style.cssText += `
1861
- ${right !== undefined ? `right: ${right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)}px;` : ""}
1862
- ${left !== undefined ? `left: ${left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)}px;` : ""}
1863
- top: ${bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)}px;
1864
- z-index:${this._options.zIndex};
1865
- `;
1866
- }
1867
- }
1868
- /**
1869
- * 初始化内容样式
1870
- */ _initContentStyle() {
1871
- if (!this.$wrapperContent) return;
1872
- // prettier-ignore
1873
- this.$wrapperContent.classList.add(`${PICKER_PREFIX_CLS}`, `${PICKER_PREFIX_CLS}-wrapper`, `${PICKER_PREFIX_CLS}-${this._options.placement}`);
1874
- // 提升优先级
1875
- this.$wrapperContent.style.display = "none";
1876
- if (this._options.isMobile) {
1877
- this.$wrapperContent.classList.add(`${PICKER_PREFIX_CLS}-mobile`);
1878
- this._$mask = document.createElement("div");
1879
- this._$mask.classList.add(`${PICKER_PREFIX_CLS}-mask`);
1880
- this.$wrapperContent.appendChild(this._$mask);
1881
- }
1882
- this.$body = document.createElement("div");
1883
- this.$body.classList.add(`${PICKER_PREFIX_CLS}-body`);
1884
- this.$wrapperContent.appendChild(this.$body);
1885
- if (typeof this._options.content === "string") {
1886
- this.innerHTML(this._options.content);
1887
- } else if (typeof this._options.content === "function") {
1888
- this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1889
- }
1890
- if (typeof this._options.wrapClassName === "string") {
1891
- try {
1892
- var _this_$wrapperContent;
1893
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.classList.add(...this._options.wrapClassName.split(" "));
1894
- } catch (error) {}
1895
- }
1896
- }
1897
- /**
1898
- * 绑定事件
1899
- */ _eventListener() {
1900
- var _this_$container_addEventListener, _this_$container;
1901
- // eslint-disable-next-line @typescript-eslint/unbound-method
1902
- this.$wrapperContent.addEventListener("click", this._onContentClick);
1903
- (_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, "click", this._onContentClick);
1904
- //
1905
- if (this._options.trigger === "click") {
1906
- var _this_$container_addEventListener1, _this_$container1;
1907
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, "click", this._onShow);
1908
- }
1909
- if (this._options.trigger === "hover") {
1910
- var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1911
- (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, "mouseenter", this._onShow);
1912
- (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, "mouseover", this._onShow);
1913
- (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, "mouseleave", this._onHide);
1914
- this.$wrapperContent.addEventListener("mouseenter", this._onWrapperShow);
1915
- this.$wrapperContent.addEventListener("mouseleave", this._onHide);
1916
- }
1917
- if (this._$mask) {
1918
- this._$mask.addEventListener("click", this._onHide);
1919
- }
1920
- if (!this._options.isMobile) {
1921
- // eslint-disable-next-line @typescript-eslint/unbound-method
1922
- window.addEventListener("blur", this._onHide);
1923
- // eslint-disable-next-line @typescript-eslint/unbound-method
1924
- document.addEventListener("visibilitychange", this._onHide);
1925
- // eslint-disable-next-line @typescript-eslint/unbound-method
1926
- window.addEventListener("resize", this._onHide);
1927
- // eslint-disable-next-line @typescript-eslint/unbound-method
1928
- document.addEventListener("click", this._onDocumentClick);
1929
- }
1930
- }
1931
- /**
1932
- * $wrapperContent click event
1933
- * @param e - 内容点击事件
1934
- */ _onContentClick(e) {
1935
- e.stopPropagation();
1936
- pickerProvider.closeOther(e);
1937
- }
1938
- /**
1939
- * 显示事件
1940
- */ _onShow() {
1941
- if (this._disabled) return;
1942
- this.open = true;
1943
- }
1944
- /**
1945
- * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1946
- */ _onWrapperShow() {
1947
- if (this._disabled) {
1948
- return;
1949
- }
1950
- this._onShow();
1951
- }
1952
- /**
1953
- * 隐藏事件
1954
- */ _onHide(e) {
1955
- if (!this._open || this._disabled) return;
1956
- if ((e == null ? void 0 : e.target) === this._$mask) {
1957
- e == null ? void 0 : e.stopPropagation();
1958
- }
1959
- this.open = false;
1960
- }
1961
- /**
1962
- * document 点击事件
1963
- * @param event - 鼠标点击事件
1964
- */ _onDocumentClick(event) {
1965
- var _this_$container;
1966
- if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
1967
- if (this._disabled) return;
1968
- this._onHide();
1969
- }
1970
- }
1971
- constructor(container, options){
1972
- var _this_$popupContainer;
1973
- /** 是否打开 */ this._open = false;
1974
- this._OpenChange = false;
1975
- this._animationTimer = null;
1976
- this._disabled = false;
1977
- this._timer = null;
1978
- // prettier-ignore
1979
- this._options = Object.assign({}, __PICKER_DEFAULT_OPTIONS__, options || {});
1980
- // 移动端模式强制使用 click 触发
1981
- if (this._options.isMobile) {
1982
- this._options.trigger = "click";
1983
- }
1984
- pickerProvider.add(this);
1985
- if (typeof container === "function") this.$container = container();
1986
- else this.$container = container;
1987
- this.$wrapperContent = document.createElement("div");
1988
- this._initContentStyle();
1989
- (_this_$popupContainer = this.$popupContainer) == null ? void 0 : _this_$popupContainer.appendChild(this.$wrapperContent);
1990
- this._onContentClick = this._onContentClick.bind(this);
1991
- this._onShow = this._onShow.bind(this);
1992
- this._onWrapperShow = this._onWrapperShow.bind(this);
1993
- this._onHide = this._onHide.bind(this);
1994
- this._onDocumentClick = this._onDocumentClick.bind(this);
1995
- this._eventListener();
1996
- this.open = !!this._options.open;
1997
- }
1998
- }
1999
- /**
2000
- * 版本号
2001
- * @example
2002
- * ```ts
2003
- * Picker.VERSION; // 输出版本号
2004
- * ```
2005
- */ Picker.VERSION = "1.0.3";
1477
+ var dist$6;
1478
+ var hasRequiredDist$6;
1479
+
1480
+ function requireDist$6 () {
1481
+ if (hasRequiredDist$6) return dist$6;
1482
+ hasRequiredDist$6 = 1;
1483
+
1484
+ function _array_like_to_array(arr, len) {
1485
+ if (len == null || len > arr.length) len = arr.length;
1486
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1487
+ return arr2;
1488
+ }
1489
+ function _unsupported_iterable_to_array(o, minLen) {
1490
+ if (!o) return;
1491
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1492
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1493
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1494
+ if (n === "Map" || n === "Set") return Array.from(n);
1495
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1496
+ }
1497
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1498
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1499
+ if (it) return (it = it.call(o)).next.bind(it);
1500
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
1501
+ if (it) o = it;
1502
+ var i = 0;
1503
+ return function() {
1504
+ if (i >= o.length) {
1505
+ return {
1506
+ done: true
1507
+ };
1508
+ }
1509
+ return {
1510
+ done: false,
1511
+ value: o[i++]
1512
+ };
1513
+ };
1514
+ }
1515
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1516
+ }
1517
+ /**
1518
+ * PickerProvider 单例类
1519
+ */ var PickerProvider = /*#__PURE__*/ function() {
1520
+ function PickerProvider() {
1521
+ this.pickers = [];
1522
+ }
1523
+ var _proto = PickerProvider.prototype;
1524
+ /**
1525
+ * 添加picker
1526
+ * @param picker Picker 实例
1527
+ */ _proto.add = function add(picker) {
1528
+ this.pickers.push(picker);
1529
+ };
1530
+ /**
1531
+ * 移除picker
1532
+ * @param picker Picker 实例
1533
+ */ _proto.remove = function remove(picker) {
1534
+ var index = this.pickers.indexOf(picker);
1535
+ if (index > -1) {
1536
+ this.pickers.splice(index, 1);
1537
+ }
1538
+ };
1539
+ /**
1540
+ * 关闭其他picker
1541
+ * @param e 事件
1542
+ */ _proto.closeOther = function closeOther(e) {
1543
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;){
1544
+ var p = _step.value;
1545
+ var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1546
+ if (p && !(e.target === p.$container || ((_p_$container = p.$container) == null ? void 0 : (_p_$container_contains = _p_$container.contains) == null ? void 0 : _p_$container_contains.call(_p_$container, e.target)) || e.target === p.$wrapperContent || ((_p_$wrapperContent = p.$wrapperContent) == null ? void 0 : (_p_$wrapperContent_contains = _p_$wrapperContent.contains) == null ? void 0 : _p_$wrapperContent_contains.call(_p_$wrapperContent, e.target)))) {
1547
+ p.open = false;
1548
+ }
1549
+ }
1550
+ };
1551
+ /**
1552
+ * 获取单例实例
1553
+ * @returns Picker 实例
1554
+ */ PickerProvider.getInstance = function getInstance() {
1555
+ if (!PickerProvider.instance) {
1556
+ PickerProvider.instance = new PickerProvider();
1557
+ }
1558
+ return PickerProvider.instance;
1559
+ };
1560
+ return PickerProvider;
1561
+ }();
1562
+ var pickerProvider = PickerProvider.getInstance();
1563
+
1564
+ function _defineProperties(target, props) {
1565
+ for(var i = 0; i < props.length; i++){
1566
+ var descriptor = props[i];
1567
+ descriptor.enumerable = descriptor.enumerable || false;
1568
+ descriptor.configurable = true;
1569
+ if ("value" in descriptor) descriptor.writable = true;
1570
+ Object.defineProperty(target, descriptor.key, descriptor);
1571
+ }
1572
+ }
1573
+ function _create_class(Constructor, protoProps, staticProps) {
1574
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1575
+ return Constructor;
1576
+ }
1577
+ /**
1578
+ * picker 位置
1579
+ *
1580
+ * | top | tl | tr | bottom | bl | br |
1581
+ * |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
1582
+ * | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
1583
+ *
1584
+ * @public
1585
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
1586
+ var _$PICKER_PLACEMENT$_ = [
1587
+ "top",
1588
+ "tl",
1589
+ "tr",
1590
+ "bottom",
1591
+ "bl",
1592
+ "br"
1593
+ ];
1594
+ /**
1595
+ * 默认样式前缀
1596
+ */ var _$PICKER_PREFIX_CLS$_ = "epicker";
1597
+ /**
1598
+ * Picker 默认值
1599
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention
1600
+ var __$PICKER_DEFAULT_OPTIONS$__ = {
1601
+ getPopupContainer: function() {
1602
+ return document.body;
1603
+ },
1604
+ wrapClassName: "",
1605
+ open: false,
1606
+ placement: "br",
1607
+ offset: [
1608
+ 0,
1609
+ 0
1610
+ ],
1611
+ zIndex: 1000,
1612
+ content: "",
1613
+ trigger: "click",
1614
+ mouseLeaveDelay: 0.1,
1615
+ mouseEnterDelay: 0.1,
1616
+ isMobile: false
1617
+ };
1618
+ /**
1619
+ * Picker 弹窗, 支持 PC 和移动端
1620
+ * @remarks
1621
+ * Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
1622
+ * 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
1623
+ *
1624
+ * @example
1625
+ * ```ts
1626
+ * import "@skax/picker/dist/style/css";
1627
+ * import Picker from '@skax/picker';
1628
+ * const picker = new Picker(document.getElementById('picker-container'),
1629
+ * {
1630
+ * placement: 'bottom',
1631
+ * content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
1632
+ * trigger: 'click',
1633
+ * isMobile: false,
1634
+ * });
1635
+ * picker.open = true; // 打开弹窗
1636
+ * picker.setPlacement('top'); // 设置弹窗位置
1637
+ * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1638
+ * picker.destroy(); // 销毁弹窗
1639
+ * ```
1640
+ */ var Picker = /*#__PURE__*/ function() {
1641
+ function Picker(container, options) {
1642
+ var _this__$popupContainer, _this__$popupContainer1;
1643
+ /** 是否打开 */ this._open = false;
1644
+ this._OpenChange = false;
1645
+ this._animationTimer = null;
1646
+ this._disabled = false;
1647
+ this._timer = null;
1648
+ // prettier-ignore
1649
+ this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
1650
+ // 移动端模式强制使用 click 触发
1651
+ if (this._options.isMobile) this._options.trigger = "click";
1652
+ pickerProvider.add(this);
1653
+ if (typeof container === "function") this.$container = container();
1654
+ else this.$container = container;
1655
+ this.$wrapperContent = document.createElement("div");
1656
+ this._initContentStyle();
1657
+ if (typeof this._options.getPopupContainer === "function") {
1658
+ this._$popupContainer = this._options.getPopupContainer();
1659
+ } else {
1660
+ this._$popupContainer = document.body;
1661
+ }
1662
+ if ([
1663
+ "INPUT",
1664
+ "CANVAS",
1665
+ "VIDEO",
1666
+ "IMG"
1667
+ ].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
1668
+ this._$popupContainer = document.body;
1669
+ }
1670
+ if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
1671
+ (_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
1672
+ this._onContentClick = this._onContentClick.bind(this);
1673
+ this._onShow = this._onShow.bind(this);
1674
+ this._onWrapperShow = this._onWrapperShow.bind(this);
1675
+ this._onHide = this._onHide.bind(this);
1676
+ this._onDocumentClick = this._onDocumentClick.bind(this);
1677
+ this._eventListener();
1678
+ this.open = !!this._options.open;
1679
+ }
1680
+ var _proto = Picker.prototype;
1681
+ /**
1682
+ * 设置弹出位置(移动端不生效)
1683
+ * @param placement - 弹出位置
1684
+ * @example
1685
+ * ```ts
1686
+ * picker.setPlacement("top");
1687
+ * picker.setPlacement("tl");
1688
+ * picker.setPlacement("tr");
1689
+ * picker.setPlacement("bottom");
1690
+ * picker.setPlacement("bl");
1691
+ * picker.setPlacement("br");
1692
+ * ```
1693
+ */ _proto.setPlacement = function setPlacement(placement) {
1694
+ if (this._disabled) return;
1695
+ if (_$PICKER_PLACEMENT$_.includes(placement)) {
1696
+ this._options.placement = placement;
1697
+ }
1698
+ this._setPlacement();
1699
+ };
1700
+ /**
1701
+ * 销毁
1702
+ * @example
1703
+ * ```ts
1704
+ * picker.destroy();
1705
+ * ```
1706
+ */ _proto.destroy = function destroy() {
1707
+ this._animationTimerClear();
1708
+ this._removeHtml();
1709
+ pickerProvider.remove(this);
1710
+ // this._$popupContainer 的 position 样式不会被移除
1711
+ };
1712
+ /**
1713
+ * 设置内容(会覆盖之前内容)
1714
+ * @param html - html 字符串内容
1715
+ * @example
1716
+ * ```ts
1717
+ * picker.innerHTML('<div>内容</div>');
1718
+ * ```
1719
+ */ _proto.innerHTML = function innerHTML(html) {
1720
+ if (this.$body) {
1721
+ this.$body.innerHTML = html || "";
1722
+ this._setPlacement();
1723
+ }
1724
+ };
1725
+ // --------------------------------------------------------------------------
1726
+ // Private methods
1727
+ // --------------------------------------------------------------------------
1728
+ /**
1729
+ * picker 面板展开或关闭变化时触发
1730
+ * @param open - true: 展开, false:关闭
1731
+ */ _proto._onOpenChange = function _onOpenChange(open) {
1732
+ this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1733
+ };
1734
+ /**
1735
+ * 移除动画定时器
1736
+ */ _proto._animationTimerClear = function _animationTimerClear() {
1737
+ if (this._animationTimer) {
1738
+ clearTimeout(this._animationTimer);
1739
+ this._animationTimer = null;
1740
+ }
1741
+ };
1742
+ /**
1743
+ * 移除html
1744
+ */ _proto._removeHtml = function _removeHtml() {
1745
+ var // eslint-disable-next-line @typescript-eslint/unbound-method
1746
+ _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
1747
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener("click", this._onContentClick);
1748
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_removeEventListener = _this_$container.removeEventListener) == null ? void 0 : _this_$container_removeEventListener.call(_this_$container, "click", this._onContentClick);
1749
+ if (this._options.trigger === "click") (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, "click", this._onShow);
1750
+ if (this._options.trigger === "hover") {
1751
+ var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4, // prettier-ignore
1752
+ _this_$wrapperContent1, _this_$wrapperContent2;
1753
+ (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_removeEventListener2 = _this_$container2.removeEventListener) == null ? void 0 : _this_$container_removeEventListener2.call(_this_$container2, "mouseenter", this._onShow);
1754
+ (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_removeEventListener3 = _this_$container3.removeEventListener) == null ? void 0 : _this_$container_removeEventListener3.call(_this_$container3, "mouseover", this._onShow);
1755
+ (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_removeEventListener4 = _this_$container4.removeEventListener) == null ? void 0 : _this_$container_removeEventListener4.call(_this_$container4, "mouseleave", this._onHide);
1756
+ (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
1757
+ (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener("mouseleave", this._onHide);
1758
+ }
1759
+ if (!this._options.isMobile) {
1760
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1761
+ window.removeEventListener("blur", this._onHide);
1762
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1763
+ document.removeEventListener("visibilitychange", this._onHide);
1764
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1765
+ window.removeEventListener("resize", this._onHide);
1766
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1767
+ document.removeEventListener("click", this._onDocumentClick);
1768
+ }
1769
+ if (this._$mask) {
1770
+ this._$mask.removeEventListener("click", this._onHide);
1771
+ this._$mask.remove();
1772
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1773
+ this._$mask = null;
1774
+ }
1775
+ if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1776
+ if (this.$wrapperContent) {
1777
+ this.$wrapperContent.remove();
1778
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1779
+ this.$wrapperContent = null;
1780
+ }
1781
+ };
1782
+ /**
1783
+ * 现实位置
1784
+ */ _proto._setPlacement = function _setPlacement() {
1785
+ var _this_$container_getBoundingClientRect, _this_$container;
1786
+ if (!this._open || this._options.isMobile || !this.$container) return;
1787
+ var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1788
+ var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1789
+ var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
1790
+ // 容器的坐标 - 挂载的容器的坐标差
1791
+ // prettier-ignore
1792
+ var containerLeft = $containerRect.left - $popupContainerRect.left;
1793
+ var containerRight = -($containerRect.right - $popupContainerRect.right);
1794
+ // prettier-ignore
1795
+ var containerTop = $containerRect.y - $popupContainerRect.y;
1796
+ var left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1797
+ var right;
1798
+ var top = containerTop - $wrapperContentRect.height;
1799
+ var bottom = containerTop + $containerRect.height;
1800
+ if (/^t/.test(this._options.placement)) {
1801
+ var _this__options_offset, _this__options_offset1, _this__options_offset2;
1802
+ switch(this._options.placement){
1803
+ case "top":
1804
+ right = undefined;
1805
+ break;
1806
+ case "tl":
1807
+ right = undefined;
1808
+ left = containerLeft;
1809
+ break;
1810
+ case "tr":
1811
+ left = undefined;
1812
+ right = containerRight;
1813
+ break;
1814
+ }
1815
+ this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)) + "px;" : "") + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)) + "px;" : "") + "\n top: " + (top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1816
+ } else if (/^b/.test(this._options.placement)) {
1817
+ var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1818
+ switch(this._options.placement){
1819
+ case "bottom":
1820
+ right = undefined;
1821
+ break;
1822
+ case "bl":
1823
+ right = undefined;
1824
+ left = containerLeft;
1825
+ break;
1826
+ case "br":
1827
+ left = undefined;
1828
+ right = containerRight;
1829
+ break;
1830
+ }
1831
+ if (this.$wrapperContent) this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)) + "px;" : "") + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)) + "px;" : "") + "\n top: " + (bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1832
+ }
1833
+ };
1834
+ /**
1835
+ * 初始化内容样式
1836
+ */ _proto._initContentStyle = function _initContentStyle() {
1837
+ if (!this.$wrapperContent) return;
1838
+ // prettier-ignore
1839
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
1840
+ // 提升优先级
1841
+ this.$wrapperContent.style.display = "none";
1842
+ if (this._options.isMobile) {
1843
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
1844
+ this._$mask = document.createElement("div");
1845
+ this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
1846
+ this.$wrapperContent.appendChild(this._$mask);
1847
+ }
1848
+ this.$body = document.createElement("div");
1849
+ this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
1850
+ this.$wrapperContent.appendChild(this.$body);
1851
+ if (typeof this._options.content === "string") {
1852
+ this.innerHTML(this._options.content);
1853
+ } else if (typeof this._options.content === "function") {
1854
+ this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1855
+ }
1856
+ if (typeof this._options.wrapClassName === "string") {
1857
+ try {
1858
+ var _this_$wrapperContent_classList;
1859
+ var _this_$wrapperContent;
1860
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(" ")));
1861
+ } catch (error) {}
1862
+ }
1863
+ };
1864
+ /**
1865
+ * 绑定事件
1866
+ */ _proto._eventListener = function _eventListener() {
1867
+ var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
1868
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1869
+ this.$wrapperContent.addEventListener("click", this._onContentClick);
1870
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, "click", this._onContentClick);
1871
+ //
1872
+ if (this._options.trigger === "click") (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, "click", this._onShow);
1873
+ if (this._options.trigger === "hover") {
1874
+ var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1875
+ (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, "mouseenter", this._onShow);
1876
+ (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, "mouseover", this._onShow);
1877
+ (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, "mouseleave", this._onHide);
1878
+ this.$wrapperContent.addEventListener("mouseenter", this._onWrapperShow);
1879
+ this.$wrapperContent.addEventListener("mouseleave", this._onHide);
1880
+ }
1881
+ if (this._$mask) this._$mask.addEventListener("click", this._onHide);
1882
+ if (!this._options.isMobile) {
1883
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1884
+ window.addEventListener("blur", this._onHide);
1885
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1886
+ document.addEventListener("visibilitychange", this._onHide);
1887
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1888
+ window.addEventListener("resize", this._onHide);
1889
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1890
+ document.addEventListener("click", this._onDocumentClick);
1891
+ }
1892
+ };
1893
+ /**
1894
+ * $wrapperContent click event
1895
+ * @param e - 内容点击事件
1896
+ */ _proto._onContentClick = function _onContentClick(e) {
1897
+ pickerProvider.closeOther(e);
1898
+ };
1899
+ /**
1900
+ * 显示事件
1901
+ */ _proto._onShow = function _onShow() {
1902
+ if (this._disabled) return;
1903
+ this.open = true;
1904
+ };
1905
+ /**
1906
+ * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1907
+ */ _proto._onWrapperShow = function _onWrapperShow() {
1908
+ if (this._disabled) return;
1909
+ this._onShow();
1910
+ };
1911
+ /**
1912
+ * 隐藏事件
1913
+ */ _proto._onHide = function _onHide(e) {
1914
+ if (!this._open || this._disabled) return;
1915
+ if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
1916
+ this.open = false;
1917
+ };
1918
+ /**
1919
+ * document 点击事件
1920
+ * @param event - 鼠标点击事件
1921
+ */ _proto._onDocumentClick = function _onDocumentClick(event) {
1922
+ var _this_$container;
1923
+ if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
1924
+ if (this._disabled) return;
1925
+ this._onHide();
1926
+ }
1927
+ };
1928
+ _create_class(Picker, [
1929
+ {
1930
+ key: "open",
1931
+ get: /**
1932
+ * 获取当前打开状态
1933
+ * @example
1934
+ * ```ts
1935
+ * console.log(picker.open); // 获取当前打开状态
1936
+ * picker.open = true; // 打开
1937
+ * picker.open = false; // 关闭
1938
+ * ```
1939
+ */ function get() {
1940
+ return this._open;
1941
+ },
1942
+ set: function set(open) {
1943
+ var _this = this;
1944
+ if (this._disabled) return;
1945
+ if (this._open !== !!open) {
1946
+ this._animationTimerClear();
1947
+ if (this._timer) {
1948
+ clearTimeout(this._timer);
1949
+ this._timer = null;
1950
+ }
1951
+ if (open) {
1952
+ // prettier-ignore
1953
+ this._timer = setTimeout(function() {
1954
+ if (!_this.$wrapperContent) return;
1955
+ _this.$wrapperContent.style.display = "inline-flex";
1956
+ _this.$wrapperContent.style.pointerEvents = "";
1957
+ // prettier-ignore
1958
+ if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1959
+ _this._animationTimer = setTimeout(function() {
1960
+ _this._animationTimerClear();
1961
+ _this.$wrapperContent.style.opacity = "1";
1962
+ }, 0);
1963
+ requestAnimationFrame(function() {
1964
+ _this._setPlacement();
1965
+ });
1966
+ _this._OpenChange = open;
1967
+ _this._onOpenChange(open);
1968
+ }, // prettier-ignore
1969
+ (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1970
+ } else {
1971
+ // prettier-ignore
1972
+ this._timer = setTimeout(function() {
1973
+ if (!_this.$wrapperContent) return;
1974
+ _this.$wrapperContent.style.opacity = "0";
1975
+ _this.$wrapperContent.style.pointerEvents = "none";
1976
+ // prettier-ignore
1977
+ if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1978
+ _this._animationTimer = setTimeout(function() {
1979
+ _this._animationTimerClear();
1980
+ _this.$wrapperContent.style.display = "none";
1981
+ }, 301); // css 动画是 300ms
1982
+ _this._OpenChange = open;
1983
+ _this._onOpenChange(open);
1984
+ }, // prettier-ignore
1985
+ (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1986
+ }
1987
+ if (this._OpenChange === open) {
1988
+ if (this._timer) {
1989
+ clearTimeout(this._timer);
1990
+ this._timer = null;
1991
+ }
1992
+ }
1993
+ this._open = !!open;
1994
+ }
1995
+ }
1996
+ },
1997
+ {
1998
+ key: "disabled",
1999
+ get: /**
2000
+ * 获取或设置禁用状态
2001
+ * @example
2002
+ * ```ts
2003
+ * picker.disabled = true; // 禁用
2004
+ * picker.disabled = false; // 启用
2005
+ * console.log(picker.disabled); // 获取禁用状态
2006
+ * ```
2007
+ */ function get() {
2008
+ return this._disabled;
2009
+ },
2010
+ set: function set(disabled) {
2011
+ if (disabled) {
2012
+ var _this_$container_classList_add, _this_$container_classList, _this_$container;
2013
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2014
+ } else {
2015
+ var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
2016
+ (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2017
+ }
2018
+ this._disabled = disabled;
2019
+ }
2020
+ }
2021
+ ]);
2022
+ return Picker;
2023
+ }();
2024
+ /**
2025
+ * 版本号
2026
+ * @example
2027
+ * ```ts
2028
+ * Picker.VERSION; // 输出版本号
2029
+ * ```
2030
+ */ Picker.VERSION = "1.1.2";
2031
+
2032
+ dist$6 = Picker;
2033
+ return dist$6;
2034
+ }
2035
+
2036
+ var distExports$5 = requireDist$6();
2037
+ var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports$5);
2006
2038
 
2007
2039
  /*
2008
- * delegate.js v3.2.0
2009
- * Copyright (c) 2025-07-25
2040
+ * delegate.js v4.0.0
2041
+ * Copyright (c) 2025-11-09
2010
2042
  * Released under the MIT License.
2011
2043
  */
2012
- const DOCUMENT_NODE_TYPE = 9;
2013
- /**
2014
- * A polyfill for Element.matches()
2015
- */ if (typeof Element !== "undefined" && !Element.prototype.matches) {
2016
- const proto = Element.prototype;
2017
- proto.matches = (proto == null ? void 0 : proto.matchesSelector) || (proto == null ? void 0 : proto.mozMatchesSelector) || (proto == null ? void 0 : proto.msMatchesSelector) || (proto == null ? void 0 : proto.oMatchesSelector) || (proto == null ? void 0 : proto.webkitMatchesSelector);
2018
- }
2019
- /**
2020
- * Finds the closest parent that matches a selector.
2021
- *
2022
- * @param {Element} element
2023
- * @param {string} selector
2024
- * @return {Function}
2025
- */ function closest(element, selector) {
2026
- while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
2027
- if (typeof element.matches === "function" && element.matches(selector)) {
2028
- return element;
2029
- }
2030
- element = element.parentNode;
2031
- }
2032
- }
2033
2044
 
2034
- /**
2035
- * Delegates event to a selector.
2036
- *
2037
- * @param {Element} element
2038
- * @param {String} selector
2039
- * @param {String} type
2040
- * @param {Function} callback
2041
- * @param {Boolean} useCapture
2042
- * @return {Object}
2043
- */ // prettier-ignore
2044
- function _delegate(element, selector, type, callback, useCapture) {
2045
- // prettier-ignore
2046
- const listenerFn = listener.apply(this, arguments);
2047
- element.addEventListener(type, listenerFn, useCapture);
2048
- return {
2049
- destroy: function() {
2050
- element.removeEventListener(type, listenerFn, useCapture);
2051
- }
2052
- };
2053
- }
2054
- /**
2055
- * Delegates event to a selector.
2056
- *
2057
- * @param {Element|String|Array} [elements]
2058
- * @param {string | Element} selector
2059
- * @param {String} type
2060
- * @param {Function} callback
2061
- * @param {Boolean} useCapture
2062
- * @return {Object}
2063
- */ // prettier-ignore
2064
- function delegate(elements, selector, type, callback, useCapture) {
2065
- // Handle the regular Element usage
2066
- if (typeof elements.addEventListener === "function") {
2067
- return _delegate.apply(null, arguments);
2068
- }
2069
- // Handle Element-less usage, it defaults to global delegation
2070
- if (typeof type === "function") {
2071
- // Use `document` as the first parameter, then apply arguments
2072
- // This is a short way to .unshift `arguments` without running into deoptimizations
2073
- return _delegate.bind(null, document).apply(null, arguments);
2074
- }
2075
- // Handle Selector-based usage
2076
- if (typeof elements === "string") {
2077
- elements = document.querySelectorAll(elements);
2078
- }
2079
- // Handle Array-like based usage
2080
- return Array.prototype.map.call(elements, function(element) {
2081
- return _delegate(element, selector, type, callback, useCapture);
2082
- });
2083
- }
2084
- /**
2085
- * Finds closest match and invokes callback.
2086
- *
2087
- * @param {Element} element
2088
- * @param {String} selector
2089
- * @param {String} type
2090
- * @param {Function} callback
2091
- * @return {Function}
2092
- */ // prettier-ignore
2093
- function listener(element, selector, type, callback) {
2094
- return function(e) {
2095
- e.delegateTarget = closest(e.target, selector);
2096
- if (e.delegateTarget) {
2097
- callback.call(element, e);
2098
- }
2099
- };
2045
+ var dist$5;
2046
+ var hasRequiredDist$5;
2047
+
2048
+ function requireDist$5 () {
2049
+ if (hasRequiredDist$5) return dist$5;
2050
+ hasRequiredDist$5 = 1;
2051
+
2052
+ const DOCUMENT_NODE_TYPE = 9;
2053
+ /**
2054
+ * A polyfill for Element.matches()
2055
+ */ if (typeof Element !== "undefined" && !Element.prototype.matches) {
2056
+ const proto = Element.prototype;
2057
+ proto.matches = (proto == null ? void 0 : proto.matchesSelector) || (proto == null ? void 0 : proto.mozMatchesSelector) || (proto == null ? void 0 : proto.msMatchesSelector) || (proto == null ? void 0 : proto.oMatchesSelector) || (proto == null ? void 0 : proto.webkitMatchesSelector);
2058
+ }
2059
+ /**
2060
+ * Finds the closest parent that matches a selector.
2061
+ *
2062
+ * @param {Element} element
2063
+ * @param {string} selector
2064
+ * @return {Element}
2065
+ */ function closest(element, selector) {
2066
+ while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
2067
+ if (typeof element.matches === "function" && element.matches(selector)) {
2068
+ return element;
2069
+ }
2070
+ element = element.parentNode;
2071
+ }
2072
+ return null;
2073
+ }
2074
+ /**
2075
+ * Finds the closest parent that matches a selector.
2076
+ *
2077
+ * @param {Element} element
2078
+ * @param {string} selector
2079
+ * @return {Element}
2080
+ */ function closestNative(element, selector) {
2081
+ return element && element.closest(selector);
2082
+ }
2083
+ var closest$1 = typeof Element.prototype.closest === "function" ? closestNative : closest;
2084
+
2085
+ /**
2086
+ * Delegates event to a selector.
2087
+ *
2088
+ * @param {Element} element
2089
+ * @param {string} selector
2090
+ * @param {string} type
2091
+ * @param {Function} callback
2092
+ * @param {boolean} useCapture
2093
+ * @return {Object}
2094
+ */ // prettier-ignore
2095
+ function _delegate(element, selector, type, callback, useCapture) {
2096
+ // prettier-ignore
2097
+ const listenerFn = listener.apply(this, arguments);
2098
+ element.addEventListener(type, listenerFn, useCapture);
2099
+ return {
2100
+ destroy: function() {
2101
+ element.removeEventListener(type, listenerFn, useCapture);
2102
+ }
2103
+ };
2104
+ }
2105
+ /**
2106
+ * Delegates event to a selector.
2107
+ *
2108
+ * @param {Element|string|Array} [elements]
2109
+ * @param {string | Element} selector
2110
+ * @param {string} type
2111
+ * @param {Function} callback
2112
+ * @param {boolean} useCapture
2113
+ * @return {Object}
2114
+ * @example
2115
+ * ```ts
2116
+ * const delegation = delegate(document.body, 'a', 'click', function (e) {})
2117
+ * // destroy (removeEventListener)
2118
+ * delegation.destroy();
2119
+ *
2120
+ * const delegation1 = delegate(".btn", "click", function (e) { console.log(e.delegateTarget)},false);
2121
+ * // destroy (removeEventListener)
2122
+ * delegation1.destroy();
2123
+ * ```
2124
+ */ // prettier-ignore
2125
+ function delegate(elements, selector, type, callback, useCapture) {
2126
+ // Handle the regular Element usage
2127
+ if (typeof elements.addEventListener === "function") {
2128
+ return _delegate.apply(null, arguments);
2129
+ }
2130
+ // Handle Element-less usage, it defaults to global delegation
2131
+ if (typeof type === "function") {
2132
+ // Use `document` as the first parameter, then apply arguments
2133
+ // This is a short way to .unshift `arguments` without running into deoptimizations
2134
+ return _delegate.bind(null, document).apply(null, arguments);
2135
+ }
2136
+ // Handle Selector-based usage
2137
+ if (typeof elements === "string") {
2138
+ elements = document.querySelectorAll(elements);
2139
+ }
2140
+ // Handle Array-like based usage
2141
+ return Array.prototype.map.call(elements, function(element) {
2142
+ return _delegate(element, selector, type, callback, useCapture);
2143
+ });
2144
+ }
2145
+ /**
2146
+ * Finds closest match and invokes callback.
2147
+ *
2148
+ * @param {Element} element
2149
+ * @param {string} selector
2150
+ * @param {string} type
2151
+ * @param {Function} callback
2152
+ * @return {Function}
2153
+ */ // prettier-ignore
2154
+ function listener(element, selector, type, callback) {
2155
+ return function(e) {
2156
+ e.delegateTarget = closest$1(e.target, selector);
2157
+ if (e.delegateTarget) {
2158
+ callback.call(element, e);
2159
+ }
2160
+ };
2161
+ }
2162
+
2163
+ dist$5 = delegate;
2164
+ return dist$5;
2100
2165
  }
2101
2166
 
2167
+ var distExports$4 = requireDist$5();
2168
+ var delegate = /*@__PURE__*/getDefaultExportFromCjs(distExports$4);
2169
+
2102
2170
  var cjs;
2103
2171
  var hasRequiredCjs;
2104
2172
 
@@ -2243,13 +2311,98 @@
2243
2311
  var cjsExports = requireCjs();
2244
2312
  var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
2245
2313
 
2246
- /*
2247
- * @ezuikit/utils-tools v1.1.1-beta.1
2248
- * tools utils
2249
- * Copyright (c) 2025-09-01 Ezviz-OpenBiz
2250
- * Released under the MIT License.
2251
- */
2252
- const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","");}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;const pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return {}}function isMobile$1(agent){var _navigator,_navigator1,_navigator2,_window;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1||(null==(_window=window)?void 0:_window.__IS_MOBILE_SIMULATOR__)}
2314
+ var dist$4 = {};
2315
+
2316
+ var hasRequiredDist$4;
2317
+
2318
+ function requireDist$4 () {
2319
+ if (hasRequiredDist$4) return dist$4;
2320
+ hasRequiredDist$4 = 1;
2321
+
2322
+ var getQuery = function(url) {
2323
+ var query = url.split("?")[1], obj = {};
2324
+ if (query) for (var vars = query.split("&"), i = 0; i < vars.length; i++) {
2325
+ var pair = vars[i].split("=");
2326
+ obj[pair[0]] = decodeURIComponent(pair[1]);
2327
+ }
2328
+ return obj;
2329
+ };
2330
+
2331
+ function parseEzopenUrl(url) {
2332
+ var obj = {};
2333
+ if (/^ezopen:\/\//.test(url)) {
2334
+ if (url.includes("@")) {
2335
+ var endIndex = url.indexOf("@"), startIndex = url.indexOf("//");
2336
+ obj.validateCode = url.substring(startIndex + 2, endIndex), url = url.replace(obj.validateCode + "@", "");
2337
+ }
2338
+ obj.protocol = url.split("//")[0], obj.search = url.split("?")[1] ? "?" + url.split("?")[1] : "",
2339
+ obj.hostname = url.split("/")[2], obj.origin = obj.protocol + "//" + obj.hostname,
2340
+ obj.pathname = url.split("?")[0].replace(obj.origin, ""), obj.href = url;
2341
+ var pathnames = obj.pathname.split("/"), lastPath = pathnames[2].split(".");
2342
+ return obj.deviceSerial = pathnames[1], obj.channelNo = lastPath[0], obj.type = lastPath[lastPath.length - 1],
2343
+ "live" === obj.type && (obj.definition = lastPath.length > 2 ? lastPath[1] : "sd"),
2344
+ "rec" === obj.type && pathnames[2] && (obj.recType = pathnames[2].includes(".cloud.") ? "cloud" : ""),
2345
+ obj.searchParams = getQuery(url), obj;
2346
+ }
2347
+ return {};
2348
+ }
2349
+
2350
+ var __$codec$__ = {
2351
+ h264: 1,
2352
+ h265: 2,
2353
+ h266: 4,
2354
+ vp8: 8,
2355
+ vp9: 16,
2356
+ av1: 32
2357
+ };
2358
+
2359
+ dist$4.addVc = function(url, codecs) {
2360
+ void 0 === codecs && (codecs = [ "h264" ]);
2361
+ var vc = (codecs || [ "h264" ]).reduce(function(acc, key) {
2362
+ return key = key.toLowerCase(), acc + (__$codec$__[key] || 0);
2363
+ }, 0), host = url.split("?")[0], query = url.split("?")[1];
2364
+ return query = (query || "").split("&").filter(function(item) {
2365
+ return !/^vc=\d?/.test(item);
2366
+ }).join("&"), host + "?" + (query += (query ? "&" : "") + "vc=" + vc);
2367
+ }, dist$4.getQuery = getQuery, dist$4.getStaticPath = function(path, base) {
2368
+ void 0 === base && (base = "");
2369
+ var protocolReg = /^(https?:\/\/|^\/\/)/;
2370
+ if ("" === path || void 0 === path) return "";
2371
+ if (protocolReg.test(path)) return path;
2372
+ path = path.replace(/\/+/g, "/"), base = protocolReg.test(base || "") ? base : window.location.href;
2373
+ try {
2374
+ return new URL(path, base).href;
2375
+ } catch (error) {
2376
+ return path;
2377
+ }
2378
+ }, dist$4.isHttp = function(url) {
2379
+ return /^http[s]?:\/\//.test(url);
2380
+ }, dist$4.isMobile = function(agent) {
2381
+ var _navigator, _navigator1, _navigator2, _window;
2382
+ return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null != agent ? agent : null == (_navigator = navigator) ? void 0 : _navigator.userAgent) || /Macintosh/i.test(null == (_navigator1 = navigator) ? void 0 : _navigator1.userAgent) && (null == (_navigator2 = navigator) ? void 0 : _navigator2.maxTouchPoints) > 1 || (null == (_window = window) ? void 0 : _window.__IS_MOBILE_SIMULATOR__);
2383
+ }, dist$4.parseEzopenUrl = parseEzopenUrl, dist$4.pick = function(obj, keys) {
2384
+ return Object.entries(obj).reduce(function(acc, param) {
2385
+ var key = param[0], value = param[1];
2386
+ return keys.includes(key) && (acc[key] = value), acc;
2387
+ }, {});
2388
+ }, dist$4.switchEzopenUrl = function(url, options) {
2389
+ var _ref = null != options ? options : {}, type = _ref.type, recType = _ref.recType, search = _ref.search, definition = _ref.definition, channelNo = _ref.channelNo, deviceSerial = _ref.deviceSerial, validateCode = _ref.validateCode, obj = parseEzopenUrl(url);
2390
+ if (search) {
2391
+ var ns = Object.assign({}, obj.searchParams, getQuery("?" + search.replace("?", "")));
2392
+ search = Object.entries(ns).reduce(function(acc, param) {
2393
+ var key = param[0], value = param[1];
2394
+ return "" === value ? acc : acc += key + "=" + encodeURIComponent(value) + "&";
2395
+ }, "?").replace(/&$/, "");
2396
+ } else search = obj.search;
2397
+ return type = type || obj.type, recType = null != recType ? recType : obj.recType,
2398
+ definition = null != definition ? definition : obj.definition, channelNo = channelNo || obj.channelNo,
2399
+ deviceSerial = deviceSerial || obj.deviceSerial, validateCode = null != validateCode ? validateCode : obj.validateCode,
2400
+ obj.protocol + "//" + (validateCode ? validateCode + "@" : "") + obj.hostname + "/" + deviceSerial + "/" + channelNo + ("rec" === type && recType ? "." + recType : "") + ("live" === type && "hd" === definition ? "." + definition : "") + "." + type + search;
2401
+ };
2402
+ return dist$4;
2403
+ }
2404
+
2405
+ var distExports$3 = requireDist$4();
2253
2406
 
2254
2407
  /**
2255
2408
  * 节流函数
@@ -2477,7 +2630,7 @@
2477
2630
  * ```ts
2478
2631
  * Utils.isMobile // true | false
2479
2632
  * ```
2480
- */ Utils.isMobile = isMobile$1();
2633
+ */ Utils.isMobile = distExports$3.isMobile();
2481
2634
 
2482
2635
  function _defineProperties$7(target, props) {
2483
2636
  for(var i = 0; i < props.length; i++){
@@ -2816,8 +2969,8 @@
2816
2969
  if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
2817
2970
  return Constructor;
2818
2971
  }
2819
- function _extends$n() {
2820
- _extends$n = Object.assign || function(target) {
2972
+ function _extends$m() {
2973
+ _extends$m = Object.assign || function(target) {
2821
2974
  for(var i = 1; i < arguments.length; i++){
2822
2975
  var source = arguments[i];
2823
2976
  for(var key in source){
@@ -2828,7 +2981,7 @@
2828
2981
  }
2829
2982
  return target;
2830
2983
  };
2831
- return _extends$n.apply(this, arguments);
2984
+ return _extends$m.apply(this, arguments);
2832
2985
  }
2833
2986
  function _inherits$m(subClass, superClass) {
2834
2987
  if (typeof superClass !== "function" && superClass !== null) {
@@ -2867,7 +3020,7 @@
2867
3020
  if (options === void 0) options = {};
2868
3021
  var _this;
2869
3022
  var _this__options_props, _this__options_props1, _this__options_props2, _this__options_props3;
2870
- _this = Control.call(this, _extends$n({}, options, {
3023
+ _this = Control.call(this, _extends$m({}, options, {
2871
3024
  tagName: 'span',
2872
3025
  classNameSuffix: 'volume',
2873
3026
  controlType: 'button'
@@ -3722,8 +3875,8 @@
3722
3875
  return Fullscreen;
3723
3876
  }();
3724
3877
 
3725
- function _extends$m() {
3726
- _extends$m = Object.assign || function(target) {
3878
+ function _extends$l() {
3879
+ _extends$l = Object.assign || function(target) {
3727
3880
  for(var i = 1; i < arguments.length; i++){
3728
3881
  var source = arguments[i];
3729
3882
  for(var key in source){
@@ -3734,7 +3887,7 @@
3734
3887
  }
3735
3888
  return target;
3736
3889
  };
3737
- return _extends$m.apply(this, arguments);
3890
+ return _extends$l.apply(this, arguments);
3738
3891
  }
3739
3892
  function _inherits$l(subClass, superClass) {
3740
3893
  if (typeof superClass !== "function" && superClass !== null) {
@@ -3764,7 +3917,7 @@
3764
3917
  function Fullscreen(options) {
3765
3918
  var _this;
3766
3919
  var _options_props, _this_options;
3767
- _this = Control.call(this, _extends$m({
3920
+ _this = Control.call(this, _extends$l({
3768
3921
  tagName: 'span',
3769
3922
  classNameSuffix: 'fullscreen',
3770
3923
  controlType: 'button'
@@ -3829,8 +3982,8 @@
3829
3982
  return Fullscreen;
3830
3983
  }(Control);
3831
3984
 
3832
- function _extends$l() {
3833
- _extends$l = Object.assign || function(target) {
3985
+ function _extends$k() {
3986
+ _extends$k = Object.assign || function(target) {
3834
3987
  for(var i = 1; i < arguments.length; i++){
3835
3988
  var source = arguments[i];
3836
3989
  for(var key in source){
@@ -3841,7 +3994,7 @@
3841
3994
  }
3842
3995
  return target;
3843
3996
  };
3844
- return _extends$l.apply(this, arguments);
3997
+ return _extends$k.apply(this, arguments);
3845
3998
  }
3846
3999
  function _inherits$k(subClass, superClass) {
3847
4000
  if (typeof superClass !== "function" && superClass !== null) {
@@ -3871,7 +4024,7 @@
3871
4024
  function Rec(options) {
3872
4025
  var _this;
3873
4026
  var _options_props;
3874
- _this = Control.call(this, _extends$l({}, options, {
4027
+ _this = Control.call(this, _extends$k({}, options, {
3875
4028
  tagName: 'div',
3876
4029
  controlType: 'block',
3877
4030
  classNameSuffix: 'rec'
@@ -3963,25 +4116,185 @@
3963
4116
  return Rec;
3964
4117
  }(Control);
3965
4118
 
3966
- /*
3967
- * @ezuikit/utils-i18n v1.1.1
3968
- * i18n utils
3969
- * Copyright (c) 2025-08-30 Ezviz-OpenBiz
3970
- * Released under the MIT License.
3971
- */
3972
- class I18n{t(scope,variables){
3973
- const translation=this._translations[this._locale];let value;if(!translation)return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):`[missing "${this._locale}" locale]`;if("string"==typeof scope&&scope.includes(".")&&!(scope in translation)){const[v,hasProp]=this._findChainValue(translation,scope);if(hasProp)value=v;else {if(void 0===(null==variables?void 0:variables.defaultvalue))return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):`[missing "${this._locale}.${scope}" translation]`;value=variables.defaultvalue;}}else if(scope in translation)value=translation[scope];else {if(void 0===(null==variables?void 0:variables.defaultvalue))return "function"==typeof this.options.customizeMissing?this.options.customizeMissing(scope,variables):`[missing "${this._locale}.${scope}" translation]`;value=variables.defaultvalue;}return "string"==typeof value&&variables&&/\{\{\s*(\w+)\s*\}\}/.test(value)?value.replace(/\{\{\s*(\w+)\s*\}\}/g,((_,varName)=>String(variables[varName])||"")):value}get locale(){return this._locale}get translations(){return this._translations}appendTranslations(translations){this._translations=deepmerge(this._translations,translations,{clone:false}),this._locale||(this._locale=Object.keys(this._translations)[0]),this._onChange();}
3974
- switchLocale(locale){locale in this._translations&&(this._locale=locale,this._onChange());}
3975
- switchTranslation(locale){locale in this._translations&&(this._locale=locale,this._onChange());}
3976
- getCurrentLocale(){return this._locale}getCurrentTranslation(){return this._translations[this._locale]}getVersion(){return "1.1.0"}_onChange(){return null==this.options.onChange?void 0:this.options.onChange.call(this.options,this)}_findChainValue(obj,path){const paths=path.split(".");let translation=obj;for(let i=0;i<paths.length;i++){if(!(paths[i]in translation))return [void 0,false];if(translation=translation[paths[i]],i+1===paths.length)return [translation[paths[i]],true]}return [void 0,false]}constructor(translations,options){this._translations={},this._locale=null==options?void 0:options.defaultLocale,translations&&(this._translations=translations,(null==options?void 0:options.defaultLocale)||(this._locale=Object.keys(translations)[0])),this.options=options||{};}}I18n.VERSION="1.1.0";
4119
+ var dist$3 = {exports: {}};
3977
4120
 
3978
- /*
3979
- * @ezuikit/utils-logger v1.1.0
3980
- * logger utils
3981
- * Copyright (c) 2025-08-29 Ezviz-OpenBiz
3982
- * Released under the MIT License.
3983
- */
3984
- const LoggerStyle={info:"",log:"background: #4096ff; color: #FFF;",warn:"background: yellow; color: #FFF;",error:"background: red; color: #FFF;"};class LoggerCls{setOptions(options){var _this__options_level;this._options=Object.assign({},this._options,options),this._levelNum=this._matchLevel(null!=(_this__options_level=this._options.level)?_this__options_level:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0);}_matchLevel(level){let logLevel=3;switch(level){case "INFO":logLevel=3;break;case "LOG":logLevel=2;break;case "WARN":logLevel=1;break;case "ERROR":logLevel=0;}return logLevel}_loggerFactory(type,bool){const fn=console[type];if(bool&&fn){const args0=this._options.name?`%c[${this._options.name}]%c %c[${type.toUpperCase()}]`:`%c[${type.toUpperCase()}]`,color=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,LoggerStyle[type]].filter((color=>null!=color));return fn.bind(console,args0,...color)}return LoggerCls.noop}getOptions(){return this._options}getVersion(){return "1.1.0"}constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._options={level:"INFO",showTime:false},this._levelNum=3,this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(options);}}function fillTen(num){return (num=+num)<10&&(num=`0${num}`),num+""}LoggerCls.noop=()=>{},LoggerCls.VERSION="1.1.0";const list=["info","log","warn","error"];function Logger(options){const logger=new LoggerCls(options);return new Proxy(logger,{get(target,prop){if(list.includes(prop)){var _target__options;if(null==(_target__options=target._options)?void 0:_target__options.showTime){const time=function(){const now=new Date(Date.now()),year=now.getFullYear(),month=now.getMonth()+1,day=now.getDate(),hour=now.getHours(),min=now.getMinutes(),sec=now.getSeconds(),ms=now.getMilliseconds();return `${year}/${fillTen(month)}/${fillTen(day)} ${fillTen(hour)}:${fillTen(min)}:${fillTen(sec)}:${ms}`}();return target[prop].bind(console,`[${time}]`)}return target[prop].bind(console)}return Reflect.get(target,prop)}})}
4121
+ var hasRequiredDist$3;
4122
+
4123
+ function requireDist$3 () {
4124
+ if (hasRequiredDist$3) return dist$3.exports;
4125
+ hasRequiredDist$3 = 1;
4126
+
4127
+ var deepmerge = requireCjs();
4128
+
4129
+ function _create_class(Constructor, protoProps, staticProps) {
4130
+ return protoProps && function(target, props) {
4131
+ for (var i = 0; i < props.length; i++) {
4132
+ var descriptor = props[i];
4133
+ descriptor.enumerable = descriptor.enumerable || false, descriptor.configurable = true,
4134
+ "value" in descriptor && (descriptor.writable = true), Object.defineProperty(target, descriptor.key, descriptor);
4135
+ }
4136
+ }(Constructor.prototype, protoProps), Constructor;
4137
+ }
4138
+
4139
+ var I18n = function() {
4140
+ function I18n(translations, options) {
4141
+ this._translations = {}, this._locale = null == options ? void 0 : options.defaultLocale,
4142
+ translations && (this._translations = translations, (null == options ? void 0 : options.defaultLocale) || (this._locale = Object.keys(translations)[0])),
4143
+ this.options = options || {};
4144
+ }
4145
+ var _proto = I18n.prototype;
4146
+ return _proto.t = function(scope, variables) {
4147
+ var value, translation = this._translations[this._locale];
4148
+ if (!translation) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + '" locale]';
4149
+ if ("string" == typeof scope && scope.includes(".") && !(scope in translation)) {
4150
+ var _this__findChainValue = this._findChainValue(translation, scope), v = _this__findChainValue[0];
4151
+ if (_this__findChainValue[1]) value = v; else {
4152
+ if (void 0 === (null == variables ? void 0 : variables.defaultvalue)) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + "." + scope + '" translation]';
4153
+ value = variables.defaultvalue;
4154
+ }
4155
+ } else if (scope in translation) value = translation[scope]; else {
4156
+ if (void 0 === (null == variables ? void 0 : variables.defaultvalue)) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + "." + scope + '" translation]';
4157
+ value = variables.defaultvalue;
4158
+ }
4159
+ return "string" == typeof value && variables && /\{\{\s*(\w+)\s*\}\}/.test(value) ? value.replace(/\{\{\s*(\w+)\s*\}\}/g, function(_, varName) {
4160
+ return String(variables[varName]) || "";
4161
+ }) : value;
4162
+ }, _proto.appendTranslations = function(translations) {
4163
+ this._translations = deepmerge(this._translations, translations, {
4164
+ clone: false
4165
+ }), this._locale || (this._locale = Object.keys(this._translations)[0]), this._onChange();
4166
+ }, _proto.switchLocale = function(locale) {
4167
+ locale in this._translations && (this._locale = locale, this._onChange());
4168
+ }, _proto.switchTranslation = function(locale) {
4169
+ this.switchLocale(locale);
4170
+ }, _proto.getCurrentLocale = function() {
4171
+ return this._locale;
4172
+ }, _proto.getCurrentTranslation = function() {
4173
+ return this._translations[this._locale];
4174
+ }, _proto.getVersion = function() {
4175
+ return "2.0.0-beta.4";
4176
+ }, _proto._onChange = function() {
4177
+ return null == this.options.onChange ? void 0 : this.options.onChange.call(this.options, this);
4178
+ }, _proto._findChainValue = function(obj, path) {
4179
+ for (var paths = path.split("."), translation = obj, i = 0; i < paths.length; i++) {
4180
+ if (!(paths[i] in translation)) return [ void 0, false ];
4181
+ if (translation = translation[paths[i]], i + 1 === paths.length) return [ translation[paths[i]], true ];
4182
+ }
4183
+ return [ void 0, false ];
4184
+ }, _create_class(I18n, [ {
4185
+ key: "locale",
4186
+ get: function() {
4187
+ return this._locale;
4188
+ }
4189
+ }, {
4190
+ key: "translations",
4191
+ get: function() {
4192
+ return this._translations;
4193
+ }
4194
+ } ]), I18n;
4195
+ }();
4196
+
4197
+ I18n.VERSION = "2.0.0-beta.4", dist$3.exports = I18n;
4198
+ return dist$3.exports;
4199
+ }
4200
+
4201
+ var distExports$2 = requireDist$3();
4202
+ var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$2);
4203
+
4204
+ var dist$2;
4205
+ var hasRequiredDist$2;
4206
+
4207
+ function requireDist$2 () {
4208
+ if (hasRequiredDist$2) return dist$2;
4209
+ hasRequiredDist$2 = 1;
4210
+
4211
+ var _$LoggerStyle$_ = {
4212
+ info: "",
4213
+ log: "background: #4096ff; color: #FFF;",
4214
+ warn: "background: yellow; color: #FFF;",
4215
+ error: "background: red; color: #FFF;"
4216
+ }, LoggerCls = function() {
4217
+ function LoggerCls(options) {
4218
+ void 0 === options && (options = {}), this._options = {
4219
+ level: "INFO",
4220
+ showTime: false
4221
+ }, this._levelNum = 3, this.info = this._loggerFactory("info", this._levelNum >= 3),
4222
+ this.log = this._loggerFactory("log", this._levelNum >= 2), this.warn = this._loggerFactory("warn", this._levelNum >= 1),
4223
+ this.error = this._loggerFactory("error", this._levelNum >= 0), this.setOptions(options);
4224
+ }
4225
+ var _proto = LoggerCls.prototype;
4226
+ return _proto.setOptions = function(options) {
4227
+ var _this__options_level;
4228
+ this._options = Object.assign({}, this._options, options), this._levelNum = this._matchLevel(null != (_this__options_level = this._options.level) ? _this__options_level : "INFO"),
4229
+ this.info = this._loggerFactory("info", this._levelNum >= 3), this.log = this._loggerFactory("log", this._levelNum >= 2),
4230
+ this.warn = this._loggerFactory("warn", this._levelNum >= 1), this.error = this._loggerFactory("error", this._levelNum >= 0);
4231
+ }, _proto._matchLevel = function(level) {
4232
+ var logLevel = 3;
4233
+ switch (level) {
4234
+ case "INFO":
4235
+ logLevel = 3;
4236
+ break;
4237
+
4238
+ case "LOG":
4239
+ logLevel = 2;
4240
+ break;
4241
+
4242
+ case "WARN":
4243
+ logLevel = 1;
4244
+ break;
4245
+
4246
+ case "ERROR":
4247
+ logLevel = 0;
4248
+ }
4249
+ return logLevel;
4250
+ }, _proto._loggerFactory = function(type, bool) {
4251
+ var fn = console[type];
4252
+ if (bool && fn) {
4253
+ var _fn, args0 = this._options.name ? "%c[" + this._options.name + "]%c %c[" + type.toUpperCase() + "]" : "%c[" + type.toUpperCase() + "]", color = [ this._options.name ? "background: green;color: #fff" : null, this._options.name ? "" : null, _$LoggerStyle$_[type] ].filter(function(color) {
4254
+ return null != color;
4255
+ });
4256
+ return (_fn = fn).bind.apply(_fn, [].concat([ console, args0 ], color));
4257
+ }
4258
+ return LoggerCls.noop;
4259
+ }, _proto.getOptions = function() {
4260
+ return this._options;
4261
+ }, _proto.getVersion = function() {
4262
+ return "2.0.0-beta.1";
4263
+ }, LoggerCls;
4264
+ }();
4265
+
4266
+ function __fillTen__(num) {
4267
+ return (num = +num) < 10 && (num = "0" + num), num + "";
4268
+ }
4269
+
4270
+ LoggerCls.noop = function() {}, LoggerCls.VERSION = "2.0.0-beta.1";
4271
+
4272
+ var __$list$__ = [ "info", "log", "warn", "error" ];
4273
+
4274
+ dist$2 = function(options) {
4275
+ var logger = new LoggerCls(options);
4276
+ return new Proxy(logger, {
4277
+ get: function(target, prop) {
4278
+ if (__$list$__.includes(prop)) {
4279
+ var _target__options;
4280
+ if (null == (_target__options = target._options) ? void 0 : _target__options.showTime) {
4281
+ var time = (now = new Date(Date.now()), year = now.getFullYear(), month = now.getMonth() + 1,
4282
+ day = now.getDate(), hour = now.getHours(), min = now.getMinutes(), sec = now.getSeconds(),
4283
+ ms = now.getMilliseconds(), year + "/" + __fillTen__(month) + "/" + __fillTen__(day) + " " + __fillTen__(hour) + ":" + __fillTen__(min) + ":" + __fillTen__(sec) + ":" + ms);
4284
+ return target[prop].bind(console, "[" + time + "]");
4285
+ }
4286
+ return target[prop].bind(console);
4287
+ }
4288
+ var now, year, month, day, hour, min, sec, ms;
4289
+ return Reflect.get(target, prop);
4290
+ }
4291
+ });
4292
+ };
4293
+ return dist$2;
4294
+ }
4295
+
4296
+ var distExports$1 = requireDist$2();
4297
+ var Logger = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
3985
4298
 
3986
4299
  var zh = {
3987
4300
  391001: '取流地址或端口非法',
@@ -5083,22 +5396,86 @@
5083
5396
  _inherits$j(Content, EventEmitter);
5084
5397
  function Content(options) {
5085
5398
  var _this;
5086
- _this = EventEmitter.call(this) || this;
5399
+ _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0;
5087
5400
  _this.options = options;
5401
+ _this._scaleMode = options.scaleMode || 0;
5088
5402
  _this.$wrapper = document.createElement('div');
5089
5403
  _this.$wrapper.className = "" + PREFIX_CLASS + "-content-wrapper";
5090
5404
  _this.$content = document.createElement('div');
5091
5405
  _this.$content.className = "" + PREFIX_CLASS + "-content";
5406
+ _this.$video = document.createElement('div');
5407
+ _this.$video.className = "" + PREFIX_CLASS + "-content-video";
5408
+ _this.$content.appendChild(_this.$video);
5092
5409
  _this.$wrapper.appendChild(_this.$content);
5093
5410
  if (typeof options.getContainer === 'function') {
5094
5411
  var $popupContainer = options.getContainer();
5095
5412
  $popupContainer.appendChild(_this.$wrapper);
5096
5413
  }
5414
+ _this.on(EVENTS.videoInfo, function(originWidth, originHeight) {
5415
+ _this._rerender(originWidth, originHeight);
5416
+ });
5417
+ _this.on(EVENTS.resize, function() {
5418
+ _this._rerender();
5419
+ });
5097
5420
  return _this;
5098
5421
  }
5099
5422
  var _proto = Content.prototype;
5423
+ /**
5424
+ * 重新画面区域
5425
+ * @param {number} originWidth 画面宽度
5426
+ * @param {number} originHeight 画面高度
5427
+ * @returns {void}
5428
+ */ _proto._rerender = function _rerender(originWidth, originHeight) {
5429
+ if (originWidth === void 0) originWidth = 0;
5430
+ if (originHeight === void 0) originHeight = 0;
5431
+ var width = this.$wrapper.clientWidth;
5432
+ var height = this.$wrapper.clientHeight;
5433
+ if (originWidth > 0 && originHeight > 0) {
5434
+ this._originWidth = originWidth;
5435
+ this._originHeight = originHeight;
5436
+ }
5437
+ // 默认是1
5438
+ // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边
5439
+ var objectFill = 'contain';
5440
+ // 视频画面完全填充canvas区域,画面会被拉伸
5441
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.full) {
5442
+ objectFill = 'fill';
5443
+ }
5444
+ // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
5445
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
5446
+ objectFill = 'cover';
5447
+ }
5448
+ if (width > 0 && height > 0 && this._originWidth > 0 && this._originHeight > 0 && this.$video) {
5449
+ var left = (width - this._originWidth) / 2;
5450
+ var top = (height - this._originHeight) / 2;
5451
+ var wScale = width / this._originWidth;
5452
+ var hScale = height / this._originHeight;
5453
+ var scale = wScale > hScale ? hScale : wScale;
5454
+ //
5455
+ if (!(this._scaleMode === THEME_SCALE_MODE_TYPE.auto)) {
5456
+ if (wScale !== hScale) {
5457
+ scale = wScale + ',' + hScale;
5458
+ }
5459
+ }
5460
+ //
5461
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
5462
+ scale = wScale > hScale ? wScale : hScale;
5463
+ }
5464
+ this.$video.style.cssText += "\n width: " + this._originWidth + "px;\n height: " + this._originHeight + "px;\n position: absolute;\n object-fit:" + objectFill + ";\n left: " + left + "px;\n top: " + top + "px;\n transform-origin: 50% 50%;\n transform: scale(" + scale + ");\n ";
5465
+ }
5466
+ };
5467
+ _proto.setScaleMode = function setScaleMode(scaleMode) {
5468
+ if (scaleMode === void 0) scaleMode = 0;
5469
+ this._scaleMode = scaleMode;
5470
+ this._rerender();
5471
+ };
5100
5472
  _proto.destroy = function destroy() {
5101
5473
  var _this_$wrapper;
5474
+ if (this.$video) {
5475
+ this.$video.remove();
5476
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5477
+ this.$video = null;
5478
+ }
5102
5479
  if (this.$content) {
5103
5480
  this.$content.remove();
5104
5481
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -5113,8 +5490,8 @@
5113
5490
  return Content;
5114
5491
  }(EventEmitter);
5115
5492
 
5116
- function _extends$k() {
5117
- _extends$k = Object.assign || function(target) {
5493
+ function _extends$j() {
5494
+ _extends$j = Object.assign || function(target) {
5118
5495
  for(var i = 1; i < arguments.length; i++){
5119
5496
  var source = arguments[i];
5120
5497
  for(var key in source){
@@ -5125,7 +5502,7 @@
5125
5502
  }
5126
5503
  return target;
5127
5504
  };
5128
- return _extends$k.apply(this, arguments);
5505
+ return _extends$j.apply(this, arguments);
5129
5506
  }
5130
5507
  function _inherits$i(subClass, superClass) {
5131
5508
  if (typeof superClass !== "function" && superClass !== null) {
@@ -5154,7 +5531,7 @@
5154
5531
  _inherits$i(More, Control);
5155
5532
  function More(options) {
5156
5533
  var _this;
5157
- _this = Control.call(this, _extends$k({}, options, {
5534
+ _this = Control.call(this, _extends$j({}, options, {
5158
5535
  tagName: 'span',
5159
5536
  controlType: 'button',
5160
5537
  classNameSuffix: 'more'
@@ -5300,6 +5677,17 @@
5300
5677
  }
5301
5678
  });
5302
5679
  theme == null ? void 0 : theme.on(EVENTS.videoInfo, function(info) {
5680
+ // 排除流信息回调触发的事件
5681
+ if (!!info && info.from !== "setStreamInfoCallBack") {
5682
+ var // rerender 画面
5683
+ _theme_contentControl_emit, _theme_contentControl;
5684
+ (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.videoInfo, info.width, info.height);
5685
+ }
5686
+ });
5687
+ theme == null ? void 0 : theme.on(EVENTS.resize, function() {
5688
+ var // rerender 画面
5689
+ _theme_contentControl_emit, _theme_contentControl;
5690
+ (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.resize);
5303
5691
  });
5304
5692
  theme == null ? void 0 : theme.on('getDeviceInfo', function(info) {
5305
5693
  });
@@ -5696,12 +6084,12 @@
5696
6084
  * @returns {void}
5697
6085
  */ function _resize(theme, width, height) {
5698
6086
  var cssText = '';
5699
- if (/\d/.test(width + '')) {
6087
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
5700
6088
  cssText += "width: " + width + "px;";
5701
6089
  } else if (width) {
5702
6090
  cssText += "width: " + width + ";";
5703
6091
  }
5704
- if (/\d/.test(height + '')) {
6092
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
5705
6093
  cssText += "height: " + height + "px;";
5706
6094
  } else if (height) {
5707
6095
  cssText += "height: " + height + ";";
@@ -5722,8 +6110,8 @@
5722
6110
  if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
5723
6111
  return Constructor;
5724
6112
  }
5725
- function _extends$j() {
5726
- _extends$j = Object.assign || function(target) {
6113
+ function _extends$i() {
6114
+ _extends$i = Object.assign || function(target) {
5727
6115
  for(var i = 1; i < arguments.length; i++){
5728
6116
  var source = arguments[i];
5729
6117
  for(var key in source){
@@ -5734,7 +6122,7 @@
5734
6122
  }
5735
6123
  return target;
5736
6124
  };
5737
- return _extends$j.apply(this, arguments);
6125
+ return _extends$i.apply(this, arguments);
5738
6126
  }
5739
6127
  function _inherits$h(subClass, superClass) {
5740
6128
  if (typeof superClass !== "function" && superClass !== null) {
@@ -5767,7 +6155,7 @@
5767
6155
  _inherits$h(Zoom, Control);
5768
6156
  function Zoom(options) {
5769
6157
  var _this;
5770
- _this = Control.call(this, _extends$j({}, options, {
6158
+ _this = Control.call(this, _extends$i({}, options, {
5771
6159
  tagName: 'span',
5772
6160
  controlType: 'button',
5773
6161
  classNameSuffix: 'zoom'
@@ -5897,7 +6285,7 @@
5897
6285
 
5898
6286
  /*
5899
6287
  * @ezuikit/control-zoom v0.0.2
5900
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
6288
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
5901
6289
  * Released under the MIT License.
5902
6290
  */
5903
6291
  /**
@@ -6572,8 +6960,8 @@
6572
6960
  }
6573
6961
  Zoom.VERSION = '0.0.2';
6574
6962
 
6575
- function _extends$i() {
6576
- _extends$i = Object.assign || function(target) {
6963
+ function _extends$h() {
6964
+ _extends$h = Object.assign || function(target) {
6577
6965
  for(var i = 1; i < arguments.length; i++){
6578
6966
  var source = arguments[i];
6579
6967
  for(var key in source){
@@ -6584,10 +6972,10 @@
6584
6972
  }
6585
6973
  return target;
6586
6974
  };
6587
- return _extends$i.apply(this, arguments);
6975
+ return _extends$h.apply(this, arguments);
6588
6976
  }
6589
6977
  function __zoom(theme, container, options) {
6590
- theme.zoomUtil = new Zoom(container, _extends$i({}, options || {}, {
6978
+ theme.zoomUtil = new Zoom(container, _extends$h({}, options || {}, {
6591
6979
  min: 1,
6592
6980
  onChange: function(zoom, reset) {
6593
6981
  if (zoom !== theme._zoom) {
@@ -6812,8 +7200,8 @@
6812
7200
  });
6813
7201
  };
6814
7202
  }
6815
- function _extends$h() {
6816
- _extends$h = Object.assign || function(target) {
7203
+ function _extends$g() {
7204
+ _extends$g = Object.assign || function(target) {
6817
7205
  for(var i = 1; i < arguments.length; i++){
6818
7206
  var source = arguments[i];
6819
7207
  for(var key in source){
@@ -6824,7 +7212,7 @@
6824
7212
  }
6825
7213
  return target;
6826
7214
  };
6827
- return _extends$h.apply(this, arguments);
7215
+ return _extends$g.apply(this, arguments);
6828
7216
  }
6829
7217
  function _ts_generator$3(thisArg, body) {
6830
7218
  var f, y, t, _ = {
@@ -6952,7 +7340,7 @@
6952
7340
  }
6953
7341
  if (item.isrender === 1 && REC_GROUP.includes(item.iconId)) {
6954
7342
  // TODO: 因为回放是一组, 位置以第一个位置为准
6955
- recControls.push(recControls[0] ? _extends$h({}, item, {
7343
+ recControls.push(recControls[0] ? _extends$g({}, item, {
6956
7344
  part: recControls[0].part
6957
7345
  }) : item);
6958
7346
  return false;
@@ -6975,7 +7363,7 @@
6975
7363
  }
6976
7364
  if (item.isrender === 1 && REC_GROUP.includes(item.iconId)) {
6977
7365
  // TODO: 因为回放是一组, 位置以第一个位置为准
6978
- recControls.push(recControls[0] ? _extends$h({}, item, {
7366
+ recControls.push(recControls[0] ? _extends$g({}, item, {
6979
7367
  part: recControls[0].part
6980
7368
  }) : item);
6981
7369
  return false;
@@ -7230,8 +7618,8 @@
7230
7618
  return Component;
7231
7619
  }();
7232
7620
 
7233
- function _extends$g() {
7234
- _extends$g = Object.assign || function(target) {
7621
+ function _extends$f() {
7622
+ _extends$f = Object.assign || function(target) {
7235
7623
  for(var i = 1; i < arguments.length; i++){
7236
7624
  var source = arguments[i];
7237
7625
  for(var key in source){
@@ -7242,7 +7630,7 @@
7242
7630
  }
7243
7631
  return target;
7244
7632
  };
7245
- return _extends$g.apply(this, arguments);
7633
+ return _extends$f.apply(this, arguments);
7246
7634
  }
7247
7635
  function _inherits$g(subClass, superClass) {
7248
7636
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7268,15 +7656,15 @@
7268
7656
  _inherits$g(Footer, Component);
7269
7657
  function Footer(options) {
7270
7658
  if (options === void 0) options = {};
7271
- return Component.call(this, _extends$g({}, options, {
7659
+ return Component.call(this, _extends$f({}, options, {
7272
7660
  cType: 'footer'
7273
7661
  })) || this;
7274
7662
  }
7275
7663
  return Footer;
7276
7664
  }(Component);
7277
7665
 
7278
- function _extends$f() {
7279
- _extends$f = Object.assign || function(target) {
7666
+ function _extends$e() {
7667
+ _extends$e = Object.assign || function(target) {
7280
7668
  for(var i = 1; i < arguments.length; i++){
7281
7669
  var source = arguments[i];
7282
7670
  for(var key in source){
@@ -7287,7 +7675,7 @@
7287
7675
  }
7288
7676
  return target;
7289
7677
  };
7290
- return _extends$f.apply(this, arguments);
7678
+ return _extends$e.apply(this, arguments);
7291
7679
  }
7292
7680
  function _inherits$f(subClass, superClass) {
7293
7681
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7313,7 +7701,7 @@
7313
7701
  _inherits$f(Header, Component);
7314
7702
  function Header(options) {
7315
7703
  if (options === void 0) options = {};
7316
- return Component.call(this, _extends$f({}, options, {
7704
+ return Component.call(this, _extends$e({}, options, {
7317
7705
  cType: 'header'
7318
7706
  })) || this;
7319
7707
  }
@@ -7479,8 +7867,8 @@
7479
7867
  };
7480
7868
  }
7481
7869
 
7482
- function _extends$e() {
7483
- _extends$e = Object.assign || function(target) {
7870
+ function _extends$d() {
7871
+ _extends$d = Object.assign || function(target) {
7484
7872
  for(var i = 1; i < arguments.length; i++){
7485
7873
  var source = arguments[i];
7486
7874
  for(var key in source){
@@ -7491,7 +7879,7 @@
7491
7879
  }
7492
7880
  return target;
7493
7881
  };
7494
- return _extends$e.apply(this, arguments);
7882
+ return _extends$d.apply(this, arguments);
7495
7883
  }
7496
7884
  function _inherits$e(subClass, superClass) {
7497
7885
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7520,7 +7908,7 @@
7520
7908
  */ var GlobalFullscreen = /*#__PURE__*/ function(Fullscreen) {
7521
7909
  _inherits$e(GlobalFullscreen, Fullscreen);
7522
7910
  function GlobalFullscreen(options) {
7523
- return Fullscreen.call(this, _extends$e({}, options, {
7911
+ return Fullscreen.call(this, _extends$d({}, options, {
7524
7912
  controlType: 'button',
7525
7913
  classNameSuffix: 'global-fullscreen'
7526
7914
  })) || this;
@@ -7551,8 +7939,8 @@
7551
7939
  return GlobalFullscreen;
7552
7940
  }(Fullscreen);
7553
7941
 
7554
- function _extends$d() {
7555
- _extends$d = Object.assign || function(target) {
7942
+ function _extends$c() {
7943
+ _extends$c = Object.assign || function(target) {
7556
7944
  for(var i = 1; i < arguments.length; i++){
7557
7945
  var source = arguments[i];
7558
7946
  for(var key in source){
@@ -7563,7 +7951,7 @@
7563
7951
  }
7564
7952
  return target;
7565
7953
  };
7566
- return _extends$d.apply(this, arguments);
7954
+ return _extends$c.apply(this, arguments);
7567
7955
  }
7568
7956
  function _inherits$d(subClass, superClass) {
7569
7957
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7592,7 +7980,7 @@
7592
7980
  _inherits$d(CapturePicture, Control);
7593
7981
  function CapturePicture(options) {
7594
7982
  var _this;
7595
- _this = Control.call(this, _extends$d({}, options, {
7983
+ _this = Control.call(this, _extends$c({}, options, {
7596
7984
  tagName: 'span',
7597
7985
  classNameSuffix: 'capture-picture'
7598
7986
  })) || this, _this._timer = null;
@@ -7645,17 +8033,9 @@
7645
8033
  return CapturePicture;
7646
8034
  }(Control);
7647
8035
 
7648
- /*
7649
- * @ezuikit/utils-tools v1.1.0
7650
- * tools utils
7651
- * Copyright (c) 2025-08-29 Ezviz-OpenBiz
7652
- * Released under the MIT License.
7653
- */
7654
- function isMobile(agent){var _navigator,_navigator1,_navigator2;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1}
7655
-
7656
8036
  /*
7657
8037
  * @ezuikit/control-ptz v0.0.1
7658
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
8038
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
7659
8039
  * Released under the MIT License.
7660
8040
  */
7661
8041
 
@@ -7824,11 +8204,11 @@
7824
8204
  $icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
7825
8205
  }
7826
8206
  }
7827
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
8207
+ $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
7828
8208
  if (type === 'stop') {
7829
8209
  var _this_options_env1;
7830
8210
  url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
7831
- $warp.style.cssText = '';
8211
+ $warp.style = '';
7832
8212
  $icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
7833
8213
  $icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
7834
8214
  $icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
@@ -7872,14 +8252,11 @@
7872
8252
  60003,
7873
8253
  60004
7874
8254
  ].includes(+rt.code)) {
7875
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
8255
+ $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
7876
8256
  }
7877
8257
  }
7878
8258
  operationResultCb == null ? void 0 : operationResultCb(rt);
7879
8259
  }).catch((err)=>{
7880
- }).finally(()=>{
7881
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7882
- operationResultCb = null;
7883
8260
  });
7884
8261
  }
7885
8262
  constructor(container, options){
@@ -8195,7 +8572,7 @@
8195
8572
  }
8196
8573
  }
8197
8574
  constructor(container, options = {}){
8198
- super(container, options), this._isMobile = isMobile(), this._isRotate = false, this._clearTimer = null;
8575
+ super(container, options), this._isMobile = distExports$3.isMobile(), this._isRotate = false, this._clearTimer = null;
8199
8576
  this._$wrapper = document.createElement('div');
8200
8577
  this._$wrapper.className = PTZ_PREFIX + '-container-wrap';
8201
8578
  this._$directionCircleContainer = document.createElement('div');
@@ -8431,8 +8808,8 @@
8431
8808
  if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
8432
8809
  return Constructor;
8433
8810
  }
8434
- function _extends$c() {
8435
- _extends$c = Object.assign || function(target) {
8811
+ function _extends$b() {
8812
+ _extends$b = Object.assign || function(target) {
8436
8813
  for(var i = 1; i < arguments.length; i++){
8437
8814
  var source = arguments[i];
8438
8815
  for(var key in source){
@@ -8443,7 +8820,7 @@
8443
8820
  }
8444
8821
  return target;
8445
8822
  };
8446
- return _extends$c.apply(this, arguments);
8823
+ return _extends$b.apply(this, arguments);
8447
8824
  }
8448
8825
  function _inherits$c(subClass, superClass) {
8449
8826
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8472,7 +8849,7 @@
8472
8849
  _inherits$c(Ptz, Control);
8473
8850
  function Ptz(options) {
8474
8851
  var _this;
8475
- _this = Control.call(this, _extends$c({}, options, {
8852
+ _this = Control.call(this, _extends$b({}, options, {
8476
8853
  tagName: 'span',
8477
8854
  controlType: 'button',
8478
8855
  classNameSuffix: 'ptz'
@@ -8515,7 +8892,7 @@
8515
8892
  this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
8516
8893
  this.$panel.appendChild(this.$turntable);
8517
8894
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8518
- this._ptzControl = new Ptz$1(this.$turntable, _extends$c({}, this._options, {
8895
+ this._ptzControl = new Ptz$1(this.$turntable, _extends$b({}, this._options, {
8519
8896
  onSpeedChange: this._onSpeedChange.bind(this),
8520
8897
  onDirection: this._onDirection.bind(this)
8521
8898
  }));
@@ -8524,7 +8901,7 @@
8524
8901
  };
8525
8902
  _proto.renderMobileExtend = function renderMobileExtend($container) {
8526
8903
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8527
- if (!this._ptzControl1) this._ptzControl1 = new MobilePtz($container, _extends$c({}, this._options, {
8904
+ if (!this._ptzControl1) this._ptzControl1 = new MobilePtz($container, _extends$b({}, this._options, {
8528
8905
  onSpeedChange: this._onSpeedChange.bind(this),
8529
8906
  onDirection: this._onDirection.bind(this)
8530
8907
  }));
@@ -8627,8 +9004,8 @@
8627
9004
  if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
8628
9005
  return Constructor;
8629
9006
  }
8630
- function _extends$b() {
8631
- _extends$b = Object.assign || function(target) {
9007
+ function _extends$a() {
9008
+ _extends$a = Object.assign || function(target) {
8632
9009
  for(var i = 1; i < arguments.length; i++){
8633
9010
  var source = arguments[i];
8634
9011
  for(var key in source){
@@ -8639,7 +9016,7 @@
8639
9016
  }
8640
9017
  return target;
8641
9018
  };
8642
- return _extends$b.apply(this, arguments);
9019
+ return _extends$a.apply(this, arguments);
8643
9020
  }
8644
9021
  function _inherits$b(subClass, superClass) {
8645
9022
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8676,7 +9053,7 @@
8676
9053
  _inherits$b(Record, Control);
8677
9054
  function Record(options) {
8678
9055
  var _this;
8679
- _this = Control.call(this, _extends$b({}, options, {
9056
+ _this = Control.call(this, _extends$a({}, options, {
8680
9057
  tagName: 'span',
8681
9058
  controlType: 'button',
8682
9059
  classNameSuffix: 'record'
@@ -8817,8 +9194,8 @@
8817
9194
  if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
8818
9195
  return Constructor;
8819
9196
  }
8820
- function _extends$a() {
8821
- _extends$a = Object.assign || function(target) {
9197
+ function _extends$9() {
9198
+ _extends$9 = Object.assign || function(target) {
8822
9199
  for(var i = 1; i < arguments.length; i++){
8823
9200
  var source = arguments[i];
8824
9201
  for(var key in source){
@@ -8829,7 +9206,7 @@
8829
9206
  }
8830
9207
  return target;
8831
9208
  };
8832
- return _extends$a.apply(this, arguments);
9209
+ return _extends$9.apply(this, arguments);
8833
9210
  }
8834
9211
  function _inherits$a(subClass, superClass) {
8835
9212
  if (typeof superClass !== "function" && superClass !== null) {
@@ -8954,7 +9331,7 @@
8954
9331
  _inherits$a(Talk, Control);
8955
9332
  function Talk(options) {
8956
9333
  var _this;
8957
- _this = Control.call(this, _extends$a({}, options, {
9334
+ _this = Control.call(this, _extends$9({}, options, {
8958
9335
  tagName: 'span',
8959
9336
  controlType: 'button',
8960
9337
  classNameSuffix: 'talk'
@@ -9071,8 +9448,8 @@
9071
9448
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
9072
9449
  return Constructor;
9073
9450
  }
9074
- function _extends$9() {
9075
- _extends$9 = Object.assign || function(target) {
9451
+ function _extends$8() {
9452
+ _extends$8 = Object.assign || function(target) {
9076
9453
  for(var i = 1; i < arguments.length; i++){
9077
9454
  var source = arguments[i];
9078
9455
  for(var key in source){
@@ -9083,7 +9460,7 @@
9083
9460
  }
9084
9461
  return target;
9085
9462
  };
9086
- return _extends$9.apply(this, arguments);
9463
+ return _extends$8.apply(this, arguments);
9087
9464
  }
9088
9465
  function _inherits$9(subClass, superClass) {
9089
9466
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9169,7 +9546,7 @@
9169
9546
  function Select(options) {
9170
9547
  var _this;
9171
9548
  var _this__options_fieldNames, _this__picker_$body;
9172
- _this = Control.call(this, _extends$9({
9549
+ _this = Control.call(this, _extends$8({
9173
9550
  tagName: 'span',
9174
9551
  type: 'button',
9175
9552
  controlType: 'button'
@@ -9367,8 +9744,8 @@
9367
9744
  }
9368
9745
  return self;
9369
9746
  }
9370
- function _extends$8() {
9371
- _extends$8 = Object.assign || function(target) {
9747
+ function _extends$7() {
9748
+ _extends$7 = Object.assign || function(target) {
9372
9749
  for(var i = 1; i < arguments.length; i++){
9373
9750
  var source = arguments[i];
9374
9751
  for(var key in source){
@@ -9379,7 +9756,7 @@
9379
9756
  }
9380
9757
  return target;
9381
9758
  };
9382
- return _extends$8.apply(this, arguments);
9759
+ return _extends$7.apply(this, arguments);
9383
9760
  }
9384
9761
  function _inherits$8(subClass, superClass) {
9385
9762
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9454,7 +9831,7 @@
9454
9831
  if (options === void 0) options = {};
9455
9832
  var _this;
9456
9833
  var _options_props, _options_props1, _options_locales_options_language;
9457
- _this = Select.call(this, _extends$8({}, DEFINITION_DEFAULT_OPTIONS, {
9834
+ _this = Select.call(this, _extends$7({}, DEFINITION_DEFAULT_OPTIONS, {
9458
9835
  value: (_options_props = options.props) == null ? void 0 : _options_props.videoLevel
9459
9836
  }, options, {
9460
9837
  fieldNames: {
@@ -9466,14 +9843,16 @@
9466
9843
  controlType: 'button',
9467
9844
  classNameSuffix: 'definition',
9468
9845
  renderLabel: function(label, item, list) {
9846
+ var _list_;
9469
9847
  if ((item == null ? void 0 : item.level) === 'auto') {
9470
9848
  var _options_locales_options_language;
9471
- var realIitem = list.find(function(it) {
9849
+ var realItem = list.find(function(it) {
9472
9850
  return it.level === _assert_this_initialized$1(_this)._level;
9473
9851
  });
9474
- return "<span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realIitem == null ? void 0 : realIitem.name) || '') + ")</span>";
9852
+ return "<span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realItem == null ? void 0 : realItem.name) || '') + ")</span>";
9475
9853
  }
9476
- return "<span>" + label + "</span>";
9854
+ // 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
9855
+ return "<span>" + (label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || '') + "</span>";
9477
9856
  },
9478
9857
  onChange: function(value, item) {
9479
9858
  var _options_onChange;
@@ -9500,10 +9879,10 @@
9500
9879
  _this._level = realLevel + '';
9501
9880
  if (l === 'auto') {
9502
9881
  var _options_locales_options_language;
9503
- var realIitem = _this.list.find(function(it) {
9882
+ var realItem = _this.list.find(function(it) {
9504
9883
  return it.level === _this._level;
9505
9884
  });
9506
- _this.$container.querySelector("." + PREFIX_CLASS + "-select-btn").innerHTML = "\n <span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realIitem == null ? void 0 : realIitem.name) || '') + ")</span>\n ";
9885
+ _this.$container.querySelector("." + PREFIX_CLASS + "-select-btn").innerHTML = "\n <span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realItem == null ? void 0 : realItem.name) || '') + ")</span>\n ";
9507
9886
  } else {
9508
9887
  if (_this.value !== _this._level + '') _this.value = _this._level + '';
9509
9888
  }
@@ -9526,8 +9905,8 @@
9526
9905
  }
9527
9906
  return self;
9528
9907
  }
9529
- function _extends$7() {
9530
- _extends$7 = Object.assign || function(target) {
9908
+ function _extends$6() {
9909
+ _extends$6 = Object.assign || function(target) {
9531
9910
  for(var i = 1; i < arguments.length; i++){
9532
9911
  var source = arguments[i];
9533
9912
  for(var key in source){
@@ -9538,7 +9917,7 @@
9538
9917
  }
9539
9918
  return target;
9540
9919
  };
9541
- return _extends$7.apply(this, arguments);
9920
+ return _extends$6.apply(this, arguments);
9542
9921
  }
9543
9922
  function _inherits$7(subClass, superClass) {
9544
9923
  if (typeof superClass !== "function" && superClass !== null) {
@@ -9594,7 +9973,7 @@
9594
9973
  function Speed(options) {
9595
9974
  var _this;
9596
9975
  var _options_locales_options_language, _options_locales;
9597
- _this = Select.call(this, _extends$7({}, SPEED_DEFAULT_OPTIONS, options, {
9976
+ _this = Select.call(this, _extends$6({}, SPEED_DEFAULT_OPTIONS, options, {
9598
9977
  value: (options.props.speed || 1) + '',
9599
9978
  classNameSuffix: 'speed',
9600
9979
  controlType: 'button',
@@ -9627,7 +10006,7 @@
9627
10006
 
9628
10007
  /*
9629
10008
  * @ezuikit/control-date-picker v0.0.1
9630
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
10009
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
9631
10010
  * Released under the MIT License.
9632
10011
  */
9633
10012
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
@@ -9999,8 +10378,8 @@
9999
10378
  return DateTime;
10000
10379
  }();
10001
10380
 
10002
- function _extends$6() {
10003
- _extends$6 = Object.assign || function(target) {
10381
+ function _extends$5() {
10382
+ _extends$5 = Object.assign || function(target) {
10004
10383
  for(var i = 1; i < arguments.length; i++){
10005
10384
  var source = arguments[i];
10006
10385
  for(var key in source){
@@ -10011,7 +10390,7 @@
10011
10390
  }
10012
10391
  return target;
10013
10392
  };
10014
- return _extends$6.apply(this, arguments);
10393
+ return _extends$5.apply(this, arguments);
10015
10394
  }
10016
10395
  function _inherits$6(subClass, superClass) {
10017
10396
  if (typeof superClass !== "function" && superClass !== null) {
@@ -10041,7 +10420,7 @@
10041
10420
  function DatePickerControl(options) {
10042
10421
  var _this;
10043
10422
  var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
10044
- _this = Control.call(this, _extends$6({}, options, {
10423
+ _this = Control.call(this, _extends$5({}, options, {
10045
10424
  tagName: 'span',
10046
10425
  controlType: 'button',
10047
10426
  classNameSuffix: 'date'
@@ -10054,7 +10433,7 @@
10054
10433
  var _proto = DatePickerControl.prototype;
10055
10434
  _proto._render = function _render() {
10056
10435
  var _this = this;
10057
- if (isMobile$1()) {
10436
+ if (distExports$3.isMobile()) {
10058
10437
  var _this_locale;
10059
10438
  this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
10060
10439
  } else {
@@ -10068,7 +10447,7 @@
10068
10447
  language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
10069
10448
  current: new Date(this._value + ' 00:00:00'),
10070
10449
  maxDate: this.options.maxDate || new Date(),
10071
- place: isMobile$1() ? 'bottom-left' : 'top-right',
10450
+ place: distExports$3.isMobile() ? 'bottom-left' : 'top-right',
10072
10451
  onChange: function(date) {
10073
10452
  if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
10074
10453
  _this._value = DateTime.formate(date, 'YYYY-MM-DD');
@@ -10126,965 +10505,1003 @@
10126
10505
  return DatePickerControl;
10127
10506
  }(Control);
10128
10507
 
10508
+ var dist$1 = {exports: {}};
10509
+
10129
10510
  /**
10130
10511
  * drag scroll support move and touch
10131
10512
  *
10132
- * @skax/drag-scroll v1.0.0
10133
- * Copyright (c) 2025-11-03 ShineShao <xiaoshaoqq@gmail.com>
10513
+ * @skax/drag-scroll v1.1.0
10514
+ * Copyright (c) 2025-11-08 ShineShao <xiaoshaoqq@gmail.com>
10134
10515
  *
10135
10516
  * This source code is licensed under the MIT license found in the
10136
10517
  * LICENSE file in the root directory of this source tree.
10137
10518
  */
10138
- /**
10139
- * 拖拽滚动状态
10140
- */ /**
10141
- * 默认参数
10142
- */ const _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
10143
- content: '',
10144
- height: '400px',
10145
- readonly: false,
10146
- hideScrollbar: false
10147
- };
10148
- /**
10149
- * 前缀类名
10150
- */ const _$DRAG_SCROLL_PREFIX_CLASSNAME$_ = 'drag-scroll';
10151
- /**
10152
- * 拖拽滚动(使用 PointerEvent 统一处理鼠标和触摸事件)
10153
- * @class DragScroll
10154
- * @example
10155
- * ```ts
10156
- * const container = document.getElementById('scrollContainer');
10157
- * const dragScroll = new DragScroll(container, {
10158
- * width: '300px',
10159
- * height: '500px',
10160
- * content: '<div>...</div>',
10161
- * });
10162
- * ```
10163
- */ class DragScroll {
10164
- /**
10165
- * 获取容器宽度
10166
- * @example
10167
- * ```ts
10168
- * const width = dragScroll.width;
10169
- * ```
10170
- * @return {number}
10171
- */ get width() {
10172
- return this.$container.clientWidth;
10173
- }
10174
- /**
10175
- * 获取容器高度
10176
- * @example
10177
- * ```ts
10178
- * const height = dragScroll.height;
10179
- * ```
10180
- * @return {number}
10181
- */ get height() {
10182
- return this.$container.clientHeight;
10183
- }
10184
- /**
10185
- * 只读属性
10186
- */ get readonly() {
10187
- return this._readonly;
10188
- }
10189
- set readonly(value) {
10190
- if (this._readonly !== value) {
10191
- this.$container.style.cursor = value ? 'not-allowed' : 'grab';
10192
- this._readonly = value;
10193
- }
10194
- this.$container.removeEventListener('touchmove', this._onTouchMove);
10195
- if (!value) {
10196
- // 当非只读时,添加 touchmove 事件监听, 阻止透传到body默认滚动行为
10197
- this.$container.addEventListener('touchmove', this._onTouchMove, {
10198
- passive: false
10199
- }); //
10200
- }
10201
- }
10202
- /**
10203
- * 内容是否可滚动
10204
- */ get canDrag() {
10205
- const clientHeight = this.$content.clientHeight;
10206
- return !this.readonly && clientHeight > this.$container.clientHeight;
10207
- }
10208
- /**
10209
- * 设置容器尺寸
10210
- * @param width 容器宽度
10211
- * @param height 容器高度
10212
- * @example
10213
- * ```ts
10214
- * dragScroll.resize(500, '400px');
10215
- * dragScroll.resize('80%', '600px');
10216
- * ```
10217
- */ resize(width, height) {
10218
- let css = ``;
10219
- if (/^\d+(\.\d+)?$/.test(width + '')) {
10220
- css = `width: ${width}px;`;
10221
- } else if (typeof width === 'string') {
10222
- css = `width: ${width};`;
10223
- }
10224
- if (/^\d+(\.\d+)?$/.test(height + '')) {
10225
- css += `height: ${height}px;`;
10226
- } else if (typeof height === 'string') {
10227
- css += `height: ${height};`;
10228
- }
10229
- this.$container.style.cssText += css;
10230
- this._applyTransform();
10231
- }
10232
- /**
10233
- * 设置 HTML 内容
10234
- * @param html HTML 字符串或返回 HTML 字符串的函数
10235
- * @example
10236
- * ```ts
10237
- * dragScroll.innerHtml('<div>New Content</div>');
10238
- * dragScroll.innerHtml(() => '<div>Dynamic Content</div>');
10239
- * ```
10240
- */ innerHtml(html) {
10241
- this.$content.innerHTML = typeof html === 'function' ? html() : html;
10242
- this._applyTransform();
10243
- }
10244
- /**
10245
- * Y轴滚动到指定位置
10246
- * @param y Y轴平移值 (需正值不支持负值)
10247
- * @example
10248
- * ```ts
10249
- * dragScroll.scrollToY(200);
10250
- * dragScroll.scrollToY(0); // 平移到顶部
10251
- * dragScroll.scrollToY(-2); // 无效
10252
- * ```
10253
- */ scrollToY(y, triggerChange = true) {
10254
- const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10255
- // 边界检查
10256
- if (y < 0 || y > maxScroll) return;
10257
- this.currentY = y;
10258
- this.velocity = 0;
10259
- this._applyTransform();
10260
- if (triggerChange) this._updateState();
10261
- }
10262
- /**
10263
- * 销毁方法,用于清理资源
10264
- * @example
10265
- * ```ts
10266
- * dragScroll.destroy();
10267
- * dragScroll = null;
10268
- * ```
10269
- */ destroy() {
10270
- var _this__$scrollbarThumb, _this__$scrollbar, _this_$content;
10271
- if (this._animationId) {
10272
- cancelAnimationFrame(this._animationId);
10273
- this._animationId = null;
10274
- }
10275
- if (this._indicatorTimeout) {
10276
- clearTimeout(this._indicatorTimeout);
10277
- this._indicatorTimeout = null;
10278
- }
10279
- (_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
10280
- this._$scrollbarThumb = null;
10281
- (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
10282
- this._$scrollbar = null;
10283
- (_this_$content = this.$content) == null ? void 0 : _this_$content.remove();
10284
- this.$content = null;
10285
- this._removeEventListeners();
10286
- }
10287
- // ---------------------------------------------------------------------- //
10288
- // 私有方法
10289
- // ---------------------------------------------------------------------- //
10290
- _renderScrollbar() {
10291
- this._$scrollbar = document.createElement('div');
10292
- this._$scrollbar.className = `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-scrollbar`;
10293
- this._$scrollbarThumb = document.createElement('div');
10294
- this._$scrollbarThumb.className = `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-scrollbar-thumb`;
10295
- this._$scrollbar.appendChild(this._$scrollbarThumb);
10296
- this.$container.appendChild(this._$scrollbar);
10297
- }
10298
- // 初始化
10299
- _init() {
10300
- this.resize(this.options.width, this.options.height);
10301
- this._addEventListeners();
10302
- // 初始化滚动条
10303
- this._updateScrollbar();
10304
- // 初始化动画
10305
- this._animate();
10306
- }
10307
- // ----------- 事件处理 ----------- //
10308
- /**
10309
- * 添加事件监听器
10310
- */ _addEventListeners() {
10311
- // 添加事件监听器
10312
- this.$container.addEventListener('pointerdown', this._onMouseDown);
10313
- document.addEventListener('pointermove', this._onMouseMove);
10314
- // 务必同时监听 pointerup 和 pointercancel,都要做收尾和状态清理,否则会出现“拖动卡死”问题
10315
- document.addEventListener('pointerup', this._onMouseUp); // 指针正常抬起时
10316
- document.addEventListener('pointercancel', this._onMouseUp); // 指针操作被系统/外部原因打断时
10317
- }
10318
- /**
10319
- * 移除事件监听器
10320
- */ _removeEventListeners() {
10321
- this.$container.removeEventListener('touchmove', this._onTouchMove);
10322
- // 移除事件监听器
10323
- this.$container.removeEventListener('pointerdown', this._onMouseDown);
10324
- document.removeEventListener('pointermove', this._onMouseMove);
10325
- document.removeEventListener('pointerup', this._onMouseUp);
10326
- document.removeEventListener('pointercancel', this._onMouseUp);
10327
- }
10328
- /**
10329
- * 鼠标按下
10330
- * @param e 鼠标事件
10331
- */ _onMouseDown(e) {
10332
- if (!this.canDrag) return;
10333
- this._startDrag(e.clientY);
10334
- this.options.onDragStart == null ? void 0 : this.options.onDragStart.call(this.options, e);
10335
- }
10336
- /**
10337
- * 触摸移动
10338
- * @param e 触摸移动事件
10339
- */ _onTouchMove(e) {
10340
- e.preventDefault();
10341
- }
10342
- /**
10343
- * 开始拖拽
10344
- * @param clientY 鼠标或触摸的 Y 坐标
10345
- */ _startDrag(clientY) {
10346
- var _this__$scrollbar_classList, _this__$scrollbar;
10347
- if (!this.canDrag) return;
10348
- this.isDragging = true;
10349
- this._startY = clientY;
10350
- this.velocity = 0;
10351
- (_this__$scrollbar = this._$scrollbar) == null ? void 0 : (_this__$scrollbar_classList = _this__$scrollbar.classList) == null ? void 0 : _this__$scrollbar_classList.add(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-show`);
10352
- // 更新光标样式
10353
- this.$container.style.cursor = 'grabbing';
10354
- }
10355
- /**
10356
- * 鼠标移动
10357
- * @param e 鼠标事件
10358
- */ _onMouseMove(e) {
10359
- // e.preventDefault();
10360
- if (!this.canDrag) return;
10361
- if (!this.isDragging) return;
10362
- this._drag(e.clientY);
10363
- this.options.onDragging == null ? void 0 : this.options.onDragging.call(this.options, 0, this.currentY);
10364
- }
10365
- /**
10366
- * 拖动
10367
- * @param clientY 鼠标或触摸的 Y 坐标
10368
- */ _drag(clientY) {
10369
- if (!this.canDrag) return;
10370
- const deltaY = this._startY - clientY;
10371
- this._startY = clientY;
10372
- // 更新位置
10373
- this.currentY += deltaY;
10374
- // 计算速度(用于惯性滚动)
10375
- this.velocity = deltaY;
10376
- // 限制速度
10377
- this.velocity = Math.max(Math.min(this.velocity, this._maxVelocity), -this._maxVelocity);
10378
- this._applyTransform();
10379
- this._updateState();
10380
- }
10381
- /**
10382
- * 鼠标释放
10383
- */ _onMouseUp(e) {
10384
- if (!this.canDrag) return;
10385
- if (!this.isDragging) return;
10386
- this.isDragging = false; // 停止拖动, 放置在最后
10387
- this._endDrag();
10388
- this.options.onDragEnd == null ? void 0 : this.options.onDragEnd.call(this.options, e);
10389
- }
10390
- /**
10391
- * 结束拖动
10392
- */ _endDrag() {
10393
- // 恢复光标样式
10394
- this.$container.style.cursor = 'grab';
10395
- // 延迟隐藏滚动条
10396
- setTimeout(()=>{
10397
- var _this__$scrollbar;
10398
- if (!this.isDragging) (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.classList.remove(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-show`);
10399
- }, 1500);
10400
- }
10401
- /**
10402
- * 平移内容
10403
- */ _applyTransform() {
10404
- const clientHeight = this.$content.clientHeight;
10405
- // 内容高度小于等于容器高度时,不进行滚动
10406
- if (clientHeight <= this.$container.clientHeight) {
10407
- this.$content.style.transform = `translate3d(0, 0, 0)`;
10408
- return;
10409
- }
10410
- const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10411
- // 边界检查与弹性效果
10412
- if (this.currentY < 0) {
10413
- // 超出顶部边界
10414
- this.currentY = 0; // this.currentY * this._bounceDamping;
10415
- this.velocity *= this._bounceDamping;
10416
- } else if (this.currentY > maxScroll) {
10417
- // 超出底部边界
10418
- this.currentY = maxScroll; // maxScroll + (this.currentY - maxScroll) * this._bounceDamping;
10419
- this.velocity *= this._bounceDamping;
10420
- }
10421
- // 应用 transform
10422
- this.$content.style.transform = `translate3d(0, ${-this.currentY}px, 0)`;
10423
- this._updateScrollbar();
10424
- }
10425
- /**
10426
- * 动画
10427
- * @param timestamp 时间戳
10428
- */ _animate(timestamp = 0) {
10429
- const clientHeight = this.$content.clientHeight;
10430
- // 内容高度小于等于容器高度时,不进行滚动
10431
- if (clientHeight <= this.$container.clientHeight) {
10432
- return;
10433
- }
10434
- if (!this._lastTimestamp) this._lastTimestamp = timestamp;
10435
- const deltaTime = Math.min(timestamp - this._lastTimestamp, 100) / 16; // 限制最大时间增量
10436
- this._lastTimestamp = timestamp;
10437
- if (!this.isDragging) {
10438
- // 惯性滚动
10439
- this.velocity *= this._friction;
10440
- this.currentY += this.velocity;
10441
- // 弹性回弹
10442
- const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10443
- if (this.currentY < 0) {
10444
- // 顶部弹性
10445
- this.velocity -= this.currentY * this._spring * deltaTime;
10446
- } else if (this.currentY > maxScroll) {
10447
- // 底部弹性
10448
- this.velocity -= (this.currentY - maxScroll) * this._spring * deltaTime;
10449
- }
10450
- this._applyTransform();
10451
- this._updateState();
10452
- // 当速度足够小时停止动画
10453
- if (Math.abs(this.velocity) < 0.1 && this.currentY >= 0 && this.currentY <= maxScroll) {
10454
- this.velocity = 0;
10455
- }
10456
- }
10457
- this._animationId = requestAnimationFrame(this._animate.bind(this));
10458
- }
10459
- /**
10460
- * 更新滚动条
10461
- */ _updateScrollbar() {
10462
- const containerHeight = this.$container.clientHeight;
10463
- const contentHeight = this.$content.scrollHeight;
10464
- const maxScroll = contentHeight - containerHeight;
10465
- if (maxScroll <= 0) {
10466
- if (this._$scrollbarThumb) this._$scrollbarThumb.style.height = '0';
10467
- return;
10468
- }
10469
- // 计算滚动条高度和位置
10470
- const thumbHeight = Math.max(containerHeight / contentHeight * containerHeight, 20);
10471
- const thumbPosition = this.currentY / maxScroll * (containerHeight - thumbHeight);
10472
- if (this._$scrollbarThumb) {
10473
- this._$scrollbarThumb.style.height = `${thumbHeight}px`;
10474
- this._$scrollbarThumb.style.transform = `translateY(${thumbPosition}px)`;
10475
- }
10476
- }
10477
- /**
10478
- * 更新统计信息
10479
- */ _updateState() {
10480
- this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, {
10481
- x: 0,
10482
- y: this.currentY,
10483
- velocity: +this.velocity.toFixed(1)
10484
- });
10485
- }
10486
- constructor(container, options = {}){
10487
- this._indicatorTimeout = null;
10488
- /** 滚动条元素 */ this._$scrollbar = null;
10489
- /** 滚动条指示器元素 */ this._$scrollbarThumb = null;
10490
- /** 是否只读 */ this._readonly = false;
10491
- this.$container = container;
10492
- this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
10493
- this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-container`);
10494
- this.$content = document.createElement('div');
10495
- this.$content.classList.add(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-content`);
10496
- this.innerHtml(this.options.content);
10497
- this.$container.appendChild(this.$content);
10498
- this.isDragging = false;
10499
- this._startY = 0;
10500
- this.currentY = 0;
10501
- this.velocity = 0;
10502
- this._animationId = null;
10503
- this._lastTimestamp = 0;
10504
- // 物理参数
10505
- this._spring = 0.25; // 弹性系数
10506
- this._friction = 0.92; // 摩擦力
10507
- this._bounceDamping = 0.6; // 边界反弹阻尼
10508
- this._maxVelocity = 30; // 最大速度限制
10509
- if (!this.options.hideScrollbar) {
10510
- this._renderScrollbar();
10511
- }
10512
- this._onMouseDown = this._onMouseDown.bind(this);
10513
- this._onTouchMove = this._onTouchMove.bind(this);
10514
- this._onMouseMove = this._onMouseMove.bind(this);
10515
- this._onMouseUp = this._onMouseUp.bind(this);
10516
- this.readonly = this.options.readonly;
10517
- this._init();
10518
- }
10519
+
10520
+ var dist;
10521
+ var hasRequiredDist$1;
10522
+
10523
+ function requireDist$1 () {
10524
+ if (hasRequiredDist$1) return dist;
10525
+ hasRequiredDist$1 = 1;
10526
+
10527
+ /**
10528
+ * 拖拽滚动状态
10529
+ */ function _defineProperties(target, props) {
10530
+ for(var i = 0; i < props.length; i++){
10531
+ var descriptor = props[i];
10532
+ descriptor.enumerable = descriptor.enumerable || false;
10533
+ descriptor.configurable = true;
10534
+ if ("value" in descriptor) descriptor.writable = true;
10535
+ Object.defineProperty(target, descriptor.key, descriptor);
10536
+ }
10537
+ }
10538
+ function _create_class(Constructor, protoProps, staticProps) {
10539
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10540
+ return Constructor;
10541
+ }
10542
+ /**
10543
+ * 默认参数
10544
+ */ var _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
10545
+ content: '',
10546
+ height: '400px',
10547
+ readonly: false,
10548
+ hideScrollbar: false
10549
+ };
10550
+ /**
10551
+ * 前缀类名
10552
+ */ var _$DRAG_SCROLL_PREFIX_CLASSNAME$_ = 'drag-scroll';
10553
+ /**
10554
+ * 拖拽滚动(使用 PointerEvent 统一处理鼠标和触摸事件)
10555
+ * @class DragScroll
10556
+ * @example
10557
+ * ```ts
10558
+ * const container = document.getElementById('scrollContainer');
10559
+ * const dragScroll = new DragScroll(container, {
10560
+ * width: '300px',
10561
+ * height: '500px',
10562
+ * content: '<div>...</div>',
10563
+ * });
10564
+ * ```
10565
+ */ var DragScroll = /*#__PURE__*/ function() {
10566
+ function DragScroll(container, options) {
10567
+ if (options === void 0) options = {};
10568
+ this._indicatorTimeout = null;
10569
+ /** 滚动条元素 */ this._$scrollbar = null;
10570
+ /** 滚动条指示器元素 */ this._$scrollbarThumb = null;
10571
+ /** 是否只读 */ this._readonly = false;
10572
+ this.$container = container;
10573
+ this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
10574
+ this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-container");
10575
+ this.$content = document.createElement('div');
10576
+ this.$content.classList.add("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-content");
10577
+ this.innerHtml(this.options.content);
10578
+ this.$container.appendChild(this.$content);
10579
+ this.isDragging = false;
10580
+ this._startY = 0;
10581
+ this.currentY = 0;
10582
+ this.velocity = 0;
10583
+ this._animationId = null;
10584
+ this._lastTimestamp = 0;
10585
+ // 物理参数
10586
+ this._spring = 0.25; // 弹性系数
10587
+ this._friction = 0.92; // 摩擦力
10588
+ this._bounceDamping = 0.6; // 边界反弹阻尼
10589
+ this._maxVelocity = 30; // 最大速度限制
10590
+ if (!this.options.hideScrollbar) {
10591
+ this._renderScrollbar();
10592
+ }
10593
+ this._onMouseDown = this._onMouseDown.bind(this);
10594
+ this._onTouchMove = this._onTouchMove.bind(this);
10595
+ this._onMouseMove = this._onMouseMove.bind(this);
10596
+ this._onMouseUp = this._onMouseUp.bind(this);
10597
+ this.readonly = this.options.readonly;
10598
+ this._init();
10599
+ }
10600
+ var _proto = DragScroll.prototype;
10601
+ /**
10602
+ * 设置容器尺寸
10603
+ * @param width 容器宽度
10604
+ * @param height 容器高度
10605
+ * @example
10606
+ * ```ts
10607
+ * dragScroll.resize(500, '400px');
10608
+ * dragScroll.resize('80%', '600px');
10609
+ * ```
10610
+ */ _proto.resize = function resize(width, height) {
10611
+ var css = "";
10612
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
10613
+ css = "width: " + width + "px;";
10614
+ } else if (typeof width === 'string') {
10615
+ css = "width: " + width + ";";
10616
+ }
10617
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
10618
+ css += "height: " + height + "px;";
10619
+ } else if (typeof height === 'string') {
10620
+ css += "height: " + height + ";";
10621
+ }
10622
+ this.$container.style.cssText += css;
10623
+ this._applyTransform();
10624
+ };
10625
+ /**
10626
+ * 设置 HTML 内容
10627
+ * @param html HTML 字符串或返回 HTML 字符串的函数
10628
+ * @example
10629
+ * ```ts
10630
+ * dragScroll.innerHtml('<div>New Content</div>');
10631
+ * dragScroll.innerHtml(() => '<div>Dynamic Content</div>');
10632
+ * ```
10633
+ */ _proto.innerHtml = function innerHtml(html) {
10634
+ this.$content.innerHTML = typeof html === 'function' ? html() : html;
10635
+ this._applyTransform();
10636
+ };
10637
+ /**
10638
+ * Y轴滚动到指定位置
10639
+ * @param y Y轴平移值 (需正值不支持负值)
10640
+ * @example
10641
+ * ```ts
10642
+ * dragScroll.scrollToY(200);
10643
+ * dragScroll.scrollToY(0); // 平移到顶部
10644
+ * dragScroll.scrollToY(-2); // 无效
10645
+ * ```
10646
+ */ _proto.scrollToY = function scrollToY(y, triggerChange) {
10647
+ if (triggerChange === void 0) triggerChange = true;
10648
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10649
+ // 边界检查
10650
+ if (y < 0 || y > maxScroll) return;
10651
+ this.currentY = y;
10652
+ this.velocity = 0;
10653
+ this._applyTransform();
10654
+ if (triggerChange) this._updateState();
10655
+ };
10656
+ /**
10657
+ * 销毁方法,用于清理资源
10658
+ * @example
10659
+ * ```ts
10660
+ * dragScroll.destroy();
10661
+ * dragScroll = null;
10662
+ * ```
10663
+ */ _proto.destroy = function destroy() {
10664
+ var _this__$scrollbarThumb, _this__$scrollbar, _this_$content;
10665
+ if (this._animationId) {
10666
+ cancelAnimationFrame(this._animationId);
10667
+ this._animationId = null;
10668
+ }
10669
+ if (this._indicatorTimeout) {
10670
+ clearTimeout(this._indicatorTimeout);
10671
+ this._indicatorTimeout = null;
10672
+ }
10673
+ (_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
10674
+ this._$scrollbarThumb = null;
10675
+ (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
10676
+ this._$scrollbar = null;
10677
+ (_this_$content = this.$content) == null ? void 0 : _this_$content.remove();
10678
+ this.$content = null;
10679
+ this._removeEventListeners();
10680
+ };
10681
+ // ---------------------------------------------------------------------- //
10682
+ // 私有方法
10683
+ // ---------------------------------------------------------------------- //
10684
+ _proto._renderScrollbar = function _renderScrollbar() {
10685
+ this._$scrollbar = document.createElement('div');
10686
+ this._$scrollbar.className = "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-scrollbar";
10687
+ this._$scrollbarThumb = document.createElement('div');
10688
+ this._$scrollbarThumb.className = "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-scrollbar-thumb";
10689
+ this._$scrollbar.appendChild(this._$scrollbarThumb);
10690
+ this.$container.appendChild(this._$scrollbar);
10691
+ };
10692
+ // 初始化
10693
+ _proto._init = function _init() {
10694
+ this.resize(this.options.width, this.options.height);
10695
+ this._addEventListeners();
10696
+ // 初始化滚动条
10697
+ this._updateScrollbar();
10698
+ // 初始化动画
10699
+ this._animate();
10700
+ };
10701
+ // ----------- 事件处理 ----------- //
10702
+ /**
10703
+ * 添加事件监听器
10704
+ */ _proto._addEventListeners = function _addEventListeners() {
10705
+ // 添加事件监听器
10706
+ this.$container.addEventListener('pointerdown', this._onMouseDown);
10707
+ document.addEventListener('pointermove', this._onMouseMove);
10708
+ // 务必同时监听 pointerup 和 pointercancel,都要做收尾和状态清理,否则会出现“拖动卡死”问题
10709
+ document.addEventListener('pointerup', this._onMouseUp); // 指针正常抬起时
10710
+ document.addEventListener('pointercancel', this._onMouseUp); // 指针操作被系统/外部原因打断时
10711
+ };
10712
+ /**
10713
+ * 移除事件监听器
10714
+ */ _proto._removeEventListeners = function _removeEventListeners() {
10715
+ this.$container.removeEventListener('touchmove', this._onTouchMove);
10716
+ // 移除事件监听器
10717
+ this.$container.removeEventListener('pointerdown', this._onMouseDown);
10718
+ document.removeEventListener('pointermove', this._onMouseMove);
10719
+ document.removeEventListener('pointerup', this._onMouseUp);
10720
+ document.removeEventListener('pointercancel', this._onMouseUp);
10721
+ };
10722
+ /**
10723
+ * 鼠标按下
10724
+ * @param e 鼠标事件
10725
+ */ _proto._onMouseDown = function _onMouseDown(e) {
10726
+ if (!this.canDrag) return;
10727
+ this._startDrag(e.clientY);
10728
+ this.options.onDragStart == null ? void 0 : this.options.onDragStart.call(this.options, e);
10729
+ };
10730
+ /**
10731
+ * 触摸移动
10732
+ * @param e 触摸移动事件
10733
+ */ _proto._onTouchMove = function _onTouchMove(e) {
10734
+ e.preventDefault();
10735
+ };
10736
+ /**
10737
+ * 开始拖拽
10738
+ * @param clientY 鼠标或触摸的 Y 坐标
10739
+ */ _proto._startDrag = function _startDrag(clientY) {
10740
+ var _this__$scrollbar_classList, _this__$scrollbar;
10741
+ if (!this.canDrag) return;
10742
+ this.isDragging = true;
10743
+ this._startY = clientY;
10744
+ this.velocity = 0;
10745
+ (_this__$scrollbar = this._$scrollbar) == null ? void 0 : (_this__$scrollbar_classList = _this__$scrollbar.classList) == null ? void 0 : _this__$scrollbar_classList.add("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-show");
10746
+ // 更新光标样式
10747
+ this.$container.style.cursor = 'grabbing';
10748
+ };
10749
+ /**
10750
+ * 鼠标移动
10751
+ * @param e 鼠标事件
10752
+ */ _proto._onMouseMove = function _onMouseMove(e) {
10753
+ // e.preventDefault();
10754
+ if (!this.canDrag) return;
10755
+ if (!this.isDragging) return;
10756
+ this._drag(e.clientY);
10757
+ this.options.onDragging == null ? void 0 : this.options.onDragging.call(this.options, 0, this.currentY);
10758
+ };
10759
+ /**
10760
+ * 拖动
10761
+ * @param clientY 鼠标或触摸的 Y 坐标
10762
+ */ _proto._drag = function _drag(clientY) {
10763
+ if (!this.canDrag) return;
10764
+ var deltaY = this._startY - clientY;
10765
+ this._startY = clientY;
10766
+ // 更新位置
10767
+ this.currentY += deltaY;
10768
+ // 计算速度(用于惯性滚动)
10769
+ this.velocity = deltaY;
10770
+ // 限制速度
10771
+ this.velocity = Math.max(Math.min(this.velocity, this._maxVelocity), -this._maxVelocity);
10772
+ this._applyTransform();
10773
+ this._updateState();
10774
+ };
10775
+ /**
10776
+ * 鼠标释放
10777
+ */ _proto._onMouseUp = function _onMouseUp(e) {
10778
+ if (!this.canDrag) return;
10779
+ if (!this.isDragging) return;
10780
+ this.isDragging = false; // 停止拖动, 放置在最后
10781
+ this._endDrag();
10782
+ this.options.onDragEnd == null ? void 0 : this.options.onDragEnd.call(this.options, e);
10783
+ };
10784
+ /**
10785
+ * 结束拖动
10786
+ */ _proto._endDrag = function _endDrag() {
10787
+ var _this = this;
10788
+ // 恢复光标样式
10789
+ this.$container.style.cursor = 'grab';
10790
+ // 延迟隐藏滚动条
10791
+ setTimeout(function() {
10792
+ var _this__$scrollbar;
10793
+ if (!_this.isDragging) (_this__$scrollbar = _this._$scrollbar) == null ? void 0 : _this__$scrollbar.classList.remove("" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-show");
10794
+ }, 1500);
10795
+ };
10796
+ /**
10797
+ * 平移内容
10798
+ */ _proto._applyTransform = function _applyTransform() {
10799
+ var clientHeight = this.$content.clientHeight;
10800
+ // 内容高度小于等于容器高度时,不进行滚动
10801
+ if (clientHeight <= this.$container.clientHeight) {
10802
+ this.$content.style.transform = "translate3d(0, 0, 0)";
10803
+ return;
10804
+ }
10805
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10806
+ // 边界检查与弹性效果
10807
+ if (this.currentY < 0) {
10808
+ // 超出顶部边界
10809
+ this.currentY = 0; // this.currentY * this._bounceDamping;
10810
+ this.velocity *= this._bounceDamping;
10811
+ } else if (this.currentY > maxScroll) {
10812
+ // 超出底部边界
10813
+ this.currentY = maxScroll; // maxScroll + (this.currentY - maxScroll) * this._bounceDamping;
10814
+ this.velocity *= this._bounceDamping;
10815
+ }
10816
+ // 应用 transform
10817
+ this.$content.style.transform = "translate3d(0, " + -this.currentY + "px, 0)";
10818
+ this._updateScrollbar();
10819
+ };
10820
+ /**
10821
+ * 动画
10822
+ * @param timestamp 时间戳
10823
+ */ _proto._animate = function _animate(timestamp) {
10824
+ if (timestamp === void 0) timestamp = 0;
10825
+ var clientHeight = this.$content.clientHeight;
10826
+ // 内容高度小于等于容器高度时,不进行滚动
10827
+ if (clientHeight <= this.$container.clientHeight) {
10828
+ return;
10829
+ }
10830
+ if (!this._lastTimestamp) this._lastTimestamp = timestamp;
10831
+ var deltaTime = Math.min(timestamp - this._lastTimestamp, 100) / 16; // 限制最大时间增量
10832
+ this._lastTimestamp = timestamp;
10833
+ if (!this.isDragging) {
10834
+ // 惯性滚动
10835
+ this.velocity *= this._friction;
10836
+ this.currentY += this.velocity;
10837
+ // 弹性回弹
10838
+ var maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
10839
+ if (this.currentY < 0) {
10840
+ // 顶部弹性
10841
+ this.velocity -= this.currentY * this._spring * deltaTime;
10842
+ } else if (this.currentY > maxScroll) {
10843
+ // 底部弹性
10844
+ this.velocity -= (this.currentY - maxScroll) * this._spring * deltaTime;
10845
+ }
10846
+ this._applyTransform();
10847
+ this._updateState();
10848
+ // 当速度足够小时停止动画
10849
+ if (Math.abs(this.velocity) < 0.1 && this.currentY >= 0 && this.currentY <= maxScroll) {
10850
+ this.velocity = 0;
10851
+ }
10852
+ }
10853
+ this._animationId = requestAnimationFrame(this._animate.bind(this));
10854
+ };
10855
+ /**
10856
+ * 更新滚动条
10857
+ */ _proto._updateScrollbar = function _updateScrollbar() {
10858
+ var containerHeight = this.$container.clientHeight;
10859
+ var contentHeight = this.$content.scrollHeight;
10860
+ var maxScroll = contentHeight - containerHeight;
10861
+ if (maxScroll <= 0) {
10862
+ if (this._$scrollbarThumb) this._$scrollbarThumb.style.height = '0';
10863
+ return;
10864
+ }
10865
+ // 计算滚动条高度和位置
10866
+ var thumbHeight = Math.max(containerHeight / contentHeight * containerHeight, 20);
10867
+ var thumbPosition = this.currentY / maxScroll * (containerHeight - thumbHeight);
10868
+ if (this._$scrollbarThumb) {
10869
+ this._$scrollbarThumb.style.height = "" + thumbHeight + "px";
10870
+ this._$scrollbarThumb.style.transform = "translateY(" + thumbPosition + "px)";
10871
+ }
10872
+ };
10873
+ /**
10874
+ * 更新统计信息
10875
+ */ _proto._updateState = function _updateState() {
10876
+ this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, {
10877
+ x: 0,
10878
+ y: this.currentY,
10879
+ velocity: +this.velocity.toFixed(1)
10880
+ });
10881
+ };
10882
+ _create_class(DragScroll, [
10883
+ {
10884
+ key: "width",
10885
+ get: /**
10886
+ * 获取容器宽度
10887
+ * @example
10888
+ * ```ts
10889
+ * const width = dragScroll.width;
10890
+ * ```
10891
+ * @return {number}
10892
+ */ function get() {
10893
+ return this.$container.clientWidth;
10894
+ }
10895
+ },
10896
+ {
10897
+ key: "height",
10898
+ get: /**
10899
+ * 获取容器高度
10900
+ * @example
10901
+ * ```ts
10902
+ * const height = dragScroll.height;
10903
+ * ```
10904
+ * @return {number}
10905
+ */ function get() {
10906
+ return this.$container.clientHeight;
10907
+ }
10908
+ },
10909
+ {
10910
+ key: "readonly",
10911
+ get: /**
10912
+ * 只读属性
10913
+ */ function get() {
10914
+ return this._readonly;
10915
+ },
10916
+ set: function set(value) {
10917
+ if (this._readonly !== value) {
10918
+ this.$container.style.cursor = value ? 'not-allowed' : 'grab';
10919
+ this._readonly = value;
10920
+ }
10921
+ this.$container.removeEventListener('touchmove', this._onTouchMove);
10922
+ if (!value) {
10923
+ // 当非只读时,添加 touchmove 事件监听, 阻止透传到body默认滚动行为
10924
+ this.$container.addEventListener('touchmove', this._onTouchMove, {
10925
+ passive: false
10926
+ }); //
10927
+ }
10928
+ }
10929
+ },
10930
+ {
10931
+ key: "canDrag",
10932
+ get: /**
10933
+ * 内容是否可滚动
10934
+ */ function get() {
10935
+ var clientHeight = this.$content.clientHeight;
10936
+ return !this.readonly && clientHeight > this.$container.clientHeight;
10937
+ }
10938
+ }
10939
+ ]);
10940
+ return DragScroll;
10941
+ }();
10942
+
10943
+ dist = DragScroll;
10944
+ return dist;
10519
10945
  }
10520
10946
 
10521
10947
  /*
10522
- * @ezuikit/control-time-line v1.0.0
10523
- * Copyright (c) 2025-11-03 Ezviz-OpenBiz
10948
+ * @ezuikit/control-time-line v1.0.1-beta.14
10949
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
10524
10950
  * Released under the MIT License.
10525
10951
  */
10526
- var _$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};const _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
10527
- // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
10528
- timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
10529
- onChange:()=>{},onDragStart:()=>{},onDragging:()=>{},onDragEnd:()=>{},onDestroy:()=>{}};
10530
- /**
10531
- * 时间轴基类
10532
- * @internal
10533
- */class BaseTimeLine{
10534
- /**
10535
- * 当前时间
10536
- */
10537
- get current(){return this._current}
10538
- /**
10539
- * 当前时间
10540
- */set current(current){this._current=current;}set readOnly(readOnly){if(this._readOnly!==readOnly){this._readOnly=readOnly;this.$container.style.cursor=readOnly?"not-allowed":"pointer";}}
10541
- /**
10542
- * 只读状态
10543
- */get readOnly(){return this._readOnly}
10544
- /**
10545
- * 时间片段
10546
- */get timeSections(){return this._timeSections}
10547
- /**
10548
- * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
10549
- * @param readOnly - 只读或取消只读
10550
- * @returns
10551
- */setReadOnly(readOnly){this.readOnly=readOnly;}
10552
- /**
10553
- * 更新当前时间
10554
- * @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10555
- */update(current){this._current=current;}
10556
- /**
10557
- * 更新时间片段
10558
- * @param timeSections 片段数据
10559
- */updateTimeSections(timeSections){if(timeSections&&Array.isArray(timeSections))this._timeSections=timeSections;}
10560
- /**
10561
- * 获取 TimeLine 的宽度
10562
- * @returns
10563
- */get width(){return this._width}
10564
- /**
10565
- * 获取 TimeLine 的高度
10566
- */get height(){return this._height}
10567
- /**
10568
- * 重置尺寸
10569
- */resize(width,height){this._resize(width,height);}_resize(width,height){let cssText="";if(/\d/.test(width+""))cssText+=`width: ${width}px;`;else if(width)cssText+=`width: ${width};`;if(/\d/.test(height+""))cssText+=`height: ${height}px;`;else if(height)cssText+=`height: ${height};`;if(this.$container)this.$container.style.cssText+=cssText;this._width=Math.floor(this.$container.clientWidth);this._height=Math.floor(this.$container.clientHeight);}get timeWidth(){return this._timeWidth}
10570
- /**
10571
- * 改变时间轴刻度
10572
- * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
10573
- * PC间距:
10574
- * @param timeWidth 时间轴刻度
10575
- */setTimeWidth(timeWidth){if([0,1,2,3,4,5].includes(timeWidth))this._timeWidth=timeWidth;}
10576
- /**
10577
- * 销毁
10578
- */destroy(){
10579
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10580
- this._current=null;this.options.onDestroy==null?void 0:this.options.onDestroy.call(this.options);this._timeSections=[];this._readOnly=false;this._destroyed=true;}constructor(container,options){this._current=new Date;
10581
- /** 只读 */this._readOnly=false;this._width=0;this._height=0;this._destroyed=false;this._timeWidth=0;
10582
- /** 片段列表 */this._timeSections=[];this.$container=container;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false});if(this.options.timeSections&&Array.isArray(this.options.timeSections))this._timeSections=this.options.timeSections;if(this.options.readOnly)this.readOnly=this.options.readOnly;if(this.options.className)this.$container.classList.add(this.options.className);if(this.options.current&&this.options.current instanceof Date)this._current=this.options.current||new Date;
10583
- // prettier-ignore
10584
- this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"});this._timeWidth=this.options.timeWidth||0;this._resize(this.options.width||"100%",this.options.height);}}
10585
- /** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;
10586
- /**
10587
- * 时间轴工具类
10588
- */class TimeLineUtil{
10589
- /**
10590
- * 时间转成日期
10591
- * @param time 时间 (秒, 毫秒, 日期字符串, Date)
10592
- * @returns 日期
10593
- */
10594
- static toDate(time){let date=null;if(typeof time==="string"&&time.includes(":"))date=new Date(time);else if((typeof time==="string"||typeof time==="number")&&/\d/.test(time+"")&&(time+"").length===10)date=new Date(+time*1e3);else if((typeof time==="string"||typeof time==="number")&&/\d/.test(time+"")&&(time+"").length===13)date=new Date(+time);else if(time instanceof Date)date=time;return date}
10595
- /**
10596
- * 时间转成 HH:mm:ss
10597
- * @param time 时间
10598
- * @returns
10599
- */static formatDateToHHmmss(time){const date=TimeLineUtil.toDate(time);if(date){const h=date.getHours();// 返回日期中的小时数(0到23)
10600
- const m=date.getMinutes();// 返回日期中的分钟数(0到59)
10601
- const s=date.getSeconds();// 返回日期中的秒数(0到59)
10602
- return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"}
10603
- /**
10604
- * 十位补充 0
10605
- * @param m 数字
10606
- * @returns 十位补充 0后的结果字符串
10607
- */static subTime(m){return +m>9?m+"":"0"+m}
10608
- /**
10609
- * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
10610
- * @param time 时间
10611
- * @param fmt 时间格式
10612
- * @returns
10613
- */static tranTime(time,fmt="YYYY-MM-DD HH:mm:ss"){const newDate=TimeLineUtil.toDate(time);if(newDate){if(fmt==="YYYY-MM-DD")return newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate());else if(fmt==="HH:mm:ss")return TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds());else if(fmt==="HH")return TimeLineUtil.subTime(newDate.getHours());else if(fmt==="mm:ss")return TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds());else if(fmt==="HH:mm")return TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes());else if(fmt==="YYYYMMDDTHHmmssZ")return newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z";
10614
- // prettier-ignore
10615
- return newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds())}return ""}
10616
- /**
10617
- * 时间转成秒
10618
- * @param time
10619
- * @returns
10620
- */static timeToSecond(time){const e=time.split(":");const h=Number(e[0]);const m=Number(e[1]);const s=Number(e[2]);return h*60*60+m*60+(s||0)}
10621
- /**
10622
- * 分钟转成 HH:mm
10623
- * @param minute
10624
- * @returns
10625
- */static minuteToTime(minute){const hour=Math.floor(minute/60);const m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)}
10626
- /**
10627
- * 时间转成分钟
10628
- * @param time
10629
- * @returns
10630
- */static timeToMinute(time){const e=time.split(":");const h=Number(e[0]);const m=Number(e[1]);
10631
- // const s = Number(e[2]);
10632
- return h*60+m}
10633
- /**
10634
- * @description 判读两个区间是否重叠
10635
- * @param {number} a_start 一个区间的开始
10636
- * @param {number} a_end 一个区间的结束
10637
- * @param {number} b_start 另一个区间的开始
10638
- * @param {number} b_end 另一个区间的结束
10639
- * @returns {boolean}
10640
- */static isOverlap(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)}static tranTimeToString(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1;const secondNum=Math.floor(((_TimeLineUtil_toDate=TimeLineUtil.toDate(end))==null?void 0:_TimeLineUtil_toDate.getTime())-((_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))==null?void 0:_TimeLineUtil_toDate1.getTime()))/1e3;const second=secondNum%60;const minute=Math.floor(secondNum/60);return `${minute>0?TimeLineUtil.subTime(minute)+"'":"0'"}${TimeLineUtil.subTime(second)}''`}}
10641
- /**
10642
- * 时间轴图标集
10643
- */const _$TIMELINE_ICONS$_={tip:`<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>`,plus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,minus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,close:`\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n `,pause:`<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n `,picture:`\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n `};
10644
- /**
10645
- * 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 说明]
10646
- * 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0, 这样 0 点刻度才能正确显示
10647
- */
10648
- /**
10649
- * 时间刻度宽度, 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0
10650
- */const TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]];
10651
- /**
10652
- * 时间刻度宽度, 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0
10653
- * // * 0: 1分钟,
10654
- // * 1: 10分钟
10655
- // * 2: 半小时
10656
- // * 3: 1小时
10657
- // * 4: 2小时
10658
- // * 5: 4小时
10659
- */const MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];
10660
- /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable eqeqeq */ /* eslint-disable no-unneeded-ternary */ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/prefer-includes */function _extends$1$1(){_extends$1$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$1$1.apply(this,arguments)}
10661
- /**
10662
- * 时间轴样式类前缀
10663
- */const _$MOBILE_TIMELINE_PREFIX$_="ez-time-line";const _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
10664
- /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
10665
- /** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true});const _$DAY_TIME_SECOND$_=60*60*24;// 一天的秒数
10666
- class MobileTimeLine extends BaseTimeLine{
10667
- /**
10668
- * 设置只读或取消只读
10669
- * @param readOnly - 只读或取消只读
10670
- * @returns
10671
- */
10672
- setReadOnly(readOnly){super.setReadOnly(readOnly);if(this._dragScroll)this._dragScroll.readonly=readOnly;}
10673
- /**
10674
- * 改变时间轴刻度
10675
- * 0: 1分钟,
10676
- * 1: 10分钟
10677
- * 2: 半小时
10678
- * 3: 1小时
10679
- * 4: 2小时
10680
- * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
10681
- */setTimeWidth(timeWidth){if(MOBILE_TIME_WIDTH[timeWidth]){super.setTimeWidth(timeWidth);this._matchTimeDot();}else console.warn(`scale ${timeWidth} not exist!`);}
10682
- /**
10683
- * 获取真实时间刻度(时间单位 分钟)
10684
- */get _scaleWidth(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}
10685
- /**
10686
- * 更新片段数组
10687
- * @param timeSections
10688
- * @param defaultIndex
10689
- */updateTimeSections(timeSections,defaultIndex){super.updateTimeSections(timeSections);const list=timeSections.map(record=>_extends$1$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)}));if(list.length>0){if(typeof defaultIndex==="undefined")defaultIndex=list.length-1;// 默认选中最后一个片段位置
10690
- // 若current不为 null,则不重置current,避免拖动后时间轴回弹
10691
- const{current:current}=this.state;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:current===null?list[defaultIndex].startTime:current});this._matchTimeDot();}else {this._setState({availTimeLine:[]});this._matchTimeDot();}}
10692
- /**
10693
- * 更新当前时间
10694
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10695
- */update(time){var _this__dragScroll;if(time&&!((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.isDragging)){this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")});this._currentOffsetH();}}
10696
- /**
10697
- * 销毁
10698
- */destroy(){var _this__dragScroll;if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}if(this._$currentTime)try{this.$container.removeChild(this._$currentTime);this._$currentTime=null;}catch(error){}if(this._$itemList)this._imageRemoveErrorEvent(this._$itemList.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);if(this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList);this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer);this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op);this._$op=null;}catch(error){}if(this._picker){var _this__picker_$body_querySelectorAll,_this__picker_$body;this._imageRemoveErrorEvent(((_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)==null?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]);this._picker.destroy();this._picker=null;}this._removeEventListener();(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.destroy();this._dragScroll=null;super.destroy();}
10699
- /**
10700
- * 更新状态
10701
- * @param obj
10702
- */_setState(obj){
10703
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10704
- Object.keys(obj).forEach(key=>{if(key==="current"&&obj[key]){var _this__dragScroll;this._setCurrentDOM(obj[key]);if(this.state.current!==obj[key]&&!((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.isDragging)){var _this_timeSections_;this.state[key]=obj[key];this.current=new Date(TimeLineUtil.tranTime((_this_timeSections_=this.timeSections[0])==null?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]);this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.current);}}else this.state[key]=obj[key];});}_setCurrentDOM(time){if(this._$currentTime)this._$currentTime.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-current-value`).innerHTML=time;}
10705
- /**
10706
- * 渲染时间轴刻度数组
10707
- */_matchTimeDot(){const scaleWidth=this._scaleWidth;// 时间单位 分钟
10708
- const timeArr=[];
10709
- // 时间转分钟
10710
- let minute=TimeLineUtil.timeToMinute("24:00:00");minute=Math.floor(minute/scaleWidth)*scaleWidth;for(let i=minute;i>=0;){let marginTop=0;let marginBottom=0;
10711
- // 视频片段
10712
- if(i==minute)marginTop=70;if(i==0)marginBottom=this.$container.clientHeight-70;const time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)});i-=scaleWidth;}this._setState({timeArr:timeArr});this._matchRecTimeDot();}_matchRecTimeDot(){const{availTimeLine:availTimeLine,timeArr:timeArr}=this.state;const scaleWidth=this._scaleWidth;const len=availTimeLine.length;if(len===0)for(let j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(let k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(let i=0;i<len;i++){const temp=availTimeLine[i];const st=TimeLineUtil.timeToSecond(temp.startTime);// "00:01:00" -> 60 // 秒
10713
- const et=TimeLineUtil.timeToSecond(temp.endTime);let stAvailPercent=0;let etAvailPercent=0;const stMinute=Math.floor(st/(scaleWidth*60))*scaleWidth;stAvailPercent=(st-stMinute*60)/scaleWidth;const etMinute=Math.floor(et/(scaleWidth*60))*scaleWidth;etAvailPercent=(et-etMinute*60)/scaleWidth;for(let j=0;j<timeArr.length;j++)if(timeArr[j].id==stMinute&&timeArr[j].id==etMinute){const height=etAvailPercent-stAvailPercent;const top=60-etAvailPercent;
10714
- // prettier-ignore
10715
- timeArr[j].recArr.push({height:height,top:top});}else if(timeArr[j].id==stMinute)timeArr[j].recArr.push({height:60-stAvailPercent,top:0});else if(timeArr[j].id==etMinute)timeArr[j].recArr.push({height:etAvailPercent,top:60-etAvailPercent});else if(timeArr[j].id>stMinute&&timeArr[j].id<etMinute)timeArr[j].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr});this._renderDateLine();}_renderDateLine(){const{timeArr:timeArr}=this.state;const container=this._$itemList;
10716
- // 清理上一次的error 事件
10717
- this._imageRemoveErrorEvent(container.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);container.innerHTML="";timeArr.forEach((item,index)=>{const timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class",_$MOBILE_TIMELINE_PREFIX$_+"-time-scale-area");if(item.marginTop)timeItemDOM.style.cssText+=`margin-top: ${item.marginTop}px;`;if(item.marginBottom)timeItemDOM.style.cssText+=`margin-bottom: ${item.marginBottom}px;`;timeItemDOM.style.cssText+=`border-right-color: ${this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)"};`;timeItemDOM.setAttribute("data-time",item.current);timeItemDOM.setAttribute("data-index",index+"");const scaleDOM=document.createElement("div");scaleDOM.setAttribute("class",_$MOBILE_TIMELINE_PREFIX$_+"-scale");let timeItemHtml=``;if(item.coverArr.length)timeItemHtml+=`\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold ${item.coverArr.length>1?`${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-multiple`:""}"\n data-start="${item.current}">\n ${item.coverArr.length>1?`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-cover-fold-placeholder" style="color: #FFF"></div>`:""}\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-img">\n <img src="${this._setImageScr(item.coverArr[0].coverPic)}" class="${_$MOBILE_TIMELINE_PREFIX$_}-img"/>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-len">\n ${item.coverArr.length>1?this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):`${TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm")}`}\n </span>\n ${item.coverArr.length===1?`<span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-time">${TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)}</span>`:""}\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-pause">${_$TIMELINE_ICONS$_.pause}</span>\n </div>\n </div>`;
10718
- // 六个详细刻度
10719
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
10720
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
10721
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
10722
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
10723
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
10724
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
10725
- item.recArr.forEach(i=>{timeItemHtml+=`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-unavail"\n style="height: ${i.height}px;background-color:${this.options.timeSectionColor||"#369FFF"}; top: ${i.top}px">\n </div>`;});timeItemHtml+=`<div id=${item.label} class="${_$MOBILE_TIMELINE_PREFIX$_}-time-label" style="color: ${this.options.timeTextColor||"#666"}">${item.current}</div>`;timeItemDOM.innerHTML=timeItemHtml;container.appendChild(timeItemDOM);this._imageErrorEvent(container.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);});this._currentOffsetH();}_currentOffsetH(){const{current:current}=this.state;if(current){var _this__dragScroll;const currentSecond=TimeLineUtil.timeToSecond(current);const daySecond=24*3600;// 一天的秒数
10726
- const y=(daySecond-currentSecond||0)/this._scaleWidth;(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.scrollToY(y+60,false);}}_render(){this._$currentTime=document.createElement("div");this._$currentTime.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-current");this._$currentTime.innerHTML=`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-current-content" style="color: ${this.options.currentTimeBgColor||"#648FFC"}">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-current-tip">${_$TIMELINE_ICONS$_.tip}</span>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-current-tip-line" style="background-color: ${this.options.timePointColor||"#648FFC"};"></span>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-current-value" style="color: ${this.options.currentTimeColor||"#FFFFFF"}">00:00:00</div>\n </div>`;this.$container.appendChild(this._$currentTime);this._$itemContainer=document.createElement("div");this._$itemContainer.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-container");this.$container.appendChild(this._$itemContainer);this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:state=>{const result=this._offsetYToTime(state.y);if(result[1]!==this.state.current)this._setCurrentDOM(result[0]>=_$DAY_TIME_SECOND$_?"23:59:59":result[1]);},onDragStart:()=>{this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.state.current);},onDragging:()=>{this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,this.state.current);},onDragEnd:()=>{var _this__dragScroll;const result=this._offsetYToTime((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.currentY);if(result[1]!==this.state.current)this._setState({current:result[0]>=_$DAY_TIME_SECOND$_?"23:59:59":result[1]});this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.state.current);}});
10727
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10728
- if(/\d/.test(this.options.height))this._$itemContainer.style.cssText+=`height: ${this.options.height}px`;else if(typeof this.options.height==="string")this._$itemContainer.style.cssText+=`height: ${this.options.height}`;else {const height=this.$container.clientHeight;this._$itemContainer.style.cssText+=`height: ${height}px`;}this._$itemList=document.createElement("div");this._$itemList.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-item");this._dragScroll.$content.appendChild(this._$itemList);if(this.options.showTimeWidthBtn){
10729
- // 加减
10730
- this._$op=document.createElement("div");this._$op.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-op");this._$op.innerHTML=`<span class="${_$MOBILE_TIMELINE_PREFIX$_}-op-wrapper"><span class="${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus">${_$TIMELINE_ICONS$_.plus}</span> <span class="${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus">${_$TIMELINE_ICONS$_.minus}</span></span>`;this.$container.appendChild(this._$op);}this._picker=new Picker(null,{isMobile:true,wrapClassName:`${_$MOBILE_TIMELINE_PREFIX$_}-picker`,onOpenChange:isOpen=>{var _this_options_onPickerOpenChange,_this_options;(_this_options=this.options)==null?void 0:(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)==null?void 0:_this_options_onPickerOpenChange.call(_this_options,isOpen);}});this._addEventListener();}_addEventListener(){if(this.options.showTimeWidthBtn&&this._$op){var// this._$op.addEventListener('click', this._opClick, false);
10731
- _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus`))==null?void 0:_this__$op_querySelector.addEventListener("click",this._plusClick,false);(_this__$op_querySelector1=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus`))==null?void 0:_this__$op_querySelector1.addEventListener("click",this._minusClick,false);}this._matchTimeDot();if(this._picker){this._delegatePickerClose=delegate(this._picker.$body,`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-close`,"click",this._onPickerClose,false);this._delegateItemContent=delegate(this._picker.$body,`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-content`,"click",this._onClickItem,false);this._delegateCoverFold=delegate(this._$itemList,`.${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold`,"click",this._onClickCoverFold,false);}}_removeEventListener(){if(this.options.showTimeWidthBtn&&this._$op){var _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus`))==null?void 0:_this__$op_querySelector.removeEventListener("click",this._plusClick);(_this__$op_querySelector1=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus`))==null?void 0:_this__$op_querySelector1.removeEventListener("click",this._minusClick);}if(this._picker){var _this__picker_$body_querySelector,_this__picker_$body;(_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelector=_this__picker_$body.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-close`))==null?void 0:_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose);if(this._delegateItemContent){this._delegateItemContent.forEach(function(delegation){delegation.destroy();});this._delegateItemContent=null;}if(this._delegatePickerClose){this._delegatePickerClose.forEach(function(delegation){delegation.destroy();});this._delegatePickerClose=null;}if(this._delegateCoverFold){this._delegateCoverFold.forEach(function(delegation){delegation.destroy();});this._delegateCoverFold=null;}}}_plusClick(){const timeWidth=this.timeWidth+1;if(timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(timeWidth);else console.warn("时间轴刻度宽度不能再加了");}_minusClick(){const timeWidth=this.timeWidth-1;if(timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(Math.floor(timeWidth));else console.warn("时间轴刻度宽度不能再减了");}_timeSectionsToGroupsByHour(list){const obj={};list.forEach((item,index)=>{
10732
- // 移动端仅支持一天
10733
- // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
10734
- // }
10735
- const hour=TimeLineUtil.tranTime(item.startTime,"HH");if(obj[+hour])
10736
- // prettier-ignore
10737
- obj[+hour].push(_extends$1$1({},item,{_index:index}));else
10738
- // prettier-ignore
10739
- obj[+hour]=[_extends$1$1({},item,{_index:index})];});return obj}
10740
- /**
10741
- *
10742
- * @param start 仅支持判断同一天的, 如果是多天的或出错
10743
- */_filterTimeSectionsByTime(start){if(!start)return [];const startSecond=TimeLineUtil.timeToSecond(start+":00");const endSecond=TimeLineUtil.timeToSecond(start+":00")+this._scaleWidth*60;return this.timeSections.filter(item=>{const start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return start>=startSecond&&start<endSecond})}
10744
- /**
10745
- * 渲染选择器内容
10746
- */_renderPickerContent(start){var _this__picker_innerHTML,_this__picker,_this__picker1;const list=this._filterTimeSectionsByTime(start);const hourGroups=this._timeSectionsToGroupsByHour(list);(_this__picker=this._picker)==null?void 0:(_this__picker_innerHTML=_this__picker.innerHTML)==null?void 0:_this__picker_innerHTML.call(_this__picker,`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-container">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-header">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-close">${_$TIMELINE_ICONS$_.close}</span>\n ${this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})}\n </div>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-content">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-list">\n ${Object.keys(hourGroups).reverse().map(key=>`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-title">${key}:00</div>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-list">\n ${hourGroups[key].reverse().map(item=>`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-content"\n data-start="${TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")}"\n data-end="${TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")}"\n data-index="${item._index}">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-time">${TimeLineUtil.tranTime(item.startTime,"HH:mm")}</span>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-duration">\n ${TimeLineUtil.tranTimeToString(item.startTime,item.endTime)}\n </span>\n <img class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-cover" src="${this._setImageScr(item.coverPic)}"/>\n </div>`).join("")}\n </div>\n </div>`).join("")}\n </div>\n </div>\n </div>\n </div>`);if((_this__picker1=this._picker)==null?void 0:_this__picker1.$body){var _this__picker2;this._imageErrorEvent(((_this__picker2=this._picker)==null?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);}}
10747
- /**
10748
- * 图片加载失败事件监听
10749
- * @param list
10750
- */_imageErrorEvent(list=[]){Array.from(list).forEach(img=>{
10751
- // 避免重复添加事件
10752
- if(!img.hasAttribute("data-error"))img.addEventListener("error",this._onImageError);});}
10753
- /**
10754
- * 图片加载失败移除
10755
- * @param list
10756
- */_imageRemoveErrorEvent(list=[]){Array.from(list).forEach(img=>{
10757
- // 避免重复添加事件
10758
- img.removeEventListener("error",this._onImageError);});}
10759
- /**
10760
- * 图片加载失败
10761
- * @param e
10762
- */_onImageError(e){const img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode;
10763
- // 加密图片不能加载或没有图片
10764
- const placeholder=document.createElement("div");placeholder.classList.add(`${_$MOBILE_TIMELINE_PREFIX$_}-item-cover-placeholder`);placeholder.innerHTML=`${_$TIMELINE_ICONS$_.picture}`;(_img_parentNode=img.parentNode)==null?void 0:_img_parentNode.appendChild(placeholder);img.remove();
10765
- // img.setAttribute('data-error', 'true'); // 失败仅设置一次, 否则会死循环
10766
- }}_onPickerClose(){if(this._picker)this._picker.open=false;}_onClickItem(e){var _e_delegateTarget_getAttribute,_e_delegateTarget;const index=(_e_delegateTarget=e.delegateTarget)==null?void 0:(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)==null?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");if(this._picker)this._picker.open=false;this.options.onPickerSelect==null?void 0:this.options.onPickerSelect.call(this.options,this.timeSections[+index]);}_onClickCoverFold(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();e.stopPropagation();const time=(_e_delegateTarget=e.delegateTarget)==null?void 0:(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)==null?void 0:(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)==null?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time");if(this._picker&&time){this._renderPickerContent(time);this._picker.open=true;}}_setImageScr(src){if(src){const query="x=1000&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""}_offsetYToTime(offsetY){let y=offsetY;if(offsetY<60){var _this__dragScroll;
10767
- // 60 是下限
10768
- y=60;(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.scrollToY(y);}const second=_$DAY_TIME_SECOND$_-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]}constructor(container,options){super(container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false})),this._isTouchStart=false,this._dragScroll=null,this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0};this._plusClick=this._plusClick.bind(this);this._minusClick=this._minusClick.bind(this);this._onPickerClose=this._onPickerClose.bind(this);this._onClickItem=this._onClickItem.bind(this);this._onClickCoverFold=this._onClickCoverFold.bind(this);this._onImageError=this._onImageError.bind(this);this._render();}}function _extends$5(){_extends$5=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$5.apply(this,arguments)}
10769
- /**
10770
- * 时间轴配置项
10771
- */const _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
10772
- // wheelSpeed: 0.1,
10773
- scaleOffsetTop:4,showYearMonthDay:true};
10774
- /**
10775
- * 时间轴控件类, 支持PC/Mobile 拖动和缩放
10776
- * @beta
10777
- * @example
10778
- * ```ts
10779
- * import TimeLine from './TimeLine';
10780
- * const timeLine = new TimeLine(document.getElementById('container'), {})
10781
- * ```
10782
- */class TimeLine extends BaseTimeLine{
10783
- /**
10784
- * 初始化 (canvas)
10785
- */
10786
- _init(){this._$canvas=document.createElement("canvas");this._ctx=this._$canvas.getContext("2d");if(!this.readOnly)this._$canvas.style.cssText+="cursor: pointer;";this.$container.appendChild(this._$canvas);this.resize(this.width,this.height);this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections});this._addEventListener();}
10787
- /**
10788
- * 重置尺寸
10789
- */resize(width,height){super.resize(width,height);if(this._$canvas&&width){this._$canvas.width=this.width*this.options.dpr;this._$canvas.style.cssText+=`width: ${this.width}px;`;}if(this._$canvas&&height){this._$canvas.height=this.height*this.options.dpr;this._$canvas.style.cssText+=`height: ${this.height}px;`;}this._draw();}
10790
- /**
10791
- * 设置时间轴刻度宽度
10792
- * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
10793
- * @returns
10794
- */setTimeWidth(timeWidth){this._update({timeWidth:timeWidth});}
10795
- /**
10796
- * 设置片段数组
10797
- * @param timeSections - 片段数组
10798
- * @returns
10799
- */updateTimeSections(timeSections){this._update({timeSections:timeSections});}
10800
- /**
10801
- * 更新当前时间
10802
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10803
- */update(time){if(time&&!this._isMouseDown)this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});}
10804
- /**
10805
- * 更新
10806
- * @param options - 更新参数
10807
- * @returns
10808
- */_update(options={}){if((options==null?void 0:options.current)&&options.current instanceof Date)this.current=options.current;if(options==null?void 0:options.timeSections)super.updateTimeSections(this._mergeTimeSections(options.timeSections));if(typeof(options==null?void 0:options.timeWidth)==="number"&&(options==null?void 0:options.timeWidth)<TIME_WIDTH.length){super.setTimeWidth(options.timeWidth);this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)];}if(typeof(options==null?void 0:options.timeWidth)==="number"&&this._timeWidthArray)if(this._timeWidthArray[3]){var _this__$canvas;(_this__$canvas=this._$canvas)==null?void 0:_this__$canvas.setAttribute("data-title",this._timeWidthArray[3]);}this._draw();}setReadOnly(readOnly){super.setReadOnly(readOnly);if(this._$canvas)this._$canvas.style.cssText+=`cursor: ${readOnly?"not-allowed":"pointer"}`;}
10809
- /**
10810
- * 销毁
10811
- * @returns
10812
- */destroy(){this._removeEventListener();if(this._$canvas)try{this.$container.removeChild(this._$canvas);
10813
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10814
- this._$canvas=null;}catch(e){
10815
- // console.error(e);
10816
- }super.destroy();
10817
- // if (this._$tip) {
10818
- // this.$container.removeChild(this._$tip);
10819
- // // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10820
- // this._$tip = null!;
10821
- // }
10822
- }
10823
- // -----------------------------------------------------------------------------------------
10824
- // private
10825
- // -----------------------------------------------------------------------------------------
10826
- /**
10827
- * 缩放时间轴 动态减少间距 (没处理 dpr)
10828
- * @returns 刻度间距
10829
- */
10830
- get _curScaleSpacing(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor(((_this__timeWidthArray=this._timeWidthArray)==null?void 0:_this__timeWidthArray[1])-((_this__timeWidthArray1=this._timeWidthArray)==null?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2));// 刻度间距
10831
- }
10832
- /**
10833
- * 绘制
10834
- */_draw(){
10835
- // 清空画布
10836
- if(this._ctx){this._ctx.fillStyle=this.options.timeAxisBgColor;
10837
- // prettier-ignore
10838
- this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr);}this._drawSections();this._drawScale();}
10839
- /**
10840
- * 绘制刻度
10841
- */_drawScale(){const lineWidth=1*this.options.dpr;
10842
- /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");const centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr};const curScaleTime=Math.floor(this.current.getTime()/1e3);// current 秒
10843
- // 由于时区问题 当前时间戳(秒)处理但前刻度有偏移,所以改成使用当天便宜量, 这样就能保证当天的 0 点刻度能展示
10844
- // prettier-ignore
10845
- const offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(curScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0];const padding=this.height*this.options.dpr/20;// 刻度顶部偏移量 高度的 1/8
10846
- const spacing=this._curScaleSpacing*this.options.dpr;
10847
- // 因为右偏移 右侧靠近中心点的X坐标 减去偏移量
10848
- // prettier-ignore
10849
- const rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing);let leftLastScaleTime=curScaleTime-offsetSecond;let rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0];const leftLastScaleTimeX=rightLastScaleTimeX-spacing;
10850
- // 左扩展刻度
10851
- for(let x=leftLastScaleTimeX;x>0;x-=spacing){
10852
- // prettier-ignore
10853
- const leftOffsetSecond=leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(leftLastScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3);
10854
- // prettier-ignore
10855
- const curScale=leftOffsetSecond%(this._timeWidthArray[0]*this._timeWidthArray[2]);if(curScale===0){
10856
- // prettier-ignore
10857
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth);
10858
- // prettier-ignore
10859
- this._drawTextString(TimeLineUtil.tranTime(new Date(leftLastScaleTime*1e3)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center");}else this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth);leftLastScaleTime-=this._timeWidthArray[0];}
10860
- // 右扩展刻度
10861
- // prettier-ignore
10862
- for(let x=rightLastScaleTimeX;x<=this.width*this.options.dpr;x+=spacing){
10863
- // prettier-ignore
10864
- const rightOffsetSecond=rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(rightLastScaleTime*1e3),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3);
10865
- // prettier-ignore
10866
- const curScale=rightOffsetSecond%(this._timeWidthArray[0]*this._timeWidthArray[2]);if(curScale===0){
10867
- // prettier-ignore
10868
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth);
10869
- // prettier-ignore
10870
- this._drawTextString(TimeLineUtil.tranTime(new Date(rightLastScaleTime*1e3)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center");}else this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth);rightLastScaleTime+=this._timeWidthArray[0];}
10871
- // 当前中心位置(当前时间 current)
10872
- // prettier-ignore
10873
- this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);}
10874
- /**
10875
- * 绘制线
10876
- * @param startX - 线起点 x 坐标
10877
- * @param startY - 线起点 y 坐标
10878
- * @param endX - 线终点 x 坐标
10879
- * @param endY - 线终点 y 坐标
10880
- * @param lineWidth - 线宽度
10881
- * @param color - 线颜色
10882
- *
10883
- */
10884
- // prettier-ignore
10885
- _drawSolidLine(startX,startY,endX,endY,lineWidth,color){if(this._ctx){this._ctx.save();this._ctx.strokeStyle=color!=null?color:this.options.timeScaleColor;this._ctx.lineWidth=lineWidth;this._ctx.beginPath();this._ctx.moveTo(startX,startY);this._ctx.lineTo(endX,endY);this._ctx.stroke();this._ctx.restore();}}
10886
- /**
10887
- * 绘制刻度文字
10888
- * @param text - 文本
10889
- * @param x - X
10890
- * @param y - Y
10891
- * @param align - 文本对齐方式
10892
- */_drawTextString(text,x,y,align){if(this._ctx){const timeTexts=text.split(" ");this._ctx.font=`${12*this.options.dpr*1}px serif`;this._ctx.fillStyle=this.options.timeTextColor;this._ctx.textAlign=align||"left";if(this._timeWidthArray[0]%60===0)
10893
- // 仅展示 hh:mm
10894
- timeTexts[1]=timeTexts[1].replace(/:00$/,"");this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr);
10895
- // prettier-ignore
10896
- if(this.options.showYearMonthDay&&(timeTexts[1]==="00:00:00"||timeTexts[1]==="00:00"||this._timeWidthArray[0]*this._timeWidthArray[2]===24*3600)){
10897
- // 展示年月日
10898
- this._ctx.textAlign=align||"left";this._ctx.fillText(timeTexts[0],x,y+(8+10)*this.options.dpr);}}}
10899
- /**
10900
- * 画录像区间
10901
- */_drawSections(){
10902
- // 绘制蓝色区域
10903
- const timeArr=this.timeSections||[];
10904
- // 根据时间查找当前位置
10905
- for(let i=0;i<timeArr.length;i++){const position=this._findPosition(timeArr[i]);
10906
- // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
10907
- // prettier-ignore
10908
- if(this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)){this._ctx.fillStyle=this.options.timeSectionColor;
10909
- // prettier-ignore
10910
- this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr);}}}
10911
- /**
10912
- * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
10913
- * @param item - 时间片段
10914
- * @returns {void}
10915
- */_findPosition(item){
10916
- // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
10917
- // prettier-ignore
10918
- const x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;const x2=x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr;return {x1:x1,x2:x2}}
10919
- /**
10920
- * 合并相邻两个时间区间
10921
- * @param timeSections - 时间区间数组
10922
- *
10923
- * @returns 合并后的时间区间
10924
- */_mergeTimeSections(timeSections){if(timeSections.length===0)return timeSections;timeSections=timeSections.map(item=>{
10925
- // 处理秒
10926
- if((item.startTime+"").length===10)item.startTime=item.startTime*1e3;if((item.endTime+"").length===10)item.endTime=item.endTime*1e3;return _extends$5({},item,{startTime:item.startTime,endTime:item.endTime})});const merged=[timeSections[0]];for(let i=1;i<timeSections.length;i++){const prev=merged[merged.length-1];const curr=timeSections[i];
10927
- // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
10928
- if(prev.endTime>=curr.startTime)
10929
- // 合并区间
10930
- prev.endTime=Math.max(prev.endTime,curr.endTime);else merged.push(curr);}return merged}
10931
- // -------------------------------------
10932
- // mouse event
10933
- // -------------------------------------
10934
- /**
10935
- * 添加事件监听
10936
- * @returns
10937
- */
10938
- _addEventListener(){if(this._$canvas){
10939
- // 事件监听
10940
- this._$canvas.addEventListener("mousemove",this._mousemoveFun);
10941
- // prettier-ignore
10942
- this._$canvas.addEventListener("mouseover",this._mouseoverFun);
10943
- // prettier-ignore
10944
- this._$canvas.addEventListener("mouseleave",this._mouseleaveFun);
10945
- // prettier-ignore
10946
- this._$canvas.addEventListener("mousedown",this._mousedownFun);
10947
- // prettier-ignore
10948
- this._$canvas.addEventListener("mouseup",this._mouseUpFun);this._$canvas.addEventListener("wheel",this._mousewheelFun);
10949
- // prettier-ignore
10950
- this.$container.addEventListener("wheel",e=>{e.preventDefault();},{passive:false});this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun);this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun);
10951
- // ctrl 键事件
10952
- document.addEventListener("keydown",this._ctrlKeyDownFun,false);document.addEventListener("keyup",this._ctrlKeyUpFun,false);this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false});this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false});this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false});}}
10953
- /**
10954
- * 移除事件监听
10955
- * @returns
10956
- */_removeEventListener(){if(this._$canvas){
10957
- // 事件监听
10958
- this._$canvas.removeEventListener("mousemove",this._mousemoveFun);
10959
- // prettier-ignore
10960
- this._$canvas.removeEventListener("mouseover",this._mouseoverFun);
10961
- // prettier-ignore
10962
- this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun);
10963
- // prettier-ignore
10964
- this._$canvas.removeEventListener("mousedown",this._mousedownFun);
10965
- // prettier-ignore
10966
- this._$canvas.removeEventListener("mouseup",this._mouseUpFun);this._$canvas.removeEventListener("wheel",this._mousewheelFun);this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun);this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun);
10967
- // ctrl 键事件
10968
- document.removeEventListener("keydown",this._ctrlKeyDownFun);document.removeEventListener("keyup",this._ctrlKeyUpFun);
10969
- // touch
10970
- this._$canvas.removeEventListener("touchstart",this._touchstartFun);this._$canvas.removeEventListener("touchmove",this._touchmoveFun);this._$canvas.removeEventListener("touchend",this._touchendFun);}}
10971
- /**
10972
- * 鼠标按下事件监听
10973
- * @param e - 鼠标事件
10974
- * @returns
10975
- */_mousedownFun(e){if(this.readOnly)return;this._isMouseDown=true;this._mousePosition=e.pageX;this._oldTime=this.current;this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.current);}
10976
- /**
10977
- * 鼠标移入事件监听
10978
- * @returns
10979
- */_mouseoverFun(){if(this.readOnly)return;this._isOver=true;}
10980
- /**
10981
- * 鼠标离开事件监听
10982
- * @returns
10983
- */_mouseleaveFun(e){if(this.readOnly)return;this._isOver=false;this._moveEndOrTouchEndFun(e);}
10984
- /**
10985
- * 鼠标抬起事件监听
10986
- * @returns
10987
- */_mouseUpFun(e){this._moveEndOrTouchEndFun(e);}
10988
- /**
10989
- * 鼠标移动事件监听
10990
- * @param e - 鼠标事件
10991
- * @returns
10992
- */_mousemoveFun(e){if(this.readOnly)return;if(this._isMouseDown&&this._isOver)
10993
- // 鼠标按下位置和移动位置的偏移量
10994
- this._moveUpdateFun(e.pageX);else {const left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left;this._update();// 更新画面
10995
- }
10996
- // const time = new Date(
10997
- // // prettier-ignore
10998
- // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
10999
- // );
11000
- }
11001
- /**
11002
- * 鼠标滚轮滚动
11003
- * @param e - 鼠标滚轮滚动事件
11004
- * @returns
11005
- */_mousewheelFun(e){e.preventDefault();// 阻止默认滚动行为
11006
- // eslint-disable-next-line no-useless-return
11007
- if(this.readOnly)return;
11008
- // if (this._isCtrlKeyDown) {
11009
- // const zoom = e.deltaY > 0 ? -this.options.wheelSpeed : this.options.wheelSpeed;
11010
- // this._timeWidth = +(this._timeWidth + zoom).toFixed(2);
11011
- // if (this._timeWidth <= 0) {
11012
- // this._timeWidth = 0;
11013
- // } else if (this._timeWidth >= TIME_WIDTH.length) {
11014
- // this._timeWidth = TIME_WIDTH.length - 0.01;
11015
- // }
11016
- // this._update({
11017
- // timeWidth: Math.floor(this._timeWidth),
11018
- // });
11019
- // }
10952
+
10953
+ var hasRequiredDist;
10954
+
10955
+ function requireDist () {
10956
+ if (hasRequiredDist) return dist$1.exports;
10957
+ hasRequiredDist = 1;
10958
+ (function (module, exports) {
10959
+ Object.defineProperty(exports,"__esModule",{value:true});var deepmerge=requireCjs(),I18n=requireDist$3(),Picker=requireDist$6(),DragScroll=requireDist$1(),delegate=requireDist$5(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
10960
+ // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
10961
+ timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
10962
+ onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,
10963
+ /** 只读 */this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,
10964
+ /** 片段列表 */this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,
10965
+ // prettier-ignore
10966
+ this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._timeWidth=this.options.timeWidth||0,this._resize(this.options.width||"100%",this.options.height);}var _proto=BaseTimeLine.prototype;
10967
+ /**
10968
+ * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
10969
+ * @param readOnly - 只读或取消只读
10970
+ * @returns
10971
+ */return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},
10972
+ /**
10973
+ * 更新当前时间
10974
+ * @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
10975
+ */
10976
+ _proto.update=function(current){this._current=current;},
10977
+ /**
10978
+ * 更新时间片段
10979
+ * @param timeSections 片段数据
10980
+ */
10981
+ _proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},
10982
+ /**
10983
+ * 重置尺寸
10984
+ */
10985
+ _proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},
10986
+ /**
10987
+ * 改变时间轴刻度
10988
+ * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
10989
+ * PC间距:
10990
+ * @param timeWidth 时间轴刻度
10991
+ */
10992
+ _proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},
10993
+ /**
10994
+ * 销毁
10995
+ */
10996
+ _proto.destroy=function(){
10997
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10998
+ this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:
10999
+ /**
11000
+ * 当前时间
11001
+ */
11002
+ function(){return this._current},set:
11003
+ /**
11004
+ * 当前时间
11005
+ */
11006
+ function(current){this._current=current;}},{key:"readOnly",get:
11007
+ /**
11008
+ * 只读状态
11009
+ */
11010
+ function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:
11011
+ /**
11012
+ * 时间片段
11013
+ */
11014
+ function(){return this._timeSections}},{key:"width",get:
11015
+ /**
11016
+ * 获取 TimeLine 的宽度
11017
+ * @returns
11018
+ */
11019
+ function(){return this._width}},{key:"height",get:
11020
+ /**
11021
+ * 获取 TimeLine 的高度
11022
+ */
11023
+ function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();
11024
+ /**
11025
+ * 时间轴基类
11026
+ * @internal
11027
+ */
11028
+ /** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}
11029
+ /**
11030
+ * 时间转成日期
11031
+ * @param time 时间 (秒, 毫秒, 日期字符串, Date)
11032
+ * @returns 日期
11033
+ */return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(date=time)):date=new Date(+time):date=new Date(1e3*+time),date},
11034
+ /**
11035
+ * 时间转成 HH:mm:ss
11036
+ * @param time 时间
11037
+ * @returns
11038
+ */
11039
+ TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();// 返回日期中的小时数(0到23)
11040
+ // 返回日期中的秒数(0到59)
11041
+ return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},
11042
+ /**
11043
+ * 十位补充 0
11044
+ * @param m 数字
11045
+ * @returns 十位补充 0后的结果字符串
11046
+ */
11047
+ TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},
11048
+ /**
11049
+ * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
11050
+ * @param time 时间
11051
+ * @param fmt 时间格式
11052
+ * @returns
11053
+ */
11054
+ TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},
11055
+ /**
11056
+ * 时间转成秒
11057
+ * @param time
11058
+ * @returns
11059
+ */
11060
+ TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},
11061
+ /**
11062
+ * 分钟转成 HH:mm
11063
+ * @param minute
11064
+ * @returns
11065
+ */
11066
+ TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},
11067
+ /**
11068
+ * 时间转成分钟
11069
+ * @param time
11070
+ * @returns
11071
+ */
11072
+ TimeLineUtil.timeToMinute=function(time){var e=time.split(":");
11073
+ // const s = Number(e[2]);
11074
+ return 60*Number(e[0])+Number(e[1])},
11075
+ /**
11076
+ * @description 判读两个区间是否重叠
11077
+ * @param {number} a_start 一个区间的开始
11078
+ * @param {number} a_end 一个区间的结束
11079
+ * @param {number} b_start 另一个区间的开始
11080
+ * @param {number} b_end 另一个区间的结束
11081
+ * @returns {boolean}
11082
+ */
11083
+ TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$TIMELINE_ICONS$__tip='<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>',_$TIMELINE_ICONS$__plus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__minus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__close='\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n ',_$TIMELINE_ICONS$__pause='<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n ',_$TIMELINE_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];
11084
+ /**
11085
+ * 时间轴图标集
11086
+ */function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&
11087
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable eqeqeq */ /* eslint-disable no-unneeded-ternary */ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/prefer-includes */function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}
11088
+ /**
11089
+ * 时间轴样式类前缀
11090
+ */var _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
11091
+ /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
11092
+ /** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0},_this._plusClick=_this._plusClick.bind(_this),_this._minusClick=_this._minusClick.bind(_this),_this._onPickerClose=_this._onPickerClose.bind(_this),_this._onClickItem=_this._onClickItem.bind(_this),_this._onClickCoverFold=_this._onClickCoverFold.bind(_this),_this._onImageError=_this._onImageError.bind(_this),_this._render(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;
11093
+ /**
11094
+ * 设置只读或取消只读
11095
+ * @param readOnly - 只读或取消只读
11096
+ * @returns
11097
+ */return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},
11098
+ /**
11099
+ * 改变时间轴刻度
11100
+ * 0: 1分钟,
11101
+ * 1: 10分钟
11102
+ * 2: 半小时
11103
+ * 3: 1小时
11104
+ * 4: 2小时
11105
+ * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
11106
+ */
11107
+ _proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},
11108
+ /**
11109
+ * 更新片段数组
11110
+ * @param timeSections
11111
+ * @param defaultIndex
11112
+ */
11113
+ _proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);
11114
+ // 若current不为 null,则不重置current,避免拖动后时间轴回弹
11115
+ var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},
11116
+ /**
11117
+ * 更新当前时间
11118
+ * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11119
+ */
11120
+ _proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},
11121
+ /**
11122
+ * 销毁
11123
+ */
11124
+ _proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList),this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer),this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op),this._$op=null;}catch(error){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},
11125
+ /**
11126
+ * 更新状态
11127
+ * @param obj
11128
+ */
11129
+ _proto._setState=function(obj){var _this=this;
11130
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11131
+ Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime(null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},
11132
+ /**
11133
+ * 渲染时间轴刻度数组
11134
+ */
11135
+ _proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth// 时间单位 分钟
11136
+ ;i>=0;){var marginTop=0,marginBottom=0;
11137
+ // 视频片段
11138
+ i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)}),i-=scaleWidth;}this._setState({timeArr:timeArr}),this._matchRecTimeDot();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;
11139
+ // prettier-ignore
11140
+ timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;
11141
+ // 清理上一次的error 事件
11142
+ this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),item.marginBottom&&(timeItemDOM.style.cssText+="margin-bottom: "+item.marginBottom+"px;"),timeItemDOM.style.cssText+="border-right-color: "+(_this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)")+";",timeItemDOM.setAttribute("data-time",item.current),timeItemDOM.setAttribute("data-index",index+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-time-cover-fold-len">\n '+(item.coverArr.length>1?_this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):""+TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm"))+"\n </span>\n "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),
11143
+ // 六个详细刻度
11144
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11145
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11146
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11147
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11148
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11149
+ // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
11150
+ item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-time-unavail"\n style="height: '+i.height+"px;background-color:"+(_this.options.timeSectionColor||"#369FFF")+"; top: "+i.top+'px">\n </div>';}),timeItemHtml+="<div id="+item.label+' class="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;
11151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11152
+ if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-current-value" style="color: '+(this.options.currentTimeColor||"#FFFFFF")+'">00:00:00</div>\n </div>',this.$container.appendChild(this._$currentTime),this._$itemContainer=document.createElement("div"),this._$itemContainer.classList.add("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(
11153
+ // 加减
11154
+ this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var// this._$op.addEventListener('click', this._opClick, false);
11155
+ _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){
11156
+ // 移动端仅支持一天
11157
+ // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
11158
+ // }
11159
+ var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?
11160
+ // prettier-ignore
11161
+ obj[+hour].push(_extends$1({},item,{_index:index})):
11162
+ // prettier-ignore
11163
+ obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},
11164
+ /**
11165
+ *
11166
+ * @param start 仅支持判断同一天的, 如果是多天的或出错
11167
+ */
11168
+ _proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},
11169
+ /**
11170
+ * 渲染选择器内容
11171
+ */
11172
+ _proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-picker-close">'+_$TIMELINE_ICONS$__close+"</span>\n "+this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})+'\n </div>\n <div class="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-picker-item-content"\n data-start="'+TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")+'"\n data-end="'+TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")+'"\n data-index="'+item._index+'">\n <span class="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},
11173
+ /**
11174
+ * 图片加载失败事件监听
11175
+ * @param list
11176
+ */
11177
+ _proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11178
+ // 避免重复添加事件
11179
+ img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},
11180
+ /**
11181
+ * 图片加载失败移除
11182
+ * @param list
11183
+ */
11184
+ _proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11185
+ // 避免重复添加事件
11186
+ img.removeEventListener("error",_this._onImageError);});},
11187
+ /**
11188
+ * 图片加载失败
11189
+ * @param e
11190
+ */
11191
+ _proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");
11192
+ // 加密图片不能加载或没有图片
11193
+ placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);
11194
+ // moveX >= 1 || moveY >= 1 用于判断是否移动
11195
+ this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=1000&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(
11196
+ // 60 是下限
11197
+ y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:
11198
+ /**
11199
+ * 获取真实时间刻度(时间单位 分钟)
11200
+ */
11201
+ function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}
11202
+ /**
11203
+ * 时间轴配置项
11204
+ */var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
11205
+ // wheelSpeed: 0.1,
11206
+ scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,// mouse
11207
+ _this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,
11208
+ // prettier-ignore
11209
+ _this._mousemoveFun=_this._mousemoveFun.bind(_this),_this._mouseoverFun=_this._mouseoverFun.bind(_this),_this._mouseleaveFun=_this._mouseleaveFun.bind(_this),_this._mousedownFun=_this._mousedownFun.bind(_this),_this._mouseUpFun=_this._mouseUpFun.bind(_this),_this._mousewheelFun=_this._mousewheelFun.bind(_this),_this._touchstartFun=_this._touchstartFun.bind(_this),_this._touchmoveFun=_this._touchmoveFun.bind(_this),_this._touchendFun=_this._touchendFun.bind(_this),_this._ctrlKeyDownFun=_this._ctrlKeyDownFun.bind(_this),_this._ctrlKeyUpFun=_this._ctrlKeyUpFun.bind(_this),_this._init(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;
11210
+ /**
11211
+ * 初始化 (canvas)
11212
+ */return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},
11213
+ /**
11214
+ * 重置尺寸
11215
+ */
11216
+ _proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},
11217
+ /**
11218
+ * 设置时间轴刻度宽度
11219
+ * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
11220
+ * @returns
11221
+ */
11222
+ _proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},
11223
+ /**
11224
+ * 设置片段数组
11225
+ * @param timeSections - 片段数组
11226
+ * @returns
11227
+ */
11228
+ _proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},
11229
+ /**
11230
+ * 更新当前时间
11231
+ * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11232
+ */
11233
+ _proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},
11234
+ /**
11235
+ * 更新
11236
+ * @param options - 更新参数
11237
+ * @returns
11238
+ */
11239
+ _proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},
11240
+ /**
11241
+ * 销毁
11242
+ * @returns
11243
+ */
11244
+ _proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),
11245
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11246
+ this._$canvas=null;}catch(e){
11247
+ // console.error(e);
11248
+ }BaseTimeLine.prototype.destroy.call(this);},
11249
+ /**
11250
+ * 绘制
11251
+ */
11252
+ _proto._draw=function(){
11253
+ // 清空画布
11254
+ this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,
11255
+ // prettier-ignore
11256
+ this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},
11257
+ /**
11258
+ * 绘制刻度
11259
+ */
11260
+ _proto._drawScale=function(){var lineWidth=1*this.options.dpr;
11261
+ /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");
11262
+ // 左扩展刻度
11263
+ for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11264
+ // prettier-ignore
11265
+ this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11266
+ // prettier-ignore
11267
+ this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}
11268
+ // 右扩展刻度
11269
+ // prettier-ignore
11270
+ for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11271
+ // prettier-ignore
11272
+ this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11273
+ // prettier-ignore
11274
+ this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}
11275
+ // 当前中心位置(当前时间 current)
11276
+ // prettier-ignore
11277
+ this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},
11278
+ /**
11279
+ * 绘制线
11280
+ * @param startX - 线起点 x 坐标
11281
+ * @param startY - 线起点 y 坐标
11282
+ * @param endX - 线终点 x 坐标
11283
+ * @param endY - 线终点 y 坐标
11284
+ * @param lineWidth - 线宽度
11285
+ * @param color - 线颜色
11286
+ *
11287
+ */
11288
+ // prettier-ignore
11289
+ _proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},
11290
+ /**
11291
+ * 绘制刻度文字
11292
+ * @param text - 文本
11293
+ * @param x - X
11294
+ * @param y - Y
11295
+ * @param align - 文本对齐方式
11296
+ */
11297
+ _proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(
11298
+ // 仅展示 hh:mm
11299
+ timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),
11300
+ // prettier-ignore
11301
+ !this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(
11302
+ // 展示年月日
11303
+ this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},
11304
+ /**
11305
+ * 画录像区间
11306
+ */
11307
+ _proto._drawSections=function(){
11308
+ // 根据时间查找当前位置
11309
+ for(
11310
+ // 绘制蓝色区域
11311
+ var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);
11312
+ // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
11313
+ // prettier-ignore
11314
+ this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,
11315
+ // prettier-ignore
11316
+ this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},
11317
+ /**
11318
+ * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
11319
+ * @param item - 时间片段
11320
+ * @returns {void}
11321
+ */
11322
+ _proto._findPosition=function(item){
11323
+ // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
11324
+ // prettier-ignore
11325
+ var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},
11326
+ /**
11327
+ * 合并相邻两个时间区间
11328
+ * @param timeSections - 时间区间数组
11329
+ *
11330
+ * @returns 合并后的时间区间
11331
+ */
11332
+ _proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){
11333
+ // 处理秒
11334
+ return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];
11335
+ // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
11336
+ prev.endTime>=curr.startTime?
11337
+ // 合并区间
11338
+ prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},
11339
+ // -------------------------------------
11340
+ // mouse event
11341
+ // -------------------------------------
11342
+ /**
11343
+ * 添加事件监听
11344
+ * @returns
11345
+ */
11346
+ _proto._addEventListener=function(){this._$canvas&&(
11347
+ // 事件监听
11348
+ this._$canvas.addEventListener("mousemove",this._mousemoveFun),
11349
+ // prettier-ignore
11350
+ this._$canvas.addEventListener("mouseover",this._mouseoverFun),
11351
+ // prettier-ignore
11352
+ this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),
11353
+ // prettier-ignore
11354
+ this._$canvas.addEventListener("mousedown",this._mousedownFun),
11355
+ // prettier-ignore
11356
+ this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),
11357
+ // prettier-ignore
11358
+ this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),
11359
+ // ctrl 键事件
11360
+ document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},
11361
+ /**
11362
+ * 移除事件监听
11363
+ * @returns
11364
+ */
11365
+ _proto._removeEventListener=function(){this._$canvas&&(
11366
+ // 事件监听
11367
+ this._$canvas.removeEventListener("mousemove",this._mousemoveFun),
11368
+ // prettier-ignore
11369
+ this._$canvas.removeEventListener("mouseover",this._mouseoverFun),
11370
+ // prettier-ignore
11371
+ this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),
11372
+ // prettier-ignore
11373
+ this._$canvas.removeEventListener("mousedown",this._mousedownFun),
11374
+ // prettier-ignore
11375
+ this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),
11376
+ // ctrl 键事件
11377
+ document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),
11378
+ // touch
11379
+ this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},
11380
+ /**
11381
+ * 鼠标按下事件监听
11382
+ * @param e - 鼠标事件
11383
+ * @returns
11384
+ */
11385
+ _proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},
11386
+ /**
11387
+ * 鼠标移入事件监听
11388
+ * @returns
11389
+ */
11390
+ _proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},
11391
+ /**
11392
+ * 鼠标离开事件监听
11393
+ * @returns
11394
+ */
11395
+ _proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},
11396
+ /**
11397
+ * 鼠标抬起事件监听
11398
+ * @returns
11399
+ */
11400
+ _proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},
11401
+ /**
11402
+ * 鼠标移动事件监听
11403
+ * @param e - 鼠标事件
11404
+ * @returns
11405
+ */
11406
+ _proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)
11407
+ // 鼠标按下位置和移动位置的偏移量
11408
+ this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}
11409
+ // const time = new Date(
11410
+ // // prettier-ignore
11411
+ // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
11412
+ // );
11413
+ },
11414
+ /**
11415
+ * 鼠标滚轮滚动
11416
+ * @param e - 鼠标滚轮滚动事件
11417
+ * @returns
11418
+ */
11419
+ _proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},
11420
+ /**
11421
+ * ctrl键按下事件
11422
+ * @param e - 键盘按下事件
11423
+ */
11424
+ _proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},
11425
+ /**
11426
+ * ctrl键抬起事件
11427
+ * @param e - 键盘按下事件
11428
+ */
11429
+ _proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},
11430
+ // ----------------------------------------------------------------------
11431
+ // touch
11432
+ // ----------------------------------------------------------------------
11433
+ /**
11434
+ * 触摸距离
11435
+ * @param touches - 两指触摸点
11436
+ * @returns
11437
+ */
11438
+ _proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},
11439
+ /**
11440
+ * 触摸开始
11441
+ * @param e - 触摸事件
11442
+ * @returns
11443
+ */
11444
+ _proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){
11445
+ // 单指
11446
+ var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(
11447
+ // 双指
11448
+ this._lastTouchDist=this._getTouchDistance(e.touches));},
11449
+ /**
11450
+ * 触摸移动
11451
+ * @param e - 触摸事件
11452
+ * @returns
11453
+ */
11454
+ _proto._touchmoveFun=function(e){if(e.preventDefault(),// 防止页面缩放
11455
+ e.stopPropagation(),!this.readOnly)if(1===e.touches.length){
11456
+ // 单指
11457
+ var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){
11458
+ // 双指
11459
+ this._getTouchDistance(e.touches);this._lastTouchDist;}},
11460
+ /**
11461
+ * 触摸结束
11462
+ * @param e - 触摸事件
11463
+ * @returns
11464
+ */
11465
+ _proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},
11466
+ /**
11467
+ * 拖动结束
11468
+ * @returns
11469
+ */
11470
+ _proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},
11471
+ /**
11472
+ * 移动更新时间
11473
+ * @param x - 移动的x坐标
11474
+ * @returns
11475
+ */
11476
+ _proto._moveUpdateFun=function(x){
11477
+ // 鼠标按下位置和移动位置的偏移量
11478
+ var mouseOffset=this._mousePosition-x;
11479
+ // fix点击引起mousemove的问题
11480
+ if(0!==mouseOffset){if(this._oldTime){
11481
+ // prettier-ignore
11482
+ var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:// -----------------------------------------------------------------------------------------
11483
+ // private
11484
+ // -----------------------------------------------------------------------------------------
11485
+ /**
11486
+ * 缩放时间轴 动态减少间距 (没处理 dpr)
11487
+ * @returns 刻度间距
11488
+ */
11489
+ function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2));// 刻度间距
11490
+ }}]),TimeLine}(BaseTimeLine);
11491
+ /**
11492
+ * 时间轴控件类, 支持PC/Mobile 拖动和缩放
11493
+ * @beta
11494
+ * @example
11495
+ * ```ts
11496
+ * import TimeLine from './TimeLine';
11497
+ * const timeLine = new TimeLine(document.getElementById('container'), {})
11498
+ * ```
11499
+ */TimeLine.TIME_WIDTH=TIME_WIDTH;var index={MobileTimeLine:MobileTimeLine,TimeLine:TimeLine,BaseTimeLine:BaseTimeLine};exports.BaseTimeLine=BaseTimeLine,exports.MobileTimeLine=MobileTimeLine,exports.TimeLine=TimeLine,module.exports=index;
11500
+ } (dist$1, dist$1.exports));
11501
+ return dist$1.exports;
11020
11502
  }
11021
- /**
11022
- * ctrl键按下事件
11023
- * @param e - 键盘按下事件
11024
- */_ctrlKeyDownFun(e){if(e.ctrlKey||e.key==="Control"){console.log("Ctrl 键被按下");this._isCtrlKeyDown=true;}}
11025
- /**
11026
- * ctrl键抬起事件
11027
- * @param e - 键盘按下事件
11028
- */_ctrlKeyUpFun(e){if(e.ctrlKey||e.key==="Control"){console.log("Ctrl 键UP");this._isCtrlKeyDown=false;}}
11029
- // ----------------------------------------------------------------------
11030
- // touch
11031
- // ----------------------------------------------------------------------
11032
- /**
11033
- * 触摸距离
11034
- * @param touches - 两指触摸点
11035
- * @returns
11036
- */
11037
- _getTouchDistance(touches){const[touch1,touch2]=touches;const dx=touch2.clientX-touch1.clientX;const dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)}
11038
- /**
11039
- * 触摸开始
11040
- * @param e - 触摸事件
11041
- * @returns
11042
- */_touchstartFun(e){if(this.readOnly)return;this._oldTime=this.current;this._isOver=true;if(e.touches.length===1){
11043
- // 单指
11044
- const touch=e.touches[0];this._isMouseDown=true;this._mousePosition=touch.clientX;
11045
- // this._touchmoveFun(e);
11046
- }else if(e.touches.length===2){
11047
- // 双指
11048
- this._lastTouchDist=this._getTouchDistance(e.touches);console.warn("_touchstartFun",this._lastTouchDist);}}
11049
- /**
11050
- * 触摸移动
11051
- * @param e - 触摸事件
11052
- * @returns
11053
- */_touchmoveFun(e){e.preventDefault();// 防止页面缩放
11054
- e.stopPropagation();if(this.readOnly)return;console.warn(e.touches.length);if(e.touches.length===1){
11055
- // 单指
11056
- const touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(e.touches.length===2){
11057
- // 双指
11058
- const newDist=this._getTouchDistance(e.touches);const zoom=newDist/this._lastTouchDist;console.warn("_touchmoveFun",this._lastTouchDist,zoom);
11059
- // scale *= zoom;
11060
- // // 限制缩放范围
11061
- // scale = Math.max(0.5, Math.min(3, scale));
11062
- // img.style.transform = `scale(${scale})`;
11063
- // lastDist = newDist;
11064
- }}
11065
- /**
11066
- * 触摸结束
11067
- * @param e - 触摸事件
11068
- * @returns
11069
- */_touchendFun(e){if(this.readOnly)return;this._moveEndOrTouchEndFun(e);}
11070
- /**
11071
- * 拖动结束
11072
- * @returns
11073
- */_moveEndOrTouchEndFun(e){e.preventDefault();if(this.readOnly)return;if(this._isMouseDown){this._isMouseDown=false;if(this._moved){this._moved=false;this._update({current:this.current});this._oldTime=this.current;this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.current,this._isOver);}if(this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5)this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.current);this._mousePosition=0;this._lastTouchDist=0;}}
11074
- /**
11075
- * 移动更新时间
11076
- * @param x - 移动的x坐标
11077
- * @returns
11078
- */_moveUpdateFun(x){
11079
- // 鼠标按下位置和移动位置的偏移量
11080
- const mouseOffset=this._mousePosition-x;
11081
- // fix点击引起mousemove的问题
11082
- if(mouseOffset===0)return;if(this._oldTime){
11083
- // prettier-ignore
11084
- const currentTime=this._oldTime.getTime()+parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10)*1e3;this._update({current:new Date(currentTime)});this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}constructor(container,options){super(container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true})),this._$canvas=null,this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */this._timeWidthArray=TIME_WIDTH[0],this._centerPositionX=0,// mouse
11085
- this._isMouseDown=false,this._mousePosition=0,this._oldTime=null,this._isOver=false,this._moved=false,this._isCtrlKeyDown=false,this._lastTouchDist=0;this.$container=container;
11086
- // prettier-ignore
11087
- console.log("TimeLine dpr",JSON.stringify(this.options));this._mousemoveFun=this._mousemoveFun.bind(this);this._mouseoverFun=this._mouseoverFun.bind(this);this._mouseleaveFun=this._mouseleaveFun.bind(this);this._mousedownFun=this._mousedownFun.bind(this);this._mouseUpFun=this._mouseUpFun.bind(this);this._mousewheelFun=this._mousewheelFun.bind(this);this._touchstartFun=this._touchstartFun.bind(this);this._touchmoveFun=this._touchmoveFun.bind(this);this._touchendFun=this._touchendFun.bind(this);this._ctrlKeyDownFun=this._ctrlKeyDownFun.bind(this);this._ctrlKeyUpFun=this._ctrlKeyUpFun.bind(this);this._init();}}TimeLine.TIME_WIDTH=TIME_WIDTH;
11503
+
11504
+ var distExports = requireDist();
11088
11505
 
11089
11506
  function _extends$4() {
11090
11507
  _extends$4 = Object.assign || function(target) {
@@ -11182,17 +11599,17 @@
11182
11599
  }
11183
11600
  }
11184
11601
  };
11185
- if (isMobile$1()) {
11186
- this.timeLineUtil = new MobileTimeLine(this.$container, _timeLineOptions);
11602
+ if (distExports$3.isMobile()) {
11603
+ this.timeLineUtil = new distExports.MobileTimeLine(this.$container, _timeLineOptions);
11187
11604
  } else {
11188
- this.timeLineUtil = new TimeLine(this.$container, _timeLineOptions);
11605
+ this.timeLineUtil = new distExports.TimeLine(this.$container, _timeLineOptions);
11189
11606
  this._renderAddReduce();
11190
11607
  }
11191
11608
  (_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, this.records);
11192
11609
  this.timeLineUtil.update(new Date());
11193
11610
  };
11194
11611
  _proto.setWidth = function setWidth(width) {
11195
- if (!isMobile$1()) this.timeLineUtil.resize(width);
11612
+ if (!distExports$3.isMobile()) this.timeLineUtil.resize(width);
11196
11613
  };
11197
11614
  _proto._renderAddReduce = function _renderAddReduce() {
11198
11615
  var _this = this;
@@ -11982,7 +12399,7 @@
11982
12399
  if (theme.options.posterOptions !== null) {
11983
12400
  theme.posterControl = new Poster(_extends$1({}, theme.options.posterOptions || {}, {
11984
12401
  getPopupContainer: function() {
11985
- return theme.contentControl.$content;
12402
+ return theme.contentControl.$video;
11986
12403
  }
11987
12404
  }));
11988
12405
  }
@@ -12382,6 +12799,7 @@
12382
12799
  dblClickFullscreen: true,
12383
12800
  language: 'zh',
12384
12801
  autoPlay: true,
12802
+ scaleMode: THEME_SCALE_MODE_TYPE.full,
12385
12803
  loggerOptions: {
12386
12804
  level: 'INFO',
12387
12805
  showTime: true
@@ -12450,11 +12868,11 @@
12450
12868
  */ _this._footerMoreControl = null, /** 头部控件 @since 0.0.1 @private */ _this._header = null, /** 低部控件 @since 0.0.1 @private */ _this._footer = null, /** 回放底部时间轴 @since 0.0.1 @private */ _this._recFooter = null, /**
12451
12869
  * 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
12452
12870
  * @private
12453
- */ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null;
12871
+ */ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
12454
12872
  _this._initOptions(options);
12455
12873
  if (_this.options.type === 'ezopen') {
12456
12874
  var _this_urlInfo_searchParams, _this_urlInfo;
12457
- _this.urlInfo = parseEzopenUrl(_this.options.url);
12875
+ _this.urlInfo = distExports$3.parseEzopenUrl(_this.options.url);
12458
12876
  if ((_this_urlInfo = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams = _this_urlInfo.searchParams) == null ? void 0 : _this_urlInfo_searchParams.spaceId) {
12459
12877
  _this.options.spaceId = _this.urlInfo.searchParams.spaceId;
12460
12878
  }
@@ -12474,7 +12892,8 @@
12474
12892
  _this.contentControl = new Content({
12475
12893
  getContainer: function() {
12476
12894
  return _this.$container;
12477
- }
12895
+ },
12896
+ scaleMode: _this.scaleMode
12478
12897
  });
12479
12898
  // zoom utils
12480
12899
  __zoom(_this, _this.contentControl.$content, _extends({}, _this.options.zoomOptions || {}, {
@@ -12635,6 +13054,38 @@
12635
13054
  (_this = this) == null ? void 0 : _this.emit(EVENTS.setLoggerOptions, options);
12636
13055
  };
12637
13056
  /**
13057
+ * 设置视频画面缩放模式
13058
+ * @since 1.0.1
13059
+ * @param {0 | 1 | 2} scaleMode - 缩放模式, 0: 窗口铺满, 1: 等比缩放大边铺满, 2: 等比缩放小边铺满
13060
+ */ _proto.setScaleMode = function setScaleMode(scaleMode) {
13061
+ if ([
13062
+ 0,
13063
+ 1,
13064
+ 2
13065
+ ].includes(+scaleMode)) {
13066
+ var _this_contentControl_setScaleMode, _this_contentControl;
13067
+ this.scaleMode = +scaleMode;
13068
+ (_this_contentControl = this.contentControl) == null ? void 0 : (_this_contentControl_setScaleMode = _this_contentControl.setScaleMode) == null ? void 0 : _this_contentControl_setScaleMode.call(_this_contentControl, +scaleMode);
13069
+ var classList = this.$container.classList;
13070
+ for(var _iterator = _create_for_of_iterator_helper_loose(classList), _step; !(_step = _iterator()).done;){
13071
+ var item = _step.value;
13072
+ if (item.startsWith("" + PREFIX_CLASS + "-scale-mode-")) {
13073
+ classList.remove(item);
13074
+ }
13075
+ }
13076
+ if (this.scaleMode === 0) {
13077
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-full");
13078
+ } else if (this.scaleMode === 1) {
13079
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-auto");
13080
+ } else if (this.scaleMode === 2) {
13081
+ this.$container.classList.add("" + PREFIX_CLASS + "-scale-mode-full-auto");
13082
+ }
13083
+ } else {
13084
+ var _this_logger;
13085
+ (_this_logger = this.logger) == null ? void 0 : _this_logger.warn('scaleMode must be 0 | 1 | 2');
13086
+ }
13087
+ };
13088
+ /**
12638
13089
  * 销毁包括事件、控件 ...
12639
13090
  *
12640
13091
  * Destroy (including events, controls...)
@@ -12685,7 +13136,7 @@
12685
13136
  // ==============================================================================================
12686
13137
  /** 初始化配置项 */ _proto._initOptions = function _initOptions(options) {
12687
13138
  if (options === void 0) options = {};
12688
- var _this_options_loggerOptions;
13139
+ var _this_options_loggerOptions, _this_options_definitionOptions_list, _this_options_definitionOptions, _this_options_videoLevelList;
12689
13140
  this.options = deepmerge(THEME_DEFAULT_OPTIONS, options, {
12690
13141
  clone: false
12691
13142
  });
@@ -12699,7 +13150,7 @@
12699
13150
  }
12700
13151
  if (!this.$container) throw new Error('container option is required!');
12701
13152
  if ([
12702
- 'VIDOE',
13153
+ 'VIDEO',
12703
13154
  'CANVAS'
12704
13155
  ].includes(this.$container.tagName)) {
12705
13156
  throw new Error('container node cannot be video or canvas!');
@@ -12710,7 +13161,15 @@
12710
13161
  }));
12711
13162
  this.logger.log(navigator.userAgent || 'unknown');
12712
13163
  this.logger.log('[Theme Version] ', Theme.THEME_VERSION);
12713
- this.logger.log(JSON.stringify(this.options));
13164
+ if ('container' in this.options) {
13165
+ // JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
13166
+ delete this.options.container;
13167
+ }
13168
+ try {
13169
+ this.logger.log('[options] \n', JSON.stringify(this.options));
13170
+ } catch (error) {
13171
+ this.logger.log('[options] \n', this.options);
13172
+ }
12714
13173
  var language = this.options.language || 'zh';
12715
13174
  var locales = deepmerge({
12716
13175
  zh: zh,
@@ -12722,6 +13181,12 @@
12722
13181
  this.i18n = new I18n(locales, {
12723
13182
  defaultLocale: language
12724
13183
  });
13184
+ // 默认清晰度列表
13185
+ if (((_this_options_definitionOptions = this.options.definitionOptions) == null ? void 0 : (_this_options_definitionOptions_list = _this_options_definitionOptions.list) == null ? void 0 : _this_options_definitionOptions_list.length) > 0 || ((_this_options_videoLevelList = this.options.videoLevelList) == null ? void 0 : _this_options_videoLevelList.length) > 0) {
13186
+ var _this_options_definitionOptions1;
13187
+ this.videoLevelList = ((_this_options_definitionOptions1 = this.options.definitionOptions) == null ? void 0 : _this_options_definitionOptions1.list) || this.options.videoLevelList;
13188
+ }
13189
+ this.setScaleMode(this.options.scaleMode);
12725
13190
  };
12726
13191
  /**
12727
13192
  * 初始化设置类名和设置宽高
@@ -13157,7 +13622,7 @@
13157
13622
  };
13158
13623
  _proto._getRecType = function _getRecType(url) {
13159
13624
  if (this.options.type === 'ezopen' && /^ezopen:\/\//.test(url)) {
13160
- var urlInfo = parseEzopenUrl(url);
13625
+ var urlInfo = distExports$3.parseEzopenUrl(url);
13161
13626
  if (urlInfo.type === 'rec') {
13162
13627
  var _urlInfo_searchParams;
13163
13628
  if (urlInfo.recType === 'cloud' && (urlInfo == null ? void 0 : (_urlInfo_searchParams = urlInfo.searchParams) == null ? void 0 : _urlInfo_searchParams.busType) === '7') {
@@ -13616,7 +14081,7 @@
13616
14081
  zh: zh,
13617
14082
  en: en
13618
14083
  };
13619
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.0';
14084
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.1-alpha.0';
13620
14085
 
13621
14086
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
13622
14087