@ezuikit/player-theme 3.1.8-beta.1 → 3.1.8-beta.2
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/constant.js +2 -2
- package/dist/index.cjs +157 -52
- package/dist/index.esm.js +157 -52
- package/dist/index.umd.js +225 -120
- package/dist/style.css +1 -1
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +31 -2
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v3.1.8-beta.
|
|
3
|
-
* Copyright (c) 2026-
|
|
2
|
+
* @ezuikit/player-theme v3.1.8-beta.2
|
|
3
|
+
* Copyright (c) 2026-10-10 15:37:05 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -365,15 +365,15 @@
|
|
|
365
365
|
var eventemitter3Exports = requireEventemitter3();
|
|
366
366
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
367
367
|
|
|
368
|
-
function _extends$
|
|
369
|
-
_extends$
|
|
368
|
+
function _extends$D() {
|
|
369
|
+
_extends$D = Object.assign || function assign(target) {
|
|
370
370
|
for(var i = 1; i < arguments.length; i++){
|
|
371
371
|
var source = arguments[i];
|
|
372
372
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
373
373
|
}
|
|
374
374
|
return target;
|
|
375
375
|
};
|
|
376
|
-
return _extends$
|
|
376
|
+
return _extends$D.apply(this, arguments);
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* 播放器的类名前缀
|
|
@@ -568,7 +568,7 @@
|
|
|
568
568
|
/** 播放区间播放结束(SDK 层 playbackRange 特性) */ playbackEnd: 'playbackEnd',
|
|
569
569
|
/**
|
|
570
570
|
* 控件相关
|
|
571
|
-
*/ control: _extends$
|
|
571
|
+
*/ control: _extends$D({}, CONTROL_INIT_EVENTS, {
|
|
572
572
|
/** 点击播放播放/暂停按钮 */ play: 'Control.play',
|
|
573
573
|
/** 播放控件销毁 */ playDestroy: 'Control.playDestroy',
|
|
574
574
|
/** 截图 */ capturePicture: 'Control.capturePicture',
|
|
@@ -790,20 +790,22 @@
|
|
|
790
790
|
/**
|
|
791
791
|
* 销毁控件
|
|
792
792
|
*/ _proto.destroy = function destroy() {
|
|
793
|
-
var _this___options, _this_$container_remove, _this_$
|
|
793
|
+
var _this___options, _this_$container, _this_$container_remove, _this_$container1;
|
|
794
794
|
if (this._camelCaseName) {
|
|
795
795
|
this.emit("Control." + this._camelCaseName + "Destroy");
|
|
796
796
|
}
|
|
797
|
-
|
|
797
|
+
// 用可选链与下面的 click 解绑保持一致:destroy() 之后 $container 会被置空,
|
|
798
|
+
// 重复 destroy(例如主题卸载控件后调用方又手动销毁一次)不应抛错
|
|
799
|
+
if (((_this___options = this.__options) == null ? void 0 : _this___options.controlType) !== 'block') (_this_$container = this.$container) == null ? void 0 : _this_$container.removeEventListener('dblclick', this._onDBlClick);
|
|
798
800
|
// 移除 click 监听
|
|
799
801
|
if (this._onClickHandler) {
|
|
800
|
-
var _this_$
|
|
801
|
-
(_this_$
|
|
802
|
+
var _this_$container2;
|
|
803
|
+
(_this_$container2 = this.$container) == null ? void 0 : _this_$container2.removeEventListener('click', this._onClickHandler);
|
|
802
804
|
this._onClickHandler = null;
|
|
803
805
|
}
|
|
804
806
|
this._active = false;
|
|
805
807
|
this.removeAllListeners();
|
|
806
|
-
(_this_$
|
|
808
|
+
(_this_$container1 = this.$container) == null ? void 0 : (_this_$container_remove = _this_$container1.remove) == null ? void 0 : _this_$container_remove.call(_this_$container1);
|
|
807
809
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
808
810
|
this.$container = null;
|
|
809
811
|
};
|
|
@@ -913,15 +915,54 @@
|
|
|
913
915
|
* ```
|
|
914
916
|
*/ Control.supportedPlayTypes = [].concat(PLAY_TYPES);
|
|
915
917
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
+
/**
|
|
919
|
+
* HTML 转义
|
|
920
|
+
*
|
|
921
|
+
* 控件大量使用「模板字符串拼 HTML + innerHTML」的写法,只要拼进去的值来自
|
|
922
|
+
* 播放地址、接口返回或多语言配置,就存在注入风险。能改用 `textContent` /
|
|
923
|
+
* `createElement` 的地方应优先改用 DOM API;确实需要拼字符串时,所有外部
|
|
924
|
+
* 数据都必须先过这个函数。
|
|
925
|
+
*
|
|
926
|
+
* 同时覆盖两种语境:
|
|
927
|
+
* - 文本内容:`<span>${escapeHtml(v)}</span>`
|
|
928
|
+
* - 属性值:`<span title="${escapeHtml(v)}">`
|
|
929
|
+
*
|
|
930
|
+
* @remarks 用一次 `replace` 扫描完成,不存在「先转 `&` 再转其他」导致的二次转义。
|
|
931
|
+
*/ /** 需要转义的字符与对应实体 */ var HTML_ESCAPE_MAP = {
|
|
932
|
+
'&': '&',
|
|
933
|
+
'<': '<',
|
|
934
|
+
'>': '>',
|
|
935
|
+
'"': '"',
|
|
936
|
+
"'": '''
|
|
937
|
+
};
|
|
938
|
+
/**
|
|
939
|
+
* 转义 HTML 中有特殊含义的字符
|
|
940
|
+
*
|
|
941
|
+
* @param value - 任意值,`null` / `undefined` 归一成空字符串
|
|
942
|
+
* @returns 可安全拼进 HTML 文本或双引号属性值的字符串
|
|
943
|
+
* @since 3.1.8
|
|
944
|
+
* @example
|
|
945
|
+
* ```ts
|
|
946
|
+
* escapeHtml('x" onerror="alert(1)'); // 'x" onerror="alert(1)'
|
|
947
|
+
* escapeHtml('<img src=x>'); // '<img src=x>'
|
|
948
|
+
* escapeHtml(undefined); // ''
|
|
949
|
+
* ```
|
|
950
|
+
*/ function escapeHtml(value) {
|
|
951
|
+
if (value === null || value === undefined) return '';
|
|
952
|
+
return String(value).replace(/[&<>"']/g, function(char) {
|
|
953
|
+
return HTML_ESCAPE_MAP[char];
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function _extends$C() {
|
|
958
|
+
_extends$C = Object.assign || function assign(target) {
|
|
918
959
|
for(var i = 1; i < arguments.length; i++){
|
|
919
960
|
var source = arguments[i];
|
|
920
961
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
921
962
|
}
|
|
922
963
|
return target;
|
|
923
964
|
};
|
|
924
|
-
return _extends$
|
|
965
|
+
return _extends$C.apply(this, arguments);
|
|
925
966
|
}
|
|
926
967
|
function _inherits$y(subClass, superClass) {
|
|
927
968
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -952,7 +993,7 @@
|
|
|
952
993
|
function Loading(options) {
|
|
953
994
|
if (options === void 0) options = {};
|
|
954
995
|
var _this;
|
|
955
|
-
_this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$
|
|
996
|
+
_this = Control.call(this, Object.assign({}, LOADING_DEFAULT_OPTIONS, _extends$C({}, options, {
|
|
956
997
|
tagName: 'div',
|
|
957
998
|
controlType: 'block',
|
|
958
999
|
classNameSuffix: 'loading'
|
|
@@ -968,11 +1009,13 @@
|
|
|
968
1009
|
this.$container.innerHTML = this._options.render();
|
|
969
1010
|
} else {
|
|
970
1011
|
var _this_locale;
|
|
971
|
-
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS$1 + "-loading-dot " + PREFIX_CLASS$1 + '-loading-dot-load">\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n </span>\n <div class="' + PREFIX_CLASS$1 + '-loading-text">' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.LOADING) || 'loading...') + "</div>\n ";
|
|
1012
|
+
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS$1 + "-loading-dot " + PREFIX_CLASS$1 + '-loading-dot-load">\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n <i class="' + PREFIX_CLASS$1 + '-loading-dot-item"></i>\n </span>\n <div class="' + PREFIX_CLASS$1 + '-loading-text">' + escapeHtml(((_this_locale = this.locale) == null ? void 0 : _this_locale.LOADING) || 'loading...') + "</div>\n ";
|
|
972
1013
|
}
|
|
973
1014
|
};
|
|
974
1015
|
/**
|
|
975
1016
|
* 动画展示
|
|
1017
|
+
*
|
|
1018
|
+
* @remarks `html` 会原样写入 `innerHTML`,**不做转义**,仅接受可信内容。
|
|
976
1019
|
* @param html 自定义动画内容, 如果不存在则使用默认动画
|
|
977
1020
|
*/ _proto.show = function show(html) {
|
|
978
1021
|
if (html) this.$container.innerHTML = html;
|
|
@@ -990,15 +1033,15 @@
|
|
|
990
1033
|
return Loading;
|
|
991
1034
|
}(Control);
|
|
992
1035
|
|
|
993
|
-
function _extends$
|
|
994
|
-
_extends$
|
|
1036
|
+
function _extends$B() {
|
|
1037
|
+
_extends$B = Object.assign || function assign(target) {
|
|
995
1038
|
for(var i = 1; i < arguments.length; i++){
|
|
996
1039
|
var source = arguments[i];
|
|
997
1040
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
998
1041
|
}
|
|
999
1042
|
return target;
|
|
1000
1043
|
};
|
|
1001
|
-
return _extends$
|
|
1044
|
+
return _extends$B.apply(this, arguments);
|
|
1002
1045
|
}
|
|
1003
1046
|
function _inherits$x(subClass, superClass) {
|
|
1004
1047
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -1034,7 +1077,7 @@
|
|
|
1034
1077
|
function Poster(options) {
|
|
1035
1078
|
if (options === void 0) options = {};
|
|
1036
1079
|
var _this;
|
|
1037
|
-
_this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$
|
|
1080
|
+
_this = Control.call(this, Object.assign({}, POSTER_OPTIONS, _extends$B({}, options, {
|
|
1038
1081
|
tagName: 'div',
|
|
1039
1082
|
controlType: 'block',
|
|
1040
1083
|
classNameSuffix: 'poster'
|
|
@@ -1061,16 +1104,21 @@
|
|
|
1061
1104
|
* 设置封面 这里不对 poster 进行缓存,如果有值优先使用,如果没有值优先使用 初始化传入的值
|
|
1062
1105
|
* @param {string} poster 封面地址或 base64 数据
|
|
1063
1106
|
*/ _proto.setPoster = function setPoster(poster) {
|
|
1064
|
-
var // eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1065
|
-
// prettier-ignore
|
|
1066
|
-
_this_$container_querySelector;
|
|
1067
1107
|
poster = poster != null ? poster : this._options.poster;
|
|
1068
|
-
|
|
1069
|
-
|
|
1108
|
+
// 空值一律清空。原先只判 `=== ''`,poster 为 undefined 时会渲染出
|
|
1109
|
+
// `<img src="undefined">`,浏览器会去请求 ./undefined 再触发 error 回调
|
|
1110
|
+
if (!poster) {
|
|
1111
|
+
this.$container.replaceChildren();
|
|
1070
1112
|
return;
|
|
1071
1113
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1114
|
+
// 用 DOM API 而不是拼 innerHTML:封面地址可能来自远程模板接口或业务动态传入,
|
|
1115
|
+
// 拼进 src="${poster}" 时 `x" onerror="...` 能闭合属性挂上事件处理器
|
|
1116
|
+
var $img = document.createElement('img');
|
|
1117
|
+
$img.className = "" + PREFIX_CLASS$1 + "-poster-img";
|
|
1118
|
+
$img.src = poster;
|
|
1119
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1120
|
+
$img.addEventListener('error', this._imgLoadErrorEvent);
|
|
1121
|
+
this.$container.replaceChildren($img);
|
|
1074
1122
|
};
|
|
1075
1123
|
/**
|
|
1076
1124
|
* 展示封面 这里不对 poster 进行缓存, 如果有值优先使用, 如果没有值优先使用 初始化传入的值
|
|
@@ -1164,7 +1212,9 @@
|
|
|
1164
1212
|
var attrStr = '';
|
|
1165
1213
|
if (attr) {
|
|
1166
1214
|
Object.keys(attr).forEach(function(key) {
|
|
1167
|
-
|
|
1215
|
+
// 属性值必须转义:所有控件的 title 都来自 options.locales,
|
|
1216
|
+
// 不转义时 `x" onmouseover="alert(1)` 这样的文案可以闭合属性并挂上事件
|
|
1217
|
+
if (!(attr[key] === undefined || attr[key] === null)) attrStr += key + '="' + escapeHtml(attr[key]) + '"';
|
|
1168
1218
|
});
|
|
1169
1219
|
}
|
|
1170
1220
|
return '<span class="' + PREFIX_CLASS$1 + "-icon " + PREFIX_CLASS$1 + "-icon-" + type + '" ' + attrStr + ">" + svg + "</span>";
|
|
@@ -1328,15 +1378,15 @@
|
|
|
1328
1378
|
}
|
|
1329
1379
|
};
|
|
1330
1380
|
|
|
1331
|
-
function _extends$
|
|
1332
|
-
_extends$
|
|
1381
|
+
function _extends$A() {
|
|
1382
|
+
_extends$A = Object.assign || function assign(target) {
|
|
1333
1383
|
for(var i = 1; i < arguments.length; i++){
|
|
1334
1384
|
var source = arguments[i];
|
|
1335
1385
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
1336
1386
|
}
|
|
1337
1387
|
return target;
|
|
1338
1388
|
};
|
|
1339
|
-
return _extends$
|
|
1389
|
+
return _extends$A.apply(this, arguments);
|
|
1340
1390
|
}
|
|
1341
1391
|
function _inherits$w(subClass, superClass) {
|
|
1342
1392
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -1367,7 +1417,7 @@
|
|
|
1367
1417
|
function Message(options) {
|
|
1368
1418
|
if (options === void 0) options = {};
|
|
1369
1419
|
var _this;
|
|
1370
|
-
_this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$
|
|
1420
|
+
_this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$A({}, options, {
|
|
1371
1421
|
tagName: 'div',
|
|
1372
1422
|
controlType: 'block'
|
|
1373
1423
|
}))) || this, _this._$toast = null;
|
|
@@ -1419,7 +1469,8 @@
|
|
|
1419
1469
|
this._$toast = document.createElement('div');
|
|
1420
1470
|
this._$toast.classList.add("" + PREFIX_CLASS$1 + "-toast");
|
|
1421
1471
|
}
|
|
1422
|
-
|
|
1472
|
+
// msg 是 EVENTS.message 的载荷,内核与接口的错误信息都走这个通道,必须转义
|
|
1473
|
+
this._$toast.innerHTML = '<div class="' + PREFIX_CLASS$1 + '-toast-content">' + this._getIcon(type) + '<span class="' + PREFIX_CLASS$1 + "-toast-msg " + PREFIX_CLASS$1 + "-toast-" + type + '">' + escapeHtml(msg) + "</span></div>";
|
|
1423
1474
|
this.options.rootContainer.appendChild(this._$toast);
|
|
1424
1475
|
if (duration > 0) {
|
|
1425
1476
|
this._toastTimer = setTimeout(function() {
|
|
@@ -1451,7 +1502,7 @@
|
|
|
1451
1502
|
//
|
|
1452
1503
|
this.$container.innerHTML = this.options.render(msg, duration, type);
|
|
1453
1504
|
} else {
|
|
1454
|
-
this.$container.innerHTML = '<div class="' + PREFIX_CLASS$1 + "-message-content " + PREFIX_CLASS$1 + "-message-" + type + '">' + (msg
|
|
1505
|
+
this.$container.innerHTML = '<div class="' + PREFIX_CLASS$1 + "-message-content " + PREFIX_CLASS$1 + "-message-" + type + '">' + escapeHtml(msg) + "</div>";
|
|
1455
1506
|
}
|
|
1456
1507
|
//
|
|
1457
1508
|
this.$container.style.display = 'flex';
|
|
@@ -1524,15 +1575,15 @@
|
|
|
1524
1575
|
if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
|
|
1525
1576
|
return Constructor;
|
|
1526
1577
|
}
|
|
1527
|
-
function _extends$
|
|
1528
|
-
_extends$
|
|
1578
|
+
function _extends$z() {
|
|
1579
|
+
_extends$z = Object.assign || function assign(target) {
|
|
1529
1580
|
for(var i = 1; i < arguments.length; i++){
|
|
1530
1581
|
var source = arguments[i];
|
|
1531
1582
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
1532
1583
|
}
|
|
1533
1584
|
return target;
|
|
1534
1585
|
};
|
|
1535
|
-
return _extends$
|
|
1586
|
+
return _extends$z.apply(this, arguments);
|
|
1536
1587
|
}
|
|
1537
1588
|
function _inherits$v(subClass, superClass) {
|
|
1538
1589
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -1561,7 +1612,7 @@
|
|
|
1561
1612
|
_inherits$v(Play, Control);
|
|
1562
1613
|
function Play(options) {
|
|
1563
1614
|
var _this;
|
|
1564
|
-
_this = Control.call(this, _extends$
|
|
1615
|
+
_this = Control.call(this, _extends$z({}, options, {
|
|
1565
1616
|
tagName: 'span',
|
|
1566
1617
|
controlType: 'button',
|
|
1567
1618
|
classNameSuffix: 'play'
|
|
@@ -3077,15 +3128,15 @@
|
|
|
3077
3128
|
if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
|
|
3078
3129
|
return Constructor;
|
|
3079
3130
|
}
|
|
3080
|
-
function _extends$
|
|
3081
|
-
_extends$
|
|
3131
|
+
function _extends$y() {
|
|
3132
|
+
_extends$y = Object.assign || function assign(target) {
|
|
3082
3133
|
for(var i = 1; i < arguments.length; i++){
|
|
3083
3134
|
var source = arguments[i];
|
|
3084
3135
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
3085
3136
|
}
|
|
3086
3137
|
return target;
|
|
3087
3138
|
};
|
|
3088
|
-
return _extends$
|
|
3139
|
+
return _extends$y.apply(this, arguments);
|
|
3089
3140
|
}
|
|
3090
3141
|
function _inherits$u(subClass, superClass) {
|
|
3091
3142
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -3124,7 +3175,7 @@
|
|
|
3124
3175
|
if (options === void 0) options = {};
|
|
3125
3176
|
var _this;
|
|
3126
3177
|
var _this__options_props, _this__options_props1, _this__options_props2, _this__options_props3;
|
|
3127
|
-
_this = Control.call(this, _extends$
|
|
3178
|
+
_this = Control.call(this, _extends$y({}, options, {
|
|
3128
3179
|
tagName: 'span',
|
|
3129
3180
|
classNameSuffix: 'volume',
|
|
3130
3181
|
controlType: 'button'
|
|
@@ -3260,9 +3311,9 @@
|
|
|
3260
3311
|
// 这里不要用 click 事件,因为拖动音量大小时鼠标移动到图标上会触发 click
|
|
3261
3312
|
// prettier-ignore
|
|
3262
3313
|
delegate(this.$container, "." + PREFIX_CLASS$1 + "-control-volume", "mousedown", function() {
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3314
|
+
// 禁用判断交给 _toggleMute 里的 this.disabled(状态是权威来源,
|
|
3315
|
+
// class 只是它的呈现),避免两处各判一遍
|
|
3316
|
+
_this._toggleMute();
|
|
3266
3317
|
});
|
|
3267
3318
|
};
|
|
3268
3319
|
_create_class$h(Volume, [
|
|
@@ -3987,15 +4038,15 @@
|
|
|
3987
4038
|
return Fullscreen;
|
|
3988
4039
|
}();
|
|
3989
4040
|
|
|
3990
|
-
function _extends$
|
|
3991
|
-
_extends$
|
|
4041
|
+
function _extends$x() {
|
|
4042
|
+
_extends$x = Object.assign || function assign(target) {
|
|
3992
4043
|
for(var i = 1; i < arguments.length; i++){
|
|
3993
4044
|
var source = arguments[i];
|
|
3994
4045
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
3995
4046
|
}
|
|
3996
4047
|
return target;
|
|
3997
4048
|
};
|
|
3998
|
-
return _extends$
|
|
4049
|
+
return _extends$x.apply(this, arguments);
|
|
3999
4050
|
}
|
|
4000
4051
|
function _inherits$t(subClass, superClass) {
|
|
4001
4052
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -4025,7 +4076,7 @@
|
|
|
4025
4076
|
function Fullscreen(options) {
|
|
4026
4077
|
var _this;
|
|
4027
4078
|
var _options_props, _this_options;
|
|
4028
|
-
_this = Control.call(this, _extends$
|
|
4079
|
+
_this = Control.call(this, _extends$x({
|
|
4029
4080
|
tagName: 'span',
|
|
4030
4081
|
classNameSuffix: 'fullscreen',
|
|
4031
4082
|
controlType: 'button'
|
|
@@ -4090,15 +4141,15 @@
|
|
|
4090
4141
|
return Fullscreen;
|
|
4091
4142
|
}(Control);
|
|
4092
4143
|
|
|
4093
|
-
function _extends$
|
|
4094
|
-
_extends$
|
|
4144
|
+
function _extends$w() {
|
|
4145
|
+
_extends$w = Object.assign || function assign(target) {
|
|
4095
4146
|
for(var i = 1; i < arguments.length; i++){
|
|
4096
4147
|
var source = arguments[i];
|
|
4097
4148
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
4098
4149
|
}
|
|
4099
4150
|
return target;
|
|
4100
4151
|
};
|
|
4101
|
-
return _extends$
|
|
4152
|
+
return _extends$w.apply(this, arguments);
|
|
4102
4153
|
}
|
|
4103
4154
|
function _inherits$s(subClass, superClass) {
|
|
4104
4155
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -4128,7 +4179,7 @@
|
|
|
4128
4179
|
function Rec(options) {
|
|
4129
4180
|
var _this;
|
|
4130
4181
|
var _options_props;
|
|
4131
|
-
_this = Control.call(this, _extends$
|
|
4182
|
+
_this = Control.call(this, _extends$w({}, options, {
|
|
4132
4183
|
tagName: 'div',
|
|
4133
4184
|
controlType: 'block',
|
|
4134
4185
|
classNameSuffix: 'rec'
|
|
@@ -5743,15 +5794,15 @@
|
|
|
5743
5794
|
return Content;
|
|
5744
5795
|
}(EventEmitter);
|
|
5745
5796
|
|
|
5746
|
-
function _extends$
|
|
5747
|
-
_extends$
|
|
5797
|
+
function _extends$v() {
|
|
5798
|
+
_extends$v = Object.assign || function assign(target) {
|
|
5748
5799
|
for(var i = 1; i < arguments.length; i++){
|
|
5749
5800
|
var source = arguments[i];
|
|
5750
5801
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
5751
5802
|
}
|
|
5752
5803
|
return target;
|
|
5753
5804
|
};
|
|
5754
|
-
return _extends$
|
|
5805
|
+
return _extends$v.apply(this, arguments);
|
|
5755
5806
|
}
|
|
5756
5807
|
function _inherits$q(subClass, superClass) {
|
|
5757
5808
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -5780,7 +5831,7 @@
|
|
|
5780
5831
|
_inherits$q(More, Control);
|
|
5781
5832
|
function More(options) {
|
|
5782
5833
|
var _this;
|
|
5783
|
-
_this = Control.call(this, _extends$
|
|
5834
|
+
_this = Control.call(this, _extends$v({}, options, {
|
|
5784
5835
|
tagName: 'span',
|
|
5785
5836
|
controlType: 'button',
|
|
5786
5837
|
classNameSuffix: 'more'
|
|
@@ -6543,15 +6594,15 @@
|
|
|
6543
6594
|
if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
|
|
6544
6595
|
return Constructor;
|
|
6545
6596
|
}
|
|
6546
|
-
function _extends$
|
|
6547
|
-
_extends$
|
|
6597
|
+
function _extends$u() {
|
|
6598
|
+
_extends$u = Object.assign || function assign(target) {
|
|
6548
6599
|
for(var i = 1; i < arguments.length; i++){
|
|
6549
6600
|
var source = arguments[i];
|
|
6550
6601
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6551
6602
|
}
|
|
6552
6603
|
return target;
|
|
6553
6604
|
};
|
|
6554
|
-
return _extends$
|
|
6605
|
+
return _extends$u.apply(this, arguments);
|
|
6555
6606
|
}
|
|
6556
6607
|
function _inherits$p(subClass, superClass) {
|
|
6557
6608
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -6584,7 +6635,7 @@
|
|
|
6584
6635
|
_inherits$p(Zoom, Control);
|
|
6585
6636
|
function Zoom(options) {
|
|
6586
6637
|
var _this;
|
|
6587
|
-
_this = Control.call(this, _extends$
|
|
6638
|
+
_this = Control.call(this, _extends$u({}, options, {
|
|
6588
6639
|
tagName: 'span',
|
|
6589
6640
|
controlType: 'button',
|
|
6590
6641
|
classNameSuffix: 'zoom'
|
|
@@ -6719,18 +6770,18 @@
|
|
|
6719
6770
|
*/
|
|
6720
6771
|
function _create_class$f(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 ZOOM_DEFAULT_POSITION=[0,0],DefaultOptions$1={initialZoom:1,defaultCursor:"pointer",scrollVelocity:.1,animDuration:.25,allowZoom:true,allowPan:true,onChange:function(){},onTranslateChange:function(){},onTap:function(){},max:8,min:1,zoomStep:.1,allowTouchEvents:false,allowWheel:true,ignoredMouseButtons:[],doubleTouchMaxDelay:300,decelerationDuration:750},Zoom=function(){function Zoom(container,options){var _this=this;this._dragging=false,this.destroy=function(){_this.setAllowZoom(false),_this.reset(),_this.removeEventListeners();},this.setTransform=function(trans){_this.transform=trans;},this.getTransform=function(){return _this.transform},this.updateTranslate=function(){var translateX=0,translateY=0;translateX=_this.percentPos[0]<0?_this.percentPos[0]<-0.5*(_this.zoom-1)?-0.5*(_this.zoom-1):_this.percentPos[0]:_this.percentPos[0]>.5*(_this.zoom-1)?.5*(_this.zoom-1):_this.percentPos[0],translateY=_this.percentPos[1]<0?_this.percentPos[1]<-0.5*(_this.zoom-1)?-0.5*(_this.zoom-1):_this.percentPos[1]:_this.percentPos[1]>.5*(_this.zoom-1)?.5*(_this.zoom-1):_this.percentPos[1],_this.percentPos=[translateX,translateY];},this.update=function(){_this.container&&(_this.updateTranslate(),_this.container.style.transition="transform ease-out "+_this.transition+"s",_this.container.style.transform="translate3d("+100*_this.percentPos[0]+"%, "+100*_this.percentPos[1]+"%, 0) scale("+_this.zoom+")");},this.setAllowZoom=function(allow){_this.options.allowZoom=allow;},this.setZoom=function(zoom,reset){zoom=parseFloat(zoom.toFixed(_this.getPrecision(_this.options.zoomStep))),_this.zoom!==zoom&&(_this.zoom=zoom,_this.update(),null==_this.options.onChange||_this.options.onChange.call(_this.options,+_this.zoom.toFixed(_this.getPrecision(_this.options.zoomStep)),reset));},this.getZoom=function(){return _this.zoom},this.setPos=function(pos){var _this_container,_this_container1,containerWidth=null==(_this_container=_this.container)?void 0:_this_container.clientWidth,containerHeight=null==(_this_container1=_this.container)?void 0:_this_container1.clientHeight;+_this.pos[0]===pos[0]&&+_this.pos[1]===pos[1]||(_this.percentPos=[pos[0]/containerWidth,pos[1]/containerHeight],_this.update(),null==_this.options.onTranslateChange||_this.options.onTranslateChange.call(_this.options,{posX:pos[0],posY:pos[1]}));},this.setTransitionDuration=function(duration){_this.transition=duration,_this.update();},this.setCursor=function(cursor){_this.container&&(_this.container.style.cssText+="cursor:"+cursor+";",_this.cursor=cursor);},this.zoomIn=function(value){var _this_options_max,_this_options_max1,newPosX=_this.pos[0],newPosY=_this.pos[1],prevZoom=_this.zoom,newZoom=prevZoom+value<(null!=(_this_options_max=_this.options.max)?_this_options_max:8)?prevZoom+value:null!=(_this_options_max1=_this.options.max)?_this_options_max1:8;newZoom!==prevZoom&&(newPosX=newPosX*(newZoom-1)/(prevZoom>1?prevZoom-1:prevZoom),newPosY=newPosY*(newZoom-1)/(prevZoom>1?prevZoom-1:prevZoom)),_this.setZoom(newZoom),_this.setPos([newPosX,newPosY]),_this.setTransitionDuration(_this.options.animDuration);},this.zoomOut=function(value){var _this_options_min,_this_options_min1,newPosX=_this.pos[0],newPosY=_this.pos[1],prevZoom=_this.zoom,newZoom=prevZoom-value>(null!=(_this_options_min=_this.options.min)?_this_options_min:1)?prevZoom-value:null!=(_this_options_min1=_this.options.min)?_this_options_min1:1;newZoom!==prevZoom&&(newPosX=newPosX*(newZoom-1)/(prevZoom-1),newPosY=newPosY*(newZoom-1)/(prevZoom-1)),_this.setZoom(newZoom),_this.setPos([newPosX,newPosY]),_this.setTransitionDuration(_this.options.animDuration);},this.zoomToZone=function(relX,relY,relWidth,relHeight){var _this_container;if(_this.container){var _this_options_max,newPosX=_this.pos[0],newPosY=_this.pos[1],parentRect=(null==(_this_container=_this.container)?void 0:_this_container.parentNode).getBoundingClientRect(),prevZoom=_this.zoom,optimalZoomX=parentRect.width/relWidth,optimalZoomY=parentRect.height/relHeight,newZoom=Math.min(optimalZoomX,optimalZoomY,null!=(_this_options_max=_this.options.max)?_this_options_max:8),rect=_this.container.getBoundingClientRect(),_ref=[rect.width/prevZoom/2,rect.height/prevZoom/2],_ref1=[relX+relWidth/2,relY+relHeight/2];newPosX=(_ref[0]-_ref1[0])*newZoom,newPosY=(_ref[1]-_ref1[1])*newZoom,_this.setZoom(newZoom),_this.setPos([newPosX,newPosY]),_this.setTransitionDuration(_this.options.animDuration);}},this.getNewPosition=function(x,y,newZoom){var prevZoom=[_this.zoom,_this.pos[0],_this.pos[1]][0];if(1===newZoom||!_this)return ZOOM_DEFAULT_POSITION;var _ref1=[_this.container.clientWidth,_this.container.clientHeight],clientWidth=_ref1[0],clientHeight=_ref1[1];if(newZoom>prevZoom)return [0,0];var w=-(x-clientWidth/2)/(clientWidth/2)*newZoom/2,h=-(y-clientHeight/2)/(clientHeight/2)*newZoom/2;return w>newZoom/2-.5&&(w=3.5),h>newZoom/2-.5&&(h=3.5),[clientWidth*w,clientHeight*h]},this.fullZoomInOnPosition=function(x,y){var _this_options_max,zoom=null!=(_this_options_max=_this.options.max)?_this_options_max:DefaultOptions$1.max;_this.setZoom(null!=zoom?zoom:DefaultOptions$1.max),_this.setPos(_this.getNewPosition(x,y,zoom)),_this.setTransitionDuration(_this.options.animDuration);},this.getLimitedShift=function(shift,minLimit,maxLimit,minElement,maxElement){if(shift>0){if(minElement>minLimit)return 0;if(minElement+shift>minLimit)return minLimit-minElement}else if(shift<0){if(maxElement<maxLimit)return 0;if(maxElement+shift<maxLimit)return maxLimit-maxElement}return shift},this.getCursor=function(canMoveOnX,canMoveOnY){return canMoveOnX&&canMoveOnY?"move":canMoveOnX?"ew-resize":canMoveOnY?"ns-resize":"auto"},this.move=function(shiftX,shiftY,transitionDuration){if(void 0===transitionDuration&&(transitionDuration=0),_this.container){var newPosX=_this.pos[0],newPosY=_this.pos[1],rect=_this.container.getBoundingClientRect(),parentRect=_this.container.parentNode.getBoundingClientRect(),shiftHorizontal=_this.transform?shiftY:shiftX,shiftVertical=_this.transform?shiftX:shiftY,_ref=_this.transform?[rect.height>parentRect.bottom-parentRect.top,shiftVertical>0&&rect.top-parentRect.top<0,shiftVertical<0&&rect.bottom-parentRect.bottom>0]:[rect.width>parentRect.right-parentRect.left,shiftHorizontal>0&&rect.left-parentRect.left<0,shiftHorizontal<0&&rect.right-parentRect.right>0],canMoveOnX=_ref[0]||_ref[1]||_ref[2];canMoveOnX&&(_this.transform?newPosX+=_this.getLimitedShift(shiftVertical,parentRect.top,parentRect.bottom,rect.top,rect.bottom):newPosX+=_this.getLimitedShift(shiftHorizontal,parentRect.left,parentRect.right,rect.left,rect.right));var _ref1=_this.transform?[rect.width>parentRect.right-parentRect.left,shiftHorizontal>0&&rect.right-parentRect.right<0,shiftHorizontal<0&&rect.left-parentRect.left>0]:[rect.height>parentRect.bottom-parentRect.top,shiftVertical>0&&rect.top-parentRect.top<0,shiftVertical<0&&rect.bottom-parentRect.bottom>0],canMoveOnY=_ref1[0]||_ref1[1]||_ref1[2];if(canMoveOnY)if(_this.transform){newPosY+=function(shift,minLimit,maxLimit,minElement,maxElement){if(shift>0){if(maxElement<maxLimit+1)return 0;if(maxElement+shift<maxLimit+1)return maxLimit-maxElement}else if(shift<0){if(minElement+1>minLimit)return 0;if(minElement+1+shift>minLimit)return minLimit-minElement}return shift}(shiftHorizontal,parentRect.left,parentRect.right,rect.left,rect.right);}else newPosY+=_this.getLimitedShift(shiftVertical,parentRect.top,parentRect.bottom,rect.top,rect.bottom);var cursor=_this.getCursor(canMoveOnX,canMoveOnY);_this.setPos([newPosX,newPosY]),_this.setCursor(cursor),_this.setTransitionDuration(transitionDuration);}},this.isDoubleTapping=function(){var _this_lastTouchTime,_this_options_doubleTouchMaxDelay,_this_lastDoubleTapTime,_this_options_doubleTouchMaxDelay1,touchTime=(new Date).getTime();return touchTime-(null!=(_this_lastTouchTime=_this.lastTouchTime)?_this_lastTouchTime:0)<(null!=(_this_options_doubleTouchMaxDelay=_this.options.doubleTouchMaxDelay)?_this_options_doubleTouchMaxDelay:300)&&touchTime-(null!=(_this_lastDoubleTapTime=_this.lastDoubleTapTime)?_this_lastDoubleTapTime:0)>(null!=(_this_options_doubleTouchMaxDelay1=_this.options.doubleTouchMaxDelay)?_this_options_doubleTouchMaxDelay1:750)?(_this.lastDoubleTapTime=touchTime,true):(_this.lastTouchTime=touchTime,false)},this.startDeceleration=function(lastShiftOnX,lastShiftOnY){var startTimestamp=null,startDecelerationMove=function(timestamp){null===startTimestamp&&(startTimestamp=timestamp);var _this_options_decelerationDuration,_this_options_decelerationDuration1,_this_options_decelerationDuration2,progress=timestamp-startTimestamp,ratio=((null!=(_this_options_decelerationDuration=_this.options.decelerationDuration)?_this_options_decelerationDuration:750)-progress)/(null!=(_this_options_decelerationDuration1=_this.options.decelerationDuration)?_this_options_decelerationDuration1:750),_ref=[lastShiftOnX*ratio,lastShiftOnY*ratio],shiftX=_ref[0],shiftY=_ref[1];progress<(null!=(_this_options_decelerationDuration2=_this.options.decelerationDuration)?_this_options_decelerationDuration2:750)&&Math.max(Math.abs(shiftX),Math.abs(shiftY))>1?(_this.move(shiftX,shiftY,0),_this.lastRequestAnimationId=requestAnimationFrame(startDecelerationMove)):_this.lastRequestAnimationId=null;};_this.lastRequestAnimationId=requestAnimationFrame(startDecelerationMove);},this.reset=function(){_this.setZoom(_this.options.initialZoom,true),_this.cursor=_this.options.defaultCursor,_this.setTransitionDuration(_this.options.animDuration),_this.setPos(ZOOM_DEFAULT_POSITION);},this.addScale=function(scale){ void 0===scale&&(scale=1),_this.handleZoomAdd(scale);},this.handleZoomAdd=function(scale){if(void 0===scale&&(scale=1),_this.options.allowZoom&&_this.options.allowWheel){var _this_options_max,newZoom=parseFloat((_this.zoom+scale).toFixed(_this.getPrecision(_this.options.zoomStep)));newZoom>(null!=(_this_options_max=_this.options.max)?_this_options_max:8)&&(newZoom=8),_this.setZoom(newZoom),_this.setPos(_this.pos),_this.setTransitionDuration(.05);}},this.subScale=function(scale){ void 0===scale&&(scale=1),_this.handleZoomSub(scale);},this.handleZoomSub=function(scale){if(void 0===scale&&(scale=1),_this.options.allowZoom&&_this.options.allowWheel){var newZoom=parseFloat((_this.zoom-scale).toFixed(_this.getPrecision(_this.options.zoomStep)));newZoom<1&&(newZoom=1),_this.setZoom(newZoom),_this.setPos(_this.pos),_this.setTransitionDuration(.05);}},this.handleMouseWheel=function(event){if(event.preventDefault(),_this.options.allowZoom&&_this.options.allowWheel){var _this_options_max,_this_options_min,velocity=event.deltaY<0?_this.options.scrollVelocity:0-_this.options.scrollVelocity,newZoom=parseFloat(Math.max(Math.min(_this.zoom+velocity,null!=(_this_options_max=_this.options.max)?_this_options_max:8),null!=(_this_options_min=_this.options.min)?_this_options_min:1).toFixed(_this.getPrecision(_this.options.zoomStep)));_this.setZoom(newZoom),_this.setTransitionDuration(.05);}},this.handleMouseStart=function(event){var _this_options_ignoredMouseButtons;event.preventDefault(),_this.options.allowPan&&!(null==(_this_options_ignoredMouseButtons=_this.options.ignoredMouseButtons)?void 0:_this_options_ignoredMouseButtons.includes(event.button))&&(_this._dragging=true,_this.lastRequestAnimationId&&cancelAnimationFrame(_this.lastRequestAnimationId),_this.lastCursor=_this.getCoordinates(event));},this.handleMouseMove=function(event){event.preventDefault(),_this.options.allowPan&&_this.lastCursor&&_this._dragging&&_this._touchOrMouseDrag(event);},this.handleMouseStop=function(event){event.preventDefault(),_this.lastShift&&(_this.startDeceleration(_this.lastShift[0],_this.lastShift[1]),_this.lastShift=null),_this.lastCursor=null,_this.setCursor("auto"),_this._dragging=false;},this.handleTouchStart=function(event){var isThisDoubleTapping=_this.isDoubleTapping();_this.isMultiTouch=event.touches.length,_this.options.allowTouchEvents||event.preventDefault(),_this.lastRequestAnimationId&&cancelAnimationFrame(_this.lastRequestAnimationId);var _this_getCoordinates=_this.getCoordinates(event.touches[0]),posX=_this_getCoordinates[0],posY=_this_getCoordinates[1];if(_this.isMultiTouch>1)_this.lastCursor=[posX,posY];else if(isThisDoubleTapping&&_this.options.allowZoom)if(1===_this.zoom){var _this_container_getBoundingClientRect=_this.container.getBoundingClientRect();_this_container_getBoundingClientRect.top,_this_container_getBoundingClientRect.left;var ref,ref1,x=_this_container_getBoundingClientRect.x,y=_this_container_getBoundingClientRect.y;posX=(ref1=[posX-(x=(ref=_this.transform?[y,x]:[x,y])[0]),posY-(y=ref[1])])[0],posY=ref1[1],_this.fullZoomInOnPosition(posX,posY);}else _this.reset();else _this._tapStartTime=(new Date).getTime(),_this.options.allowPan&&(_this.lastCursor=[posX,posY]);},this.handleTouchMove=function(event){if(_this.options.allowTouchEvents||event.preventDefault(),_this.lastCursor)if(1===_this.isMultiTouch)_this._touchOrMouseDrag(event.touches[0]),_this.lastTouchDistance=null;else if(_this.isMultiTouch>1){var newZoom=_this.zoom,_this_getCoordinates=_this.getCoordinates(event.touches[0]),pos1X=_this_getCoordinates[0],pos1Y=_this_getCoordinates[1],_this_getCoordinates1=_this.getCoordinates(event.touches[1]),pos2X=_this_getCoordinates1[0],pos2Y=_this_getCoordinates1[1],distance=Math.sqrt(Math.pow(pos2X-pos1X,2)+Math.pow(pos2Y-pos1Y,2));if(_this.lastTouchDistance&&distance&&distance!==_this.lastTouchDistance){var _this_options_max,_this_options_min,_this_options_max1;if(_this.options.allowZoom)if((newZoom+=(distance-_this.lastTouchDistance)/100)>(null!=(_this_options_max=_this.options.max)?_this_options_max:8))newZoom=null!=(_this_options_max1=_this.options.max)?_this_options_max1:8;else if(newZoom<(null!=(_this_options_min=_this.options.min)?_this_options_min:1)){var _this_options_min1;newZoom=null!=(_this_options_min1=_this.options.min)?_this_options_min1:1;}_this.setZoom(newZoom),_this.setTransitionDuration(0);}_this.lastCursor=[pos1X,pos1Y],_this.lastTouchDistance=distance;}},this.handleTouchStop=function(){_this.lastShift&&(_this.startDeceleration(_this.lastShift[0],_this.lastShift[1]),_this.lastShift=null),_this._tapStartTime&&(new Date).getTime()-_this._tapStartTime<200&&(null==_this.options.onTap||_this.options.onTap.call(_this.options)),_this._tapStartTime=void 0,_this.lastCursor=null,_this.lastTouchDistance=null,_this.isMultiTouch=0;},this.container=container,this.options=Object.assign({},DefaultOptions$1,options||{}),this.percentPos=ZOOM_DEFAULT_POSITION,this.transition=this.options.animDuration,this.zoom=1,this.cursor="auto",this.lastCursor=[0,0],this.lastShift=null,this.lastTouchDistance=null,this.lastRequestAnimationId=null,this.lastTouchTime=(new Date).getTime(),this.lastDoubleTapTime=(new Date).getTime(),this.transform=false,this.isMultiTouch=1,this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseStart=this.handleMouseStart.bind(this),this.handleMouseStop=this.handleMouseStop.bind(this),this.handleMouseWheel=this.handleMouseWheel.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchStop=this.handleTouchStop.bind(this),this.getZoom=this.getZoom.bind(this),this.setZoom=this.setZoom.bind(this);}var _proto=Zoom.prototype;return _proto.setUpEventListeners=function(){var refCurrentValue=this.container;window.matchMedia("(pointer: fine)").matches?(this.options.allowWheel&&(null==refCurrentValue||refCurrentValue.addEventListener("wheel",this.handleMouseWheel,{passive:false})),null==refCurrentValue||refCurrentValue.addEventListener("mousedown",this.handleMouseStart,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("mousemove",this.handleMouseMove,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("mouseup",this.handleMouseStop,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("mouseleave",this.handleMouseStop,{passive:false})):(null==refCurrentValue||refCurrentValue.addEventListener("touchstart",this.handleTouchStart,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("touchmove",this.handleTouchMove,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("touchend",this.handleTouchStop,{passive:false}),null==refCurrentValue||refCurrentValue.addEventListener("touchcancel",this.handleTouchStop,{passive:false}));},_proto.removeEventListeners=function(){var refCurrentValue=this.container;window.matchMedia("(pointer: fine)").matches?(this.options.allowWheel&&(null==refCurrentValue||refCurrentValue.removeEventListener("wheel",this.handleMouseWheel)),null==refCurrentValue||refCurrentValue.removeEventListener("mousedown",this.handleMouseStart),null==refCurrentValue||refCurrentValue.removeEventListener("mousemove",this.handleMouseMove),null==refCurrentValue||refCurrentValue.removeEventListener("mouseup",this.handleMouseStop),null==refCurrentValue||refCurrentValue.removeEventListener("mouseleave",this.handleMouseStop)):(null==refCurrentValue||refCurrentValue.removeEventListener("touchstart",this.handleTouchStart),null==refCurrentValue||refCurrentValue.removeEventListener("touchmove",this.handleTouchMove),null==refCurrentValue||refCurrentValue.removeEventListener("touchend",this.handleTouchStop),null==refCurrentValue||refCurrentValue.removeEventListener("touchcancel",this.handleTouchStop));},_proto.getPrecision=function(value){ void 0===value&&(value=1);var valueStr=value.toString();return valueStr.includes(".")?valueStr.split(".")[1].length:1},_proto.getCoordinates=function(event){var clientHeight=this.container.clientHeight,clientTop=this.container.clientTop,clientLeft=this.container.clientLeft,_ref=this.transform?[event.clientY,clientHeight-event.clientX]:[event.clientX-clientTop,event.clientY-clientLeft];return [_ref[0],_ref[1]]},_proto._touchOrMouseDrag=function(event){if(this.lastCursor){var _this_getCoordinates=this.getCoordinates(event),posX=_this_getCoordinates[0],posY=_this_getCoordinates[1],shiftX=posX-this.lastCursor[0],shiftY=posY-this.lastCursor[1];this.move(shiftX,shiftY,0),this.lastCursor=[posX,posY],this.lastShift=[shiftX,shiftY];}},_create_class$f(Zoom,[{key:"pos",get:function(){return [this.container.clientWidth*this.percentPos[0],this.container.clientHeight*this.percentPos[1]]}}]),Zoom}();Zoom.VERSION="1.0.0-beta.2";
|
|
6721
6772
|
|
|
6722
|
-
function _extends$
|
|
6723
|
-
_extends$
|
|
6773
|
+
function _extends$t() {
|
|
6774
|
+
_extends$t = Object.assign || function assign(target) {
|
|
6724
6775
|
for(var i = 1; i < arguments.length; i++){
|
|
6725
6776
|
var source = arguments[i];
|
|
6726
6777
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6727
6778
|
}
|
|
6728
6779
|
return target;
|
|
6729
6780
|
};
|
|
6730
|
-
return _extends$
|
|
6781
|
+
return _extends$t.apply(this, arguments);
|
|
6731
6782
|
}
|
|
6732
6783
|
function __zoom(theme, container, options) {
|
|
6733
|
-
theme.zoomUtil = new Zoom(container, _extends$
|
|
6784
|
+
theme.zoomUtil = new Zoom(container, _extends$t({}, options || {}, {
|
|
6734
6785
|
min: 1,
|
|
6735
6786
|
onChange: function onChange(zoom, reset) {
|
|
6736
6787
|
if (zoom !== theme._zoom) {
|
|
@@ -6881,11 +6932,14 @@
|
|
|
6881
6932
|
*/ function getThemeDataByTemplate(theme, id) {
|
|
6882
6933
|
return _async_to_generator$7(function() {
|
|
6883
6934
|
var _theme_options_token_httpToken, _theme_options_token, // 中止上一个在途请求,并为本次请求创建可中止的信号(destroy 时会 abort)
|
|
6884
|
-
_theme__templateAbortController, url, controller;
|
|
6935
|
+
_theme__templateAbortController, accessToken, url, controller;
|
|
6885
6936
|
return _ts_generator$7(this, function(_state) {
|
|
6886
6937
|
switch(_state.label){
|
|
6887
6938
|
case 0:
|
|
6888
|
-
|
|
6939
|
+
accessToken = theme.options.accessToken || ((_theme_options_token = theme.options.token) == null ? void 0 : (_theme_options_token_httpToken = _theme_options_token.httpToken) == null ? void 0 : _theme_options_token_httpToken.url);
|
|
6940
|
+
// 查询参数逐个 encodeURIComponent,防止 `&` `#` `=` 等字符注入额外参数或截断 URL(SECURITY_AUDIT M1)
|
|
6941
|
+
// 不用 `new URL()`:env.domain 允许为空(同源相对路径)或带路径前缀,URL 构造会抛错或丢掉前缀
|
|
6942
|
+
url = theme.options.env.domain + "/api/service/media/template/getDetail?accessToken=" + encodeURIComponent(String(accessToken)) + "&id=" + encodeURIComponent(String(id));
|
|
6889
6943
|
(_theme__templateAbortController = theme._templateAbortController) == null ? void 0 : _theme__templateAbortController.abort();
|
|
6890
6944
|
controller = new AbortController();
|
|
6891
6945
|
theme._templateAbortController = controller;
|
|
@@ -6967,15 +7021,15 @@
|
|
|
6967
7021
|
});
|
|
6968
7022
|
};
|
|
6969
7023
|
}
|
|
6970
|
-
function _extends$
|
|
6971
|
-
_extends$
|
|
7024
|
+
function _extends$s() {
|
|
7025
|
+
_extends$s = Object.assign || function assign(target) {
|
|
6972
7026
|
for(var i = 1; i < arguments.length; i++){
|
|
6973
7027
|
var source = arguments[i];
|
|
6974
7028
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6975
7029
|
}
|
|
6976
7030
|
return target;
|
|
6977
7031
|
};
|
|
6978
|
-
return _extends$
|
|
7032
|
+
return _extends$s.apply(this, arguments);
|
|
6979
7033
|
}
|
|
6980
7034
|
function _ts_generator$6(thisArg, body) {
|
|
6981
7035
|
var f, y, t, _ = {
|
|
@@ -7111,7 +7165,7 @@
|
|
|
7111
7165
|
}
|
|
7112
7166
|
if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
|
|
7113
7167
|
// TODO: 因为回放是一组, 位置以第一个位置为准
|
|
7114
|
-
recControls.push(recControls[0] ? _extends$
|
|
7168
|
+
recControls.push(recControls[0] ? _extends$s({}, item, {
|
|
7115
7169
|
part: recControls[0].part
|
|
7116
7170
|
}) : item);
|
|
7117
7171
|
return false;
|
|
@@ -7134,7 +7188,7 @@
|
|
|
7134
7188
|
}
|
|
7135
7189
|
if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
|
|
7136
7190
|
// TODO: 因为回放是一组, 位置以第一个位置为准
|
|
7137
|
-
recControls.push(recControls[0] ? _extends$
|
|
7191
|
+
recControls.push(recControls[0] ? _extends$s({}, item, {
|
|
7138
7192
|
part: recControls[0].part
|
|
7139
7193
|
}) : item);
|
|
7140
7194
|
return false;
|
|
@@ -7213,7 +7267,9 @@
|
|
|
7213
7267
|
];
|
|
7214
7268
|
// 渲染主题模板
|
|
7215
7269
|
themeData = TEMPLATES[data];
|
|
7216
|
-
|
|
7270
|
+
// 修复:此前判的是 `!data`,而这个分支里 data 必然是非空字符串,告警永远不会发出,
|
|
7271
|
+
// 传了不存在的模板名只会静默返回 undefined。应当判查表结果。
|
|
7272
|
+
if (!themeData) {
|
|
7217
7273
|
(_theme_logger = theme.logger) == null ? void 0 : _theme_logger.warn("Theme template " + data + " is not exist!");
|
|
7218
7274
|
themeData = null;
|
|
7219
7275
|
}
|
|
@@ -7396,15 +7452,15 @@
|
|
|
7396
7452
|
return Component;
|
|
7397
7453
|
}();
|
|
7398
7454
|
|
|
7399
|
-
function _extends$
|
|
7400
|
-
_extends$
|
|
7455
|
+
function _extends$r() {
|
|
7456
|
+
_extends$r = Object.assign || function assign(target) {
|
|
7401
7457
|
for(var i = 1; i < arguments.length; i++){
|
|
7402
7458
|
var source = arguments[i];
|
|
7403
7459
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
7404
7460
|
}
|
|
7405
7461
|
return target;
|
|
7406
7462
|
};
|
|
7407
|
-
return _extends$
|
|
7463
|
+
return _extends$r.apply(this, arguments);
|
|
7408
7464
|
}
|
|
7409
7465
|
function _inherits$o(subClass, superClass) {
|
|
7410
7466
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -7430,22 +7486,22 @@
|
|
|
7430
7486
|
_inherits$o(Footer, Component);
|
|
7431
7487
|
function Footer(options) {
|
|
7432
7488
|
if (options === void 0) options = {};
|
|
7433
|
-
return Component.call(this, _extends$
|
|
7489
|
+
return Component.call(this, _extends$r({}, options, {
|
|
7434
7490
|
cType: 'footer'
|
|
7435
7491
|
})) || this;
|
|
7436
7492
|
}
|
|
7437
7493
|
return Footer;
|
|
7438
7494
|
}(Component);
|
|
7439
7495
|
|
|
7440
|
-
function _extends$
|
|
7441
|
-
_extends$
|
|
7496
|
+
function _extends$q() {
|
|
7497
|
+
_extends$q = Object.assign || function assign(target) {
|
|
7442
7498
|
for(var i = 1; i < arguments.length; i++){
|
|
7443
7499
|
var source = arguments[i];
|
|
7444
7500
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
7445
7501
|
}
|
|
7446
7502
|
return target;
|
|
7447
7503
|
};
|
|
7448
|
-
return _extends$
|
|
7504
|
+
return _extends$q.apply(this, arguments);
|
|
7449
7505
|
}
|
|
7450
7506
|
function _inherits$n(subClass, superClass) {
|
|
7451
7507
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -7471,7 +7527,7 @@
|
|
|
7471
7527
|
_inherits$n(Header, Component);
|
|
7472
7528
|
function Header(options) {
|
|
7473
7529
|
if (options === void 0) options = {};
|
|
7474
|
-
return Component.call(this, _extends$
|
|
7530
|
+
return Component.call(this, _extends$q({}, options, {
|
|
7475
7531
|
cType: 'header'
|
|
7476
7532
|
})) || this;
|
|
7477
7533
|
}
|
|
@@ -7634,15 +7690,15 @@
|
|
|
7634
7690
|
};
|
|
7635
7691
|
}
|
|
7636
7692
|
|
|
7637
|
-
function _extends$
|
|
7638
|
-
_extends$
|
|
7693
|
+
function _extends$p() {
|
|
7694
|
+
_extends$p = Object.assign || function assign(target) {
|
|
7639
7695
|
for(var i = 1; i < arguments.length; i++){
|
|
7640
7696
|
var source = arguments[i];
|
|
7641
7697
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
7642
7698
|
}
|
|
7643
7699
|
return target;
|
|
7644
7700
|
};
|
|
7645
|
-
return _extends$
|
|
7701
|
+
return _extends$p.apply(this, arguments);
|
|
7646
7702
|
}
|
|
7647
7703
|
function _inherits$m(subClass, superClass) {
|
|
7648
7704
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -7671,7 +7727,7 @@
|
|
|
7671
7727
|
*/ var GlobalFullscreen = /*#__PURE__*/ function(Fullscreen) {
|
|
7672
7728
|
_inherits$m(GlobalFullscreen, Fullscreen);
|
|
7673
7729
|
function GlobalFullscreen(options) {
|
|
7674
|
-
return Fullscreen.call(this, _extends$
|
|
7730
|
+
return Fullscreen.call(this, _extends$p({}, options, {
|
|
7675
7731
|
controlType: 'button',
|
|
7676
7732
|
classNameSuffix: 'global-fullscreen'
|
|
7677
7733
|
})) || this;
|
|
@@ -7702,15 +7758,15 @@
|
|
|
7702
7758
|
return GlobalFullscreen;
|
|
7703
7759
|
}(Fullscreen);
|
|
7704
7760
|
|
|
7705
|
-
function _extends$
|
|
7706
|
-
_extends$
|
|
7761
|
+
function _extends$o() {
|
|
7762
|
+
_extends$o = Object.assign || function assign(target) {
|
|
7707
7763
|
for(var i = 1; i < arguments.length; i++){
|
|
7708
7764
|
var source = arguments[i];
|
|
7709
7765
|
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
7710
7766
|
}
|
|
7711
7767
|
return target;
|
|
7712
7768
|
};
|
|
7713
|
-
return _extends$
|
|
7769
|
+
return _extends$o.apply(this, arguments);
|
|
7714
7770
|
}
|
|
7715
7771
|
function _inherits$l(subClass, superClass) {
|
|
7716
7772
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -7739,7 +7795,7 @@
|
|
|
7739
7795
|
_inherits$l(CapturePicture, Control);
|
|
7740
7796
|
function CapturePicture(options) {
|
|
7741
7797
|
var _this;
|
|
7742
|
-
_this = Control.call(this, _extends$
|
|
7798
|
+
_this = Control.call(this, _extends$o({}, options, {
|
|
7743
7799
|
tagName: 'span',
|
|
7744
7800
|
classNameSuffix: 'capture-picture'
|
|
7745
7801
|
})) || this, _this._timer = null;
|
|
@@ -7793,11 +7849,11 @@
|
|
|
7793
7849
|
}(Control);
|
|
7794
7850
|
|
|
7795
7851
|
/*
|
|
7796
|
-
* @ezuikit/control-ptz
|
|
7797
|
-
* Copyright (c) 2026-
|
|
7852
|
+
* @ezuikit/control-ptz v2.0.0-beta.1
|
|
7853
|
+
* Copyright (c) 2026-10-10 15:13:21 Ezviz-OpenBiz
|
|
7798
7854
|
* Released under the MIT License.
|
|
7799
7855
|
*/
|
|
7800
|
-
var PTZ_DEFAULT_OPTIONS={language:"zh",env:{domain:"https://open.ys7.com"},accessToken:"",speed:2,locales:{zh:{GET_PTZ_STATUS:"获取当前云台状态",GET_PTZ_STATUS_FAILED:"未加载Theme模块,无法获取云台状态",MOBILE_HIDE_PTZ:"移动端,非全屏状态不展示云台",OPTION_PTZ_FAILED:"未加载Theme模块,无法操作云台",MOBILE_PTZ_TIPS:"请通过操控云台来调整摄像机视角",PTZ_FAST:"快",PTZ_MID:"中",PTZ_SLOW:"慢",PTZ_SPEED:"调整云台转动速度",DEVICE_ZOOM:"控制设备放大/缩小画面",DEVICE_FOCUS:"调整设备焦距"},en:{GET_PTZ_STATUS:"Get current PTZ status",GET_PTZ_STATUS_FAILED:"Theme module is not loaded, PTZ status cannot be obtained",MOBILE_HIDE_PTZ:"Mobile terminal, PTZ is not displayed in non-full screen state",OPTION_PTZ_FAILED:"Theme module is not loaded, PTZ cannot be operated",MOBILE_PTZ_TIPS:"Adjust camera angle by manipulating gimbal",PTZ_FAST:"F",PTZ_MID:"M",PTZ_SLOW:"S",PTZ_SPEED:"Adjust the PTZ rotation speed",DEVICE_ZOOM:"Control the device to zoom in/out of the screen",DEVICE_FOCUS:"Adjusting the device's focal length"}}},PTZ_SPEED={1:1,2:3,3:7,slow:1,mid:3,fast:7},BasePtz=function(){function BasePtz(container,options){var _this_options_locales,_this_options_locales1,_this_options_locales2;if(void 0===options&&(options={}),!container)throw new Error("Ptz container is required");(this.options=deepmerge(PTZ_DEFAULT_OPTIONS,options,{clone:false}),null==(_this_options_locales=this.options.locales)?void 0:_this_options_locales[this.options.language])?this.locale=null==(_this_options_locales1=this.options.locales)?void 0:_this_options_locales1[this.options.language]:this.locale=null==(_this_options_locales2=this.options.locales)?void 0:_this_options_locales2.zh;this.$container=container,this.speed=PTZ_SPEED[this.options.speed||2];}var _proto=BasePtz.prototype;return _proto.updateOptions=function(options){this.options=deepmerge(this.options,options,{clone:false});},_proto.destroy=function(){},BasePtz}();function _set_prototype_of$1$3(o,p){return _set_prototype_of$1$3=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$3(o,p)}var MobilePtz=function(BasePtz){function MobilePtz(container,options){var _this;return (_this=BasePtz.call(this,container,options)||this)._touchstart=_this._touchstart.bind(_this),_this._touchend=_this._touchend.bind(_this),_this._render(),_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$3(subClass,superClass);}(MobilePtz,BasePtz);var _proto=MobilePtz.prototype;return _proto.destroy=function(){this._removeEventListener(),this.$content&&(this.$content.remove(),this.$content=null),BasePtz.prototype.destroy.call(this);},_proto._render=function(){this.$content=document.createElement("div"),this.$content.classList.add("ez-mobile-ptz-content"),this.$content.innerHTML='\n <div class="ez-mobile-ptz-wrap">\n <div class="ez-mobile-ptz-container">\n <div class="ez-mobile-ptz-center ez-mobile-ptz-center"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-top ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-left ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-bottom ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-right ez-mobile-ptz-default"></div>\n </div>\n </div>\n ',this.$container.appendChild(this.$content),this._addEventListener();},_proto._addEventListener=function(){var $warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),touchstart="PointerEvent"in window?"pointerdown":"touchstart",touchend="PointerEvent"in window?"pointerup":"touchend";$warp&&($warp.addEventListener(touchstart,this._touchstart),$warp.addEventListener(touchend,this._touchend));},_proto._touchstart=function(e){e.preventDefault(),this._handlePtzTouch(e,"start");},_proto._touchend=function(e){e.preventDefault(),this._handlePtzTouch(e,"stop");},_proto._removeEventListener=function(){var $warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),touchstart="PointerEvent"in window?"pointerdown":"touchstart",touchend="PointerEvent"in window?"pointerup":"touchend";$warp&&($warp.removeEventListener(touchstart,this._touchstart),$warp.removeEventListener(touchend,this._touchend));},_proto._handlePtzTouch=function(e,type){var _this_options_token_deviceToken,_this_options_token,_e_changedTouches_,_e_changedTouches_1,_this_options_env,_this_options_token_deviceToken1,_this_options_token1;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token.deviceToken)?void 0:_this_options_token_deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");var _this_options_env1,$warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),rect=$warp.getBoundingClientRect(),containerCenterX=rect.left+130,containerCenterY=rect.top+130,left=(e.x||(null==(_e_changedTouches_=e.changedTouches[0])?void 0:_e_changedTouches_.clientX))-containerCenterX,top=(e.y||(null==(_e_changedTouches_1=e.changedTouches[0])?void 0:_e_changedTouches_1.clientY))-containerCenterY,direction=0,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken1=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken1.video),$icons=$warp.querySelectorAll(".ez-mobile-ptz-icon");(Math.abs(left)>Math.abs(top)?left>0?(direction=3,$icons[3].className=$icons[3].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):(direction=2,$icons[1].className=$icons[1].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):top>0?(direction=1,$icons[2].className=$icons[2].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):(direction=0,$icons[0].className=$icons[0].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")),$warp.style.cssText="background-image:linear-gradient("+(0===direction?180:1===direction?0:2===direction?90:270)+"deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)","stop"===type)&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop",$warp.style.cssText="",$icons[3].className=$icons[3].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[1].className=$icons[1].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[2].className=$icons[2].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[0].className=$icons[0].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"));var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{direction:direction,speed:this.speed,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed","1"),data.append("direction",direction+""),data.append("accessToken",token),fetch(url,{method:"POST",body:data}).then(function(response){return response.json()}).then(function(rt){200===rt.code||[60005,60002,60003,60004].includes(+rt.code)&&($warp.style.cssText="background-image:linear-gradient("+(0===direction?180:1===direction?0:2===direction?90:270)+"deg, #f45656 0%, rgba(100,143,252,0.00) 50%)"),null==operationResultCb||operationResultCb(rt);}).catch(function(err){}).finally(function(){operationResultCb=null;});},MobilePtz}(BasePtz);function asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value;}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw);}function _async_to_generator$5(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"throw",err);}_next(void 0);})}}function _create_class$e(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 _set_prototype_of$o(o,p){return _set_prototype_of$o=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$o(o,p)}function _ts_generator$5(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),"function"==typeof Symbol&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e],y=0;}finally{f=t=0;}if(5&op[0])throw op[1];return {value:op[0]?op[1]:void 0,done:true}}([n,v])}}}var Ptz$1=function(BasePtz){function Ptz(container,options){var _this;return void 0===options&&(options={}),(_this=BasePtz.call(this,container,options)||this)._isMobile=distExports$3.isMobile(),_this._isRotate=false,_this._clearTimer=null,_this._$wrapper=document.createElement("div"),_this._$wrapper.className="ez-ptz-container-wrap",_this._$directionCircleContainer=document.createElement("div"),_this._$directionCircleContainer.classList.add("ez-ptz-container"),_this._$directionCircleContainer.innerHTML='\n <div class="ez-ptz-main ez-ptz-direction-center"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top" data-direction="0"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top-left" data-direction="4"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left" data-direction="2"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left-bottom" data-direction="5"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom" data-direction="1"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom-right" data-direction="7"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right" data-direction="3"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right-top" data-direction="6"></div>\n ',_this._$wrapper.appendChild(_this._$directionCircleContainer),_this._$speedContainer=document.createElement("div"),_this._$speedContainer.classList.add("ez-ptz-speed-container"),_this._$speedContainer.innerHTML='\n <div class="ez-ptz-speed-progress" title="'+_this.locale.PTZ_SPEED+'">\n <div class="ez-ptz-speed-progress-line">\n <div class="ez-ptz-speed-progress-line-dot '+(1===_this.speed?"ez-ptz-speed-active":"")+'" data-id="slow" data-index="1" data-value="1"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(3===_this.speed?"ez-ptz-speed-active":"")+'" data-id="mid" data-index="2" data-value="3"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(7===_this.speed?"ez-ptz-speed-active":"")+'" data-id="fast" data-index="3" data-value="7"></div>\n </div>\n <div class="ez-ptz-speed-progress-points">\n <div class="ez-ptz-speed-progress-points-slow">\n '+_this.locale.PTZ_SLOW+'\n </div>\n <div class="ez-ptz-speed-progress-points-mid">\n '+_this.locale.PTZ_MID+'\n </div>\n <div class="ez-ptz-speed-progress-points-fast">\n '+_this.locale.PTZ_FAST+"\n </div>\n </div>\n </div>\n ",_this._$wrapper.appendChild(_this._$speedContainer),_this._$btnContainer=document.createElement("div"),_this._$btnContainer.classList.add("ez-ptz-btn-container"),_this._$btnContainer.innerHTML='\n <div class="ez-ptz-btn-zoom" title="'+_this.locale.DEVICE_ZOOM+'" style="user-select: none;">\n <div class="ez-ptz-btn-zoom-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M563.2 198.4c179.2 0 326.4 147.2 326.4 326.4s-147.2 326.4-326.4 326.4S230.4 704 230.4 524.8s147.2-326.4 332.8-326.4z m0 64c-147.2 0-262.4 115.2-262.4 262.4s115.2 262.4 262.4 262.4 262.4-115.2 262.4-262.4S704 262.4 563.2 262.4z" fill="#ffffff"></path>\n <path d="M691.2 556.8H428.8c-19.2 0-32-12.8-32-32s12.8-32 32-32h262.4c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#ffffff">\n </path>\n <path d="M556.8 691.2c-19.2 0-32-12.8-32-32V396.8c0-19.2 12.8-32 32-32s32 12.8 32 32v262.4c0 19.2-12.8 32-32 32z" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-zoom-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M569.6 838.4c-172.8 0-307.2-140.8-307.2-307.2s140.8-307.2 307.2-307.2 307.2 140.8 307.2 307.2-140.8 307.2-307.2 307.2z m0-64c134.4 0 249.6-108.8 249.6-249.6S704 281.6 569.6 281.6 320 396.8 320 531.2s108.8 243.2 249.6 243.2z" fill="#ffffff"></path>\n <path d="M691.2 563.2H448c-19.2 0-32-12.8-32-32s12.8-38.4 32-38.4h249.6c19.2 0 32 12.8 32 32s-19.2 38.4-38.4 38.4z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n <div class="ez-ptz-btn-focal" title="'+_this.locale.DEVICE_FOCUS+'" style="user-select: none;">\n <div class="ez-ptz-btn-focal-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M646.4 825.6H320c-44.8 0-83.2-38.4-83.2-83.2V409.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6zM320 390.4c-12.8 0-19.2 6.4-19.2 19.2v326.4c0 12.8 6.4 19.2 19.2 19.2h326.4c12.8 0 19.2-6.4 19.2-19.2V409.6c0-12.8-6.4-19.2-19.2-19.2H320z" fill="#ffffff"></path>\n <path d="M396.8 358.4V281.6c0-25.6 25.6-51.2 51.2-51.2h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H704l-6.4-268.8" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-focal-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M320 358.4h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H320c-25.6 0-51.2-25.6-51.2-51.2V409.6c0-25.6 25.6-51.2 51.2-51.2z" fill="#ffffff"></path>\n <path d="M774.4 697.6H704c-19.2 0-32-12.8-32-32s12.8-32 32-32h70.4c12.8 0 19.2-6.4 19.2-19.2V281.6c0-12.8-6.4-19.2-19.2-19.2H448c-12.8 0-19.2 6.4-19.2 19.2v70.4c0 19.2-12.8 32-32 32s-32-12.8-32-25.6V281.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n ',_this._$wrapper.appendChild(_this._$btnContainer),container.appendChild(_this._$wrapper),_this._$directionCircleContainer.onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"start");},_this._$directionCircleContainer.onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"stop");},_this._$directionCircleContainer.ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"start");},_this._$directionCircleContainer.ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"stop");},_this._onSwitchSpeed=function(e){var list=Array.from(_this._$speedContainer.querySelectorAll(".ez-ptz-speed-progress-line-dot"));if(list.includes(e.target)&&!e.target.classList.contains("ez-ptz-speed-active")){list.forEach(function(item){item===e.target?item.classList.add("ez-ptz-speed-active"):item.classList.remove("ez-ptz-speed-active");});var value=e.target.getAttribute("data-value"),index=e.target.getAttribute("data-index");_this.speed=+value,null==_this.options.onSpeedChange||_this.options.onSpeedChange.call(_this.options,+index);}},_this._$speedContainer.onmouseup=_this._onSwitchSpeed,_this._isMobile&&(_this._$speedContainer.ontouchend=_this._onSwitchSpeed),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","stop");}),_this._isMobile&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","stop");})),_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$o(subClass,superClass);}(Ptz,BasePtz);var _proto=Ptz.prototype;return _proto.destroy=function(){this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null),this._$directionCircleContainer&&(this._$directionCircleContainer.remove(),this._$directionCircleContainer=null),this._$speedContainer&&(this._onSwitchSpeed=null,this._$speedContainer.remove(),this._$speedContainer=null),this._$btnContainer&&(this._$btnContainer.remove(),this._$btnContainer=null),this._$wrapper&&(this._$wrapper.remove(),this._$wrapper=null),BasePtz.prototype.destroy.call(this);},_proto._handlePtzTouch=function(e,type){var _this_options_token_deviceToken,_this_options_token,_this_options_env,_this_options_token_deviceToken1,_this_options_token1,_this=this;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token.deviceToken)?void 0:_this_options_token_deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");this._ptzQueue||(this._ptzQueue=Promise.resolve());var container=this._$directionCircleContainer.getBoundingClientRect(),containerCenterX=container.left+(this._$directionCircleContainer.clientWidth+2)/2,containerCenterY=container.top+(this._$directionCircleContainer.clientHeight+2)/2,eventX=e.x||e.changedTouches[0].clientX,eventY=e.y||e.changedTouches[0].clientY,direction=0,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken1=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken1.video),backDeg=0;function getAreaId(x,y){var rad=Math.atan2(y,x);rad<0&&(rad+=2*Math.PI);var deg=rad*(180/Math.PI)-225-12.5;return deg<0&&(deg+=360),Math.floor(deg/45)+1}var _this_options_env1,left=eventX-containerCenterX,top=eventY-containerCenterY;if(this.isRotate)switch(getAreaId(left,top)){case 1:direction=2,backDeg=90;break;case 2:direction=4,backDeg=135;break;case 3:direction=0,backDeg=180;break;case 4:direction=6,backDeg=225;break;case 5:direction=3,backDeg=270;break;case 6:direction=7,backDeg=315;break;case 7:direction=1,backDeg=0;break;case 8:direction=5,backDeg=45;}else switch(getAreaId(left,top)){case 1:direction=0,backDeg=180;break;case 2:direction=6,backDeg=225;break;case 3:direction=3,backDeg=270;break;case 4:direction=7,backDeg=315;break;case 5:direction=1,backDeg=0;break;case 6:direction=5,backDeg=45;break;case 7:direction=2,backDeg=90;break;case 8:direction=4,backDeg=135;}(this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null),this._$directionCircleContainer.style.cssText="start"===type?"background-image:linear-gradient("+backDeg+"deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)":"","stop"===type)&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop");var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{areaId:getAreaId(left,top),direction:direction,backDeg:backDeg,isRotate:this.isRotate,speed:this.speed,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed",this.speed+""),data.append("direction",direction+""),data.append("accessToken",token),this._ptzQueue=this._ptzQueue.then(function(){return _async_to_generator$5(function(){var _this;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return _this=this,[4,fetch(url,{method:"POST",body:data}).then(function(response){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,response.json()];case 1:return [2,_state.sent()]}})})()}).then(function(rt){var _rt_result;null==operationResultCb||operationResultCb(rt);var code=rt.code||(null==rt||null==(_rt_result=rt.result)?void 0:_rt_result.code);return [6e4,60001,60002,60003,60004,60005,60006,10002].includes(+code)&&(_this._$directionCircleContainer.style.cssText="background-image:linear-gradient("+backDeg+"deg, #f45656 0%, rgba(100,143,252,0.00) 30%)"),rt}).catch(function(err){}).finally(function(){operationResultCb=null,"stop"===type&&(_this._clearTimer=setTimeout(function(){_this._$directionCircleContainer.style.cssText="";},1e3));})];case 1:return [2,_state.sent()]}})}).call(_this)}),"stop"===type&&(this._ptzQueue=this._ptzQueue.finally(function(){}));},_proto._handleBtnTouch=function(btn,option,type){var _this_options_token,_this_options_env,_this_options_token_deviceToken,_this_options_token1,_this=this;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)?void 0:_this_options_token.deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");this._ptzOperation||(this._ptzOperation=Promise.resolve());var direction=8;direction="zoom"===btn?"add"===option?8:9:"add"===option?10:11;var _this_options_env1,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken.video);"stop"===type&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop");var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{btn:btn,option:option,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed",this.speed+""),data.append("direction",direction+""),data.append("accessToken",token),this._ptzOperation=this._ptzOperation.then(function(){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,fetch(url,{method:"POST",body:data}).then(function(response){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,response.json()];case 1:return [2,_state.sent()]}})})()}).then(function(rt){return null==operationResultCb||operationResultCb(rt),rt}).catch(function(err){}).finally(function(){operationResultCb=null;})];case 1:return [2,_state.sent()]}})})()}),"stop"===type&&(this._ptzOperation=this._ptzOperation.finally(function(){_this._ptzOperation=null;}));},_create_class$e(Ptz,[{key:"isRotate",get:function(){return this._isRotate},set:function(isRotate){this._isRotate=isRotate;}}]),Ptz}(BasePtz);
|
|
7856
|
+
var PTZ_DEFAULT_OPTIONS={language:"zh",env:{domain:"https://open.ys7.com"},accessToken:"",speed:2,locales:{zh:{GET_PTZ_STATUS:"获取当前云台状态",GET_PTZ_STATUS_FAILED:"未加载Theme模块,无法获取云台状态",MOBILE_HIDE_PTZ:"移动端,非全屏状态不展示云台",OPTION_PTZ_FAILED:"未加载Theme模块,无法操作云台",MOBILE_PTZ_TIPS:"请通过操控云台来调整摄像机视角",PTZ_FAST:"快",PTZ_MID:"中",PTZ_SLOW:"慢",PTZ_SPEED:"调整云台转动速度",DEVICE_ZOOM:"控制设备放大/缩小画面",DEVICE_FOCUS:"调整设备焦距"},en:{GET_PTZ_STATUS:"Get current PTZ status",GET_PTZ_STATUS_FAILED:"Theme module is not loaded, PTZ status cannot be obtained",MOBILE_HIDE_PTZ:"Mobile terminal, PTZ is not displayed in non-full screen state",OPTION_PTZ_FAILED:"Theme module is not loaded, PTZ cannot be operated",MOBILE_PTZ_TIPS:"Adjust camera angle by manipulating gimbal",PTZ_FAST:"F",PTZ_MID:"M",PTZ_SLOW:"S",PTZ_SPEED:"Adjust the PTZ rotation speed",DEVICE_ZOOM:"Control the device to zoom in/out of the screen",DEVICE_FOCUS:"Adjusting the device's focal length"}}},PTZ_SPEED={1:1,2:3,3:7,slow:1,mid:3,fast:7};function asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value;}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw);}function _async_to_generator$5(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"throw",err);}_next(void 0);})}}function _create_class$1$4(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$n(){return _extends$n=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$n.apply(this,arguments)}function _ts_generator$5(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),"function"==typeof Symbol&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e],y=0;}finally{f=t=0;}if(5&op[0])throw op[1];return {value:op[0]?op[1]:void 0,done:true}}([n,v])}}}function _ts_values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return {next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function _type_of$1(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}var PTZ_TIMED_OUT={timeout:true},isTimeout=function(value){return value===PTZ_TIMED_OUT},isSuccess=function(result){var _result_result;return 200===+((null==result?void 0:result.code)||(null==result||null==(_result_result=result.result)?void 0:_result_result.code))},deviceKey=function(cmd){return [cmd.domain,cmd.deviceSerial,cmd.channelNo].join("|")};function withTimeout(promise,ms,onTimeout){return _async_to_generator$5(function(){var timer,timeout,value;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return timeout=new Promise(function(resolve){timer=setTimeout(function(){null==onTimeout||onTimeout(),resolve(PTZ_TIMED_OUT);},ms);}),[4,Promise.race([promise,timeout])];case 1:return value=_state.sent(),clearTimeout(timer),[2,value]}})})()}var BasePtz=function(){function BasePtz(container,options){var _this_options_locales,_this_options_locales1,_this_options_locales2;if(void 0===options&&(options={}),this._destroyed=false,this._unbinds=[],this._press=null,this._pressSeq=0,this._queue=[],this._inflight=null,this._draining=false,!container)throw new Error("Ptz container is required");(this.options=deepmerge(PTZ_DEFAULT_OPTIONS,options),null==(_this_options_locales=this.options.locales)?void 0:_this_options_locales[this.options.language])?this.locale=null==(_this_options_locales1=this.options.locales)?void 0:_this_options_locales1[this.options.language]:this.locale=null==(_this_options_locales2=this.options.locales)?void 0:_this_options_locales2.zh;this.$container=container,this.speed=PTZ_SPEED[this.options.speed||2];}var _proto=BasePtz.prototype;return _proto.updateOptions=function(options){this.options=deepmerge(this.options,options,{clone:false});},_proto.destroy=function(){if(!this._destroyed){this._destroyed=true,this._endPress("destroy"),this._unbinds.forEach(function(off){return off()}),this._unbinds=[];var pendingStartIds=this._queue.filter(function(cmd){return "start"===cmd.type}).map(function(cmd){return cmd.pressId});this._queue=this._queue.filter(function(cmd){return !pendingStartIds.includes(cmd.pressId)}),this._queue.forEach(function(cmd){return cmd.resultCb=null}),this._inflight&&(this._inflight.resultCb=null),this.options={},this.$container=null;}},_proto._listen=function(target,type,fn,opts){target.addEventListener(type,fn,opts),this._unbinds.push(function(){return target.removeEventListener(type,fn,opts)});},_proto._bindPress=function(el,handlers){var _this=this;el.style.touchAction="none",this._listen(el,"contextmenu",function(e){return e.preventDefault()}),"undefined"!=typeof window&&"PointerEvent"in window?(this._listen(el,"pointerdown",function(e){e.isPrimary&&0===e.button&&(e.preventDefault(),e.stopPropagation(),_this._beginPress(el,handlers,e.clientX,e.clientY,e.pointerId,null));}),this._listen(el,"lostpointercapture",function(e){var _this__press;(null==(_this__press=_this._press)?void 0:_this__press.el)===el&&_this._press.pointerId===e.pointerId&&_this._endPress("lost");})):(this._listen(el,"mousedown",function(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),_this._beginPress(el,handlers,e.clientX,e.clientY,null,null));}),this._listen(el,"touchstart",function(e){var touch=e.changedTouches[0];touch&&(e.preventDefault(),e.stopPropagation(),_this._beginPress(el,handlers,touch.clientX,touch.clientY,null,touch.identifier));},{passive:false}));},_proto._onCommandResult=function(_cmd,_result){},_proto._beginPress=function(el,handlers,x,y,pointerId,touchId){var _ref,_this_options_token_deviceToken,_this_options_token,_this_options_env;if(!this._destroyed&&!this._press){var token=this.options.accessToken||(null==(_this_options_token=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token.deviceToken)?void 0:_this_options_token_deviceToken.video);if(token){var begin=handlers.onStart(x,y);if(begin){var id=++this._pressSeq,start=_extends$n({},begin,{pressId:id,type:"start",domain:null!=(_ref=null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)?_ref:"",deviceSerial:String(this.options.deviceSerial),channelNo:String(this.options.channelNo),token:token,resultCb:null}),press={id:id,el:el,pointerId:pointerId,touchId:touchId,start:start,onEnd:handlers.onEnd,unwatch:function(){}};if(this._press=press,press.unwatch=this._watchPress(press),null!==pointerId)try{el.setPointerCapture(pointerId);}catch(_){}this._dispatch(start);}}}},_proto._watchPress=function(press){var _this=this,offs=[],on=function(target,type,fn,capture){ void 0===capture&&(capture=true);var opts={capture:capture,passive:true};target.addEventListener(type,fn,opts),offs.push(function(){return target.removeEventListener(type,fn,opts)});},leaveIfOutside=function(x,y){_this._hitTest(press.el,x,y)||_this._endPress("leave");};if(null!==press.pointerId){var match=function(e){return e.pointerId===press.pointerId};on(window,"pointermove",function(e){return match(e)&&leaveIfOutside(e.clientX,e.clientY)}),on(window,"pointerup",function(e){return match(e)&&_this._endPress("up")}),on(window,"pointercancel",function(e){return match(e)&&_this._endPress("cancel")});}else if(null!==press.touchId){var find=function(e){return Array.prototype.find.call(e.changedTouches,function(t){return t.identifier===press.touchId})};on(window,"touchmove",function(e){var touch=find(e);touch&&leaveIfOutside(touch.clientX,touch.clientY);}),on(window,"touchend",function(e){return find(e)&&_this._endPress("up")}),on(window,"touchcancel",function(e){return find(e)&&_this._endPress("cancel")});}else on(window,"mousemove",function(e){return leaveIfOutside(e.clientX,e.clientY)}),on(window,"mouseup",function(e){return 0===e.button&&_this._endPress("up")});return on(window,"blur",function(e){return e.target===window&&_this._endPress("blur")},false),on(document,"visibilitychange",function(){return "hidden"===document.visibilityState&&_this._endPress("hidden")}),function(){return offs.forEach(function(off){return off()})}},_proto._hitTest=function(el,x,y){var _ref,root=null!=(_ref=null==el.getRootNode?void 0:el.getRootNode.call(el))?_ref:document,hit="function"==typeof root.elementFromPoint?root.elementFromPoint(x,y):document.elementFromPoint(x,y);return !!hit&&el.contains(hit)},_proto._endPress=function(reason){var press=this._press;if(press){if(this._press=null,press.unwatch(),null!==press.pointerId)try{(null==press.el.hasPointerCapture?void 0:press.el.hasPointerCapture.call(press.el,press.pointerId))&&press.el.releasePointerCapture(press.pointerId);}catch(_){}try{null==press.onEnd||press.onEnd.call(press,reason);}catch(err){}this._dispatch(_extends$n({},press.start,{type:"stop",resultCb:null}));}},_proto._dispatch=function(cmd){if(!this._destroyed&&"function"==typeof this.options.onDirection)try{var cb=this.options.onDirection(_extends$n({},cmd.info,{type:cmd.type}));cmd.resultCb="function"==typeof cb?cb:null;}catch(err){}this._queue.push(cmd),this._trimQueue(),this._drain();},_proto._trimQueue=function(){for(var _this,_loop=function(){var startIndex=_this._queue.findIndex(function(cmd){return "start"===cmd.type&&_this1._queue.some(function(c){return "stop"===c.type&&c.pressId===cmd.pressId})});if(startIndex<0)return {v:void 0};var pressId=_this._queue[startIndex].pressId;_this._queue=_this._queue.filter(function(cmd){return cmd.pressId!==pressId});},_this1=this;this._queue.length>10;){var _ret=(_this=this,_loop());if("object"===_type_of$1(_ret))return _ret.v}},_proto._drain=function(){return _async_to_generator$5(function(){var cmd;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:if(this._draining)return [2];this._draining=true,_state.label=1;case 1:_state.trys.push([1,,5,6]),_state.label=2;case 2:return this._queue.length?(cmd=this._queue.shift(),this._inflight=cmd,[4,"start"===cmd.type?this._sendStart(cmd):this._sendStop(cmd)]):[3,4];case 3:return _state.sent(),this._inflight=null,[3,2];case 4:return [3,6];case 5:return this._inflight=null,this._draining=false,[7];case 6:return [2]}})}).call(this)},_proto._sendStart=function(cmd){return _async_to_generator$5(function(){var _this,request,outcome;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return _this=this,[4,withTimeout(request=this._request(cmd),1e4)];case 1:return outcome=_state.sent(),isTimeout(outcome)?(request.then(function(late){_this._finish(cmd,late),late.ok&&_this._needsCompensation(cmd)&&(_this._queue.push(_extends$n({},cmd,{type:"stop",resultCb:null})),_this._drain());}),[2]):(this._finish(cmd,outcome),[2])}})}).call(this)},_proto._needsCompensation=function(cmd){var key=deviceKey(cmd);return (!this._press||deviceKey(this._press.start)!==key)&&!this._queue.some(function(c){return "stop"===c.type&&deviceKey(c)===key})},_proto._sendStop=function(cmd){return _async_to_generator$5(function(){var _this,_loop,outcome,attempt;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:_loop=function(attempt){var controller,result;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return attempt>0?[4,(ms=300*attempt,_async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,new Promise(function(resolve){return setTimeout(resolve,ms)})];case 1:return [2,_state.sent()]}})})())]:[3,2];case 1:_state.sent(),_state.label=2;case 2:return controller="function"==typeof AbortController?new AbortController:void 0,[4,withTimeout(_this._request(cmd,null==controller?void 0:controller.signal),1e4,function(){return null==controller?void 0:controller.abort()})];case 3:return result=_state.sent(),(outcome=isTimeout(result)?{ok:false,retryable:true,error:new Error("ptz stop timeout (10000ms)")}:result).retryable?[2]:[2,"break"]}var ms;})},outcome={ok:false,retryable:true},attempt=0,_state.label=1;case 1:return attempt<=3?(_this=this,[5,_ts_values(_loop(attempt))]):[3,4];case 2:if("break"===_state.sent())return [3,4];_state.label=3;case 3:return attempt++,[3,1];case 4:return this._finish(cmd,outcome),[2]}})}).call(this)},_proto._request=function(cmd,signal){return _async_to_generator$5(function(){var data,url,response,result,error1;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:(data=new FormData).append("deviceSerial",cmd.deviceSerial),data.append("channelNo",cmd.channelNo),data.append("speed",cmd.speed+""),data.append("direction",cmd.direction+""),data.append("accessToken",cmd.token),url=cmd.domain+("start"===cmd.type?"/api/lapp/device/ptz/start":"/api/lapp/device/ptz/stop"),_state.label=1;case 1:return _state.trys.push([1,3,,4]),[4,fetch(url,{method:"POST",body:data,signal:signal,keepalive:"stop"===cmd.type})];case 2:return response=_state.sent(),[3,4];case 3:return [2,{ok:false,retryable:true,error:_state.sent()}];case 4:if(response.status>=500)return [2,{ok:false,retryable:true,error:new Error("ptz "+cmd.type+" HTTP "+response.status)}];_state.label=5;case 5:return _state.trys.push([5,7,,8]),[4,response.json()];case 6:return result=_state.sent(),[2,{ok:isSuccess(result),retryable:false,result:result}];case 7:return error1=_state.sent(),[2,{ok:false,retryable:(left=error1,right=SyntaxError,!(null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)),error:error1}];case 8:return [2]}var left,right;})})()},_proto._finish=function(cmd,outcome){outcome.ok;var resultCb=cmd.resultCb;if(cmd.resultCb=null,!this._destroyed&&"result"in outcome){try{this._onCommandResult(cmd,outcome.result);}catch(err){}try{null==resultCb||resultCb(outcome.result);}catch(err){}}},_create_class$1$4(BasePtz,[{key:"_activePressId",get:function(){var _ref,_this__press;return null!=(_ref=null==(_this__press=this._press)?void 0:_this__press.id)?_ref:null}}]),BasePtz}();function _set_prototype_of$1$3(o,p){return _set_prototype_of$1$3=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$3(o,p)}var PTZ_MOBILE_DIRECTION_UI={0:[0,180],1:[2,0],2:[1,90],3:[3,270]},PTZ_MOBILE_ERROR_CODES=[60005,60002,60003,60004],gradient=function(deg,color){return "linear-gradient("+deg+"deg, "+color+" 0%, rgba(100,143,252,0.00) 50%)"},MobilePtz=function(BasePtz){function MobilePtz(container,options){var _this;return (_this=BasePtz.call(this,container,options)||this)._$wrap=null,_this._$icons=[],_this._render(),_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$3(subClass,superClass);}(MobilePtz,BasePtz);var _proto=MobilePtz.prototype;return _proto.destroy=function(){this._destroyed||(BasePtz.prototype.destroy.call(this),this.$content&&this.$content.remove(),this.$content=null,this._$wrap=null,this._$icons=[]);},_proto._render=function(){var _this=this;this.$content=document.createElement("div"),this.$content.classList.add("ez-mobile-ptz-content"),this.$content.innerHTML='\n <div class="ez-mobile-ptz-wrap">\n <div class="ez-mobile-ptz-container">\n <div class="ez-mobile-ptz-center ez-mobile-ptz-center"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-top ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-left ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-bottom ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-right ez-mobile-ptz-default"></div>\n </div>\n </div>\n ',this.$container.appendChild(this.$content),this._$wrap=this.$content.querySelector(".ez-mobile-ptz-wrap"),this._$icons=Array.from(this.$content.querySelectorAll(".ez-mobile-ptz-icon")),this._$wrap&&this._bindPress(this._$wrap,{onStart:function(x,y){return _this._onStart(x,y)},onEnd:function(){return _this._resetUI()}});},_proto._onCommandResult=function(cmd,rt){if(PTZ_MOBILE_ERROR_CODES.includes(+(null==rt?void 0:rt.code))){var activeId=this._activePressId;null!==activeId&&activeId!==cmd.pressId||this._$wrap&&(this._$wrap.style.backgroundImage=gradient(PTZ_MOBILE_DIRECTION_UI[cmd.direction][1],"#f45656"));}},_proto._onStart=function(x,y){var direction,_this=this,$wrap=this._$wrap,rect=$wrap.getBoundingClientRect(),left=x-(rect.left+rect.width/2),top=y-(rect.top+rect.height/2);direction=Math.abs(left)>Math.abs(top)?left>0?3:2:top>0?1:0;var _PTZ_MOBILE_DIRECTION_UI_direction=PTZ_MOBILE_DIRECTION_UI[direction],iconIndex=_PTZ_MOBILE_DIRECTION_UI_direction[0],deg=_PTZ_MOBILE_DIRECTION_UI_direction[1];return this._$icons.forEach(function($icon,i){return _this._setIconActive($icon,i===iconIndex)}),$wrap.style.backgroundImage=gradient(deg,"#c0ddf1"),{direction:direction,speed:1,info:{direction:direction,speed:this.speed}}},_proto._resetUI=function(){var _this=this;this._$wrap&&(this._$wrap.style.backgroundImage=""),this._$icons.forEach(function($icon){return _this._setIconActive($icon,false)});},_proto._setIconActive=function($icon,active){$icon.classList.remove(active?"ez-mobile-ptz-default":"ez-mobile-ptz-active"),$icon.classList.add(active?"ez-mobile-ptz-active":"ez-mobile-ptz-default");},MobilePtz}(BasePtz);function _create_class$e(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 _set_prototype_of$o(o,p){return _set_prototype_of$o=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$o(o,p)}var PTZ_AREA_MAP={1:[0,180],2:[6,225],3:[3,270],4:[7,315],5:[1,0],6:[5,45],7:[2,90],8:[4,135]},PTZ_AREA_MAP_ROTATE={1:[2,90],2:[4,135],3:[0,180],4:[6,225],5:[3,270],6:[7,315],7:[1,0],8:[5,45]},PTZ_ERROR_CODES=[6e4,60001,60002,60003,60004,60005,60006,10002],PTZ_BUTTONS=[["zoom-add","zoom","add",8],["zoom-sub","zoom","sub",9],["focal-add","focal","add",10],["focal-sub","focal","sub",11]];var Ptz$1=function(BasePtz){function Ptz(container,options){var _this;return void 0===options&&(options={}),(_this=BasePtz.call(this,container,options)||this)._isRotate=false,_this._clearTimer=null,_this._$wrapper=document.createElement("div"),_this._$wrapper.className="ez-ptz-container-wrap",_this._$directionCircleContainer=document.createElement("div"),_this._$directionCircleContainer.classList.add("ez-ptz-container"),_this._$directionCircleContainer.innerHTML='\n <div class="ez-ptz-main ez-ptz-direction-center"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top" data-direction="0"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top-left" data-direction="4"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left" data-direction="2"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left-bottom" data-direction="5"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom" data-direction="1"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom-right" data-direction="7"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right" data-direction="3"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right-top" data-direction="6"></div>\n ',_this._$wrapper.appendChild(_this._$directionCircleContainer),_this._$speedContainer=document.createElement("div"),_this._$speedContainer.classList.add("ez-ptz-speed-container"),_this._$speedContainer.innerHTML='\n <div class="ez-ptz-speed-progress" title="'+_this.locale.PTZ_SPEED+'">\n <div class="ez-ptz-speed-progress-line">\n <div class="ez-ptz-speed-progress-line-dot '+(1===_this.speed?"ez-ptz-speed-active":"")+'" data-id="slow" data-index="1" data-value="1"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(3===_this.speed?"ez-ptz-speed-active":"")+'" data-id="mid" data-index="2" data-value="3"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(7===_this.speed?"ez-ptz-speed-active":"")+'" data-id="fast" data-index="3" data-value="7"></div>\n </div>\n <div class="ez-ptz-speed-progress-points">\n <div class="ez-ptz-speed-progress-points-slow">\n '+_this.locale.PTZ_SLOW+'\n </div>\n <div class="ez-ptz-speed-progress-points-mid">\n '+_this.locale.PTZ_MID+'\n </div>\n <div class="ez-ptz-speed-progress-points-fast">\n '+_this.locale.PTZ_FAST+"\n </div>\n </div>\n </div>\n ",_this._$wrapper.appendChild(_this._$speedContainer),_this._$btnContainer=document.createElement("div"),_this._$btnContainer.classList.add("ez-ptz-btn-container"),_this._$btnContainer.innerHTML='\n <div class="ez-ptz-btn-zoom" title="'+_this.locale.DEVICE_ZOOM+'" style="user-select: none;">\n <div class="ez-ptz-btn-zoom-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M563.2 198.4c179.2 0 326.4 147.2 326.4 326.4s-147.2 326.4-326.4 326.4S230.4 704 230.4 524.8s147.2-326.4 332.8-326.4z m0 64c-147.2 0-262.4 115.2-262.4 262.4s115.2 262.4 262.4 262.4 262.4-115.2 262.4-262.4S704 262.4 563.2 262.4z" fill="#ffffff"></path>\n <path d="M691.2 556.8H428.8c-19.2 0-32-12.8-32-32s12.8-32 32-32h262.4c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#ffffff">\n </path>\n <path d="M556.8 691.2c-19.2 0-32-12.8-32-32V396.8c0-19.2 12.8-32 32-32s32 12.8 32 32v262.4c0 19.2-12.8 32-32 32z" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-zoom-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M569.6 838.4c-172.8 0-307.2-140.8-307.2-307.2s140.8-307.2 307.2-307.2 307.2 140.8 307.2 307.2-140.8 307.2-307.2 307.2z m0-64c134.4 0 249.6-108.8 249.6-249.6S704 281.6 569.6 281.6 320 396.8 320 531.2s108.8 243.2 249.6 243.2z" fill="#ffffff"></path>\n <path d="M691.2 563.2H448c-19.2 0-32-12.8-32-32s12.8-38.4 32-38.4h249.6c19.2 0 32 12.8 32 32s-19.2 38.4-38.4 38.4z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n <div class="ez-ptz-btn-focal" title="'+_this.locale.DEVICE_FOCUS+'" style="user-select: none;">\n <div class="ez-ptz-btn-focal-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M646.4 825.6H320c-44.8 0-83.2-38.4-83.2-83.2V409.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6zM320 390.4c-12.8 0-19.2 6.4-19.2 19.2v326.4c0 12.8 6.4 19.2 19.2 19.2h326.4c12.8 0 19.2-6.4 19.2-19.2V409.6c0-12.8-6.4-19.2-19.2-19.2H320z" fill="#ffffff"></path>\n <path d="M396.8 358.4V281.6c0-25.6 25.6-51.2 51.2-51.2h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H704l-6.4-268.8" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-focal-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M320 358.4h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H320c-25.6 0-51.2-25.6-51.2-51.2V409.6c0-25.6 25.6-51.2 51.2-51.2z" fill="#ffffff"></path>\n <path d="M774.4 697.6H704c-19.2 0-32-12.8-32-32s12.8-32 32-32h70.4c12.8 0 19.2-6.4 19.2-19.2V281.6c0-12.8-6.4-19.2-19.2-19.2H448c-12.8 0-19.2 6.4-19.2 19.2v70.4c0 19.2-12.8 32-32 32s-32-12.8-32-25.6V281.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n ',_this._$wrapper.appendChild(_this._$btnContainer),container.appendChild(_this._$wrapper),_this._bindPress(_this._$directionCircleContainer,{onStart:function(x,y){return _this._onDirectionStart(x,y)},onEnd:function(){return _this._paintDirection(null)}}),PTZ_BUTTONS.forEach(function(param){var cls=param[0],btn=param[1],option=param[2],direction=param[3],$btn=_this._$btnContainer.querySelector(".ez-ptz-btn-"+cls);$btn&&_this._bindPress($btn,{onStart:function(){return {direction:direction,speed:_this.speed,info:{btn:btn,option:option}}}});}),_this._listen(_this._$speedContainer,"click",function(e){return _this._onSwitchSpeed(e)}),_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$o(subClass,superClass);}(Ptz,BasePtz);var _proto=Ptz.prototype;return _proto.destroy=function(){this._destroyed||(BasePtz.prototype.destroy.call(this),this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null),this._$wrapper&&this._$wrapper.remove(),this._$wrapper=null,this._$directionCircleContainer=null,this._$speedContainer=null,this._$btnContainer=null);},_proto._onCommandResult=function(cmd,rt){var _rt_result,_this=this;if("direction"===cmd.tag){var code=+((null==rt?void 0:rt.code)||(null==rt||null==(_rt_result=rt.result)?void 0:_rt_result.code));if(PTZ_ERROR_CODES.includes(code)){var activeId=this._activePressId;null!==activeId&&activeId!==cmd.pressId||(this._paintDirection(cmd.info.backDeg,"#f45656"),null===activeId&&(this._clearTimer=setTimeout(function(){_this._clearTimer=null,_this._paintDirection(null);},1e3)));}}},_proto._onDirectionStart=function(x,y){var rect=this._$directionCircleContainer.getBoundingClientRect(),areaId=function(x,y){var rad=Math.atan2(y,x);rad<0&&(rad+=2*Math.PI);var deg=rad*(180/Math.PI)-225-12.5;return deg<0&&(deg+=360),Math.floor(deg/45)+1}(x-(rect.left+rect.width/2),y-(rect.top+rect.height/2)),_areaId=(this.isRotate?PTZ_AREA_MAP_ROTATE:PTZ_AREA_MAP)[areaId],direction=_areaId[0],backDeg=_areaId[1];return this._paintDirection(backDeg,"#4277FF"),{direction:direction,speed:this.speed,tag:"direction",info:{areaId:areaId,direction:direction,backDeg:backDeg,isRotate:this.isRotate,speed:this.speed}}},_proto._paintDirection=function(backDeg,color){ void 0===color&&(color="#4277FF"),this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null);var $el=this._$directionCircleContainer;$el&&($el.style.backgroundImage=null===backDeg?"":"linear-gradient("+backDeg+"deg, "+color+" 0%, rgba(100,143,252,0.00) 30%)");},_proto._onSwitchSpeed=function(e){var target=e.target,list=Array.from(this._$speedContainer.querySelectorAll(".ez-ptz-speed-progress-line-dot"));if(list.includes(target)&&!target.classList.contains("ez-ptz-speed-active")){list.forEach(function(item){item===target?item.classList.add("ez-ptz-speed-active"):item.classList.remove("ez-ptz-speed-active");});var value=target.getAttribute("data-value"),index=target.getAttribute("data-index");this.speed=+value,null==this.options.onSpeedChange||this.options.onSpeedChange.call(this.options,+index);}},_create_class$e(Ptz,[{key:"isRotate",get:function(){return this._isRotate},set:function(isRotate){this._isRotate=isRotate;}}]),Ptz}(BasePtz);
|
|
7801
7857
|
|
|
7802
7858
|
function _defineProperties$4(target, props) {
|
|
7803
7859
|
for(var i = 0; i < props.length; i++){
|
|
@@ -7911,7 +7967,9 @@
|
|
|
7911
7967
|
this._ptzControl.updateOptions(options);
|
|
7912
7968
|
}
|
|
7913
7969
|
if (this._ptzControl1) {
|
|
7914
|
-
this._ptzControl
|
|
7970
|
+
// 修复:此前误写成 this._ptzControl,移动端扩展区域的云台拿不到新凭据,
|
|
7971
|
+
// 换 accessToken 或切设备后移动端云台会继续用旧值请求
|
|
7972
|
+
this._ptzControl1.updateOptions(options);
|
|
7915
7973
|
}
|
|
7916
7974
|
};
|
|
7917
7975
|
_proto._onSpeedChange = function _onSpeedChange(speed) {
|
|
@@ -9133,7 +9191,13 @@
|
|
|
9133
9191
|
controlType: 'button',
|
|
9134
9192
|
classNameSuffix: 'rec-dropdown'
|
|
9135
9193
|
})) || this;
|
|
9136
|
-
_this._options =
|
|
9194
|
+
_this._options = Object.assign({
|
|
9195
|
+
list: [
|
|
9196
|
+
'rec',
|
|
9197
|
+
'cloudRec',
|
|
9198
|
+
'cloudRecord'
|
|
9199
|
+
]
|
|
9200
|
+
}, options || {});
|
|
9137
9201
|
// H5 端不展示直播/回放切换按钮
|
|
9138
9202
|
if (Utils.isMobile) {
|
|
9139
9203
|
_this.$container.style.display = 'none';
|
|
@@ -9166,7 +9230,8 @@
|
|
|
9166
9230
|
}
|
|
9167
9231
|
};
|
|
9168
9232
|
_proto._render = function _render() {
|
|
9169
|
-
var _this_locale;
|
|
9233
|
+
var _this__options_list, _this_locale;
|
|
9234
|
+
if (((_this__options_list = this._options.list) == null ? void 0 : _this__options_list.length) === 0) ;
|
|
9170
9235
|
this.$container.innerHTML = IconComponents.recDropdown({
|
|
9171
9236
|
title: ((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_REC_DROPDOWN) || '回放'
|
|
9172
9237
|
});
|
|
@@ -9189,8 +9254,8 @@
|
|
|
9189
9254
|
// 打开时按控件在视口中的位置决定对齐方式。
|
|
9190
9255
|
// 此时 picker 已把 $wrapperContent 设为 inline-flex(可测量宽度),
|
|
9191
9256
|
// 而它内部的定位计算还在 requestAnimationFrame 里,改 placement 来得及生效。
|
|
9192
|
-
//
|
|
9193
|
-
if (open
|
|
9257
|
+
// 移动端不适用的判断放在 _adjustPlacement 内部,避免两处各管一半
|
|
9258
|
+
if (open) _this._adjustPlacement();
|
|
9194
9259
|
}
|
|
9195
9260
|
});
|
|
9196
9261
|
this._picker.innerHTML(this._getPanelHTML());
|
|
@@ -9236,7 +9301,7 @@
|
|
|
9236
9301
|
var cloudRecLabel = ((_this_locale = this.locale) == null ? void 0 : _this_locale.REC_DROPDOWN_CLOUD_REC) || '云存储';
|
|
9237
9302
|
var cloudRecordLabel = ((_this_locale1 = this.locale) == null ? void 0 : _this_locale1.REC_DROPDOWN_CLOUD_RECORD) || '云录制';
|
|
9238
9303
|
var localRecLabel = ((_this_locale2 = this.locale) == null ? void 0 : _this_locale2.REC_DROPDOWN_LOCAL_REC) || '本地回放';
|
|
9239
|
-
return '<div class="' + PREFIX_CLASS$1 + '-rec-dropdown-panel">\n <ul class="' + PREFIX_CLASS$1 + '-rec-dropdown-list">\n <li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="cloudRec">\n <span>' + cloudRecLabel +
|
|
9304
|
+
return '<div class="' + PREFIX_CLASS$1 + '-rec-dropdown-panel">\n <ul class="' + PREFIX_CLASS$1 + '-rec-dropdown-list">\n ' + (this._options.list.includes('cloudRec') ? '<li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="cloudRec">\n <span>' + cloudRecLabel + "</span>\n </li>" : '') + "\n " + (this._options.list.includes('cloudRecord') ? '<li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="cloudRecord">\n <span>' + cloudRecordLabel + "</span>\n </li>" : '') + "\n " + (this._options.list.includes('rec') ? ' <li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="rec">\n <span>' + localRecLabel + "</span>\n </li>" : '') + "\n </ul>\n </div>";
|
|
9240
9305
|
};
|
|
9241
9306
|
_proto._bindPanelEvents = function _bindPanelEvents() {
|
|
9242
9307
|
var _this = this;
|
|
@@ -9257,6 +9322,9 @@
|
|
|
9257
9322
|
};
|
|
9258
9323
|
_proto._activeOption = function _activeOption(type) {
|
|
9259
9324
|
var _this__picker;
|
|
9325
|
+
if (!this._options.list.includes(type)) {
|
|
9326
|
+
return;
|
|
9327
|
+
}
|
|
9260
9328
|
if ((_this__picker = this._picker) == null ? void 0 : _this__picker.$body) {
|
|
9261
9329
|
var items = this._picker.$body.querySelectorAll("." + PREFIX_CLASS$1 + "-rec-dropdown-item");
|
|
9262
9330
|
items.forEach(function(item) {
|
|
@@ -9602,8 +9670,9 @@
|
|
|
9602
9670
|
label: 'label',
|
|
9603
9671
|
value: 'value'
|
|
9604
9672
|
},
|
|
9673
|
+
// label 可能来自内核下发的列表,内置实现必须转义
|
|
9605
9674
|
renderLabel: function renderLabel(label) {
|
|
9606
|
-
return "<span>" + (label
|
|
9675
|
+
return "<span>" + escapeHtml(label) + "</span>";
|
|
9607
9676
|
},
|
|
9608
9677
|
onChange: function onChange() {},
|
|
9609
9678
|
onOpenChange: function onOpenChange() {}
|
|
@@ -9718,9 +9787,11 @@
|
|
|
9718
9787
|
var _this__options_fieldNames, _this__options_fieldNames1, _this_locale, _this__picker;
|
|
9719
9788
|
var labelKey = (_ref = (_this__options_fieldNames = this._options.fieldNames) == null ? void 0 : _this__options_fieldNames.label) != null ? _ref : 'label';
|
|
9720
9789
|
var valueKey = (_ref1 = (_this__options_fieldNames1 = this._options.fieldNames) == null ? void 0 : _this__options_fieldNames1.value) != null ? _ref1 : 'value';
|
|
9721
|
-
(_this__picker = this._picker) == null ? void 0 : _this__picker.innerHTML('<div class="' + PREFIX_CLASS$1 + '-select-panel">\n <ul class="' + PREFIX_CLASS$1 + '-select-list">\n ' + list.map(
|
|
9722
|
-
|
|
9723
|
-
|
|
9790
|
+
(_this__picker = this._picker) == null ? void 0 : _this__picker.innerHTML('<div class="' + PREFIX_CLASS$1 + '-select-panel">\n <ul class="' + PREFIX_CLASS$1 + '-select-list">\n ' + list.map(// 列表可能来自内核下发(如 setVideoLevelList 的清晰度列表),
|
|
9791
|
+
// data-value 与标签文本都要转义
|
|
9792
|
+
function(item) {
|
|
9793
|
+
return '\n <li class="' + PREFIX_CLASS$1 + "-select-option " + (+item[valueKey] === _this.value ? "" + PREFIX_CLASS$1 + "-active" : '') + '" data-value="' + escapeHtml(item[valueKey]) + '">\n <span>' + escapeHtml(item[labelKey]) + "</span>\n </li>\n ";
|
|
9794
|
+
}).join('') + "\n </ul>\n " + (Utils.isMobile ? '<div class="' + PREFIX_CLASS$1 + '-select-cancel">\n <span>' + escapeHtml(((_this_locale = this.locale) == null ? void 0 : _this_locale.cancel) || '取消') + "</span>\n </div>" : '') + "\n " + (Utils.isMobile ? '<span class="' + PREFIX_CLASS$1 + '-select-close">' + IconComponents.close() + "</span>" : '') + "\n <div>");
|
|
9724
9795
|
this.list = list;
|
|
9725
9796
|
this._activeOption();
|
|
9726
9797
|
} else if ((list == null ? void 0 : list.length) === 0) {
|
|
@@ -9952,15 +10023,16 @@
|
|
|
9952
10023
|
classNameSuffix: 'definition',
|
|
9953
10024
|
renderLabel: function renderLabel(label, item, list) {
|
|
9954
10025
|
var _list_;
|
|
10026
|
+
// 文案来自 options.locales,name / label 来自内核下发的清晰度列表,都要转义
|
|
9955
10027
|
if ((item == null ? void 0 : item.level) === 'auto') {
|
|
9956
10028
|
var _options_locales_options_language;
|
|
9957
10029
|
var realItem = list.find(function(it) {
|
|
9958
10030
|
return it.level === _assert_this_initialized$1(_this)._level;
|
|
9959
10031
|
});
|
|
9960
|
-
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>";
|
|
10032
|
+
return "<span>" + escapeHtml(options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + escapeHtml((realItem == null ? void 0 : realItem.name) || '') + ")</span>";
|
|
9961
10033
|
}
|
|
9962
10034
|
// 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
|
|
9963
|
-
return "<span>" + (label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || '') + "</span>";
|
|
10035
|
+
return "<span>" + escapeHtml(label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || '') + "</span>";
|
|
9964
10036
|
},
|
|
9965
10037
|
onChange: function onChange(value, item) {
|
|
9966
10038
|
var _options_onChange;
|
|
@@ -9990,7 +10062,8 @@
|
|
|
9990
10062
|
var realItem = _this.list.find(function(it) {
|
|
9991
10063
|
return it.level === _this._level;
|
|
9992
10064
|
});
|
|
9993
|
-
|
|
10065
|
+
// 文案来自 options.locales,realItem.name 来自内核下发的清晰度列表,两者都要转义
|
|
10066
|
+
_this.$container.querySelector("." + PREFIX_CLASS$1 + "-select-btn").innerHTML = "\n <span>" + escapeHtml(options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + escapeHtml((realItem == null ? void 0 : realItem.name) || '') + ")</span>\n ";
|
|
9994
10067
|
} else {
|
|
9995
10068
|
if (_this.value !== _this._level + '') _this.value = _this._level + '';
|
|
9996
10069
|
}
|
|
@@ -10226,7 +10299,8 @@
|
|
|
10226
10299
|
var isMobile1 = distExports$3.isMobile();
|
|
10227
10300
|
if (isMobile1) {
|
|
10228
10301
|
var _this_locale;
|
|
10229
|
-
|
|
10302
|
+
// title 来自 options.locales,必须转义后再拼进属性
|
|
10303
|
+
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS$1 + '-mobile-date-filter" title="' + escapeHtml(((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS$1 + '-mobile-date-filter-value">' + escapeHtml(this._getDateStr()) + "</span>\n " + IconComponents.filter() + "\n <span>";
|
|
10230
10304
|
} else {
|
|
10231
10305
|
var _this_locale1;
|
|
10232
10306
|
this.$container.innerHTML = IconComponents.date({
|
|
@@ -10260,7 +10334,8 @@
|
|
|
10260
10334
|
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
|
|
10261
10335
|
_this.emit(EVENTS$2.control.dateChange, date);
|
|
10262
10336
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value")) {
|
|
10263
|
-
|
|
10337
|
+
// 纯文本,用 textContent 避免把日期字符串交给 HTML 解析器
|
|
10338
|
+
_this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").textContent = _this._getDateStr();
|
|
10264
10339
|
}
|
|
10265
10340
|
}
|
|
10266
10341
|
},
|
|
@@ -10307,7 +10382,7 @@
|
|
|
10307
10382
|
if (date && !change && this._value !== distExports$3.DateTime.format(date, 'YYYY-MM-DD')) {
|
|
10308
10383
|
this._value = distExports$3.DateTime.format(date, 'YYYY-MM-DD');
|
|
10309
10384
|
if (date && this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value")) {
|
|
10310
|
-
this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").
|
|
10385
|
+
this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").textContent = this._getDateStr();
|
|
10311
10386
|
}
|
|
10312
10387
|
}
|
|
10313
10388
|
};
|
|
@@ -10478,7 +10553,8 @@
|
|
|
10478
10553
|
this._value = time;
|
|
10479
10554
|
var valueEl = this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value");
|
|
10480
10555
|
if (valueEl) {
|
|
10481
|
-
|
|
10556
|
+
// time 由调用方传入(setTime 是公开方法),只需纯文本,走 textContent
|
|
10557
|
+
valueEl.textContent = this._getTimeStr();
|
|
10482
10558
|
}
|
|
10483
10559
|
}
|
|
10484
10560
|
};
|
|
@@ -11379,8 +11455,12 @@
|
|
|
11379
11455
|
}
|
|
11380
11456
|
this._progress.setCurrent(currentMs);
|
|
11381
11457
|
};
|
|
11382
|
-
/**
|
|
11383
|
-
|
|
11458
|
+
/**
|
|
11459
|
+
* 没有可用片段信息时退化为整个区间,避免进度条空转
|
|
11460
|
+
*
|
|
11461
|
+
* 两个调用方(`_syncCurrent` 开头、`_updateVisible` 的 `visible` 分支)都已经
|
|
11462
|
+
* 判过 `_hasRange()`,这里不再重复判断。
|
|
11463
|
+
*/ _proto._fallbackToRange = function _fallbackToRange() {
|
|
11384
11464
|
this._progress.setSegment(this._rangeBeginMs, this._rangeEndMs);
|
|
11385
11465
|
};
|
|
11386
11466
|
_proto._hasRange = function _hasRange() {
|
|
@@ -11454,7 +11534,12 @@
|
|
|
11454
11534
|
var _proto = Device.prototype;
|
|
11455
11535
|
_proto._render = function _render() {
|
|
11456
11536
|
var _this___options_props_urlInfo, _this___options_props;
|
|
11457
|
-
|
|
11537
|
+
// deviceSerial 由播放地址解析而来(parseEzopenUrl 对它不做字符校验),
|
|
11538
|
+
// 这里只需要纯文本,用 textContent 从根上避免注入
|
|
11539
|
+
var $span = document.createElement('span');
|
|
11540
|
+
$span.className = PREFIX_CLASS$1 + "-text " + PREFIX_CLASS$1 + "-text-device";
|
|
11541
|
+
$span.textContent = this._splicingString(this.__options.deviceName, (_this___options_props = this.__options.props) == null ? void 0 : (_this___options_props_urlInfo = _this___options_props.urlInfo) == null ? void 0 : _this___options_props_urlInfo.deviceSerial);
|
|
11542
|
+
this.$container.replaceChildren($span);
|
|
11458
11543
|
};
|
|
11459
11544
|
/**
|
|
11460
11545
|
* 更新设备序列号
|
|
@@ -11465,7 +11550,8 @@
|
|
|
11465
11550
|
var $span = this.$container.querySelector("." + PREFIX_CLASS$1 + "-text-device");
|
|
11466
11551
|
var text = this._splicingString(deviceName, deviceSerial);
|
|
11467
11552
|
$span == null ? void 0 : $span.setAttribute('title', text);
|
|
11468
|
-
|
|
11553
|
+
// 设备信息来自 getDeviceInfo 事件(接口/内核数据),同样走 textContent
|
|
11554
|
+
$span.textContent = text;
|
|
11469
11555
|
}
|
|
11470
11556
|
};
|
|
11471
11557
|
_proto._splicingString = function _splicingString(deviceName, deviceSerial) {
|
|
@@ -11861,7 +11947,11 @@
|
|
|
11861
11947
|
theme._footer.destroy();
|
|
11862
11948
|
theme._footer = null;
|
|
11863
11949
|
}
|
|
11950
|
+
// 移除 header / footer 动画暂停监听(挂在 theme 上,需显式解绑)
|
|
11951
|
+
// 修复:此前只置空引用没有解绑,changeTheme 每调用一次就漏一个监听器,
|
|
11952
|
+
// 且引用被清掉后 _renderTheme 里的兜底解绑也永远不会执行
|
|
11864
11953
|
if (theme._onPauseTimingFunc) {
|
|
11954
|
+
theme.removeListener(CLEAR_TIMER_HEADER_FOOTER_ANIMATION, theme._onPauseTimingFunc);
|
|
11865
11955
|
theme._onPauseTimingFunc = null;
|
|
11866
11956
|
}
|
|
11867
11957
|
// 移除首帧同步监听(挂在 theme 上,需显式解绑,避免 changeTheme 累积)
|
|
@@ -12275,10 +12365,8 @@
|
|
|
12275
12365
|
});
|
|
12276
12366
|
// 当移动端 picker 控件打开时需要关闭动画(定时器)
|
|
12277
12367
|
// 暂停 header footer 的动画(定时器)
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
theme._onPauseTimingFunc = null;
|
|
12281
|
-
}
|
|
12368
|
+
// 旧监听的解绑统一在 _unmountedControls 里做(本函数开头已无条件调用过),
|
|
12369
|
+
// 这里不再重复判断
|
|
12282
12370
|
theme._onPauseTimingFunc = function(open) {
|
|
12283
12371
|
if (open) {
|
|
12284
12372
|
var _theme__interactiveResult_clearTimeout, _theme__interactiveResult;
|
|
@@ -12672,6 +12760,17 @@
|
|
|
12672
12760
|
});
|
|
12673
12761
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
12674
12762
|
}
|
|
12763
|
+
function _object_without_properties_loose(source, excluded) {
|
|
12764
|
+
if (source == null) return {};
|
|
12765
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
12766
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
12767
|
+
key = sourceKeys[i];
|
|
12768
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
12769
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
12770
|
+
target[key] = source[key];
|
|
12771
|
+
}
|
|
12772
|
+
return target;
|
|
12773
|
+
}
|
|
12675
12774
|
function _set_prototype_of(o, p) {
|
|
12676
12775
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
12677
12776
|
o.__proto__ = p;
|
|
@@ -13266,10 +13365,16 @@
|
|
|
13266
13365
|
// JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
|
|
13267
13366
|
delete this.options.container;
|
|
13268
13367
|
}
|
|
13368
|
+
// 凭据不进日志:这条 log 在生产产物里依然存在(strip 插件只剥离 console.*,
|
|
13369
|
+
// 不处理 logger 实例方法),直接打印 options 等于把 accessToken 暴露在控制台
|
|
13370
|
+
var _this_options = this.options; _this_options.accessToken; _this_options.token; var loggableOptions = _object_without_properties_loose(_this_options, [
|
|
13371
|
+
"accessToken",
|
|
13372
|
+
"token"
|
|
13373
|
+
]);
|
|
13269
13374
|
try {
|
|
13270
|
-
this.logger.log('[options] \n', JSON.stringify(
|
|
13375
|
+
this.logger.log('[options] \n', JSON.stringify(loggableOptions));
|
|
13271
13376
|
} catch (error) {
|
|
13272
|
-
this.logger.log('[options] \n',
|
|
13377
|
+
this.logger.log('[options] \n', loggableOptions);
|
|
13273
13378
|
}
|
|
13274
13379
|
var language = this.options.language || 'zh';
|
|
13275
13380
|
// 深拷贝内置语言包,避免与模块级 zh/en 常量共享引用(I18n 若对其做合并/修改会污染全局)
|
|
@@ -14342,7 +14447,7 @@
|
|
|
14342
14447
|
zh: zh,
|
|
14343
14448
|
en: en
|
|
14344
14449
|
};
|
|
14345
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.8-beta.
|
|
14450
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.8-beta.2';
|
|
14346
14451
|
|
|
14347
14452
|
// 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
|
|
14348
14453
|
|