@netless/app-slide 0.2.92 → 0.2.94

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/main.es.js CHANGED
@@ -28682,10 +28682,22 @@ void main() {
28682
28682
  const t3 = l2 * u2;
28683
28683
  t3 > 2048 && (l2 *= u2 / t3);
28684
28684
  }
28685
- const c2 = document.createElement("canvas"), d2 = Math.ceil(a2.width * l2), p2 = Math.ceil(a2.height * l2);
28686
- c2.width = d2, c2.height = p2;
28687
- c2.getContext("2d").drawImage(a2, 0, 0, d2, p2);
28688
- const f2 = new Vh.c(c2, { resolution: 1 });
28685
+ const c2 = Math.ceil(a2.width * l2), d2 = Math.ceil(a2.height * l2);
28686
+ let p2;
28687
+ try {
28688
+ p2 = yield createImageBitmap(a2, { resizeWidth: c2, resizeHeight: d2, resizeQuality: "high" });
28689
+ } catch (t3) {
28690
+ this.logger.warn("createImageBitmap failed, fallback to canvas: " + t3, this.taskId || "");
28691
+ const e3 = document.createElement("canvas");
28692
+ e3.width = c2, e3.height = d2;
28693
+ const i3 = e3.getContext("2d");
28694
+ if (!i3)
28695
+ throw new Tm(gm.CanvasCrash, "Failed to get 2D context from canvas");
28696
+ i3.drawImage(a2, 0, 0, c2, d2);
28697
+ const n3 = new Vh.c(e3, { resolution: 1 });
28698
+ return this.logger.info("load end. " + r2, this.taskId || ""), { baseTexture: n3, scale: l2 };
28699
+ }
28700
+ const f2 = new Vh.c(p2, { resolution: 1 });
28689
28701
  return this.logger.info("load end. " + r2, this.taskId || ""), { baseTexture: f2, scale: l2 };
28690
28702
  });
28691
28703
  }
@@ -31062,8 +31074,20 @@ void main(void){
31062
31074
  if (this.json.isMathFallback) {
31063
31075
  if (!this.json.textBody)
31064
31076
  return this;
31065
- const t3 = () => this.json.textBody.paragraphs[0].lines.length <= 1, e3 = () => this.json.textBody.paragraphs[0].lines[0].textUnits.length <= 1, i3 = () => "" === this.json.textBody.paragraphs[0].lines[0].textUnits[0].content.trim();
31066
- if ((() => this.json.textBody.paragraphs.length <= 1)() && t3() && e3() && i3())
31077
+ const t3 = () => {
31078
+ var t4, e4, i4, n3;
31079
+ return Number(null !== (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4[0]) || void 0 === i4 ? void 0 : i4.lines.length) && void 0 !== n3 ? n3 : 0) <= 1;
31080
+ }, e3 = () => {
31081
+ var t4, e4, i4, n3, r2, o2, s2;
31082
+ return Number(null !== (s2 = null === (o2 = null === (r2 = null === (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4[0]) || void 0 === i4 ? void 0 : i4.lines) || void 0 === n3 ? void 0 : n3[0]) || void 0 === r2 ? void 0 : r2.textUnits) || void 0 === o2 ? void 0 : o2.length) && void 0 !== s2 ? s2 : 0) <= 1;
31083
+ }, i3 = () => {
31084
+ var t4, e4, i4, n3, r2, o2;
31085
+ return "" === (null !== (o2 = null === (r2 = null === (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody.paragraphs[0]) || void 0 === t4 ? void 0 : t4.lines[0]) || void 0 === e4 ? void 0 : e4.textUnits) || void 0 === i4 ? void 0 : i4[0]) || void 0 === n3 ? void 0 : n3.content) || void 0 === r2 ? void 0 : r2.trim()) && void 0 !== o2 ? o2 : "");
31086
+ };
31087
+ if ((() => {
31088
+ var t4, e4;
31089
+ return Number(null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4.length) <= 1;
31090
+ })() && t3() && e3() && i3())
31067
31091
  return this;
31068
31092
  }
31069
31093
  return null !== (n2 = null === (i2 = this.text) || void 0 === i2 ? void 0 : i2.getTextElement(t2, e2)) && void 0 !== n2 ? n2 : null;
