@ezuikit/player-theme 1.0.1-alpha.0 → 2.0.0-beta.1

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