pimath 0.2.5 → 0.2.7

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
@@ -1,15 +1,15 @@
1
- function ut(n) {
2
- const t = st(n), e = [];
1
+ function ft(n) {
2
+ const t = rt(n), e = [];
3
3
  let i, s;
4
4
  for (; t.length > 0; )
5
5
  i = t.shift() ?? 1, s = (t.length > 0 ? t.pop() : +i) ?? 1, e.push([i, s]);
6
6
  return e;
7
7
  }
8
- function ft(...n) {
9
- const t = J(...n);
8
+ function dt(...n) {
9
+ const t = _(...n);
10
10
  return n.map((e) => e / t);
11
11
  }
12
- function st(n) {
12
+ function rt(n) {
13
13
  const t = Math.abs(n), e = Math.sqrt(t), i = [];
14
14
  for (let s = 1; s <= e; s++)
15
15
  n % s === 0 && (i.push(s), i.push(t / s));
@@ -17,7 +17,7 @@ function st(n) {
17
17
  return s - r;
18
18
  }), [...new Set(i)];
19
19
  }
20
- function J(...n) {
20
+ function _(...n) {
21
21
  const t = function(s, r) {
22
22
  return isNaN(s) || isNaN(r) ? NaN : r === 0 ? s : s === 0 ? r : t(r, s % r);
23
23
  };
@@ -32,34 +32,34 @@ function J(...n) {
32
32
  ;
33
33
  return Math.abs(e);
34
34
  }
35
- function dt(...n) {
35
+ function pt(...n) {
36
36
  return n.reduce(function(t, e) {
37
- return Math.abs(t * e / J(t, e));
37
+ return Math.abs(t * e / _(t, e));
38
38
  });
39
39
  }
40
- function pt(n, t = 3) {
40
+ function mt(n, t = 3) {
41
41
  return +n.toFixed(t);
42
42
  }
43
- function mt(n) {
43
+ function gt(n) {
44
44
  if (Number.isSafeInteger(n) || n.toString().split(".")[0].length < 10)
45
45
  return 0;
46
46
  throw new Error("Periodic value: Not implemented yet");
47
47
  }
48
- function gt(n) {
48
+ function wt(n) {
49
49
  const t = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973];
50
50
  return n === void 0 ? t : t.slice(0, Math.min(t.length, n));
51
51
  }
52
- function wt(n, t) {
52
+ function yt(n, t) {
53
53
  const e = [], i = t === !0 ? +n : n ** 2;
54
54
  for (let s = 0; s <= n; s++)
55
55
  for (let r = 0; r <= n; r++)
56
56
  s ** 2 + r ** 2 === i && e.push([s, r, n]);
57
57
  return e;
58
58
  }
59
- function yt(n, t = 2) {
59
+ function vt(n, t = 2) {
60
60
  return +`${Math.round(+`${n}e${t}`)}e-${t}`;
61
61
  }
62
- function vt(n, t) {
62
+ function xt(n, t) {
63
63
  let e = Math.floor(Math.pow(n, 1 / t));
64
64
  const i = n, s = 1;
65
65
  for (; e > 1; ) {
@@ -70,20 +70,20 @@ function vt(n, t) {
70
70
  }
71
71
  return s;
72
72
  }
73
- const x = {
74
- decompose: ut,
75
- dividers: st,
76
- divideNumbersByGCD: ft,
77
- gcd: J,
78
- lcm: dt,
79
- numberCorrection: pt,
80
- periodic: mt,
81
- primes: gt,
82
- pythagoreanTripletsWithTarget: wt,
83
- round: yt,
84
- greatestPower: vt
73
+ const b = {
74
+ decompose: ft,
75
+ dividers: rt,
76
+ divideNumbersByGCD: dt,
77
+ gcd: _,
78
+ lcm: pt,
79
+ numberCorrection: mt,
80
+ periodic: gt,
81
+ primes: wt,
82
+ pythagoreanTripletsWithTarget: yt,
83
+ round: vt,
84
+ greatestPower: xt
85
85
  };
86
- var xt = /* @__PURE__ */ ((n) => (n.frac = "frac", n.dfrac = "dfrac", n.tfrac = "tfrac", n))(xt || {});
86
+ var bt = /* @__PURE__ */ ((n) => (n.frac = "frac", n.dfrac = "dfrac", n.tfrac = "tfrac", n))(bt || {});
87
87
  class h {
88
88
  #t = 1;
89
89
  #e = 3;
@@ -156,7 +156,7 @@ class h {
156
156
  return e && s.reverse(), s;
157
157
  };
158
158
  static toSameDenominateur(...t) {
159
- const e = t.map((s) => new h(s)), i = x.lcm(...e.map((s) => s.denominator));
159
+ const e = t.map((s) => new h(s)), i = b.lcm(...e.map((s) => s.denominator));
160
160
  return e.forEach((s) => s.amplify(i / s.denominator)), e;
161
161
  }
162
162
  static unique = (t) => {
@@ -244,7 +244,7 @@ class h {
244
244
  if (Number.isSafeInteger(t))
245
245
  return this.#s = t, this.#t = 1, this.#i = !0, this;
246
246
  const [, e] = t.toString().split("."), i = e ? e.length : 0, s = Math.pow(10, i);
247
- return this.#s = t * s, this.#t = s, this.#s = x.numberCorrection(this.#s), this.#t = x.numberCorrection(this.#t), this.reduce(), this.#i = i < 10, this;
247
+ return this.#s = t * s, this.#t = s, this.#s = b.numberCorrection(this.#s), this.#t = b.numberCorrection(this.#t), this.reduce(), this.#i = i < 10, this;
248
248
  }
249
249
  fromNumbers(t, e) {
250
250
  return Number.isSafeInteger(t) && Number.isSafeInteger(e) ? (this.#s = t, this.#t = e, this.#i = !0, this) : this.fromNumber(t / e);
@@ -285,7 +285,7 @@ class h {
285
285
  isOne = () => this.#s === 1 && this.#t === 1;
286
286
  isPositive = () => this.sign() === 1;
287
287
  isRational = () => this.exact && !this.isRelative();
288
- isReduced = () => Math.abs(x.gcd(this.#s, this.#t)) === 1;
288
+ isReduced = () => Math.abs(b.gcd(this.#s, this.#t)) === 1;
289
289
  isRelative = () => this.exact && this.clone().reduce().denominator === 1;
290
290
  isSquare = () => Math.sqrt(this.#s) % 1 === 0 && Math.sqrt(this.#t) % 1 === 0;
291
291
  isStrictlyNegative = () => this.value < 0;
@@ -316,7 +316,7 @@ class h {
316
316
  return r === i && o === s ? (this.#s = r, this.#t = o) : (this.#s = i / s, this.#t = 1, this.exact = !1), this;
317
317
  };
318
318
  reduce = () => {
319
- const t = x.gcd(this.#s, this.#t);
319
+ const t = b.gcd(this.#s, this.#t);
320
320
  return this.#s = this.#s / t, this.#t = this.#t / t, this.#t < 0 && (this.#t = -this.#t, this.#s = -this.#s), this;
321
321
  };
322
322
  root = (t) => {
@@ -349,15 +349,30 @@ class h {
349
349
  }
350
350
  zero = () => this.fromNumber(0);
351
351
  }
352
- function it(n, t = !0) {
352
+ function st(n, t = !0) {
353
353
  return t ? `\\left( ${n} \\right)` : `(${n})`;
354
354
  }
355
- function Q(n) {
356
- return n.startsWith("(") && (n = n.substring(1)), n.endsWith(")") && (n = n.substring(0, n.length - 1)), n;
355
+ function j(n) {
356
+ if (!n.startsWith("(") || !n.endsWith(")")) return n;
357
+ let t = 0;
358
+ for (let e = 0; e < n.length - 1; e++)
359
+ if (n[e] === "(" ? t++ : n[e] === ")" && t--, t === 0) return n;
360
+ return n.slice(1, -1);
357
361
  }
358
- function j(n, t, e, i, s) {
362
+ function F(n, t, e, i, s) {
359
363
  return n.map((r, o) => r === t ? e : r);
360
364
  }
365
+ function H(n, t) {
366
+ if (t.length !== 1)
367
+ throw new Error(`splitChar must be a single character, got: "${t}"`);
368
+ let e = 0, i = 0;
369
+ const s = [];
370
+ for (let r = 0; r < n.length; r++) {
371
+ const o = n[r];
372
+ o === "(" ? e++ : o === ")" ? e-- : o === t && e === 0 && (s.push(n.substring(i, r)), i = r + 1);
373
+ }
374
+ return s.push(n.substring(i)), s;
375
+ }
361
376
  class T {
362
377
  #t;
363
378
  #e;
@@ -464,7 +479,7 @@ class T {
464
479
  }
465
480
  pow(t) {
466
481
  this.factor.pow(t);
467
- const e = x.gcd(this.index, t);
482
+ const e = b.gcd(this.index, t);
468
483
  return this.index = this.index / e, this.radical.pow(t / e), this;
469
484
  }
470
485
  get radical() {
@@ -478,7 +493,7 @@ class T {
478
493
  const e = this.radical.denominator;
479
494
  this.radical.denominator = 1, this.radical.numerator *= e, this.factor.divide(e);
480
495
  }
481
- const t = x.greatestPower(this.radical.value, this.index);
496
+ const t = b.greatestPower(this.radical.value, this.index);
482
497
  return this.factor.multiply(Math.pow(t, 1 / this.index)), this.radical.divide(t), this;
483
498
  }
484
499
  root(t) {
@@ -492,7 +507,7 @@ class T {
492
507
  return this.add(e.opposite());
493
508
  }
494
509
  get value() {
495
- return x.numberCorrection(this.factor.value * Math.pow(this.radical.value, 1 / this.index));
510
+ return b.numberCorrection(this.factor.value * Math.pow(this.radical.value, 1 / this.index));
496
511
  }
497
512
  get withSign() {
498
513
  return this.#s = !0, this;
@@ -518,12 +533,14 @@ class T {
518
533
  return s.length === 0 ? null : s.join(" ");
519
534
  }
520
535
  #o(t) {
521
- const [e, i] = t.split("root"), [s, r] = i.split(")");
522
- return this.index = +Q(s), this.radical = new h(Q(r)), this.factor = e === "" ? new h().one() : new h(e), this;
536
+ const e = /^(.*?)root\((\d+)\)\(?([^)]+)/.exec(t);
537
+ if (!e) throw new Error(`Invalid root format: "${t}"`);
538
+ const [, i, s, r] = e;
539
+ return this.index = +s, this.radical = new h(r), this.factor = i === "" ? new h().one() : new h(i.trim()), this;
523
540
  }
524
541
  #a(t) {
525
542
  const [e, i] = t.split("sqrt");
526
- return this.index = 2, this.radical = new h(Q(i)), this.factor = e === "" ? new h().one() : new h(e), this;
543
+ return this.index = 2, this.radical = new h(j(i)), this.factor = e === "" ? new h().one() : new h(e), this;
527
544
  }
528
545
  }
529
546
  class C {
@@ -568,8 +585,8 @@ class C {
568
585
  if (a.isNegative())
569
586
  return [];
570
587
  if (a.isSquare()) {
571
- const m = a.sqrt(), d = r.clone().opposite().subtract(m).divide(s.clone().multiply(2)), y = r.clone().opposite().add(m).divide(s.clone().multiply(2));
572
- return m.isZero() ? [C.fromFraction(d)] : [C.fromFraction(d), C.fromFraction(y)];
588
+ const m = a.sqrt(), d = r.clone().opposite().subtract(m).divide(s.clone().multiply(2)), v = r.clone().opposite().add(m).divide(s.clone().multiply(2));
589
+ return m.isZero() ? [C.fromFraction(d)] : [C.fromFraction(d), C.fromFraction(v)];
573
590
  }
574
591
  const c = new C();
575
592
  c.fraction = r.clone().opposite().divide(s).divide(2), c.root = new T().from(2, a, s.clone().multiply(2).inverse().opposite()), c.setExact(!1);
@@ -619,11 +636,11 @@ class C {
619
636
  t !== void 0 && (this.#o = t);
620
637
  }
621
638
  }
622
- class Ut {
639
+ class jt {
623
640
  #t;
624
641
  #e;
625
642
  constructor(t) {
626
- t instanceof N || t instanceof b ? this.#t = new N(t) : this.#t = new N().fromPolynom(t), this.#e = this.#t.getRoots();
643
+ t instanceof N || t instanceof y ? this.#t = new N(t) : this.#t = new N().fromPolynom(t), this.#e = this.#t.getRoots();
627
644
  }
628
645
  get fx() {
629
646
  return this.#t;
@@ -689,8 +706,8 @@ class R {
689
706
  if (m === d)
690
707
  e.push(this.#r(m));
691
708
  else {
692
- const y = this.#o(t, m, d);
693
- y !== null && e.push(this.#s(y));
709
+ const v = this.#o(t, m, d);
710
+ v !== null && e.push(this.#s(v));
694
711
  }
695
712
  }), e;
696
713
  }
@@ -711,7 +728,7 @@ class R {
711
728
  #a(t, e, i) {
712
729
  const s = [], r = 2 * e / i;
713
730
  for (let o = -e; o <= e; o += r) {
714
- const a = x.numberCorrection(o);
731
+ const a = b.numberCorrection(o);
715
732
  s.push(
716
733
  {
717
734
  x: a,
@@ -736,13 +753,13 @@ class R {
736
753
  const s = t.monomByDegree().coefficient, r = t.monomByDegree(0).coefficient;
737
754
  if (r.isZero()) {
738
755
  e.push(this.#r(0));
739
- const d = t.monoms.reduce((q, $) => $.degree().value < q.degree().value ? $ : q), y = d.coefficient;
740
- d.clone().divide(y), t.divide(d);
756
+ const d = t.monoms.reduce((q, $) => $.degree().value < q.degree().value ? $ : q), v = d.coefficient;
757
+ d.clone().divide(v), t.divide(d);
741
758
  }
742
- const o = x.dividers(s.value), a = x.dividers(r.value), c = [];
759
+ const o = b.dividers(s.value), a = b.dividers(r.value), c = [];
743
760
  for (const d of o)
744
- for (const y of a) {
745
- const q = new h(y, d);
761
+ for (const v of a) {
762
+ const q = new h(v, d);
746
763
  c.find(($) => $.value === q.value) || (c.push(q.clone()), c.push(q.opposite().clone()));
747
764
  }
748
765
  c.forEach((d) => {
@@ -751,20 +768,20 @@ class R {
751
768
  for (const d of e) {
752
769
  if (d.isZero())
753
770
  continue;
754
- const y = t.clone().fromCoefficients(d.fraction.denominator, -d.fraction.numerator);
755
- for (d.count = 0; t.isDividableBy(y); )
756
- t.divide(y), d.count++;
771
+ const v = t.clone().fromCoefficients(d.fraction.denominator, -d.fraction.numerator);
772
+ for (d.count = 0; t.isDividableBy(v); )
773
+ t.divide(v), d.count++;
757
774
  }
758
775
  if (t.degree().isZero() || t.degree().value > 3)
759
- return e.sort((d, y) => d.value - y.value), { solutions: e, reminder: t };
776
+ return e.sort((d, v) => d.value - v.value), { solutions: e, reminder: t };
760
777
  const f = t.clone().zero(), m = new R(t, f, this.#i);
761
778
  return {
762
- solutions: e.concat(m.solve()).sort((d, y) => d.value - y.value),
779
+ solutions: e.concat(m.solve()).sort((d, v) => d.value - v.value),
763
780
  reminder: f
764
781
  };
765
782
  }
766
783
  #h() {
767
- const t = this.#e, e = t.monomByDegree(3).coefficient, i = t.monomByDegree(2).coefficient, s = t.monomByDegree(1).coefficient, r = t.monomByDegree(0).coefficient, o = i.clone().divide(e), a = s.clone().divide(e), c = r.clone().divide(e), f = a.clone().subtract(o.clone().pow(2).divide(3)), m = c.clone().subtract(o.clone().multiply(a).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), d = m.clone().opposite(), y = f.clone().opposite().pow(3).divide(27), q = d.clone().pow(2).subtract(y.clone().multiply(4)).opposite();
784
+ const t = this.#e, e = t.monomByDegree(3).coefficient, i = t.monomByDegree(2).coefficient, s = t.monomByDegree(1).coefficient, r = t.monomByDegree(0).coefficient, o = i.clone().divide(e), a = s.clone().divide(e), c = r.clone().divide(e), f = a.clone().subtract(o.clone().pow(2).divide(3)), m = c.clone().subtract(o.clone().multiply(a).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), d = m.clone().opposite(), v = f.clone().opposite().pow(3).divide(27), q = d.clone().pow(2).subtract(v.clone().multiply(4)).opposite();
768
785
  if (q.isNegative()) {
769
786
  const $ = m.clone().opposite().add(q.clone().opposite().sqrt()).divide(2).root(3), k = m.clone().opposite().subtract(q.clone().opposite().sqrt()).divide(2).root(3), I = $.clone().add(k).subtract(o.clone().divide(3));
770
787
  return [this.#r(I)];
@@ -774,13 +791,13 @@ class R {
774
791
  return k.isEqual(I) ? [this.#r(k)] : [
775
792
  this.#r(I),
776
793
  this.#r(k)
777
- ].sort((Y, M) => Y.value - M.value);
794
+ ].sort((Q, M) => Q.value - M.value);
778
795
  }
779
796
  if (q.isPositive()) {
780
- const $ = [], k = f.value, I = m.value, Y = o.value;
797
+ const $ = [], k = f.value, I = m.value, Q = o.value;
781
798
  for (let M = 0; M < 3; M++)
782
- $.push(2 * Math.sqrt(-k / 3) * Math.cos(Math.acos(3 * I / (2 * k) * Math.sqrt(-3 / k)) / 3 + 2 * Math.PI * M / 3) - Y / 3);
783
- return $.map((M) => this.#s(M)).sort((M, lt) => M.value - lt.value);
799
+ $.push(2 * Math.sqrt(-k / 3) * Math.cos(Math.acos(3 * I / (2 * k) * Math.sqrt(-3 / k)) / 3 + 2 * Math.PI * M / 3) - Q / 3);
800
+ return $.map((M) => this.#s(M)).sort((M, ut) => M.value - ut.value);
784
801
  }
785
802
  return [];
786
803
  }
@@ -816,105 +833,105 @@ class R {
816
833
  return o.fraction = e.clone().opposite().divide(s.clone()), o.root.radical = i.clone(), o.root.factor = new h().one().divide(s.clone()).opposite(), o.exact = !0, [r, o].sort((a, c) => a.value - c.value);
817
834
  }
818
835
  }
819
- const _ = {
836
+ const tt = {
820
837
  pi: Math.PI,
821
838
  e: Math.exp(1)
822
839
  };
823
- var l = /* @__PURE__ */ ((n) => (n.VARIABLE = "variable", n.COEFFICIENT = "coefficient", n.OPERATION = "operation", n.CONSTANT = "constant", n.FUNCTION = "function", n.FUNCTION_ARGUMENT = "function-argument", n.MONOM = "monom", n.LEFT_PARENTHESIS = "(", n.RIGHT_PARENTHESIS = ")", n))(l || {}), S = /* @__PURE__ */ ((n) => (n.EXPRESSION = "expression", n.POLYNOM = "polynom", n.SET = "set", n.NUMERIC = "numeric", n))(S || {});
824
- function bt(n, t) {
840
+ var u = /* @__PURE__ */ ((n) => (n.VARIABLE = "variable", n.COEFFICIENT = "coefficient", n.OPERATION = "operation", n.CONSTANT = "constant", n.FUNCTION = "function", n.FUNCTION_ARGUMENT = "function-argument", n.MONOM = "monom", n.LEFT_PARENTHESIS = "(", n.RIGHT_PARENTHESIS = ")", n))(u || {}), S = /* @__PURE__ */ ((n) => (n.EXPRESSION = "expression", n.POLYNOM = "polynom", n.SET = "set", n.NUMERIC = "numeric", n))(S || {});
841
+ function Et(n, t) {
825
842
  if (n.length <= 1)
826
843
  return n;
827
- const e = Object.keys(t).filter((d) => t[d].type === l.FUNCTION).map((d) => d);
828
- e.sort((d, y) => y.length - d.length);
829
- const i = new RegExp(`^(${e.join("|")})\\(`), s = Object.keys(_);
830
- s.sort((d, y) => y.length - d.length);
844
+ const e = Object.keys(t).filter((d) => t[d].type === u.FUNCTION).map((d) => d);
845
+ e.sort((d, v) => v.length - d.length);
846
+ const i = new RegExp(`^(${e.join("|")})\\(`), s = Object.keys(tt);
847
+ s.sort((d, v) => v.length - d.length);
831
848
  const r = new RegExp(`^(${s.join("|")})`), o = /^(\d+(\.\d+)?)/;
832
849
  let a = "", c, f, m;
833
850
  for (e.forEach((d) => {
834
851
  if (n.includes(d)) {
835
- const y = new RegExp(`${d}([0-9.]+)`, "g");
836
- n = n.replaceAll(y, `${d}($1)`);
852
+ const v = new RegExp(`${d}([0-9.]+)`, "g");
853
+ n = n.replaceAll(v, `${d}($1)`);
837
854
  }
838
855
  }); n.length > 0; ) {
839
856
  if (c = f, m = void 0, e.length > 0 && i.exec(n)) {
840
- const d = e.find((y) => n.startsWith(y));
841
- d && (m = d + "(", n = n.slice(d.length + 1), f = l.FUNCTION);
857
+ const d = e.find((v) => n.startsWith(v));
858
+ d && (m = d + "(", n = n.slice(d.length + 1), f = u.FUNCTION);
842
859
  } else if (s.length > 0 && r.exec(n)) {
843
- const d = s.find((y) => n.startsWith(y));
844
- d && (m = d, n = n.slice(d.length), f = l.CONSTANT);
860
+ const d = s.find((v) => n.startsWith(v));
861
+ d && (m = d, n = n.slice(d.length), f = u.CONSTANT);
845
862
  } else if (o.exec(n)) {
846
863
  const d = o.exec(n);
847
- d && (m = d[0], n = n.slice(d[0].length), f = l.COEFFICIENT);
864
+ d && (m = d[0], n = n.slice(d[0].length), f = u.COEFFICIENT);
848
865
  } else
849
866
  switch (m = n[0], n = n.slice(1), m) {
850
867
  case "(":
851
- f = l.LEFT_PARENTHESIS;
868
+ f = u.LEFT_PARENTHESIS;
852
869
  break;
853
870
  case ")":
854
- f = l.RIGHT_PARENTHESIS;
871
+ f = u.RIGHT_PARENTHESIS;
855
872
  break;
856
873
  case ",":
857
- f = l.FUNCTION_ARGUMENT;
874
+ f = u.FUNCTION_ARGUMENT;
858
875
  break;
859
876
  case "+":
860
877
  case "-":
861
878
  case "*":
862
879
  case "/":
863
880
  case "^":
864
- f = l.OPERATION;
881
+ f = u.OPERATION;
865
882
  break;
866
883
  default:
867
- f = l.VARIABLE;
884
+ f = u.VARIABLE;
868
885
  }
869
886
  if (m === void 0 || f === void 0)
870
887
  throw new Error("The token is undefined");
871
- a += Et(c, f), a += m;
888
+ a += Nt(c, f), a += m;
872
889
  }
873
890
  return a;
874
891
  }
875
- function Et(n, t) {
876
- return n === void 0 || n === l.OPERATION || t === l.OPERATION || n === l.LEFT_PARENTHESIS || n === l.FUNCTION || n === l.FUNCTION_ARGUMENT || t === l.RIGHT_PARENTHESIS || t === l.FUNCTION_ARGUMENT ? "" : "*";
892
+ function Nt(n, t) {
893
+ return n === void 0 || n === u.OPERATION || t === u.OPERATION || n === u.LEFT_PARENTHESIS || n === u.FUNCTION || n === u.FUNCTION_ARGUMENT || t === u.RIGHT_PARENTHESIS || t === u.FUNCTION_ARGUMENT ? "" : "*";
877
894
  }
878
- const Nt = {
879
- "^": { precedence: 4, associative: "right", type: l.OPERATION },
880
- "*": { precedence: 3, associative: "left", type: l.OPERATION },
881
- "/": { precedence: 3, associative: "left", type: l.OPERATION },
882
- "+": { precedence: 2, associative: "left", type: l.OPERATION },
883
- "-": { precedence: 2, associative: "left", type: l.OPERATION }
884
- }, At = {
885
- "^": { precedence: 4, associative: "right", type: l.OPERATION },
886
- "*": { precedence: 3, associative: "left", type: l.OPERATION },
887
- "/": { precedence: 3, associative: "left", type: l.OPERATION },
888
- "+": { precedence: 2, associative: "left", type: l.OPERATION },
889
- "-": { precedence: 2, associative: "left", type: l.OPERATION },
890
- "%": { precedence: 3, associative: "right", type: l.OPERATION },
891
- sin: { precedence: 4, associative: "right", type: l.FUNCTION },
892
- cos: { precedence: 4, associative: "right", type: l.FUNCTION },
893
- tan: { precedence: 4, associative: "right", type: l.FUNCTION },
894
- sqrt: { precedence: 4, associative: "right", type: l.FUNCTION },
895
- nthrt: { precedence: 4, associative: "right", type: l.FUNCTION },
896
- ",": { precedence: 2, associative: "left", type: l.FUNCTION_ARGUMENT }
895
+ const At = {
896
+ "^": { precedence: 4, associative: "right", type: u.OPERATION },
897
+ "*": { precedence: 3, associative: "left", type: u.OPERATION },
898
+ "/": { precedence: 3, associative: "left", type: u.OPERATION },
899
+ "+": { precedence: 2, associative: "left", type: u.OPERATION },
900
+ "-": { precedence: 2, associative: "left", type: u.OPERATION }
897
901
  }, Tt = {
898
- "^": { precedence: 4, associative: "right", type: l.OPERATION },
899
- "*": { precedence: 3, associative: "left", type: l.OPERATION },
900
- "/": { precedence: 3, associative: "left", type: l.OPERATION },
901
- "+": { precedence: 2, associative: "left", type: l.OPERATION },
902
- "-": { precedence: 2, associative: "left", type: l.OPERATION },
903
- "%": { precedence: 3, associative: "right", type: l.OPERATION },
904
- sin: { precedence: 4, associative: "right", type: l.FUNCTION },
905
- cos: { precedence: 4, associative: "right", type: l.FUNCTION },
906
- tan: { precedence: 4, associative: "right", type: l.FUNCTION },
907
- sqrt: { precedence: 4, associative: "right", type: l.FUNCTION },
908
- nthrt: { precedence: 4, associative: "right", type: l.FUNCTION },
909
- ln: { precedence: 4, associative: "right", type: l.FUNCTION },
910
- log: { precedence: 4, associative: "right", type: l.FUNCTION }
902
+ "^": { precedence: 4, associative: "right", type: u.OPERATION },
903
+ "*": { precedence: 3, associative: "left", type: u.OPERATION },
904
+ "/": { precedence: 3, associative: "left", type: u.OPERATION },
905
+ "+": { precedence: 2, associative: "left", type: u.OPERATION },
906
+ "-": { precedence: 2, associative: "left", type: u.OPERATION },
907
+ "%": { precedence: 3, associative: "right", type: u.OPERATION },
908
+ sin: { precedence: 4, associative: "right", type: u.FUNCTION },
909
+ cos: { precedence: 4, associative: "right", type: u.FUNCTION },
910
+ tan: { precedence: 4, associative: "right", type: u.FUNCTION },
911
+ sqrt: { precedence: 4, associative: "right", type: u.FUNCTION },
912
+ nthrt: { precedence: 4, associative: "right", type: u.FUNCTION },
913
+ ",": { precedence: 2, associative: "left", type: u.FUNCTION_ARGUMENT }
911
914
  }, Ot = {
912
- "&": { precedence: 3, associative: "left", type: l.OPERATION },
913
- "|": { precedence: 3, associative: "left", type: l.OPERATION },
914
- "!": { precedence: 4, associative: "right", type: l.OPERATION },
915
- "-": { precedence: 2, associative: "left", type: l.OPERATION }
915
+ "^": { precedence: 4, associative: "right", type: u.OPERATION },
916
+ "*": { precedence: 3, associative: "left", type: u.OPERATION },
917
+ "/": { precedence: 3, associative: "left", type: u.OPERATION },
918
+ "+": { precedence: 2, associative: "left", type: u.OPERATION },
919
+ "-": { precedence: 2, associative: "left", type: u.OPERATION },
920
+ "%": { precedence: 3, associative: "right", type: u.OPERATION },
921
+ sin: { precedence: 4, associative: "right", type: u.FUNCTION },
922
+ cos: { precedence: 4, associative: "right", type: u.FUNCTION },
923
+ tan: { precedence: 4, associative: "right", type: u.FUNCTION },
924
+ sqrt: { precedence: 4, associative: "right", type: u.FUNCTION },
925
+ nthrt: { precedence: 4, associative: "right", type: u.FUNCTION },
926
+ ln: { precedence: 4, associative: "right", type: u.FUNCTION },
927
+ log: { precedence: 4, associative: "right", type: u.FUNCTION }
928
+ }, Ct = {
929
+ "&": { precedence: 3, associative: "left", type: u.OPERATION },
930
+ "|": { precedence: 3, associative: "left", type: u.OPERATION },
931
+ "!": { precedence: 4, associative: "right", type: u.OPERATION },
932
+ "-": { precedence: 2, associative: "left", type: u.OPERATION }
916
933
  };
917
- class G {
934
+ class W {
918
935
  #t;
919
936
  #e = [];
920
937
  #i = {};
@@ -931,7 +948,7 @@ class G {
931
948
  return this.#e.map((t) => t.token);
932
949
  }
933
950
  tokenConfigInitialization() {
934
- return this.#t === S.SET ? (this.#i = Ot, this.#r = !1) : this.#t === S.NUMERIC ? (this.#i = Tt, this.#r = !0) : this.#t === S.EXPRESSION ? (this.#i = At, this.#r = !0) : (this.#i = Nt, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
951
+ return this.#t === S.SET ? (this.#i = Ct, this.#r = !1) : this.#t === S.NUMERIC ? (this.#i = Ot, this.#r = !0) : this.#t === S.EXPRESSION ? (this.#i = Tt, this.#r = !0) : (this.#i = At, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
935
952
  }
936
953
  /**
937
954
  * Get the next token to analyse.
@@ -941,31 +958,31 @@ class G {
941
958
  NextToken(t, e) {
942
959
  let i, s;
943
960
  if (i = "", s = void 0, t[e] === "(")
944
- i = "(", s = l.LEFT_PARENTHESIS;
961
+ i = "(", s = u.LEFT_PARENTHESIS;
945
962
  else if (t[e] === ")")
946
- i = ")", s = l.RIGHT_PARENTHESIS;
963
+ i = ")", s = u.RIGHT_PARENTHESIS;
947
964
  else if (t[e] === ",")
948
- i = ",", s = l.FUNCTION_ARGUMENT;
965
+ i = ",", s = u.FUNCTION_ARGUMENT;
949
966
  else {
950
967
  for (const r of this.#s)
951
968
  if (t.substring(e, e + r.length) === r) {
952
969
  i += r, s = this.#i[r].type;
953
970
  break;
954
971
  }
955
- for (const r in _)
972
+ for (const r in tt)
956
973
  if (t.substring(e, e + r.length) === r) {
957
- i += r, s = l.CONSTANT;
974
+ i += r, s = u.CONSTANT;
958
975
  break;
959
976
  }
960
977
  if (i === "")
961
978
  if (/[0-9.]/.exec(t[e])) {
962
979
  const r = /^([0-9.]+)/.exec(t.substring(e));
963
- i = r ? r[0] : "", s = l.COEFFICIENT;
980
+ i = r ? r[0] : "", s = u.COEFFICIENT;
964
981
  } else if (/[a-zA-Z]/.exec(t[e])) {
965
982
  const r = /^([a-zA-Z])/.exec(t.substring(e));
966
- i = r ? r[0] : "", s = l.VARIABLE;
983
+ i = r ? r[0] : "", s = u.VARIABLE;
967
984
  } else
968
- console.log("Unidentified token", t[e], t, e), i = t[e], s = l.MONOM;
985
+ console.log("Unidentified token", t[e], t, e), i = t[e], s = u.MONOM;
969
986
  }
970
987
  if (s === void 0)
971
988
  throw new Error(`Token type is undefined for token ${i}`);
@@ -980,7 +997,7 @@ class G {
980
997
  parse(t, e) {
981
998
  const i = [], s = [];
982
999
  let r = "", o = 0, a;
983
- (e ?? this.#r) && (t = bt(t, this.#i));
1000
+ (e ?? this.#r) && (t = Et(t, this.#i));
984
1001
  let c = 50, f;
985
1002
  for (; o < t.length; ) {
986
1003
  if (c--, c === 0) {
@@ -988,16 +1005,16 @@ class G {
988
1005
  break;
989
1006
  }
990
1007
  switch ([r, o, a] = this.NextToken(t, o), a) {
991
- case l.MONOM:
992
- case l.COEFFICIENT:
993
- case l.VARIABLE:
994
- case l.CONSTANT:
1008
+ case u.MONOM:
1009
+ case u.COEFFICIENT:
1010
+ case u.VARIABLE:
1011
+ case u.CONSTANT:
995
1012
  i.push({
996
1013
  token: r,
997
1014
  tokenType: a
998
1015
  });
999
1016
  break;
1000
- case l.OPERATION:
1017
+ case u.OPERATION:
1001
1018
  if (s.length > 0) {
1002
1019
  let m = s[s.length - 1];
1003
1020
  for (f = 50; m.token in this.#i && //either o1 is left-associative and its precedence is less than or equal to that of o2,
@@ -1007,14 +1024,14 @@ class G {
1007
1024
  console.log("SECURITY LEVEL 2 OPERATION EXIT");
1008
1025
  break;
1009
1026
  }
1010
- if (i.push(s.pop() ?? { token: "", tokenType: l.OPERATION }), s.length === 0)
1027
+ if (i.push(s.pop() ?? { token: "", tokenType: u.OPERATION }), s.length === 0)
1011
1028
  break;
1012
1029
  m = s[s.length - 1];
1013
1030
  }
1014
1031
  }
1015
1032
  s.push({ token: r, tokenType: a });
1016
1033
  break;
1017
- case l.FUNCTION_ARGUMENT:
1034
+ case u.FUNCTION_ARGUMENT:
1018
1035
  for (f = 50; s[s.length - 1].token !== "(" && s.length > 0; ) {
1019
1036
  if (f--, f === 0) {
1020
1037
  console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");
@@ -1023,10 +1040,10 @@ class G {
1023
1040
  i.push(s.pop() ?? { token: r, tokenType: a });
1024
1041
  }
1025
1042
  break;
1026
- case l.LEFT_PARENTHESIS:
1027
- s.push({ token: r, tokenType: a }), t[o] === "-" && i.push({ token: "0", tokenType: l.COEFFICIENT });
1043
+ case u.LEFT_PARENTHESIS:
1044
+ s.push({ token: r, tokenType: a }), t[o] === "-" && i.push({ token: "0", tokenType: u.COEFFICIENT });
1028
1045
  break;
1029
- case l.RIGHT_PARENTHESIS:
1046
+ case u.RIGHT_PARENTHESIS:
1030
1047
  for (f = 50; s[s.length - 1].token !== "(" && s.length > 1; ) {
1031
1048
  if (f--, f === 0) {
1032
1049
  console.log("SECURITY LEVEL 2 CLOSING PARENTHESIS EXIT");
@@ -1036,7 +1053,7 @@ class G {
1036
1053
  }
1037
1054
  s.pop();
1038
1055
  break;
1039
- case l.FUNCTION:
1056
+ case u.FUNCTION:
1040
1057
  s.push({ token: r, tokenType: a });
1041
1058
  break;
1042
1059
  default:
@@ -1046,14 +1063,14 @@ class G {
1046
1063
  return this.#e = i.concat(s.reverse()), this;
1047
1064
  }
1048
1065
  }
1049
- class Ct {
1066
+ class qt {
1050
1067
  _rpn;
1051
1068
  _expression;
1052
1069
  _isValid;
1053
1070
  constructor(t, e) {
1054
1071
  this._expression = t;
1055
1072
  try {
1056
- this._rpn = new G(S.NUMERIC).parse(t, e).rpn;
1073
+ this._rpn = new W(S.NUMERIC).parse(t, e).rpn;
1057
1074
  } catch (i) {
1058
1075
  throw this._rpn = null, this._isValid = !1, console.warn(i), new Error(`There was a problem parsing: ${t}`);
1059
1076
  }
@@ -1082,7 +1099,7 @@ class Ct {
1082
1099
  return this._isValid = !1, 0;
1083
1100
  this._isValid = !0;
1084
1101
  for (const i of this._rpn)
1085
- if (i.tokenType === l.COEFFICIENT)
1102
+ if (i.tokenType === u.COEFFICIENT)
1086
1103
  if (!isNaN(+i.token))
1087
1104
  e.push(+i.token);
1088
1105
  else {
@@ -1091,11 +1108,11 @@ class Ct {
1091
1108
  throw this._isValid = !1, new Error("This coefficient is not a fraction");
1092
1109
  e.push(+s[0] / +s[1]);
1093
1110
  }
1094
- else if (i.tokenType === l.VARIABLE && t !== void 0)
1111
+ else if (i.tokenType === u.VARIABLE && t !== void 0)
1095
1112
  Object.hasOwn(t, i.token) && e.push(+t[i.token]);
1096
- else if (i.tokenType === l.CONSTANT)
1097
- e.push(_[i.token]);
1098
- else if (i.tokenType === l.OPERATION) {
1113
+ else if (i.tokenType === u.CONSTANT)
1114
+ e.push(tt[i.token]);
1115
+ else if (i.tokenType === u.OPERATION) {
1099
1116
  if (i.token === "*") {
1100
1117
  const s = e.pop(), r = e.pop();
1101
1118
  if (r === void 0 || s === void 0)
@@ -1122,7 +1139,7 @@ class Ct {
1122
1139
  throw this._isValid = !1, new Error(`The base value ${r ?? "a"} or exponent ${s ?? "b"} are not defined`);
1123
1140
  e.push(Math.pow(r, s));
1124
1141
  }
1125
- } else if (i.tokenType === l.FUNCTION) {
1142
+ } else if (i.tokenType === u.FUNCTION) {
1126
1143
  const s = e.pop();
1127
1144
  if (s === void 0)
1128
1145
  throw this._isValid = !1, new Error(`The parameters for ${i.token} is not defined`);
@@ -1190,7 +1207,7 @@ class p {
1190
1207
  for (const r of t)
1191
1208
  if (r.containsRationalPower())
1192
1209
  return new p().zero();
1193
- const e = new p(), i = x.gcd(...t.map((r) => r.coefficient.numerator)), s = x.lcm(...t.map((r) => r.coefficient.denominator));
1210
+ const e = new p(), i = b.gcd(...t.map((r) => r.coefficient.numerator)), s = b.lcm(...t.map((r) => r.coefficient.denominator));
1194
1211
  e.coefficient = new h(i, s).reduce();
1195
1212
  for (const r of t) {
1196
1213
  for (const o in e.literal)
@@ -1275,7 +1292,7 @@ class p {
1275
1292
  return [this.clone()];
1276
1293
  if (this.coefficient.numerator > 1e6)
1277
1294
  return [this.clone()];
1278
- const t = x.dividers(Math.abs(this.coefficient.numerator));
1295
+ const t = b.dividers(Math.abs(this.coefficient.numerator));
1279
1296
  let e = [];
1280
1297
  for (const s in this.literal)
1281
1298
  e = this.#n(e, s);
@@ -1568,12 +1585,12 @@ class p {
1568
1585
  }
1569
1586
  #o = (t, e) => {
1570
1587
  let i, s, r, o, a;
1571
- if (e.tokenType === l.COEFFICIENT)
1588
+ if (e.tokenType === u.COEFFICIENT)
1572
1589
  t.push(new p(new h(e.token)));
1573
- else if (e.tokenType === l.VARIABLE) {
1590
+ else if (e.tokenType === u.VARIABLE) {
1574
1591
  const c = new p().one();
1575
1592
  c.setLetter(e.token, 1), t.push(c.clone());
1576
- } else if (e.tokenType === l.OPERATION)
1593
+ } else if (e.tokenType === u.OPERATION)
1577
1594
  switch (e.token) {
1578
1595
  case "-":
1579
1596
  s = t.pop() ?? new p().zero(), i = t.pop() ?? new p().zero(), t.push(i.subtract(s));
@@ -1591,19 +1608,19 @@ class p {
1591
1608
  }
1592
1609
  };
1593
1610
  #a = (t) => {
1594
- const i = new G().parse(t).rpn, s = [];
1611
+ const i = new W().parse(t).rpn, s = [];
1595
1612
  if (i.length === 0)
1596
1613
  return this.zero(), this;
1597
1614
  if (i.length === 1) {
1598
1615
  const r = i[0];
1599
- return this.one(), r.tokenType === l.COEFFICIENT ? this.coefficient = new h(r.token) : r.tokenType === l.VARIABLE && this.setLetter(r.token, 1), this;
1616
+ return this.one(), r.tokenType === u.COEFFICIENT ? this.coefficient = new h(r.token) : r.tokenType === u.VARIABLE && this.setLetter(r.token, 1), this;
1600
1617
  } else
1601
1618
  for (const r of i)
1602
1619
  this.#o(s, r);
1603
1620
  return this.one(), this.multiply(s[0]), this;
1604
1621
  };
1605
1622
  }
1606
- function rt(n, t) {
1623
+ function nt(n, t) {
1607
1624
  if (!Number.isSafeInteger(t))
1608
1625
  throw new Error("Can only raise item by an integer");
1609
1626
  if (t < 0)
@@ -1615,7 +1632,7 @@ function rt(n, t) {
1615
1632
  n.multiply(e);
1616
1633
  return n;
1617
1634
  }
1618
- class u {
1635
+ class l {
1619
1636
  #t = "x";
1620
1637
  #e;
1621
1638
  #i;
@@ -1638,7 +1655,7 @@ class u {
1638
1655
  this.#i.push(new p(t)), e.forEach((i) => {
1639
1656
  this.#i.push(new p(i));
1640
1657
  });
1641
- else if (t instanceof u)
1658
+ else if (t instanceof l)
1642
1659
  for (const i of t.monoms)
1643
1660
  this.#i.push(i.clone());
1644
1661
  return this;
@@ -1647,7 +1664,7 @@ class u {
1647
1664
  * Clone the polynom
1648
1665
  */
1649
1666
  clone() {
1650
- const t = new u(), e = [];
1667
+ const t = new l(), e = [];
1651
1668
  t.#t = this.#t;
1652
1669
  for (const i of this.#i)
1653
1670
  e.push(i.clone());
@@ -1660,14 +1677,14 @@ class u {
1660
1677
  return this.#l();
1661
1678
  }
1662
1679
  static xMultiply(...t) {
1663
- const e = new u().one();
1680
+ const e = new l().one();
1664
1681
  return t.forEach((i) => {
1665
1682
  e.multiply(i);
1666
1683
  }), e;
1667
1684
  }
1668
1685
  add(...t) {
1669
1686
  for (const e of t)
1670
- e instanceof u ? this.#i = this.#i.concat(e.monoms.map((i) => i.clone())) : e instanceof p ? this.#i.push(e.clone()) : typeof e == "number" && Number.isSafeInteger(e) ? this.#i.push(new p(e.toString())) : this.#i.push(new p(e));
1687
+ e instanceof l ? this.#i = this.#i.concat(e.monoms.map((i) => i.clone())) : e instanceof p ? this.#i.push(e.clone()) : typeof e == "number" && Number.isSafeInteger(e) ? this.#i.push(new p(e.toString())) : this.#i.push(new p(e));
1671
1688
  return this.reduce();
1672
1689
  }
1673
1690
  commonMonom() {
@@ -1688,7 +1705,7 @@ class u {
1688
1705
  return e;
1689
1706
  }
1690
1707
  derivative(t) {
1691
- const e = new u();
1708
+ const e = new l();
1692
1709
  for (const i of this.#i)
1693
1710
  e.add(i.derivative(t));
1694
1711
  return e.reduce();
@@ -1699,8 +1716,8 @@ class u {
1699
1716
  if (typeof t == "number" && Number.isSafeInteger(t))
1700
1717
  return this.#a(t);
1701
1718
  if (t instanceof p)
1702
- return this.divide(new u(t));
1703
- if (t instanceof u) {
1719
+ return this.divide(new l(t));
1720
+ if (t instanceof l) {
1704
1721
  if (t.monoms.length === 1 && t.variables.length === 0)
1705
1722
  return this.#o(t.monoms[0].coefficient);
1706
1723
  {
@@ -1709,7 +1726,7 @@ class u {
1709
1726
  return this.#i = e.monoms, this.#h(), this;
1710
1727
  }
1711
1728
  } else if (typeof t == "string")
1712
- return this.divide(new u(t));
1729
+ return this.divide(new l(t));
1713
1730
  throw new Error(`Cannot divide by ${t}`);
1714
1731
  }
1715
1732
  empty() {
@@ -1721,11 +1738,11 @@ class u {
1721
1738
  * returns {quotient: Polynom, reminder: Polynom}
1722
1739
  */
1723
1740
  euclidean(t) {
1724
- const e = t.variables[0], i = new u().zero(), s = this.clone().reorder(e);
1741
+ const e = t.variables[0], i = new l().zero(), s = this.clone().reorder(e);
1725
1742
  if (t.variables.length === 0)
1726
1743
  return {
1727
1744
  quotient: this.clone().divide(t).reduce(),
1728
- reminder: new u().zero()
1745
+ reminder: new l().zero()
1729
1746
  };
1730
1747
  if (!this.degree(e).isNatural() || !t.degree(e).isNatural())
1731
1748
  throw new Error("Euclidean division requires integer degrees");
@@ -1750,19 +1767,19 @@ class u {
1750
1767
  * TODO: Handle other letter than 'x'.
1751
1768
  */
1752
1769
  factorize(t) {
1753
- this.#e = [];
1770
+ if (this.#e = [], this.monoms.length === 1) return [this.clone()];
1754
1771
  let e = this.clone().reorder();
1755
1772
  const i = e.commonMonom();
1756
- e.monomByDegree().coefficient.isStrictlyNegative() && i.opposite(), i.isOne() || (this.#e.push(new u(i)), e = e.euclidean(this.#e[0]).quotient);
1773
+ e.monomByDegree().coefficient.isStrictlyNegative() && i.opposite(), i.isOne() || (this.#e.push(new l(i)), e = e.euclidean(this.#e[0]).quotient);
1757
1774
  const s = new R(e).solve();
1758
1775
  if (s.length === 0)
1759
1776
  return this.#e.length === 0 ? this.#e = [this.clone()] : this.#e.push(e), this.#e;
1760
1777
  if (s.forEach((o) => {
1761
1778
  if (o.exact && o.root.isZero())
1762
1779
  for (let a = 0; a < o.count; a++)
1763
- o.fraction.isRational() ? this.#e.push(new u().fromCoefficients(o.fraction.denominator, -o.fraction.numerator)) : this.#e.push(new u().fromCoefficients(1, o.fraction.clone().opposite()));
1780
+ o.fraction.isRational() ? this.#e.push(new l().fromCoefficients(o.fraction.denominator, -o.fraction.numerator)) : this.#e.push(new l().fromCoefficients(1, o.fraction.clone().opposite()));
1764
1781
  }), this.#e.map((o) => o.degree().value).reduce((o, a) => o + a, 0) < this.degree().value) {
1765
- const o = u.xMultiply(...this.#e);
1782
+ const o = l.xMultiply(...this.#e);
1766
1783
  this.#e.push(this.clone().divide(o));
1767
1784
  }
1768
1785
  return this.#e;
@@ -1779,10 +1796,10 @@ class u {
1779
1796
  }), this.#h(), this.reorder();
1780
1797
  }
1781
1798
  gcdDenominator() {
1782
- return x.gcd(...this.getDenominators());
1799
+ return b.gcd(...this.getDenominators());
1783
1800
  }
1784
1801
  gcdNumerator() {
1785
- return x.gcd(...this.getNumerators());
1802
+ return b.gcd(...this.getNumerators());
1786
1803
  }
1787
1804
  getCoefficients() {
1788
1805
  if (!this.degree().isNatural())
@@ -1824,7 +1841,7 @@ class u {
1824
1841
  if (i.includes("(") || i.includes(")"))
1825
1842
  return !1;
1826
1843
  try {
1827
- e = new u(t);
1844
+ e = new l(t);
1828
1845
  } catch {
1829
1846
  return !1;
1830
1847
  }
@@ -1858,10 +1875,10 @@ class u {
1858
1875
  return this.#i.length === 1 && this.#i[0].coefficient.isZero() || this.#i.length === 0;
1859
1876
  }
1860
1877
  lcmDenominator() {
1861
- return x.lcm(...this.getDenominators());
1878
+ return b.lcm(...this.getDenominators());
1862
1879
  }
1863
1880
  lcmNumerator() {
1864
- return x.lcm(...this.getNumerators());
1881
+ return b.lcm(...this.getNumerators());
1865
1882
  }
1866
1883
  get length() {
1867
1884
  return this.#i.length;
@@ -1908,7 +1925,7 @@ class u {
1908
1925
  return i;
1909
1926
  }
1910
1927
  multiply(t) {
1911
- if (t instanceof u)
1928
+ if (t instanceof l)
1912
1929
  return this.#p(t);
1913
1930
  if (t instanceof h)
1914
1931
  return this.#u(t);
@@ -1939,10 +1956,10 @@ class u {
1939
1956
  return this.#l("tex", !1, !1, !0);
1940
1957
  }
1941
1958
  pow(t) {
1942
- return rt(this, t).reduce();
1959
+ return nt(this, t).reduce();
1943
1960
  }
1944
1961
  primitive(t) {
1945
- const e = new u();
1962
+ const e = new l();
1946
1963
  for (const i of this.#i)
1947
1964
  e.add(i.primitive(t));
1948
1965
  return e;
@@ -1981,7 +1998,7 @@ class u {
1981
1998
  */
1982
1999
  replaceBy(t, e) {
1983
2000
  let i;
1984
- const s = new u().zero();
2001
+ const s = new l().zero();
1985
2002
  for (const r of this.monoms)
1986
2003
  if (!r.hasVariable(t) || r.literal[t].isZero())
1987
2004
  s.add(r.clone());
@@ -2010,7 +2027,7 @@ class u {
2010
2027
  }
2011
2028
  subtract(...t) {
2012
2029
  for (const e of t)
2013
- e instanceof u ? this.add(e.clone().opposite()) : e instanceof p ? this.#i.push(e.clone().opposite()) : this.#i.push(new p(e).opposite());
2030
+ e instanceof l ? this.add(e.clone().opposite()) : e instanceof p ? this.#i.push(e.clone().opposite()) : this.#i.push(new p(e).opposite());
2014
2031
  return this.reduce();
2015
2032
  }
2016
2033
  tableOfSigns() {
@@ -2018,7 +2035,7 @@ class u {
2018
2035
  let e = new Array(2 * t.length + 1).fill("").map((i, s) => s % 2 === 0 ? "" : "z");
2019
2036
  if (e.length === 1) {
2020
2037
  const [i] = this.getCoefficients().map((s) => s.value);
2021
- e = j(e, "", i > 0 ? "+" : "-");
2038
+ e = F(e, "", i > 0 ? "+" : "-");
2022
2039
  } else if (this.degree().isOne()) {
2023
2040
  const [i] = this.getCoefficients().map((s) => s.value);
2024
2041
  e[0] = i > 0 ? "-" : "+", e[1] = "z", e[2] = i > 0 ? "+" : "-";
@@ -2144,15 +2161,15 @@ class u {
2144
2161
  }
2145
2162
  #g(t, e) {
2146
2163
  switch (e.tokenType) {
2147
- case l.COEFFICIENT:
2148
- t.push(new u(e.token));
2164
+ case u.COEFFICIENT:
2165
+ t.push(new l(e.token));
2149
2166
  break;
2150
- case l.VARIABLE:
2151
- t.push(new u().add(new p(e.token)));
2167
+ case u.VARIABLE:
2168
+ t.push(new l().add(new p(e.token)));
2152
2169
  break;
2153
- case l.CONSTANT:
2170
+ case u.CONSTANT:
2154
2171
  throw new Error("Unsupported CONSTANT token in Polynom parser");
2155
- case l.OPERATION:
2172
+ case u.OPERATION:
2156
2173
  if (t.length >= 2) {
2157
2174
  const i = t.pop(), s = t.pop();
2158
2175
  if (s === void 0 || i === void 0)
@@ -2185,9 +2202,9 @@ class u {
2185
2202
  } else
2186
2203
  throw new Error("Error parsing the polynom");
2187
2204
  break;
2188
- case l.MONOM:
2205
+ case u.MONOM:
2189
2206
  throw new Error("Unexpected MONOM token in polynom parser");
2190
- case l.FUNCTION:
2207
+ case u.FUNCTION:
2191
2208
  throw new Error(`Unsupported function token "${e.token}" in polynom parser`);
2192
2209
  }
2193
2210
  }
@@ -2196,7 +2213,7 @@ class u {
2196
2213
  * @param inputStr
2197
2214
  */
2198
2215
  #w(t) {
2199
- const i = new G().parse(t).rpn;
2216
+ const i = new W().parse(t).rpn;
2200
2217
  this.zero();
2201
2218
  const s = [];
2202
2219
  for (const r of i)
@@ -2204,7 +2221,7 @@ class u {
2204
2221
  return s.length === 1 && this.add(s[0]), this.reorder();
2205
2222
  }
2206
2223
  }
2207
- class v {
2224
+ class x {
2208
2225
  // Left part of the equation
2209
2226
  #t;
2210
2227
  // Right part of the equation
@@ -2212,11 +2229,11 @@ class v {
2212
2229
  // Signe of the equation
2213
2230
  #i;
2214
2231
  constructor(t, e, i) {
2215
- if (this.#t = new u().zero(), this.#e = new u().zero(), this.#i = "=", t !== void 0 && e === void 0) {
2216
- if (t instanceof v)
2232
+ if (this.#t = new l().zero(), this.#e = new l().zero(), this.#i = "=", t !== void 0 && e === void 0) {
2233
+ if (t instanceof x)
2217
2234
  return t.clone();
2218
2235
  typeof t == "string" && this.parse(t);
2219
- } else t !== void 0 && e !== void 0 && (this.left = new u(t), this.right = new u(e));
2236
+ } else t !== void 0 && e !== void 0 && (this.left = new l(t), this.right = new l(e));
2220
2237
  return i !== void 0 && (this.sign = i), this;
2221
2238
  }
2222
2239
  // ------------------------------------------
@@ -2225,9 +2242,9 @@ class v {
2225
2242
  if (e === !1)
2226
2243
  throw new Error("The equation is not valid (no sign found)");
2227
2244
  const i = t.split(e);
2228
- return this.create(new u(i[0]), new u(i[1]), this.#r(e));
2245
+ return this.create(new l(i[0]), new l(i[1]), this.#r(e));
2229
2246
  };
2230
- clone = () => new v(this.#t.clone(), this.#e.clone(), this.#i);
2247
+ clone = () => new x(this.#t.clone(), this.#e.clone(), this.#i);
2231
2248
  get tex() {
2232
2249
  return `${this.#t.tex}${this.signAsTex}${this.#e.tex}`;
2233
2250
  }
@@ -2250,11 +2267,11 @@ class v {
2250
2267
  * @param value | Polynom | Monom | Fraction | string | monom
2251
2268
  */
2252
2269
  add(t) {
2253
- if (t instanceof v)
2270
+ if (t instanceof x)
2254
2271
  return this.#t.add(t.left), this.#e.add(t.right), this;
2255
- if (typeof t == "string" && !v.isEquationString(t))
2256
- return this.add(new v(t));
2257
- const e = new u(t);
2272
+ if (typeof t == "string" && !x.isEquationString(t))
2273
+ return this.add(new x(t));
2274
+ const e = new l(t);
2258
2275
  return this.#t.add(e), this.#e.add(e), this;
2259
2276
  }
2260
2277
  create = (t, e, i) => (this.#t = t, this.#e = e, this.#i = this.#r(i ?? "="), this);
@@ -2298,7 +2315,7 @@ class v {
2298
2315
  */
2299
2316
  hasVariable = (t) => this.variables.includes(t);
2300
2317
  isEqual(t) {
2301
- const e = new v(t);
2318
+ const e = new x(t);
2302
2319
  return e.left.isEqual(this.#t) && e.right.isEqual(this.#e);
2303
2320
  }
2304
2321
  // -----------------------------------------------
@@ -2390,18 +2407,18 @@ class v {
2390
2407
  /**
2391
2408
  * Multiply by the lcm denominator and divide by the gcm numerators.
2392
2409
  */
2393
- simplify = () => (this.multiply(x.lcm(...this.#t.getDenominators(), ...this.#e.getDenominators())), this.divide(x.gcd(...this.#t.getNumerators(), ...this.#e.getNumerators())), this);
2410
+ simplify = () => (this.multiply(b.lcm(...this.#t.getDenominators(), ...this.#e.getDenominators())), this.divide(b.gcd(...this.#t.getNumerators(), ...this.#e.getNumerators())), this);
2394
2411
  // -----------------------------------------------
2395
2412
  solve = () => new R(this.clone()).solve();
2396
2413
  split() {
2397
2414
  return [this.#t.clone(), this.#e.clone()];
2398
2415
  }
2399
2416
  subtract(t) {
2400
- if (t instanceof v)
2417
+ if (t instanceof x)
2401
2418
  return this.#t.subtract(t.left), this.#e.subtract(t.right), this;
2402
- if (typeof t == "string" && !v.isEquationString(t))
2403
- return this.subtract(new v(t));
2404
- const e = new u(t);
2419
+ if (typeof t == "string" && !x.isEquationString(t))
2420
+ return this.subtract(new x(t));
2421
+ const e = new l(t);
2405
2422
  return this.#t.subtract(e), this.#e.subtract(e), this;
2406
2423
  }
2407
2424
  test = (t) => this.left.evaluate(t).isEqual(this.right.evaluate(t));
@@ -2434,29 +2451,29 @@ class v {
2434
2451
  #r = (t) => t === void 0 ? "=" : t.includes("geq") || t.includes(">=") || t.includes("=>") ? ">=" : t.includes(">") ? ">" : t.includes("leq") || t.includes("<=") || t.includes("=<") ? "<=" : t.includes("<") ? "<" : "=";
2435
2452
  #n = () => this.#i === "=" ? this : this.#i.includes("<") ? (this.#i.replace("<", ">"), this) : this.#i.includes(">") ? (this.#i.replace(">", "<"), this) : this;
2436
2453
  }
2437
- class b {
2454
+ class y {
2438
2455
  #t;
2439
2456
  #e;
2440
2457
  #i;
2441
2458
  #s = !1;
2442
2459
  constructor(t, e) {
2443
- return t instanceof b ? (this.#e = t.polynom.clone(), this.#i = t.power.clone(), e !== void 0 && this.#i.multiply(new h(e))) : t !== void 0 ? (this.#e = new u(t), this.#i = new h(e ?? 1)) : (this.#e = new u(), this.#i = new h(1)), this.#t = 1, this;
2460
+ return t instanceof y ? (this.#e = t.polynom.clone(), this.#i = t.power.clone(), e !== void 0 && this.#i.multiply(new h(e))) : t !== void 0 ? (this.#e = new l(t), this.#i = new h(e ?? 1)) : (this.#e = new l(), this.#i = new h(1)), this.#t = 1, this;
2444
2461
  }
2445
2462
  parse() {
2446
2463
  throw new Error("Method not implemented.");
2447
2464
  }
2448
2465
  clone() {
2449
- return new b(this);
2466
+ return new y(this);
2450
2467
  }
2451
2468
  get tex() {
2452
2469
  const t = this.power.numerator, e = this.power.denominator;
2453
2470
  let i, s;
2454
- return this.#t === 0 && e > 1 ? (i = `\\sqrt${e === 2 ? "" : `[ ${e} ]`}{ ${this.polynom.tex} }`, s = t === 1 ? "" : `^{ ${t} }`) : (i = this.#s && this.power.isOne() ? this.polynom.tex : it(this.polynom.tex), s = e === 1 && t === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${s}`, this.#t === 0 && t < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
2471
+ return this.#t === 0 && e > 1 ? (i = `\\sqrt${e === 2 ? "" : `[ ${e} ]`}{ ${this.polynom.tex} }`, s = t === 1 ? "" : `^{ ${t} }`) : (i = this.#s && this.power.isOne() ? this.polynom.tex : st(this.polynom.tex), s = e === 1 && t === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${s}`, this.#t === 0 && t < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
2455
2472
  }
2456
2473
  get display() {
2457
2474
  const t = this.power.numerator, e = this.power.denominator;
2458
2475
  let i, s;
2459
- return this.#t === 0 && e > 1 ? (i = `${e === 2 ? "sqrt" : `root(${e})`}(${this.polynom.display})`, s = t === 1 ? "" : `^(${t})`) : (i = this.#s && this.power.isOne() ? this.polynom.display : it(this.polynom.display, !1), s = e === 1 && t === 1 ? "" : `^(${this.power.display})`), i = `${i}${s}`, this.#t === 0 && t < 0 && (i = `1/(${i})`), i;
2476
+ return this.#t === 0 && e > 1 ? (i = `${e === 2 ? "sqrt" : `root(${e})`}(${this.polynom.display})`, s = t === 1 ? "" : `^(${t})`) : (i = this.#s && this.power.isOne() ? this.polynom.display : st(this.polynom.display, !1), s = e === 1 && t === 1 ? "" : `^(${this.power.display})`), i = `${i}${s}`, this.#t === 0 && t < 0 && (i = `1/(${i})`), i;
2460
2477
  }
2461
2478
  add() {
2462
2479
  throw new Error("Adding two factors is not possible");
@@ -2468,10 +2485,10 @@ class b {
2468
2485
  return this.polynom.degree(t).multiply(this.power);
2469
2486
  }
2470
2487
  derivative() {
2471
- return this.power.isZero() ? [new b("0")] : this.power.isOne() ? [new b(this.polynom.clone().derivative())] : [
2472
- new b(this.power.clone()),
2473
- new b(this.polynom.clone().derivative()),
2474
- new b(this.polynom.clone(), this.power.clone().subtract(1))
2488
+ return this.power.isZero() ? [new y("0")] : this.power.isOne() ? [new y(this.polynom.clone().derivative())] : [
2489
+ new y(this.power.clone()),
2490
+ new y(this.polynom.clone().derivative()),
2491
+ new y(this.polynom.clone(), this.power.clone().subtract(1))
2475
2492
  ];
2476
2493
  }
2477
2494
  develop() {
@@ -2480,9 +2497,9 @@ class b {
2480
2497
  throw new Error("The power must be a natural number");
2481
2498
  }
2482
2499
  divide(t) {
2483
- if (t instanceof b && this.isSameAs(t))
2500
+ if (t instanceof y && this.isSameAs(t))
2484
2501
  return this.power.subtract(t.power), this;
2485
- const e = new u(t);
2502
+ const e = new l(t);
2486
2503
  if (this.isSameAs(e))
2487
2504
  return this.power.subtract(1), this;
2488
2505
  throw new Error("The two factors must be the same");
@@ -2491,7 +2508,7 @@ class b {
2491
2508
  return e ? this.polynom.evaluate(t, !0) ** this.power.value : this.polynom.evaluate(t).pow(this.power);
2492
2509
  }
2493
2510
  fromPolynom(t) {
2494
- return this.#e = new u(t), this.#i = new h(1), this;
2511
+ return this.#e = new l(t), this.#i = new h(1), this;
2495
2512
  }
2496
2513
  hasVariable(t) {
2497
2514
  return this.polynom.hasVariable(t);
@@ -2507,15 +2524,15 @@ class b {
2507
2524
  }
2508
2525
  isSameAs(t) {
2509
2526
  let e;
2510
- return t instanceof b ? e = t.polynom : t instanceof u ? e = t : e = new u(t), this.polynom.isEqual(e);
2527
+ return t instanceof y ? e = t.polynom : t instanceof l ? e = t : e = new l(t), this.polynom.isEqual(e);
2511
2528
  }
2512
2529
  isZero() {
2513
2530
  return this.polynom.isZero();
2514
2531
  }
2515
2532
  multiply(t) {
2516
- if (t instanceof b && this.isSameAs(t))
2533
+ if (t instanceof y && this.isSameAs(t))
2517
2534
  return this.power.add(t.power), this;
2518
- const e = new u(t);
2535
+ const e = new l(t);
2519
2536
  if (this.isSameAs(e))
2520
2537
  return this.power.add(1), this;
2521
2538
  throw new Error("The two factors must be the same");
@@ -2558,7 +2575,7 @@ class b {
2558
2575
  }
2559
2576
  tableOfSigns() {
2560
2577
  const t = this.power.clone().reduce(), e = this.polynom.tableOfSigns();
2561
- return t.isStrictlyNegative() && (e.signs = j(e.signs, "z", "d")), t.denominator % 2 === 0 ? e.signs = j(e.signs, "-", "h") : t.numerator % 2 === 0 && (e.signs = j(e.signs, "-", "+")), { roots: e.roots, signs: e.signs };
2578
+ return t.isStrictlyNegative() && (e.signs = F(e.signs, "z", "d")), t.denominator % 2 === 0 ? e.signs = F(e.signs, "-", "h") : t.numerator % 2 === 0 && (e.signs = F(e.signs, "-", "+")), { roots: e.roots, signs: e.signs };
2562
2579
  }
2563
2580
  get variables() {
2564
2581
  return this.polynom.variables;
@@ -2572,17 +2589,39 @@ class b {
2572
2589
  zero() {
2573
2590
  return this.#e.zero(), this.#i.one(), this;
2574
2591
  }
2592
+ static checkParseAsFactors(t) {
2593
+ const e = H(t, "+");
2594
+ if (e[0] === "" && e.shift(), e.length > 1) return !1;
2595
+ const i = H(t, "-");
2596
+ return i[0] === "" && i.shift(), !(i.length > 1);
2597
+ }
2598
+ static factorsFromString(t, e = !0) {
2599
+ if (!y.checkParseAsFactors(t))
2600
+ return [new y(t, e ? 1 : -1)];
2601
+ const i = e ? 1 : -1, s = [], r = /\(([^)]+)\)(?:\^(-?[0-9]+(?:\/[0-9]+)?|\(-?[0-9]+(?:\/[0-9]+)?\)))?|([^(]+)/g;
2602
+ for (const o of t.matchAll(r))
2603
+ if (o[1] !== void 0) {
2604
+ const a = (o[2] ?? "1").replace(/[()]/g, "");
2605
+ s.push(
2606
+ new y(
2607
+ new l(o[1]),
2608
+ new h(a).multiply(i)
2609
+ )
2610
+ );
2611
+ } else o[3]?.trim() && s.push(new y(new l(o[3].trim()), new h(i)));
2612
+ return s;
2613
+ }
2575
2614
  }
2576
2615
  var D = /* @__PURE__ */ ((n) => (n[n.ROOT = 0] = "ROOT", n[n.POWER = 1] = "POWER", n))(D || {});
2577
- class z {
2616
+ class P {
2578
2617
  #t;
2579
2618
  // Determine the letters in the linear asSystem, usually ['x', 'y']
2580
2619
  #e;
2581
2620
  constructor(...t) {
2582
2621
  return this.#t = [], this.#e = [], t.length > 0 && this.parse(...t), this;
2583
2622
  }
2584
- parse = (...t) => (this.#t = t.map((e) => new v(e)), this.#i(), this);
2585
- clone = () => new z().parse(...this.#t.map((t) => t.clone()));
2623
+ parse = (...t) => (this.#t = t.map((e) => new x(e)), this.#i(), this);
2624
+ clone = () => new P().parse(...this.#t.map((t) => t.clone()));
2586
2625
  get tex() {
2587
2626
  const t = this.clone().reorder();
2588
2627
  return this.buildTex(t.equations);
@@ -2595,10 +2634,10 @@ class z {
2595
2634
  if (t.some((r) => r.length !== i))
2596
2635
  throw new Error("All rows must have the same number of columns");
2597
2636
  const s = e.split("").splice(0, i - 1);
2598
- return new z(
2637
+ return new P(
2599
2638
  ...t.map((r) => {
2600
- const o = new u(s.join(""), ...r);
2601
- return new v(o, 0);
2639
+ const o = new l(s.join(""), ...r);
2640
+ return new x(o, 0);
2602
2641
  })
2603
2642
  );
2604
2643
  }
@@ -2609,7 +2648,7 @@ class z {
2609
2648
  return `\\left( ${t.map((e) => e.tex).join(" ; ")} \\right)`;
2610
2649
  }
2611
2650
  add(t, e) {
2612
- if (t instanceof z) {
2651
+ if (t instanceof P) {
2613
2652
  const i = t.equations.length;
2614
2653
  if (i !== this.#t.length)
2615
2654
  throw new Error("The number of equations must be the same");
@@ -2618,7 +2657,7 @@ class z {
2618
2657
  } else {
2619
2658
  if (e === void 0 || e < 0 || e >= this.#t.length)
2620
2659
  throw new Error("Index out of range");
2621
- const i = new v(t);
2660
+ const i = new x(t);
2622
2661
  this.#t[e].add(i);
2623
2662
  }
2624
2663
  return this;
@@ -2722,7 +2761,7 @@ class z {
2722
2761
  const e = [], i = this.equations.map((s) => s.left.monomByLetter(t).coefficient.value);
2723
2762
  return i.forEach((s, r) => {
2724
2763
  for (let o = r + 1; o < i.length; o++) {
2725
- const a = x.lcm(s, i[o]), c = s < 0 ? -1 : 1;
2764
+ const a = b.lcm(s, i[o]), c = s < 0 ? -1 : 1;
2726
2765
  e.push([
2727
2766
  {
2728
2767
  id: r,
@@ -2737,7 +2776,7 @@ class z {
2737
2776
  }), e.sort((s, r) => Math.abs(s[0].factor) + Math.abs(s[1].factor) - (Math.abs(r[0].factor) + Math.abs(r[1].factor)));
2738
2777
  }
2739
2778
  subtract(t, e) {
2740
- if (t instanceof z) {
2779
+ if (t instanceof P) {
2741
2780
  const i = t.equations.length;
2742
2781
  if (i !== this.#t.length)
2743
2782
  throw new Error("The number of equations must be the same");
@@ -2746,7 +2785,7 @@ class z {
2746
2785
  } else {
2747
2786
  if (e === void 0 || e < 0 || e >= this.#t.length)
2748
2787
  throw new Error("Index out of range");
2749
- const i = new v(t);
2788
+ const i = new x(t);
2750
2789
  this.#t[e].subtract(i);
2751
2790
  }
2752
2791
  return this;
@@ -2782,7 +2821,7 @@ class z {
2782
2821
  }), e);
2783
2822
  }
2784
2823
  }
2785
- class qt {
2824
+ class $t {
2786
2825
  #t;
2787
2826
  /**
2788
2827
  *
@@ -2791,7 +2830,7 @@ class qt {
2791
2830
  constructor(t) {
2792
2831
  return this.#t = [], t !== void 0 && this.parse(t), this;
2793
2832
  }
2794
- parse = (t) => (this.#t = new G(S.SET).parse(t).rpn, this);
2833
+ parse = (t) => (this.#t = new W(S.SET).parse(t).rpn, this);
2795
2834
  get tex() {
2796
2835
  const t = [];
2797
2836
  for (const e of this.#t)
@@ -2937,7 +2976,7 @@ class N {
2937
2976
  }
2938
2977
  parse(...t) {
2939
2978
  return this.#e = [], t.length === 0 ? this : (t.forEach((e) => {
2940
- e instanceof N ? this.#e.push(...e.factors.map((i) => i.clone())) : this.#e.push(new b(e));
2979
+ e instanceof N ? this.#e.push(...e.factors.map((i) => i.clone())) : this.#e.push(new y(e));
2941
2980
  }), this);
2942
2981
  }
2943
2982
  clone() {
@@ -2962,14 +3001,14 @@ class N {
2962
3001
  static #i(t, e) {
2963
3002
  const i = Z(t), s = Z(e), o = Object.keys(i).filter((a) => Object.hasOwn(s, a)).map((a) => {
2964
3003
  const c = i[a].reduce((m, d) => m.add(d.power), new h("0")), f = s[a].reduce((m, d) => m.add(d.power), new h("0"));
2965
- return new b(a, h.min(c, f));
3004
+ return new y(a, h.min(c, f));
2966
3005
  });
2967
3006
  return new N(...o);
2968
3007
  }
2969
3008
  static #s(t, e) {
2970
3009
  const i = Z(t), s = Z(e), o = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].map((a) => {
2971
3010
  const c = Object.hasOwn(i, a) ? i[a].reduce((m, d) => m.add(d.power), new h("0")) : new h(0), f = Object.hasOwn(s, a) ? s[a].reduce((m, d) => m.add(d.power), new h("0")) : new h(0);
2972
- return new b(a, h.max(c, f));
3011
+ return new y(a, h.max(c, f));
2973
3012
  });
2974
3013
  return new N(...o);
2975
3014
  }
@@ -3000,12 +3039,12 @@ class N {
3000
3039
  c.multiply(a.clone().divide(i[f]));
3001
3040
  }), s = a;
3002
3041
  }
3003
- const r = N.gcd(...e), o = new u(0).add(
3042
+ const r = N.gcd(...e), o = new l(0).add(
3004
3043
  ...e.map((a) => a.divide(r).reduce().develop().factors[0].polynom)
3005
3044
  ).reduce();
3006
3045
  return this.#e = [
3007
3046
  ...r.factors,
3008
- new b(o)
3047
+ new y(o)
3009
3048
  ], s && this.divide(s), this.#e = this.#e.filter((a) => !a.power.isZero()), this;
3010
3049
  }
3011
3050
  get asPower() {
@@ -3035,7 +3074,7 @@ class N {
3035
3074
  return i !== void 0 && (this.#e = i.factors), this.add(...t);
3036
3075
  }
3037
3076
  develop() {
3038
- const t = new u("1"), e = new u("1");
3077
+ const t = new l("1"), e = new l("1");
3039
3078
  return this.numerator.factors.forEach((i) => {
3040
3079
  t.multiply(i.develop());
3041
3080
  }), this.denominator.factors.forEach((i) => {
@@ -3054,7 +3093,7 @@ class N {
3054
3093
  const a = o.polynom.factorize(t);
3055
3094
  if (a.length > 1) {
3056
3095
  const c = o.power.clone();
3057
- e.push(...a.map((f) => new b(f, c)));
3096
+ e.push(...a.map((f) => new y(f, c)));
3058
3097
  } else
3059
3098
  e.push(o.clone());
3060
3099
  });
@@ -3068,16 +3107,24 @@ class N {
3068
3107
  this.#e = t;
3069
3108
  }
3070
3109
  fromPolynom(t, e) {
3071
- if (this.#e = [new b(new u(t))], e) {
3072
- const i = new u(e);
3073
- if (i.isOne())
3074
- return this;
3075
- if (i.isZero())
3076
- throw new Error("Cannot divide by zero");
3077
- this.#e.push(new b(i, -1));
3110
+ if (this.#e = [new y(new l(t))], e) {
3111
+ const i = new l(e);
3112
+ if (i.isOne()) return this;
3113
+ if (i.isZero()) throw new Error("Cannot divide by zero");
3114
+ this.#e.push(new y(i, -1));
3078
3115
  }
3079
3116
  return this;
3080
3117
  }
3118
+ fromString(t) {
3119
+ this.#e = [];
3120
+ const [e, ...i] = H(t, "/");
3121
+ if (e === "") throw new Error("Parsing a PolyFactor from a string requires a numerator");
3122
+ if (i.length > 1) throw new Error('Parsing a PolyFactor from a string only allows max one signe "/"');
3123
+ return i.length === 0 ? this.#e = y.factorsFromString(j(e), !0) : this.#e = [
3124
+ ...y.factorsFromString(j(e), !0),
3125
+ ...y.factorsFromString(j(i[0]), !1)
3126
+ ], this;
3127
+ }
3081
3128
  /**
3082
3129
  * Get the roots of the PolyFactor.
3083
3130
  */
@@ -3117,11 +3164,11 @@ class N {
3117
3164
  return new N(...this.#e.filter((t) => t.power.isPositive()));
3118
3165
  }
3119
3166
  one() {
3120
- return this.#e = [new b("1", "1")], this;
3167
+ return this.#e = [new y("1", "1")], this;
3121
3168
  }
3122
3169
  opposite() {
3123
3170
  const t = this.#e.findIndex((e) => e.display === "(-1)");
3124
- return t >= 0 ? this.#e.splice(t, 1) : this.#e.push(new b("-1", "1")), this;
3171
+ return t >= 0 ? this.#e.splice(t, 1) : this.#e.push(new y("-1", "1")), this;
3125
3172
  }
3126
3173
  pow(t) {
3127
3174
  return this.#e = this.#e.map((e) => e.pow(t)), this;
@@ -3133,7 +3180,7 @@ class N {
3133
3180
  const t = Z(this);
3134
3181
  return this.#e = Object.values(t).map((e) => {
3135
3182
  const i = e[0].polynom, s = e.reduce((r, o) => r.add(o.power), new h("0"));
3136
- return new b(i, s.reduce());
3183
+ return new y(i, s.reduce());
3137
3184
  }).filter((e) => !e.power.isZero()), this;
3138
3185
  }
3139
3186
  root(t) {
@@ -3164,17 +3211,17 @@ class N {
3164
3211
  return this.add(...t.map((e) => e.opposite()));
3165
3212
  }
3166
3213
  tableOfSigns() {
3167
- const t = this.getZeroes(), e = t.map((r) => r.value), i = this.factorize().factors.map((r) => ({ factor: new b(r), ...r.tableOfSigns() }));
3214
+ const t = this.getZeroes(), e = t.map((r) => r.value), i = this.factorize().factors.map((r) => ({ factor: new y(r), ...r.tableOfSigns() }));
3168
3215
  return i.forEach((r) => {
3169
3216
  const o = new Array(2 * t.length + 1).fill("");
3170
3217
  let a = r.signs.shift(), c = r.roots.shift();
3171
3218
  const f = o.map((m, d) => {
3172
3219
  if (d % 2 === 0)
3173
3220
  return a;
3174
- if (c === void 0 || c.value !== e[(d - 1) / 2])
3221
+ if (c?.value !== e[(d - 1) / 2])
3175
3222
  return "t";
3176
- const y = r.signs.shift();
3177
- return a = r.signs.shift(), c = r.roots.shift(), y;
3223
+ const v = r.signs.shift();
3224
+ return a = r.signs.shift(), c = r.roots.shift(), v;
3178
3225
  });
3179
3226
  r.roots = t, r.signs = f;
3180
3227
  }), { signs: i.map((r) => [...r.signs]).reduce((r, o) => r.length === 0 ? o : (o.forEach((a, c) => {
@@ -3198,11 +3245,11 @@ class N {
3198
3245
  return this.#e.reduce((t, e) => t.concat(e.variables), []);
3199
3246
  }
3200
3247
  zero() {
3201
- return this.#e = [new b("0", "1")], this;
3248
+ return this.#e = [new y("0", "1")], this;
3202
3249
  }
3203
3250
  #r() {
3204
3251
  let t, e = [];
3205
- return this.#t === D.ROOT ? (t = this.numerator.factors, e = this.denominator.factors) : t = this.#e, t.length === 0 && (t = [new b("1")]), { num: t, den: e };
3252
+ return this.#t === D.ROOT ? (t = this.numerator.factors, e = this.denominator.factors) : t = this.#e, t.length === 0 && (t = [new y("1")]), { num: t, den: e };
3206
3253
  }
3207
3254
  }
3208
3255
  function Z(n) {
@@ -3212,7 +3259,7 @@ function Z(n) {
3212
3259
  const c = a.polynom.display;
3213
3260
  return Object.hasOwn(o, c) ? o[c].push(a) : o[c] = [a], o;
3214
3261
  }, {}), { numerator: s, denominator: r } = t.divide(e).reduce();
3215
- return s !== 1 && (i[s.toString()] = [new b(s, 1)]), r !== 1 && (i[r.toString()] = [new b(r, -1)]), i;
3262
+ return s !== 1 && (i[s.toString()] = [new y(s, 1)]), r !== 1 && (i[r.toString()] = [new y(r, -1)]), i;
3216
3263
  }
3217
3264
  class B {
3218
3265
  #t = null;
@@ -3277,7 +3324,7 @@ class B {
3277
3324
  }
3278
3325
  characteristic_polynom(t) {
3279
3326
  return t ??= "k", this.clone().subtract(
3280
- new B(this.dimension.rows).one().multiply(new u(t))
3327
+ new B(this.dimension.rows).one().multiply(new l(t))
3281
3328
  ).determinant();
3282
3329
  }
3283
3330
  cofactor(t, e) {
@@ -3287,7 +3334,7 @@ class B {
3287
3334
  }), i.determinant().multiply((-1) ** (t + e));
3288
3335
  }
3289
3336
  get cols() {
3290
- const t = Array.from({ length: this.dimension.cols }, () => Array.from({ length: this.dimension.rows }, () => new u()));
3337
+ const t = Array.from({ length: this.dimension.cols }, () => Array.from({ length: this.dimension.rows }, () => new l()));
3291
3338
  return this.forEach((e, i, s) => {
3292
3339
  t[s][i] = e;
3293
3340
  }), t;
@@ -3295,7 +3342,7 @@ class B {
3295
3342
  determinant() {
3296
3343
  if (!this.isSquare())
3297
3344
  throw new Error("Matrix is not square");
3298
- const t = new u();
3345
+ const t = new l();
3299
3346
  return this.#i.length === 1 ? this.#i[0][0].clone() : (this.values[0].forEach((e, i) => {
3300
3347
  const s = this.cofactor(0, i);
3301
3348
  t.add(e.clone().multiply(s));
@@ -3318,14 +3365,14 @@ class B {
3318
3365
  });
3319
3366
  }
3320
3367
  fromDimensions(t, e) {
3321
- return this.#i = Array.from({ length: t }, () => Array.from({ length: e }, () => new u())), this;
3368
+ return this.#i = Array.from({ length: t }, () => Array.from({ length: e }, () => new l())), this;
3322
3369
  }
3323
3370
  fromString(t) {
3324
3371
  if (t.startsWith("((") && t.endsWith("))"))
3325
3372
  return this.fromString(t.substring(1, t.length - 1));
3326
3373
  const e = t.split("),(");
3327
3374
  return this.#i = e.map((i, s) => s === 0 ? i.substring(1).split(",") : s === e.length - 1 ? i.substring(0, i.length - 1).split(",") : i.split(",")).map(
3328
- (i) => i.map((s) => new u(s))
3375
+ (i) => i.map((s) => new l(s))
3329
3376
  ), this;
3330
3377
  }
3331
3378
  fromValues(t) {
@@ -3336,7 +3383,7 @@ class B {
3336
3383
  return t.forEach((i) => {
3337
3384
  const s = [];
3338
3385
  i.forEach((r) => {
3339
- s.push(new u(r));
3386
+ s.push(new l(r));
3340
3387
  }), this.#i.push(s);
3341
3388
  }), this;
3342
3389
  }
@@ -3347,7 +3394,7 @@ class B {
3347
3394
  throw new Error("Each vectors must be the same dimension");
3348
3395
  return this.fromDimensions(t[0].dimension, t.length), t.forEach((i, s) => {
3349
3396
  i.array.forEach((r, o) => {
3350
- this.#i[o][s] = new u(r);
3397
+ this.#i[o][s] = new l(r);
3351
3398
  });
3352
3399
  }), this;
3353
3400
  }
@@ -3397,7 +3444,7 @@ class B {
3397
3444
  throw new Error("Cannot multiply a matrix with incompatibles dimensions");
3398
3445
  const e = new B(this.dimension.rows, t.dimension.cols);
3399
3446
  return e.forEach((i, s, r) => {
3400
- const o = this.rows[s], a = t.cols[r], c = new u();
3447
+ const o = this.rows[s], a = t.cols[r], c = new l();
3401
3448
  o.forEach((f, m) => {
3402
3449
  c.add(f.clone().multiply(a[m]));
3403
3450
  }), e.setValue(s, r, c);
@@ -3421,7 +3468,7 @@ class B {
3421
3468
  return this.#e = !0, this;
3422
3469
  }
3423
3470
  pow(t) {
3424
- return rt(this, t);
3471
+ return nt(this, t);
3425
3472
  }
3426
3473
  reduce() {
3427
3474
  throw new Error("Not yet implemented");
@@ -3433,7 +3480,7 @@ class B {
3433
3480
  const { rows: s, cols: r } = this.dimension;
3434
3481
  if (t < 0 || t >= s || e < 0 || e >= r)
3435
3482
  throw new Error(`${t}x${e} is out of range (${s}x${r})`);
3436
- return this.#i[t][e] = new u(i), this;
3483
+ return this.#i[t][e] = new l(i), this;
3437
3484
  }
3438
3485
  subtract(t) {
3439
3486
  if (!this.canBeAdded(t))
@@ -3457,12 +3504,12 @@ class B {
3457
3504
  return this.forEach((t) => t.zero()), this;
3458
3505
  }
3459
3506
  }
3460
- function $t(n, t) {
3507
+ function kt(n, t) {
3461
3508
  return n.dimension === t.dimension && n.array.every(
3462
3509
  (e, i) => t.array[i].isEqual(e)
3463
3510
  );
3464
3511
  }
3465
- function kt(n, t) {
3512
+ function Mt(n, t) {
3466
3513
  if (n.dimension !== t.dimension)
3467
3514
  return !1;
3468
3515
  const e = t.array[0].value / n.array[0].value;
@@ -3470,13 +3517,13 @@ function kt(n, t) {
3470
3517
  (i, s) => t.array[s].value === i.value * e
3471
3518
  );
3472
3519
  }
3473
- function Mt(n, t) {
3520
+ function Bt(n, t) {
3474
3521
  return n.dimension !== t.dimension ? new h().invalid() : n.array.reduce(
3475
3522
  (e, i, s) => e.add(i.clone().multiply(t.array[s])),
3476
3523
  new h(0)
3477
3524
  );
3478
3525
  }
3479
- function jt(...n) {
3526
+ function Ft(...n) {
3480
3527
  if (n.some((t) => t.dimension !== n[0].dimension))
3481
3528
  throw new Error("All vectors must have the same dimension");
3482
3529
  if (n[0].dimension !== n.length)
@@ -3489,7 +3536,7 @@ function jt(...n) {
3489
3536
  )
3490
3537
  ).add(n[0].array[2].clone().multiply(n[1].array[0].clone().multiply(n[2].array[1]).subtract(n[1].array[1].clone().multiply(n[2].array[0]))));
3491
3538
  }
3492
- class P {
3539
+ class z {
3493
3540
  #t = [];
3494
3541
  #e;
3495
3542
  constructor(...t) {
@@ -3552,13 +3599,13 @@ class P {
3552
3599
  }
3553
3600
  zero = () => (this.#t.forEach((t) => t.zero()), this.#e?.(), this);
3554
3601
  }
3555
- class w extends P {
3602
+ class w extends z {
3556
3603
  constructor(...t) {
3557
3604
  super(), t.length > 0 && this.parse(...t);
3558
3605
  }
3559
3606
  parse(...t) {
3560
3607
  if (t.length === 1) {
3561
- if (t[0] instanceof P)
3608
+ if (t[0] instanceof z)
3562
3609
  return this.array = t[0].copy(), this;
3563
3610
  if (typeof t[0] == "string")
3564
3611
  return this.fromString(t[0]), this;
@@ -3605,7 +3652,7 @@ class w extends P {
3605
3652
  }), this;
3606
3653
  }
3607
3654
  }
3608
- class g extends P {
3655
+ class g extends z {
3609
3656
  constructor(...t) {
3610
3657
  return super(), t.length > 0 && this.parse(...t), this;
3611
3658
  }
@@ -3615,7 +3662,7 @@ class g extends P {
3615
3662
  if (t.length === 0)
3616
3663
  throw new Error("Invalid value");
3617
3664
  if (t.length === 1) {
3618
- if (t[0] instanceof P)
3665
+ if (t[0] instanceof z)
3619
3666
  return this.array = t[0].copy(), this;
3620
3667
  if (typeof t[0] == "string")
3621
3668
  return this.fromString(t[0]);
@@ -3623,7 +3670,7 @@ class g extends P {
3623
3670
  }
3624
3671
  if (t.length === 2) {
3625
3672
  const [e, i] = t;
3626
- if (e instanceof P && i instanceof P) {
3673
+ if (e instanceof z && i instanceof z) {
3627
3674
  if (e.dimension !== i.dimension)
3628
3675
  throw new Error("Vectors must have the same dimension");
3629
3676
  return this.array = i.array.map((s, r) => s.clone().subtract(e.array[r])), this;
@@ -3663,12 +3710,12 @@ class g extends P {
3663
3710
  // ------------------------------------------
3664
3711
  // Creation / parsing functions
3665
3712
  divideByScalar = (t) => this.multiplyByScalar(new h(t).inverse());
3666
- dot = (t) => Mt(this, t);
3713
+ dot = (t) => Bt(this, t);
3667
3714
  fromString(t) {
3668
3715
  return t.startsWith("((") && t.endsWith("))") ? super.fromString(t.slice(1, -1)) : super.fromString(t);
3669
3716
  }
3670
- isColinearTo = (t) => kt(this, t);
3671
- isEqual = (t) => $t(this, t);
3717
+ isColinearTo = (t) => Mt(this, t);
3718
+ isEqual = (t) => kt(this, t);
3672
3719
  isNormalTo = (t) => this.dot(t).isZero();
3673
3720
  // ------------------------------------------
3674
3721
  get isNull() {
@@ -3699,7 +3746,7 @@ class g extends P {
3699
3746
  one = () => (this.zero(), this.x.one(), this);
3700
3747
  opposite = () => (this.array.forEach((t) => t.opposite()), this);
3701
3748
  simplify = () => {
3702
- const t = x.lcm(...this.array.map((i) => i.denominator)), e = x.gcd(...this.array.map((i) => i.numerator));
3749
+ const t = b.lcm(...this.array.map((i) => i.denominator)), e = b.gcd(...this.array.map((i) => i.numerator));
3703
3750
  return this.multiplyByScalar(new h(t, e)), this.x.isNegative() && this.opposite(), this;
3704
3751
  };
3705
3752
  subtract = (t) => this.add(t.clone().opposite());
@@ -3711,8 +3758,8 @@ class g extends P {
3711
3758
  return t === 0 ? this : this.divideByScalar(t);
3712
3759
  };
3713
3760
  }
3714
- var V = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(V || {}), H = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(H || {});
3715
- function nt(n = 0.5) {
3761
+ var V = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(V || {}), K = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(K || {});
3762
+ function ot(n = 0.5) {
3716
3763
  return Math.random() < n;
3717
3764
  }
3718
3765
  function O(n, t, e) {
@@ -3730,23 +3777,23 @@ function O(n, t, e) {
3730
3777
  return i;
3731
3778
  }
3732
3779
  function A(n, t) {
3733
- return t === !1 ? nt() ? O(1, n) : -O(1, n) : O(-n, n);
3780
+ return t === !1 ? ot() ? O(1, n) : -O(1, n) : O(-n, n);
3734
3781
  }
3735
- function Bt(n, t) {
3736
- const e = x.pythagoreanTripletsWithTarget(n).filter((i) => t === !0 || !i.includes(0));
3737
- return e.length === 0 ? null : W(e);
3782
+ function St(n, t) {
3783
+ const e = b.pythagoreanTripletsWithTarget(n).filter((i) => t === !0 || !i.includes(0));
3784
+ return e.length === 0 ? null : X(e);
3738
3785
  }
3739
- function St(n) {
3740
- let t = x.primes();
3741
- return n !== void 0 && (t = t.filter((e) => e < n)), W(t);
3786
+ function It(n) {
3787
+ let t = b.primes();
3788
+ return n !== void 0 && (t = t.filter((e) => e < n)), X(t);
3742
3789
  }
3743
- function It(n, t) {
3744
- return t === void 0 && (t = 1), n.length <= 0 ? Object.values(n) : ot(n).slice(0, t);
3790
+ function Pt(n, t) {
3791
+ return t === void 0 && (t = 1), n.length <= 0 ? Object.values(n) : ht(n).slice(0, t);
3745
3792
  }
3746
- function W(n) {
3793
+ function X(n) {
3747
3794
  return n.length === 0 ? null : n[O(0, n.length - 1)];
3748
3795
  }
3749
- function ot(n) {
3796
+ function ht(n) {
3750
3797
  const t = Object.values(n);
3751
3798
  for (let e = t.length - 1; e > 0; e--) {
3752
3799
  const i = Math.floor(Math.random() * (e + 1)), s = t[e];
@@ -3786,11 +3833,11 @@ class E {
3786
3833
  if (t.length === 1) {
3787
3834
  if (t[0] instanceof E)
3788
3835
  return this.fromCoefficient(t[0].a, t[0].b, t[0].c);
3789
- if (t[0] instanceof v)
3836
+ if (t[0] instanceof x)
3790
3837
  return this.fromEquation(t[0]);
3791
3838
  if (typeof t[0] == "string")
3792
3839
  try {
3793
- const e = new v(t[0]);
3840
+ const e = new x(t[0]);
3794
3841
  return this.parse(e);
3795
3842
  } catch (e) {
3796
3843
  return console.warn(e), this;
@@ -3817,13 +3864,13 @@ class E {
3817
3864
  case 0:
3818
3865
  return this.getEquation().reorder().tex;
3819
3866
  case 2:
3820
- return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new u().parse("x", this.slope, this.height).tex;
3867
+ return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new l().parse("x", this.slope, this.height).tex;
3821
3868
  case 3:
3822
3869
  case 4: {
3823
3870
  const e = this.d.clone().simplify();
3824
3871
  return t === 3 ? `${g.asTex("x", "y")} = ${g.asTex(this.#t.x.tex, this.#t.y.tex)} + k\\cdot ${g.asTex(e.x.tex, e.y.tex)}` : `\\left\\{\\begin{aligned}
3825
- x &= ${new u(this.#t.x).add(new p(e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3826
- y &= ${new u(this.#t.y).add(new p(e.y).multiply(new p("k"))).reorder("k", !0).tex}
3872
+ x &= ${new l(this.#t.x).add(new p(e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3873
+ y &= ${new l(this.#t.y).add(new p(e.y).multiply(new p("k"))).reorder("k", !0).tex}
3827
3874
  \\end{aligned}\\right.`;
3828
3875
  }
3829
3876
  default: {
@@ -3838,13 +3885,13 @@ class E {
3838
3885
  case 0:
3839
3886
  return this.getEquation().reorder().display;
3840
3887
  case 2:
3841
- return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new u().parse("x", this.slope, this.height).display;
3888
+ return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new l().parse("x", this.slope, this.height).display;
3842
3889
  case 3: {
3843
3890
  const e = this.d.clone().simplify();
3844
3891
  return `((x,y))=((${this.#t.x.display},${this.#t.y.display}))+k((${e.x.display},${e.y.display}))`;
3845
3892
  }
3846
3893
  case 4: {
3847
- const e = this.d.clone().simplify(), i = new u(this.#t.x).add(new p(e.x).multiply(new p("k"))).reorder("k", !0), s = new u(this.#t.y).add(new p(e.y).multiply(new p("k"))).reorder("k", !0);
3894
+ const e = this.d.clone().simplify(), i = new l(this.#t.x).add(new p(e.x).multiply(new p("k"))).reorder("k", !0), s = new l(this.#t.y).add(new p(e.y).multiply(new p("k"))).reorder("k", !0);
3848
3895
  return `{(x,=,${i.display}),(y,=,${s.display}):}`;
3849
3896
  }
3850
3897
  default: {
@@ -3913,7 +3960,7 @@ class E {
3913
3960
  }
3914
3961
  fromCoefficient(t, e, i) {
3915
3962
  this.#e = new h(t), this.#i = new h(e), this.#s = new h(i);
3916
- const s = [this.#e, this.#i, this.#s].every((o) => o.exact) ? x.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator) : 1;
3963
+ const s = [this.#e, this.#i, this.#s].every((o) => o.exact) ? b.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator) : 1;
3917
3964
  if (s > 1 && (this.#e.multiply(s).reduce(), this.#i.multiply(s).reduce(), this.#s.multiply(s).reduce()), this.#i.isZero())
3918
3965
  return this.#t = new g(this.#s.clone().divide(this.#e).opposite(), 0), this;
3919
3966
  for (let o = 0; o < this.#i.value; o++) {
@@ -3961,15 +4008,15 @@ class E {
3961
4008
  }
3962
4009
  // ------------------------------------------
3963
4010
  getEquation() {
3964
- return new v(new u().parse("xy", this.#e, this.#i, this.#s), new u("0")).simplify();
4011
+ return new x(new l().parse("xy", this.#e, this.#i, this.#s), new l("0")).simplify();
3965
4012
  }
3966
4013
  getValueAtX = (t) => {
3967
4014
  const e = this.getEquation().isolate("y"), i = new h(t);
3968
- return e instanceof v ? e.right.evaluate({ x: i }) : new h().invalid();
4015
+ return e instanceof x ? e.right.evaluate({ x: i }) : new h().invalid();
3969
4016
  };
3970
4017
  getValueAtY = (t) => {
3971
4018
  const e = this.getEquation().isolate("x"), i = new h(t);
3972
- return e instanceof v ? e.right.evaluate({ y: i }) : new h().invalid();
4019
+ return e instanceof x ? e.right.evaluate({ y: i }) : new h().invalid();
3973
4020
  };
3974
4021
  get height() {
3975
4022
  return this.#s.clone().opposite().divide(this.#i);
@@ -4021,7 +4068,7 @@ class E {
4021
4068
  return new w(e);
4022
4069
  };
4023
4070
  simplify = () => {
4024
- const t = x.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator), e = x.gcd(this.#e.numerator, this.#i.numerator, this.#s.numerator);
4071
+ const t = b.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator), e = b.gcd(this.#e.numerator, this.#i.numerator, this.#s.numerator);
4025
4072
  return this.fromCoefficient(
4026
4073
  this.#e.clone().multiply(t).divide(e),
4027
4074
  this.#i.clone().multiply(t).divide(e),
@@ -4264,7 +4311,7 @@ class L {
4264
4311
  }
4265
4312
  #c(t, e, i) {
4266
4313
  const s = (e ** 2 + i ** 2 - t ** 2) / (2 * e * i);
4267
- return this.#n ? Math.acos(s) : x.numberCorrection(Math.acos(s) * 180 / Math.PI);
4314
+ return this.#n ? Math.acos(s) : b.numberCorrection(Math.acos(s) * 180 / Math.PI);
4268
4315
  }
4269
4316
  /**
4270
4317
  * Get the Point class for the given name
@@ -4300,7 +4347,7 @@ class U {
4300
4347
  t.length > 0 && this.parse(...t);
4301
4348
  }
4302
4349
  parse(...t) {
4303
- return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof v ? this.fromEquation(t[0]) : t[0] instanceof U ? this.copy(t[0]) : t.length === 2 && t[0] instanceof w && t[1] instanceof w ? this.fromCenterPoint(t[0], t[1]) : t.length >= 2 && t[0] instanceof w && (t[1] instanceof h || typeof t[1] == "number") ? this.fromCenterRadius(
4350
+ return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof x ? this.fromEquation(t[0]) : t[0] instanceof U ? this.copy(t[0]) : t.length === 2 && t[0] instanceof w && t[1] instanceof w ? this.fromCenterPoint(t[0], t[1]) : t.length >= 2 && t[0] instanceof w && (t[1] instanceof h || typeof t[1] == "number") ? this.fromCenterRadius(
4304
4351
  t[0],
4305
4352
  t[1],
4306
4353
  typeof t[2] == "boolean" ? t[2] : !1
@@ -4338,7 +4385,7 @@ class U {
4338
4385
  return this.#t ?? new w();
4339
4386
  }
4340
4387
  get equation() {
4341
- return this.#e?.clone() ?? new v("0=0");
4388
+ return this.#e?.clone() ?? new x("0=0");
4342
4389
  }
4343
4390
  fromCenterPoint(t, e) {
4344
4391
  return this.#t = t.clone(), this.#s = new g(this.#t, e).normSquare, this.#r(), this;
@@ -4367,10 +4414,10 @@ class U {
4367
4414
  );
4368
4415
  }
4369
4416
  fromString(t) {
4370
- return this.fromEquation(new v(t));
4417
+ return this.fromEquation(new x(t));
4371
4418
  }
4372
4419
  getPointsOnCircle() {
4373
- const t = x.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), e = [];
4420
+ const t = b.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), e = [];
4374
4421
  return t.forEach((i) => {
4375
4422
  for (const s of [[1, 1], [-1, 1], [-1, -1], [1, -1]]) {
4376
4423
  const r = this.center.x.clone().add(s[0] * i[0]), o = this.center.y.clone().add(s[1] * i[1]);
@@ -4401,7 +4448,7 @@ class U {
4401
4448
  return [
4402
4449
  new w(f.x, f.y),
4403
4450
  new w(m.x, m.y)
4404
- ].sort((d, y) => i.x.isZero() ? i.y.isPositive() ? d.y.value - y.y.value : y.y.value - d.y.value : i.x.isPositive() ? d.x.value - y.x.value : y.x.value - d.x.value);
4451
+ ].sort((d, v) => i.x.isZero() ? i.y.isPositive() ? d.y.value - v.y.value : v.y.value - d.y.value : i.x.isPositive() ? d.x.value - v.x.value : v.x.value - d.x.value);
4405
4452
  }
4406
4453
  get radius() {
4407
4454
  return new T().from(2, this.#s ?? 0);
@@ -4425,9 +4472,9 @@ class U {
4425
4472
  }
4426
4473
  tangents = (t) => t instanceof h ? this.#c(t) : this.isPointOnCircle(t) ? this.#o(t) : this.#t !== null && this.#t.distanceTo(t).value > this.radius.value ? this.#a(t) : [];
4427
4474
  #r() {
4428
- this.#e = new v(
4429
- new u(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
4430
- new u(this.squareRadius.display)
4475
+ this.#e = new x(
4476
+ new l(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
4477
+ new l(this.squareRadius.display)
4431
4478
  ).moveLeft();
4432
4479
  }
4433
4480
  #n() {
@@ -4438,10 +4485,10 @@ class U {
4438
4485
  return [new E().fromPointAndNormal(t, e)];
4439
4486
  };
4440
4487
  #a = (t) => {
4441
- const e = this.center.x.clone().subtract(t.x), i = this.center.y.clone().subtract(t.y), s = new u("x"), r = new u("x^2+1");
4442
- return s.multiply(e).subtract(i).pow(2), r.multiply(this.squareRadius), new v(s, r).solve().map((c) => {
4488
+ const e = this.center.x.clone().subtract(t.x), i = this.center.y.clone().subtract(t.y), s = new l("x"), r = new l("x^2+1");
4489
+ return s.multiply(e).subtract(i).pow(2), r.multiply(this.squareRadius), new x(s, r).solve().map((c) => {
4443
4490
  let f;
4444
- const m = new v("y", "x");
4491
+ const m = new x("y", "x");
4445
4492
  return c.exact ? (f = t.x.clone().opposite().multiply(c.fraction).add(t.y), m.right.multiply(c.fraction).add(f)) : (f = t.x.clone().opposite().multiply(c.value).add(t.y), m.right.multiply(c.value).add(f)), new E(m);
4446
4493
  });
4447
4494
  };
@@ -4450,10 +4497,10 @@ class U {
4450
4497
  return [new E(e, i, a), new E(e, i, c)];
4451
4498
  };
4452
4499
  }
4453
- class X {
4454
- static PARALLEL = H.Parallel;
4500
+ class Y {
4501
+ static PARALLEL = K.Parallel;
4455
4502
  // A line is defined as the canonical form
4456
- static PERPENDICULAR = H.Perpendicular;
4503
+ static PERPENDICULAR = K.Perpendicular;
4457
4504
  // ax + by + c = 0
4458
4505
  #t = new w();
4459
4506
  #e = new g();
@@ -4465,11 +4512,11 @@ class X {
4465
4512
  return {
4466
4513
  parametric: `${g.asTex("x", "y", "z")} = ${g.asTex(this.#t.x.tex, this.#t.y.tex, this.#t.z.tex)} + k\\cdot ${g.asTex(this.#e.x.tex, this.#e.y.tex, this.#e.z.tex)}`,
4467
4514
  system: `\\left\\{\\begin{aligned}
4468
- x &= ${new u(this.#t.x).add(new p(this.#e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
4469
- y &= ${new u(this.#t.y).add(new p(this.#e.y).multiply(new p("k"))).reorder("k", !0).tex}\\\\
4470
- z &= ${new u(this.#t.z).add(new p(this.#e.z).multiply(new p("k"))).reorder("k", !0).tex}
4515
+ x &= ${new l(this.#t.x).add(new p(this.#e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
4516
+ y &= ${new l(this.#t.y).add(new p(this.#e.y).multiply(new p("k"))).reorder("k", !0).tex}\\\\
4517
+ z &= ${new l(this.#t.z).add(new p(this.#e.z).multiply(new p("k"))).reorder("k", !0).tex}
4471
4518
  \\end{aligned}\\right.`,
4472
- cartesian: `\\frac{ ${new u("x", 1, this.#t.x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new u("y", 1, this.#t.y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new u("z", 1, this.#t.z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
4519
+ cartesian: `\\frac{ ${new l("x", 1, this.#t.x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new l("y", 1, this.#t.y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new l("z", 1, this.#t.z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
4473
4520
  };
4474
4521
  }
4475
4522
  get display() {
@@ -4507,7 +4554,7 @@ class X {
4507
4554
  // Mathematical operations
4508
4555
  hitSegment(t, e) {
4509
4556
  const i = this.intersection(
4510
- new X(t, e)
4557
+ new Y(t, e)
4511
4558
  );
4512
4559
  return i.hasIntersection ? i.point.x.value >= Math.min(t.x.value, e.x.value) && i.point.x.value <= Math.max(t.x.value, e.x.value) && i.point.y.value >= Math.min(t.y.value, e.y.value) && i.point.y.value <= Math.max(t.y.value, e.y.value) && i.point.z.value >= Math.min(t.z.value, e.z.value) && i.point.z.value <= Math.max(t.z.value, e.z.value) : !1;
4513
4560
  }
@@ -4559,7 +4606,7 @@ class X {
4559
4606
  throw new Error("Method not implemented.");
4560
4607
  };
4561
4608
  }
4562
- class tt {
4609
+ class et {
4563
4610
  #t = new g(0, 0, 1);
4564
4611
  #e = new w(0, 0, 0);
4565
4612
  constructor(t) {
@@ -4593,22 +4640,22 @@ class tt {
4593
4640
  }
4594
4641
  }
4595
4642
  get tex() {
4596
- return new v(
4597
- new u("xyz", this.a, this.b, this.c, this.d),
4598
- new u(0)
4643
+ return new x(
4644
+ new l("xyz", this.a, this.b, this.c, this.d),
4645
+ new l(0)
4599
4646
  ).reduce().tex;
4600
4647
  }
4601
4648
  get display() {
4602
- return new v(
4603
- new u("xyz", this.a, this.b, this.c, this.d),
4604
- new u(0)
4649
+ return new x(
4650
+ new l("xyz", this.a, this.b, this.c, this.d),
4651
+ new l(0)
4605
4652
  ).reduce().display;
4606
4653
  }
4607
4654
  get a() {
4608
4655
  return this.#t.x;
4609
4656
  }
4610
4657
  angle(t, e, i) {
4611
- if (t instanceof tt)
4658
+ if (t instanceof et)
4612
4659
  return this.normal.angle(t.normal, e, i);
4613
4660
  let s;
4614
4661
  if (t instanceof g) {
@@ -4656,7 +4703,7 @@ class tt {
4656
4703
  this.#e = new w(t);
4657
4704
  }
4658
4705
  }
4659
- var ht = /* @__PURE__ */ ((n) => (n[n.INTERIOR = 0] = "INTERIOR", n[n.EXTERIOR = 1] = "EXTERIOR", n[n.SECANT = 2] = "SECANT", n[n.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", n[n.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", n[n.SUPERPOSED = 5] = "SUPERPOSED", n[n.CONCENTRIC = 6] = "CONCENTRIC", n))(ht || {});
4706
+ var at = /* @__PURE__ */ ((n) => (n[n.INTERIOR = 0] = "INTERIOR", n[n.EXTERIOR = 1] = "EXTERIOR", n[n.SECANT = 2] = "SECANT", n[n.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", n[n.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", n[n.SUPERPOSED = 5] = "SUPERPOSED", n[n.CONCENTRIC = 6] = "CONCENTRIC", n))(at || {});
4660
4707
  class zt {
4661
4708
  #t = void 0;
4662
4709
  #e = void 0;
@@ -4666,7 +4713,7 @@ class zt {
4666
4713
  return t && e && (this.#t = t, this.#e = new h(e).clone().pow(2), this.#n()), this;
4667
4714
  }
4668
4715
  fromEquation(t) {
4669
- const e = new v(t).moveLeft().reduce(), i = ["x", "y", "z"];
4716
+ const e = new x(t).moveLeft().reduce(), i = ["x", "y", "z"];
4670
4717
  if (i.some((r) => e.degree(r).value !== 2))
4671
4718
  return this.makeUndefined();
4672
4719
  const s = e.left.monomByDegree(2, "x").coefficient;
@@ -4729,7 +4776,7 @@ class zt {
4729
4776
  if (this.center[s].isZero())
4730
4777
  e.push(`${s}^2`);
4731
4778
  else {
4732
- const r = new u(s).subtract(this.center[s]);
4779
+ const r = new l(s).subtract(this.center[s]);
4733
4780
  e.push(
4734
4781
  t ? `\\(${r.tex}\\)^2` : `(${r.display})^2`
4735
4782
  );
@@ -4737,16 +4784,16 @@ class zt {
4737
4784
  }), e.join("+") + "=" + (t ? this.squareRadius.tex : this.squareRadius.display);
4738
4785
  };
4739
4786
  #n() {
4740
- this.#i = new v(
4741
- new u("x").subtract(this.center.x).pow(2).add(
4742
- new u("y").subtract(this.center.y).pow(2)
4787
+ this.#i = new x(
4788
+ new l("x").subtract(this.center.x).pow(2).add(
4789
+ new l("y").subtract(this.center.y).pow(2)
4743
4790
  ).add(
4744
- new u("z").subtract(this.center.z).pow(2)
4791
+ new l("z").subtract(this.center.z).pow(2)
4745
4792
  ),
4746
- new u(this.squareRadius)
4793
+ new l(this.squareRadius)
4747
4794
  ).reduce();
4748
4795
  }
4749
- static RELATIVE_POSITION = ht;
4796
+ static RELATIVE_POSITION = at;
4750
4797
  relativePosition = (t) => {
4751
4798
  const e = this.center.distanceTo(t.center).value, i = this.radius.value, s = t.radius.value;
4752
4799
  return e > i + s ? 1 : e === i + s ? 4 : e === 0 ? i === s ? 5 : 6 : e === Math.abs(i - s) ? 3 : e < Math.abs(i - s) ? 0 : 2;
@@ -4757,7 +4804,7 @@ class zt {
4757
4804
  z: t.z
4758
4805
  }) ?? !1;
4759
4806
  }
4760
- function F(n) {
4807
+ function G(n) {
4761
4808
  const t = Object.assign(
4762
4809
  {
4763
4810
  negative: !0,
@@ -4777,7 +4824,7 @@ function F(n) {
4777
4824
  }
4778
4825
  return t.reduced ? e.reduce() : e;
4779
4826
  }
4780
- function at(n) {
4827
+ function ct(n) {
4781
4828
  const t = Object.assign(
4782
4829
  {
4783
4830
  letters: "x",
@@ -4787,7 +4834,7 @@ function at(n) {
4787
4834
  },
4788
4835
  n
4789
4836
  ), e = new p();
4790
- if (e.coefficient = F({
4837
+ if (e.coefficient = G({
4791
4838
  zero: t.zero,
4792
4839
  reduced: !0,
4793
4840
  natural: !t.fraction
@@ -4795,14 +4842,14 @@ function at(n) {
4795
4842
  for (const i of t.letters.split(""))
4796
4843
  e.setLetter(i, 0);
4797
4844
  for (let i = 0; i < t.degree; i++) {
4798
- const s = W(t.letters.split(""));
4845
+ const s = X(t.letters.split(""));
4799
4846
  e.setLetter(s, e.degree(s).clone().add(1));
4800
4847
  }
4801
4848
  } else
4802
4849
  e.setLetter(t.letters, t.degree);
4803
4850
  return e;
4804
4851
  }
4805
- const ct = {
4852
+ const lt = {
4806
4853
  letters: "x",
4807
4854
  degree: 2,
4808
4855
  fraction: !1,
@@ -4814,18 +4861,18 @@ const ct = {
4814
4861
  commonConstant: !1,
4815
4862
  positive: !0
4816
4863
  };
4817
- function et(n) {
4864
+ function it(n) {
4818
4865
  const t = Object.assign(
4819
4866
  {},
4820
- ct,
4867
+ lt,
4821
4868
  n
4822
4869
  );
4823
- if (t.factorable) return Pt(t);
4824
- const e = new u().empty();
4870
+ if (t.factorable) return Rt(t);
4871
+ const e = new l().empty();
4825
4872
  let i;
4826
4873
  const s = t.degree ?? 2;
4827
4874
  for (let r = s; r >= 0; r--)
4828
- i = at({
4875
+ i = ct({
4829
4876
  letters: t.letters,
4830
4877
  degree: r,
4831
4878
  fraction: t.fraction,
@@ -4838,22 +4885,22 @@ function et(n) {
4838
4885
  }
4839
4886
  return e.reduce();
4840
4887
  }
4841
- function Pt(n) {
4888
+ function Rt(n) {
4842
4889
  const t = Object.assign(
4843
- ct,
4890
+ lt,
4844
4891
  n
4845
4892
  ), e = { ...t };
4846
4893
  e.degree = 1, e.factorable = !1;
4847
4894
  const i = [], s = t.degree ?? 2;
4848
4895
  for (; i.length < s; )
4849
- i.push(et(e));
4896
+ i.push(it(e));
4850
4897
  if (n?.commonConstant !== !1) {
4851
4898
  let r = A(10, !1);
4852
- n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= O(2, 5)), r !== 1 && r !== -1 && i.unshift(new u(r));
4899
+ n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= O(2, 5)), r !== 1 && r !== -1 && i.unshift(new l(r));
4853
4900
  }
4854
- return u.xMultiply(...i);
4901
+ return l.xMultiply(...i);
4855
4902
  }
4856
- function Rt(n) {
4903
+ function Zt(n) {
4857
4904
  const t = Object.assign(
4858
4905
  {
4859
4906
  letters: "x",
@@ -4873,9 +4920,9 @@ function Rt(n) {
4873
4920
  }
4874
4921
  },
4875
4922
  n
4876
- ), e = new u().one();
4923
+ ), e = new l().one();
4877
4924
  for (let i = 0; i < t.degree; i++) {
4878
- const s = et({
4925
+ const s = it({
4879
4926
  degree: 1,
4880
4927
  unit: t.unit,
4881
4928
  fraction: t.fraction,
@@ -4884,9 +4931,9 @@ function Rt(n) {
4884
4931
  });
4885
4932
  e.multiply(s);
4886
4933
  }
4887
- return new v(e, 0);
4934
+ return new x(e, 0);
4888
4935
  }
4889
- function K(n) {
4936
+ function J(n) {
4890
4937
  const t = Object.assign(
4891
4938
  {
4892
4939
  axis: !0,
@@ -4895,10 +4942,10 @@ function K(n) {
4895
4942
  quadrant: null
4896
4943
  },
4897
4944
  n
4898
- ), e = t.axis === "x", i = t.axis === "y", s = t.fraction ? F({ max: t.max, zero: e }) : new h(A(t.max, e)), r = t.fraction ? F({ max: t.max, zero: i }) : new h(A(t.max, i));
4945
+ ), e = t.axis === "x", i = t.axis === "y", s = t.fraction ? G({ max: t.max, zero: e }) : new h(A(t.max, e)), r = t.fraction ? G({ max: t.max, zero: i }) : new h(A(t.max, i));
4899
4946
  return Number(t.quadrant) === 1 && (s.abs(), r.abs()), Number(t.quadrant) === 2 && (s.isPositive() && s.opposite(), r.isNegative() && r.opposite()), Number(t.quadrant) === 3 && (s.isPositive() && s.opposite(), r.isPositive() && r.opposite()), Number(t.quadrant) === 4 && (s.isNegative() && s.opposite(), r.isPositive() && r.opposite()), new w(s, r);
4900
4947
  }
4901
- function Zt(n) {
4948
+ function Dt(n) {
4902
4949
  const t = Object.assign(
4903
4950
  {
4904
4951
  center: {
@@ -4908,11 +4955,11 @@ function Zt(n) {
4908
4955
  pointsOnCircle: 8
4909
4956
  },
4910
4957
  n
4911
- ), e = K(t.center);
4958
+ ), e = J(t.center);
4912
4959
  let i, s;
4913
4960
  return t.pointsOnCircle === 8 ? (i = O(1, 3), s = i ** 2 + (i + 1) ** 2) : s = O(1, 20), new U(e, s, !0);
4914
4961
  }
4915
- function Dt(n) {
4962
+ function Vt(n) {
4916
4963
  const t = Object.assign(
4917
4964
  {
4918
4965
  A: {
@@ -4926,7 +4973,7 @@ function Dt(n) {
4926
4973
  e.x = A(10, t.allow?.vertical ?? !0), e.y = A(10, t.allow?.horizontal ?? !0);
4927
4974
  return t.slope === 1 ? e.x.sign() !== e.y.sign() && e.y.opposite() : t.slope === -1 && e.x.sign() !== e.y.sign() && e.y.opposite(), new E().fromPointAndDirection(new g(t.A.x, t.A.y), e);
4928
4975
  }
4929
- function Vt(n) {
4976
+ function Lt(n) {
4930
4977
  const t = Object.assign(
4931
4978
  {
4932
4979
  A: {
@@ -4942,83 +4989,83 @@ function Vt(n) {
4942
4989
  },
4943
4990
  n
4944
4991
  ), e = new w(t.A.x, t.A.y, t.A.z), i = new g(t.direction.x, t.direction.y, t.direction.z);
4945
- return new X(e, i);
4992
+ return new Y(e, i);
4946
4993
  }
4947
- const Lt = {
4948
- equation: (n) => Rt(n),
4949
- polynom: (n) => et(n),
4950
- monom: (n) => at(n),
4951
- fraction: (n) => F(n),
4994
+ const Ut = {
4995
+ equation: (n) => Zt(n),
4996
+ polynom: (n) => it(n),
4997
+ monom: (n) => ct(n),
4998
+ fraction: (n) => G(n),
4952
4999
  number: (n, t, e) => O(n, t, e),
4953
5000
  numberSym: (n, t) => A(n, t),
4954
- prime: (n) => St(n),
4955
- triplet: (n, t) => Bt(n, t),
4956
- bool: (n) => nt(n),
4957
- array: (n, t) => It(n, t),
4958
- item: (n) => W(n),
4959
- shuffle: (n) => ot(n),
4960
- line: (n) => Dt(n),
4961
- line3: (n) => Vt(n),
4962
- vector: (n) => K(n),
4963
- point: (n) => new w(K(n)),
4964
- circle: (n) => Zt(n)
4965
- }, Ft = {
4966
- Numeric: x,
5001
+ prime: (n) => It(n),
5002
+ triplet: (n, t) => St(n, t),
5003
+ bool: (n) => ot(n),
5004
+ array: (n, t) => Pt(n, t),
5005
+ item: (n) => X(n),
5006
+ shuffle: (n) => ht(n),
5007
+ line: (n) => Vt(n),
5008
+ line3: (n) => Lt(n),
5009
+ vector: (n) => J(n),
5010
+ point: (n) => new w(J(n)),
5011
+ circle: (n) => Dt(n)
5012
+ }, Gt = {
5013
+ Numeric: b,
4967
5014
  Fraction: h,
4968
5015
  Root: T,
4969
5016
  Monom: p,
4970
- Polynom: u,
4971
- Equation: v,
5017
+ Polynom: l,
5018
+ Equation: x,
4972
5019
  Matrix: B,
4973
- LinearSystem: z,
4974
- Factor: b,
5020
+ LinearSystem: P,
5021
+ Factor: y,
4975
5022
  PolyFactor: N,
4976
- LogicalSet: qt,
4977
- Random: Lt,
5023
+ LogicalSet: $t,
5024
+ Random: Ut,
4978
5025
  Geometry: {
4979
5026
  Vector: g,
4980
5027
  Point: w,
4981
5028
  Line: E,
4982
5029
  Triangle: L,
4983
5030
  Circle: U,
4984
- Line3: X,
4985
- Plane3: tt,
5031
+ Line3: Y,
5032
+ Plane3: et,
4986
5033
  Sphere3: zt
4987
5034
  },
4988
- NumExp: Ct
5035
+ NumExp: qt
4989
5036
  };
4990
5037
  export {
4991
5038
  U as Circle,
4992
- v as Equation,
5039
+ x as Equation,
4993
5040
  R as EquationSolver,
4994
5041
  D as FACTOR_DISPLAY,
4995
- xt as FRAC_TYPE,
4996
- b as Factor,
5042
+ bt as FRAC_TYPE,
5043
+ y as Factor,
4997
5044
  h as Fraction,
4998
5045
  E as Line,
4999
- X as Line3,
5000
- z as LinearSystem,
5001
- qt as LogicalSet,
5046
+ Y as Line3,
5047
+ P as LinearSystem,
5048
+ $t as LogicalSet,
5002
5049
  B as Matrix,
5003
5050
  p as Monom,
5004
- Ct as NumExp,
5005
- x as Numeric,
5006
- tt as Plane3,
5051
+ qt as NumExp,
5052
+ b as Numeric,
5053
+ et as Plane3,
5007
5054
  w as Point,
5008
5055
  N as PolyFactor,
5009
- u as Polynom,
5010
- Lt as Random,
5056
+ l as Polynom,
5057
+ Ut as Random,
5011
5058
  T as Root,
5012
- ht as SPHERE3_RELATIVE_POSITION,
5059
+ at as SPHERE3_RELATIVE_POSITION,
5013
5060
  C as Solution,
5014
5061
  zt as Sphere3,
5015
- Ut as TableOfSigns,
5062
+ jt as TableOfSigns,
5016
5063
  L as Triangle,
5017
5064
  g as Vector,
5018
- kt as areVectorsColinears,
5019
- $t as areVectorsEquals,
5020
- Ft as default,
5021
- jt as determinantFromVectors,
5022
- Mt as dotProduct
5065
+ Mt as areVectorsColinears,
5066
+ kt as areVectorsEquals,
5067
+ Gt as default,
5068
+ Ft as determinantFromVectors,
5069
+ Bt as dotProduct
5023
5070
  };
5024
5071
  //# sourceMappingURL=pimath.js.map