@ezuikit/player-theme 3.1.0-beta.5 → 3.1.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constant.js +2 -2
- package/dist/index.cjs +171 -80
- package/dist/index.esm.js +171 -80
- package/dist/index.umd.js +210 -184
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +76 -41
- package/package.json +12 -15
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v3.1.
|
|
3
|
-
* Copyright (c) 2026-07-
|
|
2
|
+
* @ezuikit/player-theme v3.1.1-beta.2
|
|
3
|
+
* Copyright (c) 2026-07-30 01:56:43 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -1300,7 +1300,11 @@
|
|
|
1300
1300
|
if (duration === void 0) duration = 2;
|
|
1301
1301
|
this._toast(msg, 'warn', duration);
|
|
1302
1302
|
};
|
|
1303
|
-
|
|
1303
|
+
/**
|
|
1304
|
+
* toast 错误消息(渲染在 rootContainer 上的浮层)
|
|
1305
|
+
* @param {string} msg 消息内容
|
|
1306
|
+
* @param {number} duration 自动关闭延时,单位秒, 默认 2s 后关闭
|
|
1307
|
+
*/ _proto.toastError = function toastError(msg, duration) {
|
|
1304
1308
|
if (duration === void 0) duration = 2;
|
|
1305
1309
|
this._toast(msg, 'error', duration);
|
|
1306
1310
|
};
|
|
@@ -2405,9 +2409,9 @@
|
|
|
2405
2409
|
var dist$4 = {};
|
|
2406
2410
|
|
|
2407
2411
|
/*
|
|
2408
|
-
* @ezuikit/utils-tools v2.0.
|
|
2412
|
+
* @ezuikit/utils-tools v2.0.5
|
|
2409
2413
|
* tools utils
|
|
2410
|
-
* Copyright (c) 2026-
|
|
2414
|
+
* Copyright (c) 2026-07-06 Ezviz-OpenBiz
|
|
2411
2415
|
* Released under the MIT License.
|
|
2412
2416
|
*/
|
|
2413
2417
|
|
|
@@ -2416,7 +2420,7 @@
|
|
|
2416
2420
|
function requireDist$4 () {
|
|
2417
2421
|
if (hasRequiredDist$4) return dist$4;
|
|
2418
2422
|
hasRequiredDist$4 = 1;
|
|
2419
|
-
var getQuery=function(url){var query=url.split("?")[1],obj={};if(query)for(var vars=query.split("&"),i=0;i<vars.length;i++){var pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}return obj};function parseEzopenUrl(url){var obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){var 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;var 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 {}}var codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(+str.slice(0,4),+str.slice(5,7)-1,+str.slice(8,10),0,0,0):/^\d{8}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),0,0,0)):/^\d{14}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),+str.slice(8,10),+str.slice(10,12),+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$4.DateTime=DateTime,dist$4.addVc=function(url,codecs){ void 0===codecs&&(codecs=["h264"]);var vc=(codecs||["h264"]).reduce(function(acc,key){return key=key.toLowerCase(),acc+(codec[key]||0)},0),host=url.split("?")[0],query=url.split("?")[1];return query=(query||"").split("&").filter(function(item){return !/^vc=\d?/.test(item)}).join("&"),host+"?"+(query+=(query?"&":"")+"vc="+vc)},dist$4.getQuery=getQuery,dist$4.getStaticPath=function(path,base){ void 0===base&&(base="");var 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$4.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$4.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(agent||(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$4.isRealMobile=function(agent){var _navigator,ua=(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent).toLowerCase();if(/ipad|tablet|playbook|silk|android(?!.*mobile)/i.test(ua))return false;var hasTouch="ontouchstart"in window||navigator.maxTouchPoints>0;return /android|webos|iphone|ipod|blackberry|iemobile|opera mini/i.test(ua)&&hasTouch},dist$4.parseEzopenUrl=parseEzopenUrl,dist$4.pick=function(obj,keys){return Object.entries(obj).reduce(function(acc,param){var key=param[0],value=param[1];return keys.includes(key)&&(acc[key]=value),acc},{})},dist$4.switchEzopenUrl=function(url,options){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);if(search){var ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(function(acc,param){var key=param[0],value=param[1];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};
|
|
2423
|
+
var getQuery=function(url){var query=url.split("?")[1],obj={};if(query)for(var vars=query.split("&"),i=0;i<vars.length;i++){var pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}return obj};function parseEzopenUrl(url){var obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){var 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;var 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 {}}var codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.normalizeUnit=function(unit){return "year"===unit||"y"===unit||"年"===unit?"year":"month"===unit||"M"===unit||"月"===unit?"month":"day"===unit||"d"===unit||"日"===unit?"day":"hour"===unit||"h"===unit||"时"===unit?"hour":"minute"===unit||"m"===unit||"分"===unit?"minute":"second"},DateTime.daysInMonth=function(year,month){return new Date(year,month+1,0).getDate()},DateTime.shiftMonth=function(baseDate,months){var result=new Date(baseDate.getTime()),currentDate=result.getDate();result.setDate(1),result.setMonth(result.getMonth()+months);var maxDate=DateTime.daysInMonth(result.getFullYear(),result.getMonth());return result.setDate(Math.min(currentDate,maxDate)),result},DateTime.add=function(input,value,unit){if(void 0===unit&&(unit="day"),!Number.isFinite(value))throw new Error("Invalid value");var baseDate=DateTime.toDate(input),normalizedUnit=DateTime.normalizeUnit(unit);if("year"===normalizedUnit)return DateTime.shiftMonth(baseDate,12*value);if("month"===normalizedUnit)return DateTime.shiftMonth(baseDate,value);var result=new Date(baseDate.getTime());return result.setTime(result.getTime()+value*{day:864e5,hour:36e5,minute:6e4,second:1e3}[normalizedUnit]),result},DateTime.subtract=function(input,value,unit){return void 0===unit&&(unit="day"),DateTime.add(input,-value,unit)},DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(+str.slice(0,4),+str.slice(5,7)-1,+str.slice(8,10),0,0,0):/^\d{8}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),0,0,0)):/^\d{14}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),+str.slice(8,10),+str.slice(10,12),+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$4.DateTime=DateTime,dist$4.addVc=function(url,codecs){ void 0===codecs&&(codecs=["h264"]);var vc=(codecs||["h264"]).reduce((function(acc,key){return key=key.toLowerCase(),acc+(codec[key]||0)}),0),host=url.split("?")[0],query=url.split("?")[1];return query=(query||"").split("&").filter((function(item){return !/^vc=\d?/.test(item)})).join("&"),host+"?"+(query+=(query?"&":"")+"vc="+vc)},dist$4.getQuery=getQuery,dist$4.getStaticPath=function(path,base){ void 0===base&&(base="");var 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$4.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$4.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(agent||(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$4.isRealMobile=function(agent){var _navigator,ua=(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent).toLowerCase();if(/ipad|tablet|playbook|silk|android(?!.*mobile)/i.test(ua))return false;var hasTouch="ontouchstart"in window||navigator.maxTouchPoints>0;return /android|webos|iphone|ipod|blackberry|iemobile|opera mini/i.test(ua)&&hasTouch},dist$4.parseEzopenUrl=parseEzopenUrl,dist$4.pick=function(obj,keys){return Object.entries(obj).reduce((function(acc,param){var key=param[0],value=param[1];return keys.includes(key)&&(acc[key]=value),acc}),{})},dist$4.switchEzopenUrl=function(url,options){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);if(search){var ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce((function(acc,param){var key=param[0],value=param[1];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};
|
|
2420
2424
|
return dist$4;
|
|
2421
2425
|
}
|
|
2422
2426
|
|
|
@@ -3042,7 +3046,7 @@
|
|
|
3042
3046
|
tagName: 'span',
|
|
3043
3047
|
classNameSuffix: 'volume',
|
|
3044
3048
|
controlType: 'button'
|
|
3045
|
-
})) || this, _this._muted = false, _this._volume = 0, /** 用来记录静音前的音量 */ _this._lastVolume = 0, _this._progress = null;
|
|
3049
|
+
})) || this, _this._muted = false, _this._volume = 0, /** 用来记录静音前的音量 */ _this._lastVolume = 0, /** 音量进度条实例 @private */ _this._progress = null;
|
|
3046
3050
|
_this._options = deepmerge(VOLUME_DEFAULT_OPTIONS, options, {
|
|
3047
3051
|
clone: false
|
|
3048
3052
|
});
|
|
@@ -3943,7 +3947,7 @@
|
|
|
3943
3947
|
tagName: 'span',
|
|
3944
3948
|
classNameSuffix: 'fullscreen',
|
|
3945
3949
|
controlType: 'button'
|
|
3946
|
-
}, options)) || this, _this.isCurrentFullscreen = false;
|
|
3950
|
+
}, options)) || this, /** 当前是否处于全屏状态 */ _this.isCurrentFullscreen = false;
|
|
3947
3951
|
_this.options = options;
|
|
3948
3952
|
_this.isCurrentFullscreen = !!((_options_props = options.props) == null ? void 0 : _options_props.isCurrentFullscreen);
|
|
3949
3953
|
_this._$rootContainer = (_this_options = _this.options) == null ? void 0 : _this_options.rootContainer;
|
|
@@ -4059,14 +4063,19 @@
|
|
|
4059
4063
|
return _this;
|
|
4060
4064
|
}
|
|
4061
4065
|
var _proto = Rec.prototype;
|
|
4062
|
-
|
|
4066
|
+
/**
|
|
4067
|
+
* 销毁
|
|
4068
|
+
*/ _proto.destroy = function destroy() {
|
|
4063
4069
|
var _this__delegation;
|
|
4064
4070
|
this.$container.removeEventListener('dblclick', this._onDBlClick);
|
|
4065
4071
|
(_this__delegation = this._delegation) == null ? void 0 : _this__delegation.destroy();
|
|
4066
4072
|
this._delegation = null;
|
|
4067
4073
|
Control.prototype.destroy.call(this);
|
|
4068
4074
|
};
|
|
4069
|
-
|
|
4075
|
+
/**
|
|
4076
|
+
* 添加回放类型图标
|
|
4077
|
+
* @param {string} id 回放类型 'rec' | 'cloudRec' | 'cloudRecord'
|
|
4078
|
+
*/ _proto.addRecType = function addRecType(id) {
|
|
4070
4079
|
var spanIcon = '';
|
|
4071
4080
|
switch(id){
|
|
4072
4081
|
case 'rec':
|
|
@@ -4157,7 +4166,7 @@
|
|
|
4157
4166
|
}
|
|
4158
4167
|
|
|
4159
4168
|
var distExports$3 = requireDist$3();
|
|
4160
|
-
var I18n
|
|
4169
|
+
var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$3);
|
|
4161
4170
|
|
|
4162
4171
|
/*
|
|
4163
4172
|
* @ezuikit/utils-logger v2.0.0
|
|
@@ -6616,7 +6625,12 @@
|
|
|
6616
6625
|
};
|
|
6617
6626
|
}
|
|
6618
6627
|
}
|
|
6619
|
-
|
|
6628
|
+
/**
|
|
6629
|
+
* 获取开放平台轻应用模板数据
|
|
6630
|
+
* @param theme
|
|
6631
|
+
* @param id 开放平台轻应用模板id (https://open.ys7.com/console/ezuikit/template.html)
|
|
6632
|
+
* @returns
|
|
6633
|
+
*/ function getThemeDataByTemplate(theme, id) {
|
|
6620
6634
|
return _async_to_generator$7(function() {
|
|
6621
6635
|
var _theme_options_token_httpToken, _theme_options_token, url;
|
|
6622
6636
|
return _ts_generator$7(this, function(_state) {
|
|
@@ -6925,7 +6939,8 @@
|
|
|
6925
6939
|
}
|
|
6926
6940
|
/**
|
|
6927
6941
|
* 获取主题数据 (主题优先级: template > themeDate)
|
|
6928
|
-
* @param
|
|
6942
|
+
* @param theme 主题实例
|
|
6943
|
+
* @param data 主题数据或模板id(萤石开放平台轻应用32位模板字符串)或模板名称
|
|
6929
6944
|
* @returns
|
|
6930
6945
|
*/ function getThemeData(theme, data) {
|
|
6931
6946
|
return _async_to_generator$6(function() {
|
|
@@ -7533,8 +7548,8 @@
|
|
|
7533
7548
|
}(Control);
|
|
7534
7549
|
|
|
7535
7550
|
/*
|
|
7536
|
-
* @ezuikit/control-ptz v1.0.0-beta.
|
|
7537
|
-
* Copyright (c) 2026-
|
|
7551
|
+
* @ezuikit/control-ptz v1.0.0-beta.6
|
|
7552
|
+
* Copyright (c) 2026-07-28 Ezviz-OpenBiz
|
|
7538
7553
|
* Released under the MIT License.
|
|
7539
7554
|
*/
|
|
7540
7555
|
var PTZ_DEFAULT_OPTIONS={language:"zh",env:{domain:"https://open.ys7.com"},accessToken:"",speed:2,locales:{zh:{GET_PTZ_STATUS:"获取当前云台状态",GET_PTZ_STATUS_FAILED:"未加载Theme模块,无法获取云台状态",MOBILE_HIDE_PTZ:"移动端,非全屏状态不展示云台",OPTION_PTZ_FAILED:"未加载Theme模块,无法操作云台",MOBILE_PTZ_TIPS:"请通过操控云台来调整摄像机视角",PTZ_FAST:"快",PTZ_MID:"中",PTZ_SLOW:"慢",PTZ_SPEED:"调整云台转动速度",DEVICE_ZOOM:"控制设备放大/缩小画面",DEVICE_FOCUS:"调整设备焦距"},en:{GET_PTZ_STATUS:"Get current PTZ status",GET_PTZ_STATUS_FAILED:"Theme module is not loaded, PTZ status cannot be obtained",MOBILE_HIDE_PTZ:"Mobile terminal, PTZ is not displayed in non-full screen state",OPTION_PTZ_FAILED:"Theme module is not loaded, PTZ cannot be operated",MOBILE_PTZ_TIPS:"Adjust camera angle by manipulating gimbal",PTZ_FAST:"F",PTZ_MID:"M",PTZ_SLOW:"S",PTZ_SPEED:"Adjust the PTZ rotation speed",DEVICE_ZOOM:"Control the device to zoom in/out of the screen",DEVICE_FOCUS:"Adjusting the device's focal length"}}},PTZ_SPEED={1:1,2:3,3:7,slow:1,mid:3,fast:7},BasePtz=function(){function BasePtz(container,options){var _this_options_locales,_this_options_locales1,_this_options_locales2;if(void 0===options&&(options={}),!container)throw new Error("Ptz container is required");(this.options=deepmerge(PTZ_DEFAULT_OPTIONS,options,{clone:false}),null==(_this_options_locales=this.options.locales)?void 0:_this_options_locales[this.options.language])?this.locale=null==(_this_options_locales1=this.options.locales)?void 0:_this_options_locales1[this.options.language]:this.locale=null==(_this_options_locales2=this.options.locales)?void 0:_this_options_locales2.zh;this.$container=container,this.speed=PTZ_SPEED[this.options.speed||2];}var _proto=BasePtz.prototype;return _proto.updateOptions=function(options){this.options=deepmerge(this.options,options,{clone:false});},_proto.destroy=function(){},BasePtz}();function _set_prototype_of$1$3(o,p){return _set_prototype_of$1$3=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$3(o,p)}var MobilePtz=function(BasePtz){function MobilePtz(container,options){var _this;return (_this=BasePtz.call(this,container,options)||this)._touchstart=_this._touchstart.bind(_this),_this._touchend=_this._touchend.bind(_this),_this._render(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1$3(subClass,superClass);}(MobilePtz,BasePtz);var _proto=MobilePtz.prototype;return _proto.destroy=function(){this._removeEventListener(),this.$content&&(this.$content.remove(),this.$content=null),BasePtz.prototype.destroy.call(this);},_proto._render=function(){this.$content=document.createElement("div"),this.$content.classList.add("ez-mobile-ptz-content"),this.$content.innerHTML='\n <div class="ez-mobile-ptz-wrap">\n <div class="ez-mobile-ptz-container">\n <div class="ez-mobile-ptz-center ez-mobile-ptz-center"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-top ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-left ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-bottom ez-mobile-ptz-default"></div>\n <div class="ez-mobile-ptz-icon ez-mobile-ptz-right ez-mobile-ptz-default"></div>\n </div>\n </div>\n ',this.$container.appendChild(this.$content),this._addEventListener();},_proto._addEventListener=function(){var $warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),touchstart="PointerEvent"in window?"pointerdown":"touchstart",touchend="PointerEvent"in window?"pointerup":"touchend";$warp&&($warp.addEventListener(touchstart,this._touchstart),$warp.addEventListener(touchend,this._touchend));},_proto._touchstart=function(e){e.preventDefault(),this._handlePtzTouch(e,"start");},_proto._touchend=function(e){e.preventDefault(),this._handlePtzTouch(e,"stop");},_proto._removeEventListener=function(){var $warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),touchstart="PointerEvent"in window?"pointerdown":"touchstart",touchend="PointerEvent"in window?"pointerup":"touchend";$warp&&($warp.removeEventListener(touchstart,this._touchstart),$warp.removeEventListener(touchend,this._touchend));},_proto._handlePtzTouch=function(e,type){var _this_options_token_deviceToken,_this_options_token,_e_changedTouches_,_e_changedTouches_1,_this_options_env,_this_options_token_deviceToken1,_this_options_token1;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token.deviceToken)?void 0:_this_options_token_deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");var _this_options_env1,$warp=this.$content.querySelector(".ez-mobile-ptz-wrap"),rect=$warp.getBoundingClientRect(),containerCenterX=rect.left+130,containerCenterY=rect.top+130,left=(e.x||(null==(_e_changedTouches_=e.changedTouches[0])?void 0:_e_changedTouches_.clientX))-containerCenterX,top=(e.y||(null==(_e_changedTouches_1=e.changedTouches[0])?void 0:_e_changedTouches_1.clientY))-containerCenterY,direction=0,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken1=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken1.video),$icons=$warp.querySelectorAll(".ez-mobile-ptz-icon");(Math.abs(left)>Math.abs(top)?left>0?(direction=3,$icons[3].className=$icons[3].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):(direction=2,$icons[1].className=$icons[1].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):top>0?(direction=1,$icons[2].className=$icons[2].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")):(direction=0,$icons[0].className=$icons[0].className.replace("ez-mobile-ptz-default","ez-mobile-ptz-active")),$warp.style.cssText="background-image:linear-gradient("+(0===direction?180:1===direction?0:2===direction?90:270)+"deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)","stop"===type)&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop",$warp.style.cssText="",$icons[3].className=$icons[3].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[1].className=$icons[1].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[2].className=$icons[2].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"),$icons[0].className=$icons[0].className.replace("ez-mobile-ptz-active","ez-mobile-ptz-default"));var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{direction:direction,speed:this.speed,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed","1"),data.append("direction",direction+""),data.append("accessToken",token),fetch(url,{method:"POST",body:data}).then(function(response){return response.json()}).then(function(rt){200===rt.code||[60005,60002,60003,60004].includes(+rt.code)&&($warp.style.cssText="background-image:linear-gradient("+(0===direction?180:1===direction?0:2===direction?90:270)+"deg, #f45656 0%, rgba(100,143,252,0.00) 50%)"),null==operationResultCb||operationResultCb(rt);}).catch(function(err){}).finally(function(){operationResultCb=null;});},MobilePtz}(BasePtz);function asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value;}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw);}function _async_to_generator$5(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$5(gen,resolve,reject,_next,_throw,"throw",err);}_next(void 0);})}}function _create_class$e(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$n(o,p){return _set_prototype_of$n=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$n(o,p)}function _ts_generator$5(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=verb(0),g.throw=verb(1),g.return=verb(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e],y=0;}finally{f=t=0;}if(5&op[0])throw op[1];return {value:op[0]?op[1]:void 0,done:true}}([n,v])}}}var Ptz$1=function(BasePtz){function Ptz(container,options){var _this;return void 0===options&&(options={}),(_this=BasePtz.call(this,container,options)||this)._isMobile=distExports$4.isMobile(),_this._isRotate=false,_this._clearTimer=null,_this._$wrapper=document.createElement("div"),_this._$wrapper.className="ez-ptz-container-wrap",_this._$directionCircleContainer=document.createElement("div"),_this._$directionCircleContainer.classList.add("ez-ptz-container"),_this._$directionCircleContainer.innerHTML='\n <div class="ez-ptz-main ez-ptz-direction-center"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top" data-direction="0"></div>\n <div class="ez-ptz-icon ez-ptz-direction-top-left" data-direction="4"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left" data-direction="2"></div>\n <div class="ez-ptz-icon ez-ptz-direction-left-bottom" data-direction="5"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom" data-direction="1"></div>\n <div class="ez-ptz-icon ez-ptz-direction-bottom-right" data-direction="7"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right" data-direction="3"></div>\n <div class="ez-ptz-icon ez-ptz-direction-right-top" data-direction="6"></div>\n ',_this._$wrapper.appendChild(_this._$directionCircleContainer),_this._$speedContainer=document.createElement("div"),_this._$speedContainer.classList.add("ez-ptz-speed-container"),_this._$speedContainer.innerHTML='\n <div class="ez-ptz-speed-progress" title="'+_this.locale.PTZ_SPEED+'">\n <div class="ez-ptz-speed-progress-line">\n <div class="ez-ptz-speed-progress-line-dot '+(1===_this.speed?"ez-ptz-speed-active":"")+'" data-id="slow" data-index="1" data-value="1"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(3===_this.speed?"ez-ptz-speed-active":"")+'" data-id="mid" data-index="2" data-value="3"></div>\n <div class="ez-ptz-speed-progress-line-dot '+(7===_this.speed?"ez-ptz-speed-active":"")+'" data-id="fast" data-index="3" data-value="7"></div>\n </div>\n <div class="ez-ptz-speed-progress-points">\n <div class="ez-ptz-speed-progress-points-slow">\n '+_this.locale.PTZ_SLOW+'\n </div>\n <div class="ez-ptz-speed-progress-points-mid">\n '+_this.locale.PTZ_MID+'\n </div>\n <div class="ez-ptz-speed-progress-points-fast">\n '+_this.locale.PTZ_FAST+"\n </div>\n </div>\n </div>\n ",_this._$wrapper.appendChild(_this._$speedContainer),_this._$btnContainer=document.createElement("div"),_this._$btnContainer.classList.add("ez-ptz-btn-container"),_this._$btnContainer.innerHTML='\n <div class="ez-ptz-btn-zoom" title="'+_this.locale.DEVICE_ZOOM+'" style="user-select: none;">\n <div class="ez-ptz-btn-zoom-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M563.2 198.4c179.2 0 326.4 147.2 326.4 326.4s-147.2 326.4-326.4 326.4S230.4 704 230.4 524.8s147.2-326.4 332.8-326.4z m0 64c-147.2 0-262.4 115.2-262.4 262.4s115.2 262.4 262.4 262.4 262.4-115.2 262.4-262.4S704 262.4 563.2 262.4z" fill="#ffffff"></path>\n <path d="M691.2 556.8H428.8c-19.2 0-32-12.8-32-32s12.8-32 32-32h262.4c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#ffffff">\n </path>\n <path d="M556.8 691.2c-19.2 0-32-12.8-32-32V396.8c0-19.2 12.8-32 32-32s32 12.8 32 32v262.4c0 19.2-12.8 32-32 32z" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-zoom-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M569.6 838.4c-172.8 0-307.2-140.8-307.2-307.2s140.8-307.2 307.2-307.2 307.2 140.8 307.2 307.2-140.8 307.2-307.2 307.2z m0-64c134.4 0 249.6-108.8 249.6-249.6S704 281.6 569.6 281.6 320 396.8 320 531.2s108.8 243.2 249.6 243.2z" fill="#ffffff"></path>\n <path d="M691.2 563.2H448c-19.2 0-32-12.8-32-32s12.8-38.4 32-38.4h249.6c19.2 0 32 12.8 32 32s-19.2 38.4-38.4 38.4z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n <div class="ez-ptz-btn-focal" title="'+_this.locale.DEVICE_FOCUS+'" style="user-select: none;">\n <div class="ez-ptz-btn-focal-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M646.4 825.6H320c-44.8 0-83.2-38.4-83.2-83.2V409.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6zM320 390.4c-12.8 0-19.2 6.4-19.2 19.2v326.4c0 12.8 6.4 19.2 19.2 19.2h326.4c12.8 0 19.2-6.4 19.2-19.2V409.6c0-12.8-6.4-19.2-19.2-19.2H320z" fill="#ffffff"></path>\n <path d="M396.8 358.4V281.6c0-25.6 25.6-51.2 51.2-51.2h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H704l-6.4-268.8" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="ez-ptz-btn-focal-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M320 358.4h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H320c-25.6 0-51.2-25.6-51.2-51.2V409.6c0-25.6 25.6-51.2 51.2-51.2z" fill="#ffffff"></path>\n <path d="M774.4 697.6H704c-19.2 0-32-12.8-32-32s12.8-32 32-32h70.4c12.8 0 19.2-6.4 19.2-19.2V281.6c0-12.8-6.4-19.2-19.2-19.2H448c-12.8 0-19.2 6.4-19.2 19.2v70.4c0 19.2-12.8 32-32 32s-32-12.8-32-25.6V281.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n ',_this._$wrapper.appendChild(_this._$btnContainer),container.appendChild(_this._$wrapper),_this._$directionCircleContainer.onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"start");},_this._$directionCircleContainer.onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"stop");},_this._$directionCircleContainer.ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"start");},_this._$directionCircleContainer.ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handlePtzTouch(e,"stop");},_this._onSwitchSpeed=function(e){var list=Array.from(_this._$speedContainer.querySelectorAll(".ez-ptz-speed-progress-line-dot"));if(list.includes(e.target)&&!e.target.classList.contains("ez-ptz-speed-active")){list.forEach(function(item){item===e.target?item.classList.add("ez-ptz-speed-active"):item.classList.remove("ez-ptz-speed-active");});var value=e.target.getAttribute("data-value"),index=e.target.getAttribute("data-index");_this.speed=+value,null==_this.options.onSpeedChange||_this.options.onSpeedChange.call(_this.options,+index);}},_this._$speedContainer.onmouseup=_this._onSwitchSpeed,_this._isMobile&&(_this._$speedContainer.ontouchend=_this._onSwitchSpeed),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").onmousedown=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").onmouseup=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","stop");}),_this._isMobile&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-add").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-zoom-sub").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("zoom","sub","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-add").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","add","stop");}),_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub")&&(_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","start");},_this._$btnContainer.querySelector(".ez-ptz-btn-focal-sub").ontouchend=function(e){e.preventDefault(),e.stopPropagation(),_this._handleBtnTouch("focal","sub","stop");})),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$n(subClass,superClass);}(Ptz,BasePtz);var _proto=Ptz.prototype;return _proto.destroy=function(){this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null),this._$directionCircleContainer&&(this._$directionCircleContainer.remove(),this._$directionCircleContainer=null),this._$speedContainer&&(this._onSwitchSpeed=null,this._$speedContainer.remove(),this._$speedContainer=null),this._$btnContainer&&(this._$btnContainer.remove(),this._$btnContainer=null),this._$wrapper&&(this._$wrapper.remove(),this._$wrapper=null),BasePtz.prototype.destroy.call(this);},_proto._handlePtzTouch=function(e,type){var _this_options_token_deviceToken,_this_options_token,_this_options_env,_this_options_token_deviceToken1,_this_options_token1,_this=this;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token.deviceToken)?void 0:_this_options_token_deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");this._ptzQueue||(this._ptzQueue=Promise.resolve());var container=this._$directionCircleContainer.getBoundingClientRect(),containerCenterX=container.left+(this._$directionCircleContainer.clientWidth+2)/2,containerCenterY=container.top+(this._$directionCircleContainer.clientHeight+2)/2,eventX=e.x||e.changedTouches[0].clientX,eventY=e.y||e.changedTouches[0].clientY,direction=0,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken1=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken1.video),backDeg=0;function getAreaId(x,y){var rad=Math.atan2(y,x);rad<0&&(rad+=2*Math.PI);var deg=rad*(180/Math.PI)-225-12.5;return deg<0&&(deg+=360),Math.floor(deg/45)+1}var _this_options_env1,left=eventX-containerCenterX,top=eventY-containerCenterY;if(this.isRotate)switch(getAreaId(left,top)){case 1:direction=2,backDeg=90;break;case 2:direction=4,backDeg=135;break;case 3:direction=0,backDeg=180;break;case 4:direction=6,backDeg=225;break;case 5:direction=3,backDeg=270;break;case 6:direction=7,backDeg=315;break;case 7:direction=1,backDeg=0;break;case 8:direction=5,backDeg=45;}else switch(getAreaId(left,top)){case 1:direction=0,backDeg=180;break;case 2:direction=6,backDeg=225;break;case 3:direction=3,backDeg=270;break;case 4:direction=7,backDeg=315;break;case 5:direction=1,backDeg=0;break;case 6:direction=5,backDeg=45;break;case 7:direction=2,backDeg=90;break;case 8:direction=4,backDeg=135;}(this._clearTimer&&(clearTimeout(this._clearTimer),this._clearTimer=null),this._$directionCircleContainer.style.cssText="start"===type?"background-image:linear-gradient("+backDeg+"deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)":"","stop"===type)&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop");var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{areaId:getAreaId(left,top),direction:direction,backDeg:backDeg,isRotate:this.isRotate,speed:this.speed,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed",this.speed+""),data.append("direction",direction+""),data.append("accessToken",token),this._ptzQueue=this._ptzQueue.then(function(){return _async_to_generator$5(function(){var _this;return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return _this=this,[4,fetch(url,{method:"POST",body:data}).then(function(response){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,response.json()];case 1:return [2,_state.sent()]}})})()}).then(function(rt){var _rt_result;null==operationResultCb||operationResultCb(rt);var code=rt.code||(null==rt||null==(_rt_result=rt.result)?void 0:_rt_result.code);return [6e4,60001,60002,60003,60004,60005,60006,10002].includes(+code)&&(_this._$directionCircleContainer.style.cssText="background-image:linear-gradient("+backDeg+"deg, #f45656 0%, rgba(100,143,252,0.00) 30%)"),rt}).catch(function(err){}).finally(function(){operationResultCb=null,"stop"===type&&(_this._clearTimer=setTimeout(function(){_this._$directionCircleContainer.style.cssText="";},1e3));})];case 1:return [2,_state.sent()]}})}).call(_this)}),"stop"===type&&(this._ptzQueue=this._ptzQueue.finally(function(){}));},_proto._handleBtnTouch=function(btn,option,type){var _this_options_token,_this_options_env,_this_options_token_deviceToken,_this_options_token1,_this=this;if(!this.options.accessToken&&!(null==(_this_options_token=this.options.token)?void 0:_this_options_token.deviceToken.video))throw new Error("Ptz accessToken or token.deviceToken.video is required");this._ptzOperation||(this._ptzOperation=Promise.resolve());var direction=8;direction="zoom"===btn?"add"===option?8:9:"add"===option?10:11;var _this_options_env1,url=(null==(_this_options_env=this.options.env)?void 0:_this_options_env.domain)+"/api/lapp/device/ptz/start",token=this.options.accessToken||(null==(_this_options_token1=this.options.token)||null==(_this_options_token_deviceToken=_this_options_token1.deviceToken)?void 0:_this_options_token_deviceToken.video);"stop"===type&&(url=(null==(_this_options_env1=this.options.env)?void 0:_this_options_env1.domain)+"/api/lapp/device/ptz/stop");var operationResultCb=null==this.options.onDirection?void 0:this.options.onDirection.call(this.options,{btn:btn,option:option,type:type}),data=new FormData;data.append("deviceSerial",this.options.deviceSerial+""),data.append("channelNo",this.options.channelNo+""),data.append("speed",this.speed+""),data.append("direction",direction+""),data.append("accessToken",token),this._ptzOperation=this._ptzOperation.then(function(){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,fetch(url,{method:"POST",body:data}).then(function(response){return _async_to_generator$5(function(){return _ts_generator$5(this,function(_state){switch(_state.label){case 0:return [4,response.json()];case 1:return [2,_state.sent()]}})})()}).then(function(rt){return null==operationResultCb||operationResultCb(rt),rt}).catch(function(err){}).finally(function(){operationResultCb=null;})];case 1:return [2,_state.sent()]}})})()}),"stop"===type&&(this._ptzOperation=this._ptzOperation.finally(function(){_this._ptzOperation=null;}));},_create_class$e(Ptz,[{key:"isRotate",get:function(){return this._isRotate},set:function(isRotate){this._isRotate=isRotate;}}]),Ptz}(BasePtz);
|
|
@@ -9249,25 +9264,25 @@
|
|
|
9249
9264
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
9250
9265
|
|
|
9251
9266
|
/*
|
|
9252
|
-
* @ezuikit/control-modal v0.0.1
|
|
9253
|
-
* Copyright (c) 2026-07-
|
|
9267
|
+
* @ezuikit/control-modal v0.0.1
|
|
9268
|
+
* Copyright (c) 2026-07-06 Ezviz-OpenBiz
|
|
9254
9269
|
* Released under the MIT License.
|
|
9255
9270
|
*/
|
|
9256
|
-
function _array_like_to_array$2(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _create_class$a(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _create_for_of_iterator_helper_loose$2(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array$2(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array$2(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ModalProvider=function(){function ModalProvider(){this._instances=new Set,this._zIndexCounter=1e3;}var _proto=ModalProvider.prototype;return _proto.register=function(modal,minZIndex){this._instances.add(modal);var base=Math.max(this._zIndexCounter,minZIndex||1e3);return this._zIndexCounter=base+2,base},_proto.unregister=function(modal){this._instances.delete(modal);},_proto.bringToTop=function(){var base=this._zIndexCounter;return this._zIndexCounter+=2,base},_proto.getInstances=function(){return Array.from(this._instances)},_proto.destroyAll=function(){for(var _step,_iterator=_create_for_of_iterator_helper_loose$2(this.getInstances());!(_step=_iterator()).done;){var modal=_step.value;modal._destroyed||modal.destroy();}},ModalProvider.getInstance=function(){return ModalProvider._instance||(ModalProvider._instance=new ModalProvider),ModalProvider._instance},ModalProvider.resetInstance=function(){ModalProvider._instance&&(ModalProvider._instance._instances.clear(),ModalProvider._instance._zIndexCounter=1e3,ModalProvider._instance=null);},_create_class$a(ModalProvider,[{key:"count",get:function(){return this._instances.size}}]),ModalProvider}();ModalProvider._instance=null;var EVENTS$1={open:"open",close:"close",dragStart:"dragStart",dragging:"dragging",dragEnd:"dragEnd"},_$MODAL_LOCALES$_={zh:{close:"关闭"},en:{close:"Close"}},__$MODAL_DEFAULT_OPTIONS$__={width:420,position:"center",draggable:true,showMask:true,maskClosable:true,showHeader:true,showClose:true,closeOnEscape:true,open:false,zIndex:1e3,language:"zh"};var Modal=function(){function Modal(container,options){this._$mask=null,this._$header=null,this._$title=null,this._$close=null,this._visible=false,this._dragging=false,this._dragOffset={x:0,y:0},this._destroyed=false,this._dragBounds={maxLeft:0,maxTop:0},this._dragPoint=null,this._dragRafId=null,this._pos={x:0,y:0},this.options=deepmerge(__$MODAL_DEFAULT_OPTIONS$__,null!=options?options:{},{clone:false}),this._eventEmitter=new EventEmitter,this._i18n=new I18n$1(deepmerge(_$MODAL_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._container=this._resolveContainer(container),this._baseZIndex=ModalProvider.getInstance().register(this,this.options.zIndex),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onDragFrame=this._onDragFrame.bind(this),this._onHeaderPointerDown=this._onHeaderPointerDown.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onMaskClick=this._onMaskClick.bind(this),this._onKeydown=this._onKeydown.bind(this),this._onWindowResize=this._onWindowResize.bind(this),this._onModalPointerDown=this._onModalPointerDown.bind(this),this._onWrapDblClick=this._onWrapDblClick.bind(this),this._render(),this._bindEvents(),this.options.open&&this.open();}var _proto=Modal.prototype;return _proto.open=function(){this._destroyed||this._visible||(this._visible=true,this._$mask&&this._$mask.classList.remove("emodal-hidden"),this._$wrap.classList.remove("emodal-hidden"),this._applyInitialPosition(),window.addEventListener("resize",this._onWindowResize),this.options.closeOnEscape&&document.addEventListener("keydown",this._onKeydown),this._eventEmitter.emit(EVENTS$1.open),null==this.options.onOpen||this.options.onOpen.call(this.options));},_proto.close=function(){!this._destroyed&&this._visible&&(this._visible=false,this._$mask&&this._$mask.classList.add("emodal-hidden"),this._$wrap.classList.add("emodal-hidden"),this._stopDragging(),window.removeEventListener("resize",this._onWindowResize),document.removeEventListener("keydown",this._onKeydown),this._eventEmitter.emit(EVENTS$1.close),null==this.options.onClose||this.options.onClose.call(this.options));},_proto.isVisible=function(){return this._visible},_proto.bringToTop=function(){this._destroyed||(this._baseZIndex=ModalProvider.getInstance().bringToTop(),this._$mask&&(this._$mask.style.zIndex=""+this._baseZIndex),this._$wrap.style.zIndex=""+(this._baseZIndex+1));},_proto.setTitle=function(title){this.options.title=title,this._$title&&this._mount(this._$title,title);},_proto.setContent=function(content){this.options.content=content,this._mount(this._$body,content);},_proto.updateOptions=function(options){this.options=deepmerge(this.options,options,{clone:false}),(options.language||options.locales)&&(this._i18n=new I18n$1(deepmerge(_$MODAL_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"})),this._stopDragging();var wasVisible=this._visible;this._teardownDom(),this._render(),this._bindEvents(),wasVisible&&(this._visible=false,this.open());},_proto.on=function(event,callback){this._eventEmitter.on(event,callback);},_proto.off=function(event,callback){this._eventEmitter.off(event,callback);},_proto.setPosition=function(left,top,bounds){var _ref=bounds||this._bounds(),maxLeft=_ref.maxLeft,maxTop=_ref.maxTop,x=Math.max(0,Math.min(left,maxLeft)),y=Math.max(0,Math.min(top,maxTop));return this._setTranslate(x,y),{x:x,y:y}},_proto.destroy=function(){this._destroyed||(this._stopDragging(),window.removeEventListener("resize",this._onWindowResize),document.removeEventListener("keydown",this._onKeydown),this._teardownDom(),this._eventEmitter.removeAllListeners(),this._destroyed=true,ModalProvider.getInstance().unregister(this));},_proto._resolveContainer=function(container){return "string"==typeof container?document.querySelector(container)||document.body:container||document.body},_proto._toSize=function(value){return null==value||""===value?null:"number"==typeof value?value+"px":value},_proto._render=function(){this.options.showMask&&(this._$mask=document.createElement("div"),this._$mask.className="emodal-mask emodal-hidden",this._$mask.style.zIndex=""+this._baseZIndex,this._container.appendChild(this._$mask)),this._$wrap=document.createElement("div"),this._$wrap.className="emodal-wrap emodal-hidden",this.options.draggable&&this._$wrap.classList.add("emodal-draggable"),this.options.className&&this._$wrap.classList.add(this.options.className),this._$wrap.style.zIndex=""+(this._baseZIndex+1);var w=this._toSize(this.options.width);w&&(this._$wrap.style.width=w);var h=this._toSize(this.options.height);h&&(this._$wrap.style.height=h),this.options.showHeader?(this._$header=document.createElement("div"),this._$header.className="emodal-header",this._$title=document.createElement("div"),this._$title.className="emodal-title",void 0!==this.options.title&&this._mount(this._$title,this.options.title),this._$header.appendChild(this._$title),this.options.showClose&&(this._$close=document.createElement("button"),this._$close.type="button",this._$close.className="emodal-close",this._$close.setAttribute("aria-label",String(this._i18n.t("close"))),this._$close.innerHTML='<svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true">\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n</svg>',this._$header.appendChild(this._$close)),this._$wrap.appendChild(this._$header)):(this._$header=null,this._$title=null,this._$close=null),this._$body=document.createElement("div"),this._$body.className="emodal-body",void 0!==this.options.content&&this._mount(this._$body,this.options.content),this._$wrap.appendChild(this._$body),this._container.appendChild(this._$wrap);},_proto._mount=function(target,content){var left,right;left=content,(null!=(right=HTMLElement)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?(target.innerHTML="",target.appendChild(content)):target.innerHTML=null!=content?content:"";},_proto._teardownDom=function(){var _this__$mask;this._$wrap.parentNode&&this._$wrap.parentNode.removeChild(this._$wrap),(null==(_this__$mask=this._$mask)?void 0:_this__$mask.parentNode)&&this._$mask.parentNode.removeChild(this._$mask),this._$mask=null,this._$header=null,this._$title=null,this._$close=null;},_proto._bindEvents=function(){var _this__$close,_this__$mask,_this__$mask1;(null==(_this__$close=this._$close)||_this__$close.addEventListener("click",this._onCloseClick),this.options.showMask&&this.options.maskClosable)&&(null==(_this__$mask1=this._$mask)||_this__$mask1.addEventListener("click",this._onMaskClick));this.options.draggable&&this._$header&&(this._$header.addEventListener("mousedown",this._onHeaderPointerDown),this._$header.addEventListener("touchstart",this._onHeaderPointerDown,{passive:false})),this._$wrap.addEventListener("pointerdown",this._onModalPointerDown),this._$wrap.addEventListener("dblclick",this._onWrapDblClick),null==(_this__$mask=this._$mask)||_this__$mask.addEventListener("pointerdown",this._onModalPointerDown);},_proto._onCloseClick=function(e){e.stopPropagation(),this.close();},_proto._onMaskClick=function(){this.close();},_proto._onModalPointerDown=function(){this.bringToTop();},_proto._onWrapDblClick=function(e){e.stopPropagation();},_proto._onKeydown=function(e){"Escape"!==e.key&&"Esc"!==e.key||this.close();},_proto._onWindowResize=function(){if(this._dragging)return this._dragBounds=this._bounds(),void this.setPosition(this._pos.x,this._pos.y,this._dragBounds);this.setPosition(this._pos.x,this._pos.y);},_proto._getPoint=function(e){if("touches"in e){var t=e.touches[0]||e.changedTouches[0];return {x:t.clientX,y:t.clientY}}return {x:e.clientX,y:e.clientY}},_proto._onHeaderPointerDown=function(e){if(this.options.draggable){var target=e.target;if(!(this._$close&&(target===this._$close||this._$close.contains(target))||"button"in e&&0!==e.button)){var point=this._getPoint(e),rect=this._$wrap.getBoundingClientRect();this._dragOffset={x:point.x-rect.left,y:point.y-rect.top},this._dragBounds=this._bounds(),this._dragging=true,this._$wrap.style.willChange="transform",document.body.classList.add("emodal-dragging"),document.addEventListener("mousemove",this._onPointerMove),document.addEventListener("mouseup",this._onPointerUp),document.addEventListener("touchmove",this._onPointerMove,{passive:false}),document.addEventListener("touchend",this._onPointerUp),document.addEventListener("touchcancel",this._onPointerUp),this._eventEmitter.emit(EVENTS$1.dragStart);}}},_proto._onPointerMove=function(e){this._dragging&&(e.cancelable&&e.preventDefault(),this._dragPoint=this._getPoint(e),null===this._dragRafId&&(this._dragRafId=requestAnimationFrame(this._onDragFrame)));},_proto._onDragFrame=function(){if(this._dragRafId=null,this._dragging&&this._dragPoint){var left=this._dragPoint.x-this._dragOffset.x,top=this._dragPoint.y-this._dragOffset.y,_this__dragBounds=this._dragBounds,maxLeft=_this__dragBounds.maxLeft,maxTop=_this__dragBounds.maxTop,x=Math.max(0,Math.min(left,maxLeft)),y=Math.max(0,Math.min(top,maxTop));this._setTranslate(x,y),this._eventEmitter.emit(EVENTS$1.dragging,{x:x,y:y});}},_proto._onPointerUp=function(){this._dragging&&(this._stopDragging(),this._eventEmitter.emit(EVENTS$1.dragEnd,{left:this._pos.x,top:this._pos.y}));},_proto._stopDragging=function(){null!==this._dragRafId&&(cancelAnimationFrame(this._dragRafId),this._dragRafId=null),this._dragPoint=null,this._dragging?(this._dragging=false,this._$wrap&&(this._$wrap.style.willChange=""),document.body.classList.remove("emodal-dragging"),document.removeEventListener("mousemove",this._onPointerMove),document.removeEventListener("mouseup",this._onPointerUp),document.removeEventListener("touchmove",this._onPointerMove),document.removeEventListener("touchend",this._onPointerUp),document.removeEventListener("touchcancel",this._onPointerUp)):document.body.classList.remove("emodal-dragging");},_proto._bounds=function(){var vw=document.documentElement.clientWidth,vh=document.documentElement.clientHeight,w=this._$wrap.offsetWidth,h=this._$wrap.offsetHeight;return {maxLeft:Math.max(0,vw-w),maxTop:Math.max(0,vh-h)}},_proto._setTranslate=function(x,y){this._pos={x:x,y:y},this._$wrap.style.transform="translate3d("+x+"px, "+y+"px, 0)";},_proto._center=function(){var vw=document.documentElement.clientWidth,vh=document.documentElement.clientHeight,w=this._$wrap.offsetWidth,h=this._$wrap.offsetHeight;this.setPosition((vw-w)/2,(vh-h)/2);},_proto._applyInitialPosition=function(){var obj,position=this.options.position;position&&"object"==(void 0===position?"undefined":(obj=position)&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj)?this.setPosition(position.x,position.y):this._center();},Modal}();Modal.VERSION="0.0.1-beta.7",Modal.EVENTS=EVENTS$1;
|
|
9271
|
+
function _array_like_to_array$2(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _create_class$a(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _create_for_of_iterator_helper_loose$2(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array$2(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array$2(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ModalProvider=function(){function ModalProvider(){this._instances=new Set,this._zIndexCounter=1e3;}var _proto=ModalProvider.prototype;return _proto.register=function(modal,minZIndex){this._instances.add(modal);var base=Math.max(this._zIndexCounter,minZIndex||1e3);return this._zIndexCounter=base+2,base},_proto.unregister=function(modal){this._instances.delete(modal);},_proto.bringToTop=function(){var base=this._zIndexCounter;return this._zIndexCounter+=2,base},_proto.getInstances=function(){return Array.from(this._instances)},_proto.destroyAll=function(){for(var _step,_iterator=_create_for_of_iterator_helper_loose$2(this.getInstances());!(_step=_iterator()).done;){var modal=_step.value;modal._destroyed||modal.destroy();}},ModalProvider.getInstance=function(){return ModalProvider._instance||(ModalProvider._instance=new ModalProvider),ModalProvider._instance},ModalProvider.resetInstance=function(){ModalProvider._instance&&(ModalProvider._instance._instances.clear(),ModalProvider._instance._zIndexCounter=1e3,ModalProvider._instance=null);},_create_class$a(ModalProvider,[{key:"count",get:function(){return this._instances.size}}]),ModalProvider}();ModalProvider._instance=null;var EVENTS$1={open:"open",close:"close",dragStart:"dragStart",dragging:"dragging",dragEnd:"dragEnd"},_$MODAL_LOCALES$_={zh:{close:"关闭"},en:{close:"Close"}},__$MODAL_DEFAULT_OPTIONS$__={width:420,position:"center",draggable:true,showMask:true,maskClosable:true,showHeader:true,showClose:true,closeOnEscape:true,open:false,zIndex:1e3,language:"zh"};var Modal=function(){function Modal(container,options){this._$mask=null,this._$header=null,this._$title=null,this._$close=null,this._visible=false,this._dragging=false,this._dragOffset={x:0,y:0},this._destroyed=false,this._dragBounds={maxLeft:0,maxTop:0},this._dragPoint=null,this._dragRafId=null,this._pos={x:0,y:0},this.options=deepmerge(__$MODAL_DEFAULT_OPTIONS$__,null!=options?options:{},{clone:false}),this._eventEmitter=new EventEmitter,this._i18n=new I18n(deepmerge(_$MODAL_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._container=this._resolveContainer(container),this._baseZIndex=ModalProvider.getInstance().register(this,this.options.zIndex),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onDragFrame=this._onDragFrame.bind(this),this._onHeaderPointerDown=this._onHeaderPointerDown.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onMaskClick=this._onMaskClick.bind(this),this._onKeydown=this._onKeydown.bind(this),this._onWindowResize=this._onWindowResize.bind(this),this._onModalPointerDown=this._onModalPointerDown.bind(this),this._onWrapDblClick=this._onWrapDblClick.bind(this),this._render(),this._bindEvents(),this.options.open&&this.open();}var _proto=Modal.prototype;return _proto.open=function(){this._destroyed||this._visible||(this._visible=true,this._$mask&&this._$mask.classList.remove("emodal-hidden"),this._$wrap.classList.remove("emodal-hidden"),this._applyInitialPosition(),window.addEventListener("resize",this._onWindowResize),this.options.closeOnEscape&&document.addEventListener("keydown",this._onKeydown),this._eventEmitter.emit(EVENTS$1.open),null==this.options.onOpen||this.options.onOpen.call(this.options));},_proto.close=function(){!this._destroyed&&this._visible&&(this._visible=false,this._$mask&&this._$mask.classList.add("emodal-hidden"),this._$wrap.classList.add("emodal-hidden"),this._stopDragging(),window.removeEventListener("resize",this._onWindowResize),document.removeEventListener("keydown",this._onKeydown),this._eventEmitter.emit(EVENTS$1.close),null==this.options.onClose||this.options.onClose.call(this.options));},_proto.isVisible=function(){return this._visible},_proto.bringToTop=function(){this._destroyed||(this._baseZIndex=ModalProvider.getInstance().bringToTop(),this._$mask&&(this._$mask.style.zIndex=""+this._baseZIndex),this._$wrap.style.zIndex=""+(this._baseZIndex+1));},_proto.setTitle=function(title){this.options.title=title,this._$title&&this._mount(this._$title,title);},_proto.setContent=function(content){this.options.content=content,this._mount(this._$body,content);},_proto.updateOptions=function(options){this.options=deepmerge(this.options,options,{clone:false}),(options.language||options.locales)&&(this._i18n=new I18n(deepmerge(_$MODAL_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"})),this._stopDragging();var wasVisible=this._visible;this._teardownDom(),this._render(),this._bindEvents(),wasVisible&&(this._visible=false,this.open());},_proto.on=function(event,callback){this._eventEmitter.on(event,callback);},_proto.off=function(event,callback){this._eventEmitter.off(event,callback);},_proto.setPosition=function(left,top,bounds){var _ref=bounds||this._bounds(),maxLeft=_ref.maxLeft,maxTop=_ref.maxTop,x=Math.max(0,Math.min(left,maxLeft)),y=Math.max(0,Math.min(top,maxTop));return this._setTranslate(x,y),{x:x,y:y}},_proto.destroy=function(){this._destroyed||(this._stopDragging(),window.removeEventListener("resize",this._onWindowResize),document.removeEventListener("keydown",this._onKeydown),this._teardownDom(),this._eventEmitter.removeAllListeners(),this._destroyed=true,ModalProvider.getInstance().unregister(this));},_proto._resolveContainer=function(container){return "string"==typeof container?document.querySelector(container)||document.body:container||document.body},_proto._toSize=function(value){return null==value||""===value?null:"number"==typeof value?value+"px":value},_proto._render=function(){this.options.showMask&&(this._$mask=document.createElement("div"),this._$mask.className="emodal-mask emodal-hidden",this._$mask.style.zIndex=""+this._baseZIndex,this._container.appendChild(this._$mask)),this._$wrap=document.createElement("div"),this._$wrap.className="emodal-wrap emodal-hidden",this.options.draggable&&this._$wrap.classList.add("emodal-draggable"),this.options.className&&this._$wrap.classList.add(this.options.className),this._$wrap.style.zIndex=""+(this._baseZIndex+1);var w=this._toSize(this.options.width);w&&(this._$wrap.style.width=w);var h=this._toSize(this.options.height);h&&(this._$wrap.style.height=h),this.options.showHeader?(this._$header=document.createElement("div"),this._$header.className="emodal-header",this._$title=document.createElement("div"),this._$title.className="emodal-title",void 0!==this.options.title&&this._mount(this._$title,this.options.title),this._$header.appendChild(this._$title),this.options.showClose&&(this._$close=document.createElement("button"),this._$close.type="button",this._$close.className="emodal-close",this._$close.setAttribute("aria-label",String(this._i18n.t("close"))),this._$close.innerHTML='<svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true">\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n</svg>',this._$header.appendChild(this._$close)),this._$wrap.appendChild(this._$header)):(this._$header=null,this._$title=null,this._$close=null),this._$body=document.createElement("div"),this._$body.className="emodal-body",void 0!==this.options.content&&this._mount(this._$body,this.options.content),this._$wrap.appendChild(this._$body),this._container.appendChild(this._$wrap);},_proto._mount=function(target,content){var left,right;left=content,(null!=(right=HTMLElement)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?(target.innerHTML="",target.appendChild(content)):target.innerHTML=null!=content?content:"";},_proto._teardownDom=function(){var _this__$mask;this._$wrap.parentNode&&this._$wrap.parentNode.removeChild(this._$wrap),(null==(_this__$mask=this._$mask)?void 0:_this__$mask.parentNode)&&this._$mask.parentNode.removeChild(this._$mask),this._$mask=null,this._$header=null,this._$title=null,this._$close=null;},_proto._bindEvents=function(){var _this__$close,_this__$mask,_this__$mask1;(null==(_this__$close=this._$close)||_this__$close.addEventListener("click",this._onCloseClick),this.options.showMask&&this.options.maskClosable)&&(null==(_this__$mask1=this._$mask)||_this__$mask1.addEventListener("click",this._onMaskClick));this.options.draggable&&this._$header&&(this._$header.addEventListener("mousedown",this._onHeaderPointerDown),this._$header.addEventListener("touchstart",this._onHeaderPointerDown,{passive:false})),this._$wrap.addEventListener("pointerdown",this._onModalPointerDown),this._$wrap.addEventListener("dblclick",this._onWrapDblClick),null==(_this__$mask=this._$mask)||_this__$mask.addEventListener("pointerdown",this._onModalPointerDown);},_proto._onCloseClick=function(e){e.stopPropagation(),this.close();},_proto._onMaskClick=function(){this.close();},_proto._onModalPointerDown=function(){this.bringToTop();},_proto._onWrapDblClick=function(e){e.stopPropagation();},_proto._onKeydown=function(e){"Escape"!==e.key&&"Esc"!==e.key||this.close();},_proto._onWindowResize=function(){if(this._dragging)return this._dragBounds=this._bounds(),void this.setPosition(this._pos.x,this._pos.y,this._dragBounds);this.setPosition(this._pos.x,this._pos.y);},_proto._getPoint=function(e){if("touches"in e){var t=e.touches[0]||e.changedTouches[0];return {x:t.clientX,y:t.clientY}}return {x:e.clientX,y:e.clientY}},_proto._onHeaderPointerDown=function(e){if(this.options.draggable){var target=e.target;if(!(this._$close&&(target===this._$close||this._$close.contains(target))||"button"in e&&0!==e.button)){var point=this._getPoint(e),rect=this._$wrap.getBoundingClientRect();this._dragOffset={x:point.x-rect.left,y:point.y-rect.top},this._dragBounds=this._bounds(),this._dragging=true,this._$wrap.style.willChange="transform",document.body.classList.add("emodal-dragging"),document.addEventListener("mousemove",this._onPointerMove),document.addEventListener("mouseup",this._onPointerUp),document.addEventListener("touchmove",this._onPointerMove,{passive:false}),document.addEventListener("touchend",this._onPointerUp),document.addEventListener("touchcancel",this._onPointerUp),this._eventEmitter.emit(EVENTS$1.dragStart);}}},_proto._onPointerMove=function(e){this._dragging&&(e.cancelable&&e.preventDefault(),this._dragPoint=this._getPoint(e),null===this._dragRafId&&(this._dragRafId=requestAnimationFrame(this._onDragFrame)));},_proto._onDragFrame=function(){if(this._dragRafId=null,this._dragging&&this._dragPoint){var left=this._dragPoint.x-this._dragOffset.x,top=this._dragPoint.y-this._dragOffset.y,_this__dragBounds=this._dragBounds,maxLeft=_this__dragBounds.maxLeft,maxTop=_this__dragBounds.maxTop,x=Math.max(0,Math.min(left,maxLeft)),y=Math.max(0,Math.min(top,maxTop));this._setTranslate(x,y),this._eventEmitter.emit(EVENTS$1.dragging,{x:x,y:y});}},_proto._onPointerUp=function(){this._dragging&&(this._stopDragging(),this._eventEmitter.emit(EVENTS$1.dragEnd,{left:this._pos.x,top:this._pos.y}));},_proto._stopDragging=function(){null!==this._dragRafId&&(cancelAnimationFrame(this._dragRafId),this._dragRafId=null),this._dragPoint=null,this._dragging?(this._dragging=false,this._$wrap&&(this._$wrap.style.willChange=""),document.body.classList.remove("emodal-dragging"),document.removeEventListener("mousemove",this._onPointerMove),document.removeEventListener("mouseup",this._onPointerUp),document.removeEventListener("touchmove",this._onPointerMove),document.removeEventListener("touchend",this._onPointerUp),document.removeEventListener("touchcancel",this._onPointerUp)):document.body.classList.remove("emodal-dragging");},_proto._bounds=function(){var vw=document.documentElement.clientWidth,vh=document.documentElement.clientHeight,w=this._$wrap.offsetWidth,h=this._$wrap.offsetHeight;return {maxLeft:Math.max(0,vw-w),maxTop:Math.max(0,vh-h)}},_proto._setTranslate=function(x,y){this._pos={x:x,y:y},this._$wrap.style.transform="translate3d("+x+"px, "+y+"px, 0)";},_proto._center=function(){var vw=document.documentElement.clientWidth,vh=document.documentElement.clientHeight,w=this._$wrap.offsetWidth,h=this._$wrap.offsetHeight;this.setPosition((vw-w)/2,(vh-h)/2);},_proto._applyInitialPosition=function(){var obj,position=this.options.position;position&&"object"==(void 0===position?"undefined":(obj=position)&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj)?this.setPosition(position.x,position.y):this._center();},Modal}();Modal.VERSION="0.0.1",Modal.EVENTS=EVENTS$1;
|
|
9257
9272
|
|
|
9258
9273
|
/*
|
|
9259
|
-
* @ezuikit/control-virtual-scroll v0.0.1
|
|
9260
|
-
* Copyright (c) 2026-
|
|
9274
|
+
* @ezuikit/control-virtual-scroll v0.0.1
|
|
9275
|
+
* Copyright (c) 2026-06-29 Ezviz-OpenBiz
|
|
9261
9276
|
* Released under the MIT License.
|
|
9262
9277
|
*/
|
|
9263
|
-
var EVENTS={render:"render",scroll:"scroll",reachTop:"reachTop",reachBottom:"reachBottom"},DefaultOptions={itemHeight:40,buffer:5,smooth:true};function _create_class$9(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 _OVERWRITE_MERGE_={clone:false,arrayMerge:function(_dest,src){return src}},VirtualScroll=function(){function VirtualScroll(container,options){this._active=new Map,this._pool=[],this._heights=[],this._prefix=[],this._prefixDirty=false,this._containerHeight=0,this._startIndex=-1,this._endIndex=-1,this._ticking=false,this._destroyed=false,this._resizeObserver=null,this._eventEmitter=new EventEmitter,this.options=deepmerge(DefaultOptions,null!=options?options:{},_OVERWRITE_MERGE_),this._wrapper=this._resolveContainer(null!=container?container:this.options.container),this._onScroll=this._onScroll.bind(this),this._onResize=this._onResize.bind(this),this._wrapper.classList.add("evscroll-wrapper"),"static"===getComputedStyle(this._wrapper).position&&(this._wrapper.style.position="relative"),this._wrapper.style.overflowY="auto",this._$content=document.createElement("div"),this._$content.className="evscroll-content",this._$viewport=document.createElement("div"),this._$viewport.className="evscroll-viewport",this._$content.appendChild(this._$viewport),this._wrapper.appendChild(this._$content),this._containerHeight=this._wrapper.clientHeight,this._wrapper.addEventListener("scroll",this._onScroll,{passive:true}),this._setupResizeObserver(),this._initHeights(),this._syncContentHeight(),this._compute(true);}var _proto=VirtualScroll.prototype;return _proto.getTotalCount=function(){return this.options.data?this.options.data.length:this.options.total||0},_proto.getCurrentRange=function(){return {startIndex:this._startIndex,endIndex:this._endIndex}},_proto.scrollToIndex=function(index,smooth){var total=this.getTotalCount();if(index<0||index>=total)return false;var top=this._offsetOf(index),useSmooth=void 0===smooth?this.options.smooth:smooth;return "function"==typeof this._wrapper.scrollTo?this._wrapper.scrollTo({top:top,behavior:useSmooth?"smooth":"auto"}):this._wrapper.scrollTop=top,true},_proto.scrollToTop=function(smooth){this.scrollToIndex(0,smooth);},_proto.scrollToBottom=function(smooth){var total=this.getTotalCount();total>0&&this.scrollToIndex(total-1,smooth);},_proto.setData=function(data){this.options.data=data,this.refresh();},_proto.setTotal=function(total){this.options.total=total,this.options.data=void 0,this.refresh();},_proto.refresh=function(){this._reset(),this._initHeights(),this._syncContentHeight(),this._compute(true);},_proto.updateOptions=function(options){this.options=deepmerge(this.options,options,_OVERWRITE_MERGE_),this.refresh();},_proto.on=function(event,callback){this._eventEmitter.on(event,callback);},_proto.off=function(event,callback){this._eventEmitter.off(event,callback);},_proto.destroy=function(){this._destroyed||(this._wrapper.removeEventListener("scroll",this._onScroll),this._resizeObserver?(this._resizeObserver.disconnect(),this._resizeObserver=null):window.removeEventListener("resize",this._onResize),this._reset(),this._$content.parentNode===this._wrapper&&this._wrapper.removeChild(this._$content),this._wrapper.classList.remove("evscroll-wrapper"),this._eventEmitter.removeAllListeners(),this._destroyed=true);},_proto._resolveContainer=function(container){var el="string"==typeof container?document.querySelector(container):container;if(!el)throw new Error("[VirtualScroll] container not found: "+String(container));return el},_proto._estimated=function(){var _this_options_estimatedItemHeight,ih=this.options.itemHeight;return null!=(_this_options_estimatedItemHeight=this.options.estimatedItemHeight)?_this_options_estimatedItemHeight:"number"==typeof ih&&ih>0?ih:DefaultOptions.itemHeight},_proto._baseHeightAt=function(index){var ih=this.options.itemHeight;if("function"==typeof ih){var h=ih(index,this.options.data?this.options.data[index]:void 0);return h>0?h:this._estimated()}return this._estimated()},_proto._initHeights=function(){if(!this._variable)return this._heights=[],this._prefix=[],void(this._prefixDirty=false);for(var total=this.getTotalCount(),heights=new Array(total),i=0;i<total;i++)heights[i]=this._baseHeightAt(i);this._heights=heights,this._prefixDirty=true,this._ensurePrefix();},_proto._ensurePrefix=function(){if(this._variable){var total=this.getTotalCount();if(this._prefixDirty||this._prefix.length!==total+1){var prefix=new Array(total+1);prefix[0]=0;for(var i=0;i<total;i++)prefix[i+1]=prefix[i]+(this._heights[i]||0);this._prefix=prefix,this._prefixDirty=false;}}},_proto._offsetOf=function(index){if(this._variable){this._ensurePrefix();var i=Math.max(0,Math.min(index,this.getTotalCount()));return this._prefix[i]||0}return index*this._fixedHeight},_proto._heightOf=function(index){return this._variable?this._heights[index]||0:this._fixedHeight},_proto._totalHeight=function(){return this._variable?(this._ensurePrefix(),this._prefix[this.getTotalCount()]||0):this.getTotalCount()*this._fixedHeight},_proto._findStartIndex=function(scrollTop){var total=this.getTotalCount();if(0===total)return 0;if(!this._variable)return Math.min(total-1,Math.max(0,Math.floor(scrollTop/this._fixedHeight)));this._ensurePrefix();for(var lo=0,hi=total;lo<hi;){var mid=lo+hi+1>>1;this._prefix[mid]<=scrollTop?lo=mid:hi=mid-1;}return Math.min(lo,total-1)},_proto._syncContentHeight=function(){this._$content.style.height=this._totalHeight()+"px";},_proto._onScroll=function(){var _this=this;this._eventEmitter.emit(EVENTS.scroll,this._wrapper.scrollTop),null==this.options.onScroll||this.options.onScroll.call(this.options,this._wrapper.scrollTop),this._ticking||(this._ticking=true,requestAnimationFrame(function(){_this._compute(false),_this._ticking=false;}));},_proto._setupResizeObserver=function(){var _this=this;"undefined"!=typeof ResizeObserver?(this._resizeObserver=new ResizeObserver(function(){return _this._onResize()}),this._resizeObserver.observe(this._wrapper)):window.addEventListener("resize",this._onResize);},_proto._onResize=function(){var h=this._wrapper.clientHeight;h!==this._containerHeight&&(this._containerHeight=h,this._compute(true));},_proto._compute=function(force){if(!this._destroyed){var total=this.getTotalCount();if((0===total||0===this._containerHeight)&&(this._containerHeight=this._wrapper.clientHeight,0===total))return this._reset(),void(this._$content.style.height="0px");var start,end,scrollTop=this._wrapper.scrollTop,buffer=this._buffer;if(this._variable)this._ensurePrefix(),start=Math.max(0,this._findStartIndex(scrollTop)-buffer),end=Math.min(total-1,this._findStartIndex(scrollTop+this._containerHeight)+buffer);else {var itemHeight=this._fixedHeight,rawStart=Math.floor(scrollTop/itemHeight);start=Math.max(0,rawStart-buffer);var capacity=Math.ceil(this._containerHeight/itemHeight);end=Math.min(total-1,rawStart+capacity-1+buffer);}if(force||start!==this._startIndex||end!==this._endIndex){if(this._startIndex=start,this._endIndex=end,this._updateRange(start,end),this._dynamic&&this._measureAndAdjust()){var st=this._wrapper.scrollTop,s2=Math.max(0,this._findStartIndex(st)-buffer),e2=Math.min(total-1,this._findStartIndex(st+this._containerHeight)+buffer);s2===start&&e2===end||(this._startIndex=s2,this._endIndex=e2,this._updateRange(s2,e2),start=s2,end=e2);}var range={startIndex:start,endIndex:end};this._eventEmitter.emit(EVENTS.render,range),null==this.options.onRender||this.options.onRender.call(this.options,range),0===start&&this._eventEmitter.emit(EVENTS.reachTop),end===total-1&&this._eventEmitter.emit(EVENTS.reachBottom);}}},_proto._measureAndAdjust=function(){var _this=this,changed=false;if(this._active.forEach(function(el,idx){var h=el.offsetHeight;h>0&&Math.abs(h-(_this._heights[idx]||0))>.5&&(_this._heights[idx]=h,changed=true);}),!changed)return false;var anchorIdx=this._startIndex>=0?this._startIndex:0,gap=this._wrapper.scrollTop-this._offsetOf(anchorIdx);this._prefixDirty=true,this._ensurePrefix(),this._$content.style.height=this._totalHeight()+"px",this._repositionActive();var newScrollTop=this._offsetOf(anchorIdx)+gap;return newScrollTop>=0&&Math.abs(newScrollTop-this._wrapper.scrollTop)>.5&&(this._wrapper.scrollTop=newScrollTop),true},_proto._repositionActive=function(){var _this=this;this._active.forEach(function(el,idx){el.style.top=_this._offsetOf(idx)+"px";});},_proto._updateRange=function(start,end){var _this=this,toRecycle=[];this._active.forEach(function(_el,idx){(idx<start||idx>end)&&toRecycle.push(idx);}),toRecycle.forEach(function(idx){var el=_this._active.get(idx);el&&(el.style.display="none",_this._pool.push(el)),_this._active.delete(idx);});for(var i=start;i<=end;i++)if(!this._active.has(i)){var el=this._pool.pop()||this._createItemEl();el.style.display="",el.style.top=this._offsetOf(i)+"px",el.style.height=this._dynamic?"":this._heightOf(i)+"px",el.setAttribute("data-index",String(i)),this._fillItem(el,i),el.parentNode!==this._$viewport&&this._$viewport.appendChild(el),this._active.set(i,el);}},_proto._createItemEl=function(){var el=document.createElement("div");return el.className="evscroll-item",el},_proto._fillItem=function(el,index){var left,right,item=this.options.data?this.options.data[index]:void 0,content=this.options.renderItem(index,item);left=content,(null!=(right=HTMLElement)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?el.replaceChildren(content):el.innerHTML=null!=content?content:"";},_proto._reset=function(){this._active.clear(),this._pool=[],this._$viewport.replaceChildren(),this._startIndex=-1,this._endIndex=-1;},_create_class$9(VirtualScroll,[{key:"_dynamic",get:function(){return !!this.options.dynamicHeight}},{key:"_variable",get:function(){return this._dynamic||"function"==typeof this.options.itemHeight}},{key:"_fixedHeight",get:function(){var ih=this.options.itemHeight;return "number"==typeof ih&&ih>0?ih:DefaultOptions.itemHeight}},{key:"_buffer",get:function(){var _this_options_buffer;return null!=(_this_options_buffer=this.options.buffer)?_this_options_buffer:DefaultOptions.buffer}}]),VirtualScroll}();VirtualScroll.VERSION="0.0.1-beta.3",VirtualScroll.EVENTS=EVENTS;
|
|
9278
|
+
var EVENTS={render:"render",scroll:"scroll",reachTop:"reachTop",reachBottom:"reachBottom"},DefaultOptions={itemHeight:40,buffer:5,smooth:true};function _create_class$9(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 _OVERWRITE_MERGE_={clone:false,arrayMerge:function(_dest,src){return src}},VirtualScroll=function(){function VirtualScroll(container,options){this._active=new Map,this._pool=[],this._containerHeight=0,this._startIndex=-1,this._endIndex=-1,this._ticking=false,this._destroyed=false,this._resizeObserver=null,this._eventEmitter=new EventEmitter,this.options=deepmerge(DefaultOptions,null!=options?options:{},_OVERWRITE_MERGE_),this._wrapper=this._resolveContainer(null!=container?container:this.options.container),this._onScroll=this._onScroll.bind(this),this._onResize=this._onResize.bind(this),this._wrapper.classList.add("evscroll-wrapper"),"static"===getComputedStyle(this._wrapper).position&&(this._wrapper.style.position="relative"),this._wrapper.style.overflowY="auto",this._$content=document.createElement("div"),this._$content.className="evscroll-content",this._$viewport=document.createElement("div"),this._$viewport.className="evscroll-viewport",this._$content.appendChild(this._$viewport),this._wrapper.appendChild(this._$content),this._containerHeight=this._wrapper.clientHeight,this._wrapper.addEventListener("scroll",this._onScroll,{passive:true}),this._setupResizeObserver(),this._syncContentHeight(),this._compute(true);}var _proto=VirtualScroll.prototype;return _proto.getTotalCount=function(){return this.options.data?this.options.data.length:this.options.total||0},_proto.getCurrentRange=function(){return {startIndex:this._startIndex,endIndex:this._endIndex}},_proto.scrollToIndex=function(index,smooth){var total=this.getTotalCount();if(index<0||index>=total)return false;var top=index*(this.options.itemHeight||DefaultOptions.itemHeight),useSmooth=void 0===smooth?this.options.smooth:smooth;return "function"==typeof this._wrapper.scrollTo?this._wrapper.scrollTo({top:top,behavior:useSmooth?"smooth":"auto"}):this._wrapper.scrollTop=top,true},_proto.scrollToTop=function(smooth){this.scrollToIndex(0,smooth);},_proto.scrollToBottom=function(smooth){var total=this.getTotalCount();total>0&&this.scrollToIndex(total-1,smooth);},_proto.setData=function(data){this.options.data=data,this.refresh();},_proto.setTotal=function(total){this.options.total=total,this.options.data=void 0,this.refresh();},_proto.refresh=function(){this._reset(),this._syncContentHeight(),this._compute(true);},_proto.updateOptions=function(options){this.options=deepmerge(this.options,options,_OVERWRITE_MERGE_),this.refresh();},_proto.on=function(event,callback){this._eventEmitter.on(event,callback);},_proto.off=function(event,callback){this._eventEmitter.off(event,callback);},_proto.destroy=function(){this._destroyed||(this._wrapper.removeEventListener("scroll",this._onScroll),this._resizeObserver?(this._resizeObserver.disconnect(),this._resizeObserver=null):window.removeEventListener("resize",this._onResize),this._reset(),this._$content.parentNode===this._wrapper&&this._wrapper.removeChild(this._$content),this._wrapper.classList.remove("evscroll-wrapper"),this._eventEmitter.removeAllListeners(),this._destroyed=true);},_proto._resolveContainer=function(container){var el="string"==typeof container?document.querySelector(container):container;if(!el)throw new Error("[VirtualScroll] container not found: "+String(container));return el},_proto._syncContentHeight=function(){this._$content.style.height=this.getTotalCount()*this._itemHeight+"px";},_proto._onScroll=function(){var _this=this;this._eventEmitter.emit(EVENTS.scroll,this._wrapper.scrollTop),null==this.options.onScroll||this.options.onScroll.call(this.options,this._wrapper.scrollTop),this._ticking||(this._ticking=true,requestAnimationFrame(function(){_this._compute(false),_this._ticking=false;}));},_proto._setupResizeObserver=function(){var _this=this;"undefined"!=typeof ResizeObserver?(this._resizeObserver=new ResizeObserver(function(){return _this._onResize()}),this._resizeObserver.observe(this._wrapper)):window.addEventListener("resize",this._onResize);},_proto._onResize=function(){var h=this._wrapper.clientHeight;h!==this._containerHeight&&(this._containerHeight=h,this._compute(true));},_proto._compute=function(force){if(!this._destroyed){var total=this.getTotalCount();if(0!==total&&0!==this._containerHeight||(this._containerHeight=this._wrapper.clientHeight,0!==total)){var scrollTop=this._wrapper.scrollTop,itemHeight=this._itemHeight,buffer=this._buffer,rawStart=Math.floor(scrollTop/itemHeight),start=Math.max(0,rawStart-buffer),rawEnd=rawStart+Math.ceil(this._containerHeight/itemHeight)-1,end=Math.min(total-1,rawEnd+buffer);if(force||start!==this._startIndex||end!==this._endIndex){this._startIndex=start,this._endIndex=end,this._updateRange(start,end);var range={startIndex:start,endIndex:end};this._eventEmitter.emit(EVENTS.render,range),null==this.options.onRender||this.options.onRender.call(this.options,range),0===start&&this._eventEmitter.emit(EVENTS.reachTop),end===total-1&&this._eventEmitter.emit(EVENTS.reachBottom);}}else this._reset();}},_proto._updateRange=function(start,end){var _this=this,itemHeight=this._itemHeight,toRecycle=[];this._active.forEach(function(_el,idx){(idx<start||idx>end)&&toRecycle.push(idx);}),toRecycle.forEach(function(idx){var el=_this._active.get(idx);el&&(el.style.display="none",_this._pool.push(el)),_this._active.delete(idx);});for(var i=start;i<=end;i++)if(!this._active.has(i)){var el=this._pool.pop()||this._createItemEl();el.style.display="",el.style.top=i*itemHeight+"px",el.style.height=itemHeight+"px",el.setAttribute("data-index",String(i)),this._fillItem(el,i),el.parentNode!==this._$viewport&&this._$viewport.appendChild(el),this._active.set(i,el);}},_proto._createItemEl=function(){var el=document.createElement("div");return el.className="evscroll-item",el},_proto._fillItem=function(el,index){var left,right,item=this.options.data?this.options.data[index]:void 0,content=this.options.renderItem(index,item);left=content,(null!=(right=HTMLElement)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?el.replaceChildren(content):el.innerHTML=null!=content?content:"";},_proto._reset=function(){this._active.clear(),this._pool=[],this._$viewport.replaceChildren(),this._startIndex=-1,this._endIndex=-1;},_create_class$9(VirtualScroll,[{key:"_itemHeight",get:function(){return this.options.itemHeight||DefaultOptions.itemHeight}},{key:"_buffer",get:function(){var _this_options_buffer;return null!=(_this_options_buffer=this.options.buffer)?_this_options_buffer:DefaultOptions.buffer}}]),VirtualScroll}();VirtualScroll.VERSION="0.0.1",VirtualScroll.EVENTS=EVENTS;
|
|
9264
9279
|
|
|
9265
9280
|
/*
|
|
9266
|
-
* @ezuikit/control-rec-list-modal v0.0.1-beta.
|
|
9267
|
-
* Copyright (c) 2026-07-
|
|
9281
|
+
* @ezuikit/control-rec-list-modal v0.0.1-beta.7
|
|
9282
|
+
* Copyright (c) 2026-07-28 Ezviz-OpenBiz
|
|
9268
9283
|
* Released under the MIT License.
|
|
9269
9284
|
*/
|
|
9270
|
-
var __$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__$1={targets:[],root:null,rootMargin:"0px",threshold:.1,loadingClass:"ez-lazy-image-loading",loadedClass:"ez-lazy-image-loaded",loadedErrorClass:"ez-lazy-image-error",dwell:200,onLoadError:function(){}},ImageLazyLoader$1=function(){function ImageLazyLoader(options){ void 0===options&&(options={}),this._pendingTimers=new Map,this.options=Object.assign({},__$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__$1,options),this._observer=null,this._init();}var _proto=ImageLazyLoader.prototype;return _proto._init=function(){var _this=this;ImageLazyLoader.isSupported&&(this._observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){var target=entry.target;if(entry.isIntersecting){if(_this._pendingTimers.has(target))return;var timer=setTimeout(function(){var _this__observer;_this._pendingTimers.delete(target),_this._loadImage(target),null==(_this__observer=_this._observer)||_this__observer.unobserve(target);},_this.options.dwell);_this._pendingTimers.set(target,timer);}else {var timer1=_this._pendingTimers.get(target);void 0!==timer1&&(clearTimeout(timer1),_this._pendingTimers.delete(target));}});},this.options)),this.addImages(this.options.targets);},_proto._loadImage=function(img){var _img_classList,_img_classList1,_img_classList2,_this=this;if(img&&!(null==(_img_classList=img.classList)?void 0:_img_classList.contains(this.options.loadingClass))&&!(null==(_img_classList1=img.classList)?void 0:_img_classList1.contains(this.options.loadedClass))&&!(null==(_img_classList2=img.classList)?void 0:_img_classList2.contains(this.options.loadedErrorClass))&&img.hasAttribute("data-src")){var _this1=this;img.classList.add(this.options.loadingClass);var tempImg=new Image;tempImg.onload=function(){img.src=img.dataset.src,img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedClass),img.dispatchEvent(new Event("lazyloaded"));},tempImg.onerror=function(){img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedErrorClass),null==_this1.options.onLoadError||_this1.options.onLoadError.call(_this1.options,img);},tempImg.src=img.dataset.src;}},_proto.addImages=function(targets){var _this=this;(null==targets?void 0:targets.length)&&targets.forEach(function(target){var _this__observer;(null==target?void 0:target.hasAttribute("data-src"))&&(ImageLazyLoader.isSupported&&_this._observer?null==(_this__observer=_this._observer)||_this__observer.observe(target):_this._loadImage(target));});},_proto.destroy=function(){this._pendingTimers.forEach(function(timer){return clearTimeout(timer)}),this._pendingTimers.clear(),this._observer&&(this._observer.disconnect(),this._observer=null);},ImageLazyLoader}();function _create_class$1$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}ImageLazyLoader$1.isSupported="IntersectionObserver"in window;var _PREFIX_$1="ez-rec-list-modal-checkbox",Checkbox=function(){function Checkbox(options){var _options_checked,_options_disabled,_options_label,_options_size;void 0===options&&(options={}),this._$label=null,this._destroyed=false,this.options={checked:null!=(_options_checked=options.checked)&&_options_checked,disabled:null!=(_options_disabled=options.disabled)&&_options_disabled,label:null!=(_options_label=options.label)?_options_label:"",size:null!=(_options_size=options.size)?_options_size:16,onChange:options.onChange},this._onChange=this._onChange.bind(this),this._$root=document.createElement("label"),this._$root.className=_PREFIX_$1,this._$root.style.setProperty("--ez-rec-list-modal-checkbox-size",this.options.size+"px"),this._$input=document.createElement("input"),this._$input.type="checkbox",this._$input.className=_PREFIX_$1+"-input",this._$input.checked=this.options.checked,this._$input.disabled=this.options.disabled,this._$input.addEventListener("change",this._onChange),this._$root.appendChild(this._$input),this._$box=document.createElement("span"),this._$box.className=_PREFIX_$1+"-box",this._$box.innerHTML='<span class="'+_PREFIX_$1+'-check"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3.5 8.4 6.4 11.3 12.5 4.9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>',this._$root.appendChild(this._$box),this.options.label&&(this._$label=document.createElement("span"),this._$label.className=_PREFIX_$1+"-label",this._$label.textContent=this.options.label,this._$root.appendChild(this._$label)),this._syncState();}var _proto=Checkbox.prototype;return _proto.setChecked=function(checked,emit){ void 0===emit&&(emit=false),this._$input.checked!==checked&&(this._$input.checked=checked,this._syncState(),emit&&(null==this.options.onChange||this.options.onChange.call(this.options,checked)));},_proto.setDisabled=function(disabled){this.options.disabled=disabled,this._$input.disabled=disabled,this._syncState();},_proto.setLabel=function(label){this.options.label=label,label?(this._$label||(this._$label=document.createElement("span"),this._$label.className=_PREFIX_$1+"-label",this._$root.appendChild(this._$label)),this._$label.textContent=label):this._$label&&(this._$label.remove(),this._$label=null);},_proto.destroy=function(){this._destroyed||(this._destroyed=true,this._$input.removeEventListener("change",this._onChange),this._$root.remove());},_proto._onChange=function(){this._syncState(),null==this.options.onChange||this.options.onChange.call(this.options,this._$input.checked);},_proto._syncState=function(){this._$root.classList.toggle(_PREFIX_$1+"-checked",this._$input.checked),this._$root.classList.toggle(_PREFIX_$1+"-disabled",this.options.disabled);},_create_class$1$2(Checkbox,[{key:"el",get:function(){return this._$root}},{key:"checked",get:function(){return this._$input.checked}}]),Checkbox}(),_$REC_EVENT_ICONS$__playing='<svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="playing">\n <rect x="1.5" y="7" width="3" height="7.5" rx="1.5"/>\n <rect x="6.5" y="3" width="3" height="11.5" rx="1.5"/>\n <rect x="11" y="5.5" width="3" height="9" rx="1.5"/>\n </svg>',_$REC_EVENT_ICONS$__humanDetection='<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="humanDetection">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.42689 10.122L5.78846 9.81738C5.5102 9.68459 5.33301 9.4037 5.33301 9.09537V6.6667C5.33301 6.22487 5.69118 5.8667 6.13301 5.8667H9.86634C10.3082 5.8667 10.6663 6.22487 10.6663 6.6667V9.10694C10.6663 9.40926 10.4959 9.68576 10.2258 9.82162L9.62858 10.122H6.42689Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M8.00039 2.1333C8.88405 2.1333 9.60039 2.84965 9.60039 3.7333C9.60039 4.61696 8.88405 5.3333 8.00039 5.3333C7.11674 5.3333 6.40039 4.61696 6.40039 3.7333C6.40039 2.84965 7.11674 2.1333 8.00039 2.1333Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M8.80039 9.06689C9.24222 9.06689 9.60039 9.42507 9.60039 9.8669V13.0669C9.60039 13.5087 9.24222 13.8669 8.80039 13.8669H7.20039C6.75856 13.8669 6.40039 13.5087 6.40039 13.0669V9.8669C6.40039 9.42507 6.75856 9.06689 7.20039 9.06689H8.80039Z" fill="currentColor"/>\n <path d="M4.26628 2.6665H2.93294C2.19694 2.6665 1.59961 3.26325 1.59961 3.99984V5.33317" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M1.59961 10.6665V11.9998C1.59961 12.7358 2.19694 13.3332 2.93294 13.3332H4.26628" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M11.7334 13.3332H13.0667C13.8033 13.3332 14.4001 12.7358 14.4001 11.9998V10.6665" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M14.4001 5.33317V3.99984C14.4001 3.26325 13.8033 2.6665 13.0667 2.6665H11.7334" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>',_$REC_EVENT_ICONS$__vehicleDetection='<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="vehicleDetection">\n <path d="M14.2522 6.62695L12.6147 7.25195" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M3.39233 7.25L1.74854 6.625" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M12.6116 7.25L12.0872 4.7425C11.9354 4.01875 11.2972 3.5 10.5572 3.5H5.50722C4.7816 3.5 4.15098 4 3.98598 4.70687L3.3916 7.25" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M12.375 7.25098C13.4106 7.25098 14.25 8.09035 14.25 9.12598V12.1523C14.247 12.3407 11.125 11.9375 11.125 11.9375H4.875C4.875 11.9375 1.7522 12.4275 1.75 12.2822V9.12598C1.75 8.09035 2.58938 7.25098 3.625 7.25098H12.375ZM4.09375 9.28125L4.03027 9.28516C3.80148 9.3162 3.625 9.51269 3.625 9.75C3.625 10.0089 3.83487 10.2188 4.09375 10.2188H5.65625L5.71973 10.2148C5.94852 10.1838 6.125 9.98731 6.125 9.75C6.125 9.49112 5.91513 9.28125 5.65625 9.28125H4.09375ZM10.2803 9.28516C10.0515 9.3162 9.875 9.51269 9.875 9.75C9.875 10.0089 10.0849 10.2188 10.3438 10.2188H11.9062L11.9697 10.2148C12.1985 10.1838 12.375 9.98731 12.375 9.75C12.375 9.49112 12.1651 9.28125 11.9062 9.28125H10.3438L10.2803 9.28516Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M14.25 9.125C14.25 8.08938 13.4106 7.25 12.375 7.25H3.625C2.58938 7.25 1.75 8.08938 1.75 9.125V12.0373H14.25V9.125V9.125Z" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5625 13.4998C5.08 13.4998 5.5 13.0798 5.5 12.5623V11.9373L2.375 11.875V12.7185C2.375 13.1498 2.725 13.4998 3.15625 13.4998H4.5625Z" fill="currentColor" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M12.6877 13.4998C13.2052 13.4998 13.6252 13.0798 13.6252 12.5623V11.9373L10.5002 11.875V12.7185C10.5002 13.1498 10.8502 13.4998 11.2815 13.4998H12.6877Z" fill="currentColor" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>',_$REC_EVENT_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',_$REC_LIST_MODAL_LOCALES$_={zh:{title:"录像片段",empty:"暂无录像",eventFilter:"事件片段"},en:{title:"Recordings",empty:"No recordings",eventFilter:"Event"}};function _create_class$8(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$e(){return _extends$e=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$e.apply(this,arguments)}function _set_prototype_of$f(o,p){return _set_prototype_of$f=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$f(o,p)}var _PREFIX_="ez-rec-list-modal",_ICON_EVENT_='<svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M11.5 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1v-11a1 1 0 0 0-1-1Zm0 1.1v10.8h-7V2.6h7ZM6 5.2h4v-1H6v1Zm0 2.3h4v-1H6v1Zm0 2.3h2.7v-1H6v1Z"/></svg>',_REC_EVENT_ICONS_={1:_ICON_EVENT_,2:_ICON_EVENT_,3:_$REC_EVENT_ICONS$__humanDetection,4:'<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="faceDetection">\n <path d="M4.26628 2.66602H2.93294C2.19694 2.66602 1.59961 3.26276 1.59961 3.99935V5.33268" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M1.59961 10.666V11.9993C1.59961 12.7353 2.19694 13.3327 2.93294 13.3327H4.26628" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M11.7334 13.3327H13.0667C13.8033 13.3327 14.4001 12.7353 14.4001 11.9993V10.666" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M14.4001 5.33268V3.99935C14.4001 3.26276 13.8033 2.66602 13.0667 2.66602H11.7334" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.26636 8.53273C4.26636 8.53273 3.74805 8.7145 3.74805 9.32262C3.74805 9.93074 4.12968 10.4493 4.62191 10.4493C4.73317 10.9272 5.97651 13.0867 8.08858 13.0867C10.0905 13.0867 11.5552 10.3969 11.5552 10.3969C11.5552 10.3969 12.2716 10.1395 12.2518 9.32262C12.2325 8.69788 11.7965 8.53273 11.7965 8.53273C11.7965 8.53273 12.1055 5.56552 9.99785 4.3185C7.89022 3.07148 6.36571 4.5319 6.36571 4.5319C6.36571 4.5319 4.11766 4.87602 4.2222 7.69628" fill="currentColor"/>\n </svg>',5:_$REC_EVENT_ICONS$__vehicleDetection,6:'<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="petDetection">\n <path d="M10.134 2.66309C11.9012 2.66316 13.3341 4.09615 13.3342 5.86328V10.6641C13.334 12.4311 11.9011 13.8632 10.134 13.8633H5.86743C4.10029 13.8633 2.6675 12.4311 2.66724 10.6641V5.86328C2.66739 4.09611 4.10022 2.66309 5.86743 2.66309H10.134ZM7.97583 7.95312C7.5222 7.95327 7.15454 8.32075 7.15454 8.77441C7.15459 9.07899 7.32174 9.34112 7.56763 9.4834C7.5526 9.52337 7.54321 9.56694 7.54321 9.6123C7.54296 10.2798 6.9996 10.8223 6.33228 10.8223C6.13114 10.8224 5.96802 10.9863 5.96802 11.1875C5.96822 11.3882 6.13127 11.5516 6.33228 11.5518C7.0251 11.5518 7.63284 11.185 7.97583 10.6367C8.31908 11.1851 8.92713 11.5518 9.62036 11.5518C9.82129 11.5516 9.98442 11.3881 9.98462 11.1875C9.98462 10.9864 9.8214 10.8225 9.62036 10.8223C8.95273 10.8223 8.4087 10.2798 8.40845 9.6123C8.40845 9.56694 8.39906 9.52337 8.38403 9.4834C8.63004 9.34115 8.79805 9.07907 8.7981 8.77441C8.7981 8.32066 8.42989 7.95312 7.97583 7.95312ZM5.06665 5.87207C4.62483 5.87226 4.26685 6.23032 4.26685 6.67188C4.26708 7.11353 4.62497 7.47149 5.06665 7.47168C5.50818 7.47168 5.86622 7.11365 5.86646 6.67188C5.86646 6.2302 5.50832 5.87207 5.06665 5.87207ZM10.9338 5.87207C10.492 5.87226 10.134 6.23032 10.134 6.67188C10.1343 7.11353 10.4922 7.47149 10.9338 7.47168C11.3754 7.47168 11.7334 7.11365 11.7336 6.67188C11.7336 6.2302 11.3755 5.87207 10.9338 5.87207Z" fill="currentColor"/>\n <path d="M12.8 4.08984C12.9449 4.28499 13.0671 4.49562 13.1633 4.71777L15.1584 8.09668C15.4833 8.64759 15.5543 9.28148 15.3577 9.88086C15.1613 10.4797 14.7204 10.9735 14.1174 11.2705C13.8537 11.4002 13.4576 11.4741 13.1633 11.5137C13.0759 11.7889 12.9522 12.0484 12.8 12.2891V4.08984Z" fill="currentColor" fill-opacity="0.6"/>\n <path d="M3.19946 12.4372C3.05452 12.242 2.93249 12.0315 2.83618 11.8093L0.841064 8.43039C0.51612 7.87943 0.44519 7.24568 0.641846 6.64621C0.838188 6.04713 1.27893 5.5536 1.88208 5.25656C2.14581 5.12684 2.54188 5.05303 2.83618 5.0134C2.92354 4.73812 3.04729 4.47872 3.19946 4.23801L3.19946 12.4372Z" fill="currentColor" fill-opacity="0.6"/>\n </svg>',ALRAM:_ICON_EVENT_,TIMIING:_ICON_EVENT_,CAR:_$REC_EVENT_ICONS$__vehicleDetection,HD:_$REC_EVENT_ICONS$__humanDetection},_$REC_LIST_MODAL_DEFAULT_OPTIONS$_={width:260,height:490,buffer:5,startTimeFormat:"HH:mm",groupTitleFormat:"HH:00",showEventFilter:true,showCardTypeIcon:true,eventFilterChecked:false},RecListModal=function(Modal){function RecListModal(container,options){var _this,_ref,_ref1,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8,_ref9;(_this=Modal.call(this,container,RecListModal._mergeModalOptions(options))||this)._$titleWrap=null,_this._eventCheckbox=null,_this._virtualScroll=null,_this._lazyLoader=null,_this._rows=[],_this._sortedSections=[],_this._eventOnly=false,_this._vsInited=false,_this._recordDestroyed=false,_this._activeIndex=-1,_this._userInteracting=false,_this._userScrollTimer=null;var def=_$REC_LIST_MODAL_DEFAULT_OPTIONS$_;return _this._recI18n=new I18n$1(deepmerge(_$REC_LIST_MODAL_LOCALES$_,_this.options.locales||{},{clone:false}),{defaultLocale:_this.options.language||"zh"}),_this.recordOptions={sections:null!=(_ref=null==options?void 0:options.sections)?_ref:[],buffer:null!=(_ref1=null==options?void 0:options.buffer)?_ref1:def.buffer,coverQuery:null!=(_ref2=null==options?void 0:options.coverQuery)?_ref2:"",startTimeFormat:null!=(_ref3=null==options?void 0:options.startTimeFormat)?_ref3:def.startTimeFormat,groupTitleFormat:null!=(_ref4=null==options?void 0:options.groupTitleFormat)?_ref4:def.groupTitleFormat,emptyText:null!=(_ref5=null==options?void 0:options.emptyText)?_ref5:String(_this._recI18n.t("empty")),showEventFilter:null!=(_ref6=null==options?void 0:options.showEventFilter)?_ref6:def.showEventFilter,eventFilterText:null!=(_ref7=null==options?void 0:options.eventFilterText)?_ref7:String(_this._recI18n.t("eventFilter")),eventFilterChecked:null!=(_ref8=null==options?void 0:options.eventFilterChecked)?_ref8:def.eventFilterChecked,showCardTypeIcon:null!=(_ref9=null==options?void 0:options.showCardTypeIcon)?_ref9:def.showCardTypeIcon,isEvent:null==options?void 0:options.isEvent,renderCardIcon:null==options?void 0:options.renderCardIcon,onCardClick:null==options?void 0:options.onCardClick},_this._eventOnly=_this.recordOptions.eventFilterChecked,_this._activeTime="number"==typeof(null==options?void 0:options.activeTime)?options.activeTime:void 0,_this._titleText="string"==typeof(null==options?void 0:options.title)?options.title:String(_this._recI18n.t("title")),_this.setTitle(_this._buildHeaderTitle()),_this._$listRoot=document.createElement("div"),_this._$listRoot.className=_PREFIX_+"-list",_this._$empty=document.createElement("div"),_this._$empty.className=_PREFIX_+"-empty",_this._$empty.textContent=_this.recordOptions.emptyText,_this._$empty.style.display="none",_this._$listRoot.appendChild(_this._$empty),_this.setContent(_this._$listRoot),_this._onListClick=_this._onListClick.bind(_this),_this._onUserScroll=_this._onUserScroll.bind(_this),_this._$listRoot.addEventListener("click",_this._onListClick),_this._buildRows(),_this.isVisible()&&_this._ensureVirtualScroll(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$f(subClass,superClass);}(RecListModal,Modal);var _proto=RecListModal.prototype;return _proto.open=function(){Modal.prototype.open.call(this),this._$listRoot&&(this._ensureVirtualScroll(),this._userInteracting=false,this._userScrollTimer&&(clearTimeout(this._userScrollTimer),this._userScrollTimer=null),this._scrollToActive(true));},_proto.setSections=function(sections){this.recordOptions.sections=sections||[],this._buildRows(),this._virtualScroll?this._virtualScroll.setData(this._rows):this.isVisible()&&this._ensureVirtualScroll(),this._toggleEmpty();},_proto.setActiveTime=function(time){this._activeTime="number"==typeof time?time:void 0,this._refreshActiveState(),this._scrollToActive();},_proto.showEventFilter=function(show){var _this=this;if(this.recordOptions.showEventFilter=show,show){var _this__$titleWrap;if(this._eventCheckbox)return;var checkbox=new Checkbox({label:this.recordOptions.eventFilterText,checked:this._eventOnly,onChange:function(checked){return _this._onEventFilterChange(checked)}});checkbox.el.addEventListener("mousedown",function(e){return e.stopPropagation()}),checkbox.el.addEventListener("touchstart",function(e){return e.stopPropagation()}),null==(_this__$titleWrap=this._$titleWrap)||_this__$titleWrap.appendChild(checkbox.el),this._eventCheckbox=checkbox;}else {if(!this._eventCheckbox)return;this._eventCheckbox.destroy(),this._eventCheckbox=null;}},_proto.destroy=function(){var _this__eventCheckbox,_this__virtualScroll,_this__lazyLoader;this._recordDestroyed||(this._recordDestroyed=true,null==(_this__eventCheckbox=this._eventCheckbox)||_this__eventCheckbox.destroy(),this._eventCheckbox=null,this._userScrollTimer&&(clearTimeout(this._userScrollTimer),this._userScrollTimer=null),this._$listRoot.removeEventListener("click",this._onListClick),this._$listRoot.removeEventListener("wheel",this._onUserScroll),this._$listRoot.removeEventListener("touchmove",this._onUserScroll),null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.destroy(),this._virtualScroll=null,null==(_this__lazyLoader=this._lazyLoader)||_this__lazyLoader.destroy(),this._lazyLoader=null),Modal.prototype.destroy.call(this);},_proto._rowHeight=function(row){return row&&"header"===row.type?28:this._cardRowHeight},_proto._buildHeaderTitle=function(){var _this=this,wrap=document.createElement("div");wrap.className=_PREFIX_+"-title",this._$titleWrap=wrap;var text=document.createElement("span");if(text.className=_PREFIX_+"-title-text",text.textContent=this._titleText,wrap.appendChild(text),this.recordOptions.showEventFilter){var checkbox=new Checkbox({label:this.recordOptions.eventFilterText,checked:this._eventOnly,onChange:function(checked){return _this._onEventFilterChange(checked)}});checkbox.el.addEventListener("mousedown",function(e){return e.stopPropagation()}),checkbox.el.addEventListener("touchstart",function(e){return e.stopPropagation()}),wrap.appendChild(checkbox.el),this._eventCheckbox=checkbox;}return wrap},_proto._onEventFilterChange=function(checked){var _this__virtualScroll;this._eventOnly=checked,this._buildRows(),null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.setData(this._rows),this._toggleEmpty();},_proto._ensureVirtualScroll=function(){var _this__virtualScroll,_this=this;this._recordDestroyed||(this._toggleEmpty(),this._vsInited?(null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.refresh(),this._observeVisibleImages()):(this._vsInited=true,this._lazyLoader=new ImageLazyLoader$1({root:this._$listRoot}),this._virtualScroll=new VirtualScroll(this._$listRoot,{data:this._rows,itemHeight:function(_index,row){return _this._rowHeight(row)},buffer:this.recordOptions.buffer,renderItem:function(index,item){return _this._renderRow(index,item)},onRender:function(){return _this._observeVisibleImages()}}),this._observeVisibleImages(),this._$listRoot.addEventListener("wheel",this._onUserScroll,{passive:true}),this._$listRoot.addEventListener("touchmove",this._onUserScroll,{passive:true}),this._scrollToActive(true)));},_proto._toggleEmpty=function(){this._$empty&&(this._$empty.style.display=0===this._rows.length?"":"none");},_proto._isEvent=function(section){return "function"==typeof this.recordOptions.isEvent?this.recordOptions.isEvent(section):!!_REC_EVENT_ICONS_[section.EVENT_TYPE]},_proto._buildRows=function(){var _this=this;this._activeIndex=-1;var sorted=(this.recordOptions.sections||[]).filter(function(s){return s&&"number"==typeof s.startTime&&"number"==typeof s.endTime}).filter(function(s){return !_this._eventOnly||_this._isEvent(s)}).slice().reverse();this._sortedSections=sorted;for(var rows=[],groups=new Map,i=0;i<sorted.length;i++){var section=sorted[i],key=distExports$4.DateTime.format(section.startTime,"YYYY-MM-DD HH"),bucket=groups.get(key);bucket||(bucket=[],groups.set(key,bucket)),bucket.push({section:section,index:i});}groups.forEach(function(bucket){rows.push({type:"header",title:distExports$4.DateTime.format(bucket[0].section.startTime,_this.recordOptions.groupTitleFormat),count:bucket.length});for(var i=0;i<bucket.length;i+=2)rows.push({type:"cards",items:bucket.slice(i,i+2)});}),this._rows=rows;},_proto._renderRow=function(_index,row){var _this=this;if(!row)return "";if("header"===row.type)return '<div class="'+_PREFIX_+'-group">\n <span class="'+_PREFIX_+'-group-title">'+this._escape(row.title)+"</span>\n </div>";var cards=row.items.map(function(it){return _this._renderCard(it.section,it.index)}).join("");return '<div class="'+_PREFIX_+'-row">'+cards+"</div>"},_proto._renderCard=function(section,index){var start,end,_DateTime_toDate,_DateTime_toDate1,secondNum,second,minute,startText=distExports$4.DateTime.format(section.startTime,this.recordOptions.startTimeFormat),durationText=(start=section.startTime,end=section.endTime,secondNum=Math.floor((null==(_DateTime_toDate=distExports$4.DateTime.toDate(end))?void 0:_DateTime_toDate.getTime())-(null==(_DateTime_toDate1=distExports$4.DateTime.toDate(start))?void 0:_DateTime_toDate1.getTime()))/1e3,second=secondNum%60,((minute=Math.floor(secondNum/60))>0?distExports$4.DateTime.fillZero(minute)+"'":"0'")+distExports$4.DateTime.fillZero(second)+"''"),cover=section.coverPic?""+section.coverPic+this.recordOptions.coverQuery:"",media=cover?'<img class="'+_PREFIX_+'-card-img ez-lazy-image" data-src="'+this._setImageScr(this._escape(cover))+'" alt="" />':'<div class="'+_PREFIX_+'-card-placeholder">'+_$REC_EVENT_ICONS$__picture+"</div>",icon=this._renderCardIcon(section),activeCls=this._isActive(section)?" "+_PREFIX_+"-card-active":"";return '<div class="'+_PREFIX_+"-card"+activeCls+'" data-card-index="'+index+'">\n <div class="'+_PREFIX_+'-card-thumb">\n '+media+'\n <span class="'+_PREFIX_+'-card-start">'+this._escape(startText)+'</span>\n <span class="'+_PREFIX_+'-card-duration">'+this._escape(durationText)+'</span>\n <span class="'+_PREFIX_+'-card-playing">'+_$REC_EVENT_ICONS$__playing+"</span>\n "+icon+"\n </div>\n </div>"},_proto._isActive=function(section){var t=this._activeTime;return "number"==typeof t&&t>=section.startTime&&t<=section.endTime},_proto._refreshActiveState=function(){var _this=this;this._$listRoot.querySelectorAll("."+_PREFIX_+"-card").forEach(function(card){var idx=Number(card.getAttribute("data-card-index")),section=_this._sortedSections[idx];card.classList.toggle(_PREFIX_+"-card-active",!!section&&_this._isActive(section));});},_proto._findActiveIndex=function(){if("number"!=typeof this._activeTime)return -1;for(var i=0;i<this._sortedSections.length;i++)if(this._isActive(this._sortedSections[i]))return i;return -1},_proto._rowIndexOfSection=function(sectionIndex){for(var i=0;i<this._rows.length;i++){var row=this._rows[i];if("cards"===row.type&&row.items.some(function(it){return it.index===sectionIndex}))return i}return -1},_proto._scrollToActive=function(force){ void 0===force&&(force=false);var idx=this._findActiveIndex();if((force||idx!==this._activeIndex)&&(this._activeIndex=idx,!(idx<0||!this._virtualScroll||!force&&this._userInteracting))){var rowIndex=this._rowIndexOfSection(idx);rowIndex>=0&&this._virtualScroll.scrollToIndex(rowIndex,true);}},_proto._onUserScroll=function(){var _this=this;this._userInteracting=true,this._userScrollTimer&&clearTimeout(this._userScrollTimer),this._userScrollTimer=setTimeout(function(){_this._userInteracting=false,_this._userScrollTimer=null;},3e3);},_proto._renderCardIcon=function(section){if(!this.recordOptions.showCardTypeIcon)return "";var inner="function"==typeof this.recordOptions.renderCardIcon?this.recordOptions.renderCardIcon(section):_REC_EVENT_ICONS_[section.EVENT_TYPE];return inner?'<span class="'+_PREFIX_+'-card-icon">'+inner+"</span>":""},_proto._observeVisibleImages=function(){if(this._lazyLoader){var imgs=this._$listRoot.querySelectorAll("img[data-src]");imgs.length&&this._lazyLoader.addImages(Array.from(imgs));}},_proto._onListClick=function(e){var onCardClick=this.recordOptions.onCardClick;if(onCardClick){var target=e.target,card=null==target?void 0:target.closest("."+_PREFIX_+"-card");if(card){var idx=Number(card.getAttribute("data-card-index")),section=this._sortedSections[idx];section&&onCardClick(section,idx,this._sortedSections);}}},_proto._escape=function(text){return String(text).replace(/[&<>"']/g,function(ch){switch(ch){case "&":return "&";case "<":return "<";case ">":return ">";case '"':return """;default:return "'"}})},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},RecListModal._mergeModalOptions=function(options){var _ref,_ref1;return _extends$e({},options,{width:null!=(_ref=null==options?void 0:options.width)?_ref:_$REC_LIST_MODAL_DEFAULT_OPTIONS$_.width,height:null!=(_ref1=null==options?void 0:options.height)?_ref1:_$REC_LIST_MODAL_DEFAULT_OPTIONS$_.height,content:"",title:""})},_create_class$8(RecListModal,[{key:"_cardRowHeight",get:function(){return 70}}]),RecListModal}(Modal);RecListModal.VERSION="0.0.1-beta.5";
|
|
9285
|
+
var __$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__$1={targets:[],root:null,rootMargin:"0px",threshold:.1,loadingClass:"ez-lazy-image-loading",loadedClass:"ez-lazy-image-loaded",loadedErrorClass:"ez-lazy-image-error",dwell:200,onLoadError:function(){}},ImageLazyLoader$1=function(){function ImageLazyLoader(options){ void 0===options&&(options={}),this._pendingTimers=new Map,this.options=Object.assign({},__$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__$1,options),this._observer=null,this._init();}var _proto=ImageLazyLoader.prototype;return _proto._init=function(){var _this=this;ImageLazyLoader.isSupported&&(this._observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){var target=entry.target;if(entry.isIntersecting){if(_this._pendingTimers.has(target))return;var timer=setTimeout(function(){var _this__observer;_this._pendingTimers.delete(target),_this._loadImage(target),null==(_this__observer=_this._observer)||_this__observer.unobserve(target);},_this.options.dwell);_this._pendingTimers.set(target,timer);}else {var timer1=_this._pendingTimers.get(target);void 0!==timer1&&(clearTimeout(timer1),_this._pendingTimers.delete(target));}});},this.options)),this.addImages(this.options.targets);},_proto._loadImage=function(img){var _img_classList,_img_classList1,_img_classList2,_this=this;if(img&&!(null==(_img_classList=img.classList)?void 0:_img_classList.contains(this.options.loadingClass))&&!(null==(_img_classList1=img.classList)?void 0:_img_classList1.contains(this.options.loadedClass))&&!(null==(_img_classList2=img.classList)?void 0:_img_classList2.contains(this.options.loadedErrorClass))&&img.hasAttribute("data-src")){var _this1=this;img.classList.add(this.options.loadingClass);var tempImg=new Image;tempImg.onload=function(){img.src=img.dataset.src,img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedClass),img.dispatchEvent(new Event("lazyloaded"));},tempImg.onerror=function(){img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedErrorClass),null==_this1.options.onLoadError||_this1.options.onLoadError.call(_this1.options,img);},tempImg.src=img.dataset.src;}},_proto.addImages=function(targets){var _this=this;(null==targets?void 0:targets.length)&&targets.forEach(function(target){var _this__observer;(null==target?void 0:target.hasAttribute("data-src"))&&(ImageLazyLoader.isSupported&&_this._observer?null==(_this__observer=_this._observer)||_this__observer.observe(target):_this._loadImage(target));});},_proto.destroy=function(){this._pendingTimers.forEach(function(timer){return clearTimeout(timer)}),this._pendingTimers.clear(),this._observer&&(this._observer.disconnect(),this._observer=null);},ImageLazyLoader}();function _create_class$1$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}ImageLazyLoader$1.isSupported="IntersectionObserver"in window;var _PREFIX_$1="ez-rec-list-modal-checkbox",Checkbox=function(){function Checkbox(options){var _options_checked,_options_disabled,_options_label,_options_size;void 0===options&&(options={}),this._$label=null,this._destroyed=false,this.options={checked:null!=(_options_checked=options.checked)&&_options_checked,disabled:null!=(_options_disabled=options.disabled)&&_options_disabled,label:null!=(_options_label=options.label)?_options_label:"",size:null!=(_options_size=options.size)?_options_size:16,onChange:options.onChange},this._onChange=this._onChange.bind(this),this._$root=document.createElement("label"),this._$root.className=_PREFIX_$1,this._$root.style.setProperty("--ez-rec-list-modal-checkbox-size",this.options.size+"px"),this._$input=document.createElement("input"),this._$input.type="checkbox",this._$input.className=_PREFIX_$1+"-input",this._$input.checked=this.options.checked,this._$input.disabled=this.options.disabled,this._$input.addEventListener("change",this._onChange),this._$root.appendChild(this._$input),this._$box=document.createElement("span"),this._$box.className=_PREFIX_$1+"-box",this._$box.innerHTML='<span class="'+_PREFIX_$1+'-check"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3.5 8.4 6.4 11.3 12.5 4.9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>',this._$root.appendChild(this._$box),this.options.label&&(this._$label=document.createElement("span"),this._$label.className=_PREFIX_$1+"-label",this._$label.textContent=this.options.label,this._$root.appendChild(this._$label)),this._syncState();}var _proto=Checkbox.prototype;return _proto.setChecked=function(checked,emit){ void 0===emit&&(emit=false),this._$input.checked!==checked&&(this._$input.checked=checked,this._syncState(),emit&&(null==this.options.onChange||this.options.onChange.call(this.options,checked)));},_proto.setDisabled=function(disabled){this.options.disabled=disabled,this._$input.disabled=disabled,this._syncState();},_proto.setLabel=function(label){this.options.label=label,label?(this._$label||(this._$label=document.createElement("span"),this._$label.className=_PREFIX_$1+"-label",this._$root.appendChild(this._$label)),this._$label.textContent=label):this._$label&&(this._$label.remove(),this._$label=null);},_proto.destroy=function(){this._destroyed||(this._destroyed=true,this._$input.removeEventListener("change",this._onChange),this._$root.remove());},_proto._onChange=function(){this._syncState(),null==this.options.onChange||this.options.onChange.call(this.options,this._$input.checked);},_proto._syncState=function(){this._$root.classList.toggle(_PREFIX_$1+"-checked",this._$input.checked),this._$root.classList.toggle(_PREFIX_$1+"-disabled",this.options.disabled);},_create_class$1$2(Checkbox,[{key:"el",get:function(){return this._$root}},{key:"checked",get:function(){return this._$input.checked}}]),Checkbox}(),_$REC_EVENT_ICONS$__playing='<svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="playing">\n <rect x="1.5" y="7" width="3" height="7.5" rx="1.5"/>\n <rect x="6.5" y="3" width="3" height="11.5" rx="1.5"/>\n <rect x="11" y="5.5" width="3" height="9" rx="1.5"/>\n </svg>',_$REC_EVENT_ICONS$__humanDetection='<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="humanDetection">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.42689 10.122L5.78846 9.81738C5.5102 9.68459 5.33301 9.4037 5.33301 9.09537V6.6667C5.33301 6.22487 5.69118 5.8667 6.13301 5.8667H9.86634C10.3082 5.8667 10.6663 6.22487 10.6663 6.6667V9.10694C10.6663 9.40926 10.4959 9.68576 10.2258 9.82162L9.62858 10.122H6.42689Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M8.00039 2.1333C8.88405 2.1333 9.60039 2.84965 9.60039 3.7333C9.60039 4.61696 8.88405 5.3333 8.00039 5.3333C7.11674 5.3333 6.40039 4.61696 6.40039 3.7333C6.40039 2.84965 7.11674 2.1333 8.00039 2.1333Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M8.80039 9.06689C9.24222 9.06689 9.60039 9.42507 9.60039 9.8669V13.0669C9.60039 13.5087 9.24222 13.8669 8.80039 13.8669H7.20039C6.75856 13.8669 6.40039 13.5087 6.40039 13.0669V9.8669C6.40039 9.42507 6.75856 9.06689 7.20039 9.06689H8.80039Z" fill="currentColor"/>\n <path d="M4.26628 2.6665H2.93294C2.19694 2.6665 1.59961 3.26325 1.59961 3.99984V5.33317" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M1.59961 10.6665V11.9998C1.59961 12.7358 2.19694 13.3332 2.93294 13.3332H4.26628" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M11.7334 13.3332H13.0667C13.8033 13.3332 14.4001 12.7358 14.4001 11.9998V10.6665" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M14.4001 5.33317V3.99984C14.4001 3.26325 13.8033 2.6665 13.0667 2.6665H11.7334" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>',_$REC_EVENT_ICONS$__vehicleDetection='<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="vehicleDetection">\n <path d="M14.2522 6.62695L12.6147 7.25195" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M3.39233 7.25L1.74854 6.625" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M12.6116 7.25L12.0872 4.7425C11.9354 4.01875 11.2972 3.5 10.5572 3.5H5.50722C4.7816 3.5 4.15098 4 3.98598 4.70687L3.3916 7.25" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M12.375 7.25098C13.4106 7.25098 14.25 8.09035 14.25 9.12598V12.1523C14.247 12.3407 11.125 11.9375 11.125 11.9375H4.875C4.875 11.9375 1.7522 12.4275 1.75 12.2822V9.12598C1.75 8.09035 2.58938 7.25098 3.625 7.25098H12.375ZM4.09375 9.28125L4.03027 9.28516C3.80148 9.3162 3.625 9.51269 3.625 9.75C3.625 10.0089 3.83487 10.2188 4.09375 10.2188H5.65625L5.71973 10.2148C5.94852 10.1838 6.125 9.98731 6.125 9.75C6.125 9.49112 5.91513 9.28125 5.65625 9.28125H4.09375ZM10.2803 9.28516C10.0515 9.3162 9.875 9.51269 9.875 9.75C9.875 10.0089 10.0849 10.2188 10.3438 10.2188H11.9062L11.9697 10.2148C12.1985 10.1838 12.375 9.98731 12.375 9.75C12.375 9.49112 12.1651 9.28125 11.9062 9.28125H10.3438L10.2803 9.28516Z" fill="currentColor"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M14.25 9.125C14.25 8.08938 13.4106 7.25 12.375 7.25H3.625C2.58938 7.25 1.75 8.08938 1.75 9.125V12.0373H14.25V9.125V9.125Z" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5625 13.4998C5.08 13.4998 5.5 13.0798 5.5 12.5623V11.9373L2.375 11.875V12.7185C2.375 13.1498 2.725 13.4998 3.15625 13.4998H4.5625Z" fill="currentColor" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M12.6877 13.4998C13.2052 13.4998 13.6252 13.0798 13.6252 12.5623V11.9373L10.5002 11.875V12.7185C10.5002 13.1498 10.8502 13.4998 11.2815 13.4998H12.6877Z" fill="currentColor" stroke="currentColor" stroke-width="0.9375" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>',_$REC_EVENT_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',_$REC_LIST_MODAL_LOCALES$_={zh:{title:"录像片段",empty:"暂无录像",eventFilter:"事件片段"},en:{title:"Recordings",empty:"No recordings",eventFilter:"Event"}};function _create_class$8(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$e(){return _extends$e=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$e.apply(this,arguments)}function _set_prototype_of$f(o,p){return _set_prototype_of$f=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$f(o,p)}var _PREFIX_="ez-rec-list-modal",_ICON_EVENT_='<svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M11.5 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1v-11a1 1 0 0 0-1-1Zm0 1.1v10.8h-7V2.6h7ZM6 5.2h4v-1H6v1Zm0 2.3h4v-1H6v1Zm0 2.3h2.7v-1H6v1Z"/></svg>',_REC_EVENT_ICONS_={1:_ICON_EVENT_,2:_ICON_EVENT_,3:_$REC_EVENT_ICONS$__humanDetection,4:'<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="faceDetection">\n <path d="M4.26628 2.66602H2.93294C2.19694 2.66602 1.59961 3.26276 1.59961 3.99935V5.33268" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M1.59961 10.666V11.9993C1.59961 12.7353 2.19694 13.3327 2.93294 13.3327H4.26628" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M11.7334 13.3327H13.0667C13.8033 13.3327 14.4001 12.7353 14.4001 11.9993V10.666" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M14.4001 5.33268V3.99935C14.4001 3.26276 13.8033 2.66602 13.0667 2.66602H11.7334" stroke="currentColor" stroke-opacity="0.6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.26636 8.53273C4.26636 8.53273 3.74805 8.7145 3.74805 9.32262C3.74805 9.93074 4.12968 10.4493 4.62191 10.4493C4.73317 10.9272 5.97651 13.0867 8.08858 13.0867C10.0905 13.0867 11.5552 10.3969 11.5552 10.3969C11.5552 10.3969 12.2716 10.1395 12.2518 9.32262C12.2325 8.69788 11.7965 8.53273 11.7965 8.53273C11.7965 8.53273 12.1055 5.56552 9.99785 4.3185C7.89022 3.07148 6.36571 4.5319 6.36571 4.5319C6.36571 4.5319 4.11766 4.87602 4.2222 7.69628" fill="currentColor"/>\n </svg>',5:_$REC_EVENT_ICONS$__vehicleDetection,6:'<svg viewBox="0 0 16 16" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="petDetection">\n <path d="M10.134 2.66309C11.9012 2.66316 13.3341 4.09615 13.3342 5.86328V10.6641C13.334 12.4311 11.9011 13.8632 10.134 13.8633H5.86743C4.10029 13.8633 2.6675 12.4311 2.66724 10.6641V5.86328C2.66739 4.09611 4.10022 2.66309 5.86743 2.66309H10.134ZM7.97583 7.95312C7.5222 7.95327 7.15454 8.32075 7.15454 8.77441C7.15459 9.07899 7.32174 9.34112 7.56763 9.4834C7.5526 9.52337 7.54321 9.56694 7.54321 9.6123C7.54296 10.2798 6.9996 10.8223 6.33228 10.8223C6.13114 10.8224 5.96802 10.9863 5.96802 11.1875C5.96822 11.3882 6.13127 11.5516 6.33228 11.5518C7.0251 11.5518 7.63284 11.185 7.97583 10.6367C8.31908 11.1851 8.92713 11.5518 9.62036 11.5518C9.82129 11.5516 9.98442 11.3881 9.98462 11.1875C9.98462 10.9864 9.8214 10.8225 9.62036 10.8223C8.95273 10.8223 8.4087 10.2798 8.40845 9.6123C8.40845 9.56694 8.39906 9.52337 8.38403 9.4834C8.63004 9.34115 8.79805 9.07907 8.7981 8.77441C8.7981 8.32066 8.42989 7.95312 7.97583 7.95312ZM5.06665 5.87207C4.62483 5.87226 4.26685 6.23032 4.26685 6.67188C4.26708 7.11353 4.62497 7.47149 5.06665 7.47168C5.50818 7.47168 5.86622 7.11365 5.86646 6.67188C5.86646 6.2302 5.50832 5.87207 5.06665 5.87207ZM10.9338 5.87207C10.492 5.87226 10.134 6.23032 10.134 6.67188C10.1343 7.11353 10.4922 7.47149 10.9338 7.47168C11.3754 7.47168 11.7334 7.11365 11.7336 6.67188C11.7336 6.2302 11.3755 5.87207 10.9338 5.87207Z" fill="currentColor"/>\n <path d="M12.8 4.08984C12.9449 4.28499 13.0671 4.49562 13.1633 4.71777L15.1584 8.09668C15.4833 8.64759 15.5543 9.28148 15.3577 9.88086C15.1613 10.4797 14.7204 10.9735 14.1174 11.2705C13.8537 11.4002 13.4576 11.4741 13.1633 11.5137C13.0759 11.7889 12.9522 12.0484 12.8 12.2891V4.08984Z" fill="currentColor" fill-opacity="0.6"/>\n <path d="M3.19946 12.4372C3.05452 12.242 2.93249 12.0315 2.83618 11.8093L0.841064 8.43039C0.51612 7.87943 0.44519 7.24568 0.641846 6.64621C0.838188 6.04713 1.27893 5.5536 1.88208 5.25656C2.14581 5.12684 2.54188 5.05303 2.83618 5.0134C2.92354 4.73812 3.04729 4.47872 3.19946 4.23801L3.19946 12.4372Z" fill="currentColor" fill-opacity="0.6"/>\n </svg>',ALRAM:_ICON_EVENT_,TIMIING:_ICON_EVENT_,CAR:_$REC_EVENT_ICONS$__vehicleDetection,HD:_$REC_EVENT_ICONS$__humanDetection},_$REC_LIST_MODAL_DEFAULT_OPTIONS$_={width:260,height:490,buffer:5,startTimeFormat:"HH:mm",groupTitleFormat:"HH:00",showEventFilter:false,showCardTypeIcon:false,eventFilterChecked:false},RecListModal=function(Modal){function RecListModal(container,options){var _this,_ref,_ref1,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8,_ref9;(_this=Modal.call(this,container,RecListModal._mergeModalOptions(options))||this)._$titleWrap=null,_this._eventCheckbox=null,_this._virtualScroll=null,_this._lazyLoader=null,_this._rows=[],_this._sortedSections=[],_this._eventOnly=false,_this._vsInited=false,_this._recordDestroyed=false,_this._activeIndex=-1,_this._userInteracting=false,_this._userScrollTimer=null;var def=_$REC_LIST_MODAL_DEFAULT_OPTIONS$_;return _this._recI18n=new I18n(deepmerge(_$REC_LIST_MODAL_LOCALES$_,_this.options.locales||{},{clone:false}),{defaultLocale:_this.options.language||"zh"}),_this.recordOptions={sections:null!=(_ref=null==options?void 0:options.sections)?_ref:[],buffer:null!=(_ref1=null==options?void 0:options.buffer)?_ref1:def.buffer,coverQuery:null!=(_ref2=null==options?void 0:options.coverQuery)?_ref2:"",startTimeFormat:null!=(_ref3=null==options?void 0:options.startTimeFormat)?_ref3:def.startTimeFormat,groupTitleFormat:null!=(_ref4=null==options?void 0:options.groupTitleFormat)?_ref4:def.groupTitleFormat,emptyText:null!=(_ref5=null==options?void 0:options.emptyText)?_ref5:String(_this._recI18n.t("empty")),showEventFilter:null!=(_ref6=null==options?void 0:options.showEventFilter)?_ref6:def.showEventFilter,eventFilterText:null!=(_ref7=null==options?void 0:options.eventFilterText)?_ref7:String(_this._recI18n.t("eventFilter")),eventFilterChecked:null!=(_ref8=null==options?void 0:options.eventFilterChecked)?_ref8:def.eventFilterChecked,showCardTypeIcon:null!=(_ref9=null==options?void 0:options.showCardTypeIcon)?_ref9:def.showCardTypeIcon,isEvent:null==options?void 0:options.isEvent,renderCardIcon:null==options?void 0:options.renderCardIcon,onCardClick:null==options?void 0:options.onCardClick},_this._eventOnly=_this.recordOptions.eventFilterChecked,_this._activeTime="number"==typeof(null==options?void 0:options.activeTime)?options.activeTime:void 0,_this._titleText="string"==typeof(null==options?void 0:options.title)?options.title:String(_this._recI18n.t("title")),_this.setTitle(_this._buildHeaderTitle()),_this._$listRoot=document.createElement("div"),_this._$listRoot.className=_PREFIX_+"-list",_this._$empty=document.createElement("div"),_this._$empty.className=_PREFIX_+"-empty",_this._$empty.textContent=_this.recordOptions.emptyText,_this._$empty.style.display="none",_this._$listRoot.appendChild(_this._$empty),_this.setContent(_this._$listRoot),_this._onListClick=_this._onListClick.bind(_this),_this._onUserScroll=_this._onUserScroll.bind(_this),_this._$listRoot.addEventListener("click",_this._onListClick),_this._buildRows(),_this.isVisible()&&_this._ensureVirtualScroll(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$f(subClass,superClass);}(RecListModal,Modal);var _proto=RecListModal.prototype;return _proto.open=function(){Modal.prototype.open.call(this),this._$listRoot&&(this._ensureVirtualScroll(),this._userInteracting=false,this._userScrollTimer&&(clearTimeout(this._userScrollTimer),this._userScrollTimer=null),this._scrollToActive(true));},_proto.setSections=function(sections){this.recordOptions.sections=sections||[],this._buildRows(),this._virtualScroll?this._virtualScroll.setData(this._rows):this.isVisible()&&this._ensureVirtualScroll(),this._toggleEmpty();},_proto.setActiveTime=function(time){this._activeTime="number"==typeof time?time:void 0,this._refreshActiveState(),this._scrollToActive();},_proto.showEventFilter=function(show){var _this=this;if(this.recordOptions.showEventFilter=show,show){var _this__$titleWrap;if(this._eventCheckbox)return;var checkbox=new Checkbox({label:this.recordOptions.eventFilterText,checked:this._eventOnly,onChange:function(checked){return _this._onEventFilterChange(checked)}});checkbox.el.addEventListener("mousedown",function(e){return e.stopPropagation()}),checkbox.el.addEventListener("touchstart",function(e){return e.stopPropagation()}),null==(_this__$titleWrap=this._$titleWrap)||_this__$titleWrap.appendChild(checkbox.el),this._eventCheckbox=checkbox;}else {if(!this._eventCheckbox)return;this._eventCheckbox.destroy(),this._eventCheckbox=null;}},_proto.destroy=function(){var _this__eventCheckbox,_this__virtualScroll,_this__lazyLoader;this._recordDestroyed||(this._recordDestroyed=true,null==(_this__eventCheckbox=this._eventCheckbox)||_this__eventCheckbox.destroy(),this._eventCheckbox=null,this._userScrollTimer&&(clearTimeout(this._userScrollTimer),this._userScrollTimer=null),this._$listRoot.removeEventListener("click",this._onListClick),this._$listRoot.removeEventListener("wheel",this._onUserScroll),this._$listRoot.removeEventListener("touchmove",this._onUserScroll),null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.destroy(),this._virtualScroll=null,null==(_this__lazyLoader=this._lazyLoader)||_this__lazyLoader.destroy(),this._lazyLoader=null),Modal.prototype.destroy.call(this);},_proto._rowHeight=function(row){return row&&"header"===row.type?28:this._cardRowHeight},_proto._buildHeaderTitle=function(){var _this=this,wrap=document.createElement("div");wrap.className=_PREFIX_+"-title",this._$titleWrap=wrap;var text=document.createElement("span");if(text.className=_PREFIX_+"-title-text",text.textContent=this._titleText,wrap.appendChild(text),this.recordOptions.showEventFilter){var checkbox=new Checkbox({label:this.recordOptions.eventFilterText,checked:this._eventOnly,onChange:function(checked){return _this._onEventFilterChange(checked)}});checkbox.el.addEventListener("mousedown",function(e){return e.stopPropagation()}),checkbox.el.addEventListener("touchstart",function(e){return e.stopPropagation()}),wrap.appendChild(checkbox.el),this._eventCheckbox=checkbox;}return wrap},_proto._onEventFilterChange=function(checked){var _this__virtualScroll;this._eventOnly=checked,this._buildRows(),null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.setData(this._rows),this._toggleEmpty();},_proto._ensureVirtualScroll=function(){var _this__virtualScroll,_this=this;this._recordDestroyed||(this._toggleEmpty(),this._vsInited?(null==(_this__virtualScroll=this._virtualScroll)||_this__virtualScroll.refresh(),this._observeVisibleImages()):(this._vsInited=true,this._lazyLoader=new ImageLazyLoader$1({root:this._$listRoot}),this._virtualScroll=new VirtualScroll(this._$listRoot,{data:this._rows,itemHeight:function(_index,row){return _this._rowHeight(row)},buffer:this.recordOptions.buffer,renderItem:function(index,item){return _this._renderRow(index,item)},onRender:function(){return _this._observeVisibleImages()}}),this._observeVisibleImages(),this._$listRoot.addEventListener("wheel",this._onUserScroll,{passive:true}),this._$listRoot.addEventListener("touchmove",this._onUserScroll,{passive:true}),this._scrollToActive(true)));},_proto._toggleEmpty=function(){this._$empty&&(this._$empty.style.display=0===this._rows.length?"":"none");},_proto._isEvent=function(section){return "function"==typeof this.recordOptions.isEvent?this.recordOptions.isEvent(section):!!_REC_EVENT_ICONS_[section.EVENT_TYPE]},_proto._buildRows=function(){var _this=this;this._activeIndex=-1;var sorted=(this.recordOptions.sections||[]).filter(function(s){return s&&"number"==typeof s.startTime&&"number"==typeof s.endTime}).filter(function(s){return !_this._eventOnly||_this._isEvent(s)}).slice().reverse();this._sortedSections=sorted;for(var rows=[],groups=new Map,i=0;i<sorted.length;i++){var section=sorted[i],key=distExports$4.DateTime.format(section.startTime,"YYYY-MM-DD HH"),bucket=groups.get(key);bucket||(bucket=[],groups.set(key,bucket)),bucket.push({section:section,index:i});}groups.forEach(function(bucket){rows.push({type:"header",title:distExports$4.DateTime.format(bucket[0].section.startTime,_this.recordOptions.groupTitleFormat),count:bucket.length});for(var i=0;i<bucket.length;i+=2)rows.push({type:"cards",items:bucket.slice(i,i+2)});}),this._rows=rows;},_proto._renderRow=function(_index,row){var _this=this;if(!row)return "";if("header"===row.type)return '<div class="'+_PREFIX_+'-group">\n <span class="'+_PREFIX_+'-group-title">'+this._escape(row.title)+"</span>\n </div>";var cards=row.items.map(function(it){return _this._renderCard(it.section,it.index)}).join("");return '<div class="'+_PREFIX_+'-row">'+cards+"</div>"},_proto._renderCard=function(section,index){var start,end,_DateTime_toDate,_DateTime_toDate1,secondNum,second,minute,startText=distExports$4.DateTime.format(section.startTime,this.recordOptions.startTimeFormat),durationText=(start=section.startTime,end=section.endTime,secondNum=Math.floor((null==(_DateTime_toDate=distExports$4.DateTime.toDate(end))?void 0:_DateTime_toDate.getTime())-(null==(_DateTime_toDate1=distExports$4.DateTime.toDate(start))?void 0:_DateTime_toDate1.getTime()))/1e3,second=secondNum%60,((minute=Math.floor(secondNum/60))>0?distExports$4.DateTime.fillZero(minute)+"'":"0'")+distExports$4.DateTime.fillZero(second)+"''"),cover=section.coverPic?""+section.coverPic+this.recordOptions.coverQuery:"",media=cover?'<img class="'+_PREFIX_+'-card-img ez-lazy-image" data-src="'+this._setImageScr(this._escape(cover))+'" alt="" />':'<div class="'+_PREFIX_+'-card-placeholder">'+_$REC_EVENT_ICONS$__picture+"</div>",icon=this._renderCardIcon(section),activeCls=this._isActive(section)?" "+_PREFIX_+"-card-active":"";return '<div class="'+_PREFIX_+"-card"+activeCls+'" data-card-index="'+index+'">\n <div class="'+_PREFIX_+'-card-thumb">\n '+media+'\n <span class="'+_PREFIX_+'-card-start">'+this._escape(startText)+'</span>\n <span class="'+_PREFIX_+'-card-duration">'+this._escape(durationText)+'</span>\n <span class="'+_PREFIX_+'-card-playing">'+_$REC_EVENT_ICONS$__playing+"</span>\n "+icon+"\n </div>\n </div>"},_proto._isActive=function(section){var t=this._activeTime;return "number"==typeof t&&t>=section.startTime&&t<=section.endTime},_proto._refreshActiveState=function(){var _this=this;this._$listRoot.querySelectorAll("."+_PREFIX_+"-card").forEach(function(card){var idx=Number(card.getAttribute("data-card-index")),section=_this._sortedSections[idx];card.classList.toggle(_PREFIX_+"-card-active",!!section&&_this._isActive(section));});},_proto._findActiveIndex=function(){if("number"!=typeof this._activeTime)return -1;for(var i=0;i<this._sortedSections.length;i++)if(this._isActive(this._sortedSections[i]))return i;return -1},_proto._rowIndexOfSection=function(sectionIndex){for(var i=0;i<this._rows.length;i++){var row=this._rows[i];if("cards"===row.type&&row.items.some(function(it){return it.index===sectionIndex}))return i}return -1},_proto._scrollToActive=function(force){ void 0===force&&(force=false);var idx=this._findActiveIndex();if((force||idx!==this._activeIndex)&&(this._activeIndex=idx,!(idx<0||!this._virtualScroll||!force&&this._userInteracting))){var rowIndex=this._rowIndexOfSection(idx);rowIndex>=0&&this._virtualScroll.scrollToIndex(rowIndex,true);}},_proto._onUserScroll=function(){var _this=this;this._userInteracting=true,this._userScrollTimer&&clearTimeout(this._userScrollTimer),this._userScrollTimer=setTimeout(function(){_this._userInteracting=false,_this._userScrollTimer=null;},3e3);},_proto._renderCardIcon=function(section){return ""},_proto._observeVisibleImages=function(){if(this._lazyLoader){var imgs=this._$listRoot.querySelectorAll("img[data-src]");imgs.length&&this._lazyLoader.addImages(Array.from(imgs));}},_proto._onListClick=function(e){var onCardClick=this.recordOptions.onCardClick;if(onCardClick){var target=e.target,card=null==target?void 0:target.closest("."+_PREFIX_+"-card");if(card){var idx=Number(card.getAttribute("data-card-index")),section=this._sortedSections[idx];section&&onCardClick(section,idx,this._sortedSections);}}},_proto._escape=function(text){return String(text).replace(/[&<>"']/g,function(ch){switch(ch){case "&":return "&";case "<":return "<";case ">":return ">";case '"':return """;default:return "'"}})},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},RecListModal._mergeModalOptions=function(options){var _ref,_ref1;return _extends$e({},options,{width:null!=(_ref=null==options?void 0:options.width)?_ref:_$REC_LIST_MODAL_DEFAULT_OPTIONS$_.width,height:null!=(_ref1=null==options?void 0:options.height)?_ref1:_$REC_LIST_MODAL_DEFAULT_OPTIONS$_.height,content:"",title:""})},_create_class$8(RecListModal,[{key:"_cardRowHeight",get:function(){return 70}}]),RecListModal}(Modal);RecListModal.VERSION="0.0.1-beta.6";
|
|
9271
9286
|
|
|
9272
9287
|
function _extends$d() {
|
|
9273
9288
|
_extends$d = Object.assign || function(target) {
|
|
@@ -10098,12 +10113,32 @@
|
|
|
10098
10113
|
return Speed;
|
|
10099
10114
|
}(Select);
|
|
10100
10115
|
|
|
10116
|
+
var dist$1 = {};
|
|
10117
|
+
|
|
10118
|
+
/*
|
|
10119
|
+
* @ezuikit/utils-tools v2.0.2
|
|
10120
|
+
* tools utils
|
|
10121
|
+
* Copyright (c) 2026-01-07 Ezviz-OpenBiz
|
|
10122
|
+
* Released under the MIT License.
|
|
10123
|
+
*/
|
|
10124
|
+
|
|
10125
|
+
var hasRequiredDist$1;
|
|
10126
|
+
|
|
10127
|
+
function requireDist$1 () {
|
|
10128
|
+
if (hasRequiredDist$1) return dist$1;
|
|
10129
|
+
hasRequiredDist$1 = 1;
|
|
10130
|
+
var getQuery=function(url){var query=url.split("?")[1],obj={};if(query)for(var vars=query.split("&"),i=0;i<vars.length;i++){var pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}return obj};function parseEzopenUrl(url){var obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){var 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;var 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 {}}var codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(+str.slice(0,4),+str.slice(5,7)-1,+str.slice(8,10),0,0,0):/^\d{8}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),0,0,0)):/^\d{14}$/.test(str)?(str+="",new Date(+str.slice(0,4),+str.slice(4,6)-1,+str.slice(6,8),+str.slice(8,10),+str.slice(10,12),+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$1.DateTime=DateTime,dist$1.addVc=function(url,codecs){ void 0===codecs&&(codecs=["h264"]);var vc=(codecs||["h264"]).reduce(function(acc,key){return key=key.toLowerCase(),acc+(codec[key]||0)},0),host=url.split("?")[0],query=url.split("?")[1];return query=(query||"").split("&").filter(function(item){return !/^vc=\d?/.test(item)}).join("&"),host+"?"+(query+=(query?"&":"")+"vc="+vc)},dist$1.getQuery=getQuery,dist$1.getStaticPath=function(path,base){ void 0===base&&(base="");var 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$1.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$1.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(agent||(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$1.isRealMobile=function(agent){var _navigator,ua=(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent).toLowerCase();if(/ipad|tablet|playbook|silk|android(?!.*mobile)/i.test(ua))return false;var hasTouch="ontouchstart"in window||navigator.maxTouchPoints>0;return /android|webos|iphone|ipod|blackberry|iemobile|opera mini/i.test(ua)&&hasTouch},dist$1.parseEzopenUrl=parseEzopenUrl,dist$1.pick=function(obj,keys){return Object.entries(obj).reduce(function(acc,param){var key=param[0],value=param[1];return keys.includes(key)&&(acc[key]=value),acc},{})},dist$1.switchEzopenUrl=function(url,options){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);if(search){var ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(function(acc,param){var key=param[0],value=param[1];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};
|
|
10131
|
+
return dist$1;
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10134
|
+
var distExports$1 = requireDist$1();
|
|
10135
|
+
|
|
10101
10136
|
/*
|
|
10102
10137
|
* @ezuikit/control-date-picker v2.1.0-beta.1
|
|
10103
10138
|
* Copyright (c) 2026-06-24 Ezviz-OpenBiz
|
|
10104
10139
|
* Released under the MIT License.
|
|
10105
10140
|
*/
|
|
10106
|
-
var Util=function(){function Util(){}return Util.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},Util.chunkBySize=function(arr,size){return Array.from({length:Math.ceil(arr.length/size)}).map(function(_,index){return arr.slice(index*size,(index+1)*size)})},Util.generateYears=function(year){for(var years=[],i=year%10+1;i>=0;i--)years.push(year-i);for(var i1=1;years.length<12;i1++)years.push(year+i1);return years},Util.getDaysInMonth=function(year,month){return new Date(year,month+1,0).getDate()},Util.getFirstDayOfMonth=function(year,month,startOfWeek){return void 0===startOfWeek&&(startOfWeek=0),(new Date(year,month).getDay()-startOfWeek+7)%7},Util.generateWeeksByYearMonth=function(year,month,startOfWeek){ void 0===startOfWeek&&(startOfWeek=0),month-=1;for(var daysInMonth=Util.getDaysInMonth(year,month),firstDay=Util.getFirstDayOfMonth(year,month,startOfWeek),weeks=[],i=1;i<=firstDay+daysInMonth;i++){var day=i-firstDay;day<1?weeks.push((0===month?year-1:year)+"-"+Util.fillZero((month+12-1)%12+1)+"-"+Util.fillZero(Util.getDaysInMonth(year,month-1)+day)):day>daysInMonth?weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+(day-daysInMonth)):weeks.push(year+"-"+Util.fillZero(month+1)+"-"+Util.fillZero(day));}for(var nextDay=1;weeks.length<42;)weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+Util.fillZero(nextDay++));return weeks},Util.generateHours=function(){for(var hours=[],i=0;i<24;i++)hours.push(Util.fillZero(i));return hours},Util.generateMinutesOrSeconds=function(){for(var hours=[],i=0;i<=59;i++)hours.push(Util.fillZero(i));return hours},Util}(),__$CALENDAR_LOCALES$__={en:{year:"",month:"",weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",ok:"OK",now:"Now",cancel:"Cancel",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},zh:{year:"年",month:"月",weeks:["日","一","二","三","四","五","六"],today:"今天",ok:"确定",now:"此刻",cancel:"取消",months:["01","02","03","04","05","06","07","08","09","10","11","12"]}},__DEFAULT_COMPONENTS_OPTIONS__={showSuperPrevIcon:false,showSuperNextIcon:false,showPrevIcon:false,showNextIcon:false,showHeaderClose:false,showHeaderOk:false,renderSuperPrevIcon:'<span class="edate-super-prev-icon"></span>',renderSuperNextIcon:'<span class="edate-super-next-icon"></span>',renderPrevIcon:'<span class="edate-prev-icon"></span>',renderNextIcon:'<span class="edate-next-icon"></span>',renderHeaderCloseIcon:'<span class="edate-close-icon">\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n </span>',renderHeaderOkIcon:function(locale){return '<span class="edate-btn-text">'+((null==locale?void 0:locale.ok)||"确定")+"</span>"}},Header=function(){function Header(options){this.$header=null,this._delegations=[],this.options=deepmerge.all([{},__DEFAULT_COMPONENTS_OPTIONS__,options],{clone:false}),this.$header=document.createElement("div"),this.$header.classList.add("edate-header",options.prefixCls+"-header"),options.className&&this.$header.classList.add(options.className),this._render(),this._eventListeners();}var _proto=Header.prototype;return _proto._render=function(){var _this__getStrOrFunToStr,_this__getStrOrFunToStr1,_this__getStrOrFunToStr2,_this__getStrOrFunToStr3,_this__getStrOrFunToStr4,_this__getStrOrFunToStr5;this.$header&&(this.$header.innerHTML="\n "+(this.options.showHeaderClose?'<div class="edate-close-btn">\n '+(null!=(_this__getStrOrFunToStr=this._getStrOrFunToStr(this.options.renderHeaderCloseIcon))?_this__getStrOrFunToStr:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderCloseIcon)+"\n </div>":this.options.showHeaderOk?"<span></span>":"")+"\n "+(this.options.showSuperPrevIcon||this.options.showPrevIcon?'\n <div class="edate-prev-btns">\n '+(this.options.showSuperPrevIcon?'<div class="edate-super-prev-btn '+this.options.prefixCls+'-super-prev-btn">\n '+(null!=(_this__getStrOrFunToStr1=this._getStrOrFunToStr(this.options.renderSuperPrevIcon))?_this__getStrOrFunToStr1:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperPrevIcon)+"\n </div>":"")+"\n "+(this.options.showPrevIcon?'<div class="edate-prev-btn '+this.options.prefixCls+'-prev-btn">\n '+(null!=(_this__getStrOrFunToStr2=this._getStrOrFunToStr(this.options.renderPrevIcon))?_this__getStrOrFunToStr2:__DEFAULT_COMPONENTS_OPTIONS__.renderPrevIcon)+"\n </div>":"")+"\n </div>\n ":"")+'\n\n <div class="edate-header-view '+this.options.prefixCls+'-header-view"></div>\n\n '+(this.options.showNextIcon||this.options.showSuperNextIcon?'\n <div class="edate-next-btns">\n '+(this.options.showNextIcon?'<div class="edate-next-btn '+this.options.prefixCls+'-next-btn">\n '+(null!=(_this__getStrOrFunToStr3=this._getStrOrFunToStr(this.options.renderNextIcon))?_this__getStrOrFunToStr3:__DEFAULT_COMPONENTS_OPTIONS__.renderNextIcon)+"\n </div>":"")+"\n "+(this.options.showSuperNextIcon?'<div class="edate-super-next-btn '+this.options.prefixCls+'-super-next-btn">\n '+(null!=(_this__getStrOrFunToStr4=this._getStrOrFunToStr(this.options.renderSuperNextIcon))?_this__getStrOrFunToStr4:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperNextIcon)+"\n </div>":"")+"\n </div>\n ":"")+"\n "+(this.options.showHeaderOk?'<div class="edate-ok-btn">\n '+(null!=(_this__getStrOrFunToStr5=this._getStrOrFunToStr(this.options.renderHeaderOkIcon))?_this__getStrOrFunToStr5:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderOkIcon)+"\n </div>":this.options.showHeaderClose?"<span></span>":""));},_proto._getStrOrFunToStr=function(value){if(null!=value){var _this_options;if("function"==typeof value)return this._getStrOrFunToStr(null==value?void 0:value(null==(_this_options=this.options)?void 0:_this_options.locale));if("string"==typeof value)return value}},_proto.renderContent=function(html){if(this.$header){var _$content=this.$header.querySelector(".edate-header-view");if(!_$content)return;_$content.innerHTML=html;}},_proto.destroy=function(){for(var i=0;i<this._delegations.length;i++)try{this._delegations[i].destroy();}catch(e){}this._delegations=[],this.$header&&(this.$header.remove(),this.$header=null);},_proto._eventListeners=function(){var _this=this;_this.$header&&(_this._delegations.push(delegate(_this.$header,".edate-super-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperPrev||_this.options.onSuperPrev.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onPrev||_this.options.onPrev.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onNext||_this.options.onNext.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-super-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperNext||_this.options.onSuperNext.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-close-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onClose||_this.options.onClose.call(_this.options),event.stopPropagation(),event.preventDefault());})),_this._delegations.push(delegate(_this.$header,".edate-ok-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onOk||_this.options.onOk.call(_this.options),event.stopPropagation(),event.preventDefault());})));},Header}();function _extends$3$1(){return _extends$3$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$3$1.apply(this,arguments)}var _CONTAINER_DEFAULT_OPTIONS_={prefixCls:"edate",locales:__$CALENDAR_LOCALES$__,showHeader:true},Container=function(){function Container(popupContainer,options){this.$panel=document.createElement("div"),this.$body=document.createElement("div"),this.$container=document.createElement("div"),this.language="zh",this.header=null,this._delegations=[],this.locale=__$CALENDAR_LOCALES$__.zh,this.options=deepmerge.all([{},_CONTAINER_DEFAULT_OPTIONS_,options],{clone:false}),this.$popupContainer=popupContainer?"function"==typeof popupContainer?popupContainer():popupContainer:document.body,this._setLocale(),this.$container.classList.add("edate-container",(this.options.prefixCls||"edate")+"-container"),options.isMobile&&this.$container.classList.add("edate-mobile",this.options.prefixCls+"-mobile"),this.options.wrapClassName&&this.$container.classList.add(this.options.wrapClassName),this.$panel.classList.add("edate-panel",(this.options.prefixCls||"edate")+"-panel"),this.options.showHeader&&(this.header=new Header(_extends$3$1({},this.options,{locale:this.locale,onPrev:this._onPrev.bind(this),onNext:this._onNext.bind(this),onSuperPrev:this._onSuperPrev.bind(this),onSuperNext:this._onSuperNext.bind(this),onClose:this._onClose.bind(this),onOk:this._onOk.bind(this)})),this.$panel.appendChild(this.header.$header)),this.$body.classList.add("edate-body",(this.options.prefixCls||"edate")+"-body"),this.$container.appendChild(this.$panel),this.$popupContainer.appendChild(this.$container);}var _proto=Container.prototype;return _proto._setLocale=function(){if(this.options.locales)if("string"==typeof this.options.language){var language=this.options.language||navigator.language;this.options.locales[language]?this.locale=this.options.locales[language]:this.locale=this.options.locales.zh;}else this.locale=this.options.locales.zh;},_proto._delegate=function(el,selector,type,cb,useCapture){var d=delegate(el,selector,type,cb,useCapture);return d&&"function"==typeof d.destroy&&this._delegations.push(d),d},_proto.destroy=function(){for(var _this_$container,i=0;i<this._delegations.length;i++)try{this._delegations[i].destroy();}catch(e){}this._delegations=[],this.header&&"function"==typeof this.header.destroy&&this.header.destroy(),(null==(_this_$container=this.$container)?void 0:_this_$container.parentNode)&&this.$container.parentNode.removeChild(this.$container),this.header=null,this.$container=null,this.$panel=null,this.$body=null;},_proto.setLocale=function(locale){"string"==typeof locale?this._setLocale():this.locale=locale;},_proto._onSuperPrev=function(){},_proto._onSuperNext=function(){},_proto._onPrev=function(){},_proto._onNext=function(){},_proto._onClose=function(){},_proto._onOk=function(){},Container}();function _create_class$5(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$2$1(){return _extends$2$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$2$1.apply(this,arguments)}function _set_prototype_of$5$1(o,p){return _set_prototype_of$5$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$5$1(o,p)}var _CALENDAR_DEFAULT_OPTIONS_={startOfWeek:0,showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,showPrevIcon:true,showNextIcon:true,language:"zh",renderBadge:'<span class="ecalendar-badge"></span>',badges:[]},Calendar=function(Container){function Calendar(container,options){var _this,_this_options_badges,_this_options,_this_options1,_this_options2;return (_this=Container.call(this,container,_extends$2$1({},_CALENDAR_DEFAULT_OPTIONS_,options,{prefixCls:"ecalendar"}))||this).badges=[],(null==(_this_options_badges=_this.options.badges)?void 0:_this_options_badges.length)&&_this._updateBadges(_this.options.badges,false),(null==(_this_options=_this.options)?void 0:_this_options.startOfWeek)&&((null==(_this_options1=_this.options)?void 0:_this_options1.startOfWeek)>6||(null==(_this_options2=_this.options)?void 0:_this_options2.startOfWeek)<0)&&(_this.options.startOfWeek=0),_this._render(),_this.setCurrent(_this.options.current,false),_this._onHeader(),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$5$1(subClass,superClass);}(Calendar,Container);var _proto=Calendar.prototype;return _proto.setCurrent=function(date,change){if(void 0===change&&(change=true),"string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{if(date="string"==typeof date?distExports$4.DateTime.toDate(date):date,(!this._current||distExports$4.DateTime.format(date,"YYYY-MM-DD")!==distExports$4.DateTime.format(this._current,"YYYY-MM-DD"))&&(this._current=date,change&&(null==this.options.onChange||this.options.onChange.call(this.options,date,distExports$4.DateTime.format(date,"YYYY-MM-DD"))),this.$body)){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-cell-selected"))||_this_$body_querySelector.classList.remove("ecalendar-cell-selected");var title=distExports$4.DateTime.format(this._current,"YYYY-MM-DD");null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-cell-in-view[title='"+title+"']"))||_this_$body_querySelector1.classList.add("ecalendar-cell-selected");}this._setRenderCurrent(this._current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto.updateBadges=function(badges){this._updateBadges(badges);},_proto._updateBadges=function(badges,rerender){ void 0===rerender&&(rerender=true),(null==badges?void 0:badges.length)>=0&&(this.badges=badges.map(function(date){return distExports$4.DateTime.format(date,"YYYY-MM-DD")}),rerender&&this._renderDate());},_proto._setRenderCurrent=function(date){(!this._renderCurrent||date&&distExports$4.DateTime.format(this._renderCurrent,"YYYY-MM")!==distExports$4.DateTime.format(date,"YYYY-MM"))&&(this._renderCurrent=date||new Date,this._renderDate());},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".ecalendar-cell","click",function(event){var date=new Date(event.delegateTarget.getAttribute("title").replace(/\//gi,"/")),disabled=event.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(date),null==_this.options.onCell||_this.options.onCell.call(_this.options,date,distExports$4.DateTime.format(_this._renderCurrent,"YYYY-MM-DD"),disabled),event.stopPropagation(),event.preventDefault();});},_proto._onSuperPrev=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()-1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()+1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onPrev=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()-1,date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onNext=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()+1,date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onHeader=function(){var _this=this;this._delegate(this.$panel,".ecalendar-header-month-btn","click",function(){null==_this.options.onMonth||_this.options.onMonth.call(_this.options,_this._current,_this._renderCurrent);}),this._delegate(this.$panel,".ecalendar-header-year-btn","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._render=function(){var _this_locale,_this_locale1,shiftedCustomDays=[].concat(((null==(_this_locale=this.locale)?void 0:_this_locale.weeks)||[]).slice(this.options.startOfWeek),((null==(_this_locale1=this.locale)?void 0:_this_locale1.weeks)||[]).slice(0,this.options.startOfWeek));this.$body.innerHTML='<table class="ecalendar-content">\n <thead><tr>'+shiftedCustomDays.map(function(day){return "<th>"+day+"</th>"}).join("")+"</tr></thead>\n <tbody></tbody>\n </table>",this.$panel.appendChild(this.$body);},_proto._renderDate=function(){var _this_header,_this_$body_querySelector,_this=this;if(this.$body){var _this_locale_months,_this_locale,_this_locale1,_this_locale2,_this_locale3,_this_locale_months1,_this_locale4,_this_locale5,_this_$body_querySelector1,todayStr=distExports$4.DateTime.format(new Date,"YYYY-MM-DD"),year=this._renderCurrent.getFullYear(),month=this._renderCurrent.getMonth()+1,dayGroupArray=Util.chunkBySize(Util.generateWeeksByYearMonth(year,month,this.options.startOfWeek),7),allowMonthClick="function"==typeof this.options.onMonth,allowYearClick="function"==typeof this.options.onYear;if(null==(_this_header=this.header)?void 0:_this_header.$header)this.header.renderContent("\n "+("zh"!==this.options.language?'<span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale=this.locale)||null==(_this_locale_months=_this_locale.months)?void 0:_this_locale_months[+(month-1)])+((null==(_this_locale1=this.locale)?void 0:_this_locale1.month)||"")+'</span> <span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale2=this.locale)?void 0:_this_locale2.year)||"")+"</span>":'<span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale3=this.locale)?void 0:_this_locale3.year)||"")+'</span> <span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale4=this.locale)||null==(_this_locale_months1=_this_locale4.months)?void 0:_this_locale_months1[+(month-1)])+((null==(_this_locale5=this.locale)?void 0:_this_locale5.month)||"")+"</span>"));if(null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector.querySelector("tbody"))(null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector1.querySelector("tbody")).innerHTML="\n "+dayGroupArray.slice(0,7).map(function(dates){return "<tr>\n "+dates.map(function(dateStr){var _this_options,_dateStr_split=dateStr.split("-"),y=_dateStr_split[0],m=_dateStr_split[1],d=_dateStr_split[2],date=new Date(+y,+m,+d),classNames=[month===+m?"ecalendar-cell-in-view":"",todayStr===dateStr?"ecalendar-cell-today":"",_this._current&&distExports$4.DateTime.format(_this._current,"YYYY-MM-DD")===dateStr?"ecalendar-cell-selected":"","function"==typeof(null==(_this_options=_this.options)?void 0:_this_options.disabledDate)&&_this.options.disabledDate(distExports$4.DateTime.toDate(dateStr),dateStr)?"edate-disabled":""].filter(Boolean),badgeHtml=_this._renderBadge(date,dateStr);return '<td title="'+dateStr+'" class="ecalendar-cell '+classNames.join(" ")+'">\n '+("function"==typeof _this.options.renderDate?_this.options.renderDate(date,dateStr):'<span class="ecalendar-cell-inner">'+Util.fillZero(+d)+"</span>")+"\n "+badgeHtml+"\n </td>"}).join("")+"\n </tr>"}).join("");}},_proto._renderBadge=function(date,dateStr){var badgeHtml="";badgeHtml="function"==typeof this.options.renderBadge?this.options.renderBadge(date,dateStr):"string"==typeof this.options.renderBadge?this.options.renderBadge:"";var showBadge="function"==typeof this.options.showBadge&&this.options.showBadge(date,dateStr);return this.badges.includes(dateStr)||showBadge||(badgeHtml=""),badgeHtml},_create_class$5(Calendar,[{key:"current",get:function(){return this._current}}]),Calendar}(Container);function _create_class$4(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$4$1(o,p){return _set_prototype_of$4$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$4$1(o,p)}Calendar.DateTime=distExports$4.DateTime;var _Month_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh"},Month=function(Container){function Month(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_Month_DEFAULT_OPTIONS_,options||{},{showPrevIcon:false,showNextIcon:false,prefixCls:"emonth"}],{clone:false}))||this)._render(),_this.setCurrent(_this.options.current,false),_this._onHeaderTitle(),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$4$1(subClass,superClass);}(Month,Container);var _proto=Month.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto._setCurrent=function(date,change){if("string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{var d=date;"string"==typeof d&&(d=distExports$4.DateTime.toDate(d));var current=d;this._current&&distExports$4.DateTime.format(current,"YYYY-MM-DD")===distExports$4.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=current,"function"==typeof this.options.onChange&&change&&(null==this.options.onChange||this.options.onChange.call(this.options,current,distExports$4.DateTime.format(current,"YYYY-MM")))),this._setRenderCurrent(current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto._setRenderCurrent=function(date){if((!this._renderCurrent||this._renderCurrent&&distExports$4.DateTime.format(date,"YYYY")!==distExports$4.DateTime.format(this._renderCurrent,"YYYY"))&&(this._renderCurrent=date,this._renderMonths(date.getFullYear())),this._current){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".emonth-cell-selected"))||_this_$body_querySelector.classList.remove("emonth-cell-selected");var selectedTitle=distExports$4.DateTime.format(this._current,"YYYY-MM");null==(_this_$body_querySelector1=this.$body.querySelector(".emonth-cell-in-view[title='"+selectedTitle+"']"))||_this_$body_querySelector1.classList.add("emonth-cell-selected");}this._setHeader();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".emonth-cell","click",function(e){e.stopPropagation(),e.preventDefault();var month=+e.delegateTarget.getAttribute("data-month"),newDate=distExports$4.DateTime.toDate(distExports$4.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setMonth(month-1);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,distExports$4.DateTime.format(newDate,"YYYY-MM"),disabled);});},_proto._onSuperPrev=function(){var year=this._renderCurrent.getFullYear()-1,date=distExports$4.DateTime.toDate(year+distExports$4.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperPrev||this.options.onSuperPrev.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var year=this._renderCurrent.getFullYear()+1,date=distExports$4.DateTime.toDate(year+distExports$4.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperNext||this.options.onSuperNext.call(this.options,this._current,this._renderCurrent);},_proto._onHeaderTitle=function(){var _this=this;this._delegate(this.$panel,".edate-header-title-hover","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._setHeader=function(){if(this.$panel.querySelector(".emonth-header-view")){var allowClick="function"==typeof this.options.onYear;this.$panel.querySelector(".emonth-header-view").innerHTML='<span class="'+(allowClick?"edate-header-title-hover":"")+'">'+this._renderCurrent.getFullYear()+this.locale.year+"</span>";}},_proto._setDisabled=function(){for(var year=this._renderCurrent.getFullYear(),i=0;i<12;i++){var $cell=this.$body.querySelector(".emonth-cell[title='"+year+"-"+Util.fillZero(i+1)+"']");if($cell){var date=distExports$4.DateTime.toDate(year+"-"+Util.fillZero(i+1)+"-"+distExports$4.DateTime.format(this._renderCurrent,"DDTHH:mm:ss"));"function"==typeof this.options.disabledMonth&&this.options.disabledMonth(date,distExports$4.DateTime.format(date,"YYYY-MM"))?$cell.classList.add("edate-disabled"):$cell.classList.remove("edate-disabled");}}},_proto._render=function(){this.$body.innerHTML='<table class="emonth-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderMonths=function(year){var _this=this;this.$body.querySelector(".emonth-content")&&(this.$body.querySelector(".emonth-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(this.locale.months,3).slice(0,4).map(function(month,index){return "<tr>\n "+month.map(function(m,i){return '<td title="'+year+"-"+Util.fillZero(3*index+i+1)+'" data-month="'+Util.fillZero(3*index+i+1)+'" class="emonth-cell emonth-cell-in-view">\n <span class="emonth-cell-inner">'+(_this.options.monthRender&&"function"==typeof _this.options.monthRender?_this.options.monthRender(distExports$4.DateTime.toDate(year+"-"+Util.fillZero(3*index+i+1)),year+"-"+Util.fillZero(3*index+i+1))||"":m)+"</span>\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>"),this._setDisabled();},_create_class$4(Month,[{key:"current",get:function(){return this._current}}]),Month}(Container);function _create_class$3$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$3$1(o,p){return _set_prototype_of$3$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$3$1(o,p)}var _YEAR_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh"},Year=function(Container){function Year(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_YEAR_DEFAULT_OPTIONS_,options||{},{prefixCls:"eyear",showPrevIcon:false,showNextIcon:false,renderPrevIcon:"",renderNextIcon:""}],{clone:false}))||this)._render(),_this._setCurrent(_this.options.current,false),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$3$1(subClass,superClass);}(Year,Container);var _proto=Year.prototype;return _proto.setCurrent=function(year,change){ void 0===change&&(change=true),this._setCurrent(year,change);},_proto._setCurrent=function(year,change){ void 0===change&&(change=true);var left,right,_year="number"==typeof year?distExports$4.DateTime.toDate(year):(left=year,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?year:new Date);this._current&&distExports$4.DateTime.format(_year,"YYYY-MM-DD")===distExports$4.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=_year,"function"==typeof this.options.onChange&&change&&this.options.onChange(_year)),this._renderTenYear=(this._current||new Date).getFullYear(),this._renderYearList();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".eyear-cell","click",function(e){var yearStr=+e.delegateTarget.getAttribute("title"),newDate=distExports$4.DateTime.toDate(distExports$4.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setFullYear(yearStr);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this._setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,distExports$4.DateTime.format(newDate,"YYYY"),disabled),e.stopPropagation(),e.preventDefault();});},_proto._onSuperPrev=function(){this._renderTenYear=this._renderTenYear-10,null==this.options.onPrevYear||this.options.onPrevYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._onSuperNext=function(){this._renderTenYear=this._renderTenYear+10,null==this.options.onNextYear||this.options.onNextYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._render=function(){this.$body.innerHTML='<table class="eyear-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderYearList=function(){var _this_header,_this=this,list=Util.generateYears(this._renderTenYear);null==(_this_header=this.header)||_this_header.renderContent(list[1]+" - "+list[list.length-2]),this.$body.querySelector(".eyear-content")&&(this.$body.querySelector(".eyear-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(list,3).slice(0,4).map(function(years,i){return "<tr>\n "+years.map(function(y,j){var classNames=0===i&&0===j||3===i&&2===j?"eyear-cell":"eyear-cell eyear-cell-in-view";return +y===+_this._current.getFullYear()&&(classNames+=" eyear-cell-selected"),"function"==typeof _this.options.disabledYear&&_this.options.disabledYear(distExports$4.DateTime.toDate(y),y)&&(classNames+=" edate-disabled"),'<td title="'+y+'" class="'+classNames+'">\n '+(_this.options.yearRender&&"function"==typeof _this.options.yearRender?_this.options.yearRender(distExports$4.DateTime.toDate(y),y):'<span class="eyear-cell-inner">'+ +y+"</span>")+"\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>\n ");},_create_class$3$1(Year,[{key:"current",get:function(){return this._current}}]),Year}(Container);function _create_class$2$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1$2(){return _extends$1$2=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1$2.apply(this,arguments)}function _set_prototype_of$2$1(o,p){return _set_prototype_of$2$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$2$1(o,p)}var _DATEPICKER_MODE_ARRAY=["date","month","year"],_DATEPICKER_DEFAULT_OPTIONS_={getPopupContainer:function(){return document.body},language:"zh",isMobile:false,mode:_DATEPICKER_MODE_ARRAY[0],wrapClassName:""},DatePicker=function(Picker){function DatePicker(container,options){var _this;return (_this=Picker.call(this,container,deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{},{wrapClassName:("edate-picker "+((null==options?void 0:options.wrapClassName)||"")).trim()}],{clone:false}))||this).current=null,_this._current=null,_this._calendar=null,_this._month=null,_this._year=null,_this._currentMode="date",_this.options=deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{}],{clone:false}),_this.options.current&&(_this.current=_this.options.current,_this._current=_this.options.current),_this._currentMode=_this.options.mode,_this._switchMode(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$2$1(subClass,superClass);}(DatePicker,Picker);var _proto=DatePicker.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto.updateBadges=function(badges){var _this__calendar;(null==badges?void 0:badges.length)>=0&&(null==(_this__calendar=this._calendar)||_this__calendar.updateBadges(badges));},_proto.destroy=function(){var _this__calendar,_this__month,_this__year;null==(_this__calendar=this._calendar)||_this__calendar.destroy(),this._calendar=null,null==(_this__month=this._month)||_this__month.destroy(),this._month=null,null==(_this__year=this._year)||_this__year.destroy(),this._year=null,Picker.prototype.destroy.call(this);},_proto._setCurrent=function(date,change){var _this__calendar,_this__month,_this__year;void 0===change&&(change=true),this._current=date,null==(_this__calendar=this._calendar)||_this__calendar.setCurrent(date,change),null==(_this__month=this._month)||_this__month.setCurrent(date,change),null==(_this__year=this._year)||_this__year.setCurrent(date,change);},_proto._switchMode=function(){this.$body.classList.add("edate-picker-"+this._currentMode),"date"===this._currentMode?this._initCalendar():"month"===this._currentMode?this._initMonth():"year"===this._currentMode&&this._initYear(),this.setPlacement(this.options.placement||"top");},_proto.hide=function(){this.open=false;},_proto._onOpenChange=function(open){Picker.prototype._onOpenChange.call(this,open),open&&(this._removeCurrentTypeClass(),this._currentMode=this.options.mode||"date",this._switchMode(),this._setCurrent(this.current,false)),open||null==this.options.onClose||this.options.onClose.call(this.options,this.current,this._currentMode);},_proto._initCalendar=function(){var _this=this;this._calendar||(this._calendar=new Calendar(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),onMonth:this._onMonth.bind(this),onYear:this._onYear.bind(this),onChange:function(date){var _this__calendar;_this._current&&distExports$4.DateTime.format(_this._current,"YYYY-MM-DD")===distExports$4.DateTime.format(date,"YYYY-MM-DD")||_this._onChange(date,null==(_this__calendar=_this._calendar)?void 0:_this__calendar.options.showHeaderOk);}})));},_proto._initMonth=function(){var _this=this;this._month||(this._month=new Month(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__month;_this._current&&distExports$4.DateTime.format(_this._current,"YYYY-MM")===distExports$4.DateTime.format(date,"YYYY-MM")||_this._onChange(date,null==(_this__month=_this._month)?void 0:_this__month.options.showHeaderOk);},onYear:this._onYear.bind(this)})));},_proto._initYear=function(){var _this=this;this._year||(this._year=new Year(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__year;_this._current&&distExports$4.DateTime.format(_this._current,"YYYY")===distExports$4.DateTime.format(date,"YYYY")||_this._onChange(date,null==(_this__year=_this._year)?void 0:_this__year.options.showHeaderOk);}})));},_proto._onOk=function(date){this.current=date||this._current,this._setCurrent(date||this._current),null==this.options.onOk||this.options.onOk.call(this.options,this.current,this._currentMode),this.hide();},_proto._onClose=function(){this.hide();},_proto._onChange=function(date,_showHeaderOk){this._setCurrent(date,true);},_proto._onCell=function(date,_renderDate,disabled){null==this.options.onCell||this.options.onCell.call(this.options,date,this._currentMode),this.options.isMobile||this._currentMode!==this.options.mode||disabled||this._current&&distExports$4.DateTime.format(date,"YYYY-MM-DD")!==distExports$4.DateTime.format(this._current,"YYYY-MM-DD")||(this.current=date,null==this.options.onChange||this.options.onChange.call(this.options,date,this._currentMode)),disabled||this._prvMode();},_proto._prvMode=function(){this._currentMode!==this.options.mode||this.options.isMobile||this.hide();var index=_DATEPICKER_MODE_ARRAY.indexOf(this._currentMode);index>=1&&(index--,this._removeCurrentTypeClass(),this._currentMode=_DATEPICKER_MODE_ARRAY[index],this._switchMode());},_proto._onYear=function(){this._removeCurrentTypeClass(),this._currentMode="year",this._switchMode();},_proto._onMonth=function(){this._removeCurrentTypeClass(),this._currentMode="month",this._switchMode();},_proto._removeCurrentTypeClass=function(){this.$body.classList.remove("edate-picker-"+this._currentMode);},_create_class$2$1(DatePicker,[{key:"_minModeIndex",get:function(){return _DATEPICKER_MODE_ARRAY.indexOf(this.options.mode)}}]),DatePicker}(Picker),DEFAULT_FOOTER_OPTIONS_locale={today:"Today",ok:"Ok",now:"Now",cancel:"Cancel"};function Footer(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{}),$footer=document.createElement("div");$footer.classList.add("edate-footer"),options.className&&$footer.classList.add(options.className);var html="";return "string"!=typeof(html="function"==typeof options.renderContent?options.renderContent():void 0)&&(html="",html+='<div class="edate-footer-left">\n '+(options.showToday?'<span class="edate-today">'+((null==locale?void 0:locale.today)||"Today")+"</span>":"")+"\n "+(options.showNow?'<span class="edate-now">'+((null==locale?void 0:locale.now)||"Now")+"</span>":"")+"\n </div>",html+='<div class="edate-footer-right">\n '+(options.showCancel?function(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{});return '<button class="edate-btn edate-btn-cancel '+(options.disabledOk?"edate-btn-disabled":"")+'">'+((null==locale?void 0:locale.cancel)||"Cancel")+"</button>"}({locale:options.locale}):"")+(options.showOk?function(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{});return '<button class="edate-btn edate-btn-primary edate-btn-ok '+(options.disabledOk?"edate-btn-disabled":"")+'">'+((null==locale?void 0:locale.ok)||"Ok")+"</button>"}({disabledOk:options.disabledOk,locale:options.locale}):"")+"\n </div>"),html?($footer.innerHTML=html,delegate($footer,".edate-today","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onToday||options.onToday.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-now","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onNow||options.onNow.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-btn-cancel","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onCancel||options.onCancel.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-btn-ok","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onOk||options.onOk.call(options),event.stopPropagation(),event.preventDefault());}),$footer):null}function _create_class$1$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$8(){return _extends$8=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$8.apply(this,arguments)}function _set_prototype_of$1$2(o,p){return _set_prototype_of$1$2=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$2(o,p)}var TIME_DEFAULT_OPTIONS={showHeader:true,current:"",cellHeight:30,columnHeight:208,width:160,showCancel:false,showOk:false},Time=function(Container){function Time(container,options){var _this;return (_this=Container.call(this,container,_extends$8({showHeader:TIME_DEFAULT_OPTIONS.showHeader||options.showHeader},options,{prefixCls:"etime"}))||this)._panCleanups=[],_this.options=Object.assign({},TIME_DEFAULT_OPTIONS,options||{}),_this._checkTimeFmt(_this.options.current)?_this._current=_this.options.current:_this._current=TIME_DEFAULT_OPTIONS.current,_this._render(),_this._events(),_this._bindPanEvents(),_this.activeItem("auto"),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1$2(subClass,superClass);}(Time,Container);var _proto=Time.prototype;return _proto.setCurrent=function(time){time&&this._checkTimeFmt(time)&&(this._current="string"==typeof time?time:null==time?void 0:time.join(":"),this.activeItem());},_proto.destroy=function(){for(var i=0;i<this._panCleanups.length;i++)try{this._panCleanups[i]();}catch(e){}this._panCleanups=[],Container.prototype.destroy.call(this);},_proto._events=function(){var _this=this;this.$body.querySelector(".etime-cell")&&delegate(this.$body,".etime-cell","click",function(event){var target=event.delegateTarget,type=null==target?void 0:target.getAttribute("data-type"),value=null==target?void 0:target.getAttribute("data-title"),currentTimes=_this._currentTimes;switch(type){case "hour":currentTimes[0]=value;break;case "minute":currentTimes[1]=value;break;case "second":currentTimes[2]=value;}for(var i=0;i<currentTimes.length;i++)""===currentTimes[i]&&(currentTimes[i]="00");null==_this.options.onCell||_this.options.onCell.call(_this.options,type,currentTimes.join(":"),currentTimes),_this._panCellToTop(target,true),(null==target?void 0:target.classList.contains("edate-disabled"))||_this._current!==currentTimes.join(":")&&(_this._current=currentTimes.join(":"),_this.activeItem(),null==_this.options.onChange||_this.options.onChange.call(_this.options,type,_this._current,_this._currentTimes));},false);},_proto._trackOf=function(column){return column.querySelector(".etime-track")},_proto._measureCellHeight=function(track){var first=track.querySelector(".etime-cell"),h=first?first.offsetHeight:0;return h>0?h:this.options.cellHeight||26},_proto._maxIndex=function(track){var cells=track.querySelectorAll(".etime-cell");return Math.max(0,cells.length-1)},_proto._clamp=function(value,min,max){return Math.min(max,Math.max(min,value))},_proto._getTrackOffset=function(track){var v=track._etimeOffset;return "number"==typeof v?v:0},_proto._setTrackOffset=function(track,offset,smooth){var cellH=this._measureCellHeight(track),min=-this._maxIndex(track)*cellH,clamped=this._clamp(offset,min,0);return track._etimeOffset=clamped,track.style.transition=smooth?"transform 0.25s cubic-bezier(0.23, 1, 0.32, 1)":"none",track.style.transform="translateY("+clamped+"px)",clamped},_proto._panCellToTop=function(cell,smooth){var track=cell.parentElement;if(track){var index=Array.prototype.slice.call(track.querySelectorAll(".etime-cell")).indexOf(cell);if(!(index<0)){var cellH=this._measureCellHeight(track);this._setTrackOffset(track,-index*cellH,smooth);}}},_proto._snapColumn=function(track,smooth){var cellH=this._measureCellHeight(track),offset=this._getTrackOffset(track),index=Math.round(-offset/cellH);index=this._clamp(index,0,this._maxIndex(track)),this._setTrackOffset(track,-index*cellH,smooth);},_proto.activeItem=function(behavior){ void 0===behavior&&(behavior="smooth");for(var smooth="auto"!==behavior,times=this._currentTimes,cols=[{idx:0,cls:"etime-hour"},{idx:1,cls:"etime-minute"},{idx:2,cls:"etime-second"}],i=0;i<cols.length;i++){var _this_$body,_cols_i=cols[i],idx=_cols_i.idx,cls=_cols_i.cls;if(times[idx]){var cell=null==(_this_$body=this.$body)?void 0:_this_$body.querySelector("."+cls+'[data-title="'+times[idx]+'"]');if(cell){var track=cell.parentElement,prev=track?track.querySelector(".etime-cell-selected"):null;prev&&prev.classList.remove("etime-cell-selected"),cell.classList.add("etime-cell-selected"),this._panCellToTop(cell,smooth);}}}this.header&&this.header.renderContent(this._current?"<span>"+this._current+"</span>":"");},_proto._supportsPassive=function(){var supported=false;try{if("undefined"==typeof window)return !1;var opts=Object.defineProperty({},"passive",{get:function(){return supported=!0,!0}}),noop=function(){};window.addEventListener("etime-passive-test",noop,opts),window.removeEventListener("etime-passive-test",noop,opts);}catch(e){supported=false;}return supported},_proto._bindPanEvents=function(){for(var columns=this._columns,listenerOpts=!!this._supportsPassive()&&{passive:false},i=0;i<columns.length;i++)this._bindColumnWheel(columns[i],listenerOpts),this._bindColumnTouch(columns[i],listenerOpts);},_proto._bindColumnWheel=function(column,listenerOpts){var _this=this,track=this._trackOf(column);if(track){var snapTimer=null,onWheel=function(e){e.cancelable&&e.preventDefault();var cellH=_this._measureCellHeight(track),unit=1;1===e.deltaMode?unit=cellH:2===e.deltaMode&&(unit=column.clientHeight||cellH);var next=_this._getTrackOffset(track)-e.deltaY*unit*.5;_this._setTrackOffset(track,next,false),snapTimer&&clearTimeout(snapTimer),snapTimer=setTimeout(function(){_this._snapColumn(track,true);},120);};column.addEventListener("wheel",onWheel,listenerOpts),this._panCleanups.push(function(){snapTimer&&clearTimeout(snapTimer),column.removeEventListener("wheel",onWheel,listenerOpts);});}},_proto._bindColumnTouch=function(column,listenerOpts){var _this=this,track=this._trackOf(column);if(track){var startY=0,startOffset=0,lastY=0,lastT=0,velocity=0,dragging=false,onStart=function(e){e.touches&&0!==e.touches.length&&(dragging=true,startY=lastY=e.touches[0].clientY,startOffset=_this._getTrackOffset(track),lastT=Date.now(),velocity=0,track.style.transition="none");},onMove=function(e){if(dragging&&e.touches&&0!==e.touches.length){e.cancelable&&e.preventDefault();var y=e.touches[0].clientY,now=Date.now(),dt=now-lastT;dt>0&&(velocity=(y-lastY)/dt),lastY=y,lastT=now,_this._setTrackOffset(track,startOffset+(y-startY),false);}},onEnd=function(){if(dragging){dragging=false;var cellH=_this._measureCellHeight(track),projected=_this._getTrackOffset(track)+140*velocity,index=Math.round(-projected/cellH);index=_this._clamp(index,0,_this._maxIndex(track)),_this._setTrackOffset(track,-index*cellH,true);}};column.addEventListener("touchstart",onStart,listenerOpts),column.addEventListener("touchmove",onMove,listenerOpts),column.addEventListener("touchend",onEnd),column.addEventListener("touchcancel",onEnd),this._panCleanups.push(function(){column.removeEventListener("touchstart",onStart,listenerOpts),column.removeEventListener("touchmove",onMove,listenerOpts),column.removeEventListener("touchend",onEnd),column.removeEventListener("touchcancel",onEnd);});}},_proto._render=function(){this._renderTimeBody(),this.$panel.appendChild(this.$body),this.options.showFooter&&this._renderFooter();},_proto._renderFooter=function(){var _this=this,showCancel=!!this.options.showCancel,showOk=!!this.options.showOk;if(showCancel||showOk){var locale=this.locale||{},onOk=this.options.onOk,footer=Footer({className:"etime-footer",showCancel:showCancel,showOk:showOk,locale:{ok:locale.ok,cancel:locale.cancel},onCancel:function(){null==_this.options.onCancel||_this.options.onCancel.call(_this.options);},onOk:function(){null==onOk||onOk(_this._current);}});footer&&this.$panel.appendChild(footer);}},_proto._renderTimeBody=function(){this.$body.innerHTML=this._generateList("hour",Util.generateHours())+"\n "+this._generateList("minute",Util.generateMinutesOrSeconds())+"\n "+this._generateList("second",Util.generateMinutesOrSeconds());},_proto._generateList=function(type,times){var _this=this,columnH=this.options.columnHeight+"px",cellH=this.options.cellHeight+"px";return '<div class="etime-column etime-column-'+type+'" data-type="'+type+'" style="height:'+columnH+';">\n <ul class="etime-track" style="padding-bottom: calc('+columnH+" - "+cellH+');">\n '+times.map(function(s){var disabled=false;return "hour"===type?disabled=!!(null==_this.options.disabledHour?void 0:_this.options.disabledHour.call(_this.options,+s)):"minute"===type?disabled=!!(null==_this.options.disabledMinute?void 0:_this.options.disabledMinute.call(_this.options,+s)):"second"===type&&(disabled=!!(null==_this.options.disabledSecond?void 0:_this.options.disabledSecond.call(_this.options,+s))),'<li class="etime-cell etime-'+type+" "+(disabled?"edate-disabled":"")+'" style="height:'+cellH+";line-height: "+cellH+'" data-title="'+s+"\" data-type='"+type+'\'>\n <div class="etime-cell-inner">'+s+"</div>\n </li>"}).join("")+"\n </ul>\n </div>"},_proto._checkTimeFmt=function(time){var times="string"==typeof time?time.split(":"):time;return 3===times.length||+times[0]>=0&&+times[0]<=23&&+times[1]>=0&&+times[1]<=59&&+times[2]>=0&&+times[2]<=59},_create_class$1$1(Time,[{key:"_currentTimes",get:function(){var _this__current;return this._current?null==(_this__current=this._current)?void 0:_this__current.split(":"):["","",""]}},{key:"current",get:function(){return this._current}},{key:"_columns",get:function(){return Array.prototype.slice.call(this.$body.querySelectorAll(".etime-column"))}}]),Time}(Container);function _create_class$6(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$9(o,p){return _set_prototype_of$9=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$9(o,p)}var DEFAULT_TIME_PICKER_OPTIONS={getPopupContainer:function(){return document.body},current:"00:00:00",open:false,showCancel:true,showOk:true,showHeader:true,showFooter:true,wrapClassName:"etime-picker"},TimePicker=function(Picker){function TimePicker(container,options){var _this;return (_this=Picker.call(this,container,Object.assign({},DEFAULT_TIME_PICKER_OPTIONS,options||{},{wrapClassName:options.wrapClassName?(DEFAULT_TIME_PICKER_OPTIONS.wrapClassName+" "+options.wrapClassName).trim():DEFAULT_TIME_PICKER_OPTIONS.wrapClassName}))||this).time=null,_this._current="00:00:00",_this.options=Object.assign({},DEFAULT_TIME_PICKER_OPTIONS,options||{}),_this.options.current&&(_this._current=_this.options.current),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$9(subClass,superClass);}(TimePicker,Picker);var _proto=TimePicker.prototype;return _proto.setCurrent=function(time){this.time&&time&&(this.time.setCurrent(time),this._current="string"==typeof time?time:null==time?void 0:time.join(":"));},_proto.hide=function(){this.open=false;},_proto.destroy=function(){this.time&&(this.time.destroy(),this.time=null),Picker.prototype.destroy.call(this);},_proto._onOpenChange=function(open){var _this=this;if(Picker.prototype._onOpenChange.call(this,open),open)if(this.time)this.current&&this.current!==this.time.current&&this.time.setCurrent(this.current);else {var timeOptions=Object.assign({},this.options,{wrapClassName:"",onChange:function(type,time,times){_this.options.showFooter&&_this.options.showOk||time===_this.current||null==_this.options.onChange||_this.options.onChange.call(_this.options,time,times);},onOk:function(time){time!==_this.current&&(null==_this.options.onChange||_this.options.onChange.call(_this.options,time,time.split(":"))),_this._current=time,null==_this.options.onOk||_this.options.onOk.call(_this.options,time),_this.hide();},onCancel:function(){null==_this.options.onCancel||_this.options.onCancel.call(_this.options),_this.hide();}});this.time=new Time(function(){return _this.$body},timeOptions);}},_create_class$6(TimePicker,[{key:"current",get:function(){return this._current}}]),TimePicker}(Picker);
|
|
10141
|
+
var Util=function(){function Util(){}return Util.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},Util.chunkBySize=function(arr,size){return Array.from({length:Math.ceil(arr.length/size)}).map(function(_,index){return arr.slice(index*size,(index+1)*size)})},Util.generateYears=function(year){for(var years=[],i=year%10+1;i>=0;i--)years.push(year-i);for(var i1=1;years.length<12;i1++)years.push(year+i1);return years},Util.getDaysInMonth=function(year,month){return new Date(year,month+1,0).getDate()},Util.getFirstDayOfMonth=function(year,month,startOfWeek){return void 0===startOfWeek&&(startOfWeek=0),(new Date(year,month).getDay()-startOfWeek+7)%7},Util.generateWeeksByYearMonth=function(year,month,startOfWeek){ void 0===startOfWeek&&(startOfWeek=0),month-=1;for(var daysInMonth=Util.getDaysInMonth(year,month),firstDay=Util.getFirstDayOfMonth(year,month,startOfWeek),weeks=[],i=1;i<=firstDay+daysInMonth;i++){var day=i-firstDay;day<1?weeks.push((0===month?year-1:year)+"-"+Util.fillZero((month+12-1)%12+1)+"-"+Util.fillZero(Util.getDaysInMonth(year,month-1)+day)):day>daysInMonth?weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+(day-daysInMonth)):weeks.push(year+"-"+Util.fillZero(month+1)+"-"+Util.fillZero(day));}for(var nextDay=1;weeks.length<42;)weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+Util.fillZero(nextDay++));return weeks},Util.generateHours=function(){for(var hours=[],i=0;i<24;i++)hours.push(Util.fillZero(i));return hours},Util.generateMinutesOrSeconds=function(){for(var hours=[],i=0;i<=59;i++)hours.push(Util.fillZero(i));return hours},Util}(),__$CALENDAR_LOCALES$__={en:{year:"",month:"",weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",ok:"OK",now:"Now",cancel:"Cancel",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},zh:{year:"年",month:"月",weeks:["日","一","二","三","四","五","六"],today:"今天",ok:"确定",now:"此刻",cancel:"取消",months:["01","02","03","04","05","06","07","08","09","10","11","12"]}},__DEFAULT_COMPONENTS_OPTIONS__={showSuperPrevIcon:false,showSuperNextIcon:false,showPrevIcon:false,showNextIcon:false,showHeaderClose:false,showHeaderOk:false,renderSuperPrevIcon:'<span class="edate-super-prev-icon"></span>',renderSuperNextIcon:'<span class="edate-super-next-icon"></span>',renderPrevIcon:'<span class="edate-prev-icon"></span>',renderNextIcon:'<span class="edate-next-icon"></span>',renderHeaderCloseIcon:'<span class="edate-close-icon">\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n </span>',renderHeaderOkIcon:function(locale){return '<span class="edate-btn-text">'+((null==locale?void 0:locale.ok)||"确定")+"</span>"}},Header=function(){function Header(options){this.$header=null,this._delegations=[],this.options=deepmerge.all([{},__DEFAULT_COMPONENTS_OPTIONS__,options],{clone:false}),this.$header=document.createElement("div"),this.$header.classList.add("edate-header",options.prefixCls+"-header"),options.className&&this.$header.classList.add(options.className),this._render(),this._eventListeners();}var _proto=Header.prototype;return _proto._render=function(){var _this__getStrOrFunToStr,_this__getStrOrFunToStr1,_this__getStrOrFunToStr2,_this__getStrOrFunToStr3,_this__getStrOrFunToStr4,_this__getStrOrFunToStr5;this.$header&&(this.$header.innerHTML="\n "+(this.options.showHeaderClose?'<div class="edate-close-btn">\n '+(null!=(_this__getStrOrFunToStr=this._getStrOrFunToStr(this.options.renderHeaderCloseIcon))?_this__getStrOrFunToStr:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderCloseIcon)+"\n </div>":this.options.showHeaderOk?"<span></span>":"")+"\n "+(this.options.showSuperPrevIcon||this.options.showPrevIcon?'\n <div class="edate-prev-btns">\n '+(this.options.showSuperPrevIcon?'<div class="edate-super-prev-btn '+this.options.prefixCls+'-super-prev-btn">\n '+(null!=(_this__getStrOrFunToStr1=this._getStrOrFunToStr(this.options.renderSuperPrevIcon))?_this__getStrOrFunToStr1:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperPrevIcon)+"\n </div>":"")+"\n "+(this.options.showPrevIcon?'<div class="edate-prev-btn '+this.options.prefixCls+'-prev-btn">\n '+(null!=(_this__getStrOrFunToStr2=this._getStrOrFunToStr(this.options.renderPrevIcon))?_this__getStrOrFunToStr2:__DEFAULT_COMPONENTS_OPTIONS__.renderPrevIcon)+"\n </div>":"")+"\n </div>\n ":"")+'\n\n <div class="edate-header-view '+this.options.prefixCls+'-header-view"></div>\n\n '+(this.options.showNextIcon||this.options.showSuperNextIcon?'\n <div class="edate-next-btns">\n '+(this.options.showNextIcon?'<div class="edate-next-btn '+this.options.prefixCls+'-next-btn">\n '+(null!=(_this__getStrOrFunToStr3=this._getStrOrFunToStr(this.options.renderNextIcon))?_this__getStrOrFunToStr3:__DEFAULT_COMPONENTS_OPTIONS__.renderNextIcon)+"\n </div>":"")+"\n "+(this.options.showSuperNextIcon?'<div class="edate-super-next-btn '+this.options.prefixCls+'-super-next-btn">\n '+(null!=(_this__getStrOrFunToStr4=this._getStrOrFunToStr(this.options.renderSuperNextIcon))?_this__getStrOrFunToStr4:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperNextIcon)+"\n </div>":"")+"\n </div>\n ":"")+"\n "+(this.options.showHeaderOk?'<div class="edate-ok-btn">\n '+(null!=(_this__getStrOrFunToStr5=this._getStrOrFunToStr(this.options.renderHeaderOkIcon))?_this__getStrOrFunToStr5:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderOkIcon)+"\n </div>":this.options.showHeaderClose?"<span></span>":""));},_proto._getStrOrFunToStr=function(value){if(null!=value){var _this_options;if("function"==typeof value)return this._getStrOrFunToStr(null==value?void 0:value(null==(_this_options=this.options)?void 0:_this_options.locale));if("string"==typeof value)return value}},_proto.renderContent=function(html){if(this.$header){var _$content=this.$header.querySelector(".edate-header-view");if(!_$content)return;_$content.innerHTML=html;}},_proto.destroy=function(){for(var i=0;i<this._delegations.length;i++)try{this._delegations[i].destroy();}catch(e){}this._delegations=[],this.$header&&(this.$header.remove(),this.$header=null);},_proto._eventListeners=function(){var _this=this;_this.$header&&(_this._delegations.push(delegate(_this.$header,".edate-super-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperPrev||_this.options.onSuperPrev.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onPrev||_this.options.onPrev.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onNext||_this.options.onNext.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-super-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperNext||_this.options.onSuperNext.call(_this.options);})),_this._delegations.push(delegate(_this.$header,".edate-close-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onClose||_this.options.onClose.call(_this.options),event.stopPropagation(),event.preventDefault());})),_this._delegations.push(delegate(_this.$header,".edate-ok-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onOk||_this.options.onOk.call(_this.options),event.stopPropagation(),event.preventDefault());})));},Header}();function _extends$3$1(){return _extends$3$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$3$1.apply(this,arguments)}var _CONTAINER_DEFAULT_OPTIONS_={prefixCls:"edate",locales:__$CALENDAR_LOCALES$__,showHeader:true},Container=function(){function Container(popupContainer,options){this.$panel=document.createElement("div"),this.$body=document.createElement("div"),this.$container=document.createElement("div"),this.language="zh",this.header=null,this._delegations=[],this.locale=__$CALENDAR_LOCALES$__.zh,this.options=deepmerge.all([{},_CONTAINER_DEFAULT_OPTIONS_,options],{clone:false}),this.$popupContainer=popupContainer?"function"==typeof popupContainer?popupContainer():popupContainer:document.body,this._setLocale(),this.$container.classList.add("edate-container",(this.options.prefixCls||"edate")+"-container"),options.isMobile&&this.$container.classList.add("edate-mobile",this.options.prefixCls+"-mobile"),this.options.wrapClassName&&this.$container.classList.add(this.options.wrapClassName),this.$panel.classList.add("edate-panel",(this.options.prefixCls||"edate")+"-panel"),this.options.showHeader&&(this.header=new Header(_extends$3$1({},this.options,{locale:this.locale,onPrev:this._onPrev.bind(this),onNext:this._onNext.bind(this),onSuperPrev:this._onSuperPrev.bind(this),onSuperNext:this._onSuperNext.bind(this),onClose:this._onClose.bind(this),onOk:this._onOk.bind(this)})),this.$panel.appendChild(this.header.$header)),this.$body.classList.add("edate-body",(this.options.prefixCls||"edate")+"-body"),this.$container.appendChild(this.$panel),this.$popupContainer.appendChild(this.$container);}var _proto=Container.prototype;return _proto._setLocale=function(){if(this.options.locales)if("string"==typeof this.options.language){var language=this.options.language||navigator.language;this.options.locales[language]?this.locale=this.options.locales[language]:this.locale=this.options.locales.zh;}else this.locale=this.options.locales.zh;},_proto._delegate=function(el,selector,type,cb,useCapture){var d=delegate(el,selector,type,cb,useCapture);return d&&"function"==typeof d.destroy&&this._delegations.push(d),d},_proto.destroy=function(){for(var _this_$container,i=0;i<this._delegations.length;i++)try{this._delegations[i].destroy();}catch(e){}this._delegations=[],this.header&&"function"==typeof this.header.destroy&&this.header.destroy(),(null==(_this_$container=this.$container)?void 0:_this_$container.parentNode)&&this.$container.parentNode.removeChild(this.$container),this.header=null,this.$container=null,this.$panel=null,this.$body=null;},_proto.setLocale=function(locale){"string"==typeof locale?this._setLocale():this.locale=locale;},_proto._onSuperPrev=function(){},_proto._onSuperNext=function(){},_proto._onPrev=function(){},_proto._onNext=function(){},_proto._onClose=function(){},_proto._onOk=function(){},Container}();function _create_class$5(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$2$1(){return _extends$2$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$2$1.apply(this,arguments)}function _set_prototype_of$5$1(o,p){return _set_prototype_of$5$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$5$1(o,p)}var _CALENDAR_DEFAULT_OPTIONS_={startOfWeek:0,showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,showPrevIcon:true,showNextIcon:true,language:"zh",renderBadge:'<span class="ecalendar-badge"></span>',badges:[]},Calendar=function(Container){function Calendar(container,options){var _this,_this_options_badges,_this_options,_this_options1,_this_options2;return (_this=Container.call(this,container,_extends$2$1({},_CALENDAR_DEFAULT_OPTIONS_,options,{prefixCls:"ecalendar"}))||this).badges=[],(null==(_this_options_badges=_this.options.badges)?void 0:_this_options_badges.length)&&_this._updateBadges(_this.options.badges,false),(null==(_this_options=_this.options)?void 0:_this_options.startOfWeek)&&((null==(_this_options1=_this.options)?void 0:_this_options1.startOfWeek)>6||(null==(_this_options2=_this.options)?void 0:_this_options2.startOfWeek)<0)&&(_this.options.startOfWeek=0),_this._render(),_this.setCurrent(_this.options.current,false),_this._onHeader(),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$5$1(subClass,superClass);}(Calendar,Container);var _proto=Calendar.prototype;return _proto.setCurrent=function(date,change){if(void 0===change&&(change=true),"string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{if(date="string"==typeof date?distExports$1.DateTime.toDate(date):date,(!this._current||distExports$1.DateTime.format(date,"YYYY-MM-DD")!==distExports$1.DateTime.format(this._current,"YYYY-MM-DD"))&&(this._current=date,change&&(null==this.options.onChange||this.options.onChange.call(this.options,date,distExports$1.DateTime.format(date,"YYYY-MM-DD"))),this.$body)){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-cell-selected"))||_this_$body_querySelector.classList.remove("ecalendar-cell-selected");var title=distExports$1.DateTime.format(this._current,"YYYY-MM-DD");null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-cell-in-view[title='"+title+"']"))||_this_$body_querySelector1.classList.add("ecalendar-cell-selected");}this._setRenderCurrent(this._current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto.updateBadges=function(badges){this._updateBadges(badges);},_proto._updateBadges=function(badges,rerender){ void 0===rerender&&(rerender=true),(null==badges?void 0:badges.length)>=0&&(this.badges=badges.map(function(date){return distExports$1.DateTime.format(date,"YYYY-MM-DD")}),rerender&&this._renderDate());},_proto._setRenderCurrent=function(date){(!this._renderCurrent||date&&distExports$1.DateTime.format(this._renderCurrent,"YYYY-MM")!==distExports$1.DateTime.format(date,"YYYY-MM"))&&(this._renderCurrent=date||new Date,this._renderDate());},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".ecalendar-cell","click",function(event){var date=new Date(event.delegateTarget.getAttribute("title").replace(/\//gi,"/")),disabled=event.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(date),null==_this.options.onCell||_this.options.onCell.call(_this.options,date,distExports$1.DateTime.format(_this._renderCurrent,"YYYY-MM-DD"),disabled),event.stopPropagation(),event.preventDefault();});},_proto._onSuperPrev=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()-1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()+1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onPrev=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()-1,date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onNext=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()+1,date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onHeader=function(){var _this=this;this._delegate(this.$panel,".ecalendar-header-month-btn","click",function(){null==_this.options.onMonth||_this.options.onMonth.call(_this.options,_this._current,_this._renderCurrent);}),this._delegate(this.$panel,".ecalendar-header-year-btn","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._render=function(){var _this_locale,_this_locale1,shiftedCustomDays=[].concat(((null==(_this_locale=this.locale)?void 0:_this_locale.weeks)||[]).slice(this.options.startOfWeek),((null==(_this_locale1=this.locale)?void 0:_this_locale1.weeks)||[]).slice(0,this.options.startOfWeek));this.$body.innerHTML='<table class="ecalendar-content">\n <thead><tr>'+shiftedCustomDays.map(function(day){return "<th>"+day+"</th>"}).join("")+"</tr></thead>\n <tbody></tbody>\n </table>",this.$panel.appendChild(this.$body);},_proto._renderDate=function(){var _this_header,_this_$body_querySelector,_this=this;if(this.$body){var _this_locale_months,_this_locale,_this_locale1,_this_locale2,_this_locale3,_this_locale_months1,_this_locale4,_this_locale5,_this_$body_querySelector1,todayStr=distExports$1.DateTime.format(new Date,"YYYY-MM-DD"),year=this._renderCurrent.getFullYear(),month=this._renderCurrent.getMonth()+1,dayGroupArray=Util.chunkBySize(Util.generateWeeksByYearMonth(year,month,this.options.startOfWeek),7),allowMonthClick="function"==typeof this.options.onMonth,allowYearClick="function"==typeof this.options.onYear;if(null==(_this_header=this.header)?void 0:_this_header.$header)this.header.renderContent("\n "+("zh"!==this.options.language?'<span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale=this.locale)||null==(_this_locale_months=_this_locale.months)?void 0:_this_locale_months[+(month-1)])+((null==(_this_locale1=this.locale)?void 0:_this_locale1.month)||"")+'</span> <span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale2=this.locale)?void 0:_this_locale2.year)||"")+"</span>":'<span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale3=this.locale)?void 0:_this_locale3.year)||"")+'</span> <span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale4=this.locale)||null==(_this_locale_months1=_this_locale4.months)?void 0:_this_locale_months1[+(month-1)])+((null==(_this_locale5=this.locale)?void 0:_this_locale5.month)||"")+"</span>"));if(null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector.querySelector("tbody"))(null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector1.querySelector("tbody")).innerHTML="\n "+dayGroupArray.slice(0,7).map(function(dates){return "<tr>\n "+dates.map(function(dateStr){var _this_options,_dateStr_split=dateStr.split("-"),y=_dateStr_split[0],m=_dateStr_split[1],d=_dateStr_split[2],date=new Date(+y,+m,+d),classNames=[month===+m?"ecalendar-cell-in-view":"",todayStr===dateStr?"ecalendar-cell-today":"",_this._current&&distExports$1.DateTime.format(_this._current,"YYYY-MM-DD")===dateStr?"ecalendar-cell-selected":"","function"==typeof(null==(_this_options=_this.options)?void 0:_this_options.disabledDate)&&_this.options.disabledDate(distExports$1.DateTime.toDate(dateStr),dateStr)?"edate-disabled":""].filter(Boolean),badgeHtml=_this._renderBadge(date,dateStr);return '<td title="'+dateStr+'" class="ecalendar-cell '+classNames.join(" ")+'">\n '+("function"==typeof _this.options.renderDate?_this.options.renderDate(date,dateStr):'<span class="ecalendar-cell-inner">'+Util.fillZero(+d)+"</span>")+"\n "+badgeHtml+"\n </td>"}).join("")+"\n </tr>"}).join("");}},_proto._renderBadge=function(date,dateStr){var badgeHtml="";badgeHtml="function"==typeof this.options.renderBadge?this.options.renderBadge(date,dateStr):"string"==typeof this.options.renderBadge?this.options.renderBadge:"";var showBadge="function"==typeof this.options.showBadge&&this.options.showBadge(date,dateStr);return this.badges.includes(dateStr)||showBadge||(badgeHtml=""),badgeHtml},_create_class$5(Calendar,[{key:"current",get:function(){return this._current}}]),Calendar}(Container);function _create_class$4(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$4$1(o,p){return _set_prototype_of$4$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$4$1(o,p)}Calendar.DateTime=distExports$1.DateTime;var _Month_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh"},Month=function(Container){function Month(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_Month_DEFAULT_OPTIONS_,options||{},{showPrevIcon:false,showNextIcon:false,prefixCls:"emonth"}],{clone:false}))||this)._render(),_this.setCurrent(_this.options.current,false),_this._onHeaderTitle(),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$4$1(subClass,superClass);}(Month,Container);var _proto=Month.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto._setCurrent=function(date,change){if("string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{var d=date;"string"==typeof d&&(d=distExports$1.DateTime.toDate(d));var current=d;this._current&&distExports$1.DateTime.format(current,"YYYY-MM-DD")===distExports$1.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=current,"function"==typeof this.options.onChange&&change&&(null==this.options.onChange||this.options.onChange.call(this.options,current,distExports$1.DateTime.format(current,"YYYY-MM")))),this._setRenderCurrent(current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto._setRenderCurrent=function(date){if((!this._renderCurrent||this._renderCurrent&&distExports$1.DateTime.format(date,"YYYY")!==distExports$1.DateTime.format(this._renderCurrent,"YYYY"))&&(this._renderCurrent=date,this._renderMonths(date.getFullYear())),this._current){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".emonth-cell-selected"))||_this_$body_querySelector.classList.remove("emonth-cell-selected");var selectedTitle=distExports$1.DateTime.format(this._current,"YYYY-MM");null==(_this_$body_querySelector1=this.$body.querySelector(".emonth-cell-in-view[title='"+selectedTitle+"']"))||_this_$body_querySelector1.classList.add("emonth-cell-selected");}this._setHeader();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".emonth-cell","click",function(e){e.stopPropagation(),e.preventDefault();var month=+e.delegateTarget.getAttribute("data-month"),newDate=distExports$1.DateTime.toDate(distExports$1.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setMonth(month-1);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,distExports$1.DateTime.format(newDate,"YYYY-MM"),disabled);});},_proto._onSuperPrev=function(){var year=this._renderCurrent.getFullYear()-1,date=distExports$1.DateTime.toDate(year+distExports$1.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperPrev||this.options.onSuperPrev.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var year=this._renderCurrent.getFullYear()+1,date=distExports$1.DateTime.toDate(year+distExports$1.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperNext||this.options.onSuperNext.call(this.options,this._current,this._renderCurrent);},_proto._onHeaderTitle=function(){var _this=this;this._delegate(this.$panel,".edate-header-title-hover","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._setHeader=function(){if(this.$panel.querySelector(".emonth-header-view")){var allowClick="function"==typeof this.options.onYear;this.$panel.querySelector(".emonth-header-view").innerHTML='<span class="'+(allowClick?"edate-header-title-hover":"")+'">'+this._renderCurrent.getFullYear()+this.locale.year+"</span>";}},_proto._setDisabled=function(){for(var year=this._renderCurrent.getFullYear(),i=0;i<12;i++){var $cell=this.$body.querySelector(".emonth-cell[title='"+year+"-"+Util.fillZero(i+1)+"']");if($cell){var date=distExports$1.DateTime.toDate(year+"-"+Util.fillZero(i+1)+"-"+distExports$1.DateTime.format(this._renderCurrent,"DDTHH:mm:ss"));"function"==typeof this.options.disabledMonth&&this.options.disabledMonth(date,distExports$1.DateTime.format(date,"YYYY-MM"))?$cell.classList.add("edate-disabled"):$cell.classList.remove("edate-disabled");}}},_proto._render=function(){this.$body.innerHTML='<table class="emonth-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderMonths=function(year){var _this=this;this.$body.querySelector(".emonth-content")&&(this.$body.querySelector(".emonth-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(this.locale.months,3).slice(0,4).map(function(month,index){return "<tr>\n "+month.map(function(m,i){return '<td title="'+year+"-"+Util.fillZero(3*index+i+1)+'" data-month="'+Util.fillZero(3*index+i+1)+'" class="emonth-cell emonth-cell-in-view">\n <span class="emonth-cell-inner">'+(_this.options.monthRender&&"function"==typeof _this.options.monthRender?_this.options.monthRender(distExports$1.DateTime.toDate(year+"-"+Util.fillZero(3*index+i+1)),year+"-"+Util.fillZero(3*index+i+1))||"":m)+"</span>\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>"),this._setDisabled();},_create_class$4(Month,[{key:"current",get:function(){return this._current}}]),Month}(Container);function _create_class$3$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$3$1(o,p){return _set_prototype_of$3$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$3$1(o,p)}var _YEAR_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh"},Year=function(Container){function Year(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_YEAR_DEFAULT_OPTIONS_,options||{},{prefixCls:"eyear",showPrevIcon:false,showNextIcon:false,renderPrevIcon:"",renderNextIcon:""}],{clone:false}))||this)._render(),_this._setCurrent(_this.options.current,false),_this._onCell(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$3$1(subClass,superClass);}(Year,Container);var _proto=Year.prototype;return _proto.setCurrent=function(year,change){ void 0===change&&(change=true),this._setCurrent(year,change);},_proto._setCurrent=function(year,change){ void 0===change&&(change=true);var left,right,_year="number"==typeof year?distExports$1.DateTime.toDate(year):(left=year,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?year:new Date);this._current&&distExports$1.DateTime.format(_year,"YYYY-MM-DD")===distExports$1.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=_year,"function"==typeof this.options.onChange&&change&&this.options.onChange(_year)),this._renderTenYear=(this._current||new Date).getFullYear(),this._renderYearList();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;this._delegate(this.$body,".eyear-cell","click",function(e){var yearStr=+e.delegateTarget.getAttribute("title"),newDate=distExports$1.DateTime.toDate(distExports$1.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setFullYear(yearStr);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this._setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,distExports$1.DateTime.format(newDate,"YYYY"),disabled),e.stopPropagation(),e.preventDefault();});},_proto._onSuperPrev=function(){this._renderTenYear=this._renderTenYear-10,null==this.options.onPrevYear||this.options.onPrevYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._onSuperNext=function(){this._renderTenYear=this._renderTenYear+10,null==this.options.onNextYear||this.options.onNextYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._render=function(){this.$body.innerHTML='<table class="eyear-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderYearList=function(){var _this_header,_this=this,list=Util.generateYears(this._renderTenYear);null==(_this_header=this.header)||_this_header.renderContent(list[1]+" - "+list[list.length-2]),this.$body.querySelector(".eyear-content")&&(this.$body.querySelector(".eyear-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(list,3).slice(0,4).map(function(years,i){return "<tr>\n "+years.map(function(y,j){var classNames=0===i&&0===j||3===i&&2===j?"eyear-cell":"eyear-cell eyear-cell-in-view";return +y===+_this._current.getFullYear()&&(classNames+=" eyear-cell-selected"),"function"==typeof _this.options.disabledYear&&_this.options.disabledYear(distExports$1.DateTime.toDate(y),y)&&(classNames+=" edate-disabled"),'<td title="'+y+'" class="'+classNames+'">\n '+(_this.options.yearRender&&"function"==typeof _this.options.yearRender?_this.options.yearRender(distExports$1.DateTime.toDate(y),y):'<span class="eyear-cell-inner">'+ +y+"</span>")+"\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>\n ");},_create_class$3$1(Year,[{key:"current",get:function(){return this._current}}]),Year}(Container);function _create_class$2$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1$2(){return _extends$1$2=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1$2.apply(this,arguments)}function _set_prototype_of$2$1(o,p){return _set_prototype_of$2$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$2$1(o,p)}var _DATEPICKER_MODE_ARRAY=["date","month","year"],_DATEPICKER_DEFAULT_OPTIONS_={getPopupContainer:function(){return document.body},language:"zh",isMobile:false,mode:_DATEPICKER_MODE_ARRAY[0],wrapClassName:""},DatePicker=function(Picker){function DatePicker(container,options){var _this;return (_this=Picker.call(this,container,deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{},{wrapClassName:("edate-picker "+((null==options?void 0:options.wrapClassName)||"")).trim()}],{clone:false}))||this).current=null,_this._current=null,_this._calendar=null,_this._month=null,_this._year=null,_this._currentMode="date",_this.options=deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{}],{clone:false}),_this.options.current&&(_this.current=_this.options.current,_this._current=_this.options.current),_this._currentMode=_this.options.mode,_this._switchMode(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$2$1(subClass,superClass);}(DatePicker,Picker);var _proto=DatePicker.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto.updateBadges=function(badges){var _this__calendar;(null==badges?void 0:badges.length)>=0&&(null==(_this__calendar=this._calendar)||_this__calendar.updateBadges(badges));},_proto.destroy=function(){var _this__calendar,_this__month,_this__year;null==(_this__calendar=this._calendar)||_this__calendar.destroy(),this._calendar=null,null==(_this__month=this._month)||_this__month.destroy(),this._month=null,null==(_this__year=this._year)||_this__year.destroy(),this._year=null,Picker.prototype.destroy.call(this);},_proto._setCurrent=function(date,change){var _this__calendar,_this__month,_this__year;void 0===change&&(change=true),this._current=date,null==(_this__calendar=this._calendar)||_this__calendar.setCurrent(date,change),null==(_this__month=this._month)||_this__month.setCurrent(date,change),null==(_this__year=this._year)||_this__year.setCurrent(date,change);},_proto._switchMode=function(){this.$body.classList.add("edate-picker-"+this._currentMode),"date"===this._currentMode?this._initCalendar():"month"===this._currentMode?this._initMonth():"year"===this._currentMode&&this._initYear(),this.setPlacement(this.options.placement||"top");},_proto.hide=function(){this.open=false;},_proto._onOpenChange=function(open){Picker.prototype._onOpenChange.call(this,open),open&&(this._removeCurrentTypeClass(),this._currentMode=this.options.mode||"date",this._switchMode(),this._setCurrent(this.current,false)),open||null==this.options.onClose||this.options.onClose.call(this.options,this.current,this._currentMode);},_proto._initCalendar=function(){var _this=this;this._calendar||(this._calendar=new Calendar(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),onMonth:this._onMonth.bind(this),onYear:this._onYear.bind(this),onChange:function(date){var _this__calendar;_this._current&&distExports$1.DateTime.format(_this._current,"YYYY-MM-DD")===distExports$1.DateTime.format(date,"YYYY-MM-DD")||_this._onChange(date,null==(_this__calendar=_this._calendar)?void 0:_this__calendar.options.showHeaderOk);}})));},_proto._initMonth=function(){var _this=this;this._month||(this._month=new Month(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__month;_this._current&&distExports$1.DateTime.format(_this._current,"YYYY-MM")===distExports$1.DateTime.format(date,"YYYY-MM")||_this._onChange(date,null==(_this__month=_this._month)?void 0:_this__month.options.showHeaderOk);},onYear:this._onYear.bind(this)})));},_proto._initYear=function(){var _this=this;this._year||(this._year=new Year(this.$body,_extends$1$2({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__year;_this._current&&distExports$1.DateTime.format(_this._current,"YYYY")===distExports$1.DateTime.format(date,"YYYY")||_this._onChange(date,null==(_this__year=_this._year)?void 0:_this__year.options.showHeaderOk);}})));},_proto._onOk=function(date){this.current=date||this._current,this._setCurrent(date||this._current),null==this.options.onOk||this.options.onOk.call(this.options,this.current,this._currentMode),this.hide();},_proto._onClose=function(){this.hide();},_proto._onChange=function(date,_showHeaderOk){this._setCurrent(date,true);},_proto._onCell=function(date,_renderDate,disabled){null==this.options.onCell||this.options.onCell.call(this.options,date,this._currentMode),this.options.isMobile||this._currentMode!==this.options.mode||disabled||this._current&&distExports$1.DateTime.format(date,"YYYY-MM-DD")!==distExports$1.DateTime.format(this._current,"YYYY-MM-DD")||(this.current=date,null==this.options.onChange||this.options.onChange.call(this.options,date,this._currentMode)),disabled||this._prvMode();},_proto._prvMode=function(){this._currentMode!==this.options.mode||this.options.isMobile||this.hide();var index=_DATEPICKER_MODE_ARRAY.indexOf(this._currentMode);index>=1&&(index--,this._removeCurrentTypeClass(),this._currentMode=_DATEPICKER_MODE_ARRAY[index],this._switchMode());},_proto._onYear=function(){this._removeCurrentTypeClass(),this._currentMode="year",this._switchMode();},_proto._onMonth=function(){this._removeCurrentTypeClass(),this._currentMode="month",this._switchMode();},_proto._removeCurrentTypeClass=function(){this.$body.classList.remove("edate-picker-"+this._currentMode);},_create_class$2$1(DatePicker,[{key:"_minModeIndex",get:function(){return _DATEPICKER_MODE_ARRAY.indexOf(this.options.mode)}}]),DatePicker}(Picker),DEFAULT_FOOTER_OPTIONS_locale={today:"Today",ok:"Ok",now:"Now",cancel:"Cancel"};function Footer(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{}),$footer=document.createElement("div");$footer.classList.add("edate-footer"),options.className&&$footer.classList.add(options.className);var html="";return "string"!=typeof(html="function"==typeof options.renderContent?options.renderContent():void 0)&&(html="",html+='<div class="edate-footer-left">\n '+(options.showToday?'<span class="edate-today">'+((null==locale?void 0:locale.today)||"Today")+"</span>":"")+"\n "+(options.showNow?'<span class="edate-now">'+((null==locale?void 0:locale.now)||"Now")+"</span>":"")+"\n </div>",html+='<div class="edate-footer-right">\n '+(options.showCancel?function(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{});return '<button class="edate-btn edate-btn-cancel '+(options.disabledOk?"edate-btn-disabled":"")+'">'+((null==locale?void 0:locale.cancel)||"Cancel")+"</button>"}({locale:options.locale}):"")+(options.showOk?function(options){var locale=Object.assign({},DEFAULT_FOOTER_OPTIONS_locale,options.locale||{});return '<button class="edate-btn edate-btn-primary edate-btn-ok '+(options.disabledOk?"edate-btn-disabled":"")+'">'+((null==locale?void 0:locale.ok)||"Ok")+"</button>"}({disabledOk:options.disabledOk,locale:options.locale}):"")+"\n </div>"),html?($footer.innerHTML=html,delegate($footer,".edate-today","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onToday||options.onToday.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-now","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onNow||options.onNow.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-btn-cancel","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onCancel||options.onCancel.call(options),event.stopPropagation(),event.preventDefault());}),delegate($footer,".edate-btn-ok","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==options.onOk||options.onOk.call(options),event.stopPropagation(),event.preventDefault());}),$footer):null}function _create_class$1$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$8(){return _extends$8=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$8.apply(this,arguments)}function _set_prototype_of$1$2(o,p){return _set_prototype_of$1$2=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$2(o,p)}var TIME_DEFAULT_OPTIONS={showHeader:true,current:"",cellHeight:30,columnHeight:208,width:160,showCancel:false,showOk:false},Time=function(Container){function Time(container,options){var _this;return (_this=Container.call(this,container,_extends$8({showHeader:TIME_DEFAULT_OPTIONS.showHeader||options.showHeader},options,{prefixCls:"etime"}))||this)._panCleanups=[],_this.options=Object.assign({},TIME_DEFAULT_OPTIONS,options||{}),_this._checkTimeFmt(_this.options.current)?_this._current=_this.options.current:_this._current=TIME_DEFAULT_OPTIONS.current,_this._render(),_this._events(),_this._bindPanEvents(),_this.activeItem("auto"),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1$2(subClass,superClass);}(Time,Container);var _proto=Time.prototype;return _proto.setCurrent=function(time){time&&this._checkTimeFmt(time)&&(this._current="string"==typeof time?time:null==time?void 0:time.join(":"),this.activeItem());},_proto.destroy=function(){for(var i=0;i<this._panCleanups.length;i++)try{this._panCleanups[i]();}catch(e){}this._panCleanups=[],Container.prototype.destroy.call(this);},_proto._events=function(){var _this=this;this.$body.querySelector(".etime-cell")&&delegate(this.$body,".etime-cell","click",function(event){var target=event.delegateTarget,type=null==target?void 0:target.getAttribute("data-type"),value=null==target?void 0:target.getAttribute("data-title"),currentTimes=_this._currentTimes;switch(type){case "hour":currentTimes[0]=value;break;case "minute":currentTimes[1]=value;break;case "second":currentTimes[2]=value;}for(var i=0;i<currentTimes.length;i++)""===currentTimes[i]&&(currentTimes[i]="00");null==_this.options.onCell||_this.options.onCell.call(_this.options,type,currentTimes.join(":"),currentTimes),_this._panCellToTop(target,true),(null==target?void 0:target.classList.contains("edate-disabled"))||_this._current!==currentTimes.join(":")&&(_this._current=currentTimes.join(":"),_this.activeItem(),null==_this.options.onChange||_this.options.onChange.call(_this.options,type,_this._current,_this._currentTimes));},false);},_proto._trackOf=function(column){return column.querySelector(".etime-track")},_proto._measureCellHeight=function(track){var first=track.querySelector(".etime-cell"),h=first?first.offsetHeight:0;return h>0?h:this.options.cellHeight||26},_proto._maxIndex=function(track){var cells=track.querySelectorAll(".etime-cell");return Math.max(0,cells.length-1)},_proto._clamp=function(value,min,max){return Math.min(max,Math.max(min,value))},_proto._getTrackOffset=function(track){var v=track._etimeOffset;return "number"==typeof v?v:0},_proto._setTrackOffset=function(track,offset,smooth){var cellH=this._measureCellHeight(track),min=-this._maxIndex(track)*cellH,clamped=this._clamp(offset,min,0);return track._etimeOffset=clamped,track.style.transition=smooth?"transform 0.25s cubic-bezier(0.23, 1, 0.32, 1)":"none",track.style.transform="translateY("+clamped+"px)",clamped},_proto._panCellToTop=function(cell,smooth){var track=cell.parentElement;if(track){var index=Array.prototype.slice.call(track.querySelectorAll(".etime-cell")).indexOf(cell);if(!(index<0)){var cellH=this._measureCellHeight(track);this._setTrackOffset(track,-index*cellH,smooth);}}},_proto._snapColumn=function(track,smooth){var cellH=this._measureCellHeight(track),offset=this._getTrackOffset(track),index=Math.round(-offset/cellH);index=this._clamp(index,0,this._maxIndex(track)),this._setTrackOffset(track,-index*cellH,smooth);},_proto.activeItem=function(behavior){ void 0===behavior&&(behavior="smooth");for(var smooth="auto"!==behavior,times=this._currentTimes,cols=[{idx:0,cls:"etime-hour"},{idx:1,cls:"etime-minute"},{idx:2,cls:"etime-second"}],i=0;i<cols.length;i++){var _this_$body,_cols_i=cols[i],idx=_cols_i.idx,cls=_cols_i.cls;if(times[idx]){var cell=null==(_this_$body=this.$body)?void 0:_this_$body.querySelector("."+cls+'[data-title="'+times[idx]+'"]');if(cell){var track=cell.parentElement,prev=track?track.querySelector(".etime-cell-selected"):null;prev&&prev.classList.remove("etime-cell-selected"),cell.classList.add("etime-cell-selected"),this._panCellToTop(cell,smooth);}}}this.header&&this.header.renderContent(this._current?"<span>"+this._current+"</span>":"");},_proto._supportsPassive=function(){var supported=false;try{if("undefined"==typeof window)return !1;var opts=Object.defineProperty({},"passive",{get:function(){return supported=!0,!0}}),noop=function(){};window.addEventListener("etime-passive-test",noop,opts),window.removeEventListener("etime-passive-test",noop,opts);}catch(e){supported=false;}return supported},_proto._bindPanEvents=function(){for(var columns=this._columns,listenerOpts=!!this._supportsPassive()&&{passive:false},i=0;i<columns.length;i++)this._bindColumnWheel(columns[i],listenerOpts),this._bindColumnTouch(columns[i],listenerOpts);},_proto._bindColumnWheel=function(column,listenerOpts){var _this=this,track=this._trackOf(column);if(track){var snapTimer=null,onWheel=function(e){e.cancelable&&e.preventDefault();var cellH=_this._measureCellHeight(track),unit=1;1===e.deltaMode?unit=cellH:2===e.deltaMode&&(unit=column.clientHeight||cellH);var next=_this._getTrackOffset(track)-e.deltaY*unit*.5;_this._setTrackOffset(track,next,false),snapTimer&&clearTimeout(snapTimer),snapTimer=setTimeout(function(){_this._snapColumn(track,true);},120);};column.addEventListener("wheel",onWheel,listenerOpts),this._panCleanups.push(function(){snapTimer&&clearTimeout(snapTimer),column.removeEventListener("wheel",onWheel,listenerOpts);});}},_proto._bindColumnTouch=function(column,listenerOpts){var _this=this,track=this._trackOf(column);if(track){var startY=0,startOffset=0,lastY=0,lastT=0,velocity=0,dragging=false,onStart=function(e){e.touches&&0!==e.touches.length&&(dragging=true,startY=lastY=e.touches[0].clientY,startOffset=_this._getTrackOffset(track),lastT=Date.now(),velocity=0,track.style.transition="none");},onMove=function(e){if(dragging&&e.touches&&0!==e.touches.length){e.cancelable&&e.preventDefault();var y=e.touches[0].clientY,now=Date.now(),dt=now-lastT;dt>0&&(velocity=(y-lastY)/dt),lastY=y,lastT=now,_this._setTrackOffset(track,startOffset+(y-startY),false);}},onEnd=function(){if(dragging){dragging=false;var cellH=_this._measureCellHeight(track),projected=_this._getTrackOffset(track)+140*velocity,index=Math.round(-projected/cellH);index=_this._clamp(index,0,_this._maxIndex(track)),_this._setTrackOffset(track,-index*cellH,true);}};column.addEventListener("touchstart",onStart,listenerOpts),column.addEventListener("touchmove",onMove,listenerOpts),column.addEventListener("touchend",onEnd),column.addEventListener("touchcancel",onEnd),this._panCleanups.push(function(){column.removeEventListener("touchstart",onStart,listenerOpts),column.removeEventListener("touchmove",onMove,listenerOpts),column.removeEventListener("touchend",onEnd),column.removeEventListener("touchcancel",onEnd);});}},_proto._render=function(){this._renderTimeBody(),this.$panel.appendChild(this.$body),this.options.showFooter&&this._renderFooter();},_proto._renderFooter=function(){var _this=this,showCancel=!!this.options.showCancel,showOk=!!this.options.showOk;if(showCancel||showOk){var locale=this.locale||{},onOk=this.options.onOk,footer=Footer({className:"etime-footer",showCancel:showCancel,showOk:showOk,locale:{ok:locale.ok,cancel:locale.cancel},onCancel:function(){null==_this.options.onCancel||_this.options.onCancel.call(_this.options);},onOk:function(){null==onOk||onOk(_this._current);}});footer&&this.$panel.appendChild(footer);}},_proto._renderTimeBody=function(){this.$body.innerHTML=this._generateList("hour",Util.generateHours())+"\n "+this._generateList("minute",Util.generateMinutesOrSeconds())+"\n "+this._generateList("second",Util.generateMinutesOrSeconds());},_proto._generateList=function(type,times){var _this=this,columnH=this.options.columnHeight+"px",cellH=this.options.cellHeight+"px";return '<div class="etime-column etime-column-'+type+'" data-type="'+type+'" style="height:'+columnH+';">\n <ul class="etime-track" style="padding-bottom: calc('+columnH+" - "+cellH+');">\n '+times.map(function(s){var disabled=false;return "hour"===type?disabled=!!(null==_this.options.disabledHour?void 0:_this.options.disabledHour.call(_this.options,+s)):"minute"===type?disabled=!!(null==_this.options.disabledMinute?void 0:_this.options.disabledMinute.call(_this.options,+s)):"second"===type&&(disabled=!!(null==_this.options.disabledSecond?void 0:_this.options.disabledSecond.call(_this.options,+s))),'<li class="etime-cell etime-'+type+" "+(disabled?"edate-disabled":"")+'" style="height:'+cellH+";line-height: "+cellH+'" data-title="'+s+"\" data-type='"+type+'\'>\n <div class="etime-cell-inner">'+s+"</div>\n </li>"}).join("")+"\n </ul>\n </div>"},_proto._checkTimeFmt=function(time){var times="string"==typeof time?time.split(":"):time;return 3===times.length||+times[0]>=0&&+times[0]<=23&&+times[1]>=0&&+times[1]<=59&&+times[2]>=0&&+times[2]<=59},_create_class$1$1(Time,[{key:"_currentTimes",get:function(){var _this__current;return this._current?null==(_this__current=this._current)?void 0:_this__current.split(":"):["","",""]}},{key:"current",get:function(){return this._current}},{key:"_columns",get:function(){return Array.prototype.slice.call(this.$body.querySelectorAll(".etime-column"))}}]),Time}(Container);function _create_class$6(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$9(o,p){return _set_prototype_of$9=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$9(o,p)}var DEFAULT_TIME_PICKER_OPTIONS={getPopupContainer:function(){return document.body},current:"00:00:00",open:false,showCancel:true,showOk:true,showHeader:true,showFooter:true,wrapClassName:"etime-picker"},TimePicker=function(Picker){function TimePicker(container,options){var _this;return (_this=Picker.call(this,container,Object.assign({},DEFAULT_TIME_PICKER_OPTIONS,options||{},{wrapClassName:options.wrapClassName?(DEFAULT_TIME_PICKER_OPTIONS.wrapClassName+" "+options.wrapClassName).trim():DEFAULT_TIME_PICKER_OPTIONS.wrapClassName}))||this).time=null,_this._current="00:00:00",_this.options=Object.assign({},DEFAULT_TIME_PICKER_OPTIONS,options||{}),_this.options.current&&(_this._current=_this.options.current),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$9(subClass,superClass);}(TimePicker,Picker);var _proto=TimePicker.prototype;return _proto.setCurrent=function(time){this.time&&time&&(this.time.setCurrent(time),this._current="string"==typeof time?time:null==time?void 0:time.join(":"));},_proto.hide=function(){this.open=false;},_proto.destroy=function(){this.time&&(this.time.destroy(),this.time=null),Picker.prototype.destroy.call(this);},_proto._onOpenChange=function(open){var _this=this;if(Picker.prototype._onOpenChange.call(this,open),open)if(this.time)this.current&&this.current!==this.time.current&&this.time.setCurrent(this.current);else {var timeOptions=Object.assign({},this.options,{wrapClassName:"",onChange:function(type,time,times){_this.options.showFooter&&_this.options.showOk||time===_this.current||null==_this.options.onChange||_this.options.onChange.call(_this.options,time,times);},onOk:function(time){time!==_this.current&&(null==_this.options.onChange||_this.options.onChange.call(_this.options,time,time.split(":"))),_this._current=time,null==_this.options.onOk||_this.options.onOk.call(_this.options,time),_this.hide();},onCancel:function(){null==_this.options.onCancel||_this.options.onCancel.call(_this.options),_this.hide();}});this.time=new Time(function(){return _this.$body},timeOptions);}},_create_class$6(TimePicker,[{key:"current",get:function(){return this._current}}]),TimePicker}(Picker);
|
|
10107
10142
|
|
|
10108
10143
|
function _extends$7() {
|
|
10109
10144
|
_extends$7 = Object.assign || function(target) {
|
|
@@ -10404,91 +10439,6 @@
|
|
|
10404
10439
|
return TimePickerControl;
|
|
10405
10440
|
}(Control);
|
|
10406
10441
|
|
|
10407
|
-
var dist$1 = {exports: {}};
|
|
10408
|
-
|
|
10409
|
-
var hasRequiredDist$1;
|
|
10410
|
-
|
|
10411
|
-
function requireDist$1 () {
|
|
10412
|
-
if (hasRequiredDist$1) return dist$1.exports;
|
|
10413
|
-
hasRequiredDist$1 = 1;
|
|
10414
|
-
|
|
10415
|
-
var deepmerge = requireCjs();
|
|
10416
|
-
|
|
10417
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
10418
|
-
return protoProps && function(target, props) {
|
|
10419
|
-
for (var i = 0; i < props.length; i++) {
|
|
10420
|
-
var descriptor = props[i];
|
|
10421
|
-
descriptor.enumerable = descriptor.enumerable || false, descriptor.configurable = true,
|
|
10422
|
-
"value" in descriptor && (descriptor.writable = true), Object.defineProperty(target, descriptor.key, descriptor);
|
|
10423
|
-
}
|
|
10424
|
-
}(Constructor.prototype, protoProps), Constructor;
|
|
10425
|
-
}
|
|
10426
|
-
|
|
10427
|
-
var I18n = function() {
|
|
10428
|
-
function I18n(translations, options) {
|
|
10429
|
-
this._translations = {}, this._locale = null == options ? void 0 : options.defaultLocale,
|
|
10430
|
-
translations && (this._translations = translations, (null == options ? void 0 : options.defaultLocale) || (this._locale = Object.keys(translations)[0])),
|
|
10431
|
-
this.options = options || {};
|
|
10432
|
-
}
|
|
10433
|
-
var _proto = I18n.prototype;
|
|
10434
|
-
return _proto.t = function(scope, variables) {
|
|
10435
|
-
var value, translation = this._translations[this._locale];
|
|
10436
|
-
if (!translation) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + '" locale]';
|
|
10437
|
-
if ("string" == typeof scope && scope.includes(".") && !(scope in translation)) {
|
|
10438
|
-
var _this__findChainValue = this._findChainValue(translation, scope), v = _this__findChainValue[0];
|
|
10439
|
-
if (_this__findChainValue[1]) value = v; else {
|
|
10440
|
-
if (void 0 === (null == variables ? void 0 : variables.defaultvalue)) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + "." + scope + '" translation]';
|
|
10441
|
-
value = variables.defaultvalue;
|
|
10442
|
-
}
|
|
10443
|
-
} else if (scope in translation) value = translation[scope]; else {
|
|
10444
|
-
if (void 0 === (null == variables ? void 0 : variables.defaultvalue)) return "function" == typeof this.options.customizeMissing ? this.options.customizeMissing(scope, variables) : '[missing "' + this._locale + "." + scope + '" translation]';
|
|
10445
|
-
value = variables.defaultvalue;
|
|
10446
|
-
}
|
|
10447
|
-
return "string" == typeof value && variables && /\{\{\s*(\w+)\s*\}\}/.test(value) ? value.replace(/\{\{\s*(\w+)\s*\}\}/g, function(_, varName) {
|
|
10448
|
-
return String(variables[varName]) || "";
|
|
10449
|
-
}) : value;
|
|
10450
|
-
}, _proto.appendTranslations = function(translations) {
|
|
10451
|
-
this._translations = deepmerge(this._translations, translations, {
|
|
10452
|
-
clone: false
|
|
10453
|
-
}), this._locale || (this._locale = Object.keys(this._translations)[0]), this._onChange();
|
|
10454
|
-
}, _proto.switchLocale = function(locale) {
|
|
10455
|
-
locale in this._translations && (this._locale = locale, this._onChange());
|
|
10456
|
-
}, _proto.switchTranslation = function(locale) {
|
|
10457
|
-
this.switchLocale(locale);
|
|
10458
|
-
}, _proto.getCurrentLocale = function() {
|
|
10459
|
-
return this._locale;
|
|
10460
|
-
}, _proto.getCurrentTranslation = function() {
|
|
10461
|
-
return this._translations[this._locale];
|
|
10462
|
-
}, _proto.getVersion = function() {
|
|
10463
|
-
return "2.0.0";
|
|
10464
|
-
}, _proto._onChange = function() {
|
|
10465
|
-
return null == this.options.onChange ? void 0 : this.options.onChange.call(this.options, this);
|
|
10466
|
-
}, _proto._findChainValue = function(obj, path) {
|
|
10467
|
-
for (var paths = path.split("."), translation = obj, i = 0; i < paths.length; i++) {
|
|
10468
|
-
if (!(paths[i] in translation)) return [ void 0, false ];
|
|
10469
|
-
if (translation = translation[paths[i]], i + 1 === paths.length) return [ translation[paths[i]], true ];
|
|
10470
|
-
}
|
|
10471
|
-
return [ void 0, false ];
|
|
10472
|
-
}, _create_class(I18n, [ {
|
|
10473
|
-
key: "locale",
|
|
10474
|
-
get: function() {
|
|
10475
|
-
return this._locale;
|
|
10476
|
-
}
|
|
10477
|
-
}, {
|
|
10478
|
-
key: "translations",
|
|
10479
|
-
get: function() {
|
|
10480
|
-
return this._translations;
|
|
10481
|
-
}
|
|
10482
|
-
} ]), I18n;
|
|
10483
|
-
}();
|
|
10484
|
-
|
|
10485
|
-
I18n.VERSION = "2.0.0", dist$1.exports = I18n;
|
|
10486
|
-
return dist$1.exports;
|
|
10487
|
-
}
|
|
10488
|
-
|
|
10489
|
-
var distExports$1 = requireDist$1();
|
|
10490
|
-
var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
|
|
10491
|
-
|
|
10492
10442
|
/**
|
|
10493
10443
|
* drag scroll support move and touch
|
|
10494
10444
|
*
|
|
@@ -10947,8 +10897,8 @@
|
|
|
10947
10897
|
var DragScroll = /*@__PURE__*/getDefaultExportFromCjs(distExports);
|
|
10948
10898
|
|
|
10949
10899
|
/*
|
|
10950
|
-
* @ezuikit/control-time-line v2.1.0-beta.
|
|
10951
|
-
* Copyright (c) 2026-07-
|
|
10900
|
+
* @ezuikit/control-time-line v2.1.0-beta.9
|
|
10901
|
+
* Copyright (c) 2026-07-28 Ezviz-OpenBiz
|
|
10952
10902
|
* Released under the MIT License.
|
|
10953
10903
|
*/
|
|
10954
10904
|
var _$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%",timePointColor:"#FFF",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",currentTimeBgColor:"#648FFC",currentTimeColor:"#FFFFFF",hoverTipBgColor:"rgba(0, 0, 0, 0.75)",hoverTipColor:"#FFFFFF",hoverLineColor:"rgba(255, 255, 255, 0.8)",opBtnBorderColor:"rgba(153, 153, 153, 1)",opBtnActiveColor:"rgba(54, 159, 255, 1)",opBtnDisabledBorderColor:"rgba(222, 222, 222, 1)",pickerHeaderColor:"rgba(44, 44, 44, 1)",pickerCloseColor:"#20262c",pickerCloseActiveColor:"rgba(240, 87, 87, 1)",pickerItemTitleColor:"rgba(102, 102, 102, 1)",coverFoldPlaceholderBackColor:"#cccccc",coverFoldPlaceholderFrontColor:"#ededed",coverFoldOverlayColor:"rgba(0, 0, 0, 0.3)",itemCoverPlaceholderStartColor:"rgb(183, 195, 207)",itemCoverPlaceholderEndColor:"rgb(212, 209, 209)",timeTextFontSize:12,timeTextFontFamily:"serif",scaleLineWidth:1,onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._timeWidth=this.options.timeWidth||0,this._resize(this.options.width||"100%",this.options.height);}var _proto=BaseTimeLine.prototype;return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},_proto.update=function(current){this._current=current;},_proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},_proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},_proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},_proto.destroy=function(){this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:function(){return this._current},set:function(current){this._current=current;}},{key:"readOnly",get:function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:function(){return this._timeSections}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}return TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},TimeLineUtil.timeToMinute=function(time){var e=time.split(":");return 60*Number(e[0])+Number(e[1])},TimeLineUtil.tranTimeToString=function(start,end){var _DateTime_toDate,_DateTime_toDate1,secondNum=Math.floor((null==(_DateTime_toDate=distExports$4.DateTime.toDate(end))?void 0:_DateTime_toDate.getTime())-(null==(_DateTime_toDate1=distExports$4.DateTime.toDate(start))?void 0:_DateTime_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?distExports$4.DateTime.fillZero(minute)+"'":"0'")+distExports$4.DateTime.fillZero(second)+"''"},TimeLineUtil}(),_$TIMELINE_ICONS$__tip='<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>',_$TIMELINE_ICONS$__plus='\n <svg viewBox="0 0 16 16" stroke="currentColor" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__minus='\n <svg viewBox="0 0 16 16" stroke="currentColor" fill="none" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__close='\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n ',_$TIMELINE_ICONS$__pause='<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n ',_$TIMELINE_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',_$TIMELINE_ICONS$__event='\n <svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="event">\n <path d="M14.074 2.91669C15.4547 2.91669 16.574 4.03597 16.574 5.41669V15.8334C16.574 17.2141 15.4547 18.3334 14.074 18.3334H5.32968C3.94897 18.3334 2.82968 17.2141 2.82968 15.8334V5.41669C2.82968 4.03597 3.94897 2.91669 5.32968 2.91669H14.074ZM5.32968 4.16669C4.63933 4.16669 4.07968 4.72633 4.07968 5.41669V15.8334C4.07968 16.5237 4.63933 17.0834 5.32968 17.0834H14.074C14.7644 17.0834 15.324 16.5237 15.324 15.8334V5.41669C15.324 4.72633 14.7644 4.16669 14.074 4.16669H5.32968Z"/>\n <path d="M11.7228 8.54169C12.068 8.54169 12.3478 8.82151 12.3478 9.16669C12.3478 9.51186 12.068 9.79169 11.7228 9.79169H6.56897C6.22379 9.79169 5.94397 9.51186 5.94397 9.16669C5.94397 8.82151 6.22379 8.54169 6.56897 8.54169H11.7228Z"/>\n <path d="M9.14659 11.875C9.49165 11.8751 9.77159 12.1549 9.77159 12.5C9.77159 12.8451 9.49165 13.1249 9.14659 13.125H6.56927C6.2241 13.125 5.94427 12.8452 5.94427 12.5C5.94427 12.1548 6.2241 11.875 6.56927 11.875H9.14659Z"/>\n <path d="M7.09341 4.46613C7.09341 4.8113 6.81359 5.09113 6.46841 5.09113C6.12324 5.09113 5.84341 4.8113 5.84341 4.46613V2.47394C5.84341 2.12876 6.12324 1.84894 6.46841 1.84894C6.81359 1.84894 7.09341 2.12876 7.09341 2.47394V4.46613Z"/>\n <path d="M13.5607 4.46613C13.5607 4.8113 13.2809 5.09113 12.9357 5.09113C12.5905 5.09113 12.3107 4.8113 12.3107 4.46613V2.47394C12.3107 2.12876 12.5905 1.84894 12.9357 1.84894C13.2809 1.84894 13.5607 2.12876 13.5607 2.47394V4.46613Z"/>\n </svg>\n ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]],__$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__={targets:[],root:null,rootMargin:"0px",threshold:.1,loadingClass:"ez-lazy-image-loading",loadedClass:"ez-lazy-image-loaded",loadedErrorClass:"ez-lazy-image-error",onLoadError:function(){}},ImageLazyLoader=function(){function ImageLazyLoader(options){ void 0===options&&(options={}),this.options=Object.assign({},__$IMAGE_LAZY_LOADER_DEFAULT_OPTIONS$__,options),this._observer=null,this._init();}var _proto=ImageLazyLoader.prototype;return _proto._init=function(){var _this=this;ImageLazyLoader.isSupported&&(this._observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){var _this__observer;entry.isIntersecting&&(_this._loadImage(entry.target),null==(_this__observer=_this._observer)||_this__observer.unobserve(entry.target));});},this.options)),this.addImages(this.options.targets);},_proto._loadImage=function(img){var _img_classList,_img_classList1,_img_classList2,_this=this;if(img&&!(null==(_img_classList=img.classList)?void 0:_img_classList.contains(this.options.loadingClass))&&!(null==(_img_classList1=img.classList)?void 0:_img_classList1.contains(this.options.loadedClass))&&!(null==(_img_classList2=img.classList)?void 0:_img_classList2.contains(this.options.loadedErrorClass))&&img.hasAttribute("data-src")){var _this1=this;img.classList.add(this.options.loadingClass);var tempImg=new Image;tempImg.onload=function(){img.src=img.dataset.src,img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedClass),img.dispatchEvent(new Event("lazyloaded"));},tempImg.onerror=function(e){img.classList.remove(_this.options.loadingClass),img.classList.add(_this.options.loadedErrorClass),null==_this1.options.onLoadError||_this1.options.onLoadError.call(_this1.options,img);},tempImg.src=img.dataset.src;}},_proto.addImages=function(targets){var _this=this;(null==targets?void 0:targets.length)&&targets.forEach(function(target){var _this__observer;(null==target?void 0:target.hasAttribute("data-src"))&&(ImageLazyLoader.isSupported&&_this._observer?null==(_this__observer=_this._observer)||_this__observer.observe(target):_this._loadImage(target));});},_proto.destroy=function(){this._observer&&(this._observer.disconnect(),this._observer=null);},ImageLazyLoader}();function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1$1(){return _extends$1$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1$1.apply(this,arguments)}function _set_prototype_of$1$1(o,p){return _set_prototype_of$1$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1$1(o,p)}ImageLazyLoader.isSupported="IntersectionObserver"in window;var _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",currentTimeBgColor:"#648FFC",currentTimeColor:"#FFFFFF",showTimeWidthBtn:true,showCoverFold:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_this._imageLazyLoader=null,_this._imageLazyLoaderPicker=null,_this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0},_this._onImageError=_this._onImageError.bind(_this),_this._plusClick=_this._plusClick.bind(_this),_this._minusClick=_this._minusClick.bind(_this),_this._onPickerClose=_this._onPickerClose.bind(_this),_this._onClickItem=_this._onClickItem.bind(_this),_this._onClickCoverFold=_this._onClickCoverFold.bind(_this),_this._imageLazyLoader=new ImageLazyLoader({root:_this.$container,onLoadError:function(img){null==_this._onImageError||_this._onImageError.call(_this,img);}}),_this._render(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this._applyCssVars(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;return _proto._applyCssVars=function(){var opts,_this=this,vars=(opts=this.options,{"--ez-time-line-axis-border-color":String(opts.timeAxisBgColor),"--ez-time-line-section-color":String(opts.timeSectionColor),"--ez-time-line-text-color":String(opts.timeTextColor),"--ez-time-line-point-color":String(opts.timePointColor),"--ez-time-line-current-bg":String(opts.currentTimeBgColor),"--ez-time-line-current-color":String(opts.currentTimeColor),"--ez-time-line-op-btn-border":String(opts.opBtnBorderColor),"--ez-time-line-op-btn-active":String(opts.opBtnActiveColor),"--ez-time-line-op-btn-disabled-border":String(opts.opBtnDisabledBorderColor),"--ez-time-line-picker-header":String(opts.pickerHeaderColor),"--ez-time-line-picker-close":String(opts.pickerCloseColor),"--ez-time-line-picker-close-active":String(opts.pickerCloseActiveColor),"--ez-time-line-picker-item-title":String(opts.pickerItemTitleColor),"--ez-time-line-cover-fold-placeholder-back":String(opts.coverFoldPlaceholderBackColor),"--ez-time-line-cover-fold-placeholder-front":String(opts.coverFoldPlaceholderFrontColor),"--ez-time-line-cover-fold-overlay":String(opts.coverFoldOverlayColor),"--ez-time-line-item-cover-placeholder-start":String(opts.itemCoverPlaceholderStartColor),"--ez-time-line-item-cover-placeholder-end":String(opts.itemCoverPlaceholderEndColor),"--ez-time-line-hover-tip-bg":String(opts.hoverTipBgColor),"--ez-time-line-hover-tip-color":String(opts.hoverTipColor)});Object.entries(vars).forEach(function(param){var name=param[0],value=param[1];return _this.$container.style.setProperty(name,value)});},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},_proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},_proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1$1({},record,{startTime:distExports$4.DateTime.format(record.startTime,"HH:mm:ss"),endTime:distExports$4.DateTime.format(record.endTime,"HH:mm:ss")})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:distExports$4.DateTime.format(this.current||(new Date).getTime(),"HH:mm:ss")}),this._matchTimeDot();},_proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:distExports$4.DateTime.format(time,"HH:mm:ss")}),this._currentOffsetH());},_proto.destroy=function(){var _this__dragScroll;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList),this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer),this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op),this._$op=null;}catch(error){}this._picker&&(this._picker.destroy(),this._picker=null),this._imageLazyLoader&&(this._imageLazyLoader.destroy(),this._imageLazyLoader=null),this._imageLazyLoaderPicker&&(this._imageLazyLoaderPicker.destroy(),this._imageLazyLoaderPicker=null),this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},_proto._setState=function(obj){var _this=this;Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(distExports$4.DateTime.format((null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime)||(new Date).getTime(),"YYYY-MM-DD")+"T"+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},_proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth;i>=0;){var marginTop=0,marginBottom=0;i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)}),i-=scaleWidth;}this._setState({timeArr:timeArr}),this._matchRecTimeDot();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;container.innerHTML="",timeArr.forEach(function(item,index){var _this__imageLazyLoader,timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),item.marginBottom&&(timeItemDOM.style.cssText+="margin-bottom: "+item.marginBottom+"px;"),timeItemDOM.style.cssText+="border-right-color: "+String(_this.options.timeAxisBgColor)+";",timeItemDOM.setAttribute("data-time",item.current),timeItemDOM.setAttribute("data-index",index+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&_this.options.showCoverFold&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img data-src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-time-cover-fold-len">\n '+(item.coverArr.length>1?_this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):""+distExports$4.DateTime.format(item.coverArr[0].startTime,"HH:mm"))+"\n </span>\n "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-time-unavail"\n style="height: '+i.height+"px;background-color:"+String(_this.options.timeSectionColor)+"; top: "+i.top+'px">\n </div>';}),timeItemHtml+="<div id="+item.label+' class="ez-time-line-time-label" style="color: '+String(_this.options.timeTextColor)+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),item.coverArr.length&&_this.options.showCoverFold&&(null==(_this__imageLazyLoader=_this._imageLazyLoader)||_this__imageLazyLoader.addImages(container.querySelectorAll("img.ez-time-line-img")||[]));}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+String(this.options.currentTimeBgColor)+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+String(this.options.timePointColor)+';"></span>\n <div class="ez-time-line-current-value" style="color: '+String(this.options.currentTimeColor)+'">00:00:00</div>\n </div>',this.$container.appendChild(this._$currentTime),this._$itemContainer=document.createElement("div"),this._$itemContainer.classList.add("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this.options.showCoverFold&&(this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._imageLazyLoaderPicker=new ImageLazyLoader({root:this._picker.$body,onLoadError:function(img){null==_this._onImageError||_this._onImageError.call(_this,img);}})),this._addEventListener();},_proto._addEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){var hour=distExports$4.DateTime.format(item.startTime,"HH");obj[+hour]?obj[+hour].push(_extends$1$1({},item,{_index:index})):obj[+hour]=[_extends$1$1({},item,{_index:index})];}),obj},_proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(distExports$4.DateTime.format(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},_proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this__imageLazyLoaderPicker,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-picker-close">'+_$TIMELINE_ICONS$__close+"</span>\n "+this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})+'\n </div>\n <div class="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-picker-item-content"\n data-start="'+distExports$4.DateTime.format(item.startTime,"YYYYMMDDTHHmmssZ")+'"\n data-end="'+distExports$4.DateTime.format(item.endTime,"YYYYMMDDTHHmmssZ")+'"\n data-index="'+item._index+'">\n <span class="ez-time-line-picker-item-time">'+distExports$4.DateTime.format(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" data-src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&(null==(_this__imageLazyLoaderPicker=this._imageLazyLoaderPicker)||_this__imageLazyLoaderPicker.addImages((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]));},_proto._onImageError=function(img){if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.setAttribute("data-error","true"),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-Math.floor((y-60)*this._scaleWidth);return [second,distExports$4.DateTime.fillZero(Math.floor(second/3600))+":"+distExports$4.DateTime.fillZero(Math.floor(second%3600/60))+":"+distExports$4.DateTime.fillZero(second%60)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function isOverlap(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)}function _extends$5(){return _extends$5=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$5.apply(this,arguments)}function getTouchDistance(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)}function _create_class$3(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _set_prototype_of$6(o,p){return _set_prototype_of$6=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$6(o,p)}var _REC_EVENT_KEYS_=[1,2,3,4,5,6,"ALRAM","TIMIING","CAR","HD"],_$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,readOnly:false,scaleOffsetTop:4,showYearMonthDay:true,showHoverTip:true,hoverTipPlacement:"follow",enabledClickToSeek:true,enabledWheelZoom:true,showSectionIcon:false,sectionIconColor:"#FFFFFF",sectionIconSize:14,showSectionCount:true,sectionCountColor:"#FFFFFF",sectionCountBgColor:"#FF4D4F"},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,_this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._lastTouchDist=0,_this._$hoverTip=null,_this._hoverRafId=null,_this._hoverX=0,_this._hoverY=0,_this._hoverActive=false,_this._hoverLineX=0,_this._dragMoved=false,_this._containerRect=null,_this._drawRafId=null,_this._$sectionIconLayer=null,_this._sectionIconPool=[],_this.$container=container,_this._mousemoveFun=_this._mousemoveFun.bind(_this),_this._mouseoverFun=_this._mouseoverFun.bind(_this),_this._mouseleaveFun=_this._mouseleaveFun.bind(_this),_this._mousedownFun=_this._mousedownFun.bind(_this),_this._mouseUpFun=_this._mouseUpFun.bind(_this),_this._mousewheelFun=_this._mousewheelFun.bind(_this),_this._containerWheelFun=_this._containerWheelFun.bind(_this),_this._touchstartFun=_this._touchstartFun.bind(_this),_this._touchmoveFun=_this._touchmoveFun.bind(_this),_this._touchendFun=_this._touchendFun.bind(_this),_this._clickFun=_this._clickFun.bind(_this),_this._init(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$6(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cursor="pointer"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._initSectionIconLayer(),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._initHoverTip(),this._applyHoverTipVars(),this._addEventListener();},_proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.width=this.width+"px"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.height=this.height+"px"),this._$sectionIconLayer&&(this._$sectionIconLayer.style.width=this.width+"px",this._$sectionIconLayer.style.height=this.height+"px"),this._containerRect=null,this._draw();},_proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},_proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},_proto.update=function(time){time&&!this._isMouseDown&&this._update({current:distExports$4.DateTime.toDate(time)});},_proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,function(timeSections){if(0===timeSections.length)return timeSections;for(var normalized=timeSections.map(function(item){var startTime=item.startTime,endTime=item.endTime;return 10===(startTime+"").length&&(startTime*=1e3),10===(endTime+"").length&&(endTime*=1e3),_extends$5({},item,{startTime:startTime,endTime:endTime})}),merged=[normalized[0]],i=1;i<normalized.length;i++){var prev=merged[merged.length-1],curr=normalized[i];prev.endTime>=curr.startTime?prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged}(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw(),this._hoverActive&&this._$hoverTip&&!this._isMouseDown&&this._showHoverTip(this._hoverX,this._hoverY);},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cursor=readOnly?"not-allowed":"pointer");},_proto.destroy=function(){this._removeEventListener(),this._hideHoverTip(),null!=this._drawRafId&&(cancelAnimationFrame(this._drawRafId),this._drawRafId=null),this._$hoverTip&&this._$hoverTip.remove(),this._$hoverTip=null,this._$sectionIconLayer&&this._$sectionIconLayer.remove(),this._$sectionIconLayer=null,this._sectionIconPool=[],this._$canvas&&this._$canvas.remove(),this._$canvas=null,this._ctx=null,this._containerRect=null,BaseTimeLine.prototype.destroy.call(this);},_proto._initSectionIconLayer=function(){var _this=this;if(this.options.showSectionIcon){var layer=document.createElement("div");layer.className="ez-time-line-section-icon-layer",layer.style.width=this.width+"px",layer.style.height=this.height+"px",this.$container.appendChild(layer),this._$sectionIconLayer=layer,delegate(layer,".ez-time-line-section-icon","click",function(event){event.stopImmediatePropagation(),event.stopPropagation(),event.preventDefault();var el=event.delegateTarget,startTime=Number(el.dataset.start),count=Number(el.dataset.count),index=Number(el.dataset.index);Number.isNaN(startTime)||null==_this.options.onSectionIconClick||_this.options.onSectionIconClick.call(_this.options,{startTime:startTime,count:Number.isNaN(count)?0:count,index:Number.isNaN(index)?-1:index});});}},_proto._isEventSection=function(section){var type=section.EVENT_TYPE;return void 0!==type&&_REC_EVENT_KEYS_.includes(type)},_proto._collectSectionIcons=function(offsetTop,sectionHeight){var _this_options_sectionIconSize,_this=this,renders=[];if(!this.options.showSectionIcon)return renders;var timeArr=this.timeSections||[],intervalSec=this._timeWidthArray[0];if(!intervalSec)return renders;for(var intervalMs=1e3*intervalSec,buckets=new Map,i=0;i<timeArr.length;i++){var section=timeArr[i];if(section&&"number"==typeof section.startTime&&this._isEventSection(section)){var idx=Math.floor(section.startTime/intervalMs),bucket=buckets.get(idx);bucket?(bucket.count+=1,section.startTime<bucket.startTime&&(bucket.startTime=section.startTime,bucket.index=i)):buckets.set(idx,{count:1,startTime:section.startTime,index:i});}}var dpr=this.options.dpr,iconSizePx=null!=(_this_options_sectionIconSize=this.options.sectionIconSize)?_this_options_sectionIconSize:14,sectionHeightPx=sectionHeight/dpr,offsetTopCss=offsetTop/dpr,size=Math.min(iconSizePx,sectionHeightPx),canvasWidthDpr=this.width*dpr;return buckets.forEach(function(bucket,idx){var bucketStart=idx*intervalMs,position=_this._findPosition({startTime:bucketStart,endTime:bucketStart+intervalMs});if(isOverlap(0,canvasWidthDpr,position.x1,position.x2)){var bucketWidthPx=(position.x2-position.x1)/dpr;renders.push({left:position.x1/dpr+(bucketWidthPx-size)/2,top:offsetTopCss+(sectionHeightPx-size)/2,size:size,count:bucket.count,startTime:bucket.startTime,index:bucket.index});}}),renders},_proto._createSectionIconEl=function(){var _this_options_sectionIconColor,_this_options_sectionCountColor,_this_options_sectionCountBgColor,span=document.createElement("span");span.className="ez-time-line-section-icon",span.style.color=null!=(_this_options_sectionIconColor=this.options.sectionIconColor)?_this_options_sectionIconColor:"#FFFFFF",span.innerHTML=_$TIMELINE_ICONS$__event;var count=document.createElement("span");return count.className="ez-time-line-section-icon-count",count.style.color=null!=(_this_options_sectionCountColor=this.options.sectionCountColor)?_this_options_sectionCountColor:"#FFFFFF",count.style.backgroundColor=null!=(_this_options_sectionCountBgColor=this.options.sectionCountBgColor)?_this_options_sectionCountBgColor:"#FF4D4F",count.style.display="none",span.appendChild(count),span},_proto._renderSectionIcons=function(renders){var layer=this._$sectionIconLayer;if(layer&&this.options.showSectionIcon){for(var pool=this._sectionIconPool,showCount=this.options.showSectionCount,i=0;i<renders.length;i++){var r=renders[i],el=pool[i];el||(el=this._createSectionIconEl(),layer.appendChild(el),pool.push(el)),el.style.display="",el.style.left=r.left+"px",el.style.bottom="0px",el.dataset.start=String(r.startTime),el.dataset.count=String(r.count),el.dataset.index=String(r.index);var countEl=el.lastElementChild;showCount&&r.count>0?(countEl.textContent=r.count>99?"99+":String(r.count),countEl.style.display=""):countEl.style.display="none";}for(;i<pool.length;i++)pool[i].style.display="none";}},_proto._initHoverTip=function(){if(this.options.showHoverTip){var tip=document.createElement("div");tip.className="ez-time-line-hover-tip",this.$container.appendChild(tip),this._$hoverTip=tip,this._applyHoverTipVars();}},_proto._applyHoverTipVars=function(){this.$container.style.setProperty("--ez-time-line-hover-tip-bg",String(this.options.hoverTipBgColor)),this.$container.style.setProperty("--ez-time-line-hover-tip-color",String(this.options.hoverTipColor));},_proto._hoverTimeAt=function(x){var seconds=(x-this.width/2)/this._curScaleSpacing*this._timeWidthArray[0];return new Date(this.current.getTime()+Math.round(1e3*seconds))},_proto._localDayStartSec=function(sec){var d=new Date(1e3*sec);return d.setHours(0,0,0,0),Math.floor(d.getTime()/1e3)},_proto._getContainerRect=function(){return this._containerRect||(this._containerRect=this.$container.getBoundingClientRect()),this._containerRect},_proto._scheduleDraw=function(){var _this=this;null==this._drawRafId&&(this._drawRafId=requestAnimationFrame(function(){_this._drawRafId=null,_this._draw();}));},_proto._formatHoverTime=function(date){if("function"==typeof this.options.renderHoverTip)return this.options.renderHoverTip(date);var fmt=this.options.hoverTipFormat||"yyyy-MM-dd HH:mm:ss";return distExports$4.DateTime.format(date,fmt)},_proto._showHoverTip=function(x,y){var _this=this;this._$hoverTip&&(this._hoverX=x,this._hoverY=y,null==this._hoverRafId&&(this._hoverRafId=requestAnimationFrame(function(){_this._hoverRafId=null,_this._renderHoverTip();})));},_proto._renderHoverTip=function(){var tip=this._$hoverTip;if(tip){var width=this.width,tx=Math.max(0,Math.min(this._hoverX,width)),date=this._hoverTimeAt(tx),content=this._formatHoverTime(date);"function"==typeof this.options.renderHoverTip?tip.innerHTML=content:tip.textContent=content,tip.style.display="inline-flex",tip.style.opacity="1";var left,top,tipW=tip.offsetWidth;if("top"===this.options.hoverTipPlacement)(left=this._hoverX-tipW/2)+tipW>width&&(left=width-tipW),left<0&&(left=0),top=-tip.offsetHeight-2;else {(left=this._hoverX+14)+tipW>width&&(left=this._hoverX-14-tipW),left<0&&(left=0),top=this._hoverY+16;}tip.style.left=left+"px",tip.style.top=top+"px";}},_proto._hideHoverTip=function(){null!=this._hoverRafId&&(cancelAnimationFrame(this._hoverRafId),this._hoverRafId=null),this._$hoverTip&&(this._$hoverTip.style.display="none",this._$hoverTip.style.opacity="0");},_proto._draw=function(){this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale(),this._drawHoverLine();},_proto._drawHoverLine=function(){if(this._hoverActive&&!this._isMouseDown&&this._ctx){var dpr=this.options.dpr,x=Math.max(0,Math.min(this._hoverLineX,this.width))*dpr,lineWidth=this.options.scaleLineWidth*dpr;this._drawSolidLine(x,0,x,this.height*dpr,lineWidth,this.options.hoverLineColor);}},_proto._drawScale=function(){var lineWidth=this.options.scaleLineWidth*this.options.dpr;this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-this._localDayStartSec(curScaleTime))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-this._localDayStartSec(leftLastScaleTime))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(distExports$4.DateTime.format(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD HH:mm:ss"),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-this._localDayStartSec(rightLastScaleTime))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(distExports$4.DateTime.format(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD HH:mm:ss"),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}this._drawCenterIndicator(centerPosition.x,centerPosition.y);},_proto._drawCenterIndicator=function(centerX,totalHeight){if(this._ctx){var dpr=this.options.dpr,lineW=2*dpr,triH=3*dpr,baseW=6*dpr,baseH=5*dpr,x=centerX;this._ctx.save(),this._ctx.fillStyle=this.options.timePointColor,this._ctx.fillRect(x-lineW/2,0,lineW,totalHeight),this._ctx.beginPath(),this._ctx.moveTo(x-baseW/2,0),this._ctx.lineTo(x+baseW/2,0),this._ctx.lineTo(x+baseW/2,baseH),this._ctx.lineTo(x,baseH+triH),this._ctx.lineTo(x-baseW/2,baseH),this._ctx.closePath(),this._ctx.fill(),this._ctx.beginPath(),this._ctx.moveTo(x-baseW/2,totalHeight),this._ctx.lineTo(x+baseW/2,totalHeight),this._ctx.lineTo(x+baseW/2,totalHeight-baseH),this._ctx.lineTo(x,totalHeight-baseH-triH),this._ctx.lineTo(x-baseW/2,totalHeight-baseH),this._ctx.closePath(),this._ctx.fill(),this._ctx.restore();}},_proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},_proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=(opts=this.options,dpr=this.options.dpr,(null!=(_opts_timeTextFontSize=opts.timeTextFontSize)?_opts_timeTextFontSize:12)*(dpr||1)+"px "+(null!=(_opts_timeTextFontFamily=opts.timeTextFontFamily)?_opts_timeTextFontFamily:"serif")),this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),!this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}var opts,dpr,_opts_timeTextFontSize,_opts_timeTextFontFamily;},_proto._drawSections=function(){for(var timeArr=this.timeSections||[],dpr=this.options.dpr,_ref=this.options.timeSectionOffset||[],tmp=_ref[0],offsetTopPx=void 0===tmp?0:tmp,tmp1=_ref[1],offsetTop=offsetTopPx*dpr,offsetBottom=(void 0===tmp1?0:tmp1)*dpr,sectionHeight=this.height*dpr-offsetTop-offsetBottom,i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);this._ctx&&isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,this._ctx.fillRect(position.x1,offsetTop,position.x2-position.x1,sectionHeight));}this._renderSectionIcons(this._collectSectionIcons(offsetTop,sectionHeight));},_proto._findPosition=function(item){var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},_proto._addEventListener=function(){this._$canvas&&(this._$canvas.addEventListener("mousemove",this._mousemoveFun),this._$canvas.addEventListener("mouseover",this._mouseoverFun),this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),this._$canvas.addEventListener("mousedown",this._mousedownFun),this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("click",this._clickFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),this.$container.addEventListener("wheel",this._containerWheelFun,{passive:false}),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},_proto._removeEventListener=function(){this._$canvas&&(this._$canvas.removeEventListener("mousemove",this._mousemoveFun),this._$canvas.removeEventListener("mouseover",this._mouseoverFun),this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),this._$canvas.removeEventListener("mousedown",this._mousedownFun),this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("click",this._clickFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this.$container.removeEventListener("wheel",this._containerWheelFun),this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},_proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,this._dragMoved=false,this._hideHoverTip(),this._hoverActive=false,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},_proto._mouseoverFun=function(){this.readOnly||(this._isOver=true,this._containerRect=this.$container.getBoundingClientRect());},_proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._containerRect=null,this._hideHoverTip(),this._hoverActive=false,this._draw(),this._moveEndOrTouchEndFun(e));},_proto._containerWheelFun=function(e){this.options.enabledWheelZoom&&e.target===this._$canvas&&e.preventDefault();},_proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},_proto._clickFun=function(e){if(!this.readOnly&&this.options.enabledClickToSeek)if(this._dragMoved)this._dragMoved=false;else {var rect=this._getContainerRect(),x=e.clientX-rect.left,date=this._hoverTimeAt(x);this._update({current:date}),null==this.options.onClickSeek||this.options.onClickSeek.call(this.options,date);}},_proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left;var rect=this._getContainerRect();this._hoverActive=true,this._hoverLineX=e.clientX-rect.left,this._scheduleDraw(),this._showHoverTip(e.clientX-rect.left,e.clientY-rect.top);}},_proto._mousewheelFun=function(e){if(this.options.enabledWheelZoom)if(e.preventDefault(),e.deltaY>0){if(this.timeWidth<=0)return;this.setTimeWidth(this.timeWidth-1);}else this.setTimeWidth(this.timeWidth+1);},_proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(this._lastTouchDist=getTouchDistance(e.touches));},_proto._touchmoveFun=function(e){if(e.preventDefault(),e.stopPropagation(),!this.readOnly)if(1===e.touches.length){var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else 2===e.touches.length&&(this._lastTouchDist=getTouchDistance(e.touches));},_proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},_proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},_proto._moveUpdateFun=function(x){var mouseOffset=this._mousePosition-x;if(0!==mouseOffset){if(this._oldTime){var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true,this._dragMoved=true;}},_create_class$3(TimeLine,[{key:"_curScaleSpacing",get:function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2))}}]),TimeLine}(BaseTimeLine);TimeLine.TIME_WIDTH=TIME_WIDTH;
|
|
@@ -12151,6 +12101,97 @@
|
|
|
12151
12101
|
if ((_theme_controls1 = theme.controls) == null ? void 0 : _theme_controls1['recControl']) ((_theme_controls2 = theme.controls) == null ? void 0 : _theme_controls2['recControl']).addRecType(recType);
|
|
12152
12102
|
};
|
|
12153
12103
|
|
|
12104
|
+
/**
|
|
12105
|
+
* 布局溢出(More 收纳)与响应式尺寸分档的**纯函数**模块。
|
|
12106
|
+
*
|
|
12107
|
+
* @remarks
|
|
12108
|
+
* 这些函数只做「计算 / 判定」,不含任何 DOM 副作用,因此可以在没有布局引擎的环境(如 jsdom)
|
|
12109
|
+
* 中被完整单元测试。`theme.ts` 中的命令式外壳(读取 `clientWidth`、增删 class、创建 More、
|
|
12110
|
+
* 搬移控件)负责副作用,具体的判定逻辑全部下沉到这里。
|
|
12111
|
+
*/ /**
|
|
12112
|
+
* 一次 classList 变更集合:需要添加与需要移除的类名。
|
|
12113
|
+
*/ /**
|
|
12114
|
+
* 根据尺寸计算某一维度(宽或高)需要增删的响应式档位类名。
|
|
12115
|
+
*
|
|
12116
|
+
* 档位规则:
|
|
12117
|
+
* - `(280, 375]` → medium
|
|
12118
|
+
* - `(200, 280]` → small
|
|
12119
|
+
* - `<= 200` → mini
|
|
12120
|
+
* - 其它(> 375)→ 无档位(移除全部)
|
|
12121
|
+
*
|
|
12122
|
+
* @param size 尺寸(px)
|
|
12123
|
+
* @param axis `'width'` 或 `'height'`
|
|
12124
|
+
* @param prefix 类名前缀(如 `ezplayer`)
|
|
12125
|
+
*/ function computeDimensionClasses(size, axis, prefix) {
|
|
12126
|
+
var medium = prefix + "-medium-" + axis;
|
|
12127
|
+
var small = prefix + "-small-" + axis;
|
|
12128
|
+
var mini = prefix + "-mini-" + axis;
|
|
12129
|
+
var add = [];
|
|
12130
|
+
var remove = [];
|
|
12131
|
+
if (size > 280 && size <= 375) {
|
|
12132
|
+
add.push(medium);
|
|
12133
|
+
remove.push(small, mini);
|
|
12134
|
+
} else if (size > 200 && size <= 280) {
|
|
12135
|
+
add.push(small);
|
|
12136
|
+
remove.push(medium, mini);
|
|
12137
|
+
} else {
|
|
12138
|
+
if (size <= 200) {
|
|
12139
|
+
add.push(mini);
|
|
12140
|
+
} else {
|
|
12141
|
+
remove.push(mini);
|
|
12142
|
+
}
|
|
12143
|
+
remove.push(small, medium);
|
|
12144
|
+
}
|
|
12145
|
+
return {
|
|
12146
|
+
add: add,
|
|
12147
|
+
remove: remove
|
|
12148
|
+
};
|
|
12149
|
+
}
|
|
12150
|
+
/**
|
|
12151
|
+
* 计算宽、高两个维度的响应式档位类名增删集合。
|
|
12152
|
+
* @param width 容器宽度(px)
|
|
12153
|
+
* @param height 容器高度(px)
|
|
12154
|
+
* @param prefix 类名前缀
|
|
12155
|
+
*/ function computeSizeClasses(width, height, prefix) {
|
|
12156
|
+
var w = computeDimensionClasses(width, 'width', prefix);
|
|
12157
|
+
var h = computeDimensionClasses(height, 'height', prefix);
|
|
12158
|
+
return {
|
|
12159
|
+
add: [].concat(w.add, h.add),
|
|
12160
|
+
remove: [].concat(w.remove, h.remove)
|
|
12161
|
+
};
|
|
12162
|
+
}
|
|
12163
|
+
/**
|
|
12164
|
+
* header 左右控件宽度之和 + 30 是否超过容器宽度 —— 超过则需要显示 More。
|
|
12165
|
+
*/ function shouldShowHeaderMore(width, leftWidth, rightWidth) {
|
|
12166
|
+
return leftWidth + rightWidth + 30 > width;
|
|
12167
|
+
}
|
|
12168
|
+
/**
|
|
12169
|
+
* header 剩余空间是否 > 100 —— 足够则可以移除 More,把控件放回工具栏。
|
|
12170
|
+
*/ function shouldRemoveHeaderMore(width, leftWidth, rightWidth) {
|
|
12171
|
+
return width - leftWidth - rightWidth > 100;
|
|
12172
|
+
}
|
|
12173
|
+
/**
|
|
12174
|
+
* footer 剩余空间是否 < 16 —— 不足则需要把控件收拢进 More。
|
|
12175
|
+
*/ function shouldCollapseFooter(width, leftWidth, rightWidth) {
|
|
12176
|
+
return width - leftWidth - rightWidth < 16;
|
|
12177
|
+
}
|
|
12178
|
+
/**
|
|
12179
|
+
* footer 从 More 中释放控件时的展开阈值。
|
|
12180
|
+
*
|
|
12181
|
+
* 基准为 50;当 More 中已有控件时,加上首个控件宽度(保持与历史实现一致的运算与兜底:
|
|
12182
|
+
* `50 + firstItemWidth || 0`)。
|
|
12183
|
+
* @param firstItemWidth More 列表中第一个控件的宽度;未提供表示 More 为空。
|
|
12184
|
+
*/ function computeFooterExpandOffset(firstItemWidth) {
|
|
12185
|
+
var base = 50;
|
|
12186
|
+
if (firstItemWidth === undefined) return base;
|
|
12187
|
+
return base + firstItemWidth || 0;
|
|
12188
|
+
}
|
|
12189
|
+
/**
|
|
12190
|
+
* footer 剩余空间是否足够把一个控件从 More 释放回工具栏。
|
|
12191
|
+
*/ function shouldExpandFooter(width, leftWidth, rightWidth, offset) {
|
|
12192
|
+
return width - leftWidth - rightWidth > offset;
|
|
12193
|
+
}
|
|
12194
|
+
|
|
12154
12195
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */ function _array_like_to_array(arr, len) {
|
|
12155
12196
|
if (len == null || len > arr.length) len = arr.length;
|
|
12156
12197
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -12404,7 +12445,7 @@
|
|
|
12404
12445
|
_inherits(Theme, EventEmitter);
|
|
12405
12446
|
function Theme(options) {
|
|
12406
12447
|
var _this;
|
|
12407
|
-
var _this_options_volumeOptions, _this_options_volumeOptions1, _this_options_speedOptions, _this_options, _this_options1
|
|
12448
|
+
var _this_options_volumeOptions, _this_options_volumeOptions1, _this_options_speedOptions, _this_options, _this_options1;
|
|
12408
12449
|
_this = EventEmitter.call(this) || this, /** 播放器配置项 */ _this.options = THEME_DEFAULT_OPTIONS, _this.staticPath = '', /** 所有控件列表, 所有控件名称规则(`${iconId}Control`), 如音量控件 this.controls["volumeControl"] @since 0.0.1 */ _this.controls = {}, /**
|
|
12409
12450
|
* @since 0.0.1
|
|
12410
12451
|
* @private
|
|
@@ -12484,16 +12525,31 @@
|
|
|
12484
12525
|
_this._headerMoreControlShow = debounce(_this._headerMoreControlShow.bind(_this), 200);
|
|
12485
12526
|
_this._footerMoreControlShow = debounce(_this._footerMoreControlShow.bind(_this), 200);
|
|
12486
12527
|
_this.destroyed = false;
|
|
12487
|
-
|
|
12488
|
-
//
|
|
12489
|
-
//
|
|
12490
|
-
|
|
12491
|
-
|
|
12492
|
-
|
|
12528
|
+
// 标准流暂时仅支持 TEMPLATES 中的配置,多余的展示不生效(如电子放大等),待版本更新后才能支持。
|
|
12529
|
+
//
|
|
12530
|
+
// 下面根据播放类型决定初始渲染使用的「主题数据 / 模板」,规则如下:
|
|
12531
|
+
// 关键点:themeData 只要不是 undefined(即便显式传入 null)就以它为准,
|
|
12532
|
+
// 仅当未传(undefined)时才回退到对应的标准模板;
|
|
12533
|
+
// 因此 themeData: null 表示「不展示主题」,而非回退到默认模板。
|
|
12534
|
+
var themeData = (_this_options = _this.options) == null ? void 0 : _this_options.themeData; // IThemeData | null | undefined
|
|
12535
|
+
var template = (_this_options1 = _this.options) == null ? void 0 : _this_options1.template; // ThemeTemplateType | string | undefined
|
|
12536
|
+
var initialThemeData;
|
|
12537
|
+
if (options.type === 'hls' || options.type === 'ezhls') {
|
|
12538
|
+
// hls / ezhls:@3.1.1 起支持自定义 themeData,但不支持标准提供的模板;未传时回退 hlsLiveTemplate
|
|
12539
|
+
// FIXME: 部分控件在 hls 下不生效,开发者需自行斟酌
|
|
12540
|
+
initialThemeData = themeData !== undefined ? themeData : hlsLiveTemplate;
|
|
12541
|
+
} else if ([
|
|
12493
12542
|
'flv',
|
|
12494
12543
|
'mp4'
|
|
12495
|
-
].includes(options.type)
|
|
12496
|
-
|
|
12544
|
+
].includes(options.type)) {
|
|
12545
|
+
// flv / mp4:支持自定义 themeData,未传时回退到标准直播模板 LiveTemplate(2026-01-19 起支持自定义)
|
|
12546
|
+
initialThemeData = themeData !== undefined ? themeData : LiveTemplate;
|
|
12547
|
+
} else {
|
|
12548
|
+
var _ref3;
|
|
12549
|
+
// 其余类型(如 ezopen 私有流):template 优先级高于 themeData,二者都未设置时为 null
|
|
12550
|
+
initialThemeData = (_ref3 = template != null ? template : themeData) != null ? _ref3 : null;
|
|
12551
|
+
}
|
|
12552
|
+
_this._renderTheme(initialThemeData);
|
|
12497
12553
|
_this._addEventListener();
|
|
12498
12554
|
_themeEventemitter(_this);
|
|
12499
12555
|
return _this;
|
|
@@ -12752,7 +12808,7 @@
|
|
|
12752
12808
|
clone: false
|
|
12753
12809
|
});
|
|
12754
12810
|
// prettier-ignore
|
|
12755
|
-
this.i18n = new I18n
|
|
12811
|
+
this.i18n = new I18n(locales, {
|
|
12756
12812
|
defaultLocale: language
|
|
12757
12813
|
});
|
|
12758
12814
|
// 默认清晰度列表
|
|
@@ -12888,6 +12944,7 @@
|
|
|
12888
12944
|
this._mobileInnerWidthHeight();
|
|
12889
12945
|
window.addEventListener('resize', this._throttleMobileInnerWidthHeight);
|
|
12890
12946
|
// ------------------------------ resize observer ----------------------------
|
|
12947
|
+
// istanbul ignore next -- jsdom has no layout engine; clientWidth/height-driven resize bucketing is not exercisable in unit tests
|
|
12891
12948
|
// prettier-ignore
|
|
12892
12949
|
this._cleanUpResizeObserver = Utils.resizeObserver(this.$container, throttle(function() {
|
|
12893
12950
|
var // 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条
|
|
@@ -12896,40 +12953,14 @@
|
|
|
12896
12953
|
// 这里不要使用 $containerWarp.getBoundingClientRect() 获取宽和高 因为会出现小数导致两次(设置后的值和设置后再次获取的值)的宽高不一致 (因为缩放后取整设置,再次获取还有可能是带小数的然后取整 对比两次不一致,一般在屏幕缩放百分比变化和浏览器页面缩放时出现),致使一直触发 resize 事件
|
|
12897
12954
|
var width = Math.floor(_this.$container.clientWidth);
|
|
12898
12955
|
var height = Math.floor(_this.$container.clientHeight);
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
_this.$container.classList.
|
|
12903
|
-
}
|
|
12904
|
-
|
|
12905
|
-
_this.$container.classList.remove(
|
|
12906
|
-
|
|
12907
|
-
} else {
|
|
12908
|
-
if (width <= 200) {
|
|
12909
|
-
_this.$container.classList.add("" + PREFIX_CLASS + "-mini-width");
|
|
12910
|
-
} else {
|
|
12911
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-mini-width");
|
|
12912
|
-
}
|
|
12913
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-small-width");
|
|
12914
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-medium-width");
|
|
12915
|
-
}
|
|
12916
|
-
if (height > 280 && height <= 375) {
|
|
12917
|
-
_this.$container.classList.add("" + PREFIX_CLASS + "-medium-height");
|
|
12918
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-small-height");
|
|
12919
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-mini-height");
|
|
12920
|
-
} else if (height > 200 && height <= 280) {
|
|
12921
|
-
_this.$container.classList.add("" + PREFIX_CLASS + "-small-height");
|
|
12922
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-medium-height");
|
|
12923
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-mini-height");
|
|
12924
|
-
} else {
|
|
12925
|
-
if (height <= 200) {
|
|
12926
|
-
_this.$container.classList.add("" + PREFIX_CLASS + "-mini-height");
|
|
12927
|
-
} else {
|
|
12928
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-mini-height");
|
|
12929
|
-
}
|
|
12930
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-small-height");
|
|
12931
|
-
_this.$container.classList.remove("" + PREFIX_CLASS + "-medium-height");
|
|
12932
|
-
}
|
|
12956
|
+
// 响应式档位类名(纯逻辑见 ./Theme/overflow computeSizeClasses)
|
|
12957
|
+
var sizeClasses = computeSizeClasses(width, height, PREFIX_CLASS);
|
|
12958
|
+
sizeClasses.add.forEach(function(c) {
|
|
12959
|
+
return _this.$container.classList.add(c);
|
|
12960
|
+
});
|
|
12961
|
+
sizeClasses.remove.forEach(function(c) {
|
|
12962
|
+
return _this.$container.classList.remove(c);
|
|
12963
|
+
});
|
|
12933
12964
|
//
|
|
12934
12965
|
if (_this.width !== width || _this.height !== height) {
|
|
12935
12966
|
var _this_controls;
|
|
@@ -12975,7 +13006,7 @@
|
|
|
12975
13006
|
/**
|
|
12976
13007
|
* 窗口尺寸变化判断头部是否需要隐藏控件展示在更多中
|
|
12977
13008
|
* 尺寸变化结束时 进行判断,为了节省开销
|
|
12978
|
-
*/ _proto._headerMoreControlShow = function _headerMoreControlShow() {
|
|
13009
|
+
*/ /* istanbul ignore next -- jsdom has no layout engine; clientWidth-driven header overflow (More) logic is not exercisable in unit tests */ _proto._headerMoreControlShow = function _headerMoreControlShow() {
|
|
12979
13010
|
var _this = this;
|
|
12980
13011
|
if (this._header) {
|
|
12981
13012
|
var _this__header_$left, _this__header, _this__header_$right, _this__header1;
|
|
@@ -12986,7 +13017,7 @@
|
|
|
12986
13017
|
var rightWidth = ((_this__header1 = this._header) == null ? void 0 : (_this__header_$right = _this__header1.$right) == null ? void 0 : _this__header_$right.clientWidth) || 0;
|
|
12987
13018
|
// 当header 中 left 和 right 宽度之和大于 header 宽度,则 header more 显示
|
|
12988
13019
|
// 如果 header more 存在,则偏移量量宽度为 150,否则为 100, 因为隐藏多个控件时 right 会变短
|
|
12989
|
-
var showHeaderMore = leftWidth
|
|
13020
|
+
var showHeaderMore = shouldShowHeaderMore(this._width, leftWidth, rightWidth);
|
|
12990
13021
|
if (showHeaderMore) {
|
|
12991
13022
|
var _this_controls;
|
|
12992
13023
|
if (!this._headerMoreControl && ((_this_controls = this.controls) == null ? void 0 : _this_controls.recControl)) {
|
|
@@ -13014,7 +13045,7 @@
|
|
|
13014
13045
|
(_this_controls1 = this.controls) == null ? void 0 : (_this_controls_recControl = _this_controls1.recControl) == null ? void 0 : _this_controls_recControl.resetPopupContainer(this._headerMoreControl.$panel);
|
|
13015
13046
|
}
|
|
13016
13047
|
this.emit(Theme.EVENTS.control.headerMoreShowControlsChange, showHeaderMore);
|
|
13017
|
-
} else if (this._width
|
|
13048
|
+
} else if (shouldRemoveHeaderMore(this._width, leftWidth, rightWidth)) {
|
|
13018
13049
|
var _this_controls2;
|
|
13019
13050
|
//
|
|
13020
13051
|
if (this._headerMoreControl && ((_this_controls2 = this.controls) == null ? void 0 : _this_controls2.recControl)) {
|
|
@@ -13034,7 +13065,7 @@
|
|
|
13034
13065
|
*/ _proto._footerMoreControlShow = function _footerMoreControlShow() {
|
|
13035
13066
|
this._displayMore();
|
|
13036
13067
|
};
|
|
13037
|
-
_proto._displayMore = function _displayMore() {
|
|
13068
|
+
/* istanbul ignore next -- jsdom has no layout engine; clientWidth-driven footer overflow (More) logic is not exercisable in unit tests */ _proto._displayMore = function _displayMore() {
|
|
13038
13069
|
var _this = this;
|
|
13039
13070
|
if (this._footer) {
|
|
13040
13071
|
var _this__footer_$left, _this__footer_$right;
|
|
@@ -13042,7 +13073,7 @@
|
|
|
13042
13073
|
var leftWidth = ((_this__footer_$left = this._footer.$left) == null ? void 0 : _this__footer_$left.clientWidth) || 0;
|
|
13043
13074
|
var rightWidth = ((_this__footer_$right = this._footer.$right) == null ? void 0 : _this__footer_$right.clientWidth) || 0;
|
|
13044
13075
|
// 当footer 中 left 和 right 宽度之和大于 footer 宽度,则 footer more 显示
|
|
13045
|
-
var collapseControl = this._width
|
|
13076
|
+
var collapseControl = shouldCollapseFooter(this._width, leftWidth, rightWidth); // 收拢控件到 More 中
|
|
13046
13077
|
if (collapseControl) {
|
|
13047
13078
|
var _this__footer, _this__themeData_footer, _this__themeData, _this__footerMoreControl_list, _this__footerMoreControl, _this__footerMoreControl_list1, _this__footerMoreControl1;
|
|
13048
13079
|
if (!this._footerMoreControl && ((_this__footer = this._footer) == null ? void 0 : _this__footer.$right)) {
|
|
@@ -13122,28 +13153,23 @@
|
|
|
13122
13153
|
this._displayMore();
|
|
13123
13154
|
}
|
|
13124
13155
|
} else {
|
|
13125
|
-
var _this__footerMoreControl_list2,
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
if ((_this__footerMoreControl5 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list2 = _this__footerMoreControl5.list) == null ? void 0 : _this__footerMoreControl_list2.length) {
|
|
13131
|
-
offset = offset + this._footerMoreControl.list[0].width || 0;
|
|
13132
|
-
}
|
|
13133
|
-
if (((_this__footerMoreControl6 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list3 = _this__footerMoreControl6.list) == null ? void 0 : _this__footerMoreControl_list3.length) && this._width - leftWidth - rightWidth > offset) {
|
|
13134
|
-
var _this__footerMoreControl7, _this__footerMoreControl_list4, _this__footerMoreControl8, _this__footerMoreControl_list5, _this__footerMoreControl9;
|
|
13156
|
+
var _this__footerMoreControl_list2, _this__footerMoreControl4, _this__footerMoreControl_list3, _this__footerMoreControl5;
|
|
13157
|
+
// 展开阈值(纯逻辑见 ./Theme/overflow computeFooterExpandOffset)
|
|
13158
|
+
var offset = computeFooterExpandOffset(((_this__footerMoreControl4 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list2 = _this__footerMoreControl4.list) == null ? void 0 : _this__footerMoreControl_list2.length) ? this._footerMoreControl.list[0].width : undefined);
|
|
13159
|
+
if (((_this__footerMoreControl5 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list3 = _this__footerMoreControl5.list) == null ? void 0 : _this__footerMoreControl_list3.length) && shouldExpandFooter(this._width, leftWidth, rightWidth, offset)) {
|
|
13160
|
+
var _this__footerMoreControl6, _this__footerMoreControl_list4, _this__footerMoreControl7, _this__footerMoreControl_list5, _this__footerMoreControl8;
|
|
13135
13161
|
// 110 是为了保住个别控件的宽度超出已知的值, 如英文下 按钮的宽度
|
|
13136
13162
|
// 从 More 中一次移除一个控件到 header/footer 中
|
|
13137
13163
|
//
|
|
13138
|
-
var item2 = (
|
|
13164
|
+
var item2 = (_this__footerMoreControl6 = this._footerMoreControl) == null ? void 0 : _this__footerMoreControl6.list.shift();
|
|
13139
13165
|
if (item2) {
|
|
13140
|
-
var
|
|
13166
|
+
var _this__footerMoreControl9;
|
|
13141
13167
|
if (item2.part === 'left') {
|
|
13142
13168
|
var _item_control_resetPopupContainer, _item_control;
|
|
13143
13169
|
(_item_control = item2.control) == null ? void 0 : (_item_control_resetPopupContainer = _item_control.resetPopupContainer) == null ? void 0 : _item_control_resetPopupContainer.call(_item_control, this._footer.$left, 'append');
|
|
13144
13170
|
} else if (item2.part === 'right') {
|
|
13145
|
-
var _this__footerMoreControl_list6,
|
|
13146
|
-
if (((
|
|
13171
|
+
var _this__footerMoreControl_list6, _this__footerMoreControl10;
|
|
13172
|
+
if (((_this__footerMoreControl10 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list6 = _this__footerMoreControl10.list) == null ? void 0 : _this__footerMoreControl_list6.length) === 0) {
|
|
13147
13173
|
var _item_control_resetPopupContainer1, _item_control1;
|
|
13148
13174
|
(_item_control1 = item2.control) == null ? void 0 : (_item_control_resetPopupContainer1 = _item_control1.resetPopupContainer) == null ? void 0 : _item_control_resetPopupContainer1.call(_item_control1, this._footer.$right, 'append');
|
|
13149
13175
|
} else {
|
|
@@ -13151,14 +13177,14 @@
|
|
|
13151
13177
|
(_item_control2 = item2.control) == null ? void 0 : (_item_control_resetPopupContainer2 = _item_control2.resetPopupContainer) == null ? void 0 : _item_control_resetPopupContainer2.call(_item_control2, this._footer.$right, 'before', this._footerMoreControl.$container);
|
|
13152
13178
|
}
|
|
13153
13179
|
}
|
|
13154
|
-
(
|
|
13180
|
+
(_this__footerMoreControl9 = this._footerMoreControl) == null ? void 0 : _this__footerMoreControl9.remove(item2.control);
|
|
13155
13181
|
}
|
|
13156
|
-
if (((
|
|
13157
|
-
var
|
|
13182
|
+
if (((_this__footerMoreControl7 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list4 = _this__footerMoreControl7.list) == null ? void 0 : _this__footerMoreControl_list4.length) === 1) {
|
|
13183
|
+
var _this__footerMoreControl11, _this__footerMoreControl_destroy, _this__footerMoreControl12;
|
|
13158
13184
|
// 最后一个, 移除 More
|
|
13159
|
-
var item11 = (
|
|
13185
|
+
var item11 = (_this__footerMoreControl11 = this._footerMoreControl) == null ? void 0 : _this__footerMoreControl11.list.shift();
|
|
13160
13186
|
if (item11) {
|
|
13161
|
-
var
|
|
13187
|
+
var _this__footerMoreControl13;
|
|
13162
13188
|
if (item11.part === 'left') {
|
|
13163
13189
|
var _item1_control_resetPopupContainer, _item1_control;
|
|
13164
13190
|
(_item1_control = item11.control) == null ? void 0 : (_item1_control_resetPopupContainer = _item1_control.resetPopupContainer) == null ? void 0 : _item1_control_resetPopupContainer.call(_item1_control, this._footer.$left, 'append');
|
|
@@ -13166,13 +13192,13 @@
|
|
|
13166
13192
|
var _item1_control_resetPopupContainer1, _item1_control1;
|
|
13167
13193
|
(_item1_control1 = item11.control) == null ? void 0 : (_item1_control_resetPopupContainer1 = _item1_control1.resetPopupContainer) == null ? void 0 : _item1_control_resetPopupContainer1.call(_item1_control1, this._footer.$right, 'append');
|
|
13168
13194
|
}
|
|
13169
|
-
(
|
|
13195
|
+
(_this__footerMoreControl13 = this._footerMoreControl) == null ? void 0 : _this__footerMoreControl13.remove(item11.control);
|
|
13170
13196
|
}
|
|
13171
|
-
(
|
|
13197
|
+
(_this__footerMoreControl12 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_destroy = _this__footerMoreControl12.destroy) == null ? void 0 : _this__footerMoreControl_destroy.call(_this__footerMoreControl12);
|
|
13172
13198
|
this._footerMoreControl = null;
|
|
13173
13199
|
}
|
|
13174
13200
|
// prettier-ignore
|
|
13175
|
-
this.emit(Theme.EVENTS.control.footerMoreShowControlsChange, !!this._footerMoreControl, (
|
|
13201
|
+
this.emit(Theme.EVENTS.control.footerMoreShowControlsChange, !!this._footerMoreControl, (_this__footerMoreControl8 = this._footerMoreControl) == null ? void 0 : (_this__footerMoreControl_list5 = _this__footerMoreControl8.list) == null ? void 0 : _this__footerMoreControl_list5.map(function(item) {
|
|
13176
13202
|
return item.key;
|
|
13177
13203
|
}));
|
|
13178
13204
|
this._displayMore();
|
|
@@ -13699,7 +13725,7 @@
|
|
|
13699
13725
|
zh: zh,
|
|
13700
13726
|
en: en
|
|
13701
13727
|
};
|
|
13702
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.
|
|
13728
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.1-beta.2';
|
|
13703
13729
|
|
|
13704
13730
|
// 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
|
|
13705
13731
|
|