@ezuikit/player-theme 1.0.1-alpha.0 → 2.0.0-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 v1.0.1-alpha.0
3
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v2.0.0-beta.2
3
+ * Copyright (c) 2025-11-12 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -1474,12 +1474,12 @@
1474
1474
  * Released under the MIT License.
1475
1475
  */
1476
1476
 
1477
- var dist$6;
1478
- var hasRequiredDist$6;
1477
+ var dist$a;
1478
+ var hasRequiredDist$a;
1479
1479
 
1480
- function requireDist$6 () {
1481
- if (hasRequiredDist$6) return dist$6;
1482
- hasRequiredDist$6 = 1;
1480
+ function requireDist$a () {
1481
+ if (hasRequiredDist$a) return dist$a;
1482
+ hasRequiredDist$a = 1;
1483
1483
 
1484
1484
  function _array_like_to_array(arr, len) {
1485
1485
  if (len == null || len > arr.length) len = arr.length;
@@ -2029,12 +2029,12 @@
2029
2029
  * ```
2030
2030
  */ Picker.VERSION = "1.1.2";
2031
2031
 
2032
- dist$6 = Picker;
2033
- return dist$6;
2032
+ dist$a = Picker;
2033
+ return dist$a;
2034
2034
  }
2035
2035
 
2036
- var distExports$5 = requireDist$6();
2037
- var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports$5);
2036
+ var distExports$8 = requireDist$a();
2037
+ var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports$8);
2038
2038
 
2039
2039
  /*
2040
2040
  * delegate.js v4.0.0
@@ -2042,12 +2042,12 @@
2042
2042
  * Released under the MIT License.
2043
2043
  */
2044
2044
 
2045
- var dist$5;
2046
- var hasRequiredDist$5;
2045
+ var dist$9;
2046
+ var hasRequiredDist$9;
2047
2047
 
2048
- function requireDist$5 () {
2049
- if (hasRequiredDist$5) return dist$5;
2050
- hasRequiredDist$5 = 1;
2048
+ function requireDist$9 () {
2049
+ if (hasRequiredDist$9) return dist$9;
2050
+ hasRequiredDist$9 = 1;
2051
2051
 
2052
2052
  const DOCUMENT_NODE_TYPE = 9;
2053
2053
  /**
@@ -2160,12 +2160,12 @@
2160
2160
  };
2161
2161
  }
2162
2162
 
2163
- dist$5 = delegate;
2164
- return dist$5;
2163
+ dist$9 = delegate;
2164
+ return dist$9;
2165
2165
  }
2166
2166
 
2167
- var distExports$4 = requireDist$5();
2168
- var delegate = /*@__PURE__*/getDefaultExportFromCjs(distExports$4);
2167
+ var distExports$7 = requireDist$9();
2168
+ var delegate = /*@__PURE__*/getDefaultExportFromCjs(distExports$7);
2169
2169
 
2170
2170
  var cjs;
2171
2171
  var hasRequiredCjs;
@@ -2311,13 +2311,13 @@
2311
2311
  var cjsExports = requireCjs();
2312
2312
  var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
2313
2313
 
2314
- var dist$4 = {};
2314
+ var dist$8 = {};
2315
2315
 
2316
- var hasRequiredDist$4;
2316
+ var hasRequiredDist$8;
2317
2317
 
2318
- function requireDist$4 () {
2319
- if (hasRequiredDist$4) return dist$4;
2320
- hasRequiredDist$4 = 1;
2318
+ function requireDist$8 () {
2319
+ if (hasRequiredDist$8) return dist$8;
2320
+ hasRequiredDist$8 = 1;
2321
2321
 
2322
2322
  var getQuery = function(url) {
2323
2323
  var query = url.split("?")[1], obj = {};
@@ -2356,7 +2356,7 @@
2356
2356
  av1: 32
2357
2357
  };
2358
2358
 
2359
- dist$4.addVc = function(url, codecs) {
2359
+ dist$8.addVc = function(url, codecs) {
2360
2360
  void 0 === codecs && (codecs = [ "h264" ]);
2361
2361
  var vc = (codecs || [ "h264" ]).reduce(function(acc, key) {
2362
2362
  return key = key.toLowerCase(), acc + (__$codec$__[key] || 0);
@@ -2364,7 +2364,7 @@
2364
2364
  return query = (query || "").split("&").filter(function(item) {
2365
2365
  return !/^vc=\d?/.test(item);
2366
2366
  }).join("&"), host + "?" + (query += (query ? "&" : "") + "vc=" + vc);
2367
- }, dist$4.getQuery = getQuery, dist$4.getStaticPath = function(path, base) {
2367
+ }, dist$8.getQuery = getQuery, dist$8.getStaticPath = function(path, base) {
2368
2368
  void 0 === base && (base = "");
2369
2369
  var protocolReg = /^(https?:\/\/|^\/\/)/;
2370
2370
  if ("" === path || void 0 === path) return "";
@@ -2375,17 +2375,17 @@
2375
2375
  } catch (error) {
2376
2376
  return path;
2377
2377
  }
2378
- }, dist$4.isHttp = function(url) {
2378
+ }, dist$8.isHttp = function(url) {
2379
2379
  return /^http[s]?:\/\//.test(url);
2380
- }, dist$4.isMobile = function(agent) {
2380
+ }, dist$8.isMobile = function(agent) {
2381
2381
  var _navigator, _navigator1, _navigator2, _window;
2382
2382
  return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null != agent ? agent : null == (_navigator = navigator) ? void 0 : _navigator.userAgent) || /Macintosh/i.test(null == (_navigator1 = navigator) ? void 0 : _navigator1.userAgent) && (null == (_navigator2 = navigator) ? void 0 : _navigator2.maxTouchPoints) > 1 || (null == (_window = window) ? void 0 : _window.__IS_MOBILE_SIMULATOR__);
2383
- }, dist$4.parseEzopenUrl = parseEzopenUrl, dist$4.pick = function(obj, keys) {
2383
+ }, dist$8.parseEzopenUrl = parseEzopenUrl, dist$8.pick = function(obj, keys) {
2384
2384
  return Object.entries(obj).reduce(function(acc, param) {
2385
2385
  var key = param[0], value = param[1];
2386
2386
  return keys.includes(key) && (acc[key] = value), acc;
2387
2387
  }, {});
2388
- }, dist$4.switchEzopenUrl = function(url, options) {
2388
+ }, dist$8.switchEzopenUrl = function(url, options) {
2389
2389
  var _ref = null != options ? options : {}, type = _ref.type, recType = _ref.recType, search = _ref.search, definition = _ref.definition, channelNo = _ref.channelNo, deviceSerial = _ref.deviceSerial, validateCode = _ref.validateCode, obj = parseEzopenUrl(url);
2390
2390
  if (search) {
2391
2391
  var ns = Object.assign({}, obj.searchParams, getQuery("?" + search.replace("?", "")));
@@ -2399,10 +2399,10 @@
2399
2399
  deviceSerial = deviceSerial || obj.deviceSerial, validateCode = null != validateCode ? validateCode : obj.validateCode,
2400
2400
  obj.protocol + "//" + (validateCode ? validateCode + "@" : "") + obj.hostname + "/" + deviceSerial + "/" + channelNo + ("rec" === type && recType ? "." + recType : "") + ("live" === type && "hd" === definition ? "." + definition : "") + "." + type + search;
2401
2401
  };
2402
- return dist$4;
2402
+ return dist$8;
2403
2403
  }
2404
2404
 
2405
- var distExports$3 = requireDist$4();
2405
+ var distExports$6 = requireDist$8();
2406
2406
 
2407
2407
  /**
2408
2408
  * 节流函数
@@ -2630,7 +2630,7 @@
2630
2630
  * ```ts
2631
2631
  * Utils.isMobile // true | false
2632
2632
  * ```
2633
- */ Utils.isMobile = distExports$3.isMobile();
2633
+ */ Utils.isMobile = distExports$6.isMobile();
2634
2634
 
2635
2635
  function _defineProperties$7(target, props) {
2636
2636
  for(var i = 0; i < props.length; i++){
@@ -3432,7 +3432,7 @@
3432
3432
  var screenfullExports = requireScreenfull();
3433
3433
  var screenfull = /*@__PURE__*/getDefaultExportFromCjs(screenfullExports);
3434
3434
 
3435
- function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
3435
+ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3436
3436
  try {
3437
3437
  var info = gen[key](arg);
3438
3438
  var value = info.value;
@@ -3446,16 +3446,16 @@
3446
3446
  Promise.resolve(value).then(_next, _throw);
3447
3447
  }
3448
3448
  }
3449
- function _async_to_generator$7(fn) {
3449
+ function _async_to_generator$5(fn) {
3450
3450
  return function() {
3451
3451
  var self = this, args = arguments;
3452
3452
  return new Promise(function(resolve, reject) {
3453
3453
  var gen = fn.apply(self, args);
3454
3454
  function _next(value) {
3455
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
3455
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
3456
3456
  }
3457
3457
  function _throw(err) {
3458
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
3458
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
3459
3459
  }
3460
3460
  _next(undefined);
3461
3461
  });
@@ -3675,7 +3675,7 @@
3675
3675
  * 全屏
3676
3676
  * @returns Promise<void>
3677
3677
  */ _proto.fullscreen = function fullscreen() {
3678
- return _async_to_generator$7(function() {
3678
+ return _async_to_generator$5(function() {
3679
3679
  return _ts_generator$5(this, function(_state) {
3680
3680
  switch(_state.label){
3681
3681
  case 0:
@@ -3711,7 +3711,7 @@
3711
3711
  * 退出全屏
3712
3712
  * @returns Promise<void>
3713
3713
  */ _proto.exitFullscreen = function exitFullscreen() {
3714
- return _async_to_generator$7(function() {
3714
+ return _async_to_generator$5(function() {
3715
3715
  return _ts_generator$5(this, function(_state) {
3716
3716
  switch(_state.label){
3717
3717
  case 0:
@@ -3751,7 +3751,7 @@
3751
3751
  * 全屏切换
3752
3752
  * @returns Promise<void>
3753
3753
  */ _proto.toggle = function toggle() {
3754
- return _async_to_generator$7(function() {
3754
+ return _async_to_generator$5(function() {
3755
3755
  return _ts_generator$5(this, function(_state) {
3756
3756
  switch(_state.label){
3757
3757
  case 0:
@@ -4116,13 +4116,13 @@
4116
4116
  return Rec;
4117
4117
  }(Control);
4118
4118
 
4119
- var dist$3 = {exports: {}};
4119
+ var dist$7 = {exports: {}};
4120
4120
 
4121
- var hasRequiredDist$3;
4121
+ var hasRequiredDist$7;
4122
4122
 
4123
- function requireDist$3 () {
4124
- if (hasRequiredDist$3) return dist$3.exports;
4125
- hasRequiredDist$3 = 1;
4123
+ function requireDist$7 () {
4124
+ if (hasRequiredDist$7) return dist$7.exports;
4125
+ hasRequiredDist$7 = 1;
4126
4126
 
4127
4127
  var deepmerge = requireCjs();
4128
4128
 
@@ -4194,19 +4194,19 @@
4194
4194
  } ]), I18n;
4195
4195
  }();
4196
4196
 
4197
- I18n.VERSION = "2.0.0-beta.4", dist$3.exports = I18n;
4198
- return dist$3.exports;
4197
+ I18n.VERSION = "2.0.0-beta.4", dist$7.exports = I18n;
4198
+ return dist$7.exports;
4199
4199
  }
4200
4200
 
4201
- var distExports$2 = requireDist$3();
4202
- var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$2);
4201
+ var distExports$5 = requireDist$7();
4202
+ var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$5);
4203
4203
 
4204
- var dist$2;
4205
- var hasRequiredDist$2;
4204
+ var dist$6;
4205
+ var hasRequiredDist$6;
4206
4206
 
4207
- function requireDist$2 () {
4208
- if (hasRequiredDist$2) return dist$2;
4209
- hasRequiredDist$2 = 1;
4207
+ function requireDist$6 () {
4208
+ if (hasRequiredDist$6) return dist$6;
4209
+ hasRequiredDist$6 = 1;
4210
4210
 
4211
4211
  var _$LoggerStyle$_ = {
4212
4212
  info: "",
@@ -4271,7 +4271,7 @@
4271
4271
 
4272
4272
  var __$list$__ = [ "info", "log", "warn", "error" ];
4273
4273
 
4274
- dist$2 = function(options) {
4274
+ dist$6 = function(options) {
4275
4275
  var logger = new LoggerCls(options);
4276
4276
  return new Proxy(logger, {
4277
4277
  get: function(target, prop) {
@@ -4290,11 +4290,11 @@
4290
4290
  }
4291
4291
  });
4292
4292
  };
4293
- return dist$2;
4293
+ return dist$6;
4294
4294
  }
4295
4295
 
4296
- var distExports$1 = requireDist$2();
4297
- var Logger = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
4296
+ var distExports$4 = requireDist$6();
4297
+ var Logger = /*@__PURE__*/getDefaultExportFromCjs(distExports$4);
4298
4298
 
4299
4299
  var zh = {
4300
4300
  391001: '取流地址或端口非法',
@@ -5396,7 +5396,7 @@
5396
5396
  _inherits$j(Content, EventEmitter);
5397
5397
  function Content(options) {
5398
5398
  var _this;
5399
- _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0;
5399
+ _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0, _this._width = 0, _this._height = 0;
5400
5400
  _this.options = options;
5401
5401
  _this._scaleMode = options.scaleMode || 0;
5402
5402
  _this.$wrapper = document.createElement('div');
@@ -5430,6 +5430,10 @@
5430
5430
  if (originHeight === void 0) originHeight = 0;
5431
5431
  var width = this.$wrapper.clientWidth;
5432
5432
  var height = this.$wrapper.clientHeight;
5433
+ // 防止多次渲染
5434
+ if (this._width === width && this._height === height && this._originWidth === originWidth && this._originHeight === originHeight) return;
5435
+ this._width = width;
5436
+ this._height = height;
5433
5437
  if (originWidth > 0 && originHeight > 0) {
5434
5438
  this._originWidth = originWidth;
5435
5439
  this._originHeight = originHeight;
@@ -5678,7 +5682,7 @@
5678
5682
  });
5679
5683
  theme == null ? void 0 : theme.on(EVENTS.videoInfo, function(info) {
5680
5684
  // 排除流信息回调触发的事件
5681
- if (!!info && info.from !== "setStreamInfoCallBack") {
5685
+ if (info) {
5682
5686
  var // rerender 画面
5683
5687
  _theme_contentControl_emit, _theme_contentControl;
5684
5688
  (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.videoInfo, info.width, info.height);
@@ -6285,738 +6289,786 @@
6285
6289
 
6286
6290
  /*
6287
6291
  * @ezuikit/control-zoom v0.0.2
6288
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
6292
+ * Copyright (c) 2025-11-12 Ezviz-OpenBiz
6289
6293
  * Released under the MIT License.
6290
6294
  */
6291
- /**
6292
- * Zoom position
6293
- *
6294
- */ const ZOOM_DEFAULT_POSITION = [
6295
- 0,
6296
- 0
6297
- ];
6298
- /**
6299
- * 默认值
6300
- */ const DefaultOptions = {
6301
- initialZoom: 1,
6302
- defaultCursor: 'pointer',
6303
- scrollVelocity: 0.1,
6304
- animDuration: 0.25,
6305
- allowZoom: true,
6306
- allowPan: true,
6307
- onChange: ()=>{},
6308
- onTranslateChange: ()=>{},
6309
- onTap: ()=>{},
6310
- max: 8,
6311
- min: 1,
6312
- zoomStep: 0.1,
6313
- allowTouchEvents: false,
6314
- allowWheel: true,
6315
- ignoredMouseButtons: [],
6316
- doubleTouchMaxDelay: 300,
6317
- decelerationDuration: 750
6318
- };
6319
- /**
6320
- * dom 节点放大和拖动
6321
- *
6322
- */ class Zoom {
6323
- get pos() {
6324
- return [
6325
- this.container.clientWidth * this.percentPos[0],
6326
- this.container.clientHeight * this.percentPos[1]
6327
- ];
6328
- }
6329
- // 设置事件侦听器
6330
- setUpEventListeners() {
6331
- const refCurrentValue = this.container;
6332
- const hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
6333
- if (hasMouseDevice) {
6334
- if (this.options.allowWheel) {
6335
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('wheel', this.handleMouseWheel, {
6336
- passive: false
6337
- });
6295
+
6296
+ var dist$5;
6297
+ var hasRequiredDist$5;
6298
+
6299
+ function requireDist$5 () {
6300
+ if (hasRequiredDist$5) return dist$5;
6301
+ hasRequiredDist$5 = 1;
6302
+
6303
+ /**
6304
+ * Zoom position
6305
+ *
6306
+ */ function _defineProperties(target, props) {
6307
+ for(var i = 0; i < props.length; i++){
6308
+ var descriptor = props[i];
6309
+ descriptor.enumerable = descriptor.enumerable || false;
6310
+ descriptor.configurable = true;
6311
+ if ("value" in descriptor) descriptor.writable = true;
6312
+ Object.defineProperty(target, descriptor.key, descriptor);
6313
+ }
6314
+ }
6315
+ function _create_class(Constructor, protoProps, staticProps) {
6316
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
6317
+ return Constructor;
6318
+ }
6319
+ var ZOOM_DEFAULT_POSITION = [
6320
+ 0,
6321
+ 0
6322
+ ];
6323
+ /**
6324
+ * 默认值
6325
+ */ var DefaultOptions = {
6326
+ initialZoom: 1,
6327
+ defaultCursor: 'pointer',
6328
+ scrollVelocity: 0.1,
6329
+ animDuration: 0.25,
6330
+ allowZoom: true,
6331
+ allowPan: true,
6332
+ onChange: function() {},
6333
+ onTranslateChange: function() {},
6334
+ onTap: function() {},
6335
+ max: 8,
6336
+ min: 1,
6337
+ zoomStep: 0.1,
6338
+ allowTouchEvents: false,
6339
+ allowWheel: true,
6340
+ ignoredMouseButtons: [],
6341
+ doubleTouchMaxDelay: 300,
6342
+ decelerationDuration: 750
6343
+ };
6344
+ /**
6345
+ * dom 节点放大和拖动
6346
+ *
6347
+ */ var Zoom = /*#__PURE__*/ function() {
6348
+ function Zoom(container, options) {
6349
+ var _this = this;
6350
+ this._dragging = false;
6351
+ /**
6352
+ * 销毁
6353
+ * destroy
6354
+ */ this.destroy = function() {
6355
+ _this.setAllowZoom(false);
6356
+ _this.reset();
6357
+ _this.removeEventListeners();
6358
+ };
6359
+ /**
6360
+ * 设置是否旋转
6361
+ * @param trans - 是否transform
6362
+ */ this.setTransform = function(trans) {
6363
+ _this.transform = trans;
6364
+ };
6365
+ /**
6366
+ * 获取是否旋转
6367
+ * @returns
6368
+ */ this.getTransform = function() {
6369
+ return _this.transform;
6370
+ };
6371
+ /**
6372
+ * 更新x轴和Y轴平移值
6373
+ */ this.updateTranslate = function() {
6374
+ var translateX = 0;
6375
+ var translateY = 0;
6376
+ if (_this.percentPos[0] < 0) {
6377
+ translateX = _this.percentPos[0] < -(0.5 * (_this.zoom - 1)) ? -(0.5 * (_this.zoom - 1)) : _this.percentPos[0];
6378
+ } else {
6379
+ translateX = _this.percentPos[0] > 0.5 * (_this.zoom - 1) ? 0.5 * (_this.zoom - 1) : _this.percentPos[0];
6380
+ }
6381
+ if (_this.percentPos[1] < 0) {
6382
+ translateY = _this.percentPos[1] < -(0.5 * (_this.zoom - 1)) ? -(0.5 * (_this.zoom - 1)) : _this.percentPos[1];
6383
+ } else {
6384
+ translateY = _this.percentPos[1] > 0.5 * (_this.zoom - 1) ? 0.5 * (_this.zoom - 1) : _this.percentPos[1];
6385
+ }
6386
+ _this.percentPos = [
6387
+ translateX,
6388
+ translateY
6389
+ ];
6390
+ };
6391
+ /**
6392
+ * 更新容器样式
6393
+ */ this.update = function() {
6394
+ if (!_this.container) return;
6395
+ _this.updateTranslate();
6396
+ _this.container.style.transition = "transform ease-out " + _this.transition + "s";
6397
+ _this.container.style.transform = "translate3d(" + _this.percentPos[0] * 100 + "%, " + _this.percentPos[1] * 100 + "%, 0) scale(" + _this.zoom + ")";
6398
+ };
6399
+ /**
6400
+ * 设置支持缩放
6401
+ * @param allow
6402
+ */ this.setAllowZoom = function(allow) {
6403
+ _this.options.allowZoom = allow;
6404
+ };
6405
+ /**
6406
+ * 设置缩放值
6407
+ * @param zoom - 缩放值
6408
+ * @param reset - 是否重置
6409
+ */ this.setZoom = function(zoom, reset) {
6410
+ zoom = parseFloat(zoom.toFixed(_this.getPrecision(_this.options.zoomStep)));
6411
+ if (_this.zoom !== zoom) {
6412
+ _this.zoom = zoom;
6413
+ _this.update();
6414
+ _this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, +_this.zoom.toFixed(_this.getPrecision(_this.options.zoomStep)), reset);
6415
+ }
6416
+ };
6417
+ /**
6418
+ * 获取缩放值
6419
+ * @returns
6420
+ */ this.getZoom = function() {
6421
+ return _this.zoom;
6422
+ };
6423
+ /**
6424
+ * 设置位置
6425
+ * @param pos - 位置 [X轴坐标转换, Y轴坐标转换]
6426
+ */ this.setPos = function(pos) {
6427
+ var _this_container, _this_container1;
6428
+ var containerWidth = (_this_container = _this.container) == null ? void 0 : _this_container.clientWidth;
6429
+ var containerHeight = (_this_container1 = _this.container) == null ? void 0 : _this_container1.clientHeight;
6430
+ if (+_this.pos[0] !== pos[0] || +_this.pos[1] !== pos[1]) {
6431
+ _this.percentPos = [
6432
+ pos[0] / containerWidth,
6433
+ pos[1] / containerHeight
6434
+ ];
6435
+ _this.update();
6436
+ _this.options.onTranslateChange == null ? void 0 : _this.options.onTranslateChange.call(_this.options, {
6437
+ posX: pos[0],
6438
+ posY: pos[1]
6439
+ });
6440
+ }
6441
+ };
6442
+ /**
6443
+ * 设置过渡时间
6444
+ * @param duration - 过渡时间, 单位秒
6445
+ */ this.setTransitionDuration = function(duration) {
6446
+ _this.transition = duration;
6447
+ _this.update();
6448
+ };
6449
+ /**
6450
+ * 设置鼠标样式
6451
+ * @param cursor
6452
+ * @returns
6453
+ */ this.setCursor = function(cursor) {
6454
+ if (!_this.container) return;
6455
+ _this.container.style.cssText += "cursor:" + cursor + ";";
6456
+ _this.cursor = cursor;
6457
+ };
6458
+ this.zoomIn = function(value) {
6459
+ var newPosX = _this.pos[0];
6460
+ var newPosY = _this.pos[1];
6461
+ var prevZoom = _this.zoom;
6462
+ var _this_options_max, _this_options_max1;
6463
+ var newZoom = prevZoom + value < ((_this_options_max = _this.options.max) != null ? _this_options_max : 8) ? prevZoom + value : (_this_options_max1 = _this.options.max) != null ? _this_options_max1 : 8;
6464
+ if (newZoom !== prevZoom) {
6465
+ newPosX = newPosX * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
6466
+ newPosY = newPosY * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
6467
+ }
6468
+ _this.setZoom(newZoom);
6469
+ _this.setPos([
6470
+ newPosX,
6471
+ newPosY
6472
+ ]);
6473
+ _this.setTransitionDuration(_this.options.animDuration);
6474
+ };
6475
+ this.zoomOut = function(value) {
6476
+ var newPosX = _this.pos[0];
6477
+ var newPosY = _this.pos[1];
6478
+ var prevZoom = _this.zoom;
6479
+ var _this_options_min, _this_options_min1;
6480
+ var newZoom = prevZoom - value > ((_this_options_min = _this.options.min) != null ? _this_options_min : 1) ? prevZoom - value : (_this_options_min1 = _this.options.min) != null ? _this_options_min1 : 1;
6481
+ if (newZoom !== prevZoom) {
6482
+ newPosX = newPosX * (newZoom - 1) / (prevZoom - 1);
6483
+ newPosY = newPosY * (newZoom - 1) / (prevZoom - 1);
6484
+ }
6485
+ _this.setZoom(newZoom);
6486
+ _this.setPos([
6487
+ newPosX,
6488
+ newPosY
6489
+ ]);
6490
+ _this.setTransitionDuration(_this.options.animDuration);
6491
+ };
6492
+ this.zoomToZone = function(relX, relY, relWidth, relHeight) {
6493
+ var _this_container;
6494
+ if (!_this.container) return;
6495
+ var newPosX = _this.pos[0];
6496
+ var newPosY = _this.pos[1];
6497
+ var parentRect = ((_this_container = _this.container) == null ? void 0 : _this_container.parentNode).getBoundingClientRect();
6498
+ var prevZoom = _this.zoom;
6499
+ // Calculate zoom factor to scale the zone
6500
+ var optimalZoomX = parentRect.width / relWidth;
6501
+ var optimalZoomY = parentRect.height / relHeight;
6502
+ var _this_options_max;
6503
+ var newZoom = Math.min(optimalZoomX, optimalZoomY, (_this_options_max = _this.options.max) != null ? _this_options_max : 8);
6504
+ // Calculate new position to center the zone
6505
+ var rect = _this.container.getBoundingClientRect();
6506
+ var _ref = [
6507
+ rect.width / prevZoom / 2,
6508
+ rect.height / prevZoom / 2
6509
+ ], centerX = _ref[0], centerY = _ref[1];
6510
+ var _ref1 = [
6511
+ relX + relWidth / 2,
6512
+ relY + relHeight / 2
6513
+ ], zoneCenterX = _ref1[0], zoneCenterY = _ref1[1];
6514
+ newPosX = (centerX - zoneCenterX) * newZoom;
6515
+ newPosY = (centerY - zoneCenterY) * newZoom;
6516
+ _this.setZoom(newZoom);
6517
+ _this.setPos([
6518
+ newPosX,
6519
+ newPosY
6520
+ ]);
6521
+ _this.setTransitionDuration(_this.options.animDuration);
6522
+ };
6523
+ this.getNewPosition = function(x, y, newZoom) {
6524
+ var _ref = [
6525
+ _this.zoom,
6526
+ _this.pos[0],
6527
+ _this.pos[1]
6528
+ ], prevZoom = _ref[0];
6529
+ if (newZoom === 1 || !_this) return ZOOM_DEFAULT_POSITION;
6530
+ var _ref1 = [
6531
+ _this.container.clientWidth,
6532
+ _this.container.clientHeight
6533
+ ], clientWidth = _ref1[0], clientHeight = _ref1[1];
6534
+ if (newZoom > prevZoom) {
6535
+ return [
6536
+ 0,
6537
+ 0
6538
+ ];
6539
+ } else {
6540
+ // 放到最大
6541
+ var w = -((x - clientWidth / 2) / (clientWidth / 2)) * newZoom / 2;
6542
+ var h = -((y - clientHeight / 2) / (clientHeight / 2)) * newZoom / 2;
6543
+ if (w > newZoom / 2 - 0.5) {
6544
+ w = 3.5;
6545
+ }
6546
+ if (h > newZoom / 2 - 0.5) {
6547
+ h = 3.5;
6548
+ }
6549
+ return [
6550
+ clientWidth * w,
6551
+ clientHeight * h
6552
+ ];
6553
+ }
6554
+ };
6555
+ /**
6556
+ * 缩放到最大
6557
+ * @param x - 点击点X坐标
6558
+ * @param y - 点击点Y坐标
6559
+ */ this.fullZoomInOnPosition = function(x, y) {
6560
+ var _this_options_max;
6561
+ var zoom = (_this_options_max = _this.options.max) != null ? _this_options_max : DefaultOptions.max;
6562
+ _this.setZoom(zoom != null ? zoom : DefaultOptions.max);
6563
+ _this.setPos(_this.getNewPosition(x, y, zoom));
6564
+ _this.setTransitionDuration(_this.options.animDuration);
6565
+ };
6566
+ this.getLimitedShift = function(shift, minLimit, maxLimit, minElement, maxElement) {
6567
+ if (shift > 0) {
6568
+ if (minElement > minLimit) {
6569
+ return 0;
6570
+ } else if (minElement + shift > minLimit) {
6571
+ return minLimit - minElement;
6572
+ }
6573
+ } else if (shift < 0) {
6574
+ if (maxElement < maxLimit) {
6575
+ return 0;
6576
+ } else if (maxElement + shift < maxLimit) {
6577
+ return maxLimit - maxElement;
6578
+ }
6579
+ }
6580
+ return shift;
6581
+ };
6582
+ this.getCursor = function(canMoveOnX, canMoveOnY) {
6583
+ if (canMoveOnX && canMoveOnY) {
6584
+ return 'move';
6585
+ } else if (canMoveOnX) {
6586
+ return 'ew-resize';
6587
+ } else if (canMoveOnY) {
6588
+ return 'ns-resize';
6589
+ } else {
6590
+ return 'auto';
6591
+ }
6592
+ };
6593
+ this.move = function(shiftX, shiftY, transitionDuration) {
6594
+ if (transitionDuration === void 0) transitionDuration = 0;
6595
+ if (!_this.container) return;
6596
+ var newPosX = _this.pos[0];
6597
+ var newPosY = _this.pos[1];
6598
+ // let canMoveOnX: boolean, canMoveOnY: boolean;
6599
+ var rect = _this.container.getBoundingClientRect();
6600
+ var parentRect = _this.container.parentNode.getBoundingClientRect();
6601
+ // 根据是否进行了伪横屏旋转,决定是使用 shiftX 还是 shiftY 来对画面进行移动
6602
+ var shiftHorizontal = _this.transform ? shiftY : shiftX;
6603
+ var shiftVertical = _this.transform ? shiftX : shiftY;
6604
+ var _ref = _this.transform ? [
6605
+ rect.height > parentRect.bottom - parentRect.top,
6606
+ shiftVertical > 0 && rect.top - parentRect.top < 0,
6607
+ shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
6608
+ ] : [
6609
+ rect.width > parentRect.right - parentRect.left,
6610
+ shiftHorizontal > 0 && rect.left - parentRect.left < 0,
6611
+ shiftHorizontal < 0 && rect.right - parentRect.right > 0
6612
+ ], isLargerHor = _ref[0], isOutLeftBoundary = _ref[1], isOutRightBoundary = _ref[2];
6613
+ var canMoveOnX = isLargerHor || isOutLeftBoundary || isOutRightBoundary;
6614
+ if (canMoveOnX) {
6615
+ if (_this.transform) {
6616
+ newPosX += _this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
6617
+ } else {
6618
+ newPosX += _this.getLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
6619
+ }
6620
+ }
6621
+ var _ref1 = _this.transform ? [
6622
+ rect.width > parentRect.right - parentRect.left,
6623
+ shiftHorizontal > 0 && rect.right - parentRect.right < 0,
6624
+ shiftHorizontal < 0 && rect.left - parentRect.left > 0
6625
+ ] : [
6626
+ rect.height > parentRect.bottom - parentRect.top,
6627
+ shiftVertical > 0 && rect.top - parentRect.top < 0,
6628
+ shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
6629
+ ], isLargerVer = _ref1[0], isOutTopBoundary = _ref1[1], isOutBottomBoundary = _ref1[2];
6630
+ var canMoveOnY = isLargerVer || isOutTopBoundary || isOutBottomBoundary;
6631
+ if (canMoveOnY) {
6632
+ if (_this.transform) {
6633
+ var transformGetLimitedShift = function(shift, minLimit, maxLimit, minElement, maxElement) {
6634
+ // css伪横屏边界判断特殊处理
6635
+ if (shift > 0) {
6636
+ if (maxElement < maxLimit + 1) {
6637
+ return 0;
6638
+ } else if (maxElement + shift < maxLimit + 1) {
6639
+ return maxLimit - maxElement;
6640
+ }
6641
+ } else if (shift < 0) {
6642
+ if (minElement + 1 > minLimit) {
6643
+ return 0;
6644
+ } else if (minElement + 1 + shift > minLimit) {
6645
+ return minLimit - minElement;
6646
+ }
6647
+ }
6648
+ return shift;
6649
+ };
6650
+ newPosY += transformGetLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
6651
+ } else {
6652
+ newPosY += _this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
6653
+ }
6654
+ }
6655
+ var cursor = _this.getCursor(canMoveOnX, canMoveOnY);
6656
+ _this.setPos([
6657
+ newPosX,
6658
+ newPosY
6659
+ ]);
6660
+ _this.setCursor(cursor);
6661
+ _this.setTransitionDuration(transitionDuration);
6662
+ };
6663
+ /**
6664
+ * 移动端双击
6665
+ * @returns
6666
+ */ this.isDoubleTapping = function() {
6667
+ var touchTime = new Date().getTime();
6668
+ var _this_lastTouchTime, _this_options_doubleTouchMaxDelay, _this_lastDoubleTapTime, _this_options_doubleTouchMaxDelay1;
6669
+ var isDoubleTap = touchTime - ((_this_lastTouchTime = _this.lastTouchTime) != null ? _this_lastTouchTime : 0) < ((_this_options_doubleTouchMaxDelay = _this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay : 300) && touchTime - ((_this_lastDoubleTapTime = _this.lastDoubleTapTime) != null ? _this_lastDoubleTapTime : 0) > ((_this_options_doubleTouchMaxDelay1 = _this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay1 : 750);
6670
+ if (isDoubleTap) {
6671
+ _this.lastDoubleTapTime = touchTime;
6672
+ return true;
6673
+ }
6674
+ _this.lastTouchTime = touchTime;
6675
+ return false;
6676
+ };
6677
+ this.startDeceleration = function(lastShiftOnX, lastShiftOnY) {
6678
+ var startTimestamp = null;
6679
+ var startDecelerationMove = function(timestamp) {
6680
+ if (startTimestamp === null) startTimestamp = timestamp;
6681
+ var progress = timestamp - startTimestamp;
6682
+ var _this_options_decelerationDuration, _this_options_decelerationDuration1;
6683
+ var ratio = (((_this_options_decelerationDuration = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration : 750) - progress) / ((_this_options_decelerationDuration1 = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration1 : 750);
6684
+ var _ref = [
6685
+ lastShiftOnX * ratio,
6686
+ lastShiftOnY * ratio
6687
+ ], shiftX = _ref[0], shiftY = _ref[1];
6688
+ var _this_options_decelerationDuration2;
6689
+ if (progress < ((_this_options_decelerationDuration2 = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration2 : 750) && Math.max(Math.abs(shiftX), Math.abs(shiftY)) > 1) {
6690
+ _this.move(shiftX, shiftY, 0);
6691
+ _this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
6692
+ } else {
6693
+ _this.lastRequestAnimationId = null;
6694
+ }
6695
+ };
6696
+ _this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
6697
+ };
6698
+ this.reset = function() {
6699
+ _this.setZoom(_this.options.initialZoom, true);
6700
+ _this.cursor = _this.options.defaultCursor;
6701
+ _this.setTransitionDuration(_this.options.animDuration);
6702
+ _this.setPos(ZOOM_DEFAULT_POSITION);
6703
+ };
6704
+ // api向前兼容
6705
+ this.addScale = function(scale) {
6706
+ if (scale === void 0) scale = 1;
6707
+ _this.handleZoomAdd(scale);
6708
+ };
6709
+ this.handleZoomAdd = function(scale) {
6710
+ if (scale === void 0) scale = 1;
6711
+ if (!_this.options.allowZoom || !_this.options.allowWheel) return;
6712
+ var newZoom = parseFloat((_this.zoom + scale).toFixed(_this.getPrecision(_this.options.zoomStep)));
6713
+ var _this_options_max;
6714
+ if (newZoom > ((_this_options_max = _this.options.max) != null ? _this_options_max : 8)) {
6715
+ newZoom = 8;
6716
+ }
6717
+ _this.setZoom(newZoom);
6718
+ _this.setPos(_this.pos);
6719
+ _this.setTransitionDuration(0.05);
6720
+ };
6721
+ // api向前兼容
6722
+ this.subScale = function(scale) {
6723
+ if (scale === void 0) scale = 1;
6724
+ _this.handleZoomSub(scale);
6725
+ };
6726
+ this.handleZoomSub = function(scale) {
6727
+ if (scale === void 0) scale = 1;
6728
+ if (!_this.options.allowZoom || !_this.options.allowWheel) return;
6729
+ var newZoom = parseFloat((_this.zoom - scale).toFixed(_this.getPrecision(_this.options.zoomStep)));
6730
+ if (newZoom < 1) {
6731
+ newZoom = 1;
6732
+ }
6733
+ _this.setZoom(newZoom);
6734
+ _this.setPos(_this.pos);
6735
+ _this.setTransitionDuration(0.05);
6736
+ };
6737
+ this.handleMouseWheel = function(event) {
6738
+ event.preventDefault();
6739
+ if (!_this.options.allowZoom || !_this.options.allowWheel) return;
6740
+ var velocity = event.deltaY < 0 ? _this.options.scrollVelocity : 0 - _this.options.scrollVelocity;
6741
+ var _this_options_max, _this_options_min;
6742
+ var newZoom = parseFloat(Math.max(Math.min(_this.zoom + velocity, (_this_options_max = _this.options.max) != null ? _this_options_max : 8), (_this_options_min = _this.options.min) != null ? _this_options_min : 1).toFixed(_this.getPrecision(_this.options.zoomStep)));
6743
+ _this.setZoom(newZoom);
6744
+ // this.setPos(this.getNewPosition(posX, posY, newZoom));
6745
+ _this.setTransitionDuration(0.05);
6746
+ };
6747
+ this.handleMouseStart = function(event) {
6748
+ var _this_options_ignoredMouseButtons;
6749
+ event.preventDefault();
6750
+ if (!_this.options.allowPan || ((_this_options_ignoredMouseButtons = _this.options.ignoredMouseButtons) == null ? void 0 : _this_options_ignoredMouseButtons.includes(event.button))) return;
6751
+ _this._dragging = true;
6752
+ if (_this.lastRequestAnimationId) cancelAnimationFrame(_this.lastRequestAnimationId);
6753
+ _this.lastCursor = _this.getCoordinates(event);
6754
+ };
6755
+ this.handleMouseMove = function(event) {
6756
+ event.preventDefault();
6757
+ if (!_this.options.allowPan || !_this.lastCursor || !_this._dragging) return;
6758
+ _this._touchOrMouseDrag(event);
6759
+ };
6760
+ this.handleMouseStop = function(event) {
6761
+ event.preventDefault();
6762
+ if (_this.lastShift) {
6763
+ _this.startDeceleration(_this.lastShift[0], _this.lastShift[1]);
6764
+ _this.lastShift = null;
6765
+ }
6766
+ _this.lastCursor = null;
6767
+ _this.setCursor('auto');
6768
+ _this._dragging = false;
6769
+ };
6770
+ this.handleTouchStart = function(event) {
6771
+ var isThisDoubleTapping = _this.isDoubleTapping();
6772
+ _this.isMultiTouch = event.touches.length;
6773
+ if (!_this.options.allowTouchEvents) event.preventDefault();
6774
+ if (_this.lastRequestAnimationId) cancelAnimationFrame(_this.lastRequestAnimationId);
6775
+ var _this_getCoordinates = _this.getCoordinates(event.touches[0]), posX = _this_getCoordinates[0], posY = _this_getCoordinates[1];
6776
+ if (_this.isMultiTouch > 1) {
6777
+ _this.lastCursor = [
6778
+ posX,
6779
+ posY
6780
+ ];
6781
+ return;
6782
+ }
6783
+ if (isThisDoubleTapping && _this.options.allowZoom) {
6784
+ if (_this.zoom === 1) {
6785
+ var _this_container_getBoundingClientRect = _this.container.getBoundingClientRect(); _this_container_getBoundingClientRect.top; _this_container_getBoundingClientRect.left; var x = _this_container_getBoundingClientRect.x, y = _this_container_getBoundingClientRect.y;
6786
+ var ref;
6787
+ ref = _this.transform ? [
6788
+ y,
6789
+ x
6790
+ ] : [
6791
+ x,
6792
+ y
6793
+ ], x = ref[0], y = ref[1];
6794
+ var ref1;
6795
+ ref1 = [
6796
+ posX - x,
6797
+ posY - y
6798
+ ], posX = ref1[0], posY = ref1[1];
6799
+ // 双击放大到最大
6800
+ _this.fullZoomInOnPosition(posX, posY);
6801
+ } else {
6802
+ _this.reset();
6803
+ }
6804
+ return;
6805
+ }
6806
+ _this._tapStartTime = new Date().getTime();
6807
+ if (_this.options.allowPan) _this.lastCursor = [
6808
+ posX,
6809
+ posY
6810
+ ];
6811
+ };
6812
+ this.handleTouchMove = function(event) {
6813
+ if (!_this.options.allowTouchEvents) event.preventDefault();
6814
+ if (!_this.lastCursor) return;
6815
+ if (_this.isMultiTouch === 1) {
6816
+ _this._touchOrMouseDrag(event.touches[0]);
6817
+ _this.lastTouchDistance = null;
6818
+ } else if (_this.isMultiTouch > 1) {
6819
+ var newZoom = _this.zoom;
6820
+ // If we detect two points, we shall zoom up or down
6821
+ var _this_getCoordinates = _this.getCoordinates(event.touches[0]), pos1X = _this_getCoordinates[0], pos1Y = _this_getCoordinates[1];
6822
+ var _this_getCoordinates1 = _this.getCoordinates(event.touches[1]), pos2X = _this_getCoordinates1[0], pos2Y = _this_getCoordinates1[1];
6823
+ var distance = Math.sqrt(Math.pow(pos2X - pos1X, 2) + Math.pow(pos2Y - pos1Y, 2));
6824
+ if (_this.lastTouchDistance && distance && distance !== _this.lastTouchDistance) {
6825
+ if (_this.options.allowZoom) {
6826
+ newZoom += (distance - _this.lastTouchDistance) / 100;
6827
+ var _this_options_max, _this_options_min;
6828
+ if (newZoom > ((_this_options_max = _this.options.max) != null ? _this_options_max : 8)) {
6829
+ var _this_options_max1;
6830
+ newZoom = (_this_options_max1 = _this.options.max) != null ? _this_options_max1 : 8;
6831
+ } else if (newZoom < ((_this_options_min = _this.options.min) != null ? _this_options_min : 1)) {
6832
+ var _this_options_min1;
6833
+ newZoom = (_this_options_min1 = _this.options.min) != null ? _this_options_min1 : 1;
6834
+ }
6835
+ }
6836
+ // 不要做移动,因为会有冲突
6837
+ _this.setZoom(newZoom);
6838
+ _this.setTransitionDuration(0);
6839
+ }
6840
+ // Save data for the next move
6841
+ _this.lastCursor = [
6842
+ pos1X,
6843
+ pos1Y
6844
+ ];
6845
+ _this.lastTouchDistance = distance;
6846
+ }
6847
+ };
6848
+ this.handleTouchStop = function() {
6849
+ if (_this.lastShift) {
6850
+ // Use the last shift to make a decelerating movement effect
6851
+ _this.startDeceleration(_this.lastShift[0], _this.lastShift[1]);
6852
+ _this.lastShift = null;
6853
+ }
6854
+ if (_this._tapStartTime && new Date().getTime() - _this._tapStartTime < 200) {
6855
+ _this.options.onTap == null ? void 0 : _this.options.onTap.call(_this.options);
6856
+ }
6857
+ _this._tapStartTime = undefined;
6858
+ _this.lastCursor = null;
6859
+ _this.lastTouchDistance = null;
6860
+ _this.isMultiTouch = 0;
6861
+ };
6862
+ this.container = container;
6863
+ this.options = Object.assign({}, DefaultOptions, options || {});
6864
+ this.percentPos = ZOOM_DEFAULT_POSITION;
6865
+ this.transition = this.options.animDuration;
6866
+ this.zoom = 1;
6867
+ this.cursor = 'auto';
6868
+ this.lastCursor = [
6869
+ 0,
6870
+ 0
6871
+ ];
6872
+ this.lastShift = null;
6873
+ this.lastTouchDistance = null;
6874
+ this.lastRequestAnimationId = null;
6875
+ this.lastTouchTime = new Date().getTime();
6876
+ this.lastDoubleTapTime = new Date().getTime();
6877
+ this.transform = false; // 是否为横屏模式
6878
+ this.isMultiTouch = 1;
6879
+ this.handleMouseMove = this.handleMouseMove.bind(this);
6880
+ this.handleMouseStart = this.handleMouseStart.bind(this);
6881
+ this.handleMouseStop = this.handleMouseStop.bind(this);
6882
+ this.handleMouseWheel = this.handleMouseWheel.bind(this);
6883
+ this.handleTouchStart = this.handleTouchStart.bind(this);
6884
+ this.handleTouchMove = this.handleTouchMove.bind(this);
6885
+ this.handleTouchStop = this.handleTouchStop.bind(this);
6886
+ this.getZoom = this.getZoom.bind(this);
6887
+ this.setZoom = this.setZoom.bind(this);
6888
+ }
6889
+ var _proto = Zoom.prototype;
6890
+ // 设置事件侦听器
6891
+ _proto.setUpEventListeners = function setUpEventListeners() {
6892
+ var refCurrentValue = this.container;
6893
+ var hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
6894
+ if (hasMouseDevice) {
6895
+ if (this.options.allowWheel) {
6896
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('wheel', this.handleMouseWheel, {
6897
+ passive: false
6898
+ });
6899
+ }
6900
+ // Apply mouse events only to devices which include an accurate pointing device
6901
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousedown', this.handleMouseStart, {
6902
+ passive: false
6903
+ });
6904
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousemove', this.handleMouseMove, {
6905
+ passive: false
6906
+ });
6907
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseup', this.handleMouseStop, {
6908
+ passive: false
6909
+ });
6910
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseleave', this.handleMouseStop, {
6911
+ passive: false
6912
+ });
6913
+ } else {
6914
+ // Apply touch events to all other devices
6915
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchstart', this.handleTouchStart, {
6916
+ passive: false
6917
+ });
6918
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchmove', this.handleTouchMove, {
6919
+ passive: false
6920
+ });
6921
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchend', this.handleTouchStop, {
6922
+ passive: false
6923
+ });
6924
+ refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchcancel', this.handleTouchStop, {
6925
+ passive: false
6926
+ });
6927
+ }
6928
+ };
6929
+ // 移除事件侦听器
6930
+ _proto.removeEventListeners = function removeEventListeners() {
6931
+ var refCurrentValue = this.container;
6932
+ var hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
6933
+ if (hasMouseDevice) {
6934
+ if (this.options.allowWheel) {
6935
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('wheel', this.handleMouseWheel);
6936
+ }
6937
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousedown', this.handleMouseStart);
6938
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousemove', this.handleMouseMove);
6939
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseup', this.handleMouseStop);
6940
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseleave', this.handleMouseStop);
6941
+ } else {
6942
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchstart', this.handleTouchStart);
6943
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchmove', this.handleTouchMove);
6944
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchend', this.handleTouchStop);
6945
+ refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchcancel', this.handleTouchStop);
6946
+ }
6947
+ };
6948
+ _proto.getPrecision = function getPrecision(value) {
6949
+ if (value === void 0) value = 1;
6950
+ var valueStr = value.toString();
6951
+ if (valueStr.includes('.')) {
6952
+ return valueStr.split('.')[1].length;
6953
+ } else {
6954
+ return 1;
6955
+ }
6956
+ };
6957
+ /**
6958
+ * 获取坐标 (伪横屏X、Y轴坐标转换, 相对值)
6959
+ * @param event
6960
+ * @returns
6961
+ */ _proto.getCoordinates = function getCoordinates(event) {
6962
+ var clientHeight = this.container.clientHeight;
6963
+ var clientTop = this.container.clientTop;
6964
+ var clientLeft = this.container.clientLeft;
6965
+ var _ref = this.transform ? [
6966
+ event.clientY,
6967
+ clientHeight - event.clientX
6968
+ ] : [
6969
+ event.clientX - clientTop,
6970
+ event.clientY - clientLeft
6971
+ ], x1 = _ref[0], y1 = _ref[1];
6972
+ return [
6973
+ x1,
6974
+ y1
6975
+ ];
6976
+ };
6977
+ _proto._touchOrMouseDrag = function _touchOrMouseDrag(event) {
6978
+ if (this.lastCursor) {
6979
+ var _this_getCoordinates = this.getCoordinates(event), posX = _this_getCoordinates[0], posY = _this_getCoordinates[1];
6980
+ var shiftX = posX - this.lastCursor[0];
6981
+ var shiftY = posY - this.lastCursor[1];
6982
+ this.move(shiftX, shiftY, 0);
6983
+ this.lastCursor = [
6984
+ posX,
6985
+ posY
6986
+ ];
6987
+ this.lastShift = [
6988
+ shiftX,
6989
+ shiftY
6990
+ ];
6991
+ }
6992
+ };
6993
+ _create_class(Zoom, [
6994
+ {
6995
+ key: "pos",
6996
+ get: function get() {
6997
+ return [
6998
+ this.container.clientWidth * this.percentPos[0],
6999
+ this.container.clientHeight * this.percentPos[1]
7000
+ ];
7001
+ }
7002
+ }
7003
+ ]);
7004
+ return Zoom;
7005
+ }();
7006
+ Zoom.VERSION = '0.0.2';
7007
+
7008
+ dist$5 = Zoom;
7009
+ return dist$5;
7010
+ }
7011
+
7012
+ var distExports$3 = requireDist$5();
7013
+ var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$3);
7014
+
7015
+ function _extends$h() {
7016
+ _extends$h = Object.assign || function(target) {
7017
+ for(var i = 1; i < arguments.length; i++){
7018
+ var source = arguments[i];
7019
+ for(var key in source){
7020
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7021
+ target[key] = source[key];
7022
+ }
6338
7023
  }
6339
- // Apply mouse events only to devices which include an accurate pointing device
6340
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousedown', this.handleMouseStart, {
6341
- passive: false
6342
- });
6343
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousemove', this.handleMouseMove, {
6344
- passive: false
6345
- });
6346
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseup', this.handleMouseStop, {
6347
- passive: false
6348
- });
6349
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseleave', this.handleMouseStop, {
6350
- passive: false
6351
- });
6352
- } else {
6353
- // Apply touch events to all other devices
6354
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchstart', this.handleTouchStart, {
6355
- passive: false
6356
- });
6357
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchmove', this.handleTouchMove, {
6358
- passive: false
6359
- });
6360
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchend', this.handleTouchStop, {
6361
- passive: false
6362
- });
6363
- refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchcancel', this.handleTouchStop, {
6364
- passive: false
6365
- });
6366
7024
  }
6367
- }
6368
- // 移除事件侦听器
6369
- removeEventListeners() {
6370
- const refCurrentValue = this.container;
6371
- const hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
6372
- if (hasMouseDevice) {
6373
- if (this.options.allowWheel) {
6374
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('wheel', this.handleMouseWheel);
7025
+ return target;
7026
+ };
7027
+ return _extends$h.apply(this, arguments);
7028
+ }
7029
+ function __zoom(theme, container, options) {
7030
+ theme.zoomUtil = new Zoom(container, _extends$h({}, options || {}, {
7031
+ min: 1,
7032
+ onChange: function(zoom, reset) {
7033
+ if (zoom !== theme._zoom) {
7034
+ var _options_onChange;
7035
+ theme.zoom = zoom;
7036
+ options == null ? void 0 : (_options_onChange = options.onChange) == null ? void 0 : _options_onChange.call(options, zoom, reset);
6375
7037
  }
6376
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousedown', this.handleMouseStart);
6377
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousemove', this.handleMouseMove);
6378
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseup', this.handleMouseStop);
6379
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseleave', this.handleMouseStop);
6380
- } else {
6381
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchstart', this.handleTouchStart);
6382
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchmove', this.handleTouchMove);
6383
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchend', this.handleTouchStop);
6384
- refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchcancel', this.handleTouchStop);
6385
- }
6386
- }
6387
- getPrecision(value = 1) {
6388
- const valueStr = value.toString();
6389
- if (valueStr.includes('.')) {
6390
- return valueStr.split('.')[1].length;
6391
- } else {
6392
- return 1;
6393
- }
6394
- }
6395
- /**
6396
- * 获取坐标 (伪横屏X、Y轴坐标转换, 相对值)
6397
- * @param event
6398
- * @returns
6399
- */ getCoordinates(event) {
6400
- const clientHeight = this.container.clientHeight;
6401
- const clientTop = this.container.clientTop;
6402
- const clientLeft = this.container.clientLeft;
6403
- const [x1, y1] = this.transform ? [
6404
- event.clientY,
6405
- clientHeight - event.clientX
6406
- ] : [
6407
- event.clientX - clientTop,
6408
- event.clientY - clientLeft
6409
- ];
6410
- return [
6411
- x1,
6412
- y1
6413
- ];
7038
+ },
7039
+ onTranslateChange: function(pos) {
7040
+ var _options_onTranslateChange;
7041
+ theme.emit(EVENTS.zoomTranslateChange, pos);
7042
+ options == null ? void 0 : (_options_onTranslateChange = options.onTranslateChange) == null ? void 0 : _options_onTranslateChange.call(options, pos);
7043
+ },
7044
+ onTap: options == null ? void 0 : options.onTap
7045
+ }));
7046
+ }
7047
+
7048
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
7049
+ try {
7050
+ var info = gen[key](arg);
7051
+ var value = info.value;
7052
+ } catch (error) {
7053
+ reject(error);
7054
+ return;
6414
7055
  }
6415
- _touchOrMouseDrag(event) {
6416
- if (this.lastCursor) {
6417
- const [posX, posY] = this.getCoordinates(event);
6418
- const shiftX = posX - this.lastCursor[0];
6419
- const shiftY = posY - this.lastCursor[1];
6420
- this.move(shiftX, shiftY, 0);
6421
- this.lastCursor = [
6422
- posX,
6423
- posY
6424
- ];
6425
- this.lastShift = [
6426
- shiftX,
6427
- shiftY
6428
- ];
6429
- }
6430
- }
6431
- constructor(container, options){
6432
- this._dragging = false;
6433
- /**
6434
- * 销毁
6435
- * destroy
6436
- */ this.destroy = ()=>{
6437
- this.setAllowZoom(false);
6438
- this.reset();
6439
- this.removeEventListeners();
6440
- };
6441
- /**
6442
- * 设置是否旋转
6443
- * @param trans - 是否transform
6444
- */ this.setTransform = (trans)=>{
6445
- this.transform = trans;
6446
- };
6447
- /**
6448
- * 获取是否旋转
6449
- * @returns
6450
- */ this.getTransform = ()=>this.transform;
6451
- /**
6452
- * 更新x轴和Y轴平移值
6453
- */ this.updateTranslate = ()=>{
6454
- let translateX = 0;
6455
- let translateY = 0;
6456
- if (this.percentPos[0] < 0) {
6457
- translateX = this.percentPos[0] < -(0.5 * (this.zoom - 1)) ? -(0.5 * (this.zoom - 1)) : this.percentPos[0];
6458
- } else {
6459
- translateX = this.percentPos[0] > 0.5 * (this.zoom - 1) ? 0.5 * (this.zoom - 1) : this.percentPos[0];
6460
- }
6461
- if (this.percentPos[1] < 0) {
6462
- translateY = this.percentPos[1] < -(0.5 * (this.zoom - 1)) ? -(0.5 * (this.zoom - 1)) : this.percentPos[1];
6463
- } else {
6464
- translateY = this.percentPos[1] > 0.5 * (this.zoom - 1) ? 0.5 * (this.zoom - 1) : this.percentPos[1];
6465
- }
6466
- this.percentPos = [
6467
- translateX,
6468
- translateY
6469
- ];
6470
- };
6471
- /**
6472
- * 更新容器样式
6473
- */ this.update = ()=>{
6474
- if (!this.container) return;
6475
- this.updateTranslate();
6476
- this.container.style.transition = `transform ease-out ${this.transition}s`;
6477
- this.container.style.transform = `translate3d(${this.percentPos[0] * 100}%, ${this.percentPos[1] * 100}%, 0) scale(${this.zoom})`;
6478
- };
6479
- /**
6480
- * 设置支持缩放
6481
- * @param allow
6482
- */ this.setAllowZoom = (allow)=>{
6483
- this.options.allowZoom = allow;
6484
- };
6485
- /**
6486
- * 设置缩放值
6487
- * @param zoom - 缩放值
6488
- * @param reset - 是否重置
6489
- */ this.setZoom = (zoom, reset)=>{
6490
- zoom = parseFloat(zoom.toFixed(this.getPrecision(this.options.zoomStep)));
6491
- if (this.zoom !== zoom) {
6492
- this.zoom = zoom;
6493
- this.update();
6494
- this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, +this.zoom.toFixed(this.getPrecision(this.options.zoomStep)), reset);
6495
- }
6496
- };
6497
- /**
6498
- * 获取缩放值
6499
- * @returns
6500
- */ this.getZoom = ()=>this.zoom;
6501
- /**
6502
- * 设置位置
6503
- * @param pos - 位置 [X轴坐标转换, Y轴坐标转换]
6504
- */ this.setPos = (pos)=>{
6505
- var _this_container, _this_container1;
6506
- const containerWidth = (_this_container = this.container) == null ? void 0 : _this_container.clientWidth;
6507
- const containerHeight = (_this_container1 = this.container) == null ? void 0 : _this_container1.clientHeight;
6508
- if (+this.pos[0] !== pos[0] || +this.pos[1] !== pos[1]) {
6509
- this.percentPos = [
6510
- pos[0] / containerWidth,
6511
- pos[1] / containerHeight
6512
- ];
6513
- this.update();
6514
- this.options.onTranslateChange == null ? void 0 : this.options.onTranslateChange.call(this.options, {
6515
- posX: pos[0],
6516
- posY: pos[1]
6517
- });
6518
- }
6519
- };
6520
- /**
6521
- * 设置过渡时间
6522
- * @param duration - 过渡时间, 单位秒
6523
- */ this.setTransitionDuration = (duration)=>{
6524
- this.transition = duration;
6525
- this.update();
6526
- };
6527
- /**
6528
- * 设置鼠标样式
6529
- * @param cursor
6530
- * @returns
6531
- */ this.setCursor = (cursor)=>{
6532
- if (!this.container) return;
6533
- this.container.style.cssText += `cursor:${cursor};`;
6534
- this.cursor = cursor;
6535
- };
6536
- this.zoomIn = (value)=>{
6537
- let newPosX = this.pos[0];
6538
- let newPosY = this.pos[1];
6539
- const prevZoom = this.zoom;
6540
- var _this_options_max, _this_options_max1;
6541
- const newZoom = prevZoom + value < ((_this_options_max = this.options.max) != null ? _this_options_max : 8) ? prevZoom + value : (_this_options_max1 = this.options.max) != null ? _this_options_max1 : 8;
6542
- if (newZoom !== prevZoom) {
6543
- newPosX = newPosX * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
6544
- newPosY = newPosY * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
6545
- }
6546
- this.setZoom(newZoom);
6547
- this.setPos([
6548
- newPosX,
6549
- newPosY
6550
- ]);
6551
- this.setTransitionDuration(this.options.animDuration);
6552
- };
6553
- this.zoomOut = (value)=>{
6554
- let newPosX = this.pos[0];
6555
- let newPosY = this.pos[1];
6556
- const prevZoom = this.zoom;
6557
- var _this_options_min, _this_options_min1;
6558
- const newZoom = prevZoom - value > ((_this_options_min = this.options.min) != null ? _this_options_min : 1) ? prevZoom - value : (_this_options_min1 = this.options.min) != null ? _this_options_min1 : 1;
6559
- if (newZoom !== prevZoom) {
6560
- newPosX = newPosX * (newZoom - 1) / (prevZoom - 1);
6561
- newPosY = newPosY * (newZoom - 1) / (prevZoom - 1);
6562
- }
6563
- this.setZoom(newZoom);
6564
- this.setPos([
6565
- newPosX,
6566
- newPosY
6567
- ]);
6568
- this.setTransitionDuration(this.options.animDuration);
6569
- };
6570
- this.zoomToZone = (relX, relY, relWidth, relHeight)=>{
6571
- var _this_container;
6572
- if (!this.container) return;
6573
- let newPosX = this.pos[0];
6574
- let newPosY = this.pos[1];
6575
- const parentRect = ((_this_container = this.container) == null ? void 0 : _this_container.parentNode).getBoundingClientRect();
6576
- const prevZoom = this.zoom;
6577
- // Calculate zoom factor to scale the zone
6578
- const optimalZoomX = parentRect.width / relWidth;
6579
- const optimalZoomY = parentRect.height / relHeight;
6580
- var _this_options_max;
6581
- const newZoom = Math.min(optimalZoomX, optimalZoomY, (_this_options_max = this.options.max) != null ? _this_options_max : 8);
6582
- // Calculate new position to center the zone
6583
- const rect = this.container.getBoundingClientRect();
6584
- const [centerX, centerY] = [
6585
- rect.width / prevZoom / 2,
6586
- rect.height / prevZoom / 2
6587
- ];
6588
- const [zoneCenterX, zoneCenterY] = [
6589
- relX + relWidth / 2,
6590
- relY + relHeight / 2
6591
- ];
6592
- newPosX = (centerX - zoneCenterX) * newZoom;
6593
- newPosY = (centerY - zoneCenterY) * newZoom;
6594
- this.setZoom(newZoom);
6595
- this.setPos([
6596
- newPosX,
6597
- newPosY
6598
- ]);
6599
- this.setTransitionDuration(this.options.animDuration);
6600
- };
6601
- this.getNewPosition = (x, y, newZoom)=>{
6602
- const [prevZoom] = [
6603
- this.zoom,
6604
- this.pos[0],
6605
- this.pos[1]
6606
- ];
6607
- if (newZoom === 1 || !this) return ZOOM_DEFAULT_POSITION;
6608
- const [clientWidth, clientHeight] = [
6609
- this.container.clientWidth,
6610
- this.container.clientHeight
6611
- ];
6612
- if (newZoom > prevZoom) {
6613
- return [
6614
- 0,
6615
- 0
6616
- ];
6617
- } else {
6618
- // 放到最大
6619
- let w = -((x - clientWidth / 2) / (clientWidth / 2)) * newZoom / 2;
6620
- let h = -((y - clientHeight / 2) / (clientHeight / 2)) * newZoom / 2;
6621
- if (w > newZoom / 2 - 0.5) {
6622
- w = 3.5;
6623
- }
6624
- if (h > newZoom / 2 - 0.5) {
6625
- h = 3.5;
6626
- }
6627
- return [
6628
- clientWidth * w,
6629
- clientHeight * h
6630
- ];
6631
- }
6632
- };
6633
- /**
6634
- * 缩放到最大
6635
- * @param x - 点击点X坐标
6636
- * @param y - 点击点Y坐标
6637
- */ this.fullZoomInOnPosition = (x, y)=>{
6638
- var _this_options_max;
6639
- const zoom = (_this_options_max = this.options.max) != null ? _this_options_max : DefaultOptions.max;
6640
- this.setZoom(zoom != null ? zoom : DefaultOptions.max);
6641
- this.setPos(this.getNewPosition(x, y, zoom));
6642
- this.setTransitionDuration(this.options.animDuration);
6643
- };
6644
- this.getLimitedShift = (shift, minLimit, maxLimit, minElement, maxElement)=>{
6645
- if (shift > 0) {
6646
- if (minElement > minLimit) {
6647
- return 0;
6648
- } else if (minElement + shift > minLimit) {
6649
- return minLimit - minElement;
6650
- }
6651
- } else if (shift < 0) {
6652
- if (maxElement < maxLimit) {
6653
- return 0;
6654
- } else if (maxElement + shift < maxLimit) {
6655
- return maxLimit - maxElement;
6656
- }
6657
- }
6658
- return shift;
6659
- };
6660
- this.getCursor = (canMoveOnX, canMoveOnY)=>{
6661
- if (canMoveOnX && canMoveOnY) {
6662
- return 'move';
6663
- } else if (canMoveOnX) {
6664
- return 'ew-resize';
6665
- } else if (canMoveOnY) {
6666
- return 'ns-resize';
6667
- } else {
6668
- return 'auto';
6669
- }
6670
- };
6671
- this.move = (shiftX, shiftY, transitionDuration = 0)=>{
6672
- if (!this.container) return;
6673
- let newPosX = this.pos[0];
6674
- let newPosY = this.pos[1];
6675
- // let canMoveOnX: boolean, canMoveOnY: boolean;
6676
- const rect = this.container.getBoundingClientRect();
6677
- const parentRect = this.container.parentNode.getBoundingClientRect();
6678
- // 根据是否进行了伪横屏旋转,决定是使用 shiftX 还是 shiftY 来对画面进行移动
6679
- const shiftHorizontal = this.transform ? shiftY : shiftX;
6680
- const shiftVertical = this.transform ? shiftX : shiftY;
6681
- const [isLargerHor, isOutLeftBoundary, isOutRightBoundary] = this.transform ? [
6682
- rect.height > parentRect.bottom - parentRect.top,
6683
- shiftVertical > 0 && rect.top - parentRect.top < 0,
6684
- shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
6685
- ] : [
6686
- rect.width > parentRect.right - parentRect.left,
6687
- shiftHorizontal > 0 && rect.left - parentRect.left < 0,
6688
- shiftHorizontal < 0 && rect.right - parentRect.right > 0
6689
- ];
6690
- const canMoveOnX = isLargerHor || isOutLeftBoundary || isOutRightBoundary;
6691
- if (canMoveOnX) {
6692
- if (this.transform) {
6693
- newPosX += this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
6694
- } else {
6695
- newPosX += this.getLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
6696
- }
6697
- }
6698
- const [isLargerVer, isOutTopBoundary, isOutBottomBoundary] = this.transform ? [
6699
- rect.width > parentRect.right - parentRect.left,
6700
- shiftHorizontal > 0 && rect.right - parentRect.right < 0,
6701
- shiftHorizontal < 0 && rect.left - parentRect.left > 0
6702
- ] : [
6703
- rect.height > parentRect.bottom - parentRect.top,
6704
- shiftVertical > 0 && rect.top - parentRect.top < 0,
6705
- shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
6706
- ];
6707
- const canMoveOnY = isLargerVer || isOutTopBoundary || isOutBottomBoundary;
6708
- if (canMoveOnY) {
6709
- if (this.transform) {
6710
- const transformGetLimitedShift = (shift, minLimit, maxLimit, minElement, maxElement)=>{
6711
- // css伪横屏边界判断特殊处理
6712
- if (shift > 0) {
6713
- if (maxElement < maxLimit + 1) {
6714
- return 0;
6715
- } else if (maxElement + shift < maxLimit + 1) {
6716
- return maxLimit - maxElement;
6717
- }
6718
- } else if (shift < 0) {
6719
- if (minElement + 1 > minLimit) {
6720
- return 0;
6721
- } else if (minElement + 1 + shift > minLimit) {
6722
- return minLimit - minElement;
6723
- }
6724
- }
6725
- return shift;
6726
- };
6727
- newPosY += transformGetLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
6728
- } else {
6729
- newPosY += this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
6730
- }
6731
- }
6732
- const cursor = this.getCursor(canMoveOnX, canMoveOnY);
6733
- this.setPos([
6734
- newPosX,
6735
- newPosY
6736
- ]);
6737
- this.setCursor(cursor);
6738
- this.setTransitionDuration(transitionDuration);
6739
- };
6740
- /**
6741
- * 移动端双击
6742
- * @returns
6743
- */ this.isDoubleTapping = ()=>{
6744
- const touchTime = new Date().getTime();
6745
- var _this_lastTouchTime, _this_options_doubleTouchMaxDelay, _this_lastDoubleTapTime, _this_options_doubleTouchMaxDelay1;
6746
- const isDoubleTap = touchTime - ((_this_lastTouchTime = this.lastTouchTime) != null ? _this_lastTouchTime : 0) < ((_this_options_doubleTouchMaxDelay = this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay : 300) && touchTime - ((_this_lastDoubleTapTime = this.lastDoubleTapTime) != null ? _this_lastDoubleTapTime : 0) > ((_this_options_doubleTouchMaxDelay1 = this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay1 : 750);
6747
- if (isDoubleTap) {
6748
- this.lastDoubleTapTime = touchTime;
6749
- return true;
6750
- }
6751
- this.lastTouchTime = touchTime;
6752
- return false;
6753
- };
6754
- this.startDeceleration = (lastShiftOnX, lastShiftOnY)=>{
6755
- let startTimestamp = null;
6756
- const startDecelerationMove = (timestamp)=>{
6757
- if (startTimestamp === null) startTimestamp = timestamp;
6758
- const progress = timestamp - startTimestamp;
6759
- var _this_options_decelerationDuration, _this_options_decelerationDuration1;
6760
- const ratio = (((_this_options_decelerationDuration = this.options.decelerationDuration) != null ? _this_options_decelerationDuration : 750) - progress) / ((_this_options_decelerationDuration1 = this.options.decelerationDuration) != null ? _this_options_decelerationDuration1 : 750);
6761
- const [shiftX, shiftY] = [
6762
- lastShiftOnX * ratio,
6763
- lastShiftOnY * ratio
6764
- ];
6765
- var _this_options_decelerationDuration2;
6766
- if (progress < ((_this_options_decelerationDuration2 = this.options.decelerationDuration) != null ? _this_options_decelerationDuration2 : 750) && Math.max(Math.abs(shiftX), Math.abs(shiftY)) > 1) {
6767
- this.move(shiftX, shiftY, 0);
6768
- this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
6769
- } else {
6770
- this.lastRequestAnimationId = null;
6771
- }
6772
- };
6773
- this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
6774
- };
6775
- this.reset = ()=>{
6776
- this.setZoom(this.options.initialZoom, true);
6777
- this.cursor = this.options.defaultCursor;
6778
- this.setTransitionDuration(this.options.animDuration);
6779
- this.setPos(ZOOM_DEFAULT_POSITION);
6780
- };
6781
- // api向前兼容
6782
- this.addScale = (scale = 1)=>{
6783
- this.handleZoomAdd(scale);
6784
- };
6785
- this.handleZoomAdd = (scale = 1)=>{
6786
- if (!this.options.allowZoom || !this.options.allowWheel) return;
6787
- let newZoom = parseFloat((this.zoom + scale).toFixed(this.getPrecision(this.options.zoomStep)));
6788
- var _this_options_max;
6789
- if (newZoom > ((_this_options_max = this.options.max) != null ? _this_options_max : 8)) {
6790
- newZoom = 8;
6791
- }
6792
- this.setZoom(newZoom);
6793
- this.setPos(this.pos);
6794
- this.setTransitionDuration(0.05);
6795
- };
6796
- // api向前兼容
6797
- this.subScale = (scale = 1)=>{
6798
- this.handleZoomSub(scale);
6799
- };
6800
- this.handleZoomSub = (scale = 1)=>{
6801
- if (!this.options.allowZoom || !this.options.allowWheel) return;
6802
- let newZoom = parseFloat((this.zoom - scale).toFixed(this.getPrecision(this.options.zoomStep)));
6803
- if (newZoom < 1) {
6804
- newZoom = 1;
6805
- }
6806
- this.setZoom(newZoom);
6807
- this.setPos(this.pos);
6808
- this.setTransitionDuration(0.05);
6809
- };
6810
- this.handleMouseWheel = (event)=>{
6811
- event.preventDefault();
6812
- if (!this.options.allowZoom || !this.options.allowWheel) return;
6813
- const velocity = event.deltaY < 0 ? this.options.scrollVelocity : 0 - this.options.scrollVelocity;
6814
- var _this_options_max, _this_options_min;
6815
- const newZoom = parseFloat(Math.max(Math.min(this.zoom + velocity, (_this_options_max = this.options.max) != null ? _this_options_max : 8), (_this_options_min = this.options.min) != null ? _this_options_min : 1).toFixed(this.getPrecision(this.options.zoomStep)));
6816
- this.setZoom(newZoom);
6817
- // this.setPos(this.getNewPosition(posX, posY, newZoom));
6818
- this.setTransitionDuration(0.05);
6819
- };
6820
- this.handleMouseStart = (event)=>{
6821
- var _this_options_ignoredMouseButtons;
6822
- event.preventDefault();
6823
- if (!this.options.allowPan || ((_this_options_ignoredMouseButtons = this.options.ignoredMouseButtons) == null ? void 0 : _this_options_ignoredMouseButtons.includes(event.button))) return;
6824
- this._dragging = true;
6825
- if (this.lastRequestAnimationId) cancelAnimationFrame(this.lastRequestAnimationId);
6826
- this.lastCursor = this.getCoordinates(event);
6827
- };
6828
- this.handleMouseMove = (event)=>{
6829
- event.preventDefault();
6830
- if (!this.options.allowPan || !this.lastCursor || !this._dragging) return;
6831
- this._touchOrMouseDrag(event);
6832
- };
6833
- this.handleMouseStop = (event)=>{
6834
- event.preventDefault();
6835
- if (this.lastShift) {
6836
- this.startDeceleration(this.lastShift[0], this.lastShift[1]);
6837
- this.lastShift = null;
6838
- }
6839
- this.lastCursor = null;
6840
- this.setCursor('auto');
6841
- this._dragging = false;
6842
- };
6843
- this.handleTouchStart = (event)=>{
6844
- const isThisDoubleTapping = this.isDoubleTapping();
6845
- this.isMultiTouch = event.touches.length;
6846
- if (!this.options.allowTouchEvents) event.preventDefault();
6847
- if (this.lastRequestAnimationId) cancelAnimationFrame(this.lastRequestAnimationId);
6848
- let [posX, posY] = this.getCoordinates(event.touches[0]);
6849
- if (this.isMultiTouch > 1) {
6850
- this.lastCursor = [
6851
- posX,
6852
- posY
6853
- ];
6854
- return;
6855
- }
6856
- if (isThisDoubleTapping && this.options.allowZoom) {
6857
- if (this.zoom === 1) {
6858
- let { top, left, x, y } = this.container.getBoundingClientRect();
6859
- [x, y] = this.transform ? [
6860
- y,
6861
- x
6862
- ] : [
6863
- x,
6864
- y
6865
- ];
6866
- [posX, posY] = [
6867
- posX - x,
6868
- posY - y
6869
- ];
6870
- // 双击放大到最大
6871
- this.fullZoomInOnPosition(posX, posY);
6872
- } else {
6873
- this.reset();
6874
- }
6875
- return;
6876
- }
6877
- this._tapStartTime = new Date().getTime();
6878
- if (this.options.allowPan) this.lastCursor = [
6879
- posX,
6880
- posY
6881
- ];
6882
- };
6883
- this.handleTouchMove = (event)=>{
6884
- if (!this.options.allowTouchEvents) event.preventDefault();
6885
- if (!this.lastCursor) return;
6886
- if (this.isMultiTouch === 1) {
6887
- this._touchOrMouseDrag(event.touches[0]);
6888
- this.lastTouchDistance = null;
6889
- } else if (this.isMultiTouch > 1) {
6890
- let newZoom = this.zoom;
6891
- // If we detect two points, we shall zoom up or down
6892
- const [pos1X, pos1Y] = this.getCoordinates(event.touches[0]);
6893
- const [pos2X, pos2Y] = this.getCoordinates(event.touches[1]);
6894
- const distance = Math.sqrt(Math.pow(pos2X - pos1X, 2) + Math.pow(pos2Y - pos1Y, 2));
6895
- if (this.lastTouchDistance && distance && distance !== this.lastTouchDistance) {
6896
- if (this.options.allowZoom) {
6897
- newZoom += (distance - this.lastTouchDistance) / 100;
6898
- var _this_options_max, _this_options_min;
6899
- if (newZoom > ((_this_options_max = this.options.max) != null ? _this_options_max : 8)) {
6900
- var _this_options_max1;
6901
- newZoom = (_this_options_max1 = this.options.max) != null ? _this_options_max1 : 8;
6902
- } else if (newZoom < ((_this_options_min = this.options.min) != null ? _this_options_min : 1)) {
6903
- var _this_options_min1;
6904
- newZoom = (_this_options_min1 = this.options.min) != null ? _this_options_min1 : 1;
6905
- }
6906
- }
6907
- // 不要做移动,因为会有冲突
6908
- this.setZoom(newZoom);
6909
- this.setTransitionDuration(0);
6910
- }
6911
- // Save data for the next move
6912
- this.lastCursor = [
6913
- pos1X,
6914
- pos1Y
6915
- ];
6916
- this.lastTouchDistance = distance;
6917
- }
6918
- };
6919
- this.handleTouchStop = ()=>{
6920
- if (this.lastShift) {
6921
- // Use the last shift to make a decelerating movement effect
6922
- this.startDeceleration(this.lastShift[0], this.lastShift[1]);
6923
- this.lastShift = null;
6924
- }
6925
- if (this._tapStartTime && new Date().getTime() - this._tapStartTime < 200) {
6926
- this.options.onTap == null ? void 0 : this.options.onTap.call(this.options);
6927
- }
6928
- this._tapStartTime = undefined;
6929
- this.lastCursor = null;
6930
- this.lastTouchDistance = null;
6931
- this.isMultiTouch = 0;
6932
- };
6933
- this.container = container;
6934
- this.options = Object.assign({}, DefaultOptions, options || {});
6935
- this.percentPos = ZOOM_DEFAULT_POSITION;
6936
- this.transition = this.options.animDuration;
6937
- this.zoom = 1;
6938
- this.cursor = 'auto';
6939
- this.lastCursor = [
6940
- 0,
6941
- 0
6942
- ];
6943
- this.lastShift = null;
6944
- this.lastTouchDistance = null;
6945
- this.lastRequestAnimationId = null;
6946
- this.lastTouchTime = new Date().getTime();
6947
- this.lastDoubleTapTime = new Date().getTime();
6948
- this.transform = false; // 是否为横屏模式
6949
- this.isMultiTouch = 1;
6950
- this.handleMouseMove = this.handleMouseMove.bind(this);
6951
- this.handleMouseStart = this.handleMouseStart.bind(this);
6952
- this.handleMouseStop = this.handleMouseStop.bind(this);
6953
- this.handleMouseWheel = this.handleMouseWheel.bind(this);
6954
- this.handleTouchStart = this.handleTouchStart.bind(this);
6955
- this.handleTouchMove = this.handleTouchMove.bind(this);
6956
- this.handleTouchStop = this.handleTouchStop.bind(this);
6957
- this.getZoom = this.getZoom.bind(this);
6958
- this.setZoom = this.setZoom.bind(this);
6959
- }
6960
- }
6961
- Zoom.VERSION = '0.0.2';
6962
-
6963
- function _extends$h() {
6964
- _extends$h = Object.assign || function(target) {
6965
- for(var i = 1; i < arguments.length; i++){
6966
- var source = arguments[i];
6967
- for(var key in source){
6968
- if (Object.prototype.hasOwnProperty.call(source, key)) {
6969
- target[key] = source[key];
6970
- }
6971
- }
6972
- }
6973
- return target;
6974
- };
6975
- return _extends$h.apply(this, arguments);
6976
- }
6977
- function __zoom(theme, container, options) {
6978
- theme.zoomUtil = new Zoom(container, _extends$h({}, options || {}, {
6979
- min: 1,
6980
- onChange: function(zoom, reset) {
6981
- if (zoom !== theme._zoom) {
6982
- var _options_onChange;
6983
- theme.zoom = zoom;
6984
- options == null ? void 0 : (_options_onChange = options.onChange) == null ? void 0 : _options_onChange.call(options, zoom, reset);
6985
- }
6986
- },
6987
- onTranslateChange: function(pos) {
6988
- var _options_onTranslateChange;
6989
- theme.emit(EVENTS.zoomTranslateChange, pos);
6990
- options == null ? void 0 : (_options_onTranslateChange = options.onTranslateChange) == null ? void 0 : _options_onTranslateChange.call(options, pos);
6991
- },
6992
- onTap: options == null ? void 0 : options.onTap
6993
- }));
6994
- }
6995
-
6996
- function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
6997
- try {
6998
- var info = gen[key](arg);
6999
- var value = info.value;
7000
- } catch (error) {
7001
- reject(error);
7002
- return;
7003
- }
7004
- if (info.done) {
7005
- resolve(value);
7006
- } else {
7007
- Promise.resolve(value).then(_next, _throw);
7056
+ if (info.done) {
7057
+ resolve(value);
7058
+ } else {
7059
+ Promise.resolve(value).then(_next, _throw);
7008
7060
  }
7009
7061
  }
7010
- function _async_to_generator$6(fn) {
7062
+ function _async_to_generator$4(fn) {
7011
7063
  return function() {
7012
7064
  var self = this, args = arguments;
7013
7065
  return new Promise(function(resolve, reject) {
7014
7066
  var gen = fn.apply(self, args);
7015
7067
  function _next(value) {
7016
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
7068
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
7017
7069
  }
7018
7070
  function _throw(err) {
7019
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
7071
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
7020
7072
  }
7021
7073
  _next(undefined);
7022
7074
  });
@@ -7114,7 +7166,7 @@
7114
7166
  }
7115
7167
  }
7116
7168
  function getThemeDataByTemplate(theme, id) {
7117
- return _async_to_generator$6(function() {
7169
+ return _async_to_generator$4(function() {
7118
7170
  var _theme_options_token_httpToken, _theme_options_token, url;
7119
7171
  return _ts_generator$4(this, function(_state) {
7120
7172
  switch(_state.label){
@@ -7125,7 +7177,7 @@
7125
7177
  fetch(url, {
7126
7178
  method: 'GET'
7127
7179
  }).then(function(response) {
7128
- return _async_to_generator$6(function() {
7180
+ return _async_to_generator$4(function() {
7129
7181
  return _ts_generator$4(this, function(_state) {
7130
7182
  switch(_state.label){
7131
7183
  case 0:
@@ -7171,7 +7223,7 @@
7171
7223
  })();
7172
7224
  }
7173
7225
 
7174
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
7226
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
7175
7227
  try {
7176
7228
  var info = gen[key](arg);
7177
7229
  var value = info.value;
@@ -7185,16 +7237,16 @@
7185
7237
  Promise.resolve(value).then(_next, _throw);
7186
7238
  }
7187
7239
  }
7188
- function _async_to_generator$5(fn) {
7240
+ function _async_to_generator$3(fn) {
7189
7241
  return function() {
7190
7242
  var self = this, args = arguments;
7191
7243
  return new Promise(function(resolve, reject) {
7192
7244
  var gen = fn.apply(self, args);
7193
7245
  function _next(value) {
7194
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
7246
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
7195
7247
  }
7196
7248
  function _throw(err) {
7197
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
7249
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
7198
7250
  }
7199
7251
  _next(undefined);
7200
7252
  });
@@ -7425,7 +7477,7 @@
7425
7477
  * @param data
7426
7478
  * @returns
7427
7479
  */ function getThemeData(theme, data) {
7428
- return _async_to_generator$5(function() {
7480
+ return _async_to_generator$3(function() {
7429
7481
  var themeData, _theme_logger, template;
7430
7482
  return _ts_generator$3(this, function(_state) {
7431
7483
  switch(_state.label){
@@ -8033,767 +8085,966 @@
8033
8085
  return CapturePicture;
8034
8086
  }(Control);
8035
8087
 
8088
+ var dist$4 = {};
8089
+
8090
+ var dist$3 = {};
8091
+
8092
+ /*
8093
+ * @ezuikit/utils-tools v1.1.1-beta.1
8094
+ * tools utils
8095
+ * Copyright (c) 2025-09-01 Ezviz-OpenBiz
8096
+ * Released under the MIT License.
8097
+ */
8098
+
8099
+ var hasRequiredDist$4;
8100
+
8101
+ function requireDist$4 () {
8102
+ if (hasRequiredDist$4) return dist$3;
8103
+ hasRequiredDist$4 = 1;
8104
+ const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","");}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;const pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return {}}const codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};dist$3.addVc=function(url){const vc=((arguments.length>1&&void 0!==arguments[1]?arguments[1]:["h264"])||["h264"]).reduce(((acc,key)=>(key=key.toLowerCase(),acc+(codec[key]||0))),0),host=url.split("?")[0];let query=url.split("?")[1];return query=(query||"").split("&").filter((item=>!/^vc=\d?/.test(item))).join("&"),query+=`${query?"&":""}vc=${vc}`,host+"?"+query},dist$3.getQuery=getQuery,dist$3.getStaticPath=function(path){let base=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const protocolReg=/^(https?:\/\/|^\/\/)/;if(""===path||void 0===path)return "";if(protocolReg.test(path))return path;path=path.replace(/\/+/g,"/"),base=protocolReg.test(base||"")?base:window.location.href;try{return new URL(path,base).href}catch(error){return path}},dist$3.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$3.isMobile=function(agent){var _navigator,_navigator1,_navigator2,_window;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1||(null==(_window=window)?void 0:_window.__IS_MOBILE_SIMULATOR__)},dist$3.parseEzopenUrl=parseEzopenUrl,dist$3.pick=function(obj,keys){return Object.entries(obj).reduce(((acc,_ref)=>{let[key,value]=_ref;return keys.includes(key)&&(acc[key]=value),acc}),{})},dist$3.switchEzopenUrl=function(url,options){let{type:type,recType:recType,search:search,definition:definition,channelNo:channelNo,deviceSerial:deviceSerial,validateCode:validateCode}=null!=options?options:{};const obj=parseEzopenUrl(url);if(search){const ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(((acc,_ref)=>{let[key,value]=_ref;return ""===value?acc:acc+=`${key}=${encodeURIComponent(value)}&`}),"?").replace(/&$/,"");}else search=obj.search;return type=type||obj.type,recType=null!=recType?recType:obj.recType,definition=null!=definition?definition:obj.definition,channelNo=channelNo||obj.channelNo,deviceSerial=deviceSerial||obj.deviceSerial,validateCode=null!=validateCode?validateCode:obj.validateCode,`${obj.protocol}//${validateCode?`${validateCode}@`:""}${obj.hostname}/${deviceSerial}/${channelNo}${"rec"===type&&recType?"."+recType:""}${"live"===type&&"hd"===definition?"."+definition:""}.${type}${search}`};
8105
+ return dist$3;
8106
+ }
8107
+
8036
8108
  /*
8037
8109
  * @ezuikit/control-ptz v0.0.1
8038
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
8110
+ * Copyright (c) 2025-11-12 Ezviz-OpenBiz
8039
8111
  * Released under the MIT License.
8040
8112
  */
8041
8113
 
8042
- var en_US = {
8043
- GET_PTZ_STATUS: 'Get current PTZ status',
8044
- GET_PTZ_STATUS_FAILED: 'Theme module is not loaded, PTZ status cannot be obtained',
8045
- MOBILE_HIDE_PTZ: 'Mobile terminal, PTZ is not displayed in non-full screen state',
8046
- OPTION_PTZ_FAILED: 'Theme module is not loaded, PTZ cannot be operated',
8047
- MOBILE_PTZ_TIPS: 'Adjust camera angle by manipulating gimbal',
8048
- PTZ_FAST: 'F',
8049
- PTZ_MID: 'M',
8050
- PTZ_SLOW: 'S',
8051
- PTZ_SPEED: 'Adjust the PTZ rotation speed',
8052
- DEVICE_ZOOM: 'Control the device to zoom in/out of the screen',
8053
- DEVICE_FOCUS: "Adjusting the device's focal length"
8054
- };
8114
+ var hasRequiredDist$3;
8055
8115
 
8056
- var zh_CN = {
8057
- GET_PTZ_STATUS: '获取当前云台状态',
8058
- GET_PTZ_STATUS_FAILED: '未加载Theme模块,无法获取云台状态',
8059
- MOBILE_HIDE_PTZ: '移动端,非全屏状态不展示云台',
8060
- OPTION_PTZ_FAILED: '未加载Theme模块,无法操作云台',
8061
- MOBILE_PTZ_TIPS: '请通过操控云台来调整摄像机视角',
8062
- PTZ_FAST: '快',
8063
- PTZ_MID: '中',
8064
- PTZ_SLOW: '慢',
8065
- PTZ_SPEED: '调整云台转动速度',
8066
- DEVICE_ZOOM: '控制设备放大/缩小画面',
8067
- DEVICE_FOCUS: '调整设备焦距'
8068
- };
8116
+ function requireDist$3 () {
8117
+ if (hasRequiredDist$3) return dist$4;
8118
+ hasRequiredDist$3 = 1;
8069
8119
 
8070
- const PTZ_DEFAULT_OPTIONS = {
8071
- language: 'zh',
8072
- env: {
8073
- domain: 'https://open.ys7.com'
8074
- },
8075
- accessToken: '',
8076
- speed: 2,
8077
- locales: {
8078
- zh: zh_CN,
8079
- en: en_US
8080
- }
8081
- };
8082
- const PTZ_SPEED = {
8083
- 1: 1,
8084
- 2: 3,
8085
- 3: 7,
8086
- slow: 1,
8087
- mid: 3,
8088
- fast: 7
8089
- };
8090
- const PTZ_PREFIX = 'ez-ptz';
8091
- const PTZ_MOBILE_PREFIX = 'ez-mobile-ptz';
8092
- const PTZ_SPEED_ACTIVE_PREFIX = PTZ_PREFIX + '-speed-active';
8093
- const PTZ_DIRECTION_PREFIX = PTZ_PREFIX + '-direction';
8094
-
8095
- class BasePtz {
8096
- updateOptions(options) {
8097
- this.options = deepmerge(this.options, options, {
8098
- clone: false
8099
- });
8100
- }
8101
- destroy() {}
8102
- constructor(container, options = {}){
8103
- var _this_options_locales;
8104
- if (!container) throw new Error('Ptz container is required');
8105
- this.options = deepmerge(PTZ_DEFAULT_OPTIONS, options, {
8106
- clone: false
8107
- });
8108
- if ((_this_options_locales = this.options.locales) == null ? void 0 : _this_options_locales[this.options.language]) {
8109
- var _this_options_locales1;
8110
- this.locale = (_this_options_locales1 = this.options.locales) == null ? void 0 : _this_options_locales1[this.options.language];
8111
- } else {
8112
- var _this_options_locales2;
8113
- this.locale = (_this_options_locales2 = this.options.locales) == null ? void 0 : _this_options_locales2['zh'];
8114
- }
8115
- this.$container = container;
8116
- this.speed = PTZ_SPEED[this.options.speed || 2];
8117
- }
8118
- }
8120
+ var deepmerge = requireCjs();
8121
+ var utilsTools = requireDist$4();
8122
+
8123
+ var en_US = {
8124
+ GET_PTZ_STATUS: 'Get current PTZ status',
8125
+ GET_PTZ_STATUS_FAILED: 'Theme module is not loaded, PTZ status cannot be obtained',
8126
+ MOBILE_HIDE_PTZ: 'Mobile terminal, PTZ is not displayed in non-full screen state',
8127
+ OPTION_PTZ_FAILED: 'Theme module is not loaded, PTZ cannot be operated',
8128
+ MOBILE_PTZ_TIPS: 'Adjust camera angle by manipulating gimbal',
8129
+ PTZ_FAST: 'F',
8130
+ PTZ_MID: 'M',
8131
+ PTZ_SLOW: 'S',
8132
+ PTZ_SPEED: 'Adjust the PTZ rotation speed',
8133
+ DEVICE_ZOOM: 'Control the device to zoom in/out of the screen',
8134
+ DEVICE_FOCUS: "Adjusting the device's focal length"
8135
+ };
8119
8136
 
8120
- class MobilePtz extends BasePtz {
8121
- destroy() {
8122
- this._removeEventListener();
8123
- if (this.$content) {
8124
- this.$content.remove();
8125
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8126
- this.$content = null;
8127
- }
8128
- super.destroy();
8129
- }
8130
- _render() {
8131
- this.$content = document.createElement('div');
8132
- this.$content.classList.add(PTZ_MOBILE_PREFIX + '-content');
8133
- this.$content.innerHTML = `
8134
- <div class="${PTZ_MOBILE_PREFIX}-wrap">
8135
- <div class="${PTZ_MOBILE_PREFIX}-container">
8136
- <div class="${PTZ_MOBILE_PREFIX}-center ${PTZ_MOBILE_PREFIX}-center"></div>
8137
- <div class="${PTZ_MOBILE_PREFIX}-icon ${PTZ_MOBILE_PREFIX}-top ${PTZ_MOBILE_PREFIX}-default"></div>
8138
- <div class="${PTZ_MOBILE_PREFIX}-icon ${PTZ_MOBILE_PREFIX}-left ${PTZ_MOBILE_PREFIX}-default"></div>
8139
- <div class="${PTZ_MOBILE_PREFIX}-icon ${PTZ_MOBILE_PREFIX}-bottom ${PTZ_MOBILE_PREFIX}-default"></div>
8140
- <div class="${PTZ_MOBILE_PREFIX}-icon ${PTZ_MOBILE_PREFIX}-right ${PTZ_MOBILE_PREFIX}-default"></div>
8141
- </div>
8142
- </div>
8143
- `;
8144
- this.$container.appendChild(this.$content);
8145
- this._addEventListener();
8146
- }
8147
- _addEventListener() {
8148
- // 云台控制事件绑定
8149
- const $warp = this.$content.querySelector(`.${PTZ_MOBILE_PREFIX}-wrap`);
8150
- const touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
8151
- const touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
8152
- if ($warp) {
8153
- $warp.addEventListener(touchstart, this._touchstart);
8154
- $warp.addEventListener(touchend, this._touchend);
8155
- }
8156
- }
8157
- _touchstart(e) {
8158
- e.preventDefault();
8159
- this._handlePtzTouch(e, 'start');
8160
- }
8161
- _touchend(e) {
8162
- e.preventDefault();
8163
- this._handlePtzTouch(e, 'stop');
8164
- }
8165
- _removeEventListener() {
8166
- const $warp = this.$content.querySelector(`.${PTZ_MOBILE_PREFIX}-wrap`);
8167
- const touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
8168
- const touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
8169
- if ($warp) {
8170
- $warp.removeEventListener(touchstart, this._touchstart);
8171
- $warp.removeEventListener(touchend, this._touchend);
8172
- }
8173
- }
8174
- _handlePtzTouch(e, type) {
8175
- var _this_options_token_deviceToken, _this_options_token, _e_changedTouches_, _e_changedTouches_1, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
8176
- if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8177
- const $warp = this.$content.querySelector(`.${PTZ_MOBILE_PREFIX}-wrap`);
8178
- const rect = $warp.getBoundingClientRect();
8179
- const containerCenterX = rect.left + 130;
8180
- const containerCenterY = rect.top + 130;
8181
- const eventX = e.x || ((_e_changedTouches_ = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_.clientX);
8182
- const eventY = e.y || ((_e_changedTouches_1 = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_1.clientY);
8183
- const left = eventX - containerCenterX;
8184
- const top = eventY - containerCenterY;
8185
- let direction = 0; // 操作命令:0-上,1-下,2-左,3右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
8186
- let url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8187
- const token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
8188
- const $icons = $warp.querySelectorAll(`.${PTZ_MOBILE_PREFIX}-icon`);
8189
- // 判读方位
8190
- if (Math.abs(left) > Math.abs(top)) {
8191
- if (left > 0) {
8192
- direction = 3;
8193
- $icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
8194
- } else {
8195
- direction = 2;
8196
- $icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
8197
- }
8198
- } else {
8199
- if (top > 0) {
8200
- direction = 1;
8201
- $icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
8202
- } else {
8203
- direction = 0;
8204
- $icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
8205
- }
8206
- }
8207
- $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
8208
- if (type === 'stop') {
8209
- var _this_options_env1;
8210
- url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8211
- $warp.style = '';
8212
- $icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
8213
- $icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
8214
- $icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
8215
- $icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
8216
- }
8217
- // 这个控件暂时没有 ptzSpeed 和areaId 和backDeg 的值
8218
- // this.jSPlugin?.eventEmitter?.emit(EVENTS.ptz.ptzDirection, {
8219
- // type,
8220
- // direction,
8221
- // isRotate: false,
8222
- // ptzSpeed: 1,
8223
- // });
8224
- let operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8225
- direction,
8226
- speed: this.speed,
8227
- type
8228
- });
8229
- const data = new FormData();
8230
- data.append('deviceSerial', this.options.deviceSerial + '');
8231
- data.append('channelNo', this.options.channelNo + '');
8232
- data.append('speed', '1');
8233
- data.append('direction', direction + '');
8234
- data.append('accessToken', token);
8235
- // prettier-ignore
8236
- // eslint-disable-next-line @typescript-eslint/promise-function-async
8237
- fetch(url, {
8238
- method: 'POST',
8239
- body: data
8240
- }).then((response)=>response.json()).then((rt)=>{
8241
- if (rt.code === 200) ; else {
8242
- // this.jSPlugin?.logger?.error('[errors]', this.jSPlugin.i18n.t('38' + rt.code) + `(${rt.code})`);
8243
- // const msg = this.jSPlugin.i18n.t('38' + rt.code) || rt.msg;
8244
- // this.pluginStatus.loadingSetText({
8245
- // text: msg,
8246
- // color: 'red',
8247
- // delayClear: 2000,
8248
- // });
8249
- if ([
8250
- 60005,
8251
- 60002,
8252
- 60003,
8253
- 60004
8254
- ].includes(+rt.code)) {
8255
- $warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
8256
- }
8257
- }
8258
- operationResultCb == null ? void 0 : operationResultCb(rt);
8259
- }).catch((err)=>{
8260
- });
8261
- }
8262
- constructor(container, options){
8263
- super(container, options);
8264
- this._touchstart = this._touchstart.bind(this);
8265
- this._touchend = this._touchend.bind(this);
8266
- this._render();
8267
- }
8268
- }
8137
+ var zh_CN = {
8138
+ GET_PTZ_STATUS: '获取当前云台状态',
8139
+ GET_PTZ_STATUS_FAILED: '未加载Theme模块,无法获取云台状态',
8140
+ MOBILE_HIDE_PTZ: '移动端,非全屏状态不展示云台',
8141
+ OPTION_PTZ_FAILED: '未加载Theme模块,无法操作云台',
8142
+ MOBILE_PTZ_TIPS: '请通过操控云台来调整摄像机视角',
8143
+ PTZ_FAST: '快',
8144
+ PTZ_MID: '中',
8145
+ PTZ_SLOW: '慢',
8146
+ PTZ_SPEED: '调整云台转动速度',
8147
+ DEVICE_ZOOM: '控制设备放大/缩小画面',
8148
+ DEVICE_FOCUS: '调整设备焦距'
8149
+ };
8269
8150
 
8270
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
8271
- try {
8272
- var info = gen[key](arg);
8273
- var value = info.value;
8274
- } catch (error) {
8275
- reject(error);
8276
- return;
8277
- }
8278
- if (info.done) {
8279
- resolve(value);
8280
- } else {
8281
- Promise.resolve(value).then(_next, _throw);
8282
- }
8283
- }
8284
- function _async_to_generator$4(fn) {
8285
- return function() {
8286
- var self = this, args = arguments;
8287
- return new Promise(function(resolve, reject) {
8288
- var gen = fn.apply(self, args);
8289
- function _next(value) {
8290
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
8291
- }
8292
- function _throw(err) {
8293
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
8294
- }
8295
- _next(undefined);
8296
- });
8297
- };
8298
- }
8299
- /**
8300
- * @class Ptz
8301
- * @classdesc 云台控制
8302
- *
8303
- * @example
8304
- * // 初始化云台控制
8305
- * // 显示云台控制
8306
- * ptz.show()
8307
- * // 隐藏云台控制
8308
- * ptz.hide()
8309
- */ let Ptz$1 = class Ptz extends BasePtz {
8310
- get isRotate() {
8311
- return this._isRotate;
8312
- }
8313
- /**
8314
- * 是否旋转了
8315
- */ set isRotate(isRotate) {
8316
- this._isRotate = isRotate;
8317
- }
8318
- destroy() {
8319
- if (this._clearTimer) {
8320
- clearTimeout(this._clearTimer);
8321
- this._clearTimer = null;
8322
- }
8323
- if (this._$directionCircleContainer) {
8324
- this._$directionCircleContainer.remove();
8325
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8326
- this._$directionCircleContainer = null;
8327
- }
8328
- if (this._$speedContainer) {
8329
- this._onSwitchSpeed = null;
8330
- this._$speedContainer.remove();
8331
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8332
- this._$speedContainer = null;
8333
- }
8334
- if (this._$btnContainer) {
8335
- this._$btnContainer.remove();
8336
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8337
- this._$btnContainer = null;
8338
- }
8339
- if (this._$wrapper) {
8340
- this._$wrapper.remove();
8341
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8342
- this._$wrapper = null;
8343
- }
8344
- super.destroy();
8345
- }
8346
- _handlePtzTouch(e, type) {
8347
- var _this_options_token_deviceToken, _this_options_token, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
8348
- if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8349
- // 初始化或获取当前PTZ操作队列
8350
- if (!this._ptzQueue) {
8351
- this._ptzQueue = Promise.resolve();
8352
- }
8353
- const container = this._$directionCircleContainer.getBoundingClientRect();
8354
- const containerCenterX = container.left + (this._$directionCircleContainer.clientWidth + 2) / 2;
8355
- const containerCenterY = container.top + (this._$directionCircleContainer.clientHeight + 2) / 2;
8356
- const eventX = e.x || e.changedTouches[0].clientX;
8357
- const eventY = e.y || e.changedTouches[0].clientY;
8358
- let direction = 0;
8359
- let url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8360
- const token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
8361
- let backDeg = 0;
8362
- function getAreaId(x, y) {
8363
- // 获取当前点击位置相对于圆心的角度
8364
- let rad = Math.atan2(y, x);
8365
- if (rad < 0) rad += 2 * Math.PI;
8366
- let deg = rad * (180 / Math.PI) - 225 - 12.5;
8367
- if (deg < 0) deg += 360;
8368
- return Math.floor(deg / 45) + 1;
8369
- }
8370
- // 兼容画面旋转90度
8371
- // const isRotate = false; // /^rotate\(90/.test(document.getElementById(`${this.jSPlugin.id}-wrap`).style.transform);
8372
- const left = eventX - containerCenterX;
8373
- const top = eventY - containerCenterY;
8374
- if (this.isRotate) {
8375
- switch(getAreaId(left, top)){
8376
- case 1:
8377
- direction = 2;
8378
- backDeg = 90;
8379
- break;
8380
- case 2:
8381
- direction = 4;
8382
- backDeg = 135;
8383
- break;
8384
- case 3:
8385
- direction = 0;
8386
- backDeg = 180;
8387
- break;
8388
- case 4:
8389
- direction = 6;
8390
- backDeg = 225;
8391
- break;
8392
- case 5:
8393
- direction = 3;
8394
- backDeg = 270;
8395
- break;
8396
- case 6:
8397
- direction = 7;
8398
- backDeg = 315;
8399
- break;
8400
- case 7:
8401
- direction = 1;
8402
- backDeg = 0;
8403
- break;
8404
- case 8:
8405
- direction = 5;
8406
- backDeg = 45;
8407
- break;
8408
- }
8409
- } else {
8410
- switch(getAreaId(left, top)){
8411
- case 1:
8412
- direction = 0;
8413
- backDeg = 180;
8414
- break;
8415
- case 2:
8416
- direction = 6;
8417
- backDeg = 225;
8418
- break;
8419
- case 3:
8420
- direction = 3;
8421
- backDeg = 270;
8422
- break;
8423
- case 4:
8424
- direction = 7;
8425
- backDeg = 315;
8426
- break;
8427
- case 5:
8428
- direction = 1;
8429
- backDeg = 0;
8430
- break;
8431
- case 6:
8432
- direction = 5;
8433
- backDeg = 45;
8434
- break;
8435
- case 7:
8436
- direction = 2;
8437
- backDeg = 90;
8438
- break;
8439
- case 8:
8440
- direction = 4;
8441
- backDeg = 135;
8442
- break;
8443
- }
8444
- }
8445
- if (this._clearTimer) {
8446
- clearTimeout(this._clearTimer);
8447
- this._clearTimer = null;
8448
- }
8449
- if (type === 'start') {
8450
- this._$directionCircleContainer.style.cssText = `background-image:linear-gradient(${backDeg}deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)`;
8451
- } else {
8452
- this._$directionCircleContainer.style.cssText = '';
8453
- }
8454
- if (type === 'stop') {
8455
- var _this_options_env1;
8456
- url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8457
- }
8458
- let operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8459
- areaId: getAreaId(left, top),
8460
- direction,
8461
- backDeg,
8462
- isRotate: this.isRotate,
8463
- speed: this.speed,
8464
- type
8465
- });
8466
- const data = new FormData();
8467
- data.append('deviceSerial', this.options.deviceSerial + '');
8468
- data.append('channelNo', this.options.channelNo + '');
8469
- data.append('speed', this.speed + '');
8470
- data.append('direction', direction + '');
8471
- data.append('accessToken', token);
8472
- // 将操作加入队列
8473
- this._ptzQueue = this._ptzQueue.then(()=>_async_to_generator$4(function*() {
8474
- // prettier-ignore
8475
- return yield fetch(url, {
8476
- method: 'POST',
8477
- body: data
8478
- }).then((response)=>_async_to_generator$4(function*() {
8479
- return yield response.json();
8480
- })()).then((rt)=>{
8481
- var _rt_result;
8482
- operationResultCb == null ? void 0 : operationResultCb(rt);
8483
- const code = rt.code || (rt == null ? void 0 : (_rt_result = rt.result) == null ? void 0 : _rt_result.code);
8484
- if ([
8485
- 60000,
8486
- 60001,
8487
- 60002,
8488
- 60003,
8489
- 60004,
8490
- 60005,
8491
- 60006,
8492
- 10002
8493
- ].includes(+code)) {
8494
- this._$directionCircleContainer.style.cssText = `background-image:linear-gradient(${backDeg}deg, #f45656 0%, rgba(100,143,252,0.00) 30%)`;
8495
- }
8496
- return rt;
8497
- }).catch((err)=>{
8498
- }).finally(()=>{
8499
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8500
- operationResultCb = null;
8501
- if (type === 'stop') {
8502
- this._clearTimer = setTimeout(()=>{
8503
- this._$directionCircleContainer.style.cssText = '';
8504
- }, 1000);
8505
- }
8506
- });
8507
- }).call(this));
8508
- if (type === 'stop') {
8509
- this._ptzQueue = this._ptzQueue.finally(()=>{});
8510
- }
8511
- // this.jSPlugin?.eventEmitter?.emit(EVENTS.ptzDirection, {
8512
- // areaId: getAreaId(left, top),
8513
- // direction,
8514
- // backDeg,
8515
- // isRotate,
8516
- // ptzSpeed: this.jSPlugin.ptzSpeed,
8517
- // type,
8518
- // });
8519
- }
8520
- _handleBtnTouch(btn, option, type) {
8521
- var _this_options_token, _this_options_env, _this_options_token_deviceToken, _this_options_token1;
8522
- if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : _this_options_token.deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8523
- // 使用Promise来跟踪当前操作状态
8524
- if (!this._ptzOperation) {
8525
- this._ptzOperation = Promise.resolve();
8526
- }
8527
- let direction = 8;
8528
- if (btn === 'zoom') {
8529
- direction = option === 'add' ? 8 : 9;
8530
- } else {
8531
- direction = option === 'add' ? 10 : 11;
8532
- }
8533
- let url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8534
- const token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video);
8535
- if (type === 'stop') {
8536
- var _this_options_env1;
8537
- url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8538
- }
8539
- let operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8540
- btn,
8541
- option,
8542
- type
8543
- });
8544
- const data = new FormData();
8545
- data.append('deviceSerial', this.options.deviceSerial + '');
8546
- data.append('channelNo', this.options.channelNo + '');
8547
- data.append('speed', this.speed + '');
8548
- data.append('direction', direction + '');
8549
- data.append('accessToken', token);
8550
- // 将当前操作加入Promise链
8551
- this._ptzOperation = this._ptzOperation.then(()=>_async_to_generator$4(function*() {
8552
- // prettier-ignore
8553
- return yield fetch(url, {
8554
- method: 'POST',
8555
- body: data
8556
- }).then((response)=>_async_to_generator$4(function*() {
8557
- return yield response.json();
8558
- })()).then((rt)=>{
8559
- operationResultCb == null ? void 0 : operationResultCb(rt);
8560
- return rt;
8561
- }).catch((err)=>{
8562
- }).finally(()=>{
8563
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8564
- operationResultCb = null;
8565
- });
8566
- })());
8567
- // 如果是stop操作,添加一个清理操作
8568
- if (type === 'stop') {
8569
- this._ptzOperation = this._ptzOperation.finally(()=>{
8570
- this._ptzOperation = null; // 重置操作链
8571
- });
8572
- }
8573
- }
8574
- constructor(container, options = {}){
8575
- super(container, options), this._isMobile = distExports$3.isMobile(), this._isRotate = false, this._clearTimer = null;
8576
- this._$wrapper = document.createElement('div');
8577
- this._$wrapper.className = PTZ_PREFIX + '-container-wrap';
8578
- this._$directionCircleContainer = document.createElement('div');
8579
- this._$directionCircleContainer.classList.add(PTZ_PREFIX + '-container');
8580
- this._$directionCircleContainer.innerHTML = `
8581
- <div class="${PTZ_PREFIX}-main ${PTZ_DIRECTION_PREFIX}-center"></div>
8582
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-top" data-direction="0"></div>
8583
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-top-left" data-direction="4"></div>
8584
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-left" data-direction="2"></div>
8585
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-left-bottom" data-direction="5"></div>
8586
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-bottom" data-direction="1"></div>
8587
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-bottom-right" data-direction="7"></div>
8588
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-right" data-direction="3"></div>
8589
- <div class="${PTZ_PREFIX}-icon ${PTZ_DIRECTION_PREFIX}-right-top" data-direction="6"></div>
8590
- `;
8591
- this._$wrapper.appendChild(this._$directionCircleContainer);
8592
- this._$speedContainer = document.createElement('div');
8593
- this._$speedContainer.classList.add(PTZ_PREFIX + '-speed-container');
8594
- this._$speedContainer.innerHTML = `
8595
- <div class="${PTZ_PREFIX}-speed-progress" title="${this.locale['PTZ_SPEED']}">
8596
- <div class="${PTZ_PREFIX}-speed-progress-line">
8597
- <div class="${PTZ_PREFIX}-speed-progress-line-dot ${this.speed === 1 ? PTZ_SPEED_ACTIVE_PREFIX : ''}" data-id="slow" data-index="1" data-value="1"></div>
8598
- <div class="${PTZ_PREFIX}-speed-progress-line-dot ${this.speed === 3 ? PTZ_SPEED_ACTIVE_PREFIX : ''}" data-id="mid" data-index="2" data-value="3"></div>
8599
- <div class="${PTZ_PREFIX}-speed-progress-line-dot ${this.speed === 7 ? PTZ_SPEED_ACTIVE_PREFIX : ''}" data-id="fast" data-index="3" data-value="7"></div>
8600
- </div>
8601
- <div class="${PTZ_PREFIX}-speed-progress-points">
8602
- <div class="${PTZ_PREFIX}-speed-progress-points-slow">
8603
- ${this.locale['PTZ_SLOW']}
8604
- </div>
8605
- <div class="${PTZ_PREFIX}-speed-progress-points-mid">
8606
- ${this.locale['PTZ_MID']}
8607
- </div>
8608
- <div class="${PTZ_PREFIX}-speed-progress-points-fast">
8609
- ${this.locale['PTZ_FAST']}
8610
- </div>
8611
- </div>
8612
- </div>
8613
- `;
8614
- this._$wrapper.appendChild(this._$speedContainer);
8615
- this._$btnContainer = document.createElement('div');
8616
- this._$btnContainer.classList.add(PTZ_PREFIX + '-btn-container');
8617
- this._$btnContainer.innerHTML = `
8618
- <div class="${PTZ_PREFIX}-btn-zoom" title="${this.locale['DEVICE_ZOOM']}" style="user-select: none;">
8619
- <div class="${PTZ_PREFIX}-btn-zoom-add" style="user-select: none;">
8620
- <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">
8621
- <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>
8622
- <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">
8623
- </path>
8624
- <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>
8625
- </svg>
8626
- </div>
8627
- <div class="${PTZ_PREFIX}-btn-zoom-sub" style="user-select: none;">
8628
- <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">
8629
- <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>
8630
- <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>
8631
- </svg>
8632
- </div>
8633
- </div>
8634
- <div class="${PTZ_PREFIX}-btn-focal" title="${this.locale['DEVICE_FOCUS']}" style="user-select: none;">
8635
- <div class="${PTZ_PREFIX}-btn-focal-add" style="user-select: none;">
8636
- <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">
8637
- <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>
8638
- <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>
8639
- </svg>
8640
- </div>
8641
- <div class="${PTZ_PREFIX}-btn-focal-sub" style="user-select: none;">
8642
- <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">
8643
- <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>
8644
- <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>
8645
- </svg>
8646
- </div>
8647
- </div>
8648
- `;
8649
- this._$wrapper.appendChild(this._$btnContainer);
8650
- container.appendChild(this._$wrapper);
8651
- // 云台控制事件绑定
8652
- // 云台控制
8653
- this._$directionCircleContainer.onmousedown = (e)=>{
8654
- e.preventDefault();
8655
- e.stopPropagation();
8656
- this._handlePtzTouch(e, 'start');
8657
- };
8658
- this._$directionCircleContainer.onmouseup = (e)=>{
8659
- e.preventDefault();
8660
- e.stopPropagation();
8661
- this._handlePtzTouch(e, 'stop');
8662
- };
8663
- this._$directionCircleContainer.ontouchstart = (e)=>{
8664
- e.preventDefault();
8665
- e.stopPropagation();
8666
- this._handlePtzTouch(e, 'start');
8667
- };
8668
- this._$directionCircleContainer.ontouchend = (e)=>{
8669
- e.preventDefault();
8670
- e.stopPropagation();
8671
- this._handlePtzTouch(e, 'stop');
8672
- };
8673
- this._onSwitchSpeed = (e)=>{
8674
- const list = Array.from(this._$speedContainer.querySelectorAll(`.${PTZ_PREFIX}-speed-progress-line-dot`));
8675
- if (list.includes(e.target) && !e.target.classList.contains(PTZ_SPEED_ACTIVE_PREFIX)) {
8676
- list.forEach((item)=>{
8677
- if (item === e.target) {
8678
- item.classList.add(PTZ_SPEED_ACTIVE_PREFIX);
8679
- } else {
8680
- item.classList.remove(PTZ_SPEED_ACTIVE_PREFIX);
8681
- }
8682
- });
8683
- const value = e.target.getAttribute('data-value');
8684
- const index = e.target.getAttribute('data-index');
8685
- this.speed = +value;
8686
- this.options.onSpeedChange == null ? void 0 : this.options.onSpeedChange.call(this.options, +index);
8687
- }
8688
- };
8689
- // mouse 事件绑定
8690
- // 云台速度变化事件绑定
8691
- this._$speedContainer.onmouseup = this._onSwitchSpeed;
8692
- if (this._isMobile) {
8693
- this._$speedContainer.ontouchend = this._onSwitchSpeed;
8694
- }
8695
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`)) {
8696
- // 物理缩放、变焦按钮事件监听
8697
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`).onmousedown = (e)=>{
8698
- e.preventDefault();
8699
- e.stopPropagation();
8700
- this._handleBtnTouch('zoom', 'add', 'start');
8701
- };
8702
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`).onmouseup = (e)=>{
8703
- e.preventDefault();
8704
- e.stopPropagation();
8705
- this._handleBtnTouch('zoom', 'add', 'stop');
8706
- };
8707
- }
8708
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`)) {
8709
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`).onmousedown = (e)=>{
8710
- e.preventDefault();
8711
- e.stopPropagation();
8712
- this._handleBtnTouch('zoom', 'sub', 'start');
8713
- };
8714
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`).onmouseup = (e)=>{
8715
- e.preventDefault();
8716
- e.stopPropagation();
8717
- this._handleBtnTouch('zoom', 'sub', 'stop');
8718
- };
8719
- }
8720
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`)) {
8721
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`).onmousedown = (e)=>{
8722
- e.preventDefault();
8723
- e.stopPropagation();
8724
- this._handleBtnTouch('focal', 'add', 'start');
8725
- };
8726
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`).onmouseup = (e)=>{
8727
- e.preventDefault();
8728
- e.stopPropagation();
8729
- this._handleBtnTouch('focal', 'add', 'stop');
8730
- };
8731
- }
8732
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`)) {
8733
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`).onmousedown = (e)=>{
8734
- e.preventDefault();
8735
- e.stopPropagation();
8736
- this._handleBtnTouch('focal', 'sub', 'start');
8737
- };
8738
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`).onmouseup = (e)=>{
8739
- e.preventDefault();
8740
- e.stopPropagation();
8741
- this._handleBtnTouch('focal', 'sub', 'stop');
8742
- };
8743
- }
8744
- // mobile touch 事件监听
8745
- if (this._isMobile) {
8746
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`)) {
8747
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`).ontouchstart = (e)=>{
8748
- e.preventDefault();
8749
- e.stopPropagation();
8750
- this._handleBtnTouch('zoom', 'add', 'start');
8751
- };
8752
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-add`).ontouchend = (e)=>{
8753
- e.preventDefault();
8754
- e.stopPropagation();
8755
- this._handleBtnTouch('zoom', 'add', 'stop');
8756
- };
8757
- }
8758
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`)) {
8759
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`).ontouchstart = (e)=>{
8760
- e.preventDefault();
8761
- e.stopPropagation();
8762
- this._handleBtnTouch('zoom', 'sub', 'start');
8763
- };
8764
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-zoom-sub`).ontouchend = (e)=>{
8765
- e.preventDefault();
8766
- e.stopPropagation();
8767
- this._handleBtnTouch('zoom', 'sub', 'stop');
8768
- };
8769
- }
8770
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`)) {
8771
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`).ontouchstart = (e)=>{
8772
- e.preventDefault();
8773
- e.stopPropagation();
8774
- this._handleBtnTouch('focal', 'add', 'start');
8775
- };
8776
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-add`).ontouchend = (e)=>{
8777
- e.preventDefault();
8778
- e.stopPropagation();
8779
- this._handleBtnTouch('focal', 'add', 'stop');
8780
- };
8781
- }
8782
- if (this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`)) {
8783
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`).ontouchstart = (e)=>{
8784
- e.preventDefault();
8785
- e.stopPropagation();
8786
- this._handleBtnTouch('focal', 'sub', 'start');
8787
- };
8788
- this._$btnContainer.querySelector(`.${PTZ_PREFIX}-btn-focal-sub`).ontouchend = (e)=>{
8789
- e.preventDefault();
8790
- e.stopPropagation();
8791
- this._handleBtnTouch('focal', 'sub', 'stop');
8792
- };
8793
- }
8794
- }
8795
- }
8796
- };
8151
+ var PTZ_DEFAULT_OPTIONS = {
8152
+ language: 'zh',
8153
+ env: {
8154
+ domain: 'https://open.ys7.com'
8155
+ },
8156
+ accessToken: '',
8157
+ speed: 2,
8158
+ locales: {
8159
+ zh: zh_CN,
8160
+ en: en_US
8161
+ }
8162
+ };
8163
+ var PTZ_SPEED = {
8164
+ 1: 1,
8165
+ 2: 3,
8166
+ 3: 7,
8167
+ slow: 1,
8168
+ mid: 3,
8169
+ fast: 7
8170
+ };
8171
+ var PTZ_PREFIX = 'ez-ptz';
8172
+ var PTZ_MOBILE_PREFIX = 'ez-mobile-ptz';
8173
+ var PTZ_SPEED_ACTIVE_PREFIX = PTZ_PREFIX + '-speed-active';
8174
+ var PTZ_DIRECTION_PREFIX = PTZ_PREFIX + '-direction';
8175
+
8176
+ var BasePtz = /*#__PURE__*/ function() {
8177
+ function BasePtz(container, options) {
8178
+ if (options === void 0) options = {};
8179
+ var _this_options_locales;
8180
+ if (!container) throw new Error('Ptz container is required');
8181
+ this.options = deepmerge(PTZ_DEFAULT_OPTIONS, options, {
8182
+ clone: false
8183
+ });
8184
+ if ((_this_options_locales = this.options.locales) == null ? void 0 : _this_options_locales[this.options.language]) {
8185
+ var _this_options_locales1;
8186
+ this.locale = (_this_options_locales1 = this.options.locales) == null ? void 0 : _this_options_locales1[this.options.language];
8187
+ } else {
8188
+ var _this_options_locales2;
8189
+ this.locale = (_this_options_locales2 = this.options.locales) == null ? void 0 : _this_options_locales2['zh'];
8190
+ }
8191
+ this.$container = container;
8192
+ this.speed = PTZ_SPEED[this.options.speed || 2];
8193
+ }
8194
+ var _proto = BasePtz.prototype;
8195
+ _proto.updateOptions = function updateOptions(options) {
8196
+ this.options = deepmerge(this.options, options, {
8197
+ clone: false
8198
+ });
8199
+ };
8200
+ _proto.destroy = function destroy() {};
8201
+ return BasePtz;
8202
+ }();
8203
+
8204
+ function _inherits$1(subClass, superClass) {
8205
+ if (typeof superClass !== "function" && superClass !== null) {
8206
+ throw new TypeError("Super expression must either be null or a function");
8207
+ }
8208
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
8209
+ constructor: {
8210
+ value: subClass,
8211
+ writable: true,
8212
+ configurable: true
8213
+ }
8214
+ });
8215
+ if (superClass) _set_prototype_of$1(subClass, superClass);
8216
+ }
8217
+ function _set_prototype_of$1(o, p) {
8218
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
8219
+ o.__proto__ = p;
8220
+ return o;
8221
+ };
8222
+ return _set_prototype_of$1(o, p);
8223
+ }
8224
+ var MobilePtz = /*#__PURE__*/ function(BasePtz) {
8225
+ _inherits$1(MobilePtz, BasePtz);
8226
+ function MobilePtz(container, options) {
8227
+ var _this;
8228
+ _this = BasePtz.call(this, container, options) || this;
8229
+ _this._touchstart = _this._touchstart.bind(_this);
8230
+ _this._touchend = _this._touchend.bind(_this);
8231
+ _this._render();
8232
+ return _this;
8233
+ }
8234
+ var _proto = MobilePtz.prototype;
8235
+ _proto.destroy = function destroy() {
8236
+ this._removeEventListener();
8237
+ if (this.$content) {
8238
+ this.$content.remove();
8239
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8240
+ this.$content = null;
8241
+ }
8242
+ BasePtz.prototype.destroy.call(this);
8243
+ };
8244
+ _proto._render = function _render() {
8245
+ this.$content = document.createElement('div');
8246
+ this.$content.classList.add(PTZ_MOBILE_PREFIX + '-content');
8247
+ this.$content.innerHTML = '\n <div class="' + PTZ_MOBILE_PREFIX + '-wrap">\n <div class="' + PTZ_MOBILE_PREFIX + '-container">\n <div class="' + PTZ_MOBILE_PREFIX + "-center " + PTZ_MOBILE_PREFIX + '-center"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-top " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-left " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-bottom " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-right " + PTZ_MOBILE_PREFIX + '-default"></div>\n </div>\n </div>\n ';
8248
+ this.$container.appendChild(this.$content);
8249
+ this._addEventListener();
8250
+ };
8251
+ _proto._addEventListener = function _addEventListener() {
8252
+ // 云台控制事件绑定
8253
+ var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
8254
+ var touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
8255
+ var touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
8256
+ if ($warp) {
8257
+ $warp.addEventListener(touchstart, this._touchstart);
8258
+ $warp.addEventListener(touchend, this._touchend);
8259
+ }
8260
+ };
8261
+ _proto._touchstart = function _touchstart(e) {
8262
+ e.preventDefault();
8263
+ this._handlePtzTouch(e, 'start');
8264
+ };
8265
+ _proto._touchend = function _touchend(e) {
8266
+ e.preventDefault();
8267
+ this._handlePtzTouch(e, 'stop');
8268
+ };
8269
+ _proto._removeEventListener = function _removeEventListener() {
8270
+ var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
8271
+ var touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
8272
+ var touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
8273
+ if ($warp) {
8274
+ $warp.removeEventListener(touchstart, this._touchstart);
8275
+ $warp.removeEventListener(touchend, this._touchend);
8276
+ }
8277
+ };
8278
+ _proto._handlePtzTouch = function _handlePtzTouch(e, type) {
8279
+ var _this_options_token_deviceToken, _this_options_token, _e_changedTouches_, _e_changedTouches_1, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
8280
+ if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8281
+ var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
8282
+ var rect = $warp.getBoundingClientRect();
8283
+ var containerCenterX = rect.left + 130;
8284
+ var containerCenterY = rect.top + 130;
8285
+ var eventX = e.x || ((_e_changedTouches_ = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_.clientX);
8286
+ var eventY = e.y || ((_e_changedTouches_1 = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_1.clientY);
8287
+ var left = eventX - containerCenterX;
8288
+ var top = eventY - containerCenterY;
8289
+ var direction = 0; // 操作命令:0-上,1-下,2-左,3右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
8290
+ var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8291
+ var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
8292
+ var $icons = $warp.querySelectorAll("." + PTZ_MOBILE_PREFIX + "-icon");
8293
+ // 判读方位
8294
+ if (Math.abs(left) > Math.abs(top)) {
8295
+ if (left > 0) {
8296
+ direction = 3;
8297
+ $icons[3].className = $icons[3].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
8298
+ } else {
8299
+ direction = 2;
8300
+ $icons[1].className = $icons[1].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
8301
+ }
8302
+ } else {
8303
+ if (top > 0) {
8304
+ direction = 1;
8305
+ $icons[2].className = $icons[2].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
8306
+ } else {
8307
+ direction = 0;
8308
+ $icons[0].className = $icons[0].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
8309
+ }
8310
+ }
8311
+ $warp.style.cssText = "background-image:linear-gradient(" + (direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270) + "deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)";
8312
+ if (type === 'stop') {
8313
+ var _this_options_env1;
8314
+ url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8315
+ $warp.style.cssText = '';
8316
+ $icons[3].className = $icons[3].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
8317
+ $icons[1].className = $icons[1].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
8318
+ $icons[2].className = $icons[2].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
8319
+ $icons[0].className = $icons[0].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
8320
+ }
8321
+ // 这个控件暂时没有 ptzSpeed 和areaId 和backDeg 的值
8322
+ // this.jSPlugin?.eventEmitter?.emit(EVENTS.ptz.ptzDirection, {
8323
+ // type,
8324
+ // direction,
8325
+ // isRotate: false,
8326
+ // ptzSpeed: 1,
8327
+ // });
8328
+ var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8329
+ direction: direction,
8330
+ speed: this.speed,
8331
+ type: type
8332
+ });
8333
+ var data = new FormData();
8334
+ data.append('deviceSerial', this.options.deviceSerial + '');
8335
+ data.append('channelNo', this.options.channelNo + '');
8336
+ data.append('speed', '1');
8337
+ data.append('direction', direction + '');
8338
+ data.append('accessToken', token);
8339
+ // prettier-ignore
8340
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
8341
+ fetch(url, {
8342
+ method: 'POST',
8343
+ body: data
8344
+ }).then(function(response) {
8345
+ return response.json();
8346
+ }).then(function(rt) {
8347
+ if (rt.code === 200) ; else {
8348
+ // this.jSPlugin?.logger?.error('[errors]', this.jSPlugin.i18n.t('38' + rt.code) + `(${rt.code})`);
8349
+ // const msg = this.jSPlugin.i18n.t('38' + rt.code) || rt.msg;
8350
+ // this.pluginStatus.loadingSetText({
8351
+ // text: msg,
8352
+ // color: 'red',
8353
+ // delayClear: 2000,
8354
+ // });
8355
+ if ([
8356
+ 60005,
8357
+ 60002,
8358
+ 60003,
8359
+ 60004
8360
+ ].includes(+rt.code)) {
8361
+ $warp.style.cssText = "background-image:linear-gradient(" + (direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270) + "deg, #f45656 0%, rgba(100,143,252,0.00) 50%)";
8362
+ }
8363
+ }
8364
+ operationResultCb == null ? void 0 : operationResultCb(rt);
8365
+ }).catch(function(err) {
8366
+ }).finally(function() {
8367
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8368
+ operationResultCb = null;
8369
+ });
8370
+ };
8371
+ return MobilePtz;
8372
+ }(BasePtz);
8373
+
8374
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8375
+ try {
8376
+ var info = gen[key](arg);
8377
+ var value = info.value;
8378
+ } catch (error) {
8379
+ reject(error);
8380
+ return;
8381
+ }
8382
+ if (info.done) {
8383
+ resolve(value);
8384
+ } else {
8385
+ Promise.resolve(value).then(_next, _throw);
8386
+ }
8387
+ }
8388
+ function _async_to_generator(fn) {
8389
+ return function() {
8390
+ var self = this, args = arguments;
8391
+ return new Promise(function(resolve, reject) {
8392
+ var gen = fn.apply(self, args);
8393
+ function _next(value) {
8394
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
8395
+ }
8396
+ function _throw(err) {
8397
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
8398
+ }
8399
+ _next(undefined);
8400
+ });
8401
+ };
8402
+ }
8403
+ function _defineProperties(target, props) {
8404
+ for(var i = 0; i < props.length; i++){
8405
+ var descriptor = props[i];
8406
+ descriptor.enumerable = descriptor.enumerable || false;
8407
+ descriptor.configurable = true;
8408
+ if ("value" in descriptor) descriptor.writable = true;
8409
+ Object.defineProperty(target, descriptor.key, descriptor);
8410
+ }
8411
+ }
8412
+ function _create_class(Constructor, protoProps, staticProps) {
8413
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
8414
+ return Constructor;
8415
+ }
8416
+ function _inherits(subClass, superClass) {
8417
+ if (typeof superClass !== "function" && superClass !== null) {
8418
+ throw new TypeError("Super expression must either be null or a function");
8419
+ }
8420
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
8421
+ constructor: {
8422
+ value: subClass,
8423
+ writable: true,
8424
+ configurable: true
8425
+ }
8426
+ });
8427
+ if (superClass) _set_prototype_of(subClass, superClass);
8428
+ }
8429
+ function _set_prototype_of(o, p) {
8430
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
8431
+ o.__proto__ = p;
8432
+ return o;
8433
+ };
8434
+ return _set_prototype_of(o, p);
8435
+ }
8436
+ function _ts_generator(thisArg, body) {
8437
+ var f, y, t, _ = {
8438
+ label: 0,
8439
+ sent: function() {
8440
+ if (t[0] & 1) throw t[1];
8441
+ return t[1];
8442
+ },
8443
+ trys: [],
8444
+ ops: []
8445
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
8446
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
8447
+ return this;
8448
+ }), g;
8449
+ function verb(n) {
8450
+ return function(v) {
8451
+ return step([
8452
+ n,
8453
+ v
8454
+ ]);
8455
+ };
8456
+ }
8457
+ function step(op) {
8458
+ if (f) throw new TypeError("Generator is already executing.");
8459
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
8460
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
8461
+ if (y = 0, t) op = [
8462
+ op[0] & 2,
8463
+ t.value
8464
+ ];
8465
+ switch(op[0]){
8466
+ case 0:
8467
+ case 1:
8468
+ t = op;
8469
+ break;
8470
+ case 4:
8471
+ _.label++;
8472
+ return {
8473
+ value: op[1],
8474
+ done: false
8475
+ };
8476
+ case 5:
8477
+ _.label++;
8478
+ y = op[1];
8479
+ op = [
8480
+ 0
8481
+ ];
8482
+ continue;
8483
+ case 7:
8484
+ op = _.ops.pop();
8485
+ _.trys.pop();
8486
+ continue;
8487
+ default:
8488
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
8489
+ _ = 0;
8490
+ continue;
8491
+ }
8492
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
8493
+ _.label = op[1];
8494
+ break;
8495
+ }
8496
+ if (op[0] === 6 && _.label < t[1]) {
8497
+ _.label = t[1];
8498
+ t = op;
8499
+ break;
8500
+ }
8501
+ if (t && _.label < t[2]) {
8502
+ _.label = t[2];
8503
+ _.ops.push(op);
8504
+ break;
8505
+ }
8506
+ if (t[2]) _.ops.pop();
8507
+ _.trys.pop();
8508
+ continue;
8509
+ }
8510
+ op = body.call(thisArg, _);
8511
+ } catch (e) {
8512
+ op = [
8513
+ 6,
8514
+ e
8515
+ ];
8516
+ y = 0;
8517
+ } finally{
8518
+ f = t = 0;
8519
+ }
8520
+ if (op[0] & 5) throw op[1];
8521
+ return {
8522
+ value: op[0] ? op[1] : void 0,
8523
+ done: true
8524
+ };
8525
+ }
8526
+ }
8527
+ /**
8528
+ * @class Ptz
8529
+ * @classdesc 云台控制
8530
+ *
8531
+ * @example
8532
+ * // 初始化云台控制
8533
+ * // 显示云台控制
8534
+ * ptz.show()
8535
+ * // 隐藏云台控制
8536
+ * ptz.hide()
8537
+ */ var Ptz = /*#__PURE__*/ function(BasePtz) {
8538
+ _inherits(Ptz, BasePtz);
8539
+ function Ptz(container, options) {
8540
+ if (options === void 0) options = {};
8541
+ var _this;
8542
+ _this = BasePtz.call(this, container, options) || this, _this._isMobile = utilsTools.isMobile(), _this._isRotate = false, _this._clearTimer = null;
8543
+ _this._$wrapper = document.createElement('div');
8544
+ _this._$wrapper.className = PTZ_PREFIX + '-container-wrap';
8545
+ _this._$directionCircleContainer = document.createElement('div');
8546
+ _this._$directionCircleContainer.classList.add(PTZ_PREFIX + '-container');
8547
+ _this._$directionCircleContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + "-main " + PTZ_DIRECTION_PREFIX + '-center"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-top" data-direction="0"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-top-left" data-direction="4"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-left" data-direction="2"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-left-bottom" data-direction="5"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-bottom" data-direction="1"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-bottom-right" data-direction="7"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-right" data-direction="3"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-right-top" data-direction="6"></div>\n ';
8548
+ _this._$wrapper.appendChild(_this._$directionCircleContainer);
8549
+ _this._$speedContainer = document.createElement('div');
8550
+ _this._$speedContainer.classList.add(PTZ_PREFIX + '-speed-container');
8551
+ _this._$speedContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + '-speed-progress" title="' + _this.locale['PTZ_SPEED'] + '">\n <div class="' + PTZ_PREFIX + '-speed-progress-line">\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 1 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="slow" data-index="1" data-value="1"></div>\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 3 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="mid" data-index="2" data-value="3"></div>\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 7 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="fast" data-index="3" data-value="7"></div>\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points">\n <div class="' + PTZ_PREFIX + '-speed-progress-points-slow">\n ' + _this.locale['PTZ_SLOW'] + '\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points-mid">\n ' + _this.locale['PTZ_MID'] + '\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points-fast">\n ' + _this.locale['PTZ_FAST'] + "\n </div>\n </div>\n </div>\n ";
8552
+ _this._$wrapper.appendChild(_this._$speedContainer);
8553
+ _this._$btnContainer = document.createElement('div');
8554
+ _this._$btnContainer.classList.add(PTZ_PREFIX + '-btn-container');
8555
+ _this._$btnContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + '-btn-zoom" title="' + _this.locale['DEVICE_ZOOM'] + '" style="user-select: none;">\n <div class="' + PTZ_PREFIX + '-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="' + PTZ_PREFIX + '-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="' + PTZ_PREFIX + '-btn-focal" title="' + _this.locale['DEVICE_FOCUS'] + '" style="user-select: none;">\n <div class="' + PTZ_PREFIX + '-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="' + PTZ_PREFIX + '-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 ';
8556
+ _this._$wrapper.appendChild(_this._$btnContainer);
8557
+ container.appendChild(_this._$wrapper);
8558
+ // 云台控制事件绑定
8559
+ // 云台控制
8560
+ _this._$directionCircleContainer.onmousedown = function(e) {
8561
+ e.preventDefault();
8562
+ e.stopPropagation();
8563
+ _this._handlePtzTouch(e, 'start');
8564
+ };
8565
+ _this._$directionCircleContainer.onmouseup = function(e) {
8566
+ e.preventDefault();
8567
+ e.stopPropagation();
8568
+ _this._handlePtzTouch(e, 'stop');
8569
+ };
8570
+ _this._$directionCircleContainer.ontouchstart = function(e) {
8571
+ e.preventDefault();
8572
+ e.stopPropagation();
8573
+ _this._handlePtzTouch(e, 'start');
8574
+ };
8575
+ _this._$directionCircleContainer.ontouchend = function(e) {
8576
+ e.preventDefault();
8577
+ e.stopPropagation();
8578
+ _this._handlePtzTouch(e, 'stop');
8579
+ };
8580
+ _this._onSwitchSpeed = function(e) {
8581
+ var list = Array.from(_this._$speedContainer.querySelectorAll("." + PTZ_PREFIX + "-speed-progress-line-dot"));
8582
+ if (list.includes(e.target) && !e.target.classList.contains(PTZ_SPEED_ACTIVE_PREFIX)) {
8583
+ list.forEach(function(item) {
8584
+ if (item === e.target) {
8585
+ item.classList.add(PTZ_SPEED_ACTIVE_PREFIX);
8586
+ } else {
8587
+ item.classList.remove(PTZ_SPEED_ACTIVE_PREFIX);
8588
+ }
8589
+ });
8590
+ var value = e.target.getAttribute('data-value');
8591
+ var index = e.target.getAttribute('data-index');
8592
+ _this.speed = +value;
8593
+ _this.options.onSpeedChange == null ? void 0 : _this.options.onSpeedChange.call(_this.options, +index);
8594
+ }
8595
+ };
8596
+ // mouse 事件绑定
8597
+ // 云台速度变化事件绑定
8598
+ _this._$speedContainer.onmouseup = _this._onSwitchSpeed;
8599
+ if (_this._isMobile) {
8600
+ _this._$speedContainer.ontouchend = _this._onSwitchSpeed;
8601
+ }
8602
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add")) {
8603
+ // 物理缩放、变焦按钮事件监听
8604
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").onmousedown = function(e) {
8605
+ e.preventDefault();
8606
+ e.stopPropagation();
8607
+ _this._handleBtnTouch('zoom', 'add', 'start');
8608
+ };
8609
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").onmouseup = function(e) {
8610
+ e.preventDefault();
8611
+ e.stopPropagation();
8612
+ _this._handleBtnTouch('zoom', 'add', 'stop');
8613
+ };
8614
+ }
8615
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub")) {
8616
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").onmousedown = function(e) {
8617
+ e.preventDefault();
8618
+ e.stopPropagation();
8619
+ _this._handleBtnTouch('zoom', 'sub', 'start');
8620
+ };
8621
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").onmouseup = function(e) {
8622
+ e.preventDefault();
8623
+ e.stopPropagation();
8624
+ _this._handleBtnTouch('zoom', 'sub', 'stop');
8625
+ };
8626
+ }
8627
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add")) {
8628
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").onmousedown = function(e) {
8629
+ e.preventDefault();
8630
+ e.stopPropagation();
8631
+ _this._handleBtnTouch('focal', 'add', 'start');
8632
+ };
8633
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").onmouseup = function(e) {
8634
+ e.preventDefault();
8635
+ e.stopPropagation();
8636
+ _this._handleBtnTouch('focal', 'add', 'stop');
8637
+ };
8638
+ }
8639
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub")) {
8640
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").onmousedown = function(e) {
8641
+ e.preventDefault();
8642
+ e.stopPropagation();
8643
+ _this._handleBtnTouch('focal', 'sub', 'start');
8644
+ };
8645
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").onmouseup = function(e) {
8646
+ e.preventDefault();
8647
+ e.stopPropagation();
8648
+ _this._handleBtnTouch('focal', 'sub', 'stop');
8649
+ };
8650
+ }
8651
+ // mobile touch 事件监听
8652
+ if (_this._isMobile) {
8653
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add")) {
8654
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").ontouchstart = function(e) {
8655
+ e.preventDefault();
8656
+ e.stopPropagation();
8657
+ _this._handleBtnTouch('zoom', 'add', 'start');
8658
+ };
8659
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").ontouchend = function(e) {
8660
+ e.preventDefault();
8661
+ e.stopPropagation();
8662
+ _this._handleBtnTouch('zoom', 'add', 'stop');
8663
+ };
8664
+ }
8665
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub")) {
8666
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").ontouchstart = function(e) {
8667
+ e.preventDefault();
8668
+ e.stopPropagation();
8669
+ _this._handleBtnTouch('zoom', 'sub', 'start');
8670
+ };
8671
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").ontouchend = function(e) {
8672
+ e.preventDefault();
8673
+ e.stopPropagation();
8674
+ _this._handleBtnTouch('zoom', 'sub', 'stop');
8675
+ };
8676
+ }
8677
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add")) {
8678
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").ontouchstart = function(e) {
8679
+ e.preventDefault();
8680
+ e.stopPropagation();
8681
+ _this._handleBtnTouch('focal', 'add', 'start');
8682
+ };
8683
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").ontouchend = function(e) {
8684
+ e.preventDefault();
8685
+ e.stopPropagation();
8686
+ _this._handleBtnTouch('focal', 'add', 'stop');
8687
+ };
8688
+ }
8689
+ if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub")) {
8690
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").ontouchstart = function(e) {
8691
+ e.preventDefault();
8692
+ e.stopPropagation();
8693
+ _this._handleBtnTouch('focal', 'sub', 'start');
8694
+ };
8695
+ _this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").ontouchend = function(e) {
8696
+ e.preventDefault();
8697
+ e.stopPropagation();
8698
+ _this._handleBtnTouch('focal', 'sub', 'stop');
8699
+ };
8700
+ }
8701
+ }
8702
+ return _this;
8703
+ }
8704
+ var _proto = Ptz.prototype;
8705
+ _proto.destroy = function destroy() {
8706
+ if (this._clearTimer) {
8707
+ clearTimeout(this._clearTimer);
8708
+ this._clearTimer = null;
8709
+ }
8710
+ if (this._$directionCircleContainer) {
8711
+ this._$directionCircleContainer.remove();
8712
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8713
+ this._$directionCircleContainer = null;
8714
+ }
8715
+ if (this._$speedContainer) {
8716
+ this._onSwitchSpeed = null;
8717
+ this._$speedContainer.remove();
8718
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8719
+ this._$speedContainer = null;
8720
+ }
8721
+ if (this._$btnContainer) {
8722
+ this._$btnContainer.remove();
8723
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8724
+ this._$btnContainer = null;
8725
+ }
8726
+ if (this._$wrapper) {
8727
+ this._$wrapper.remove();
8728
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8729
+ this._$wrapper = null;
8730
+ }
8731
+ BasePtz.prototype.destroy.call(this);
8732
+ };
8733
+ _proto._handlePtzTouch = function _handlePtzTouch(e, type) {
8734
+ var _this = this;
8735
+ var _this_options_token_deviceToken, _this_options_token, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
8736
+ if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8737
+ // 初始化或获取当前PTZ操作队列
8738
+ if (!this._ptzQueue) {
8739
+ this._ptzQueue = Promise.resolve();
8740
+ }
8741
+ var container = this._$directionCircleContainer.getBoundingClientRect();
8742
+ var containerCenterX = container.left + (this._$directionCircleContainer.clientWidth + 2) / 2;
8743
+ var containerCenterY = container.top + (this._$directionCircleContainer.clientHeight + 2) / 2;
8744
+ var eventX = e.x || e.changedTouches[0].clientX;
8745
+ var eventY = e.y || e.changedTouches[0].clientY;
8746
+ var direction = 0;
8747
+ var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8748
+ var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
8749
+ var backDeg = 0;
8750
+ function getAreaId(x, y) {
8751
+ // 获取当前点击位置相对于圆心的角度
8752
+ var rad = Math.atan2(y, x);
8753
+ if (rad < 0) rad += 2 * Math.PI;
8754
+ var deg = rad * (180 / Math.PI) - 225 - 12.5;
8755
+ if (deg < 0) deg += 360;
8756
+ return Math.floor(deg / 45) + 1;
8757
+ }
8758
+ // 兼容画面旋转90度
8759
+ // const isRotate = false; // /^rotate\(90/.test(document.getElementById(`${this.jSPlugin.id}-wrap`).style.transform);
8760
+ var left = eventX - containerCenterX;
8761
+ var top = eventY - containerCenterY;
8762
+ if (this.isRotate) {
8763
+ switch(getAreaId(left, top)){
8764
+ case 1:
8765
+ direction = 2;
8766
+ backDeg = 90;
8767
+ break;
8768
+ case 2:
8769
+ direction = 4;
8770
+ backDeg = 135;
8771
+ break;
8772
+ case 3:
8773
+ direction = 0;
8774
+ backDeg = 180;
8775
+ break;
8776
+ case 4:
8777
+ direction = 6;
8778
+ backDeg = 225;
8779
+ break;
8780
+ case 5:
8781
+ direction = 3;
8782
+ backDeg = 270;
8783
+ break;
8784
+ case 6:
8785
+ direction = 7;
8786
+ backDeg = 315;
8787
+ break;
8788
+ case 7:
8789
+ direction = 1;
8790
+ backDeg = 0;
8791
+ break;
8792
+ case 8:
8793
+ direction = 5;
8794
+ backDeg = 45;
8795
+ break;
8796
+ }
8797
+ } else {
8798
+ switch(getAreaId(left, top)){
8799
+ case 1:
8800
+ direction = 0;
8801
+ backDeg = 180;
8802
+ break;
8803
+ case 2:
8804
+ direction = 6;
8805
+ backDeg = 225;
8806
+ break;
8807
+ case 3:
8808
+ direction = 3;
8809
+ backDeg = 270;
8810
+ break;
8811
+ case 4:
8812
+ direction = 7;
8813
+ backDeg = 315;
8814
+ break;
8815
+ case 5:
8816
+ direction = 1;
8817
+ backDeg = 0;
8818
+ break;
8819
+ case 6:
8820
+ direction = 5;
8821
+ backDeg = 45;
8822
+ break;
8823
+ case 7:
8824
+ direction = 2;
8825
+ backDeg = 90;
8826
+ break;
8827
+ case 8:
8828
+ direction = 4;
8829
+ backDeg = 135;
8830
+ break;
8831
+ }
8832
+ }
8833
+ if (this._clearTimer) {
8834
+ clearTimeout(this._clearTimer);
8835
+ this._clearTimer = null;
8836
+ }
8837
+ if (type === 'start') {
8838
+ this._$directionCircleContainer.style.cssText = "background-image:linear-gradient(" + backDeg + "deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)";
8839
+ } else {
8840
+ this._$directionCircleContainer.style.cssText = '';
8841
+ }
8842
+ if (type === 'stop') {
8843
+ var _this_options_env1;
8844
+ url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8845
+ }
8846
+ var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8847
+ areaId: getAreaId(left, top),
8848
+ direction: direction,
8849
+ backDeg: backDeg,
8850
+ isRotate: this.isRotate,
8851
+ speed: this.speed,
8852
+ type: type
8853
+ });
8854
+ var data = new FormData();
8855
+ data.append('deviceSerial', this.options.deviceSerial + '');
8856
+ data.append('channelNo', this.options.channelNo + '');
8857
+ data.append('speed', this.speed + '');
8858
+ data.append('direction', direction + '');
8859
+ data.append('accessToken', token);
8860
+ // 将操作加入队列
8861
+ this._ptzQueue = this._ptzQueue.then(function() {
8862
+ return _async_to_generator(function() {
8863
+ var _this;
8864
+ return _ts_generator(this, function(_state) {
8865
+ switch(_state.label){
8866
+ case 0:
8867
+ _this = this;
8868
+ return [
8869
+ 4,
8870
+ fetch(url, {
8871
+ method: 'POST',
8872
+ body: data
8873
+ }).then(function(response) {
8874
+ return _async_to_generator(function() {
8875
+ return _ts_generator(this, function(_state) {
8876
+ switch(_state.label){
8877
+ case 0:
8878
+ return [
8879
+ 4,
8880
+ response.json()
8881
+ ];
8882
+ case 1:
8883
+ return [
8884
+ 2,
8885
+ _state.sent()
8886
+ ];
8887
+ }
8888
+ });
8889
+ })();
8890
+ }).then(function(rt) {
8891
+ var _rt_result;
8892
+ operationResultCb == null ? void 0 : operationResultCb(rt);
8893
+ var code = rt.code || (rt == null ? void 0 : (_rt_result = rt.result) == null ? void 0 : _rt_result.code);
8894
+ if ([
8895
+ 60000,
8896
+ 60001,
8897
+ 60002,
8898
+ 60003,
8899
+ 60004,
8900
+ 60005,
8901
+ 60006,
8902
+ 10002
8903
+ ].includes(+code)) {
8904
+ _this._$directionCircleContainer.style.cssText = "background-image:linear-gradient(" + backDeg + "deg, #f45656 0%, rgba(100,143,252,0.00) 30%)";
8905
+ }
8906
+ return rt;
8907
+ }).catch(function(err) {
8908
+ }).finally(function() {
8909
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8910
+ operationResultCb = null;
8911
+ if (type === 'stop') {
8912
+ _this._clearTimer = setTimeout(function() {
8913
+ _this._$directionCircleContainer.style.cssText = '';
8914
+ }, 1000);
8915
+ }
8916
+ })
8917
+ ];
8918
+ case 1:
8919
+ // prettier-ignore
8920
+ return [
8921
+ 2,
8922
+ _state.sent()
8923
+ ];
8924
+ }
8925
+ });
8926
+ }).call(_this);
8927
+ });
8928
+ if (type === 'stop') {
8929
+ this._ptzQueue = this._ptzQueue.finally(function() {});
8930
+ }
8931
+ // this.jSPlugin?.eventEmitter?.emit(EVENTS.ptzDirection, {
8932
+ // areaId: getAreaId(left, top),
8933
+ // direction,
8934
+ // backDeg,
8935
+ // isRotate,
8936
+ // ptzSpeed: this.jSPlugin.ptzSpeed,
8937
+ // type,
8938
+ // });
8939
+ };
8940
+ _proto._handleBtnTouch = function _handleBtnTouch(btn, option, type) {
8941
+ var _this = this;
8942
+ var _this_options_token, _this_options_env, _this_options_token_deviceToken, _this_options_token1;
8943
+ if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : _this_options_token.deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
8944
+ // 使用Promise来跟踪当前操作状态
8945
+ if (!this._ptzOperation) {
8946
+ this._ptzOperation = Promise.resolve();
8947
+ }
8948
+ var direction = 8;
8949
+ if (btn === 'zoom') {
8950
+ direction = option === 'add' ? 8 : 9;
8951
+ } else {
8952
+ direction = option === 'add' ? 10 : 11;
8953
+ }
8954
+ var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
8955
+ var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video);
8956
+ if (type === 'stop') {
8957
+ var _this_options_env1;
8958
+ url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
8959
+ }
8960
+ var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
8961
+ btn: btn,
8962
+ option: option,
8963
+ type: type
8964
+ });
8965
+ var data = new FormData();
8966
+ data.append('deviceSerial', this.options.deviceSerial + '');
8967
+ data.append('channelNo', this.options.channelNo + '');
8968
+ data.append('speed', this.speed + '');
8969
+ data.append('direction', direction + '');
8970
+ data.append('accessToken', token);
8971
+ // 将当前操作加入Promise链
8972
+ this._ptzOperation = this._ptzOperation.then(function() {
8973
+ return _async_to_generator(function() {
8974
+ return _ts_generator(this, function(_state) {
8975
+ switch(_state.label){
8976
+ case 0:
8977
+ return [
8978
+ 4,
8979
+ fetch(url, {
8980
+ method: 'POST',
8981
+ body: data
8982
+ }).then(function(response) {
8983
+ return _async_to_generator(function() {
8984
+ return _ts_generator(this, function(_state) {
8985
+ switch(_state.label){
8986
+ case 0:
8987
+ return [
8988
+ 4,
8989
+ response.json()
8990
+ ];
8991
+ case 1:
8992
+ return [
8993
+ 2,
8994
+ _state.sent()
8995
+ ];
8996
+ }
8997
+ });
8998
+ })();
8999
+ }).then(function(rt) {
9000
+ operationResultCb == null ? void 0 : operationResultCb(rt);
9001
+ return rt;
9002
+ }).catch(function(err) {
9003
+ }).finally(function() {
9004
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9005
+ operationResultCb = null;
9006
+ })
9007
+ ];
9008
+ case 1:
9009
+ // prettier-ignore
9010
+ return [
9011
+ 2,
9012
+ _state.sent()
9013
+ ];
9014
+ }
9015
+ });
9016
+ })();
9017
+ });
9018
+ // 如果是stop操作,添加一个清理操作
9019
+ if (type === 'stop') {
9020
+ this._ptzOperation = this._ptzOperation.finally(function() {
9021
+ _this._ptzOperation = null; // 重置操作链
9022
+ });
9023
+ }
9024
+ };
9025
+ _create_class(Ptz, [
9026
+ {
9027
+ key: "isRotate",
9028
+ get: function get() {
9029
+ return this._isRotate;
9030
+ },
9031
+ set: /**
9032
+ * 是否旋转了
9033
+ */ function set(isRotate) {
9034
+ this._isRotate = isRotate;
9035
+ }
9036
+ }
9037
+ ]);
9038
+ return Ptz;
9039
+ }(BasePtz);
9040
+
9041
+ dist$4.BasePtz = BasePtz;
9042
+ dist$4.MobilePtz = MobilePtz;
9043
+ dist$4.Ptz = Ptz;
9044
+ return dist$4;
9045
+ }
9046
+
9047
+ var distExports$2 = requireDist$3();
8797
9048
 
8798
9049
  function _defineProperties$4(target, props) {
8799
9050
  for(var i = 0; i < props.length; i++){
@@ -8892,7 +9143,7 @@
8892
9143
  this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
8893
9144
  this.$panel.appendChild(this.$turntable);
8894
9145
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8895
- this._ptzControl = new Ptz$1(this.$turntable, _extends$b({}, this._options, {
9146
+ this._ptzControl = new distExports$2.Ptz(this.$turntable, _extends$b({}, this._options, {
8896
9147
  onSpeedChange: this._onSpeedChange.bind(this),
8897
9148
  onDirection: this._onDirection.bind(this)
8898
9149
  }));
@@ -8901,7 +9152,7 @@
8901
9152
  };
8902
9153
  _proto.renderMobileExtend = function renderMobileExtend($container) {
8903
9154
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8904
- if (!this._ptzControl1) this._ptzControl1 = new MobilePtz($container, _extends$b({}, this._options, {
9155
+ if (!this._ptzControl1) this._ptzControl1 = new distExports$2.MobilePtz($container, _extends$b({}, this._options, {
8905
9156
  onSpeedChange: this._onSpeedChange.bind(this),
8906
9157
  onDirection: this._onDirection.bind(this)
8907
9158
  }));
@@ -9152,7 +9403,7 @@
9152
9403
  return Record;
9153
9404
  }(Control);
9154
9405
 
9155
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
9406
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
9156
9407
  try {
9157
9408
  var info = gen[key](arg);
9158
9409
  var value = info.value;
@@ -9166,16 +9417,16 @@
9166
9417
  Promise.resolve(value).then(_next, _throw);
9167
9418
  }
9168
9419
  }
9169
- function _async_to_generator$3(fn) {
9420
+ function _async_to_generator$2(fn) {
9170
9421
  return function() {
9171
9422
  var self = this, args = arguments;
9172
9423
  return new Promise(function(resolve, reject) {
9173
9424
  var gen = fn.apply(self, args);
9174
9425
  function _next(value) {
9175
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
9426
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
9176
9427
  }
9177
9428
  function _throw(err) {
9178
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
9429
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
9179
9430
  }
9180
9431
  _next(undefined);
9181
9432
  });
@@ -9383,7 +9634,7 @@
9383
9634
  var _this = this, _superprop_get__onControlClick = function() {
9384
9635
  return Control.prototype._onControlClick;
9385
9636
  };
9386
- return _async_to_generator$3(function() {
9637
+ return _async_to_generator$2(function() {
9387
9638
  return _ts_generator$2(this, function(_state) {
9388
9639
  _superprop_get__onControlClick().call(_this, e);
9389
9640
  this.active = !this.active;
@@ -10005,232 +10256,393 @@
10005
10256
  }(Select);
10006
10257
 
10007
10258
  /*
10008
- * @ezuikit/control-date-picker v0.0.1
10009
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
10259
+ * @ezuikit/control-date-picker v0.0.1-alpha.2
10260
+ * Copyright (c) 2025-11-12 Ezviz-OpenBiz
10010
10261
  * Released under the MIT License.
10011
10262
  */
10012
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
10013
- try {
10014
- var info = gen[key](arg);
10015
- var value = info.value;
10016
- } catch (error) {
10017
- reject(error);
10018
- return;
10019
- }
10020
- if (info.done) {
10021
- resolve(value);
10022
- } else {
10023
- Promise.resolve(value).then(_next, _throw);
10024
- }
10025
- }
10026
- function _async_to_generator$2(fn) {
10027
- return function() {
10028
- var self = this, args = arguments;
10029
- return new Promise(function(resolve, reject) {
10030
- var gen = fn.apply(self, args);
10031
- function _next(value) {
10032
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
10033
- }
10034
- function _throw(err) {
10035
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
10036
- }
10037
- _next(undefined);
10038
- });
10039
- };
10040
- }
10041
- class AppendJS {
10042
- static loadScript(src) {
10043
- return _async_to_generator$2(function*() {
10044
- return yield new Promise((resolve, reject)=>{
10045
- if (AppendJS.LoadedScr.includes(src)) {
10046
- return resolve(src);
10047
- }
10048
- if (AppendJS.LoadingScrQueue[src]) {
10049
- return AppendJS.LoadingScrQueue[src].push(resolve);
10050
- } else {
10051
- AppendJS.LoadingScrQueue[src] = [
10052
- resolve
10053
- ];
10054
- }
10055
- let link;
10056
- if (src.includes('.js')) {
10057
- link = document.createElement('script');
10058
- link.src = src;
10059
- link.async = true;
10060
- } else if (src.includes('.css')) {
10061
- link = document.createElement('link');
10062
- link.rel = 'stylesheet';
10063
- link.href = src;
10064
- }
10065
- link.onload = ()=>{
10066
- AppendJS.LoadedScr.push(src);
10067
- AppendJS.LoadingScrQueue[src].forEach((resolve)=>resolve(src));
10068
- AppendJS.LoadingScrQueue[src] = [];
10069
- };
10070
- link.onerror = ()=>reject(new Error('Failed to load ' + src));
10071
- document.head.appendChild(link);
10072
- });
10073
- })();
10074
- }
10075
- static loadScriptsBatch(srcArr) {
10076
- return _async_to_generator$2(function*() {
10077
- return yield Promise.all(srcArr.map(AppendJS.loadScript));
10078
- })();
10079
- }
10080
- static remove(src) {
10081
- src.forEach((item)=>{
10082
- const link = document.querySelector(`script[src="${item}"]`) || document.querySelector(`link[href="${item}"]`);
10083
- if (link) {
10084
- link.remove();
10085
- }
10086
- });
10087
- }
10088
- static clear() {
10089
- AppendJS.remove(AppendJS.LoadedScr);
10090
- }
10091
- }
10092
- /** 已经加载完的js/css */ AppendJS.LoadedScr = [];
10093
- /** 正在加载的js/css */ AppendJS.LoadingScrQueue = {};
10094
10263
 
10095
- const DEFAULT_OPTIONS = {
10096
- staticPath: '.',
10097
- place: 'top-right',
10098
- language: 'zh-CN',
10099
- current: new Date(),
10100
- maxDate: new Date()
10101
- };
10102
- /**
10103
- * 日期选择器
10104
- */ class DatePicker {
10105
- _init() {
10106
- // 因为挂载在行内,需要父标签设置 position: relative;
10107
- this.$container.style.cssText += `;position: relative;`;
10108
- this.$container.classList.add(`datepicker-inline-${this.options.place}`);
10109
- AppendJS.loadScriptsBatch([
10110
- `${this.options.staticPath}/rec/jquery.min.js`,
10111
- `${this.options.staticPath}/rec/datepicker.min.css`
10112
- ]).then(()=>{
10113
- AppendJS.loadScriptsBatch([
10114
- `${this.options.staticPath}/rec/datepicker.js`
10115
- ]).then(()=>{
10116
- AppendJS.loadScriptsBatch([
10117
- `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
10118
- `${this.options.staticPath}/rec/datepicker.en-US.js`
10119
- ]).then(()=>{
10120
- window.$(this.$container).datepicker({
10121
- date: this.options.current,
10122
- language: this.options.language,
10123
- endDate: this.options.maxDate,
10124
- inline: true
10125
- });
10126
- this.hide();
10127
- window.$(this.$container).on('pick.datepicker', (e)=>{
10128
- var _this__date, _this__date1, _this__date2, _this__date3, _this__date4, _this__date5;
10129
- if (e.view === 'year' && ((_this__date = this._date) == null ? void 0 : _this__date.getFullYear()) !== e.date.getFullYear()) {
10130
- this.options.onYearChange == null ? void 0 : this.options.onYearChange.call(this.options, e.date);
10131
- } else if (e.view === 'month' && (((_this__date1 = this._date) == null ? void 0 : _this__date1.getMonth()) !== e.date.getMonth() || ((_this__date2 = this._date) == null ? void 0 : _this__date2.getFullYear()) !== e.date.getFullYear())) {
10132
- this.options.onMonthChange == null ? void 0 : this.options.onMonthChange.call(this.options, e.date);
10133
- } else if ([
10134
- 'day',
10135
- 'pick'
10136
- ].includes(e.view || e.type) && (((_this__date3 = this._date) == null ? void 0 : _this__date3.getDate()) !== e.date.getDate() || ((_this__date4 = this._date) == null ? void 0 : _this__date4.getMonth()) !== e.date.getMonth() || ((_this__date5 = this._date) == null ? void 0 : _this__date5.getFullYear()) !== e.date.getFullYear())) {
10137
- if (this._change) {
10138
- this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, e.date);
10139
- }
10140
- this._date = new Date(e.date.getTime());
10141
- }
10142
- if (e.view === 'day') this.hide();
10143
- this._change = true;
10144
- });
10145
- });
10146
- });
10147
- });
10148
- }
10149
- /**
10150
- * 获取日期
10151
- */ get date() {
10152
- return this._date;
10153
- }
10154
- /**
10155
- * 设置日期, change = true 时触发 onChange 事件
10156
- *
10157
- * @param date 设置的日期
10158
- * @param change 是否触发 onChange 事件
10159
- */ setDate(date, change = true) {
10160
- const $datepicker = this.$container.querySelector(`.datepicker-inline`);
10161
- if ($datepicker) {
10162
- this._change = change;
10163
- window.$(this.$container).datepicker('setDate', date);
10164
- }
10165
- }
10166
- /**
10167
- * 隐藏面板, 会触发 onPanelChange 事件
10168
- */ hide() {
10169
- const $datepicker = this.$container.querySelector(`.datepicker-inline`);
10170
- if ($datepicker) {
10171
- if (this._open) {
10172
- this._open = false;
10173
- this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, false, this._date);
10174
- }
10175
- $datepicker.classList.add('datepicker-hide');
10176
- }
10177
- }
10178
- /**
10179
- * 显示面板, 会触发 onPanelChange 事件
10180
- */ show() {
10181
- const $datepicker = this.$container.querySelector(`.datepicker-inline`);
10182
- if ($datepicker) {
10183
- var _window_$_datepicker, _window_$;
10184
- if (!this._open) {
10185
- this._open = true;
10186
- this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, true, this._date);
10187
- }
10188
- if (this._date) this.setDate(this._date, false);
10189
- (_window_$_datepicker = (_window_$ = window.$(this.$container)).datepicker) == null ? void 0 : _window_$_datepicker.call(_window_$, 'showView');
10190
- if (this.options.place === 'bottom-left') {
10191
- $datepicker.style.cssText += `top: ${this.$container.clientHeight + 10}px; bottom: auto; right: auto; left: 0px`;
10192
- } else {
10193
- $datepicker.style.cssText += `bottom: ${this.$container.clientHeight + 10}px; top: auto`;
10194
- }
10195
- $datepicker.classList.remove('datepicker-hide');
10196
- }
10197
- }
10198
- /**
10199
- * 销毁
10200
- */ destroy() {
10201
- this.hide();
10202
- this._date = undefined;
10203
- window.$(this.$container).datepicker('destroy');
10204
- // AppendJS.remove([
10205
- // `${this.options.staticPath}/rec/jquery.min.js`,
10206
- // `${this.options.staticPath}/rec/datepicker.min.css`,
10207
- // `${this.options.staticPath}/rec/datepicker.js`,
10208
- // `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
10209
- // `${this.options.staticPath}/rec/datepicker.en-US.js`,
10210
- // ]);
10211
- }
10212
- constructor(container, options){
10213
- this._open = false;
10214
- this._change = true;
10215
- this.$container = container;
10216
- this.options = Object.assign({}, DEFAULT_OPTIONS, options);
10217
- this.options.staticPath = (this.options.staticPath || '').replace(/\/$/, '');
10218
- if (this.options.current) {
10219
- this._date = this.options.current;
10220
- }
10221
- this._init();
10222
- this.$container.addEventListener('click', ()=>{
10223
- if (this._open) this.hide();
10224
- else this.show();
10225
- });
10226
- document.body.addEventListener('click', (e)=>{
10227
- if (!this.$container.contains(e.target)) {
10228
- this.hide();
10229
- }
10230
- });
10231
- }
10264
+ var dist$2;
10265
+ var hasRequiredDist$2;
10266
+
10267
+ function requireDist$2 () {
10268
+ if (hasRequiredDist$2) return dist$2;
10269
+ hasRequiredDist$2 = 1;
10270
+
10271
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10272
+ try {
10273
+ var info = gen[key](arg);
10274
+ var value = info.value;
10275
+ } catch (error) {
10276
+ reject(error);
10277
+ return;
10278
+ }
10279
+ if (info.done) {
10280
+ resolve(value);
10281
+ } else {
10282
+ Promise.resolve(value).then(_next, _throw);
10283
+ }
10284
+ }
10285
+ function _async_to_generator(fn) {
10286
+ return function() {
10287
+ var self = this, args = arguments;
10288
+ return new Promise(function(resolve, reject) {
10289
+ var gen = fn.apply(self, args);
10290
+ function _next(value) {
10291
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
10292
+ }
10293
+ function _throw(err) {
10294
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
10295
+ }
10296
+ _next(undefined);
10297
+ });
10298
+ };
10299
+ }
10300
+ function _ts_generator(thisArg, body) {
10301
+ var f, y, t, _ = {
10302
+ label: 0,
10303
+ sent: function() {
10304
+ if (t[0] & 1) throw t[1];
10305
+ return t[1];
10306
+ },
10307
+ trys: [],
10308
+ ops: []
10309
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
10310
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
10311
+ return this;
10312
+ }), g;
10313
+ function verb(n) {
10314
+ return function(v) {
10315
+ return step([
10316
+ n,
10317
+ v
10318
+ ]);
10319
+ };
10320
+ }
10321
+ function step(op) {
10322
+ if (f) throw new TypeError("Generator is already executing.");
10323
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
10324
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
10325
+ if (y = 0, t) op = [
10326
+ op[0] & 2,
10327
+ t.value
10328
+ ];
10329
+ switch(op[0]){
10330
+ case 0:
10331
+ case 1:
10332
+ t = op;
10333
+ break;
10334
+ case 4:
10335
+ _.label++;
10336
+ return {
10337
+ value: op[1],
10338
+ done: false
10339
+ };
10340
+ case 5:
10341
+ _.label++;
10342
+ y = op[1];
10343
+ op = [
10344
+ 0
10345
+ ];
10346
+ continue;
10347
+ case 7:
10348
+ op = _.ops.pop();
10349
+ _.trys.pop();
10350
+ continue;
10351
+ default:
10352
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
10353
+ _ = 0;
10354
+ continue;
10355
+ }
10356
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
10357
+ _.label = op[1];
10358
+ break;
10359
+ }
10360
+ if (op[0] === 6 && _.label < t[1]) {
10361
+ _.label = t[1];
10362
+ t = op;
10363
+ break;
10364
+ }
10365
+ if (t && _.label < t[2]) {
10366
+ _.label = t[2];
10367
+ _.ops.push(op);
10368
+ break;
10369
+ }
10370
+ if (t[2]) _.ops.pop();
10371
+ _.trys.pop();
10372
+ continue;
10373
+ }
10374
+ op = body.call(thisArg, _);
10375
+ } catch (e) {
10376
+ op = [
10377
+ 6,
10378
+ e
10379
+ ];
10380
+ y = 0;
10381
+ } finally{
10382
+ f = t = 0;
10383
+ }
10384
+ if (op[0] & 5) throw op[1];
10385
+ return {
10386
+ value: op[0] ? op[1] : void 0,
10387
+ done: true
10388
+ };
10389
+ }
10390
+ }
10391
+ var AppendJS = /*#__PURE__*/ function() {
10392
+ function AppendJS() {}
10393
+ AppendJS.loadScript = function loadScript(src) {
10394
+ return _async_to_generator(function() {
10395
+ return _ts_generator(this, function(_state) {
10396
+ switch(_state.label){
10397
+ case 0:
10398
+ return [
10399
+ 4,
10400
+ new Promise(function(resolve, reject) {
10401
+ if (AppendJS.LoadedScr.includes(src)) {
10402
+ return resolve(src);
10403
+ }
10404
+ if (AppendJS.LoadingScrQueue[src]) {
10405
+ return AppendJS.LoadingScrQueue[src].push(resolve);
10406
+ } else {
10407
+ AppendJS.LoadingScrQueue[src] = [
10408
+ resolve
10409
+ ];
10410
+ }
10411
+ var link;
10412
+ if (src.includes('.js')) {
10413
+ link = document.createElement('script');
10414
+ link.src = src;
10415
+ link.async = true;
10416
+ } else if (src.includes('.css')) {
10417
+ link = document.createElement('link');
10418
+ link.rel = 'stylesheet';
10419
+ link.href = src;
10420
+ }
10421
+ link.onload = function() {
10422
+ AppendJS.LoadedScr.push(src);
10423
+ AppendJS.LoadingScrQueue[src].forEach(function(resolve) {
10424
+ return resolve(src);
10425
+ });
10426
+ AppendJS.LoadingScrQueue[src] = [];
10427
+ };
10428
+ link.onerror = function() {
10429
+ return reject(new Error('Failed to load ' + src));
10430
+ };
10431
+ document.head.appendChild(link);
10432
+ })
10433
+ ];
10434
+ case 1:
10435
+ return [
10436
+ 2,
10437
+ _state.sent()
10438
+ ];
10439
+ }
10440
+ });
10441
+ })();
10442
+ };
10443
+ AppendJS.loadScriptsBatch = function loadScriptsBatch(srcArr) {
10444
+ return _async_to_generator(function() {
10445
+ return _ts_generator(this, function(_state) {
10446
+ switch(_state.label){
10447
+ case 0:
10448
+ return [
10449
+ 4,
10450
+ Promise.all(srcArr.map(AppendJS.loadScript))
10451
+ ];
10452
+ case 1:
10453
+ return [
10454
+ 2,
10455
+ _state.sent()
10456
+ ];
10457
+ }
10458
+ });
10459
+ })();
10460
+ };
10461
+ AppendJS.remove = function remove(src) {
10462
+ src.forEach(function(item) {
10463
+ var link = document.querySelector('script[src="' + item + '"]') || document.querySelector('link[href="' + item + '"]');
10464
+ if (link) {
10465
+ link.remove();
10466
+ }
10467
+ });
10468
+ };
10469
+ AppendJS.clear = function clear() {
10470
+ AppendJS.remove(AppendJS.LoadedScr);
10471
+ };
10472
+ return AppendJS;
10473
+ }();
10474
+ /** 已经加载完的js/css */ AppendJS.LoadedScr = [];
10475
+ /** 正在加载的js/css */ AppendJS.LoadingScrQueue = {};
10476
+
10477
+ function _defineProperties(target, props) {
10478
+ for(var i = 0; i < props.length; i++){
10479
+ var descriptor = props[i];
10480
+ descriptor.enumerable = descriptor.enumerable || false;
10481
+ descriptor.configurable = true;
10482
+ if ("value" in descriptor) descriptor.writable = true;
10483
+ Object.defineProperty(target, descriptor.key, descriptor);
10484
+ }
10485
+ }
10486
+ function _create_class(Constructor, protoProps, staticProps) {
10487
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10488
+ return Constructor;
10489
+ }
10490
+ var DEFAULT_OPTIONS = {
10491
+ staticPath: '.',
10492
+ place: 'top-right',
10493
+ language: 'zh-CN',
10494
+ current: new Date(),
10495
+ maxDate: new Date()
10496
+ };
10497
+ /**
10498
+ * 日期选择器
10499
+ */ var DatePicker = /*#__PURE__*/ function() {
10500
+ function DatePicker(container, options) {
10501
+ var _this = this;
10502
+ this._open = false;
10503
+ this._change = true;
10504
+ this.$container = container;
10505
+ this.options = Object.assign({}, DEFAULT_OPTIONS, options);
10506
+ this.options.staticPath = (this.options.staticPath || '').replace(/\/$/, '');
10507
+ if (this.options.current) {
10508
+ this._date = this.options.current;
10509
+ }
10510
+ this._init();
10511
+ this.$container.addEventListener('click', function() {
10512
+ if (_this._open) _this.hide();
10513
+ else _this.show();
10514
+ });
10515
+ document.body.addEventListener('click', function(e) {
10516
+ if (!_this.$container.contains(e.target)) {
10517
+ _this.hide();
10518
+ }
10519
+ });
10520
+ }
10521
+ var _proto = DatePicker.prototype;
10522
+ _proto._init = function _init() {
10523
+ var _this = this;
10524
+ // 因为挂载在行内,需要父标签设置 position: relative;
10525
+ this.$container.style.cssText += ";position: relative;";
10526
+ this.$container.classList.add("datepicker-inline-" + this.options.place);
10527
+ AppendJS.loadScriptsBatch([
10528
+ "" + this.options.staticPath + "/rec/jquery.min.js",
10529
+ "" + this.options.staticPath + "/rec/datepicker.min.css"
10530
+ ]).then(function() {
10531
+ AppendJS.loadScriptsBatch([
10532
+ "" + _this.options.staticPath + "/rec/datepicker.js"
10533
+ ]).then(function() {
10534
+ AppendJS.loadScriptsBatch([
10535
+ "" + _this.options.staticPath + "/rec/datepicker.zh-CN.js",
10536
+ "" + _this.options.staticPath + "/rec/datepicker.en-US.js"
10537
+ ]).then(function() {
10538
+ window.$(_this.$container).datepicker({
10539
+ date: _this.options.current,
10540
+ language: _this.options.language,
10541
+ endDate: _this.options.maxDate,
10542
+ inline: true
10543
+ });
10544
+ _this.hide();
10545
+ window.$(_this.$container).on('pick.datepicker', function(e) {
10546
+ var _this__date, _this__date1, _this__date2, _this__date3, _this__date4, _this__date5;
10547
+ if (e.view === 'year' && ((_this__date = _this._date) == null ? void 0 : _this__date.getFullYear()) !== e.date.getFullYear()) {
10548
+ _this.options.onYearChange == null ? void 0 : _this.options.onYearChange.call(_this.options, e.date);
10549
+ } else if (e.view === 'month' && (((_this__date1 = _this._date) == null ? void 0 : _this__date1.getMonth()) !== e.date.getMonth() || ((_this__date2 = _this._date) == null ? void 0 : _this__date2.getFullYear()) !== e.date.getFullYear())) {
10550
+ _this.options.onMonthChange == null ? void 0 : _this.options.onMonthChange.call(_this.options, e.date);
10551
+ } else if ([
10552
+ 'day',
10553
+ 'pick'
10554
+ ].includes(e.view || e.type) && (((_this__date3 = _this._date) == null ? void 0 : _this__date3.getDate()) !== e.date.getDate() || ((_this__date4 = _this._date) == null ? void 0 : _this__date4.getMonth()) !== e.date.getMonth() || ((_this__date5 = _this._date) == null ? void 0 : _this__date5.getFullYear()) !== e.date.getFullYear())) {
10555
+ if (_this._change) {
10556
+ _this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, e.date);
10557
+ }
10558
+ _this._date = new Date(e.date.getTime());
10559
+ }
10560
+ if (e.view === 'day') _this.hide();
10561
+ _this._change = true;
10562
+ });
10563
+ });
10564
+ });
10565
+ });
10566
+ };
10567
+ /**
10568
+ * 设置日期, change = true 时触发 onChange 事件
10569
+ *
10570
+ * @param date 设置的日期
10571
+ * @param change 是否触发 onChange 事件
10572
+ */ _proto.setDate = function setDate(date, change) {
10573
+ if (change === void 0) change = true;
10574
+ var $datepicker = this.$container.querySelector(".datepicker-inline");
10575
+ if ($datepicker) {
10576
+ this._change = change;
10577
+ window.$(this.$container).datepicker('setDate', date);
10578
+ }
10579
+ };
10580
+ /**
10581
+ * 隐藏面板, 会触发 onPanelChange 事件
10582
+ */ _proto.hide = function hide() {
10583
+ var $datepicker = this.$container.querySelector(".datepicker-inline");
10584
+ if ($datepicker) {
10585
+ if (this._open) {
10586
+ this._open = false;
10587
+ this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, false, this._date);
10588
+ }
10589
+ $datepicker.classList.add('datepicker-hide');
10590
+ }
10591
+ };
10592
+ /**
10593
+ * 显示面板, 会触发 onPanelChange 事件
10594
+ */ _proto.show = function show() {
10595
+ var $datepicker = this.$container.querySelector(".datepicker-inline");
10596
+ if ($datepicker) {
10597
+ var _window_$_datepicker, _window_$;
10598
+ if (!this._open) {
10599
+ this._open = true;
10600
+ this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, true, this._date);
10601
+ }
10602
+ if (this._date) this.setDate(this._date, false);
10603
+ (_window_$_datepicker = (_window_$ = window.$(this.$container)).datepicker) == null ? void 0 : _window_$_datepicker.call(_window_$, 'showView');
10604
+ if (this.options.place === 'bottom-left') {
10605
+ $datepicker.style.cssText += "top: " + (this.$container.clientHeight + 10) + "px; bottom: auto; right: auto; left: 0px";
10606
+ } else {
10607
+ $datepicker.style.cssText += "bottom: " + (this.$container.clientHeight + 10) + "px; top: auto";
10608
+ }
10609
+ $datepicker.classList.remove('datepicker-hide');
10610
+ }
10611
+ };
10612
+ /**
10613
+ * 销毁
10614
+ */ _proto.destroy = function destroy() {
10615
+ this.hide();
10616
+ this._date = undefined;
10617
+ window.$(this.$container).datepicker('destroy');
10618
+ // AppendJS.remove([
10619
+ // `${this.options.staticPath}/rec/jquery.min.js`,
10620
+ // `${this.options.staticPath}/rec/datepicker.min.css`,
10621
+ // `${this.options.staticPath}/rec/datepicker.js`,
10622
+ // `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
10623
+ // `${this.options.staticPath}/rec/datepicker.en-US.js`,
10624
+ // ]);
10625
+ };
10626
+ _create_class(DatePicker, [
10627
+ {
10628
+ key: "date",
10629
+ get: /**
10630
+ * 获取日期
10631
+ */ function get() {
10632
+ return this._date;
10633
+ }
10634
+ }
10635
+ ]);
10636
+ return DatePicker;
10637
+ }();
10638
+
10639
+ dist$2 = DatePicker;
10640
+ return dist$2;
10232
10641
  }
