pimath 0.1.26 → 0.1.27

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/pimath.js CHANGED
@@ -79,7 +79,7 @@ const U = {
79
79
  round: Hi
80
80
  };
81
81
  var ut, x, v, Re;
82
- const P = class P {
82
+ const $ = class $ {
83
83
  constructor(e, t) {
84
84
  m(this, ut, !1);
85
85
  m(this, x, 1);
@@ -114,22 +114,22 @@ const P = class P {
114
114
  }
115
115
  break;
116
116
  case "object":
117
- e instanceof P && (h(this, v, +e.numerator), h(this, x, +e.denominator));
117
+ e instanceof $ && (h(this, v, +e.numerator), h(this, x, +e.denominator));
118
118
  break;
119
119
  }
120
120
  return this;
121
121
  });
122
122
  a(this, "clone", () => {
123
- const e = new P();
123
+ const e = new $();
124
124
  return e.numerator = +s(this, v), e.denominator = +s(this, x), e;
125
125
  });
126
126
  a(this, "abs", () => (h(this, v, Math.abs(s(this, v))), h(this, x, Math.abs(s(this, x))), this));
127
127
  a(this, "add", (e) => {
128
- if (e instanceof P) {
128
+ if (e instanceof $) {
129
129
  const t = s(this, v), i = s(this, x);
130
130
  h(this, v, t * e.denominator + e.numerator * i), h(this, x, i * e.denominator);
131
131
  } else
132
- return this.add(new P(e));
132
+ return this.add(new $(e));
133
133
  return this.reduce();
134
134
  });
135
135
  a(this, "amplify", (e) => (Number.isSafeInteger(e) && (h(this, v, s(this, v) * e), h(this, x, s(this, x) * e)), this));
@@ -146,7 +146,7 @@ const P = class P {
146
146
  a(this, "compare", (e, t) => {
147
147
  t === void 0 && (t = "=");
148
148
  let i;
149
- switch (e instanceof P ? i = e.clone() : i = new P(e), t) {
149
+ switch (e instanceof $ ? i = e.clone() : i = new $(e), t) {
150
150
  case ">":
151
151
  return this.value > i.value;
152
152
  case ">=":
@@ -168,9 +168,9 @@ const P = class P {
168
168
  }
169
169
  });
170
170
  a(this, "divide", (e) => {
171
- const t = new P(e);
171
+ const t = new $(e);
172
172
  if (t.numerator === 0)
173
- return new P().infinite();
173
+ return new $().infinite();
174
174
  const i = +s(this, v), n = +s(this, x);
175
175
  return h(this, v, i * t.denominator), h(this, x, n * t.numerator), this.reduce();
176
176
  });
@@ -188,7 +188,7 @@ const P = class P {
188
188
  a(this, "isGeq", (e) => this.compare(e, ">="));
189
189
  a(this, "isGreater", (e) => this.compare(e, ">"));
190
190
  a(this, "isInfinity", () => Math.abs(s(this, v)) === 1 / 0);
191
- a(this, "isInverted", (e) => this.isEqual(new P().one().divide(e.clone())));
191
+ a(this, "isInverted", (e) => this.isEqual(new $().one().divide(e.clone())));
192
192
  a(this, "isLeq", (e) => this.compare(e, "<="));
193
193
  /* Compare shortcuts */
194
194
  a(this, "isLesser", (e) => this.compare(e, "<"));
@@ -212,13 +212,13 @@ const P = class P {
212
212
  // Mathematical operations specific to fractions
213
213
  a(this, "isZero", () => s(this, v) === 0);
214
214
  a(this, "multiply", (e) => {
215
- const t = new P(e);
215
+ const t = new $(e);
216
216
  return h(this, v, s(this, v) * t.numerator), h(this, x, s(this, x) * t.denominator), this.reduce();
217
217
  });
218
218
  a(this, "one", () => (h(this, v, 1), h(this, x, 1), this));
219
219
  a(this, "opposite", () => (h(this, v, -s(this, v)), this));
220
220
  a(this, "pow", (e) => {
221
- if (e instanceof P)
221
+ if (e instanceof $)
222
222
  return this.pow(e.value);
223
223
  this.reduce(), e < 0 && this.inverse();
224
224
  const t = Math.floor(Math.pow(s(this, v), Math.abs(e))), i = Math.floor(Math.pow(s(this, x), Math.abs(e)));
@@ -245,7 +245,7 @@ const P = class P {
245
245
  // Getter and setter
246
246
  a(this, "sign", () => s(this, v) * s(this, x) >= 0 ? 1 : -1);
247
247
  a(this, "sqrt", () => this.root(2));
248
- a(this, "subtract", (e) => e instanceof P ? this.add(e.clone().opposite()) : this.add(-e));
248
+ a(this, "subtract", (e) => e instanceof $ ? this.add(e.clone().opposite()) : this.add(-e));
249
249
  a(this, "zero", () => (h(this, v, 0), h(this, x, 1), this));
250
250
  return e !== void 0 && this.parse(e, t), this;
251
251
  }
@@ -286,44 +286,44 @@ const P = class P {
286
286
  return e === 0 ? 0 : e;
287
287
  }
288
288
  };
289
- ut = new WeakMap(), x = new WeakMap(), v = new WeakMap(), Re = new WeakMap(), a(P, "average", (...e) => {
290
- const t = new P().zero();
289
+ ut = new WeakMap(), x = new WeakMap(), v = new WeakMap(), Re = new WeakMap(), a($, "average", (...e) => {
290
+ const t = new $().zero();
291
291
  for (const i of e)
292
292
  t.add(i);
293
293
  return t.divide(e.length), t;
294
- }), a(P, "max", (...e) => {
295
- let t = new P(e[0]);
294
+ }), a($, "max", (...e) => {
295
+ let t = new $(e[0]);
296
296
  for (const i of e) {
297
- const n = new P(i);
297
+ const n = new $(i);
298
298
  n.isGreater(t) && (t = n.clone());
299
299
  }
300
300
  return t;
301
- }), a(P, "min", (...e) => {
302
- let t = new P(e[0]);
301
+ }), a($, "min", (...e) => {
302
+ let t = new $(e[0]);
303
303
  for (const i of e) {
304
- const n = new P(i);
304
+ const n = new $(i);
305
305
  n.isLesser(t) && (t = n.clone());
306
306
  }
307
307
  return t;
308
- }), a(P, "sort", (e, t) => {
309
- const n = e.map((r) => r instanceof P ? r : new P(r)).sort((r, l) => r.value - l.value);
308
+ }), a($, "sort", (e, t) => {
309
+ const n = e.map((r) => r instanceof $ ? r : new $(r)).sort((r, l) => r.value - l.value);
310
310
  return t && n.reverse(), n;
311
311
  }), // ------------------------------------------
312
312
  // Compare functions
313
- a(P, "unique", (e) => {
313
+ a($, "unique", (e) => {
314
314
  const t = {}, i = [];
315
315
  return e.forEach((n) => {
316
- n instanceof P || (n = new P(n)), t[n.clone().reduce().tex] || (i.push(n.clone()), t[n.tex] = !0);
316
+ n instanceof $ || (n = new $(n)), t[n.clone().reduce().tex] || (i.push(n.clone()), t[n.tex] = !0);
317
317
  }), i;
318
- }), a(P, "xMultiply", (...e) => {
319
- const t = new P();
318
+ }), a($, "xMultiply", (...e) => {
319
+ const t = new $();
320
320
  for (const i of e) {
321
- const n = new P(i);
321
+ const n = new $(i);
322
322
  t.numerator = t.numerator * n.numerator, t.denominator = t.denominator * n.denominator;
323
323
  }
324
324
  return t;
325
325
  });
326
- let u = P;
326
+ let u = $;
327
327
  var Z, ie, re, Ye;
328
328
  class vt {
329
329
  constructor(...e) {
@@ -1370,8 +1370,8 @@ function yi(o, e = !0) {
1370
1370
  function Et(o, e, t, i, n) {
1371
1371
  return o.map((r, l) => r === e ? t : r);
1372
1372
  }
1373
- var je, y, Ke, ft, Je, dt, Ct, $t, Pt, _e, It, pt, St, Bt, Rt, zt, ki, Lt, Vt;
1374
- const $ = class $ {
1373
+ var je, y, Ke, ft, Je, dt, Ct, Pt, $t, _e, It, pt, St, Bt, Rt, zt, ki, Lt, Vt;
1374
+ const P = class P {
1375
1375
  constructor(e, ...t) {
1376
1376
  m(this, zt);
1377
1377
  m(this, je);
@@ -1392,7 +1392,7 @@ const $ = class $ {
1392
1392
  s(this, y).push(new M(e)), t.forEach((i) => {
1393
1393
  s(this, y).push(new M(i));
1394
1394
  });
1395
- else if (e instanceof $)
1395
+ else if (e instanceof P)
1396
1396
  for (const i of e.monoms)
1397
1397
  s(this, y).push(i.clone());
1398
1398
  return this;
@@ -1401,14 +1401,14 @@ const $ = class $ {
1401
1401
  * Clone the polynom
1402
1402
  */
1403
1403
  a(this, "clone", () => {
1404
- const e = new $(), t = [];
1404
+ const e = new P(), t = [];
1405
1405
  for (const i of s(this, y))
1406
1406
  t.push(i.clone());
1407
1407
  return e.monoms = t, e;
1408
1408
  });
1409
1409
  a(this, "add", (...e) => {
1410
1410
  for (const t of e)
1411
- t instanceof $ ? h(this, y, s(this, y).concat(t.monoms)) : t instanceof M ? s(this, y).push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? s(this, y).push(new M(t.toString())) : s(this, y).push(new M(t));
1411
+ t instanceof P ? h(this, y, s(this, y).concat(t.monoms)) : t instanceof M ? s(this, y).push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? s(this, y).push(new M(t.toString())) : s(this, y).push(new M(t));
1412
1412
  return this.reduce();
1413
1413
  });
1414
1414
  a(this, "commonMonom", () => {
@@ -1429,7 +1429,7 @@ const $ = class $ {
1429
1429
  return t;
1430
1430
  });
1431
1431
  a(this, "derivative", (e) => {
1432
- const t = new $();
1432
+ const t = new P();
1433
1433
  for (const i of s(this, y))
1434
1434
  t.add(i.derivative(e));
1435
1435
  return t.reduce();
@@ -1440,8 +1440,8 @@ const $ = class $ {
1440
1440
  if (typeof e == "number" && Number.isSafeInteger(e))
1441
1441
  return s(this, Ct).call(this, e);
1442
1442
  if (e instanceof M)
1443
- return this.divide(new $(e));
1444
- if (e instanceof $) {
1443
+ return this.divide(new P(e));
1444
+ if (e instanceof P) {
1445
1445
  if (e.monoms.length === 1 && e.variables.length === 0)
1446
1446
  return s(this, dt).call(this, e.monoms[0].coefficient);
1447
1447
  {
@@ -1450,7 +1450,7 @@ const $ = class $ {
1450
1450
  return h(this, y, t.monoms), this;
1451
1451
  }
1452
1452
  } else if (typeof e == "string")
1453
- return this.divide(new $(e));
1453
+ return this.divide(new P(e));
1454
1454
  throw new Error(`Cannot divide by ${e}`);
1455
1455
  });
1456
1456
  a(this, "empty", () => (h(this, y, []), this));
@@ -1460,11 +1460,11 @@ const $ = class $ {
1460
1460
  * returns {quotient: Polynom, reminder: Polynom}
1461
1461
  */
1462
1462
  a(this, "euclidean", (e) => {
1463
- const t = e.variables[0], i = new $().zero(), n = this.clone().reorder(t);
1463
+ const t = e.variables[0], i = new P().zero(), n = this.clone().reorder(t);
1464
1464
  if (e.variables.length === 0)
1465
1465
  return {
1466
1466
  quotient: this.clone().divide(e).reduce(),
1467
- reminder: new $().zero()
1467
+ reminder: new P().zero()
1468
1468
  };
1469
1469
  const r = e.monomByDegree(void 0, t), l = e.degree(t);
1470
1470
  let c, f = this.degree(t).value * 2;
@@ -1474,7 +1474,7 @@ const $ = class $ {
1474
1474
  });
1475
1475
  a(this, "evaluate", (e, t) => {
1476
1476
  if (t)
1477
- return s(this, $t).call(this, e);
1477
+ return s(this, Pt).call(this, e);
1478
1478
  const i = new u().zero();
1479
1479
  return s(this, y).forEach((n) => {
1480
1480
  i.add(n.evaluate(e, t));
@@ -1489,7 +1489,7 @@ const $ = class $ {
1489
1489
  let t = [], i = this.clone().reorder();
1490
1490
  const n = i.commonMonom();
1491
1491
  if (i.monomByDegree().coefficient.isStrictlyNegative() && n.coefficient.isStrictlyPositive() && !n.isOne() && n.opposite(), !n.isOne()) {
1492
- const c = new $(n);
1492
+ const c = new P(n);
1493
1493
  t = [c.clone()], i = i.euclidean(c).quotient;
1494
1494
  }
1495
1495
  let r = i.degree().clone().multiply(2).value, l = 1;
@@ -1543,7 +1543,7 @@ const $ = class $ {
1543
1543
  if (i.includes("(") || i.includes(")"))
1544
1544
  return !1;
1545
1545
  try {
1546
- t = new $(e);
1546
+ t = new P(e);
1547
1547
  } catch {
1548
1548
  return !1;
1549
1549
  }
@@ -1563,7 +1563,7 @@ const $ = class $ {
1563
1563
  a(this, "isReduced", (e) => {
1564
1564
  if (!this.isDeveloped(e))
1565
1565
  return !1;
1566
- const t = new $(e);
1566
+ const t = new P(e);
1567
1567
  if (t.monoms.length > this.monoms.length)
1568
1568
  return !1;
1569
1569
  for (const i of t.monoms)
@@ -1613,7 +1613,7 @@ const $ = class $ {
1613
1613
  r.degree(t).isEqual(e) && i.push(r.clone());
1614
1614
  return i;
1615
1615
  });
1616
- a(this, "multiply", (e) => e instanceof $ ? s(this, Rt).call(this, e) : e instanceof u ? s(this, pt).call(this, e) : e instanceof M ? s(this, Bt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this, St).call(this, e) : this);
1616
+ a(this, "multiply", (e) => e instanceof P ? s(this, Rt).call(this, e) : e instanceof u ? s(this, pt).call(this, e) : e instanceof M ? s(this, Bt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this, St).call(this, e) : this);
1617
1617
  a(this, "one", () => (h(this, y, []), s(this, y).push(new M().one()), this));
1618
1618
  // ------------------------------------------
1619
1619
  a(this, "opposite", () => (h(this, y, s(this, y).map((e) => e.opposite())), this));
@@ -1623,14 +1623,14 @@ const $ = class $ {
1623
1623
  if (e < 0)
1624
1624
  return this.zero();
1625
1625
  if (e === 0)
1626
- return new $();
1626
+ return new P();
1627
1627
  const t = this.clone();
1628
1628
  for (let i = 1; i < e; i++)
1629
1629
  this.multiply(t);
1630
1630
  return this.reduce();
1631
1631
  });
1632
1632
  a(this, "primitive", (e) => {
1633
- const t = new $();
1633
+ const t = new P();
1634
1634
  for (const i of s(this, y))
1635
1635
  t.add(i.primitive(e));
1636
1636
  return t;
@@ -1645,7 +1645,7 @@ const $ = class $ {
1645
1645
  h(this, y, s(this, y).filter((t) => !t.coefficient.isZero()));
1646
1646
  for (const t of s(this, y))
1647
1647
  t.coefficient.reduce();
1648
- return this.length === 0 ? new $().zero() : this.reorder();
1648
+ return this.length === 0 ? new P().zero() : this.reorder();
1649
1649
  });
1650
1650
  // ------------------------------------------
1651
1651
  a(this, "reorder", (e = "x", t) => {
@@ -1671,14 +1671,14 @@ const $ = class $ {
1671
1671
  */
1672
1672
  a(this, "replaceBy", (e, t) => {
1673
1673
  let i;
1674
- const n = new $().zero();
1674
+ const n = new P().zero();
1675
1675
  for (const r of this.monoms)
1676
1676
  !r.hasVariable(e) || r.literal[e].isZero() ? n.add(r.clone()) : (i = r.literal[e].clone(), r.removeVariable(e), n.add(t.clone().pow(Math.abs(i.numerator)).multiply(r)));
1677
1677
  return h(this, y, n.reduce().monoms), this;
1678
1678
  });
1679
1679
  a(this, "subtract", (...e) => {
1680
1680
  for (const t of e)
1681
- t instanceof $ ? this.add(t.clone().opposite()) : t instanceof M ? s(this, y).push(t.clone().opposite()) : s(this, y).push(new M(t).opposite());
1681
+ t instanceof P ? this.add(t.clone().opposite()) : t instanceof M ? s(this, y).push(t.clone().opposite()) : s(this, y).push(new M(t).opposite());
1682
1682
  return this.reduce();
1683
1683
  });
1684
1684
  /**
@@ -1709,26 +1709,26 @@ const $ = class $ {
1709
1709
  i.coefficient.divide(t);
1710
1710
  return this;
1711
1711
  });
1712
- m(this, $t, (e) => {
1712
+ m(this, Pt, (e) => {
1713
1713
  let t = 0;
1714
1714
  return s(this, y).forEach((i) => {
1715
1715
  t += i.evaluate(e, !0);
1716
1716
  }), t;
1717
1717
  });
1718
- m(this, Pt, (e) => {
1718
+ m(this, $t, (e) => {
1719
1719
  var w;
1720
1720
  let t, i, n, r, l, c, f, d, p;
1721
1721
  if (this.numberOfVars === 1)
1722
- return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, c = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), c.isZero() ? (f = r.clone().opposite().divide(n.clone().multiply(2)), t = new $(e).subtract(f.display).multiply(f.denominator), i = new $(e).subtract(f.display).multiply(f.denominator), p = n.divide(f.denominator).divide(f.denominator), p.isOne() ? [t, i] : [new $(p.display), t, i]) : c.isPositive() && c.isSquare() ? (f = r.clone().opposite().add(c.clone().sqrt()).divide(n.clone().multiply(2)), d = r.clone().opposite().subtract(c.clone().sqrt()).divide(n.clone().multiply(2)), p = n.divide(f.denominator).divide(d.denominator), p.isOne() ? [
1723
- new $(e).subtract(f.display).multiply(f.denominator),
1724
- new $(e).subtract(d.display).multiply(d.denominator)
1722
+ return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, c = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), c.isZero() ? (f = r.clone().opposite().divide(n.clone().multiply(2)), t = new P(e).subtract(f.display).multiply(f.denominator), i = new P(e).subtract(f.display).multiply(f.denominator), p = n.divide(f.denominator).divide(f.denominator), p.isOne() ? [t, i] : [new P(p.display), t, i]) : c.isPositive() && c.isSquare() ? (f = r.clone().opposite().add(c.clone().sqrt()).divide(n.clone().multiply(2)), d = r.clone().opposite().subtract(c.clone().sqrt()).divide(n.clone().multiply(2)), p = n.divide(f.denominator).divide(d.denominator), p.isOne() ? [
1723
+ new P(e).subtract(f.display).multiply(f.denominator),
1724
+ new P(e).subtract(d.display).multiply(d.denominator)
1725
1725
  ] : [
1726
- new $(p.display),
1727
- new $(e).subtract(f.display).multiply(f.denominator),
1728
- new $(e).subtract(d.display).multiply(d.denominator)
1726
+ new P(p.display),
1727
+ new P(e).subtract(f.display).multiply(f.denominator),
1728
+ new P(e).subtract(d.display).multiply(d.denominator)
1729
1729
  ]) : [this.clone()];
1730
1730
  if (n = this.monomByDegree(2, e), r = this.monomByDegree(1, e), l = this.monomByDegree(0, e), n.isLiteralSquare() && l.isLiteralSquare() && r.clone().pow(2).isSameAs(n.clone().multiply(l))) {
1731
- const V = new $("x", n.coefficient, r.coefficient, l.coefficient), ce = s(w = V, Pt).call(w, "x"), ue = [];
1731
+ const V = new P("x", n.coefficient, r.coefficient, l.coefficient), ce = s(w = V, $t).call(w, "x"), ue = [];
1732
1732
  let fe;
1733
1733
  if (ce.length >= 2) {
1734
1734
  for (const ye of ce)
@@ -1752,7 +1752,7 @@ const $ = class $ {
1752
1752
  const n = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, l = [];
1753
1753
  return n.forEach((c) => {
1754
1754
  c.degree(i).isLeq(t) && r.forEach((f) => {
1755
- c.degree(i).isNotEqual(f.degree(i)) && (l.push(new $(c, f)), l.push(new $(c, f.clone().opposite())));
1755
+ c.degree(i).isNotEqual(f.degree(i)) && (l.push(new P(c, f)), l.push(new P(c, f.clone().opposite())));
1756
1756
  });
1757
1757
  }), l;
1758
1758
  });
@@ -1789,10 +1789,10 @@ const $ = class $ {
1789
1789
  m(this, Vt, (e, t) => {
1790
1790
  switch (t.tokenType) {
1791
1791
  case g.COEFFICIENT:
1792
- e.push(new $(t.token));
1792
+ e.push(new P(t.token));
1793
1793
  break;
1794
1794
  case g.VARIABLE:
1795
- e.push(new $().add(new M(t.token)));
1795
+ e.push(new P().add(new M(t.token)));
1796
1796
  break;
1797
1797
  case g.CONSTANT:
1798
1798
  console.log("Actually, not supported - will be added later !");
@@ -1930,7 +1930,7 @@ const $ = class $ {
1930
1930
  return this.getZeroes();
1931
1931
  }
1932
1932
  };
1933
- je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), Je = new WeakMap(), dt = new WeakMap(), Ct = new WeakMap(), $t = new WeakMap(), Pt = new WeakMap(), _e = new WeakMap(), It = new WeakMap(), pt = new WeakMap(), St = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap(), zt = new WeakSet(), ki = function(e, ...t) {
1933
+ je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), Je = new WeakMap(), dt = new WeakMap(), Ct = new WeakMap(), Pt = new WeakMap(), $t = new WeakMap(), _e = new WeakMap(), It = new WeakMap(), pt = new WeakMap(), St = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap(), zt = new WeakSet(), ki = function(e, ...t) {
1934
1934
  if (t.length === 0) {
1935
1935
  if (e = "" + e, e !== "" && !isNaN(Number(e))) {
1936
1936
  this.empty();
@@ -1961,7 +1961,7 @@ je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), J
1961
1961
  } else
1962
1962
  return this.zero();
1963
1963
  }, Lt = new WeakMap(), Vt = new WeakMap();
1964
- let O = $;
1964
+ let O = P;
1965
1965
  var q, k, oe, Dt, et, Zt;
1966
1966
  const Ne = class Ne {
1967
1967
  constructor(e, t, i) {
@@ -2337,12 +2337,12 @@ const ve = class ve {
2337
2337
  };
2338
2338
  Te = new WeakMap(), Ae = new WeakMap(), be = new WeakMap(), tt = new WeakMap();
2339
2339
  let se = ve;
2340
- var lt = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(lt || {}), D, $e, Ft, jt;
2340
+ var lt = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(lt || {}), D, Pe, Ft, jt;
2341
2341
  const Xe = class Xe {
2342
2342
  constructor(...e) {
2343
2343
  m(this, D);
2344
2344
  // Determine the letters in the linear system, usually ['x', 'y']
2345
- m(this, $e);
2345
+ m(this, Pe);
2346
2346
  a(this, "parse", (...e) => (h(this, D, e.map((t) => new H(t))), s(this, Ft).call(this), this));
2347
2347
  a(this, "clone", () => new Xe().parse(...s(this, D).map((e) => e.clone())));
2348
2348
  a(this, "buildTex", (e, t) => {
@@ -2393,7 +2393,7 @@ const Xe = class Xe {
2393
2393
  }
2394
2394
  return i.map((n) => n[n.length - 1]);
2395
2395
  });
2396
- m(this, Ft, () => (h(this, $e, s(this, D).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), s(this, $e).sort(), this));
2396
+ m(this, Ft, () => (h(this, Pe, s(this, D).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), s(this, Pe).sort(), this));
2397
2397
  m(this, jt, () => {
2398
2398
  const e = [], t = [];
2399
2399
  for (const i of s(this, D)) {
@@ -2406,7 +2406,7 @@ const Xe = class Xe {
2406
2406
  }
2407
2407
  return [e, t];
2408
2408
  });
2409
- return h(this, D, []), h(this, $e, []), e.length > 0 && this.parse(...e), this;
2409
+ return h(this, D, []), h(this, Pe, []), e.length > 0 && this.parse(...e), this;
2410
2410
  }
2411
2411
  static fromMatrix(e, t = "xyz") {
2412
2412
  const i = e[0].length;
@@ -2452,7 +2452,7 @@ const Xe = class Xe {
2452
2452
  throw new Error("Method not implemented.");
2453
2453
  }
2454
2454
  hasVariable(e) {
2455
- return s(this, $e).includes(e);
2455
+ return s(this, Pe).includes(e);
2456
2456
  }
2457
2457
  isEqual(e) {
2458
2458
  return this.equations.every((t, i) => t.isEqual(e.equations[i]));
@@ -2501,14 +2501,14 @@ const Xe = class Xe {
2501
2501
  return this.buildTex(e.equations);
2502
2502
  }
2503
2503
  get variables() {
2504
- return s(this, $e);
2504
+ return s(this, Pe);
2505
2505
  }
2506
2506
  set variables(e) {
2507
2507
  const t = typeof e == "string" ? e.split("") : [...e];
2508
- t.sort(), h(this, $e, t);
2508
+ t.sort(), h(this, Pe, t);
2509
2509
  }
2510
2510
  };
2511
- D = new WeakMap(), $e = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap();
2511
+ D = new WeakMap(), Pe = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap();
2512
2512
  let ti = Xe;
2513
2513
  var Oe, mt, ii;
2514
2514
  class ss {
@@ -3185,12 +3185,12 @@ function as(o) {
3185
3185
  return o !== void 0 && (e = e.filter((t) => t < o)), di(e);
3186
3186
  }
3187
3187
  function ls(o, e) {
3188
- return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : $i(o).slice(0, e);
3188
+ return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : Pi(o).slice(0, e);
3189
3189
  }
3190
3190
  function di(o) {
3191
3191
  return o.length === 0 ? null : o[pe(0, o.length - 1)];
3192
3192
  }
3193
- function $i(o) {
3193
+ function Pi(o) {
3194
3194
  const e = Object.values(o);
3195
3195
  for (let t = e.length - 1; t > 0; t--) {
3196
3196
  const i = Math.floor(Math.random() * (t + 1)), n = e[t];
@@ -3224,7 +3224,7 @@ class S extends E {
3224
3224
  return e.array = this.copy(), e.asPoint = !0, e;
3225
3225
  }
3226
3226
  }
3227
- var Pe, B, z, W, he, J, Ie, xe;
3227
+ var $e, B, z, W, he, J, Ie, xe;
3228
3228
  const De = class De {
3229
3229
  /**
3230
3230
  * Value can be a mix of:
@@ -3232,7 +3232,7 @@ const De = class De {
3232
3232
  * @param values
3233
3233
  */
3234
3234
  constructor(...e) {
3235
- m(this, Pe);
3235
+ m(this, $e);
3236
3236
  // ax + by + c = 0
3237
3237
  m(this, B);
3238
3238
  m(this, z);
@@ -3361,7 +3361,7 @@ const De = class De {
3361
3361
  const t = this.getEquation().isolate("x"), i = new u(e);
3362
3362
  return t instanceof H ? t.right.evaluate({ y: i }) : new u().invalid();
3363
3363
  });
3364
- return h(this, B, new u().zero()), h(this, z, new u().zero()), h(this, W, new u().zero()), h(this, he, new E()), h(this, J, new E()), h(this, Ie, new E()), h(this, Pe, !0), e.length > 0 && this.parse(...e), this;
3364
+ return h(this, B, new u().zero()), h(this, z, new u().zero()), h(this, W, new u().zero()), h(this, he, new E()), h(this, J, new E()), h(this, Ie, new E()), h(this, $e, !0), e.length > 0 && this.parse(...e), this;
3365
3365
  }
3366
3366
  get a() {
3367
3367
  return s(this, B);
@@ -3401,7 +3401,7 @@ const De = class De {
3401
3401
  // ------------------------------------------
3402
3402
  getEquation() {
3403
3403
  const e = new H(new O().parse("xy", s(this, B), s(this, z), s(this, W)), new O("0"));
3404
- return s(this, Pe) ? e.simplify() : e;
3404
+ return s(this, $e) ? e.simplify() : e;
3405
3405
  }
3406
3406
  // get system(): { x: Equation, y: Equation } {
3407
3407
  // const e1 = new Equation(
@@ -3441,7 +3441,7 @@ const De = class De {
3441
3441
  case "parametric":
3442
3442
  case "system": {
3443
3443
  const t = s(this, J).clone();
3444
- return s(this, Pe) && t.simplify(), e === "parametric" ? `${E.asTex("x", "y")} = ${E.asTex(s(this, he).x.tex, s(this, he).y.tex)} + k\\cdot ${E.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3444
+ return s(this, $e) && t.simplify(), e === "parametric" ? `${E.asTex("x", "y")} = ${E.asTex(s(this, he).x.tex, s(this, he).y.tex)} + k\\cdot ${E.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3445
3445
  x &= ${new O(s(this, he).x).add(new M(s(this, J).x).multiply(new M("k"))).reorder("k", !0).tex}\\\\
3446
3446
  y &= ${new O(s(this, he).y).add(new M(s(this, J).y).multiply(new M("k"))).reorder("k", !0).tex}
3447
3447
  \\end{aligned}\\right.`;
@@ -3453,10 +3453,10 @@ const De = class De {
3453
3453
  }
3454
3454
  }
3455
3455
  get reduceBeforeDisplay() {
3456
- return s(this, Pe);
3456
+ return s(this, $e);
3457
3457
  }
3458
3458
  set reduceBeforeDisplay(e) {
3459
- h(this, Pe, e);
3459
+ h(this, $e, e);
3460
3460
  }
3461
3461
  get display() {
3462
3462
  const e = s(this, xe);
@@ -3467,7 +3467,7 @@ const De = class De {
3467
3467
  return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new O().parse("x", this.slope, this.height).display;
3468
3468
  case "parametric": {
3469
3469
  const t = s(this, J).clone();
3470
- return s(this, Pe) && t.simplify(), `((x,y))=((${s(this, he).x.display},${s(this, he).y.display}))+k((${t.x.display},${t.y.display}))`;
3470
+ return s(this, $e) && t.simplify(), `((x,y))=((${s(this, he).x.display},${s(this, he).y.display}))+k((${t.x.display},${t.y.display}))`;
3471
3471
  }
3472
3472
  default: {
3473
3473
  const t = this.getEquation();
@@ -3524,10 +3524,10 @@ const De = class De {
3524
3524
  return s(this, B).isZero() || (s(this, B).isOne() ? t = "x" : s(this, B).clone().opposite().isOne() ? t = "-x" : t = s(this, B).value.toFixed(e) + "x"), s(this, z).isZero() || (s(this, z).isPositive() && (t += "+"), t += s(this, z).value.toFixed(e) + "y"), s(this, W).isZero() || (s(this, W).isPositive() && (t += "+"), t += s(this, W).value.toFixed(e)), t + "=0";
3525
3525
  }
3526
3526
  };
3527
- Pe = new WeakMap(), B = new WeakMap(), z = new WeakMap(), W = new WeakMap(), he = new WeakMap(), J = new WeakMap(), Ie = new WeakMap(), xe = new WeakMap(), // A line is defined as the canonical form
3527
+ $e = new WeakMap(), B = new WeakMap(), z = new WeakMap(), W = new WeakMap(), he = new WeakMap(), J = new WeakMap(), Ie = new WeakMap(), xe = new WeakMap(), // A line is defined as the canonical form
3528
3528
  a(De, "PERPENDICULAR", we.Perpendicular), a(De, "PARALLEL", we.Parallel);
3529
3529
  let R = De;
3530
- var ae, j, qe, Ut, Wt, Gt, le, Pi, Nt, Ii, Si, Bi, hi;
3530
+ var ae, j, qe, Ut, Wt, Gt, le, $i, Nt, Ii, Si, Bi, hi;
3531
3531
  const Ht = class Ht {
3532
3532
  constructor(...e) {
3533
3533
  m(this, le);
@@ -3631,7 +3631,7 @@ const Ht = class Ht {
3631
3631
  return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)), A(this, le, Nt).call(this), this;
3632
3632
  }
3633
3633
  parse(...e) {
3634
- return A(this, le, Pi).call(this), typeof e[0] == "string" ? A(this, le, hi).call(this, new H(e[0])) : e[0] instanceof H ? A(this, le, hi).call(this, e[0]) : e[0] instanceof Ht ? A(this, le, Ii).call(this, e[0]) : e[0] instanceof S && e.length > 1 && (e[1] instanceof S ? e[2] instanceof S || A(this, le, Bi).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && A(this, le, Si).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), A(this, le, Nt).call(this), this;
3634
+ return A(this, le, $i).call(this), typeof e[0] == "string" ? A(this, le, hi).call(this, new H(e[0])) : e[0] instanceof H ? A(this, le, hi).call(this, e[0]) : e[0] instanceof Ht ? A(this, le, Ii).call(this, e[0]) : e[0] instanceof S && e.length > 1 && (e[1] instanceof S ? e[2] instanceof S || A(this, le, Bi).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && A(this, le, Si).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), A(this, le, Nt).call(this), this;
3635
3635
  }
3636
3636
  // private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
3637
3637
  // const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
@@ -3640,7 +3640,7 @@ const Ht = class Ht {
3640
3640
  // return this
3641
3641
  // }
3642
3642
  };
3643
- ae = new WeakMap(), j = new WeakMap(), qe = new WeakMap(), Ut = new WeakMap(), Wt = new WeakMap(), Gt = new WeakMap(), le = new WeakSet(), Pi = function() {
3643
+ ae = new WeakMap(), j = new WeakMap(), qe = new WeakMap(), Ut = new WeakMap(), Wt = new WeakMap(), Gt = new WeakMap(), le = new WeakSet(), $i = function() {
3644
3644
  return h(this, ae, void 0), h(this, j, void 0), h(this, qe, void 0), this;
3645
3645
  }, Nt = function() {
3646
3646
  h(this, qe, new H(
@@ -4244,7 +4244,7 @@ function ps(o) {
4244
4244
  );
4245
4245
  for (; t.isNull; )
4246
4246
  t.x = Q(10), t.y = Q(10);
4247
- return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new R(new E(e.A.x, e.A.y), t);
4247
+ return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new R().fromPointAndDirection(new E(e.A.x, e.A.y), t);
4248
4248
  }
4249
4249
  function ms(o) {
4250
4250
  const e = Object.assign(
@@ -4275,7 +4275,7 @@ const gs = {
4275
4275
  bool: (o) => Ci(o),
4276
4276
  array: (o, e) => ls(o, e),
4277
4277
  item: (o) => di(o),
4278
- shuffle: (o) => $i(o),
4278
+ shuffle: (o) => Pi(o),
4279
4279
  line: (o) => ps(o),
4280
4280
  line3: (o) => ms(o),
4281
4281
  vector: (o) => ci(o),