@netless/app-slide 0.2.106-beta.4 → 0.2.106

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
@@ -12845,15 +12845,15 @@ var Slide = function(t) {
12845
12845
  }), i.d(e, "PreloadCancelledError", function() {
12846
12846
  return Nm;
12847
12847
  }), i.d(e, "LOCAL_GIF_RUNTIME_CAPABILITY", function() {
12848
- return Rw;
12848
+ return Iw;
12849
12849
  }), i.d(e, "delay", function() {
12850
- return Ow;
12851
- }), i.d(e, "waitUntil", function() {
12852
12850
  return Lw;
12853
- }), i.d(e, "SLIDE_EVENTS", function() {
12851
+ }), i.d(e, "waitUntil", function() {
12854
12852
  return Nw;
12853
+ }), i.d(e, "SLIDE_EVENTS", function() {
12854
+ return Dw;
12855
12855
  }), i.d(e, "Slide", function() {
12856
- return Bw;
12856
+ return Uw;
12857
12857
  });
12858
12858
  const n = [];
12859
12859
  for (let t2 = 0; t2 < 256; t2++)
@@ -33513,20 +33513,20 @@ void main(void){
33513
33513
  }
33514
33514
  }
33515
33515
  }
33516
- function qy(t2, e2, i2) {
33516
+ function qy(t2, e2, i2, n2) {
33517
33517
  if (!t2 || t2.isTargetAlive && !t2.isTargetAlive())
33518
33518
  return;
33519
- const n2 = e2.split(".");
33520
- n2.reduce((r2, o2, s2) => {
33521
- if (r2)
33522
- return s2 !== n2.length - 1 ? r2[o2] : void (r2[o2] = i2);
33523
- console.warn(`${t2} not support ${e2}`);
33519
+ const r2 = e2.split(".");
33520
+ r2.reduce((o2, s2, a2) => {
33521
+ if (o2)
33522
+ return a2 !== r2.length - 1 ? o2[s2] : void (o2[s2] = i2);
33523
+ null == n2 || n2.logger.warn(`${t2} not support ${e2}`, n2.taskId);
33524
33524
  }, t2);
33525
33525
  }
33526
- function Zy(t2, e2) {
33526
+ function Zy(t2, e2, i2) {
33527
33527
  if (!e2 || !t2 || t2.isTargetAlive && !t2.isTargetAlive())
33528
33528
  return null;
33529
- return e2.split(".").reduce((i2, n2) => i2 ? i2[n2] : (console.warn(`${t2} not support ${e2}`), null), t2);
33529
+ return e2.split(".").reduce((n2, r2) => n2 ? n2[r2] : (null == i2 || i2.logger.warn(`${t2} not support ${e2}`, i2.taskId), null), t2);
33530
33530
  }
33531
33531
  class Jy {
33532
33532
  constructor(t2) {
@@ -33558,19 +33558,19 @@ void main(void){
33558
33558
  class Ky extends Jy {
33559
33559
  constructor(t2) {
33560
33560
  super(t2), this.isConflict = false, this.activeWhenConflict = "next", this.startVal = null, this.updateStartValue = () => {
33561
- this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]));
33561
+ this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx));
33562
33562
  }, this.onSeekToStart = () => {
33563
33563
  const t3 = this.json.cBhvr.attrList[0];
33564
- null !== this.startVal && this.timingTarget && qy(this.timingTarget, t3, this.startVal);
33564
+ null !== this.startVal && this.timingTarget && qy(this.timingTarget, t3, this.startVal, this.ctx);
33565
33565
  }, this.onSeekToEnd = () => {
33566
33566
  const t3 = this.json.cBhvr.attrList[0], e2 = this.json.cBhvr.to || this.json.to;
33567
- e2 && this.timingTarget && qy(this.timingTarget, t3, e2);
33567
+ e2 && this.timingTarget && qy(this.timingTarget, t3, e2, this.ctx);
33568
33568
  }, this.commonTimeNode.on("timeNodeStart", this.updateStartValue), this.commonTimeNode.on("timeNodeCreate", this.updateStartValue), this.commonTimeNode.on("timeUpdate", ({ duration: t3, delta: e2 }) => {
33569
33569
  if (e2 / t3 >= 1) {
33570
33570
  const t4 = this.json.cBhvr.attrList[0];
33571
- this.json.cBhvr.attrList.length > 1 && console.warn("this.json.cBhvr.attrList.length > 0");
33571
+ this.json.cBhvr.attrList.length > 1 && this.ctx.logger.warn("set behavior has multiple attributes", this.ctx.taskId);
33572
33572
  const e3 = this.json.cBhvr.to || this.json.to;
33573
- e3 && this.timingTarget && qy(this.timingTarget, t4, e3);
33573
+ e3 && this.timingTarget && qy(this.timingTarget, t4, e3, this.ctx);
33574
33574
  }
33575
33575
  });
33576
33576
  }
@@ -33656,7 +33656,7 @@ void main(void){
33656
33656
  class r_ extends Jy {
33657
33657
  constructor(t2) {
33658
33658
  super(t2), this.isConflict = true, this.activeWhenConflict = "next", this.startVal = null, this.createVal = null, this.vars = { ppt_x: 0, ppt_y: 0, ppt_w: 0, ppt_h: 0, ppt_r: 0 }, this.keyFrames = [], this.isColorAnim = false, this.onTimeNodeStart = () => {
33659
- this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]));
33659
+ this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx));
33660
33660
  }, this.updateVars = () => {
33661
33661
  var t3, e2, i2, n2;
33662
33662
  (null === (t3 = this.timingTarget) || void 0 === t3 ? void 0 : t3.ppt_h) && (this.vars.ppt_h = this.timingTarget.ppt_h), (null === (e2 = this.timingTarget) || void 0 === e2 ? void 0 : e2.ppt_w) && (this.vars.ppt_w = this.timingTarget.ppt_w), (null === (i2 = this.timingTarget) || void 0 === i2 ? void 0 : i2.ppt_x) && (this.vars.ppt_x = this.timingTarget.ppt_x), (null === (n2 = this.timingTarget) || void 0 === n2 ? void 0 : n2.ppt_y) && (this.vars.ppt_y = this.timingTarget.ppt_y), this.isColorAnim;
@@ -33664,17 +33664,17 @@ void main(void){
33664
33664
  const i2 = e2 / t3, n2 = this.keyFrames.findIndex((t4) => i2 <= t4[0]), { attrList: r2 } = this.json.cBhvr;
33665
33665
  if (n2 < 0) {
33666
33666
  const t4 = this.keyFrames[this.keyFrames.length - 1];
33667
- return void (this.timingTarget && r2 && r2[0] && (t4 ? qy(this.timingTarget, r2[0], t4[1].resolveValue(this.vars)) : this.ctx.logger.error("no keyframe found for anim behavior", this.ctx.taskId)));
33667
+ return void (this.timingTarget && r2 && r2[0] && (t4 ? qy(this.timingTarget, r2[0], t4[1].resolveValue(this.vars), this.ctx) : this.ctx.logger.error("no keyframe found for anim behavior", this.ctx.taskId)));
33668
33668
  }
33669
33669
  const o2 = n2 - 1, s2 = this.keyFrames[n2], a2 = this.keyFrames[o2] || s2, l2 = s2[0] - a2[0] == 0 ? 1 : (i2 - a2[0]) / (s2[0] - a2[0]), h2 = s2[1].interpolationFrom(a2[1], l2, this.vars);
33670
- this.timingTarget && r2 && r2[0] && qy(this.timingTarget, r2[0], h2);
33670
+ this.timingTarget && r2 && r2[0] && qy(this.timingTarget, r2[0], h2, this.ctx);
33671
33671
  }, this.onSeekToStart = () => {
33672
- null !== this.startVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.startVal);
33672
+ null !== this.startVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.startVal, this.ctx);
33673
33673
  }, this.onSeekToEnd = () => {
33674
33674
  this.onTimeUpdate({ duration: 1, delta: 1, isReverse: false });
33675
33675
  }, this.onDestroy = () => {
33676
- null !== this.createVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.createVal);
33677
- }, this.initKeyFrames(), this.commonTimeNode.on("timeUpdate", this.onTimeUpdate), this.commonTimeNode.on("timelineStart", this.updateVars), this.commonTimeNode.on("timeNodeStart", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeCreate", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeDestroy", this.onDestroy), this.createVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]);
33676
+ null !== this.createVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.createVal, this.ctx);
33677
+ }, this.initKeyFrames(), this.commonTimeNode.on("timeUpdate", this.onTimeUpdate), this.commonTimeNode.on("timelineStart", this.updateVars), this.commonTimeNode.on("timeNodeStart", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeCreate", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeDestroy", this.onDestroy), this.createVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx);
33678
33678
  }
33679
33679
  get modifyAttrKey() {
33680
33680
  return this.json.cBhvr.attrList[0];
@@ -33719,7 +33719,7 @@ void main(void){
33719
33719
  for (const t3 of this.json.tavLst)
33720
33720
  if (t3.val && this.timingTarget) {
33721
33721
  let i2 = null;
33722
- "string" === t3.val.type ? "num" === e2 ? i2 = new i_(t3, this.timingTarget) : "str" === e2 && (i2 = new e_(t3, this.timingTarget)) : "number" === t3.val.type ? i2 = new t_(t3, this.timingTarget) : "color" === t3.val.type ? (this.isColorAnim = true, i2 = new n_(t3, this.timingTarget)) : "boolean" === t3.val.type && console.warn("not implements"), i2 && this.keyFrames.push([t3.time, i2]);
33722
+ "string" === t3.val.type ? "num" === e2 ? i2 = new i_(t3, this.timingTarget) : "str" === e2 && (i2 = new e_(t3, this.timingTarget)) : "number" === t3.val.type ? i2 = new t_(t3, this.timingTarget) : "color" === t3.val.type ? (this.isColorAnim = true, i2 = new n_(t3, this.timingTarget)) : "boolean" === t3.val.type && this.ctx.logger.warn("boolean animation value is not implemented", this.ctx.taskId), i2 && this.keyFrames.push([t3.time, i2]);
33723
33723
  }
33724
33724
  }
33725
33725
  }
@@ -33902,7 +33902,7 @@ void main(void){
33902
33902
  } else if ("Z" === i3)
33903
33903
  e2.closePath();
33904
33904
  else if ("E" === i3)