10233
10642
 
10643
+ var distExports$1 = requireDist$2();
10644
+ var DatePickerUtil = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
10645
+
10234
10646
  /**
10235
10647
  * @description 时间操作
10236
10648
  */ var DateTime = /*#__PURE__*/ function() {
@@ -10433,7 +10845,7 @@
10433
10845
  var _proto = DatePickerControl.prototype;
10434
10846
  _proto._render = function _render() {
10435
10847
  var _this = this;
10436
- if (distExports$3.isMobile()) {
10848
+ if (distExports$6.isMobile()) {
10437
10849
  var _this_locale;
10438
10850
  this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
10439
10851
  } else {
@@ -10442,12 +10854,12 @@
10442
10854
  title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
10443
10855
  });
10444
10856
  }
10445
- this.dataPickerUtil = new DatePicker(this.$container, {
10857
+ this.dataPickerUtil = new DatePickerUtil(this.$container, {
10446
10858
  staticPath: this.options.staticPath,
10447
10859
  language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
10448
10860
  current: new Date(this._value + ' 00:00:00'),
10449
10861
  maxDate: this.options.maxDate || new Date(),
10450
- place: distExports$3.isMobile() ? 'bottom-left' : 'top-right',
10862
+ place: distExports$6.isMobile() ? 'bottom-left' : 'top-right',
10451
10863
  onChange: function(date) {
10452
10864
  if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
10453
10865
  _this._value = DateTime.formate(date, 'YYYY-MM-DD');
@@ -10956,7 +11368,7 @@
10956
11368
  if (hasRequiredDist) return dist$1.exports;
10957
11369
  hasRequiredDist = 1;
10958
11370
  (function (module, exports) {
10959
- Object.defineProperty(exports,"__esModule",{value:true});var deepmerge=requireCjs(),I18n=requireDist$3(),Picker=requireDist$6(),DragScroll=requireDist$1(),delegate=requireDist$5(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
11371
+ Object.defineProperty(exports,"__esModule",{value:true});var deepmerge=requireCjs(),I18n=requireDist$7(),Picker=requireDist$a(),DragScroll=requireDist$1(),delegate=requireDist$9(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
10960
11372
  // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
10961
11373
  timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
10962
11374
  onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,
@@ -11599,7 +12011,7 @@
11599
12011
  }
11600
12012
  }
11601
12013
  };
11602
- if (distExports$3.isMobile()) {
12014
+ if (distExports$6.isMobile()) {
11603
12015
  this.timeLineUtil = new distExports.MobileTimeLine(this.$container, _timeLineOptions);
11604
12016
  } else {
11605
12017
  this.timeLineUtil = new distExports.TimeLine(this.$container, _timeLineOptions);
@@ -11609,7 +12021,7 @@
11609
12021
  this.timeLineUtil.update(new Date());
11610
12022
  };
11611
12023
  _proto.setWidth = function setWidth(width) {
11612
- if (!distExports$3.isMobile()) this.timeLineUtil.resize(width);
12024
+ if (!distExports$6.isMobile()) this.timeLineUtil.resize(width);
11613
12025
  };
11614
12026
  _proto._renderAddReduce = function _renderAddReduce() {
11615
12027
  var _this = this;
@@ -12872,7 +13284,7 @@
12872
13284
  _this._initOptions(options);
12873
13285
  if (_this.options.type === 'ezopen') {
12874
13286
  var _this_urlInfo_searchParams, _this_urlInfo;
12875
- _this.urlInfo = distExports$3.parseEzopenUrl(_this.options.url);
13287
+ _this.urlInfo = distExports$6.parseEzopenUrl(_this.options.url);
12876
13288
  if ((_this_urlInfo = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams = _this_urlInfo.searchParams) == null ? void 0 : _this_urlInfo_searchParams.spaceId) {
12877
13289
  _this.options.spaceId = _this.urlInfo.searchParams.spaceId;
12878
13290
  }
@@ -13622,7 +14034,7 @@
13622
14034
  };
13623
14035
  _proto._getRecType = function _getRecType(url) {
13624
14036
  if (this.options.type === 'ezopen' && /^ezopen:\/\//.test(url)) {
13625
- var urlInfo = distExports$3.parseEzopenUrl(url);
14037
+ var urlInfo = distExports$6.parseEzopenUrl(url);
13626
14038
  if (urlInfo.type === 'rec') {
13627
14039
  var _urlInfo_searchParams;
13628
14040
  if (urlInfo.recType === 'cloud' && (urlInfo == null ? void 0 : (_urlInfo_searchParams = urlInfo.searchParams) == null ? void 0 : _urlInfo_searchParams.busType) === '7') {
@@ -14081,7 +14493,7 @@
14081
14493
  zh: zh,
14082
14494
  en: en
14083
14495
  };
14084
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.1-alpha.0';
14496
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.0-beta.2';
14085
14497
 
14086
14498
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
14087
14499