@@ -34151,12 +34175,13 @@ void main(void){
34151
34175
  this.slideCount = c2, this.designWidth = h2, this.designHeight = u2, null === (e2 = this.currentStage) || void 0 === e2 || e2.clearOnSlideChange();
34152
34176
  const d2 = this.currentStage;
34153
34177
  this.currentStage = s2, s2.initOnReuse(), s2.createTiming(), s2.container.visible = true, s2.collectMainSeqStartValue(), this.isForward ? s2.setMainSeqStep(0, "start") : s2.setMainSeqStep(-1, "end"), this.onRequestCancelFullscreenVideo(true);
34154
- let p2 = false;
34155
- if (Ph.isWebGLSupported() && !this.config.forceCanvas && s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && d2) {
34178
+ const p2 = () => !!this.app.renderer.gl;
34179
+ let f2 = false;
34180
+ if (Ph.isWebGLSupported() && !this.config.forceCanvas && s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && d2 && !p2()) {
34156
34181
  let { transition: t3 } = s2.json;
34157
34182
  !this.isForward && (null == d2 ? void 0 : d2.json.transition) && (t3 = d2.json.transition);
34158
34183
  const e3 = this.getTransactionTexture(d2, this.view, null, null);
34159
- this.initTransactionPlayer(t3), null === (i2 = this.transactionPlayer) || void 0 === i2 || i2.setPrevTexture(e3), p2 = true;
34184
+ this.initTransactionPlayer(t3), null === (i2 = this.transactionPlayer) || void 0 === i2 || i2.setPrevTexture(e3), f2 = true;
34160
34185
  }
34161
34186
  if (this.app.stage.addChild(s2.container), this.updateResolution(this.config.resolution * this.scale), d2) {
34162
34187
  d2.clearOnTransactionEnd();
@@ -34166,8 +34191,8 @@ void main(void){
34166
34191
  this.logger.error("removeChild error: PPTPlayer:622", this.taskId);
34167
34192
  }
34168
34193
  }
34169
- if (s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && this.transactionPlayer && p2) {
34170
- const e3 = yield this.getTransactionTexture(s2, this.view, a2, l2);
34194
+ if (s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && this.transactionPlayer && f2 && !p2()) {
34195
+ const e3 = this.getTransactionTexture(s2, this.view, a2, l2);
34171
34196
  this.transactionPlayer.setNextTexture(e3), this.tracker({ name: "slidePageChangePure", reason: "", result: "", payload: { duration: Date.now() - o2, from: r2, to: t2 } }), yield this.transactionPlayer.play();
34172
34197
  const i3 = this.transactionPlayer.renderer.domElement;
34173
34198
  if (this.view.parentElement && i3)
@@ -36501,7 +36526,7 @@ void main(void){
36501
36526
  }
36502
36527
  var _T = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart", useraddLink: "useraddLink" }, yT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, xT = "";
36503
36528
  try {
36504
- xT = "1.4.45";
36529
+ xT = "1.4.47";
36505
36530
  } catch (t2) {
36506
36531
  xT = "-dev-";
36507
36532
  }
@@ -36557,32 +36582,32 @@ void main(void){
36557
36582
  i4 > 0 && Number.isInteger(i4) && (e2.__stageCountLimit = i4);
36558
36583
  }, n3.receiveSyncHandler = function(t3) {
36559
36584
  return pT(n3, void 0, void 0, function() {
36560
- var e3, i4, n4, r2, o2, s2 = this;
36561
- return fT(this, function(a2) {
36562
- switch (a2.label) {
36585
+ var e3, i4, n4, r2, o2, s2, a2, l2 = this;
36586
+ return fT(this, function(h2) {
36587
+ switch (h2.label) {
36563
36588
  case 0:
36564
36589
  return Vm()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(_T.syncEventLag), this._receiveIncrId = t3.incrId || 0), this.logger.info("sync receive " + JSON.stringify(t3), this.taskId), "nextStep" !== t3.type ? [3, 1] : (this.mainSeqStep !== t3.next - 1 && this.mainSeqStep + 1 !== this.mainSeqLength && this.player ? (this.setMainSeqStep(t3.next, "start"), this.player.nextTick(function() {
36565
- s2.doNextStep(true, t3.clientId || "");
36590
+ l2.doNextStep(true, t3.clientId || "");
36566
36591
  })) : this.doNextStep(true, t3.clientId || ""), [3, 6]);
36567
36592
  case 1:
36568
- return "prevStep" !== t3.type ? [3, 2] : (0 === this.mainSeqStep && "idle" === this.mainSeqState || this.mainSeqStep === t3.next + 1 || this.mainSeqStep + 1 === this.mainSeqLength ? this.doPrevStep(true) : (this.setMainSeqStep(t3.next + 1, "start"), null === (e3 = this.player) || void 0 === e3 || e3.nextTick(function() {
36569
- s2.doPrevStep(true);
36593
+ return "prevStep" !== t3.type ? [3, 2] : (0 === this.mainSeqStep && "idle" === this.mainSeqState || this.mainSeqStep === t3.next + 1 || this.mainSeqStep + 1 === this.mainSeqLength ? this.doPrevStep(true) : (this.setMainSeqStep(t3.next + 1, "start"), null === (i4 = this.player) || void 0 === i4 || i4.nextTick(function() {
36594
+ l2.doPrevStep(true);
36570
36595
  })), [3, 6]);
36571
36596
  case 2:
36572
36597
  return "interactiveAnim" !== t3.type ? [3, 3] : (this.player ? this.player.applyInteractiveAction(t3.action) : this.__slideState.interactiveSeqState[t3.seqId] ? this.__slideState.interactiveSeqState[t3.seqId].step += 1 : this.__slideState.interactiveSeqState[t3.seqId] = { step: 0, state: "end" }, [3, 6]);
36573
36598
  case 3:
36574
36599
  return "renderSlide" !== t3.type ? [3, 5] : [4, this.doRenderSlide(t3.index, t3.isForward)];
36575
36600
  case 4:
36576
- return a2.sent(), [3, 6];
36601
+ return h2.sent(), [3, 6];
36577
36602
  case 5:
36578
- "mediaPlay" === t3.type ? (null === (i4 = this.player) || void 0 === i4 || i4.setMediaState(t3.id, true), this.__slideState.mediaState[t3.id] = t3.state) : "mediaPause" === t3.type ? (null === (n4 = this.player) || void 0 === n4 || n4.setMediaState(t3.id, false), this.__slideState.mediaState[t3.id] = t3.state) : "mediaSeek" === t3.type ? (null === (r2 = this.player) || void 0 === r2 || r2.setMediaCurrentTime(t3.id, t3.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaFullscreen" === t3.type && (t3.targetId && this.__slideState.mediaState[t3.targetId] ? this.__slideState.mediaState[t3.targetId].fullscreen = t3.state : this.__slideState.mediaState[t3.targetId] = { fullscreen: t3.state, type: "pause", time: 0 }, null === (o2 = this.player) || void 0 === o2 || o2.syncFullscreenVideoState({ targetId: t3.targetId, state: t3.state, slideIndex: t3.slideIndex })), a2.label = 6;
36603
+ "mediaPlay" === t3.type ? (e3 = void 0, t3.state.time && (e3 = (this.timestamp() - t3.state.time) / 1e3), null === (n4 = this.player) || void 0 === n4 || n4.setMediaState(t3.id, true, e3), this.__slideState.mediaState[t3.id] = t3.state) : "mediaPause" === t3.type ? (null === (r2 = this.player) || void 0 === r2 || r2.setMediaState(t3.id, false, null === (o2 = t3.state) || void 0 === o2 ? void 0 : o2.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaSeek" === t3.type ? (null === (s2 = this.player) || void 0 === s2 || s2.setMediaCurrentTime(t3.id, t3.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaFullscreen" === t3.type && (t3.targetId && this.__slideState.mediaState[t3.targetId] ? this.__slideState.mediaState[t3.targetId].fullscreen = t3.state : this.__slideState.mediaState[t3.targetId] = { fullscreen: t3.state, type: "pause", time: 0 }, null === (a2 = this.player) || void 0 === a2 || a2.syncFullscreenVideoState({ targetId: t3.targetId, state: t3.state, slideIndex: t3.slideIndex })), h2.label = 6;
36579
36604
  case 6:
36580
36605
  return [2];
36581
36606
  }
36582
36607
  });
36583
36608
  });
36584
36609
  }, n3.flushDebounce = function() {
36585
- n3.resizeView.flush(), n3.handleViewClick.flush();
36610
+ n3.resizeView.flush(), n3.config.disableClickDebounce || n3.handleViewClick.flush();
36586
36611
  }, n3.handlePrevSlide = function(t3) {
36587
36612
  return void 0 === t3 && (t3 = false), pT(n3, void 0, void 0, function() {
36588
36613
  var e3, i4;
@@ -36603,7 +36628,7 @@ void main(void){
36603
36628
  n3.renderSlide(t3, e3);
36604
36629
  } else
36605
36630
  -1 === t3 && n3.renderSlide(n3.slideCount, true);
36606
- }, e2.instances.push(n3), n3.config = n3.initSlideConfig(i3), n3.tracker = function(t3) {
36631
+ }, e2.instances.push(n3), n3.config = n3.initSlideConfig(i3), n3.config.disableClickDebounce && (n3.handleViewClick = n3._handleViewClick.bind(n3)), n3.tracker = function(t3) {
36607
36632
  i3.whiteTracker && i3.whiteTracker.commit({ name: t3.name, reason: t3.reason, result: t3.result, payload: cT(cT({}, t3.payload), { slideId: n3.randomId, taskId: n3.taskId }) }, { slideVersion: n3.version || "" });
36608
36633
  }, e2.trackLogger.setEnable(!!n3.config.enableTracking), n3.logger = { info: function(t3, i4) {
36609
36634
  var r2;
@@ -36625,7 +36650,7 @@ void main(void){
36625
36650
  }), n3.renderingTaskManager.eventHub.on("task-error", function(t3) {
36626
36651
  var e3 = t3.error, i4 = t3.task, r2 = Tm.transform(e3);
36627
36652
  r2.errorType === gm.RuntimeWarn ? n3.logger.warn(r2.message, n3.taskId) : n3.logger.error(r2.message, n3.taskId), n3.isLoading = false, n3.reportError(r2, i4.slideIndex);
36628
- }), window.addEventListener("__slide_ref__", n3.handleSlideRef), window.addEventListener("__slide_updateStageCountLimit", n3.updateStageCountLimit), n3.resizeView = $y()(n3.resizeView.bind(n3), 50), n3.player = n3.initPlayer(n3.config), n3.config.controller && n3.createController(), n3.player.view && n3.canvasContainer.appendChild(n3.player.view), n3.handleViewClick = $y()(n3.handleViewClick, 300), n3.player.errorChannel.on("error", function(t3, e3) {
36653
+ }), window.addEventListener("__slide_ref__", n3.handleSlideRef), window.addEventListener("__slide_updateStageCountLimit", n3.updateStageCountLimit), n3.resizeView = $y()(n3.resizeView.bind(n3), 50), n3.player = n3.initPlayer(n3.config), n3.config.controller && n3.createController(), n3.player.view && n3.canvasContainer.appendChild(n3.player.view), n3.config.disableClickDebounce || (n3.handleViewClick = $y()(n3.handleViewClick, 300)), n3.player.errorChannel.on("error", function(t3, e3) {
36629
36654
  var i4 = Tm.transform(t3);
36630
36655
  i4.errorType === gm.RuntimeWarn ? n3.logger.warn(i4.message, n3.taskId) : n3.logger.error(i4.message, n3.taskId), n3.isLoading = false, n3.reportError(t3, e3), n3.tracker({ name: "slideError", reason: i4.errorMsg, result: "", payload: { code: i4.errorType } });
36631
36656
  }), window.addEventListener("message", n3.recoverHandler), e2.volumeAdjuster.on("update", n3._updateVolumeByStaticAdjuster), n3.volumeAdjuster.volume = e2.volumeAdjuster.volume, n3;
@@ -36708,7 +36733,7 @@ void main(void){
36708
36733
  }, enumerable: false, configurable: true }), e2.prototype.reportError = function(t3, i3) {
36709
36734
  this.emit(_T.renderError, { error: t3, index: i3 }), window.postMessage({ type: "@slide/_error_", errorType: t3.errorType, errorMsg: t3.errorMsg, slideId: this.randomId, slideIndex: i3 || -1, customMessage: "@slide/_error_" }, "*"), e2.trackLogger.uploadLog(true);
36710
36735
  }, e2.prototype.initSlideConfig = function(t3) {
36711
- return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (Yy.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !$a()(t3.enableGlobalClick) && t3.enableGlobalClick, this.resize = t3.resize || false, this.interactive = t3.interactive, this.frame.style.cssText = t3.fixedFrameSize ? "width:" + t3.fixedFrameSize.width + "px;height:" + t3.fixedFrameSize.height + "px;" : "width:100%;height:100%", this.frame.style.cssText += "display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", t3.fixedFrameSize && (this.frameWidth = t3.fixedFrameSize.width, this.frameHeight = t3.fixedFrameSize.height), t3;
36736
+ return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (Yy.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !$a()(t3.enableGlobalClick) && t3.enableGlobalClick, this.resize = t3.resize || false, this.interactive = t3.interactive, this.frame.style.cssText = t3.fixedFrameSize ? "width:" + t3.fixedFrameSize.width + "px;height:" + t3.fixedFrameSize.height + "px;" : "width:100%;height:100%", this.frame.style.cssText += "display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", t3.fixedFrameSize && (this.frameWidth = t3.fixedFrameSize.width, this.frameHeight = t3.fixedFrameSize.height), t3.disableClickDebounce = t3.disableClickDebounce || false, t3;
36712
36737
  }, e2.prototype.initPlayer = function(t3) {
36713
36738
  var e3, i3, n3, r2 = this, o2 = new Yy({ mode: this.mode, useLocalCache: !!$a()(this.config.useLocalCache) || this.config.useLocalCache, logger: this.logger, resourceTimeout: $a()(this.config.resourceTimeout) ? 15e3 : this.config.resourceTimeout, loadDelegate: this.config.loaderDelegate, volumeAdjuster: this.volumeAdjuster, urlInterrupter: this.urlInterrupter, tracker: this.tracker, enableWebAudio: this.config.enableWebAudio, enableAutoForward: this.config.enableAutoForward, customLinks: this.config.customLinks }, t3.renderOptions);
36714
36739
  return o2.setInteractive(this.interactive), o2.updateConfig(t3.renderOptions || {}), o2.on(Xy.renderStart, function(t4) {
@@ -38028,19 +38053,81 @@ class SlideControllerBase {
38028
38053
  this._toFreeze = -1;
38029
38054
  }
38030
38055
  };
38056
+ this.bindAppStateChangeEvent = () => {
38057
+ try {
38058
+ const boxStatus = this.context.getBoxStatus();
38059
+ if (boxStatus) {
38060
+ const appProxy = this.context.getAppProxy();
38061
+ if (appProxy) {
38062
+ this.context.emitter.on("boxStatusChange", this.onAppStatusChangeHandler);
38063
+ }
38064
+ } else {
38065
+ const windowManager = this.context.getWindowManager();
38066
+ if (windowManager) {
38067
+ windowManager.emitter.on("boxStateChange", this.onAppStateChangeHandler);
38068
+ }
38069
+ }
38070
+ } catch (error) {
38071
+ log(
38072
+ "[Slide] bind app state change event failed, because should update window manager to latest version"
38073
+ );
38074
+ }
38075
+ };
38076
+ this.onAppStateChangeHandler = (state) => {
38077
+ if (state === "minimized") {
38078
+ log("[Slide] freeze because app state is minimized");
38079
+ this.freeze();
38080
+ }
38081
+ };
38082
+ this.onAppStatusChangeHandler = (payload) => {
38083
+ const { appId, status } = payload;
38084
+ if (appId === this.context.appId && status === "minimized") {
38085
+ log("[Slide] freeze because app status is minimized");
38086
+ this.freeze();
38087
+ }
38088
+ };
38089
+ this.getAppStatus = () => {
38090
+ try {
38091
+ const boxStatus = this.context.getBoxStatus();
38092
+ if (boxStatus) {
38093
+ return boxStatus;
38094
+ }
38095
+ const windowManager = this.context.getWindowManager();
38096
+ const boxstate = windowManager.boxState;
38097
+ return boxstate;
38098
+ } catch (error) {
38099
+ return void 0;
38100
+ }
38101
+ };
38031
38102
  this.onVisibilityChange = async () => {
38103
+ const appStatus = this.getAppStatus();
38104
+ if (appStatus === "minimized") {
38105
+ log("[Slide] do nothing because app state is minimized");
38106
+ return;
38107
+ }
38032
38108
  if (!(this.visible = document.visibilityState === "visible")) {
38033
38109
  this.savedIsFrozen = this.isFrozen;
38034
38110
  log("[Slide] freeze because tab becomes invisible");
38035
38111
  this.freeze();
38036
38112
  } else {
38037
- log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
38038
38113
  if (!this.savedIsFrozen) {
38114
+ log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
38039
38115
  this.unfreeze();
38040
38116
  }
38041
38117
  }
38042
38118
  };
38043
- const { context, onRenderStart, onPageChanged, onTransitionStart, onTransitionEnd, onNavigate, onError, onRenderError, showRenderError, invisibleBehavior } = props;
38119
+ const {
38120
+ context,
38121
+ onRenderStart,
38122
+ onPageChanged,
38123
+ onTransitionStart,
38124
+ onTransitionEnd,
38125
+ onNavigate,
38126
+ onError,
38127
+ onRenderError,
38128
+ showRenderError,
38129
+ invisibleBehavior
38130
+ } = props;
38044
38131
  this.invisibleBehavior = invisibleBehavior != null ? invisibleBehavior : "frozen";
38045
38132
  this.onRenderStart = onRenderStart;
38046
38133
  this.onPageChanged = onPageChanged;
@@ -38117,7 +38204,18 @@ class SlideControllerBase {
38117
38204
  slide.on(Slide.SLIDE_EVENTS.renderEnd, this.resolveReady);
38118
38205
  this.sideEffect.add(() => {
38119
38206
  document.addEventListener("visibilitychange", this.onVisibilityChange);
38120
- return () => document.removeEventListener("visibilitychange", this.onVisibilityChange);
38207
+ this.bindAppStateChangeEvent();
38208
+ return () => {
38209
+ document.removeEventListener("visibilitychange", this.onVisibilityChange);
38210
+ try {
38211
+ this.context.emitter.off("boxStatusChange", this.onAppStatusChangeHandler);
38212
+ this.context.getWindowManager().emitter.off("boxStateChange", this.onAppStateChangeHandler);
38213
+ } catch (error) {
38214
+ log(
38215
+ "[Slide] unbind app state change event failed, because should update window manager to latest version"
38216
+ );
38217
+ }
38218
+ };
38121
38219
  });
38122
38220
  }
38123
38221
  syncStateOnce() {
@@ -39309,7 +39407,10 @@ class ScrollBar {
39309
39407
  scrollBar.className = "scroll-bar horizontal";
39310
39408
  const availableWidth = containerWidth;
39311
39409
  const trackWidth = availableWidth;
39312
- const thumbWidth = Math.max(30, Math.min(trackWidth, trackWidth * availableWidth / contentWidth));
39410
+ const thumbWidth = Math.max(
39411
+ 30,
39412
+ Math.min(trackWidth, trackWidth * availableWidth / contentWidth)
39413
+ );
39313
39414
  scrollBar.style.cssText = `
39314
39415
  position: absolute;
39315
39416
  bottom: 0;
@@ -39344,7 +39445,10 @@ class ScrollBar {
39344
39445
  scrollBar.className = "scroll-bar vertical";
39345
39446
  const availableHeight = containerHeight;
39346
39447
  const trackHeight = availableHeight;
39347
- const thumbHeight = Math.max(30, Math.min(trackHeight, trackHeight * availableHeight / contentHeight));
39448
+ const thumbHeight = Math.max(
39449
+ 30,
39450
+ Math.min(trackHeight, trackHeight * availableHeight / contentHeight)
39451
+ );
39348
39452
  scrollBar.style.cssText = `
39349
39453
  position: absolute;
39350
39454
  top: 0;
@@ -39408,15 +39512,23 @@ class ScrollBar {
39408
39512
  scrollRatio = Math.max(0, Math.min(1, scrollRatio));
39409
39513
  }
39410
39514
  if (orientation === "horizontal") {
39411
- this.resizableContainer.handleNormalizeTranslate(scrollRatio, (_a = this.resizableContainer["translateY"]) != null ? _a : 0.5, {
39412
- triggerScrollBar: false,
39413
- triggerSync: true
39414
- });
39515
+ this.resizableContainer.handleNormalizeTranslate(
39516
+ scrollRatio,
39517
+ (_a = this.resizableContainer["translateY"]) != null ? _a : 0.5,
39518
+ {
39519
+ triggerScrollBar: false,
39520
+ triggerSync: true
39521
+ }
39522
+ );
39415
39523
  } else {
39416
- this.resizableContainer.handleNormalizeTranslate((_b = this.resizableContainer["translateX"]) != null ? _b : 0.5, scrollRatio, {
39417
- triggerScrollBar: false,
39418
- triggerSync: true
39419
- });
39524
+ this.resizableContainer.handleNormalizeTranslate(
39525
+ (_b = this.resizableContainer["translateX"]) != null ? _b : 0.5,
39526
+ scrollRatio,
39527
+ {
39528
+ triggerScrollBar: false,
39529
+ triggerSync: true
39530
+ }
39531
+ );
39420
39532
  }
39421
39533
  };
39422
39534
  const handleEnd = () => {
@@ -39530,7 +39642,12 @@ class ResizableContainer {
39530
39642
  }
39531
39643
  this.translateX = 0.5;
39532
39644
  this.translateY = 0.5;
39533
- this.renderScrollBar(parentBounds.width, parentBounds.width * this.scale, parentBounds.height, parentBounds.height * this.scale);
39645
+ this.renderScrollBar(
39646
+ parentBounds.width,
39647
+ parentBounds.width * this.scale,
39648
+ parentBounds.height,
39649
+ parentBounds.height * this.scale
39650
+ );
39534
39651
  this.handleNormalizeTranslate(this.translateX, this.translateY, {
39535
39652
  triggerScrollBar: true,
39536
39653
  triggerSync: true
@@ -39806,7 +39923,10 @@ class SlideDocsViewer {
39806
39923
  console.log("[SlideDocsViewer] Initial storage state:", this.context.storage.state);
39807
39924
  console.log("[SlideDocsViewer] Initial slideScale:", this.context.storage.state.slideScale);
39808
39925
  if (this.context.storage.state.slideScale !== void 0) {
39809
- console.log("[SlideDocsViewer] Applying initial slideScale:", this.context.storage.state.slideScale);
39926
+ console.log(
39927
+ "[SlideDocsViewer] Applying initial slideScale:",
39928
+ this.context.storage.state.slideScale
39929
+ );
39810
39930
  applyScale(this.context.storage.state.slideScale);
39811
39931
  } else {
39812
39932
  console.log("[SlideDocsViewer] No initial slideScale found");
@@ -39844,7 +39964,11 @@ class SlideDocsViewer {
39844
39964
  }
39845
39965
  render() {
39846
39966
  if (!this.resizableContainer) {
39847
- this.resizableContainer = new ResizableContainer(this.viewer.$content, this.context, this.enableScale);
39967
+ this.resizableContainer = new ResizableContainer(
39968
+ this.viewer.$content,
39969
+ this.context,
39970
+ this.enableScale
39971
+ );
39848
39972
  }
39849
39973
  this.renderSlideContainer();
39850
39974
  this.renderWhiteboardView();
@@ -40226,7 +40350,7 @@ class SlidePreviewer {
40226
40350
  }
40227
40351
  }
40228
40352
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
40229
- const version = "0.2.91";
40353
+ const version = "0.2.94";
40230
40354
  const SlideApp = {
40231
40355
  kind: "Slide",
40232
40356
  setup(context) {