33905
- console.warn("not implements");
33905
+ this.ctx.logger.warn("motion path command E is not implemented", this.ctx.taskId);
33906
33906
  else if ("c" === i3) {
33907
33907
  const [t4, i4, r2, o2, s2, a2] = n2.map((t5) => Number(t5)), l2 = e2.currentPoint;
33908
33908
  e2.bezierCurveTo(t4 + l2.x, i4 + l2.y, r2 + l2.x, o2 + l2.y, s2 + l2.x, a2 + l2.y);
@@ -33957,12 +33957,12 @@ void main(void){
33957
33957
  return;
33958
33958
  this.isTimelineStart = true, t3.isReverse || this.updateCurrentValue(), this.from.isInit() || this.from.fromHexString(this.currentColorString), this.to.isInit() || this.from.by(this.by, this.to);
33959
33959
  const e2 = this.json.cBhvr.attrList[0], [i2] = e2.split(".");
33960
- qy(this.timingTarget, i2 + ".on", "true");
33960
+ qy(this.timingTarget, i2 + ".on", "true", this.ctx);
33961
33961
  }, this.onTimeNodeEnd = () => {
33962
33962
  const t3 = this.json.cBhvr.attrList[0];
33963
33963
  if ("remove" === this.json.cBhvr.ctn.fill) {
33964
33964
  const [e2] = t3.split(".");
33965
- qy(this.timingTarget, e2 + ".on", "false");
33965
+ qy(this.timingTarget, e2 + ".on", "false", this.ctx);
33966
33966
  }
33967
33967
  this.isTimelineStart = false;
33968
33968
  }, this.onSeekToStart = () => {
@@ -33973,19 +33973,19 @@ void main(void){
33973
33973
  const i2 = "ppt_c.color" === e2 || "text.color" === e2;
33974
33974
  if ((null === (t3 = this.timingTarget.fill) || void 0 === t3 ? void 0 : t3.designColor.toUpperCase()) === this.from.toHexString().toUpperCase() || i2) {
33975
33975
  const [t4] = e2.split(".");
33976
- qy(this.timingTarget, t4 + ".on", "false");
33976
+ qy(this.timingTarget, t4 + ".on", "false", this.ctx);
33977
33977
  }
33978
33978
  }
33979
33979
  }, this.onTimeNodeStart = () => {
33980
33980
  if (this.timingTarget) {
33981
- const t3 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t3);
33981
+ const t3 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t3, this.ctx);
33982
33982
  e2 && (this.startColorString = e2);
33983
33983
  }
33984
33984
  }, this.onTimeUpdate = ({ delta: t3, duration: e2 }) => {
33985
33985
  const i2 = t3 / e2;
33986
33986
  if (this.to.interpolationFrom(this.from, i2, this.target), this.timingTarget) {
33987
33987
  const t4 = this.json.cBhvr.attrList[0];
33988
- qy(this.timingTarget, t4, this.target.toHexString());
33988
+ qy(this.timingTarget, t4, this.target.toHexString(), this.ctx);
33989
33989
  }
33990
33990
  }, this.onSeekToEnd = () => {
33991
33991
  this.isTimelineStart || this.onTimelineStart({ isReverse: false, activeCount: 0, id: "" }), this.onTimeUpdate({ duration: 1, delta: 1 });
@@ -34000,7 +34000,7 @@ void main(void){
34000
34000
  }
34001
34001
  updateCurrentValue() {
34002
34002
  if (this.timingTarget) {
34003
- const t2 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t2);
34003
+ const t2 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t2, this.ctx);
34004
34004
  e2 && (this.currentColorString = e2);
34005
34005
  }
34006
34006
  }
@@ -37154,8 +37154,8 @@ geometry=${JSON.stringify(o2)}`;
37154
37154
  t2(() => this.clearAutoForwardTimer()), t2(() => this.lifecycleClock.dispose()), t2(() => this.app.view.removeEventListener("webglcontextlost", this.onWebGLLost)), t2(() => cg.collectObjectByGroup(this.objPoolGroup)), t2(() => Xx.collectObjectByGroup(this.objPoolGroup)), t2(() => {
37155
37155
  var t3;
37156
37156
  return null === (t3 = this.transactionPlayer) || void 0 === t3 ? void 0 : t3.destroy();
37157
- }), t2(() => this.loader.destroy()), t2(() => this.fps.destroy()), t2(() => this.stagePool.destroyAllStage()), t2(() => this.stagePool.destroy()), t2(() => function(t3) {
37158
- var e2, i2, n2, r2, o2, s2;
37157
+ }), t2(() => this.loader.destroy()), t2(() => this.fps.destroy()), t2(() => this.stagePool.destroyAllStage()), t2(() => this.stagePool.destroy()), t2(() => function(t3, e2) {
37158
+ var i2, n2, r2, o2, s2;
37159
37159
  let a2 = null, l2 = null;
37160
37160
  try {
37161
37161
  a2 = t3.view;
@@ -37166,14 +37166,17 @@ geometry=${JSON.stringify(o2)}`;
37166
37166
  } catch (t4) {
37167
37167
  }
37168
37168
  try {
37169
- null === (n2 = null === (i2 = null === (e2 = null == l2 ? void 0 : l2.filter) || void 0 === e2 ? void 0 : e2.texturePool) || void 0 === i2 ? void 0 : i2.clear) || void 0 === n2 || n2.call(i2, true);
37169
+ null === (r2 = null === (n2 = null === (i2 = null == l2 ? void 0 : l2.filter) || void 0 === i2 ? void 0 : i2.texturePool) || void 0 === n2 ? void 0 : n2.clear) || void 0 === r2 || r2.call(n2, true);
37170
37170
  } catch (t4) {
37171
37171
  }
