@teachinglab/omd 0.7.35 → 0.7.37

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.
@@ -3814,12 +3814,12 @@ typeof BigInt > "u" && (BigInt = function(n) {
3814
3814
  if (isNaN(n)) throw new Error("");
3815
3815
  return n;
3816
3816
  });
3817
- const Pe = BigInt(0), ot = BigInt(1), ar = BigInt(2), La = BigInt(3), Rs = BigInt(5), Hr = BigInt(10);
3817
+ const Pe = BigInt(0), ut = BigInt(1), ar = BigInt(2), La = BigInt(3), Rs = BigInt(5), Hr = BigInt(10);
3818
3818
  BigInt(Number.MAX_SAFE_INTEGER);
3819
3819
  const NT = 2e3, Ee = {
3820
- s: ot,
3820
+ s: ut,
3821
3821
  n: Pe,
3822
- d: ot
3822
+ d: ut
3823
3823
  };
3824
3824
  function Yi(n, e) {
3825
3825
  try {
@@ -3836,17 +3836,17 @@ function zt(n, e) {
3836
3836
  if (e === Pe)
3837
3837
  throw lv();
3838
3838
  const t = Object.create(oi.prototype);
3839
- t.s = n < Pe ? -ot : ot, n = n < Pe ? -n : n;
3839
+ t.s = n < Pe ? -ut : ut, n = n < Pe ? -n : n;
3840
3840
  const r = Kn(n, e);
3841
3841
  return t.n = n / r, t.d = e / r, t;
3842
3842
  }
3843
3843
  const CT = [ar * ar, ar, ar * ar, ar, ar * ar, ar * La, ar, ar * La];
3844
3844
  function _s(n) {
3845
3845
  const e = /* @__PURE__ */ Object.create(null);
3846
- if (n <= ot)
3847
- return e[n] = ot, e;
3846
+ if (n <= ut)
3847
+ return e[n] = ut, e;
3848
3848
  const t = (r) => {
3849
- e[r] = (e[r] || Pe) + ot;
3849
+ e[r] = (e[r] || Pe) + ut;
3850
3850
  };
3851
3851
  for (; n % ar === Pe; )
3852
3852
  t(ar), n /= ar;
@@ -3859,10 +3859,10 @@ function _s(n) {
3859
3859
  t(i), n /= i;
3860
3860
  i += CT[r], r = r + 1 & 7;
3861
3861
  }
3862
- return n > ot && t(n), e;
3862
+ return n > ut && t(n), e;
3863
3863
  }
3864
3864
  const nr = function(n, e) {
3865
- let t = Pe, r = ot, i = ot;
3865
+ let t = Pe, r = ut, i = ut;
3866
3866
  if (n != null) if (e !== void 0) {
3867
3867
  if (typeof n == "bigint")
3868
3868
  t = n;
@@ -3896,7 +3896,7 @@ const nr = function(n, e) {
3896
3896
  } else if (typeof n == "number") {
3897
3897
  if (isNaN(n))
3898
3898
  throw dn();
3899
- if (n < 0 && (i = -ot, n = -n), n % 1 === 0)
3899
+ if (n < 0 && (i = -ut, n = -n), n % 1 === 0)
3900
3900
  t = BigInt(n);
3901
3901
  else {
3902
3902
  let s = 1, a = 0, o = 1, l = 1, u = 1, c = 1e7;
@@ -3911,26 +3911,26 @@ const nr = function(n, e) {
3911
3911
  t = BigInt(t) * BigInt(s), r = BigInt(r);
3912
3912
  }
3913
3913
  } else if (typeof n == "string") {
3914
- let s = 0, a = Pe, o = Pe, l = Pe, u = ot, c = ot, h = n.replace(/_/g, "").match(/\d+|./g);
3914
+ let s = 0, a = Pe, o = Pe, l = Pe, u = ut, c = ut, h = n.replace(/_/g, "").match(/\d+|./g);
3915
3915
  if (h === null)
3916
3916
  throw dn();
3917
- if (h[s] === "-" ? (i = -ot, s++) : h[s] === "+" && s++, h.length === s + 1 ? o = Yi(h[s++], i) : h[s + 1] === "." || h[s] === "." ? (h[s] !== "." && (a = Yi(h[s++], i)), s++, (s + 1 === h.length || h[s + 1] === "(" && h[s + 3] === ")" || h[s + 1] === "'" && h[s + 3] === "'") && (o = Yi(h[s], i), u = Hr ** BigInt(h[s].length), s++), (h[s] === "(" && h[s + 2] === ")" || h[s] === "'" && h[s + 2] === "'") && (l = Yi(h[s + 1], i), c = Hr ** BigInt(h[s + 1].length) - ot, s += 3)) : h[s + 1] === "/" || h[s + 1] === ":" ? (o = Yi(h[s], i), u = Yi(h[s + 2], ot), s += 3) : h[s + 3] === "/" && h[s + 1] === " " && (a = Yi(h[s], i), o = Yi(h[s + 2], i), u = Yi(h[s + 4], ot), s += 5), h.length <= s)
3917
+ if (h[s] === "-" ? (i = -ut, s++) : h[s] === "+" && s++, h.length === s + 1 ? o = Yi(h[s++], i) : h[s + 1] === "." || h[s] === "." ? (h[s] !== "." && (a = Yi(h[s++], i)), s++, (s + 1 === h.length || h[s + 1] === "(" && h[s + 3] === ")" || h[s + 1] === "'" && h[s + 3] === "'") && (o = Yi(h[s], i), u = Hr ** BigInt(h[s].length), s++), (h[s] === "(" && h[s + 2] === ")" || h[s] === "'" && h[s + 2] === "'") && (l = Yi(h[s + 1], i), c = Hr ** BigInt(h[s + 1].length) - ut, s += 3)) : h[s + 1] === "/" || h[s + 1] === ":" ? (o = Yi(h[s], i), u = Yi(h[s + 2], ut), s += 3) : h[s + 3] === "/" && h[s + 1] === " " && (a = Yi(h[s], i), o = Yi(h[s + 2], i), u = Yi(h[s + 4], ut), s += 5), h.length <= s)
3918
3918
  r = u * c, i = /* void */
3919
3919
  t = l + r * a + c * o;
3920
3920
  else
3921
3921
  throw dn();
3922
3922
  } else if (typeof n == "bigint")
3923
- t = n, i = n, r = ot;
3923
+ t = n, i = n, r = ut;
3924
3924
  else
3925
3925
  throw dn();
3926
3926
  if (r === Pe)
3927
3927
  throw lv();
3928
- Ee.s = i < Pe ? -ot : ot, Ee.n = t < Pe ? -t : t, Ee.d = r < Pe ? -r : r;
3928
+ Ee.s = i < Pe ? -ut : ut, Ee.n = t < Pe ? -t : t, Ee.d = r < Pe ? -r : r;
3929
3929
  };
3930
3930
  function DT(n, e, t) {
3931
- let r = ot;
3932
- for (; e > Pe; n = n * n % t, e >>= ot)
3933
- e & ot && (r = r * n % t);
3931
+ let r = ut;
3932
+ for (; e > Pe; n = n * n % t, e >>= ut)
3933
+ e & ut && (r = r * n % t);
3934
3934
  return r;
3935
3935
  }
3936
3936
  function AT(n, e) {
@@ -3938,16 +3938,16 @@ function AT(n, e) {
3938
3938
  ;
3939
3939
  for (; e % Rs === Pe; e /= Rs)
3940
3940
  ;
3941
- if (e === ot)
3941
+ if (e === ut)
3942
3942
  return Pe;
3943
3943
  let t = Hr % e, r = 1;
3944
- for (; t !== ot; r++)
3944
+ for (; t !== ut; r++)
3945
3945
  if (t = t * Hr % e, r > NT)
3946
3946
  return Pe;
3947
3947
  return BigInt(r);
3948
3948
  }
3949
3949
  function ET(n, e, t) {
3950
- let r = ot, i = DT(Hr, t, e);
3950
+ let r = ut, i = DT(Hr, t, e);
3951
3951
  for (let s = 0; s < 300; s++) {
3952
3952
  if (r === i)
3953
3953
  return BigInt(s);
@@ -3981,9 +3981,9 @@ const lv = function() {
3981
3981
  return new Error("Parameters must be integer");
3982
3982
  };
3983
3983
  oi.prototype = {
3984
- s: ot,
3984
+ s: ut,
3985
3985
  n: Pe,
3986
- d: ot,
3986
+ d: ut,
3987
3987
  /**
3988
3988
  * Calculates the absolute value
3989
3989
  *
@@ -4060,7 +4060,7 @@ oi.prototype = {
4060
4060
  **/
4061
4061
  mod: function(n, e) {
4062
4062
  if (n === void 0)
4063
- return zt(this.s * this.n % this.d, ot);
4063
+ return zt(this.s * this.n % this.d, ut);
4064
4064
  if (nr(n, e), Pe === Ee.n * this.d)
4065
4065
  throw lv();
4066
4066
  return zt(
@@ -4082,7 +4082,7 @@ oi.prototype = {
4082
4082
  * Ex: new Fraction(5,8).lcm(3,7) => 15
4083
4083
  */
4084
4084
  lcm: function(n, e) {
4085
- return nr(n, e), Ee.n === Pe && this.n === Pe ? zt(Pe, ot) : zt(Ee.n * this.n, Kn(Ee.n, this.n) * Kn(Ee.d, this.d));
4085
+ return nr(n, e), Ee.n === Pe && this.n === Pe ? zt(Pe, ut) : zt(Ee.n * this.n, Kn(Ee.n, this.n) * Kn(Ee.d, this.d));
4086
4086
  },
4087
4087
  /**
4088
4088
  * Gets the inverse of the fraction, means numerator and denominator are exchanged
@@ -4098,10 +4098,10 @@ oi.prototype = {
4098
4098
  * Ex: new Fraction(-1,2).pow(-3) => -8
4099
4099
  */
4100
4100
  pow: function(n, e) {
4101
- if (nr(n, e), Ee.d === ot)
4101
+ if (nr(n, e), Ee.d === ut)
4102
4102
  return Ee.s < Pe ? zt((this.s * this.d) ** Ee.n, this.n ** Ee.n) : zt((this.s * this.n) ** Ee.n, this.d ** Ee.n);
4103
4103
  if (this.s < Pe) return null;
4104
- let t = _s(this.n), r = _s(this.d), i = ot, s = ot;
4104
+ let t = _s(this.n), r = _s(this.d), i = ut, s = ut;
4105
4105
  for (let a in t)
4106
4106
  if (a !== "1") {
4107
4107
  if (a === "0") {
@@ -4215,7 +4215,7 @@ oi.prototype = {
4215
4215
  **/
4216
4216
  ceil: function(n) {
4217
4217
  return n = Hr ** BigInt(n || 0), zt(
4218
- wi(this.s * n * this.n / this.d) + (n * this.n % this.d > Pe && this.s >= Pe ? ot : Pe),
4218
+ wi(this.s * n * this.n / this.d) + (n * this.n % this.d > Pe && this.s >= Pe ? ut : Pe),
4219
4219
  n
4220
4220
  );
4221
4221
  },
@@ -4226,7 +4226,7 @@ oi.prototype = {
4226
4226
  **/
4227
4227
  floor: function(n) {
4228
4228
  return n = Hr ** BigInt(n || 0), zt(
4229
- wi(this.s * n * this.n / this.d) - (n * this.n % this.d > Pe && this.s < Pe ? ot : Pe),
4229
+ wi(this.s * n * this.n / this.d) - (n * this.n % this.d > Pe && this.s < Pe ? ut : Pe),
4230
4230
  n
4231
4231
  );
4232
4232
  },
@@ -4237,7 +4237,7 @@ oi.prototype = {
4237
4237
  **/
4238
4238
  round: function(n) {
4239
4239
  return n = Hr ** BigInt(n || 0), zt(
4240
- wi(this.s * n * this.n / this.d) + this.s * ((this.s >= Pe ? ot : Pe) + ar * (n * this.n % this.d) > this.d ? ot : Pe),
4240
+ wi(this.s * n * this.n / this.d) + this.s * ((this.s >= Pe ? ut : Pe) + ar * (n * this.n % this.d) > this.d ? ut : Pe),
4241
4241
  n
4242
4242
  );
4243
4243
  },
@@ -4294,7 +4294,7 @@ oi.prototype = {
4294
4294
  **/
4295
4295
  toFraction: function(n = !1) {
4296
4296
  let e = this.n, t = this.d, r = this.s < Pe ? "-" : "";
4297
- if (t === ot)
4297
+ if (t === ut)
4298
4298
  r += e;
4299
4299
  else {
4300
4300
  const i = wi(e / t);
@@ -4309,7 +4309,7 @@ oi.prototype = {
4309
4309
  **/
4310
4310
  toLatex: function(n = !1) {
4311
4311
  let e = this.n, t = this.d, r = this.s < Pe ? "-" : "";
4312
- if (t === ot)
4312
+ if (t === ut)
4313
4313
  r += e;
4314
4314
  else {
4315
4315
  const i = wi(e / t);
@@ -4335,7 +4335,7 @@ oi.prototype = {
4335
4335
  simplify: function(n = 1e-3) {
4336
4336
  const e = BigInt(Math.ceil(1 / n)), t = this.abs(), r = t.toContinued();
4337
4337
  for (let i = 1; i < r.length; i++) {
4338
- let s = zt(r[i - 1], ot);
4338
+ let s = zt(r[i - 1], ut);
4339
4339
  for (let o = i - 2; o >= 0; o--)
4340
4340
  s = s.inverse().add(r[o]);
4341
4341
  let a = s.sub(t);
@@ -41156,7 +41156,7 @@ class Hu extends Bt {
41156
41156
  }
41157
41157
  }
41158
41158
  }
41159
- class ut extends Bt {
41159
+ class ot extends Bt {
41160
41160
  constructor(e) {
41161
41161
  if (super(e), this.type = "omdEquationNode", (e.type || e.mathjs) === "AssignmentNode") {
41162
41162
  const r = Tt(e.object);
@@ -41307,7 +41307,7 @@ class ut extends Bt {
41307
41307
  object: h.toMathJSNode(),
41308
41308
  index: null,
41309
41309
  value: f.toMathJSNode()
41310
- }, p = new ut(d);
41310
+ }, p = new ot(d);
41311
41311
  return p.setFontSize(this.getFontSize()), p.provenance.push(this.id), p.left && this.left && this._establishGranularProvenance(p.left, this.left, e, r), p.right && this.right && this._establishGranularProvenance(p.right, this.right, e, r), p.initialize(), p;
41312
41312
  }
41313
41313
  /**
@@ -41452,10 +41452,10 @@ class ut extends Bt {
41452
41452
  };
41453
41453
  }
41454
41454
  };
41455
- return new ut(s);
41455
+ return new ot(s);
41456
41456
  }
41457
41457
  clone() {
41458
- const e = JSON.parse(JSON.stringify(this.astNodeData)), t = new ut(e);
41458
+ const e = JSON.parse(JSON.stringify(this.astNodeData)), t = new ot(e);
41459
41459
  return t._syncProvenanceFrom(this), t.setFontSize(this.getFontSize()), t.argumentNodeList = { left: t.left, right: t.right }, t;
41460
41460
  }
41461
41461
  /**
@@ -41536,7 +41536,7 @@ class ut extends Bt {
41536
41536
  };
41537
41537
  }
41538
41538
  };
41539
- return new ut(r);
41539
+ return new ot(r);
41540
41540
  }
41541
41541
  /**
41542
41542
  * Apply an operation to one or both sides of the equation
@@ -41574,7 +41574,7 @@ class ut extends Bt {
41574
41574
  type: "AssignmentNode",
41575
41575
  object: u.toMathJSNode(),
41576
41576
  value: c.toMathJSNode()
41577
- }, f = new ut(h);
41577
+ }, f = new ot(h);
41578
41578
  return f.setFontSize(this.getFontSize()), f.provenance.push(this.id), f.initialize(), f;
41579
41579
  }
41580
41580
  /**
@@ -41972,9 +41972,9 @@ function i9(n, e) {
41972
41972
  var t, r;
41973
41973
  switch (n) {
41974
41974
  case "AssignmentNode":
41975
- return ut;
41975
+ return ot;
41976
41976
  case "OperatorNode":
41977
- return (e == null ? void 0 : e.op) === "-" && e.args.length === 1 && !e.implicit ? Zi : (e == null ? void 0 : e.op) === "=" ? ut : (e == null ? void 0 : e.op) === "^" ? qi : (e == null ? void 0 : e.op) === "/" ? Vr : Di;
41977
+ return (e == null ? void 0 : e.op) === "-" && e.args.length === 1 && !e.implicit ? Zi : (e == null ? void 0 : e.op) === "=" ? ot : (e == null ? void 0 : e.op) === "^" ? qi : (e == null ? void 0 : e.op) === "/" ? Vr : Di;
41978
41978
  case "ParenthesisNode":
41979
41979
  return ea;
41980
41980
  case "ConstantNode":
@@ -42255,7 +42255,7 @@ const vn = class vn extends Bt {
42255
42255
  */
42256
42256
  _markInitialSteps() {
42257
42257
  !this.steps || !Array.isArray(this.steps) || this.steps.forEach((e, t) => {
42258
- e instanceof ut && (e.stepMark = 0);
42258
+ e instanceof ot && (e.stepMark = 0);
42259
42259
  });
42260
42260
  }
42261
42261
  /**
@@ -42272,7 +42272,7 @@ const vn = class vn extends Bt {
42272
42272
  getCurrentEquation() {
42273
42273
  if (!this.steps || this.steps.length === 0) return null;
42274
42274
  for (let e = this.steps.length - 1; e >= 0; e--)
42275
- if (this.steps[e] instanceof ut)
42275
+ if (this.steps[e] instanceof ot)
42276
42276
  return this.steps[e];
42277
42277
  return null;
42278
42278
  }
@@ -42291,7 +42291,7 @@ const vn = class vn extends Bt {
42291
42291
  let i = {};
42292
42292
  typeof t == "string" ? i = { description: t, stepMark: r ?? 2 } : t && (i = t);
42293
42293
  const s = typeof e == "string" ? this._stringToNode(e) : e, a = this.steps.length;
42294
- return i.description !== void 0 && (this.stepDescriptions[a] = i.description), i.stepMark !== void 0 ? this.importanceLevels[a] = i.stepMark : this.importanceLevels[a] = 0, this.defaultEquationBackground && typeof (s == null ? void 0 : s.setBackgroundStyle) == "function" && s.setBackgroundStyle(this.defaultEquationBackground), s.setFontSize(this.getFontSize()), s.initialize(), this.steps.push(s), this.addChild(s), this.argumentNodeList.steps = this.steps, this.rebuildNodeMap(), s instanceof ut ? s.stepMark = i.stepMark ?? this._determineStepMark(s, i) : i.stepMark !== void 0 ? s.stepMark = i.stepMark : s.stepMark = 0, this.computeDimensions(), this.updateLayout(), window.refreshDisplayAndFilters && window.refreshDisplayAndFilters(), this._reapplyCurrentFilter(), a;
42294
+ return i.description !== void 0 && (this.stepDescriptions[a] = i.description), i.stepMark !== void 0 ? this.importanceLevels[a] = i.stepMark : this.importanceLevels[a] = 0, this.defaultEquationBackground && typeof (s == null ? void 0 : s.setBackgroundStyle) == "function" && s.setBackgroundStyle(this.defaultEquationBackground), s.setFontSize(this.getFontSize()), s.initialize(), this.steps.push(s), this.addChild(s), this.argumentNodeList.steps = this.steps, this.rebuildNodeMap(), s instanceof ot ? s.stepMark = i.stepMark ?? this._determineStepMark(s, i) : i.stepMark !== void 0 ? s.stepMark = i.stepMark : s.stepMark = 0, this.computeDimensions(), this.updateLayout(), window.refreshDisplayAndFilters && window.refreshDisplayAndFilters(), this._reapplyCurrentFilter(), a;
42295
42295
  }
42296
42296
  /**
42297
42297
  * Sets a default background style to be applied to all equation steps added thereafter.
@@ -42320,7 +42320,7 @@ const vn = class vn extends Bt {
42320
42320
  * @private
42321
42321
  */
42322
42322
  _isFullySimplified(e) {
42323
- if (!(e instanceof ut)) return !1;
42323
+ if (!(e instanceof ot)) return !1;
42324
42324
  const t = this._isSimpleExpression(e.left), r = this._isSimpleExpression(e.right);
42325
42325
  return t && r;
42326
42326
  }
@@ -42651,7 +42651,7 @@ const vn = class vn extends Bt {
42651
42651
  _calculateAlignmentPoint(e) {
42652
42652
  const t = [];
42653
42653
  return e.forEach((r) => {
42654
- if (r instanceof ut) {
42654
+ if (r instanceof ot) {
42655
42655
  if (typeof r.getEqualsAnchorX == "function")
42656
42656
  t.push(r.getEqualsAnchorX());
42657
42657
  else if (r.equalsSign && r.left) {
@@ -42667,7 +42667,7 @@ const vn = class vn extends Bt {
42667
42667
  const i = 15 * this.getFontSize() / this.getRootFontSize();
42668
42668
  return e.forEach((s, a) => {
42669
42669
  let o = 0;
42670
- s instanceof ut ? o = this.alignPointX + s.equalsSign.width + s.right.width : o = s.width, t = Math.max(t, o), r += s.height, a < e.length - 1 && (r += i);
42670
+ s instanceof ot ? o = this.alignPointX + s.equalsSign.width + s.right.width : o = s.width, t = Math.max(t, o), r += s.height, a < e.length - 1 && (r += i);
42671
42671
  }), { maxWidth: t, totalHeight: r };
42672
42672
  }
42673
42673
  /**
@@ -42681,7 +42681,7 @@ const vn = class vn extends Bt {
42681
42681
  _computeStepXOffset(e) {
42682
42682
  if (this.alignmentMode === "center")
42683
42683
  return (this.width - e.width) / 2;
42684
- if (e instanceof ut) {
42684
+ if (e instanceof ot) {
42685
42685
  const t = typeof e.getEqualsAnchorX == "function" ? e.getEqualsAnchorX() : e.left.width;
42686
42686
  return this.alignPointX - t;
42687
42687
  }
@@ -42715,7 +42715,7 @@ const vn = class vn extends Bt {
42715
42715
  const t = e.map((r) => {
42716
42716
  const i = r.trim();
42717
42717
  if (i.includes("="))
42718
- return ut.fromString(i);
42718
+ return ot.fromString(i);
42719
42719
  throw new Error(`Step string "${i}" is not a valid equation for omdEquationSequenceNode.`);
42720
42720
  });
42721
42721
  return new vn(t);
@@ -42737,17 +42737,16 @@ const vn = class vn extends Bt {
42737
42737
  * @returns {omdNode} The current step
42738
42738
  */
42739
42739
  getCurrentStep() {
42740
- var t;
42741
42740
  if (!this.steps || this.steps.length === 0) return null;
42742
42741
  let e = -1;
42743
- for (let r = this.steps.length - 1; r >= 0; r--) {
42744
- const i = this.steps[r];
42745
- if (i && i.visible !== !1) {
42746
- if (((t = i.constructor) == null ? void 0 : t.name) === "omdEquationNode") {
42747
- e = r;
42742
+ for (let t = this.steps.length - 1; t >= 0; t--) {
42743
+ const r = this.steps[t];
42744
+ if (r && r.visible !== !1) {
42745
+ if (r instanceof ot || r.type === "omdEquationNode") {
42746
+ e = t;
42748
42747
  break;
42749
42748
  }
42750
- e === -1 && (e = r);
42749
+ e === -1 && (e = t);
42751
42750
  }
42752
42751
  }
42753
42752
  return e === -1 && (e = this.steps.length - 1), e < 0 && (e = 0), e >= this.steps.length && (e = this.steps.length - 1), this.currentStepIndex = e, this.steps[e];
@@ -42836,7 +42835,7 @@ const vn = class vn extends Bt {
42836
42835
  const s = r.trim();
42837
42836
  let a;
42838
42837
  if (s.includes("="))
42839
- a = ut.fromString(s);
42838
+ a = ot.fromString(s);
42840
42839
  else {
42841
42840
  if (!window.math)
42842
42841
  throw new Error("Math.js is required for parsing expressions");
@@ -42859,7 +42858,7 @@ const vn = class vn extends Bt {
42859
42858
  _stringToNode(e) {
42860
42859
  const t = e.trim();
42861
42860
  if (t.includes("="))
42862
- return ut.fromString(t);
42861
+ return ot.fromString(t);
42863
42862
  if (!window.math)
42864
42863
  throw new Error("Math.js is required for parsing expressions");
42865
42864
  const r = window.math.parse(t), i = Tt(r);
@@ -43505,7 +43504,7 @@ class s9 {
43505
43504
  _findNearestVisibleEquationAbove(e) {
43506
43505
  for (let t = e - 1; t >= 0; t--) {
43507
43506
  const r = this.stepVisualizer.steps[t];
43508
- if (r instanceof ut && r.visible !== !1)
43507
+ if (r instanceof ot && r.visible !== !1)
43509
43508
  return r;
43510
43509
  }
43511
43510
  return null;
@@ -43555,7 +43554,7 @@ class s9 {
43555
43554
  let s = null;
43556
43555
  for (let l = i - 1; l >= 0; l--) {
43557
43556
  const u = this.stepVisualizer.steps[l];
43558
- if (u instanceof ut && u.visible !== !1) {
43557
+ if (u instanceof ot && u.visible !== !1) {
43559
43558
  s = u;
43560
43559
  break;
43561
43560
  }
@@ -44044,7 +44043,7 @@ class o9 {
44044
44043
  const r = t.equationRef, i = this.stepVisualizer.steps.indexOf(r);
44045
44044
  for (let s = i - 1; s >= 0; s--) {
44046
44045
  const a = this.stepVisualizer.steps[s];
44047
- if (a instanceof ut && a.visible !== !1) {
44046
+ if (a instanceof ot && a.visible !== !1) {
44048
44047
  for (let o = e - 1; o >= 0; o--) {
44049
44048
  const l = this.stepVisualizer.stepDots[o];
44050
44049
  if (l && l.equationRef === a)
@@ -44115,7 +44114,7 @@ class u9 {
44115
44114
  let o = 0;
44116
44115
  const l = 15 * this.stepVisualizer.getFontSize() / this.stepVisualizer.getRootFontSize();
44117
44116
  a.forEach((f, d) => {
44118
- if (f instanceof ut) {
44117
+ if (f instanceof ot) {
44119
44118
  const p = this.findDotIndexForEquation(f);
44120
44119
  if (p >= 0 && p < this.stepVisualizer.stepDots.length) {
44121
44120
  const m = this.stepVisualizer.stepDots[p];
@@ -44169,7 +44168,7 @@ class u9 {
44169
44168
  const e = this.stepVisualizer.steps || [];
44170
44169
  let t = 0;
44171
44170
  return e.forEach((r) => {
44172
- if (r instanceof ut && r.visible !== !1 && typeof r.getEffectiveBackgroundPaddingX == "function") {
44171
+ if (r instanceof ot && r.visible !== !1 && typeof r.getEffectiveBackgroundPaddingX == "function") {
44173
44172
  const i = Number(r.getEffectiveBackgroundPaddingX());
44174
44173
  t = Math.max(t, isNaN(i) ? 0 : i);
44175
44174
  }
@@ -44256,20 +44255,20 @@ class u9 {
44256
44255
  _createExpansionDots() {
44257
44256
  const e = this.stepVisualizer, t = e.stepDots;
44258
44257
  e.stepDots.filter((i) => i.visible), e.steps.forEach((i, s) => {
44259
- i && (i instanceof ut || i.constructor.name);
44258
+ i && (i instanceof ot || i.type);
44260
44259
  }), t.forEach((i, s) => {
44261
44260
  i && i.equationRef;
44262
44261
  });
44263
44262
  const r = [];
44264
44263
  e.steps.forEach((i, s) => {
44265
- i && (i instanceof ut || i.constructor.name === "omdEquationNode") && i.stepMark === 0 && i.visible === !0 && r.push(s);
44264
+ i && (i instanceof ot || i.type === "omdEquationNode") && i.stepMark === 0 && i.visible === !0 && r.push(s);
44266
44265
  });
44267
44266
  for (let i = 1; i < r.length; i++) {
44268
44267
  const s = r[i - 1], a = r[i];
44269
44268
  let o = 0;
44270
44269
  for (let l = s + 1; l < a; l++) {
44271
44270
  const u = e.steps[l];
44272
- u && (u instanceof ut || u.constructor.name === "omdEquationNode") && u.stepMark > 0 && u.visible === !1 && o++;
44271
+ u && (u instanceof ot || u.type === "omdEquationNode") && u.stepMark > 0 && u.visible === !1 && o++;
44273
44272
  }
44274
44273
  if (o > 0) {
44275
44274
  const l = e.steps[a];
@@ -44295,7 +44294,7 @@ class u9 {
44295
44294
  const o = r.steps.indexOf(s), l = r.steps.indexOf(a);
44296
44295
  for (let h = o + 1; h < l; h++) {
44297
44296
  const f = r.steps[h];
44298
- f && (f instanceof ut || f.constructor.name === "omdEquationNode") && f.stepMark !== void 0 && f.stepMark > 0 && f.visible === !1 && i++;
44297
+ f && (f instanceof ot || f.type === "omdEquationNode") && f.stepMark !== void 0 && f.stepMark > 0 && f.visible === !1 && i++;
44299
44298
  }
44300
44299
  return i;
44301
44300
  }
@@ -44365,7 +44364,7 @@ class u9 {
44365
44364
  let h = -1;
44366
44365
  for (let f = c + 1; f < e.steps.length; f++) {
44367
44366
  const d = e.steps[f];
44368
- if (d && (d instanceof ut || d.constructor.name === "omdEquationNode") && d.stepMark === 0 && d.visible === !0) {
44367
+ if (d && (d instanceof ot || d.type === "omdEquationNode") && d.stepMark === 0 && d.visible === !0) {
44369
44368
  h = f;
44370
44369
  break;
44371
44370
  }
@@ -44398,7 +44397,7 @@ class u9 {
44398
44397
  s >= 0 && this.expansionDots.splice(s, 1);
44399
44398
  for (let a = i + 1; a < r; a++) {
44400
44399
  const o = t.steps[a];
44401
- if (o && (o instanceof ut || o.constructor.name === "omdEquationNode") && o.stepMark > 0) {
44400
+ if (o && (o instanceof ot || o.type === "omdEquationNode") && o.stepMark > 0) {
44402
44401
  this._showStep(o);
44403
44402
  const l = t.stepDots.findIndex((u) => u.equationRef === o);
44404
44403
  if (l >= 0) {
@@ -44637,7 +44636,7 @@ class Vu extends Uu {
44637
44636
  * @private
44638
44637
  */
44639
44638
  _initializeVisualElements() {
44640
- this._clearVisualElements(), this.nodeToStepMap.clear(), this.steps.filter((t) => t instanceof ut).forEach((t, r) => {
44639
+ this._clearVisualElements(), this.nodeToStepMap.clear(), this.steps.filter((t) => t instanceof ot).forEach((t, r) => {
44641
44640
  this._createStepDot(t, r), t.findAllNodes().forEach((i) => {
44642
44641
  this.nodeToStepMap.set(i.id, r);
44643
44642
  }), r > 0 && this._createStepLine(r - 1, r);
@@ -44675,8 +44674,8 @@ class Vu extends Uu {
44675
44674
  * Override addStep to update visual elements when new steps are added
44676
44675
  */
44677
44676
  addStep(e, t = {}) {
44678
- if (this.highlighting && typeof this.highlighting.clearAllExplainHighlights == "function" && this.highlighting.clearAllExplainHighlights(), super.addStep(e, t), e instanceof ut) {
44679
- const r = this.steps.filter((i) => i instanceof ut).indexOf(e);
44677
+ if (this.highlighting && typeof this.highlighting.clearAllExplainHighlights == "function" && this.highlighting.clearAllExplainHighlights(), super.addStep(e, t), e instanceof ot) {
44678
+ const r = this.steps.filter((i) => i instanceof ot).indexOf(e);
44680
44679
  if (r >= 0) {
44681
44680
  const i = this._createStepDot(e, r);
44682
44681
  if (e.findAllNodes().forEach((s) => {
@@ -44872,7 +44871,7 @@ class Vu extends Uu {
44872
44871
  */
44873
44872
  _findPreviousVisibleEquationIndex(e) {
44874
44873
  for (let t = e - 1; t >= 0; t--)
44875
- if (this.steps[t] instanceof ut && this.steps[t].visible !== !1)
44874
+ if (this.steps[t] instanceof ot && this.steps[t].visible !== !1)
44876
44875
  return t;
44877
44876
  return -1;
44878
44877
  }
@@ -45528,30 +45527,29 @@ class c9 extends Oe {
45528
45527
  * @returns {boolean} Whether an operation was undone
45529
45528
  */
45530
45529
  undoLastOperation() {
45531
- var i, s;
45532
45530
  const e = this.sequence;
45533
45531
  if (!e || !Array.isArray(e.steps) || e.steps.length === 0) return !1;
45534
45532
  let t = -1;
45535
- for (let a = e.steps.length - 1; a >= 0; a--) {
45536
- const o = e.steps[a], l = (i = o == null ? void 0 : o.constructor) == null ? void 0 : i.name;
45537
- if (o instanceof ut || l === "omdEquationNode") {
45538
- t = a;
45533
+ for (let i = e.steps.length - 1; i >= 0; i--) {
45534
+ const s = e.steps[i];
45535
+ if (s instanceof ot || (s == null ? void 0 : s.type) === "omdEquationNode") {
45536
+ t = i;
45539
45537
  break;
45540
45538
  }
45541
45539
  }
45542
45540
  if (t === -1) return !1;
45543
45541
  let r = t;
45544
- for (let a = t; a >= 0; a--) {
45545
- const o = e.steps[a], l = (s = o == null ? void 0 : o.constructor) == null ? void 0 : s.name;
45546
- if (o instanceof ta || l === "omdOperationDisplayNode") {
45547
- r = a;
45542
+ for (let i = t; i >= 0; i--) {
45543
+ const s = e.steps[i];
45544
+ if (s instanceof ta || (s == null ? void 0 : s.type) === "omdOperationDisplayNode") {
45545
+ r = i;
45548
45546
  break;
45549
45547
  }
45550
45548
  }
45551
- for (let a = e.steps.length - 1; a >= r; a--) {
45552
- const o = e.steps[a];
45549
+ for (let i = e.steps.length - 1; i >= r; i--) {
45550
+ const s = e.steps[i];
45553
45551
  try {
45554
- e.removeChild(o);
45552
+ e.removeChild(s);
45555
45553
  } catch {
45556
45554
  }
45557
45555
  }
@@ -45566,47 +45564,44 @@ class c9 extends Oe {
45566
45564
  } catch {
45567
45565
  }
45568
45566
  try {
45569
- const a = (l) => {
45570
- var u;
45571
- return l instanceof ut || ((u = l == null ? void 0 : l.constructor) == null ? void 0 : u.name) === "omdEquationNode";
45572
- }, o = Array.isArray(e.steps) ? e.steps.filter(a).length : 0;
45567
+ const i = (a) => a instanceof ot || (a == null ? void 0 : a.type) === "omdEquationNode", s = Array.isArray(e.steps) ? e.steps.filter(i).length : 0;
45573
45568
  if (Array.isArray(e.stepDots) && e.visualContainer) {
45574
- const l = new Set(e.steps.filter(a)), u = [];
45575
- for (const c of e.stepDots)
45576
- if (!c || !c.equationRef || !l.has(c.equationRef))
45569
+ const a = new Set(e.steps.filter(i)), o = [];
45570
+ for (const l of e.stepDots)
45571
+ if (!l || !l.equationRef || !a.has(l.equationRef))
45577
45572
  try {
45578
- e.visualContainer.removeChild(c);
45573
+ e.visualContainer.removeChild(l);
45579
45574
  } catch {
45580
45575
  }
45581
45576
  else
45582
- u.push(c);
45583
- e.stepDots = u;
45577
+ o.push(l);
45578
+ e.stepDots = o;
45584
45579
  }
45585
45580
  if (e.visualContainer && Array.isArray(e.visualContainer.childList)) {
45586
- const l = /* @__PURE__ */ new Set([...e.stepDots || [], ...e.stepLines || []]), u = [];
45587
- e.visualContainer.childList.forEach((c) => {
45588
- l.has(c) || u.push(c);
45589
- }), u.forEach((c) => {
45581
+ const a = /* @__PURE__ */ new Set([...e.stepDots || [], ...e.stepLines || []]), o = [];
45582
+ e.visualContainer.childList.forEach((l) => {
45583
+ a.has(l) || o.push(l);
45584
+ }), o.forEach((l) => {
45590
45585
  try {
45591
- e.visualContainer.removeChild(c);
45586
+ e.visualContainer.removeChild(l);
45592
45587
  } catch {
45593
45588
  }
45594
45589
  });
45595
45590
  }
45596
45591
  if (Array.isArray(e.stepDots) && e.visualContainer)
45597
- for (; e.stepDots.length > o; ) {
45598
- const l = e.stepDots.pop();
45592
+ for (; e.stepDots.length > s; ) {
45593
+ const a = e.stepDots.pop();
45599
45594
  try {
45600
- e.visualContainer.removeChild(l);
45595
+ e.visualContainer.removeChild(a);
45601
45596
  } catch {
45602
45597
  }
45603
45598
  }
45604
45599
  if (Array.isArray(e.stepLines) && e.visualContainer) {
45605
- const l = Math.max(0, o - 1);
45606
- for (; e.stepLines.length > l; ) {
45607
- const u = e.stepLines.pop();
45600
+ const a = Math.max(0, s - 1);
45601
+ for (; e.stepLines.length > a; ) {
45602
+ const o = e.stepLines.pop();
45608
45603
  try {
45609
- e.visualContainer.removeChild(u);
45604
+ e.visualContainer.removeChild(o);
45610
45605
  } catch {
45611
45606
  }
45612
45607
  }
@@ -45864,7 +45859,6 @@ class j9 {
45864
45859
  })), this.svg.svgObject.appendChild(t);
45865
45860
  }
45866
45861
  centerNode() {
45867
- var m;
45868
45862
  if (!this.node) return;
45869
45863
  if (this._centerCallCount || (this._centerCallCount = 0), this._centerCallCount++, this._centerCallCount > 500) {
45870
45864
  console.warn("omdDisplay: excessive centerNode calls detected; halting further centering to prevent loop");
@@ -45878,12 +45872,12 @@ class j9 {
45878
45872
  }
45879
45873
  let r = this.node.width || 0, i = this.node.height || 0;
45880
45874
  if (this.node.getSequence) {
45881
- const y = this.node.getSequence();
45882
- if (y && (y.width && y.height && (r = y.sequenceWidth || y.width, i = y.sequenceHeight || y.height), y.getCurrentStep)) {
45883
- const v = y.getCurrentStep();
45884
- if (v && v.width && v.height) {
45885
- const S = y.sequenceWidth || v.width, g = y.sequenceHeight || v.height;
45886
- r = Math.max(r, S), i = Math.max(i, g);
45875
+ const m = this.node.getSequence();
45876
+ if (m && (m.width && m.height && (r = m.sequenceWidth || m.width, i = m.sequenceHeight || m.height), m.getCurrentStep)) {
45877
+ const y = m.getCurrentStep();
45878
+ if (y && y.width && y.height) {
45879
+ const v = m.sequenceWidth || y.width, S = m.sequenceHeight || y.height;
45880
+ r = Math.max(r, v), i = Math.max(i, S);
45887
45881
  }
45888
45882
  }
45889
45883
  }
@@ -45894,19 +45888,19 @@ class j9 {
45894
45888
  typeof this.node.closeActiveDot == "function" ? this.node.closeActiveDot() : typeof this.node.closeAllTextBoxes == "function" && this.node.closeAllTextBoxes();
45895
45889
  } catch {
45896
45890
  }
45897
- let y = !1;
45898
- if (this.node && (y = ((m = this.node.constructor) == null ? void 0 : m.name) === "omdStepVisualizer" || this.node.type === "omdStepVisualizer" || typeof Vu < "u" && this.node instanceof Vu), y) {
45899
- const v = this.node && typeof this.node.scale == "number" ? this.node.scale : void 0;
45900
- s = v && v > 0 ? v : 1;
45891
+ let m = !1;
45892
+ if (this.node && (m = this.node.type === "omdStepVisualizer" || typeof Vu < "u" && this.node instanceof Vu), m) {
45893
+ const y = this.node && typeof this.node.scale == "number" ? this.node.scale : void 0;
45894
+ s = y && y > 0 ? y : 1;
45901
45895
  } else {
45902
- const v = this.options.edgePadding || 0, S = this.options.topMargin || 0;
45903
- let b = this.options.bottomMargin || 0;
45896
+ const y = this.options.edgePadding || 0, v = this.options.topMargin || 0;
45897
+ let g = this.options.bottomMargin || 0;
45904
45898
  if (this.node && typeof this.node.isToolbarOverlay == "function" && this.node.isToolbarOverlay()) {
45905
- const A = typeof this.node.getToolbarVisualHeight == "function" ? this.node.getToolbarVisualHeight() : 0;
45906
- b += A + (this.node.getOverlayPadding ? this.node.getOverlayPadding() : 16);
45899
+ const C = typeof this.node.getToolbarVisualHeight == "function" ? this.node.getToolbarVisualHeight() : 0;
45900
+ g += C + (this.node.getOverlayPadding ? this.node.getOverlayPadding() : 16);
45907
45901
  }
45908
- const w = Math.max(0, e - v * 2), x = Math.max(0, t - (S + b)), N = w > 0 ? w / r : 1, D = x > 0 ? x / i : 1, C = typeof this.options.maxScale == "number" ? this.options.maxScale : 1;
45909
- s = Math.min(N, D, C), (!isFinite(s) || s <= 0) && (s = 1);
45902
+ const b = Math.max(0, e - y * 2), w = Math.max(0, t - (v + g)), x = b > 0 ? b / r : 1, N = w > 0 ? w / i : 1, D = typeof this.options.maxScale == "number" ? this.options.maxScale : 1;
45903
+ s = Math.min(x, N, D), (!isFinite(s) || s <= 0) && (s = 1);
45910
45904
  }
45911
45905
  }
45912
45906
  typeof this.node.setScale == "function" && this.node.setScale(s);
@@ -45914,8 +45908,8 @@ class j9 {
45914
45908
  if (this.node.type === "omdEquationSequenceNode" && this.node.alignPointX !== void 0)
45915
45909
  a = e / 2 - this.node.alignPointX * s;
45916
45910
  else {
45917
- const y = r * s;
45918
- a = (e - y) / 2;
45911
+ const m = r * s;
45912
+ a = (e - m) / 2;
45919
45913
  }
45920
45914
  const o = r * s, l = i * s, u = Math.max(
45921
45915
  0,
@@ -45933,7 +45927,7 @@ class j9 {
45933
45927
  _createNodeFromSegment(e, t) {
45934
45928
  try {
45935
45929
  if (e.includes("="))
45936
- return ut.fromString(e);
45930
+ return ot.fromString(e);
45937
45931
  if (!t || typeof t.parse != "function")
45938
45932
  throw new Error("math.js parser is unavailable");
45939
45933
  const r = t.parse(e), i = Tt(r);
@@ -48510,7 +48504,7 @@ class Xa extends _t {
48510
48504
  _renderWithEquationNode(e, t) {
48511
48505
  if (typeof math > "u" || typeof math.parse != "function")
48512
48506
  throw new Error("math.js is required to parse equation strings");
48513
- const r = ut.fromString(e);
48507
+ const r = ot.fromString(e);
48514
48508
  typeof t == "number" && r.setFontSize && r.setFontSize(t), r.hideBackgroundByDefault && r.hideBackgroundByDefault(), r.computeDimensions && r.computeDimensions(), r.updateLayout && r.updateLayout(), typeof this.equationStack.removeAllChildren == "function" ? this.equationStack.removeAllChildren() : this.equationStack.childList = [], this.equationStack.addChild(r), this.equationStack.setSpacer(0), this.equationNode = r, this.leftExpression = null, this.rightExpression = null, this.centerEquation = !1, this.updateLayout();
48515
48509
  }
48516
48510
  setLeftAndRightExpressions(e, t) {
@@ -49051,7 +49045,7 @@ class J9 extends Z2 {
49051
49045
  case "equation":
49052
49046
  if (e.equation && typeof e.equation == "string" && e.equation.includes("="))
49053
49047
  try {
49054
- t = ut.fromString(e.equation), typeof t.computeDimensions == "function" && t.computeDimensions(), typeof t.updateLayout == "function" && t.updateLayout(), t.setPosition(0, 30), this.addChild(t);
49048
+ t = ot.fromString(e.equation), typeof t.computeDimensions == "function" && t.computeDimensions(), typeof t.updateLayout == "function" && t.updateLayout(), t.setPosition(0, 30), this.addChild(t);
49055
49049
  return;
49056
49050
  } catch (i) {
49057
49051
  console.warn("⚠️ omdEquationNode failed, falling back to legacy omdEquation:", i);
@@ -49518,7 +49512,7 @@ class uE {
49518
49512
  }
49519
49513
  this.pointerEventHandler.handlePointerDown(e, r);
49520
49514
  const i = this.canvas.toolManager.getActiveTool();
49521
- i && (i.onPointerDown(r), this.isDrawing === !1 && i.constructor.name !== "PointerTool" && (this.isDrawing = !0)), this.canvas.emit("pointerDown", r);
49515
+ i && (i.onPointerDown(r), this.isDrawing === !1 && (i == null ? void 0 : i.name) !== "pointer" && (this.isDrawing = !0)), this.canvas.emit("pointerDown", r);
49522
49516
  }
49523
49517
  /**
49524
49518
  * Handle pointer move events
@@ -53106,11 +53100,11 @@ const eH = Z0, tH = {
53106
53100
  return new r(t);
53107
53101
  },
53108
53102
  createEquation(n) {
53109
- return ut.fromString(n);
53103
+ return ot.fromString(n);
53110
53104
  },
53111
53105
  createStepVisualizer(n) {
53112
53106
  const e = n.map(
53113
- (t) => ut.fromString(t)
53107
+ (t) => ot.fromString(t)
53114
53108
  );
53115
53109
  return new Vu(e);
53116
53110
  }
@@ -53169,7 +53163,7 @@ export {
53169
53163
  iE as omdDoubleTapeDiagram,
53170
53164
  sa as omdEllipse,
53171
53165
  Xa as omdEquation,
53172
- ut as omdEquationNode,
53166
+ ot as omdEquationNode,
53173
53167
  Uu as omdEquationSequenceNode,
53174
53168
  c9 as omdEquationStack,
53175
53169
  kt as omdExpression,