@ezuikit/player-theme 3.1.7-beta.4 → 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/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v3.1.7-beta.4
3
- * Copyright (c) 2026-09-28 08:24:45 Ezviz-OpenBiz
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$C() {
369
- _extends$C = Object.assign || function assign(target) {
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$C.apply(this, arguments);
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$C({}, CONTROL_INIT_EVENTS, {
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_$container;
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
- if (((_this___options = this.__options) == null ? void 0 : _this___options.controlType) !== 'block') this.$container.removeEventListener('dblclick', this._onDBlClick);
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_$container1;
801
- (_this_$container1 = this.$container) == null ? void 0 : _this_$container1.removeEventListener('click', this._onClickHandler);
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_$container = this.$container) == null ? void 0 : (_this_$container_remove = _this_$container.remove) == null ? void 0 : _this_$container_remove.call(_this_$container);
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
- function _extends$B() {
917
- _extends$B = Object.assign || function assign(target) {
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
+ '&': '&amp;',
933
+ '<': '&lt;',
934
+ '>': '&gt;',
935
+ '"': '&quot;',
936
+ "'": '&#39;'
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&quot; onerror=&quot;alert(1)'
947
+ * escapeHtml('<img src=x>'); // '&lt;img src=x&gt;'
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$B.apply(this, arguments);
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$B({}, options, {
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$A() {
994
- _extends$A = Object.assign || function assign(target) {
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$A.apply(this, arguments);
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$A({}, options, {
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
- if (poster === '') {
1069
- this.$container.innerHTML = '';
1108
+ // 空值一律清空。原先只判 `=== ''`,poster 为 undefined 时会渲染出
1109
+ // `<img src="undefined">`,浏览器会去请求 ./undefined 再触发 error 回调
1110
+ if (!poster) {
1111
+ this.$container.replaceChildren();
1070
1112
  return;
1071
1113
  }
1072
- this.$container.innerHTML = '<img class="' + PREFIX_CLASS$1 + '-poster-img" src="' + poster + '" />';
1073
- (_this_$container_querySelector = this.$container.querySelector("." + PREFIX_CLASS$1 + "-poster-img")) == null ? void 0 : _this_$container_querySelector.addEventListener("error", this._imgLoadErrorEvent);
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 进行缓存, 如果有值优先使用, 如果没有值优先使用 初始化传入的值
@@ -1130,7 +1178,9 @@
1130
1178
  return '<svg width="1em" height="1em" viewBox="0 0 24 24" focusable="false" aria-hidden="true" data-icon="talk-growth">\n <g fill="currentColor" stroke="currentColor">\n <path stroke="none" d="M9.22313 18.9543C9.6588 18.9543 10.0189 19.2133 10.0759 19.5494L10.0837 19.6428L10.0837 21.7847C10.0837 22.1649 9.69841 22.4732 9.22313 22.4732C8.78745 22.4732 8.42739 22.2142 8.37041 21.8781L8.36255 21.7847L8.36255 19.6428C8.36255 19.2626 8.74784 18.9543 9.22313 18.9543Z" fill-rule="evenodd" />\n <path d="M16.5323 11.3779L16.5323 11.5872C16.5323 15.7472 13.1599 19.1197 8.99981 19.1197C4.83971 19.1197 1.46729 15.7472 1.46729 11.5872L1.46729 11.4335" fill-rule="evenodd" fill="none" stroke-width="1.5" />\n <path stroke="none" d="M4.07861 6.12978C4.07861 3.589 6.30476 1.5293 9.05085 1.5293C11.7969 1.5293 14.0231 3.589 14.0231 6.12978L14.0231 12.075C14.0231 14.6158 11.7969 16.6755 9.05085 16.6755C6.30476 16.6755 4.07861 14.6158 4.07861 12.075L4.07861 6.12978ZM5.57861 12.075L5.57861 6.12978C5.57861 5.94083 5.597 5.75561 5.63376 5.57412C5.67605 5.36539 5.74265 5.16158 5.83357 4.9627C5.86625 4.8912 5.90164 4.82121 5.93974 4.75272C6.09781 4.4685 6.30245 4.21019 6.55365 3.97777C6.64206 3.89597 6.73424 3.81921 6.83019 3.7475C7.0816 3.55959 7.3589 3.40632 7.66207 3.28767C7.79552 3.23545 7.93107 3.19114 8.06871 3.15475C8.38503 3.07111 8.71241 3.0293 9.05085 3.0293C9.38929 3.0293 9.71668 3.07112 10.033 3.15475C10.1706 3.19114 10.3062 3.23545 10.4396 3.28767C10.7428 3.40632 11.0201 3.55959 11.2715 3.74749C11.3675 3.81921 11.4596 3.89596 11.548 3.97777C11.7993 4.2102 12.0039 4.46853 12.162 4.75276C12.2001 4.82124 12.2354 4.89122 12.2681 4.9627C12.359 5.16157 12.4256 5.36536 12.4679 5.57407C12.5047 5.75558 12.5231 5.94082 12.5231 6.12978L12.5231 12.075C12.5231 12.264 12.5047 12.4492 12.4679 12.6307C12.4256 12.8394 12.359 13.0432 12.2681 13.2421C12.2355 13.3136 12.2001 13.3835 12.162 13.452C12.0039 13.7362 11.7993 13.9946 11.548 14.227C11.4596 14.3088 11.3675 14.3856 11.2715 14.4573C11.0201 14.6452 10.7428 14.7985 10.4396 14.9171C10.3062 14.9693 10.1706 15.0136 10.033 15.05C9.71667 15.1337 9.38929 15.1755 9.05085 15.1755C8.71241 15.1755 8.38503 15.1337 8.06871 15.05C7.93107 15.0136 7.79552 14.9693 7.66207 14.9171C7.3589 14.7985 7.0816 14.6452 6.83019 14.4573C6.73424 14.3856 6.64206 14.3088 6.55365 14.227C6.30244 13.9946 6.09779 13.7363 5.93972 13.452C5.90163 13.3836 5.86625 13.3136 5.83357 13.2421C5.74265 13.0432 5.67605 12.8394 5.63377 12.6307C5.597 12.4492 5.57861 12.264 5.57861 12.075Z" fill-rule="evenodd" />\n </g>\n <g class="' + prefix + '-icon-talk-growth-dot">\n <path class="' + prefix + '-icon-talk-growth-dot1" d="M19.1333 6.40039L22.8667 6.40039" stroke="currentColor" stroke-linecap="round" stroke-width="1.86666667" />\n <path class="' + prefix + '-icon-talk-growth-dot2" d="M19.1333 10.1338L21.9331 10.1338" stroke="currentColor" stroke-linecap="round" stroke-width="1.86666667" />\n <path class="' + prefix + '-icon-talk-growth-dot3" d="M19.1333 13.8672L20.9995 13.8672" stroke="currentColor" stroke-linecap="round" stroke-width="1.86666667" />\n <path class="' + prefix + '-icon-talk-growth-dot4" d="M19.1333 17.6001L20.0669 17.6001" stroke="currentColor" stroke-linecap="round" stroke-width="1.86666667" />\n </g>\n </svg>';
1131
1179
  },
1132
1180
  /** 语音广播 */ broadcast: '\n <svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" stroke="none" focusable="false" aria-hidden="true" data-icon="broadcast">\n <g>\n <path id="矢量 1" d="m8.52109,6.76609l6.17823,-2.91335c0.2485,-0.11718 0.5027,-0.19531 0.7627,-0.2351c0.2034,-0.03077 0.4104,-0.03809 0.6211,-0.02173c0.2092,0.01636 0.4116,0.05493 0.6069,0.11621c0.2278,0.07129 0.4461,0.1731 0.6548,0.30542c0.2087,0.13232 0.394,0.28638 0.5557,0.46216l0.0002,0l0,0c0.1384,0.15064 0.2598,0.31714 0.3638,0.49951c0.1047,0.18335 0.1865,0.37354 0.2451,0.57081c0.0752,0.25219 0.1128,0.51562 0.1128,0.79004l0,10.64651c0,0.2744 -0.0376,0.5379 -0.1128,0.7901l0,0c-0.0586,0.197 -0.1404,0.3874 -0.2451,0.5708c-0.104,0.1823 -0.2254,0.3488 -0.364,0.4995c-0.1617,0.1758 -0.347,0.3298 -0.5557,0.4621c-0.2087,0.1324 -0.427,0.2342 -0.6548,0.3054c-0.1953,0.0611 -0.3977,0.0999 -0.6069,0.1163c-0.2107,0.0163 -0.4175,0.009 -0.6209,-0.0218c-0.2602,-0.0398 -0.5144,-0.1181 -0.7629,-0.2351l-5.45044,-2.5703l0,2.759c0,0.1036 -0.01831,0.1995 -0.05494,0.2879c-0.03662,0.0886 -0.09155,0.1692 -0.16479,0.2424c-0.14624,0.1465 -0.32324,0.2197 -0.53027,0.2197l-2,0c-0.14209,0 -0.27344,-0.0373 -0.39429,-0.112c-0.12085,-0.0745 -0.21289,-0.1756 -0.27661,-0.3025l-1.99268,-3.9856c-0.06225,-0.0234 -0.12402,-0.0481 -0.18555,-0.074c-0.26953,-0.114 -0.52417,-0.2502 -0.7644,-0.4084c-0.26636,-0.1758 -0.51489,-0.3789 -0.74512,-0.6094c-0.23047,-0.2302 -0.43359,-0.4788 -0.60937,-0.7451c-0.1582,-0.2403 -0.29444,-0.4949 -0.40845,-0.7644c-0.11328,-0.2679 -0.20068,-0.5413 -0.26245,-0.8206l0,0c-0.07398,-0.3347 -0.11108,-0.6775 -0.11108,-1.0286c0,-0.351 0.0371,-0.6938 0.11108,-1.0285c0.06177,-0.2793 0.14917,-0.5528 0.26245,-0.8206c0.11401,-0.26953 0.25025,-0.52417 0.40845,-0.7644c0.17578,-0.26636 0.3789,-0.5149 0.60937,-0.74512c0.23023,-0.23047 0.47876,-0.4336 0.74512,-0.60938l0,0c0.24023,-0.1582 0.49487,-0.29444 0.7644,-0.40845c0.26783,-0.11328 0.54126,-0.20068 0.82056,-0.26245l0,0l0,0l0,0c0.33472,-0.07398 0.67749,-0.11109 1.02857,-0.11109l2.93872,0c0.02636,-0.0166 0.05444,-0.03198 0.08349,-0.04589zm0.72876,8.47948l6.08937,2.8716c0.1287,0.0606 0.2598,0.0987 0.3935,0.114c0.0772,0.0088 0.1551,0.0103 0.2337,0.0042c0.0857,-0.0068 0.1687,-0.0217 0.2495,-0.0452c0.1133,-0.0329 0.2219,-0.0822 0.3257,-0.1479c0.104,-0.0659 0.1948,-0.1431 0.2729,-0.2317c0.0554,-0.063 0.1045,-0.1318 0.147,-0.2063c0.0393,-0.0686 0.0713,-0.1397 0.0962,-0.2131c0.043,-0.1277 0.0647,-0.2625 0.0647,-0.4046l0,-10.64651c0,-0.14209 -0.0217,-0.2771 -0.0647,-0.40454c-0.0249,-0.07349 -0.0569,-0.14454 -0.0962,-0.21314c-0.0425,-0.07471 -0.0916,-0.14331 -0.147,-0.2063c-0.0781,-0.08862 -0.1689,-0.16577 -0.2729,-0.23169c-0.1038,-0.06567 -0.2124,-0.11523 -0.3257,-0.14795c-0.0808,-0.02344 -0.1638,-0.03833 -0.2495,-0.04517c-0.0786,-0.0061 -0.1565,-0.00463 -0.2337,0.00415c-0.1337,0.01539 -0.2648,0.05347 -0.3935,0.11402l-6.09034,2.87208l0.00097,7.16405zm13.58447,-7.9121l-2,1c-0.3757,0.18775 -0.8184,0.04029 -1.0063,-0.33545c-0.0552,-0.11035 -0.0813,-0.22656 -0.0813,-0.34033c0,-0.27344 0.1516,-0.53321 0.4167,-0.66602l2,-1c0.3757,-0.18775 0.8186,-0.04004 1.0064,0.33545c0.0551,0.11035 0.0813,0.22656 0.0813,0.34033c0,0.27368 -0.1514,0.53345 -0.4168,0.66602zm-15.08544,8.9785l-2.08667,0l1.30029,2.6006l0.78638,0l0,-2.6006zm0,-7.99998l-2.25,0c-0.24976,0 -0.49317,0.02734 -0.73023,0.08179c-0.18188,0.04174 -0.36011,0.09961 -0.53467,0.17334c-0.17944,0.07593 -0.34961,0.1665 -0.51049,0.27124c-0.18702,0.12231 -0.36133,0.26416 -0.52271,0.42554c-0.16138,0.16137 -0.30322,0.33569 -0.42554,0.52267c-0.10473,0.1609 -0.19531,0.3311 -0.27124,0.5105c-0.07373,0.1746 -0.13159,0.3528 -0.17334,0.5347c-0.05444,0.2371 -0.08178,0.4805 -0.08178,0.7302c0,0.2498 0.02734,0.4932 0.08178,0.7303c0.04175,0.1818 0.09961,0.3601 0.17334,0.5346c0.07593,0.1795 0.16651,0.3496 0.27124,0.5105c0.12232,0.187 0.26416,0.3614 0.42554,0.5227c0.16138,0.1614 0.33569,0.3033 0.52271,0.4256c0.16088,0.1047 0.33105,0.1953 0.51049,0.2712c0.17456,0.0737 0.35279,0.1316 0.53467,0.1734c0.23706,0.0544 0.48047,0.0817 0.73023,0.0817l2.25097,0l-0.00097,-6.49998zm12.75004,2.60058l2,0c0.4199,0 0.75,0.3301 0.75,0.75c0,0.4199 -0.3301,0.75 -0.75,0.75l-2,0c-0.42,0 -0.75,-0.3301 -0.75,-0.75c0,-0.4199 0.33,-0.75 0.75,-0.75zm0.3354,4.0791l2,1c0.2654,0.1326 0.4168,0.3924 0.4168,0.6661c0,0.1137 -0.0262,0.2299 -0.0813,0.3403c-0.1878,0.3755 -0.6307,0.5232 -1.0064,0.3354l-2,-1c-0.2651,-0.1328 -0.4167,-0.3925 -0.4167,-0.666c0,-0.1138 0.0261,-0.23 0.0813,-0.3403c0.1879,-0.3758 0.6306,-0.5232 1.0063,-0.3355z" fill-rule="evenodd"/>\n </g>\n</svg>',
1133
- /** AI对话 */ aiChat: '\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none">\n <defs>\n <linearGradient id="gradient0" x1="10.667" x2="10.667" y1="0.667" y2="20.667">\n <stop stop-color="#33D9FF" offset="0.354"/>\n <stop stop-color="#CE77FF" offset="1"/>\n </linearGradient>\n <linearGradient id="gradient1" x1="8.318" x2="8.318" y1="0" y2="18.001">\n <stop stop-color="#33D9FF" offset="0.354"/>\n <stop stop-color="#CE77FF" offset="1"/>\n </linearGradient>\n </defs>\n \n <g transform="scale(1.2) translate(-3, -0.5)">\n <path d="M6.917 0C8.776 0 10.52 0.738 11.808 2.026C12.45 2.668 12.961 3.43 13.309 4.269C13.442 4.588 13.29 4.954 12.971 5.086C12.653 5.218 12.287 5.067 12.155 4.748C11.87 4.061 11.451 3.436 10.925 2.91C9.868 1.854 8.441 1.25 6.917 1.25C3.787 1.25 1.25 3.787 1.25 6.917C1.25 10.047 3.787 12.584 6.917 12.584C8.441 12.584 9.868 11.981 10.925 10.925C11.169 10.681 11.564 10.681 11.808 10.925C12.052 11.169 12.052 11.565 11.808 11.809C10.666 12.951 9.164 13.661 7.542 13.807L7.542 17.376C7.542 17.721 7.262 18.001 6.917 18.001C6.572 18.001 6.292 17.721 6.292 17.376L6.292 13.807C2.765 13.49 0 10.527 0 6.917C0 3.097 3.097 0 6.917 0ZM11.051 6.495C11.295 6.739 11.295 7.135 11.051 7.379L7.547 10.882C7.303 11.126 6.908 11.126 6.664 10.882C6.42 10.638 6.42 10.242 6.664 9.998L10.167 6.495C10.411 6.251 10.807 6.251 11.051 6.495ZM8.566 4.559L6.501 9.5C6.368 9.818 6.002 9.969 5.684 9.836C5.365 9.703 5.215 9.336 5.348 9.018L5.712 8.147L4.094 6.529L3.198 6.884C2.904 7.001 2.575 6.878 2.424 6.61C2.297 6.289 2.418 5.849 2.739 5.722L7.76 3.736C8.274 3.533 8.779 4.049 8.566 4.559ZM16.614 6.171C16.642 6.236 16.642 6.309 16.614 6.373L15.964 7.848C15.936 7.912 15.936 7.986 15.964 8.05L16.614 9.525C16.67 9.651 16.613 9.799 16.486 9.855C16.422 9.883 16.349 9.883 16.285 9.855L14.809 9.205C14.745 9.176 14.672 9.176 14.608 9.205L13.133 9.855C13.006 9.911 12.859 9.853 12.803 9.727C12.775 9.662 12.775 9.589 12.803 9.525L13.453 8.05C13.482 7.986 13.482 7.912 13.453 7.848L12.803 6.373C12.747 6.247 12.805 6.099 12.931 6.043C12.995 6.015 13.068 6.015 13.133 6.043L14.608 6.694C14.672 6.722 14.745 6.722 14.809 6.694L16.285 6.043C16.411 5.988 16.558 6.045 16.614 6.171ZM6.841 5.443L5.361 6.028L6.233 6.9L6.841 5.443Z" fill="url(#gradient1)" transform="matrix(0.707 -0.707 0.707 0.707 0.085 9.868)"/>\n </g>\n </svg>\n ',
1181
+ /** AI对话 */ aiChat: function aiChat(line_id) {
1182
+ return '<svg width="1em" height="1em" viewBox="2 2 18 18" fill="none">\n <defs>\n <linearGradient id="' + line_id + '" x1="8.31767559" x2="8.31767559" y1="0" y2="18.0010872" gradientUnits="userSpaceOnUse">\n <stop stop-color="rgb(51,217,255)" offset="0.354430377" stop-opacity="1" />\n <stop stop-color="rgb(206,119,255)" offset="1" stop-opacity="1" />\n </linearGradient>\n </defs>\n <path d="M6.91721 0C8.77619 0 10.52 0.737553 11.8084 2.026C12.4502 2.6678 12.9613 3.42996 13.3093 4.26934C13.4416 4.58819 13.2903 4.95385 12.9714 5.08607C12.6526 5.21828 12.2869 5.06698 12.1547 4.74813C11.8697 4.06081 11.4508 3.43616 10.9245 2.90989C9.86818 1.85353 8.44127 1.25 6.91721 1.25C3.7873 1.25 1.25 3.7873 1.25 6.91721C1.25 10.0471 3.7873 12.5844 6.91721 12.5844C8.44127 12.5844 9.86818 11.9809 10.9245 10.9245C11.1686 10.6805 11.5643 10.6805 11.8084 10.9245C12.0525 11.1686 12.0525 11.5643 11.8084 11.8084C10.6655 12.9513 9.16441 13.6607 7.5424 13.8064L7.54221 17.3761C7.54221 17.7213 7.26239 18.0011 6.91721 18.0011C6.57203 18.0011 6.29221 17.7213 6.29221 17.3761L6.29175 13.8065C2.76456 13.4904 0 10.5267 0 6.91721C0 3.09694 3.09694 0 6.91721 0ZM11.0506 6.49482C11.2947 6.7389 11.2947 7.13463 11.0506 7.37871L7.54746 10.8819C7.30339 11.126 6.90766 11.126 6.66358 10.8819C6.4195 10.6378 6.4195 10.2421 6.66358 9.998L10.1668 6.49482C10.4108 6.25075 10.8066 6.25075 11.0506 6.49482ZM8.56622 4.55861L6.50122 9.49996C6.36812 9.81845 6.00204 9.96873 5.68355 9.83564C5.36507 9.70254 5.21478 9.33646 5.34788 9.01798L5.71248 8.14735L4.09417 6.52917L3.19846 6.88426C2.90422 7.00062 2.57458 6.87812 2.42392 6.60965C2.29698 6.28866 2.41781 5.84878 2.7388 5.72184L7.75973 3.73641C8.27389 3.53309 8.77942 4.04845 8.56622 4.55861ZM16.614 6.1714C16.6424 6.23564 16.6424 6.30883 16.614 6.37307L15.9639 7.84813C15.9356 7.91237 15.9356 7.98556 15.9639 8.0498L16.614 9.52486C16.6697 9.6512 16.6125 9.79877 16.4861 9.85446C16.4219 9.88277 16.3487 9.88277 16.2845 9.85446L14.8094 9.20428C14.7452 9.17597 14.672 9.17597 14.6077 9.20428L13.1327 9.85446C13.0063 9.91015 12.8588 9.85287 12.8031 9.72653C12.7747 9.66229 12.7747 9.5891 12.8031 9.52486L13.4532 8.0498C13.4816 7.98556 13.4816 7.91237 13.4532 7.84813L12.8031 6.37307C12.7474 6.24673 12.8047 6.09916 12.931 6.04347C12.9952 6.01516 13.0684 6.01516 13.1327 6.04347L14.6077 6.69365C14.672 6.72196 14.7452 6.72196 14.8094 6.69365L16.2845 6.04347C16.4108 5.98778 16.5584 6.04506 16.614 6.1714ZM6.84128 5.44268L5.36083 6.02833L6.2325 6.9L6.84128 5.44268Z" fill="url(#' + line_id + ')" fill-rule="nonzero" transform="matrix(0.707107,-0.707107,0.707107,0.707107,0.0854492,9.86798)" />\n </svg>\n ';
1183
+ },
1134
1184
  /** 相机/截图 */ capturePicture: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="capture-picture">\n <path d="M6.94 7.51C7.34 7.51 7.7 7.28 7.86 6.91L8.43 5.6C8.59 5.23 8.95 5 9.35 5L14.69 5C15.04 5 15.37 5.18 15.55 5.49L16.45 7.02C16.63 7.33 16.96 7.51 17.31 7.51L18.5 7.51C19.6 7.51 20.5 8.41 20.5 9.51L20.5 17C20.5 18.1 19.6 19 18.5 19L5.5 19C4.39 19 3.5 18.1 3.5 17L3.5 9.51C3.5 8.41 4.39 7.51 5.5 7.51L6.94 7.51Z" stroke-width="1.5"/>\n <circle cx="12" cy="12.525146" r="3.068097" stroke-width="1.5"/>\n </svg>',
1135
1185
  /** 电子放大 */ zoom: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="zoom">\n <ellipse cx="10.914795" cy="11.25" rx="8.004043" ry="8.25" stroke-width="1.5"/>\n <path d="M14.31 11.04L8.05 11.14" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M11.13 14.22L11.23 7.95" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M16.45 17.83L19.36 20.83" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n </svg>',
1136
1186
  /** 隐私遮蔽 */ privacyMasking: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="privacy-masking">\n <path d="M12 19C11.15 19 10.31 18.82 9.49 18.5" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M20.88 12.46C18.98 15.96 15.49 19 11.99 19" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M19.07 8.92C19.76 9.72 20.38 10.61 20.88 11.53C21.03 11.82 21.03 12.17 20.88 12.46" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M5 19L19 5" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M9.77 14.22C8.54 12.99 8.54 11 9.77 9.77C11 8.54 12.99 8.54 14.22 9.77" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n <path d="M17.04 6.95C15.49 5.75 13.74 5 12 5C8.5 5 5.01 8.03 3.11 11.53C2.96 11.82 2.96 12.17 3.11 12.46C4.06 14.21 5.41 15.84 6.95 17.04" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>\n </svg>',
@@ -1162,7 +1212,9 @@
1162
1212
  var attrStr = '';
1163
1213
  if (attr) {
1164
1214
  Object.keys(attr).forEach(function(key) {
1165
- if (!(attr[key] === undefined || attr[key] === null)) attrStr += key + '="' + attr[key] + '"';
1215
+ // 属性值必须转义:所有控件的 title 都来自 options.locales,
1216
+ // 不转义时 `x" onmouseover="alert(1)` 这样的文案可以闭合属性并挂上事件
1217
+ if (!(attr[key] === undefined || attr[key] === null)) attrStr += key + '="' + escapeHtml(attr[key]) + '"';
1166
1218
  });
1167
1219
  }
1168
1220
  return '<span class="' + PREFIX_CLASS$1 + "-icon " + PREFIX_CLASS$1 + "-icon-" + type + '" ' + attrStr + ">" + svg + "</span>";
@@ -1226,7 +1278,7 @@
1226
1278
  },
1227
1279
  aiChat: function aiChat(attr) {
1228
1280
  if (attr === void 0) attr = {};
1229
- return createIcon(Icons.aiChat, 'aiChat', attr);
1281
+ return createIcon(Icons.aiChat(attr.line_id), 'aiChat', attr);
1230
1282
  },
1231
1283
  talkGrowth: function talkGrowth(attr) {
1232
1284
  if (attr === void 0) attr = {};
@@ -1326,15 +1378,15 @@
1326
1378
  }
1327
1379
  };
1328
1380
 
1329
- function _extends$z() {
1330
- _extends$z = Object.assign || function assign(target) {
1381
+ function _extends$A() {
1382
+ _extends$A = Object.assign || function assign(target) {
1331
1383
  for(var i = 1; i < arguments.length; i++){
1332
1384
  var source = arguments[i];
1333
1385
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
1334
1386
  }
1335
1387
  return target;
1336
1388
  };
1337
- return _extends$z.apply(this, arguments);
1389
+ return _extends$A.apply(this, arguments);
1338
1390
  }
1339
1391
  function _inherits$w(subClass, superClass) {
1340
1392
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1365,7 +1417,7 @@
1365
1417
  function Message(options) {
1366
1418
  if (options === void 0) options = {};
1367
1419
  var _this;
1368
- _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$z({}, options, {
1420
+ _this = Control.call(this, Object.assign({}, MESSAGE_DEFAULT_OPTIONS, _extends$A({}, options, {
1369
1421
  tagName: 'div',
1370
1422
  controlType: 'block'
1371
1423
  }))) || this, _this._$toast = null;
@@ -1417,7 +1469,8 @@
1417
1469
  this._$toast = document.createElement('div');
1418
1470
  this._$toast.classList.add("" + PREFIX_CLASS$1 + "-toast");
1419
1471
  }
1420
- 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 + '">' + (msg || '') + "</span></div>";
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>";
1421
1474
  this.options.rootContainer.appendChild(this._$toast);
1422
1475
  if (duration > 0) {
1423
1476
  this._toastTimer = setTimeout(function() {
@@ -1449,7 +1502,7 @@
1449
1502
  //
1450
1503
  this.$container.innerHTML = this.options.render(msg, duration, type);
1451
1504
  } else {
1452
- this.$container.innerHTML = '<div class="' + PREFIX_CLASS$1 + "-message-content " + PREFIX_CLASS$1 + "-message-" + type + '">' + (msg || '') + "</div>";
1505
+ this.$container.innerHTML = '<div class="' + PREFIX_CLASS$1 + "-message-content " + PREFIX_CLASS$1 + "-message-" + type + '">' + escapeHtml(msg) + "</div>";
1453
1506
  }
1454
1507
  //
1455
1508
  this.$container.style.display = 'flex';
@@ -1522,15 +1575,15 @@
1522
1575
  if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
1523
1576
  return Constructor;
1524
1577
  }
1525
- function _extends$y() {
1526
- _extends$y = Object.assign || function assign(target) {
1578
+ function _extends$z() {
1579
+ _extends$z = Object.assign || function assign(target) {
1527
1580
  for(var i = 1; i < arguments.length; i++){
1528
1581
  var source = arguments[i];
1529
1582
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
1530
1583
  }
1531
1584
  return target;
1532
1585
  };
1533
- return _extends$y.apply(this, arguments);
1586
+ return _extends$z.apply(this, arguments);
1534
1587
  }
1535
1588
  function _inherits$v(subClass, superClass) {
1536
1589
  if (typeof superClass !== "function" && superClass !== null) {
@@ -1559,7 +1612,7 @@
1559
1612
  _inherits$v(Play, Control);
1560
1613
  function Play(options) {
1561
1614
  var _this;
1562
- _this = Control.call(this, _extends$y({}, options, {
1615
+ _this = Control.call(this, _extends$z({}, options, {
1563
1616
  tagName: 'span',
1564
1617
  controlType: 'button',
1565
1618
  classNameSuffix: 'play'
@@ -3075,15 +3128,15 @@
3075
3128
  if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
3076
3129
  return Constructor;
3077
3130
  }
3078
- function _extends$x() {
3079
- _extends$x = Object.assign || function assign(target) {
3131
+ function _extends$y() {
3132
+ _extends$y = Object.assign || function assign(target) {
3080
3133
  for(var i = 1; i < arguments.length; i++){
3081
3134
  var source = arguments[i];
3082
3135
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
3083
3136
  }
3084
3137
  return target;
3085
3138
  };
3086
- return _extends$x.apply(this, arguments);
3139
+ return _extends$y.apply(this, arguments);
3087
3140
  }
3088
3141
  function _inherits$u(subClass, superClass) {
3089
3142
  if (typeof superClass !== "function" && superClass !== null) {
@@ -3122,7 +3175,7 @@
3122
3175
  if (options === void 0) options = {};
3123
3176
  var _this;
3124
3177
  var _this__options_props, _this__options_props1, _this__options_props2, _this__options_props3;
3125
- _this = Control.call(this, _extends$x({}, options, {
3178
+ _this = Control.call(this, _extends$y({}, options, {
3126
3179
  tagName: 'span',
3127
3180
  classNameSuffix: 'volume',
3128
3181
  controlType: 'button'
@@ -3258,9 +3311,9 @@
3258
3311
  // 这里不要用 click 事件,因为拖动音量大小时鼠标移动到图标上会触发 click
3259
3312
  // prettier-ignore
3260
3313
  delegate(this.$container, "." + PREFIX_CLASS$1 + "-control-volume", "mousedown", function() {
3261
- if (!_this.$container.classList.contains("" + PREFIX_CLASS$1 + "-disabled")) {
3262
- _this._toggleMute();
3263
- }
3314
+ // 禁用判断交给 _toggleMute 里的 this.disabled(状态是权威来源,
3315
+ // class 只是它的呈现),避免两处各判一遍
3316
+ _this._toggleMute();
3264
3317
  });
3265
3318
  };
3266
3319
  _create_class$h(Volume, [
@@ -3985,15 +4038,15 @@
3985
4038
  return Fullscreen;
3986
4039
  }();
3987
4040
 
3988
- function _extends$w() {
3989
- _extends$w = Object.assign || function assign(target) {
4041
+ function _extends$x() {
4042
+ _extends$x = Object.assign || function assign(target) {
3990
4043
  for(var i = 1; i < arguments.length; i++){
3991
4044
  var source = arguments[i];
3992
4045
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
3993
4046
  }
3994
4047
  return target;
3995
4048
  };
3996
- return _extends$w.apply(this, arguments);
4049
+ return _extends$x.apply(this, arguments);
3997
4050
  }
3998
4051
  function _inherits$t(subClass, superClass) {
3999
4052
  if (typeof superClass !== "function" && superClass !== null) {
@@ -4023,7 +4076,7 @@
4023
4076
  function Fullscreen(options) {
4024
4077
  var _this;
4025
4078
  var _options_props, _this_options;
4026
- _this = Control.call(this, _extends$w({
4079
+ _this = Control.call(this, _extends$x({
4027
4080
  tagName: 'span',
4028
4081
  classNameSuffix: 'fullscreen',
4029
4082
  controlType: 'button'
@@ -4088,15 +4141,15 @@
4088
4141
  return Fullscreen;
4089
4142
  }(Control);
4090
4143
 
4091
- function _extends$v() {
4092
- _extends$v = Object.assign || function assign(target) {
4144
+ function _extends$w() {
4145
+ _extends$w = Object.assign || function assign(target) {
4093
4146
  for(var i = 1; i < arguments.length; i++){
4094
4147
  var source = arguments[i];
4095
4148
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
4096
4149
  }
4097
4150
  return target;
4098
4151
  };
4099
- return _extends$v.apply(this, arguments);
4152
+ return _extends$w.apply(this, arguments);
4100
4153
  }
4101
4154
  function _inherits$s(subClass, superClass) {
4102
4155
  if (typeof superClass !== "function" && superClass !== null) {
@@ -4126,7 +4179,7 @@
4126
4179
  function Rec(options) {
4127
4180
  var _this;
4128
4181
  var _options_props;
4129
- _this = Control.call(this, _extends$v({}, options, {
4182
+ _this = Control.call(this, _extends$w({}, options, {
4130
4183
  tagName: 'div',
4131
4184
  controlType: 'block',
4132
4185
  classNameSuffix: 'rec'
@@ -5741,15 +5794,15 @@
5741
5794
  return Content;
5742
5795
  }(EventEmitter);
5743
5796
 
5744
- function _extends$u() {
5745
- _extends$u = Object.assign || function assign(target) {
5797
+ function _extends$v() {
5798
+ _extends$v = Object.assign || function assign(target) {
5746
5799
  for(var i = 1; i < arguments.length; i++){
5747
5800
  var source = arguments[i];
5748
5801
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
5749
5802
  }
5750
5803
  return target;
5751
5804
  };
5752
- return _extends$u.apply(this, arguments);
5805
+ return _extends$v.apply(this, arguments);
5753
5806
  }
5754
5807
  function _inherits$q(subClass, superClass) {
5755
5808
  if (typeof superClass !== "function" && superClass !== null) {
@@ -5778,7 +5831,7 @@
5778
5831
  _inherits$q(More, Control);
5779
5832
  function More(options) {
5780
5833
  var _this;
5781
- _this = Control.call(this, _extends$u({}, options, {
5834
+ _this = Control.call(this, _extends$v({}, options, {
5782
5835
  tagName: 'span',
5783
5836
  controlType: 'button',
5784
5837
  classNameSuffix: 'more'
@@ -6541,15 +6594,15 @@
6541
6594
  if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
6542
6595
  return Constructor;
6543
6596
  }
6544
- function _extends$t() {
6545
- _extends$t = Object.assign || function assign(target) {
6597
+ function _extends$u() {
6598
+ _extends$u = Object.assign || function assign(target) {
6546
6599
  for(var i = 1; i < arguments.length; i++){
6547
6600
  var source = arguments[i];
6548
6601
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6549
6602
  }
6550
6603
  return target;
6551
6604
  };
6552
- return _extends$t.apply(this, arguments);
6605
+ return _extends$u.apply(this, arguments);
6553
6606
  }
6554
6607
  function _inherits$p(subClass, superClass) {
6555
6608
  if (typeof superClass !== "function" && superClass !== null) {
@@ -6582,7 +6635,7 @@
6582
6635
  _inherits$p(Zoom, Control);
6583
6636
  function Zoom(options) {
6584
6637
  var _this;
6585
- _this = Control.call(this, _extends$t({}, options, {
6638
+ _this = Control.call(this, _extends$u({}, options, {
6586
6639
  tagName: 'span',
6587
6640
  controlType: 'button',
6588
6641
  classNameSuffix: 'zoom'
@@ -6717,18 +6770,18 @@
6717
6770
  */
6718
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";
6719
6772
 
6720
- function _extends$s() {
6721
- _extends$s = Object.assign || function assign(target) {
6773
+ function _extends$t() {
6774
+ _extends$t = Object.assign || function assign(target) {
6722
6775
  for(var i = 1; i < arguments.length; i++){
6723
6776
  var source = arguments[i];
6724
6777
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6725
6778
  }
6726
6779
  return target;
6727
6780
  };
6728
- return _extends$s.apply(this, arguments);
6781
+ return _extends$t.apply(this, arguments);
6729
6782
  }
6730
6783
  function __zoom(theme, container, options) {
6731
- theme.zoomUtil = new Zoom(container, _extends$s({}, options || {}, {
6784
+ theme.zoomUtil = new Zoom(container, _extends$t({}, options || {}, {
6732
6785
  min: 1,
6733
6786
  onChange: function onChange(zoom, reset) {
6734
6787
  if (zoom !== theme._zoom) {
@@ -6879,11 +6932,14 @@
6879
6932
  */ function getThemeDataByTemplate(theme, id) {
6880
6933
  return _async_to_generator$7(function() {
6881
6934
  var _theme_options_token_httpToken, _theme_options_token, // 中止上一个在途请求,并为本次请求创建可中止的信号(destroy 时会 abort)
6882
- _theme__templateAbortController, url, controller;
6935
+ _theme__templateAbortController, accessToken, url, controller;
6883
6936
  return _ts_generator$7(this, function(_state) {
6884
6937
  switch(_state.label){
6885
6938
  case 0:
6886
- url = theme.options.env.domain + "/api/service/media/template/getDetail?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)) + "&id=" + id;
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));
6887
6943
  (_theme__templateAbortController = theme._templateAbortController) == null ? void 0 : _theme__templateAbortController.abort();
6888
6944
  controller = new AbortController();
6889
6945
  theme._templateAbortController = controller;
@@ -6965,15 +7021,15 @@
6965
7021
  });
6966
7022
  };
6967
7023
  }
6968
- function _extends$r() {
6969
- _extends$r = Object.assign || function assign(target) {
7024
+ function _extends$s() {
7025
+ _extends$s = Object.assign || function assign(target) {
6970
7026
  for(var i = 1; i < arguments.length; i++){
6971
7027
  var source = arguments[i];
6972
7028
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6973
7029
  }
6974
7030
  return target;
6975
7031
  };
6976
- return _extends$r.apply(this, arguments);
7032
+ return _extends$s.apply(this, arguments);
6977
7033
  }
6978
7034
  function _ts_generator$6(thisArg, body) {
6979
7035
  var f, y, t, _ = {
@@ -7109,7 +7165,7 @@
7109
7165
  }
7110
7166
  if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
7111
7167
  // TODO: 因为回放是一组, 位置以第一个位置为准
7112
- recControls.push(recControls[0] ? _extends$r({}, item, {
7168
+ recControls.push(recControls[0] ? _extends$s({}, item, {
7113
7169
  part: recControls[0].part
7114
7170
  }) : item);
7115
7171
  return false;
@@ -7132,7 +7188,7 @@
7132
7188
  }
7133
7189
  if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
7134
7190
  // TODO: 因为回放是一组, 位置以第一个位置为准
7135
- recControls.push(recControls[0] ? _extends$r({}, item, {
7191
+ recControls.push(recControls[0] ? _extends$s({}, item, {
7136
7192
  part: recControls[0].part
7137
7193
  }) : item);
7138
7194
  return false;
@@ -7211,7 +7267,9 @@
7211
7267
  ];
7212
7268
  // 渲染主题模板
7213
7269
  themeData = TEMPLATES[data];
7214
- if (!data) {
7270
+ // 修复:此前判的是 `!data`,而这个分支里 data 必然是非空字符串,告警永远不会发出,
7271
+ // 传了不存在的模板名只会静默返回 undefined。应当判查表结果。
7272
+ if (!themeData) {
7215
7273
  (_theme_logger = theme.logger) == null ? void 0 : _theme_logger.warn("Theme template " + data + " is not exist!");
7216
7274
  themeData = null;
7217
7275
  }
@@ -7394,15 +7452,15 @@
7394
7452
  return Component;
7395
7453
  }();
7396
7454
 
7397
- function _extends$q() {
7398
- _extends$q = Object.assign || function assign(target) {
7455
+ function _extends$r() {
7456
+ _extends$r = Object.assign || function assign(target) {
7399
7457
  for(var i = 1; i < arguments.length; i++){
7400
7458
  var source = arguments[i];
7401
7459
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7402
7460
  }
7403
7461
  return target;
7404
7462
  };
7405
- return _extends$q.apply(this, arguments);
7463
+ return _extends$r.apply(this, arguments);
7406
7464
  }
7407
7465
  function _inherits$o(subClass, superClass) {
7408
7466
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7428,22 +7486,22 @@
7428
7486
  _inherits$o(Footer, Component);
7429
7487
  function Footer(options) {
7430
7488
  if (options === void 0) options = {};
7431
- return Component.call(this, _extends$q({}, options, {
7489
+ return Component.call(this, _extends$r({}, options, {
7432
7490
  cType: 'footer'
7433
7491
  })) || this;
7434
7492
  }
7435
7493
  return Footer;
7436
7494
  }(Component);
7437
7495
 
7438
- function _extends$p() {
7439
- _extends$p = Object.assign || function assign(target) {
7496
+ function _extends$q() {
7497
+ _extends$q = Object.assign || function assign(target) {
7440
7498
  for(var i = 1; i < arguments.length; i++){
7441
7499
  var source = arguments[i];
7442
7500
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7443
7501
  }
7444
7502
  return target;
7445
7503
  };
7446
- return _extends$p.apply(this, arguments);
7504
+ return _extends$q.apply(this, arguments);
7447
7505
  }
7448
7506
  function _inherits$n(subClass, superClass) {
7449
7507
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7469,7 +7527,7 @@
7469
7527
  _inherits$n(Header, Component);
7470
7528
  function Header(options) {
7471
7529
  if (options === void 0) options = {};
7472
- return Component.call(this, _extends$p({}, options, {
7530
+ return Component.call(this, _extends$q({}, options, {
7473
7531
  cType: 'header'
7474
7532
  })) || this;
7475
7533
  }
@@ -7632,15 +7690,15 @@
7632
7690
  };
7633
7691
  }
7634
7692
 
7635
- function _extends$o() {
7636
- _extends$o = Object.assign || function assign(target) {
7693
+ function _extends$p() {
7694
+ _extends$p = Object.assign || function assign(target) {
7637
7695
  for(var i = 1; i < arguments.length; i++){
7638
7696
  var source = arguments[i];
7639
7697
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7640
7698
  }
7641
7699
  return target;
7642
7700
  };
7643
- return _extends$o.apply(this, arguments);
7701
+ return _extends$p.apply(this, arguments);
7644
7702
  }
7645
7703
  function _inherits$m(subClass, superClass) {
7646
7704
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7669,7 +7727,7 @@
7669
7727
  */ var GlobalFullscreen = /*#__PURE__*/ function(Fullscreen) {
7670
7728
  _inherits$m(GlobalFullscreen, Fullscreen);
7671
7729
  function GlobalFullscreen(options) {
7672
- return Fullscreen.call(this, _extends$o({}, options, {
7730
+ return Fullscreen.call(this, _extends$p({}, options, {
7673
7731
  controlType: 'button',
7674
7732
  classNameSuffix: 'global-fullscreen'
7675
7733
  })) || this;
@@ -7700,15 +7758,15 @@
7700
7758
  return GlobalFullscreen;
7701
7759
  }(Fullscreen);
7702
7760
 
7703
- function _extends$n() {
7704
- _extends$n = Object.assign || function assign(target) {
7761
+ function _extends$o() {
7762
+ _extends$o = Object.assign || function assign(target) {
7705
7763
  for(var i = 1; i < arguments.length; i++){
7706
7764
  var source = arguments[i];
7707
7765
  for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7708
7766
  }
7709
7767
  return target;
7710
7768
  };
7711
- return _extends$n.apply(this, arguments);
7769
+ return _extends$o.apply(this, arguments);
7712
7770
  }
7713
7771
  function _inherits$l(subClass, superClass) {
7714
7772
  if (typeof superClass !== "function" && superClass !== null) {
@@ -7737,7 +7795,7 @@
7737
7795
  _inherits$l(CapturePicture, Control);
7738
7796
  function CapturePicture(options) {
7739
7797
  var _this;
7740
- _this = Control.call(this, _extends$n({}, options, {
7798
+ _this = Control.call(this, _extends$o({}, options, {
7741
7799
  tagName: 'span',
7742
7800
  classNameSuffix: 'capture-picture'
7743
7801
  })) || this, _this._timer = null;
@@ -7791,11 +7849,11 @@
7791
7849
  }(Control);
7792
7850
 
7793
7851
  /*
7794
- * @ezuikit/control-ptz v1.0.0
7795
- * Copyright (c) 2026-08-03 09:24:07 Ezviz-OpenBiz
7852
+ * @ezuikit/control-ptz v2.0.0-beta.1
7853
+ * Copyright (c) 2026-10-10 15:13:21 Ezviz-OpenBiz
7796
7854
  * Released under the MIT License.
7797
7855
  */
7798
- 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);
7799
7857
 
7800
7858
  function _defineProperties$4(target, props) {
7801
7859
  for(var i = 0; i < props.length; i++){
@@ -7909,7 +7967,9 @@
7909
7967
  this._ptzControl.updateOptions(options);
7910
7968
  }
7911
7969
  if (this._ptzControl1) {
7912
- this._ptzControl.updateOptions(options);
7970
+ // 修复:此前误写成 this._ptzControl,移动端扩展区域的云台拿不到新凭据,
7971
+ // 换 accessToken 或切设备后移动端云台会继续用旧值请求
7972
+ this._ptzControl1.updateOptions(options);
7913
7973
  }
7914
7974
  };
7915
7975
  _proto._onSpeedChange = function _onSpeedChange(speed) {
@@ -8675,6 +8735,83 @@
8675
8735
  'live'
8676
8736
  ];
8677
8737
 
8738
+ /**
8739
+ * UUID 生成(RFC 4122 v4)
8740
+ *
8741
+ * 按可用性三级降级:
8742
+ *
8743
+ * | 顺序 | 实现 | 说明 |
8744
+ * | ---- | ------------------------ | ------------------------------------------------------------- |
8745
+ * | 1 | `crypto.randomUUID()` | 原生实现,最快;**仅在安全上下文(HTTPS / localhost)可用** |
8746
+ * | 2 | `crypto.getRandomValues` | 密码学强度随机数手工组装;HTTP 页面下也可用 |
8747
+ * | 3 | `Math.random()` | 兜底,**不具密码学强度**,只适合做 DOM id 这类无安全要求的标识 |
8748
+ *
8749
+ * 之所以不能只用 `crypto.randomUUID()`:播放器会被嵌到 HTTP 页面里,
8750
+ * 那种场景下它是 `undefined`,必须有降级路径。
8751
+ *
8752
+ * @remarks 用 `crypto` 而非 `window.crypto`,以便在 worker 中也能工作(worker 里没有 `window`)。
8753
+ */ /** 0~255 对应的两位十六进制查表,避免每个字节都做一次 toString + 手工补零 */ var HEX_BY_BYTE = [];
8754
+ for(var i = 0; i < 256; i++){
8755
+ // + 0x100 保证结果是三位,再切掉首位,等价于补零到两位(不用 padStart,es5 目标下它需要 polyfill)
8756
+ HEX_BY_BYTE.push((i + 0x100).toString(16).slice(1));
8757
+ }
8758
+ /**
8759
+ * 取 16 个随机字节
8760
+ *
8761
+ * @returns 长度为 16 的字节数组,每项 0~255
8762
+ */ function randomBytes() {
8763
+ var bytes = [];
8764
+ if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
8765
+ var buffer = new Uint8Array(16);
8766
+ crypto.getRandomValues(buffer);
8767
+ for(var i = 0; i < 16; i++){
8768
+ bytes.push(buffer[i]);
8769
+ }
8770
+ return bytes;
8771
+ }
8772
+ // 兜底:不具密码学强度,不要用于 token / 密钥一类场景
8773
+ for(var i1 = 0; i1 < 16; i1++){
8774
+ bytes.push(Math.floor(Math.random() * 256));
8775
+ }
8776
+ return bytes;
8777
+ }
8778
+ /**
8779
+ * 把 16 个字节按 v4 规范格式化成 `8-4-4-4-12`
8780
+ *
8781
+ * 会就地改写第 6、8 个字节以写入版本号与变体位。
8782
+ *
8783
+ * @param bytes - 长度为 16 的字节数组
8784
+ * @returns 形如 `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` 的字符串,`y` 为 8/9/a/b
8785
+ */ function bytesToUuid(bytes) {
8786
+ // 版本号固定为 4(高 4 位置为 0100)
8787
+ bytes[6] = bytes[6] & 0x0f | 0x40;
8788
+ // 变体固定为 RFC 4122(高 2 位置为 10)
8789
+ bytes[8] = bytes[8] & 0x3f | 0x80;
8790
+ var out = '';
8791
+ for(var i = 0; i < 16; i++){
8792
+ // 8-4-4-4-12 的分组位置
8793
+ if (i === 4 || i === 6 || i === 8 || i === 10) out += '-';
8794
+ out += HEX_BY_BYTE[bytes[i]];
8795
+ }
8796
+ return out;
8797
+ }
8798
+ /**
8799
+ * 生成一个 v4 UUID
8800
+ *
8801
+ * @returns 36 位小写 UUID,形如 `f47ac10b-58cc-4372-a567-0e02b2c3d479`
8802
+ * @example
8803
+ * ```ts
8804
+ * import uuid from '@/utils/uuid';
8805
+ *
8806
+ * uuid(); // '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
8807
+ * ```
8808
+ */ function uuid() {
8809
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
8810
+ return crypto.randomUUID();
8811
+ }
8812
+ return bytesToUuid(randomBytes());
8813
+ }
8814
+
8678
8815
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
8679
8816
  try {
8680
8817
  var info = gen[key](arg);
@@ -8865,7 +9002,8 @@
8865
9002
  _proto._render = function _render() {
8866
9003
  var _this_locale;
8867
9004
  this.$container.innerHTML = IconComponents.aiChat({
8868
- title: (_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_AICHAT
9005
+ title: (_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_AICHAT,
9006
+ line_id: 'ezpleyer___AI_CHAT_LINEAR_GRADIENT___' + '' + uuid()
8869
9007
  });
8870
9008
  };
8871
9009
  _proto.reset = function reset(hide) {
@@ -9053,7 +9191,13 @@
9053
9191
  controlType: 'button',
9054
9192
  classNameSuffix: 'rec-dropdown'
9055
9193
  })) || this;
9056
- _this._options = options;
9194
+ _this._options = Object.assign({
9195
+ list: [
9196
+ 'rec',
9197
+ 'cloudRec',
9198
+ 'cloudRecord'
9199
+ ]
9200
+ }, options || {});
9057
9201
  // H5 端不展示直播/回放切换按钮
9058
9202
  if (Utils.isMobile) {
9059
9203
  _this.$container.style.display = 'none';
@@ -9086,7 +9230,8 @@
9086
9230
  }
9087
9231
  };
9088
9232
  _proto._render = function _render() {
9089
- 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) ;
9090
9235
  this.$container.innerHTML = IconComponents.recDropdown({
9091
9236
  title: ((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_REC_DROPDOWN) || '回放'
9092
9237
  });
@@ -9109,8 +9254,8 @@
9109
9254
  // 打开时按控件在视口中的位置决定对齐方式。
9110
9255
  // 此时 picker 已把 $wrapperContent 设为 inline-flex(可测量宽度),
9111
9256
  // 而它内部的定位计算还在 requestAnimationFrame 里,改 placement 来得及生效。
9112
- // 移动端 placement 不生效(弹窗固定在窗口底部)
9113
- if (open && !Utils.isMobile) _this._adjustPlacement();
9257
+ // 移动端不适用的判断放在 _adjustPlacement 内部,避免两处各管一半
9258
+ if (open) _this._adjustPlacement();
9114
9259
  }
9115
9260
  });
9116
9261
  this._picker.innerHTML(this._getPanelHTML());
@@ -9156,7 +9301,7 @@
9156
9301
  var cloudRecLabel = ((_this_locale = this.locale) == null ? void 0 : _this_locale.REC_DROPDOWN_CLOUD_REC) || '云存储';
9157
9302
  var cloudRecordLabel = ((_this_locale1 = this.locale) == null ? void 0 : _this_locale1.REC_DROPDOWN_CLOUD_RECORD) || '云录制';
9158
9303
  var localRecLabel = ((_this_locale2 = this.locale) == null ? void 0 : _this_locale2.REC_DROPDOWN_LOCAL_REC) || '本地回放';
9159
- 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 + '</span>\n </li>\n <li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="cloudRecord">\n <span>' + cloudRecordLabel + '</span>\n </li>\n <li class="' + PREFIX_CLASS$1 + '-rec-dropdown-item" data-type="rec">\n <span>' + localRecLabel + "</span>\n </li>\n </ul>\n </div>";
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>";
9160
9305
  };
9161
9306
  _proto._bindPanelEvents = function _bindPanelEvents() {
9162
9307
  var _this = this;
@@ -9177,6 +9322,9 @@
9177
9322
  };
9178
9323
  _proto._activeOption = function _activeOption(type) {
9179
9324
  var _this__picker;
9325
+ if (!this._options.list.includes(type)) {
9326
+ return;
9327
+ }
9180
9328
  if ((_this__picker = this._picker) == null ? void 0 : _this__picker.$body) {
9181
9329
  var items = this._picker.$body.querySelectorAll("." + PREFIX_CLASS$1 + "-rec-dropdown-item");
9182
9330
  items.forEach(function(item) {
@@ -9522,8 +9670,9 @@
9522
9670
  label: 'label',
9523
9671
  value: 'value'
9524
9672
  },
9673
+ // label 可能来自内核下发的列表,内置实现必须转义
9525
9674
  renderLabel: function renderLabel(label) {
9526
- return "<span>" + (label || '') + "</span>";
9675
+ return "<span>" + escapeHtml(label) + "</span>";
9527
9676
  },
9528
9677
  onChange: function onChange() {},
9529
9678
  onOpenChange: function onOpenChange() {}
@@ -9638,9 +9787,11 @@
9638
9787
  var _this__options_fieldNames, _this__options_fieldNames1, _this_locale, _this__picker;
9639
9788
  var labelKey = (_ref = (_this__options_fieldNames = this._options.fieldNames) == null ? void 0 : _this__options_fieldNames.label) != null ? _ref : 'label';
9640
9789
  var valueKey = (_ref1 = (_this__options_fieldNames1 = this._options.fieldNames) == null ? void 0 : _this__options_fieldNames1.value) != null ? _ref1 : 'value';
9641
- (_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(function(item) {
9642
- return '\n <li class="' + PREFIX_CLASS$1 + "-select-option " + (+item[valueKey] === _this.value ? "" + PREFIX_CLASS$1 + "-active" : '') + '" data-value="' + item[valueKey] + '">\n <span>' + item[labelKey] + "</span>\n </li>\n ";
9643
- }).join('') + "\n </ul>\n " + (Utils.isMobile ? '<div class="' + PREFIX_CLASS$1 + '-select-cancel">\n <span>' + (((_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>");
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>");
9644
9795
  this.list = list;
9645
9796
  this._activeOption();
9646
9797
  } else if ((list == null ? void 0 : list.length) === 0) {
@@ -9872,15 +10023,16 @@
9872
10023
  classNameSuffix: 'definition',
9873
10024
  renderLabel: function renderLabel(label, item, list) {
9874
10025
  var _list_;
10026
+ // 文案来自 options.locales,name / label 来自内核下发的清晰度列表,都要转义
9875
10027
  if ((item == null ? void 0 : item.level) === 'auto') {
9876
10028
  var _options_locales_options_language;
9877
10029
  var realItem = list.find(function(it) {
9878
10030
  return it.level === _assert_this_initialized$1(_this)._level;
9879
10031
  });
9880
- 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>";
9881
10033
  }
9882
10034
  // 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
9883
- 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>";
9884
10036
  },
9885
10037
  onChange: function onChange(value, item) {
9886
10038
  var _options_onChange;
@@ -9910,7 +10062,8 @@
9910
10062
  var realItem = _this.list.find(function(it) {
9911
10063
  return it.level === _this._level;
9912
10064
  });
9913
- _this.$container.querySelector("." + PREFIX_CLASS$1 + "-select-btn").innerHTML = "\n <span>" + (options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO) + "(" + ((realItem == null ? void 0 : realItem.name) || '') + ")</span>\n ";
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 ";
9914
10067
  } else {
9915
10068
  if (_this.value !== _this._level + '') _this.value = _this._level + '';
9916
10069
  }
@@ -10146,7 +10299,8 @@
10146
10299
  var isMobile1 = distExports$3.isMobile();
10147
10300
  if (isMobile1) {
10148
10301
  var _this_locale;
10149
- this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS$1 + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS$1 + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
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>";
10150
10304
  } else {
10151
10305
  var _this_locale1;
10152
10306
  this.$container.innerHTML = IconComponents.date({
@@ -10180,7 +10334,8 @@
10180
10334
  _this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
10181
10335
  _this.emit(EVENTS$2.control.dateChange, date);
10182
10336
  if (date && _this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value")) {
10183
- _this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").innerHTML = _this._getDateStr();
10337
+ // 纯文本,用 textContent 避免把日期字符串交给 HTML 解析器
10338
+ _this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").textContent = _this._getDateStr();
10184
10339
  }
10185
10340
  }
10186
10341
  },
@@ -10227,7 +10382,7 @@
10227
10382
  if (date && !change && this._value !== distExports$3.DateTime.format(date, 'YYYY-MM-DD')) {
10228
10383
  this._value = distExports$3.DateTime.format(date, 'YYYY-MM-DD');
10229
10384
  if (date && this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value")) {
10230
- this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").innerHTML = this._getDateStr();
10385
+ this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value").textContent = this._getDateStr();
10231
10386
  }
10232
10387
  }
10233
10388
  };
@@ -10398,7 +10553,8 @@
10398
10553
  this._value = time;
10399
10554
  var valueEl = this.$container.querySelector("." + PREFIX_CLASS$1 + "-mobile-date-filter-value");
10400
10555
  if (valueEl) {
10401
- valueEl.innerHTML = this._getTimeStr();
10556
+ // time 由调用方传入(setTime 是公开方法),只需纯文本,走 textContent
10557
+ valueEl.textContent = this._getTimeStr();
10402
10558
  }
10403
10559
  }
10404
10560
  };
@@ -11299,8 +11455,12 @@
11299
11455
  }
11300
11456
  this._progress.setCurrent(currentMs);
11301
11457
  };
11302
- /** 没有可用片段信息时退化为整个区间,避免进度条空转 */ _proto._fallbackToRange = function _fallbackToRange() {
11303
- if (!this._hasRange()) return;
11458
+ /**
11459
+ * 没有可用片段信息时退化为整个区间,避免进度条空转
11460
+ *
11461
+ * 两个调用方(`_syncCurrent` 开头、`_updateVisible` 的 `visible` 分支)都已经
11462
+ * 判过 `_hasRange()`,这里不再重复判断。
11463
+ */ _proto._fallbackToRange = function _fallbackToRange() {
11304
11464
  this._progress.setSegment(this._rangeBeginMs, this._rangeEndMs);
11305
11465
  };
11306
11466
  _proto._hasRange = function _hasRange() {
@@ -11374,7 +11534,12 @@
11374
11534
  var _proto = Device.prototype;
11375
11535
  _proto._render = function _render() {
11376
11536
  var _this___options_props_urlInfo, _this___options_props;
11377
- this.$container.innerHTML = '<span class="' + PREFIX_CLASS$1 + "-text " + PREFIX_CLASS$1 + '-text-device">' + 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) + "</span>";
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);
11378
11543
  };
11379
11544
  /**
11380
11545
  * 更新设备序列号
@@ -11385,7 +11550,8 @@
11385
11550
  var $span = this.$container.querySelector("." + PREFIX_CLASS$1 + "-text-device");
11386
11551
  var text = this._splicingString(deviceName, deviceSerial);
11387
11552
  $span == null ? void 0 : $span.setAttribute('title', text);
11388
- $span.innerHTML = text;
11553
+ // 设备信息来自 getDeviceInfo 事件(接口/内核数据),同样走 textContent
11554
+ $span.textContent = text;
11389
11555
  }
11390
11556
  };
11391
11557
  _proto._splicingString = function _splicingString(deviceName, deviceSerial) {
@@ -11781,7 +11947,11 @@
11781
11947
  theme._footer.destroy();
11782
11948
  theme._footer = null;
11783
11949
  }
11950
+ // 移除 header / footer 动画暂停监听(挂在 theme 上,需显式解绑)
11951
+ // 修复:此前只置空引用没有解绑,changeTheme 每调用一次就漏一个监听器,
11952
+ // 且引用被清掉后 _renderTheme 里的兜底解绑也永远不会执行
11784
11953
  if (theme._onPauseTimingFunc) {
11954
+ theme.removeListener(CLEAR_TIMER_HEADER_FOOTER_ANIMATION, theme._onPauseTimingFunc);
11785
11955
  theme._onPauseTimingFunc = null;
11786
11956
  }
11787
11957
  // 移除首帧同步监听(挂在 theme 上,需显式解绑,避免 changeTheme 累积)
@@ -12195,10 +12365,8 @@
12195
12365
  });
12196
12366
  // 当移动端 picker 控件打开时需要关闭动画(定时器)
12197
12367
  // 暂停 header footer 的动画(定时器)
12198
- if (theme._onPauseTimingFunc) {
12199
- theme.removeListener(CLEAR_TIMER_HEADER_FOOTER_ANIMATION, theme._onPauseTimingFunc);
12200
- theme._onPauseTimingFunc = null;
12201
- }
12368
+ // 旧监听的解绑统一在 _unmountedControls 里做(本函数开头已无条件调用过),
12369
+ // 这里不再重复判断
12202
12370
  theme._onPauseTimingFunc = function(open) {
12203
12371
  if (open) {
12204
12372
  var _theme__interactiveResult_clearTimeout, _theme__interactiveResult;
@@ -12592,6 +12760,17 @@
12592
12760
  });
12593
12761
  if (superClass) _set_prototype_of(subClass, superClass);
12594
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
+ }
12595
12774
  function _set_prototype_of(o, p) {
12596
12775
  _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
12597
12776
  o.__proto__ = p;
@@ -12724,6 +12903,7 @@
12724
12903
  domain: 'https://open.ys7.com'
12725
12904
  },
12726
12905
  isEzviz: true,
12906
+ sdkType: 'base',
12727
12907
  /** 移动端竖屏, 全屏情况下不展示扩张,放置在 footer 中 */ mobileExtendOptions: {
12728
12908
  controls: MOBILE_EXTENDS
12729
12909
  }
@@ -13185,10 +13365,16 @@
13185
13365
  // JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
13186
13366
  delete this.options.container;
13187
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
+ ]);
13188
13374
  try {
13189
- this.logger.log('[options] \n', JSON.stringify(this.options));
13375
+ this.logger.log('[options] \n', JSON.stringify(loggableOptions));
13190
13376
  } catch (error) {
13191
- this.logger.log('[options] \n', this.options);
13377
+ this.logger.log('[options] \n', loggableOptions);
13192
13378
  }
13193
13379
  var language = this.options.language || 'zh';
13194
13380
  // 深拷贝内置语言包,避免与模块级 zh/en 常量共享引用(I18n 若对其做合并/修改会污染全局)
@@ -14261,7 +14447,7 @@
14261
14447
  zh: zh,
14262
14448
  en: en
14263
14449
  };
14264
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.7-beta.4';
14450
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.8-beta.2';
14265
14451
 
14266
14452
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
14267
14453