37172
37172
  try {
37173
- const t4 = null == l2 ? void 0 : l2.gl, e3 = null === (r2 = null == t4 ? void 0 : t4.getExtension) || void 0 === r2 ? void 0 : r2.call(t4, "WEBGL_lose_context");
37174
- (null == e3 ? void 0 : e3.loseContext) && true !== (null === (o2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === o2 ? void 0 : o2.call(t4)) && e3.loseContext(), console.info("[Slide][webgl] release requested", { hasContext: Boolean(t4), hasLoseContext: Boolean(null == e3 ? void 0 : e3.loseContext), contextLost: null === (s2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === s2 ? void 0 : s2.call(t4) });
37173
+ const t4 = null == l2 ? void 0 : l2.gl, e3 = null === (o2 = null == t4 ? void 0 : t4.getExtension) || void 0 === o2 ? void 0 : o2.call(t4, "WEBGL_lose_context");
37174
+ (null == e3 ? void 0 : e3.loseContext) && true !== (null === (s2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === s2 ? void 0 : s2.call(t4)) && e3.loseContext();
37175
37175
  } catch (t4) {
37176
- console.warn("[Slide][webgl] release failed", t4);
37176
+ try {
37177
+ e2 ? e2(t4) : console.warn("[Slide][webgl] release failed", t4);
37178
+ } catch (t5) {
37179
+ }
37177
37180
  }
37178
37181
  try {
37179
37182
  t3.destroy(true, { children: true, texture: true, baseTexture: true });
@@ -37181,7 +37184,9 @@ geometry=${JSON.stringify(o2)}`;
37181
37184
  } finally {
37182
37185
  (null == a2 ? void 0 : a2.parentNode) && a2.parentNode.removeChild(a2);
37183
37186
  }
37184
- }(this.app)), t2(() => this.globalEventHub.removeAllListeners()), t2(() => this.removeAllListeners()), t2(() => this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} }));
37187
+ }(this.app, (t3) => {
37188
+ this.logger.warn("[Slide][webgl] release failed", this.taskId, t3);
37189
+ })), t2(() => this.globalEventHub.removeAllListeners()), t2(() => this.removeAllListeners()), t2(() => this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} }));
37185
37190
  } finally {
37186
37191
  this.lifecycle = "disposed";
37187
37192
  }
@@ -38750,28 +38755,45 @@ geometry=${JSON.stringify(o2)}`;
38750
38755
  return !!this.available && !!this.locks[t3];
38751
38756
  }, t2;
38752
38757
  }(), mw = function() {
38753
- function t2() {
38754
- var t3 = this;
38755
- this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38756
- t3.isScheduling = true;
38757
- var e2 = t3.tasks.shift();
38758
- e2 && !t3.isDestroy && (e2.status = "running", t3.runningTask = e2, e2.fn.apply(null).then(function() {
38759
- t3.runningTask = void 0, t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38760
- }).catch(function() {
38761
- t3.runningTask = void 0, t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38762
- }));
38758
+ function t2(t3) {
38759
+ var e2 = this;
38760
+ this.onWarning = t3, this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38761
+ e2.isScheduling = true;
38762
+ var t4 = e2.tasks.shift();
38763
+ t4 && !e2.isDestroy ? (t4.status = "running", Promise.resolve().then(t4.fn).catch(function() {
38764
+ }).finally(function() {
38765
+ !e2.isDestroy && e2.tasks.length > 0 ? setTimeout(e2.schedule) : e2.isScheduling = false;
38766
+ })) : e2.isScheduling = false;
38763
38767
  };
38764
38768
  }
38765
- return t2.prototype.getRunningTask = function() {
38766
- var t3;
38767
- return null !== (t3 = this.runningTask) && void 0 !== t3 ? t3 : null;
38768
- }, t2.prototype.addTask = function(t3, e2) {
38769
- var i2 = { type: t3, status: "wait", fn: e2 }, n2 = this.getRunningTask();
38770
- n2 && t3 === n2.type || (this.tasks = this.tasks.filter(function(e3) {
38771
- return e3.type !== t3;
38772
- }), this.tasks.push(i2), this.isScheduling || this.schedule());
38769
+ return t2.prototype.warn = function(t3) {
38770
+ try {
38771
+ this.onWarning ? this.onWarning("frozen task cancellation callback failed", t3) : console.warn("[Slide] frozen task cancellation callback failed", t3);
38772
+ } catch (t4) {
38773
+ }
38774
+ }, t2.prototype.cancelPending = function(t3) {
38775
+ for (var e2, i2 = 0, n2 = this.tasks.splice(0); i2 < n2.length; i2++) {
38776
+ var r2 = n2[i2];
38777
+ try {
38778
+ null === (e2 = r2.onCancelled) || void 0 === e2 || e2.call(r2, new Error("Slide " + r2.type + " task " + t3));
38779
+ } catch (t4) {
38780
+ this.warn(t4);
38781
+ }
38782
+ }
38783
+ }, t2.prototype.addTask = function(t3, e2, i2) {
38784
+ if (this.isDestroy)
38785
+ try {
38786
+ null == i2 || i2(new Error("Slide " + t3 + " task cancelled after destroy"));
38787
+ } catch (t4) {
38788
+ this.warn(t4);
38789
+ }
38790
+ else {
38791
+ this.cancelPending("superseded");
38792
+ var n2 = { type: t3, status: "wait", fn: e2, onCancelled: i2 };
38793
+ this.tasks.push(n2), this.isScheduling || this.schedule();
38794
+ }
38773
38795
  }, t2.prototype.destroy = function() {
38774
- this.isDestroy = true;
38796
+ this.isDestroy = true, this.cancelPending("cancelled after destroy");
38775
38797
  }, t2;
38776
38798
  }(), gw = function() {
38777
38799
  return (gw = Object.assign || function(t2) {
@@ -39252,7 +39274,7 @@ geometry=${JSON.stringify(o2)}`;
39252
39274
  return bw(this, function(c2) {
39253
39275
  switch (c2.label) {
39254
39276
  case 0:
39255
- return o2 = document.createElement("div"), (s2 = new Bw({ anchor: o2, renderOptions: { minFPS: 1, maxFPS: 1, resolution: 1, maxResolutionLevel: i2, forceCanvas: true }, mode: "local", interactive: false, useLocalCache: true })).setResource(t2, e2), [4, s2.getSlideCountAsync()];
39277
+ return o2 = document.createElement("div"), (s2 = new Uw({ anchor: o2, renderOptions: { minFPS: 1, maxFPS: 1, resolution: 1, maxResolutionLevel: i2, forceCanvas: true }, mode: "local", interactive: false, useLocalCache: true })).setResource(t2, e2), [4, s2.getSlideCountAsync()];
39256
39278
  case 1:
39257
39279
  a2 = c2.sent(), c2.label = 2;
39258
39280
  case 2:
@@ -39423,18 +39445,23 @@ geometry=${JSON.stringify(o2)}`;
39423
39445
  }([o3, a3]);
39424
39446
  };
39425
39447
  }
39426
- }, Rw = "netless-slide-local-gif-production-client-geometry", Iw = function(t2) {
39448
+ }, Rw = function(t2, e2, i2) {
39449
+ if (i2 || 2 === arguments.length)
39450
+ for (var n2, r2 = 0, o2 = e2.length; r2 < o2; r2++)
39451
+ !n2 && r2 in e2 || (n2 || (n2 = Array.prototype.slice.call(e2, 0, r2)), n2[r2] = e2[r2]);
39452
+ return t2.concat(n2 || Array.prototype.slice.call(e2));
39453
+ }, Iw = "netless-slide-local-gif-production-client-geometry", Pw = function(t2) {
39427
39454
  function e2() {
39428
39455
  var e3 = null !== t2 && t2.apply(this, arguments) || this;
39429
39456
  return e3.code = "PLAYER_RENDER_TIMEOUT", e3;
39430
39457
  }
39431
39458
  return Sw(e2, t2), e2;
39432
- }(Error), Pw = window.ResizeObserver || qb, Ow = function(t2) {
39459
+ }(Error), Ow = window.ResizeObserver || qb, Lw = function(t2) {
39433
39460
  return new Promise(function(e2) {
39434
39461
  return setTimeout(e2, t2);
39435
39462
  });
39436
39463
  };
39437
- function Lw(t2, e2) {
39464
+ function Nw(t2, e2) {
39438
39465
  return Mw(this, void 0, void 0, function() {
39439
39466
  var i2;
39440
39467
  return Cw(this, function(n2) {
@@ -39442,7 +39469,7 @@ geometry=${JSON.stringify(o2)}`;
39442
39469
  case 0:
39443
39470
  i2 = Date.now(), n2.label = 1;
39444
39471
  case 1:
39445
- return !t2() && Date.now() - i2 < e2 ? [4, Ow(50)] : [3, 3];
39472
+ return !t2() && Date.now() - i2 < e2 ? [4, Lw(50)] : [3, 3];
39446
39473
  case 2:
39447
39474
  return n2.sent(), i2 = Date.now(), [3, 1];
39448
39475
  case 3:
@@ -39451,27 +39478,29 @@ geometry=${JSON.stringify(o2)}`;
39451
39478
  });
39452
39479
  });
39453
39480
  }
39454
- var Nw = { 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" }, Dw = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, Fw = "";
39481
+ var Dw = { 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" }, Fw = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, kw = "";
39455
39482
  try {
39456
- Fw = "1.4.62-beta.0";
39483
+ kw = "1.4.62";
39457
39484
  } catch (t2) {
39458
- Fw = "-dev-";
39485
+ kw = "-dev-";
39459
39486
  }
39460
- var kw = null;
39487
+ var Bw = null;
39461
39488
  try {
39462
- (kw = r.createInstance({ name: "__slide_local_log__", driver: r.INDEXEDDB, version: 1 })).ready(function(t2) {
39489
+ (Bw = r.createInstance({ name: "__slide_local_log__", driver: r.INDEXEDDB, version: 1 })).ready(function(t2) {
39463
39490
  }).catch(function(t2) {
39464
39491
  });
39465
39492
  } catch (t2) {
39466
39493
  }
39467
39494
  navigator.userAgent.toUpperCase().includes("HUAWEI") && document.createElement("canvas").getContext("2d").fillText("\u9065\u9065\u9886\u5148", 0, 10);
39468
- var Bw = function(t2) {
39495
+ var Uw = function(t2) {
39469
39496
  function e2(i3) {
39470
39497
  var r3 = t2.call(this) || this;
39471
- r3.iosResetCache = [], r3.iosResetPending = false, r3.version = Fw, r3.__slideState = hb()(Dw), r3.userInputTime = 0, r3.isSyncingSlideState = false, r3.frozenTaskManager = new mw(), r3.randomId = function() {
39498
+ r3.iosResetCache = [], r3.iosResetPending = false, r3.version = kw, r3.__slideState = hb()(Fw), r3.userInputTime = 0, r3.isSyncingSlideState = false, r3.frozenTaskManager = new mw(function(t3, e3) {
39499
+ r3.logger.warn(t3, r3.taskId, e3);
39500
+ }), r3.randomId = function() {
39472
39501
  const t3 = 4294967295 * Math.random() | 0, e3 = 4294967295 * Math.random() | 0, i4 = 4294967295 * Math.random() | 0, r4 = 4294967295 * Math.random() | 0;
39473
39502
  return (n[255 & t3] + n[t3 >> 8 & 255] + n[t3 >> 16 & 255] + n[t3 >> 24 & 255] + "-" + n[255 & e3] + n[e3 >> 8 & 255] + "-" + n[e3 >> 16 & 15 | 64] + n[e3 >> 24 & 255] + "-" + n[63 & i4 | 128] + n[i4 >> 8 & 255] + "-" + n[i4 >> 16 & 255] + n[i4 >> 24 & 255] + n[255 & r4] + n[r4 >> 8 & 255] + n[r4 >> 16 & 255] + n[r4 >> 24 & 255]).toUpperCase();
39474
- }(), r3.resize = false, r3.isAnimating = false, r3.renderingTaskManager = new tT(), r3.lifecycle = "alive", r3.lifecycleGeneration = 0, r3.playerDestroyCallbacks = [], r3.renderVisibilityTimers = /* @__PURE__ */ new Set(), r3.isLoading = false, r3.isReleasing = false, r3.interactive = true, r3.canRetryWithoutPlayer = false, r3.syncCatchUpInputBlocked = false, r3.playerGeneration = 0, r3.playerGenerations = /* @__PURE__ */ new WeakMap(), r3.playerSwapRenderTimeoutMs = 6e4, r3.pptMediaPermissionCallbacks = /* @__PURE__ */ new Set(), r3.pptMediaPermissionNotified = false, r3.pptMediaPermissionRenotifyPending = false, r3.renderingIndex = 0, r3.frameWidth = 1, r3.frameHeight = 1, r3.frame = document.createElement("div"), r3.canvasContainer = document.createElement("div"), r3.medianController = document.createElement("div"), r3.frameResizeObserver = new Pw(function() {
39503
+ }(), r3.resize = false, r3.isAnimating = false, r3.renderingTaskManager = new tT(), r3.lifecycle = "alive", r3.lifecycleGeneration = 0, r3.playerDestroyCallbacks = [], r3.renderVisibilityTimers = /* @__PURE__ */ new Set(), r3.isLoading = false, r3.isReleasing = false, r3.interactive = true, r3.canRetryWithoutPlayer = false, r3.syncCatchUpInputBlocked = false, r3.playerGeneration = 0, r3.playerGenerations = /* @__PURE__ */ new WeakMap(), r3.playerSwapRenderTimeoutMs = 6e4, r3.pptMediaPermissionCallbacks = /* @__PURE__ */ new Set(), r3.pptMediaPermissionNotified = false, r3.pptMediaPermissionRenotifyPending = false, r3.renderingIndex = 0, r3.frameWidth = 1, r3.frameHeight = 1, r3.frame = document.createElement("div"), r3.canvasContainer = document.createElement("div"), r3.medianController = document.createElement("div"), r3.frameResizeObserver = new Ow(function() {
39475
39504
  return r3.frameResizeHandler();
39476
39505
  }), r3.timestamp = function() {
39477
39506
  return Date.now();
@@ -39526,7 +39555,7 @@ geometry=${JSON.stringify(o2)}`;
39526
39555
  return Cw(this, function(h2) {
39527
39556
  switch (h2.label) {
39528
39557
  case 0:
39529
- return sg()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(Nw.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() {
39558
+ return sg()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(Dw.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() {
39530
39559
  l2.doNextStep(true, t3.clientId || "");
39531
39560
  })) : this.doNextStep(true, t3.clientId || ""), [3, 6]);
39532
39561
  case 1:
@@ -39577,10 +39606,12 @@ geometry=${JSON.stringify(o2)}`;
39577
39606
  var o3 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.info;
39578
39607
  o3 && o3("[" + i4 + "] " + t3);
39579
39608
  }, warn: function(t3, i4) {
39580
- var n2;
39581
- e2.appendLogString("WARN - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + t3 + "\n"), e2.trackLogger.addLog(t3, "warn", i4, r3.randomId);
39582
- var o3 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.warn;
39583
- o3 && o3("[" + i4 + "] " + t3);
39609
+ for (var n2, o3 = [], s2 = 2; s2 < arguments.length; s2++)
39610
+ o3[s2 - 2] = arguments[s2];
39611
+ var a2 = o3.length ? t3 + ": " + o3.map(String).join(" ") : t3;
39612
+ e2.appendLogString("WARN - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + a2 + "\n"), e2.trackLogger.addLog(a2, "warn", i4, r3.randomId);
39613
+ var l2 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.warn;
39614
+ l2 && l2.apply(void 0, Rw(["[" + i4 + "] " + t3], o3, false));
39584
39615
  }, error: function(t3, i4) {
39585
39616
  var n2;
39586
39617
  e2.appendLogString("ERROR - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + t3 + "\n"), e2.trackLogger.addLog(t3, "error", i4, r3.randomId);
@@ -39590,7 +39621,7 @@ geometry=${JSON.stringify(o2)}`;
39590
39621
  var o2 = cw(r3.mode, r3.config.syncEventQueuePolicy);
39591
39622
  return r3.config.syncEventQueuePolicy = o2, r3.syncQueue = new pw(r3.receiveSyncHandler, { policy: o2, onCompact: r3.handleSyncQueueCompact, onCompactedRenderComplete: r3.handleSyncQueueCompactRenderComplete, onCatchUpStateChange: r3.handleSyncQueueCatchUpStateChange, shouldTrackCatchUpEvent: function(t3) {
39592
39623
  return !r3.selfSyncEvents.has(t3);
39593
- } }), r3.lock = new fw("interactive" === r3.mode), r3.cacheImage.style.position = "absolute", r3.cacheImage.style.display = "block", r3.cacheImage.style.zIndex = "100", r3.setMedianControllerAttribute(), r3.canvasContainer.style.position = "relative", r3.canvasContainer.style.fontSize = "0", r3.canvasContainer.appendChild(r3.medianController), r3.frame.appendChild(r3.canvasContainer), r3.frame.appendChild(r3.cacheImage), r3.config.disableFrameResizeObserver || r3.frameResizeObserver.observe(r3.frame), r3.on(Nw.syncReceive, function(t3) {
39624
+ } }), r3.lock = new fw("interactive" === r3.mode), r3.cacheImage.style.position = "absolute", r3.cacheImage.style.display = "block", r3.cacheImage.style.zIndex = "100", r3.setMedianControllerAttribute(), r3.canvasContainer.style.position = "relative", r3.canvasContainer.style.fontSize = "0", r3.canvasContainer.appendChild(r3.medianController), r3.frame.appendChild(r3.canvasContainer), r3.frame.appendChild(r3.cacheImage), r3.config.disableFrameResizeObserver || r3.frameResizeObserver.observe(r3.frame), r3.on(Dw.syncReceive, function(t3) {
39594
39625
  (r3.lock.unlock(t3.type, t3.uuid) || !!r3.config.clientId && t3.clientId === r3.config.clientId) && r3.selfSyncEvents.add(t3), !r3.player && r3.config.skipActionWhenFrozen || "sync" === r3.mode && r3.config.clientId === t3.clientId || r3.syncQueue.addTask(t3);
39595
39626
  }), r3.renderingTaskManager.eventHub.on("task-error", function(t3) {
39596
39627
  var e3 = t3.error, i4 = t3.task, n2 = Sm.transform(e3);
@@ -39610,7 +39641,7 @@ geometry=${JSON.stringify(o2)}`;
39610
39641
  return [3, 5];
39611
39642
  i3.label = 1;
39612
39643
  case 1:
39613
- return i3.trys.push([1, 3, , 4]), [4, null == kw ? void 0 : kw.setItem("run_time_log_" + e2._tempLogIndex, e2._tempLog)];
39644
+ return i3.trys.push([1, 3, , 4]), [4, null == Bw ? void 0 : Bw.setItem("run_time_log_" + e2._tempLogIndex, e2._tempLog)];
39614
39645
  case 2:
39615
39646
  return i3.sent(), [3, 4];
39616
39647
  case 3:
@@ -39632,11 +39663,11 @@ geometry=${JSON.stringify(o2)}`;
39632
39663
  case 0:
39633
39664
  return e2.remoteLogAddress = t3, [4, e2.flushLog(true)];
39634
39665
  case 1:
39635
- if (a2.sent(), !kw)
39666
+ if (a2.sent(), !Bw)
39636
39667
  return [3, 13];
39637
39668
  i3 = [], a2.label = 2;
39638
39669
  case 2:
39639
- return a2.trys.push([2, 4, , 5]), [4, kw.keys()];
39670
+ return a2.trys.push([2, 4, , 5]), [4, Bw.keys()];
39640
39671
  case 3:
39641
39672
  return i3 = (a2.sent() || []).sort(function(t4, e3) {
39642
39673
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
@@ -39650,7 +39681,7 @@ geometry=${JSON.stringify(o2)}`;
39650
39681
  return [3, 13];
39651
39682
  o2 = r3[n2], o2.replace("run_time_log_", ""), s2 = "", a2.label = 7;
39652
39683
  case 7:
39653
- return a2.trys.push([7, 9, , 10]), [4, kw.getItem(o2)];
39684
+ return a2.trys.push([7, 9, , 10]), [4, Bw.getItem(o2)];
39654
39685
  case 8:
39655
39686
  return s2 = a2.sent() || "", [3, 10];
39656
39687
  case 9:
@@ -39687,7 +39718,7 @@ geometry=${JSON.stringify(o2)}`;
39687
39718
  t4 instanceof Qb || e3.logger.error(t4, e3.taskId);
39688
39719
  });
39689
39720
  }, e2.prototype.reportError = function(t3, i3) {
39690
- this.emit(Nw.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);
39721
+ this.emit(Dw.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);
39691
39722
  }, e2.prototype.initSlideConfig = function(t3) {
39692
39723
  return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (eb.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !el()(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;
39693
39724
  }, e2.prototype.initPlayer = function(t3) {
@@ -39701,11 +39732,11 @@ geometry=${JSON.stringify(o2)}`;
39701
39732
  }), s2.on(tb.mediaPermissionResolved, function() {
39702
39733
  r3.handlePptMediaPermissionResolved();
39703
39734
  }), s2.on(tb.renderStart, function(t4) {
39704
- r3.isLoading = true, r3.emit(Nw.renderStart, t4), window.postMessage({ type: "@slide/_render_start_", taskId: r3.taskId, index: t4 }, "*");
39735
+ r3.isLoading = true, r3.emit(Dw.renderStart, t4), window.postMessage({ type: "@slide/_render_start_", taskId: r3.taskId, index: t4 }, "*");
39705
39736
  }), s2.on(tb.renderEnd, function(t4) {
39706
- r3.isLoading = false, r3.player && (r3.designHeight = r3.player.designHeight, r3.designWidth = r3.player.designWidth, r3.cacheImage.style.width = r3.player.designWidth + "px", r3.cacheImage.style.height = r3.player.designHeight + "px", r3.cacheImage.style.maxWidth = r3.player.designWidth + "px", r3.cacheImage.style.minWidth = r3.player.designHeight + "px", r3._slideCount = r3.player.slideCount), r3.emit(Nw.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r3.taskId, index: t4 }, "*");
39737
+ r3.isLoading = false, r3.player && (r3.designHeight = r3.player.designHeight, r3.designWidth = r3.player.designWidth, r3.cacheImage.style.width = r3.player.designWidth + "px", r3.cacheImage.style.height = r3.player.designHeight + "px", r3.cacheImage.style.maxWidth = r3.player.designWidth + "px", r3.cacheImage.style.minWidth = r3.player.designHeight + "px", r3._slideCount = r3.player.slideCount), r3.emit(Dw.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r3.taskId, index: t4 }, "*");
39707
39738
  }), s2.on(tb.slideChange, function(t4) {
39708
- r3.__slideState.currentSlideIndex = t4, r3.emitStateChange(), r3.emit(Nw.slideChange, t4);
39739
+ r3.__slideState.currentSlideIndex = t4, r3.emitStateChange(), r3.emit(Dw.slideChange, t4);
39709
39740
  }), s2.on(tb.mainSeqStateChange, function(t4) {
39710
39741
  r3.__slideState.mainSeqState = t4, r3.emitStateChange();
39711
39742
  }), s2.on(tb.mainSeqStepChange, function(t4) {
@@ -39714,16 +39745,16 @@ geometry=${JSON.stringify(o2)}`;
39714
39745
  var e4 = t4.id, i4 = t4.state;
39715
39746
  r3.__slideState.interactiveSeqState[e4] = i4, r3.emitStateChange();
39716
39747
  }), s2.on(tb.animateStart, function() {
39717
- true !== r3.isAnimating && (r3.isAnimating = true, r3.emit(Nw.animateStart));
39748
+ true !== r3.isAnimating && (r3.isAnimating = true, r3.emit(Dw.animateStart));
39718
39749
  }), s2.on(tb.animateEnd, function() {
39719
- false !== r3.isAnimating && (r3.isAnimating = false, r3.emit(Nw.animateEnd));
39750
+ false !== r3.isAnimating && (r3.isAnimating = false, r3.emit(Dw.animateEnd));
39720
39751
  }), s2.on(tb.interactiveSeqAction, function(t4) {
39721
39752
  var e4 = t4.action, i4 = t4.seqId;
39722
39753
  r3.emitSyncDispatch({ slideIndex: r3.__slideState.currentSlideIndex, type: "interactiveAnim", action: e4, seqId: i4 }), r3.emitStateChange();
39723
39754
  }), s2.on(tb.mainSeqStepStart, function(t4) {
39724
- r3.emit(Nw.mainSeqStepStart, t4);
39755
+ r3.emit(Dw.mainSeqStepStart, t4);
39725
39756
  }), s2.on(tb.mainSeqStepEnd, function(t4) {
39726
- r3.emit(Nw.mainSeqStepEnd, t4);
39757
+ r3.emit(Dw.mainSeqStepEnd, t4);
39727
39758
  }), s2.on(tb.mediaPlay, function(t4) {
39728
39759
  var e4, i4 = null !== (e4 = r3.__slideState.mediaState[t4.id]) && void 0 !== e4 ? e4 : {};
39729
39760
  i4.type = "play", i4.time = r3.timestamp() - 1e3 * t4.time, r3.__slideState.mediaState[t4.id] = i4, t4._stateOnly ? "interactive" === r3.config.mode && r3.receiveSyncHandler({ slideIndex: r3.__slideState.currentSlideIndex, type: "mediaPlay", id: t4.id, state: i4 }).catch(function(t5) {
@@ -39746,7 +39777,7 @@ geometry=${JSON.stringify(o2)}`;
39746
39777
  }), s2.on(tb.requestNextSlide, function(t4) {
39747
39778
  r3.handleNextSlide(t4);
39748
39779
  }), s2.on(tb.useraddLink, function(t4) {
39749
- r3.emit(Nw.useraddLink, r3.taskId, r3.renderingIndex, t4);
39780
+ r3.emit(Dw.useraddLink, r3.taskId, r3.renderingIndex, t4);
39750
39781
  }), s2.on(tb.requestGotoSlide, function(t4) {
39751
39782
  var e4;
39752
39783
  r3.syncCatchUpInputBlocked || ((null === (e4 = r3.config.navigatorDelegate) || void 0 === e4 ? void 0 : e4.gotoPage) ? r3.config.navigatorDelegate.gotoPage(t4) : r3.handleGotoSlide(t4));
@@ -39887,7 +39918,7 @@ geometry=${JSON.stringify(o2)}`;
39887
39918
  return [2];
39888
39919
  this.initInteractiveSeq(t3), this.__slideState.interactiveSeqState = t3.interactiveSeqState;
39889
39920
  }
39890
- return null == e3 || e3(), [4, Ow(1500)];
39921
+ return null == e3 || e3(), [4, Lw(1500)];
39891
39922
  case 9:
39892
39923
  if (d2.sent(), !s2())
39893
39924
  return [2];
@@ -40053,7 +40084,7 @@ geometry=${JSON.stringify(o2)}`;
40053
40084
  case 0:
40054
40085
  i3 = this.playerSwapRenderTimeoutMs, r3 = new Promise(function(t4, r4) {
40055
40086
  n2 = setTimeout(function() {
40056
- r4(new Iw("player render slide " + e3 + " timeout after " + i3 + "ms"));
40087
+ r4(new Pw("player render slide " + e3 + " timeout after " + i3 + "ms"));
40057
40088
  }, i3);
40058
40089
  }), o2.label = 1;
40059
40090
  case 1:
@@ -40159,7 +40190,7 @@ geometry=${JSON.stringify(o2)}`;
40159
40190
  var t3, e3;
40160
40191
  return null !== (e3 = null === (t3 = this.player) || void 0 === t3 ? void 0 : t3.getSnapshot()) && void 0 !== e3 ? e3 : null;
40161
40192
  }, e2.prototype.nextStep = function() {
40162
- !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasNextStep() || this.emit(Nw.slideStepEnd), this.player.mainSeqHasNextStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : "sync" === this.mode ? (this.doNextStep(false, ""), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep(false, "") : this.handleNextSlide()) : this.logger.info("prevent nextStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40193
+ !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasNextStep() || this.emit(Dw.slideStepEnd), this.player.mainSeqHasNextStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : "sync" === this.mode ? (this.doNextStep(false, ""), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep(false, "") : this.handleNextSlide()) : this.logger.info("prevent nextStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40163
40194
  }, e2.prototype.doNextStep = function(t3, e3) {
40164
40195
  if (this.player) {
40165
40196
  var i3 = !this.config.clientId || e3 === this.config.clientId;
@@ -40168,7 +40199,7 @@ geometry=${JSON.stringify(o2)}`;
40168
40199
  this.__slideState.mainSeqStep = n2, this.emitStateChange();
40169
40200
  }
40170
40201
  }, e2.prototype.prevStep = function() {
40171
- !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasPrevStep() || this.emit(Nw.slideStepStart), this.player.mainSeqHasPrevStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : "sync" === this.mode ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide()) : this.logger.info("prevent prevStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40202
+ !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasPrevStep() || this.emit(Dw.slideStepStart), this.player.mainSeqHasPrevStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : "sync" === this.mode ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide()) : this.logger.info("prevent prevStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40172
40203
  }, e2.prototype.doPrevStep = function(t3) {
40173
40204
  if (void 0 === t3 && (t3 = false), this.player) {
40174
40205
  this.player.prevStep(t3);
@@ -40180,14 +40211,14 @@ geometry=${JSON.stringify(o2)}`;
40180
40211
  }, e2.prototype.emitStateChange = function() {
40181
40212
  if ("local" !== this.mode && !this.isSyncingSlideState) {
40182
40213
  var t3 = this.slideState;
40183
- !ob()(this.lastEmitedState, t3) && this.isSlideStateReady(t3) && (this.lastEmitedState = t3, this.emit(Nw.stateChange, t3), this.logger.info("stateChange dispatch " + JSON.stringify(this.slideState), this.taskId));
40214
+ !ob()(this.lastEmitedState, t3) && this.isSlideStateReady(t3) && (this.lastEmitedState = t3, this.emit(Dw.stateChange, t3), this.logger.info("stateChange dispatch " + JSON.stringify(this.slideState), this.taskId));
40184
40215
  }
40185
40216
  }, e2.prototype.emitSyncDispatch = function(t3) {
40186
40217
  if (!this.lock.isLocked(t3.type)) {
40187
40218
  var e3 = Math.random().toString(32).substr(2);
40188
40219
  this.lock.addLock(t3.type, e3);
40189
40220
  var i3 = Ew(Ew({}, t3), { uuid: e3, clientId: this.config.clientId });
40190
- "sync" === this.config.mode && (i3.incrId = this.dispatchIncrId), this.emit(Nw.syncDispatch, i3), this.logger.info("sync dispatch " + JSON.stringify(i3), this.taskId);
40221
+ "sync" === this.config.mode && (i3.incrId = this.dispatchIncrId), this.emit(Dw.syncDispatch, i3), this.logger.info("sync dispatch " + JSON.stringify(i3), this.taskId);
40191
40222
  }
40192
40223
  }, e2.prototype.setMainSeqStep = function(t3, e3) {
40193
40224
  var i3;
@@ -40230,7 +40261,7 @@ geometry=${JSON.stringify(o2)}`;
40230
40261
  return i3._doFrozen(t3).catch(function(t4) {
40231
40262
  throw null == e3 || e3(t4), t4;
40232
40263
  });
40233
- });
40264
+ }, e3);
40234
40265
  }, e2.prototype._doRelease = function(t3, e3) {
40235
40266
  var i3, n2;
40236
40267
  return Mw(this, void 0, void 0, function() {
@@ -40246,7 +40277,7 @@ geometry=${JSON.stringify(o2)}`;
40246
40277
  case 2:
40247
40278
  if (d2.sent(), "alive" !== this.lifecycle || this.player)
40248
40279
  throw new Error("Slide release cancelled before player creation");
40249
- for (s2 in r3 = this.player = this.initPlayer(this.config), (null === (i3 = this.config) || void 0 === i3 ? void 0 : i3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), o2 = this.__slideState, this.__slideState = hb()(Dw), o2.mediaState)
40280
+ for (s2 in r3 = this.player = this.initPlayer(this.config), (null === (i3 = this.config) || void 0 === i3 ? void 0 : i3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), o2 = this.__slideState, this.__slideState = hb()(Fw), o2.mediaState)
40250
40281
  "play" === (a2 = o2.mediaState[s2]).type && (l2 = Math.max(null !== (n2 = a2.frozenTime) && void 0 !== n2 ? n2 : 0, a2.time), a2.time = this.timestamp() - (l2 - a2.time), a2.frozenTime = void 0);
40251
40282
  return null == e3 || e3(), h2 = Promise.resolve(), this.setSlideState(o2, function() {
40252
40283
  h2 = new Promise(function(t4) {
@@ -40276,7 +40307,7 @@ geometry=${JSON.stringify(o2)}`;
40276
40307
  return n2._doRelease(t3, e3).catch(function(t4) {
40277
40308
  throw null == i3 || i3(t4), t4;
40278
40309
  });
40279
- });
40310
+ }, i3);
40280
40311
  }, e2.prototype._doDestroy = function() {
40281
40312
  var t3, i3, n2, r3, o2 = this;
40282
40313
  if ("disposed" !== this.lifecycle) {
@@ -40313,7 +40344,7 @@ geometry=${JSON.stringify(o2)}`;
40313
40344
  case 0:
40314
40345
  t3 = 0, e3.label = 1;
40315
40346
  case 1:
40316
- return this.isLoading && t3 < 10 ? [4, Ow(100)] : [3, 3];
40347
+ return this.isLoading && t3 < 10 ? [4, Lw(100)] : [3, 3];
40317
40348
  case 2:
40318
40349
  return e3.sent(), t3 += 1, [3, 1];
40319
40350
  case 3:
@@ -40436,11 +40467,11 @@ geometry=${JSON.stringify(o2)}`;
40436
40467
  case 0:
40437
40468
  return [4, e2.flushLog(true)];
40438
40469
  case 1:
40439
- if (i3.sent(), !kw)
40470
+ if (i3.sent(), !Bw)
40440
40471
  return [3, 12];
40441
40472
  n2 = [], i3.label = 2;
40442
40473
  case 2:
40443
- return i3.trys.push([2, 4, , 5]), [4, kw.keys()];
40474
+ return i3.trys.push([2, 4, , 5]), [4, Bw.keys()];
40444
40475
  case 3:
40445
40476
  return n2 = (i3.sent() || []).sort(function(t4, e3) {
40446
40477
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
@@ -40456,7 +40487,7 @@ geometry=${JSON.stringify(o2)}`;
40456
40487
  return [3, 12];
40457
40488
  s2 = o2[r3], a2 = s2.replace("run_time_log_", ""), l2 = "", i3.label = 7;
40458
40489
  case 7:
40459
- return i3.trys.push([7, 9, , 10]), [4, kw.getItem(s2)];
40490
+ return i3.trys.push([7, 9, , 10]), [4, Bw.getItem(s2)];
40460
40491
  case 8:
40461
40492
  return l2 = i3.sent() || "", [3, 10];
40462
40493
  case 9:
@@ -40478,13 +40509,13 @@ geometry=${JSON.stringify(o2)}`;
40478
40509
  case 0:
40479
40510
  return i3.trys.push([0, 7, , 8]), [4, e2.flushLog(true)];
40480
40511
  case 1:
40481
- return i3.sent(), t3 = "", kw ? [4, kw.keys()] : [3, 6];
40512
+ return i3.sent(), t3 = "", Bw ? [4, Bw.keys()] : [3, 6];
40482
40513
  case 2:
40483
40514
  n2 = (i3.sent() || []).sort(function(t4, e3) {
40484
40515
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
40485
40516
  }), r3 = 0, o2 = n2, i3.label = 3;
40486
40517
  case 3:
40487
- return r3 < o2.length ? (s2 = o2[r3], a2 = t3, [4, kw.getItem(s2)]) : [3, 6];
40518
+ return r3 < o2.length ? (s2 = o2[r3], a2 = t3, [4, Bw.getItem(s2)]) : [3, 6];
40488
40519
  case 4:
40489
40520
  t3 = a2 + (i3.sent() || ""), i3.label = 5;
40490
40521
  case 5:
@@ -40525,35 +40556,35 @@ geometry=${JSON.stringify(o2)}`;
40525
40556
  };
40526
40557
  })], e2.prototype, "initSlideConfig", null), e2;
40527
40558
  }(Ka.a);
40528
- null == kw || kw.clear().catch(function() {
40529
- }), window.addEventListener("__slide_log__", Bw.handleLogDownload), window.addEventListener("message", function(t2) {
40559
+ null == Bw || Bw.clear().catch(function() {
40560
+ }), window.addEventListener("__slide_log__", Uw.handleLogDownload), window.addEventListener("message", function(t2) {
40530
40561
  var e2;
40531
40562
  if ("@slide/_request_log_" === t2.data.type)
40532
- Bw.handleLogReport(t2.data.sessionId).catch(function() {
40563
+ Uw.handleLogReport(t2.data.sessionId).catch(function() {
40533
40564
  });
40534
40565
  else if ("@slide/_request_frozen_" === t2.data.type)
40535
- Bw.handleFrozenAllSlide();
40566
+ Uw.handleFrozenAllSlide();
40536
40567
  else if ("@slide/_request_release_" === t2.data.type)
40537
- Bw.handleReleaseAllSlide();
40568
+ Uw.handleReleaseAllSlide();
40538
40569
  else if ("@slide/_update_volume_" === t2.data.type) {
40539
40570
  var i2 = 0.5;
40540
40571
  try {
40541
40572
  i2 = parseFloat(t2.data.volume.toString());
40542
40573
  } catch (t3) {
40543
40574
  }
40544
- Bw.volumeAdjuster.volume = i2;
40575
+ Uw.volumeAdjuster.volume = i2;
40545
40576
  } else if ("@slide/_get_volume_" === t2.data.type)
40546
- window.postMessage({ type: "@slide/_report_volume_", volume: Bw.volumeAdjuster.volume, customMessage: "@slide/_report_volume_" }, "*");
40577
+ window.postMessage({ type: "@slide/_report_volume_", volume: Uw.volumeAdjuster.volume, customMessage: "@slide/_report_volume_" }, "*");
40547
40578
  else if ("@slide/_preload_slide_" === t2.data.type) {
40548
40579
  var n2 = null !== (e2 = t2.data.sessionId) && void 0 !== e2 ? e2 : Math.random().toString(32).substr(2);
40549
- Bw.preloadResource(t2.data.taskId, t2.data.prefix, t2.data.maxResolutionLevel, function(e3) {
40580
+ Uw.preloadResource(t2.data.taskId, t2.data.prefix, t2.data.maxResolutionLevel, function(e3) {
40550
40581
  window.postMessage({ type: "@slide/_preload_slide_progress_", sessionId: n2, taskId: t2.data.taskId, progress: e3 }, "*");
40551
40582
  }, t2.data.pages).catch(function(e3) {
40552
40583
  window.postMessage({ type: "@slide/_preload_slide_error_", sessionId: n2, taskId: t2.data.taskId, error: e3 }, "*");
40553
40584
  });
40554
40585
  }
40555
40586
  }), window.setInterval(function() {
40556
- Bw.flushLog().catch(function() {
40587
+ Uw.flushLog().catch(function() {
40557
40588
  });
40558
40589
  }, 2e3);
40559
40590
  }]);
@@ -41005,6 +41036,25 @@ function hexDouble(num) {
41005
41036
  return str.length < 2 ? "0" + str : str;
41006
41037
  }
41007
41038
  var ColorString = colorString.exports;
41039
+ const getAppLogger = (context) => {
41040
+ var _a;
41041
+ try {
41042
+ return (_a = context.getWindowManager()) == null ? void 0 : _a.Logger;
41043
+ } catch {
41044
+ return void 0;
41045
+ }
41046
+ };
41047
+ const reportAppLog = (appLogger, level, ...args) => {
41048
+ try {
41049
+ if (appLogger)
41050
+ appLogger[level](...args);
41051
+ else if (level === "info" || level === "debug")
41052
+ console.log(...args);
41053
+ else
41054
+ console[level](...args);
41055
+ } catch {
41056
+ }
41057
+ };
41008
41058
  class Logger {
41009
41059
  constructor(enable) {
41010
41060
  this.enable = enable;
@@ -41053,32 +41103,27 @@ class Logger {
41053
41103
  window.removeEventListener("message", this._onMessage);
41054
41104
  }
41055
41105
  log(...args) {
41056
- if (this.roomLogger) {
41057
- this.roomLogger.info(...args);
41058
- } else if (this.enable) {
41059
- console.log(...args);
41060
- }
41106
+ if (this.roomLogger || this.enable)
41107
+ reportAppLog(this.roomLogger, "info", ...args);
41061
41108
  }
41062
41109
  verbose(...args) {
41063
- if (this.roomLogger) {
41064
- this.roomLogger.debug(...args);
41065
- } else if (this.enable && this.level === "verbose") {
41066
- console.log(...args);
41110
+ if (this.roomLogger || this.enable && this.level === "verbose") {
41111
+ reportAppLog(this.roomLogger, "debug", ...args);
41067
41112
  }
41068
41113
  }
41069
41114
  warn(...args) {
41070
- if (this.roomLogger) {
41071
- this.roomLogger.warn(...args);
41072
- } else {
41073
- console.warn(...args);
41074
- }
41115
+ reportAppLog(this.roomLogger, "warn", ...args);
41116
+ }
41117
+ error(...args) {
41118
+ reportAppLog(this.roomLogger, "error", ...args);
41075
41119
  }
41076
41120
  }
41077
41121
  const logger = /* @__PURE__ */ new Logger(false);
41078
41122
  const log = /* @__PURE__ */ logger.log.bind(logger);
41079
41123
  const verbose = /* @__PURE__ */ logger.verbose.bind(logger);
41080
- const setRoomLogger = (displayer) => {
41081
- logger.roomLogger = displayer.logger;
41124
+ const setRoomLogger = (context) => {
41125
+ var _a;
41126
+ logger.roomLogger = (_a = getAppLogger(context)) != null ? _a : null;
41082
41127
  };
41083
41128
  function guessBgColor(el) {
41084
41129
  try {
@@ -41206,13 +41251,21 @@ function runNextSlideWebGLTask() {
41206
41251
  slideWebGLRunning = true;
41207
41252
  const startedAt = performance.now();
41208
41253
  log("[Slide][player-queue] start", task.label, "pending", slideWebGLTasks.length);
41209
- void Promise.resolve().then(task.run).then(() => {
41210
- log("[Slide][player-queue] done", task.label, "ms", Math.round(performance.now() - startedAt));
41211
- task.resolve();
41212
- }, (error) => {
41213
- log("[Slide][player-queue] failed", task.label, error);
41214
- task.reject(error);
41215
- }).finally(() => {
41254
+ void Promise.resolve().then(task.run).then(
41255
+ () => {
41256
+ log(
41257
+ "[Slide][player-queue] done",
41258
+ task.label,
41259
+ "ms",
41260
+ Math.round(performance.now() - startedAt)
41261
+ );
41262
+ task.resolve();
41263
+ },
41264
+ (error) => {
41265
+ log("[Slide][player-queue] failed", task.label, error);
41266
+ task.reject(error);
41267
+ }
41268
+ ).finally(() => {
41216
41269
  slideWebGLRunning = false;
41217
41270
  runNextSlideWebGLTask();
41218
41271
  });
@@ -41281,9 +41334,13 @@ class SlideControllerBase {
41281
41334
  return;
41282
41335
  }
41283
41336
  if (this._toFreeze === 1) {
41284
- this.freeze();
41337
+ void this.freeze().catch(
41338
+ (error) => logger.error("[Slide] deferred freeze failed", this.context.appId, error)
41339
+ );
41285
41340
  } else if (this._toFreeze === -1) {
41286
- this.unfreeze();
41341
+ void this.unfreeze().catch(
41342
+ (error) => logger.error("[Slide] deferred unfreeze failed", this.context.appId, error)
41343
+ );
41287
41344
  }
41288
41345
  } else if (this.pollCount < MaxPollCount) {
41289
41346
  this.pollCount++;
@@ -41325,7 +41382,7 @@ class SlideControllerBase {
41325
41382
  else
41326
41383
  await this.freeze();
41327
41384
  },
41328
- (error) => logger.warn("[Slide] resource transition failed", this.context.appId, error)
41385
+ (error) => logger.error("[Slide] resource transition failed", this.context.appId, error)
41329
41386
  );
41330
41387
  this.shouldBeActive = () => {
41331
41388
  var _a, _b, _c;
@@ -41357,19 +41414,26 @@ class SlideControllerBase {
41357
41414
  if (this.ready) {
41358
41415
  log("[Slide] freeze", this.context.appId);
41359
41416
  if (this.invisibleBehavior === "frozen") {
41360
- await enqueueSlideWebGLTransition(() => {
41361
- if (this.destroyed)
41362
- return Promise.resolve();
41363
- const destroyed = new Promise((resolve, reject) => {
41364
- const result = this.slide.frozen.call(this.slide, () => {
41365
- log("[Slide][player] frozen callback", this.context.appId);
41366
- resolve();
41367
- }, reject);
41368
- if (result)
41369
- void result.then(resolve, reject);
41370
- });
41371
- return Promise.race([destroyed, this.destroyedSignal]);
41372
- }, false, `freeze:${this.context.appId}`);
41417
+ await enqueueSlideWebGLTransition(
41418
+ () => {
41419
+ if (this.destroyed)
41420
+ return Promise.resolve();
41421
+ const destroyed = new Promise((resolve, reject) => {
41422
+ const result = this.slide.frozen.call(
41423
+ this.slide,
41424
+ () => {
41425
+ resolve();
41426
+ },
41427
+ reject
41428
+ );
41429
+ if (result)
41430
+ void result.then(resolve, reject);
41431
+ });
41432
+ return Promise.race([destroyed, this.destroyedSignal]);
41433
+ },
41434
+ false,
41435
+ `freeze:${this.context.appId}`
41436
+ );
41373
41437
  } else {
41374
41438
  this.slide.pause();
41375
41439
  }
@@ -41396,32 +41460,43 @@ class SlideControllerBase {
41396
41460
  if (this.ready) {
41397
41461
  log("[Slide] unfreeze", this.context.appId);
41398
41462
  if (this.invisibleBehavior === "frozen") {
41399
- await enqueueSlideWebGLTransition(() => {
41400
- if (this.destroyed)
41401
- return Promise.resolve();
41402
- const created = new Promise((resolve, reject) => {
41403
- const result = this.slide.release.call(this.slide, () => {
41404
- log("[Slide][player] restored callback", this.context.appId);
41405
- if (this.isLazySetupMode() && !this.shouldBeActive())
41406
- return;
41407
- this.slide.notifyFrameResize();
41408
- const state = this.context.storage.state.state;
41409
- if (state) {
41410
- log("[Slide] sync storage", JSON.stringify(state));
41411
- void this.slide.setSlideState(state).catch((error) => {
41412
- this.resourceStateUnknown = true;
41413
- logger.warn("[Slide] storage sync after release failed", this.context.appId, error);
41414
- });
41415
- }
41416
- }, () => {
41417
- log("[Slide][player] created callback", this.context.appId);
41418
- resolve();
41419
- }, reject);
41420
- if (result)
41421
- void result.then(resolve, reject);
41422
- });
41423
- return Promise.race([created, this.destroyedSignal]);
41424
- }, false, `release:${this.context.appId}`);
41463
+ await enqueueSlideWebGLTransition(
41464
+ () => {
41465
+ if (this.destroyed)
41466
+ return Promise.resolve();
41467
+ const created = new Promise((resolve, reject) => {
41468
+ const result = this.slide.release.call(
41469
+ this.slide,
41470
+ () => {
41471
+ if (this.isLazySetupMode() && !this.shouldBeActive())
41472
+ return;
41473
+ this.slide.notifyFrameResize();
41474
+ const state = this.context.storage.state.state;
41475
+ if (state) {
41476
+ log("[Slide] sync storage", JSON.stringify(state));
41477
+ void this.slide.setSlideState(state).catch((error) => {
41478
+ this.resourceStateUnknown = true;
41479
+ logger.error(
41480
+ "[Slide] storage sync after release failed",
41481
+ this.context.appId,
41482
+ error
41483
+ );
41484
+ });
41485
+ }
41486
+ },
41487
+ () => {
41488
+ resolve();
41489
+ },
41490
+ reject
41491
+ );
41492
+ if (result)
41493
+ void result.then(resolve, reject);
41494
+ });
41495
+ return Promise.race([created, this.destroyedSignal]);
41496
+ },
41497
+ false,
41498
+ `release:${this.context.appId}`
41499
+ );
41425
41500
  } else {
41426
41501
  this.slide.resume();
41427
41502
  this.slide.notifyFrameResize();
@@ -41464,7 +41539,9 @@ class SlideControllerBase {
41464
41539
  }
41465
41540
  if (state === "minimized") {
41466
41541
  log("[Slide] freeze because app state is minimized");
41467
- this.freeze();
41542
+ void this.freeze().catch(
41543
+ (error) => logger.error("[Slide] minimized freeze failed", this.context.appId, error)
41544
+ );
41468
41545
  }
41469
41546
  };
41470
41547
  this.onAppStatusChangeHandler = (payload) => {
@@ -41475,7 +41552,9 @@ class SlideControllerBase {
41475
41552
  }
41476
41553
  if (appId === this.context.appId && status === "minimized") {
41477
41554
  log("[Slide] freeze because app status is minimized");
41478
- this.freeze();
41555
+ void this.freeze().catch(
41556
+ (error) => logger.error("[Slide] minimized freeze failed", this.context.appId, error)
41557
+ );
41479
41558
  }
41480
41559
  };
41481
41560
  this.getAppStatus = () => {
@@ -41500,26 +41579,30 @@ class SlideControllerBase {
41500
41579
  }
41501
41580
  };
41502
41581
  this.onVisibilityChange = async () => {
41503
- this.visible = document.visibilityState === "visible";
41504
- if (this.isLazySetupMode() || this.managedActivity) {
41505
- await this.reconcileActivity().catch(() => void 0);
41506
- return;
41507
- }
41508
- const appStatus = this.getAppStatus();
41509
- if (!this.visible) {
41510
- this.savedIsFrozen = this.isFrozen;
41511
- log("[Slide] freeze because tab becomes invisible");
41512
- if (!this.isFrozen)
41513
- await this.freeze();
41514
- return;
41515
- }
41516
- if (appStatus === "minimized") {
41517
- log("[Slide] do nothing because app state is minimized");
41518
- return;
41519
- }
41520
- if (!this.savedIsFrozen) {
41521
- log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
41522
- await this.unfreeze();
41582
+ try {
41583
+ this.visible = document.visibilityState === "visible";
41584
+ if (this.isLazySetupMode() || this.managedActivity) {
41585
+ await this.reconcileActivity().catch(() => void 0);
41586
+ return;
41587
+ }
41588
+ const appStatus = this.getAppStatus();
41589
+ if (!this.visible) {
41590
+ this.savedIsFrozen = this.isFrozen;
41591
+ log("[Slide] freeze because tab becomes invisible");
41592
+ if (!this.isFrozen)
41593
+ await this.freeze();
41594
+ return;
41595
+ }
41596
+ if (appStatus === "minimized") {
41597
+ log("[Slide] do nothing because app state is minimized");
41598
+ return;
41599
+ }
41600
+ if (!this.savedIsFrozen) {
41601
+ log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
41602
+ await this.unfreeze();
41603
+ }
41604
+ } catch (error) {
41605
+ logger.error("[Slide] visibility transition failed", this.context.appId, error);
41523
41606
  }
41524
41607
  };
41525
41608
  const {
@@ -41546,7 +41629,7 @@ class SlideControllerBase {
41546
41629
  this.context = context;
41547
41630
  this.room = context.getRoom();
41548
41631
  this.player = this.room ? void 0 : context.getDisplayer();
41549
- setRoomLogger(this.room || this.player);
41632
+ setRoomLogger(context);
41550
41633
  this.syncStateOnceFlag = !this.context.isAddApp;
41551
41634
  this.visible = document.visibilityState === "visible";
41552
41635
  this.savedIsFrozen = false;
@@ -41581,6 +41664,10 @@ class SlideControllerBase {
41581
41664
  } else if (context.isAddApp) {
41582
41665
  log("[Slide] init by renderSlide", 1);
41583
41666
  slide.renderSlide(1);
41667
+ } else if (taskId) {
41668
+ void slide.doRenderSlide(1).catch((error) => {
41669
+ logger.error("[Slide] initial local render failed", context.appId, error);
41670
+ });
41584
41671
  }
41585
41672
  this.pollReadyState();
41586
41673
  }
@@ -41675,7 +41762,29 @@ class SlideControllerBase {
41675
41762
  resourceTimeout: options.resourceTimeout,
41676
41763
  rtcAudio: options.rtcAudio,
41677
41764
  useLocalCache: options.useLocalCache,
41678
- logger: options.logger,
41765
+ logger: {
41766
+ ...options.logger,
41767
+ error: (message, ...details) => {
41768
+ var _a2, _b2;
41769
+ logger.error(message, ...details);
41770
+ if (options.logger !== logger.roomLogger) {
41771
+ try {
41772
+ (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.error) == null ? void 0 : _b2.call(_a2, message, ...details);
41773
+ } catch {
41774
+ }
41775
+ }
41776
+ },
41777
+ warn: (message, ...details) => {
41778
+ var _a2, _b2;
41779
+ logger.warn(message, ...details);
41780
+ if (options.logger !== logger.roomLogger) {
41781
+ try {
41782
+ (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.warn) == null ? void 0 : _b2.call(_a2, message, ...details);
41783
+ } catch {
41784
+ }
41785
+ }
41786
+ }
41787
+ },
41679
41788
  whiteTracker: defaults.whiteTracker,
41680
41789
  timestamp: this.timestamp,
41681
41790
  customLinks: attribute.customLinks,
@@ -41692,16 +41801,23 @@ class SlideControllerBase {
41692
41801
  if (!this.destroyed) {
41693
41802
  log("[Slide] destroy slide (once)");
41694
41803
  this.destroyed = true;
41695
- this.destroyPromise = enqueueSlideWebGLTransition(() => new Promise((resolve, reject) => {
41696
- try {
41697
- this.slide.destroy.call(this.slide, () => {
41698
- log("[Slide][player] destroy callback", this.context.appId);
41699
- resolve();
41700
- }, reject);
41701
- } catch (error) {
41702
- reject(error);
41703
- }
41704
- }), true, `destroy:${this.context.appId}`);
41804
+ this.destroyPromise = enqueueSlideWebGLTransition(
41805
+ () => new Promise((resolve, reject) => {
41806
+ try {
41807
+ this.slide.destroy.call(
41808
+ this.slide,
41809
+ () => {
41810
+ resolve();
41811
+ },
41812
+ reject
41813
+ );
41814
+ } catch (error) {
41815
+ reject(error);
41816
+ }
41817
+ }),
41818
+ true,
41819
+ `destroy:${this.context.appId}`
41820
+ );
41705
41821
  this.resolveDestroyedSignal();
41706
41822
  }
41707
41823
  return (_a = this.destroyPromise) != null ? _a : Promise.resolve();
@@ -43759,25 +43875,24 @@ class SlideDocsViewer {
43759
43875
  if ((_b = this.slideController) == null ? void 0 : _b.onRenderError) {
43760
43876
  this.slideController.onRenderError(error, index);
43761
43877
  }
43762
- logger.warn("[Slide] render error", error);
43878
+ logger.error("[Slide] render error", this.appId, error);
43763
43879
  };
43764
43880
  this.onRenderStart = () => {
43765
- logger.log("[Slide][notes] hide", this.appId, "scene", this.whiteboardView.focusScenePath);
43766
43881
  this.$whiteboardView.classList.add(this.wrapClassName("wb-view-hidden"));
43882
+ logger.log("[Slide][notes] hide", this.appId, "scene", this.whiteboardView.focusScenePath);
43767
43883
  this.viewer.setPlaying();
43768
43884
  };
43769
43885
  this.onRenderEnd = () => {
43770
43886
  };
43771
43887
  this.onPageChanged = () => {
43772
43888
  clearTimeout(this._onPageChangedTimer);
43773
- logger.log("[Slide][notes] show scheduled", this.appId, "scene", this.whiteboardView.focusScenePath);
43774
43889
  this._onPageChangedTimer = setTimeout(this._onPageChanged, 200);
43775
43890
  };
43776
43891
  this._onPageChangedTimer = 0;
43777
43892
  this._onPageChanged = () => {
43778
- logger.log("[Slide][notes] show", this.appId, "scene", this.whiteboardView.focusScenePath);
43779
43893
  this.$overlay.style.opacity = "";
43780
43894
  this.$whiteboardView.classList.remove(this.wrapClassName("wb-view-hidden"));
43895
+ logger.log("[Slide][notes] show", this.appId, "scene", this.whiteboardView.focusScenePath);
43781
43896
  };
43782
43897
  this.refreshPages = () => {
43783
43898
  if (this.slideController) {
@@ -44148,13 +44263,19 @@ class SlideDocsViewer {
44148
44263
  this.offBoxSizeChange = void 0;
44149
44264
  (_b = this.contentResizeObserver) == null ? void 0 : _b.disconnect();
44150
44265
  this.contentResizeObserver = void 0;
44151
- if (this.slideController) {
44152
- const controller = this.slideController;
44153
- this.slideController = null;
44154
- await controller.destroy();
44266
+ try {
44267
+ if (this.slideController) {
44268
+ const controller = this.slideController;
44269
+ this.slideController = null;
44270
+ await controller.destroy();
44271
+ }
44272
+ } finally {
44273
+ try {
44274
+ this.viewer.unmount();
44275
+ } finally {
44276
+ this.resizableContainer.destroy(this.box);
44277
+ }
44155
44278
  }
44156
- this.viewer.unmount();
44157
- this.resizableContainer.destroy(this.box);
44158
44279
  return this;
44159
44280
  });
44160
44281
  }
@@ -44167,8 +44288,11 @@ class SlideDocsViewer {
44167
44288
  if (!this.destroyPromise) {
44168
44289
  this.destroyPromise = Promise.resolve().then(async () => {
44169
44290
  this.sideEffect.flushAll();
44170
- await this.unmount();
44171
- this.viewer.destroy();
44291
+ try {
44292
+ await this.unmount();
44293
+ } finally {
44294
+ this.viewer.destroy();
44295
+ }
44172
44296
  });
44173
44297
  }
44174
44298
  return this.destroyPromise;
@@ -44219,54 +44343,114 @@ function setFreezerLength(length) {
44219
44343
  const inspect = (arr) => {
44220
44344
  return "[" + arr + "]";
44221
44345
  };
44346
+ const FreezerRetryDelay = 500;
44222
44347
  const apps = {
44223
44348
  map: /* @__PURE__ */ new Map(),
44224
44349
  boxes: /* @__PURE__ */ new Map(),
44225
44350
  queue: [],
44226
- validateQueue() {
44351
+ focusedAppId: void 0,
44352
+ runTransition(appId, slide, action, retried = false) {
44353
+ try {
44354
+ const result = action === "freeze" ? slide.freeze() : slide.unfreeze();
44355
+ void Promise.resolve(result).catch(
44356
+ (error) => this.onTransitionFailure(appId, slide, action, error, retried)
44357
+ );
44358
+ } catch (error) {
44359
+ void Promise.resolve().then(
44360
+ () => this.onTransitionFailure(appId, slide, action, error, retried)
44361
+ );
44362
+ }
44363
+ },
44364
+ onTransitionFailure(appId, slide, action, error, retried) {
44365
+ logger.warn(`[Slide] freezer: ${action} failed`, appId, error);
44366
+ if (this.map.get(appId) !== slide)
44367
+ return;
44368
+ if (action === "freeze" && !this.queue.includes(appId))
44369
+ this.queue.push(appId);
44370
+ if (retried)
44371
+ return;
44372
+ if (action === "freeze" ? this.focusedAppId === appId : this.focusedAppId !== appId)
44373
+ return;
44374
+ setTimeout(() => {
44375
+ if (this.map.get(appId) !== slide)
44376
+ return;
44377
+ if (action === "freeze") {
44378
+ if (this.focusedAppId !== appId && this.queue.length > FreezerLength) {
44379
+ this.validateQueue(true);
44380
+ }
44381
+ } else if (this.focusedAppId === appId) {
44382
+ this.runTransition(appId, slide, action, true);
44383
+ }
44384
+ }, FreezerRetryDelay);
44385
+ },
44386
+ validateQueue(retried = false) {
44227
44387
  this.queue.sort((a, b) => {
44228
44388
  var _a, _b, _c, _d;
44229
44389
  const za = (_b = (_a = this.boxes.get(a)) == null ? void 0 : _a.zIndex) != null ? _b : 0;
44230
44390
  const zb = (_d = (_c = this.boxes.get(b)) == null ? void 0 : _c.zIndex) != null ? _d : 0;
44231
44391
  return -(za - zb);
44232
44392
  });
44233
- log("[Slide] freezer: validate", inspect(this.queue));
44393
+ const validated = [...this.queue];
44394
+ const frozen = [];
44395
+ const missing = [];
44234
44396
  while (this.queue.length > FreezerLength) {
44235
44397
  const appId = this.queue.pop();
44236
44398
  const slide = this.map.get(appId);
44237
44399
  if (slide) {
44238
- log("[Slide] freezer: validate-freeze", appId, inspect(this.queue));
44239
- slide.freeze();
44400
+ this.runTransition(appId, slide, "freeze", retried);
44401
+ frozen.push(appId);
44402
+ } else {
44403
+ missing.push(appId);
44240
44404
  }
44241
44405
  }
44406
+ return { validated, frozen, missing };
44242
44407
  },
44243
44408
  set(appId, slide, box) {
44244
- log("[Slide] freezer: add", appId, inspect(this.queue));
44245
44409
  this.map.set(appId, slide);
44246
44410
  this.boxes.set(appId, box);
44247
44411
  if (!this.queue.includes(appId)) {
44248
44412
  this.queue.unshift(appId);
44249
44413
  }
44250
- this.validateQueue();
44414
+ const { validated, frozen, missing } = this.validateQueue();
44415
+ log(
44416
+ "[Slide] freezer: add",
44417
+ appId,
44418
+ inspect(this.queue),
44419
+ "validate",
44420
+ inspect(validated),
44421
+ ...frozen.length ? ["freeze-requested", inspect(frozen)] : [],
44422
+ ...missing.length ? ["missing", inspect(missing)] : []
44423
+ );
44251
44424
  },
44252
44425
  delete(appId) {
44253
44426
  this.map.delete(appId);
44254
44427
  this.boxes.delete(appId);
44255
44428
  this.queue = this.queue.filter((id) => id !== appId);
44429
+ if (this.focusedAppId === appId)
44430
+ this.focusedAppId = void 0;
44256
44431
  log("[Slide] freezer: delete", appId, inspect(this.queue));
44257
44432
  },
44258
44433
  focus(appId) {
44434
+ this.focusedAppId = appId;
44259
44435
  const slide = this.map.get(appId);
44260
44436
  const index = this.queue.indexOf(appId);
44261
44437
  if (index > -1) {
44262
44438
  this.queue.splice(index, 1);
44263
44439
  }
44264
44440
  this.queue.unshift(appId);
44265
- this.validateQueue();
44266
- log("[Slide] freezer: focus", appId, inspect(this.queue));
44441
+ const { validated, frozen, missing } = this.validateQueue();
44267
44442
  if (slide) {
44268
- slide.unfreeze();
44269
- }
44443
+ this.runTransition(appId, slide, "unfreeze");
44444
+ }
44445
+ log(
44446
+ slide ? "[Slide] freezer: focus" : "[Slide] freezer: focus-missing",
44447
+ appId,
44448
+ inspect(this.queue),
44449
+ "validate",
44450
+ inspect(validated),
44451
+ ...frozen.length ? ["freeze-requested", inspect(frozen)] : [],
44452
+ ...missing.length ? ["missing", inspect(missing)] : []
44453
+ );
44270
44454
  }
44271
44455
  };
44272
44456
  const on_created_callbacks = /* @__PURE__ */ new Set();
@@ -44461,12 +44645,13 @@ class SlidePreviewer {
44461
44645
  }
44462
44646
  }
44463
44647
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
44464
- const version = "0.2.106-beta.4";
44648
+ const version = "0.2.106";
44465
44649
  const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
44466
44650
  const SlideApp = {
44467
44651
  kind: "Slide",
44468
44652
  setup(context) {
44469
44653
  var _a, _b, _c, _d, _e, _f, _g;
44654
+ setRoomLogger(context);
44470
44655
  console.log("[Slide] setup @ " + version);
44471
44656
  if (context.getIsWritable()) {
44472
44657
  context.storage.ensureState(EmptyAttributes);
@@ -44630,10 +44815,14 @@ const SlideApp = {
44630
44815
  return teardownPromise;
44631
44816
  };
44632
44817
  offDestroy = context.emitter.on("destroy", teardown);
44633
- const mounting = enqueueSlideWebGLTransition(() => {
44634
- if (!disposed)
44635
- docsViewer == null ? void 0 : docsViewer.mount();
44636
- }, false, `setup:${context.appId}`);
44818
+ const mounting = enqueueSlideWebGLTransition(
44819
+ () => {
44820
+ if (!disposed)
44821
+ docsViewer == null ? void 0 : docsViewer.mount();
44822
+ },
44823
+ false,
44824
+ `setup:${context.appId}`
44825
+ );
44637
44826
  const waitForFirstRender = (timeoutMs) => new Promise((resolve) => {
44638
44827
  let settled = false;
44639
44828
  let timedOut = false;