@flexem/fc-gui 3.0.0-alpha.141 → 3.0.0-alpha.143

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.
@@ -39173,7 +39173,7 @@ class text_element_TextElement extends conditional_dynamic_display_element_Condi
39173
39173
  * 否则返回默认文本
39174
39174
  */
39175
39175
  getDisplayText() {
39176
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
39176
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39177
39177
  // 检查是否使用文本库
39178
39178
  if (this.model.textLibrary && this.model.textLibrary.labelType === 'textLibrary') {
39179
39179
  const textLibraryId = this.model.textLibrary.selectedTextLibraryItem;
@@ -39218,37 +39218,30 @@ class text_element_TextElement extends conditional_dynamic_display_element_Condi
39218
39218
  return '';
39219
39219
  }
39220
39220
  // 处理自定义文本(支持多语种)
39221
- if (this.model.text) {
39222
- // 检查是否为多语种格式
39223
- if (typeof this.model.text === 'object' && this.model.text.cultures) {
39224
- // 新格式:多语种对象
39225
- // 获取当前语种ID
39226
- const currentLanguageId = (_j = (_h = (_g = this.guiContext) === null || _g === void 0 ? void 0 : _g.getCurrentLanguageId) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : null;
39227
- // 确定要使用的语种代码(culture)
39228
- let targetLanguage;
39229
- const defaultLanguage = ((_k = this.languageService) === null || _k === void 0 ? void 0 : _k.getDefaultLanguage()) || 'zh-CN';
39221
+ if (this.model.text || this.model.textCultures) {
39222
+ // 获取目标语种(公共逻辑)
39223
+ const getTargetLanguage = () => {
39224
+ var _a, _b, _c, _d, _e, _f;
39225
+ const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
39226
+ const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
39230
39227
  if (currentLanguageId === null || currentLanguageId === undefined) {
39231
- // 设备未设置当前语种,使用默认语种
39232
- targetLanguage = defaultLanguage;
39233
- }
39234
- else {
39235
- // 设备已设置当前语种,获取对应的语种代码
39236
- const currentLanguage = (_m = (_l = this.guiContext) === null || _l === void 0 ? void 0 : _l.getLanguageCultureById) === null || _m === void 0 ? void 0 : _m.call(_l, currentLanguageId);
39237
- if (currentLanguage) {
39238
- targetLanguage = currentLanguage;
39239
- }
39240
- else {
39241
- targetLanguage = defaultLanguage;
39242
- }
39228
+ return defaultLanguage;
39243
39229
  }
39244
- // 返回对应语种的文本,如果没有则根据当前语言环境显示默认文本
39245
- // 获取当前语言环境
39246
- const language = ((_q = (_p = (_o = window.abp) === null || _o === void 0 ? void 0 : _o.localization) === null || _p === void 0 ? void 0 : _p.currentLanguage) === null || _q === void 0 ? void 0 : _q.name) || 'zh-Hans';
39247
- const isChinese = language === 'zh-Hans' || language === 'zh';
39248
- return this.model.text.cultures[targetLanguage] || (isChinese ? '文本' : 'Text');
39230
+ return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
39231
+ };
39232
+ const language = ((_j = (_h = (_g = window.abp) === null || _g === void 0 ? void 0 : _g.localization) === null || _h === void 0 ? void 0 : _h.currentLanguage) === null || _j === void 0 ? void 0 : _j.name) || 'zh-Hans';
39233
+ const isChinese = language === 'zh-Hans' || language === 'zh';
39234
+ const fallback = isChinese ? '文本' : 'Text';
39235
+ // 新格式:textCultures 在顶层(与 text 字段并列)
39236
+ if (this.model.textCultures && typeof this.model.textCultures === 'object') {
39237
+ return this.model.textCultures[getTargetLanguage()] || fallback;
39249
39238
  }
39250
- else if (typeof this.model.text === 'string') {
39251
- // 旧格式:字符串
39239
+ // 中间格式(兼容):text { cultures: {...} }
39240
+ if (typeof this.model.text === 'object' && this.model.text.cultures) {
39241
+ return this.model.text.cultures[getTargetLanguage()] || fallback;
39242
+ }
39243
+ // 旧格式:字符串
39244
+ if (typeof this.model.text === 'string') {
39252
39245
  return this.model.text;
39253
39246
  }
39254
39247
  }
@@ -39301,7 +39294,7 @@ class text_state_element_TextStateElement {
39301
39294
  return;
39302
39295
  }
39303
39296
  // 获取显示文本(支持文本库)
39304
- const content = this.getDisplayText(stateId, textState.text.content);
39297
+ const content = this.getDisplayText(stateId, textState.text);
39305
39298
  if (content === '' || content == null) {
39306
39299
  this.removeForeignObjectlement();
39307
39300
  return;
@@ -39422,24 +39415,41 @@ class text_state_element_TextStateElement {
39422
39415
  }
39423
39416
  /**
39424
39417
  * 获取显示文本
39425
- * 如果配置了文本库,则根据状态ID和当前语种ID从文本库中获取对应语种的文本
39426
- * 如果是多语种自定义文本,则根据当前语种ID获取对应语种的文本
39427
- * 否则返回默认文本
39418
+ * 支持三种格式:
39419
+ * 1. 新格式:textData.cultures 在顶层(与 content 并列)
39420
+ * 2. 中间格式:textData.content 为 { cultures: {...} }(已废弃,向下兼容)
39421
+ * 3. 旧格式:textData.content 为字符串
39428
39422
  */
39429
- getDisplayText(stateId, defaultContent) {
39430
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
39431
- // 如果 defaultContent 是多语种对象,优先使用(覆盖文本库)
39432
- if (defaultContent && typeof defaultContent === 'object' && defaultContent.cultures) {
39423
+ getDisplayText(stateId, textData) {
39424
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
39425
+ const getTargetLanguage = () => {
39426
+ var _a, _b, _c, _d, _e, _f;
39433
39427
  const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
39434
39428
  const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
39435
- let targetLanguage;
39436
39429
  if (currentLanguageId === null || currentLanguageId === undefined) {
39437
- targetLanguage = defaultLanguage;
39430
+ return defaultLanguage;
39431
+ }
39432
+ return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
39433
+ };
39434
+ const defaultContent = textData === null || textData === void 0 ? void 0 : textData.content;
39435
+ // 新格式:cultures 在 text 顶层
39436
+ if (textData && textData.cultures && typeof textData.cultures === 'object') {
39437
+ const targetLanguage = getTargetLanguage();
39438
+ if (textData.cultures[targetLanguage]) {
39439
+ return textData.cultures[targetLanguage];
39440
+ }
39441
+ else if (this.allowEmpty) {
39442
+ return '';
39438
39443
  }
39439
39444
  else {
39440
- const currentLanguage = (_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId);
39441
- targetLanguage = currentLanguage || defaultLanguage;
39445
+ const language = ((_c = (_b = (_a = window.abp) === null || _a === void 0 ? void 0 : _a.localization) === null || _b === void 0 ? void 0 : _b.currentLanguage) === null || _c === void 0 ? void 0 : _c.name) || 'zh-Hans';
39446
+ const isChinese = language === 'zh-Hans' || language === 'zh';
39447
+ return isChinese ? '文本' : 'Text';
39442
39448
  }
39449
+ }
39450
+ // 中间格式(兼容):content 为 { cultures: {...} }
39451
+ if (defaultContent && typeof defaultContent === 'object' && defaultContent.cultures) {
39452
+ const targetLanguage = getTargetLanguage();
39443
39453
  if (defaultContent.cultures[targetLanguage]) {
39444
39454
  return defaultContent.cultures[targetLanguage];
39445
39455
  }
@@ -39447,7 +39457,7 @@ class text_state_element_TextStateElement {
39447
39457
  return '';
39448
39458
  }
39449
39459
  else {
39450
- const language = ((_j = (_h = (_g = window.abp) === null || _g === void 0 ? void 0 : _g.localization) === null || _h === void 0 ? void 0 : _h.currentLanguage) === null || _j === void 0 ? void 0 : _j.name) || 'zh-Hans';
39460
+ const language = ((_f = (_e = (_d = window.abp) === null || _d === void 0 ? void 0 : _d.localization) === null || _e === void 0 ? void 0 : _e.currentLanguage) === null || _f === void 0 ? void 0 : _f.name) || 'zh-Hans';
39451
39461
  const isChinese = language === 'zh-Hans' || language === 'zh';
39452
39462
  return isChinese ? '文本' : 'Text';
39453
39463
  }
@@ -39463,17 +39473,17 @@ class text_state_element_TextStateElement {
39463
39473
  const textEntry = textLibraryData.data.find(entry => entry.value === stateId.toString());
39464
39474
  if (textEntry) {
39465
39475
  // 获取当前语种ID
39466
- const currentLanguageId = (_m = (_l = (_k = this.guiContext) === null || _k === void 0 ? void 0 : _k.getCurrentLanguageId) === null || _l === void 0 ? void 0 : _l.call(_k)) !== null && _m !== void 0 ? _m : null;
39476
+ const currentLanguageId = (_j = (_h = (_g = this.guiContext) === null || _g === void 0 ? void 0 : _g.getCurrentLanguageId) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : null;
39467
39477
  // 确定要使用的语种代码(culture)
39468
39478
  let targetLanguage;
39469
- const defaultLanguage = ((_o = this.languageService) === null || _o === void 0 ? void 0 : _o.getDefaultLanguage()) || 'zh-CN';
39479
+ const defaultLanguage = ((_k = this.languageService) === null || _k === void 0 ? void 0 : _k.getDefaultLanguage()) || 'zh-CN';
39470
39480
  if (currentLanguageId === null || currentLanguageId === undefined) {
39471
39481
  // 设备未设置当前语种,使用默认语种
39472
39482
  targetLanguage = defaultLanguage;
39473
39483
  }
39474
39484
  else {
39475
39485
  // 设备已设置当前语种,获取对应的语种代码
39476
- const currentLanguage = (_q = (_p = this.guiContext) === null || _p === void 0 ? void 0 : _p.getLanguageCultureById) === null || _q === void 0 ? void 0 : _q.call(_p, currentLanguageId);
39486
+ const currentLanguage = (_m = (_l = this.guiContext) === null || _l === void 0 ? void 0 : _l.getLanguageCultureById) === null || _m === void 0 ? void 0 : _m.call(_l, currentLanguageId);
39477
39487
  if (currentLanguage) {
39478
39488
  // 直接使用设备设置的语种,不再fallback
39479
39489
  targetLanguage = currentLanguage;
@@ -40509,6 +40519,7 @@ var view_service = __webpack_require__(27);
40509
40519
 
40510
40520
 
40511
40521
 
40522
+
40512
40523
  class view_operation_element_ViewOperationElement extends conditional_enable_element_ConditionalEnableElement {
40513
40524
  constructor(element, injector, modalService, variableCommunicator, variableStore, graphStore, permissionChecker, operationRecordService, securityChecker, localization, popupViewService, hostContainerId, el, signalRAppId, textLibraryService, languageService, guiContext) {
40514
40525
  super(element, permissionChecker, variableCommunicator, variableStore, localization, signalRAppId);
@@ -40534,12 +40545,11 @@ class view_operation_element_ViewOperationElement extends conditional_enable_ele
40534
40545
  const height = this.model.size.height;
40535
40546
  this.initGraph(width, height);
40536
40547
  this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', height).attr('fill', 'transparent');
40537
- // 初始化文本显示
40538
- const $dateTimeText = this.$element.find('text').last();
40539
- const fontStyle = this.model.label.font.fontStyle;
40540
- $dateTimeText.css('font', fontStyle + ',msyh');
40541
- // 设置初始文本内容(支持文本库)
40542
- this.updateTextContent($dateTimeText);
40548
+ // 移除模板中原有的 SVG <text> 元素,改用 TextElementModal(foreignObject)渲染,支持换行
40549
+ this.$element.find('text').last().remove();
40550
+ const font = Object.assign(Object.assign({}, this.model.label.font), { fontFamily: this.model.label.font.fontFamily || 'msyh' });
40551
+ this.textElementModal = new text_element_TextElementModal(this.getDisplayText(), font, width, height);
40552
+ this.$element.append(this.textElementModal.Element);
40543
40553
  this.switchToState(0);
40544
40554
  this.rootElement.on('mousedown', () => {
40545
40555
  if (!this.isInitialized) {
@@ -40713,24 +40723,23 @@ class view_operation_element_ViewOperationElement extends conditional_enable_ele
40713
40723
  subscribeLanguageChange() {
40714
40724
  if (this.guiContext && this.guiContext.languageChanged$) {
40715
40725
  this.languageChangeSubscription = this.guiContext.languageChanged$.subscribe(() => {
40716
- // 更新文本内容
40717
- const $dateTimeText = this.$element.find('text').last();
40718
- this.updateTextContent($dateTimeText);
40726
+ this.updateTextContent();
40719
40727
  });
40720
40728
  }
40721
40729
  }
40722
40730
  /**
40723
40731
  * 更新文本内容(支持文本库和语种切换)
40724
40732
  */
40725
- updateTextContent($textElement) {
40726
- const displayText = this.getDisplayText();
40727
- $textElement.text(displayText);
40733
+ updateTextContent() {
40734
+ if (this.textElementModal) {
40735
+ this.textElementModal.updateText(this.getDisplayText());
40736
+ }
40728
40737
  }
40729
40738
  /**
40730
40739
  * 获取显示文本
40731
40740
  */
40732
40741
  getDisplayText() {
40733
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
40742
+ var _a, _b, _c, _d, _e, _f;
40734
40743
  // 检查是否使用文本库
40735
40744
  if (this.model.textLibrary && this.model.textLibrary.labelType === 'textLibrary') {
40736
40745
  const textLibraryId = this.model.textLibrary.selectedTextLibraryItem;
@@ -40775,35 +40784,30 @@ class view_operation_element_ViewOperationElement extends conditional_enable_ele
40775
40784
  return '';
40776
40785
  }
40777
40786
  // 处理自定义文本(支持多语种)
40778
- if (this.model.label && this.model.label.content) {
40779
- // 检查是否为多语种格式
40780
- if (typeof this.model.label.content === 'object' && this.model.label.content.cultures) {
40781
- // 新格式:多语种对象
40782
- // 获取当前语种ID
40783
- const currentLanguageId = (_j = (_h = (_g = this.guiContext) === null || _g === void 0 ? void 0 : _g.getCurrentLanguageId) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : null;
40784
- // 确定要使用的语种代码(culture)
40785
- let targetLanguage;
40786
- const defaultLanguage = ((_k = this.languageService) === null || _k === void 0 ? void 0 : _k.getDefaultLanguage()) || 'zh-CN';
40787
+ if (this.model.label) {
40788
+ // 获取目标语种(公共逻辑)
40789
+ const getTargetLanguage = () => {
40790
+ var _a, _b, _c, _d, _e, _f;
40791
+ const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
40792
+ const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
40787
40793
  if (currentLanguageId === null || currentLanguageId === undefined) {
40788
- // 设备未设置当前语种,使用默认语种
40789
- targetLanguage = defaultLanguage;
40794
+ return defaultLanguage;
40790
40795
  }
40791
- else {
40792
- // 设备已设置当前语种,获取对应的语种代码
40793
- const currentLanguage = (_m = (_l = this.guiContext) === null || _l === void 0 ? void 0 : _l.getLanguageCultureById) === null || _m === void 0 ? void 0 : _m.call(_l, currentLanguageId);
40794
- if (currentLanguage) {
40795
- targetLanguage = currentLanguage;
40796
- }
40797
- else {
40798
- targetLanguage = defaultLanguage;
40799
- }
40796
+ return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
40797
+ };
40798
+ // 新格式:cultures label 顶层
40799
+ if (this.model.label.cultures && typeof this.model.label.cultures === 'object') {
40800
+ return this.model.label.cultures[getTargetLanguage()] || '';
40801
+ }
40802
+ if (this.model.label.content) {
40803
+ // 中间格式(兼容):content 为 { cultures: {...} }
40804
+ if (typeof this.model.label.content === 'object' && this.model.label.content.cultures) {
40805
+ return this.model.label.content.cultures[getTargetLanguage()] || '';
40800
40806
  }
40801
- // toggle-view 找不到语种内容时默认为空字符串
40802
- return this.model.label.content.cultures[targetLanguage] || '';
40803
- }
40804
- else if (typeof this.model.label.content === 'string') {
40805
40807
  // 旧格式:字符串
40806
- return this.model.label.content;
40808
+ if (typeof this.model.label.content === 'string') {
40809
+ return this.model.label.content;
40810
+ }
40807
40811
  }
40808
40812
  }
40809
40813
  return '';
@@ -40981,7 +40985,7 @@ class hyperlink_element_HyperlinkElement extends conditional_dynamic_display_ele
40981
40985
  * 否则返回默认文本
40982
40986
  */
40983
40987
  getDisplayText() {
40984
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
40988
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40985
40989
  // 检查是否使用文本库
40986
40990
  if (this.model.textLibrary && this.model.textLibrary.labelType === 'textLibrary') {
40987
40991
  const textLibraryId = this.model.textLibrary.selectedTextLibraryItem;
@@ -41026,37 +41030,30 @@ class hyperlink_element_HyperlinkElement extends conditional_dynamic_display_ele
41026
41030
  return '';
41027
41031
  }
41028
41032
  // 处理自定义文本(支持多语种)
41029
- if (this.model.text) {
41030
- // 检查是否为多语种格式
41031
- if (typeof this.model.text === 'object' && this.model.text.cultures) {
41032
- // 新格式:多语种对象
41033
- // 获取当前语种ID
41034
- const currentLanguageId = (_j = (_h = (_g = this.guiContext) === null || _g === void 0 ? void 0 : _g.getCurrentLanguageId) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : null;
41035
- // 确定要使用的语种代码(culture)
41036
- let targetLanguage;
41037
- const defaultLanguage = ((_k = this.languageService) === null || _k === void 0 ? void 0 : _k.getDefaultLanguage()) || 'zh-CN';
41033
+ if (this.model.text || this.model.textCultures) {
41034
+ // 获取目标语种(公共逻辑)
41035
+ const getTargetLanguage = () => {
41036
+ var _a, _b, _c, _d, _e, _f;
41037
+ const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
41038
+ const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
41038
41039
  if (currentLanguageId === null || currentLanguageId === undefined) {
41039
- // 设备未设置当前语种,使用默认语种
41040
- targetLanguage = defaultLanguage;
41041
- }
41042
- else {
41043
- // 设备已设置当前语种,获取对应的语种代码
41044
- const currentLanguage = (_m = (_l = this.guiContext) === null || _l === void 0 ? void 0 : _l.getLanguageCultureById) === null || _m === void 0 ? void 0 : _m.call(_l, currentLanguageId);
41045
- if (currentLanguage) {
41046
- targetLanguage = currentLanguage;
41047
- }
41048
- else {
41049
- targetLanguage = defaultLanguage;
41050
- }
41040
+ return defaultLanguage;
41051
41041
  }
41052
- // 返回对应语种的文本,如果没有则根据当前语言环境显示默认文本
41053
- // 获取当前语言环境
41054
- const language = ((_q = (_p = (_o = window.abp) === null || _o === void 0 ? void 0 : _o.localization) === null || _p === void 0 ? void 0 : _p.currentLanguage) === null || _q === void 0 ? void 0 : _q.name) || 'zh-Hans';
41055
- const isChinese = language === 'zh-Hans' || language === 'zh';
41056
- return this.model.text.cultures[targetLanguage] || (isChinese ? '超链接' : 'Hyperlink');
41042
+ return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
41043
+ };
41044
+ const language = ((_j = (_h = (_g = window.abp) === null || _g === void 0 ? void 0 : _g.localization) === null || _h === void 0 ? void 0 : _h.currentLanguage) === null || _j === void 0 ? void 0 : _j.name) || 'zh-Hans';
41045
+ const isChinese = language === 'zh-Hans' || language === 'zh';
41046
+ const fallback = isChinese ? '超链接' : 'Hyperlink';
41047
+ // 新格式:textCultures 在顶层(与 text 字段并列)
41048
+ if (this.model.textCultures && typeof this.model.textCultures === 'object') {
41049
+ return this.model.textCultures[getTargetLanguage()] || fallback;
41057
41050
  }
41058
- else if (typeof this.model.text === 'string') {
41059
- // 旧格式:字符串
41051
+ // 中间格式(兼容):text { cultures: {...} }
41052
+ if (typeof this.model.text === 'object' && this.model.text.cultures) {
41053
+ return this.model.text.cultures[getTargetLanguage()] || fallback;
41054
+ }
41055
+ // 旧格式:字符串
41056
+ if (typeof this.model.text === 'string') {
41060
41057
  return this.model.text;
41061
41058
  }
41062
41059
  }
@@ -41082,8 +41079,10 @@ class video_element_VideoElement extends conditional_display_element_Conditional
41082
41079
  this.svgRootClass = svgRootClass;
41083
41080
  this.videoId = '';
41084
41081
  this.isFullscreen = false;
41082
+ this.lastTimeUpdate = 0;
41085
41083
  this.isMobileMode = _tmp_settings["a" /* DisplayMode */].Mobile === injector.get(_tmp_settings["b" /* GlobalSettings */]).displayMode;
41086
41084
  this.localization = injector.get(_tmp_localization["b" /* LOCALIZATION */]);
41085
+ this.initVisibilityHandler();
41087
41086
  this.init();
41088
41087
  }
41089
41088
  dispose() {
@@ -41093,6 +41092,10 @@ class video_element_VideoElement extends conditional_display_element_Conditional
41093
41092
  $('div.' + this.svgRootClass + ' video').each(function () {
41094
41093
  $(this).remove();
41095
41094
  });
41095
+ if (this.visibilityChangeHandler) {
41096
+ document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
41097
+ }
41098
+ this.clearTimeUpdateWatchdog();
41096
41099
  }
41097
41100
  hide() {
41098
41101
  super.hide();
@@ -41191,6 +41194,7 @@ class video_element_VideoElement extends conditional_display_element_Conditional
41191
41194
  this.videoPlayer.play();
41192
41195
  });
41193
41196
  }
41197
+ this.startTimeUpdateWatchdog(videoId);
41194
41198
  }
41195
41199
  catch (err) {
41196
41200
  console.log(err);
@@ -41276,6 +41280,37 @@ class video_element_VideoElement extends conditional_display_element_Conditional
41276
41280
  }
41277
41281
  });
41278
41282
  }
41283
+ initVisibilityHandler() {
41284
+ this.visibilityChangeHandler = () => {
41285
+ if (!document.hidden && this.videoUrl && this.videoId) {
41286
+ this.initVideo(this.videoUrl, this.videoId);
41287
+ }
41288
+ };
41289
+ document.addEventListener('visibilitychange', this.visibilityChangeHandler);
41290
+ }
41291
+ startTimeUpdateWatchdog(videoId) {
41292
+ this.clearTimeUpdateWatchdog();
41293
+ this.lastTimeUpdate = Date.now();
41294
+ const videoEl = document.getElementById(videoId);
41295
+ if (videoEl && videoEl.tagName === 'VIDEO') {
41296
+ videoEl.addEventListener('timeupdate', () => {
41297
+ this.lastTimeUpdate = Date.now();
41298
+ });
41299
+ }
41300
+ this.timeUpdateWatchdog = setInterval(() => {
41301
+ if (document.hidden)
41302
+ return;
41303
+ if (Date.now() - this.lastTimeUpdate > 30000) {
41304
+ this.initVideo(this.videoUrl, this.videoId);
41305
+ }
41306
+ }, 30000);
41307
+ }
41308
+ clearTimeUpdateWatchdog() {
41309
+ if (this.timeUpdateWatchdog) {
41310
+ clearInterval(this.timeUpdateWatchdog);
41311
+ this.timeUpdateWatchdog = null;
41312
+ }
41313
+ }
41279
41314
  setIosVideo(videoUrl, videoId) {
41280
41315
  const video = $('#' + this.videoId);
41281
41316
  video.on('webkitendfullscreen', () => {